Salome HOME
Updated copyright comment
[modules/gui.git] / src / CAF / CAF_Study.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 0b60a95..48287d9
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -25,8 +25,6 @@
 #include "CAF_Tools.h"
 #include "CAF_Application.h"
 
-#include <Basics_OCCTVersion.hxx>
-
 #include <SUIT_Desktop.h>
 #include <SUIT_MessageBox.h>
 #include <SUIT_Application.h>
@@ -35,8 +33,7 @@
 
 #include <TDF_Delta.hxx>
 #include <TDF_ListIteratorOfDeltaList.hxx>
-#include <TDocStd_Application.hxx>
-
+#include <TColStd_SequenceOfAsciiString.hxx>
 #include <Standard_Failure.hxx>
 #include <Standard_ErrorHandler.hxx>
 
@@ -109,12 +106,14 @@ bool CAF_Study::createDocument( const QString& doc )
   {
     try {
       OCC_CATCH_SIGNALS;
-      TColStd_SequenceOfExtendedString formats;
-      app->stdApp()->Formats( formats );
+      TColStd_SequenceOfAsciiString formats;
+      app->stdApp()->WritingFormats( formats );
+      if ( formats.IsEmpty() )
+        app->stdApp()->ReadingFormats( formats );
       if ( !formats.IsEmpty() )
         app->stdApp()->NewDocument( formats.First(), myStdDoc );
     }
-    catch ( Standard_Failure ) {
+    catch ( Standard_Failure& ) {
       res = false;
     }
   }
@@ -150,7 +149,7 @@ bool CAF_Study::openDocument( const QString& fname )
     OCC_CATCH_SIGNALS;
     status = app->Open( CAF_Tools::toExtString( fname ), myStdDoc ) == PCDM_RS_OK;
   }
-  catch ( Standard_Failure ) {
+  catch ( Standard_Failure& ) {
     status = false;
   }
 
@@ -170,8 +169,8 @@ bool CAF_Study::saveDocumentAs( const QString& fname )
   bool save = false;
   if ( !stdDoc().IsNull() && stdDoc()->IsSaved() )
   {
-    QString path = QDir::convertSeparators( CAF_Tools::toQString( stdDoc()->GetPath() ) );
-    save = path == QDir::convertSeparators( fname );
+    QString path = QDir::toNativeSeparators( CAF_Tools::toQString( stdDoc()->GetPath() ) );
+    save = path == QDir::toNativeSeparators( fname );
   }
 
   bool status = false;
@@ -190,7 +189,7 @@ bool CAF_Study::saveDocumentAs( const QString& fname )
       status = app->SaveAs( stdDoc(), path ) == PCDM_SS_OK;
     }
   }
-  catch ( Standard_Failure ) {
+  catch ( Standard_Failure& ) {
     status = false;
   }
 
@@ -220,7 +219,7 @@ bool CAF_Study::openTransaction()
 
     myStdDoc->OpenCommand();
   }
-  catch ( Standard_Failure ) {
+  catch ( Standard_Failure& ) {
     res = false;
   }
 
@@ -242,7 +241,7 @@ bool CAF_Study::abortTransaction()
     myStdDoc->AbortCommand();
     update();
   }
-  catch ( Standard_Failure ) {
+  catch ( Standard_Failure& ) {
     res = false;
   }
   return res;
@@ -269,7 +268,7 @@ bool CAF_Study::commitTransaction( const QString& name )
         d->SetName( CAF_Tools::toExtString( name ) );
     }
   }
-  catch ( Standard_Failure ) {
+  catch ( Standard_Failure& ) {
     res = false;
   }
   return res;
@@ -366,7 +365,7 @@ bool CAF_Study::undo()
     myStdDoc->Undo();
     undoModified();     /* decrement modification counter */
   }
-  catch ( Standard_Failure ) {
+  catch ( Standard_Failure& ) {
     SUIT_MessageBox::critical(application()->desktop(), tr( "ERR_ERROR" ),
                               tr( "ERR_DOC_UNDO" ));
     return false;
@@ -388,7 +387,7 @@ bool CAF_Study::redo()
     myStdDoc->Redo();
     doModified();      /* increment modification counter */
   }
-  catch ( Standard_Failure ) {
+  catch ( Standard_Failure& ) {
     SUIT_MessageBox::critical( application()->desktop(), tr( "ERR_ERROR" ),
                                tr( "ERR_DOC_REDO" ) );
     return false;