From: sln Date: Thu, 14 Jul 2005 09:55:08 +0000 (+0000) Subject: isStudyLocked method fixed. isReadyToStart is constant now X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=27542bbe52c820d5d151ae0a3b2a5b164885b6b1;p=modules%2Fsmesh.git isStudyLocked method fixed. isReadyToStart is constant now --- diff --git a/src/SMESHGUI/SMESHGUI_Operation.cxx b/src/SMESHGUI/SMESHGUI_Operation.cxx index 14c925ae0..d97485553 100755 --- a/src/SMESHGUI/SMESHGUI_Operation.cxx +++ b/src/SMESHGUI/SMESHGUI_Operation.cxx @@ -83,18 +83,17 @@ void SMESHGUI_Operation::startOperation() // name : isReadyToStart // Purpose : Verify whether operation is ready to start //======================================================================= -bool SMESHGUI_Operation::isReadyToStart() +bool SMESHGUI_Operation::isReadyToStart() const { if ( !SalomeApp_Operation::isReadyToStart() ) return false; - - if ( getSMESHGUI() == 0 ) + else if ( getSMESHGUI() == 0 ) { SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ), tr( "NO_MODULE" ), tr( "SMESH_BUT_OK" ) ); return false; } - + return true; } @@ -159,3 +158,28 @@ void SMESHGUI_Operation::onCancel() void SMESHGUI_Operation::initDialog() { } + +/*! + * \brief Verifies whether study of operation is locked + * \param theMess - specifies whether message box must be shown if study is locked + * \return State of study. +* +* Verifies whether study of operation is locked. If second parameter is TRUE and study +* is locked when corresponding message box appears +*/ +bool SMESHGUI_Operation::isStudyLocked( const bool theMess ) const +{ + if ( studyDS() ) + { + if ( studyDS()->GetProperties()->IsLocked() ) + { + if ( theMess ) + SUIT_MessageBox::warn1 ( SMESHGUI::desktop(), QObject::tr( "WRN_WARNING" ), + QObject::tr( "WRN_STUDY_LOCKED" ), QObject::tr( "BUT_OK" ) ); + return true; + } + } + + return false; +} + diff --git a/src/SMESHGUI/SMESHGUI_Operation.h b/src/SMESHGUI/SMESHGUI_Operation.h index 89ec3f6b7..caa435d8b 100755 --- a/src/SMESHGUI/SMESHGUI_Operation.h +++ b/src/SMESHGUI/SMESHGUI_Operation.h @@ -35,12 +35,13 @@ protected: virtual void initDialog(); virtual void startOperation(); - virtual bool isReadyToStart(); + virtual bool isReadyToStart() const; //! Set according dialog active or inactive virtual void setDialogActive( const bool ); SMESHGUI* getSMESHGUI() const; + bool isStudyLocked( const bool = true ) const; _PTR(Study) studyDS() const;