Skip to content

Commit

Permalink
Update recent project menu upon pin/unpin/remove actions
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Nov 16, 2017
1 parent cfb78a1 commit 3fd32b4
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/app/qgisapp.cpp
Expand Up @@ -736,16 +736,19 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
{
mRecentProjects.removeAt( row );
saveRecentProjects();
updateRecentProjectPaths();
} );
connect( mWelcomePage, &QgsWelcomePage::projectPinned, this, [ this ]( int row )
{
mRecentProjects.at( row ).pin = true;
saveRecentProjects();
updateRecentProjectPaths();
} );
connect( mWelcomePage, &QgsWelcomePage::projectUnpinned, this, [ this ]( int row )
{
mRecentProjects.at( row ).pin = false;
saveRecentProjects();
updateRecentProjectPaths();
} );
endProfile();

Expand Down Expand Up @@ -831,7 +834,6 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
functionProfile( &QgisApp::createMapTips, this, QStringLiteral( "Create map tips" ) );
functionProfile( &QgisApp::createDecorations, this, QStringLiteral( "Create decorations" ) );
functionProfile( &QgisApp::readSettings, this, QStringLiteral( "Read settings" ) );
functionProfile( &QgisApp::updateRecentProjectPaths, this, QStringLiteral( "Update recent project paths" ) );
functionProfile( &QgisApp::updateProjectFromTemplates, this, QStringLiteral( "Update project from templates" ) );
functionProfile( &QgisApp::legendLayerSelectionChanged, this, QStringLiteral( "Legend layer selection changed" ) );
functionProfile( &QgisApp::init3D, this, QStringLiteral( "Initialize 3D support" ) );
Expand All @@ -858,6 +860,12 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
connect( projectsTemplateWatcher, &QFileSystemWatcher::directoryChanged, this, [this] { updateProjectFromTemplates(); } );
}

// Update welcome page list
startProfile( QStringLiteral( "Update recent project paths" ) );
updateRecentProjectPaths();
mWelcomePage->setRecentProjects( mRecentProjects );
endProfile();

// initialize the plugin manager
startProfile( QStringLiteral( "Plugin manager" ) );
mPluginManager = new QgsPluginManager( this, restorePlugins );
Expand Down Expand Up @@ -3819,9 +3827,6 @@ void QgisApp::updateRecentProjectPaths()
}
}

if ( mWelcomePage )
mWelcomePage->setRecentProjects( mRecentProjects );

#if defined(Q_OS_WIN)
QWinJumpList jumplist;
jumplist.recent()->clear();
Expand Down Expand Up @@ -3912,6 +3917,10 @@ void QgisApp::saveRecentProjectPath( const QString &projectPath, bool savePrevie
// Update menu list of paths
updateRecentProjectPaths();

// Update welcome page list
if ( mWelcomePage )
mWelcomePage->setRecentProjects( mRecentProjects );

} // QgisApp::saveRecentProjectPath

// Save recent projects list to settings
Expand Down

0 comments on commit 3fd32b4

Please sign in to comment.