]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
the new virtual function to allow the module to abort the active operations on load... asl/abort_operations
authorasl <asl@opencascade.com>
Tue, 1 Sep 2015 06:37:00 +0000 (09:37 +0300)
committerasl <asl@opencascade.com>
Tue, 1 Sep 2015 06:37:00 +0000 (09:37 +0300)
src/CAM/CAM_Application.cxx
src/CAM/CAM_Application.h
src/CAM/CAM_Module.cxx
src/CAM/CAM_Module.h
src/STD/STD_Application.cxx
src/STD/STD_Application.h

index e45d4a8cdf24950d56b0d38690062d21b45dd272..1f4754b3265aa01cb8a2d9efc84250806db019e1 100755 (executable)
@@ -863,3 +863,14 @@ CAM_Application::ModuleShortInfoList CAM_Application::getVersionInfo()
   }  
   return info;
 }
+
+bool CAM_Application::abortAllOperations()
+{
+  bool isNextOperationAllowed = true;
+  for( QList<CAM_Module*>::const_iterator it = myModules.begin(); it != myModules.end(); ++it )
+  {
+    if( !(*it)->abortAllOperations() )
+      isNextOperationAllowed = false;
+  }
+  return isNextOperationAllowed;
+}
index d25f4d4c25bec30afcbcc1d523bcec5244297b77..5944e55d34b8adf0a90d5448e6bbf25bd6caab12 100755 (executable)
@@ -93,6 +93,8 @@ protected:
 
   static QString      moduleLibrary( const QString&, const bool = true );
 
+  virtual bool        abortAllOperations();
+
 private:
   void                readModuleList();
 
index 5d7d569de4a9ea0170d0079bd71e953f3a454d77..d3a0ddaf156e4187b7c48dad63da1e799466bab5 100755 (executable)
@@ -1134,3 +1134,9 @@ void CAM_Module::connectToStudy( CAM_Study* camStudy )
   \fn void CAM_Module::updateCommandsStatus();
   \brief Update menu/toolbar actions.
 */
+
+
+bool CAM_Module::abortAllOperations()
+{
+  return true;
+}
index 74a2b6e75cfcc2ba1fbb26d6ed853a6ccad89746..952f1857142b39a25ea4e5af3773eb34cf5e2908 100755 (executable)
@@ -145,6 +145,8 @@ protected:
   // after activate/deactivate modules
   QMap<QPair<int, QAction*>, QKeySequence> myActionShortcutMap; //!< copy actions shortcut map
 
+  virtual bool           abortAllOperations();
+
 private:
   CAM_Application*       myApp;             //!< parent application object
   QString                myName;            //!< module title (user name)
index dee6fd199a455cc56e772c4610e5222e39b26ffd..96f13ac1819588b02eae40f49bac8845be256c1f 100755 (executable)
@@ -324,6 +324,10 @@ void STD_Application::onOpenDoc()
 /*! \retval true, if document was opened successful, else false.*/
 bool STD_Application::onOpenDoc( const QString& aName )
 {
+  bool isNextOperationAllowed = abortAllOperations();
+  if( !isNextOperationAllowed )
+    return false;
+
   QApplication::setOverrideCursor( Qt::WaitCursor );
 
   bool res = openAction( openChoice( aName ), aName );
@@ -558,6 +562,10 @@ void STD_Application::onSaveDoc()
   if ( !activeStudy() )
     return;
 
+  bool isNextOperationAllowed = abortAllOperations();
+  if( !isNextOperationAllowed )
+    return;
+
   bool isOk = false;
   if ( activeStudy()->isSaved() )
   {
@@ -593,6 +601,10 @@ bool STD_Application::onSaveAsDoc()
   if ( !study )
     return false;
 
+  bool isNextOperationAllowed = abortAllOperations();
+  if( !isNextOperationAllowed )
+    return false;
+
   bool isOk = false;
   while ( !isOk )
   {
@@ -1007,3 +1019,7 @@ int STD_Application::viewManagerId( const SUIT_ViewManager* theManager) const
   return myViewMgrs.indexOf(const_cast<SUIT_ViewManager*>(theManager));
 }
 
+bool STD_Application::abortAllOperations()
+{
+  return true;
+}
index ed3f6fed5ba9e29d527e37c3a93cfa7043237ec4..2b1f4653ca08fde49c86d20fa3c6555293052a90 100755 (executable)
@@ -170,6 +170,8 @@ protected:
   virtual bool          closeDoc( bool ask = true );
   virtual bool          closeActiveDoc( bool permanently = true );
 
+  virtual bool          abortAllOperations();
+
 private:
   ViewManagerList       myViewMgrs;
   SUIT_ViewManager*     myActiveViewMgr;