Changeset View
Changeset View
Standalone View
Standalone View
src/platformtheme/kdeplatformtheme.cpp
Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Line(s) | |||||
55 | 55 | | |||
56 | #if QT_VERSION >= QT_VERSION_CHECK(5,7,0) | 56 | #if QT_VERSION >= QT_VERSION_CHECK(5,7,0) | ||
57 | #include "qdbusmenubar_p.h" | 57 | #include "qdbusmenubar_p.h" | ||
58 | #endif | 58 | #endif | ||
59 | 59 | | |||
60 | static const QByteArray s_x11AppMenuServiceNamePropertyName = QByteArrayLiteral("_KDE_NET_WM_APPMENU_SERVICE_NAME"); | 60 | static const QByteArray s_x11AppMenuServiceNamePropertyName = QByteArrayLiteral("_KDE_NET_WM_APPMENU_SERVICE_NAME"); | ||
61 | static const QByteArray s_x11AppMenuObjectPathPropertyName = QByteArrayLiteral("_KDE_NET_WM_APPMENU_OBJECT_PATH"); | 61 | static const QByteArray s_x11AppMenuObjectPathPropertyName = QByteArrayLiteral("_KDE_NET_WM_APPMENU_OBJECT_PATH"); | ||
62 | 62 | | |||
63 | static const QByteArray s_waylandAppMenuServiceNamePropertyName = QByteArrayLiteral("KDE_APPMENU_SERVICE_NAME"); | | |||
64 | static const QByteArray s_waylandAppMenuObjectPathPropertyName = QByteArrayLiteral("KDE_APPMENU_OBJECT_PATH"); | | |||
65 | | ||||
66 | static bool checkDBusGlobalMenuAvailable() | 63 | static bool checkDBusGlobalMenuAvailable() | ||
67 | { | 64 | { | ||
68 | if (qEnvironmentVariableIsSet("KDE_NO_GLOBAL_MENU")) { | 65 | if (qEnvironmentVariableIsSet("KDE_NO_GLOBAL_MENU")) { | ||
69 | return false; | 66 | return false; | ||
70 | } | 67 | } | ||
71 | 68 | | |||
72 | QDBusConnection connection = QDBusConnection::sessionBus(); | 69 | QDBusConnection connection = QDBusConnection::sessionBus(); | ||
73 | QString registrarService = QStringLiteral("com.canonical.AppMenu.Registrar"); | 70 | QString registrarService = QStringLiteral("com.canonical.AppMenu.Registrar"); | ||
▲ Show 20 Lines • Show All 295 Lines • ▼ Show 20 Line(s) | 360 | if (m_x11Integration) { | |||
369 | if (newWindow) { | 366 | if (newWindow) { | ||
370 | m_x11Integration->setWindowProperty(newWindow, s_x11AppMenuServiceNamePropertyName, serviceName.toUtf8()); | 367 | m_x11Integration->setWindowProperty(newWindow, s_x11AppMenuServiceNamePropertyName, serviceName.toUtf8()); | ||
371 | m_x11Integration->setWindowProperty(newWindow, s_x11AppMenuObjectPathPropertyName, objectPath.toUtf8()); | 368 | m_x11Integration->setWindowProperty(newWindow, s_x11AppMenuObjectPathPropertyName, objectPath.toUtf8()); | ||
372 | } | 369 | } | ||
373 | } | 370 | } | ||
374 | 371 | | |||
375 | if (m_kwaylandIntegration) { | 372 | if (m_kwaylandIntegration) { | ||
376 | if (oldWindow) { | 373 | if (oldWindow) { | ||
377 | m_kwaylandIntegration->setWindowProperty(oldWindow, s_waylandAppMenuServiceNamePropertyName, {}); | 374 | m_kwaylandIntegration->setAppMenu(QString(), QString()); | ||
378 | m_kwaylandIntegration->setWindowProperty(oldWindow, s_waylandAppMenuObjectPathPropertyName, {}); | | |||
379 | } | 375 | } | ||
380 | 376 | | |||
381 | if (newWindow) { | 377 | if (newWindow) { | ||
382 | m_kwaylandIntegration->setWindowProperty(newWindow, s_waylandAppMenuServiceNamePropertyName, serviceName.toUtf8()); | 378 | m_kwaylandIntegration->setAppMenu(serviceName, objectPath); | ||
383 | m_kwaylandIntegration->setWindowProperty(newWindow, s_waylandAppMenuObjectPathPropertyName, objectPath.toUtf8()); | | |||
384 | } | 379 | } | ||
385 | } | 380 | } | ||
386 | }); | 381 | }); | ||
387 | 382 | | |||
388 | return menu; | 383 | return menu; | ||
389 | } | 384 | } | ||
390 | 385 | | |||
391 | return nullptr; | 386 | return nullptr; | ||
Show All 22 Lines |