|
|
|
@ -60,6 +60,9 @@ void CSVWorld::Table::contextMenuEvent (QContextMenuEvent *event)
|
|
|
|
|
menu.addAction(mCloneAction);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mTouchAction)
|
|
|
|
|
menu.addAction (mTouchAction);
|
|
|
|
|
|
|
|
|
|
if (mCreateAction)
|
|
|
|
|
menu.addAction (mCreateAction);
|
|
|
|
|
|
|
|
|
@ -226,8 +229,8 @@ void CSVWorld::Table::mouseDoubleClickEvent (QMouseEvent *event)
|
|
|
|
|
|
|
|
|
|
CSVWorld::Table::Table (const CSMWorld::UniversalId& id,
|
|
|
|
|
bool createAndDelete, bool sorting, CSMDoc::Document& document)
|
|
|
|
|
: DragRecordTable(document), mCreateAction (0),
|
|
|
|
|
mCloneAction(0), mRecordStatusDisplay (0), mJumpToAddedRecord(false), mUnselectAfterJump(false)
|
|
|
|
|
: DragRecordTable(document), mCreateAction (nullptr), mCloneAction(nullptr), mTouchAction(nullptr),
|
|
|
|
|
mRecordStatusDisplay (0), mJumpToAddedRecord(false), mUnselectAfterJump(false)
|
|
|
|
|
{
|
|
|
|
|
mModel = &dynamic_cast<CSMWorld::IdTableBase&> (*mDocument.getData().getTableModel (id));
|
|
|
|
|
|
|
|
|
@ -302,6 +305,15 @@ CSVWorld::Table::Table (const CSMWorld::UniversalId& id,
|
|
|
|
|
cloneShortcut->associateAction(mCloneAction);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mModel->getFeatures() & CSMWorld::IdTableBase::Feature_AllowTouch)
|
|
|
|
|
{
|
|
|
|
|
mTouchAction = new QAction(tr("Touch Record"), this);
|
|
|
|
|
connect(mTouchAction, SIGNAL(triggered()), this, SLOT(touchRecord()));
|
|
|
|
|
addAction(mTouchAction);
|
|
|
|
|
CSMPrefs::Shortcut* touchShortcut = new CSMPrefs::Shortcut("table-touch", this);
|
|
|
|
|
touchShortcut->associateAction(mTouchAction);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mRevertAction = new QAction (tr ("Revert Record"), this);
|
|
|
|
|
connect (mRevertAction, SIGNAL (triggered()), mDispatcher, SLOT (executeRevert()));
|
|
|
|
|
addAction (mRevertAction);
|
|
|
|
@ -442,6 +454,30 @@ void CSVWorld::Table::cloneRecord()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSVWorld::Table::touchRecord()
|
|
|
|
|
{
|
|
|
|
|
if (!mEditLock && mModel->getFeatures() & CSMWorld::IdTableBase::Feature_AllowTouch)
|
|
|
|
|
{
|
|
|
|
|
if (CSMWorld::IdTable* table = dynamic_cast<CSMWorld::IdTable*>(mModel))
|
|
|
|
|
{
|
|
|
|
|
QUndoCommand* touchRecords = new QUndoCommand();
|
|
|
|
|
touchRecords->setText("Touch records");
|
|
|
|
|
|
|
|
|
|
QModelIndexList selectedRows = selectionModel()->selectedRows();
|
|
|
|
|
for (auto it = selectedRows.begin(); it != selectedRows.end(); ++it)
|
|
|
|
|
{
|
|
|
|
|
QModelIndex index = mProxyModel->mapToSource(mProxyModel->index(it->row(),0));
|
|
|
|
|
std::string id = table->getId(index.row());
|
|
|
|
|
|
|
|
|
|
// command is a child of touchRecords
|
|
|
|
|
QUndoCommand* command = new CSMWorld::TouchCommand(*table, id, touchRecords);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mDocument.getUndoStack().push(touchRecords);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSVWorld::Table::moveUpRecord()
|
|
|
|
|
{
|
|
|
|
|
if (mEditLock || (mModel->getFeatures() & CSMWorld::IdTableBase::Feature_Constant))
|
|
|
|
|