[Libreoffice-commits] core.git: dbaccess/source dbaccess/uiconfig

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Aug 2 13:03:15 UTC 2019


 dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx |   85 ++++++++--------------
 dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx |   23 ++---
 dbaccess/source/ui/dlg/adminpages.cxx             |   10 --
 dbaccess/source/ui/dlg/adminpages.hxx             |    3 
 dbaccess/uiconfig/ui/ldapconnectionpage.ui        |   20 +++--
 5 files changed, 60 insertions(+), 81 deletions(-)

New commits:
commit 3cf9c2d436a076c472ef6e22e7a10d2bc9a85c48
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Aug 2 09:49:53 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Aug 2 15:02:12 2019 +0200

    weld OLDAPConnectionPageSetup
    
    Change-Id: Id1b5becb2e9978cf4713a35d4f89125658d3de17
    Reviewed-on: https://gerrit.libreoffice.org/76840
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
index 51c5dcf36dbb..20f9ec53e4cb 100644
--- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
+++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
@@ -132,59 +132,42 @@ using namespace ::com::sun::star;
         return m_xTextConnectionHelper->prepareLeave();
     }
 
-    VclPtr<OGenericAdministrationPage> OLDAPConnectionPageSetup::CreateLDAPTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
+    VclPtr<OGenericAdministrationPage> OLDAPConnectionPageSetup::CreateLDAPTabPage( TabPageParent pParent, const SfxItemSet& _rAttrSet )
     {
         return VclPtr<OLDAPConnectionPageSetup>::Create( pParent, _rAttrSet );
     }
 
     // OLDAPPageSetup
