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

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


 dbaccess/source/ui/dlg/detailpages.cxx                |  116 +++++++-----------
 dbaccess/source/ui/dlg/detailpages.hxx                |   31 ++--
 dbaccess/uiconfig/ui/generalspecialjdbcdetailspage.ui |   22 ++-
 3 files changed, 80 insertions(+), 89 deletions(-)

New commits:
commit 53d582156d0f699711e7993dc8898178b795e1ab
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Oct 24 09:20:51 2018 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Oct 24 17:11:59 2018 +0200

    weld OGeneralSpecialJDBCDetailsPage
    
    Change-Id: I0db0801167d36a04ebbe467b29862efcbb54e599
    Reviewed-on: https://gerrit.libreoffice.org/62289
    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 f733a5a1e902..c571aae44ae7 100644
--- a/dbaccess/source/ui/dlg/detailpages.cxx
+++ b/dbaccess/source/ui/dlg/detailpages.cxx
@@ -494,22 +494,21 @@ namespace dbaui
     }
 
     // OMySQLJDBCDetailsPage
-    OGeneralSpecialJDBCDetailsPage::OGeneralSpecialJDBCDetailsPage( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs ,sal_uInt16 _nPortId, bool bShowSocket )
-        :OCommonBehaviourTabPage(pParent, "GeneralSpecialJDBCDetails", "dbaccess/ui/generalspecialjdbcdetailspage.ui", _rCoreAttrs, OCommonBehaviourTabPageFlags::UseCharset)
-        ,m_nPortId(_nPortId)
-        ,m_bUseClass(true)
-    {
-        get(m_pEDHostname, "hostNameEntry");
-        get(m_pNFPortNumber, "portNumberSpinbutton");
-        m_pNFPortNumber->SetUseThousandSep(false);
-        get(m_pFTSocket, "socketLabel");
-        get(m_pEDSocket, "socketEntry");
-        get(m_pFTDriverClass, "driverClassLabel");
-        get(m_pEDDriverClass, "jdbcDriverClassEntry");
-        get(m_pTestJavaDriver, "testDriverClassButton");
-
-        const SfxStringItem* pUrlItem = _rCoreAttrs.GetItem<SfxStringItem>(DSID_CONNECTURL);
-        const DbuTypeCollectionItem* pTypesItem = _rCoreAttrs.GetItem<DbuTypeCollectionItem>(DSID_TYPECOLLECTION);
+    OGeneralSpecialJDBCDetailsPage::OGeneralSpecialJDBCDetailsPage(TabPageParent pParent, const SfxItemSet& rCoreAttrs ,sal_uInt16 _nPortId, bool bShowSocket)
+        : DBOCommonBehaviourTabPage(pParent, "dbaccess/ui/generalspecialjdbcdetailspage.ui", "GeneralSpecialJDBCDetails",
+                                    rCoreAttrs, OCommonBehaviourTabPageFlags::UseCharset)
+        , m_nPortId(_nPortId)
+        , m_bUseClass(true)
+        , m_xEDHostname(m_xBuilder->weld_entry("hostNameEntry"))
+        , m_xNFPortNumber(m_xBuilder->weld_spin_button("portNumberSpinbutton"))
+        , m_xFTSocket(m_xBuilder->weld_label("socketLabel"))
+        , m_xEDSocket(m_xBuilder->weld_entry("socketEntry"))
+        , m_xFTDriverClass(m_xBuilder->weld_label("driverClassLabel"))
+        , m_xEDDriverClass(m_xBuilder->weld_entry("jdbcDriverClassEntry"))
+        , m_xTestJavaDriver(m_xBuilder->weld_button("testDriverClassButton"))
+    {
+        const SfxStringItem* pUrlItem = rCoreAttrs.GetItem<SfxStringItem>(DSID_CONNECTURL);
+        const DbuTypeCollectionItem* pTypesItem = rCoreAttrs.GetItem<DbuTypeCollectionItem>(DSID_TYPECOLLECTION);
         ::dbaccess::ODsnTypeCollection* pTypeCollection = pTypesItem ? pTypesItem->getCollection() : nullptr;
         if (pTypeCollection && pUrlItem && pUrlItem->GetValue().getLength() )
         {
@@ -517,24 +516,23 @@ namespace dbaui
         }
         if ( m_sDefaultJdbcDriverName.getLength() )
         {
-            m_pEDDriverClass->SetModifyHdl(LINK(this,OGenericAdministrationPage,OnControlEditModifyHdl));
-            m_pEDDriverClass->SetModifyHdl(LINK(this, OGeneralSpecialJDBCDetailsPage, OnControlEditModifyHdl));
-            m_pTestJavaDriver->SetClickHdl(LINK(this,OGeneralSpecialJDBCDetailsPage,OnTestJavaClickHdl));
+            m_xEDDriverClass->connect_changed(LINK(this,OGenericAdministrationPage,OnControlEntryModifyHdl));
+            m_xTestJavaDriver->connect_clicked(LINK(this,OGeneralSpecialJDBCDetailsPage,OnTestJavaClickHdl));
         }
         else
         {
             m_bUseClass = false;
-            m_pFTDriverClass->Show(false);
-            m_pEDDriverClass->Show(false);
-            m_pTestJavaDriver->Show(false);
+            m_xFTDriverClass->show(false);
+            m_xEDDriverClass->show(false);
+            m_xTestJavaDriver->show(false);
         }
 
-        m_pFTSocket->Show(bShowSocket && !m_bUseClass);
-        m_pEDSocket->Show(bShowSocket && !m_bUseClass);
+        m_xFTSocket->show(bShowSocket && !m_bUseClass);
+        m_xEDSocket->show(bShowSocket && !m_bUseClass);
 
-        m_pEDHostname->SetModifyHdl(LINK(this,OGenericAdministrationPage,OnControlEditModifyHdl));
-        m_pNFPortNumber->SetModifyHdl(LINK(this,OGenericAdministrationPage,OnControlEditModifyHdl));
-        m_pEDSocket->SetModifyHdl(LINK(this,OGenericAdministrationPage,OnControlEditModifyHdl));
+        m_xEDHostname->connect_changed(LINK(this,OGenericAdministrationPage,OnControlEntryModifyHdl));
+        m_xNFPortNumber->connect_value_changed(LINK(this,OGenericAdministrationPage,OnControlSpinButtonModifyHdl));
+        m_xEDSocket->connect_changed(LINK(this,OGenericAdministrationPage,OnControlEntryModifyHdl));
     }
 
     OGeneralSpecialJDBCDetailsPage::~OGeneralSpecialJDBCDetailsPage()
@@ -542,26 +540,14 @@ namespace dbaui
         disposeOnce();
     }
 
