From 51c180af18039388332a474450fc6a9654851630 Mon Sep 17 00:00:00 2001 From: DenioD <41270280+DenioD@users.noreply.github.com> Date: Fri, 1 May 2020 17:44:18 +0200 Subject: [PATCH] fix send of memos --- src/chatmodel.cpp | 10 ++++++---- src/controller.cpp | 23 +++++++++++------------ 2 files changed, 17 insertions(+), 16 deletions(-) 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 c26c2f3..38bfada 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -926,25 +926,26 @@ void Controller::refreshTransactions() { memo = QString::fromStdString(it["memo"]); } - items.push_back(TransactionItemDetail{ + 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, @@ -955,13 +956,9 @@ void Controller::refreshTransactions() { ); qDebug()<addMessage(item); - items.push_back(TransactionItemDetail{ - address, - CAmount::fromqint64(it["amount"].get()), - memo - }); } } @@ -986,6 +983,7 @@ void Controller::refreshTransactions() { chatModel->renderChatBox(ui, ui->listChatMemo); refreshContacts( ui->listContactWidget + ); }); } @@ -993,6 +991,7 @@ void Controller::refreshTransactions() { void Controller::refreshChat(QListWidget *listWidget) { chatModel->renderChatBox(ui, listWidget); + } void Controller::refreshContacts(QListWidget *listWidget)