Skip to content

Commit 10c6929

Browse files
committed
Include vout when copying transaction ID from coin selection
1 parent b55232a commit 10c6929

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/qt/coincontroldialog.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ CoinControlDialog::CoinControlDialog(CCoinControl& coin_control, WalletModel* _m
5555
contextMenu->addAction(tr("&Copy address"), this, &CoinControlDialog::copyAddress);
5656
contextMenu->addAction(tr("Copy &label"), this, &CoinControlDialog::copyLabel);
5757
contextMenu->addAction(tr("Copy &amount"), this, &CoinControlDialog::copyAmount);
58-
copyTransactionHashAction = contextMenu->addAction(tr("Copy transaction &ID"), this, &CoinControlDialog::copyTransactionHash);
58+
m_copy_transaction_outpoint_action = contextMenu->addAction(tr("Copy transaction &ID and output index"), this, &CoinControlDialog::copyTransactionOutpoint);
5959
contextMenu->addSeparator();
6060
lockAction = contextMenu->addAction(tr("L&ock unspent"), this, &CoinControlDialog::lockCoin);
6161
unlockAction = contextMenu->addAction(tr("&Unlock unspent"), this, &CoinControlDialog::unlockCoin);
@@ -180,7 +180,7 @@ void CoinControlDialog::showMenu(const QPoint &point)
180180
// disable some items (like Copy Transaction ID, lock, unlock) for tree roots in context menu
181181
if (item->data(COLUMN_ADDRESS, TxHashRole).toString().length() == 64) // transaction hash is 64 characters (this means it is a child node, so it is not a parent node in tree mode)
182182
{
183-
copyTransactionHashAction->setEnabled(true);
183+
m_copy_transaction_outpoint_action->setEnabled(true);
184184
if (model->wallet().isLockedCoin(COutPoint(uint256S(item->data(COLUMN_ADDRESS, TxHashRole).toString().toStdString()), item->data(COLUMN_ADDRESS, VOutRole).toUInt())))
185185
{
186186
lockAction->setEnabled(false);
@@ -194,7 +194,7 @@ void CoinControlDialog::showMenu(const QPoint &point)
194194
}
195195
else // this means click on parent node in tree mode -> disable all
196196
{
197-
copyTransactionHashAction->setEnabled(false);
197+
m_copy_transaction_outpoint_action->setEnabled(false);
198198
lockAction->setEnabled(false);
199199
unlockAction->setEnabled(false);
200200
}
@@ -228,10 +228,14 @@ void CoinControlDialog::copyAddress()
228228
GUIUtil::setClipboard(contextMenuItem->text(COLUMN_ADDRESS));
229229
}
230230

231-
// context menu action: copy transaction id
232-
void CoinControlDialog::copyTransactionHash()
231+
// context menu action: copy transaction id and vout index
232+
void CoinControlDialog::copyTransactionOutpoint()
233233
{
234-
GUIUtil::setClipboard(contextMenuItem->data(COLUMN_ADDRESS, TxHashRole).toString());
234+
const QString address = contextMenuItem->data(COLUMN_ADDRESS, TxHashRole).toString();
235+
const QString vout = contextMenuItem->data(COLUMN_ADDRESS, VOutRole).toString();
236+
const QString outpoint = QString("%1:%2").arg(address).arg(vout);
237+
238+
GUIUtil::setClipboard(outpoint);
235239
}
236240

237241
// context menu action: lock coin

src/qt/coincontroldialog.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class CoinControlDialog : public QDialog
6363

6464
QMenu *contextMenu;
6565
QTreeWidgetItem *contextMenuItem;
66-
QAction *copyTransactionHashAction;
66+
QAction* m_copy_transaction_outpoint_action;
6767
QAction *lockAction;
6868
QAction *unlockAction;
6969

@@ -95,7 +95,7 @@ private Q_SLOTS:
9595
void copyAmount();
9696
void copyLabel();
9797
void copyAddress();
98-
void copyTransactionHash();
98+
void copyTransactionOutpoint();
9999
void lockCoin();
100100
void unlockCoin();
101101
void clipboardQuantity();

0 commit comments

Comments
 (0)