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

Muhammet Kara muhammet.kara at pardus.org.tr
Tue Mar 13 07:02:21 UTC 2018


 cui/source/customize/SvxMenuConfigPage.cxx    |   17 +++++++++++++++++
 cui/source/customize/SvxToolbarConfigPage.cxx |    4 ++++
 cui/source/customize/cfg.cxx                  |    5 +++++
 cui/source/inc/cfg.hxx                        |    1 +
 cui/uiconfig/ui/menuassignpage.ui             |    8 ++++++++
 5 files changed, 35 insertions(+)

New commits:
commit 51617878ddc8f9816af7d63d0b483eefd3aed27d
Author: Muhammet Kara <muhammet.kara at pardus.org.tr>
Date:   Mon Mar 12 22:11:39 2018 +0300

    tdf#114260: Allow moving top-level menus
    
    in the Customize dialog.
    
    Change-Id: I0dafe59e017e05977d00cf564cfef21190a0a7a1
    Reviewed-on: https://gerrit.libreoffice.org/51163
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Muhammet Kara <muhammet.kara at pardus.org.tr>
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/cui/source/customize/SvxMenuConfigPage.cxx b/cui/source/customize/SvxMenuConfigPage.cxx
index 1737744dbb25..75fbaa16378b 100644
--- a/cui/source/customize/SvxMenuConfigPage.cxx
+++ b/cui/source/customize/SvxMenuConfigPage.cxx
@@ -223,6 +223,7 @@ void SvxMenuConfigPage::UpdateButtonStates()
         // Add option (gear_add) will always be enabled
         pGearPopup->EnableItem( "gear_delete", pMenuData->IsDeletable() );
         pGearPopup->EnableItem( "gear_rename", pMenuData->IsRenamable() );
+        pGearPopup->EnableItem( "gear_move", pMenuData->IsMovable() );
     }
 }
 
@@ -353,6 +354,22 @@ IMPL_LINK( SvxMenuConfigPage, GearHdl, MenuButton *, pButton, void )
             GetSaveInData()->SetModified();
         }
     }
+    else if (sIdent == "gear_move")
+    {
+        SvxConfigEntry* pMenuData = GetTopLevelSelection();
+
+        VclPtrInstance<SvxMainMenuOrganizerDialog> pDialog(
+            this, GetSaveInData()->GetEntries(), pMenuData, false );
+
+        if ( pDialog->Execute() == RET_OK )
+        {
+            GetSaveInData()->SetEntries( pDialog->GetEntries() );
+
+            ReloadTopLevelListBox();
+
+            GetSaveInData()->SetModified();
+        }
+    }
     else
     {
         //This block should never be reached
diff --git a/cui/source/customize/SvxToolbarConfigPage.cxx b/cui/source/customize/SvxToolbarConfigPage.cxx
index 53542657fe81..c09d354cb9e5 100644
--- a/cui/source/customize/SvxToolbarConfigPage.cxx
+++ b/cui/source/customize/SvxToolbarConfigPage.cxx
@@ -151,6 +151,10 @@ SvxToolbarConfigPage::SvxToolbarConfigPage(vcl::Window *pParent, const SfxItemSe
     pPopup->EnableItem(OString( "insertsubmenu"), false );
     pPopup->RemoveDisabledEntries();
 
+    // Gear menu's "Move" action is irrelevant to the toolbars
+    pPopup = m_pGearBtn->GetPopupMenu();
+    pPopup->EnableItem("gear_move", false);
+
     // default toolbar to select is standardbar unless a different one
     // has been passed in
     m_aURLToSelect = ITEM_TOOLBAR_URL;
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index 8ee0080ba441..e90bfa358621 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -2100,6 +2100,11 @@ SvxConfigEntry::~SvxConfigEntry()
     }
 }
 
+bool SvxConfigEntry::IsMovable()
+{
+    return !IsPopup() || IsMain();
+}
+
 bool SvxConfigEntry::IsDeletable()
 {
     return !IsMain() || IsUserDefined();
diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx
index c1c85c86fa4c..6f79414f0671 100644
--- a/cui/source/inc/cfg.hxx
+++ b/cui/source/inc/cfg.hxx
@@ -319,6 +319,7 @@ public:
     void    SetModified( bool bValue = true ) { bIsModified = bValue; }
     bool    IsModified() { return bIsModified; }
 
+    bool    IsMovable();
     bool    IsDeletable();
     bool    IsRenamable();
 
diff --git a/cui/uiconfig/ui/menuassignpage.ui b/cui/uiconfig/ui/menuassignpage.ui
index bd77bf0179a2..425d0c2f84a4 100644
--- a/cui/uiconfig/ui/menuassignpage.ui
+++ b/cui/uiconfig/ui/menuassignpage.ui
@@ -30,6 +30,14 @@
         <property name="use_underline">True</property>
       </object>
     </child>
+    <child>
+      <object class="GtkMenuItem" id="gear_move">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes" context="menuassignpage|gear_move">_Move...</property>
+        <property name="use_underline">True</property>
+      </object>
+    </child>
   </object>
   <object class="GtkImage" id="image1">
     <property name="visible">True</property>


More information about the Libreoffice-commits mailing list