prevent multiple inclusions of the same theme and infinite cycles due to cascading fallbacks

svn path=/trunk/KDE/kdelibs/; revision=987550
This commit is contained in:
Aaron J. Seigo 2009-06-26 10:20:51 +00:00
parent 6bf6cb66db
commit 023ecb90d5

View File

@ -407,17 +407,24 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings
QString fallback = cg.readEntry("FallbackTheme", QString());
fallbackThemes.clear();
while (!fallback.isEmpty()) {
while (!fallback.isEmpty() && !fallbackThemes.contains(fallback)) {
fallbackThemes.append(fallback);
QString metadataPath(KStandardDirs::locate("data", "desktoptheme/" + theme + "/metadata.desktop"));
KConfig metadata(metadataPath);
cg = KConfigGroup(&metadata, "Settings");
fallback = cg.readEntry("FallbackTheme", QString());
//TODO: grab the fallback's wallpaper defaults?
}
if (!fallbackThemes.contains("oxygen")) {
fallbackThemes.append("oxygen");
}
if (!fallbackThemes.contains(ThemePrivate::defaultTheme)) {
fallbackThemes.append(ThemePrivate::defaultTheme);
}
QObject::disconnect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()),
q, SLOT(colorsChanged()));