diff options
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx | 58 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx | 15 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/adminpages.cxx | 46 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/adminpages.hxx | 2 | ||||
-rw-r--r-- | dbaccess/uiconfig/ui/authentificationpage.ui | 17 |
5 files changed, 36 insertions, 102 deletions
diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx index d3f3d88205f5..c8a57500875e 100644 --- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx +++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx @@ -709,53 +709,39 @@ using namespace ::com::sun::star; return bChangedSomething; } - VclPtr<OGenericAdministrationPage> OAuthentificationPageSetup::CreateAuthentificationTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet ) + VclPtr<OGenericAdministrationPage> OAuthentificationPageSetup::CreateAuthentificationTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet) { return VclPtr<OAuthentificationPageSetup>::Create( pParent, _rAttrSet); } - - OAuthentificationPageSetup::OAuthentificationPageSetup( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs ) - :OGenericAdministrationPage(pParent, "AuthentificationPage", "dbaccess/ui/authentificationpage.ui", _rCoreAttrs ) + OAuthentificationPageSetup::OAuthentificationPageSetup(TabPageParent pParent, const SfxItemSet& _rCoreAttrs) + : OGenericAdministrationPage(pParent, "dbaccess/ui/authentificationpage.ui", "AuthentificationPage", _rCoreAttrs) + , m_xFTHelpText(m_xBuilder->weld_label("helptext")) + , m_xFTUserName(m_xBuilder->weld_label("generalUserNameLabel")) + , m_xETUserName(m_xBuilder->weld_entry("generalUserNameEntry")) + , m_xCBPasswordRequired(m_xBuilder->weld_check_button("passRequiredCheckbutton")) + , m_xPBTestConnection(m_xBuilder->weld_button("testConnectionButton")) { - get(m_pFTHelpText, "helptext"); - get(m_pFTUserName, "generalUserNameLabel"); - get(m_pETUserName, "generalUserNameEntry"); - get(m_pCBPasswordRequired, "passRequiredCheckbutton"); - get(m_pPBTestConnection, "testConnectionButton"); - m_pETUserName->SetModifyHdl(LINK(this,OGenericAdministrationPage,OnControlEditModifyHdl)); - m_pCBPasswordRequired->SetClickHdl(LINK(this,OGenericAdministrationPage,OnControlModifiedClick)); - m_pPBTestConnection->SetClickHdl(LINK(this,OGenericAdministrationPage,OnTestConnectionClickHdl)); - - LayoutHelper::fitSizeRightAligned( *m_pPBTestConnection ); + m_xETUserName->connect_changed(LINK(this,OGenericAdministrationPage,OnControlEntryModifyHdl)); + m_xCBPasswordRequired->connect_toggled(LINK(this,OGenericAdministrationPage,OnControlModifiedButtonClick)); + m_xPBTestConnection->connect_clicked(LINK(this,OGenericAdministrationPage,OnTestConnectionButtonClickHdl)); } OAuthentificationPageSetup::~OAuthentificationPageSetup() { - disposeOnce(); - } - - void OAuthentificationPageSetup::dispose() - { - m_pFTHelpText.clear(); - m_pFTUserName.clear(); - m_pETUserName.clear(); - m_pCBPasswordRequired.clear(); - m_pPBTestConnection.clear(); - OGenericAdministrationPage::dispose(); } void OAuthentificationPageSetup::fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) { - _rControlList.emplace_back(new ODisableWrapper<FixedText>(m_pFTHelpText)); - _rControlList.emplace_back(new ODisableWrapper<FixedText>(m_pFTUserName)); - _rControlList.emplace_back(new ODisableWrapper<PushButton>(m_pPBTestConnection)); + _rControlList.emplace_back(new ODisableWidgetWrapper<weld::Label>(m_xFTHelpText.get())); + _rControlList.emplace_back(new ODisableWidgetWrapper<weld::Label>(m_xFTUserName.get())); + _rControlList.emplace_back(new ODisableWidgetWrapper<weld::Button>(m_xPBTestConnection.get())); } void OAuthentificationPageSetup::fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) { - _rControlList.emplace_back(new OSaveValueWrapper<Edit>(m_pETUserName)); - _rControlList.emplace_back(new OSaveValueWrapper<CheckBox>(m_pCBPasswordRequired)); + _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::Entry>(m_xETUserName.get())); + _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::ToggleButton>(m_xCBPasswordRequired.get())); } void OAuthentificationPageSetup::implInitControls(const SfxItemSet& _rSet, bool /*_bSaveValue*/) @@ -766,23 +752,23 @@ using namespace ::com::sun::star; const SfxStringItem* pUidItem = _rSet.GetItem<SfxStringItem>(DSID_USER); const SfxBoolItem* pAllowEmptyPwd = _rSet.GetItem<SfxBoolItem>(DSID_PASSWORDREQUIRED); - m_pETUserName->SetText(pUidItem->GetValue()); - m_pCBPasswordRequired->Check(pAllowEmptyPwd->GetValue()); + m_xETUserName->set_text(pUidItem->GetValue()); + m_xCBPasswordRequired->set_active(pAllowEmptyPwd->GetValue()); - m_pETUserName->ClearModifyFlag(); + m_xETUserName->save_value(); } bool OAuthentificationPageSetup::FillItemSet( SfxItemSet* _rSet ) { bool bChangedSomething = false; - if (m_pETUserName->IsValueChangedFromSaved()) + if (m_xETUserName->get_value_changed_from_saved()) { - _rSet->Put(SfxStringItem(DSID_USER, m_pETUserName->GetText())); + _rSet->Put(SfxStringItem(DSID_USER, m_xETUserName->get_text())); _rSet->Put(SfxStringItem(DSID_PASSWORD, OUString())); bChangedSomething = true; } - fillBool(*_rSet,m_pCBPasswordRequired,DSID_PASSWORDREQUIRED,bChangedSomething); + fillBool(*_rSet, m_xCBPasswordRequired.get(), DSID_PASSWORDREQUIRED, false, bChangedSomething); return bChangedSomething; } diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx index ffa1198858bb..e187f6336d46 100644 --- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx +++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx @@ -227,17 +227,16 @@ namespace dbaui { public: virtual bool FillItemSet ( SfxItemSet* _rCoreAttrs ) override; - static VclPtr<OGenericAdministrationPage> CreateAuthentificationTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet ); - OAuthentificationPageSetup(vcl::Window* pParent, const SfxItemSet& _rCoreAttrs); + static VclPtr<OGenericAdministrationPage> CreateAuthentificationTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet); + OAuthentificationPageSetup(TabPageParent pParent, const SfxItemSet& _rCoreAttrs); virtual ~OAuthentificationPageSetup() override; - virtual void dispose() override; private: - VclPtr<FixedText> m_pFTHelpText; - VclPtr<FixedText> m_pFTUserName; - VclPtr<Edit> m_pETUserName; - VclPtr<CheckBox> m_pCBPasswordRequired; - VclPtr<PushButton> m_pPBTestConnection; + std::unique_ptr<weld::Label> m_xFTHelpText; + std::unique_ptr<weld::Label> m_xFTUserName; + std::unique_ptr<weld::Entry> m_xETUserName; + std::unique_ptr<weld::CheckButton> m_xCBPasswordRequired; + std::unique_ptr<weld::Button> m_xPBTestConnection; virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) override; virtual void fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override; diff --git a/dbaccess/source/ui/dlg/adminpages.cxx b/dbaccess/source/ui/dlg/adminpages.cxx index 0a9104692e07..37f5428cadb2 100644 --- a/dbaccess/source/ui/dlg/adminpages.cxx +++ b/dbaccess/source/ui/dlg/adminpages.cxx @@ -124,11 +124,6 @@ namespace dbaui callModifiedHdl(&rCtrl); } - IMPL_LINK(OGenericAdministrationPage, OnControlModifiedClick, Button*, rCtrl, void) - { - callModifiedHdl(&rCtrl); - } - IMPL_LINK(OGenericAdministrationPage, ControlModifiedCheckBoxHdl, CheckBox&, rCtrl, void) { callModifiedHdl(&rCtrl); @@ -301,47 +296,6 @@ namespace dbaui } } - IMPL_LINK_NOARG(OGenericAdministrationPage, OnTestConnectionClickHdl, Button*, void) - { - OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF"); - bool bSuccess = false; - if ( m_pAdminDialog ) - { - m_pAdminDialog->saveDatasource(); - OGenericAdministrationPage::implInitControls(*m_pItemSetHelper->getOutputSet(), true); - bool bShowMessage = true; - try - { - std::pair< Reference<XConnection>,bool> aConnectionPair = m_pAdminDialog->createConnection(); - bShowMessage = aConnectionPair.second; - bSuccess = aConnectionPair.first.is(); - ::comphelper::disposeComponent(aConnectionPair.first); - } - catch(Exception&) - { - } - if ( bShowMessage ) - { - MessageType eImage = MessageType::Info; - OUString aMessage,sTitle; - sTitle = DBA_RES(STR_CONNECTION_TEST); - if ( bSuccess ) - { - aMessage = DBA_RES(STR_CONNECTION_SUCCESS); - } - else - { - eImage = MessageType::Error; - aMessage = DBA_RES(STR_CONNECTION_NO_SUCCESS); - } - OSQLMessageBox aMsg(GetFrameWeld(), sTitle, aMessage, MessBoxStyle::Ok, eImage); - aMsg.run(); - } - if ( !bSuccess ) - m_pAdminDialog->clearPassword(); - } - } - IMPL_LINK_NOARG(OGenericAdministrationPage, OnTestConnectionButtonClickHdl, weld::Button&, void) { OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF"); diff --git a/dbaccess/source/ui/dlg/adminpages.hxx b/dbaccess/source/ui/dlg/adminpages.hxx index 9e1106ae1a07..62b1bfa8ea3d 100644 --- a/dbaccess/source/ui/dlg/adminpages.hxx +++ b/dbaccess/source/ui/dlg/adminpages.hxx @@ -261,11 +261,9 @@ namespace dbaui DECL_LINK(OnControlEntryModifyHdl, weld::Entry&, void); DECL_LINK(OnControlSpinButtonModifyHdl, weld::SpinButton&, void); DECL_LINK(OnControlModifiedButtonClick, weld::ToggleButton&, void); - DECL_LINK(OnControlModifiedClick, Button*, void); DECL_LINK(ControlModifiedCheckBoxHdl, CheckBox&, void); DECL_LINK(OnTestConnectionButtonClickHdl, weld::Button&, void); - DECL_LINK(OnTestConnectionClickHdl, Button*, void); }; // LayoutHelper diff --git a/dbaccess/uiconfig/ui/authentificationpage.ui b/dbaccess/uiconfig/ui/authentificationpage.ui index c5f85623ce2c..0c1a6a44a3b0 100644 --- a/dbaccess/uiconfig/ui/authentificationpage.ui +++ b/dbaccess/uiconfig/ui/authentificationpage.ui @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.22.1 --> <interface domain="dba"> <requires lib="gtk+" version="3.18"/> <object class="GtkBox" id="AuthentificationPage"> @@ -31,10 +32,11 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="margin_bottom">6</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="authentificationpage|helptext">Some databases require you to enter a user name.</property> <property name="wrap">True</property> + <property name="width_chars">60</property> <property name="max_width_chars">60</property> + <property name="xalign">0</property> </object> <packing> <property name="expand">False</property> @@ -50,9 +52,6 @@ <property name="row_spacing">2</property> <property name="column_spacing">6</property> <child> - <placeholder/> - </child> - <child> <object class="GtkLabel" id="generalUserNameLabel"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -64,8 +63,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -73,12 +70,11 @@ <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> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -94,10 +90,11 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="expand">False</property> |