Aaron J. SeigoOn Friday, May 31, 2013 11:21:45 wrote: > On Friday, May 31, 2013 11:09:42 Kai Uwe Broulik wrote: > > My idea would be to also take in account the X-KDE-PluginInfo-Version of > > the metadata and force-clear the cache when the number changes. Whenever > > changes are made to the theme, the number should be increased. Isn't that > would mean adding the v# to the cache somewhere, but that's a trivial add. > it would even make sense to do this in libplasma1, very bug-fix-ish.
i imagine it would look sth like the attached patch (which builds, but i haven't tested it yet) -- Aaron J. Seigo
diff --git a/plasma/theme.cpp b/plasma/theme.cpp index 2ce1671..c425cb3 100644 --- a/plasma/theme.cpp +++ b/plasma/theme.cpp @@ -228,10 +228,15 @@ bool ThemePrivate::useCache() // FIXME: when using the system colors, if they change while the application is not running // the cache should be dropped; we need a way to detect system color change when the // application is not running. - QFile f(KStandardDirs::locate("data", "desktoptheme/" + themeName + "/metadata.desktop")); - QFileInfo info(f); - if (info.lastModified().toTime_t() > uint(pixmapCache->lastModifiedTime())) { - pixmapCache->clear(); + const QString path = KStandardDirs::locate("data", "desktoptheme/" + themeName + "/metadata.desktop"); + const KPluginInfo pluginInfo(path); + const QFile f(path); + const QFileInfo fileInfo(f); + QByteArray cacheVersion; + if (!pixmapCache->find("__themeVersion", &cacheVersion) || + pluginInfo.version().toLatin1() != cacheVersion || + fileInfo.lastModified().toTime_t() > uint(pixmapCache->lastModifiedTime())) { + discardCache(PixmapCache | SvgElementsCache); } } } @@ -297,6 +302,9 @@ void ThemePrivate::discardCache(CacheTypes caches) saveTimer->stop(); if (pixmapCache) { pixmapCache->clear(); + const QString path = KStandardDirs::locate("data", "desktoptheme/" + themeName + "/metadata.desktop"); + const KPluginInfo info(path); + pixmapCache->insert("__themeVersion", info.version().toLatin1()); } } else { // This deletes the object but keeps the on-disk cache for later use
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel