Bitcoin Core  21.99.0
P2P Digital Currency
createwalletdialog.cpp
Go to the documentation of this file.
1 // Copyright (c) 2019-2020 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #if defined(HAVE_CONFIG_H)
7 #endif
8 
10 #include <qt/forms/ui_createwalletdialog.h>
11 
12 #include <QPushButton>
13 
15  QDialog(parent),
16  ui(new Ui::CreateWalletDialog)
17 {
18  ui->setupUi(this);
19  ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Create"));
20  ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
21  ui->wallet_name_line_edit->setFocus(Qt::ActiveWindowFocusReason);
22 
23  connect(ui->wallet_name_line_edit, &QLineEdit::textEdited, [this](const QString& text) {
24  ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!text.isEmpty());
25  });
26 
27  connect(ui->encrypt_wallet_checkbox, &QCheckBox::toggled, [this](bool checked) {
28  // Disable the disable_privkeys_checkbox when isEncryptWalletChecked is
29  // set to true, enable it when isEncryptWalletChecked is false.
30  ui->disable_privkeys_checkbox->setEnabled(!checked);
31 
32  // When the disable_privkeys_checkbox is disabled, uncheck it.
33  if (!ui->disable_privkeys_checkbox->isEnabled()) {
34  ui->disable_privkeys_checkbox->setChecked(false);
35  }
36  });
37 
38  connect(ui->disable_privkeys_checkbox, &QCheckBox::toggled, [this](bool checked) {
39  // Disable the encrypt_wallet_checkbox when isDisablePrivateKeysChecked is
40  // set to true, enable it when isDisablePrivateKeysChecked is false.
41  ui->encrypt_wallet_checkbox->setEnabled(!checked);
42 
43  // Wallets without private keys start out blank
44  if (checked) {
45  ui->blank_wallet_checkbox->setChecked(true);
46  }
47 
48  // When the encrypt_wallet_checkbox is disabled, uncheck it.
49  if (!ui->encrypt_wallet_checkbox->isEnabled()) {
50  ui->encrypt_wallet_checkbox->setChecked(false);
51  }
52  });
53 
54 #ifndef USE_SQLITE
55  ui->descriptor_checkbox->setToolTip(tr("Compiled without sqlite support (required for descriptor wallets)"));
56  ui->descriptor_checkbox->setEnabled(false);
57  ui->descriptor_checkbox->setChecked(false);
58 #endif
59 #ifndef USE_BDB
60  ui->descriptor_checkbox->setEnabled(false);
61  ui->descriptor_checkbox->setChecked(true);
62 #endif
63 }
64 
66 {
67  delete ui;
68 }
69 
71 {
72  return ui->wallet_name_line_edit->text();
73 }
74 
76 {
77  return ui->encrypt_wallet_checkbox->isChecked();
78 }
79 
81 {
82  return ui->disable_privkeys_checkbox->isChecked();
83 }
84 
86 {
87  return ui->blank_wallet_checkbox->isChecked();
88 }
89 
91 {
92  return ui->descriptor_checkbox->isChecked();
93 }
bool isDescriptorWalletChecked() const
bool isEncryptWalletChecked() const
QString walletName() const
bool isDisablePrivateKeysChecked() const
CreateWalletDialog(QWidget *parent)
Ui::CreateWalletDialog * ui
bool isMakeBlankWalletChecked() const
Dialog for creating wallets.
if(it !=peer.m_getdata_requests.end() &&!pfrom.fPauseSend)