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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Oct 25 07:57:12 UTC 2018


 dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx |   64 +++++++++-------------
 dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx |   19 +++---
 dbaccess/uiconfig/ui/dbwizspreadsheetpage.ui      |    1 
 dbaccess/uiconfig/ui/jdbcconnectionpage.ui        |   48 +++++++++++-----
 4 files changed, 72 insertions(+), 60 deletions(-)

New commits:
commit c9e55e2b9e5c9a536e512151be91b1d73e0ee6e9
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Oct 24 16:11:46 2018 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Oct 25 09:56:45 2018 +0200

    weld OJDBCConnectionPageSetup
    
    Change-Id: I8c194c8efa17079253c857e171af203c17d3aff3
    Reviewed-on: https://gerrit.libreoffice.org/62323
    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 d818b2dc12a8..eafbc7eb40df 100644
--- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
+++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
@@ -563,21 +563,21 @@ using namespace ::com::sun::star;
         OGenericAdministrationPage::callModifiedHdl();
     }
 
-    VclPtr<OGenericAdministrationPage> OJDBCConnectionPageSetup::CreateJDBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet )
+    VclPtr<OGenericAdministrationPage> OJDBCConnectionPageSetup::CreateJDBCTabPage(TabPageParent pParent, const SfxItemSet& _rAttrSet)
     {
-        return VclPtr<OJDBCConnectionPageSetup>::Create( pParent, _rAttrSet);
+        return VclPtr<OJDBCConnectionPageSetup>::Create(pParent, _rAttrSet);
     }
 
     // OMySQLJDBCConnectionPageSetup
-    OJDBCConnectionPageSetup::OJDBCConnectionPageSetup( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs)
-        :OConnectionTabPageSetup(pParent, "JDBCConnectionPage", "dbaccess/ui/jdbcconnectionpage.ui", _rCoreAttrs,
+    OJDBCConnectionPageSetup::OJDBCConnectionPageSetup(TabPageParent pParent, const SfxItemSet& rCoreAttrs)
+        : DBOConnectionTabPageSetup(pParent, "dbaccess/ui/jdbcconnectionpage.ui", "JDBCConnectionPage", rCoreAttrs,
                                 STR_JDBC_HELPTEXT, STR_JDBC_HEADERTEXT, STR_COMMONURL)
+        , m_xFTDriverClass(m_xBuilder->weld_label("jdbcLabel"))
+        , m_xETDriverClass(m_xBuilder->weld_entry("jdbcEntry"))
+        , m_xPBTestJavaDriver(m_xBuilder->weld_button("jdbcButton"))
     {
-        get(m_pFTDriverClass, "jdbcLabel");
-        get(m_pETDriverClass, "jdbcEntry");
-        get(m_pPBTestJavaDriver, "jdbcButton");
-        m_pETDriverClass->SetModifyHdl(LINK(this, OJDBCConnectionPageSetup, OnEditModified));
-        m_pPBTestJavaDriver->SetClickHdl(LINK(this,OJDBCConnectionPageSetup,OnTestJavaClickHdl));
+        m_xETDriverClass->connect_changed(LINK(this, OJDBCConnectionPageSetup, OnEditModified));
+        m_xPBTestJavaDriver->connect_clicked(LINK(this,OJDBCConnectionPageSetup,OnTestJavaClickHdl));
     }
 
     OJDBCConnectionPageSetup::~OJDBCConnectionPageSetup()
@@ -585,28 +585,20 @@ using namespace ::com::sun::star;
         disposeOnce();
     }
 
-    void OJDBCConnectionPageSetup::dispose()
-    {
-        m_pFTDriverClass.clear();
-        m_pETDriverClass.clear();
-        m_pPBTestJavaDriver.clear();
-        OConnectionTabPageSetup::dispose();
-    }
-
     void OJDBCConnectionPageSetup::fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList)
     {
-        _rControlList.emplace_back(new OSaveValueWrapper<Edit>(m_pETDriverClass));
+        _rControlList.emplace_back(new OSaveValueWidgetWrapper<weld::Entry>(m_xETDriverClass.get()));
     }
 
     void OJDBCConnectionPageSetup::fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList)
     {
-        _rControlList.emplace_back(new ODisableWrapper<FixedText>(m_pFTDriverClass));
+        _rControlList.emplace_back(new ODisableWidgetWrapper<weld::Label>(m_xFTDriverClass.get()));
     }
 
     bool OJDBCConnectionPageSetup::FillItemSet( SfxItemSet* _rSet )
     {
-        bool bChangedSomething = OConnectionTabPageSetup::FillItemSet(_rSet);
-        fillString(*_rSet,m_pETDriverClass,DSID_JDBCDRIVERCLASS,bChangedSomething);
+        bool bChangedSomething = DBOConnectionTabPageSetup::FillItemSet(_rSet);
+        fillString(*_rSet,m_xETDriverClass.get(),DSID_JDBCDRIVERCLASS,bChangedSomething);
         return bChangedSomething;
     }
 
