diff --git a/svg.cpp b/svg.cpp index eba31b508..77353112e 100644 --- a/svg.cpp +++ b/svg.cpp @@ -276,14 +276,14 @@ class SvgPrivate void checkApplyColorHint() { - KConfigGroup cg(KGlobal::config(), "SvgHints"); - QString cgKey = themePath + "-hint-apply-color-scheme"; - if (cg.hasKey(cgKey)) { - applyColors = cg.readEntry(cgKey, false); + QRectF elementRect; + bool found = Theme::defaultTheme()->findInRectsCache(themePath, cacheId("hint-apply-color-scheme"), elementRect); + + if (found) { + applyColors = elementRect.isValid(); } else { - createRenderer(); + findAndCacheElementRect("hint-apply-color-scheme"); applyColors = renderer->elementExists("hint-apply-color-scheme"); - cg.writeEntry(cgKey, applyColors); } } diff --git a/theme.cpp b/theme.cpp index 4247af7a0..43ce62528 100644 --- a/theme.cpp +++ b/theme.cpp @@ -102,6 +102,7 @@ public: QString findInTheme(const QString &image, const QString &theme) const; void compositingChanged(); + void discardCache(); static const char *defaultTheme; static PackageStructure::Ptr packageStructure; @@ -169,6 +170,11 @@ void ThemePrivate::compositingChanged() #endif } +void ThemePrivate::discardCache() +{ + pixmapCache->discard(); +} + class ThemeSingleton { public: @@ -286,10 +292,15 @@ void Theme::setThemeName(const QString &themeName) disconnect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()), this, SIGNAL(themeChanged())); + disconnect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()), + this, SLOT(discardCache())); + if (colorsFile.isEmpty()) { d->colors = 0; connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()), this, SIGNAL(themeChanged())); + connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()), + this, SLOT(discardCache())); } else { d->colors = KSharedConfig::openConfig(colorsFile); } diff --git a/theme.h b/theme.h index 7541358d8..b62030c9b 100644 --- a/theme.h +++ b/theme.h @@ -247,6 +247,7 @@ class PLASMA_EXPORT Theme : public QObject ThemePrivate *const d; Q_PRIVATE_SLOT(d, void compositingChanged()) + Q_PRIVATE_SLOT(d, void discardCache()) }; } // Plasma namespace