aboutsummaryrefslogtreecommitdiff
path: root/src/qt/receivecoinsdialog.cpp
diff options
context:
space:
mode:
authorSjors Provoost <sjors@sprovoost.nl>2018-01-16 20:11:40 +0000
committerSjors Provoost <sjors@sprovoost.nl>2018-01-16 20:11:40 +0000
commit63ac8907ce6ab095b37858d6e96946b59ce1c13f (patch)
tree7bbab747e86f20f95eae5e98d0b79da86b979bbf /src/qt/receivecoinsdialog.cpp
parent0910cbe4ef31eb95fd76c7c2f820419fe64a3150 (diff)
downloadbitcoin-63ac8907ce6ab095b37858d6e96946b59ce1c13f.tar.xz
[qt] receive tab: bech32 address opt-in checkbox
When launched with -adresstype=legacy the checkbox will be hidden.
Diffstat (limited to 'src/qt/receivecoinsdialog.cpp')
-rw-r--r--src/qt/receivecoinsdialog.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/qt/receivecoinsdialog.cpp b/src/qt/receivecoinsdialog.cpp
index e07f2b74ee..f6c2fa7de7 100644
--- a/src/qt/receivecoinsdialog.cpp
+++ b/src/qt/receivecoinsdialog.cpp
@@ -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);