Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 9056aa94 authored by Peter Mühlenpfordt's avatar Peter Mühlenpfordt Committed by Henrik Fehlauer

Persist path for "Copy/Move/Link To" to config file

Summary:
Additional patch to make the targetUrl persistent again.
Modified storage of dirpath only instead of filepath.
Save temporarily stored path of Copy/Move/Link To file dialogues from ContextManager in rc-file and restore on next start.

CCBUG: 362474

Reviewers: rkflx

Reviewed By: rkflx

Subscribers: ngraham, dhaumann, rkflx

Differential Revision: https://phabricator.kde.org/D8785
parent e683a076
......@@ -94,12 +94,15 @@ static void copyMoveOrLink(Operation operation, const QList<QUrl>& urlList, QWid
dialog.setOption(QFileDialog::ShowDirsOnly, true);
}
dialog.setDirectoryUrl(contextManager->targetUrl().adjusted(QUrl::RemoveFilename));
dialog.setDirectoryUrl(contextManager->targetUrl());
if (!dialog.exec()) {
return;
}
QUrl destUrl = dialog.selectedUrls().first();
if (numberOfImages == 1) {
destUrl = destUrl.adjusted(QUrl::RemoveFilename|QUrl::StripTrailingSlash);
}
contextManager->setTargetUrl(destUrl);
KIO::CopyJob* job = 0;
......
......@@ -1436,6 +1436,7 @@ void MainWindow::loadConfig()
d->mStartMainPage->loadConfig();
d->mViewMainPage->loadConfig();
d->mBrowseMainPage->loadConfig();
d->mContextManager->loadConfig();
d->mShowStatusBarAction->setChecked(GwenviewConfig::statusBarIsVisible());
toggleStatusBar();
......@@ -1447,6 +1448,7 @@ void MainWindow::saveConfig()
GwenviewConfig::setStatusBarIsVisible(d->mShowStatusBarAction->isChecked());
d->mViewMainPage->saveConfig();
d->mBrowseMainPage->saveConfig();
d->mContextManager->saveConfig();
}
void MainWindow::print()
......
......@@ -34,6 +34,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// Local
#include <lib/document/documentfactory.h>
#include <lib/gvdebug.h>
#include <lib/gwenviewconfig.h>
#include <lib/semanticinfo/sorteddirmodel.h>
namespace Gwenview
......@@ -134,6 +135,16 @@ ContextManager::~ContextManager()
delete d;
}
void ContextManager::loadConfig()
{
setTargetUrl(QUrl(GwenviewConfig::lastTargetDir()));
}
void ContextManager::saveConfig() const
{
GwenviewConfig::setLastTargetDir(targetUrl().toString());
}
QItemSelectionModel* ContextManager::selectionModel() const
{
return d->mSelectionModel;
......
......@@ -51,6 +51,9 @@ public:
~ContextManager();
void loadConfig();
void saveConfig() const;
QUrl currentUrl() const;
void setCurrentDirUrl(const QUrl&);
......
......@@ -45,6 +45,12 @@
<default>true</default>
</entry>
<entry name="LastTargetDir" type="Path">
<default code="true">
QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation)).toString()
</default>
</entry>
<entry name="ThumbnailBarOrientation" type="Enum">
<choices name="Qt::Orientation">
<!-- Enum entries do not support enums with arbitrary values.
......
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