bool XGUI_OperationMgr::canStopOperation(ModuleBase_Operation* theOperation)
{
//in case of nested (sketch) operation no confirmation needed
- if (isGrantedOperation(theOperation))
+ if (isGrantedOperation(theOperation->id()))
return true;
if (theOperation && theOperation->isModified()) {
QString aMessage = tr("%1 operation will be aborted.").arg(theOperation->id());
theOperation->resume();
}
-bool XGUI_OperationMgr::isGrantedOperation(ModuleBase_Operation* theOperation)
+bool XGUI_OperationMgr::isGrantedOperation(const QString& theId)
{
bool isGranted = false;
ModuleBase_Operation* aPreviousOperation = 0;
while (anIt.hasPrevious()) {
ModuleBase_Operation* anOp = anIt.previous();
- if (anOp == theOperation) {
+ if (anOp->id() == theId) {
if (anIt.hasPrevious())
aPreviousOperation = anIt.previous();
break;
}
}
if (aPreviousOperation)
- isGranted = aPreviousOperation->isGranted(theOperation->id());
+ isGranted = aPreviousOperation->isGranted(theId);
return isGranted;
}
ModuleBase_Operation* aCurrentOp = currentOperation();
if (aCurrentOp) {
bool aGranted = aCurrentOp->isGranted(theId) || isAdditionallyGranted;
- if (!aGranted) {
- if (canStopOperation(aCurrentOp)) {
+ // the started operation is granted for the current one,
+ // e.g. current - Sketch, started - Line
+ if (aGranted) {
+ aCanStart = true;
+ }
+ else {
+ if (!isGrantedOperation(theId)) {
+ // the operation is not granted in the current list of operations
+ // e.g. Edit Parameter when Sketch, Line in Sketch is active.
+ aCanStart = abortAllOperations();
+ }
+ else if (canStopOperation(aCurrentOp)) {
+ // the started operation is granted in the parrent operation,
+ // e.g. current - Line in Sketch, started Circle
if (myIsApplyEnabled && aCurrentOp->isModified())
aCurrentOp->commit();
else
/// Returns whether the parameter operation is granted in relation to the previous operation
/// in a stack of started operations. It is used in canStopOperation to avoid warning message
/// when granted operation is aborted, e.g. SketchLine in Sketch
- /// \param theOperation the started operation
+ /// \param theId id of the operation which is checked
/// \return boolean result
- bool isGrantedOperation(ModuleBase_Operation* theOperation);
+ bool isGrantedOperation(const QString& theId);
public slots:
/// SLOT, that is called by the key in the property panel is clicked.