From: vsv Date: Thu, 22 May 2014 08:07:13 +0000 (+0400) Subject: Update Delete operation in pop-up X-Git-Tag: V_0.2~29^2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4b305e165a70100c3bbfacbf69fcc9e1c21ae606;p=modules%2Fshaper.git Update Delete operation in pop-up --- diff --git a/src/XGUI/XGUI_ContextMenuMgr.cpp b/src/XGUI/XGUI_ContextMenuMgr.cpp index 461b2dab5..a74824431 100644 --- a/src/XGUI/XGUI_ContextMenuMgr.cpp +++ b/src/XGUI/XGUI_ContextMenuMgr.cpp @@ -98,7 +98,7 @@ QMenu* XGUI_ContextMenuMgr::objectBrowserMenu() const } else { aActions.append(action("EDIT_CMD")); } - aActions.append(action("DELETE_CMD")); + aActions.append(action("DELETE_CMD")); // Process Root object (document) } else { // If feature is 0 the it means that selected root object (document) diff --git a/src/XGUI/XGUI_DocumentDataModel.cpp b/src/XGUI/XGUI_DocumentDataModel.cpp index 30d3b9a0f..8b42208ae 100644 --- a/src/XGUI/XGUI_DocumentDataModel.cpp +++ b/src/XGUI/XGUI_DocumentDataModel.cpp @@ -90,8 +90,8 @@ void XGUI_DocumentDataModel::processEvent(const Events_Message* theMessage) if (aDoc == myDocument) { // If root objects if (aUpdMsg->group().compare(PARTS_GROUP) == 0) { // Updsate only Parts group - int aStart = myPartModels.size(); - removeSubModel(myPartModels.size() - 1); + int aStart = myPartModels.size() - 1; + removeSubModel(aStart); removeRow(aStart, partFolderNode()); } else { // Update top groups (other except parts QModelIndex aIndex = myModel->findGroup(aUpdMsg->group()); diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 8504e1531..a666a25a2 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -318,8 +318,8 @@ void XGUI_Workshop::addFeature(const Config_FeatureMessage* theMessage) QString aWchName = QString::fromStdString(theMessage->workbenchId()); QString aNestedFeatures = QString::fromStdString(theMessage->nestedFeatures()); bool isUsePropPanel = theMessage->isUseInput(); + QString aId = QString::fromStdString(theMessage->id()); if (isSalomeMode()) { - QString aId = QString::fromStdString(theMessage->id()); QAction* aAction = salomeConnector()->addFeature(aWchName, aId, QString::fromStdString(theMessage->text()), @@ -343,7 +343,7 @@ void XGUI_Workshop::addFeature(const Config_FeatureMessage* theMessage) aGroup = aPage->addGroup(aGroupName); } //Create feature... - XGUI_Command* aCommand = aGroup->addFeature(QString::fromStdString(theMessage->id()), + XGUI_Command* aCommand = aGroup->addFeature(aId, QString::fromStdString(theMessage->text()), QString::fromStdString(theMessage->tooltip()), QIcon(theMessage->icon().c_str()), @@ -763,9 +763,18 @@ void XGUI_Workshop::deleteFeatures(QFeatureList theList) tr("Seleted features will be deleted. Continue?"), QMessageBox::No | QMessageBox::Yes, QMessageBox::No); if (aRes == QMessageBox::Yes) { + PluginManagerPtr aMgr = ModelAPI_PluginManager::get(); + aMgr->rootDocument()->startOperation(); foreach (FeaturePtr aFeature, theList) { - DocumentPtr aDoc = aFeature->data()->docRef("PartDocument")->value(); - aDoc->removeFeature(aFeature); + if (aFeature->getKind() == "Part") { + DocumentPtr aDoc = aFeature->data()->docRef("PartDocument")->value(); + if (aDoc == aMgr->currentDocument()) { + aDoc->close(); + } + } //else + //aDoc = aFeature->document(); + aMgr->rootDocument()->removeFeature(aFeature); } + aMgr->rootDocument()->finishOperation(); } } \ No newline at end of file