Skip to content

Commit cccddc0

Browse files
committed
Wallet encrypt on create, allow to navigate options
1 parent baed5ed commit cccddc0

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

src/qt/askpassphrasedialog.cpp

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,14 @@ void AskPassphraseDialog::accept()
104104
// Cannot encrypt with empty passphrase
105105
break;
106106
}
107-
QMessageBox::StandardButton retval = QMessageBox::question(this, tr("Confirm wallet encryption"),
108-
tr("Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR BITCOINS</b>!") + "<br><br>" + tr("Are you sure you wish to encrypt your wallet?"),
109-
QMessageBox::Yes|QMessageBox::Cancel,
110-
QMessageBox::Cancel);
107+
QMessageBox msgBoxConfirm(QMessageBox::Question,
108+
tr("Confirm wallet encryption"),
109+
tr("Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR BITCOINS</b>!") + "<br><br>" + tr("Are you sure you wish to encrypt your wallet?"),
110+
QMessageBox::Cancel | QMessageBox::Yes, this);
111+
msgBoxConfirm.button(QMessageBox::Yes)->setText(tr("Continue"));
112+
msgBoxConfirm.button(QMessageBox::Cancel)->setText(tr("Back"));
113+
msgBoxConfirm.setDefaultButton(QMessageBox::Cancel);
114+
QMessageBox::StandardButton retval = (QMessageBox::StandardButton)msgBoxConfirm.exec();
111115
if(retval == QMessageBox::Yes)
112116
{
113117
if(newpass1 == newpass2)
@@ -116,10 +120,19 @@ void AskPassphraseDialog::accept()
116120
"your bitcoins from being stolen by malware infecting your computer.");
117121
if (m_passphrase_out) {
118122
m_passphrase_out->assign(newpass1);
119-
QMessageBox::warning(this, tr("Wallet to be encrypted"),
120-
"<qt>" +
121-
tr("Your wallet is about to be encrypted. ") + encryption_reminder +
122-
"</b></qt>");
123+
QMessageBox msgBoxWarning(QMessageBox::Warning,
124+
tr("Wallet to be encrypted"),
125+
"<qt>" +
126+
tr("Your wallet is about to be encrypted. ") + encryption_reminder + " " +
127+
tr("Are you sure you wish to encrypt your wallet?") +
128+
"</b></qt>",
129+
QMessageBox::Cancel | QMessageBox::Yes, this);
130+
msgBoxWarning.setDefaultButton(QMessageBox::Cancel);
131+
QMessageBox::StandardButton retval = (QMessageBox::StandardButton)msgBoxWarning.exec();
132+
if (retval == QMessageBox::Cancel) {
133+
QDialog::reject();
134+
return;
135+
}
123136
} else {
124137
assert(model != nullptr);
125138
if (model->setWalletEncrypted(newpass1)) {
@@ -145,11 +158,7 @@ void AskPassphraseDialog::accept()
145158
tr("The supplied passphrases do not match."));
146159
}
147160
}
148-
else
149-
{
150-
QDialog::reject(); // Cancelled
151-
}
152-
} break;
161+
} break;
153162
case Unlock:
154163
try {
155164
if (!model->setWalletLocked(false, oldpass)) {

0 commit comments

Comments
 (0)