Feature #1226: fixes

This commit is contained in:
Stanislav 2014-09-17 09:03:02 +06:00
parent 8574d2330c
commit ebb223b2d3
2 changed files with 14 additions and 21 deletions

View file

@ -55,15 +55,8 @@ void CSVWorld::Table::contextMenuEvent (QContextMenuEvent *event)
/// \todo add menu items for select all and clear selection /// \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() ), int currRow = rowAt( event->y() ),
currCol = columnAt( event->x() ); currCol = columnAt( event->x() );
@ -82,11 +75,11 @@ void CSVWorld::Table::contextMenuEvent (QContextMenuEvent *event)
if ( !cellData.isEmpty() if ( !cellData.isEmpty()
&& colUidType != CSMWorld::UniversalId::Type::Type_None ) && colUidType != CSMWorld::UniversalId::Type::Type_None )
{ {
menu.addAction( mGotoRefAction ); mEditCellAction->setText(tr("Edit '").append(cellData).append("'"));
menu.addSeparator();
mGotoRefUid = menu.addAction( mEditCellAction );
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())); connect (mMoveDownAction, SIGNAL (triggered()), this, SLOT (moveDownRecord()));
addAction (mMoveDownAction); addAction (mMoveDownAction);
mGotoRefAction = new QAction( tr("Go to Reference"), this ); mEditCellAction = new QAction( tr("Edit Cell"), this );
connect( mGotoRefAction, SIGNAL(triggered()), this, SLOT(gotoReference()) ); connect( mEditCellAction, SIGNAL(triggered()), this, SLOT(editCell()) );
addAction( mGotoRefAction ); addAction( mEditCellAction );
mViewAction = new QAction (tr ("View"), this); mViewAction = new QAction (tr ("View"), this);
connect (mViewAction, SIGNAL (triggered()), this, SLOT (viewRecord())); 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() void CSVWorld::Table::viewRecord()

View file

@ -8,6 +8,7 @@
#include "../../model/filter/node.hpp" #include "../../model/filter/node.hpp"
#include "../../model/world/columnbase.hpp" #include "../../model/world/columnbase.hpp"
#include "../../model/world/universalid.hpp"
#include "dragrecordtable.hpp" #include "dragrecordtable.hpp"
class QUndoStack; class QUndoStack;
@ -21,7 +22,6 @@ namespace CSMDoc
namespace CSMWorld namespace CSMWorld
{ {
class Data; class Data;
class UniversalId;
class IdTableProxyModel; class IdTableProxyModel;
class IdTableBase; class IdTableBase;
class CommandDispatcher; class CommandDispatcher;
@ -45,7 +45,7 @@ namespace CSVWorld
QAction *mMoveUpAction; QAction *mMoveUpAction;
QAction *mMoveDownAction; QAction *mMoveDownAction;
QAction *mViewAction; QAction *mViewAction;
QAction *mGotoRefAction; QAction *mEditCellAction;
QAction *mPreviewAction; QAction *mPreviewAction;
QAction *mExtendedDeleteAction; QAction *mExtendedDeleteAction;
QAction *mExtendedRevertAction; QAction *mExtendedRevertAction;
@ -54,7 +54,7 @@ namespace CSVWorld
int mRecordStatusDisplay; int mRecordStatusDisplay;
CSMWorld::CommandDispatcher *mDispatcher; CSMWorld::CommandDispatcher *mDispatcher;
CSMWorld::UniversalId *mGotoRefUid = 0; CSMWorld::UniversalId mEditCellId;
private: private:
@ -96,7 +96,7 @@ namespace CSVWorld
private slots: private slots:
void gotoReference(); void editCell();
void editRecord(); void editRecord();