mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 23:20:29 -05:00
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:
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();
|
||||
|
||||
|
||||
Reference in new issue
Block a user