mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-23 03:59:38 +00:00
Merge pull request #3572
544cff7
TransactionHistory: add description to csv export (selsta)57c2052
TransactionInfo: add isCoinbase and description (selsta)
This commit is contained in:
commit
edb0358916
3 changed files with 22 additions and 3 deletions
|
@ -170,7 +170,7 @@ QString TransactionHistory::writeCSV(quint32 accountIndex, QString out)
|
|||
|
||||
// write header
|
||||
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);
|
||||
for (const auto &tx : m_pimpl->getAll()) {
|
||||
|
@ -198,6 +198,8 @@ QString TransactionHistory::writeCSV(quint32 accountIndex, QString out)
|
|||
}
|
||||
QString label = info.label();
|
||||
label.remove(QChar('"')); // reserved
|
||||
QString description = info.description();
|
||||
description.remove(QChar('"')); // reserved
|
||||
quint64 blockHeight = info.blockHeight();
|
||||
QDateTime timeStamp = info.timestamp();
|
||||
QString date = info.date() + " " + info.time();
|
||||
|
@ -209,11 +211,11 @@ QString TransactionHistory::writeCSV(quint32 accountIndex, QString out)
|
|||
}
|
||||
|
||||
// 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(direction, displayAmount, QString::number(atomicAmount))
|
||||
.arg(info.fee(), info.hash(), label, QString::number(subaddrAccount))
|
||||
.arg(paymentId);
|
||||
.arg(paymentId, description);
|
||||
output << line;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,6 +47,10 @@ bool TransactionInfo::isFailed() const
|
|||
return m_failed;
|
||||
}
|
||||
|
||||
bool TransactionInfo::isCoinbase() const
|
||||
{
|
||||
return m_coinbase;
|
||||
}
|
||||
|
||||
double TransactionInfo::amount() const
|
||||
{
|
||||
|
@ -126,6 +130,11 @@ QString TransactionInfo::paymentId() const
|
|||
return m_paymentId;
|
||||
}
|
||||
|
||||
QString TransactionInfo::description() const
|
||||
{
|
||||
return m_description;
|
||||
}
|
||||
|
||||
QString TransactionInfo::destinations_formatted() const
|
||||
{
|
||||
QString destinations;
|
||||
|
@ -144,10 +153,12 @@ TransactionInfo::TransactionInfo(const Monero::TransactionInfo *pimpl, QObject *
|
|||
, m_confirmations(pimpl->confirmations())
|
||||
, m_direction(static_cast<Direction>(pimpl->direction()))
|
||||
, m_failed(pimpl->isFailed())
|
||||
, m_coinbase(pimpl->isCoinbase())
|
||||
, m_fee(pimpl->fee())
|
||||
, m_hash(QString::fromStdString(pimpl->hash()))
|
||||
, m_label(QString::fromStdString(pimpl->label()))
|
||||
, m_paymentId(QString::fromStdString(pimpl->paymentId()))
|
||||
, m_description(QString::fromStdString(pimpl->description()))
|
||||
, m_pending(pimpl->isPending())
|
||||
, m_subaddrAccount(pimpl->subaddrAccount())
|
||||
, m_timestamp(QDateTime::fromTime_t(pimpl->timestamp()))
|
||||
|
|
|
@ -42,6 +42,7 @@ class TransactionInfo : public QObject
|
|||
Q_PROPERTY(Direction direction READ direction)
|
||||
Q_PROPERTY(bool isPending READ isPending)
|
||||
Q_PROPERTY(bool isFailed READ isFailed)
|
||||
Q_PROPERTY(bool isCoinbase READ isCoinbase)
|
||||
Q_PROPERTY(double amount READ amount)
|
||||
Q_PROPERTY(quint64 atomicAmount READ atomicAmount)
|
||||
Q_PROPERTY(QString displayAmount READ displayAmount)
|
||||
|
@ -57,6 +58,7 @@ class TransactionInfo : public QObject
|
|||
Q_PROPERTY(QString date READ date)
|
||||
Q_PROPERTY(QString time READ time)
|
||||
Q_PROPERTY(QString paymentId READ paymentId)
|
||||
Q_PROPERTY(QString description READ description)
|
||||
Q_PROPERTY(QString destinations_formatted READ destinations_formatted)
|
||||
|
||||
public:
|
||||
|
@ -71,6 +73,7 @@ public:
|
|||
Direction direction() const;
|
||||
bool isPending() const;
|
||||
bool isFailed() const;
|
||||
bool isCoinbase() const;
|
||||
double amount() const;
|
||||
quint64 atomicAmount() const;
|
||||
QString displayAmount() const;
|
||||
|
@ -87,6 +90,7 @@ public:
|
|||
QString date() const;
|
||||
QString time() const;
|
||||
QString paymentId() const;
|
||||
QString description() const;
|
||||
//! only applicable for output transactions
|
||||
//! used in tx details popup
|
||||
QString destinations_formatted() const;
|
||||
|
@ -104,7 +108,9 @@ private:
|
|||
QString m_hash;
|
||||
QString m_label;
|
||||
QString m_paymentId;
|
||||
QString m_description;
|
||||
bool m_pending;
|
||||
bool m_coinbase;
|
||||
quint32 m_subaddrAccount;
|
||||
QSet<quint32> m_subaddrIndex;
|
||||
QDateTime m_timestamp;
|
||||
|
|
Loading…
Reference in a new issue