diff options
author | Sjors Provoost <sjors@sprovoost.nl> | 2020-09-18 10:12:23 +0200 |
---|---|---|
committer | Sjors Provoost <sjors@sprovoost.nl> | 2020-10-30 11:15:05 +0100 |
commit | 5bff82540b90d899ceac6390c008d653e6b665c3 (patch) | |
tree | 4077821e9c555a1e2d074ec71e2b6e1c329a5400 /src | |
parent | 42b66a6b814bca130a9ccf0a3f747cf33d628232 (diff) |
[gui] create wallet: smarter checkbox toggling
Diffstat (limited to 'src')
-rw-r--r-- | src/qt/createwalletdialog.cpp | 27 | ||||
-rw-r--r-- | src/qt/forms/createwalletdialog.ui | 4 |
2 files changed, 24 insertions, 7 deletions
diff --git a/src/qt/createwalletdialog.cpp b/src/qt/createwalletdialog.cpp index 38c6bfe56a..2ded6a1d89 100644 --- a/src/qt/createwalletdialog.cpp +++ b/src/qt/createwalletdialog.cpp @@ -35,11 +35,28 @@ CreateWalletDialog::CreateWalletDialog(QWidget* parent) : } }); -#ifndef USE_SQLITE - ui->descriptor_checkbox->setToolTip(tr("Compiled without sqlite support (required for descriptor wallets)")); - ui->descriptor_checkbox->setEnabled(false); - ui->descriptor_checkbox->setChecked(false); -#endif + connect(ui->disable_privkeys_checkbox, &QCheckBox::toggled, [this](bool checked) { + // Disable the encrypt_wallet_checkbox when isDisablePrivateKeysChecked is + // set to true, enable it when isDisablePrivateKeysChecked is false. + ui->encrypt_wallet_checkbox->setEnabled(!checked); + + // Wallets without private keys start out blank + if (checked) { + ui->blank_wallet_checkbox->setChecked(true); + } + + // When the encrypt_wallet_checkbox is disabled, uncheck it. + if (!ui->encrypt_wallet_checkbox->isEnabled()) { + ui->encrypt_wallet_checkbox->setChecked(false); + } + }); + + #ifndef USE_SQLITE + ui->descriptor_checkbox->setToolTip(tr("Compiled without sqlite support (required for descriptor wallets)")); + ui->descriptor_checkbox->setEnabled(false); + ui->descriptor_checkbox->setChecked(false); + #endif + } CreateWalletDialog::~CreateWalletDialog() diff --git a/src/qt/forms/createwalletdialog.ui b/src/qt/forms/createwalletdialog.ui index b592140dd7..f5dcbbd83d 100644 --- a/src/qt/forms/createwalletdialog.ui +++ b/src/qt/forms/createwalletdialog.ui @@ -68,12 +68,12 @@ <string>Encrypt Wallet</string> </property> <property name="checked"> - <bool>true</bool> + <bool>false</bool> </property> </widget> <widget class="QCheckBox" name="disable_privkeys_checkbox"> <property name="enabled"> - <bool>false</bool> + <bool>true</bool> </property> <property name="geometry"> <rect> |