Commit b711b707 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

[DBusMenuImporter] Send "opened" signal alongside about to show

Firefox deliberately ignores the "about-to-show" event and only updates its menus in response to "opened".
There was an unused slot to send an "opened" event. Use that and place the updateMenu call inside.
Also use an UniqueConnection.

Differential Revision: https://phabricator.kde.org/D9631
parent 59ba8b8f
......@@ -431,11 +431,8 @@ void DBusMenuImporter::slotGetLayoutFinished(QDBusPendingCallWatcher *watcher)
sendClickedEvent(id);
});
if (action->menu()) {
auto menu = action->menu();
connect(menu, &QMenu::aboutToShow, this, [menu, this]() {
updateMenu(menu);
});
if (QMenu *menuAction = action->menu()) {
connect(menuAction, &QMenu::aboutToShow, this, &DBusMenuImporter::slotMenuAboutToShow, Qt::UniqueConnection);
}
connect(menu, &QMenu::aboutToHide, this, &DBusMenuImporter::slotMenuAboutToHide, Qt::UniqueConnection);
......@@ -527,6 +524,8 @@ void DBusMenuImporter::slotMenuAboutToShow()
QMenu *menu = qobject_cast<QMenu*>(sender());
Q_ASSERT(menu);
updateMenu(menu);
QAction *action = menu->menuAction();
Q_ASSERT(action);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment