Skip to content

Commit

Permalink
Disable the individual reset button for the menubar menus
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
mrkara authored and Katarina Behrens committed Aug 29, 2017
1 parent fbe3257 commit 1e21383
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 15 deletions.
20 changes: 5 additions & 15 deletions cui/source/customize/SvxMenuConfigPage.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

}

Expand Down Expand Up @@ -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();

Expand All @@ -198,8 +202,6 @@ void SvxMenuConfigPage::UpdateButtonStates()
m_pMoveUpButton->Enable( false );
m_pMoveDownButton->Enable( false );

m_pDescriptionField->SetText("");

return;
}

Expand All @@ -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()
Expand Down
26 changes: 26 additions & 0 deletions cui/source/customize/cfg.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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() );
Expand Down
1 change: 1 addition & 0 deletions cui/source/inc/cfg.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -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 >&,
Expand Down

0 comments on commit 1e21383

Please sign in to comment.