diff --git a/src/addressbook.cpp b/src/addressbook.cpp index d00c3ae..d17726c 100644 --- a/src/addressbook.cpp +++ b/src/addressbook.cpp @@ -156,7 +156,7 @@ void AddressBook::open(MainWindow* parent, QLineEdit* target) ab.addr_chat->setText(myAddr); }); model.updateUi(); //todo fix updating gui after adding - rpc->refresh(true); + //rpc->refresh(true); // If there is a target then make it the addr for the "Add to" button if (target != nullptr && Settings::isValidAddress(target->text())) diff --git a/src/controller.cpp b/src/controller.cpp index 35403c1..3c370f1 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -867,22 +867,14 @@ void Controller::refreshTransactions() { QString memo; if (!o["memo"].is_null()) { memo = QString::fromStdString(o["memo"]); - } + - QString cid; - QString contact; - - for(auto &c : AddressBook::getInstance()->getAllAddressLabels()) - { - if (address == c.getPartnerAddress()){ - contact = c.getName(); - }else{ contact = "";} - } + QString cid; ChatItem item = ChatItem( datetime, address, - contact, + QString(""), memo, QString(""), QString(""), @@ -890,12 +882,11 @@ void Controller::refreshTransactions() { txid, true ); - qDebug()<<"Kontaktname : " <setData(ChatIDGenerator::getInstance()->generateID(item), item); - // } + } items.push_back(TransactionItemDetail{address, amount, memo}); total_amount = total_amount + amount; @@ -947,7 +938,7 @@ void Controller::refreshTransactions() { // int position; QString requestZaddr; - if (memo.startsWith("{")) { + if ((memo.startsWith("{")) && (!it["memo"].is_null())) { QJsonDocument headermemo = QJsonDocument::fromJson(memo.toUtf8()); @@ -958,7 +949,7 @@ void Controller::refreshTransactions() { chatModel->addCid(txid, cid); chatModel->addrequestZaddr(txid, requestZaddr); - } + // } if (chatModel->getCidByTx(txid) != QString("0xdeadbeef")){ @@ -980,22 +971,13 @@ void Controller::refreshTransactions() { requestZaddr = ""; } - QString contact; - for(auto &c : AddressBook::getInstance()->getAllAddressLabels()) - { - if (address == c.getMyAddress()){ - contact = c.getName(); - - }else{ contact = "";} - - } // position = it["position"].get(); ChatItem item = ChatItem( datetime, address, - contact, + QString(""), memo, requestZaddr, type, @@ -1003,10 +985,10 @@ void Controller::refreshTransactions() { txid, false ); - qDebug()<<"Kontaktname : " <setData(ChatIDGenerator::getInstance()->generateID(item), item); - // } + } } }