From 0ee82b8845955352aa5bdd0113967b022d6f9bb3 Mon Sep 17 00:00:00 2001 From: apo Date: Wed, 1 Aug 2007 09:31:56 +0000 Subject: [PATCH] To introduce and handle Modified method for SUIT_Study --- src/STD/STD_Application.cxx | 2 ++ src/SUIT/SUIT_Application.cxx | 14 +++++++++++++- src/SUIT/SUIT_Application.h | 3 +++ src/SUIT/SUIT_Study.cxx | 9 +++++++++ src/SUIT/SUIT_Study.h | 1 + 5 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/STD/STD_Application.cxx b/src/STD/STD_Application.cxx index 90690cad7..41f98bcaa 100755 --- a/src/STD/STD_Application.cxx +++ b/src/STD/STD_Application.cxx @@ -577,6 +577,8 @@ void STD_Application::updateDesktopTitle() /*!Update commands status.*/ void STD_Application::updateCommandsStatus() { + SUIT_Application::updateCommandsStatus(); + bool aHasStudy = activeStudy() != 0; bool aIsNeedToSave = false; if ( aHasStudy ) diff --git a/src/SUIT/SUIT_Application.cxx b/src/SUIT/SUIT_Application.cxx index bbe68030d..61b218470 100755 --- a/src/SUIT/SUIT_Application.cxx +++ b/src/SUIT/SUIT_Application.cxx @@ -46,8 +46,8 @@ myStatusLabel( 0 ) */ SUIT_Application::~SUIT_Application() { + setActiveStudy( 0 ); delete myStudy; - myStudy = 0; setDesktop( 0 ); } @@ -204,6 +204,12 @@ void SUIT_Application::onInfoClear() emit infoChanged( QString::null ); } +/*! + Updates status of the registerd actions +*/ +void SUIT_Application::updateCommandsStatus() +{} + /*! Initialize with application arguments \param argc - number of application arguments @@ -263,6 +269,12 @@ void SUIT_Application::setActiveStudy( SUIT_Study* study ) if ( myStudy == study ) return; + if(myStudy) + disconnect(myStudy, SIGNAL( studyModified( SUIT_Study* ) ), this, SLOT( updateCommandsStatus() ) ); + + if(study) + connect(study, SIGNAL( studyModified( SUIT_Study* ) ), this, SLOT( updateCommandsStatus() ) ); + myStudy = study; } diff --git a/src/SUIT/SUIT_Application.h b/src/SUIT/SUIT_Application.h index 0bf48847e..b6d69edca 100755 --- a/src/SUIT/SUIT_Application.h +++ b/src/SUIT/SUIT_Application.h @@ -114,6 +114,9 @@ signals: void activated( SUIT_Application* ); void infoChanged( QString ); +public slots: + virtual void updateCommandsStatus(); + private slots: void onInfoClear(); diff --git a/src/SUIT/SUIT_Study.cxx b/src/SUIT/SUIT_Study.cxx index a3baef3ce..01387d92a 100755 --- a/src/SUIT/SUIT_Study.cxx +++ b/src/SUIT/SUIT_Study.cxx @@ -200,6 +200,15 @@ void SUIT_Study::setIsModified( const bool on ) myIsModified = on; } +/*! + Set study modified to \a on. + */ +void SUIT_Study::Modified() +{ + setIsModified( TRUE ); + sendChangesNotification(); +} + /*! Set root object. */ diff --git a/src/SUIT/SUIT_Study.h b/src/SUIT/SUIT_Study.h index 156c6bc74..c206d4fbb 100755 --- a/src/SUIT/SUIT_Study.h +++ b/src/SUIT/SUIT_Study.h @@ -50,6 +50,7 @@ public: virtual bool isSaved() const; virtual bool isModified() const; + virtual void Modified(); virtual void createDocument(); virtual void closeDocument( bool = true ); -- 2.39.2