Skip to content

Commit d244c2a

Browse files
committed
[gui] create wallet with external signer
1 parent 82031d8 commit d244c2a

File tree

4 files changed

+53
-2
lines changed

4 files changed

+53
-2
lines changed

src/qt/createwalletdialog.cpp

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,37 @@ CreateWalletDialog::CreateWalletDialog(QWidget* parent) :
2525
});
2626

2727
connect(ui->encrypt_wallet_checkbox, &QCheckBox::toggled, [this](bool checked) {
28-
// Disable the disable_privkeys_checkbox when isEncryptWalletChecked is
28+
// Disable the disable_privkeys_checkbox and external_signer_checkbox when isEncryptWalletChecked is
2929
// set to true, enable it when isEncryptWalletChecked is false.
3030
ui->disable_privkeys_checkbox->setEnabled(!checked);
31+
ui->external_signer_checkbox->setEnabled(!checked);
3132

3233
// When the disable_privkeys_checkbox is disabled, uncheck it.
3334
if (!ui->disable_privkeys_checkbox->isEnabled()) {
3435
ui->disable_privkeys_checkbox->setChecked(false);
3536
}
37+
38+
// When the external_signer_checkbox box is disabled, uncheck it.
39+
if (!ui->external_signer_checkbox->isEnabled()) {
40+
ui->external_signer_checkbox->setChecked(false);
41+
}
42+
43+
});
44+
45+
connect(ui->external_signer_checkbox, &QCheckBox::toggled, [this](bool checked) {
46+
if (checked) {
47+
ui->encrypt_wallet_checkbox->setChecked(false);
48+
ui->blank_wallet_checkbox->setChecked(false);
49+
ui->disable_privkeys_checkbox->setChecked(true);
50+
ui->descriptor_checkbox->setChecked(true);
51+
}
52+
53+
ui->encrypt_wallet_checkbox->setEnabled(!checked);
54+
ui->blank_wallet_checkbox->setEnabled(!checked);
55+
ui->disable_privkeys_checkbox->setEnabled(!checked);
56+
ui->descriptor_checkbox->setEnabled(!checked);
3657
});
58+
3759
}
3860

3961
CreateWalletDialog::~CreateWalletDialog()
@@ -65,3 +87,8 @@ bool CreateWalletDialog::isDescriptorWalletChecked() const
6587
{
6688
return ui->descriptor_checkbox->isChecked();
6789
}
90+
91+
bool CreateWalletDialog::isExternalSignerChecked() const
92+
{
93+
return ui->external_signer_checkbox->isChecked();
94+
}

src/qt/createwalletdialog.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class CreateWalletDialog : public QDialog
2828
bool isDisablePrivateKeysChecked() const;
2929
bool isMakeBlankWalletChecked() const;
3030
bool isDescriptorWalletChecked() const;
31+
bool isExternalSignerChecked() const;
3132

3233
private:
3334
Ui::CreateWalletDialog *ui;

src/qt/forms/createwalletdialog.ui

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<x>0</x>
88
<y>0</y>
99
<width>364</width>
10-
<height>213</height>
10+
<height>243</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
@@ -122,12 +122,32 @@
122122
<string>Descriptor Wallet</string>
123123
</property>
124124
</widget>
125+
<widget class="QCheckBox" name="external_signer_checkbox">
126+
<property name="geometry">
127+
<rect>
128+
<x>20</x>
129+
<y>170</y>
130+
<width>171</width>
131+
<height>22</height>
132+
</rect>
133+
</property>
134+
<property name="enabled">
135+
<bool>false</bool>
136+
</property>
137+
<property name="text">
138+
<string>External signer</string>
139+
</property>
140+
<property name="toolTip">
141+
<string>Use an external signing device such as a hardware wallet. Configure the external signer script in wallet preferences first.</string>
142+
</property>
125143
</widget>
144+
</widget>
126145
<tabstops>
127146
<tabstop>wallet_name_line_edit</tabstop>
128147
<tabstop>encrypt_wallet_checkbox</tabstop>
129148
<tabstop>disable_privkeys_checkbox</tabstop>
130149
<tabstop>blank_wallet_checkbox</tabstop>
150+
<tabstop>external_signer_checkbox</tabstop>
131151
</tabstops>
132152
<resources/>
133153
<connections>

src/qt/walletcontroller.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,9 @@ void CreateWalletActivity::createWallet()
251251
if (m_create_wallet_dialog->isDescriptorWalletChecked()) {
252252
flags |= WALLET_FLAG_DESCRIPTORS;
253253
}
254+
if (m_create_wallet_dialog->isExternalSignerChecked()) {
255+
flags |= WALLET_FLAG_EXTERNAL_SIGNER;
256+
}
254257

255258
QTimer::singleShot(500, worker(), [this, name, flags] {
256259
std::unique_ptr<interfaces::Wallet> wallet = node().walletClient().createWallet(name, m_passphrase, flags, m_error_message, m_warning_message);

0 commit comments

Comments
 (0)