diff --git a/components/HistoryTable.qml b/components/HistoryTable.qml
index 0c9e9b60..52906f26 100644
--- a/components/HistoryTable.qml
+++ b/components/HistoryTable.qml
@@ -37,7 +37,7 @@ ListView {
property var previousItem
property int rowSpacing: 12
- function buildTxDetailsString(tx_id, paymentId, tx_key,tx_note) {
+ function buildTxDetailsString(tx_id, paymentId, tx_key,tx_note, destinations) {
var trStart = '
',
trMiddle = ' | ',
trEnd = " |
";
@@ -47,6 +47,7 @@ ListView {
+ (paymentId ? trStart + qsTr("Payment ID:") + trMiddle + paymentId + trEnd : "")
+ (tx_key ? trStart + qsTr("Tx key:") + trMiddle + tx_key + trEnd : "")
+ (tx_note ? trStart + qsTr("Tx note:") + trMiddle + tx_note + trEnd : "")
+ + (destinations ? trStart + qsTr("Destinations:") + trMiddle + destinations + trEnd : "")
+ ""
+ translationManager.emptyString;
}
@@ -72,6 +73,7 @@ ListView {
width:600
cancelVisible: false
okVisible: true
+ width:850
}
@@ -97,12 +99,10 @@ ListView {
pressedColor: "#FF4304"
text: qsTr("Details")
onClicked: {
- console.log(hash)
var tx_key = currentWallet.getTxKey(hash)
var tx_note = currentWallet.getUserNote(hash)
- console.log("key",tx_key);
detailsPopup.title = "Transaction details";
- detailsPopup.content = buildTxDetailsString(hash,paymentId,tx_key,tx_note);
+ detailsPopup.content = buildTxDetailsString(hash,paymentId,tx_key,tx_note,destinations);
detailsPopup.open();
}
diff --git a/monero-core.pro b/monero-core.pro
index 249a65f5..5c48db45 100644
--- a/monero-core.pro
+++ b/monero-core.pro
@@ -24,6 +24,7 @@ HEADERS += \
src/libwalletqt/TransactionHistory.h \
src/libwalletqt/TransactionInfo.h \
src/libwalletqt/QRCodeImageProvider.h \
+ src/libwalletqt/Transfer.h \
oshelper.h \
TranslationManager.h \
src/model/TransactionHistoryModel.h \
diff --git a/src/libwalletqt/TransactionHistory.h b/src/libwalletqt/TransactionHistory.h
index ee05787a..41ee6338 100644
--- a/src/libwalletqt/TransactionHistory.h
+++ b/src/libwalletqt/TransactionHistory.h
@@ -41,7 +41,6 @@ private:
private:
friend class Wallet;
-
Bitmonero::TransactionHistory * m_pimpl;
mutable QList m_tinfo;
mutable QDateTime m_firstDateTime;
diff --git a/src/libwalletqt/TransactionInfo.cpp b/src/libwalletqt/TransactionInfo.cpp
index fb096a14..ba81b6a8 100644
--- a/src/libwalletqt/TransactionInfo.cpp
+++ b/src/libwalletqt/TransactionInfo.cpp
@@ -1,7 +1,8 @@
#include "TransactionInfo.h"
#include "WalletManager.h"
-
+#include "Transfer.h"
#include
+#include
TransactionInfo::Direction TransactionInfo::direction() const
{
@@ -71,6 +72,31 @@ QString TransactionInfo::paymentId() const
return QString::fromStdString(m_pimpl->paymentId());
}
+QString TransactionInfo::destinations_formatted() const
+{
+ QString destinations;
+ for (auto const& t: transfers()) {
+ if (!destinations.isEmpty())
+ destinations += "
";
+ destinations += WalletManager::instance()->displayAmount(t->amount()) + ": " + t->address();
+ }
+ return destinations;
+}
+
+QList TransactionInfo::transfers() const
+{
+ if (!m_transfers.isEmpty()) {
+ return m_transfers;
+ }
+
+ for(auto const& t: m_pimpl->transfers()) {
+ TransactionInfo * parent = const_cast(this);
+ Transfer * transfer = new Transfer(t.amount, QString::fromStdString(t.address), parent);
+ m_transfers.append(transfer);
+ }
+ return m_transfers;
+}
+
TransactionInfo::TransactionInfo(Bitmonero::TransactionInfo *pimpl, QObject *parent)
: QObject(parent), m_pimpl(pimpl)
{
diff --git a/src/libwalletqt/TransactionInfo.h b/src/libwalletqt/TransactionInfo.h
index 7e9396a1..cd4ce3d0 100644
--- a/src/libwalletqt/TransactionInfo.h
+++ b/src/libwalletqt/TransactionInfo.h
@@ -5,6 +5,8 @@
#include
#include
+class Transfer;
+
class TransactionInfo : public QObject
{
Q_OBJECT
@@ -21,6 +23,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 destinations_formatted READ destinations_formatted)
public:
enum Direction {
@@ -31,14 +34,6 @@ public:
Q_ENUM(Direction)
-// TODO: implement as separate class;
-
-// struct Transfer {
-// Transfer(uint64_t _amount, const std::string &address);
-// const uint64_t amount;
-// const std::string address;
-// };
-
Direction direction() const;
bool isPending() const;
bool isFailed() const;
@@ -53,16 +48,17 @@ public:
QString date() const;
QString time() const;
QString paymentId() const;
-
-
- // TODO: implement it
//! only applicable for output transactions
- // virtual const std::vector & transfers() const = 0;
+ //! used in tx details popup
+ QString destinations_formatted() const;
+ //! Could be useful later when addressbook is implemented
+ Q_INVOKABLE QList transfers() const;
private:
explicit TransactionInfo(Bitmonero::TransactionInfo * pimpl, QObject *parent = 0);
private:
friend class TransactionHistory;
Bitmonero::TransactionInfo * m_pimpl;
+ mutable QList m_transfers;
};
// in order to wrap it to QVariant
diff --git a/src/libwalletqt/Transfer.h b/src/libwalletqt/Transfer.h
new file mode 100644
index 00000000..a31ad84e
--- /dev/null
+++ b/src/libwalletqt/Transfer.h
@@ -0,0 +1,24 @@
+#ifndef TRANSFER_H
+#define TRANSFER_H
+
+#include
+#include
+
+class Transfer : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(quint64 amount READ amount)
+ Q_PROPERTY(QString address READ address)
+private:
+ explicit Transfer(uint64_t _amount, const QString &_address, QObject *parent = 0): QObject(parent), m_amount(_amount), m_address(_address) {};
+private:
+ friend class TransactionInfo;
+ quint64 m_amount;
+ QString m_address;
+public:
+ quint64 amount() const { return m_amount; }
+ QString address() const { return m_address; }
+
+};
+
+#endif // TRANSACTIONINFO_H
diff --git a/src/model/TransactionHistoryModel.cpp b/src/model/TransactionHistoryModel.cpp
index cf280e99..333893aa 100644
--- a/src/model/TransactionHistoryModel.cpp
+++ b/src/model/TransactionHistoryModel.cpp
@@ -95,6 +95,9 @@ QVariant TransactionHistoryModel::data(const QModelIndex &index, int role) const
case TransactionTimeRole:
result = tInfo->time();
break;
+ case TransactionDestinationsRole:
+ result = tInfo->destinations_formatted();
+ break;
}
return result;
@@ -124,6 +127,7 @@ QHash TransactionHistoryModel::roleNames() const
roleNames.insert(TransactionIsOutRole, "isOut");
roleNames.insert(TransactionDateRole, "date");
roleNames.insert(TransactionTimeRole, "time");
+ roleNames.insert(TransactionDestinationsRole, "destinations");
return roleNames;
}
diff --git a/src/model/TransactionHistoryModel.h b/src/model/TransactionHistoryModel.h
index 8b18f887..1b349914 100644
--- a/src/model/TransactionHistoryModel.h
+++ b/src/model/TransactionHistoryModel.h
@@ -33,7 +33,9 @@ public:
// extra roles for date and time (as UI wants date and time separately)
TransactionDateRole,
TransactionTimeRole,
- TransactionAtomicAmountRole
+ TransactionAtomicAmountRole,
+ // only for outgoing
+ TransactionDestinationsRole
};
Q_ENUM(TransactionInfoRole)