From 6888952fec96f05b67bc1367efedf8022179898a Mon Sep 17 00:00:00 2001 From: Oskar Wallgren Date: Mon, 6 Jul 2015 15:31:06 +0200 Subject: [PATCH] recent files hide missing --- src/core/ConfigManager.cpp | 2 +- src/gui/MainWindow.cpp | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/core/ConfigManager.cpp b/src/core/ConfigManager.cpp index 5cc2710ec..3024a0646 100644 --- a/src/core/ConfigManager.cpp +++ b/src/core/ConfigManager.cpp @@ -197,7 +197,7 @@ void ConfigManager::addRecentlyOpenedProject( const QString & _file ) if( !_file.endsWith( ".mpt", Qt::CaseInsensitive ) ) { m_recentlyOpenedProjects.removeAll( _file ); - if( m_recentlyOpenedProjects.size() > 15 ) + if( m_recentlyOpenedProjects.size() > 30 ) { m_recentlyOpenedProjects.removeLast(); } diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 1722cdffd..2dbdcb663 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -830,10 +830,23 @@ void MainWindow::updateRecentlyOpenedProjectsMenu() { m_recentlyOpenedProjectsMenu->clear(); QStringList rup = ConfigManager::inst()->recentlyOpenedProjects(); + +// The file history goes 30 deep but we only show the 15 +// most recent ones that we can open. + int shownInMenu = 0; for( QStringList::iterator it = rup.begin(); it != rup.end(); ++it ) { - m_recentlyOpenedProjectsMenu->addAction( - embed::getIconPixmap( "project_file" ), *it ); + QFileInfo recentFile( *it ); + if ( recentFile.exists() ) + { + m_recentlyOpenedProjectsMenu->addAction( + embed::getIconPixmap( "project_file" ), *it ); + shownInMenu++; + if( shownInMenu >= 15 ) + { + return; + } + } } }