@@ -1154,22 +1154,28 @@ void QgisApp::readSettings()
1154
1154
// Read legacy settings
1155
1155
mRecentProjects .clear ();
1156
1156
1157
- QStringList oldRecentProjects = settings.value ( " /UI/recentProjectsList" ).toStringList ();
1158
- settings.remove ( " /UI/recentProjectsList" );
1157
+ settings.beginGroup ( " /UI" );
1159
1158
1160
- Q_FOREACH ( const QString& project, oldRecentProjects )
1159
+ // Migrate old recent projects if first time with new system
1160
+ if ( !settings.childGroups ().contains ( " recentProjects" ) )
1161
1161
{
1162
- QgsWelcomePageItemsModel::RecentProjectData data;
1163
- data.path = project;
1164
- data.title = project;
1162
+ QStringList oldRecentProjects = settings.value ( " /UI/recentProjectsList" ).toStringList ();
1165
1163
1166
- mRecentProjects .append ( data );
1164
+ Q_FOREACH ( const QString& project, oldRecentProjects )
1165
+ {
1166
+ QgsWelcomePageItemsModel::RecentProjectData data;
1167
+ data.path = project;
1168
+ data.title = project;
1169
+
1170
+ mRecentProjects .append ( data );
1171
+ }
1167
1172
}
1173
+ settings.endGroup ();
1168
1174
1169
1175
settings.beginGroup ( " /UI/recentProjects" );
1170
1176
QStringList projectKeys = settings.childGroups ();
1171
1177
1172
- Q_FOREACH ( const QString& key, projectKeys )
1178
+ Q_FOREACH ( const QString& key, projectKeys )
1173
1179
{
1174
1180
QgsWelcomePageItemsModel::RecentProjectData data;
1175
1181
settings.beginGroup ( key );
@@ -2747,7 +2753,7 @@ void QgisApp::updateRecentProjectPaths()
2747
2753
{
2748
2754
mRecentProjectsMenu ->clear ();
2749
2755
2750
- Q_FOREACH ( const QgsWelcomePageItemsModel::RecentProjectData& recentProject, mRecentProjects )
2756
+ Q_FOREACH ( const QgsWelcomePageItemsModel::RecentProjectData& recentProject, mRecentProjects )
2751
2757
{
2752
2758
QAction* action = mRecentProjectsMenu ->addAction ( QString ( " %1 (%2)" ).arg ( recentProject.title ).arg ( recentProject.path ) );
2753
2759
action->setEnabled ( QFile::exists (( recentProject.path ) ) );
@@ -2816,7 +2822,7 @@ void QgisApp::saveRecentProjectPath( QString projectPath, bool savePreviewImage
2816
2822
int idx = 0 ;
2817
2823
2818
2824
// Persist the list
2819
- Q_FOREACH ( const QgsWelcomePageItemsModel::RecentProjectData& recentProject, mRecentProjects )
2825
+ Q_FOREACH ( const QgsWelcomePageItemsModel::RecentProjectData& recentProject, mRecentProjects )
2820
2826
{
2821
2827
++idx;
2822
2828
settings.beginGroup ( QString ( " /UI/recentProjects/%1" ).arg ( idx ) );
0 commit comments