summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2024-12-09 14:54:47 +0500
committerMike Kaganski <mike.kaganski@collabora.com>2024-12-11 11:43:03 +0100
commitd799a66e07ac8d9a4f8162734d66930858b9411b (patch)
treec883227a604e66b9d83a1d6f275734bc966dce07 /framework
parent5d25fc928846a0914954b71f52636f0232ac2618 (diff)
Check if the correct slot is active in SaveToolbarController::statusChanged
Otherwise, the button may still be active, even with the slot disabled. Change-Id: Id292b69513a7de8248d33fa813a8b09964f30434 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178124 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'framework')
-rw-r--r--framework/source/uielement/popuptoolbarcontroller.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx
index 81424825b2c2..2b3b70da963b 100644
--- a/framework/source/uielement/popuptoolbarcontroller.cxx
+++ b/framework/source/uielement/popuptoolbarcontroller.cxx
@@ -459,6 +459,9 @@ void SaveToolbarController::initialize( const css::uno::Sequence< css::uno::Any
{
PopupMenuToolbarController::initialize( aArguments );
+ // Also listen to the status of the slot used for read-only case
+ m_aListenerMap.emplace(u".uno:SaveAs"_ustr, css::uno::Reference<css::frame::XDispatch>());
+
ToolBox* pToolBox = nullptr;
ToolBoxItemId nId;
if ( !getToolboxId( nId, &pToolBox ) )
@@ -541,9 +544,9 @@ void SaveToolbarController::statusChanged( const css::frame::FeatureStateEvent&
bool bLastReadOnly = m_bReadOnly;
m_bReadOnly = m_xStorable.is() && m_xStorable->isReadonly();
+ OUString sCommand = m_bReadOnly ? u".uno:SaveAs"_ustr : m_aCommandURL;
if ( bLastReadOnly != m_bReadOnly )
{
- OUString sCommand = m_bReadOnly ? u".uno:SaveAs"_ustr : m_aCommandURL;
auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(sCommand,
vcl::CommandInfoProvider::GetModuleIdentifier(m_xFrame));
pToolBox->SetQuickHelpText( nId,
@@ -553,8 +556,8 @@ void SaveToolbarController::statusChanged( const css::frame::FeatureStateEvent&
updateImage();
}
- if ( !m_bReadOnly )
- pToolBox->EnableItem( nId, rEvent.IsEnabled );
+ if (rEvent.FeatureURL.Complete == sCommand)
+ pToolBox->EnableItem(nId, rEvent.IsEnabled);
}
void SaveToolbarController::modified( const css::lang::EventObject& /*rEvent*/ )