From: sln Date: Thu, 18 Nov 2010 15:07:01 +0000 (+0000) Subject: Custom persistence for PRECOS X-Git-Tag: DIAGRAM_0_1~19 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=692f3f6ea1f124790435577b8ff9d46e1cbb8e2a;p=modules%2Fgui.git Custom persistence for PRECOS --- diff --git a/src/STD/STD_Application.cxx b/src/STD/STD_Application.cxx index d16cca864..b75332057 100755 --- a/src/STD/STD_Application.cxx +++ b/src/STD/STD_Application.cxx @@ -49,7 +49,8 @@ STD_Application::STD_Application() : SUIT_Application(), myActiveViewMgr( 0 ), myExitConfirm( true ), - myEditEnabled( true ) + myEditEnabled( true ), + myCustomPersistence( false ) { setDesktop( new STD_MDIDesktop() ); } @@ -303,6 +304,12 @@ bool STD_Application::onNewDoc( const QString& name ) /*!Put file name from file dialog to onOpenDoc(const QString&) function*/ void STD_Application::onOpenDoc() { + if ( myCustomPersistence ) + { + emit openDoc(); + return; + } + // It is preferrable to use OS-specific file dialog box here !!! QString aName = getFileName( true, QString(), getFileFilter(), QString(), 0 ); if ( aName.isNull() ) @@ -488,6 +495,12 @@ void STD_Application::onSaveDoc() if ( !activeStudy() ) return; + if ( myCustomPersistence ) + { + emit saveDoc(); + return; + } + bool isOk = false; if ( activeStudy()->isSaved() ) { @@ -523,6 +536,12 @@ bool STD_Application::onSaveAsDoc() if ( !study ) return false; + if ( myCustomPersistence ) + { + emit saveAsDoc(); + return true; + } + bool isOk = false; while ( !isOk ) { @@ -927,3 +946,23 @@ void STD_Application::studySaved( SUIT_Study* ) updateDesktopTitle(); updateCommandsStatus(); } + +/*! + Replace standard SALOME persistence mechanism with custom one. If custom + persistence is set SALOME does not perform standard actions on open/save(as) + buttons pressing; it emits corresponding signal instead. + \sa isCustomPersistence +*/ +void STD_Application::setCustomPersistence( const bool theVal ) +{ + myCustomPersistence = theVal; +} + +/*! + Check f lag of custom persistence + \sa setCustomPersistence +*/ +bool STD_Application::isCustomPersistence() const +{ + return myCustomPersistence; +} diff --git a/src/STD/STD_Application.h b/src/STD/STD_Application.h index 7a382226b..f102e5e27 100755 --- a/src/STD/STD_Application.h +++ b/src/STD/STD_Application.h @@ -99,6 +99,9 @@ public: virtual void updateDesktopTitle(); + void setCustomPersistence( const bool ); + bool isCustomPersistence() const; + signals: /*!emit that view manager added*/ void viewManagerAdded( SUIT_ViewManager* ); @@ -107,6 +110,11 @@ signals: /*!emit that view manager activated*/ void viewManagerActivated( SUIT_ViewManager* ); + /*!*/ + void openDoc(); + void saveDoc(); + void saveAsDoc(); + public slots: virtual void onNewDoc(); virtual bool onNewDoc( const QString& ); @@ -168,6 +176,7 @@ private: private: bool myExitConfirm; bool myEditEnabled; + bool myCustomPersistence; }; #if defined WIN32