GUI: Remove empty/space-only items from MRU list.
This commit is contained in:
parent
fdb6ee2ad7
commit
56212aa9ca
|
@ -1014,6 +1014,20 @@ void MainWindow::UpdateMRUMenuItems()
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList projects = mSettings->value(SETTINGS_MRU_PROJECTS).toStringList();
|
QStringList projects = mSettings->value(SETTINGS_MRU_PROJECTS).toStringList();
|
||||||
|
|
||||||
|
// Do a sanity check - remove duplicates and empty or space only items
|
||||||
|
int removed = projects.removeDuplicates();
|
||||||
|
for (int i = projects.size() - 1; i >= 0; i--) {
|
||||||
|
QString text = projects[i].trimmed();
|
||||||
|
if (text.isEmpty()) {
|
||||||
|
projects.removeAt(i);
|
||||||
|
removed++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (removed)
|
||||||
|
mSettings->setValue(SETTINGS_MRU_PROJECTS, projects);
|
||||||
|
|
||||||
const int numRecentProjects = qMin(projects.size(), (int)MaxRecentProjects);
|
const int numRecentProjects = qMin(projects.size(), (int)MaxRecentProjects);
|
||||||
for (int i = 0; i < numRecentProjects; i++) {
|
for (int i = 0; i < numRecentProjects; i++) {
|
||||||
const QString filename = QFileInfo(projects[i]).fileName();
|
const QString filename = QFileInfo(projects[i]).fileName();
|
||||||
|
|
Loading…
Reference in New Issue