-    OLDAPConnectionPageSetup::OLDAPConnectionPageSetup( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs )
-        :OGenericAdministrationPage(pParent, "LDAPConnectionPage", "dbaccess/ui/ldapconnectionpage.ui",_rCoreAttrs)
-    {
-        get(m_pFTHelpText, "helpLabel");
-        get(m_pFTHostServer, "hostNameLabel");
-        get(m_pETHostServer, "hostNameEntry");
-        get(m_pFTBaseDN, "baseDNLabel");
-        get(m_pETBaseDN, "baseDNEntry");
-        get(m_pFTPortNumber, "portNumLabel");
-        get(m_pNFPortNumber, "portNumEntry");
-        m_pNFPortNumber->SetUseThousandSep(false);
-        get(m_pFTDefaultPortNumber, "portNumDefLabel");
-        get(m_pCBUseSSL, "useSSLCheckbutton");
-
-        m_pETHostServer->SetModifyHdl(LINK(this, OGenericAdministrationPage, OnControlEditModifyHdl));
-        m_pETBaseDN->SetModifyHdl(LINK(this, OGenericAdministrationPage, OnControlEditModifyHdl));
-        m_pNFPortNumber->SetModifyHdl(LINK(this, OGenericAdministrationPage, OnControlEditModifyHdl));
-        m_pCBUseSSL->SetToggleHdl( LINK(this, OGenericAdministrationPage, ControlModifiedCheckBoxHdl) );
+    OLDAPConnectionPageSetup::OLDAPConnectionPageSetup( TabPageParent pParent, const SfxItemSet& _rCoreAttrs )
+        : OGenericAdministrationPage(pParent, "dbaccess/ui/ldapconnectionpage.ui", "LDAPConnectionPage", _rCoreAttrs)
+        , m_xFTHelpText(m_xBuilder->weld_label("helpLabel"))
+        , m_xFTHostServer(m_xBuilder->weld_label("hostNameLabel"))
+        , m_xETHostServer(m_xBuilder->weld_entry("hostNameEntry"))
+        , m_xFTBaseDN(m_xBuilder->weld_label("baseDNLabel"))
+        , m_xETBaseDN(m_xBuilder->weld_entry("baseDNEntry"))
+        , m_xFTPortNumber(m_xBuilder->weld_label("portNumLabel"))
+        , m_xNFPortNumber(m_xBuilder->weld_spin_button("portNumEntry"))
+        , m_xFTDefaultPortNumber(m_xBuilder->weld_label("portNumDefLabel"))
+        , m_xCBUseSSL(m_xBuilder->weld_check_button("useSSLCheckbutton"))
+    {
+        m_xETHostServer->connect_changed(LINK(this, OGenericAdministrationPage, OnControlEntryModifyHdl));
+        m_xETBaseDN->connect_changed(LINK(this, OGenericAdministrationPage, OnControlEntryModifyHdl));
+        m_xNFPortNumber->connect_value_changed(LINK(this, OGenericAdministrationPage, OnControlSpinButtonModifyHdl));
+        m_xCBUseSSL->connect_toggled( LINK(this, OGenericAdministrationPage, OnControlModifiedButtonClick) );
         SetRoadmapStateValue(false);
     }
 
     OLDAPConnectionPageSetup::~OLDAPConnectionPageSetup()
     {
-        disposeOnce();
-    }
-
-    void OLDAPConnectionPageSetup::dispose()
-    {
-        m_pFTHelpText.clear();
-        m_pFTHostServer.clear();
-        m_pETHostServer.clear();
-        m_pFTBaseDN.clear();
-        m_pETBaseDN.clear();
-        m_pFTPortNumber.clear();
-        m_pNFPortNumber.clear();
-        m_pFTDefaultPortNumber.clear();
-        m_pCBUseSSL.clear();
-        OGenericAdministrationPage::dispose();
     }
 
     bool OLDAPConnectionPageSetup::FillItemSet( SfxItemSet* _rSet )
     {
         bool bChangedSomething = false;
-        fillString(*_rSet,m_pETBaseDN,DSID_CONN_LDAP_BASEDN, bChangedSomething);
-        fillInt32(*_rSet,m_pNFPortNumber,DSID_CONN_LDAP_PORTNUMBER,bChangedSomething);
+        fillString(*_rSet,m_xETBaseDN.get(),DSID_CONN_LDAP_BASEDN, bChangedSomething);
+        fillInt32(*_rSet,m_xNFPortNumber.get(),DSID_CONN_LDAP_PORTNUMBER,bChangedSomething);
 
-        if ( m_pETHostServer->IsValueChangedFromSaved() )
+        if ( m_xETHostServer->get_value_changed_from_saved() )
         {
             const DbuTypeCollectionItem* pCollectionItem = dynamic_cast<const DbuTypeCollectionItem*>( _rSet->GetItem(DSID_TYPECOLLECTION) );
             ::dbaccess::ODsnTypeCollection* pCollection = nullptr;
@@ -193,29 +176,29 @@ using namespace ::com::sun::star;
             OSL_ENSURE(pCollection, "OLDAPConnectionPageSetup::FillItemSet : really need a DSN type collection !");
             if (pCollection)
             {
-                OUString sUrl = pCollection->getPrefix( "sdbc:address:ldap:") + m_pETHostServer->GetText();
+                OUString sUrl = pCollection->getPrefix( "sdbc:address:ldap:") + m_xETHostServer->get_text();
                 _rSet->Put(SfxStringItem(DSID_CONNECTURL, sUrl));
                 bChangedSomething = true;
             }
         }
 
-        fillBool(*_rSet,m_pCBUseSSL,DSID_CONN_LDAP_USESSL,bChangedSomething);
+        fillBool(*_rSet,m_xCBUseSSL.get(),DSID_CONN_LDAP_USESSL,false,bChangedSomething);
         return bChangedSomething;
     }
     void OLDAPConnectionPageSetup::fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList)
     {
-        _rControlList.emplace_back(new OSaveValueWrapper<Edit>(m_pETHostServer));
-        _rControlList.emplace_back(new OSaveValueWrapper<Edit>(m_pETBaseDN));
-        _rControlList.emplace_back(new OSaveValueWrapper<NumericField>(m_pNFPortNumber));
-        _rControlList.emplace_back(new OSaveValueWrapper<CheckBox>(m_pCBUseSSL));
+        _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::Entry>(m_xETHostServer.get()));
+        _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::Entry>(m_xETBaseDN.get()));
+        _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::SpinButton>(m_xNFPortNumber.get()));
+        _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::ToggleButton>(m_xCBUseSSL.get()));
     }
     void OLDAPConnectionPageSetup::fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList)
     {
-        _rControlList.emplace_back(new ODisableWrapper<FixedText>(m_pFTHelpText));
-        _rControlList.emplace_back(new ODisableWrapper<FixedText>(m_pFTHostServer));
-        _rControlList.emplace_back(new ODisableWrapper<FixedText>(m_pFTBaseDN));
-        _rControlList.emplace_back(new ODisableWrapper<FixedText>(m_pFTPortNumber));
-        _rControlList.emplace_back(new ODisableWrapper<FixedText>(m_pFTDefaultPortNumber));
+        _rControlList.emplace_back(new ODisableWidgetWrapper<weld::Label>(m_xFTHelpText.get()));
+        _rControlList.emplace_back(new ODisableWidgetWrapper<weld::Label>(m_xFTHostServer.get()));
+        _rControlList.emplace_back(new ODisableWidgetWrapper<weld::Label>(m_xFTBaseDN.get()));
+        _rControlList.emplace_back(new ODisableWidgetWrapper<weld::Label>(m_xFTPortNumber.get()));
+        _rControlList.emplace_back(new ODisableWidgetWrapper<weld::Label>(m_xFTDefaultPortNumber.get()));
     }
     void OLDAPConnectionPageSetup::implInitControls(const SfxItemSet& _rSet, bool _bSaveValue)
     {
@@ -228,8 +211,8 @@ using namespace ::com::sun::star;
 
         if ( bValid )
         {
-            m_pETBaseDN->SetText(pBaseDN->GetValue());
-            m_pNFPortNumber->SetValue(pPortNumber->GetValue());
+            m_xETBaseDN->set_text(pBaseDN->GetValue());
+            m_xNFPortNumber->set_value(pPortNumber->GetValue());
         }
         OGenericAdministrationPage::implInitControls(_rSet, _bSaveValue);
         callModifiedHdl();
@@ -237,7 +220,7 @@ using namespace ::com::sun::star;
 
     void OLDAPConnectionPageSetup::callModifiedHdl(void *)
     {
-        bool bRoadmapState = ((!m_pETHostServer->GetText().isEmpty() ) && ( !m_pETBaseDN->GetText().isEmpty() ) && (!m_pFTPortNumber->GetText().isEmpty() ));
+        bool bRoadmapState = ((!m_xETHostServer->get_text().isEmpty() ) && ( !m_xETBaseDN->get_text().isEmpty() ) && (!m_xFTPortNumber->get_label().isEmpty() ));
         SetRoadmapStateValue(bRoadmapState);
         OGenericAdministrationPage::callModifiedHdl();
     }
diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
index 2c10d4897105..02953c0b1a0a 100644
--- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
+++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
@@ -77,10 +77,9 @@ namespace dbaui
     {
     public:
         virtual bool        FillItemSet ( SfxItemSet* _rCoreAttrs ) override;
-        static VclPtr<OGenericAdministrationPage> CreateLDAPTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
-        OLDAPConnectionPageSetup( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs );
+        static VclPtr<OGenericAdministrationPage> CreateLDAPTabPage( TabPageParent pParent, const SfxItemSet& _rAttrSet );
+        OLDAPConnectionPageSetup( TabPageParent pParent, const SfxItemSet& _rCoreAttrs );
         virtual ~OLDAPConnectionPageSetup() override;
-        virtual void dispose() override;
         virtual void callModifiedHdl(void* pControl = nullptr) override;
 
     protected:
@@ -89,15 +88,15 @@ namespace dbaui
         virtual void fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override;
 
     private:
-        VclPtr<FixedText>          m_pFTHelpText;
-        VclPtr<FixedText>          m_pFTHostServer;
-        VclPtr<Edit>               m_pETHostServer;
-        VclPtr<FixedText>          m_pFTBaseDN;
-        VclPtr<Edit>               m_pETBaseDN;
-        VclPtr<FixedText>          m_pFTPortNumber;
-        VclPtr<NumericField>       m_pNFPortNumber;
-        VclPtr<FixedText>          m_pFTDefaultPortNumber;
-        VclPtr<CheckBox>           m_pCBUseSSL;
+        std::unique_ptr<weld::Label> m_xFTHelpText;
+        std::unique_ptr<weld::Label> m_xFTHostServer;
+        std::unique_ptr<weld::Entry> m_xETHostServer;
+        std::unique_ptr<weld::Label> m_xFTBaseDN;
+        std::unique_ptr<weld::Entry> m_xETBaseDN;
+        std::unique_ptr<weld::Label> m_xFTPortNumber;
+        std::unique_ptr<weld::SpinButton> m_xNFPortNumber;
+        std::unique_ptr<weld::Label> m_xFTDefaultPortNumber;
+        std::unique_ptr<weld::CheckButton> m_xCBUseSSL;
     };
 
     // MySQLNativeSetupPage
diff --git a/dbaccess/source/ui/dlg/adminpages.cxx b/dbaccess/source/ui/dlg/adminpages.cxx
index 37f5428cadb2..28c677d254ab 100644
--- a/dbaccess/source/ui/dlg/adminpages.cxx
+++ b/dbaccess/source/ui/dlg/adminpages.cxx
@@ -124,16 +124,6 @@ namespace dbaui
         callModifiedHdl(&rCtrl);
     }
 
