Salome HOME
studyActivated() virtual method has been added
[modules/gui.git] / src / SalomeApp / SalomeApp_Study.cxx
index 0ba477280f0f016308cc045ff753a1b85cb8ddbe..aa812a9748269d2397610c8de246c13cad61bbe6 100644 (file)
@@ -120,16 +120,17 @@ bool SalomeApp_Study::loadDocument( const QString& theStudyName )
 
     if ( aComponent->ComponentDataType() == "Interface Applicative" )
       continue; // skip the magic "Interface Applicative" component
-    
+
     SalomeApp_DataModel::BuildTree( aComponent, root(), this );
   }
 
   // TODO: potentially unsafe call, since base study's openDocument() might try to access the file directly - to be improved
+  //bool res = true;
   bool res = CAM_Study::openDocument( theStudyName );
 
-  emit opened( this );
+  //emit opened( this );
 
-  return res;  
+  return res;
 }
 
 //=======================================================================
@@ -144,14 +145,15 @@ bool SalomeApp_Study::saveDocumentAs( const QString& theFileName )
   for ( ; aModel; aModel = (SalomeApp_DataModel*)list.next() )
     aModel->saveAs( theFileName, this );
 
-  bool res = CAM_Study::saveDocumentAs( theFileName );
-
   // save SALOMEDS document
   bool isMultiFile = false, isAscii = false;// TODO: This information should be taken from preferences afterwards!
-  isAscii ? SalomeApp_Application::studyMgr()->SaveAsASCII( theFileName.latin1(), studyDS(), isMultiFile ) :
-            SalomeApp_Application::studyMgr()->SaveAs     ( theFileName.latin1(), studyDS(), isMultiFile );
+   /* bool res = */isAscii ? SalomeApp_Application::studyMgr()->SaveAsASCII( theFileName.latin1(), studyDS(), isMultiFile ) :
+                  SalomeApp_Application::studyMgr()->SaveAs     ( theFileName.latin1(), studyDS(), isMultiFile );
 
-  emit saved( this );
+  bool res = res && CAM_Study::saveDocumentAs( theFileName );
+
+  if ( res )
+    emit saved( this );
 
   return res;
 }