Commit b4c44d39 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Set the default location for restored files to QStandardPaths::PicturesLocation

BUG:415810
parent 61edb745
...@@ -986,13 +986,13 @@ bool KisMainWindow::openDocumentInternal(const QUrl &url, OpenFlags flags) ...@@ -986,13 +986,13 @@ bool KisMainWindow::openDocumentInternal(const QUrl &url, OpenFlags flags)
connect(newdoc, SIGNAL(canceled(QString)), this, SLOT(slotLoadCanceled(QString))); connect(newdoc, SIGNAL(canceled(QString)), this, SLOT(slotLoadCanceled(QString)));
KisDocument::OpenFlags openFlags = KisDocument::None; KisDocument::OpenFlags openFlags = KisDocument::None;
// XXX: Why this duplication of of OpenFlags...
if (flags & RecoveryFile) { if (flags & RecoveryFile) {
openFlags |= KisDocument::RecoveryFile; openFlags |= KisDocument::RecoveryFile;
} }
bool openRet = !(flags & Import) ? newdoc->openUrl(url, openFlags) : newdoc->importDocument(url); bool openRet = !(flags & Import) ? newdoc->openUrl(url, openFlags) : newdoc->importDocument(url);
if (!openRet) { if (!openRet) {
delete newdoc; delete newdoc;
return false; return false;
...@@ -1004,6 +1004,15 @@ bool KisMainWindow::openDocumentInternal(const QUrl &url, OpenFlags flags) ...@@ -1004,6 +1004,15 @@ bool KisMainWindow::openDocumentInternal(const QUrl &url, OpenFlags flags)
if (!QFileInfo(url.toLocalFile()).isWritable()) { if (!QFileInfo(url.toLocalFile()).isWritable()) {
setReadWrite(false); setReadWrite(false);
} }
if (flags & RecoveryFile &&
( url.toLocalFile().startsWith(QDir::tempPath())
|| url.toLocalFile().startsWith(QDir::homePath()))
) {
newdoc->setUrl(QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation) + "/" + QFileInfo(url.toLocalFile()).fileName()));
newdoc->save(false, 0);
}
return true; return true;
} }
......
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