Skip to content

Commit ede3ee3

Browse files
committed
Merge pull request #3159
9eb4ab6 transactionview: make exportClicked() use message() (Philip Kaufmann) 868d3ee transactionview: add message() signal (Philip Kaufmann)
2 parents cd6426e + 9eb4ab6 commit ede3ee3

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

src/qt/transactionview.cpp

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "editaddressdialog.h"
1212
#include "optionsmodel.h"
1313
#include "guiutil.h"
14+
#include "ui_interface.h"
1415

1516
#include <QScrollBar>
1617
#include <QComboBox>
@@ -20,7 +21,6 @@
2021
#include <QLineEdit>
2122
#include <QTableView>
2223
#include <QHeaderView>
23-
#include <QMessageBox>
2424
#include <QPoint>
2525
#include <QMenu>
2626
#include <QLabel>
@@ -266,12 +266,12 @@ void TransactionView::changedAmount(const QString &amount)
266266
void TransactionView::exportClicked()
267267
{
268268
// CSV is currently the only supported format
269-
QString filename = GUIUtil::getSaveFileName(
270-
this,
271-
tr("Export Transaction Data"), QString(),
272-
tr("Comma separated file (*.csv)"));
269+
QString filename = GUIUtil::getSaveFileName(this,
270+
tr("Export Transaction History"), QString(),
271+
tr("Comma separated file (*.csv)"));
273272

274-
if (filename.isNull()) return;
273+
if (filename.isNull())
274+
return;
275275

276276
CSVModelWriter writer(filename);
277277

@@ -285,10 +285,13 @@ void TransactionView::exportClicked()
285285
writer.addColumn(tr("Amount"), 0, TransactionTableModel::FormattedAmountRole);
286286
writer.addColumn(tr("ID"), 0, TransactionTableModel::TxIDRole);
287287

288-
if(!writer.write())
289-
{
290-
QMessageBox::critical(this, tr("Error exporting"), tr("Could not write to file %1.").arg(filename),
291-
QMessageBox::Abort, QMessageBox::Abort);
288+
if(!writer.write()) {
289+
emit message(tr("Exporting Failed"), tr("There was an error trying to save the transaction history to %1.").arg(filename),
290+
CClientUIInterface::MSG_ERROR);
291+
}
292+
else {
293+
emit message(tr("Exporting Successful"), tr("The transaction history was successfully saved to %1.").arg(filename),
294+
CClientUIInterface::MSG_INFORMATION);
292295
}
293296
}
294297

src/qt/transactionview.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ private slots:
7171
signals:
7272
void doubleClicked(const QModelIndex&);
7373

74+
/** Fired when a message should be reported to the user */
75+
void message(const QString &title, const QString &message, unsigned int style);
76+
7477
public slots:
7578
void chooseDate(int idx);
7679
void chooseType(int idx);

src/qt/walletview.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ WalletView::WalletView(QWidget *parent):
6767

6868
// Pass through messages from sendCoinsPage
6969
connect(sendCoinsPage, SIGNAL(message(QString,QString,unsigned int)), this, SIGNAL(message(QString,QString,unsigned int)));
70+
// Pass through messages from transactionView
71+
connect(transactionView, SIGNAL(message(QString,QString,unsigned int)), this, SIGNAL(message(QString,QString,unsigned int)));
7072
}
7173

7274
WalletView::~WalletView()
@@ -110,7 +112,7 @@ void WalletView::setWalletModel(WalletModel *walletModel)
110112

111113
if (walletModel)
112114
{
113-
// Receive and report messages from wallet thread
115+
// Receive and pass through messages from wallet model
114116
connect(walletModel, SIGNAL(message(QString,QString,unsigned int)), this, SIGNAL(message(QString,QString,unsigned int)));
115117

116118
// Handle changes in encryption status

0 commit comments

Comments
 (0)