31 identifier_(identifier.isEmpty() ?
"unnamed" : identifier),
32 size_(size > 0 ? size : 10),
35 mapper_ =
new QSignalMapper(
this);
124 for (
int i =
size_ ; i >= 1 ; -- i)
126 QString key(
identifier_ +
"-recentfiles/file" + QString::number(i));
127 QString value(settings.value(key, QString()).toString());
137 QString filepath_ns = QDir::toNativeSeparators(filepath);
140 if (filepath_ns.isEmpty())
return;
141 list_.removeAll(filepath_ns);
144 list_.push_front(filepath_ns);
157 for (
int i = 0 ; i <
size_ && i <
list_.count() ; ++ i)
159 QString key(
identifier_ +
"-recentfiles/file" + QString::number(i + 1));
160 settings.setValue(key,
list_[i]);
176 foreach (QString filepath,
list_) {
178 QAction *action =
new QAction(filepath,
this);
182 menu_ -> addAction(action);
185 mapper_ -> setMapping(action, filepath);
186 connect(action, SIGNAL(triggered()),
mapper_, SLOT(map()));
void fileWasOpened(const QString &)
void handleMenuRequest(const QString &)
QIcon iconForFiles() const
void fileOpeningRequested(const QString &)
void saveFilesToSettings()
RecentFiles::saveFilesToSettings Write the list of recent files to settings.
void insertFile(const QString &)
RecentFiles(const QString &, int=10, QObject *=nullptr)
void extractFilesFromSettings()
RecentFiles::extractFilesFromSettings Read the list of recent file from settings. ...
void setIconForFiles(const QIcon &)