diff --git a/apps/opencs/view/world/table.cpp b/apps/opencs/view/world/table.cpp index 5f26c912c..05b64af01 100644 --- a/apps/opencs/view/world/table.cpp +++ b/apps/opencs/view/world/table.cpp @@ -55,15 +55,8 @@ void CSVWorld::Table::contextMenuEvent (QContextMenuEvent *event) /// \todo add menu items for select all and clear selection { - // Feature #1226 "Request UniversalId editing from table columns". + // Request UniversalId editing from table columns. - if ( mGotoRefUid ) - { - delete mGotoRefUid; - - mGotoRefUid = 0; - } - int currRow = rowAt( event->y() ), currCol = columnAt( event->x() ); @@ -82,11 +75,11 @@ void CSVWorld::Table::contextMenuEvent (QContextMenuEvent *event) if ( !cellData.isEmpty() && colUidType != CSMWorld::UniversalId::Type::Type_None ) { - menu.addAction( mGotoRefAction ); - menu.addSeparator(); + mEditCellAction->setText(tr("Edit '").append(cellData).append("'")); + + menu.addAction( mEditCellAction ); - mGotoRefUid = - new CSMWorld::UniversalId( colUidType, cellData.toUtf8().constData() ); + mEditCellId = CSMWorld::UniversalId( colUidType, cellData.toUtf8().constData() ); } } @@ -255,9 +248,9 @@ CSVWorld::Table::Table (const CSMWorld::UniversalId& id, connect (mMoveDownAction, SIGNAL (triggered()), this, SLOT (moveDownRecord())); addAction (mMoveDownAction); - mGotoRefAction = new QAction( tr("Go to Reference"), this ); - connect( mGotoRefAction, SIGNAL(triggered()), this, SLOT(gotoReference()) ); - addAction( mGotoRefAction ); + mEditCellAction = new QAction( tr("Edit Cell"), this ); + connect( mEditCellAction, SIGNAL(triggered()), this, SLOT(editCell()) ); + addAction( mEditCellAction ); mViewAction = new QAction (tr ("View"), this); connect (mViewAction, SIGNAL (triggered()), this, SLOT (viewRecord())); @@ -404,9 +397,9 @@ void CSVWorld::Table::moveDownRecord() } } -void CSVWorld::Table::gotoReference() +void CSVWorld::Table::editCell() { - emit editRequest( *mGotoRefUid, std::string() ); + emit editRequest( mEditCellId, std::string() ); } void CSVWorld::Table::viewRecord() diff --git a/apps/opencs/view/world/table.hpp b/apps/opencs/view/world/table.hpp index 6e3e8971e..a80a0b362 100644 --- a/apps/opencs/view/world/table.hpp +++ b/apps/opencs/view/world/table.hpp @@ -8,6 +8,7 @@ #include "../../model/filter/node.hpp" #include "../../model/world/columnbase.hpp" +#include "../../model/world/universalid.hpp" #include "dragrecordtable.hpp" class QUndoStack; @@ -21,7 +22,6 @@ namespace CSMDoc namespace CSMWorld { class Data; - class UniversalId; class IdTableProxyModel; class IdTableBase; class CommandDispatcher; @@ -45,7 +45,7 @@ namespace CSVWorld QAction *mMoveUpAction; QAction *mMoveDownAction; QAction *mViewAction; - QAction *mGotoRefAction; + QAction *mEditCellAction; QAction *mPreviewAction; QAction *mExtendedDeleteAction; QAction *mExtendedRevertAction; @@ -54,7 +54,7 @@ namespace CSVWorld int mRecordStatusDisplay; CSMWorld::CommandDispatcher *mDispatcher; - CSMWorld::UniversalId *mGotoRefUid = 0; + CSMWorld::UniversalId mEditCellId; private: @@ -96,7 +96,7 @@ namespace CSVWorld private slots: - void gotoReference(); + void editCell(); void editRecord();