diff options
author | Muhammet Kara <muhammet.kara@pardus.org.tr> | 2017-08-25 23:53:37 +0300 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2017-09-04 22:39:47 +0200 |
commit | 862b968d1c015bca2226f18c767d350da63517c8 (patch) | |
tree | 4c0982f1403d05f9576b45fbc70326a394cc0715 /cui/source | |
parent | 25435b29da75ac6fa5106eba3456ea3f8ca32cda (diff) |
Disable the individual reset button for the menubar menus
And:
* Cut m_pDescriptionField's ties to the entries list on the right.
* Disable Add and Remove buttons depending on current command selection
* Display the description of the selected command
Change-Id: I65a06f2f143c335f26de9007c6067f3116465c30
Reviewed-on: https://gerrit.libreoffice.org/41582
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'cui/source')
-rw-r--r-- | cui/source/customize/SvxMenuConfigPage.cxx | 20 | ||||
-rw-r--r-- | cui/source/customize/cfg.cxx | 26 | ||||
-rw-r--r-- | cui/source/inc/cfg.hxx | 1 |
3 files changed, 32 insertions, 15 deletions
diff --git a/cui/source/customize/SvxMenuConfigPage.cxx b/cui/source/customize/SvxMenuConfigPage.cxx index 1e7cac7598a5..336e6bbe4ed9 100644 --- a/cui/source/customize/SvxMenuConfigPage.cxx +++ b/cui/source/customize/SvxMenuConfigPage.cxx @@ -144,6 +144,11 @@ SvxMenuConfigPage::SvxMenuConfigPage(vcl::Window *pParent, const SfxItemSet& rSe m_pPlusBtn->Hide(); m_pMinusBtn->Hide(); } + else + { + // TODO: Remove this when it is possible to reset menubar menus individually + m_pResetBtn->Disable(); + } } @@ -189,7 +194,6 @@ IMPL_LINK_NOARG( SvxMenuConfigPage, SelectMenuEntry, SvTreeListBox *, void ) void SvxMenuConfigPage::UpdateButtonStates() { - // Disable Up and Down buttons depending on current selection SvTreeListEntry* selection = m_pContentsListBox->GetCurEntry(); @@ -198,8 +202,6 @@ void SvxMenuConfigPage::UpdateButtonStates() m_pMoveUpButton->Enable( false ); m_pMoveDownButton->Enable( false ); - m_pDescriptionField->SetText(""); - return; } @@ -208,18 +210,6 @@ void SvxMenuConfigPage::UpdateButtonStates() m_pMoveUpButton->Enable( selection != first ); m_pMoveDownButton->Enable( selection != last ); - - SvxConfigEntry* pEntryData = - static_cast<SvxConfigEntry*>(selection->GetUserData()); - - if ( pEntryData->IsSeparator() ) - { - m_pDescriptionField->SetText(""); - } - else - { - m_pDescriptionField->SetText(pEntryData->GetHelpText()); - } } void SvxMenuConfigPage::DeleteSelectedTopLevel() diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index 2546f91df020..d94632922098 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -1178,6 +1178,9 @@ SvxConfigPage::SvxConfigPage(vcl::Window *pParent, const SfxItemSet& rSet) m_pSearchEdit->SetUpdateDataHdl ( LINK( this, SvxConfigPage, SearchUpdateHdl )); m_pSearchEdit->EnableUpdateData(); + + m_pFunctions->SetSelectHdl( + LINK( this, SvxConfigPage, SelectFunctionHdl ) ); } SvxConfigPage::~SvxConfigPage() @@ -1773,6 +1776,29 @@ IMPL_LINK( SvxConfigPage, MoveHdl, Button *, pButton, void ) MoveEntry(pButton == m_pMoveUpButton); } +IMPL_LINK_NOARG( SvxConfigPage, SelectFunctionHdl, SvTreeListBox *, void ) +{ + // GetScriptURL() returns a non-empty string if a + // valid command is selected on the left box + bool bIsValidCommand = !GetScriptURL().isEmpty(); + + // Enable/disable Add and Remove buttons depending on current selection + if (bIsValidCommand) + { + m_pAddCommandButton->Enable(); + m_pRemoveCommandButton->Enable(); + + m_pDescriptionField->SetText( m_pFunctions->GetHelpText() ); + } + else + { + m_pAddCommandButton->Disable(); + m_pRemoveCommandButton->Disable(); + + m_pDescriptionField->SetText(""); + } +} + IMPL_LINK_NOARG(SvxConfigPage, SearchUpdateHdl, Edit&, void) { OUString aSearchTerm( m_pSearchEdit->GetText() ); diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx index fec9e139c32e..f8b397b7d614 100644 --- a/cui/source/inc/cfg.hxx +++ b/cui/source/inc/cfg.hxx @@ -424,6 +424,7 @@ protected: SvxConfigPage( vcl::Window*, const SfxItemSet& ); DECL_LINK( MoveHdl, Button *, void ); + DECL_LINK( SelectFunctionHdl, SvTreeListBox *, void ); virtual SaveInData* CreateSaveInData( const css::uno::Reference< css::ui::XUIConfigurationManager >&, |