DocumentManager: Fix off-by-one error in max number of recent files

Also update the value so we don't introduce a behavior change.

Change-Id: Ie6d474c0d62f041afd84acdd90c1c09d23c57d46
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2019-06-24 15:15:05 +02:00
parent 0db635ac58
commit 1a416840a1

View File

@@ -153,7 +153,7 @@ public:
QSet<QString> m_expectedFileNames; // set of file names without normalization
QList<DocumentManager::RecentFile> m_recentFiles;
static const int m_maxRecentFiles = 7;
static const int m_maxRecentFiles = 8;
bool m_postponeAutoReload = false;
bool m_blockActivated = false;
@@ -1278,7 +1278,7 @@ void DocumentManager::addToRecentFiles(const QString &fileName, Id editorId)
if (fileKey == recentFileKey)
it.remove();
}
if (d->m_recentFiles.count() > d->m_maxRecentFiles)
if (d->m_recentFiles.count() == d->m_maxRecentFiles)
d->m_recentFiles.removeLast();
d->m_recentFiles.prepend(RecentFile(fileName, editorId));
}