From 307f04f827207a0a3960d025bbfda87367337f05 Mon Sep 17 00:00:00 2001 From: Rob Cutmore Date: Fri, 6 May 2016 08:04:15 -0400 Subject: [PATCH 1/3] Editor: Fix issue adding start script (Bug #3331) Updated to verify column is editable when adding a new record. --- apps/opencs/model/world/idtable.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/opencs/model/world/idtable.cpp b/apps/opencs/model/world/idtable.cpp index 4d8a0842f..5f50f2210 100644 --- a/apps/opencs/model/world/idtable.cpp +++ b/apps/opencs/model/world/idtable.cpp @@ -159,7 +159,11 @@ void CSMWorld::IdTable::addRecordWithData (const std::string& id, mIdCollection->appendBlankRecord (id, type); for (std::map::const_iterator iter (data.begin()); iter!=data.end(); ++iter) - mIdCollection->setData (index, iter->first, iter->second); + { + int columnIndex = getModelIndex(id, iter->first).column(); + if (mIdCollection->getColumn(columnIndex).isEditable()) + mIdCollection->setData(index, iter->first, iter->second); + } endInsertRows(); } From e6863c8f796ee4e4fe77589e22d722e3a837cc39 Mon Sep 17 00:00:00 2001 From: Rob Cutmore Date: Sun, 8 May 2016 06:05:52 -0400 Subject: [PATCH 2/3] Editor: Undo editable column check in record add --- apps/opencs/model/world/idtable.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/apps/opencs/model/world/idtable.cpp b/apps/opencs/model/world/idtable.cpp index 5f50f2210..cebd0ebdb 100644 --- a/apps/opencs/model/world/idtable.cpp +++ b/apps/opencs/model/world/idtable.cpp @@ -160,9 +160,7 @@ void CSMWorld::IdTable::addRecordWithData (const std::string& id, for (std::map::const_iterator iter (data.begin()); iter!=data.end(); ++iter) { - int columnIndex = getModelIndex(id, iter->first).column(); - if (mIdCollection->getColumn(columnIndex).isEditable()) - mIdCollection->setData(index, iter->first, iter->second); + mIdCollection->setData(index, iter->first, iter->second); } endInsertRows(); From 547d783eacdeffa7b04ec6fd596d2cbb4e60afae Mon Sep 17 00:00:00 2001 From: Rob Cutmore Date: Sun, 8 May 2016 06:09:40 -0400 Subject: [PATCH 3/3] Editor: Remove overridden configureCreateCommand StartScriptCreator was incorrectly overriding configureCreateCommand. This caused issues trying to edit an uneditable column while adding a new record. --- apps/opencs/view/world/startscriptcreator.cpp | 9 --------- apps/opencs/view/world/startscriptcreator.hpp | 4 ---- 2 files changed, 13 deletions(-) diff --git a/apps/opencs/view/world/startscriptcreator.cpp b/apps/opencs/view/world/startscriptcreator.cpp index 1ffcdf06a..891199027 100644 --- a/apps/opencs/view/world/startscriptcreator.cpp +++ b/apps/opencs/view/world/startscriptcreator.cpp @@ -24,15 +24,6 @@ CSMWorld::IdTable& CSVWorld::StartScriptCreator::getStartScriptsTable() const ); } -void CSVWorld::StartScriptCreator::configureCreateCommand(CSMWorld::CreateCommand& command) const -{ - CSMWorld::IdTable& table = getStartScriptsTable(); - int column = table.findColumnIndex(CSMWorld::Columns::ColumnId_Id); - - // Set script ID to be added to start scripts table. - command.addValue(column, mScript->text()); -} - CSVWorld::StartScriptCreator::StartScriptCreator( CSMWorld::Data &data, QUndoStack &undoStack, diff --git a/apps/opencs/view/world/startscriptcreator.hpp b/apps/opencs/view/world/startscriptcreator.hpp index 473e2fd5f..72eb67bcc 100644 --- a/apps/opencs/view/world/startscriptcreator.hpp +++ b/apps/opencs/view/world/startscriptcreator.hpp @@ -31,10 +31,6 @@ namespace CSVWorld /// \return reference to table containing start scripts. CSMWorld::IdTable& getStartScriptsTable() const; - /// \brief Add user input to command for creating start script. - /// \param command Creation command to configure. - virtual void configureCreateCommand(CSMWorld::CreateCommand& command) const; - public: StartScriptCreator(