diff --git a/apps/opencs/view/world/table.cpp b/apps/opencs/view/world/table.cpp index 4577c40dc..02a93161c 100644 --- a/apps/opencs/view/world/table.cpp +++ b/apps/opencs/view/world/table.cpp @@ -310,7 +310,7 @@ void CSVWorld::Table::cloneRecord() QModelIndexList selectedRows = selectionModel()->selectedRows(); if (selectedRows.size()==1) { - emit cloneRequest (selectedRows.begin()->row()); + emit cloneRequest (selectedRows.begin()->row(), mModel); } } } diff --git a/apps/opencs/view/world/table.hpp b/apps/opencs/view/world/table.hpp index f4a5d3c9e..118bd3cf2 100644 --- a/apps/opencs/view/world/table.hpp +++ b/apps/opencs/view/world/table.hpp @@ -74,7 +74,7 @@ namespace CSVWorld /// \param modified Number of added and modified records void createRequest(); - void cloneRequest(int row); + void cloneRequest(int row, const CSMWorld::IdTable* table); private slots: diff --git a/apps/opencs/view/world/tablesubview.cpp b/apps/opencs/view/world/tablesubview.cpp index 7bb852cbe..0cdc57f5f 100644 --- a/apps/opencs/view/world/tablesubview.cpp +++ b/apps/opencs/view/world/tablesubview.cpp @@ -6,7 +6,7 @@ #include "../../model/doc/document.hpp" #include "../filter/filterbox.hpp" - +#include "../../model/world/idtable.hpp" #include "table.hpp" #include "tablebottombox.hpp" #include "creator.hpp" @@ -49,7 +49,7 @@ CSVWorld::TableSubView::TableSubView (const CSMWorld::UniversalId& id, CSMDoc::D { connect (mTable, SIGNAL (createRequest()), mBottom, SLOT (createRequest())); - connect (mTable, SIGNAL (cloneRequest(int)), this, SLOT(cloneRequest(int))); + connect (mTable, SIGNAL (cloneRequest(int, CSMWorld::IdTable*)), this, SLOT(cloneRequest(int, CSMWorld::IdTable*))); connect (this, SIGNAL(cloneRequest(const std::string&, const CSMWorld::UniversalId::Type, const CSMWorld::UniversalId::ArgumentType)), mBottom, SLOT(cloneRequest(const std::string&, const CSMWorld::UniversalId::Type, const CSMWorld::UniversalId::ArgumentType))); } @@ -82,8 +82,11 @@ void CSVWorld::TableSubView::setStatusBar (bool show) mBottom->setStatusBar (show); } -void CSVWorld::TableSubView::cloneRequest(int row) +void CSVWorld::TableSubView::cloneRequest(int row, const CSMWorld::IdTable* table) { const CSMWorld::UniversalId& toClone(mTable->getUniversalId(row)); - emit cloneRequest(toClone.getId(), toClone.getType(), toClone.getArgumentType()); + if (!(table->getRecord(toClone.getId()).isDeleted())) + { + emit cloneRequest(toClone.getId(), toClone.getType(), toClone.getArgumentType()); + } } diff --git a/apps/opencs/view/world/tablesubview.hpp b/apps/opencs/view/world/tablesubview.hpp index 01df204de..650a098f6 100644 --- a/apps/opencs/view/world/tablesubview.hpp +++ b/apps/opencs/view/world/tablesubview.hpp @@ -5,6 +5,11 @@ class QModelIndex; +namespace CSMWorld +{ + class IdTable; +} + namespace CSMDoc { class Document; @@ -42,7 +47,7 @@ namespace CSVWorld private slots: void editRequest (int row); - void cloneRequest (int row); + void cloneRequest (int row, const CSMWorld::IdTable* table); }; }