diff options
author | Shawn Rutledge <shawn.rutledge@digia.com> | 2015-02-19 13:47:22 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@digia.com> | 2015-02-20 11:41:40 +0000 |
commit | 23e9b57e3d261f66168a8a28ccb8e5c886b4841f (patch) | |
tree | 4054c503071c814c6fa72c8d5f63ac56804fb449 /src/platformsupport/dbusmenu/qdbusmenuconnection.cpp | |
parent | 37ce38daec9c0d73ecb846e1d16709deeef6d79b (diff) |
D-Bus system tray: properly check whether StatusNotifierHost available
"org.kde.StatusNotifierWatcher" is just a watcher/helper, whereas the
actual systray object is "org.kde.StatusNotifierHost-$PID".
The org.kde.StatusNotifierWatcher.IsStatusNotifierHostRegistered
property can tell us whether there is an actual system tray.
Also renamed the accessor to isStatusNotifierHostRegistered since we
are checking for the host, and also because it can be confusing
that it's a member of QDBusMenuConnection if the name isn't clear.
See also KDE bug 339707
Change-Id: I218c5357b9cc5a62e5cc07abe980893b826f98f4
Reviewed-by: Martin Klapetek <mklapetek@kde.org>
Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
Diffstat (limited to 'src/platformsupport/dbusmenu/qdbusmenuconnection.cpp')
-rw-r--r-- | src/platformsupport/dbusmenu/qdbusmenuconnection.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/platformsupport/dbusmenu/qdbusmenuconnection.cpp b/src/platformsupport/dbusmenu/qdbusmenuconnection.cpp index a8211f63ce..73793d7497 100644 --- a/src/platformsupport/dbusmenu/qdbusmenuconnection.cpp +++ b/src/platformsupport/dbusmenu/qdbusmenuconnection.cpp @@ -63,14 +63,14 @@ QDBusMenuConnection::QDBusMenuConnection(QObject *parent) : QObject(parent) , m_connection(QDBusConnection::sessionBus()) , m_dbusWatcher(new QDBusServiceWatcher(StatusNotifierWatcherService, m_connection, QDBusServiceWatcher::WatchForRegistration, this)) - , m_watcherRegistered(false) + , m_statusNotifierHostRegistered(false) { #ifndef QT_NO_SYSTEMTRAYICON - // Start monitoring if any known tray-related services are registered. - if (m_connection.interface()->isServiceRegistered(StatusNotifierWatcherService)) - m_watcherRegistered = true; + QDBusInterface systrayHost(StatusNotifierWatcherService, StatusNotifierWatcherPath, StatusNotifierWatcherService, m_connection); + if (systrayHost.isValid() && systrayHost.property("IsStatusNotifierHostRegistered").toBool()) + m_statusNotifierHostRegistered = true; else - qCDebug(qLcMenu) << "failed to find service" << StatusNotifierWatcherService; + qCDebug(qLcMenu) << "StatusNotifierHost is not registered"; #endif } |