diff options
author | Dmitry Shachnev <mitya57@gmail.com> | 2014-12-02 10:05:35 +0300 |
---|---|---|
committer | Dmitry Shachnev <mitya57@gmail.com> | 2014-12-21 14:20:01 +0100 |
commit | bf86735f073aaf61278230708b92c5193c5f9e15 (patch) | |
tree | fadf72481edd6b6f8f9a006117f91b1c98cc7dc3 /src/platformsupport/themes/genericunix/qgenericunixthemes.cpp | |
parent | cac5d3744c5fc115844a40c59fa26cc84a36300e (diff) |
Support multiple desktop names in XDG_CURRENT_DESKTOP
According to the Desktop Entry Specification, “If $XDG_CURRENT_DESKTOP is
set then it contains a colon-separated list of strings”. For example, on
GNOME Flashback session that variable is set to “GNOME-Flashback:GNOME”.
The value returned by QGenericUnixServices::desktopEnvironment() is in
most cases the uppercase variant of $XDG_CURRENT_DESKTOP variable.
In qgenericunixthemes.cpp, we need to support multiple names in the
return result of that function. If at least one part is in the list of
Gtk+-based desktop environments, then we should use gtk2 platform theme.
Change-Id: I0c9de68756d41b031e822be8cf100ca5c0b202ae
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Diffstat (limited to 'src/platformsupport/themes/genericunix/qgenericunixthemes.cpp')
-rw-r--r-- | src/platformsupport/themes/genericunix/qgenericunixthemes.cpp | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp index a28fbd62f4..1060ff283b 100644 --- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp +++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp @@ -637,20 +637,25 @@ QStringList QGenericUnixTheme::themeNames() QStringList result; if (QGuiApplication::desktopSettingsAware()) { const QByteArray desktopEnvironment = QGuiApplicationPrivate::platformIntegration()->services()->desktopEnvironment(); - if (desktopEnvironment == "KDE") { + QList<QByteArray> gtkBasedEnvironments; + gtkBasedEnvironments << "GNOME" + << "X-CINNAMON" + << "UNITY" + << "MATE" + << "XFCE" + << "LXDE"; + QList<QByteArray> desktopNames = desktopEnvironment.split(':'); + Q_FOREACH (const QByteArray &desktopName, desktopNames) { + if (desktopEnvironment == "KDE") { #ifndef QT_NO_SETTINGS - result.push_back(QLatin1String(QKdeTheme::name)); + result.push_back(QLatin1String(QKdeTheme::name)); #endif - } else if (desktopEnvironment == "GNOME" || - desktopEnvironment == "X-CINNAMON" || - desktopEnvironment == "UNITY" || - desktopEnvironment == "MATE" || - desktopEnvironment == "XFCE" || - desktopEnvironment == "LXDE") { // Gtk-based desktops - // prefer the GTK2 theme implementation with native dialogs etc. - result.push_back(QStringLiteral("gtk2")); - // fallback to the generic Gnome theme if loading the GTK2 theme fails - result.push_back(QLatin1String(QGnomeTheme::name)); + } else if (gtkBasedEnvironments.contains(desktopName)) { + // prefer the GTK2 theme implementation with native dialogs etc. + result.push_back(QStringLiteral("gtk2")); + // fallback to the generic Gnome theme if loading the GTK2 theme fails + result.push_back(QLatin1String(QGnomeTheme::name)); + } } const QString session = QString::fromLocal8Bit(qgetenv("DESKTOP_SESSION")); if (!session.isEmpty() && session != QLatin1String("default") && !result.contains(session)) |