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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Aug 1 20:19:30 UTC 2019


 dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx |   45 ++++++++--------------
 dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx |   14 ++----
 dbaccess/uiconfig/ui/dbwizmysqlintropage.ui       |    9 ++--
 3 files changed, 28 insertions(+), 40 deletions(-)

New commits:
commit a9f8f86387e7ef7eb5dd17528075e510a1b084a5
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Aug 1 18:14:35 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Aug 1 22:18:32 2019 +0200

    weld OMySQLIntroPageSetup
    
    Change-Id: I8378860bfc5cb087b5c04a73e99965afdee4c23f
    Reviewed-on: https://gerrit.libreoffice.org/76822
    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 24cae55f638b..d3f3d88205f5 100644
--- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
+++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
@@ -242,38 +242,27 @@ using namespace ::com::sun::star;
         OGenericAdministrationPage::callModifiedHdl();
     }
 
-    VclPtr<OMySQLIntroPageSetup> OMySQLIntroPageSetup::CreateMySQLIntroTabPage( vcl::Window* _pParent, const SfxItemSet& _rAttrSet )
+    VclPtr<OMySQLIntroPageSetup> OMySQLIntroPageSetup::CreateMySQLIntroTabPage(TabPageParent pParent, const SfxItemSet& rAttrSet)
     {
-        return VclPtr<OMySQLIntroPageSetup>::Create( _pParent, _rAttrSet);
+        return VclPtr<OMySQLIntroPageSetup>::Create(pParent, rAttrSet);
     }
 
-
-    OMySQLIntroPageSetup::OMySQLIntroPageSetup( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs )
-            :OGenericAdministrationPage(pParent, "DBWizMysqlIntroPage", "dbaccess/ui/dbwizmysqlintropage.ui", _rCoreAttrs)
+    OMySQLIntroPageSetup::OMySQLIntroPageSetup(TabPageParent pParent, const SfxItemSet& _rCoreAttrs)
+        : OGenericAdministrationPage(pParent, "dbaccess/ui/dbwizmysqlintropage.ui", "DBWizMysqlIntroPage", _rCoreAttrs)
+        , m_xODBCDatabase(m_xBuilder->weld_radio_button("odbc"))
+        , m_xJDBCDatabase(m_xBuilder->weld_radio_button("jdbc"))
+        , m_xNATIVEDatabase(m_xBuilder->weld_radio_button("directly"))
     {
-        get(m_pODBCDatabase, "odbc");
-        get(m_pJDBCDatabase, "jdbc");
-        get(m_pNATIVEDatabase, "directly");
-
-        m_pODBCDatabase->SetToggleHdl(LINK(this, OMySQLIntroPageSetup, OnSetupModeSelected));
-        m_pJDBCDatabase->SetToggleHdl(LINK(this, OMySQLIntroPageSetup, OnSetupModeSelected));
-        m_pNATIVEDatabase->SetToggleHdl(LINK(this, OMySQLIntroPageSetup, OnSetupModeSelected));
+        m_xODBCDatabase->connect_toggled(LINK(this, OMySQLIntroPageSetup, OnSetupModeSelected));
+        m_xJDBCDatabase->connect_toggled(LINK(this, OMySQLIntroPageSetup, OnSetupModeSelected));
+        m_xNATIVEDatabase->connect_toggled(LINK(this, OMySQLIntroPageSetup, OnSetupModeSelected));
     }
 
     OMySQLIntroPageSetup::~OMySQLIntroPageSetup()
     {
-        disposeOnce();
-    }
-
-    void OMySQLIntroPageSetup::dispose()
-    {
-        m_pODBCDatabase.clear();
-        m_pJDBCDatabase.clear();
-        m_pNATIVEDatabase.clear();
-        OGenericAdministrationPage::dispose();
     }
 
-    IMPL_LINK_NOARG(OMySQLIntroPageSetup, OnSetupModeSelected, RadioButton&, void)
+    IMPL_LINK_NOARG(OMySQLIntroPageSetup, OnSetupModeSelected, weld::ToggleButton&, void)
     {
         maClickHdl.Call( this );
     }
@@ -284,17 +273,17 @@ using namespace ::com::sun::star;
         const DbuTypeCollectionItem* pCollectionItem = dynamic_cast<const DbuTypeCollectionItem*>( _rSet.GetItem(DSID_TYPECOLLECTION) );
         bool bHasMySQLNative = ( pCollectionItem != nullptr ) && pCollectionItem->getCollection()->hasDriver( "sdbc:mysql:mysqlc:" );
         if ( bHasMySQLNative )
-            m_pNATIVEDatabase->Show();
+            m_xNATIVEDatabase->show();
 
         // if any of the options is checked, then there's nothing to do
-        if ( m_pODBCDatabase->IsChecked() || m_pJDBCDatabase->IsChecked() || m_pNATIVEDatabase->IsChecked() )
+        if ( m_xODBCDatabase->get_active() || m_xJDBCDatabase->get_active() || m_xNATIVEDatabase->get_active() )
             return;
 
         // prefer "native" or "JDBC"
         if ( bHasMySQLNative )
