MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / exportClicked

Method exportClicked

src/qt/transactionview.cpp:319–351  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

317}
318
319void 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
353void TransactionView::contextualMenu(const QPoint &point)
354{

Callers

nothing calls this directly

Calls 8

getSaveFileNameFunction · 0.85
QStringClass · 0.85
addColumnMethod · 0.80
haveWatchOnlyMethod · 0.80
isNullMethod · 0.45
setModelMethod · 0.45
getOptionsModelMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected