Salome HOME
refs #30 - Sketch base GUI: create, draw lines
[modules/shaper.git] / src / XGUI / XGUI_ActionsMgr.cpp
index a496899708f9375fd8fa60fde53a89de2044a6f3..7f0b02d9ae0e668688a24dbaaa15d1a65caf1a19 100644 (file)
@@ -21,20 +21,14 @@ XGUI_ActionsMgr::~XGUI_ActionsMgr()
 }
 
 
-void XGUI_ActionsMgr::addCommand(QString theId, QAction* theCmd)
+void XGUI_ActionsMgr::addCommand(QAction* theCmd)
 {
-  myActions.insert(theId,theCmd);
-  myActionsState.insert(theId, theCmd->isEnabled());
+  QString aId = theCmd->data().toString();
+  myActions.insert(aId, theCmd);
+  myActionsState.insert(aId, theCmd->isEnabled());
   connect(theCmd, SIGNAL(triggered(bool)), this, SLOT(setActionsDisabled(bool)));
 }
 
-void XGUI_ActionsMgr::addCommand(XGUI_Command* theCmd)
-{
-  myActions.insert(theCmd->id(),theCmd);
-  myActionsState.insert(theCmd->id(), theCmd->enabled());
-  theCmd->connectTo(this, SLOT(setActionsDisabled(bool)));
-}
-
 void XGUI_ActionsMgr::setActionsDisabled(bool isDisabled)
 {
   //Re-enable actions (just restore their state)
@@ -47,13 +41,9 @@ void XGUI_ActionsMgr::setActionsDisabled(bool isDisabled)
   saveCommandsState();
 
   QString aSkippedId;
-  if (myWorkshop->isSalomeMode()) {
-    QAction* aToggledFeature = dynamic_cast<QAction*>(sender());
-    aSkippedId = myWorkshop->salomeConnector()->commandId(aToggledFeature);
-  } else {
-    XGUI_Command* aToggledFeature = dynamic_cast<XGUI_Command*>(sender());
-    aSkippedId = aToggledFeature->id();
-  }
+  QAction* aToggledFeature = dynamic_cast<QAction*>(sender());
+  aSkippedId = aToggledFeature->data().toString();
+
   QStringList anActionIdsList = myActions.keys();
   foreach(QString eachKey, anActionIdsList) {
     if (eachKey == aSkippedId) {