diff options
author | Muhammet Kara <muhammet.kara@pardus.org.tr> | 2016-10-24 11:59:03 +0300 |
---|---|---|
committer | Muhammet Kara <muhammet.kara@pardus.org.tr> | 2016-10-25 13:15:16 +0000 |
commit | cd7b306e614a938b7b39a66784899c22ee6f6c64 (patch) | |
tree | f3078ff3ab91534829b8b44909be436bd615916e | |
parent | 578e890e89c9a143d36b3d7307dcdc0545523614 (diff) |
tdf#103160 Add 'Add Submenu' button in Customize dialog
And remove the 'Add Submenu' entry from Modify split button
in Customize dialog
Change-Id: I6ac940f5f1f41ac1f962f66f458c7e14d702b2be
Reviewed-on: https://gerrit.libreoffice.org/30230
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Yousuf Philips <philipz85@hotmail.com>
Tested-by: Yousuf Philips <philipz85@hotmail.com>
Reviewed-by: Muhammet Kara <muhammet.kara@pardus.org.tr>
-rw-r--r-- | cui/source/customize/cfg.cxx | 65 | ||||
-rw-r--r-- | cui/source/inc/cfg.hxx | 2 | ||||
-rw-r--r-- | cui/uiconfig/ui/menuassignpage.ui | 29 |
3 files changed, 57 insertions, 39 deletions
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index dcbe98f2acab..6d08562a321d 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -1754,6 +1754,7 @@ SvxConfigPage::SvxConfigPage(vcl::Window *pParent, const SfxItemSet& rSet) get(m_pContentsLabel, "contentslabel"); get(m_pAddCommandsButton, "add"); get(m_pAddSeparatorButton, "addseparatorbtn"); + get(m_pAddSubmenuButton, "addsubmenubtn"); get(m_pModifyCommandButton, "modify"); get(m_pDeleteCommandButton, "deletebtn"); get(m_pResetTopLevelButton, "resetbtn"); @@ -1773,7 +1774,7 @@ SvxConfigPage::SvxConfigPage(vcl::Window *pParent, const SfxItemSet& rSet) // This button is applicable only for the toolbar config tab m_pResetTopLevelButton->Enable( false ); m_pResetTopLevelButton->Hide(); - //These radio buttons are applicable only for the toolbar config tab + // These radio buttons are applicable only for the toolbar config tab m_pIconsOnlyRB->Enable( false ); m_pTextOnlyRB->Enable( false ); m_pIconsAndTextRB->Enable( false ); @@ -1781,6 +1782,9 @@ SvxConfigPage::SvxConfigPage(vcl::Window *pParent, const SfxItemSet& rSet) m_pTextOnlyRB->Hide(); m_pIconsAndTextRB->Hide(); m_pToolbarStyleLabel->Hide(); + // This button is applicable only for the Menus and Context Menus tabs + m_pAddSubmenuButton->Disable(); + m_pAddSubmenuButton->Hide(); } SvxConfigPage::~SvxConfigPage() @@ -1804,6 +1808,7 @@ void SvxConfigPage::dispose() m_pEntries.clear(); m_pAddCommandsButton.clear(); m_pAddSeparatorButton.clear(); + m_pAddSubmenuButton.clear(); m_pModifyCommandButton.clear(); m_pDeleteCommandButton.clear(); m_pResetTopLevelButton.clear(); @@ -2443,6 +2448,9 @@ SvxMenuConfigPage::SvxMenuConfigPage(vcl::Window *pParent, const SfxItemSet& rSe m_pContentsListBox->set_vexpand(true); m_pContentsListBox->Show(); + m_pAddSubmenuButton->Enable(); + m_pAddSubmenuButton->Show(); + m_pTopLevelListBox->SetSelectHdl( LINK( this, SvxMenuConfigPage, SelectMenu ) ); @@ -2461,6 +2469,9 @@ SvxMenuConfigPage::SvxMenuConfigPage(vcl::Window *pParent, const SfxItemSet& rSe m_pAddSeparatorButton->SetClickHdl ( LINK( this, SvxMenuConfigPage, AddSeparatorHdl ) ); + m_pAddSubmenuButton->SetClickHdl ( + LINK( this, SvxMenuConfigPage, AddSubmenuHdl ) ); + m_pDeleteCommandButton->SetClickHdl ( LINK( this, SvxMenuConfigPage, DeleteCommandHdl ) ); @@ -2713,30 +2724,7 @@ IMPL_LINK( SvxMenuConfigPage, MenuSelectHdl, MenuButton *, pButton, void ) IMPL_LINK( SvxMenuConfigPage, EntrySelectHdl, MenuButton *, pButton, void ) { OString sIdent = pButton->GetCurItemIdent(); - if (sIdent == "addsubmenu") - { - OUString aNewName; - OUString aDesc = CUI_RESSTR( RID_SVXSTR_SUBMENU_NAME ); - - VclPtrInstance< SvxNameDialog > pNameDialog( this, aNewName, aDesc ); - pNameDialog->SetHelpId( HID_SVX_CONFIG_NAME_SUBMENU ); - pNameDialog->SetText( CUI_RESSTR( RID_SVXSTR_ADD_SUBMENU ) ); - - if ( pNameDialog->Execute() == RET_OK ) { - pNameDialog->GetName(aNewName); - - SvxConfigEntry* pNewEntryData = - new SvxConfigEntry( aNewName, aNewName, true ); - pNewEntryData->SetUserDefined(); - - InsertEntry( pNewEntryData ); - - ReloadTopLevelListBox(); - - GetSaveInData()->SetModified(); - } - } - else if (sIdent == "modrename") + if (sIdent == "modrename") { SvTreeListEntry* pActEntry = m_pContentsListBox->GetCurEntry(); SvxConfigEntry* pEntry = @@ -2821,6 +2809,33 @@ IMPL_LINK_NOARG( SvxMenuConfigPage, AddSeparatorHdl, Button *, void ) } } +IMPL_LINK_NOARG( SvxMenuConfigPage, AddSubmenuHdl, Button *, void ) +{ + OUString aNewName; + OUString aDesc = CUI_RESSTR( RID_SVXSTR_SUBMENU_NAME ); + + VclPtrInstance< SvxNameDialog > pNameDialog( this, aNewName, aDesc ); + pNameDialog->SetHelpId( HID_SVX_CONFIG_NAME_SUBMENU ); + pNameDialog->SetText( CUI_RESSTR( RID_SVXSTR_ADD_SUBMENU ) ); + + if ( pNameDialog->Execute() == RET_OK ) + { + pNameDialog->GetName(aNewName); + + SvxConfigEntry* pNewEntryData = + new SvxConfigEntry( aNewName, aNewName, true ); + pNewEntryData->SetUserDefined(); + + InsertEntry( pNewEntryData ); + + ReloadTopLevelListBox(); + + GetSaveInData()->SetModified(); + + UpdateButtonStates(); + } +} + IMPL_LINK_NOARG( SvxMenuConfigPage, DeleteCommandHdl, Button *, void ) { DeleteSelectedContent(); diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx index 6ca5756ab118..7ddd3ac79162 100644 --- a/cui/source/inc/cfg.hxx +++ b/cui/source/inc/cfg.hxx @@ -381,6 +381,7 @@ protected: VclPtr<PushButton> m_pAddCommandsButton; VclPtr<PushButton> m_pAddSeparatorButton; + VclPtr<PushButton> m_pAddSubmenuButton; VclPtr<MenuButton> m_pModifyCommandButton; VclPtr<PushButton> m_pDeleteCommandButton; // Resets the top level toolbar to default settings @@ -484,6 +485,7 @@ private: DECL_LINK( EntrySelectHdl, MenuButton *, void ); DECL_LINK( AddCommandsHdl, Button *, void ); DECL_LINK( AddSeparatorHdl, Button *, void ); + DECL_LINK( AddSubmenuHdl, Button *, void ); DECL_LINK( DeleteCommandHdl, Button *, void ); DECL_LINK( AddFunctionHdl, SvxScriptSelectorDialog&, void ); diff --git a/cui/uiconfig/ui/menuassignpage.ui b/cui/uiconfig/ui/menuassignpage.ui index 193153d54629..e15ae5dad812 100644 --- a/cui/uiconfig/ui/menuassignpage.ui +++ b/cui/uiconfig/ui/menuassignpage.ui @@ -479,6 +479,20 @@ <property name="position">1</property> </packing> </child> + <child> + <object class="GtkButton" id="addsubmenubtn"> + <property name="label" translatable="yes">Add Submenu</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> </object> <packing> <property name="left_attach">0</property> @@ -569,6 +583,7 @@ <widget name="modify:modmenu"/> <widget name="deletebtn"/> <widget name="resetbtn"/> + <widget name="addsubmenubtn"/> </widgets> </object> <object class="GtkSizeGroup" id="sizegroup2"> @@ -616,20 +631,6 @@ <property name="visible">True</property> <property name="can_focus">False</property> <child> - <object class="GtkMenuItem" id="addsubmenu"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Add Submenu...</property> - <property name="use_underline">True</property> - </object> - </child> - <child> - <object class="GtkSeparatorMenuItem" id="menuitem4"> - <property name="visible">True</property> - <property name="can_focus">False</property> - </object> - </child> - <child> <object class="GtkMenuItem" id="modrename"> <property name="visible">True</property> <property name="can_focus">False</property> |