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 8bd2f625 authored by Peter Mühlenpfordt's avatar Peter Mühlenpfordt

Prevent saving Recent Files and LastTargetDir if history is disabled

Summary:
Disabling history in {nav Settings > Configure > Advanced > History}
does not prevent showing and populating {nav File > Open Recent}.
The last target directory for Copy/Move/Link To dialog does not check
for history option too.
This patch only saves/restores file history if the option is enabled
and hides the menu entry if disabled.

BUG: 332853
BUG: 391527

Depends on D11280

Test Plan:
* Enable/disable history option
* Open some images/folders in Gwenview
* Copy/Move/Link To some images
* Check if history is (not) saved/restored according to option value

Reviewers: #gwenview, rkflx

Reviewed By: #gwenview, rkflx

Subscribers: rkflx

Differential Revision: https://phabricator.kde.org/D11263
parent fee29422
......@@ -1119,7 +1119,7 @@ void MainWindow::slotPartCompleted()
{
d->updateActions();
const QUrl url = d->mContextManager->currentUrl();
if (!url.isEmpty()) {
if (!url.isEmpty() && GwenviewConfig::historyEnabled()) {
d->mFileOpenRecentAction->addUrl(url);
d->mGvCore->addUrlToRecentFiles(url);
}
......@@ -1474,10 +1474,16 @@ void MainWindow::loadConfig()
d->mDirModel->setBlackListedExtensions(GwenviewConfig::blackListedExtensions());
d->mDirModel->adjustKindFilter(MimeTypeUtils::KIND_VIDEO, GwenviewConfig::listVideos());
d->mFileOpenRecentAction->loadEntries(KConfigGroup(KSharedConfig::openConfig(), "Recent Files"));
foreach(const QUrl &url, d->mFileOpenRecentAction->urls()) {
d->mGvCore->addUrlToRecentFiles(url);
if (GwenviewConfig::historyEnabled()) {
d->mFileOpenRecentAction->loadEntries(KConfigGroup(KSharedConfig::openConfig(), "Recent Files"));
foreach(const QUrl& url, d->mFileOpenRecentAction->urls()) {
d->mGvCore->addUrlToRecentFiles(url);
}
} else {
d->mFileOpenRecentAction->clear();
}
d->mFileOpenRecentAction->setVisible(GwenviewConfig::historyEnabled());
d->mStartMainPage->loadConfig();
d->mViewMainPage->loadConfig();
d->mBrowseMainPage->loadConfig();
......
......@@ -311,7 +311,8 @@ QUrl ContextManager::targetDirUrl() const
void ContextManager::setTargetDirUrl(const QUrl &url)
{
GV_RETURN_IF_FAIL(url.isEmpty() || url.isValid());
d->mTargetDirUrl = url;
d->mTargetDirUrl = GwenviewConfig::historyEnabled() ? url
: QUrl();
}
void ContextManager::slotRowsInserted()
......
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