diff --git a/apps/opencs/model/world/commanddispatcher.cpp b/apps/opencs/model/world/commanddispatcher.cpp index d94033d9c..199f91e29 100644 --- a/apps/opencs/model/world/commanddispatcher.cpp +++ b/apps/opencs/model/world/commanddispatcher.cpp @@ -8,7 +8,6 @@ #include "../doc/document.hpp" #include "idtable.hpp" -#include "idtree.hpp" #include "record.hpp" #include "commands.hpp" @@ -156,10 +155,10 @@ void CSMWorld::CommandDispatcher::executeDelete() if (mId.getType() == UniversalId::Type_Referenceables) { - IdTree& tree = dynamic_cast (*mDocument.getData().getTableModel (mId)); - std::pair localIndex = tree.searchId (id); - - mDocument.getUndoStack().push (new CSMWorld::DeleteCommand (model, id, localIndex.second)); + mDocument.getUndoStack().push ( new CSMWorld::DeleteCommand (model, id, + static_cast(model.data (model.index ( + model.getModelIndex (id, columnIndex).row(), + model.findColumnIndex (CSMWorld::Columns::ColumnId_RecordType))).toInt()))); } else mDocument.getUndoStack().push (new CSMWorld::DeleteCommand (model, id)); @@ -228,17 +227,8 @@ void CSMWorld::CommandDispatcher::executeExtendedDelete() Misc::StringUtils::lowerCase (record.get().mCell))) continue; - if (mId.getType() == UniversalId::Type_Referenceables) - { - IdTree& tree = dynamic_cast (*mDocument.getData().getTableModel (mId)); - std::pair localIndex = tree.searchId (record.get().mId); - - mDocument.getUndoStack().push ( - new CSMWorld::DeleteCommand (model, record.get().mId, localIndex.second)); - } - else - mDocument.getUndoStack().push ( - new CSMWorld::DeleteCommand (model, record.get().mId)); + mDocument.getUndoStack().push ( + new CSMWorld::DeleteCommand (model, record.get().mId)); } } } diff --git a/apps/opencs/model/world/idtree.cpp b/apps/opencs/model/world/idtree.cpp index 564e4ec2f..06db09a0f 100644 --- a/apps/opencs/model/world/idtree.cpp +++ b/apps/opencs/model/world/idtree.cpp @@ -4,7 +4,6 @@ #include "collectionbase.hpp" #include "nestedcollection.hpp" -#include "refidcollection.hpp" // HACK: for searchId() only #include "columnbase.hpp" // NOTE: parent class still needs idCollection @@ -258,9 +257,3 @@ CSMWorld::NestedTableWrapperBase* CSMWorld::IdTree::nestedTable(const QModelInde return mNestedCollection->nestedTable(index.row(), index.column()); } - -// HACK: to get the UniversalId::Type associated with a particular record -std::pair CSMWorld::IdTree::searchId (const std::string& id) const -{ - return dynamic_cast(idCollection())->getDataSet().searchId(id); -} diff --git a/apps/opencs/model/world/idtree.hpp b/apps/opencs/model/world/idtree.hpp index 73cc9bdfd..5337ed82b 100644 --- a/apps/opencs/model/world/idtree.hpp +++ b/apps/opencs/model/world/idtree.hpp @@ -73,8 +73,6 @@ namespace CSMWorld virtual bool hasChildren (const QModelIndex& index) const; - std::pair searchId (const std::string& id) const; - signals: void resetStart(const QString& id);