From: sbh Date: Thu, 30 Oct 2014 12:55:04 +0000 (+0300) Subject: Issues #198 #118 "Remove" and "Duplicate" features corrected to be correctrly process... X-Git-Tag: V_0.5~58^2~2^2~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6fafa176bdd7cc86eabe98fab75c73faee6828d9;p=modules%2Fshaper.git Issues #198 #118 "Remove" and "Duplicate" features corrected to be correctrly processed by action mgr --- diff --git a/src/PartSetPlugin/PartSetPlugin_Duplicate.h b/src/PartSetPlugin/PartSetPlugin_Duplicate.h index b5e48183f..13d3df2cc 100644 --- a/src/PartSetPlugin/PartSetPlugin_Duplicate.h +++ b/src/PartSetPlugin/PartSetPlugin_Duplicate.h @@ -14,6 +14,19 @@ 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() { diff --git a/src/PartSetPlugin/PartSetPlugin_Plugin.cpp b/src/PartSetPlugin/PartSetPlugin_Plugin.cpp index 0ad4b8b92..31c80e495 100644 --- a/src/PartSetPlugin/PartSetPlugin_Plugin.cpp +++ b/src/PartSetPlugin/PartSetPlugin_Plugin.cpp @@ -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 diff --git a/src/PartSetPlugin/plugin-PartSet.xml b/src/PartSetPlugin/plugin-PartSet.xml index 8a9c5ec61..4a846cc42 100644 --- a/src/PartSetPlugin/plugin-PartSet.xml +++ b/src/PartSetPlugin/plugin-PartSet.xml @@ -2,8 +2,8 @@ - - + + diff --git a/src/XGUI/XGUI_ActionsMgr.cpp b/src/XGUI/XGUI_ActionsMgr.cpp index c1633f56c..0468a39f7 100644 --- a/src/XGUI/XGUI_ActionsMgr.cpp +++ b/src/XGUI/XGUI_ActionsMgr.cpp @@ -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); } }