aboutsummaryrefslogtreecommitdiff
path: root/src/qt
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2013-10-31 17:42:33 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2013-10-31 17:42:56 +0100
commitede3ee3348ecaeed04dec587171e732ebc0830fd (patch)
tree30fe11b31de31b7da59e387f86679f166cbceb95 /src/qt
parentcd6426ec724e2ca53ebb5ac73f10541715f6c1c5 (diff)
parent9eb4ab66bf581a75e82713640de669b93a84d9f7 (diff)
Merge pull request #3159
9eb4ab6 transactionview: make exportClicked() use message() (Philip Kaufmann) 868d3ee transactionview: add message() signal (Philip Kaufmann)
Diffstat (limited to 'src/qt')
-rw-r--r--src/qt/transactionview.cpp23
-rw-r--r--src/qt/transactionview.h3
-rw-r--r--src/qt/walletview.cpp4
3 files changed, 19 insertions, 11 deletions
diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp
index a43e29c476..89ecf99656 100644
--- a/src/qt/transactionview.cpp
+++ b/src/qt/transactionview.cpp
@@ -11,6 +11,7 @@
#include "editaddressdialog.h"
#include "optionsmodel.h"
#include "guiutil.h"
+#include "ui_interface.h"
#include <QScrollBar>
#include <QComboBox>
@@ -20,7 +21,6 @@
#include <QLineEdit>
#include <QTableView>
#include <QHeaderView>
-#include <QMessageBox>
#include <QPoint>
#include <QMenu>
#include <QLabel>
@@ -266,12 +266,12 @@ void TransactionView::changedAmount(const QString &amount)
void TransactionView::exportClicked()
{
// CSV is currently the only supported format
- QString filename = GUIUtil::getSaveFileName(
- this,
- tr("Export Transaction Data"), QString(),
- tr("Comma separated file (*.csv)"));
+ QString filename = GUIUtil::getSaveFileName(this,
+ tr("Export Transaction History"), QString(),
+ tr("Comma separated file (*.csv)"));
- if (filename.isNull()) return;
+ if (filename.isNull())
+ return;
CSVModelWriter writer(filename);
@@ -285,10 +285,13 @@ void TransactionView::exportClicked()
writer.addColumn(tr("Amount"), 0, TransactionTableModel::FormattedAmountRole);
writer.addColumn(tr("ID"), 0, TransactionTableModel::TxIDRole);
- if(!writer.write())
- {
- QMessageBox::critical(this, tr("Error exporting"), tr("Could not write to file %1.").arg(filename),
- QMessageBox::Abort, QMessageBox::Abort);
+ if(!writer.write()) {
+ emit message(tr("Exporting Failed"), tr("There was an error trying to save the transaction history to %1.").arg(filename),
+ CClientUIInterface::MSG_ERROR);
+ }
+ else {
+ emit message(tr("Exporting Successful"), tr("The transaction history was successfully saved to %1.").arg(filename),
+ CClientUIInterface::MSG_INFORMATION);
}
}
diff --git a/src/qt/transactionview.h b/src/qt/transactionview.h
index bb41a83e32..464ba3e8ce 100644
--- a/src/qt/transactionview.h
+++ b/src/qt/transactionview.h
@@ -71,6 +71,9 @@ private slots:
signals:
void doubleClicked(const QModelIndex&);
+ /** Fired when a message should be reported to the user */
+ void message(const QString &title, const QString &message, unsigned int style);
+
public slots:
void chooseDate(int idx);
void chooseType(int idx);
diff --git a/src/qt/walletview.cpp b/src/qt/walletview.cpp
index 5622fcfb17..d1e5e47bd5 100644
--- a/src/qt/walletview.cpp
+++ b/src/qt/walletview.cpp
@@ -67,6 +67,8 @@ WalletView::WalletView(QWidget *parent):
// Pass through messages from sendCoinsPage
connect(sendCoinsPage, SIGNAL(message(QString,QString,unsigned int)), this, SIGNAL(message(QString,QString,unsigned int)));
+ // Pass through messages from transactionView
+ connect(transactionView, SIGNAL(message(QString,QString,unsigned int)), this, SIGNAL(message(QString,QString,unsigned int)));
}
WalletView::~WalletView()
@@ -110,7 +112,7 @@ void WalletView::setWalletModel(WalletModel *walletModel)
if (walletModel)
{
- // Receive and report messages from wallet thread
+ // Receive and pass through messages from wallet model
connect(walletModel, SIGNAL(message(QString,QString,unsigned int)), this, SIGNAL(message(QString,QString,unsigned int)));
// Handle changes in encryption status