find the colors file properly. yay for being able to read the taskbar again.

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=766067
This commit is contained in:
Aaron J. Seigo 2008-01-25 06:10:44 +00:00
parent 06011ef27e
commit dd87a4e936

View File

@ -98,32 +98,38 @@ void Theme::settingsChanged()
void Theme::setThemeName(const QString &themeName) void Theme::setThemeName(const QString &themeName)
{ {
if (themeName.isEmpty() || themeName == d->themeName) { QString theme = themeName;
if (theme.isEmpty() || theme == d->themeName) {
// let's try and get the default theme at least // let's try and get the default theme at least
if (d->themeName.isEmpty()) { if (d->themeName.isEmpty()) {
setThemeName("default"); theme = "default";
} } else {
return; return;
} }
}
//TODO: should we care about names with relative paths in them? //TODO: should we care about names with relative paths in them?
QString themePath = KStandardDirs::locate("data", "desktoptheme/" + themeName + "/"); QString themePath = KStandardDirs::locate("data", "desktoptheme/" + theme + "/");
if (themePath.isEmpty() && d->themeName.isEmpty()) {
themePath = KStandardDirs::locate("data", "desktoptheme/default/");
if (themePath.isEmpty()) { if (themePath.isEmpty()) {
// let's try and get the default theme at least
if (d->themeName.isEmpty() && themeName != "default") {
setThemeName("default");
}
return; return;
} }
d->themeName = themeName; theme = "default";
}
d->themeName = theme;
// load the color scheme config // load the color scheme config
themePath = themePath.append("colors"); QString colorsFile = KStandardDirs::locate("data", "desktoptheme/" + theme + "/colors");
if (QFile::exists(themePath)) { //kDebug() << "we're going for..." << colorsFile << "*******************";
d->colors = KSharedConfig::openConfig(themePath);
} else { if (colorsFile.isEmpty()) {
d->colors = 0; d->colors = 0;
} else {
d->colors = KSharedConfig::openConfig(colorsFile);
} }
emit changed(); emit changed();