Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Kate
Commits
017ead02
Commit
017ead02
authored
Feb 13, 2021
by
Méven Car
Committed by
Christoph Cullmann
Mar 05, 2021
Browse files
Ensure to save stash document in per-session directories
parent
761f1dca
Changes
2
Hide whitespace changes
Inline
Side-by-side
kate/katedocmanager.cpp
View file @
017ead02
...
...
@@ -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
++
;
...
...
kate/katestashmanager.cpp
View file @
017ead02
...
...
@@ -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
());
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment