Commit a2004f7b authored by Julius Künzel's avatar Julius Künzel
Browse files

Fix broken cache deletion

BUG: 434429
parent 3724e5a4
...@@ -442,19 +442,7 @@ void TemporaryData::cleanCache() ...@@ -442,19 +442,7 @@ void TemporaryData::cleanCache()
KMessageBox::Continue) { KMessageBox::Continue) {
return; return;
} }
const QString currentId = m_doc->getDocumentProperty(QStringLiteral("documentid")); deleteCache(folders);
for (const QString &folder : qAsConst(folders)) {
if (folder == currentId) {
// Trying to delete current project's tmp folder. Do not delete, but clear it
deleteCurrentCacheData();
continue;
}
if (!m_globalDir.exists(folder)) {
continue;
}
m_globalDir.remove(folder);
}
updateGlobalInfo();
} }
...@@ -845,6 +833,11 @@ void TemporaryData::deleteSelected() ...@@ -845,6 +833,11 @@ void TemporaryData::deleteSelected()
KMessageBox::Continue) { KMessageBox::Continue) {
return; return;
} }
deleteCache(folders);
}
void TemporaryData::deleteCache(QStringList &folders)
{
const QString currentId = m_doc->getDocumentProperty(QStringLiteral("documentid")); const QString currentId = m_doc->getDocumentProperty(QStringLiteral("documentid"));
for (const QString &folder : qAsConst(folders)) { for (const QString &folder : qAsConst(folders)) {
if (folder == currentId) { if (folder == currentId) {
...@@ -852,7 +845,8 @@ void TemporaryData::deleteSelected() ...@@ -852,7 +845,8 @@ void TemporaryData::deleteSelected()
deleteCurrentCacheData(); deleteCurrentCacheData();
continue; continue;
} }
m_globalDir.remove(folder); QDir toRemove(m_globalDir.filePath(folder));
toRemove.removeRecursively();
} }
updateGlobalInfo(); updateGlobalInfo();
} }
...@@ -867,9 +861,10 @@ void TemporaryData::deleteProxy() ...@@ -867,9 +861,10 @@ void TemporaryData::deleteProxy()
KMessageBox::Continue) { KMessageBox::Continue) {
return; return;
} }
m_globalDir.remove(QStringLiteral("proxy")); QDir toRemove(m_globalDir.filePath(QStringLiteral("proxy")));
toRemove.removeRecursively();
// We deleted proxy folder, recreate it // We deleted proxy folder, recreate it
m_globalDir.mkpath(QStringLiteral(".")); m_globalDir.mkdir(QStringLiteral("proxy"));
processProxyDirectory(); processProxyDirectory();
} }
......
...@@ -153,6 +153,7 @@ private slots: ...@@ -153,6 +153,7 @@ private slots:
void deleteSelected(); void deleteSelected();
void cleanCache(); void cleanCache();
void cleanProxy(); void cleanProxy();
void deleteCache(QStringList &folders);
signals: signals:
void disableProxies(); void disableProxies();
......
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