TransactionHistory: add description to csv export

This commit is contained in:
selsta 2021-06-18 03:35:13 +02:00
parent 57c205206c
commit 544cff7dc1
No known key found for this signature in database
GPG key ID: 2EA0A99A8B07AE5E

View file

@ -170,7 +170,7 @@ QString TransactionHistory::writeCSV(quint32 accountIndex, QString out)
// write header // write header
QTextStream output(&data); QTextStream output(&data);
output << "blockHeight,epoch,date,direction,amount,atomicAmount,fee,txid,label,subaddrAccount,paymentId\n"; output << "blockHeight,epoch,date,direction,amount,atomicAmount,fee,txid,label,subaddrAccount,paymentId,description\n";
QReadLocker locker(&m_lock); QReadLocker locker(&m_lock);
for (const auto &tx : m_pimpl->getAll()) { for (const auto &tx : m_pimpl->getAll()) {
@ -199,6 +199,8 @@ QString TransactionHistory::writeCSV(quint32 accountIndex, QString out)
} }
QString label = info.label(); QString label = info.label();
label.remove(QChar('"')); // reserved label.remove(QChar('"')); // reserved
QString description = info.description();
description.remove(QChar('"')); // reserved
quint64 blockHeight = info.blockHeight(); quint64 blockHeight = info.blockHeight();
QDateTime timeStamp = info.timestamp(); QDateTime timeStamp = info.timestamp();
QString date = info.date() + " " + info.time(); QString date = info.date() + " " + info.time();
@ -210,11 +212,11 @@ QString TransactionHistory::writeCSV(quint32 accountIndex, QString out)
} }
// format and write // format and write
QString line = QString("%1,%2,%3,%4,%5,%6,%7,%8,\"%9\",%10,%11\n") QString line = QString("%1,%2,%3,%4,%5,%6,%7,%8,\"%9\",%10,%11,\"%12\"\n")
.arg(QString::number(blockHeight), QString::number(epoch), date) .arg(QString::number(blockHeight), QString::number(epoch), date)
.arg(direction, QString::number(amount), QString::number(atomicAmount)) .arg(direction, QString::number(amount), QString::number(atomicAmount))
.arg(info.fee(), info.hash(), label, QString::number(subaddrAccount)) .arg(info.fee(), info.hash(), label, QString::number(subaddrAccount))
.arg(paymentId); .arg(paymentId, description);
output << line; output << line;
} }