-    IMPL_LINK(OGenericAdministrationPage, ControlModifiedCheckBoxHdl, CheckBox&, rCtrl, void)
-    {
-        callModifiedHdl(&rCtrl);
-    }
-
-    IMPL_LINK(OGenericAdministrationPage, OnControlEditModifyHdl, Edit&, rCtrl, void)
-    {
-        callModifiedHdl(&rCtrl);
-    }
-
     IMPL_LINK(OGenericAdministrationPage, OnControlEntryModifyHdl, weld::Entry&, rCtrl, void)
     {
         callModifiedHdl(&rCtrl);
diff --git a/dbaccess/source/ui/dlg/adminpages.hxx b/dbaccess/source/ui/dlg/adminpages.hxx
index 62b1bfa8ea3d..c9897d20b8dd 100644
--- a/dbaccess/source/ui/dlg/adminpages.hxx
+++ b/dbaccess/source/ui/dlg/adminpages.hxx
@@ -257,12 +257,9 @@ namespace dbaui
             is modified. The implementation just calls callModifiedHdl.
         */
         DECL_LINK(OnControlModified, void*, void);
-        DECL_LINK(OnControlEditModifyHdl, Edit&, void);
         DECL_LINK(OnControlEntryModifyHdl, weld::Entry&, void);
         DECL_LINK(OnControlSpinButtonModifyHdl, weld::SpinButton&, void);
         DECL_LINK(OnControlModifiedButtonClick, weld::ToggleButton&, void);
-        DECL_LINK(ControlModifiedCheckBoxHdl, CheckBox&, void);
-
         DECL_LINK(OnTestConnectionButtonClickHdl, weld::Button&, void);
     };
 
