From 7e4548707fb159c877d7c15a909fd4d14667ff82 Mon Sep 17 00:00:00 2001 From: stv Date: Fri, 17 Jun 2005 08:40:03 +0000 Subject: [PATCH] Control for the status of the document opening. Function useFile return boolean value. --- src/STD/STD_Application.cxx | 16 ++++++++++++---- src/STD/STD_Application.h | 11 +++++++++-- src/SUIT/SUIT_Application.cxx | 4 ++-- src/SUIT/SUIT_Application.h | 2 +- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/STD/STD_Application.cxx b/src/STD/STD_Application.cxx index 89427f76a..0c5aa4396 100755 --- a/src/STD/STD_Application.cxx +++ b/src/STD/STD_Application.cxx @@ -229,11 +229,17 @@ void STD_Application::onOpenDoc() if ( aName.isNull() ) return; + onOpenDoc( aName ); +} + +bool STD_Application::onOpenDoc( const QString& aName ) +{ + bool res = true; if ( !activeStudy() ) { // if no study - open in current desktop createEmptyStudy(); - activeStudy()->openDocument( aName ); + res = activeStudy()->openDocument( aName ); updateDesktopTitle(); updateCommandsStatus(); } @@ -254,11 +260,12 @@ void STD_Application::onOpenDoc() { aApp = startApplication( 0, 0 ); if ( aApp ) - aApp->useFile( aName ); + res = aApp->useFile( aName ); } else aApp->desktop()->setActiveWindow(); } + return res; } void STD_Application::beforeCloseDoc( SUIT_Study* ) @@ -407,11 +414,12 @@ void STD_Application::setEditEnabled( bool theEnable ) } } -void STD_Application::useFile(const QString& theFileName) +bool STD_Application::useFile(const QString& theFileName) { - SUIT_Application::useFile(theFileName); + bool res = SUIT_Application::useFile(theFileName); updateDesktopTitle(); updateCommandsStatus(); + return res; } void STD_Application::updateDesktopTitle() diff --git a/src/STD/STD_Application.h b/src/STD/STD_Application.h index a8d4a1fe5..3740d4d79 100755 --- a/src/STD/STD_Application.h +++ b/src/STD/STD_Application.h @@ -35,7 +35,7 @@ public: virtual QString applicationName() const; virtual bool isPossibleToClose(); - virtual void useFile( const QString& ); + virtual bool useFile( const QString& ); virtual void createEmptyStudy(); @@ -70,16 +70,23 @@ signals: public slots: virtual void onNewDoc(); - virtual void onOpenDoc(); virtual void onCloseDoc(); virtual void onSaveDoc(); virtual bool onSaveAsDoc(); + + virtual void onOpenDoc(); + virtual bool onOpenDoc( const QString& ); + virtual void onExit(); + virtual void onCut(); virtual void onCopy(); virtual void onPaste(); + virtual void onViewStatusBar( bool ); + virtual void onHelpAbout(); + virtual void onDesktopClosing( SUIT_Desktop*, QCloseEvent* ); virtual void onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ); diff --git a/src/SUIT/SUIT_Application.cxx b/src/SUIT/SUIT_Application.cxx index a107e6b33..b281997cf 100755 --- a/src/SUIT/SUIT_Application.cxx +++ b/src/SUIT/SUIT_Application.cxx @@ -54,11 +54,11 @@ void SUIT_Application::start() desktop()->show(); } -void SUIT_Application::useFile( const QString& theFileName ) +bool SUIT_Application::useFile( const QString& theFileName ) { createEmptyStudy(); if ( activeStudy() ) - activeStudy()->openDocument( theFileName ); + return activeStudy()->openDocument( theFileName ); } void SUIT_Application::createEmptyStudy() diff --git a/src/SUIT/SUIT_Application.h b/src/SUIT/SUIT_Application.h index bd2f6c776..f2fa7f49c 100755 --- a/src/SUIT/SUIT_Application.h +++ b/src/SUIT/SUIT_Application.h @@ -51,7 +51,7 @@ public: virtual void start(); //! Loads document into active Study. If Study is empty - creates it. - virtual void useFile( const QString& ); + virtual bool useFile( const QString& ); //! Creates new empty Study if active Study = 0 virtual void createEmptyStudy(); -- 2.39.2