Skip to content

Commit

Permalink
Apparently this worked with Qt 5.15
Browse files Browse the repository at this point in the history
Revert "Drop support for QDBusTrayIcon for not being exported by Qt"

This reverts commit 8277178.
  • Loading branch information
grulja committed Nov 22, 2021
1 parent 71da0a5 commit a7b181b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/theme/qgnomeplatformtheme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
#include <gtk-3.0/gtk/gtk.h>
#define signals Q_SIGNALS

#ifndef QT_NO_SYSTEMTRAYICON
#include <private/qdbustrayicon_p.h>
#endif

QGnomePlatformTheme::QGnomePlatformTheme()
{
if (QGuiApplication::platformName() != QStringLiteral("xcb")) {
Expand Down Expand Up @@ -105,9 +109,27 @@ QPlatformDialogHelper *QGnomePlatformTheme::createPlatformDialogHelper(QPlatform
}
}

#ifndef QT_NO_SYSTEMTRAYICON
static bool isDBusTrayAvailable() {
static bool dbusTrayAvailable = false;
static bool dbusTrayAvailableKnown = false;
if (!dbusTrayAvailableKnown) {
QDBusMenuConnection conn;
if (conn.isStatusNotifierHostRegistered()) {
dbusTrayAvailable = true;
}
dbusTrayAvailableKnown = true;
}
return dbusTrayAvailable;
}
#endif

#ifndef QT_NO_SYSTEMTRAYICON
QPlatformSystemTrayIcon* QGnomePlatformTheme::createPlatformSystemTrayIcon() const
{
if (isDBusTrayAvailable()) {
return new QDBusTrayIcon();
}
return Q_NULLPTR;
}
#endif

0 comments on commit a7b181b

Please sign in to comment.