From a1bb5a4713f1b8e1afe4b0a085274a0c500319f2 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Wed, 9 Sep 2009 19:08:07 +0200 Subject: 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 --- src/gui/image/qiconloader.cpp | 37 +++++++++++++++++++------------------ 1 file 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")); } } -- cgit v0.12