Skip to content

Commit a953429

Browse files
committed
Merge #16822: gui: Create wallet menu option follow-ups
cad3ab5 gui: fix autofocus in CreateWalletActivity::askPassphrase() (Jon Atack) 539d940 gui: fix passphrase labels/tooltip in createwalletdialog/askpassphrasedialog (Jon Atack) 43aa9b0 gui: rename encrypt(), blank(), and askPasshprase() (Jon Atack) Pull request description: Closes #16820. The wallet [name escaping issue](bitcoin/bitcoin#15450 (review)) in that issue predates #15450 and is fixed by #16826. - [x] rename encrypt() to encryptWallet(), and blank() to makeBlankWallet() // EDIT: updated to isEncryptWalletChecked() isDisablePrivateKeysChecked() isMakeBlankWalletChecked() - [x] fix naming of askPasshprase() to askPassphrase() - [x] fix passphrase labels and tooltip in createwalletdialog.ui and askpassphrasedialog.ui - [x] fix grammar of labels in askpassphrase dialog and WalletController::closeWallet - [x] fix autofocus in CreateWalletActivity::askPassphrase() Squashed down to three commits. Reviewers, to test manually: build, launch the gui wallet, and look at labels/tooltips/focus with the create wallet, encrypt wallet, change password, and close wallet commands. ACKs for top commit: jb55: Approach ACK cad3ab5 instagibbs: code review and tACK cad3ab5 fanquake: ACK cad3ab5 Tree-SHA512: b441fbf8f8cd370dd692bac24f0d3c1b32fc7d947b6c3a2c9ba7cf0bc175a72b3460440f2f10f7632c0e8e0f8e65fe15615a30c46e2c7763bf258c504b457dd6
2 parents 9debfd0 + cad3ab5 commit a953429

8 files changed

+23
-19
lines changed

