mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-08-04 05:54:48 +02:00
GUI: Support backup to DumpWallet format
This commit is contained in:
parent
ce88a6dea4
commit
6b1898af6d
@ -210,21 +210,31 @@ void WalletView::encryptWallet()
|
|||||||
|
|
||||||
void WalletView::backupWallet()
|
void WalletView::backupWallet()
|
||||||
{
|
{
|
||||||
|
QString filetype_str;
|
||||||
QString filename = GUIUtil::getSaveFileName(this,
|
QString filename = GUIUtil::getSaveFileName(this,
|
||||||
tr("Backup Wallet"), QString(),
|
tr("Backup Wallet"), QString(),
|
||||||
//: Name of the wallet data file format.
|
//: Name of the wallet data file format.
|
||||||
tr("Wallet Data") + QLatin1String(" (*.dat)"), nullptr);
|
tr("Wallet Data") + QLatin1String(" (*.dat);;") + tr("Wallet Database Dump File") + QLatin1String(" (*.walletdbdump)"),
|
||||||
|
&filetype_str);
|
||||||
|
|
||||||
if (filename.isEmpty())
|
if (filename.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
constexpr WalletBackupFormat filetype = WalletBackupFormat::Raw;
|
WalletBackupFormat filetype;
|
||||||
|
if (filetype_str == "walletdbdump") {
|
||||||
|
filetype = WalletBackupFormat::DbDump;
|
||||||
|
} else {
|
||||||
|
filetype = WalletBackupFormat::Raw;
|
||||||
|
}
|
||||||
|
|
||||||
bilingual_str error;
|
bilingual_str error;
|
||||||
if (!walletModel->wallet().backupWallet(filename.toLocal8Bit().data(), filetype, error)) {
|
if (!walletModel->wallet().backupWallet(filename.toLocal8Bit().data(), filetype, error)) {
|
||||||
Q_EMIT message(tr("Backup Failed"), tr("There was an error trying to save the wallet data to %1.").arg(filename),
|
if (error.empty()) {
|
||||||
CClientUIInterface::MSG_ERROR);
|
Q_EMIT message(tr("Backup Failed"), tr("There was an error trying to save the wallet data to %1.").arg(filename), CClientUIInterface::MSG_ERROR);
|
||||||
|
} else {
|
||||||
|
Q_EMIT message(tr("Backup Failed"), tr("There was an error trying to save the wallet data to %1: %2").arg(filename).arg(QString::fromStdString(error.translated)), CClientUIInterface::MSG_ERROR);
|
||||||
}
|
}
|
||||||
else {
|
} else {
|
||||||
Q_EMIT message(tr("Backup Successful"), tr("The wallet data was successfully saved to %1.").arg(filename),
|
Q_EMIT message(tr("Backup Successful"), tr("The wallet data was successfully saved to %1.").arg(filename),
|
||||||
CClientUIInterface::MSG_INFORMATION);
|
CClientUIInterface::MSG_INFORMATION);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user