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

Caolán McNamara caolanm at redhat.com
Thu May 17 07:54:46 UTC 2018


 cui/source/customize/SvxToolbarConfigPage.cxx |   25 ++++++++-----------------
 cui/source/customize/cfg.cxx                  |   24 +++++++-----------------
 cui/source/inc/cfg.hxx                        |   16 +++++++---------
 cui/uiconfig/ui/newtoolbardialog.ui           |   12 +++++++++---
 4 files changed, 31 insertions(+), 46 deletions(-)

New commits:
commit 6012efecba3691e8562d3f4079455b1c05cf94b1
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed May 16 15:00:57 2018 +0100

    weld SvxNewToolbarDialog
    
    Change-Id: I9ce16b4a72037db491a0919e117d664ccd554153
    Reviewed-on: https://gerrit.libreoffice.org/54439
    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/customize/SvxToolbarConfigPage.cxx b/cui/source/customize/SvxToolbarConfigPage.cxx
index b07b84d73f67..aaccfca3fef7 100644
--- a/cui/source/customize/SvxToolbarConfigPage.cxx
+++ b/cui/source/customize/SvxToolbarConfigPage.cxx
@@ -350,33 +350,24 @@ IMPL_LINK( SvxToolbarConfigPage, GearHdl, MenuButton *, pButton, void )
         OUString aNewURL =
             SvxConfigPageHelper::generateCustomURL( GetSaveInData()->GetEntries() );
 
-        VclPtrInstance< SvxNewToolbarDialog > pNameDialog( nullptr, aNewName );
+        SvxNewToolbarDialog aNameDialog(GetFrameWeld(), aNewName);
 
         // Reflect the actual m_pSaveInListBox into the new toolbar dialog
-        for ( sal_Int32 i = 0; i < m_pSaveInListBox->GetEntryCount(); ++i )
-        {
-            SaveInData* pData =
-                static_cast<SaveInData*>(m_pSaveInListBox->GetEntryData( i ));
-
-            const sal_Int32 nInsertPos =
-                pNameDialog->m_pSaveInListBox->InsertEntry( m_pSaveInListBox->GetEntry( i ) );
-
-            pNameDialog->m_pSaveInListBox->SetEntryData( nInsertPos, pData );
-        }
+        for (sal_Int32 i = 0; i < m_pSaveInListBox->GetEntryCount(); ++i)
+            aNameDialog.m_xSaveInListBox->append_text(m_pSaveInListBox->GetEntry(i));
 
-        pNameDialog->m_pSaveInListBox->SelectEntryPos(
-            m_pSaveInListBox->GetSelectedEntryPos() );
+        aNameDialog.m_xSaveInListBox->set_active(m_pSaveInListBox->GetSelectedEntryPos());
 
-        if ( pNameDialog->Execute() == RET_OK )
+        if (aNameDialog.run() == RET_OK)
         {
-            aNewName = pNameDialog->GetName();
+            aNewName = aNameDialog.GetName();
 
             // Where to save the new toolbar? (i.e. Modulewise or documentwise)
-            sal_Int32 nInsertPos = pNameDialog->m_pSaveInListBox->GetSelectedEntryPos();
+            int nInsertPos = aNameDialog.m_xSaveInListBox->get_active();
 
             ToolbarSaveInData* pData =
                 static_cast<ToolbarSaveInData*>(
-                    pNameDialog->m_pSaveInListBox->GetEntryData( nInsertPos ) );
+                    m_pSaveInListBox->GetEntryData( nInsertPos ) );
 
             if ( GetSaveInData() != pData )
             {
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index be9d4060d172..2a377bea5183 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -2821,30 +2821,20 @@ void ToolbarSaveInData::LoadToolbar(
     }
 }
 
