summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Mühlenpfordt <[email protected]>2018-03-16 09:42:20 +0100
committerPeter Mühlenpfordt <[email protected]>2018-03-20 09:53:08 +0100
commitd2afcfe25460ac9afa67dd1cfd3fc82d592878da (patch)
treed4c57233dafa4e024764171f302365543c83b05a
parent48c224d9e9e2f91778d13d591b0cae72426ec132 (diff)
Extend action "Clear Recent List" to clear model and recent folders
Summary: {nav File > Open Recent > Clear List} clears the displayed list of recent files, but the same list in the {nav Start Page > Recent Files} tab is not cleared (only after restarting Gwenview). This patch extends and renames the menu entry to clear the internal models and both tabs {nav Start Page > Recent Files / Folders}. Ref T8194 FIXED-IN: 18.04.0 Test Plan: * Open some images to populate the recent files/folders lists * Click {nav File > Open Recent > Forget All Files & Folders} * Check if {nav File > Open Recent} is empty * Check if {nav Start Page > Recent Files / Folders} are empty Reviewers: #gwenview, rkflx Reviewed By: #gwenview, rkflx Subscribers: rkflx Maniphest Tasks: T8194 Differential Revision: https://phabricator.kde.org/D11477
-rw-r--r--app/gvcore.cpp8
-rw-r--r--app/gvcore.h1
-rw-r--r--app/mainwindow.cpp6
3 files changed, 13 insertions, 2 deletions
diff --git a/app/gvcore.cpp b/app/gvcore.cpp
index 91a9cba..5c7becc 100644
--- a/app/gvcore.cpp
+++ b/app/gvcore.cpp
@@ -460,11 +460,15 @@ static void clearModel(QAbstractItemModel* model)
model->removeRows(0, model->rowCount());
}
+void GvCore::clearRecentFilesAndFolders() {
+ clearModel(recentFilesModel());
+ clearModel(recentFoldersModel());
+}
+
void GvCore::slotConfigChanged()
{
if (!GwenviewConfig::historyEnabled()) {
- clearModel(recentFoldersModel());
- clearModel(recentFilesModel());
+ clearRecentFilesAndFolders();
}
d->setupPalettes();
}
diff --git a/app/gvcore.h b/app/gvcore.h
index 39948c5..ea28b6a 100644
--- a/app/gvcore.h
+++ b/app/gvcore.h
@@ -64,6 +64,7 @@ public:
void addUrlToRecentFolders(QUrl);
void addUrlToRecentFiles(const QUrl &);
+ void clearRecentFilesAndFolders();
QPalette palette(PaletteType type) const;
QString fullScreenPaletteName() const;
diff --git a/app/mainwindow.cpp b/app/mainwindow.cpp
index 8eddade..7a57854 100644
--- a/app/mainwindow.cpp
+++ b/app/mainwindow.cpp
@@ -360,6 +360,12 @@ struct MainWindow::Private
file->addAction(KStandardAction::SaveAs, q, SLOT(saveCurrentAs()));
file->addAction(KStandardAction::Open, q, SLOT(openFile()));
mFileOpenRecentAction = KStandardAction::openRecent(q, SLOT(openUrl(QUrl)), q);
+ connect(mFileOpenRecentAction, &KRecentFilesAction::recentListCleared,
+ mGvCore, &GvCore::clearRecentFilesAndFolders);
+ QAction* clearAction = mFileOpenRecentAction->menu()->findChild<QAction*>("clear_action");
+ if (clearAction) {
+ clearAction->setText(i18nc("@action Open Recent menu", "Forget All Files && Folders"));
+ }
file->addAction("file_open_recent", mFileOpenRecentAction);
file->addAction(KStandardAction::Print, q, SLOT(print()));
file->addAction(KStandardAction::Quit, qApp, SLOT(closeAllWindows()));