mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-07 17:00:32 +02:00
gui: create wallet with external signer
This commit is contained in:
@ -27,14 +27,39 @@ CreateWalletDialog::CreateWalletDialog(QWidget* parent) :
|
|||||||
});
|
});
|
||||||
|
|
||||||
connect(ui->encrypt_wallet_checkbox, &QCheckBox::toggled, [this](bool checked) {
|
connect(ui->encrypt_wallet_checkbox, &QCheckBox::toggled, [this](bool checked) {
|
||||||
// Disable the disable_privkeys_checkbox when isEncryptWalletChecked is
|
// Disable the disable_privkeys_checkbox and external_signer_checkbox when isEncryptWalletChecked is
|
||||||
// set to true, enable it when isEncryptWalletChecked is false.
|
// set to true, enable it when isEncryptWalletChecked is false.
|
||||||
ui->disable_privkeys_checkbox->setEnabled(!checked);
|
ui->disable_privkeys_checkbox->setEnabled(!checked);
|
||||||
|
ui->external_signer_checkbox->setEnabled(!checked);
|
||||||
|
|
||||||
// When the disable_privkeys_checkbox is disabled, uncheck it.
|
// When the disable_privkeys_checkbox is disabled, uncheck it.
|
||||||
if (!ui->disable_privkeys_checkbox->isEnabled()) {
|
if (!ui->disable_privkeys_checkbox->isEnabled()) {
|
||||||
ui->disable_privkeys_checkbox->setChecked(false);
|
ui->disable_privkeys_checkbox->setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// When the external_signer_checkbox box is disabled, uncheck it.
|
||||||
|
if (!ui->external_signer_checkbox->isEnabled()) {
|
||||||
|
ui->external_signer_checkbox->setChecked(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(ui->external_signer_checkbox, &QCheckBox::toggled, [this](bool checked) {
|
||||||
|
ui->encrypt_wallet_checkbox->setEnabled(!checked);
|
||||||
|
ui->blank_wallet_checkbox->setEnabled(!checked);
|
||||||
|
ui->disable_privkeys_checkbox->setEnabled(!checked);
|
||||||
|
ui->descriptor_checkbox->setEnabled(!checked);
|
||||||
|
|
||||||
|
// The external signer checkbox is only enabled when a device is detected.
|
||||||
|
// In that case it is checked by default. Toggling it restores the other
|
||||||
|
// options to their default.
|
||||||
|
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);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(ui->disable_privkeys_checkbox, &QCheckBox::toggled, [this](bool checked) {
|
connect(ui->disable_privkeys_checkbox, &QCheckBox::toggled, [this](bool checked) {
|
||||||
@ -63,11 +88,22 @@ CreateWalletDialog::CreateWalletDialog(QWidget* parent) :
|
|||||||
ui->descriptor_checkbox->setToolTip(tr("Compiled without sqlite support (required for descriptor wallets)"));
|
ui->descriptor_checkbox->setToolTip(tr("Compiled without sqlite support (required for descriptor wallets)"));
|
||||||
ui->descriptor_checkbox->setEnabled(false);
|
ui->descriptor_checkbox->setEnabled(false);
|
||||||
ui->descriptor_checkbox->setChecked(false);
|
ui->descriptor_checkbox->setChecked(false);
|
||||||
|
ui->external_signer_checkbox->setEnabled(false);
|
||||||
|
ui->external_signer_checkbox->setChecked(false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef USE_BDB
|
#ifndef USE_BDB
|
||||||
ui->descriptor_checkbox->setEnabled(false);
|
ui->descriptor_checkbox->setEnabled(false);
|
||||||
ui->descriptor_checkbox->setChecked(true);
|
ui->descriptor_checkbox->setChecked(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef ENABLE_EXTERNAL_SIGNER
|
||||||
|
//: "External signing" means using devices such as hardware wallets.
|
||||||
|
ui->external_signer_checkbox->setToolTip(tr("Compiled without external signing support (required for external signing)"));
|
||||||
|
ui->external_signer_checkbox->setEnabled(false);
|
||||||
|
ui->external_signer_checkbox->setChecked(false);
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateWalletDialog::~CreateWalletDialog()
|
CreateWalletDialog::~CreateWalletDialog()
|
||||||
@ -99,3 +135,8 @@ bool CreateWalletDialog::isDescriptorWalletChecked() const
|
|||||||
{
|
{
|
||||||
return ui->descriptor_checkbox->isChecked();
|
return ui->descriptor_checkbox->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CreateWalletDialog::isExternalSignerChecked() const
|
||||||
|
{
|
||||||
|
return ui->external_signer_checkbox->isChecked();
|
||||||
|
}
|
||||||
|
@ -28,6 +28,7 @@ public:
|
|||||||
bool isDisablePrivateKeysChecked() const;
|
bool isDisablePrivateKeysChecked() const;
|
||||||
bool isMakeBlankWalletChecked() const;
|
bool isMakeBlankWalletChecked() const;
|
||||||
bool isDescriptorWalletChecked() const;
|
bool isDescriptorWalletChecked() const;
|
||||||
|
bool isExternalSignerChecked() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::CreateWalletDialog *ui;
|
Ui::CreateWalletDialog *ui;
|
||||||
|
@ -109,6 +109,16 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="external_signer_checkbox">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Use an external signing device such as a hardware wallet. Configure the external signer script in wallet preferences first.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>External signer</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -143,6 +153,7 @@
|
|||||||
<tabstop>disable_privkeys_checkbox</tabstop>
|
<tabstop>disable_privkeys_checkbox</tabstop>
|
||||||
<tabstop>blank_wallet_checkbox</tabstop>
|
<tabstop>blank_wallet_checkbox</tabstop>
|
||||||
<tabstop>descriptor_checkbox</tabstop>
|
<tabstop>descriptor_checkbox</tabstop>
|
||||||
|
<tabstop>external_signer_checkbox</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
|
@ -260,6 +260,9 @@ void CreateWalletActivity::createWallet()
|
|||||||
if (m_create_wallet_dialog->isDescriptorWalletChecked()) {
|
if (m_create_wallet_dialog->isDescriptorWalletChecked()) {
|
||||||
flags |= WALLET_FLAG_DESCRIPTORS;
|
flags |= WALLET_FLAG_DESCRIPTORS;
|
||||||
}
|
}
|
||||||
|
if (m_create_wallet_dialog->isExternalSignerChecked()) {
|
||||||
|
flags |= WALLET_FLAG_EXTERNAL_SIGNER;
|
||||||
|
}
|
||||||
|
|
||||||
QTimer::singleShot(500, worker(), [this, name, flags] {
|
QTimer::singleShot(500, worker(), [this, name, flags] {
|
||||||
std::unique_ptr<interfaces::Wallet> wallet = node().walletClient().createWallet(name, m_passphrase, flags, m_error_message, m_warning_message);
|
std::unique_ptr<interfaces::Wallet> wallet = node().walletClient().createWallet(name, m_passphrase, flags, m_error_message, m_warning_message);
|
||||||
|
Reference in New Issue
Block a user