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

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


 dbaccess/source/ui/dlg/TextConnectionHelper.cxx       |    2 -
 dbaccess/source/ui/dlg/TextConnectionHelper.hxx       |    2 -
 dbaccess/source/ui/dlg/textconnectionsettings.cxx     |   36 +++++++-----------
 dbaccess/source/ui/inc/textconnectionsettings.hxx     |   24 +++++-------
 dbaccess/source/ui/uno/textconnectionsettings_uno.cxx |    3 +
 dbaccess/uiconfig/ui/textconnectionsettings.ui        |    8 +++-
 6 files changed, 36 insertions(+), 39 deletions(-)

New commits:
commit 74d4f1b43bc6c9b5ea2a8197e51cbcb2c376de6b
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Oct 24 12:45:08 2018 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Oct 24 17:46:09 2018 +0200

    weld TextConnectionSettingsDialog
    
    Change-Id: Iaa08d066d9c2198bca7e21f619fb89808620fba9
    Reviewed-on: https://gerrit.libreoffice.org/62295
    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/TextConnectionHelper.cxx b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx
index 405273b80c46..8903a32ebe90 100644
--- a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx
+++ b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx
@@ -444,7 +444,7 @@ namespace dbaui
         }
     }
 
-    DBOTextConnectionHelper::DBOTextConnectionHelper(weld::Container* pParent, const short _nAvailableSections)
+    DBOTextConnectionHelper::DBOTextConnectionHelper(weld::Widget* pParent, const short _nAvailableSections)
         : m_aFieldSeparatorList      (DBA_RES(STR_AUTOFIELDSEPARATORLIST))
         , m_aTextSeparatorList       (STR_AUTOTEXTSEPARATORLIST)
         , m_aTextNone                (DBA_RES(STR_AUTOTEXT_FIELD_SEP_NONE))
