From 43aa9b0d790840e30c1cd128e67946ffcbfeb721 Mon Sep 17 00:00:00 2001 From: Jon Atack Date: Sat, 7 Sep 2019 11:08:28 +0200 Subject: [PATCH 1/3] gui: rename encrypt(), blank(), and askPasshprase() as well as disablePrivateKeys() to be consistent in naming. --- src/qt/createwalletdialog.cpp | 9 +++++---- src/qt/createwalletdialog.h | 6 +++--- src/qt/walletcontroller.cpp | 10 +++++----- src/qt/walletcontroller.h | 2 +- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/qt/createwalletdialog.cpp b/src/qt/createwalletdialog.cpp index 10262c37c35..8e6474b0d40 100644 --- a/src/qt/createwalletdialog.cpp +++ b/src/qt/createwalletdialog.cpp @@ -25,7 +25,8 @@ CreateWalletDialog::CreateWalletDialog(QWidget* parent) : }); 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 + // Disable the disable_privkeys_checkbox when isEncryptWalletChecked is + // set to true, enable it when isEncryptWalletChecked is false. ui->disable_privkeys_checkbox->setEnabled(!checked); // When the disable_privkeys_checkbox is disabled, uncheck it. @@ -45,17 +46,17 @@ QString CreateWalletDialog::walletName() const return ui->wallet_name_line_edit->text(); } -bool CreateWalletDialog::encrypt() const +bool CreateWalletDialog::isEncryptWalletChecked() const { return ui->encrypt_wallet_checkbox->isChecked(); } -bool CreateWalletDialog::disablePrivateKeys() const +bool CreateWalletDialog::isDisablePrivateKeysChecked() const { return ui->disable_privkeys_checkbox->isChecked(); } -bool CreateWalletDialog::blank() const +bool CreateWalletDialog::isMakeBlankWalletChecked() const { return ui->blank_wallet_checkbox->isChecked(); } diff --git a/src/qt/createwalletdialog.h b/src/qt/createwalletdialog.h index a1365b59694..30766107b9c 100644 --- a/src/qt/createwalletdialog.h +++ b/src/qt/createwalletdialog.h @@ -24,9 +24,9 @@ public: virtual ~CreateWalletDialog(); QString walletName() const; - bool encrypt() const; - bool disablePrivateKeys() const; - bool blank() const; + bool isEncryptWalletChecked() const; + bool isDisablePrivateKeysChecked() const; + bool isMakeBlankWalletChecked() const; private: Ui::CreateWalletDialog *ui; diff --git a/src/qt/walletcontroller.cpp b/src/qt/walletcontroller.cpp index 8b8283d3d8b..419ba9446fe 100644 --- a/src/qt/walletcontroller.cpp +++ b/src/qt/walletcontroller.cpp @@ -179,7 +179,7 @@ CreateWalletActivity::~CreateWalletActivity() delete m_passphrase_dialog; } -void CreateWalletActivity::askPasshprase() +void CreateWalletActivity::askPassphrase() { m_passphrase_dialog = new AskPassphraseDialog(AskPassphraseDialog::Encrypt, m_parent_widget, &m_passphrase); m_passphrase_dialog->show(); @@ -201,10 +201,10 @@ void CreateWalletActivity::createWallet() std::string name = m_create_wallet_dialog->walletName().toStdString(); uint64_t flags = 0; - if (m_create_wallet_dialog->disablePrivateKeys()) { + if (m_create_wallet_dialog->isDisablePrivateKeysChecked()) { flags |= WALLET_FLAG_DISABLE_PRIVATE_KEYS; } - if (m_create_wallet_dialog->blank()) { + if (m_create_wallet_dialog->isMakeBlankWalletChecked()) { flags |= WALLET_FLAG_BLANK_WALLET; } @@ -246,8 +246,8 @@ void CreateWalletActivity::create() Q_EMIT finished(); }); connect(m_create_wallet_dialog, &QDialog::accepted, [this] { - if (m_create_wallet_dialog->encrypt()) { - askPasshprase(); + if (m_create_wallet_dialog->isEncryptWalletChecked()) { + askPassphrase(); } else { createWallet(); } diff --git a/src/qt/walletcontroller.h b/src/qt/walletcontroller.h index 4e1a772f3ad..fb37b7292c0 100644 --- a/src/qt/walletcontroller.h +++ b/src/qt/walletcontroller.h @@ -118,7 +118,7 @@ Q_SIGNALS: void created(WalletModel* wallet_model); private: - void askPasshprase(); + void askPassphrase(); void createWallet(); void finish(); From 539d9403af956c76ae0149a58c07c71a6b58ac69 Mon Sep 17 00:00:00 2001 From: Jon Atack Date: Sat, 7 Sep 2019 11:52:37 +0200 Subject: [PATCH 2/3] gui: fix passphrase labels/tooltip in createwalletdialog/askpassphrasedialog UI improvements: - update remaining GUI wallet labels and tooltips from passwords to passphrases - improve grammar of labels in askpassphrase dialog and WalletController::closeWallet --- src/qt/askpassphrasedialog.cpp | 4 ++-- src/qt/forms/askpassphrasedialog.ui | 2 +- src/qt/forms/createwalletdialog.ui | 2 +- src/qt/walletcontroller.cpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/qt/askpassphrasedialog.cpp b/src/qt/askpassphrasedialog.cpp index c9f17d12ec9..2ababb5e1ef 100644 --- a/src/qt/askpassphrasedialog.cpp +++ b/src/qt/askpassphrasedialog.cpp @@ -44,7 +44,7 @@ AskPassphraseDialog::AskPassphraseDialog(Mode _mode, QWidget *parent, SecureStri switch(mode) { case Encrypt: // Ask passphrase x2 - ui->warningLabel->setText(tr("Enter the new passphrase to the wallet.
Please use a passphrase of ten or more random characters, or eight or more words.")); + ui->warningLabel->setText(tr("Enter the new passphrase for the wallet.
Please use a passphrase of ten or more random characters, or eight or more words.")); ui->passLabel1->hide(); ui->passEdit1->hide(); setWindowTitle(tr("Encrypt wallet")); @@ -67,7 +67,7 @@ AskPassphraseDialog::AskPassphraseDialog(Mode _mode, QWidget *parent, SecureStri break; case ChangePass: // Ask old passphrase + new passphrase x2 setWindowTitle(tr("Change passphrase")); - ui->warningLabel->setText(tr("Enter the old passphrase and new passphrase to the wallet.")); + ui->warningLabel->setText(tr("Enter the old passphrase and new passphrase for the wallet.")); break; } textChanged(); diff --git a/src/qt/forms/askpassphrasedialog.ui b/src/qt/forms/askpassphrasedialog.ui index 69803989cd1..e74d1838187 100644 --- a/src/qt/forms/askpassphrasedialog.ui +++ b/src/qt/forms/askpassphrasedialog.ui @@ -95,7 +95,7 @@ - Show password + Show passphrase diff --git a/src/qt/forms/createwalletdialog.ui b/src/qt/forms/createwalletdialog.ui index 1fbaeeaaab3..e49bab8f3bd 100644 --- a/src/qt/forms/createwalletdialog.ui +++ b/src/qt/forms/createwalletdialog.ui @@ -62,7 +62,7 @@ - Encrypt the wallet. The wallet will be encrypted with a password of your choice. + Encrypt the wallet. The wallet will be encrypted with a passphrase of your choice. Encrypt Wallet diff --git a/src/qt/walletcontroller.cpp b/src/qt/walletcontroller.cpp index 419ba9446fe..4fab3752e18 100644 --- a/src/qt/walletcontroller.cpp +++ b/src/qt/walletcontroller.cpp @@ -75,7 +75,7 @@ void WalletController::closeWallet(WalletModel* wallet_model, QWidget* parent) { QMessageBox box(parent); box.setWindowTitle(tr("Close wallet")); - box.setText(tr("Are you sure you wish to close wallet %1?").arg(GUIUtil::HtmlEscape(wallet_model->getDisplayName()))); + box.setText(tr("Are you sure you wish to close the wallet %1?").arg(GUIUtil::HtmlEscape(wallet_model->getDisplayName()))); box.setInformativeText(tr("Closing the wallet for too long can result in having to resync the entire chain if pruning is enabled.")); box.setStandardButtons(QMessageBox::Yes|QMessageBox::Cancel); box.setDefaultButton(QMessageBox::Yes); From cad3ab5db835e1d0c44c6a5fc0e4b2d1661dcd5c Mon Sep 17 00:00:00 2001 From: Jon Atack Date: Sat, 7 Sep 2019 12:07:54 +0200 Subject: [PATCH 3/3] gui: fix autofocus in CreateWalletActivity::askPassphrase() --- src/qt/bitcoingui.cpp | 4 +++- src/qt/walletcontroller.cpp | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index c672171cfb8..7671fde7051 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -375,7 +375,9 @@ void BitcoinGUI::createActions() for (const std::pair& i : m_wallet_controller->listWalletDir()) { const std::string& path = i.first; QString name = path.empty() ? QString("["+tr("default wallet")+"]") : QString::fromStdString(path); - // Menu items remove single &. Single & are shown when && is in the string, but only the first occurrence. So replace only the first & with && + // Menu items remove single &. Single & are shown when && is in + // the string, but only the first occurrence. So replace only + // the first & with &&. name.replace(name.indexOf(QChar('&')), 1, QString("&&")); QAction* action = m_open_wallet_menu->addAction(name); diff --git a/src/qt/walletcontroller.cpp b/src/qt/walletcontroller.cpp index 4fab3752e18..fa6f9f3f169 100644 --- a/src/qt/walletcontroller.cpp +++ b/src/qt/walletcontroller.cpp @@ -182,6 +182,7 @@ CreateWalletActivity::~CreateWalletActivity() void CreateWalletActivity::askPassphrase() { m_passphrase_dialog = new AskPassphraseDialog(AskPassphraseDialog::Encrypt, m_parent_widget, &m_passphrase); + m_passphrase_dialog->setWindowModality(Qt::ApplicationModal); m_passphrase_dialog->show(); connect(m_passphrase_dialog, &QObject::destroyed, [this] {