colorScheme and buttonColorScheme need to be updated the color changes

for system-color themes.  Also clear out itemsToSave on colorChange.

svn path=/trunk/KDE/kdelibs/; revision=898780
This commit is contained in:
Andrew Lake 2008-12-19 01:48:42 +00:00
parent 0b9f1db281
commit fb3d7e75cb
3 changed files with 14 additions and 3 deletions

View File

@ -366,6 +366,8 @@ class SvgPrivate
} }
eraseRenderer(); eraseRenderer();
itemsToSave.clear();
saveTimer->stop();
emit q->repaintNeeded(); emit q->repaintNeeded();
} }

View File

@ -100,6 +100,7 @@ public:
void compositingChanged(); void compositingChanged();
void discardCache(); void discardCache();
void discardCache(bool recreateElementsCache); void discardCache(bool recreateElementsCache);
void colorsChanged();
bool useCache(); bool useCache();
static const char *defaultTheme; static const char *defaultTheme;
@ -187,10 +188,10 @@ void ThemePrivate::discardCache()
void ThemePrivate::discardCache(bool recreateElementsCache) void ThemePrivate::discardCache(bool recreateElementsCache)
{ {
KPixmapCache::deleteCache("plasma_theme_" + themeName);
delete pixmapCache; delete pixmapCache;
pixmapCache = 0; pixmapCache = 0;
invalidElements.clear(); invalidElements.clear();
KPixmapCache::deleteCache("plasma_theme_" + themeName);
svgElementsCache = 0; svgElementsCache = 0;
@ -205,6 +206,13 @@ void ThemePrivate::discardCache(bool recreateElementsCache)
} }
} }
void ThemePrivate::colorsChanged()
{
discardCache(true);
colorScheme = KColorScheme(QPalette::Active, KColorScheme::Window, colors);
buttonColorScheme = KColorScheme(QPalette::Active, KColorScheme::Button, colors);
}
class ThemeSingleton class ThemeSingleton
{ {
public: public:
@ -331,14 +339,14 @@ void Theme::setThemeName(const QString &themeName)
disconnect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()), disconnect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()),
this, SIGNAL(themeChanged())); this, SIGNAL(themeChanged()));
disconnect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()), disconnect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()),
this, SLOT(discardCache())); this, SLOT(colorsChanged()));
if (colorsFile.isEmpty()) { if (colorsFile.isEmpty()) {
d->colors = 0; d->colors = 0;
connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()), connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()),
this, SIGNAL(themeChanged())); this, SIGNAL(themeChanged()));
connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()), connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()),
this, SLOT(discardCache())); this, SLOT(colorsChanged()));
} else { } else {
d->colors = KSharedConfig::openConfig(colorsFile); d->colors = KSharedConfig::openConfig(colorsFile);
} }

View File

@ -259,6 +259,7 @@ class PLASMA_EXPORT Theme : public QObject
Q_PRIVATE_SLOT(d, void compositingChanged()) Q_PRIVATE_SLOT(d, void compositingChanged())
Q_PRIVATE_SLOT(d, void discardCache()) Q_PRIVATE_SLOT(d, void discardCache())
Q_PRIVATE_SLOT(d, void colorsChanged())
}; };
} // Plasma namespace } // Plasma namespace