mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 18:53:23 -03:00
qt: Add Copy Address Action to Payment Requests
Currently, the only way to copy the address of a payment request is to double-click on the payment request and then click on the copy address button. This commit adds a convenient context menu action to copy the address of a payment request.
This commit is contained in:
parent
5bb64acd9d
commit
e348d7ea2c
2 changed files with 17 additions and 0 deletions
|
@ -44,6 +44,7 @@ ReceiveCoinsDialog::ReceiveCoinsDialog(const PlatformStyle *_platformStyle, QWid
|
||||||
|
|
||||||
// context menu actions
|
// context menu actions
|
||||||
QAction *copyURIAction = new QAction(tr("Copy URI"), this);
|
QAction *copyURIAction = new QAction(tr("Copy URI"), this);
|
||||||
|
QAction* copyAddressAction = new QAction(tr("Copy address"), this);
|
||||||
QAction *copyLabelAction = new QAction(tr("Copy label"), this);
|
QAction *copyLabelAction = new QAction(tr("Copy label"), this);
|
||||||
QAction *copyMessageAction = new QAction(tr("Copy message"), this);
|
QAction *copyMessageAction = new QAction(tr("Copy message"), this);
|
||||||
QAction *copyAmountAction = new QAction(tr("Copy amount"), this);
|
QAction *copyAmountAction = new QAction(tr("Copy amount"), this);
|
||||||
|
@ -51,6 +52,7 @@ ReceiveCoinsDialog::ReceiveCoinsDialog(const PlatformStyle *_platformStyle, QWid
|
||||||
// context menu
|
// context menu
|
||||||
contextMenu = new QMenu(this);
|
contextMenu = new QMenu(this);
|
||||||
contextMenu->addAction(copyURIAction);
|
contextMenu->addAction(copyURIAction);
|
||||||
|
contextMenu->addAction(copyAddressAction);
|
||||||
contextMenu->addAction(copyLabelAction);
|
contextMenu->addAction(copyLabelAction);
|
||||||
contextMenu->addAction(copyMessageAction);
|
contextMenu->addAction(copyMessageAction);
|
||||||
contextMenu->addAction(copyAmountAction);
|
contextMenu->addAction(copyAmountAction);
|
||||||
|
@ -58,6 +60,7 @@ ReceiveCoinsDialog::ReceiveCoinsDialog(const PlatformStyle *_platformStyle, QWid
|
||||||
// context menu signals
|
// context menu signals
|
||||||
connect(ui->recentRequestsView, &QWidget::customContextMenuRequested, this, &ReceiveCoinsDialog::showMenu);
|
connect(ui->recentRequestsView, &QWidget::customContextMenuRequested, this, &ReceiveCoinsDialog::showMenu);
|
||||||
connect(copyURIAction, &QAction::triggered, this, &ReceiveCoinsDialog::copyURI);
|
connect(copyURIAction, &QAction::triggered, this, &ReceiveCoinsDialog::copyURI);
|
||||||
|
connect(copyAddressAction, &QAction::triggered, this, &ReceiveCoinsDialog::copyAddress);
|
||||||
connect(copyLabelAction, &QAction::triggered, this, &ReceiveCoinsDialog::copyLabel);
|
connect(copyLabelAction, &QAction::triggered, this, &ReceiveCoinsDialog::copyLabel);
|
||||||
connect(copyMessageAction, &QAction::triggered, this, &ReceiveCoinsDialog::copyMessage);
|
connect(copyMessageAction, &QAction::triggered, this, &ReceiveCoinsDialog::copyMessage);
|
||||||
connect(copyAmountAction, &QAction::triggered, this, &ReceiveCoinsDialog::copyAmount);
|
connect(copyAmountAction, &QAction::triggered, this, &ReceiveCoinsDialog::copyAmount);
|
||||||
|
@ -287,6 +290,19 @@ void ReceiveCoinsDialog::copyURI()
|
||||||
GUIUtil::setClipboard(uri);
|
GUIUtil::setClipboard(uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// context menu action: copy address
|
||||||
|
void ReceiveCoinsDialog::copyAddress()
|
||||||
|
{
|
||||||
|
const QModelIndex sel = selectedRow();
|
||||||
|
if (!sel.isValid()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const RecentRequestsTableModel* const submodel = model->getRecentRequestsTableModel();
|
||||||
|
const QString address = submodel->entry(sel.row()).recipient.address;
|
||||||
|
GUIUtil::setClipboard(address);
|
||||||
|
}
|
||||||
|
|
||||||
// context menu action: copy label
|
// context menu action: copy label
|
||||||
void ReceiveCoinsDialog::copyLabel()
|
void ReceiveCoinsDialog::copyLabel()
|
||||||
{
|
{
|
||||||
|
|
|
@ -69,6 +69,7 @@ private Q_SLOTS:
|
||||||
void updateDisplayUnit();
|
void updateDisplayUnit();
|
||||||
void showMenu(const QPoint &point);
|
void showMenu(const QPoint &point);
|
||||||
void copyURI();
|
void copyURI();
|
||||||
|
void copyAddress();
|
||||||
void copyLabel();
|
void copyLabel();
|
||||||
void copyMessage();
|
void copyMessage();
|
||||||
void copyAmount();
|
void copyAmount();
|
||||||
|
|
Loading…
Add table
Reference in a new issue