Salome HOME
fix clear data when new study from button new: do not delete document when switching...
authorPaul RASCLE <paul.rascle@edf.fr>
Thu, 14 Nov 2019 10:47:53 +0000 (11:47 +0100)
committerPaul RASCLE <paul.rascle@edf.fr>
Thu, 14 Nov 2019 12:02:23 +0000 (13:02 +0100)
src/HYDROGUI/HYDROGUI_DataModel.cxx
src/HYDROGUI/HYDROGUI_DataModel.h
src/HYDROGUI/HYDROGUI_Module.cxx
src/HYDROGUI/HYDROGUI_Module.h

index 8f3178629fb188c5ff9719fa74500636f5272b0f..fe650d28fb0a754ff14d22e1247faa5dad744561 100644 (file)
@@ -84,7 +84,7 @@ const int ENTRY_COLUMN = 2;
 
 
 HYDROGUI_DataModel::HYDROGUI_DataModel( CAM_Module* theModule )
-: LightApp_DataModel( theModule ), myIsAboutToClose(false)
+: LightApp_DataModel( theModule )
 {
   DEBTRACE("HYDROGUI_DataModel");
   update( module()->application()->activeStudy()->id() );
@@ -219,19 +219,12 @@ bool HYDROGUI_DataModel::saveAs( const QString& theURL,
 bool HYDROGUI_DataModel::close()
 {
   DEBTRACE("close");
-  myIsAboutToClose = true;
   HYDROGUI_Module* aModule = dynamic_cast<HYDROGUI_Module*>( module() );
   if ( aModule )
       aModule->clearCache();
   return true;
 }
 
-bool HYDROGUI_DataModel::isAboutToClose()
-{
-  DEBTRACE("isAboutToClose " << myIsAboutToClose);
-  return myIsAboutToClose;
-}
-
 bool HYDROGUI_DataModel::dumpPython( const QString& theURL,
                                      CAM_Study*     theStudy,
                                      bool           isMultiFile,
index e1a4a7cadb5016b1e8e8899417b64366ff7d6585..2b7d92176c7bd94a8f5b232b6fcd805d6d783f3f 100644 (file)
@@ -86,7 +86,6 @@ public:
    * Close the model and remove data. Reimplemented.
    */
   virtual bool close();
-  virtual bool isAboutToClose();
 
   /**
    * Dump study data to Python script. Reimplemented.
@@ -388,7 +387,6 @@ protected:
 protected:
   QString myStudyURL; ///< the saved/opened document URL
   QByteArray myStates;
-  bool myIsAboutToClose;
 };
 
 #endif 
index dc41e3e12e3c1ca7921d68d7b585000379b19538..5ef49f3d3d410a0c28c429ee076dc6fa15211103 100755 (executable)
 #include <QStatusBar>
 #include <QCursor>
 
-//#define _DEVDEBUG_
+#define _DEVDEBUG_
 #include "HYDRO_trace.hxx"
 
 static int ViewManagerId = 0;
@@ -332,14 +332,15 @@ bool HYDROGUI_Module::deactivateModule( SUIT_Study* theStudy )
   myViewManagerMap.clear();
 
   bool ret = LightApp_Module::deactivateModule( theStudy );
-  HYDROGUI_DataModel* aModel = getDataModel();
-  if (aModel->isAboutToClose())
-  {
+  return ret;
+}
+
+void HYDROGUI_Module::studyClosed(SUIT_Study* theStudy)
+{
+    DEBTRACE("HYDROGUI_Module::studyClosed");
     Handle(HYDROData_Document) aDoc = HYDROData_Document::Document();
     if (!aDoc.IsNull())
       aDoc->Close();
-  }
-  return ret;
 }
 
 void HYDROGUI_Module::windows( QMap<int, int>& theMap ) const
index 116a351dab38b4b56e2dbec65c6f569f81f37128..e39ca9566af4bf1b9c4a44a169273e764e8f8042 100644 (file)
@@ -140,6 +140,7 @@ public:
   virtual void                    updateCommandsStatus();
 
   virtual void                    selectionChanged();
+  virtual void                    studyClosed( SUIT_Study* );
 
   SUIT_ViewManager*               getViewManager( const int theId ) const;
   HYDROGUI_DataModel*             getDataModel() const;