]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issues #198 #118 "Remove" and "Duplicate" features corrected to be correctrly process...
authorsbh <sergey.belash@opencascade.com>
Thu, 30 Oct 2014 12:55:04 +0000 (15:55 +0300)
committersbh <sergey.belash@opencascade.com>
Thu, 30 Oct 2014 12:55:04 +0000 (15:55 +0300)
src/PartSetPlugin/PartSetPlugin_Duplicate.h
src/PartSetPlugin/PartSetPlugin_Plugin.cpp
src/PartSetPlugin/plugin-PartSet.xml
src/XGUI/XGUI_ActionsMgr.cpp

index b5e48183f54196eb8989e053d5839d45f2f7dacd..13d3df2cc497c8c27ed8c8654a0875c5179147a0 100644 (file)
 class PartSetPlugin_Duplicate : public PartSetPlugin_Part
 {
  public:
+    /// Duplicate kind
+  inline static const std::string& ID()
+  {
+    static const std::string MY_DUPLICATE_KIND("Duplicate");
+    return MY_DUPLICATE_KIND;
+  }
+  /// Returns the kind of a feature
+  PARTSETPLUGIN_EXPORT virtual const std::string& getKind()
+  {
+    static std::string MY_KIND = PartSetPlugin_Duplicate::ID();
+    return MY_KIND;
+  }
+
   /// the reference to copy: reference to the attribute
   inline static const std::string& ORIGIN_REF()
   {
index 0ad4b8b928ad69e4ec78822999fedf0fa66e1e3c..31c80e4953a769853494e17e785805c59b6b3a7e 100644 (file)
@@ -21,10 +21,10 @@ FeaturePtr PartSetPlugin_Plugin::createFeature(string theFeatureID)
   if (theFeatureID == PartSetPlugin_Part::ID()) {
     return FeaturePtr(new PartSetPlugin_Part);
   }
-  if (theFeatureID == "duplicate") {
+  if (theFeatureID == PartSetPlugin_Duplicate::ID()) {
     return FeaturePtr(new PartSetPlugin_Duplicate);
   }
-  if (theFeatureID == "remove") {
+  if (theFeatureID == PartSetPlugin_Remove::ID()) {
     return FeaturePtr(new PartSetPlugin_Remove);
   }
   // feature of such kind is not found
index 8a9c5ec613e0dc5c5827f728c508554322f46fc3..4a846cc42a98088901b5d05ae21d98a8f31b1b77 100644 (file)
@@ -2,8 +2,8 @@
   <workbench id="Part">
     <group id="Operations">
       <feature id="Part" title="New part" tooltip="Create a new part" icon=":pictures/part_ico.png"/>
-      <feature id="duplicate" title="Duplicate" tooltip="Duplicate selected part" icon=":icons/duplicate.png"/>
-      <feature id="remove" title="Remove part"  tooltip="Remove active part" icon=":icons/remove.png"/>
+      <feature id="Duplicate" title="Duplicate" tooltip="Duplicate selected part" icon=":icons/duplicate.png"/>
+      <feature id="Remove" title="Remove part"  tooltip="Remove active part" icon=":icons/remove.png"/>
     </group>
   </workbench>
 </plugin>
index c1633f56c7e1fcb3b57a41ff06bd8eef3814edee..0468a39f75bc4ba8c5da482cdb115eefa28d89b1 100644 (file)
@@ -115,9 +115,11 @@ void XGUI_ActionsMgr::setNestedCommandsEnabled(bool theEnabled, const QString& t
 
 void XGUI_ActionsMgr::setActionChecked(const QString& theId, const bool theChecked)
 {
-  QAction* anAction = myActions[theId];
-  if (anAction && anAction->isCheckable()) {
-    anAction->setChecked(theChecked);
+  if (myActions.contains(theId)) {
+    QAction* anAction = myActions[theId];
+    if (anAction->isCheckable()) {
+      anAction->setChecked(theChecked);
+    }
   }
 }
 
@@ -135,7 +137,7 @@ void XGUI_ActionsMgr::updateByDocumentKind()
     QString aCmdDocKind;
     if(aCmd) {
       aCmdDocKind = aCmd->documentKind();
-    } else if (eachAction) {
+    } else {
       QString aId = eachAction->data().toString();
       if (!aId.isEmpty()) {
         aCmdDocKind = aWorkshop->salomeConnector()->documentKind(aId);
@@ -149,9 +151,8 @@ void XGUI_ActionsMgr::updateByDocumentKind()
 
 void XGUI_ActionsMgr::setActionEnabled(const QString& theId, const bool theEnabled)
 {
-  QAction* anAction = myActions[theId];
-  if (anAction) {
-    anAction->setEnabled(theEnabled);
+  if (myActions.contains(theId)) {
+    myActions[theId]->setEnabled(theEnabled);
   }
 }