Commit fee29422 authored by Peter Mühlenpfordt's avatar Peter Mühlenpfordt

Set default path of "Copy/Move/Link To" dialog to current folder

Summary:
D8785 introduced `QStandardPaths::PicturesLocation` as default
location for Copy/Move/Link To dialog.
This patch sets the starting folder to the current folder (where
the source image(s) resist). It also provides an easier handling
of switching off the history option in D11263.

CCBUG: 391527

Test Plan:
* Clear `LastTargetDir` config entry (e.g. remove `~/.config/gwenviewrc`)
* Start Gwenview
* Select one or more images and press {key F7} to copy
* Dialog should start in current folder

Reviewers: #gwenview, rkflx

Reviewed By: #gwenview, rkflx

Differential Revision: https://phabricator.kde.org/D11280
parent d883cdcd
......@@ -96,7 +96,12 @@ static void copyMoveOrLink(Operation operation, const QList<QUrl>& urlList, QWid
dialog->setOption(QFileDialog::ShowDirsOnly, true);
}
dialog->setDirectoryUrl(contextManager->targetDirUrl());
QUrl dirUrl = contextManager->targetDirUrl();
if (!dirUrl.isValid()) {
dirUrl = urlList.constFirst().adjusted(QUrl::RemoveFilename|QUrl::StripTrailingSlash);
}
dialog->setDirectoryUrl(dirUrl);
if (!dialog->exec()) {
return;
}
......
......@@ -310,7 +310,7 @@ QUrl ContextManager::targetDirUrl() const
void ContextManager::setTargetDirUrl(const QUrl &url)
{
GV_RETURN_IF_FAIL(url.isValid());
GV_RETURN_IF_FAIL(url.isEmpty() || url.isValid());
d->mTargetDirUrl = url;
}
......
......@@ -55,9 +55,6 @@
</entry>
<entry name="LastTargetDir" type="Path">
<default code="true">
QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation)).toString()
</default>
</entry>
<entry name="ThumbnailBarOrientation" type="Enum">
......
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