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

Caolán McNamara caolanm at redhat.com
Fri May 11 07:53:12 UTC 2018


 sd/source/filter/html/pubdlg.cxx   |   50 +++++++++++++------------------------
 sd/uiconfig/sdraw/ui/namedesign.ui |    9 +++++-
 2 files changed, 26 insertions(+), 33 deletions(-)

New commits:
commit c82438da6827045244a3bde1629c43edb9204146
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu May 10 17:27:51 2018 +0100

    weld SdDesignNameDlg
    
    Change-Id: Ie8f7a62d55aabb520c234c995b01d85bf9f432b6
    Reviewed-on: https://gerrit.libreoffice.org/54093
    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/sd/source/filter/html/pubdlg.cxx b/sd/source/filter/html/pubdlg.cxx
index ce7d614db124..cf6d21f88559 100644
--- a/sd/source/filter/html/pubdlg.cxx
+++ b/sd/source/filter/html/pubdlg.cxx
@@ -338,18 +338,16 @@ SvStream& WriteSdPublishingDesign(SvStream& rOut, const SdPublishingDesign& rDes
 }
 
 // Dialog for the entry of the name of the design
-class SdDesignNameDlg : public ModalDialog
+class SdDesignNameDlg : public weld::GenericDialogController
 {
 private:
-    VclPtr<Edit>           m_pEdit;
-    VclPtr<OKButton>       m_pBtnOK;
+    std::unique_ptr<weld::Entry> m_xEdit;
+    std::unique_ptr<weld::Button> m_xBtnOK;
 
 public:
-    SdDesignNameDlg(vcl::Window* pWindow, const OUString& aName );
-    virtual ~SdDesignNameDlg() override;
-    virtual void dispose() override;
+    SdDesignNameDlg(weld::Window* pWindow, const OUString& aName );
     OUString GetDesignName();
-    DECL_LINK(ModifyHdl, Edit&, void);
+    DECL_LINK(ModifyHdl, weld::Entry&, void);
 };
 
 // SdPublishingDlg Methods
@@ -1139,11 +1137,11 @@ IMPL_LINK_NOARG(SdPublishingDlg, FinishHdl, Button*, void)
         {
             bRetry = false;
 
-            ScopedVclPtrInstance< SdDesignNameDlg > aDlg(this, aName );
+            SdDesignNameDlg aDlg(GetFrameWeld(), aName);
 
-            if ( aDlg->Execute() == RET_OK )
+            if (aDlg.run() == RET_OK)
             {
-                aDesign.m_aDesignName = aDlg->GetDesignName();
+                aDesign.m_aDesignName = aDlg.GetDesignName();
 
                 std::vector<SdPublishingDesign>::iterator iter;
                 for (iter = m_aDesignList.begin(); iter != m_aDesignList.end(); ++iter)
@@ -1616,36 +1614,24 @@ bool SdPublishingDlg::selectPageByUIXMLDescription(const OString& rUIXMLDescript
 }
 
 // SdDesignNameDlg Methods
-SdDesignNameDlg::SdDesignNameDlg(vcl::Window* pWindow, const OUString& aName)
-    : ModalDialog(pWindow, "NameDesignDialog", "modules/sdraw/ui/namedesign.ui")
+SdDesignNameDlg::SdDesignNameDlg(weld::Window* pWindow, const OUString& rName)
+    : GenericDialogController(pWindow, "modules/sdraw/ui/namedesign.ui", "NameDesignDialog")
+    , m_xEdit(m_xBuilder->weld_entry("entry"))
+    , m_xBtnOK(m_xBuilder->weld_button("ok"))
 {
-    get(m_pEdit, "entry");
-    get(m_pBtnOK, "ok");
-    m_pEdit->SetModifyHdl(LINK(this, SdDesignNameDlg, ModifyHdl ));
-    m_pEdit->SetText(aName);
-    m_pBtnOK->Enable(!aName.isEmpty());
-}
-
-SdDesignNameDlg::~SdDesignNameDlg()
-{
-    disposeOnce();
-}
-
-void SdDesignNameDlg::dispose()
-{
-    m_pEdit.clear();
-    m_pBtnOK.clear();
-    ModalDialog::dispose();
+    m_xEdit->connect_changed(LINK(this, SdDesignNameDlg, ModifyHdl ));
+    m_xEdit->set_text(rName);
+    m_xBtnOK->set_sensitive(!rName.isEmpty());
 }
 
 OUString SdDesignNameDlg::GetDesignName()
 {
-    return m_pEdit->GetText();
+    return m_xEdit->get_text();
 }
 
-IMPL_LINK_NOARG(SdDesignNameDlg, ModifyHdl, Edit&, void)
+IMPL_LINK_NOARG(SdDesignNameDlg, ModifyHdl, weld::Entry&, void)
 {
-    m_pBtnOK->Enable(!m_pEdit->GetText().isEmpty());
+    m_xBtnOK->set_sensitive(!m_xEdit->get_text().isEmpty());
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/uiconfig/sdraw/ui/namedesign.ui b/sd/uiconfig/sdraw/ui/namedesign.ui
index b5ddb4ee6e18..cdc8b9a037f3 100644
--- a/sd/uiconfig/sdraw/ui/namedesign.ui
+++ b/sd/uiconfig/sdraw/ui/namedesign.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="sd">
   <requires lib="gtk+" version="3.18"/>
   <object class="GtkDialog" id="NameDesignDialog">
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
     <property name="title" translatable="yes" context="namedesign|NameDesignDialog">Name HTML Design</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">
@@ -80,6 +83,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">0</property>
@@ -99,5 +103,8 @@
       <action-widget response="-5">ok</action-widget>
       <action-widget response="-6">cancel</action-widget>
     </action-widgets>
+    <child>
+      <placeholder/>
+    </child>
   </object>
 </interface>


More information about the Libreoffice-commits mailing list