Salome HOME
Issue #6 Extended processing of nested actions.
[modules/shaper.git] / src / XGUI / XGUI_ActionsMgr.cpp
index 0d652dceba7eed7cdeba455230e3056d03bc361f..8cc05c494a8a75a01b8c96e38c0ecfd844f3d32e 100644 (file)
@@ -29,22 +29,22 @@ void XGUI_ActionsMgr::setActionsDisabled(bool isDisabled)
 {
   //Re-enable actions (just restore their state)
   if (!isDisabled) {
+    myNestedActions.clear();
     restoreCommandState();
     return;
   }
   //Disable all actions, but caller and unblockable (defined in a xml)
   saveCommandsState();
-  QStringList aSkippedIds;
   XGUI_Command* aToggledFeature = dynamic_cast<XGUI_Command*>(sender());
-  aSkippedIds.append(aToggledFeature->unblockableCommands());
-  aSkippedIds.append(aToggledFeature->id());
+  QString aSkippedId = aToggledFeature->id();
   QStringList anActionIdsList = myActions.keys();
   foreach(QString eachKey, anActionIdsList) {
-    if (aSkippedIds.removeAll(eachKey) > 0) {
+    if (eachKey == aSkippedId) {
       continue;
     }
     myActions[eachKey]->setEnabled(false);
   }
+  myNestedActions = aToggledFeature->unblockableCommands();
 }
 
 void XGUI_ActionsMgr::saveCommandsState()
@@ -65,3 +65,10 @@ void XGUI_ActionsMgr::restoreCommandState()
     myActions[eachKey]->setChecked(false);
   }
 }
+
+void XGUI_ActionsMgr::setNestedActionsEnabled(bool isEnabled)
+{
+  foreach(QString eachKey, myNestedActions) {
+    myActions[eachKey]->setEnabled(isEnabled);
+  }
+}