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

Caolán McNamara caolanm at redhat.com
Thu Apr 19 12:12:39 UTC 2018


 cui/source/dialogs/hangulhanjadlg.cxx   |   45 ++++++++++++--------------------
 cui/source/inc/hangulhanjadlg.hxx       |   18 +++++-------
 cui/uiconfig/ui/hangulhanjaadddialog.ui |    8 ++++-
 3 files changed, 33 insertions(+), 38 deletions(-)

New commits:
commit 308c2084d270e542ba7b5a778fd30f7323c353d7
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Apr 19 10:57:42 2018 +0100

    weld HangulHanjaNewDictDialog
    
    Change-Id: I66db57e550e5035cc4830bfe51f671974eee6686
    Reviewed-on: https://gerrit.libreoffice.org/53147
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/source/dialogs/hangulhanjadlg.cxx b/cui/source/dialogs/hangulhanjadlg.cxx
index 3c1a74fedac7..1564a6fb33bb 100644
--- a/cui/source/dialogs/hangulhanjadlg.cxx
+++ b/cui/source/dialogs/hangulhanjadlg.cxx
@@ -1025,9 +1025,9 @@ namespace svx
     IMPL_LINK_NOARG(HangulHanjaOptionsDialog, NewDictHdl, Button*, void)
     {
         OUString                    aName;
-        ScopedVclPtrInstance< HangulHanjaNewDictDialog > aNewDlg(this);
-        aNewDlg->Execute();
-        if( aNewDlg->GetName( aName ) )
+        HangulHanjaNewDictDialog aNewDlg(GetFrameWeld());
+        aNewDlg.run();
+        if (aNewDlg.GetName(aName))
         {
             if( m_xConversionDictionaryList.is() )
             {
@@ -1176,51 +1176,42 @@ namespace svx
         pEntry->SetUserData( new OUString( _rName ) );
     }
 
-    IMPL_LINK_NOARG(HangulHanjaNewDictDialog, OKHdl, Button*, void)
+    IMPL_LINK_NOARG(HangulHanjaNewDictDialog, OKHdl, weld::Button&, void)
     {
-        OUString  aName(comphelper::string::stripEnd(m_pDictNameED->GetText(), ' '));
+        OUString  aName(comphelper::string::stripEnd(m_xDictNameED->get_text(), ' '));
 
         m_bEntered = !aName.isEmpty();
-        if( m_bEntered )
-            m_pDictNameED->SetText( aName );     // do this in case of trailing chars have been deleted
+        if (m_bEntered)
+            m_xDictNameED->set_text(aName);     // do this in case of trailing chars have been deleted
 
-        EndDialog( RET_OK );
+        m_xDialog->response(RET_OK);
     }
 
-    IMPL_LINK_NOARG(HangulHanjaNewDictDialog, ModifyHdl, Edit&, void)
+    IMPL_LINK_NOARG(HangulHanjaNewDictDialog, ModifyHdl, weld::Entry&, void)
     {
-        OUString aName(comphelper::string::stripEnd(m_pDictNameED->GetText(), ' '));
+        OUString aName(comphelper::string::stripEnd(m_xDictNameED->get_text(), ' '));
 
-        m_pOkBtn->Enable( !aName.isEmpty() );
+        m_xOkBtn->set_sensitive(!aName.isEmpty());
     }
 
-    HangulHanjaNewDictDialog::HangulHanjaNewDictDialog(vcl::Window* pParent)
-        : ModalDialog(pParent, "HangulHanjaAddDialog", "cui/ui/hangulhanjaadddialog.ui")
+    HangulHanjaNewDictDialog::HangulHanjaNewDictDialog(weld::Window* pParent)
+        : GenericDialogController(pParent, "cui/ui/hangulhanjaadddialog.ui", "HangulHanjaAddDialog")
         , m_bEntered(false)
+        , m_xOkBtn(m_xBuilder->weld_button("ok"))
+        , m_xDictNameED(m_xBuilder->weld_entry("entry"))
     {
-        get(m_pOkBtn, "ok");
-        get(m_pDictNameED, "entry");
-
-        m_pOkBtn->SetClickHdl( LINK( this, HangulHanjaNewDictDialog, OKHdl ) );
-        m_pDictNameED->SetModifyHdl( LINK( this, HangulHanjaNewDictDialog, ModifyHdl ) );
+        m_xOkBtn->connect_clicked( LINK( this, HangulHanjaNewDictDialog, OKHdl ) );
+        m_xDictNameED->connect_changed( LINK( this, HangulHanjaNewDictDialog, ModifyHdl ) );
     }
 
     HangulHanjaNewDictDialog::~HangulHanjaNewDictDialog()
     {
-        disposeOnce();
-    }
-
-    void HangulHanjaNewDictDialog::dispose()
-    {
-        m_pDictNameED.clear();
-        m_pOkBtn.clear();
-        ModalDialog::dispose();
     }
 
     bool HangulHanjaNewDictDialog::GetName( OUString& _rRetName ) const
     {
         if( m_bEntered )
-            _rRetName = comphelper::string::stripEnd(m_pDictNameED->GetText(), ' ');
+            _rRetName = comphelper::string::stripEnd(m_xDictNameED->get_text(), ' ');
 
         return m_bEntered;
     }
diff --git a/cui/source/inc/hangulhanjadlg.hxx b/cui/source/inc/hangulhanjadlg.hxx
index a300da3c30ed..de160d434acf 100644
--- a/cui/source/inc/hangulhanjadlg.hxx
+++ b/cui/source/inc/hangulhanjadlg.hxx
@@ -25,6 +25,7 @@
 #include <vcl/combobox.hxx>
 #include <vcl/fixed.hxx>
 #include <vcl/scrbar.hxx>
+#include <vcl/weld.hxx>
 #include <svx/checklbx.hxx>
 #include <editeng/hangulhanja.hxx>
 #include <com/sun/star/uno/Sequence.hxx>
@@ -225,26 +226,23 @@ namespace svx
         void                AddDict( const OUString& _rName, bool _bChecked );
     };
 
-
-    class HangulHanjaNewDictDialog : public ModalDialog
+    class HangulHanjaNewDictDialog : public weld::GenericDialogController
     {
     private:
-        VclPtr<Edit> m_pDictNameED;
-        VclPtr<OKButton> m_pOkBtn;
-
         bool m_bEntered;
 
-        DECL_LINK( OKHdl, Button*, void );
-        DECL_LINK( ModifyHdl, Edit&, void );
+        std::unique_ptr<weld::Button> m_xOkBtn;
+        std::unique_ptr<weld::Entry> m_xDictNameED;
+
+        DECL_LINK(OKHdl, weld::Button&, void);
+        DECL_LINK(ModifyHdl, weld::Entry&, void);
     public:
-        HangulHanjaNewDictDialog( vcl::Window* _pParent );
+        HangulHanjaNewDictDialog(weld::Window* pParent);
         virtual ~HangulHanjaNewDictDialog() override;
-        virtual void dispose() override;
 
         bool GetName( OUString& _rRetName ) const;
     };
 
-
     class SuggestionList;
 
     class SuggestionEdit : public Edit
diff --git a/cui/uiconfig/ui/hangulhanjaadddialog.ui b/cui/uiconfig/ui/hangulhanjaadddialog.ui
index e7eedd72ba1a..94ff47ae7ece 100644
--- a/cui/uiconfig/ui/hangulhanjaadddialog.ui
+++ b/cui/uiconfig/ui/hangulhanjaadddialog.ui
@@ -1,11 +1,14 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.20.4 -->
 <interface domain="cui">
   <requires lib="gtk+" version="3.18"/>
   <object class="GtkDialog" id="HangulHanjaAddDialog">
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
     <property name="title" translatable="yes" context="hangulhanjaadddialog|HangulHanjaAddDialog">New Dictionary</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 internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
@@ -145,5 +148,8 @@
       <action-widget response="-6">cancel</action-widget>
       <action-widget response="-11">help</action-widget>
     </action-widgets>
+    <child>
+      <placeholder/>
+    </child>
   </object>
 </interface>


More information about the Libreoffice-commits mailing list