aboutsummaryrefslogtreecommitdiff
path: root/src/qt/createwalletdialog.cpp
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2019-02-20 12:22:07 -0500
committerAndrew Chow <achow101-github@achow101.com>2019-09-05 20:36:57 -0400
commit78863e290006e61060622dbdbecc5b58c0fefa05 (patch)
tree63370880baf94c3a2576c3fa2e0b6d3fce4b683c /src/qt/createwalletdialog.cpp
parent60adb21c7affb41ec475a62a53fb0a36bea35dfb (diff)
Add CreateWalletDialog to create wallets from the GUI
Co-authored-by: João Barbosa <joao.paulo.barbosa@gmail.com>
Diffstat (limited to 'src/qt/createwalletdialog.cpp')
-rw-r--r--src/qt/createwalletdialog.cpp61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/qt/createwalletdialog.cpp b/src/qt/createwalletdialog.cpp
new file mode 100644
index 0000000000..449dcc70a0
--- /dev/null
+++ b/src/qt/createwalletdialog.cpp
@@ -0,0 +1,61 @@
+// 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);
+ ui->buttonBox->button(QDialogButtonBox::Ok)->setText("Create");
+ 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) {
+ // Disable disable_privkeys_checkbox when encrypt is set to true, enable it when encrypt is false
+ 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();
+}
+
+bool CreateWalletDialog::encrypt() const
+{
+ return ui->encrypt_wallet_checkbox->isChecked();
+}
+
+bool CreateWalletDialog::disablePrivateKeys() const
+{
+ return ui->disable_privkeys_checkbox->isChecked();
+}
+
+bool CreateWalletDialog::blank() const
+{
+ return ui->blank_wallet_checkbox->isChecked();
+}