Bitcoin Core  0.21.1
P2P Digital Currency
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules
createwalletdialog.cpp
Go to the documentation of this file.
1 // Copyright (c) 2019 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 
60 }
61 
63 {
64  delete ui;
65 }
66 
68 {
69  return ui->wallet_name_line_edit->text();
70 }
71 
73 {
74  return ui->encrypt_wallet_checkbox->isChecked();
75 }
76 
78 {
79  return ui->disable_privkeys_checkbox->isChecked();
80 }
81 
83 {
84  return ui->blank_wallet_checkbox->isChecked();
85 }
86 
88 {
89  return ui->descriptor_checkbox->isChecked();
90 }
bool isEncryptWalletChecked() const
if(expired!=0)
Definition: validation.cpp:335
CreateWalletDialog(QWidget *parent)
Ui::CreateWalletDialog * ui
bool isMakeBlankWalletChecked() const
bool isDescriptorWalletChecked() const
bool isDisablePrivateKeysChecked() const
Dialog for creating wallets.
QString walletName() const