RiuRecentFileActionProvider: Track last used project file via recent file list

Remove lastUsedProjectFileName from RiaPreferences and store it via the
existing recentFileList QSettings key. loadProject and saveProjectAs now
call addToRecentFiles instead of writing to preferences. A new static
method lastUsedProjectFileName() on RiuRecentFileActionProvider returns
the most recent .rsp entry from the list.
This commit is contained in:
Magne Sjaastad committed 2026-03-11 12:46:43 +01:00
1 parent ef7943feaa
commit 5d65057d6f
8 files changed
+24 -13

No files matched your search

@@ -73,6 +73,19 @@ QString RiuRecentFileActionProvider::registryKey()
return "recentFileList";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiuRecentFileActionProvider::lastUsedProjectFileName()
{
const QStringList files = RiaStringListSerializer( registryKey() ).textStrings();
for ( const QString& file : files )
{
if ( file.endsWith( ".rsp", Qt::CaseInsensitive ) ) return file;
}
return {};
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -41,6 +41,8 @@ public:
void addFileName( const QString& fileName );
std::vector<QAction*> actions() const;
static QString lastUsedProjectFileName();
private slots:
void slotOpenRecentFile();