-    void OGeneralSpecialJDBCDetailsPage::dispose()
-    {
-        m_pEDHostname.clear();
-        m_pNFPortNumber.clear();
-        m_pFTSocket.clear();
-        m_pEDSocket.clear();
-        m_pFTDriverClass.clear();
-        m_pEDDriverClass.clear();
-        m_pTestJavaDriver.clear();
-        OCommonBehaviourTabPage::dispose();
-    }
-
     bool OGeneralSpecialJDBCDetailsPage::FillItemSet( SfxItemSet* _rSet )
     {
-        bool bChangedSomething = OCommonBehaviourTabPage::FillItemSet(_rSet);
+        bool bChangedSomething = DBOCommonBehaviourTabPage::FillItemSet(_rSet);
         if ( m_bUseClass )
-            fillString(*_rSet,m_pEDDriverClass,DSID_JDBCDRIVERCLASS,bChangedSomething);
-        fillString(*_rSet,m_pEDHostname,DSID_CONN_HOSTNAME,bChangedSomething);
-        fillString(*_rSet,m_pEDSocket,DSID_CONN_SOCKET,bChangedSomething);
-        fillInt32(*_rSet,m_pNFPortNumber,m_nPortId,bChangedSomething );
+            fillString(*_rSet,m_xEDDriverClass.get(),DSID_JDBCDRIVERCLASS,bChangedSomething);
+        fillString(*_rSet,m_xEDHostname.get(),DSID_CONN_HOSTNAME,bChangedSomething);
+        fillString(*_rSet,m_xEDSocket.get(),DSID_CONN_SOCKET,bChangedSomething);
+        fillInt32(*_rSet,m_xNFPortNumber.get(),m_nPortId,bChangedSomething );
 
         return bChangedSomething;
     }
@@ -580,30 +566,30 @@ namespace dbaui
         {
             if ( m_bUseClass )
             {
-                m_pEDDriverClass->SetText(pDrvItem->GetValue());
-                m_pEDDriverClass->ClearModifyFlag();
+                m_xEDDriverClass->set_text(pDrvItem->GetValue());
+                m_xEDDriverClass->save_value();
             }
 
-            m_pEDHostname->SetText(pHostName->GetValue());
-            m_pEDHostname->ClearModifyFlag();
+            m_xEDHostname->set_text(pHostName->GetValue());
+            m_xEDHostname->save_value();
 
-            m_pNFPortNumber->SetValue(pPortNumber->GetValue());
-            m_pNFPortNumber->ClearModifyFlag();
+            m_xNFPortNumber->set_value(pPortNumber->GetValue());
+            m_xNFPortNumber->save_value();
 
-            m_pEDSocket->SetText(pSocket->GetValue());
-            m_pEDSocket->ClearModifyFlag();
+            m_xEDSocket->set_text(pSocket->GetValue());
+            m_xEDSocket->save_value();
         }
 