-SvxNewToolbarDialog::SvxNewToolbarDialog(vcl::Window* pWindow, const OUString& rName)
-    : ModalDialog(pWindow, "NewToolbarDialog", "cui/ui/newtoolbardialog.ui")
+SvxNewToolbarDialog::SvxNewToolbarDialog(weld::Window* pWindow, const OUString& rName)
+    : GenericDialogController(pWindow, "cui/ui/newtoolbardialog.ui", "NewToolbarDialog")
+    , m_xEdtName(m_xBuilder->weld_entry("edit"))
+    , m_xBtnOK(m_xBuilder->weld_button("ok"))
+    , m_xSaveInListBox(m_xBuilder->weld_combo_box_text("savein"))
 {
-    get(m_pEdtName, "edit");
-    get(m_pBtnOK, "ok");
-    get(m_pSaveInListBox, "savein");
-    m_pEdtName->SetText( rName );
-    m_pEdtName->SetSelection(Selection(SELECTION_MIN, SELECTION_MAX));
+    m_xEdtName->set_text(rName);
+    m_xEdtName->select_region(0, -1);
 }
 
 SvxNewToolbarDialog::~SvxNewToolbarDialog()
 {
-    disposeOnce();
-}
-
-void SvxNewToolbarDialog::dispose()
-{
-    m_pEdtName.clear();
-    m_pBtnOK.clear();
-    m_pSaveInListBox.clear();
-    ModalDialog::dispose();
 }
 
-
 /*******************************************************************************
 *
 * The SvxIconSelectorDialog class
diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx
index 6e6e1584685b..686749a217dc 100644
--- a/cui/source/inc/cfg.hxx
+++ b/cui/source/inc/cfg.hxx
@@ -571,22 +571,20 @@ public:
     bool            Apply() override;
 };
 
-class SvxNewToolbarDialog : public ModalDialog
+class SvxNewToolbarDialog : public weld::GenericDialogController
 {
 private:
-    VclPtr<Edit>           m_pEdtName;
-    VclPtr<OKButton>       m_pBtnOK;
-
+    std::unique_ptr<weld::Entry> m_xEdtName;
+    std::unique_ptr<weld::Button> m_xBtnOK;
 public:
-    SvxNewToolbarDialog(vcl::Window* pWindow, const OUString& rName);
-    virtual ~SvxNewToolbarDialog() override;
-    virtual void dispose() override;
+    std::unique_ptr<weld::ComboBoxText> m_xSaveInListBox;
 
-    VclPtr<ListBox>        m_pSaveInListBox;
+    SvxNewToolbarDialog(weld::Window* pWindow, const OUString& rName);
+    virtual ~SvxNewToolbarDialog() override;
 
     OUString GetName()
     {
-        return m_pEdtName->GetText();
+        return m_xEdtName->get_text();
     }
 };
 
diff --git a/cui/uiconfig/ui/newtoolbardialog.ui b/cui/uiconfig/ui/newtoolbardialog.ui
index 0a812e04ce8b..de20c2645342 100644
--- a/cui/uiconfig/ui/newtoolbardialog.ui
+++ b/cui/uiconfig/ui/newtoolbardialog.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="cui">
   <requires lib="gtk+" version="3.18"/>
   <object class="GtkDialog" id="NewToolbarDialog">
@@ -7,7 +7,12 @@
     <property name="border_width">6</property>
     <property name="title" translatable="yes" context="newtoolbardialog|NewToolbarDialog">Name</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>
@@ -89,10 +94,10 @@
                   <object class="GtkLabel" id="label1">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
                     <property name="label" translatable="yes" context="newtoolbardialog|label1">_Toolbar name:</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">edit</property>
+                    <property name="xalign">0</property>
                   </object>
                   <packing>
                     <property name="expand">False</property>
@@ -104,6 +109,7 @@
                   <object class="GtkEntry" id="edit">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
+                    <property name="activates_default">True</property>
                     <property name="width_chars">26</property>
                   </object>
                   <packing>
@@ -129,10 +135,10 @@
                   <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="newtoolbardialog|label2">_Save in:</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">savein</property>
+                    <property name="xalign">0</property>
                   </object>
                   <packing>
                     <property name="expand">False</property>


More information about the Libreoffice-commits mailing list