Salome HOME
[bos#35161][EDF](2023-T1) Automatic backup - initial commit
[modules/gui.git] / src / SalomeApp / SalomeApp_Study.cxx
index 96aa82adca7e9e15e3693b4113cf6214bfa08c95..6d97460513d09610720625cf81714964b819b9fb 100644 (file)
 #include <SALOMEconfig.h>
 #include CORBA_SERVER_HEADER(SALOME_Exception)
 
+//---------------------------------------------------------
+#define USE_DEBUG
+//#define MB_IGNORE_QT
+//#define MB_FULL_DUMP
+#define MBCLASSNAME "SalomeApp_Study"
+#include "MBDebug.h"
+// <-- insert includes for addtional debug headers here!
+//---------------------------------------------------------
+
 //#define NOTIFY_BY_EVENT
 
 class ObserverEvent : public QEvent
@@ -391,6 +400,7 @@ private:
 SalomeApp_Study::SalomeApp_Study( SUIT_Application* app )
 : LightApp_Study( app ), myObserver( 0 )
 {
+  DBG_FUN();
   myStudyDS = SalomeApp_Application::getStudy();
 }
 
@@ -399,6 +409,7 @@ SalomeApp_Study::SalomeApp_Study( SUIT_Application* app )
 */
 SalomeApp_Study::~SalomeApp_Study()
 {
+  DBG_FUN();
   if ( myObserver ) {
     PortableServer::ObjectId_var oid = myObserver->_default_POA()->servant_to_id( myObserver );
     myObserver->_default_POA()->deactivate_object( oid.in() );
@@ -447,6 +458,8 @@ _PTR(Study) SalomeApp_Study::studyDS() const
 */
 bool SalomeApp_Study::createDocument( const QString& theStr )
 {
+  DBG_FUN();
+  ARG(theStr);
   MESSAGE( "createDocument" );
 
   setStudyName( QString::fromUtf8(myStudyDS->URL().c_str()) );
@@ -477,6 +490,8 @@ bool SalomeApp_Study::createDocument( const QString& theStr )
 */
 bool SalomeApp_Study::openDocument( const QString& theFileName )
 {
+  DBG_FUN();
+  ARG(theFileName);
   MESSAGE( "openDocument" );
 
   // read HDF file
@@ -547,6 +562,8 @@ bool SalomeApp_Study::openDocument( const QString& theFileName )
 */
 bool SalomeApp_Study::loadDocument( const QString& theStudyName )
 {
+  DBG_FUN();
+  ARG(theStudyName);
   MESSAGE( "loadDocument" );
 
   setRoot( new SalomeApp_RootObject( this ) ); // create myRoot
@@ -595,10 +612,14 @@ bool SalomeApp_Study::loadDocument( const QString& theStudyName )
   Saves document
   \param theFileName - name of file
 */
-bool SalomeApp_Study::saveDocumentAs( const QString& theFileName )
+bool SalomeApp_Study::saveDocumentAs( const QString& theFileName, bool isBackup/*=false*/ )
 {
+  DBG_FUN();
+  ARG(theFileName);
+  ARG(isBackup);
+
   bool store = application()->resourceMgr()->booleanValue( "Study", "store_visual_state", false );
-  if ( store )
+  if ( store && !isBackup )
     SalomeApp_VisualState( (SalomeApp_Application*)application() ).storeState();
 
   ModelList list; dataModels( list );
@@ -611,7 +632,7 @@ bool SalomeApp_Study::saveDocumentAs( const QString& theFileName )
     if ( LightApp_DataModel* aModel = 
          dynamic_cast<LightApp_DataModel*>( it.next() ) ) {
       listOfFiles.clear();
-      aModel->saveAs( theFileName, this, listOfFiles );
+      aModel->saveAs( theFileName, this, listOfFiles, isBackup );
       if ( !listOfFiles.isEmpty() )
         saveModuleData(aModel->module()->name(), 0, // 0 means persistence file
                        listOfFiles);
@@ -630,7 +651,7 @@ bool SalomeApp_Study::saveDocumentAs( const QString& theFileName )
 
   res = res && saveStudyData(theFileName, 0); // 0 means persistence file
 
-  if ( res )
+  if ( res && !isBackup)
     emit saved( this );
 
   return res;
@@ -641,6 +662,7 @@ bool SalomeApp_Study::saveDocumentAs( const QString& theFileName )
 */
 bool SalomeApp_Study::saveDocument()
 {
+  DBG_FUN();
   bool store = application()->resourceMgr()->booleanValue( "Study", "store_visual_state", true );
   if ( store )
     SalomeApp_VisualState( (SalomeApp_Application*)application() ).storeState();
@@ -683,6 +705,7 @@ bool SalomeApp_Study::saveDocument()
 */
 void SalomeApp_Study::closeDocument(bool permanently)
 {
+  DBG_FUN();
   LightApp_Study::closeDocument(permanently);
 
   // close SALOMEDS document
@@ -721,6 +744,11 @@ bool SalomeApp_Study::dump( const QString& theFileName,
                             bool isMultiFile,
                             bool toSaveGUI )
 {
+  DBG_FUN();
+  ARG(theFileName);
+  ARG(toPublish);
+  ARG(isMultiFile);
+  ARG(toSaveGUI);
   int savePoint = 0;
   _PTR(AttributeParameter) ap;
   _PTR(IParameters) ip = ClientFactory::getIParameters(ap);