59 lines
2.2 KiB
Diff
59 lines
2.2 KiB
Diff
From 072679bd7044021b08a3ef04909719b5b3479f58 Mon Sep 17 00:00:00 2001
|
|
From: Martin Klapetek <mklapetek@kde.org>
|
|
Date: Wed, 14 Jan 2015 16:13:10 +0100
|
|
Subject: [PATCH 5/8] Properly check for systray being available
|
|
|
|
The "org.kde.StatusNotifierWatcher" is just a watcher/helper, not the
|
|
actual systray object, that's "org.kde.StatusNotifierHost-$PID". Because
|
|
Plasma appends the PID (as per the specification), we cannot check
|
|
directly for it being present on the bus, so we check the
|
|
org.kde.StatusNotifierWatcher.IsStatusNotifierHostRegistered property
|
|
that's meant to be used for this.
|
|
|
|
Plus QSystemTrayIcon::isSystemTrayAvailable() is actually returning
|
|
always true, because the Watcher is in kded and is /always/ present.
|
|
|
|
This also fixes many apps with KSNI crashing on plasma exit, bug 339707
|
|
(though I believe this is not the direct cause for that bug)
|
|
|
|
REVIEW: 121885
|
|
BUG: 339707
|
|
CHANGELOG
|
|
---
|
|
src/platformtheme/kdeplatformsystemtrayicon.cpp | 12 +++++++-----
|
|
1 file changed, 7 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/src/platformtheme/kdeplatformsystemtrayicon.cpp b/src/platformtheme/kdeplatformsystemtrayicon.cpp
|
|
index b5e207cbff0cf302ef142bb424d6dfbfcad9bbd3..d3a1d4fe2f135ea241e97598a2589558656c1099 100644
|
|
--- a/src/platformtheme/kdeplatformsystemtrayicon.cpp
|
|
+++ b/src/platformtheme/kdeplatformsystemtrayicon.cpp
|
|
@@ -24,9 +24,7 @@
|
|
#include <QMenu>
|
|
#include <QRect>
|
|
#include <QApplication>
|
|
-#include <QDBusConnection>
|
|
-#include <QDBusConnectionInterface>
|
|
-#include <QDBusReply>
|
|
+#include <QDBusInterface>
|
|
|
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0))
|
|
SystemTrayMenu::SystemTrayMenu()
|
|
@@ -327,8 +325,12 @@ void KDEPlatformSystemTrayIcon::showMessage(const QString &msg, const QString &t
|
|
|
|
bool KDEPlatformSystemTrayIcon::isSystemTrayAvailable() const
|
|
{
|
|
- QDBusReply<bool> reply = QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.StatusNotifierWatcher");
|
|
- return reply.value();
|
|
+ QDBusInterface systrayHost("org.kde.StatusNotifierWatcher", "/StatusNotifierWatcher", "org.kde.StatusNotifierWatcher");
|
|
+ if (systrayHost.isValid()) {
|
|
+ return systrayHost.property("IsStatusNotifierHostRegistered").toBool();
|
|
+ }
|
|
+
|
|
+ return false;
|
|
}
|
|
|
|
bool KDEPlatformSystemTrayIcon::supportsMessages() const
|
|
--
|
|
2.2.2
|
|
|