diff --git a/doc/release-notes.md b/doc/release-notes.md
index ea5f9d23d..127277b3a 100644
--- a/doc/release-notes.md
+++ b/doc/release-notes.md
@@ -1,11 +1,11 @@
Bitcoin ABC version 0.19.4 is now available from:
This release includes the following features and fixes:
- Added to `getblockchaininfo` `size_on_disk` and, when the prune option is
enabled, `prune_height`, `automatic_pruning`, and `prune_target_size`.
- The help message also reflects this.
- Code standard updated to c++14.
- Remove `depends` from transaction objects provided by `getblocktemplate`.
-
\ No newline at end of file
+ - The option to reuse exisiting receiving addresses has been removed from the wallet.
diff --git a/src/qt/forms/receivecoinsdialog.ui b/src/qt/forms/receivecoinsdialog.ui
index 03fcb2fb5..2ca296bc2 100644
--- a/src/qt/forms/receivecoinsdialog.ui
+++ b/src/qt/forms/receivecoinsdialog.ui
@@ -1,338 +1,320 @@
ReceiveCoinsDialog
0
0
776
364
-
0
0
QFrame::StyledPanel
QFrame::Sunken
-
-
-
-
-
- Reuse one of the previously used receiving addresses. Reusing addresses has security and privacy issues. Do not use this unless re-generating a payment request made before.
-
-
- R&euse an existing receiving address (not recommended)
-
-
-
- -
-
-
-
-
-
-
-
An optional message to attach to the payment request, which will be displayed when the request is opened. Note: The message will not be sent with the payment over the Bitcoin network.
&Message:
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
reqMessage
-
An optional label to associate with the new receiving address.
-
An optional message to attach to the payment request, which will be displayed when the request is opened. Note: The message will not be sent with the payment over the Bitcoin network.
-
Use this form to request payments. All fields are <b>optional</b>.
-
An optional label to associate with the new receiving address.
&Label:
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
reqLabel
-
An optional amount to request. Leave this empty or zero to not request a specific amount.
&Amount:
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
reqAmount
-
80
0
An optional amount to request. Leave this empty or zero to not request a specific amount.
- -
+
-
-
150
0
&Request payment
:/icons/receiving_addresses:/icons/receiving_addresses
-
0
0
Clear all fields of the form.
Clear
:/icons/remove:/icons/remove
false
-
Qt::Horizontal
40
20
- -
+
-
-
Qt::Vertical
20
10
-
0
0
QFrame::StyledPanel
QFrame::Raised
-
75
true
Requested payments history
-
Qt::CustomContextMenu
false
true
-
-
false
Show the selected request (does the same as double clicking an entry)
Show
:/icons/edit:/icons/edit
false
-
false
Remove the selected entries from the list
Remove
:/icons/remove:/icons/remove
false
-
Qt::Horizontal
40
20
BitcoinAmountField
QLineEdit
1
reqLabel
reqAmount
reqMessage
- reuseAddress
receiveButton
clearButton
recentRequestsView
showRequestButton
removeRequestButton
diff --git a/src/qt/receivecoinsdialog.cpp b/src/qt/receivecoinsdialog.cpp
index e23b83df3..65dbeaaf8 100644
--- a/src/qt/receivecoinsdialog.cpp
+++ b/src/qt/receivecoinsdialog.cpp
@@ -1,298 +1,281 @@
// Copyright (c) 2011-2016 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "receivecoinsdialog.h"
#include "ui_receivecoinsdialog.h"
#include "addressbookpage.h"
#include "addresstablemodel.h"
#include "bitcoinunits.h"
#include "guiutil.h"
#include "optionsmodel.h"
#include "platformstyle.h"
#include "receiverequestdialog.h"
#include "recentrequeststablemodel.h"
#include "walletmodel.h"
#include
#include
#include
#include
#include
#include
ReceiveCoinsDialog::ReceiveCoinsDialog(const PlatformStyle *_platformStyle,
const Config *configIn, QWidget *parent)
: QDialog(parent), ui(new Ui::ReceiveCoinsDialog), columnResizingFixer(0),
model(0), platformStyle(_platformStyle), config(configIn) {
ui->setupUi(this);
if (!_platformStyle->getImagesOnButtons()) {
ui->clearButton->setIcon(QIcon());
ui->receiveButton->setIcon(QIcon());
ui->showRequestButton->setIcon(QIcon());
ui->removeRequestButton->setIcon(QIcon());
} else {
ui->clearButton->setIcon(
_platformStyle->SingleColorIcon(":/icons/remove"));
ui->receiveButton->setIcon(
_platformStyle->SingleColorIcon(":/icons/receiving_addresses"));
ui->showRequestButton->setIcon(
_platformStyle->SingleColorIcon(":/icons/edit"));
ui->removeRequestButton->setIcon(
_platformStyle->SingleColorIcon(":/icons/remove"));
}
// context menu actions
QAction *copyURIAction = new QAction(tr("Copy URI"), 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);
// context menu
contextMenu = new QMenu(this);
contextMenu->addAction(copyURIAction);
contextMenu->addAction(copyLabelAction);
contextMenu->addAction(copyMessageAction);
contextMenu->addAction(copyAmountAction);
// context menu signals
connect(ui->recentRequestsView, SIGNAL(customContextMenuRequested(QPoint)),
this, SLOT(showMenu(QPoint)));
connect(copyURIAction, SIGNAL(triggered()), this, SLOT(copyURI()));
connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel()));
connect(copyMessageAction, SIGNAL(triggered()), this, SLOT(copyMessage()));
connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount()));
connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear()));
}
void ReceiveCoinsDialog::setModel(WalletModel *_model) {
this->model = _model;
if (_model && _model->getOptionsModel()) {
_model->getRecentRequestsTableModel()->sort(
RecentRequestsTableModel::Date, Qt::DescendingOrder);
connect(_model->getOptionsModel(), SIGNAL(displayUnitChanged(int)),
this, SLOT(updateDisplayUnit()));
updateDisplayUnit();
QTableView *tableView = ui->recentRequestsView;
tableView->verticalHeader()->hide();
tableView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
tableView->setModel(_model->getRecentRequestsTableModel());
tableView->setAlternatingRowColors(true);
tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
tableView->setSelectionMode(QAbstractItemView::ContiguousSelection);
tableView->setColumnWidth(RecentRequestsTableModel::Date,
DATE_COLUMN_WIDTH);
tableView->setColumnWidth(RecentRequestsTableModel::Label,
LABEL_COLUMN_WIDTH);
tableView->setColumnWidth(RecentRequestsTableModel::Amount,
AMOUNT_MINIMUM_COLUMN_WIDTH);
connect(tableView->selectionModel(),
SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this,
SLOT(recentRequestsView_selectionChanged(QItemSelection,
QItemSelection)));
// Last 2 columns are set by the columnResizingFixer, when the table
// geometry is ready.
columnResizingFixer = new GUIUtil::TableViewLastColumnResizingFixer(
tableView, AMOUNT_MINIMUM_COLUMN_WIDTH, DATE_COLUMN_WIDTH, this);
}
}
ReceiveCoinsDialog::~ReceiveCoinsDialog() {
delete ui;
}
void ReceiveCoinsDialog::clear() {
ui->reqAmount->clear();
ui->reqLabel->setText("");
ui->reqMessage->setText("");
- ui->reuseAddress->setChecked(false);
updateDisplayUnit();
}
void ReceiveCoinsDialog::reject() {
clear();
}
void ReceiveCoinsDialog::accept() {
clear();
}
void ReceiveCoinsDialog::updateDisplayUnit() {
if (model && model->getOptionsModel()) {
ui->reqAmount->setDisplayUnit(
model->getOptionsModel()->getDisplayUnit());
}
}
void ReceiveCoinsDialog::on_receiveButton_clicked() {
if (!model || !model->getOptionsModel() || !model->getAddressTableModel() ||
!model->getRecentRequestsTableModel())
return;
QString address;
QString label = ui->reqLabel->text();
- if (ui->reuseAddress->isChecked()) {
- /* Choose existing receiving address */
- AddressBookPage dlg(platformStyle, AddressBookPage::ForSelection,
- AddressBookPage::ReceivingTab, this);
- dlg.setModel(model->getAddressTableModel());
- if (dlg.exec()) {
- address = dlg.getReturnValue();
- // If no label provided, use the previously used label
- if (label.isEmpty()) {
- label = model->getAddressTableModel()->labelForAddress(address);
- }
- } else {
- return;
- }
- } else {
- /* Generate new receiving address */
- address = model->getAddressTableModel()->addRow(
- AddressTableModel::Receive, label, "");
- }
+ /* Generate new receiving address */
+ address = model->getAddressTableModel()->addRow(AddressTableModel::Receive,
+ label, "");
SendCoinsRecipient info(address, label, ui->reqAmount->value(),
ui->reqMessage->text());
ReceiveRequestDialog *dialog = new ReceiveRequestDialog(config, this);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->setModel(model);
dialog->setInfo(info);
dialog->show();
clear();
/* Store request for later reference */
model->getRecentRequestsTableModel()->addNewRequest(info);
}
void ReceiveCoinsDialog::on_recentRequestsView_doubleClicked(
const QModelIndex &index) {
const RecentRequestsTableModel *submodel =
model->getRecentRequestsTableModel();
ReceiveRequestDialog *dialog = new ReceiveRequestDialog(config, this);
dialog->setModel(model);
dialog->setInfo(submodel->entry(index.row()).recipient);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->show();
}
void ReceiveCoinsDialog::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())
return;
QModelIndexList selection =
ui->recentRequestsView->selectionModel()->selectedRows();
for (const QModelIndex &index : selection) {
on_recentRequestsView_doubleClicked(index);
}
}
void ReceiveCoinsDialog::on_removeRequestButton_clicked() {
if (!model || !model->getRecentRequestsTableModel() ||
!ui->recentRequestsView->selectionModel())
return;
QModelIndexList selection =
ui->recentRequestsView->selectionModel()->selectedRows();
if (selection.empty()) return;
// correct for selection mode ContiguousSelection
QModelIndex firstIndex = selection.at(0);
model->getRecentRequestsTableModel()->removeRows(
firstIndex.row(), selection.length(), firstIndex.parent());
}
// We override the virtual resizeEvent of the QWidget to adjust tables column
// sizes as the tables width is proportional to the dialogs width.
void ReceiveCoinsDialog::resizeEvent(QResizeEvent *event) {
QWidget::resizeEvent(event);
columnResizingFixer->stretchColumnWidth(RecentRequestsTableModel::Message);
}
void ReceiveCoinsDialog::keyPressEvent(QKeyEvent *event) {
if (event->key() == Qt::Key_Return) {
// press return -> submit form
if (ui->reqLabel->hasFocus() || ui->reqAmount->hasFocus() ||
ui->reqMessage->hasFocus()) {
event->ignore();
on_receiveButton_clicked();
return;
}
}
this->QDialog::keyPressEvent(event);
}
QModelIndex ReceiveCoinsDialog::selectedRow() {
if (!model || !model->getRecentRequestsTableModel() ||
!ui->recentRequestsView->selectionModel())
return QModelIndex();
QModelIndexList selection =
ui->recentRequestsView->selectionModel()->selectedRows();
if (selection.empty()) return QModelIndex();
// correct for selection mode ContiguousSelection
QModelIndex firstIndex = selection.at(0);
return firstIndex;
}
// copy column of selected row to clipboard
void ReceiveCoinsDialog::copyColumnToClipboard(int column) {
QModelIndex firstIndex = selectedRow();
if (!firstIndex.isValid()) {
return;
}
GUIUtil::setClipboard(
model->getRecentRequestsTableModel()
->data(firstIndex.child(firstIndex.row(), column), Qt::EditRole)
.toString());
}
// context menu
void ReceiveCoinsDialog::showMenu(const QPoint &point) {
if (!selectedRow().isValid()) {
return;
}
contextMenu->exec(QCursor::pos());
}
// context menu action: copy URI
void ReceiveCoinsDialog::copyURI() {
QModelIndex sel = selectedRow();
if (!sel.isValid()) {
return;
}
const RecentRequestsTableModel *const submodel =
model->getRecentRequestsTableModel();
const QString uri = GUIUtil::formatBitcoinURI(
*config, submodel->entry(sel.row()).recipient);
GUIUtil::setClipboard(uri);
}
// context menu action: copy label
void ReceiveCoinsDialog::copyLabel() {
copyColumnToClipboard(RecentRequestsTableModel::Label);
}
// context menu action: copy message
void ReceiveCoinsDialog::copyMessage() {
copyColumnToClipboard(RecentRequestsTableModel::Message);
}
// context menu action: copy amount
void ReceiveCoinsDialog::copyAmount() {
copyColumnToClipboard(RecentRequestsTableModel::Amount);
}