diff --git a/apps/opencs/model/world/data.cpp b/apps/opencs/model/world/data.cpp index 04e35cdaaf..8a7dc3971a 100644 --- a/apps/opencs/model/world/data.cpp +++ b/apps/opencs/model/world/data.cpp @@ -657,6 +657,27 @@ int CSMWorld::Data::count (RecordBase::State state) const count (state, mReferenceables); } +bool CSMWorld::Data::recordDeleted(const std::string& id) const +{ + return + getGlobals().getRecord(id).isDeleted() || + getGmsts().getRecord(id).isDeleted() || + getSkills().getRecord(id).isDeleted() || + getClasses().getRecord(id).isDeleted() || + getFactions().getRecord(id).isDeleted() || + getRaces().getRecord(id).isDeleted() || + getSounds().getRecord(id).isDeleted() || + getScripts().getRecord(id).isDeleted() || + getRegions().getRecord(id).isDeleted() || + getBirthsigns().getRecord(id).isDeleted() || + getSpells().getRecord(id).isDeleted() || + getTopics().getRecord(id).isDeleted() || + getJournals().getRecord(id).isDeleted() || + getCells().getRecord(id).isDeleted() || + getReferenceables().getRecord(id).isDeleted(); +} + + void CSMWorld::Data::setDescription (const std::string& description) { mDescription = description; diff --git a/apps/opencs/model/world/data.hpp b/apps/opencs/model/world/data.hpp index 152c3ac419..df51c936a4 100644 --- a/apps/opencs/model/world/data.hpp +++ b/apps/opencs/model/world/data.hpp @@ -189,6 +189,8 @@ namespace CSMWorld void setAuthor (const std::string& author); std::string getAuthor() const; + + bool recordDeleted(const std::string& id) const; signals: diff --git a/apps/opencs/view/world/genericcreator.cpp b/apps/opencs/view/world/genericcreator.cpp index efdd9ecafb..16bd04ece4 100644 --- a/apps/opencs/view/world/genericcreator.cpp +++ b/apps/opencs/view/world/genericcreator.cpp @@ -125,10 +125,13 @@ void CSVWorld::GenericCreator::create() { if (mCloneMode) { - std::string id = getId(); + const std::string id = getId(); + if (mData.recordDeleted(id)) + { + return; + } std::auto_ptr command (new CSMWorld::CloneCommand ( dynamic_cast (*mData.getTableModel(mListId)), mClonedId, id, mClonedType, mArgumentType)); - mUndoStack.push(command.release()); emit done(); diff --git a/apps/opencs/view/world/table.cpp b/apps/opencs/view/world/table.cpp index 31a7d8b588..4577c40dc8 100644 --- a/apps/opencs/view/world/table.cpp +++ b/apps/opencs/view/world/table.cpp @@ -308,9 +308,10 @@ void CSVWorld::Table::cloneRecord() if (!mEditLock) { QModelIndexList selectedRows = selectionModel()->selectedRows(); - if (selectedRows.size()==1) + { emit cloneRequest (selectedRows.begin()->row()); + } } }