-            m_pNATIVEDatabase->Check();
+            m_xNATIVEDatabase->set_active(true);
         else
-            m_pJDBCDatabase->Check();
+            m_xJDBCDatabase->set_active(true);
     }
 
     void OMySQLIntroPageSetup::fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& /*_rControlList*/)
@@ -313,9 +302,9 @@ using namespace ::com::sun::star;
 
     OMySQLIntroPageSetup::ConnectionType OMySQLIntroPageSetup::getMySQLMode()
     {
-        if (m_pJDBCDatabase->IsChecked())
+        if (m_xJDBCDatabase->get_active())
             return VIA_JDBC;
-        else if (m_pNATIVEDatabase->IsChecked())
+        else if (m_xNATIVEDatabase->get_active())
             return VIA_NATIVE;
         else
             return VIA_ODBC;
diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
index 099af83ba54a..ffa1198858bb 100644
--- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
+++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
@@ -200,11 +200,10 @@ namespace dbaui
             VIA_NATIVE
         };
 
-        OMySQLIntroPageSetup( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs);
+        OMySQLIntroPageSetup(TabPageParent pParent, const SfxItemSet& rCoreAttrs);
         virtual ~OMySQLIntroPageSetup() override;
-        virtual void dispose() override;
 
-        static VclPtr<OMySQLIntroPageSetup> CreateMySQLIntroTabPage( vcl::Window* _pParent, const SfxItemSet& _rAttrSet );
+        static VclPtr<OMySQLIntroPageSetup> CreateMySQLIntroTabPage(TabPageParent pParent, const SfxItemSet& rAttrSet);
         ConnectionType      getMySQLMode();
         void                SetClickHdl( const Link<OMySQLIntroPageSetup *, void>& rLink ) { maClickHdl = rLink; }
 
@@ -215,13 +214,12 @@ namespace dbaui
         virtual void fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override;
 
     private:
-        VclPtr<RadioButton>         m_pODBCDatabase;
-        VclPtr<RadioButton>         m_pJDBCDatabase;
-        VclPtr<RadioButton>         m_pNATIVEDatabase;
+        std::unique_ptr<weld::RadioButton> m_xODBCDatabase;
+        std::unique_ptr<weld::RadioButton> m_xJDBCDatabase;
+        std::unique_ptr<weld::RadioButton> m_xNATIVEDatabase;
         Link<OMySQLIntroPageSetup *, void> maClickHdl;
 
-        DECL_LINK(OnSetupModeSelected, RadioButton&, void);
-
+        DECL_LINK(OnSetupModeSelected, weld::ToggleButton&, void);
     };
 
     // OAuthentificationPageSetup
diff --git a/dbaccess/uiconfig/ui/dbwizmysqlintropage.ui b/dbaccess/uiconfig/ui/dbwizmysqlintropage.ui
index 59e975b2711b..8f1d39966b27 100644
--- a/dbaccess/uiconfig/ui/dbwizmysqlintropage.ui
+++ b/dbaccess/uiconfig/ui/dbwizmysqlintropage.ui
@@ -1,5 +1,5 @@
 <?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="GtkBox" id="DBWizMysqlIntroPage">
@@ -34,11 +34,12 @@
                   <object class="GtkLabel" id="label2">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
                     <property name="label" translatable="yes" context="dbwizmysqlintropage|label2">You can connect to a MySQL database using either ODBC or JDBC.
 Please contact your system administrator if you are unsure about the following settings.</property>
                     <property name="wrap">True</property>
+                    <property name="width_chars">100</property>
                     <property name="max_width_chars">100</property>
+                    <property name="xalign">0</property>
                   </object>
                   <packing>
                     <property name="expand">False</property>
@@ -73,6 +74,7 @@ Please contact your system administrator if you are unsure about the following s
                                 <property name="use_underline">True</property>
                                 <property name="xalign">0</property>
                                 <property name="draw_indicator">True</property>
+                                <property name="group">jdbc</property>
                               </object>
                               <packing>
                                 <property name="expand">False</property>
@@ -90,7 +92,6 @@ Please contact your system administrator if you are unsure about the following s
                                 <property name="xalign">0</property>
                                 <property name="active">True</property>
                                 <property name="draw_indicator">True</property>
-                                <property name="group">odbc</property>
                               </object>
                               <packing>
                                 <property name="expand">False</property>
@@ -106,7 +107,7 @@ Please contact your system administrator if you are unsure about the following s
                                 <property name="use_underline">True</property>
                                 <property name="xalign">0</property>
                                 <property name="draw_indicator">True</property>
-                                <property name="group">odbc</property>
+                                <property name="group">jdbc</property>
                               </object>
                               <packing>
                                 <property name="expand">False</property>


More information about the Libreoffice-commits mailing list