Browse Source

Merge pull request #3160 from Diapolo/walletview

[Qt] walletview: make backupWallet() use GUIUtil::getSaveFileName()
0.10
Wladimir J. van der Laan 11 years ago
parent
commit
033ffc4377
  1. 37
      src/qt/walletview.cpp

37
src/qt/walletview.cpp

@ -18,16 +18,11 @@
#include "overviewpage.h" #include "overviewpage.h"
#include "askpassphrasedialog.h" #include "askpassphrasedialog.h"
#include "ui_interface.h" #include "ui_interface.h"
#include "guiutil.h"
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QAction> #include <QAction>
#if QT_VERSION < 0x050000
#include <QDesktopServices>
#else
#include <QStandardPaths>
#endif
#include <QFileDialog>
#include <QPushButton> #include <QPushButton>
WalletView::WalletView(QWidget *parent): WalletView::WalletView(QWidget *parent):
@ -61,7 +56,7 @@ WalletView::WalletView(QWidget *parent):
addWidget(receiveCoinsPage); addWidget(receiveCoinsPage);
addWidget(sendCoinsPage); addWidget(sendCoinsPage);
// Clicking on a transaction on the overview page simply sends you to transaction history page // Clicking on a transaction on the overview pre-selects the transaction on the transaction history page
connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex))); connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));
// Double-clicking on a transaction on the transaction history page shows details // Double-clicking on a transaction on the transaction history page shows details
@ -82,7 +77,7 @@ void WalletView::setBitcoinGUI(BitcoinGUI *gui)
{ {
if (gui) if (gui)
{ {
// Clicking on a transaction on the overview page sends you to the transactions tab // Clicking on a transaction on the overview page simply sends you to transaction history page
connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), gui, SLOT(gotoHistoryPage())); connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), gui, SLOT(gotoHistoryPage()));
// Receive and report messages // Receive and report messages
@ -222,20 +217,20 @@ void WalletView::encryptWallet(bool status)
void WalletView::backupWallet() void WalletView::backupWallet()
{ {
#if QT_VERSION < 0x050000 QString filename = GUIUtil::getSaveFileName(this,
QString saveDir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation); tr("Backup Wallet"), QString(),
#else tr("Wallet Data (*.dat)"));
QString saveDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
#endif if (filename.isEmpty())
QString filename = QFileDialog::getSaveFileName(this, tr("Backup Wallet"), saveDir, tr("Wallet Data (*.dat)")); return;
if (!filename.isEmpty()) {
if (!walletModel->backupWallet(filename)) { if (!walletModel->backupWallet(filename)) {
emit message(tr("Backup Failed"), tr("There was an error trying to save the wallet data to the new location."), emit message(tr("Backup Failed"), tr("There was an error trying to save the wallet data to %1.").arg(filename),
CClientUIInterface::MSG_ERROR); CClientUIInterface::MSG_ERROR);
} }
else else {
emit message(tr("Backup Successful"), tr("The wallet data was successfully saved to the new location."), emit message(tr("Backup Successful"), tr("The wallet data was successfully saved to %1.").arg(filename),
CClientUIInterface::MSG_INFORMATION); CClientUIInterface::MSG_INFORMATION);
} }
} }

Loading…
Cancel
Save