Salome HOME
Merge branch 'BR_1328' into BR_DEMO
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ImportImageOp.cxx
index a3d2c72e040aaed1a8d230cd4604687abf75e997..15c73fdecb3b1ce405a5f5bcad2abc2dea9d841c 100644 (file)
@@ -23,7 +23,7 @@
 #include "HYDROGUI_ImportImageDlg.h"
 #include "HYDROGUI_Module.h"
 #include "HYDROGUI_PrsImage.h"
-#include "HYDROGUI_Tool.h"
+#include "HYDROGUI_Tool2.h"
 #include "HYDROGUI_UpdateFlags.h"
 
 #include <HYDROData_Iterator.h>
@@ -350,9 +350,22 @@ bool HYDROGUI_ImportImageOp::processApply( int& theUpdateFlags,
 {
   HYDROGUI_ImportImageDlg* aPanel = (HYDROGUI_ImportImageDlg*)inputPanel();
 
+  if( !myIsEdit )
+  {
+    QString aFilePath = aPanel->getFileName();
+    if( aFilePath.isEmpty() )
+    {
+      theErrorMsg = tr( "SELECT_IMAGE_FILE" ).arg( aFilePath );
+      return false;
+    }
+  }
+
   QString anImageName = aPanel->getImageName();
   if( anImageName.isEmpty() )
+  {
+    theErrorMsg = tr( "SELECT_IMAGE_NAME" ).arg( anImageName );
     return false;
+  }
 
   if( !myIsEdit || ( !myEditedObject.IsNull() && myEditedObject->GetName() != anImageName ) )
   {
@@ -509,14 +522,23 @@ bool HYDROGUI_ImportImageOp::processApply( int& theUpdateFlags,
   if ( isApplyAndClose() )
     theUpdateFlags |= UF_Viewer | UF_GV_Forced | UF_OCCViewer | UF_OCC_Forced;
 
+  if( isApplyAndClose() )
+  {
+    commitDocOperation(); // to save the modifications in the data model
+    return true;
+  }
 
   if( SetNextFile() )
   {
     theErrorMsg = "";
-    commitDocOperation(); // to save the modifications in the data model
+    module()->updateObjBrowser();
     return false;         // and to continue the operation
   }
 
+  /*if( myFiles.count() > 1 )
+  {
+    setIsApplyAndClose( true );
+  }*/
   return true;
 }