From 876b136aba9763be6bd924aa54ed61f73235d7b7 Mon Sep 17 00:00:00 2001 From: nds Date: Wed, 8 Jul 2015 19:43:55 +0300 Subject: [PATCH] Set "Apply" command button enabled in the tool bar of the application when nested operation is active. --- src/XGUI/XGUI_OperationMgr.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/XGUI/XGUI_OperationMgr.cpp b/src/XGUI/XGUI_OperationMgr.cpp index b5579b88c..c04cb9c6c 100644 --- a/src/XGUI/XGUI_OperationMgr.cpp +++ b/src/XGUI/XGUI_OperationMgr.cpp @@ -248,8 +248,19 @@ void XGUI_OperationMgr::onOperationStarted() { ModuleBase_Operation* aSenderOperation = dynamic_cast(sender()); - bool isNestedOk = (myOperations.count() >= 1) && - myOperations.at(0)->isValid(); + // the enable state of the parent operation of the nested one is defined by the rules that + // firstly there are nested operations and secondly the parent operation is valid + ModuleBase_Operation* aPrevOp; + Operations::const_iterator anIt = myOperations.end(); + if (anIt != myOperations.begin()) { // there are items in the operations list + --anIt; + aPrevOp = *anIt; // the last top operation, the operation which is started + if (anIt != myOperations.begin()) { // find the operation where the started operation is nested + --anIt; + aPrevOp = *anIt; + } + } + bool isNestedOk = (myOperations.count() >= 1) && aPrevOp->isValid(); emit nestedStateChanged(isNestedOk); emit operationStarted(aSenderOperation); } -- 2.39.2