Salome HOME
Fix for the bug #45: check and warning when the same image is used in 2 arguments.
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ExportCalculationOp.cxx
index 65b86410a22cbdc32d6ada80dee8a958e83cd50d..77722af36d2ebeeeec1da79c503b4e80235b2e6e 100644 (file)
@@ -29,6 +29,7 @@
 #include <HYDROData_CalculationCase.h>
 
 #include <GeometryGUI.h>
+#include <GEOMBase.h>
 
 #include <SalomeApp_Study.h>
 
@@ -79,10 +80,11 @@ bool HYDROGUI_ExportCalculationOp::processApply( int& theUpdateFlags,
       HYDROGUI_Tool::GetSelectedObject( module() ) );
 
   if ( aCalculation.IsNull() ) {
-    theErrorMsg = tr( "EXPORT_FAILED" );
+    theErrorMsg = tr( "NULL_DATA_OBJECT" );
     return false;
   }
 
+  QString anErrorMsg;
   bool anIsOk = false;
 
   TopoDS_Shell aShell = aCalculation->GetShell();
@@ -112,7 +114,7 @@ bool HYDROGUI_ExportCalculationOp::processApply( int& theUpdateFlags,
 
     // Puplish the GEOM object
     if ( !aGeomObj->_is_nil() ) {
-      QString aName = tr( "OBJ_PREFIX" ) + aCalculation->GetName();
+      QString aName = GEOMBase::GetDefaultName( tr( "OBJ_PREFIX" ) + aCalculation->GetName() );
 
       SALOMEDS::Study_var aDSStudy = GeometryGUI::ClientStudyToStudy( aStudy->studyDS() );
       SALOMEDS::SObject_var aResultSO = 
@@ -123,14 +125,14 @@ bool HYDROGUI_ExportCalculationOp::processApply( int& theUpdateFlags,
         anIsOk = true;
       } 
     }
+
+    if ( !anIsOk )
+      theErrorMsg = tr( "IMPOSSIBLE_TO_CREATE_GEOM_SHAPE" );
+
   } else {
     theErrorMsg = tr( "RESULT_SHAPE_NULL" );
   }
 
-  if ( !anIsOk && theErrorMsg.isEmpty() ) {
-    theErrorMsg = tr( "EXPORT_FAILED" );
-  }
-
   return anIsOk;
 }
 
@@ -170,11 +172,14 @@ void HYDROGUI_ExportCalculationOp::onApply()
   } 
   else {
     abort();
-    QString aMsg = tr( "INPUT_VALID_DATA" );
-    if( !anErrorMsg.isEmpty() )
-      aMsg.prepend( anErrorMsg + "\n" );
+
+    if ( anErrorMsg.isEmpty() )
+      anErrorMsg = tr( "EXPORT_DATA_FAILED" );
+
+    anErrorMsg.prepend( tr( "EXPORT_FAILED" ) + "\n" );
+
     SUIT_MessageBox::critical( module()->getApp()->desktop(),
                                tr( "EXPORT_STATUS" ),
-                               aMsg ); 
+                               anErrorMsg ); 
   }
 }
\ No newline at end of file