diff --git a/ApplicationCode/UserInterface/RiuMainWindow.cpp b/ApplicationCode/UserInterface/RiuMainWindow.cpp index 323e1acc4a..5e2b857ac4 100644 --- a/ApplicationCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationCode/UserInterface/RiuMainWindow.cpp @@ -957,14 +957,24 @@ void RiuMainWindow::slotOpenRecentFile() if (action) { QString filename = action->data().toString(); + bool loadingSucceded = false; if (filename.contains(".rsp", Qt::CaseInsensitive) || filename.contains(".rip", Qt::CaseInsensitive) ) { - RiaApplication::instance()->loadProject(action->data().toString()); + loadingSucceded = RiaApplication::instance()->loadProject(action->data().toString()); } else if ( filename.contains(".egrid", Qt::CaseInsensitive) || filename.contains(".grid", Qt::CaseInsensitive) ) { - RiaApplication::instance()->openEclipseCaseFromFile(filename); + loadingSucceded = RiaApplication::instance()->openEclipseCaseFromFile(filename); + } + + if (loadingSucceded) + { + addRecentFiles(filename); + } + else + { + removeRecentFiles(filename); } } } @@ -1009,6 +1019,20 @@ void RiuMainWindow::addRecentFiles(const QString& file) } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuMainWindow::removeRecentFiles(const QString& file) +{ + QSettings settings; + QStringList files = settings.value("recentFileList").toStringList(); + files.removeAll(file); + + settings.setValue("recentFileList", files); + + updateRecentFileActions(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/UserInterface/RiuMainWindow.h b/ApplicationCode/UserInterface/RiuMainWindow.h index 54da53911b..0e2aa40bee 100644 --- a/ApplicationCode/UserInterface/RiuMainWindow.h +++ b/ApplicationCode/UserInterface/RiuMainWindow.h @@ -113,6 +113,7 @@ private: void updateRecentFileActions(); void addRecentFiles(const QString& file); + void removeRecentFiles(const QString& file); QMdiSubWindow* findMdiSubWindow(RiuViewer* viewer);