Salome HOME
Feature #86: The hierarchy in the Object Browser (T 19).
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ExportCalculationOp.cxx
index 65b86410a22cbdc32d6ada80dee8a958e83cd50d..6344eddd19da49c5dd25dd4c461ee7edf77fab56 100644 (file)
@@ -29,6 +29,7 @@
 #include <HYDROData_CalculationCase.h>
 
 #include <GeometryGUI.h>
+#include <GEOMBase.h>
 
 #include <SalomeApp_Study.h>
 
@@ -83,6 +84,7 @@ bool HYDROGUI_ExportCalculationOp::processApply( int& theUpdateFlags,
     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 = 
@@ -124,11 +126,15 @@ bool HYDROGUI_ExportCalculationOp::processApply( int& theUpdateFlags,
       } 
     }
   } else {
-    theErrorMsg = tr( "RESULT_SHAPE_NULL" );
+    anErrorMsg = tr( "RESULT_SHAPE_NULL" );
   }
 
-  if ( !anIsOk && theErrorMsg.isEmpty() ) {
+  if ( !anIsOk ) {
     theErrorMsg = tr( "EXPORT_FAILED" );
+
+    if( !anErrorMsg.isEmpty() ) {
+      theErrorMsg.prepend( anErrorMsg + "\n" );
+    }
   }
 
   return anIsOk;
@@ -170,9 +176,11 @@ void HYDROGUI_ExportCalculationOp::onApply()
   } 
   else {
     abort();
-    QString aMsg = tr( "INPUT_VALID_DATA" );
+    QString aMsg = tr( "EXPORT_FAILED" );
+    /* TODO: improve error processing
     if( !anErrorMsg.isEmpty() )
       aMsg.prepend( anErrorMsg + "\n" );
+    */
     SUIT_MessageBox::critical( module()->getApp()->desktop(),
                                tr( "EXPORT_STATUS" ),
                                aMsg );