From b7865aea95475f41ba3fdc58ad1a98314a048e43 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 14 Jun 2019 10:45:24 +0200 Subject: [PATCH] #2023 SSI-hub: Create ResInsight project at well path download --- .../RicWellPathsImportSsihubFeature.cpp | 39 +++++++++++++------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/ApplicationCode/Commands/WellPathCommands/RicWellPathsImportSsihubFeature.cpp b/ApplicationCode/Commands/WellPathCommands/RicWellPathsImportSsihubFeature.cpp index aa11da2c5d..f407acd445 100644 --- a/ApplicationCode/Commands/WellPathCommands/RicWellPathsImportSsihubFeature.cpp +++ b/ApplicationCode/Commands/WellPathCommands/RicWellPathsImportSsihubFeature.cpp @@ -32,6 +32,7 @@ #include #include #include +#include CAF_CMD_SOURCE_INIT(RicWellPathsImportSsihubFeature, "RicWellPathsImportSsihubFeature"); @@ -41,17 +42,6 @@ CAF_CMD_SOURCE_INIT(RicWellPathsImportSsihubFeature, "RicWellPathsImportSsihubFe //-------------------------------------------------------------------------------------------------- bool RicWellPathsImportSsihubFeature::isCommandEnabled() { - RiaApplication* app = RiaApplication::instance(); - if (!app->project()) - { - return false; - } - - if (!caf::Utils::fileExists(app->project()->fileName())) - { - return false; - } - return true; } @@ -63,8 +53,33 @@ void RicWellPathsImportSsihubFeature::onActionTriggered(bool isChecked) RiaApplication* app = RiaApplication::instance(); if (!app->project()) return; - if (!caf::Utils::fileExists(app->project()->fileName())) return; + if (!caf::Utils::fileExists(app->project()->fileName())) + { + RiaGuiApplication* guiApp = RiaGuiApplication::instance(); + if (guiApp) + { + QMessageBox msgBox(guiApp->mainWindow()); + msgBox.setIcon(QMessageBox::Question); + QString questionText = QString("Import of well paths will be stored as a part of a ResInsight project file. Please " + "save the project to file before importing well paths."); + + msgBox.setText(questionText); + msgBox.setInformativeText("Do you want to save the project?"); + msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); + + int ret = msgBox.exec(); + if (ret == QMessageBox::Yes) + { + guiApp->saveProject(); + } + } + + if (!caf::Utils::fileExists(app->project()->fileName())) + { + return; + } + } // Update the UTM bounding box from the reservoir app->project()->computeUtmAreaOfInterest();