From b8490cc7452ff635a63b81a5b549914b327ccfd5 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Sun, 9 Nov 2008 20:41:27 +0000 Subject: [PATCH] when the modification time of the metadata file, discard the cache svn path=/trunk/KDE/kdelibs/; revision=882120 --- theme.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/theme.cpp b/theme.cpp index cd9876c5a..3c685afa2 100644 --- a/theme.cpp +++ b/theme.cpp @@ -21,6 +21,7 @@ #include #include +#include #ifdef Q_WS_X11 #include #endif @@ -264,7 +265,8 @@ void Theme::setThemeName(const QString &themeName) //kDebug() << "we're going for..." << colorsFile << "*******************"; // load the wallpaper settings, if any - KConfig metadata(KStandardDirs::locate("data", "desktoptheme/" + theme + "/metadata.desktop")); + QString metadataPath(KStandardDirs::locate("data", "desktoptheme/" + theme + "/metadata.desktop")); + KConfig metadata(metadataPath); KConfigGroup cg; if (metadata.hasGroup("Wallpaper")) { // we have a theme color config, so let's also check to see if @@ -308,6 +310,18 @@ void Theme::setThemeName(const QString &themeName) QString svgElementsFile = KStandardDirs::locateLocal("cache", "plasma-svgelements-"+themeName); + + //check for expired cache + QFile f(metadataPath); + QFileInfo info(f); + + if (info.lastModified().toTime_t() > d->pixmapCache->timestamp()) { + d->pixmapCache->discard(); + + QFile f(svgElementsFile); + f.remove(); + } + d->invalidElements.clear(); d->svgElementsCache = KSharedConfig::openConfig(svgElementsFile);