Salome HOME
Merge from OCC_development_generic_2006
[modules/gui.git] / src / SalomeApp / SalomeApp_Study.cxx
index 3073e544e1dd3e89374fec534e0f627a3b73fa4a..f3de086605ec8967f99fd10910cd16004f4c8833 100644 (file)
@@ -195,12 +195,13 @@ bool SalomeApp_Study::saveDocumentAs( const QString& theFileName )
     return false;
 
   bool isMultiFile = resMgr->booleanValue( "Study", "multi_file", false ),
-       isAscii = resMgr->booleanValue( "Study", "ascii_file", false );
-  isAscii ? SalomeApp_Application::studyMgr()->SaveAsASCII( theFileName.latin1(), studyDS(), isMultiFile ) :
-            SalomeApp_Application::studyMgr()->SaveAs     ( theFileName.latin1(), studyDS(), isMultiFile );
+       isAscii = resMgr->booleanValue( "Study", "ascii_file", false ),
+       res = isAscii ? 
+        SalomeApp_Application::studyMgr()->SaveAsASCII( theFileName.latin1(), studyDS(), isMultiFile ) :
+        SalomeApp_Application::studyMgr()->SaveAs     ( theFileName.latin1(), studyDS(), isMultiFile ) &&
+    CAM_Study::saveDocumentAs( theFileName ) &&  //SRN: BugID IPAL9377, removed usage of uninitialized variable <res>
+    saveStudyData(theFileName);
 
-  bool res = CAM_Study::saveDocumentAs( theFileName );  //SRN: BugID IPAL9377, removed usage of uninitialized variable <res>
-  res = res && saveStudyData(theFileName);
   if ( res )
     emit saved( this );
 
@@ -230,11 +231,10 @@ bool SalomeApp_Study::saveDocument()
     return false;
 
   bool isMultiFile = resMgr->booleanValue( "Study", "multi_file", false ),
-       isAscii = resMgr->booleanValue( "Study", "ascii_file", false );
-  isAscii ? SalomeApp_Application::studyMgr()->SaveASCII( studyDS(), isMultiFile ) :
-            SalomeApp_Application::studyMgr()->Save     ( studyDS(), isMultiFile );
-
-  bool res = CAM_Study::saveDocument();
+       isAscii = resMgr->booleanValue( "Study", "ascii_file", false ),
+       res = isAscii ? 
+        SalomeApp_Application::studyMgr()->SaveASCII( studyDS(), isMultiFile ) :
+         SalomeApp_Application::studyMgr()->Save     ( studyDS(), isMultiFile ) && CAM_Study::saveDocument();
 
   res = res && saveStudyData(studyName());
   if ( res )
@@ -396,7 +396,8 @@ void SalomeApp_Study::addComponent(const CAM_DataModel* dm)
       }
       // Set default engine IOR
       aBuilder->DefineComponentInstance(aComp, SalomeApp_Application::defaultEngineIOR().latin1());
-      SalomeApp_DataModel::BuildTree( aComp, root(), this, /*skipExisitng=*/true );
+      //SalomeApp_DataModel::BuildTree( aComp, root(), this, /*skipExisitng=*/true );
+      SalomeApp_DataModel::synchronize( aComp, this );
     }
   }
 }