Skip to content

Commit d386b54

Browse files
author
MarcoFalke
committed
Merge #213: qt: Add Copy Address Action to Payment Requests
e348d7e 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 e348d7e, only suggested changes since my [previous](#213 (review)) review. Tree-SHA512: 2b75930ca326ef1d695afc1c6f25853ef55d06d20b66c3c3c372188a6cdfa4686c07f9c56824b766e46b660c731f8a9c2e5b935aa26b316fd46f9e396b29b802
2 parents 1e7dd58 + e348d7e commit d386b54

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/qt/receivecoinsdialog.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,23 @@ ReceiveCoinsDialog::ReceiveCoinsDialog(const PlatformStyle *_platformStyle, QWid
4444

4545
// context menu actions
4646
QAction *copyURIAction = new QAction(tr("Copy URI"), this);
47+
QAction* copyAddressAction = new QAction(tr("Copy address"), this);
4748
QAction *copyLabelAction = new QAction(tr("Copy label"), this);
4849
QAction *copyMessageAction = new QAction(tr("Copy message"), this);
4950
QAction *copyAmountAction = new QAction(tr("Copy amount"), this);
5051

5152
// context menu
5253
contextMenu = new QMenu(this);
5354
contextMenu->addAction(copyURIAction);
55+
contextMenu->addAction(copyAddressAction);
5456
contextMenu->addAction(copyLabelAction);
5557
contextMenu->addAction(copyMessageAction);
5658
contextMenu->addAction(copyAmountAction);
5759

5860
// context menu signals
5961
connect(ui->recentRequestsView, &QWidget::customContextMenuRequested, this, &ReceiveCoinsDialog::showMenu);
6062
connect(copyURIAction, &QAction::triggered, this, &ReceiveCoinsDialog::copyURI);
63+
connect(copyAddressAction, &QAction::triggered, this, &ReceiveCoinsDialog::copyAddress);
6164
connect(copyLabelAction, &QAction::triggered, this, &ReceiveCoinsDialog::copyLabel);
6265
connect(copyMessageAction, &QAction::triggered, this, &ReceiveCoinsDialog::copyMessage);
6366
connect(copyAmountAction, &QAction::triggered, this, &ReceiveCoinsDialog::copyAmount);
@@ -285,6 +288,19 @@ void ReceiveCoinsDialog::copyURI()
285288
GUIUtil::setClipboard(uri);
286289
}
287290

291+
// context menu action: copy address
292+
void ReceiveCoinsDialog::copyAddress()
293+
{
294+
const QModelIndex sel = selectedRow();
295+
if (!sel.isValid()) {
296+
return;
297+
}
298+
299+
const RecentRequestsTableModel* const submodel = model->getRecentRequestsTableModel();
300+
const QString address = submodel->entry(sel.row()).recipient.address;
301+
GUIUtil::setClipboard(address);
302+
}
303+
288304
// context menu action: copy label
289305
void ReceiveCoinsDialog::copyLabel()
290306
{

src/qt/receivecoinsdialog.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ private Q_SLOTS:
6767
void updateDisplayUnit();
6868
void showMenu(const QPoint &point);
6969
void copyURI();
70+
void copyAddress();
7071
void copyLabel();
7172
void copyMessage();
7273
void copyAmount();

0 commit comments

Comments
 (0)