Skip to content

Commit

Permalink
qt, wallet: Remove unused AskPassphraseDialog::Decrypt
Browse files Browse the repository at this point in the history
Summary:
Co-authored-by: Sehyun Chung <[email protected]>

This is a backport of [[bitcoin-core/gui#109 | core-gui#109]] [1/3]
bitcoin-core/gui@6e95011

Test Plan: `ninja all check-all`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D10737
  • Loading branch information
hebasto authored and PiRK committed Dec 23, 2021
1 parent dbfb106 commit 01d8946
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 27 deletions.
23 changes: 1 addition & 22 deletions src/qt/askpassphrasedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,6 @@ AskPassphraseDialog::AskPassphraseDialog(Mode _mode, QWidget *parent,
ui->passEdit3->hide();
setWindowTitle(tr("Unlock wallet"));
break;
case Decrypt: // Ask passphrase
ui->warningLabel->setText(tr("This operation needs your wallet "
"passphrase to decrypt the wallet."));
ui->passLabel2->hide();
ui->passEdit2->hide();
ui->passLabel3->hide();
ui->passEdit3->hide();
setWindowTitle(tr("Decrypt wallet"));
break;
case ChangePass: // Ask old passphrase + new passphrase x2
setWindowTitle(tr("Change passphrase"));
ui->warningLabel->setText(tr(
Expand Down Expand Up @@ -186,15 +177,6 @@ void AskPassphraseDialog::accept() {
e.what());
}
break;
case Decrypt:
if (!model->setWalletEncrypted(false, oldpass)) {
QMessageBox::critical(this, tr("Wallet decryption failed"),
tr("The passphrase entered for the "
"wallet decryption was incorrect."));
} else {
QDialog::accept(); // Success
}
break;
case ChangePass:
if (newpass1 == newpass2) {
if (model->changePassphrase(oldpass, newpass1)) {
Expand Down Expand Up @@ -225,10 +207,7 @@ void AskPassphraseDialog::textChanged() {
acceptable = !ui->passEdit2->text().isEmpty() &&
!ui->passEdit3->text().isEmpty();
break;
case Unlock: // Old passphrase x1
case Decrypt:
acceptable = !ui->passEdit1->text().isEmpty();
break;
case Unlock: // Old passphrase x1
case ChangePass: // Old passphrase x1, new passphrase x2
acceptable = !ui->passEdit1->text().isEmpty() &&
!ui->passEdit2->text().isEmpty() &&
Expand Down
1 change: 0 additions & 1 deletion src/qt/askpassphrasedialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class AskPassphraseDialog : public QDialog {
Encrypt, /**< Ask passphrase twice and encrypt */
Unlock, /**< Ask passphrase and unlock */
ChangePass, /**< Ask old passphrase + new passphrase twice */
Decrypt /**< Ask passphrase and decrypt wallet */
};

explicit AskPassphraseDialog(Mode mode, QWidget *parent,
Expand Down
5 changes: 1 addition & 4 deletions src/qt/walletview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,7 @@ void WalletView::encryptWallet(bool status) {
if (!walletModel) {
return;
}

AskPassphraseDialog dlg(status ? AskPassphraseDialog::Encrypt
: AskPassphraseDialog::Decrypt,
this);
AskPassphraseDialog dlg(AskPassphraseDialog::Encrypt, this);
dlg.setModel(walletModel);
dlg.exec();

Expand Down

0 comments on commit 01d8946

Please sign in to comment.