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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Oct 24 15:08:40 UTC 2018


 dbaccess/source/ui/dlg/detailpages.cxx |   83 +++++++++++++--------------------
 dbaccess/source/ui/dlg/detailpages.hxx |   20 +++----
 dbaccess/uiconfig/ui/ldappage.ui       |   23 +++++++--
 3 files changed, 64 insertions(+), 62 deletions(-)

New commits:
commit 33b76785eeff2a261a0a35a4041180d175e3f8e4
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Oct 23 21:25:19 2018 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Oct 24 17:08:11 2018 +0200

    weld OLDAPDetailsPage
    
    Change-Id: I9477a52419db08812ccef95107c410685449fa6c
    Reviewed-on: https://gerrit.libreoffice.org/62285
    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/detailpages.cxx b/dbaccess/source/ui/dlg/detailpages.cxx
index 6c9c8e6d10ff..869f7aaa197e 100644
--- a/dbaccess/source/ui/dlg/detailpages.cxx
+++ b/dbaccess/source/ui/dlg/detailpages.cxx
@@ -757,24 +757,21 @@ namespace dbaui
     }
 
     // OLDAPDetailsPage
-    OLDAPDetailsPage::OLDAPDetailsPage( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs )
-        :OCommonBehaviourTabPage(pParent, "LDAP", "dbaccess/ui/ldappage.ui", _rCoreAttrs, OCommonBehaviourTabPageFlags::NONE)
-    {
-        get(m_pETBaseDN, "baseDNEntry");
-        get(m_pCBUseSSL, "useSSLCheckbutton");
-        get(m_pNFPortNumber, "portNumberSpinbutton");
-        m_pNFPortNumber->SetUseThousandSep(false);
-        get(m_pNFRowCount, "LDAPRowCountspinbutton");
+    OLDAPDetailsPage::OLDAPDetailsPage(TabPageParent pParent, const SfxItemSet& rCoreAttrs)
+        : DBOCommonBehaviourTabPage(pParent, "dbaccess/ui/ldappage.ui", "LDAP",
+                                    rCoreAttrs, OCommonBehaviourTabPageFlags::NONE)
+        , m_xETBaseDN(m_xBuilder->weld_entry("baseDNEntry"))
+        , m_xCBUseSSL(m_xBuilder->weld_check_button("useSSLCheckbutton"))
+        , m_xNFPortNumber(m_xBuilder->weld_spin_button("portNumberSpinbutton"))
+        , m_xNFRowCount(m_xBuilder->weld_spin_button("LDAPRowCountspinbutton"))
+    {
+        m_xETBaseDN->connect_changed(LINK(this,OGenericAdministrationPage,OnControlEntryModifyHdl));
+        m_xNFPortNumber->connect_value_changed(LINK(this,OGenericAdministrationPage,OnControlSpinButtonModifyHdl));
+        m_xNFRowCount->connect_value_changed(LINK(this,OGenericAdministrationPage,OnControlSpinButtonModifyHdl));
 
-        m_pETBaseDN->SetModifyHdl(LINK(this,OGenericAdministrationPage,OnControlEditModifyHdl));
-        m_pCBUseSSL->SetToggleHdl( LINK(this, OGenericAdministrationPage, ControlModifiedCheckBoxHdl) );
-        m_pNFPortNumber->SetModifyHdl(LINK(this,OGenericAdministrationPage,OnControlEditModifyHdl));
-        m_pNFRowCount->SetModifyHdl(LINK(this,OGenericAdministrationPage,OnControlEditModifyHdl));
-
-        m_pNFRowCount->SetUseThousandSep(false);
         m_iNormalPort = 389;
         m_iSSLPort    = 636;
-        m_pCBUseSSL->SetClickHdl(LINK(this, OLDAPDetailsPage,OnCheckBoxClick));
+        m_xCBUseSSL->connect_toggled(LINK(this, OLDAPDetailsPage, OnCheckBoxClick));
     }
 
     OLDAPDetailsPage::~OLDAPDetailsPage()
@@ -782,45 +779,35 @@ namespace dbaui
         disposeOnce();
     }
 
-    void OLDAPDetailsPage::dispose()
-    {
-        m_pETBaseDN.clear();
-        m_pCBUseSSL.clear();
-        m_pNFPortNumber.clear();
-        m_pNFRowCount.clear();
-        OCommonBehaviourTabPage::dispose();
-    }
-
-    VclPtr<SfxTabPage> ODriversSettings::CreateLDAP( TabPageParent pParent, const SfxItemSet* _rAttrSet )
+    VclPtr<SfxTabPage> ODriversSettings::CreateLDAP(TabPageParent pParent, const SfxItemSet* _rAttrSet)
     {
-        return VclPtr<OLDAPDetailsPage>::Create( pParent.pParent, *_rAttrSet );
+        return VclPtr<OLDAPDetailsPage>::Create(pParent, *_rAttrSet);
     }
 
     bool OLDAPDetailsPage::FillItemSet( SfxItemSet* _rSet )
     {
-        bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet);
+        bool bChangedSomething = DBOCommonBehaviourTabPage::FillItemSet(_rSet);
 
-        fillString(*_rSet,m_pETBaseDN,DSID_CONN_LDAP_BASEDN,bChangedSomething);
-        fillInt32(*_rSet,m_pNFPortNumber,DSID_CONN_LDAP_PORTNUMBER,bChangedSomething);
-        fillInt32(*_rSet,m_pNFRowCount,DSID_CONN_LDAP_ROWCOUNT,bChangedSomething);
-        fillBool(*_rSet,m_pCBUseSSL,DSID_CONN_LDAP_USESSL,bChangedSomething);
+        fillString(*_rSet,m_xETBaseDN.get(),DSID_CONN_LDAP_BASEDN,bChangedSomething);
+        fillInt32(*_rSet,m_xNFPortNumber.get(),DSID_CONN_LDAP_PORTNUMBER,bChangedSomething);
+        fillInt32(*_rSet,m_xNFRowCount.get(),DSID_CONN_LDAP_ROWCOUNT,bChangedSomething);
+        fillBool(*_rSet,m_xCBUseSSL.get(),DSID_CONN_LDAP_USESSL,false,bChangedSomething);
         return bChangedSomething;
     }
-    IMPL_LINK( OLDAPDetailsPage, OnCheckBoxClick, Button*, pCheckBox, void )
+
+    IMPL_LINK(OLDAPDetailsPage, OnCheckBoxClick, weld::ToggleButton&, rCheckBox, void)
     {
+        OnControlModifiedButtonClick(rCheckBox);
         callModifiedHdl();
-        if ( pCheckBox == m_pCBUseSSL)
+        if (m_xCBUseSSL->get_active())
         {
-            if ( m_pCBUseSSL->IsChecked() )
-            {
-                m_iNormalPort = static_cast<sal_Int32>(m_pNFPortNumber->GetValue());
-                m_pNFPortNumber->SetValue(m_iSSLPort);
-            }
-            else
-            {
-                m_iSSLPort = static_cast<sal_Int32>(m_pNFPortNumber->GetValue());
-                m_pNFPortNumber->SetValue(m_iNormalPort);
-            }
+            m_iNormalPort = m_xNFPortNumber->get_value();
+            m_xNFPortNumber->set_value(m_iSSLPort);
+        }
+        else
+        {
+            m_iSSLPort = m_xNFPortNumber->get_value();
+            m_xNFPortNumber->set_value(m_iNormalPort);
         }
     }
 
