1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 07:53:53 +00:00

do not offer view action for cells flagged as deleted

This commit is contained in:
Marc Zinnschlag 2014-03-06 13:43:06 +01:00
parent 4a119c8f46
commit f04348fb8e
2 changed files with 12 additions and 2 deletions

View file

@ -40,7 +40,16 @@ void CSVWorld::Table::contextMenuEvent (QContextMenuEvent *event)
menu.addAction(mCloneAction);
if (mModel->getViewing()!=CSMWorld::IdTable::Viewing_None)
menu.addAction (mViewAction);
{
int row = selectedRows.begin()->row();
row = mProxyModel->mapToSource (mProxyModel->index (row, 0)).row();
CSMWorld::UniversalId id = mModel->view (row).first;
if (!mData.getCells().getRecord (id.getId()).isDeleted())
menu.addAction (mViewAction);
}
}
if (mCreateAction)
@ -168,7 +177,7 @@ std::vector<std::string> CSVWorld::Table::listDeletableSelectedIds() const
CSVWorld::Table::Table (const CSMWorld::UniversalId& id, CSMWorld::Data& data, QUndoStack& undoStack,
bool createAndDelete, bool sorting, const CSMDoc::Document& document)
: mUndoStack (undoStack), mCreateAction (0), mCloneAction(0), mEditLock (false), mRecordStatusDisplay (0), mDocument(document)
: mUndoStack (undoStack), mCreateAction (0), mCloneAction(0), mEditLock (false), mRecordStatusDisplay (0), mDocument(document), mData (data)
{
mModel = &dynamic_cast<CSMWorld::IdTable&> (*data.getTableModel (id));

View file

@ -48,6 +48,7 @@ namespace CSVWorld
CSMWorld::IdTable *mModel;
bool mEditLock;
int mRecordStatusDisplay;
CSMWorld::Data& mData;
/// \brief This variable is used exclusivly for checking if dropEvents came from the same document. Most likely you
/// should NOT use it for anything else.