Changeset View
Changeset View
Standalone View
Standalone View
appmenu/appmenu.cpp
Show First 20 Lines • Show All 130 Lines • ▼ Show 20 Line(s) | 129 | if (x == -1 || y == -1) { | |||
---|---|---|---|---|---|
131 | emit showRequest(serviceName, menuObjectPath, actionId); | 131 | emit showRequest(serviceName, menuObjectPath, actionId); | ||
132 | return; | 132 | return; | ||
133 | } | 133 | } | ||
134 | 134 | | |||
135 | auto *importer = new KDBusMenuImporter(serviceName, menuObjectPath.path(), this); | 135 | auto *importer = new KDBusMenuImporter(serviceName, menuObjectPath.path(), this); | ||
136 | QMetaObject::invokeMethod(importer, "updateMenu", Qt::QueuedConnection); | 136 | QMetaObject::invokeMethod(importer, "updateMenu", Qt::QueuedConnection); | ||
137 | disconnect(importer, 0, this, 0); // ensure we don't popup multiple times in case the menu updates again later | 137 | disconnect(importer, 0, this, 0); // ensure we don't popup multiple times in case the menu updates again later | ||
138 | 138 | | |||
139 | connect(importer, &KDBusMenuImporter::menuUpdated, this, [=] { | 139 | connect(importer, &KDBusMenuImporter::menuUpdated, this, [=](QMenu *m) { | ||
140 | QMenu *menu = importer->menu(); | 140 | QMenu *menu = importer->menu(); | ||
141 | if (!menu) { | 141 | if (!menu || menu != m) { | ||
142 | return; | 142 | return; | ||
143 | } | 143 | } | ||
144 | m_menu = qobject_cast<VerticalMenu*>(menu); | 144 | m_menu = qobject_cast<VerticalMenu*>(menu); | ||
145 | 145 | | |||
146 | m_menu.data()->setServiceName(serviceName); | 146 | m_menu.data()->setServiceName(serviceName); | ||
147 | m_menu.data()->setMenuObjectPath(menuObjectPath); | 147 | m_menu.data()->setMenuObjectPath(menuObjectPath); | ||
148 | 148 | | |||
149 | connect(m_menu.data(), &QMenu::aboutToHide, this, [this, importer] { | 149 | connect(m_menu.data(), &QMenu::aboutToHide, this, [this, importer] { | ||
▲ Show 20 Lines • Show All 55 Lines • Show Last 20 Lines |