@@ -837,13 +824,13 @@ namespace dbaui
 
         if ( bValid )
         {
-            m_pETBaseDN->SetText(pBaseDN->GetValue());
-            m_pNFPortNumber->SetValue(pPortNumber->GetValue());
-            m_pNFRowCount->SetValue(pRowCount->GetValue());
-            m_pCBUseSSL->Check(pUseSSL->GetValue());
+            m_xETBaseDN->set_text(pBaseDN->GetValue());
+            m_xNFPortNumber->set_value(pPortNumber->GetValue());
+            m_xNFRowCount->set_value(pRowCount->GetValue());
+            m_xCBUseSSL->set_active(pUseSSL->GetValue());
         }
 
-        OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
+        DBOCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
     }
 
     // OTextDetailsPage
diff --git a/dbaccess/source/ui/dlg/detailpages.hxx b/dbaccess/source/ui/dlg/detailpages.hxx
index a998a4dbd696..e15a33ef08f8 100644
--- a/dbaccess/source/ui/dlg/detailpages.hxx
+++ b/dbaccess/source/ui/dlg/detailpages.hxx
@@ -263,25 +263,25 @@ namespace dbaui
     };
 
     // OOdbcDetailsPage
-    class OLDAPDetailsPage : public OCommonBehaviourTabPage
+    class OLDAPDetailsPage : public DBOCommonBehaviourTabPage
     {
     public:
         virtual bool        FillItemSet ( SfxItemSet* _rCoreAttrs ) override;
 
-        OLDAPDetailsPage( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs );
+        OLDAPDetailsPage(TabPageParent pParent, const SfxItemSet& rCoreAttrs);
         virtual ~OLDAPDetailsPage() override;
-        virtual void dispose() override;
     protected:
         virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) override;
     private:
-        VclPtr<Edit>               m_pETBaseDN;
-        VclPtr<CheckBox>           m_pCBUseSSL;
-        VclPtr<NumericField>       m_pNFPortNumber;
-        VclPtr<NumericField>       m_pNFRowCount;
+        sal_Int32 m_iSSLPort;
+        sal_Int32 m_iNormalPort;
+
+        std::unique_ptr<weld::Entry> m_xETBaseDN;
+        std::unique_ptr<weld::CheckButton> m_xCBUseSSL;
+        std::unique_ptr<weld::SpinButton> m_xNFPortNumber;
+        std::unique_ptr<weld::SpinButton> m_xNFRowCount;
 
-        sal_Int32           m_iSSLPort;
-        sal_Int32           m_iNormalPort;
-        DECL_LINK( OnCheckBoxClick, Button*, void );
+        DECL_LINK(OnCheckBoxClick, weld::ToggleButton&, void);
     };
 
     // OTextDetailsPage
diff --git a/dbaccess/uiconfig/ui/ldappage.ui b/dbaccess/uiconfig/ui/ldappage.ui
index 4d7bcc292f21..d98767375c1c 100644
--- a/dbaccess/uiconfig/ui/ldappage.ui
+++ b/dbaccess/uiconfig/ui/ldappage.ui
@@ -1,7 +1,17 @@
 <?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">65535</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustment2">
+    <property name="upper">65535</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
   <object class="GtkBox" id="LDAP">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
@@ -35,10 +45,10 @@
                   <object class="GtkLabel" id="label1">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">1</property>
                     <property name="label" translatable="yes" context="ldappage|label1">_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>
@@ -50,6 +60,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>
@@ -76,10 +87,10 @@
                   <object class="GtkLabel" id="label2">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">1</property>
                     <property name="label" translatable="yes" context="ldappage|label2">_Port number:</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">portNumberSpinbutton</property>
+                    <property name="xalign">1</property>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
@@ -91,6 +102,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="left_attach">1</property>
@@ -101,10 +114,10 @@
                   <object class="GtkLabel" id="label3">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">1</property>
                     <property name="label" translatable="yes" context="ldappage|label3">Maximum number of _records:</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">LDAPRowCountspinbutton</property>
+                    <property name="xalign">1</property>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
@@ -116,6 +129,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">adjustment2</property>
                   </object>
                   <packing>
                     <property name="left_attach">1</property>


More information about the Libreoffice-commits mailing list