diff --git a/YACReader/configuration.h b/YACReader/configuration.h index 57440996..4208c0ff 100644 --- a/YACReader/configuration.h +++ b/YACReader/configuration.h @@ -68,6 +68,7 @@ using namespace YACReader; //openRecent QStringList openRecentList() { return settings->value("recentFiles").toStringList(); } void updateOpenRecentList (QString path); + void clearOpenRecentList() { settings->remove("recentFiles"); } //Old fitmodes /* diff --git a/YACReader/main_window_viewer.cpp b/YACReader/main_window_viewer.cpp index 98181a52..60f10518 100644 --- a/YACReader/main_window_viewer.cpp +++ b/YACReader/main_window_viewer.cpp @@ -227,6 +227,10 @@ void MainWindowViewer::createActions() QObject::connect(recentFileAction, &QAction::triggered, this, &MainWindowViewer::openRecent); recentFilesActionList.append(recentFileAction); } + + clearRecentFilesAction = new QAction(tr("Clear"),this); + clearRecentFilesAction->setToolTip(tr("Clear openrecent list")); + connect(clearRecentFilesAction, &QAction::triggered, this, &MainWindowViewer::clearRecentFiles); saveImageAction = new QAction(tr("Save"),this); saveImageAction->setIcon(QIcon(":/images/viewer_toolbar/save.png")); @@ -514,8 +518,10 @@ void MainWindowViewer::createToolBars() #else QMenu * recentmenu = new QMenu("Open recent"); recentmenu->addActions(recentFilesActionList); + recentmenu->addSeparator(); + recentmenu->addAction(clearRecentFilesAction); refreshRecentFilesActionList(); - + QToolButton * tb = new QToolButton(); tb->addAction(openAction); tb->addAction(openFolderAction); @@ -683,6 +689,13 @@ void MainWindowViewer::refreshRecentFilesActionList() } } +void MainWindowViewer::clearRecentFiles() +{ + qDebug() << "clear triggered"; + Configuration::getConfiguration().clearOpenRecentList(); + refreshRecentFilesActionList(); +} + void MainWindowViewer::openRecent() { QAction *action = qobject_cast(sender()); diff --git a/YACReader/main_window_viewer.h b/YACReader/main_window_viewer.h index afdd8c02..af75ab75 100644 --- a/YACReader/main_window_viewer.h +++ b/YACReader/main_window_viewer.h @@ -106,6 +106,7 @@ class EditShortcutsDialog; QAction *openAction; QAction *openFolderAction; QList recentFilesActionList; + QAction *clearRecentFilesAction; QAction *saveImageAction; QAction *openPreviousComicAction; QAction *openNextComicAction; @@ -148,6 +149,7 @@ class EditShortcutsDialog; void createActions(); void createToolBars(); void refreshRecentFilesActionList(); + void clearRecentFiles(); void getSiblingComics(QString path,QString currentComic); //! Manejadores de evento: