]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix of Delete operation bug and Rename improvement
authorvsv <vitaly.smetannikov@opencascade.com>
Thu, 22 Oct 2015 14:06:30 +0000 (17:06 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Thu, 22 Oct 2015 14:06:44 +0000 (17:06 +0300)
src/XGUI/XGUI_ContextMenuMgr.cpp
src/XGUI/XGUI_ObjectsBrowser.cpp
src/XGUI/XGUI_Workshop.cpp

index 190f2ef3d50e54ab4cc89b3d33ffc4c52079ec43..b90e3e08505c81862e796bb72495b1e381c41312 100644 (file)
@@ -495,9 +495,10 @@ QStringList XGUI_ContextMenuMgr::actionObjectGroups(const QString& theName)
 
 void XGUI_ContextMenuMgr::onRename()
 {
-  ModuleBase_OperationAction* anAction = new ModuleBase_OperationAction("Rename", this);
-  XGUI_OperationMgr* anOpMgr = myWorkshop->operationMgr();
-  anOpMgr->startOperation(anAction);
+  QObjectPtrList anObjects = myWorkshop->selector()->selection()->selectedObjects();
+  if (!myWorkshop->abortAllOperations())
+    return; 
+  // restore selection in case if dialog box was shown
+  myWorkshop->objectBrowser()->setObjectsSelected(anObjects);
   myWorkshop->objectBrowser()->onEditItem();
-  anOpMgr->commitOperation();
 }
index 2df67c44963a3e33d72576739e1ae5b8c5bd2ff7..a083bc3db324a2e5013f6b1a3caac90efef9bada 100644 (file)
@@ -101,8 +101,12 @@ void XGUI_DataTree::commitData(QWidget* theEditor)
       XGUI_DataModel* aModel = dataModel();
       ObjectPtr aObj = aModel->object(aIndexList.first());
 
-      if (XGUI_Tools::canRename(aObj, aName))
+      if (XGUI_Tools::canRename(aObj, aName)) {
+        SessionPtr aMgr = ModelAPI_Session::get();
+        aMgr->startOperation("Rename");
         aObj->data()->setName(qPrintable(aName));
+        aMgr->finishOperation();
+      }
     }
   }
   aEntrance = 0;
index b46d8d692014f50bb90da6a88b9a3786b254389c..184cafe058120277560f5f67eb2417e2c133f44e 100644 (file)
@@ -1116,9 +1116,9 @@ void XGUI_Workshop::deleteObjects()
     return;
   }
 
+  QObjectPtrList anObjects = mySelector->selection()->selectedObjects();
   if (!abortAllOperations())
     return;
-  QObjectPtrList anObjects = mySelector->selection()->selectedObjects();
   // It is necessary to clear selection in order to avoid selection changed event during
   // deletion and negative consequences connected with processing of already deleted items
   mySelector->clearSelection();