summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorKatarina Behrens <Katarina.Behrens@cib.de>2018-10-22 14:30:20 +0200
committerKatarina Behrens <Katarina.Behrens@cib.de>2018-10-22 20:24:48 +0200
commita77163f0bd21d018da0e195974b42d6d71503592 (patch)
treef33b7e68a73b4df7daf45e88abec7e9028a509c2 /vcl
parent22beeb3ee7d199b6b15636c532d3ad9f75da1a2b (diff)
tdf#119856: [Re-]activate menu before dispatching command
Menu entry dispatchers may be cleared (after they've been initially set) when an extension comes with its own menu entries. Activating the entry sets the dispatcher again so that dispatching a command can proceed Change-Id: I3909fb5eb6e6e2fa7db0418aca17009e60f01372 Reviewed-on: https://gerrit.libreoffice.org/62180 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/qt5/Qt5Menu.hxx2
-rw-r--r--vcl/qt5/Qt5Menu.cxx10
2 files changed, 8 insertions, 4 deletions
diff --git a/vcl/inc/qt5/Qt5Menu.hxx b/vcl/inc/qt5/Qt5Menu.hxx
index bbd18709ce51..f3111d01aa8a 100644
--- a/vcl/inc/qt5/Qt5Menu.hxx
+++ b/vcl/inc/qt5/Qt5Menu.hxx
@@ -60,7 +60,7 @@ public:
Qt5MenuItem* GetItemAtPos(unsigned nPos) { return maItems[nPos]; }
private slots:
- void DispatchCommand(Qt5MenuItem* pQItem);
+ void slotMenuTriggered(Qt5MenuItem* pQItem);
};
class Qt5MenuItem : public SalMenuItem
diff --git a/vcl/qt5/Qt5Menu.cxx b/vcl/qt5/Qt5Menu.cxx
index c7abd17c30d2..9bbf86be6688 100644
--- a/vcl/qt5/Qt5Menu.cxx
+++ b/vcl/qt5/Qt5Menu.cxx
@@ -138,7 +138,7 @@ void Qt5Menu::DoFullMenuUpdate(Menu* pMenuBar, QMenu* pParentMenu)
pAction->setVisible(pSalMenuItem->mbVisible);
connect(pAction, &QAction::triggered, this,
- [this, pSalMenuItem] { DispatchCommand(pSalMenuItem); });
+ [this, pSalMenuItem] { slotMenuTriggered(pSalMenuItem); });
}
}
}
@@ -234,14 +234,18 @@ const Qt5Frame* Qt5Menu::GetFrame() const
return pMenu ? pMenu->mpFrame : nullptr;
}
-void Qt5Menu::DispatchCommand(Qt5MenuItem* pQItem)
+void Qt5Menu::slotMenuTriggered(Qt5MenuItem* pQItem)
{
if (pQItem)
{
Qt5Menu* pSalMenu = pQItem->mpParentMenu;
Qt5Menu* pTopLevel = pSalMenu->GetTopLevel();
+
+ // it is possible that dispatcher of a menu entry was cleared since
+ // initial activation (happens e.g. when extension comes w/ its own menus
+ // and dispatchers) so re-activate the entry before dispatching the command
+ pTopLevel->GetMenu()->HandleMenuActivateEvent(pSalMenu->GetMenu());
pTopLevel->GetMenu()->HandleMenuCommandEvent(pSalMenu->GetMenu(), pQItem->mnId);
- SAL_WARN("vcl.qt5", "menu triggered " << pQItem->mnId);
}
}