cui/source/customize/cfg.cxx | 50 ++++++++++++++++++++++++---------- cui/source/customize/cfg.src | 5 --- cui/source/inc/cfg.hxx | 4 ++ cui/uiconfig/ui/menuassignpage.ui | 55 ++++++++++++-------------------------- 4 files changed, 57 insertions(+), 57 deletions(-)
New commits: commit 5214eba02c011b5d15cc2ba33f4c6bd811e6cef1 Author: Muhammet Kara <[email protected]> Date: Mon Aug 22 09:57:30 2016 +0300 tdf#82840 Add 'delete' button to toolbar customization Added 'delete' button for contents of Menus, Context Menus, and Toolbars pages of the 'Customize' dialog. And removed the 'delete' item from the 'Modify' menu in those pages. Change-Id: Ie59a32e0b92116f8058fe8efe288bfb215b522b0 Reviewed-on: https://gerrit.libreoffice.org/28323 Tested-by: Jenkins <[email protected]> Reviewed-by: Samuel Mehrbrodt <[email protected]> diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index d553439..828f46e 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -1750,6 +1750,7 @@ SvxConfigPage::SvxConfigPage(vcl::Window *pParent, const SfxItemSet& rSet) get(m_pContentsLabel, "contentslabel"); get(m_pAddCommandsButton, "add"); get(m_pModifyCommandButton, "modify"); + get(m_pDeleteCommandButton, "deletebtn"); get(m_pMoveUpButton, "up"); get(m_pMoveDownButton, "down"); get(m_pSaveInListBox, "savein"); @@ -1781,6 +1782,7 @@ void SvxConfigPage::dispose() m_pEntries.clear(); m_pAddCommandsButton.clear(); m_pModifyCommandButton.clear(); + m_pDeleteCommandButton.clear(); m_pMoveUpButton.clear(); m_pMoveDownButton.clear(); m_pSaveInListBox.clear(); @@ -2432,6 +2434,9 @@ SvxMenuConfigPage::SvxMenuConfigPage(vcl::Window *pParent, const SfxItemSet& rSe m_pAddCommandsButton->SetClickHdl ( LINK( this, SvxMenuConfigPage, AddCommandsHdl ) ); + m_pDeleteCommandButton->SetClickHdl ( + LINK( this, SvxMenuConfigPage, DeleteCommandHdl ) ); + PopupMenu* pMenu = m_pModifyTopLevelButton->GetPopupMenu(); pMenu->SetMenuFlags( pMenu->GetMenuFlags() | MenuFlags::AlwaysShowDisabledEntries ); @@ -2500,10 +2505,10 @@ void SvxMenuConfigPage::UpdateButtonStates() { m_pMoveUpButton->Enable( false ); m_pMoveDownButton->Enable( false ); + m_pDeleteCommandButton->Enable(false); pPopup->EnableItem( "addseparator" ); pPopup->EnableItem( "modrename", false ); - pPopup->EnableItem( "moddelete", false ); m_pDescriptionField->SetText(""); @@ -2521,18 +2526,20 @@ void SvxMenuConfigPage::UpdateButtonStates() if ( pEntryData->IsSeparator() ) { - pPopup->EnableItem( "moddelete" ); pPopup->EnableItem( "addseparator", false ); pPopup->EnableItem( "modrename", false ); m_pDescriptionField->SetText(""); + + m_pDeleteCommandButton->Enable(); } else { pPopup->EnableItem( "addseparator" ); - pPopup->EnableItem( "moddelete" ); pPopup->EnableItem( "modrename" ); + m_pDeleteCommandButton->Enable(); + m_pDescriptionField->SetText(pEntryData->GetHelpText()); } } @@ -2707,10 +2714,6 @@ IMPL_LINK_TYPED( SvxMenuConfigPage, EntrySelectHdl, MenuButton *, pButton, void pNewEntryData->SetUserDefined(); InsertEntry( pNewEntryData ); } - else if (sIdent == "moddelete") - { - DeleteSelectedContent(); - } else if (sIdent == "modrename") { SvTreeListEntry* pActEntry = m_pContentsListBox->GetCurEntry(); @@ -2784,6 +2787,15 @@ IMPL_LINK_NOARG_TYPED( SvxMenuConfigPage, AddCommandsHdl, Button *, void ) m_pSelectorDlg->Execute(); } +IMPL_LINK_NOARG_TYPED( SvxMenuConfigPage, DeleteCommandHdl, Button *, void ) +{ + DeleteSelectedContent(); + if ( GetSaveInData()->IsModified() ) + { + UpdateButtonStates(); + } +} + SaveInData* SvxMenuConfigPage::CreateSaveInData( const uno::Reference< css::ui::XUIConfigurationManager >& xCfgMgr, const uno::Reference< css::ui::XUIConfigurationManager >& xParentCfgMgr, @@ -3100,6 +3112,9 @@ SvxToolbarConfigPage::SvxToolbarConfigPage(vcl::Window *pParent, const SfxItemSe m_pAddCommandsButton->SetClickHdl ( LINK( this, SvxToolbarConfigPage, AddCommandsHdl ) ); + m_pDeleteCommandButton->SetClickHdl ( + LINK( this, SvxToolbarConfigPage, DeleteCommandHdl ) ); + m_pMoveUpButton->SetClickHdl ( LINK( this, SvxToolbarConfigPage, MoveHdl) ); m_pMoveDownButton->SetClickHdl ( LINK( this, SvxToolbarConfigPage, MoveHdl) ); // Always enable Up and Down buttons @@ -3456,11 +3471,6 @@ IMPL_LINK_TYPED( SvxToolbarConfigPage, EntrySelectHdl, MenuButton *, pButton, vo bNeedsApply = true; break; } - case ID_DELETE: - { - DeleteSelectedContent(); - break; - } case ID_ICON_ONLY: { break; @@ -4464,7 +4474,6 @@ void SvxToolbarConfigPage::UpdateButtonStates() { PopupMenu* pPopup = m_pModifyCommandButton->GetPopupMenu(); pPopup->EnableItem( ID_RENAME, false ); - pPopup->EnableItem( ID_DELETE, false ); pPopup->EnableItem( ID_BEGIN_GROUP, false ); pPopup->EnableItem( ID_DEFAULT_COMMAND, false ); pPopup->EnableItem( ID_ICON_ONLY, false ); @@ -4473,6 +4482,8 @@ void SvxToolbarConfigPage::UpdateButtonStates() pPopup->EnableItem( ID_CHANGE_SYMBOL, false ); pPopup->EnableItem( ID_RESET_SYMBOL, false ); + m_pDeleteCommandButton->Enable(false); + m_pDescriptionField->SetText(""); SvTreeListEntry* selection = m_pContentsListBox->GetCurEntry(); @@ -4483,17 +4494,20 @@ void SvxToolbarConfigPage::UpdateButtonStates() SvxConfigEntry* pEntryData = static_cast<SvxConfigEntry*>(selection->GetUserData()); if ( pEntryData->IsSeparator() ) - pPopup->EnableItem( ID_DELETE ); + { + m_pDeleteCommandButton->Enable(); + } else { pPopup->EnableItem( ID_BEGIN_GROUP ); - pPopup->EnableItem( ID_DELETE ); pPopup->EnableItem( ID_RENAME ); pPopup->EnableItem( ID_ICON_ONLY ); pPopup->EnableItem( ID_ICON_AND_TEXT ); pPopup->EnableItem( ID_TEXT_ONLY ); pPopup->EnableItem( ID_CHANGE_SYMBOL ); + m_pDeleteCommandButton->Enable(); + if ( !pEntryData->IsUserDefined() ) pPopup->EnableItem( ID_DEFAULT_COMMAND ); @@ -4528,6 +4542,7 @@ IMPL_LINK_NOARG_TYPED( SvxToolbarConfigPage, SelectToolbar, ListBox&, void ) m_pModifyTopLevelButton->Enable( false ); m_pModifyCommandButton->Enable( false ); m_pAddCommandsButton->Enable( false ); + m_pDeleteCommandButton->Enable( false ); return; } @@ -4666,6 +4681,11 @@ IMPL_LINK_NOARG_TYPED( SvxToolbarConfigPage, AddCommandsHdl, Button *, void ) m_pSelectorDlg->Execute(); } +IMPL_LINK_NOARG_TYPED( SvxToolbarConfigPage, DeleteCommandHdl, Button *, void ) +{ + DeleteSelectedContent(); +} + IMPL_LINK_NOARG_TYPED( SvxToolbarConfigPage, AddFunctionHdl, SvxScriptSelectorDialog&, void ) { AddFunction(); diff --git a/cui/source/customize/cfg.src b/cui/source/customize/cfg.src index b9a515b..a354c24 100644 --- a/cui/source/customize/cfg.src +++ b/cui/source/customize/cfg.src @@ -88,11 +88,6 @@ Menu MODIFY_TOOLBAR_CONTENT }; MenuItem { - Identifier = ID_DELETE ; - TEXT_DELETE_NODOTS - }; - MenuItem - { Identifier = ID_DEFAULT_COMMAND ; Text [ en-US ] = "Restore Default Command" ; }; diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx index 2653b48..1b6cfa1 100644 --- a/cui/source/inc/cfg.hxx +++ b/cui/source/inc/cfg.hxx @@ -377,6 +377,8 @@ protected: VclPtr<PushButton> m_pAddCommandsButton; VclPtr<MenuButton> m_pModifyCommandButton; + VclPtr<PushButton> m_pDeleteCommandButton; + VclPtr<PushButton> m_pMoveUpButton; VclPtr<PushButton> m_pMoveDownButton; @@ -474,6 +476,7 @@ private: DECL_LINK_TYPED( MenuSelectHdl, MenuButton *, void ); DECL_LINK_TYPED( EntrySelectHdl, MenuButton *, void ); DECL_LINK_TYPED( AddCommandsHdl, Button *, void ); + DECL_LINK_TYPED( DeleteCommandHdl, Button *, void ); DECL_LINK_TYPED( AddFunctionHdl, SvxScriptSelectorDialog&, void ); void Init() override; @@ -566,6 +569,7 @@ private: DECL_LINK_TYPED( EntrySelectHdl, MenuButton *, void ); DECL_LINK_TYPED( NewToolbarHdl, Button *, void ); DECL_LINK_TYPED( AddCommandsHdl, Button *, void ); + DECL_LINK_TYPED( DeleteCommandHdl, Button *, void ); DECL_LINK_TYPED( AddFunctionHdl, SvxScriptSelectorDialog&, void ); DECL_LINK_TYPED( MoveHdl, Button *, void ); diff --git a/cui/uiconfig/ui/menuassignpage.ui b/cui/uiconfig/ui/menuassignpage.ui index d7efe56..aafe87c 100644 --- a/cui/uiconfig/ui/menuassignpage.ui +++ b/cui/uiconfig/ui/menuassignpage.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.16.1 --> +<!-- Generated with glade 3.20.0 --> <interface> <requires lib="gtk+" version="3.10"/> <object class="GtkImage" id="image1"> @@ -75,8 +75,6 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -89,16 +87,14 @@ <object class="GtkLabel" id="toplevelft"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes">Menu</property> <property name="use_underline">True</property> <property name="mnemonic_widget">toplevellist</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -109,16 +105,12 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> @@ -199,12 +191,24 @@ <property name="position">1</property> </packing> </child> + <child> + <object class="GtkButton" id="deletebtn"> + <property name="label" translatable="yes">Remove</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">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> </object> <packing> <property name="left_attach">1</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -224,24 +228,20 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> <object class="GtkLabel" id="label33"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes">_Save In</property> <property name="use_underline">True</property> <property name="mnemonic_widget">savein</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -249,16 +249,14 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="valign">start</property> - <property name="xalign">0</property> <property name="label" translatable="yes">Entries</property> <property name="use_underline">True</property> <property name="mnemonic_widget">entries</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -277,8 +275,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -291,15 +287,12 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> <packing> <property name="left_attach">2</property> <property name="top_attach">0</property> - <property name="width">1</property> <property name="height">2</property> </packing> </child> @@ -316,16 +309,12 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> @@ -484,13 +473,5 @@ <property name="can_focus">False</property> </object> </child> - <child> - <object class="GtkMenuItem" id="moddelete"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Delete</property> - <property name="use_underline">True</property> - </object> - </child> </object> </interface> _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
