| 380 | } |
| 381 | |
| 382 | void TransactionView::exportClicked() |
| 383 | { |
| 384 | if (!model || !model->getOptionsModel()) { |
| 385 | return; |
| 386 | } |
| 387 | // CSV is currently the only supported format |
| 388 | QString filename = GUIUtil::getSaveFileName(this, |
| 389 | tr("Export Transaction History"), QString(), |
| 390 | tr("Comma separated file (*.csv)"), NULL); |
| 391 | |
| 392 | if (filename.isNull()) |
| 393 | return; |
| 394 | |
| 395 | CSVModelWriter writer(filename); |
| 396 | |
| 397 | // name, column, role |
| 398 | writer.setModel(transactionProxyModel); |
| 399 | writer.addColumn(tr("Confirmed"), 0, TransactionTableModel::ConfirmedRole); |
| 400 | if (model->haveWatchOnly()) |
| 401 | writer.addColumn(tr("Watch-only"), TransactionTableModel::Watchonly); |
| 402 | writer.addColumn(tr("Date"), 0, TransactionTableModel::DateRole); |
| 403 | writer.addColumn(tr("Type"), TransactionTableModel::Type, Qt::EditRole); |
| 404 | writer.addColumn(tr("Label"), 0, TransactionTableModel::LabelRole); |
| 405 | writer.addColumn(tr("Address"), 0, TransactionTableModel::AddressRole); |
| 406 | writer.addColumn(BitcoinUnits::getAmountColumnTitle(model->getOptionsModel()->getDisplayUnit()), 0, TransactionTableModel::FormattedAmountRole); |
| 407 | writer.addColumn(tr("ID"), 0, TransactionTableModel::TxIDRole); |
| 408 | |
| 409 | if (!writer.write()) { |
| 410 | Q_EMIT message(tr("Exporting Failed"), tr("There was an error trying to save the transaction history to %1.").arg(filename), |
| 411 | CClientUIInterface::MSG_ERROR); |
| 412 | } else { |
| 413 | Q_EMIT message(tr("Exporting Successful"), tr("The transaction history was successfully saved to %1.").arg(filename), |
| 414 | CClientUIInterface::MSG_INFORMATION); |
| 415 | } |
| 416 | } |
| 417 | |
| 418 | void TransactionView::contextualMenu(const QPoint &point) |
| 419 | { |
nothing calls this directly
no test coverage detected