|
|
@ -27,25 +27,17 @@ public: |
|
|
|
void refreshWallet() |
|
|
|
void refreshWallet() |
|
|
|
{ |
|
|
|
{ |
|
|
|
qDebug() << "refreshWallet"; |
|
|
|
qDebug() << "refreshWallet"; |
|
|
|
cachedWallet.clear(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Query wallet from core, and compare with our own
|
|
|
|
/* Query entire wallet from core.
|
|
|
|
representation. |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
cachedWallet.clear(); |
|
|
|
CRITICAL_BLOCK(cs_mapWallet) |
|
|
|
CRITICAL_BLOCK(cs_mapWallet) |
|
|
|
{ |
|
|
|
{ |
|
|
|
for(std::map<uint256, CWalletTx>::iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) |
|
|
|
for(std::map<uint256, CWalletTx>::iterator it = mapWallet.begin(); it != mapWallet.end(); ++it) |
|
|
|
{ |
|
|
|
{ |
|
|
|
/* TODO: Make note of new and removed transactions */ |
|
|
|
|
|
|
|
/* insertedIndices */ |
|
|
|
|
|
|
|
/* removedIndices */ |
|
|
|
|
|
|
|
cachedWallet.append(TransactionRecord::decomposeTransaction(it->second)); |
|
|
|
cachedWallet.append(TransactionRecord::decomposeTransaction(it->second)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
/* beginInsertRows(QModelIndex(), first, last) */ |
|
|
|
|
|
|
|
/* endInsertRows */ |
|
|
|
|
|
|
|
/* beginRemoveRows(QModelIndex(), first, last) */ |
|
|
|
|
|
|
|
/* beginEndRows */ |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* Update our model of the wallet.
|
|
|
|
/* Update our model of the wallet.
|
|
|
@ -64,6 +56,10 @@ public: |
|
|
|
{ |
|
|
|
{ |
|
|
|
qDebug() << " " << QString::fromStdString(hash.ToString()); |
|
|
|
qDebug() << " " << QString::fromStdString(hash.ToString()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/* beginInsertRows(QModelIndex(), first, last) */ |
|
|
|
|
|
|
|
/* endInsertRows */ |
|
|
|
|
|
|
|
/* beginRemoveRows(QModelIndex(), first, last) */ |
|
|
|
|
|
|
|
/* beginEndRows */ |
|
|
|
|
|
|
|
|
|
|
|
refreshWallet(); |
|
|
|
refreshWallet(); |
|
|
|
} |
|
|
|
} |
|
|
@ -218,17 +214,17 @@ QVariant TransactionTableModel::formatTxDescription(const TransactionRecord *wtx |
|
|
|
|
|
|
|
|
|
|
|
switch(wtx->type) |
|
|
|
switch(wtx->type) |
|
|
|
{ |
|
|
|
{ |
|
|
|
case TransactionRecord::RecvFromAddress: |
|
|
|
case TransactionRecord::RecvWithAddress: |
|
|
|
description = tr("From: ") + QString::fromStdString(lookupAddress(wtx->address)); |
|
|
|
description = tr("Received with: ") + QString::fromStdString(lookupAddress(wtx->address)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case TransactionRecord::RecvFromIP: |
|
|
|
case TransactionRecord::RecvFromIP: |
|
|
|
description = tr("From IP: ") + QString::fromStdString(wtx->address); |
|
|
|
description = tr("Received from IP: ") + QString::fromStdString(wtx->address); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case TransactionRecord::SendToAddress: |
|
|
|
case TransactionRecord::SendToAddress: |
|
|
|
description = tr("To: ") + QString::fromStdString(lookupAddress(wtx->address)); |
|
|
|
description = tr("Sent to: ") + QString::fromStdString(lookupAddress(wtx->address)); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case TransactionRecord::SendToIP: |
|
|
|
case TransactionRecord::SendToIP: |
|
|
|
description = tr("To IP: ") + QString::fromStdString(wtx->address); |
|
|
|
description = tr("Sent to IP: ") + QString::fromStdString(wtx->address); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case TransactionRecord::SendToSelf: |
|
|
|
case TransactionRecord::SendToSelf: |
|
|
|
description = tr("Payment to yourself"); |
|
|
|
description = tr("Payment to yourself"); |
|
|
@ -340,7 +336,7 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const |
|
|
|
/* Role for filtering tabs by type */ |
|
|
|
/* Role for filtering tabs by type */ |
|
|
|
switch(rec->type) |
|
|
|
switch(rec->type) |
|
|
|
{ |
|
|
|
{ |
|
|
|
case TransactionRecord::RecvFromAddress: |
|
|
|
case TransactionRecord::RecvWithAddress: |
|
|
|
case TransactionRecord::RecvFromIP: |
|
|
|
case TransactionRecord::RecvFromIP: |
|
|
|
return TransactionTableModel::Received; |
|
|
|
return TransactionTableModel::Received; |
|
|
|
case TransactionRecord::SendToAddress: |
|
|
|
case TransactionRecord::SendToAddress: |
|
|
|