2019-02-20 14:22:07 -03:00
|
|
|
// Copyright (c) 2019 The Bitcoin Core developers
|
|
|
|
// Distributed under the MIT software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
|
|
|
#if defined(HAVE_CONFIG_H)
|
|
|
|
#include <config/bitcoin-config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <qt/createwalletdialog.h>
|
|
|
|
#include <qt/forms/ui_createwalletdialog.h>
|
|
|
|
|
|
|
|
#include <QPushButton>
|
|
|
|
|
|
|
|
CreateWalletDialog::CreateWalletDialog(QWidget* parent) :
|
|
|
|
QDialog(parent),
|
|
|
|
ui(new Ui::CreateWalletDialog)
|
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
2019-05-24 17:14:16 -04:00
|
|
|
ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Create"));
|
2019-02-20 14:22:07 -03:00
|
|
|
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
|
|
|
ui->wallet_name_line_edit->setFocus(Qt::ActiveWindowFocusReason);
|
|
|
|
|
|
|
|
connect(ui->wallet_name_line_edit, &QLineEdit::textEdited, [this](const QString& text) {
|
|
|
|
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!text.isEmpty());
|
|
|
|
});
|
|
|
|
|
|
|
|
connect(ui->encrypt_wallet_checkbox, &QCheckBox::toggled, [this](bool checked) {
|
2019-09-07 05:08:28 -04:00
|
|
|
// Disable the disable_privkeys_checkbox when isEncryptWalletChecked is
|
|
|
|
// set to true, enable it when isEncryptWalletChecked is false.
|
2019-02-20 14:22:07 -03:00
|
|
|
ui->disable_privkeys_checkbox->setEnabled(!checked);
|
|
|
|
|
|
|
|
// When the disable_privkeys_checkbox is disabled, uncheck it.
|
|
|
|
if (!ui->disable_privkeys_checkbox->isEnabled()) {
|
|
|
|
ui->disable_privkeys_checkbox->setChecked(false);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
CreateWalletDialog::~CreateWalletDialog()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString CreateWalletDialog::walletName() const
|
|
|
|
{
|
|
|
|
return ui->wallet_name_line_edit->text();
|
|
|
|
}
|
|
|
|
|
2019-09-07 05:08:28 -04:00
|
|
|
bool CreateWalletDialog::isEncryptWalletChecked() const
|
2019-02-20 14:22:07 -03:00
|
|
|
{
|
|
|
|
return ui->encrypt_wallet_checkbox->isChecked();
|
|
|
|
}
|
|
|
|
|
2019-09-07 05:08:28 -04:00
|
|
|
bool CreateWalletDialog::isDisablePrivateKeysChecked() const
|
2019-02-20 14:22:07 -03:00
|
|
|
{
|
|
|
|
return ui->disable_privkeys_checkbox->isChecked();
|
|
|
|
}
|
|
|
|
|
2019-09-07 05:08:28 -04:00
|
|
|
bool CreateWalletDialog::isMakeBlankWalletChecked() const
|
2019-02-20 14:22:07 -03:00
|
|
|
{
|
|
|
|
return ui->blank_wallet_checkbox->isChecked();
|
|
|
|
}
|
2019-07-11 18:21:21 -04:00
|
|
|
|
|
|
|
bool CreateWalletDialog::isDescriptorWalletChecked() const
|
|
|
|
{
|
|
|
|
return ui->descriptor_checkbox->isChecked();
|
|
|
|
}
|