-        OCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
+        DBOCommonBehaviourTabPage::implInitControls(_rSet, _bSaveValue);
 
         // to get the correct value when saveValue was called by base class
-        if ( m_bUseClass && m_pEDDriverClass->GetText().trim().isEmpty() )
+        if ( m_bUseClass && m_xEDDriverClass->get_text().trim().isEmpty() )
         {
-            m_pEDDriverClass->SetText(m_sDefaultJdbcDriverName);
-            m_pEDDriverClass->SetModifyFlag();
+            m_xEDDriverClass->set_text(m_sDefaultJdbcDriverName);
+            m_xEDDriverClass->save_value();
         }
     }
-    IMPL_LINK_NOARG(OGeneralSpecialJDBCDetailsPage, OnTestJavaClickHdl, Button*, void)
+    IMPL_LINK_NOARG(OGeneralSpecialJDBCDetailsPage, OnTestJavaClickHdl, weld::Button&, void)
     {
         OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
         OSL_ENSURE(m_bUseClass,"Who called me?");
@@ -612,12 +598,12 @@ namespace dbaui
 #if HAVE_FEATURE_JAVA
         try
         {
-            if ( !m_pEDDriverClass->GetText().trim().isEmpty() )
+            if (!m_xEDDriverClass->get_text().trim().isEmpty())
             {
 // TODO change jvmaccess
                 ::rtl::Reference< jvmaccess::VirtualMachine > xJVM = ::connectivity::getJavaVM( m_pAdminDialog->getORB() );
-                m_pEDDriverClass->SetText(m_pEDDriverClass->GetText().trim()); // fdo#68341
-                bSuccess = ::connectivity::existsJavaClassByName(xJVM,m_pEDDriverClass->GetText());
+                m_xEDDriverClass->set_text(m_xEDDriverClass->get_text().trim()); // fdo#68341
+                bSuccess = ::connectivity::existsJavaClassByName(xJVM,m_xEDDriverClass->get_text());
             }
         }
         catch(Exception&)
@@ -632,8 +618,8 @@ namespace dbaui
 
     void OGeneralSpecialJDBCDetailsPage::callModifiedHdl(void* pControl)
     {
-        if ( m_bUseClass && pControl == m_pEDDriverClass )
-            m_pTestJavaDriver->Enable( !m_pEDDriverClass->GetText().trim().isEmpty() );
+        if (m_bUseClass && pControl == m_xEDDriverClass.get())
+            m_xTestJavaDriver->set_sensitive(!m_xEDDriverClass->get_text().trim().isEmpty());
 
         // tell the listener we were modified
         OGenericAdministrationPage::callModifiedHdl();
@@ -728,7 +714,7 @@ namespace dbaui
 
     VclPtr<SfxTabPage> ODriversSettings::CreateMySQLJDBC( TabPageParent pParent, const SfxItemSet* _rAttrSet )
     {
-        return VclPtr<OGeneralSpecialJDBCDetailsPage>::Create( pParent.pParent, *_rAttrSet,DSID_MYSQL_PORTNUMBER );
+        return VclPtr<OGeneralSpecialJDBCDetailsPage>::Create(pParent, *_rAttrSet,DSID_MYSQL_PORTNUMBER);
     }
 
     VclPtr<SfxTabPage> ODriversSettings::CreateMySQLNATIVE( TabPageParent pParent, const SfxItemSet* _rAttrSet )
@@ -736,9 +722,9 @@ namespace dbaui
         return VclPtr<MySQLNativePage>::Create( pParent.pParent, *_rAttrSet );
     }
 
-    VclPtr<SfxTabPage> ODriversSettings::CreateOracleJDBC( TabPageParent pParent, const SfxItemSet* _rAttrSet )
+    VclPtr<SfxTabPage> ODriversSettings::CreateOracleJDBC(TabPageParent pParent, const SfxItemSet* _rAttrSet)
     {
-        return VclPtr<OGeneralSpecialJDBCDetailsPage>::Create( pParent.pParent, *_rAttrSet,DSID_ORACLE_PORTNUMBER, false);
+        return VclPtr<OGeneralSpecialJDBCDetailsPage>::Create(pParent, *_rAttrSet,DSID_ORACLE_PORTNUMBER, false);
     }
 
     // OLDAPDetailsPage
diff --git a/dbaccess/source/ui/dlg/detailpages.hxx b/dbaccess/source/ui/dlg/detailpages.hxx
index 8b9c86dbb39e..d59e2ff065ce 100644
--- a/dbaccess/source/ui/dlg/detailpages.hxx
+++ b/dbaccess/source/ui/dlg/detailpages.hxx
@@ -202,16 +202,14 @@ namespace dbaui
     };
 
     // OGeneralSpecialJDBCDetailsPage
