Salome HOME
refs #30 - Sketch base GUI: create, draw lines
[modules/shaper.git] / src / XGUI / XGUI_OperationMgr.cpp
index 00419c69238d19063e84d0aa1c41cb39cce61bf2..ad312dad5c99de848390a0f352ace60621f3675f 100644 (file)
@@ -41,6 +41,7 @@ bool XGUI_OperationMgr::startOperation(ModuleBase_Operation* theOperation)
 
   connect(theOperation, SIGNAL(stopped()), this, SLOT(onOperationStopped()));
   connect(theOperation, SIGNAL(started()), this, SIGNAL(operationStarted()));
+  connect(theOperation, SIGNAL(resumed()), this, SIGNAL(operationResumed()));
 
   theOperation->start();
   return true;
@@ -58,9 +59,6 @@ bool XGUI_OperationMgr::abortOperation()
 
 void XGUI_OperationMgr::resumeOperation(ModuleBase_Operation* theOperation)
 {
-  connect(theOperation, SIGNAL(stopped()), this, SLOT(onOperationStopped()));
-  connect(theOperation, SIGNAL(started()), this, SIGNAL(operationStarted()));
-
   theOperation->resume();
 }
 
@@ -68,7 +66,7 @@ bool XGUI_OperationMgr::canStartOperation(ModuleBase_Operation* theOperation)
 {
   bool aCanStart = true;
   ModuleBase_Operation* aCurrentOp = currentOperation();
-  if (aCurrentOp && !theOperation->isGranted())
+  if (aCurrentOp && !theOperation->isGranted(aCurrentOp))
   {
     if (canStopOperation()) {
       aCurrentOp->abort();
@@ -87,6 +85,20 @@ bool XGUI_OperationMgr::canStopOperation()
   return anAnswer == QMessageBox::Ok;
 }
 
+void XGUI_OperationMgr::onCommitOperation()
+{
+  ModuleBase_Operation* anOperation = currentOperation();
+  if (anOperation)
+    anOperation->commit();
+}
+
+void XGUI_OperationMgr::onAbortOperation()
+{
+  ModuleBase_Operation* anOperation = currentOperation();
+  if (anOperation)
+    anOperation->abort();
+}
+
 void XGUI_OperationMgr::onOperationStopped()
 {
   ModuleBase_Operation* aSenderOperation = dynamic_cast<ModuleBase_Operation*>(sender());