diff --git a/dbaccess/uiconfig/ui/ldapconnectionpage.ui b/dbaccess/uiconfig/ui/ldapconnectionpage.ui
index c1edb008f8a0..e386c06102d2 100644
--- a/dbaccess/uiconfig/ui/ldapconnectionpage.ui
+++ b/dbaccess/uiconfig/ui/ldapconnectionpage.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="LDAPConnectionPage">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
@@ -30,10 +35,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="ldapconnectionpage|helpLabel">Please enter the required information to connect to an LDAP directory. 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>
@@ -53,10 +59,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="ldapconnectionpage|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>
@@ -67,10 +73,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="ldapconnectionpage|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>
@@ -82,6 +88,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>
@@ -99,6 +106,8 @@
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="hexpand">True</property>
+                <property name="activates_default">True</property>
+                <property name="adjustment">adjustment1</property>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -128,10 +137,10 @@
           <object class="GtkLabel" id="baseDNLabel">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="xalign">1</property>
             <property name="label" translatable="yes" context="ldapconnectionpage|baseDNLabel">Base _DN:</property>
             <property name="use_underline">True</property>
             <property name="mnemonic_widget">baseDNEntry</property>
+            <property name="xalign">1</property>
           </object>
           <packing>
             <property name="left_attach">0</property>
@@ -143,6 +152,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>


More information about the Libreoffice-commits mailing list