- ModuleBase_Operation* anOperation = currentOperation();
- if (anOperation && anOperation->isModified()) {
- int anAnswer = QMessageBox::question(
- qApp->activeWindow(), tr("Cancel operation"),
- tr("Operation %1 will be cancelled. Continue?").arg(anOperation->id()), QMessageBox::Yes,
- QMessageBox::No);
- return anAnswer == QMessageBox::Yes;
- }
- return true;
+ ModuleBase_Operation* aSenderOperation = dynamic_cast<ModuleBase_Operation*>(sender());
+
+ bool aParentValid = isParentOperationValid();
+ // in order to apply is enabled only if there are modifications in the model
+ // e.g. sketch can be applyed only if at least one nested element modification is finished
+ bool aCanUndo = ModelAPI_Session::get()->canUndo();
+ emit nestedStateChanged(aParentValid && aCanUndo);
+
+ emit operationStarted(aSenderOperation);
+}
+
+void XGUI_OperationMgr::onOperationAborted()
+{
+ ModuleBase_Operation* aSenderOperation = dynamic_cast<ModuleBase_Operation*>(sender());
+ emit operationAborted(aSenderOperation);
+}
+
+void XGUI_OperationMgr::onOperationCommitted()
+{
+ ModuleBase_Operation* aSenderOperation = dynamic_cast<ModuleBase_Operation*>(sender());
+ // in order to apply is enabled only if there are modifications in the model
+ // e.g. sketch can be applyed only if at least one nested element create is finished
+ bool aCanUndo = ModelAPI_Session::get()->canUndo();
+ emit nestedStateChanged(myOperations.count() >= 1 && aCanUndo);
+ emit operationCommitted(aSenderOperation);
+}
+
+void XGUI_OperationMgr::onOperationResumed()
+{
+ ModuleBase_Operation* aSenderOperation = dynamic_cast<ModuleBase_Operation*>(sender());
+ emit operationResumed(aSenderOperation);