diff options
author | Katarina Behrens <Katarina.Behrens@cib.de> | 2018-10-22 14:30:20 +0200 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2018-10-22 20:24:48 +0200 |
commit | a77163f0bd21d018da0e195974b42d6d71503592 (patch) | |
tree | f33b7e68a73b4df7daf45e88abec7e9028a509c2 /vcl/qt5/Qt5Menu.cxx | |
parent | 22beeb3ee7d199b6b15636c532d3ad9f75da1a2b (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/qt5/Qt5Menu.cxx')
-rw-r--r-- | vcl/qt5/Qt5Menu.cxx | 10 |
1 files changed, 7 insertions, 3 deletions
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); } } |