1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-01 06:15:32 +00:00

Properly check if clone is deleted.

This commit is contained in:
Marek Kochanowicz 2014-01-20 16:17:49 +01:00
parent 5a52715701
commit d82f272e05
4 changed files with 15 additions and 7 deletions

View file

@ -310,7 +310,7 @@ void CSVWorld::Table::cloneRecord()
QModelIndexList selectedRows = selectionModel()->selectedRows(); QModelIndexList selectedRows = selectionModel()->selectedRows();
if (selectedRows.size()==1) if (selectedRows.size()==1)
{ {
emit cloneRequest (selectedRows.begin()->row()); emit cloneRequest (selectedRows.begin()->row(), mModel);
} }
} }
} }

View file

@ -74,7 +74,7 @@ namespace CSVWorld
/// \param modified Number of added and modified records /// \param modified Number of added and modified records
void createRequest(); void createRequest();
void cloneRequest(int row); void cloneRequest(int row, const CSMWorld::IdTable* table);
private slots: private slots:

View file

@ -6,7 +6,7 @@
#include "../../model/doc/document.hpp" #include "../../model/doc/document.hpp"
#include "../filter/filterbox.hpp" #include "../filter/filterbox.hpp"
#include "../../model/world/idtable.hpp"
#include "table.hpp" #include "table.hpp"
#include "tablebottombox.hpp" #include "tablebottombox.hpp"
#include "creator.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 (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)), 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))); 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); 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)); const CSMWorld::UniversalId& toClone(mTable->getUniversalId(row));
if (!(table->getRecord(toClone.getId()).isDeleted()))
{
emit cloneRequest(toClone.getId(), toClone.getType(), toClone.getArgumentType()); emit cloneRequest(toClone.getId(), toClone.getType(), toClone.getArgumentType());
}
} }

View file

@ -5,6 +5,11 @@
class QModelIndex; class QModelIndex;
namespace CSMWorld
{
class IdTable;
}
namespace CSMDoc namespace CSMDoc
{ {
class Document; class Document;
@ -42,7 +47,7 @@ namespace CSVWorld
private slots: private slots:
void editRequest (int row); void editRequest (int row);
void cloneRequest (int row); void cloneRequest (int row, const CSMWorld::IdTable* table);
}; };
} }