aboutsummaryrefslogtreecommitdiff
path: root/src/qt
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-02-23 11:09:10 +0100
committerMarcoFalke <falke.marco@gmail.com>2021-02-23 11:09:16 +0100
commitd386b54239877329e3f3f9e224de695153f08b5f (patch)
treebeacd9de5d8b20dd562ed793e738dbfde3f9695b /src/qt
parent1e7dd584a5f998a5b307285a7bc29ea4ad63ebc8 (diff)
parente348d7ea2c0b5d2eb8039dab33b0b9a48655885f (diff)
downloadbitcoin-d386b54239877329e3f3f9e224de695153f08b5f.tar.xz
Merge bitcoin-core/gui#213: qt: Add Copy Address Action to Payment Requests
e348d7ea2c0b5d2eb8039dab33b0b9a48655885f qt: Add Copy Address Action to Payment Requests (Jarol Rodriguez) Pull request description: 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 PR adds a convenient context menu action to copy the address of a payment request. | Master | PR | | ----------- | ------------ | |<img width="169" alt="Screen Shot 2021-02-18 at 8 33 08 PM" src="https://user-images.githubusercontent.com/23396902/108444489-b6703f80-7228-11eb-8684-945fbcd04772.png"> |<img width="169" alt="Screen Shot 2021-02-18 at 8 33 50 PM" src="https://user-images.githubusercontent.com/23396902/108444505-c12ad480-7228-11eb-9eee-473fee877ad7.png">| ACKs for top commit: hebasto: re-ACK e348d7ea2c0b5d2eb8039dab33b0b9a48655885f, only suggested changes since my [previous](https://github.com/bitcoin-core/gui/pull/213#pullrequestreview-595520204) review. Tree-SHA512: 2b75930ca326ef1d695afc1c6f25853ef55d06d20b66c3c3c372188a6cdfa4686c07f9c56824b766e46b660c731f8a9c2e5b935aa26b316fd46f9e396b29b802
Diffstat (limited to 'src/qt')
-rw-r--r--src/qt/receivecoinsdialog.cpp16
-rw-r--r--src/qt/receivecoinsdialog.h1
2 files changed, 17 insertions, 0 deletions
diff --git a/src/qt/receivecoinsdialog.cpp b/src/qt/receivecoinsdialog.cpp
index 49725a0d33..62adaa4e9f 100644
--- a/src/qt/receivecoinsdialog.cpp
+++ b/src/qt/receivecoinsdialog.cpp
@@ -44,6 +44,7 @@ ReceiveCoinsDialog::ReceiveCoinsDialog(const PlatformStyle *_platformStyle, QWid
// context menu actions
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 *copyMessageAction = new QAction(tr("Copy message"), this);
QAction *copyAmountAction = new QAction(tr("Copy amount"), this);
@@ -51,6 +52,7 @@ ReceiveCoinsDialog::ReceiveCoinsDialog(const PlatformStyle *_platformStyle, QWid
// context menu
contextMenu = new QMenu(this);
contextMenu->addAction(copyURIAction);
+ contextMenu->addAction(copyAddressAction);
contextMenu->addAction(copyLabelAction);
contextMenu->addAction(copyMessageAction);
contextMenu->addAction(copyAmountAction);
@@ -58,6 +60,7 @@ ReceiveCoinsDialog::ReceiveCoinsDialog(const PlatformStyle *_platformStyle, QWid
// context menu signals
connect(ui->recentRequestsView, &QWidget::customContextMenuRequested, this, &ReceiveCoinsDialog::showMenu);
connect(copyURIAction, &QAction::triggered, this, &ReceiveCoinsDialog::copyURI);
+ connect(copyAddressAction, &QAction::triggered, this, &ReceiveCoinsDialog::copyAddress);
connect(copyLabelAction, &QAction::triggered, this, &ReceiveCoinsDialog::copyLabel);
connect(copyMessageAction, &QAction::triggered, this, &ReceiveCoinsDialog::copyMessage);
connect(copyAmountAction, &QAction::triggered, this, &ReceiveCoinsDialog::copyAmount);
@@ -285,6 +288,19 @@ void ReceiveCoinsDialog::copyURI()
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
void ReceiveCoinsDialog::copyLabel()
{
diff --git a/src/qt/receivecoinsdialog.h b/src/qt/receivecoinsdialog.h
index 1ef84640f2..f12cd8ce0c 100644
--- a/src/qt/receivecoinsdialog.h
+++ b/src/qt/receivecoinsdialog.h
@@ -67,6 +67,7 @@ private Q_SLOTS:
void updateDisplayUnit();
void showMenu(const QPoint &point);
void copyURI();
+ void copyAddress();
void copyLabel();
void copyMessage();
void copyAmount();