src/qt/askpassphrasedialog.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ AskPassphraseDialog::AskPassphraseDialog(Mode _mode, QWidget *parent, SecureStri
4444
switch(mode)
4545
{
4646
case Encrypt: // Ask passphrase x2
47-
ui->warningLabel->setText(tr("Enter the new passphrase to the wallet.<br/>Please use a passphrase of <b>ten or more random characters</b>, or <b>eight or more words</b>."));
47+
ui->warningLabel->setText(tr("Enter the new passphrase for the wallet.<br/>Please use a passphrase of <b>ten or more random characters</b>, or <b>eight or more words</b>."));
4848
ui->passLabel1->hide();
4949
ui->passEdit1->hide();
5050
setWindowTitle(tr("Encrypt wallet"));
@@ -67,7 +67,7 @@ AskPassphraseDialog::AskPassphraseDialog(Mode _mode, QWidget *parent, SecureStri
6767
break;
6868
case ChangePass: // Ask old passphrase + new passphrase x2
6969
setWindowTitle(tr("Change passphrase"));
70-
ui->warningLabel->setText(tr("Enter the old passphrase and new passphrase to the wallet."));
70+
ui->warningLabel->setText(tr("Enter the old passphrase and new passphrase for the wallet."));
7171
break;
7272
}
7373
textChanged();

src/qt/bitcoingui.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,9 @@ void BitcoinGUI::createActions()
375375
for (const std::pair<const std::string, bool>& i : m_wallet_controller->listWalletDir()) {
376376
const std::string& path = i.first;
377377
QString name = path.empty() ? QString("["+tr("default wallet")+"]") : QString::fromStdString(path);
378-
// Menu items remove single &. Single & are shown when && is in the string, but only the first occurrence. So replace only the first & with &&
378+
// Menu items remove single &. Single & are shown when && is in
379+
// the string, but only the first occurrence. So replace only
380+
// the first & with &&.
379381
name.replace(name.indexOf(QChar('&')), 1, QString("&&"));
380382
QAction* action = m_open_wallet_menu->addAction(name);
381383

src/qt/createwalletdialog.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ CreateWalletDialog::CreateWalletDialog(QWidget* parent) :
2525
});
2626

2727
connect(ui->encrypt_wallet_checkbox, &QCheckBox::toggled, [this](bool checked) {
28-
// Disable disable_privkeys_checkbox when encrypt is set to true, enable it when encrypt is false
28+
// Disable the disable_privkeys_checkbox when isEncryptWalletChecked is
29+
// set to true, enable it when isEncryptWalletChecked is false.
2930
ui->disable_privkeys_checkbox->setEnabled(!checked);
3031

3132
// When the disable_privkeys_checkbox is disabled, uncheck it.
@@ -45,17 +46,17 @@ QString CreateWalletDialog::walletName() const
4546
return ui->wallet_name_line_edit->text();
4647
}
4748

48-
bool CreateWalletDialog::encrypt() const
49+
bool CreateWalletDialog::isEncryptWalletChecked() const
4950
{
5051
return ui->encrypt_wallet_checkbox->isChecked();
5152
}
5253

53-
bool CreateWalletDialog::disablePrivateKeys() const
54+
bool CreateWalletDialog::isDisablePrivateKeysChecked() const
5455
{
5556
return ui->disable_privkeys_checkbox->isChecked();
5657
}
5758

58-
bool CreateWalletDialog::blank() const
59+
bool CreateWalletDialog::isMakeBlankWalletChecked() const
5960
{
6061
return ui->blank_wallet_checkbox->isChecked();
6162
}

src/qt/createwalletdialog.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ class CreateWalletDialog : public QDialog
2424
virtual ~CreateWalletDialog();
2525

2626
QString walletName() const;
27-
bool encrypt() const;
28-
bool disablePrivateKeys() const;
29-
bool blank() const;
27+
bool isEncryptWalletChecked() const;
28+
bool isDisablePrivateKeysChecked() const;
29+
bool isMakeBlankWalletChecked() const;
3030

3131
private:
3232
Ui::CreateWalletDialog *ui;

src/qt/forms/askpassphrasedialog.ui

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
<item row="3" column="1">
9696
<widget class="QCheckBox" name="toggleShowPasswordButton">
9797
<property name="text">
98-
<string>Show password</string>
98+
<string>Show passphrase</string>
9999
</property>
100100
</widget>
101101
</item>

src/qt/forms/createwalletdialog.ui

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
</rect>
6363
</property>
6464
<property name="toolTip">
65-
<string>Encrypt the wallet. The wallet will be encrypted with a password of your choice.</string>
65+
<string>Encrypt the wallet. The wallet will be encrypted with a passphrase of your choice.</string>
6666
</property>
6767
<property name="text">
6868
<string>Encrypt Wallet</string>

src/qt/walletcontroller.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ void WalletController::closeWallet(WalletModel* wallet_model, QWidget* parent)
7575
{
7676
QMessageBox box(parent);
7777
box.setWindowTitle(tr("Close wallet"));
78-
box.setText(tr("Are you sure you wish to close wallet <i>%1</i>?").arg(GUIUtil::HtmlEscape(wallet_model->getDisplayName())));
78+
box.setText(tr("Are you sure you wish to close the wallet <i>%1</i>?").arg(GUIUtil::HtmlEscape(wallet_model->getDisplayName())));
7979
box.setInformativeText(tr("Closing the wallet for too long can result in having to resync the entire chain if pruning is enabled."));
8080
box.setStandardButtons(QMessageBox::Yes|QMessageBox::Cancel);
8181
box.setDefaultButton(QMessageBox::Yes);
@@ -179,9 +179,10 @@ CreateWalletActivity::~CreateWalletActivity()
179179
delete m_passphrase_dialog;
180180
}
181181

182-
void CreateWalletActivity::askPasshprase()
182+
void CreateWalletActivity::askPassphrase()
183183
{
184184
m_passphrase_dialog = new AskPassphraseDialog(AskPassphraseDialog::Encrypt, m_parent_widget, &m_passphrase);
185+
m_passphrase_dialog->setWindowModality(Qt::ApplicationModal);
185186
m_passphrase_dialog->show();
186187

187188
connect(m_passphrase_dialog, &QObject::destroyed, [this] {
@@ -201,10 +202,10 @@ void CreateWalletActivity::createWallet()
201202

202203
std::string name = m_create_wallet_dialog->walletName().toStdString();
203204
uint64_t flags = 0;
204-
if (m_create_wallet_dialog->disablePrivateKeys()) {
205+
if (m_create_wallet_dialog->isDisablePrivateKeysChecked()) {
205206
flags |= WALLET_FLAG_DISABLE_PRIVATE_KEYS;
206207
}
207-
if (m_create_wallet_dialog->blank()) {
208+
if (m_create_wallet_dialog->isMakeBlankWalletChecked()) {
208209
flags |= WALLET_FLAG_BLANK_WALLET;
209210
}
210211

@@ -246,8 +247,8 @@ void CreateWalletActivity::create()
246247
Q_EMIT finished();
247248
});
248249
connect(m_create_wallet_dialog, &QDialog::accepted, [this] {
249-
if (m_create_wallet_dialog->encrypt()) {
250-
askPasshprase();
250+
if (m_create_wallet_dialog->isEncryptWalletChecked()) {
251+
askPassphrase();
251252
} else {
252253
createWallet();
253254
}

src/qt/walletcontroller.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class CreateWalletActivity : public WalletControllerActivity
118118
void created(WalletModel* wallet_model);
119119

120120
private:
121-
void askPasshprase();
121+
void askPassphrase();
122122
void createWallet();
123123
void finish();
124124

0 commit comments

Comments
 (0)