Skip to content

Commit 033ffc4

Browse files
committed
Merge pull request #3160 from Diapolo/walletview
[Qt] walletview: make backupWallet() use GUIUtil::getSaveFileName()
2 parents 42a12f2 + d127964 commit 033ffc4

File tree

1 file changed

+16
-21
lines changed

1 file changed

+16
-21
lines changed

src/qt/walletview.cpp

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,11 @@
1818
#include "overviewpage.h"
1919
#include "askpassphrasedialog.h"
2020
#include "ui_interface.h"
21+
#include "guiutil.h"
2122

2223
#include <QHBoxLayout>
2324
#include <QVBoxLayout>
2425
#include <QAction>
25-
#if QT_VERSION < 0x050000
26-
#include <QDesktopServices>
27-
#else
28-
#include <QStandardPaths>
29-
#endif
30-
#include <QFileDialog>
3126
#include <QPushButton>
3227

3328
WalletView::WalletView(QWidget *parent):
@@ -61,7 +56,7 @@ WalletView::WalletView(QWidget *parent):
6156
addWidget(receiveCoinsPage);
6257
addWidget(sendCoinsPage);
6358

64-
// Clicking on a transaction on the overview page simply sends you to transaction history page
59+
// Clicking on a transaction on the overview pre-selects the transaction on the transaction history page
6560
connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));
6661

6762
// Double-clicking on a transaction on the transaction history page shows details
@@ -82,7 +77,7 @@ void WalletView::setBitcoinGUI(BitcoinGUI *gui)
8277
{
8378
if (gui)
8479
{
85-
// Clicking on a transaction on the overview page sends you to the transactions tab
80+
// Clicking on a transaction on the overview page simply sends you to transaction history page
8681
connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), gui, SLOT(gotoHistoryPage()));
8782

8883
// Receive and report messages
@@ -222,20 +217,20 @@ void WalletView::encryptWallet(bool status)
222217

223218
void WalletView::backupWallet()
224219
{
225-
#if QT_VERSION < 0x050000
226-
QString saveDir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
227-
#else
228-
QString saveDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
229-
#endif
230-
QString filename = QFileDialog::getSaveFileName(this, tr("Backup Wallet"), saveDir, tr("Wallet Data (*.dat)"));
231-
if (!filename.isEmpty()) {
232-
if (!walletModel->backupWallet(filename)) {
233-
emit message(tr("Backup Failed"), tr("There was an error trying to save the wallet data to the new location."),
234-
CClientUIInterface::MSG_ERROR);
220+
QString filename = GUIUtil::getSaveFileName(this,
221+
tr("Backup Wallet"), QString(),
222+
tr("Wallet Data (*.dat)"));
223+
224+
if (filename.isEmpty())
225+
return;
226+
227+
if (!walletModel->backupWallet(filename)) {
228+
emit message(tr("Backup Failed"), tr("There was an error trying to save the wallet data to %1.").arg(filename),
229+
CClientUIInterface::MSG_ERROR);
235230
}
236-
else
237-
emit message(tr("Backup Successful"), tr("The wallet data was successfully saved to the new location."),
238-
CClientUIInterface::MSG_INFORMATION);
231+
else {
232+
emit message(tr("Backup Successful"), tr("The wallet data was successfully saved to %1.").arg(filename),
233+
CClientUIInterface::MSG_INFORMATION);
239234
}
240235
}
241236

0 commit comments

Comments
 (0)