diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-08-02 10:10:54 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-08-02 15:03:39 +0200 |
commit | 6eda61d6b994b422c988b552b5316a87c9c03654 (patch) | |
tree | 205aaaec54c92099269fa25b185acaf14db9617c /dbaccess | |
parent | c44028ceb8dbc07cefea77c98b2416be3635418b (diff) |
weld MySQLNativeSetupPage
Change-Id: Ie27649de602241936378f1e937100718d0c95d5e
Reviewed-on: https://gerrit.libreoffice.org/76844
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 | 34 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx | 11 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/admincontrols.cxx | 26 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/admincontrols.hxx | 2 |
4 files changed, 50 insertions, 23 deletions
diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx index 20f9ec53e4cb..2287be7a8934 100644 --- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx +++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx @@ -294,13 +294,12 @@ using namespace ::com::sun::star; } // MySQLNativeSetupPage - MySQLNativeSetupPage::MySQLNativeSetupPage( vcl::Window* _pParent, const SfxItemSet& _rCoreAttrs ) - :OGenericAdministrationPage( _pParent, "DBWizMysqlNativePage", "dbaccess/ui/dbwizmysqlnativepage.ui", _rCoreAttrs ) - ,m_aMySQLSettings ( VclPtr<MySQLNativeSettings>::Create(*get<VclVBox>("MySQLSettingsContainer"), LINK(this, OGenericAdministrationPage, OnControlModified)) ) + MySQLNativeSetupPage::MySQLNativeSetupPage( TabPageParent pParent, const SfxItemSet& rCoreAttrs ) + : OGenericAdministrationPage(pParent, "dbaccess/ui/dbwizmysqlnativepage.ui", "DBWizMysqlNativePage", rCoreAttrs) + , m_xHelpText(m_xBuilder->weld_label("helptext")) + , m_xSettingsContainer(m_xBuilder->weld_container("MySQLSettingsContainer")) + , m_xMySQLSettings(new DBMySQLNativeSettings(m_xSettingsContainer.get(), LINK(this, OGenericAdministrationPage, OnControlModified))) { - get(m_pHelpText, "helptext"); - m_aMySQLSettings->Show(); - SetRoadmapStateValue(false); } @@ -311,35 +310,34 @@ using namespace ::com::sun::star; void MySQLNativeSetupPage::dispose() { - m_aMySQLSettings.disposeAndClear(); - m_pHelpText.clear(); + m_xMySQLSettings.reset(); OGenericAdministrationPage::dispose(); - } + } - VclPtr<OGenericAdministrationPage> MySQLNativeSetupPage::Create( vcl::Window* pParent, const SfxItemSet& _rAttrSet ) + VclPtr<OGenericAdministrationPage> MySQLNativeSetupPage::Create(TabPageParent pParent, const SfxItemSet& rAttrSet) { - return VclPtr<MySQLNativeSetupPage>::Create( pParent, _rAttrSet ); + return VclPtr<MySQLNativeSetupPage>::Create(pParent, rAttrSet); } void MySQLNativeSetupPage::fillControls( std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList ) { - m_aMySQLSettings->fillControls( _rControlList ); + m_xMySQLSettings->fillControls( _rControlList ); } - void MySQLNativeSetupPage::fillWindows( std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList ) + void MySQLNativeSetupPage::fillWindows(std::vector<std::unique_ptr<ISaveValueWrapper>>& rControlList) { - _rControlList.emplace_back( new ODisableWrapper< FixedText >( m_pHelpText ) ); - m_aMySQLSettings->fillWindows( _rControlList ); + rControlList.emplace_back(new ODisableWidgetWrapper<weld::Label>(m_xHelpText.get())); + m_xMySQLSettings->fillWindows(rControlList); } bool MySQLNativeSetupPage::FillItemSet( SfxItemSet* _rSet ) { - return m_aMySQLSettings->FillItemSet( _rSet ); + return m_xMySQLSettings->FillItemSet( _rSet ); } void MySQLNativeSetupPage::implInitControls( const SfxItemSet& _rSet, bool _bSaveValue ) { - m_aMySQLSettings->implInitControls( _rSet ); + m_xMySQLSettings->implInitControls( _rSet ); OGenericAdministrationPage::implInitControls( _rSet, _bSaveValue ); @@ -348,7 +346,7 @@ using namespace ::com::sun::star; void MySQLNativeSetupPage::callModifiedHdl(void*) { - SetRoadmapStateValue( m_aMySQLSettings->canAdvance() ); + SetRoadmapStateValue( m_xMySQLSettings->canAdvance() ); OGenericAdministrationPage::callModifiedHdl(); } diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx index 02953c0b1a0a..dd0717f47a54 100644 --- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx +++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx @@ -103,15 +103,16 @@ namespace dbaui class MySQLNativeSetupPage : public OGenericAdministrationPage { private: - VclPtr<FixedText> m_pHelpText; - VclPtr<MySQLNativeSettings> m_aMySQLSettings; + std::unique_ptr<weld::Label> m_xHelpText; + std::unique_ptr<weld::Container> m_xSettingsContainer; + std::unique_ptr<DBMySQLNativeSettings> m_xMySQLSettings; public: - MySQLNativeSetupPage( vcl::Window* _pParent, const SfxItemSet& _rCoreAttrs ); - virtual ~MySQLNativeSetupPage() override; + MySQLNativeSetupPage(TabPageParent pParent, const SfxItemSet& rCoreAttrs); virtual void dispose() override; + virtual ~MySQLNativeSetupPage() override; - static VclPtr<OGenericAdministrationPage> Create( vcl::Window* pParent, const SfxItemSet& _rAttrSet ); + static VclPtr<OGenericAdministrationPage> Create(TabPageParent pParent, const SfxItemSet& rAttrSet); protected: virtual void fillControls( std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList ) override; diff --git a/dbaccess/source/ui/dlg/admincontrols.cxx b/dbaccess/source/ui/dlg/admincontrols.cxx index e45e14379351..5ba2a5b313f3 100644 --- a/dbaccess/source/ui/dlg/admincontrols.cxx +++ b/dbaccess/source/ui/dlg/admincontrols.cxx @@ -369,6 +369,32 @@ namespace dbaui m_xHostPortRadio->set_active(true); } + bool DBMySQLNativeSettings::canAdvance() const + { + if (m_xDatabaseName->get_text().isEmpty()) + return false; + + if ( m_xHostPortRadio->get_active() + && ( ( m_xHostName->get_text().isEmpty() ) + || ( m_xPort->get_text().isEmpty() ) + ) + ) + return false; + +#ifdef UNX + if ( ( m_xSocketRadio->get_active() ) + && ( m_xSocket->get_text().isEmpty() ) + ) +#else + if ( ( m_xNamedPipeRadio->get_active() ) + && ( m_xNamedPipe->get_text().isEmpty() ) + ) +#endif + return false; + + return true; + } + } // namespace dbaui /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/ui/dlg/admincontrols.hxx b/dbaccess/source/ui/dlg/admincontrols.hxx index 71366a09266f..775f843d9ad8 100644 --- a/dbaccess/source/ui/dlg/admincontrols.hxx +++ b/dbaccess/source/ui/dlg/admincontrols.hxx @@ -93,6 +93,8 @@ namespace dbaui bool FillItemSet( SfxItemSet* rCoreAttrs ); void implInitControls( const SfxItemSet& _rSet ); + + bool canAdvance() const; }; } // namespace dbaui |