Kaydet (Commit) 862b968d authored tarafından Muhammet Kara's avatar Muhammet Kara Kaydeden (comit) Katarina Behrens

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/41582Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarKatarina Behrens <Katarina.Behrens@cib.de>
üst 25435b29
......@@ -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()
......
......@@ -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() );
......
......@@ -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 >&,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment