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

Method exportClicked

src/qt/transactionview.cpp:344–380  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

342}
343
344void TransactionView::exportClicked()
345{
346 if (!model || !model->getOptionsModel()) {
347 return;
348 }
349
350 // CSV is currently the only supported format
351 QString filename = GUIUtil::getSaveFileName(this,
352 tr("Export Transaction History"), QString(),
353 tr("Comma separated file (*.csv)"), nullptr);
354
355 if (filename.isNull())
356 return;
357
358 CSVModelWriter writer(filename);
359
360 // name, column, role
361 writer.setModel(transactionProxyModel);
362 writer.addColumn(tr("Confirmed"), 0, TransactionTableModel::ConfirmedRole);
363 if (model->wallet().haveWatchOnly())
364 writer.addColumn(tr("Watch-only"), TransactionTableModel::Watchonly);
365 writer.addColumn(tr("Date"), 0, TransactionTableModel::DateRole);
366 writer.addColumn(tr("Type"), TransactionTableModel::Type, Qt::EditRole);
367 writer.addColumn(tr("Label"), 0, TransactionTableModel::LabelRole);
368 writer.addColumn(tr("Address"), 0, TransactionTableModel::AddressRole);
369 writer.addColumn(BitcoinUnits::getAmountColumnTitle(model->getOptionsModel()->getDisplayUnit()), 0, TransactionTableModel::FormattedAmountRole);
370 writer.addColumn(tr("ID"), 0, TransactionTableModel::TxHashRole);
371
372 if(!writer.write()) {
373 Q_EMIT message(tr("Exporting Failed"), tr("There was an error trying to save the transaction history to %1.").arg(filename),
374 CClientUIInterface::MSG_ERROR);
375 }
376 else {
377 Q_EMIT message(tr("Exporting Successful"), tr("The transaction history was successfully saved to %1.").arg(filename),
378 CClientUIInterface::MSG_INFORMATION);
379 }
380}
381
382void TransactionView::contextualMenu(const QPoint &point)
383{

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected