diff options
author | Andrew Chow <achow101-github@achow101.com> | 2021-08-05 23:27:53 -0400 |
---|---|---|
committer | Andrew Chow <achow101-github@achow101.com> | 2021-08-05 23:27:53 -0400 |
commit | a9b9ca82daefc77ee3c884d3f250460d7cf734a5 (patch) | |
tree | d5980605959936924ecf59a06ab2a9541c5df6be /src | |
parent | d67330d11245b11fbdd5e2dd5343ee451186931e (diff) | |
download | bitcoin-a9b9ca82daefc77ee3c884d3f250460d7cf734a5.tar.xz |
gui: ensure external signer option remains disabled without signers
When no external signers are available, the option to enable external
signers should always be disabled. However the encrypt wallet checkbox
can erroneously re-enable the external signer checkbox. To avoid this,
CreateWalletDialog now stores whether signers were available during
setSigners so that future calls to external_signer_checkbox->setEnabled
can account for whether signers are available.
Diffstat (limited to 'src')
-rw-r--r-- | src/qt/createwalletdialog.cpp | 5 | ||||
-rw-r--r-- | src/qt/createwalletdialog.h | 1 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/qt/createwalletdialog.cpp b/src/qt/createwalletdialog.cpp index dc24bbc6a6..f9a61c3e60 100644 --- a/src/qt/createwalletdialog.cpp +++ b/src/qt/createwalletdialog.cpp @@ -32,7 +32,7 @@ CreateWalletDialog::CreateWalletDialog(QWidget* parent) : // set to true, enable it when isEncryptWalletChecked is false. ui->disable_privkeys_checkbox->setEnabled(!checked); #ifdef ENABLE_EXTERNAL_SIGNER - ui->external_signer_checkbox->setEnabled(!checked); + ui->external_signer_checkbox->setEnabled(m_has_signers && !checked); #endif // When the disable_privkeys_checkbox is disabled, uncheck it. if (!ui->disable_privkeys_checkbox->isEnabled()) { @@ -115,7 +115,8 @@ CreateWalletDialog::~CreateWalletDialog() void CreateWalletDialog::setSigners(const std::vector<ExternalSigner>& signers) { - if (!signers.empty()) { + m_has_signers = !signers.empty(); + if (m_has_signers) { ui->external_signer_checkbox->setEnabled(true); ui->external_signer_checkbox->setChecked(true); ui->encrypt_wallet_checkbox->setEnabled(false); diff --git a/src/qt/createwalletdialog.h b/src/qt/createwalletdialog.h index 25ddf97585..fc13cc44eb 100644 --- a/src/qt/createwalletdialog.h +++ b/src/qt/createwalletdialog.h @@ -35,6 +35,7 @@ public: private: Ui::CreateWalletDialog *ui; + bool m_has_signers = false; }; #endif // BITCOIN_QT_CREATEWALLETDIALOG_H |