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
This commit is contained in:
parent
868d3ee5ac
commit
9eb4ab66bf
1 changed files with 13 additions and 10 deletions
|
@ -11,6 +11,7 @@
|
||||||
#include "editaddressdialog.h"
|
#include "editaddressdialog.h"
|
||||||
#include "optionsmodel.h"
|
#include "optionsmodel.h"
|
||||||
#include "guiutil.h"
|
#include "guiutil.h"
|
||||||
|
#include "ui_interface.h"
|
||||||
|
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
|
@ -20,7 +21,6 @@
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QTableView>
|
#include <QTableView>
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
@ -266,12 +266,12 @@ void TransactionView::changedAmount(const QString &amount)
|
||||||
void TransactionView::exportClicked()
|
void TransactionView::exportClicked()
|
||||||
{
|
{
|
||||||
// CSV is currently the only supported format
|
// CSV is currently the only supported format
|
||||||
QString filename = GUIUtil::getSaveFileName(
|
QString filename = GUIUtil::getSaveFileName(this,
|
||||||
this,
|
tr("Export Transaction History"), QString(),
|
||||||
tr("Export Transaction Data"), QString(),
|
tr("Comma separated file (*.csv)"));
|
||||||
tr("Comma separated file (*.csv)"));
|
|
||||||
|
|
||||||
if (filename.isNull()) return;
|
if (filename.isNull())
|
||||||
|
return;
|
||||||
|
|
||||||
CSVModelWriter writer(filename);
|
CSVModelWriter writer(filename);
|
||||||
|
|
||||||
|
@ -285,10 +285,13 @@ void TransactionView::exportClicked()
|
||||||
writer.addColumn(tr("Amount"), 0, TransactionTableModel::FormattedAmountRole);
|
writer.addColumn(tr("Amount"), 0, TransactionTableModel::FormattedAmountRole);
|
||||||
writer.addColumn(tr("ID"), 0, TransactionTableModel::TxIDRole);
|
writer.addColumn(tr("ID"), 0, TransactionTableModel::TxIDRole);
|
||||||
|
|
||||||
if(!writer.write())
|
if(!writer.write()) {
|
||||||
{
|
emit message(tr("Exporting Failed"), tr("There was an error trying to save the transaction history to %1.").arg(filename),
|
||||||
QMessageBox::critical(this, tr("Error exporting"), tr("Could not write to file %1.").arg(filename),
|
CClientUIInterface::MSG_ERROR);
|
||||||
QMessageBox::Abort, QMessageBox::Abort);
|
}
|
||||||
|
else {
|
||||||
|
emit message(tr("Exporting Successful"), tr("The transaction history was successfully saved to %1.").arg(filename),
|
||||||
|
CClientUIInterface::MSG_INFORMATION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue