From 11f8406be395607a4e3b095cc85560f855345111 Mon Sep 17 00:00:00 2001 From: mrdeveloper Date: Thu, 22 Oct 2020 13:17:13 +0200 Subject: [PATCH] History: don't show copy spend proof on incoming transactions --- src/historywidget.cpp | 7 ++++++- src/historywidget.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/historywidget.cpp b/src/historywidget.cpp index 2d6980d..489d759 100644 --- a/src/historywidget.cpp +++ b/src/historywidget.cpp @@ -25,12 +25,17 @@ HistoryWidget::HistoryWidget(QWidget *parent) m_copyMenu->addAction("Transaction ID", this, [this]{copy(copyField::TxID);}); m_copyMenu->addAction("Date", this, [this]{copy(copyField::Date);}); m_copyMenu->addAction("Amount", this, [this]{copy(copyField::Amount);}); - m_copyMenu->addAction("Spend proof", this, &HistoryWidget::getSpendProof); + auto spendProof = m_copyMenu->addAction("Spend proof", this, &HistoryWidget::getSpendProof); ui->history->setContextMenuPolicy(Qt::CustomContextMenu); connect(ui->history, &QTreeView::customContextMenuRequested, [=](const QPoint & point){ QModelIndex index = ui->history->indexAt(point); if (index.isValid()) { + TransactionInfo::Direction direction; + m_txHistory->transaction(m_model->mapToSource(index).row(), [&direction](TransactionInfo &tInfo) { + direction = tInfo.direction(); + }); + spendProof->setVisible(direction == TransactionInfo::Direction_Out); m_contextMenu->exec(ui->history->viewport()->mapToGlobal(point)); } }); diff --git a/src/historywidget.h b/src/historywidget.h index a6c8b00..b6e9fa8 100644 --- a/src/historywidget.h +++ b/src/historywidget.h @@ -46,6 +46,7 @@ private: }; void copy(copyField field); + void showContextMenu(const QPoint &point); Ui::HistoryWidget *ui; QMenu *m_contextMenu;