Commit 017ead02 authored by Méven Car's avatar Méven Car Committed by Christoph Cullmann
Browse files

Ensure to save stash document in per-session directories

parent 761f1dca
......@@ -414,6 +414,15 @@ void KateDocManager::saveDocumentList(KConfig *config)
openDocGroup.writeEntry("Count", m_docList.count());
// prepare stash directory
const QString appDataPath = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
const QString sessionName = KateApp::self()->sessionManager()->activeSession()->name();
QDir dir(appDataPath);
dir.mkdir(QStringLiteral("stash"));
dir.cd(QStringLiteral("stash"));
dir.mkdir(sessionName);
dir.cd(sessionName);
int i = 0;
for (KTextEditor::Document *doc : qAsConst(m_docList)) {
const QString entryName = QStringLiteral("Document %1").arg(i);
......@@ -422,11 +431,7 @@ void KateDocManager::saveDocumentList(KConfig *config)
// stash the file content
if (doc->isModified()) {
const QString appDataPath = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
QDir dir(appDataPath);
dir.mkdir(QStringLiteral("stash"));
KateApp::self()->stashManager()->stashDocument(doc, entryName, cg, appDataPath + QStringLiteral("/stash/"));
KateApp::self()->stashManager()->stashDocument(doc, entryName, cg, dir.path());
}
i++;
......
......@@ -90,6 +90,7 @@ bool KateStashManager::stashDocument(KTextEditor::Document *doc, const QString &
// write stash metadata to config
kconfig.writeEntry("stashedFile", stashedFile);
if (doc->url().isValid()) {
// save checksum for already-saved documents
kconfig.writeEntry("checksum", doc->checksum());
}
......
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