| 317 | } |
| 318 | |
| 319 | void TransactionView::exportClicked() |
| 320 | { |
| 321 | // CSV is currently the only supported format |
| 322 | QString filename = GUIUtil::getSaveFileName(this, |
| 323 | tr("Export Transaction History"), QString(), |
| 324 | tr("Comma separated file (*.csv)"), NULL); |
| 325 | |
| 326 | if (filename.isNull()) |
| 327 | return; |
| 328 | |
| 329 | CSVModelWriter writer(filename); |
| 330 | |
| 331 | // name, column, role |
| 332 | writer.setModel(transactionProxyModel); |
| 333 | writer.addColumn(tr("Confirmed"), 0, TransactionTableModel::ConfirmedRole); |
| 334 | if (model && model->haveWatchOnly()) |
| 335 | writer.addColumn(tr("Watch-only"), TransactionTableModel::Watchonly); |
| 336 | writer.addColumn(tr("Date"), 0, TransactionTableModel::DateRole); |
| 337 | writer.addColumn(tr("Type"), TransactionTableModel::Type, Qt::EditRole); |
| 338 | writer.addColumn(tr("Label"), 0, TransactionTableModel::LabelRole); |
| 339 | writer.addColumn(tr("Address"), 0, TransactionTableModel::AddressRole); |
| 340 | writer.addColumn(BitcoinUnits::getAmountColumnTitle(model->getOptionsModel()->getDisplayUnit()), 0, TransactionTableModel::FormattedAmountRole); |
| 341 | writer.addColumn(tr("ID"), 0, TransactionTableModel::TxIDRole); |
| 342 | |
| 343 | if(!writer.write()) { |
| 344 | Q_EMIT message(tr("Exporting Failed"), tr("There was an error trying to save the transaction history to %1.").arg(filename), |
| 345 | CClientUIInterface::MSG_ERROR); |
| 346 | } |
| 347 | else { |
| 348 | Q_EMIT message(tr("Exporting Successful"), tr("The transaction history was successfully saved to %1.").arg(filename), |
| 349 | CClientUIInterface::MSG_INFORMATION); |
| 350 | } |
| 351 | } |
| 352 | |
| 353 | void TransactionView::contextualMenu(const QPoint &point) |
| 354 | { |
nothing calls this directly
no test coverage detected