Salome HOME
IPAL9192: string resources added for SPlot2d_SetupPlot2dDlg
[modules/gui.git] / src / SalomeApp / SalomeApp_Study.cxx
index f735c66588d85de553102d942749273fd8f15635..0d6c28ae57b40eb64b0123cb8bd82367336eb81c 100644 (file)
@@ -39,11 +39,13 @@ void SalomeApp_Study::createDocument()
   MESSAGE( "openDocument" );
 
   // initialize myStudyDS, read HDF file
-  _PTR(Study) study ( SalomeApp_Application::studyMgr()->NewStudy( newStudyName().latin1() ) );
+  QString aName = newStudyName();
+  _PTR(Study) study ( SalomeApp_Application::studyMgr()->NewStudy( aName.latin1() ) );
   if ( !study )
     return;
 
   setStudyDS( study );
+  setStudyName( aName );
 
   // create myRoot
   setRoot( new SalomeApp_RootObject( this ) );
@@ -142,14 +144,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;
 }
@@ -188,7 +191,7 @@ void SalomeApp_Study::closeDocument()
 
   // close SALOMEDS document
   _PTR(Study) studyPtr = studyDS();
-  if ( studyPtr.get() )
+  if ( studyPtr )
   {
     SalomeApp_Application::studyMgr()->Close( studyPtr );
     SALOMEDSClient_Study* aStudy = 0;