mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 03:35:53 +01:00
Do not duplicate the same paths in the "open recent" menu
This commit is contained in:
parent
cedca8725b
commit
9cacf1906e
@ -2026,11 +2026,13 @@ void GUI::updateWindowTitle()
|
||||
#ifndef Q_OS_ANDROID
|
||||
void GUI::updateRecentFiles(const QString &fileName)
|
||||
{
|
||||
QFileInfo fi(fileName);
|
||||
QString canonicalFileName(fi.canonicalFilePath());
|
||||
QAction *a = 0;
|
||||
|
||||
QList<QAction *> actions(_recentFilesActionGroup->actions());
|
||||
for (int i = 0; i < actions.size(); i++) {
|
||||
if (actions.at(i)->text() == fileName) {
|
||||
if (actions.at(i)->text() == canonicalFileName) {
|
||||
a = actions.at(i);
|
||||
break;
|
||||
}
|
||||
@ -2044,7 +2046,7 @@ void GUI::updateRecentFiles(const QString &fileName)
|
||||
actions = _recentFilesActionGroup->actions();
|
||||
QAction *before = actions.size() ? actions.last() : _recentFilesEnd;
|
||||
_recentFilesMenu->insertAction(before,
|
||||
new QAction(fileName, _recentFilesActionGroup));
|
||||
new QAction(canonicalFileName, _recentFilesActionGroup));
|
||||
_recentFilesMenu->setEnabled(true);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user