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

Extend action "Clear Recent List" to clear model and recent folders

{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:
parent 48c224d9
......@@ -460,11 +460,15 @@ static void clearModel(QAbstractItemModel* model)
model->removeRows(0, model->rowCount());
void GvCore::clearRecentFilesAndFolders() {
void GvCore::slotConfigChanged()
if (!GwenviewConfig::historyEnabled()) {
......@@ -64,6 +64,7 @@ public:
void addUrlToRecentFolders(QUrl);
void addUrlToRecentFiles(const QUrl &);
void clearRecentFilesAndFolders();
QPalette palette(PaletteType type) const;
QString fullScreenPaletteName() const;
......@@ -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()));
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