summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMuhammet Kara <muhammet.kara@pardus.org.tr>2017-08-25 23:53:37 +0300
committerKatarina Behrens <Katarina.Behrens@cib.de>2017-08-29 16:13:52 +0200
commit1e21383d023739cf9b77f3e83710235b4518a5d3 (patch)
tree75c4e499dae302f5c641d96e312cfde2c34b02df
parentfbe32573281c873f159e380a454e52147d15f932 (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>
-rw-r--r--cui/source/customize/SvxMenuConfigPage.cxx20
-rw-r--r--cui/source/customize/cfg.cxx26
-rw-r--r--cui/source/inc/cfg.hxx1
3 files changed, 32 insertions, 15 deletions
diff --git a/cui/source/customize/SvxMenuConfigPage.cxx b/cui/source/customize/SvxMenuConfigPage.cxx
index c07b057f7f34..af426bf0b2fc 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 f37bae121971..01d32e8fbb74 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -1177,6 +1177,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()
@@ -1772,6 +1775,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 bddd41a4307b..c7190648e3cd 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 >&,