diff --git a/ApplicationCode/Application/RiaApplication.cpp b/ApplicationCode/Application/RiaApplication.cpp index 696a7d10a6..a4ef5a623b 100644 --- a/ApplicationCode/Application/RiaApplication.cpp +++ b/ApplicationCode/Application/RiaApplication.cpp @@ -84,6 +84,7 @@ #include "RimWellRftPlot.h" #include "cafPdmSettings.h" +#include "cafPdmUiModelChangeDetector.h" #include "cafProgressInfo.h" #include "cafUiProcess.h" #include "cafUtils.h" @@ -305,6 +306,16 @@ bool RiaApplication::openFile(const QString& fileName) return loadingSucceded; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RiaApplication::isProjectSavedToDisc() const +{ + if (m_project.isNull()) return false; + + return caf::Utils::fileExists(m_project->fileName()); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -370,7 +381,7 @@ bool RiaApplication::loadProject(const QString& projectFileName, // Create a absolute path file name, as this is required for update of file references in the project modifier object QString fullPathProjectFileName = caf::Utils::absoluteFileName(projectFileName); - if (!caf::Utils::fileExists(fullPathProjectFileName)) + if (!isProjectSavedToDisc()) { RiaLogging::info(QString("File does not exist : '%1'").arg(fullPathProjectFileName)); return false; @@ -677,6 +688,8 @@ void RiaApplication::closeProject() m_commandQueue.clear(); onProjectClosed(); + + caf::PdmUiModelChangeDetector::instance()->reset(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Application/RiaApplication.h b/ApplicationCode/Application/RiaApplication.h index 8ebb5484c1..816c045657 100644 --- a/ApplicationCode/Application/RiaApplication.h +++ b/ApplicationCode/Application/RiaApplication.h @@ -121,6 +121,7 @@ public: bool openFile(const QString& fileName); + bool isProjectSavedToDisc() const; QString currentProjectPath() const; QString createAbsolutePathFromProjectRelativePath(QString projectRelativePath); bool loadProject(const QString& projectFileName); diff --git a/ApplicationCode/Application/RiaGuiApplication.cpp b/ApplicationCode/Application/RiaGuiApplication.cpp index e0c278aad1..f5b6d4740e 100644 --- a/ApplicationCode/Application/RiaGuiApplication.cpp +++ b/ApplicationCode/Application/RiaGuiApplication.cpp @@ -204,7 +204,7 @@ bool RiaGuiApplication::saveProject() { CVF_ASSERT(m_project.notNull()); - if (!caf::Utils::fileExists(m_project->fileName())) + if (!isProjectSavedToDisc()) { return saveProjectPromptForFileName(); } diff --git a/ApplicationCode/Commands/ApplicationCommands/RicEditPreferencesFeature.cpp b/ApplicationCode/Commands/ApplicationCommands/RicEditPreferencesFeature.cpp index 17845b47be..eef944c8d4 100644 --- a/ApplicationCode/Commands/ApplicationCommands/RicEditPreferencesFeature.cpp +++ b/ApplicationCode/Commands/ApplicationCommands/RicEditPreferencesFeature.cpp @@ -24,6 +24,7 @@ #include "RiuPropertyViewTabWidget.h" #include "cafPdmSettings.h" +#include "cafPdmUiModelChangeDetector.h" #include @@ -65,6 +66,13 @@ void RicEditPreferencesFeature::onActionTriggered(bool isChecked) caf::PdmSettings::readFieldsFromApplicationStore(app->preferences()); app->preferences()->initAfterReadRecursively(); } + + if (!app->isProjectSavedToDisc()) + { + // Always reset change detector when modifying preferences, as these changes are irrelevant + // when the project we work on is not saved to disc + caf::PdmUiModelChangeDetector::instance()->reset(); + } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Commands/SsiHubImportCommands/RicWellPathsImportSsihubFeature.cpp b/ApplicationCode/Commands/SsiHubImportCommands/RicWellPathsImportSsihubFeature.cpp index 0b9d0e3514..a035e6b25e 100644 --- a/ApplicationCode/Commands/SsiHubImportCommands/RicWellPathsImportSsihubFeature.cpp +++ b/ApplicationCode/Commands/SsiHubImportCommands/RicWellPathsImportSsihubFeature.cpp @@ -27,8 +27,6 @@ #include "RiuMainWindow.h" #include "RiuWellImportWizard.h" -#include "cafUtils.h" - #include #include #include @@ -52,7 +50,7 @@ void RicWellPathsImportSsihubFeature::onActionTriggered(bool isChecked) RiaApplication* app = RiaApplication::instance(); if (!app->project()) return; - if (!caf::Utils::fileExists(app->project()->fileName())) + if (!app->isProjectSavedToDisc()) { RiaGuiApplication* guiApp = RiaGuiApplication::instance(); if (guiApp) @@ -74,7 +72,7 @@ void RicWellPathsImportSsihubFeature::onActionTriggered(bool isChecked) } } - if (!caf::Utils::fileExists(app->project()->fileName())) + if (!app->isProjectSavedToDisc()) { return; }