diff options
Diffstat (limited to 'src/gui/image/qiconloader.cpp')
-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")); } } |