t->m_timestamp = QDateTime::fromSecsSinceEpoch(pd.m_timestamp);
t->m_confirmations = (wallet_height > pd.m_block_height) ? wallet_height - pd.m_block_height : 0;
t->m_unlockTime = pd.m_unlock_time;
-
- t->m_description = QString::fromStdString(m_wallet2->get_tx_note(pd.m_tx_hash));
- if (t->m_description.isEmpty()) {
- t->m_description = QString::fromStdString(m_wallet2->get_subaddress_label(pd.m_subaddr_index));
- }
+ t->m_description = description(pd);
m_rows.append(t);
}
t->m_label = QString::fromStdString(m_wallet2->get_subaddress_label(pd.m_subaddr_index));
t->m_timestamp = QDateTime::fromSecsSinceEpoch(pd.m_timestamp);
t->m_confirmations = 0;
-
- t->m_description = QString::fromStdString(m_wallet2->get_tx_note(pd.m_tx_hash));
- if (t->m_description.isEmpty()) {
- t->m_description = QString::fromStdString(m_wallet2->get_subaddress_label(pd.m_subaddr_index));
- }
+ t->m_description = description(pd);
m_rows.append(t);
data = QString("blockHeight,timestamp,date,accountIndex,direction,balanceDelta,amount,fee,txid,description,paymentId,fiatAmount,fiatCurrency%1").arg(data);
return Utils::fileWrite(path, data);
}
+
+QString TransactionHistory::description(const tools::wallet2::payment_details &pd)
+{
+ QString description = QString::fromStdString(m_wallet2->get_tx_note(pd.m_tx_hash));
+ if (description.isEmpty()) {
+ if (pd.m_coinbase) {
+ description = "Coinbase";
+ }
+ else if (pd.m_subaddr_index.major == 0 && pd.m_subaddr_index.minor == 0) {
+ description = "Primary address";
+ }
+ else {
+ description = QString::fromStdString(m_wallet2->get_subaddress_label(pd.m_subaddr_index));
+ }
+ }
+ return description;
+}
\ No newline at end of file