From 0e9e25ade0ca5a524626e7dcb6e81311d1759f4d Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Sat, 22 Feb 2020 04:48:22 +0000 Subject: [PATCH] Bugfix: GUI: Disable editing of sending addresses This has been broken since 0.17 and nobody noticed, so just remove it entirely. Bug 1 (since 0.17, #10244): Instead of moving the label, the new address's label was set to the new address itself, and the actual label was lost completely. Bug 2 (since 0.19, #13756): "used" DestData should have been retained at the old address rather than deleted entirely. Bug 3: Editing both the label and address in the label-editing dialog would still delete the label for the old address. This commit just turns off the GUI editing capabilities, which should be the minimal needed to disable the functionality and therefore the bugs. --- src/qt/addresstablemodel.cpp | 4 +--- src/qt/editaddressdialog.cpp | 1 + src/qt/forms/addressbookpage.ui | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/qt/addresstablemodel.cpp b/src/qt/addresstablemodel.cpp index 380a3ddb84..1e88afca6b 100644 --- a/src/qt/addresstablemodel.cpp +++ b/src/qt/addresstablemodel.cpp @@ -307,9 +307,7 @@ Qt::ItemFlags AddressTableModel::flags(const QModelIndex &index) const Qt::ItemFlags retval = Qt::ItemIsSelectable | Qt::ItemIsEnabled; // Can edit address and label for sending addresses, // and only label for receiving addresses. - if(rec->type == AddressTableEntry::Sending || - (rec->type == AddressTableEntry::Receiving && index.column()==Label)) - { + if ((rec->type == AddressTableEntry::Sending || rec->type == AddressTableEntry::Receiving) && index.column() == Label) { retval |= Qt::ItemIsEditable; } return retval; diff --git a/src/qt/editaddressdialog.cpp b/src/qt/editaddressdialog.cpp index 0b0b96b30c..5068e6fa3c 100644 --- a/src/qt/editaddressdialog.cpp +++ b/src/qt/editaddressdialog.cpp @@ -34,6 +34,7 @@ EditAddressDialog::EditAddressDialog(Mode _mode, QWidget *parent) : break; case EditSendingAddress: setWindowTitle(tr("Edit sending address")); + ui->addressEdit->setEnabled(false); break; } diff --git a/src/qt/forms/addressbookpage.ui b/src/qt/forms/addressbookpage.ui index 7ac216286c..c22156c067 100644 --- a/src/qt/forms/addressbookpage.ui +++ b/src/qt/forms/addressbookpage.ui @@ -34,7 +34,7 @@ Qt::CustomContextMenu - Right-click to edit address or label + Right-click to edit label false