From: mbs Date: Thu, 21 Dec 2023 12:08:40 +0000 (+0000) Subject: restore study flags after backup X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f6d0283d2e75183f2f8327ba8cf1af799a994161;p=modules%2Fgui.git restore study flags after backup --- diff --git a/src/SalomeApp/SalomeApp_Study.cxx b/src/SalomeApp/SalomeApp_Study.cxx index 6d9746051..ecd50357e 100644 --- a/src/SalomeApp/SalomeApp_Study.cxx +++ b/src/SalomeApp/SalomeApp_Study.cxx @@ -618,6 +618,10 @@ bool SalomeApp_Study::saveDocumentAs( const QString& theFileName, bool isBackup/ ARG(theFileName); ARG(isBackup); + bool wasSaved = isSaved(); + bool wasModified = isModified(); + std::string oldName = (studyDS() ? studyDS()->Name() : ""); + std::string oldURL = (studyDS() ? studyDS()->URL() : ""); bool store = application()->resourceMgr()->booleanValue( "Study", "store_visual_state", false ); if ( store && !isBackup ) SalomeApp_VisualState( (SalomeApp_Application*)application() ).storeState(); @@ -647,13 +651,24 @@ bool SalomeApp_Study::saveDocumentAs( const QString& theFileName, bool isBackup/ bool isMultiFile = resMgr->booleanValue( "Study", "multi_file", false ); bool isAscii = resMgr->booleanValue( "Study", "ascii_file", false ); bool res = studyDS()->SaveAs( theFileName.toUtf8().data(), isMultiFile, isAscii ) - && CAM_Study::saveDocumentAs( theFileName ); + && CAM_Study::saveDocumentAs( theFileName, isBackup ); res = res && saveStudyData(theFileName, 0); // 0 means persistence file if ( res && !isBackup) emit saved( this ); + if (isBackup) { + // Restore the isSaved and isModified flag after having done backup + setIsSaved(wasSaved); + setIsModified(wasModified); + // If the document hasn't been saved before, reset here its name and URL + if (!wasSaved && studyDS()) { + studyDS()->URL(oldURL); + studyDS()->Name(oldName); + } + } + return res; }