diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-08-02 09:35:07 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-08-02 12:03:13 +0200 |
commit | ce64ab3c4a8cbd633b91e2313b82d8b4f309cff8 (patch) | |
tree | 017cf77b721516678e2f87a38790c37ded76dba2 /dbaccess | |
parent | 6d482d0ac21249d4d4987cda1bfe51f967c36dc8 (diff) |
weld OGeneralSpecialJDBCConnectionPageSetup
Change-Id: Ie4c2a34127a79d290105f0f032b4edf22d5871cd
Reviewed-on: https://gerrit.libreoffice.org/76838
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx | 142 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx | 38 | ||||
-rw-r--r-- | dbaccess/uiconfig/ui/specialjdbcconnectionpage.ui | 20 |
3 files changed, 95 insertions, 105 deletions
diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx index c8a57500875e..51c5dcf36dbb 100644 --- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx +++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx @@ -371,38 +371,36 @@ using namespace ::com::sun::star; } // OMySQLJDBCConnectionPageSetup - OGeneralSpecialJDBCConnectionPageSetup::OGeneralSpecialJDBCConnectionPageSetup( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs ,sal_uInt16 _nPortId, const char* pDefaultPortResId, const char* pHelpTextResId, const char* pHeaderTextResId, const char* pDriverClassId) - :OGenericAdministrationPage(pParent, "SpecialJDBCConnectionPage", "dbaccess/ui/specialjdbcconnectionpage.ui", _rCoreAttrs) - ,m_nPortId(_nPortId) - { - get(m_pHeaderText, "header"); - get(m_pFTHelpText, "helpLabel"); - get(m_pFTDatabasename, "dbNameLabel"); - get(m_pETDatabasename, "dbNameEntry"); - get(m_pFTHostname, "hostNameLabel"); - get(m_pETHostname, "hostNameEntry"); - get(m_pFTPortNumber, "portNumLabel"); - get(m_pFTDefaultPortNumber, "portNumDefLabel"); - get(m_pNFPortNumber, "portNumEntry"); - m_pNFPortNumber->SetUseThousandSep(false); - get(m_pFTDriverClass, "jdbcDriverLabel"); - get(m_pETDriverClass, "jdbcDriverEntry"); - get(m_pPBTestJavaDriver, "testDriverButton"); - - m_pFTDriverClass->SetText(DBA_RES(pDriverClassId)); - - m_pFTDefaultPortNumber->SetText(DBA_RES(pDefaultPortResId)); + OGeneralSpecialJDBCConnectionPageSetup::OGeneralSpecialJDBCConnectionPageSetup( TabPageParent pParent, const SfxItemSet& _rCoreAttrs ,sal_uInt16 _nPortId, const char* pDefaultPortResId, const char* pHelpTextResId, const char* pHeaderTextResId, const char* pDriverClassId) + : OGenericAdministrationPage(pParent, "dbaccess/ui/specialjdbcconnectionpage.ui", "SpecialJDBCConnectionPage", _rCoreAttrs) + , m_nPortId(_nPortId) + , m_xHeaderText(m_xBuilder->weld_label("header")) + , m_xFTHelpText(m_xBuilder->weld_label("helpLabel")) + , m_xFTDatabasename(m_xBuilder->weld_label("dbNameLabel")) + , m_xETDatabasename(m_xBuilder->weld_entry("dbNameEntry")) + , m_xFTHostname(m_xBuilder->weld_label("hostNameLabel")) + , m_xETHostname(m_xBuilder->weld_entry("hostNameEntry")) + , m_xFTPortNumber(m_xBuilder->weld_label("portNumLabel")) + , m_xFTDefaultPortNumber(m_xBuilder->weld_label("portNumDefLabel")) + , m_xNFPortNumber(m_xBuilder->weld_spin_button("portNumEntry")) + , m_xFTDriverClass(m_xBuilder->weld_label("jdbcDriverLabel")) + , m_xETDriverClass(m_xBuilder->weld_entry("jdbcDriverEntry")) + , m_xPBTestJavaDriver(m_xBuilder->weld_button("testDriverButton")) + { + m_xFTDriverClass->set_label(DBA_RES(pDriverClassId)); + + m_xFTDefaultPortNumber->set_label(DBA_RES(pDefaultPortResId)); OUString sHelpText = DBA_RES(pHelpTextResId); - m_pFTHelpText->SetText(sHelpText); + m_xFTHelpText->set_label(sHelpText); //TODO this code snippet is redundant - m_pHeaderText->SetText(DBA_RES(pHeaderTextResId)); + m_xHeaderText->set_label(DBA_RES(pHeaderTextResId)); - m_pETDatabasename->SetModifyHdl(LINK(this, OGenericAdministrationPage, OnControlEditModifyHdl)); - m_pETHostname->SetModifyHdl(LINK(this, OGenericAdministrationPage, OnControlEditModifyHdl)); - m_pNFPortNumber->SetModifyHdl(LINK(this, OGenericAdministrationPage, OnControlEditModifyHdl)); + m_xETDatabasename->connect_changed(LINK(this, OGenericAdministrationPage, OnControlEntryModifyHdl)); + m_xETHostname->connect_changed(LINK(this, OGenericAdministrationPage, OnControlEntryModifyHdl)); + m_xNFPortNumber->connect_value_changed(LINK(this, OGenericAdministrationPage, OnControlSpinButtonModifyHdl)); - m_pETDriverClass->SetModifyHdl(LINK(this, OGenericAdministrationPage, OnControlEditModifyHdl)); - m_pPBTestJavaDriver->SetClickHdl(LINK(this,OGeneralSpecialJDBCConnectionPageSetup,OnTestJavaClickHdl)); + m_xETDriverClass->connect_changed(LINK(this, OGenericAdministrationPage, OnControlEntryModifyHdl)); + m_xPBTestJavaDriver->connect_clicked(LINK(this,OGeneralSpecialJDBCConnectionPageSetup,OnTestJavaClickHdl)); const SfxStringItem* pUrlItem = _rCoreAttrs.GetItem<SfxStringItem>(DSID_CONNECTURL); const DbuTypeCollectionItem* pTypesItem = _rCoreAttrs.GetItem<DbuTypeCollectionItem>(DSID_TYPECOLLECTION); @@ -417,27 +415,9 @@ using namespace ::com::sun::star; OGeneralSpecialJDBCConnectionPageSetup::~OGeneralSpecialJDBCConnectionPageSetup() { - disposeOnce(); - } - - void OGeneralSpecialJDBCConnectionPageSetup::dispose() - { - m_pHeaderText.clear(); - m_pFTHelpText.clear(); - m_pFTDatabasename.clear(); - m_pETDatabasename.clear(); - m_pFTHostname.clear(); - m_pETHostname.clear(); - m_pFTPortNumber.clear(); - m_pFTDefaultPortNumber.clear(); - m_pNFPortNumber.clear(); - m_pFTDriverClass.clear(); - m_pETDriverClass.clear(); - m_pPBTestJavaDriver.clear(); - OGenericAdministrationPage::dispose(); } - VclPtr<OGenericAdministrationPage> OGeneralSpecialJDBCConnectionPageSetup::CreateMySQLJDBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet ) + VclPtr<OGenericAdministrationPage> OGeneralSpecialJDBCConnectionPageSetup::CreateMySQLJDBCTabPage( TabPageParent pParent, const SfxItemSet& _rAttrSet ) { return VclPtr<OGeneralSpecialJDBCConnectionPageSetup>::Create( pParent, _rAttrSet, @@ -448,7 +428,7 @@ using namespace ::com::sun::star; STR_MYSQL_DRIVERCLASSTEXT); } - VclPtr<OGenericAdministrationPage> OGeneralSpecialJDBCConnectionPageSetup::CreateOracleJDBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet ) + VclPtr<OGenericAdministrationPage> OGeneralSpecialJDBCConnectionPageSetup::CreateOracleJDBCTabPage( TabPageParent pParent, const SfxItemSet& _rAttrSet ) { return VclPtr<OGeneralSpecialJDBCConnectionPageSetup>::Create( pParent, _rAttrSet, @@ -461,28 +441,28 @@ using namespace ::com::sun::star; void OGeneralSpecialJDBCConnectionPageSetup::fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) { - _rControlList.emplace_back(new OSaveValueWrapper<Edit>(m_pETDatabasename)); - _rControlList.emplace_back(new OSaveValueWrapper<Edit>(m_pETDriverClass)); - _rControlList.emplace_back(new OSaveValueWrapper<Edit>(m_pETHostname)); - _rControlList.emplace_back(new OSaveValueWrapper<NumericField>(m_pNFPortNumber)); + _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::Entry>(m_xETDatabasename.get())); + _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::Entry>(m_xETDriverClass.get())); + _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::Entry>(m_xETHostname.get())); + _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::SpinButton>(m_xNFPortNumber.get())); } void OGeneralSpecialJDBCConnectionPageSetup::fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) { - _rControlList.emplace_back(new ODisableWrapper<FixedText>(m_pFTHelpText)); - _rControlList.emplace_back(new ODisableWrapper<FixedText>(m_pFTDatabasename)); - _rControlList.emplace_back(new ODisableWrapper<FixedText>(m_pFTHostname)); - _rControlList.emplace_back(new ODisableWrapper<FixedText>(m_pFTPortNumber)); - _rControlList.emplace_back(new ODisableWrapper<FixedText>(m_pFTDefaultPortNumber)); - _rControlList.emplace_back(new ODisableWrapper<FixedText>(m_pFTDriverClass)); + _rControlList.emplace_back(new ODisableWidgetWrapper<weld::Label>(m_xFTHelpText.get())); + _rControlList.emplace_back(new ODisableWidgetWrapper<weld::Label>(m_xFTDatabasename.get())); + _rControlList.emplace_back(new ODisableWidgetWrapper<weld::Label>(m_xFTHostname.get())); + _rControlList.emplace_back(new ODisableWidgetWrapper<weld::Label>(m_xFTPortNumber.get())); + _rControlList.emplace_back(new ODisableWidgetWrapper<weld::Label>(m_xFTDefaultPortNumber.get())); + _rControlList.emplace_back(new ODisableWidgetWrapper<weld::Label>(m_xFTDriverClass.get())); } bool OGeneralSpecialJDBCConnectionPageSetup::FillItemSet( SfxItemSet* _rSet ) { bool bChangedSomething = false; - fillString(*_rSet,m_pETDriverClass,DSID_JDBCDRIVERCLASS,bChangedSomething); - fillString(*_rSet,m_pETHostname,DSID_CONN_HOSTNAME,bChangedSomething); - fillString(*_rSet,m_pETDatabasename,DSID_DATABASENAME,bChangedSomething); - fillInt32(*_rSet,m_pNFPortNumber,m_nPortId,bChangedSomething ); + fillString(*_rSet,m_xETDriverClass.get(),DSID_JDBCDRIVERCLASS,bChangedSomething); + fillString(*_rSet,m_xETHostname.get(),DSID_CONN_HOSTNAME,bChangedSomething); + fillString(*_rSet,m_xETDatabasename.get(),DSID_DATABASENAME,bChangedSomething); + fillInt32(*_rSet,m_xNFPortNumber.get(),m_nPortId,bChangedSomething ); return bChangedSomething; } @@ -499,33 +479,33 @@ using namespace ::com::sun::star; if ( bValid ) { - m_pETDatabasename->SetText(pDatabaseName->GetValue()); - m_pETDatabasename->ClearModifyFlag(); + m_xETDatabasename->set_text(pDatabaseName->GetValue()); + m_xETDatabasename->save_value(); - m_pETDriverClass->SetText(pDrvItem->GetValue()); - m_pETDriverClass->ClearModifyFlag(); + m_xETDriverClass->set_text(pDrvItem->GetValue()); + m_xETDriverClass->save_value(); - m_pETHostname->SetText(pHostName->GetValue()); - m_pETHostname->ClearModifyFlag(); + m_xETHostname->set_text(pHostName->GetValue()); + m_xETHostname->save_value(); - m_pNFPortNumber->SetValue(pPortNumber->GetValue()); - m_pNFPortNumber->ClearModifyFlag(); + m_xNFPortNumber->set_value(pPortNumber->GetValue()); + m_xNFPortNumber->save_value(); } OGenericAdministrationPage::implInitControls(_rSet, _bSaveValue); // to get the correct value when saveValue was called by base class - if ( m_pETDriverClass->GetText().trim().isEmpty() ) + if ( m_xETDriverClass->get_text().trim().isEmpty() ) { - m_pETDriverClass->SetText(m_sDefaultJdbcDriverName); - m_pETDriverClass->SetModifyFlag(); + m_xETDriverClass->set_text(m_sDefaultJdbcDriverName); + m_xETDriverClass->save_value(); } callModifiedHdl(); - bool bRoadmapState = ((!m_pETDatabasename->GetText().isEmpty() ) && (!m_pETHostname->GetText().isEmpty()) && (!m_pNFPortNumber->GetText().isEmpty() ) && ( !m_pETDriverClass->GetText().isEmpty() )); + bool bRoadmapState = ((!m_xETDatabasename->get_text().isEmpty() ) && (!m_xETHostname->get_text().isEmpty()) && (!m_xNFPortNumber->get_text().isEmpty() ) && ( !m_xETDriverClass->get_text().isEmpty() )); SetRoadmapStateValue(bRoadmapState); } - IMPL_LINK_NOARG(OGeneralSpecialJDBCConnectionPageSetup, OnTestJavaClickHdl, Button*, void) + IMPL_LINK_NOARG(OGeneralSpecialJDBCConnectionPageSetup, OnTestJavaClickHdl, weld::Button&, void) { OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF"); @@ -533,12 +513,12 @@ using namespace ::com::sun::star; #if HAVE_FEATURE_JAVA try { - if ( !m_pETDriverClass->GetText().trim().isEmpty() ) + if ( !m_xETDriverClass->get_text().trim().isEmpty() ) { // TODO change jvmaccess ::rtl::Reference< jvmaccess::VirtualMachine > xJVM = ::connectivity::getJavaVM( m_pAdminDialog->getORB() ); - m_pETDriverClass->SetText(m_pETDriverClass->GetText().trim()); // fdo#68341 - bSuccess = ::connectivity::existsJavaClassByName(xJVM,m_pETDriverClass->GetText()); + m_xETDriverClass->set_text(m_xETDriverClass->get_text().trim()); // fdo#68341 + bSuccess = ::connectivity::existsJavaClassByName(xJVM,m_xETDriverClass->get_text()); } } catch(css::uno::Exception&) @@ -553,9 +533,9 @@ using namespace ::com::sun::star; void OGeneralSpecialJDBCConnectionPageSetup::callModifiedHdl(void* pControl) { - if ( pControl == m_pETDriverClass ) - m_pPBTestJavaDriver->Enable( !m_pETDriverClass->GetText().trim().isEmpty() ); - bool bRoadmapState = ((!m_pETDatabasename->GetText().isEmpty() ) && ( !m_pETHostname->GetText().isEmpty() ) && (!m_pNFPortNumber->GetText().isEmpty() ) && ( !m_pETDriverClass->GetText().trim().isEmpty() )); + if (pControl == m_xETDriverClass.get()) + m_xPBTestJavaDriver->set_sensitive( !m_xETDriverClass->get_text().trim().isEmpty() ); + bool bRoadmapState = ((!m_xETDatabasename->get_text().isEmpty() ) && ( !m_xETHostname->get_text().isEmpty() ) && (!m_xNFPortNumber->get_text().isEmpty() ) && ( !m_xETDriverClass->get_text().trim().isEmpty() )); SetRoadmapStateValue(bRoadmapState); OGenericAdministrationPage::callModifiedHdl(); } diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx index e187f6336d46..2c10d4897105 100644 --- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx +++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx @@ -128,17 +128,16 @@ namespace dbaui class OGeneralSpecialJDBCConnectionPageSetup final : public OGenericAdministrationPage { public: - OGeneralSpecialJDBCConnectionPageSetup( vcl::Window* pParent + OGeneralSpecialJDBCConnectionPageSetup(TabPageParent pParent , const SfxItemSet& _rCoreAttrs , sal_uInt16 _nPortId , const char* pDefaultPortResId , const char* pHelpTextResId , const char* pHeaderTextResId , const char* pDriverClassId ); - virtual ~OGeneralSpecialJDBCConnectionPageSetup() override; - virtual void dispose() override; - static VclPtr<OGenericAdministrationPage> CreateMySQLJDBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet ); - static VclPtr<OGenericAdministrationPage> CreateOracleJDBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet ); + virtual ~OGeneralSpecialJDBCConnectionPageSetup() override; + static VclPtr<OGenericAdministrationPage> CreateMySQLJDBCTabPage( TabPageParent pParent, const SfxItemSet& _rAttrSet ); + static VclPtr<OGenericAdministrationPage> CreateOracleJDBCTabPage( TabPageParent pParent, const SfxItemSet& _rAttrSet ); private: virtual bool FillItemSet( SfxItemSet* _rCoreAttrs ) override; @@ -147,23 +146,24 @@ namespace dbaui virtual void fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override; virtual void callModifiedHdl(void* pControl = nullptr) override; - DECL_LINK(OnTestJavaClickHdl, Button*, void); - VclPtr<FixedText> m_pHeaderText; - VclPtr<FixedText> m_pFTHelpText; - VclPtr<FixedText> m_pFTDatabasename; - VclPtr<Edit> m_pETDatabasename; - VclPtr<FixedText> m_pFTHostname; - VclPtr<Edit> m_pETHostname; - VclPtr<FixedText> m_pFTPortNumber; - VclPtr<FixedText> m_pFTDefaultPortNumber; - VclPtr<NumericField> m_pNFPortNumber; - - VclPtr<FixedText> m_pFTDriverClass; - VclPtr<Edit> m_pETDriverClass; - VclPtr<PushButton> m_pPBTestJavaDriver; + DECL_LINK(OnTestJavaClickHdl, weld::Button&, void); OUString m_sDefaultJdbcDriverName; sal_uInt16 m_nPortId; + + std::unique_ptr<weld::Label> m_xHeaderText; + std::unique_ptr<weld::Label> m_xFTHelpText; + std::unique_ptr<weld::Label> m_xFTDatabasename; + std::unique_ptr<weld::Entry> m_xETDatabasename; + std::unique_ptr<weld::Label> m_xFTHostname; + std::unique_ptr<weld::Entry> m_xETHostname; + std::unique_ptr<weld::Label> m_xFTPortNumber; + std::unique_ptr<weld::Label> m_xFTDefaultPortNumber; + std::unique_ptr<weld::SpinButton> m_xNFPortNumber; + + std::unique_ptr<weld::Label> m_xFTDriverClass; + std::unique_ptr<weld::Entry> m_xETDriverClass; + std::unique_ptr<weld::Button> m_xPBTestJavaDriver; }; // OJDBCConnectionPageSetup diff --git a/dbaccess/uiconfig/ui/specialjdbcconnectionpage.ui b/dbaccess/uiconfig/ui/specialjdbcconnectionpage.ui index 61efc8014efc..8fa89c34d21c 100644 --- a/dbaccess/uiconfig/ui/specialjdbcconnectionpage.ui +++ b/dbaccess/uiconfig/ui/specialjdbcconnectionpage.ui @@ -1,7 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.22.1 --> <interface domain="dba"> <requires lib="gtk+" version="3.18"/> + <object class="GtkAdjustment" id="adjustment1"> + <property name="upper">1000000000000</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> <object class="GtkBox" id="SpecialJDBCConnectionPage"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -31,10 +36,11 @@ <object class="GtkLabel" id="helpLabel"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="specialjdbcconnectionpage|helpLabel">Please enter the required information to connect to a MySQL database using JDBC. Note that a JDBC driver class must be installed on your system and registered with %PRODUCTNAME. Please contact your system administrator if you are unsure about the following settings. </property> <property name="wrap">True</property> + <property name="width_chars">80</property> <property name="max_width_chars">80</property> + <property name="xalign">0</property> </object> <packing> <property name="expand">False</property> @@ -54,10 +60,10 @@ <object class="GtkLabel" id="dbNameLabel"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes" context="specialjdbcconnectionpage|dbNameLabel">_Database name:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">dbNameEntry</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -68,10 +74,10 @@ <object class="GtkLabel" id="hostNameLabel"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes" context="specialjdbcconnectionpage|hostNameLabel">_Server:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">hostNameEntry</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -82,10 +88,10 @@ <object class="GtkLabel" id="portNumLabel"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes" context="specialjdbcconnectionpage|portNumLabel">_Port number:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">portNumEntry</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -97,6 +103,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> + <property name="activates_default">True</property> </object> <packing> <property name="left_attach">1</property> @@ -108,6 +115,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> + <property name="activates_default">True</property> </object> <packing> <property name="left_attach">1</property> @@ -125,6 +133,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> + <property name="adjustment">adjustment1</property> </object> <packing> <property name="expand">False</property> @@ -184,6 +193,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> + <property name="activates_default">True</property> </object> <packing> <property name="left_attach">0</property> |