summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/themes/genericunix
diff options
context:
space:
mode:
Diffstat (limited to 'src/platformsupport/themes/genericunix')
-rw-r--r--src/platformsupport/themes/genericunix/qgenericunixthemes.cpp38
-rw-r--r--src/platformsupport/themes/genericunix/qgenericunixthemes_p.h8
2 files changed, 44 insertions, 2 deletions
diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
index 1060ff283b..9fa1f19f3c 100644
--- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
+++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.
@@ -51,6 +51,10 @@
#include <qpa/qplatformintegration.h>
#include <qpa/qplatformservices.h>
#include <qpa/qplatformdialoghelper.h>
+#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)
+#include "QtPlatformSupport/private/qdbustrayicon_p.h"
+#include "QtPlatformSupport/private/qdbusplatformmenu_p.h"
+#endif
#include <algorithm>
@@ -85,6 +89,20 @@ const char *QGenericUnixTheme::name = "generic";
static const char defaultSystemFontNameC[] = "Sans Serif";
enum { defaultSystemFontSize = 9 };
+#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)
+static bool isDBusTrayAvailable() {
+ static bool dbusTrayAvailable = false;
+ static bool dbusTrayAvailableKnown = false;
+ if (!dbusTrayAvailableKnown) {
+ QDBusMenuConnection conn;
+ if (conn.isWatcherRegistered())
+ dbusTrayAvailable = true;
+ dbusTrayAvailableKnown = true;
+ }
+ return dbusTrayAvailable;
+}
+#endif
+
class QGenericUnixThemePrivate : public QPlatformThemePrivate
{
public:
@@ -509,6 +527,15 @@ QPlatformTheme *QKdeTheme::createKdeTheme()
return new QKdeTheme(kdeDirs, kdeVersion);
}
+#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)
+QPlatformSystemTrayIcon *QKdeTheme::createPlatformSystemTrayIcon() const
+{
+ if (isDBusTrayAvailable())
+ return new QDBusTrayIcon();
+ return Q_NULLPTR;
+}
+#endif
+
#endif // QT_NO_SETTINGS
/*!
@@ -595,6 +622,15 @@ QString QGnomeTheme::gtkFontName() const
return QStringLiteral("%1 %2").arg(QLatin1String(defaultSystemFontNameC)).arg(defaultSystemFontSize);
}
+#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)
+QPlatformSystemTrayIcon *QGnomeTheme::createPlatformSystemTrayIcon() const
+{
+ if (isDBusTrayAvailable())
+ return new QDBusTrayIcon();
+ return Q_NULLPTR;
+}
+#endif
+
QString QGnomeTheme::standardButtonText(int button) const
{
switch (button) {
diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h b/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h
index 2a689c6872..d0f7702793 100644
--- a/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h
+++ b/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.
@@ -98,6 +98,9 @@ public:
virtual const QPalette *palette(Palette type = SystemPalette) const Q_DECL_OVERRIDE;
virtual const QFont *font(Font type) const Q_DECL_OVERRIDE;
+#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)
+ QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const Q_DECL_OVERRIDE;
+#endif
static const char *name;
};
@@ -115,6 +118,9 @@ public:
QString standardButtonText(int button) const Q_DECL_OVERRIDE;
virtual QString gtkFontName() const;
+#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)
+ QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const Q_DECL_OVERRIDE;
+#endif
static const char *name;
};