Skip to content

Commit 9eb4ab6

Browse files
author
Philip Kaufmann
committed
transactionview: make exportClicked() use message()
- use message() for displaying success or failure of export - rework the strings to be more detailed / informative - additional small cleanups
1 parent 868d3ee commit 9eb4ab6

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
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

0 commit comments

Comments
 (0)