vcl/inc/qt5/Qt5Menu.hxx |    2 +-
 vcl/qt5/Qt5Menu.cxx     |   10 +++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

New commits:
commit a77163f0bd21d018da0e195974b42d6d71503592
Author:     Katarina Behrens <katarina.behr...@cib.de>
AuthorDate: Mon Oct 22 14:30:20 2018 +0200
Commit:     Katarina Behrens <katarina.behr...@cib.de>
CommitDate: Mon Oct 22 20:24:48 2018 +0200

    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.behr...@cib.de>

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);
     }
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to