Salome HOME
no message
authorstv <stv@opencascade.com>
Tue, 22 Nov 2005 11:46:17 +0000 (11:46 +0000)
committerstv <stv@opencascade.com>
Tue, 22 Nov 2005 11:46:17 +0000 (11:46 +0000)
src/STD/STD_Application.cxx
src/STD/STD_Application.h

index e3ef0126c26cbeb9654f63e4a82ca9812c5bdc83..374bce1fc65a0e8d724b20895fbcf2579e738483 100755 (executable)
@@ -221,15 +221,15 @@ void STD_Application::onNewDoc()
   {
     createEmptyStudy();
     activeStudy()->createDocument();
-    updateDesktopTitle();
-    updateCommandsStatus();
+    studyCreated( activeStudy() );
   }
   else
   {
     SUIT_Application* aApp = startApplication( 0, 0 );
     if ( aApp->inherits( "STD_Application" ) )
       ((STD_Application*)aApp)->onNewDoc();
-    else {
+    else
+    {
       aApp->createEmptyStudy();
       aApp->activeStudy()->createDocument();
     }
@@ -445,7 +445,7 @@ void STD_Application::onSaveDoc()
   }
 
   if ( isOk )
-    updateCommandsStatus();
+    studySaved( activeStudy() );
   else
     onSaveAsDoc();
 }
@@ -478,8 +478,7 @@ bool STD_Application::onSaveAsDoc()
                              tr( "INF_DOC_SAVING_FAILS" ).arg( aName ), tr( "BUT_OK" ) );
   }
 
-  updateDesktopTitle();
-  updateCommandsStatus();
+  studySaved( activeStudy() );
 
   return isOk;
 }
@@ -521,9 +520,11 @@ void STD_Application::setEditEnabled( bool theEnable )
 /*!\retval true, if document opened successful, else false.*/
 bool STD_Application::useFile(const QString& theFileName)
 {
-  bool res = SUIT_Application::useFile(theFileName);
-  updateDesktopTitle();
-  updateCommandsStatus();
+  bool res = SUIT_Application::useFile( theFileName );
+
+  if ( res )
+    studyOpened( activeStudy() );
+
   return res;
 }
 
@@ -809,3 +810,21 @@ void STD_Application::setDesktop( SUIT_Desktop* desk )
     connect( desk, SIGNAL( closing( SUIT_Desktop*, QCloseEvent* ) ),
              this, SLOT( onDesktopClosing( SUIT_Desktop*, QCloseEvent* ) ) );
 }
+
+void STD_Application::studyCreated( SUIT_Study* )
+{
+  updateDesktopTitle();
+  updateCommandsStatus();
+}
+
+void STD_Application::studyOpened( SUIT_Study* )
+{
+  updateDesktopTitle();
+  updateCommandsStatus();
+}
+
+void STD_Application::studySaved( SUIT_Study* )
+{
+  updateDesktopTitle();
+  updateCommandsStatus();
+}
index aa15b247739922a4f6f6177c24581abd17342b60..d5236f790a51fb9a5a56dc18fa9edb2b0aca9c33 100755 (executable)
@@ -111,6 +111,10 @@ protected:
 
   virtual void          setDesktop( SUIT_Desktop* );
 
+  virtual void          studySaved( SUIT_Study* );
+  virtual void          studyOpened( SUIT_Study* );
+  virtual void          studyCreated( SUIT_Study* );
+
   virtual void          beforeCloseDoc( SUIT_Study* theDoc );
   virtual void          afterCloseDoc();