mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-16 03:43:04 +02:00
Merge bitcoin-core/gui#109: wallet: Remove unused AskPassphraseDialog::Decrypt
4146a31ccbb012ff552f303113979b48c086532b qt, wallet: Drop unused parameter in WalletModel::setWalletEncrypted (Hennadii Stepanov) f886a20b02094d657ddb3d792d561d50f2107f07 qt, wallet: Drop unused parameter in Wallet{Frame|View}::encryptWallet (Hennadii Stepanov) 6e950118a31fd6a85026d934fc6adb6255e47e23 qt, wallet: Remove unused AskPassphraseDialog::Decrypt (Hennadii Stepanov) Pull request description: Grabbed from #42 with an additional commit. Fix #1. ACKs for top commit: MarcoFalke: ACK 4146a31ccbb012ff552f303113979b48c086532b promag: Code review ACK 4146a31ccbb012ff552f303113979b48c086532b. Tree-SHA512: 6070d8995525af826ad972cf1b8988ff98af0528eef285a07ec7ba0e2e92a7a6173a19dc371de94d4b437fa10f7921166e45a081de6ed2f4306e6502aafc94ee
This commit is contained in:
commit
54532f46c4
@ -58,14 +58,6 @@ AskPassphraseDialog::AskPassphraseDialog(Mode _mode, QWidget *parent, SecureStri
|
|||||||
ui->passEdit3->hide();
|
ui->passEdit3->hide();
|
||||||
setWindowTitle(tr("Unlock wallet"));
|
setWindowTitle(tr("Unlock wallet"));
|
||||||
break;
|
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
|
case ChangePass: // Ask old passphrase + new passphrase x2
|
||||||
setWindowTitle(tr("Change passphrase"));
|
setWindowTitle(tr("Change passphrase"));
|
||||||
ui->warningLabel->setText(tr("Enter the old passphrase and new passphrase for the wallet."));
|
ui->warningLabel->setText(tr("Enter the old passphrase and new passphrase for the wallet."));
|
||||||
@ -133,8 +125,7 @@ void AskPassphraseDialog::accept()
|
|||||||
"</b></qt>");
|
"</b></qt>");
|
||||||
} else {
|
} else {
|
||||||
assert(model != nullptr);
|
assert(model != nullptr);
|
||||||
if(model->setWalletEncrypted(true, newpass1))
|
if (model->setWalletEncrypted(newpass1)) {
|
||||||
{
|
|
||||||
QMessageBox::warning(this, tr("Wallet encrypted"),
|
QMessageBox::warning(this, tr("Wallet encrypted"),
|
||||||
"<qt>" +
|
"<qt>" +
|
||||||
tr("Your wallet is now encrypted. ") + encryption_reminder +
|
tr("Your wallet is now encrypted. ") + encryption_reminder +
|
||||||
@ -144,9 +135,7 @@ void AskPassphraseDialog::accept()
|
|||||||
"For security reasons, previous backups of the unencrypted wallet file "
|
"For security reasons, previous backups of the unencrypted wallet file "
|
||||||
"will become useless as soon as you start using the new, encrypted wallet.") +
|
"will become useless as soon as you start using the new, encrypted wallet.") +
|
||||||
"</b></qt>");
|
"</b></qt>");
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
QMessageBox::critical(this, tr("Wallet encryption failed"),
|
QMessageBox::critical(this, tr("Wallet encryption failed"),
|
||||||
tr("Wallet encryption failed due to an internal error. Your wallet was not encrypted."));
|
tr("Wallet encryption failed due to an internal error. Your wallet was not encrypted."));
|
||||||
}
|
}
|
||||||
@ -176,17 +165,6 @@ void AskPassphraseDialog::accept()
|
|||||||
QMessageBox::critical(this, tr("Wallet unlock failed"), e.what());
|
QMessageBox::critical(this, tr("Wallet unlock failed"), e.what());
|
||||||
}
|
}
|
||||||
break;
|
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:
|
case ChangePass:
|
||||||
if(newpass1 == newpass2)
|
if(newpass1 == newpass2)
|
||||||
{
|
{
|
||||||
@ -221,9 +199,6 @@ void AskPassphraseDialog::textChanged()
|
|||||||
acceptable = !ui->passEdit2->text().isEmpty() && !ui->passEdit3->text().isEmpty();
|
acceptable = !ui->passEdit2->text().isEmpty() && !ui->passEdit3->text().isEmpty();
|
||||||
break;
|
break;
|
||||||
case Unlock: // Old passphrase x1
|
case Unlock: // Old passphrase x1
|
||||||
case Decrypt:
|
|
||||||
acceptable = !ui->passEdit1->text().isEmpty();
|
|
||||||
break;
|
|
||||||
case ChangePass: // Old passphrase x1, new passphrase x2
|
case ChangePass: // Old passphrase x1, new passphrase x2
|
||||||
acceptable = !ui->passEdit1->text().isEmpty() && !ui->passEdit2->text().isEmpty() && !ui->passEdit3->text().isEmpty();
|
acceptable = !ui->passEdit1->text().isEmpty() && !ui->passEdit2->text().isEmpty() && !ui->passEdit3->text().isEmpty();
|
||||||
break;
|
break;
|
||||||
|
@ -26,7 +26,6 @@ public:
|
|||||||
Encrypt, /**< Ask passphrase twice and encrypt */
|
Encrypt, /**< Ask passphrase twice and encrypt */
|
||||||
Unlock, /**< Ask passphrase and unlock */
|
Unlock, /**< Ask passphrase and unlock */
|
||||||
ChangePass, /**< Ask old passphrase + new passphrase twice */
|
ChangePass, /**< Ask old passphrase + new passphrase twice */
|
||||||
Decrypt /**< Ask passphrase and decrypt wallet */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit AskPassphraseDialog(Mode mode, QWidget *parent, SecureString* passphrase_out = nullptr);
|
explicit AskPassphraseDialog(Mode mode, QWidget *parent, SecureString* passphrase_out = nullptr);
|
||||||
|
@ -196,11 +196,11 @@ void WalletFrame::gotoLoadPSBT(bool from_clipboard)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WalletFrame::encryptWallet(bool status)
|
void WalletFrame::encryptWallet()
|
||||||
{
|
{
|
||||||
WalletView *walletView = currentWalletView();
|
WalletView *walletView = currentWalletView();
|
||||||
if (walletView)
|
if (walletView)
|
||||||
walletView->encryptWallet(status);
|
walletView->encryptWallet();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WalletFrame::backupWallet()
|
void WalletFrame::backupWallet()
|
||||||
|
@ -86,7 +86,7 @@ public Q_SLOTS:
|
|||||||
void gotoLoadPSBT(bool from_clipboard = false);
|
void gotoLoadPSBT(bool from_clipboard = false);
|
||||||
|
|
||||||
/** Encrypt the wallet */
|
/** Encrypt the wallet */
|
||||||
void encryptWallet(bool status);
|
void encryptWallet();
|
||||||
/** Backup the wallet */
|
/** Backup the wallet */
|
||||||
void backupWallet();
|
void backupWallet();
|
||||||
/** Change encrypted wallet passphrase */
|
/** Change encrypted wallet passphrase */
|
||||||
|
@ -313,12 +313,9 @@ WalletModel::EncryptionStatus WalletModel::getEncryptionStatus() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WalletModel::setWalletEncrypted(bool encrypted, const SecureString &passphrase)
|
bool WalletModel::setWalletEncrypted(const SecureString& passphrase)
|
||||||
{
|
{
|
||||||
if (encrypted) {
|
return m_wallet->encryptWallet(passphrase);
|
||||||
return m_wallet->encryptWallet(passphrase);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WalletModel::setWalletLocked(bool locked, const SecureString &passPhrase)
|
bool WalletModel::setWalletLocked(bool locked, const SecureString &passPhrase)
|
||||||
|
@ -105,7 +105,7 @@ public:
|
|||||||
SendCoinsReturn sendCoins(WalletModelTransaction &transaction);
|
SendCoinsReturn sendCoins(WalletModelTransaction &transaction);
|
||||||
|
|
||||||
// Wallet encryption
|
// Wallet encryption
|
||||||
bool setWalletEncrypted(bool encrypted, const SecureString &passphrase);
|
bool setWalletEncrypted(const SecureString& passphrase);
|
||||||
// Passphrase only needed when unlocking
|
// Passphrase only needed when unlocking
|
||||||
bool setWalletLocked(bool locked, const SecureString &passPhrase=SecureString());
|
bool setWalletLocked(bool locked, const SecureString &passPhrase=SecureString());
|
||||||
bool changePassphrase(const SecureString &oldPass, const SecureString &newPass);
|
bool changePassphrase(const SecureString &oldPass, const SecureString &newPass);
|
||||||
|
@ -258,11 +258,11 @@ void WalletView::updateEncryptionStatus()
|
|||||||
Q_EMIT encryptionStatusChanged();
|
Q_EMIT encryptionStatusChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WalletView::encryptWallet(bool status)
|
void WalletView::encryptWallet()
|
||||||
{
|
{
|
||||||
if(!walletModel)
|
if(!walletModel)
|
||||||
return;
|
return;
|
||||||
AskPassphraseDialog dlg(status ? AskPassphraseDialog::Encrypt : AskPassphraseDialog::Decrypt, this);
|
AskPassphraseDialog dlg(AskPassphraseDialog::Encrypt, this);
|
||||||
dlg.setModel(walletModel);
|
dlg.setModel(walletModel);
|
||||||
dlg.exec();
|
dlg.exec();
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ public Q_SLOTS:
|
|||||||
*/
|
*/
|
||||||
void processNewTransaction(const QModelIndex& parent, int start, int /*end*/);
|
void processNewTransaction(const QModelIndex& parent, int start, int /*end*/);
|
||||||
/** Encrypt the wallet */
|
/** Encrypt the wallet */
|
||||||
void encryptWallet(bool status);
|
void encryptWallet();
|
||||||
/** Backup the wallet */
|
/** Backup the wallet */
|
||||||
void backupWallet();
|
void backupWallet();
|
||||||
/** Change encrypted wallet passphrase */
|
/** Change encrypted wallet passphrase */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user