implemented check for deletion. But it seems flawed.

actorid
Marek Kochanowicz 11 years ago
parent 38636fab9a
commit 5a52715701

@ -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;

@ -189,6 +189,8 @@ namespace CSMWorld
void setAuthor (const std::string& author);
std::string getAuthor() const;
bool recordDeleted(const std::string& id) const;
signals:

@ -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<CSMWorld::CloneCommand> command (new CSMWorld::CloneCommand (
dynamic_cast<CSMWorld::IdTable&> (*mData.getTableModel(mListId)), mClonedId, id, mClonedType, mArgumentType));
mUndoStack.push(command.release());
emit done();

@ -308,9 +308,10 @@ void CSVWorld::Table::cloneRecord()
if (!mEditLock)
{
QModelIndexList selectedRows = selectionModel()->selectedRows();
if (selectedRows.size()==1)
{
emit cloneRequest (selectedRows.begin()->row());
}
}
}

Loading…
Cancel
Save