Skip to content

Commit e476826

Browse files
committed
Merge #12721: Qt: remove "new" button during receive-mode in addressbook
d843db7 Qt: remove "new" button during receive-mode in addressbook (Jonas Schnelli) Pull request description: There are currently two ways how to generate new receiving addresses in the GUI (which leads to code duplication or required refactoring, see #12520). Since the address-book is probably something that should be removed in the long run, suppressing the new-button in receive-mode could be a first step in deprecating the address book. With this PR, users can still edit existing receiving address book entries and they can still create new sending address book entries. Tree-SHA512: abe8d1b44bc3e1b53826ccf9d2b3f764264337758d95ca1fe1ef1bac72d47608cf454055fce3720e06634f0a5841a752ce643b4505b47d6e322b6fc71296e961
2 parents 8ee5c7b + d843db7 commit e476826

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

src/qt/addressbookpage.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,12 @@ AddressBookPage::AddressBookPage(const PlatformStyle *platformStyle, Mode _mode,
104104
case SendingTab:
105105
ui->labelExplanation->setText(tr("These are your Bitcoin addresses for sending payments. Always check the amount and the receiving address before sending coins."));
106106
ui->deleteAddress->setVisible(true);
107+
ui->newAddress->setVisible(true);
107108
break;
108109
case ReceivingTab:
109110
ui->labelExplanation->setText(tr("These are your Bitcoin addresses for receiving payments. It is recommended to use a new receiving address for each transaction."));
110111
ui->deleteAddress->setVisible(false);
112+
ui->newAddress->setVisible(false);
111113
break;
112114
}
113115

@@ -211,10 +213,11 @@ void AddressBookPage::on_newAddress_clicked()
211213
if(!model)
212214
return;
213215

214-
EditAddressDialog dlg(
215-
tab == SendingTab ?
216-
EditAddressDialog::NewSendingAddress :
217-
EditAddressDialog::NewReceivingAddress, this);
216+
if (tab == ReceivingTab) {
217+
return;
218+
}
219+
220+
EditAddressDialog dlg(EditAddressDialog::NewSendingAddress, this);
218221
dlg.setModel(model);
219222
if(dlg.exec())
220223
{

src/qt/editaddressdialog.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ EditAddressDialog::EditAddressDialog(Mode _mode, QWidget *parent) :
2525

2626
switch(mode)
2727
{
28-
case NewReceivingAddress:
29-
setWindowTitle(tr("New receiving address"));
30-
ui->addressEdit->setEnabled(false);
31-
break;
3228
case NewSendingAddress:
3329
setWindowTitle(tr("New sending address"));
3430
break;
@@ -73,10 +69,9 @@ bool EditAddressDialog::saveCurrentRow()
7369

7470
switch(mode)
7571
{
76-
case NewReceivingAddress:
7772
case NewSendingAddress:
7873
address = model->addRow(
79-
mode == NewSendingAddress ? AddressTableModel::Send : AddressTableModel::Receive,
74+
AddressTableModel::Send,
8075
ui->labelEdit->text(),
8176
ui->addressEdit->text(),
8277
model->GetDefaultAddressType());

src/qt/editaddressdialog.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ class EditAddressDialog : public QDialog
2525

2626
public:
2727
enum Mode {
28-
NewReceivingAddress,
2928
NewSendingAddress,
3029
EditReceivingAddress,
3130
EditSendingAddress

0 commit comments

Comments
 (0)