File tree Expand file tree Collapse file tree 3 files changed +42
-0
lines changed Expand file tree Collapse file tree 3 files changed +42
-0
lines changed Original file line number Diff line number Diff line change 66#include < config/bitcoin-config.h>
77#endif
88
9+ #include < external_signer.h>
910#include < qt/createwalletdialog.h>
1011#include < qt/forms/ui_createwalletdialog.h>
1112
@@ -111,6 +112,28 @@ CreateWalletDialog::~CreateWalletDialog()
111112 delete ui;
112113}
113114
115+ #ifdef ENABLE_EXTERNAL_SIGNER
116+ void CreateWalletDialog::setSigners (std::vector<ExternalSigner>& signers)
117+ {
118+ if (!signers.empty ()) {
119+ ui->external_signer_checkbox ->setEnabled (true );
120+ ui->external_signer_checkbox ->setChecked (true );
121+ ui->encrypt_wallet_checkbox ->setEnabled (false );
122+ ui->encrypt_wallet_checkbox ->setChecked (false );
123+ // The order matters, because connect() is called when toggling a checkbox:
124+ ui->blank_wallet_checkbox ->setEnabled (false );
125+ ui->blank_wallet_checkbox ->setChecked (false );
126+ ui->disable_privkeys_checkbox ->setEnabled (false );
127+ ui->disable_privkeys_checkbox ->setChecked (true );
128+ const std::string label = signers[0 ].m_name ;
129+ ui->wallet_name_line_edit ->setText (QString::fromStdString (label));
130+ ui->buttonBox ->button (QDialogButtonBox::Ok)->setEnabled (true );
131+ } else {
132+ ui->external_signer_checkbox ->setEnabled (false );
133+ }
134+ }
135+ #endif
136+
114137QString CreateWalletDialog::walletName () const
115138{
116139 return ui->wallet_name_line_edit ->text ();
Original file line number Diff line number Diff line change 99
1010class WalletModel ;
1111
12+ #ifdef ENABLE_EXTERNAL_SIGNER
13+ class ExternalSigner ;
14+ #endif
15+
1216namespace Ui {
1317 class CreateWalletDialog ;
1418}
@@ -23,6 +27,10 @@ class CreateWalletDialog : public QDialog
2327 explicit CreateWalletDialog (QWidget* parent);
2428 virtual ~CreateWalletDialog ();
2529
30+ #ifdef ENABLE_EXTERNAL_SIGNER
31+ void setSigners (std::vector<ExternalSigner>& signers);
32+ #endif
33+
2634 QString walletName () const ;
2735 bool isEncryptWalletChecked () const ;
2836 bool isDisablePrivateKeysChecked () const ;
Original file line number Diff line number Diff line change @@ -291,6 +291,17 @@ void CreateWalletActivity::finish()
291291void CreateWalletActivity::create ()
292292{
293293 m_create_wallet_dialog = new CreateWalletDialog (m_parent_widget);
294+
295+ #ifdef ENABLE_EXTERNAL_SIGNER
296+ std::vector<ExternalSigner> signers;
297+ try {
298+ signers = node ().externalSigners ();
299+ } catch (const std::runtime_error& e) {
300+ QMessageBox::critical (nullptr , tr (" Can't list signers" ), e.what ());
301+ }
302+ m_create_wallet_dialog->setSigners (signers);
303+ #endif
304+
294305 m_create_wallet_dialog->setWindowModality (Qt::ApplicationModal);
295306 m_create_wallet_dialog->show ();
296307
You can’t perform that action at this time.
0 commit comments