@@ -625,19 +617,19 @@ using namespace ::com::sun::star;
                 OUString sDefaultJdbcDriverName = m_pCollection->getJavaDriverClass(m_eType);
                 if ( !sDefaultJdbcDriverName.isEmpty() )
                 {
-                    m_pETDriverClass->SetText(sDefaultJdbcDriverName);
-                    m_pETDriverClass->SetModifyFlag();
+                    m_xETDriverClass->set_text(sDefaultJdbcDriverName);
+                    m_xETDriverClass->save_value();
                 }
             }
             else
             {
-                m_pETDriverClass->SetText(pDrvItem->GetValue());
-                m_pETDriverClass->ClearModifyFlag();
+                m_xETDriverClass->set_text(pDrvItem->GetValue());
+                m_xETDriverClass->save_value();
             }
         }
         bool bEnable = pDrvItem->GetValue().getLength() != 0;
-        m_pPBTestJavaDriver->Enable(bEnable);
-        OConnectionTabPageSetup::implInitControls(_rSet, _bSaveValue);
+        m_xPBTestJavaDriver->set_sensitive(bEnable);
+        DBOConnectionTabPageSetup::implInitControls(_rSet, _bSaveValue);
 
         SetRoadmapStateValue(checkTestConnection());
     }
@@ -645,24 +637,24 @@ using namespace ::com::sun::star;
     bool OJDBCConnectionPageSetup::checkTestConnection()
     {
         OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
-        bool bEnableTestConnection = !m_pConnectionURL->IsVisible() || !m_pConnectionURL->GetTextNoPrefix().isEmpty();
-        bEnableTestConnection = bEnableTestConnection && (!m_pETDriverClass->GetText().isEmpty());
+        bool bEnableTestConnection = !m_xConnectionURL->get_visible() || !m_xConnectionURL->GetTextNoPrefix().isEmpty();
+        bEnableTestConnection = bEnableTestConnection && (!m_xETDriverClass->get_text().isEmpty());
         return bEnableTestConnection;
     }
 
-    IMPL_LINK_NOARG(OJDBCConnectionPageSetup, OnTestJavaClickHdl, Button*, void)
+    IMPL_LINK_NOARG(OJDBCConnectionPageSetup, OnTestJavaClickHdl, weld::Button&, void)
     {
         OSL_ENSURE(m_pAdminDialog,"No Admin dialog set! ->GPF");
         bool bSuccess = false;
 #if HAVE_FEATURE_JAVA
         try
         {
-            if ( !m_pETDriverClass->GetText().isEmpty() )
+            if ( !m_xETDriverClass->get_text().isEmpty() )
             {
 // TODO change jvmaccess
                 ::rtl::Reference< jvmaccess::VirtualMachine > xJVM = ::connectivity::getJavaVM( m_pAdminDialog->getORB() );
-                m_pETDriverClass->SetText(m_pETDriverClass->GetText().trim()); // fdo#68341
-                bSuccess = xJVM.is() && ::connectivity::existsJavaClassByName(xJVM,m_pETDriverClass->GetText());
+                m_xETDriverClass->set_text(m_xETDriverClass->get_text().trim()); // fdo#68341
+                bSuccess = xJVM.is() && ::connectivity::existsJavaClassByName(xJVM,m_xETDriverClass->get_text());
             }
         }
         catch(css::uno::Exception&)
@@ -675,10 +667,10 @@ using namespace ::com::sun::star;
         aMsg.run();
     }
 
-    IMPL_LINK(OJDBCConnectionPageSetup, OnEditModified, Edit&, _rEdit, void)
+    IMPL_LINK(OJDBCConnectionPageSetup, OnEditModified, weld::Entry&, rEdit, void)
     {
-        if ( &_rEdit == m_pETDriverClass )
-            m_pPBTestJavaDriver->Enable( !m_pETDriverClass->GetText().isEmpty() );
+        if (&rEdit == m_xETDriverClass.get())
+            m_xPBTestJavaDriver->set_sensitive(!m_xETDriverClass->get_text().isEmpty());
         SetRoadmapStateValue(checkTestConnection());
         // tell the listener we were modified
         callModifiedHdl();
diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
index f634232113ae..ec41c7281ad2 100644
--- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
+++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.hxx
@@ -168,13 +168,12 @@ namespace dbaui
     };
 
     // OJDBCConnectionPageSetup
