diff --git a/src/qt/forms/receivecoinsdialog.ui b/src/qt/forms/receivecoinsdialog.ui
index 3e1a8bccc..e1a0a28f8 100644
--- a/src/qt/forms/receivecoinsdialog.ui
+++ b/src/qt/forms/receivecoinsdialog.ui
@@ -263,6 +263,9 @@
Show
+
+ false
+
:/icons/edit:/icons/edit
@@ -277,6 +280,9 @@
Remove
+
+ false
+
:/icons/remove:/icons/remove
diff --git a/src/qt/receivecoinsdialog.cpp b/src/qt/receivecoinsdialog.cpp
index 7539645b4..2af3949ae 100644
--- a/src/qt/receivecoinsdialog.cpp
+++ b/src/qt/receivecoinsdialog.cpp
@@ -19,6 +19,7 @@
#include
#include
#include
+#include
ReceiveCoinsDialog::ReceiveCoinsDialog(QWidget *parent) :
QDialog(parent),
@@ -77,6 +78,11 @@ void ReceiveCoinsDialog::setModel(WalletModel *model)
ui->recentRequestsView->horizontalHeader()->resizeSection(RecentRequestsTableModel::Amount, 100);
model->getRecentRequestsTableModel()->sort(RecentRequestsTableModel::Date, Qt::DescendingOrder);
+
+ connect(ui->recentRequestsView->selectionModel(),
+ SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
+ this,
+ SLOT(on_recentRequestsView_selectionChanged(QItemSelection, QItemSelection)));
}
}
@@ -161,6 +167,15 @@ void ReceiveCoinsDialog::on_recentRequestsView_doubleClicked(const QModelIndex &
dialog->show();
}
+void ReceiveCoinsDialog::on_recentRequestsView_selectionChanged(const QItemSelection &selected,
+ const QItemSelection &deselected)
+{
+ // Enable Show/Remove buttons only if anything is selected.
+ bool enable = !ui->recentRequestsView->selectionModel()->selectedRows().isEmpty();
+ ui->showRequestButton->setEnabled(enable);
+ ui->removeRequestButton->setEnabled(enable);
+}
+
void ReceiveCoinsDialog::on_showRequestButton_clicked()
{
if(!model || !model->getRecentRequestsTableModel() || !ui->recentRequestsView->selectionModel())
diff --git a/src/qt/receivecoinsdialog.h b/src/qt/receivecoinsdialog.h
index 12d223578..bfe8b3401 100644
--- a/src/qt/receivecoinsdialog.h
+++ b/src/qt/receivecoinsdialog.h
@@ -10,6 +10,7 @@
#include
#include
#include
+#include
namespace Ui {
class ReceiveCoinsDialog;
@@ -51,6 +52,7 @@ private slots:
void on_showRequestButton_clicked();
void on_removeRequestButton_clicked();
void on_recentRequestsView_doubleClicked(const QModelIndex &index);
+ void on_recentRequestsView_selectionChanged(const QItemSelection &, const QItemSelection &);
void updateDisplayUnit();
void showMenu(const QPoint &);
void copyLabel();