From 7a8e9957d295bc3f5b3ed082469f66a7c0dc0af3 Mon Sep 17 00:00:00 2001 From: san Date: Tue, 20 Dec 2005 09:57:52 +0000 Subject: [PATCH] STD_Application::closeApplication() implemented --- src/STD/STD_Application.cxx | 27 +++++++++++++++++---------- src/STD/STD_Application.h | 1 + src/SUIT/SUIT_Application.h | 4 +++- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/STD/STD_Application.cxx b/src/STD/STD_Application.cxx index 706ecedb5..3717e8437 100755 --- a/src/STD/STD_Application.cxx +++ b/src/STD/STD_Application.cxx @@ -84,6 +84,23 @@ void STD_Application::start() SUIT_Application::start(); } +/*!Closes the active study (if any)*/ +void STD_Application::closeApplication() +{ + SUIT_Study* study = activeStudy(); + + if ( study ){ + study->closeDocument(); + + setActiveStudy( 0 ); + delete study; + } + + setDesktop( 0 ); + + SUIT_Application::closeApplication(); +} + /*!Event on closing desktop*/ void STD_Application::onDesktopClosing( SUIT_Desktop*, QCloseEvent* e ) { @@ -98,16 +115,6 @@ void STD_Application::onDesktopClosing( SUIT_Desktop*, QCloseEvent* e ) return; } - SUIT_Study* study = activeStudy(); - - if ( study ) - study->closeDocument(); - - setActiveStudy( 0 ); - delete study; - - setDesktop( 0 ); - closeApplication(); } diff --git a/src/STD/STD_Application.h b/src/STD/STD_Application.h index ce925fa5c..58e74353b 100755 --- a/src/STD/STD_Application.h +++ b/src/STD/STD_Application.h @@ -53,6 +53,7 @@ public: virtual QString applicationName() const; virtual bool isPossibleToClose(); + virtual void closeApplication(); virtual bool useFile( const QString& ); virtual void createEmptyStudy(); diff --git a/src/SUIT/SUIT_Application.h b/src/SUIT/SUIT_Application.h index 43f6f29ed..b630177e6 100755 --- a/src/SUIT/SUIT_Application.h +++ b/src/SUIT/SUIT_Application.h @@ -56,10 +56,12 @@ public: //! Returns main widget (Desktop) of the application (if it exists) virtual SUIT_Desktop* desktop(); - /*! Returns FALSE if applic ation can not be closed (because of non saved data for example). + /*! Returns FALSE if application can not be closed (because of non saved data for example). This method called by SUIT_Session whin closing of application was requested. */ virtual bool isPossibleToClose(); + /*! Performs some finalization of life cycle of this application. + For instance, the application can force its documents(s) to close. */ virtual void closeApplication(); //! Returns active Study. If Application supports wirking with several studies this method should be redefined -- 2.39.2