Salome HOME
isStudyLocked method fixed. isReadyToStart is constant now
authorsln <sln@opencascade.com>
Thu, 14 Jul 2005 09:55:08 +0000 (09:55 +0000)
committersln <sln@opencascade.com>
Thu, 14 Jul 2005 09:55:08 +0000 (09:55 +0000)
src/SMESHGUI/SMESHGUI_Operation.cxx
src/SMESHGUI/SMESHGUI_Operation.h

index 14c925ae03c769abb5e09b87319b86eddc8f645d..d97485553e3adde1ed3c2ebd6f5046917023f6b8 100755 (executable)
@@ -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;
+}
+
index 89ec3f6b7580be00b53acb87eb25c7e970e4c7a2..caa435d8b92c58d8ec3ab90d9154dcb54a984b2d 100755 (executable)
@@ -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;