diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp index 558ea6f..df894c3 100644 --- a/src/chatmodel.cpp +++ b/src/chatmodel.cpp @@ -93,7 +93,9 @@ void ChatModel::renderChatBox(Ui::MainWindow* ui, QListWidget *view) myDateTime.setTime_t(c.second.getTimestamp()); //////Render only Memos for selected contacts. Do not render empty Memos //// Render only memos where cid=cid - if ((ui->ContactZaddr->text().trimmed() == c.second.getAddress()) && (c.second.getMemo().startsWith("{") == false) && (c.second.getMemo().isEmpty() == false)) { + + /// + if ((ui->ContactZaddr->text().trimmed() == c.second.getAddress()) && (c.second.getMemo().startsWith("{") == false) && (c.second.getMemo().isEmpty() == false)) { // if (c.second.getMemo.find()) line += QString("[") + myDateTime.toString("dd.MM.yyyy hh:mm:ss ") + QString("] "); line += QString("<") + QString("Outgoing") + QString("> :\n"); @@ -102,7 +104,7 @@ void ChatModel::renderChatBox(Ui::MainWindow* ui, QListWidget *view) line =""; ////////////////////////////////// Todo : Render green checkmark for contacts if cid = cid - We have to search for cid in txid/cid list - QString cid = c.second.getCid(); + // QString cid = c.second.getCid(); }else{} @@ -170,7 +172,7 @@ Tx MainWindow::createTxFromChatPage() { tx.toAddrs.push_back(ToFields{addr, amt, hmemo}) ; - tx.toAddrs.push_back( ToFields{addr, amt, memo}); + tx.toAddrs.push_back(ToFields{addr, amt, memo}); qDebug() << "pushback chattx"; } } @@ -249,7 +251,7 @@ void MainWindow::sendChatButton() { }); // Force a UI update so we get the unconfirmed Tx - rpc->refresh(true); + // rpc->refresh(true); ui->memoTxtChat->clear(); }, diff --git a/src/controller.cpp b/src/controller.cpp index 0871d6b..38bfada 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -895,26 +895,27 @@ void Controller::refreshTransactions() { items.push_back(TransactionItemDetail{address, amount, memo}); total_amount = total_amount + amount; - // } + } - // { + { + QList addresses; + for (auto item : items) { // Concat all the addresses - - // QList addresses; - // for (auto item : items) { + if (item.amount == 0) { + + }else{ + - // addresses.push_back(item.address); + addresses.push_back(item.address); } - + } - // } - - // } + } + txdata.push_back(TransactionItem{ "send", datetime, address, txid,confirmations, items }); - } } else { // Incoming Transaction address = (it["address"].is_null() ? "" : QString::fromStdString(it["address"])); @@ -925,19 +926,26 @@ void Controller::refreshTransactions() { memo = QString::fromStdString(it["memo"]); } + items.push_back(TransactionItemDetail{ + address, + CAmount::fromqint64(it["amount"].get()), + memo + }); + + TransactionItem tx{ "Receive", datetime, address, txid,confirmations, items }; txdata.push_back(tx); - QString cid; - if (memo.startsWith("{")) { + QString cid = ""; + // if (memo.startsWith("{")) { - cid = memo.mid(14,36); - - }else{ cid = "";} + // cid = memo.mid(14,36); + // }else{ cid = "";} + ChatItem item = ChatItem( datetime, address, @@ -948,13 +956,9 @@ void Controller::refreshTransactions() { ); qDebug()<addMessage(item); - items.push_back(TransactionItemDetail{ - address, - CAmount::fromqint64(it["amount"].get()), - memo - }); } } @@ -979,6 +983,7 @@ void Controller::refreshTransactions() { chatModel->renderChatBox(ui, ui->listChatMemo); refreshContacts( ui->listContactWidget + ); }); } @@ -986,6 +991,7 @@ void Controller::refreshTransactions() { void Controller::refreshChat(QListWidget *listWidget) { chatModel->renderChatBox(ui, listWidget); + } void Controller::refreshContacts(QListWidget *listWidget)