diff --git a/src/qt/walletview.cpp b/src/qt/walletview.cpp index 9b2c116dc7..9572125ef7 100644 --- a/src/qt/walletview.cpp +++ b/src/qt/walletview.cpp @@ -210,21 +210,31 @@ void WalletView::encryptWallet() void WalletView::backupWallet() { + QString filetype_str; QString filename = GUIUtil::getSaveFileName(this, tr("Backup Wallet"), QString(), //: 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()) return; - constexpr WalletBackupFormat filetype = WalletBackupFormat::Raw; + WalletBackupFormat filetype; + if (filetype_str == "walletdbdump") { + filetype = WalletBackupFormat::DbDump; + } else { + filetype = WalletBackupFormat::Raw; + } + bilingual_str 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), - CClientUIInterface::MSG_ERROR); + if (error.empty()) { + 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), CClientUIInterface::MSG_INFORMATION); }