Skip to content

Commit

Permalink
Progress on GUI / JS: 'PRIVATE' balance / transaction history doesn't…
Browse files Browse the repository at this point in the history
… update with incoming private transactions when wallet is locked aliascash#45
  • Loading branch information
shbli committed Jun 23, 2018
1 parent b5e9c01 commit acb3ac0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/qt/res/assets/js/spectre.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,7 @@ function bindTransactionTableEvents() {
}).attr("data-title", "Double click to edit").tooltip();
}
function appendTransactions(f) {
console.log(f);
if ("string" == typeof f) {
if ("[]" == f) {
return;
Expand Down
14 changes: 11 additions & 3 deletions src/qt/spectrebridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ void TransactionModel::init(ClientModel * clientModel, TransactionTableModel * t

QVariantMap TransactionModel::addTransaction(int row)
{
qDebug() << "addTransaction";
QModelIndex status = ttm->index (row, TransactionTableModel::Status);
QModelIndex date = status.sibling(row, TransactionTableModel::Date);
QModelIndex address = status.sibling(row, TransactionTableModel::ToAddress);
Expand Down Expand Up @@ -106,6 +107,7 @@ QVariantMap TransactionModel::addTransaction(int row)

void TransactionModel::populateRows(int start, int end)
{
qDebug() << "populateRows";
if(start > ROWS_TO_REFRESH)
return;

Expand All @@ -124,15 +126,17 @@ void TransactionModel::populateRows(int start, int end)

start++;
}
if(!transactions.isEmpty())
if(!transactions.isEmpty()) {
qDebug() << "transactions " << transactions;
emitTransactions(transactions);
}

running = false;
}

void TransactionModel::populatePage()
{

qDebug() << "populatePage";
if(!prepare())
return;

Expand All @@ -144,8 +148,10 @@ void TransactionModel::populatePage()
if(visibleTransactions.first() == "*"||visibleTransactions.contains(ttm->index(row, TransactionTableModel::Type).data().toString()))
transactions.append(addTransaction(row));

if(!transactions.isEmpty())
if(!transactions.isEmpty()) {
qDebug() << "transactions " << transactions;
emitTransactions(transactions);
}

running = false;

Expand Down Expand Up @@ -750,12 +756,14 @@ void SpectreBridge::populateTransactionTable()
void SpectreBridge::updateTransactions(QModelIndex topLeft, QModelIndex bottomRight)
{
// Updated transactions...
qDebug() << "updateTransactions";
if(topLeft.column() == TransactionTableModel::Status)
transactionModel->populateRows(topLeft.row(), bottomRight.row());
}

void SpectreBridge::insertTransactions(const QModelIndex & parent, int start, int end)
{
qDebug() << "insertTransactions";
// New Transactions...
transactionModel->populateRows(start, end);
}
Expand Down
1 change: 1 addition & 0 deletions src/qt/spectregui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,7 @@ void SpectreGUI::askFee(qint64 nFeeRequired, bool *payFee)

void SpectreGUI::incomingTransaction(const QModelIndex & parent, int start, int end)
{
qDebug() << "SpectreGUI::incomingTransaction";
if(!walletModel || !clientModel || clientModel->inInitialBlockDownload() || nNodeState != NS_READY)
return;

Expand Down

0 comments on commit acb3ac0

Please sign in to comment.