Skip to content

Commit

Permalink
Merge #739: Disable and uncheck blank when private keys are disabled
Browse files Browse the repository at this point in the history
9ea31eb gui: Disable and uncheck blank when private keys are disabled (Andrew Chow)

Pull request description:

  Unify the GUI's create wallet with the RPC createwallet so that the blank flag is not set when private keys are disabled.

ACKs for top commit:
  S3RK:
    Code review ACK 9ea31eb
  jarolrod:
    ACK 9ea31eb
  pablomartin4btc:
    tACK 9ea31eb

Tree-SHA512: 0c90dbd77e66f088c6a57711a4b91e254814c4ee301ab703807f281cacd4b08712d2dfeac7661f28bc0e93acc55d486a17b8b4a53ffa57093d992e7a3c51f4e8
  • Loading branch information
hebasto committed Sep 22, 2023
2 parents 2e1d4bf + 9ea31eb commit bce7b08
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/qt/createwalletdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,18 @@ CreateWalletDialog::CreateWalletDialog(QWidget* parent) :
ui->descriptor_checkbox->setChecked(checked);
ui->encrypt_wallet_checkbox->setChecked(false);
ui->disable_privkeys_checkbox->setChecked(checked);
// The blank check box is ambiguous. This flag is always true for a
// watch-only wallet, even though we immedidately fetch keys from the
// external signer.
ui->blank_wallet_checkbox->setChecked(checked);
ui->blank_wallet_checkbox->setChecked(false);
});

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
// Wallets without private keys cannot set blank
ui->blank_wallet_checkbox->setEnabled(!checked);
if (checked) {
ui->blank_wallet_checkbox->setChecked(true);
ui->blank_wallet_checkbox->setChecked(false);
}

// When the encrypt_wallet_checkbox is disabled, uncheck it.
Expand All @@ -81,8 +79,11 @@ CreateWalletDialog::CreateWalletDialog(QWidget* parent) :
});

connect(ui->blank_wallet_checkbox, &QCheckBox::toggled, [this](bool checked) {
if (!checked) {
ui->disable_privkeys_checkbox->setChecked(false);
// Disable the disable_privkeys_checkbox when blank_wallet_checkbox is checked
// as blank-ness only pertains to wallets with private keys.
ui->disable_privkeys_checkbox->setEnabled(!checked);
if (checked) {
ui->disable_privkeys_checkbox->setChecked(false);
}
});

Expand Down

0 comments on commit bce7b08

Please sign in to comment.