if a name is passed in the ctor, never change

BUG:335005
This commit is contained in:
Marco Martin 2014-05-20 18:24:26 +02:00
parent db8da9ff8d
commit 409d340fba
3 changed files with 8 additions and 1 deletions

View File

@ -63,6 +63,7 @@ ThemePrivate::ThemePrivate(QObject *parent)
isDefault(true),
useGlobal(true),
hasWallpapers(false),
fixedName(false),
backgroundContrastEnabled(true)
{
ThemeConfig config;
@ -456,6 +457,9 @@ void ThemePrivate::settingsFileChanged(const QString &file)
void ThemePrivate::settingsChanged()
{
if (fixedName) {
return;
}
//qDebug() << "Settings Changed!";
KConfigGroup cg = config();
setThemeName(cg.readEntry("name", ThemePrivate::defaultTheme), false);
@ -575,7 +579,8 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings
// the system colors.
bool realTheme = theme != systemColorsTheme;
if (realTheme) {
QString themePath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1Literal(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % theme % QLatin1Char('/'));
QString themePath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1Literal(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % theme % "/metadata.desktop");
if (themePath.isEmpty() && themeName.isEmpty()) {
themePath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/default"), QStandardPaths::LocateDirectory);

View File

@ -148,6 +148,7 @@ public:
bool useGlobal : 1;
bool hasWallpapers : 1;
bool cacheTheme : 1;
bool fixedName : 1;
qreal backgroundContrast;
qreal backgroundIntensity;

View File

@ -81,6 +81,7 @@ Theme::Theme(const QString &themeName, QObject *parent)
d->cacheTheme = false;
d->setThemeName(themeName, false);
d->cacheTheme = useCache;
d->fixedName = true;
if (QCoreApplication::instance()) {
connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()),
d, SLOT(onAppExitCleanup()));