-    class OJDBCConnectionPageSetup final : public OConnectionTabPageSetup
+    class OJDBCConnectionPageSetup final : public DBOConnectionTabPageSetup
     {
     public:
-                OJDBCConnectionPageSetup( vcl::Window* pParent, const SfxItemSet& _rCoreAttrs );
+        OJDBCConnectionPageSetup(TabPageParent pParent, const SfxItemSet& _rCoreAttrs);
         virtual ~OJDBCConnectionPageSetup() override;
-        virtual void dispose() override;
-        static VclPtr<OGenericAdministrationPage> CreateJDBCTabPage( vcl::Window* pParent, const SfxItemSet& _rAttrSet );
+        static VclPtr<OGenericAdministrationPage> CreateJDBCTabPage(TabPageParent pParent, const SfxItemSet& rAttrSet);
 
     private:
         virtual bool checkTestConnection() override;
@@ -184,14 +183,14 @@ namespace dbaui
         virtual void fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override;
         virtual void fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override;
 
-        DECL_LINK(OnTestJavaClickHdl, Button*, void);
-        DECL_LINK(OnEditModified, Edit&, void);
-        VclPtr<FixedText>          m_pFTDriverClass;
-        VclPtr<Edit>               m_pETDriverClass;
-        VclPtr<PushButton>         m_pPBTestJavaDriver;
+        DECL_LINK(OnTestJavaClickHdl, weld::Button&, void);
+        DECL_LINK(OnEditModified, weld::Entry&, void);
+        std::unique_ptr<weld::Label> m_xFTDriverClass;
+        std::unique_ptr<weld::Entry> m_xETDriverClass;
+        std::unique_ptr<weld::Button> m_xPBTestJavaDriver;
     };
 
-    // OJDBCConnectionPageSetup
+    // OMySQLIntroPageSetup
     class OMySQLIntroPageSetup : public OGenericAdministrationPage
     {
     public:
diff --git a/dbaccess/uiconfig/ui/dbwizspreadsheetpage.ui b/dbaccess/uiconfig/ui/dbwizspreadsheetpage.ui
index b104f4d664c1..2dbe3dd2eb6b 100644
--- a/dbaccess/uiconfig/ui/dbwizspreadsheetpage.ui
+++ b/dbaccess/uiconfig/ui/dbwizspreadsheetpage.ui
@@ -104,6 +104,7 @@
                           <object class="GtkEntry" id="browseurl">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
+                            <property name="activates_default">True</property>
                           </object>
                           <packing>
                             <property name="left_attach">1</property>
diff --git a/dbaccess/uiconfig/ui/jdbcconnectionpage.ui b/dbaccess/uiconfig/ui/jdbcconnectionpage.ui
index 70075da1f9f2..8f62f3f821c1 100644
--- a/dbaccess/uiconfig/ui/jdbcconnectionpage.ui
+++ b/dbaccess/uiconfig/ui/jdbcconnectionpage.ui
@@ -1,8 +1,7 @@
 <?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="GtkBox" id="JDBCConnectionPage">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
@@ -32,10 +31,10 @@
       <object class="GtkLabel" id="helptext">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="xalign">0</property>
         <property name="label" translatable="yes" context="jdbcconnectionpage|helptext">Please enter the required information to connect to a JDBC database. Please contact your system administrator if you are unsure about the following settings.</property>
         <property name="wrap">True</property>
         <property name="max_width_chars">60</property>
+        <property name="xalign">0</property>
       </object>
       <packing>
         <property name="expand">False</property>
@@ -64,17 +63,6 @@
           </packing>
         </child>
         <child>
-          <object class="dbulo-ConnectionURLEdit" id="browseurl">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="hexpand">True</property>
-          </object>
-          <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">1</property>
-          </packing>
-        </child>
-        <child>
           <object class="GtkButton" id="create">
             <property name="label" translatable="yes" context="jdbcconnectionpage|create">_Create New</property>
             <property name="visible">True</property>
@@ -100,6 +88,37 @@
             <property name="top_attach">1</property>
           </packing>
         </child>
+        <child>
+          <object class="GtkGrid">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <child>
+              <object class="GtkEntry" id="browseurl">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="hexpand">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="browselabel">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">0</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">1</property>
+          </packing>
+        </child>
       </object>
       <packing>
         <property name="expand">False</property>
@@ -141,6 +160,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="expand">False</property>


More information about the Libreoffice-commits mailing list