From: sbh Date: Thu, 16 Apr 2015 17:02:29 +0000 (+0300) Subject: Issue #445 undo/redo for Delete and Auxiliary operations X-Git-Tag: V_1.1.0~20 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b6f8818a3de26b38025a19d9caaec51a4aa838af;p=modules%2Fshaper.git Issue #445 undo/redo for Delete and Auxiliary operations --- diff --git a/src/PartSet/PartSet_MenuMgr.cpp b/src/PartSet/PartSet_MenuMgr.cpp index 0aa5faf3e..91b6f859e 100644 --- a/src/PartSet/PartSet_MenuMgr.cpp +++ b/src/PartSet/PartSet_MenuMgr.cpp @@ -376,7 +376,11 @@ void PartSet_MenuMgr::setAuxiliary(const bool isChecked) } if (isUseTransaction) { aMgr->finishOperation(); + XGUI_ModuleConnector* aConnector = dynamic_cast(myModule->workshop()); + XGUI_Workshop* aWorkshop = aConnector->workshop(); + aWorkshop->updateCommandStatus(); } + Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); myModule->sketchMgr()->restoreSelection(); } diff --git a/src/XGUI/XGUI_ContextMenuMgr.cpp b/src/XGUI/XGUI_ContextMenuMgr.cpp index 868da0552..80fdfad7f 100644 --- a/src/XGUI/XGUI_ContextMenuMgr.cpp +++ b/src/XGUI/XGUI_ContextMenuMgr.cpp @@ -97,6 +97,16 @@ QAction* XGUI_ContextMenuMgr::action(const QString& theId) const return 0; } +QAction* XGUI_ContextMenuMgr::actionByName(const QString& theName) const +{ + foreach(QAction* eachAction, myActions) { + if (eachAction->text() == theName) { + return eachAction; + } + } + return NULL; +} + QStringList XGUI_ContextMenuMgr::actionIds() const { return myActions.keys(); diff --git a/src/XGUI/XGUI_ContextMenuMgr.h b/src/XGUI/XGUI_ContextMenuMgr.h index 570fe912e..805b376ef 100644 --- a/src/XGUI/XGUI_ContextMenuMgr.h +++ b/src/XGUI/XGUI_ContextMenuMgr.h @@ -33,6 +33,8 @@ Q_OBJECT /// \param theId an id of an action QAction* action(const QString& theId) const; + QAction* actionByName(const QString& theName) const; + /// Returns list of registered actions Ids QStringList actionIds() const; diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index eda386924..701ac10b8 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -1377,8 +1377,10 @@ void XGUI_Workshop::deleteObjects() { ModuleBase_IModule* aModule = module(); // 1. allow the module to delete objects, do nothing if it has succeed - if (aModule->deleteObjects()) + if (aModule->deleteObjects()) { + updateCommandStatus(); return; + } if (!isActiveOperationAborted()) return; @@ -1705,7 +1707,13 @@ QList XGUI_Workshop::processHistoryList(const std::list if (isEditing) { anId.chop(ModuleBase_Operation::EditSuffix().size()); } - ActionInfo anInfo = myActionsMgr->actionInfoById(anId); + ActionInfo anInfo; + QAction* aContextMenuAct = myContextMenuMgr->actionByName(anId); + if (aContextMenuAct) { + anInfo.initFrom(aContextMenuAct); + } else { + anInfo = myActionsMgr->actionInfoById(anId); + } if (isEditing) { anInfo.text = anInfo.text.prepend("Modify "); }