Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions src/qt/coincontroldialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ CoinControlDialog::CoinControlDialog(CCoinControl& coin_control, WalletModel* _m
contextMenu->addAction(tr("&Copy address"), this, &CoinControlDialog::copyAddress);
contextMenu->addAction(tr("Copy &label"), this, &CoinControlDialog::copyLabel);
contextMenu->addAction(tr("Copy &amount"), this, &CoinControlDialog::copyAmount);
copyTransactionHashAction = contextMenu->addAction(tr("Copy transaction &ID"), this, &CoinControlDialog::copyTransactionHash);
m_copy_transaction_outpoint_action = contextMenu->addAction(tr("Copy transaction &ID and output index"), this, &CoinControlDialog::copyTransactionOutpoint);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anything against having both actions?

Copy link
Contributor Author

@meshcollider meshcollider Sep 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@promag seems a bit more GUI clutter for no purpose. It's a manual action touching the clipboard so it can't interfere with any automation, so the user can always just manually delete the :n on the end if they don't want it. IMO txid alone is useless in this situation because this is a specific outpoint selection dialog.

contextMenu->addSeparator();
lockAction = contextMenu->addAction(tr("L&ock unspent"), this, &CoinControlDialog::lockCoin);
unlockAction = contextMenu->addAction(tr("&Unlock unspent"), this, &CoinControlDialog::unlockCoin);
Expand Down Expand Up @@ -180,7 +180,7 @@ void CoinControlDialog::showMenu(const QPoint &point)
// disable some items (like Copy Transaction ID, lock, unlock) for tree roots in context menu
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)
{
copyTransactionHashAction->setEnabled(true);
m_copy_transaction_outpoint_action->setEnabled(true);
if (model->wallet().isLockedCoin(COutPoint(uint256S(item->data(COLUMN_ADDRESS, TxHashRole).toString().toStdString()), item->data(COLUMN_ADDRESS, VOutRole).toUInt())))
{
lockAction->setEnabled(false);
Expand All @@ -194,7 +194,7 @@ void CoinControlDialog::showMenu(const QPoint &point)
}
else // this means click on parent node in tree mode -> disable all
{
copyTransactionHashAction->setEnabled(false);
m_copy_transaction_outpoint_action->setEnabled(false);
lockAction->setEnabled(false);
unlockAction->setEnabled(false);
}
Expand Down Expand Up @@ -228,10 +228,14 @@ void CoinControlDialog::copyAddress()
GUIUtil::setClipboard(contextMenuItem->text(COLUMN_ADDRESS));
}

// context menu action: copy transaction id
void CoinControlDialog::copyTransactionHash()
// context menu action: copy transaction id and vout index
void CoinControlDialog::copyTransactionOutpoint()
{
GUIUtil::setClipboard(contextMenuItem->data(COLUMN_ADDRESS, TxHashRole).toString());
const QString address = contextMenuItem->data(COLUMN_ADDRESS, TxHashRole).toString();
const QString vout = contextMenuItem->data(COLUMN_ADDRESS, VOutRole).toString();
const QString outpoint = QString("%1:%2").arg(address).arg(vout);

GUIUtil::setClipboard(outpoint);
}

// context menu action: lock coin
Expand Down
4 changes: 2 additions & 2 deletions src/qt/coincontroldialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class CoinControlDialog : public QDialog

QMenu *contextMenu;
QTreeWidgetItem *contextMenuItem;
QAction *copyTransactionHashAction;
QAction* m_copy_transaction_outpoint_action;
QAction *lockAction;
QAction *unlockAction;

Expand Down Expand Up @@ -95,7 +95,7 @@ private Q_SLOTS:
void copyAmount();
void copyLabel();
void copyAddress();
void copyTransactionHash();
void copyTransactionOutpoint();
void lockCoin();
void unlockCoin();
void clipboardQuantity();
Expand Down