diff --git a/dbaccess/source/ui/dlg/TextConnectionHelper.hxx b/dbaccess/source/ui/dlg/TextConnectionHelper.hxx
index 0da671112f51..db71db300c0c 100644
--- a/dbaccess/source/ui/dlg/TextConnectionHelper.hxx
+++ b/dbaccess/source/ui/dlg/TextConnectionHelper.hxx
@@ -95,7 +95,7 @@ namespace dbaui
     class DBOTextConnectionHelper final
     {
     public:
-        DBOTextConnectionHelper(weld::Container* pParent , const short _nAvailableSections);
+        DBOTextConnectionHelper(weld::Widget* pParent , const short _nAvailableSections);
 
     private:
         OUString    m_aFieldSeparatorList;
diff --git a/dbaccess/source/ui/dlg/textconnectionsettings.cxx b/dbaccess/source/ui/dlg/textconnectionsettings.cxx
index 6e87f811da5a..dcf578c6e40d 100644
--- a/dbaccess/source/ui/dlg/textconnectionsettings.cxx
+++ b/dbaccess/source/ui/dlg/textconnectionsettings.cxx
@@ -26,26 +26,18 @@
 namespace dbaui
 {
     // TextConnectionSettingsDialog
-    TextConnectionSettingsDialog::TextConnectionSettingsDialog( vcl::Window* _pParent, SfxItemSet& _rItems )
-        :ModalDialog( _pParent, "TextConnectionSettingsDialog", "dbaccess/ui/textconnectionsettings.ui" )
-        ,m_rItems( _rItems )
+    TextConnectionSettingsDialog::TextConnectionSettingsDialog(weld::Window* pParent, SfxItemSet& rItems)
+        : GenericDialogController(pParent, "dbaccess/ui/textconnectionsettings.ui", "TextConnectionSettingsDialog")
+        , m_rItems(rItems)
+        , m_xContainer(m_xBuilder->weld_widget("TextPageContainer"))
+        , m_xOK(m_xBuilder->weld_button("ok"))
+        , m_xTextConnectionHelper(new DBOTextConnectionHelper(m_xContainer.get(), TC_HEADER | TC_SEPARATORS | TC_CHARSET))
     {
-        get(m_pOK, "ok");
-        m_pTextConnectionHelper.reset( VclPtr<OTextConnectionHelper>::Create( get<VclVBox>("TextPageContainer"), TC_HEADER | TC_SEPARATORS | TC_CHARSET ) );
-
-        m_pOK->SetClickHdl( LINK( this, TextConnectionSettingsDialog, OnOK ) );
+        m_xOK->connect_clicked(LINK(this, TextConnectionSettingsDialog, OnOK));
     }
 
     TextConnectionSettingsDialog::~TextConnectionSettingsDialog()
     {
-        disposeOnce();
-    }
-
-    void TextConnectionSettingsDialog::dispose()
-    {
-        m_pOK.clear();
-        m_pTextConnectionHelper.disposeAndClear();
-        ModalDialog::dispose();
     }
 
     void TextConnectionSettingsDialog::bindItemStorages( SfxItemSet& _rSet, PropertyValues& _rValues )
@@ -58,18 +50,18 @@ namespace dbaui
         _rValues[ PROPERTY_ID_ENCODING ].reset( new SetItemPropertyStorage( _rSet, DSID_CHARSET ) );
     }
 
-    short TextConnectionSettingsDialog::Execute()
+    short TextConnectionSettingsDialog::run()
     {
-        m_pTextConnectionHelper->implInitControls( m_rItems, true );
-        return ModalDialog::Execute();
+        m_xTextConnectionHelper->implInitControls(m_rItems, true);
+        return GenericDialogController::run();
     }
 
-    IMPL_LINK_NOARG( TextConnectionSettingsDialog, OnOK, Button*, void )
+    IMPL_LINK_NOARG(TextConnectionSettingsDialog, OnOK, weld::Button&, void)
     {
-        if ( m_pTextConnectionHelper->prepareLeave() )
+        if (m_xTextConnectionHelper->prepareLeave())
         {
-            m_pTextConnectionHelper->FillItemSet( m_rItems, false/*bUnused*/ );
-            EndDialog( RET_OK );
+            m_xTextConnectionHelper->FillItemSet( m_rItems, false/*bUnused*/ );
+            m_xDialog->response(RET_OK);
         }
     }
 
diff --git a/dbaccess/source/ui/inc/textconnectionsettings.hxx b/dbaccess/source/ui/inc/textconnectionsettings.hxx
index 3bccf4a36a62..713371ad40e1 100644
--- a/dbaccess/source/ui/inc/textconnectionsettings.hxx
+++ b/dbaccess/source/ui/inc/textconnectionsettings.hxx
@@ -21,40 +21,38 @@
 #define INCLUDED_DBACCESS_SOURCE_UI_INC_TEXTCONNECTIONSETTINGS_HXX
 
 #include "propertystorage.hxx"
-
-#include <vcl/dialog.hxx>
-#include <vcl/button.hxx>
-
+#include <vcl/weld.hxx>
 #include <memory>
 
 class SfxItemSet;
 namespace dbaui
 {
 
-    class OTextConnectionHelper;
+    class DBOTextConnectionHelper;
 
     // TextConnectionSettingsDialog
-    class TextConnectionSettingsDialog : public ModalDialog
+    class TextConnectionSettingsDialog : public weld::GenericDialogController
     {
     public:
-        TextConnectionSettingsDialog( vcl::Window* _pParent, SfxItemSet& _rItems );
+        TextConnectionSettingsDialog(weld::Window* _pParent, SfxItemSet& rItems);
         virtual ~TextConnectionSettingsDialog() override;
-        virtual void dispose() override;
 
         /** initializes a set of PropertyStorage instances, which are bound to
             the text-connection relevant items in our item sets
         */
         static void bindItemStorages( SfxItemSet& _rSet, PropertyValues& _rValues );
 
-        virtual short   Execute() override;
+        virtual short run() override;
 
     private:
-        VclPtr<OTextConnectionHelper>               m_pTextConnectionHelper;
-        VclPtr<OKButton>                            m_pOK;
-        SfxItemSet&                                 m_rItems;
+        SfxItemSet& m_rItems;
+
+        std::unique_ptr<weld::Widget> m_xContainer;
+        std::unique_ptr<weld::Button> m_xOK;
+        std::unique_ptr<DBOTextConnectionHelper> m_xTextConnectionHelper;
 
     private:
-        DECL_LINK( OnOK, Button*, void );
+        DECL_LINK(OnOK, weld::Button&, void);
     };
 
 } // namespace dbaui
diff --git a/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx b/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx
index 987b095c6e88..899a521eb5e9 100644
--- a/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx
+++ b/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx
@@ -33,6 +33,7 @@
 #include <comphelper/proparrhlp.hxx>
 #include <svtools/genericunodialog.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
+#include <vcl/svapp.hxx>
 #include <cppuhelper/implbase.hxx>
 
 namespace dbaui
@@ -205,7 +206,7 @@ namespace dbaui
 
     svt::OGenericUnoDialog::Dialog OTextConnectionSettingsDialog::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent)
     {
-        return svt::OGenericUnoDialog::Dialog(VclPtr<TextConnectionSettingsDialog>::Create(VCLUnoHelper::GetWindow(rParent), *m_pDatasourceItems));
+        return svt::OGenericUnoDialog::Dialog(o3tl::make_unique<TextConnectionSettingsDialog>(Application::GetFrameWeld(rParent), *m_pDatasourceItems));
     }
 
     void SAL_CALL OTextConnectionSettingsDialog::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const Any& _rValue )
diff --git a/dbaccess/uiconfig/ui/textconnectionsettings.ui b/dbaccess/uiconfig/ui/textconnectionsettings.ui
index 78364d2b6e3e..c19184429637 100644
--- a/dbaccess/uiconfig/ui/textconnectionsettings.ui
+++ b/dbaccess/uiconfig/ui/textconnectionsettings.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="GtkDialog" id="TextConnectionSettingsDialog">
@@ -7,7 +7,13 @@
     <property name="border_width">6</property>
     <property name="title" translatable="yes" context="textconnectionsettings|TextConnectionSettingsDialog">Text Connection Settings</property>
     <property name="resizable">False</property>
+    <property name="modal">True</property>
+    <property name="default_width">0</property>
+    <property name="default_height">0</property>
     <property name="type_hint">dialog</property>
+    <child>
+      <placeholder/>
+    </child>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
         <property name="can_focus">False</property>


More information about the Libreoffice-commits mailing list