mirror of
https://github.com/YACReader/yacreader
synced 2025-06-03 17:18:23 -04:00
Add functionality to clear the openrecent list
This commit is contained in:
parent
c850cc5b55
commit
6b19a3093c
@ -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
|
||||
/*
|
||||
|
@ -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<QAction *>(sender());
|
||||
|
@ -106,6 +106,7 @@ class EditShortcutsDialog;
|
||||
QAction *openAction;
|
||||
QAction *openFolderAction;
|
||||
QList<QAction*> 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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user