0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-12 11:19:08 -05:00

Wallet encrypt on create, allow to navigate options

This commit is contained in:
Hernan Marino 2023-03-14 14:01:17 -03:00 committed by Hernan Marino
parent baed5edeb6
commit cccddc03f0

View file

@ -104,10 +104,14 @@ void AskPassphraseDialog::accept()
// Cannot encrypt with empty passphrase // Cannot encrypt with empty passphrase
break; break;
} }
QMessageBox::StandardButton retval = QMessageBox::question(this, tr("Confirm wallet encryption"), QMessageBox msgBoxConfirm(QMessageBox::Question,
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?"), tr("Confirm wallet encryption"),
QMessageBox::Yes|QMessageBox::Cancel, 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?"),
QMessageBox::Cancel); QMessageBox::Cancel | QMessageBox::Yes, this);
msgBoxConfirm.button(QMessageBox::Yes)->setText(tr("Continue"));
msgBoxConfirm.button(QMessageBox::Cancel)->setText(tr("Back"));
msgBoxConfirm.setDefaultButton(QMessageBox::Cancel);
QMessageBox::StandardButton retval = (QMessageBox::StandardButton)msgBoxConfirm.exec();
if(retval == QMessageBox::Yes) if(retval == QMessageBox::Yes)
{ {
if(newpass1 == newpass2) if(newpass1 == newpass2)
@ -116,10 +120,19 @@ void AskPassphraseDialog::accept()
"your bitcoins from being stolen by malware infecting your computer."); "your bitcoins from being stolen by malware infecting your computer.");
if (m_passphrase_out) { if (m_passphrase_out) {
m_passphrase_out->assign(newpass1); m_passphrase_out->assign(newpass1);
QMessageBox::warning(this, tr("Wallet to be encrypted"), QMessageBox msgBoxWarning(QMessageBox::Warning,
"<qt>" + tr("Wallet to be encrypted"),
tr("Your wallet is about to be encrypted. ") + encryption_reminder + "<qt>" +
"</b></qt>"); tr("Your wallet is about to be encrypted. ") + encryption_reminder + " " +
tr("Are you sure you wish to encrypt your wallet?") +
"</b></qt>",
QMessageBox::Cancel | QMessageBox::Yes, this);
msgBoxWarning.setDefaultButton(QMessageBox::Cancel);
QMessageBox::StandardButton retval = (QMessageBox::StandardButton)msgBoxWarning.exec();
if (retval == QMessageBox::Cancel) {
QDialog::reject();
return;
}
} else { } else {
assert(model != nullptr); assert(model != nullptr);
if (model->setWalletEncrypted(newpass1)) { if (model->setWalletEncrypted(newpass1)) {
@ -145,11 +158,7 @@ void AskPassphraseDialog::accept()
tr("The supplied passphrases do not match.")); tr("The supplied passphrases do not match."));
} }
} }
else } break;
{
QDialog::reject(); // Cancelled
}
} break;
case Unlock: case Unlock:
try { try {
if (!model->setWalletLocked(false, oldpass)) { if (!model->setWalletLocked(false, oldpass)) {