Skip to content

Commit

Permalink
Fix create hardware wallet checkbox
Browse files Browse the repository at this point in the history
  • Loading branch information
timemarkovqtum committed May 17, 2024
1 parent a7f4950 commit 19f7b0e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
27 changes: 12 additions & 15 deletions src/qt/createwalletdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ CreateWalletDialog::CreateWalletDialog(QWidget* parent) :
});

connect(ui->external_signer_checkbox, &QCheckBox::toggled, [this](bool checked) {
ui->hardware_wallet_checkbox->blockSignals(true);
if (checked) ui->hardware_wallet_checkbox->setChecked(false);
ui->hardware_wallet_checkbox->blockSignals(false);

ui->encrypt_wallet_checkbox->setEnabled(!checked);
ui->blank_wallet_checkbox->setEnabled(!checked);
ui->disable_privkeys_checkbox->setEnabled(!checked);
Expand Down Expand Up @@ -96,26 +100,19 @@ CreateWalletDialog::CreateWalletDialog(QWidget* parent) :
#endif
connect(ui->hardware_wallet_checkbox, &QCheckBox::toggled, [this](bool checked) {
#ifdef ENABLE_EXTERNAL_SIGNER
// Uncheck external signer when hardware wallet is checked
if(checked) {
ui->external_signer_checkbox->setChecked(false);
}
ui->external_signer_checkbox->blockSignals(true);
if (checked) ui->external_signer_checkbox->setChecked(false);
ui->external_signer_checkbox->blockSignals(false);
#endif

// Disable and uncheck encrypt_wallet_checkbox when isHardwareWalletChecked is true,
// enable and check it if isHardwareWalletChecked is false
ui->encrypt_wallet_checkbox->setChecked(!checked);
ui->encrypt_wallet_checkbox->setEnabled(!checked);
ui->blank_wallet_checkbox->setEnabled(!checked);
ui->disable_privkeys_checkbox->setEnabled(!checked);

// Disable disable_privkeys_checkbox
// and check it if isHardwareWalletChecked is true or uncheck if isHardwareWalletChecked is false
ui->disable_privkeys_checkbox->setEnabled(false);
// Toggling it restores the other options to their default.
ui->encrypt_wallet_checkbox->setChecked(false);
ui->disable_privkeys_checkbox->setChecked(checked);

// Disable and check blank_wallet_checkbox if isHardwareWalletChecked is true and
// enable and uncheck it if isHardwareWalletChecked is false
ui->blank_wallet_checkbox->setEnabled(!checked);
ui->blank_wallet_checkbox->setChecked(checked);
ui->blank_wallet_checkbox->setChecked(false);
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/qt/forms/createwalletdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
<item>
<widget class="QCheckBox" name="hardware_wallet_checkbox">
<property name="toolTip">
<string>Make a blank wallet. Blank wallets do not initially have private keys or scripts. Private keys and addresses can be imported, or an HD seed can be set, at a later time.</string>
<string>Use a hardware wallet device for signing. Configure the HWI tool path in main preferences first.</string>
</property>
<property name="text">
<string>Use a hardware device</string>
Expand Down

0 comments on commit 19f7b0e

Please sign in to comment.