From 8a9da365dc8ac93e5c33ef6f58ab4b2905c1ca83 Mon Sep 17 00:00:00 2001 From: Aditya Kulkarni Date: Wed, 14 Nov 2018 22:38:22 -0800 Subject: [PATCH] #53 Allow copying addr from tx table --- src/mainwindow.cpp | 10 ++++++++++ src/txtablemodel.cpp | 4 ++++ src/txtablemodel.h | 1 + 3 files changed, 15 insertions(+) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 715da23..231852d 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -796,11 +796,20 @@ void MainWindow::setupTransactionsTab() { QString txid = txModel->getTxId(index.row()); QString memo = txModel->getMemo(index.row()); + QString addr = txModel->getAddr(index.row()); menu.addAction("Copy txid", [=] () { QGuiApplication::clipboard()->setText(txid); ui->statusBar->showMessage("Copied to clipboard", 3 * 1000); }); + + if (!addr.isEmpty()) { + menu.addAction("Copy Address", [=] () { + QGuiApplication::clipboard()->setText(addr); + ui->statusBar->showMessage("Copied to clipboard", 3 * 1000); + }); + } + menu.addAction("View on block explorer", [=] () { QString url; if (Settings::getInstance()->isTestnet()) { @@ -810,6 +819,7 @@ void MainWindow::setupTransactionsTab() { } QDesktopServices::openUrl(QUrl(url)); }); + if (!memo.isEmpty()) { menu.addAction("View Memo", [=] () { QMessageBox::information(this, "Memo", memo, QMessageBox::Ok); diff --git a/src/txtablemodel.cpp b/src/txtablemodel.cpp index 73733cb..7b88c1b 100644 --- a/src/txtablemodel.cpp +++ b/src/txtablemodel.cpp @@ -163,3 +163,7 @@ QString TxTableModel::getTxId(int row) { QString TxTableModel::getMemo(int row) { return modeldata->at(row).memo; } + +QString TxTableModel::getAddr(int row) { + return modeldata->at(row).address.trimmed(); +} \ No newline at end of file diff --git a/src/txtablemodel.h b/src/txtablemodel.h index 27de88f..fb149cf 100644 --- a/src/txtablemodel.h +++ b/src/txtablemodel.h @@ -17,6 +17,7 @@ public: QString getTxId(int row); QString getMemo(int row); + QString getAddr(int row); int rowCount(const QModelIndex &parent) const; int columnCount(const QModelIndex &parent) const;