diff options
author | Jens Bache-Wiig <jbache@trolltech.com> | 2009-09-09 17:08:07 (GMT) |
---|---|---|
committer | Jens Bache-Wiig <jbache@trolltech.com> | 2009-09-09 17:09:09 (GMT) |
commit | a1bb5a4713f1b8e1afe4b0a085274a0c500319f2 (patch) | |
tree | a48d2e33b8ebd14ccccfa581ca416d134a20b7f5 /src/gui | |
parent | 8ff6ecc129d98a4bb198aeb1e7d995c4b332f47b (diff) | |
download | Qt-a1bb5a4713f1b8e1afe4b0a085274a0c500319f2.zip Qt-a1bb5a4713f1b8e1afe4b0a085274a0c500319f2.tar.gz Qt-a1bb5a4713f1b8e1afe4b0a085274a0c500319f2.tar.bz2 |
Fix incorrect fallback for icon themes
When using themed icons, we incorrectly used the systemTheme
as the fallback. This is not correct as the idea of the fallback
was to use the generic "gnome" or "oxygen" themes if the
proper theme was not available.
Reviewed-by: joao
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/image/qiconloader.cpp | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp index 908b8a1..adc2967 100644 --- a/src/gui/image/qiconloader.cpp +++ b/src/gui/image/qiconloader.cpp @@ -68,41 +68,42 @@ QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC(QIconLoader, iconLoaderInstance) +static QString fallbackTheme() +{ + QString defaultTheme; +#ifdef Q_WS_X11 + if (X11->desktopEnvironment == DE_GNOME) + defaultTheme = QLatin1String("gnome"); + else if (X11->desktopEnvironment == DE_KDE) + defaultTheme = X11->desktopVersion >= 4 ? + QString::fromLatin1("oxygen") : + QString::fromLatin1("crystalsvg"); +#endif + return defaultTheme; +} + static QString systemThemeName() { - QString result; + QString result = fallbackTheme(); #ifdef Q_WS_X11 if (X11->desktopEnvironment == DE_GNOME) { -#if defined(QT_NO_STYLE_GTK) - result = QLatin1String("gnome"); -#else +#ifndef QT_NO_STYLE_GTK result = QGtk::getGConfString(QLatin1String("/desktop/gnome/interface/icon_theme"), - QLatin1String("gnome")); + result); #endif } else if (X11->desktopEnvironment == DE_KDE) { - QString kdeDefault = X11->desktopVersion >= 4 ? - QString::fromLatin1("oxygen") : - QString::fromLatin1("crystalsvg"); - QSettings settings(QKde::kdeHome() + QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat); settings.beginGroup(QLatin1String("Icons")); - result = settings.value(QLatin1String("Theme"), kdeDefault).toString(); + result = settings.value(QLatin1String("Theme"), result).toString(); } #endif return result; } -static QString fallbackTheme() -{ - QString defaultTheme = systemThemeName(); - if (defaultTheme.isEmpty()) - defaultTheme = QLatin1String("hicolor"); - return defaultTheme; -} QIconLoader::QIconLoader() : m_themeKey(1), m_supportsSvg(false) @@ -269,7 +270,7 @@ QIconTheme::QIconTheme(const QString &themeName) m_parents.append(fallbackTheme()); // Ensure that all themes fall back to hicolor - if (!m_parents.isEmpty()) + if (!m_parents.contains(QLatin1String("hicolor"))) m_parents.append(QLatin1String("hicolor")); } } |