From ad2f9a69a1aaf2abd4a42d170cec472f1cf9feba Mon Sep 17 00:00:00 2001 From: Marek Kochanowicz Date: Thu, 20 Mar 2014 08:59:04 +0100 Subject: [PATCH] prevent deleting already deleted record --- apps/opencs/view/world/dialoguesubview.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/opencs/view/world/dialoguesubview.cpp b/apps/opencs/view/world/dialoguesubview.cpp index 53e53e0e6..5c718ad7f 100644 --- a/apps/opencs/view/world/dialoguesubview.cpp +++ b/apps/opencs/view/world/dialoguesubview.cpp @@ -596,9 +596,15 @@ void CSVWorld::DialogueSubView::revertRecord() void CSVWorld::DialogueSubView::deleteRecord() { int rows = mTable->rowCount(); + + //easier than disabling the button + CSMWorld::RecordBase::State state = static_cast(mTable->data (mTable->index (mRow, 1)).toInt()); + bool deledetedOrErased = (state == CSMWorld::RecordBase::State_Deleted || state == CSMWorld::RecordBase::State_Erased); + if (!mLocked && mTable->columnCount() > 0 && - mRow < mTable->rowCount() && + !deledetedOrErased && + mRow < rows && mBottom->canCreateAndDelete()) { mUndoStack.push(new CSMWorld::DeleteCommand(*mTable, mTable->data(mTable->index (mRow, 0)).toString().toStdString()));