Commit be6738b3 authored by Halla Rempt's avatar Halla Rempt
Browse files

BUG:353591 Remove tags associated with bundles

parent 5ce167b6
......@@ -24,7 +24,6 @@
#include <KoXmlWriter.h>
#include <KoStore.h>
#include <KoResourceServerProvider.h>
#include <KoResourcePaths.h>
#include <QScopedPointer>
......@@ -197,16 +196,17 @@ bool KisResourceBundle::load()
* If no version is found it's an old bundle with md5 hashes to fix, or if some manifest resource entry
* doesn't not correspond to a file the bundle is "broken", in both cases we need to recreate the bundle.
*/
if(!versionFound) {
if (!versionFound) {
m_metadata.insert("bundle-version", "1");
warnKrita << filename() << " has an old version and possibly wrong resources md5, so it will be recreated.";
toRecreate = true;
}
if(toRecreate) {
if (toRecreate) {
recreateBundle(resourceStore);
}
m_installed = true;
setValid(true);
setImage(m_thumbnail);
......@@ -709,8 +709,11 @@ bool KisResourceBundle::install()
bool KisResourceBundle::uninstall()
{
m_installed = false;
m_installed = false;
QStringList tags = getTagsList();
tags << m_manifest.tags();
tags << name();
KoResourceServer<KoAbstractGradient>* gradientServer = KoResourceServerProvider::instance()->gradientServer();
//Q_FOREACH (const KisResourceBundleManifest::ResourceReference &ref, m_manifest.files("gradients")) {
......@@ -747,6 +750,7 @@ bool KisResourceBundle::uninstall()
paletteServer->removeResourceFromServer(res);
}
}
KoResourceServer< KisWorkspaceResource >* workspaceServer = KisResourceServerProvider::instance()->workspaceServer();
//Q_FOREACH (const KisResourceBundleManifest::ResourceReference &ref, m_manifest.files("workspaces")) {
Q_FOREACH (const QByteArray md5, m_workspacesMd5Installed) {
......@@ -755,7 +759,6 @@ bool KisResourceBundle::uninstall()
workspaceServer->removeResourceFromServer(res);
}
}
KisPaintOpPresetResourceServer* paintoppresetServer = KisResourceServerProvider::instance()->paintOpPresetServer();
//Q_FOREACH (const KisResourceBundleManifest::ResourceReference &ref, m_manifest.files("paintoppresets")) {
Q_FOREACH (const QByteArray md5, m_presetsMd5Installed) {
......@@ -765,6 +768,16 @@ bool KisResourceBundle::uninstall()
}
}
Q_FOREACH(const QString &tag, tags) {
paintoppresetServer->tagCategoryRemoved(tag);
workspaceServer->tagCategoryRemoved(tag);
paletteServer->tagCategoryRemoved(tag);
brushServer->tagCategoryRemoved(tag);
patternServer->tagCategoryRemoved(tag);
gradientServer->tagCategoryRemoved(tag);
}
return true;
}
......
......@@ -283,7 +283,7 @@ public:
return true;
}
/*Removes a given resource from the blacklist.
*/
bool removeFromBlacklist(PointerType resource) {
......@@ -295,8 +295,8 @@ public:
warnWidgets<<"Doesn't contain filename";
return false;
}
//then return true//
return true;
}
......
......@@ -172,6 +172,7 @@ void DlgBundleManager::accept()
QByteArray ba = item->data(Qt::UserRole).toByteArray();
KisResourceBundle *bundle = bundleServer->resourceByMD5(ba);
if (bundle && bundle->isInstalled()) {
bundle->uninstall();
bundleServer->removeResourceAndBlacklist(bundle);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment