mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +01:00
[qt] receive tab: bech32 address opt-in checkbox
When launched with -adresstype=legacy the checkbox will be hidden.
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <wallet/wallet.h>
|
||||
|
||||
#include <qt/receivecoinsdialog.h>
|
||||
#include <qt/forms/ui_receivecoinsdialog.h>
|
||||
|
||||
@@ -41,6 +43,15 @@ ReceiveCoinsDialog::ReceiveCoinsDialog(const PlatformStyle *_platformStyle, QWid
|
||||
ui->removeRequestButton->setIcon(_platformStyle->SingleColorIcon(":/icons/remove"));
|
||||
}
|
||||
|
||||
// configure bech32 checkbox, disable if launched with legacy as default:
|
||||
if (model->getDefaultAddressType() == OUTPUT_TYPE_BECH32) {
|
||||
ui->useBech32->setCheckState(Qt::Checked);
|
||||
} else {
|
||||
ui->useBech32->setCheckState(Qt::Unchecked);
|
||||
}
|
||||
|
||||
ui->useBech32->setVisible(model->getDefaultAddressType() != OUTPUT_TYPE_LEGACY);
|
||||
|
||||
// context menu actions
|
||||
QAction *copyURIAction = new QAction(tr("Copy URI"), this);
|
||||
QAction *copyLabelAction = new QAction(tr("Copy label"), this);
|
||||
@@ -133,7 +144,11 @@ void ReceiveCoinsDialog::on_receiveButton_clicked()
|
||||
QString address;
|
||||
QString label = ui->reqLabel->text();
|
||||
/* Generate new receiving address */
|
||||
address = model->getAddressTableModel()->addRow(AddressTableModel::Receive, label, "");
|
||||
OutputType address_type = model->getDefaultAddressType();
|
||||
if (address_type != OUTPUT_TYPE_LEGACY) {
|
||||
address_type = ui->useBech32->isChecked() ? OUTPUT_TYPE_BECH32 : OUTPUT_TYPE_P2SH_SEGWIT;
|
||||
}
|
||||
address = model->getAddressTableModel()->addRow(AddressTableModel::Receive, label, "", address_type);
|
||||
SendCoinsRecipient info(address, label,
|
||||
ui->reqAmount->value(), ui->reqMessage->text());
|
||||
ReceiveRequestDialog *dialog = new ReceiveRequestDialog(this);
|
||||
|
||||
Reference in New Issue
Block a user