-    class OGeneralSpecialJDBCDetailsPage final : public OCommonBehaviourTabPage
+    class OGeneralSpecialJDBCDetailsPage final : public DBOCommonBehaviourTabPage
     {
     public:
-        OGeneralSpecialJDBCDetailsPage(   vcl::Window* pParent
-                                        , const SfxItemSet& _rCoreAttrs
-                                        , sal_uInt16 _nPortId
-                                        , bool bShowSocket = true
-                                        );
+        OGeneralSpecialJDBCDetailsPage(TabPageParent pParent,
+                                       const SfxItemSet& _rCoreAttrs,
+                                       sal_uInt16 _nPortId,
+                                       bool bShowSocket = true);
         virtual ~OGeneralSpecialJDBCDetailsPage() override;
-        virtual void dispose() override;
 
     private:
 
@@ -219,20 +217,19 @@ namespace dbaui
         virtual void implInitControls(const SfxItemSet& _rSet, bool _bSaveValue) override;
         virtual void callModifiedHdl(void* pControl = nullptr) override;
 
-        DECL_LINK(OnTestJavaClickHdl, Button*, void);
-
-        VclPtr<Edit>               m_pEDHostname;
-        VclPtr<NumericField>       m_pNFPortNumber;
-        VclPtr<FixedText>          m_pFTSocket;
-        VclPtr<Edit>               m_pEDSocket;
-
-        VclPtr<FixedText>          m_pFTDriverClass;
-        VclPtr<Edit>               m_pEDDriverClass;
-        VclPtr<PushButton>         m_pTestJavaDriver;
+        DECL_LINK(OnTestJavaClickHdl, weld::Button&, void);
 
         OUString                   m_sDefaultJdbcDriverName;
         sal_uInt16                 m_nPortId;
         bool                       m_bUseClass;
+
+        std::unique_ptr<weld::Entry> m_xEDHostname;
+        std::unique_ptr<weld::SpinButton> m_xNFPortNumber;
+        std::unique_ptr<weld::Label> m_xFTSocket;
+        std::unique_ptr<weld::Entry> m_xEDSocket;
+        std::unique_ptr<weld::Label> m_xFTDriverClass;
+        std::unique_ptr<weld::Entry> m_xEDDriverClass;
+        std::unique_ptr<weld::Button> m_xTestJavaDriver;
     };
 
     // MySQLNativePage
diff --git a/dbaccess/uiconfig/ui/generalspecialjdbcdetailspage.ui b/dbaccess/uiconfig/ui/generalspecialjdbcdetailspage.ui
index 3a90b8b1fa41..23106fb9ca1b 100644
--- a/dbaccess/uiconfig/ui/generalspecialjdbcdetailspage.ui
+++ b/dbaccess/uiconfig/ui/generalspecialjdbcdetailspage.ui
@@ -1,8 +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"/>
-  <requires lib="LibreOffice" version="1.0"/>
+  <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="GtkBox" id="GeneralSpecialJDBCDetails">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
@@ -35,10 +39,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="generalspecialjdbcdetailspage|label2">_Host name:</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>
@@ -49,10 +53,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="generalspecialjdbcdetailspage|label3">_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>
@@ -64,6 +68,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>
@@ -74,8 +79,8 @@
                   <object class="GtkLabel" id="socketLabel">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">1</property>
                     <property name="label" translatable="yes" context="generalspecialjdbcdetailspage|socketLabel">Socket:</property>
+                    <property name="xalign">1</property>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
@@ -86,10 +91,10 @@
                   <object class="GtkLabel" id="driverClassLabel">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">1</property>
                     <property name="label" translatable="yes" context="generalspecialjdbcdetailspage|driverClassLabel">MySQL JDBC d_river class:</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">jdbcDriverClassEntry</property>
+                    <property name="xalign">1</property>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
@@ -101,6 +106,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>
@@ -124,6 +130,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>
@@ -135,6 +142,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="left_attach">1</property>
@@ -206,7 +214,7 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="dbulo-CharSetListBox" id="charset">
+                  <object class="GtkComboBox" id="charset">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="hexpand">True</property>


More information about the Libreoffice-commits mailing list