From f515be1aa8898b6cb16febd3a06a1241926fb8ad Mon Sep 17 00:00:00 2001 From: DenioD <41270280+DenioD@users.noreply.github.com> Date: Fri, 1 May 2020 21:40:45 +0200 Subject: [PATCH] create a cid in addressbook but make it editable for the beginning --- src/addressbook.cpp | 9 +++------ src/addressbook.ui | 25 ++++++++++++++++--------- src/chatmodel.cpp | 7 ++++--- src/mainwindow.ui | 21 +++++++++++++++++---- 4 files changed, 40 insertions(+), 22 deletions(-) diff --git a/src/addressbook.cpp b/src/addressbook.cpp index be13b82..1a2bad3 100644 --- a/src/addressbook.cpp +++ b/src/addressbook.cpp @@ -142,16 +142,15 @@ void AddressBook::open(MainWindow* parent, QLineEdit* target) bool sapling = true; rpc->createNewZaddr(sapling, [=] (json reply) { QString myAddr = QString::fromStdString(reply.get()[0]); - // QString myAddr = "zs1flslqurcnummsw37mfxkhx6d7uwpevlc78cdjyqrgng7357t8f3stm9fneeqtuupfnrt7f933a9"; QString message = QString("New Chat Address for your partner: ") + myAddr; + QString cid = QUuid::createUuid().toString(QUuid::WithoutBraces); parent->ui->listReceiveAddresses->insertItem(0, myAddr); parent->ui->listReceiveAddresses->setCurrentIndex(0); - // ab.addr_chat->setText(myAddr); + qDebug() << "new generated myAddr" << myAddr; - // + ab.cid->setText(cid); ab.addr_chat->setText(myAddr); - // AddressBook::getInstance()->addAddressLabel(newLabel, ab.addr->text(), myAddr, cid); }); model.updateUi(); //todo fix updating gui after adding rpc->refresh(true); @@ -168,8 +167,6 @@ void AddressBook::open(MainWindow* parent, QLineEdit* target) auto addr = ab.addr->text().trimmed(); auto myAddr = ab.addr_chat->text().trimmed(); QString newLabel = ab.label->text(); - // QString cid = QUuid::createUuid().toString(QUuid::WithoutBraces); - QString cid = ab.cid->text(); if (addr.isEmpty() || newLabel.isEmpty()) diff --git a/src/addressbook.ui b/src/addressbook.ui index f2344eb..c2d255d 100644 --- a/src/addressbook.ui +++ b/src/addressbook.ui @@ -27,9 +27,23 @@ + + + + Nickname + + + + + + + 40 + + + @@ -41,20 +55,13 @@ - + - Label + <html><head/><body><p>Conversation ID (editable):</p></body></html> - - - 40 - - - - diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp index 8a0689b..24523a1 100644 --- a/src/chatmodel.cpp +++ b/src/chatmodel.cpp @@ -129,8 +129,9 @@ void ChatModel::renderChatBox(Ui::MainWindow* ui, QListWidget *view) if ((ui->MyZaddr->text().trimmed() == c.second.getAddress()) && (c.second.getMemo().startsWith("{") == false) && (c.second.getMemo().isEmpty() == false)){ for(auto &p : AddressBook::getInstance()->getAllAddressLabels()){ - if (p.getCid() == c.second.getCid()){ - line += QString("<") + "verified" + QString("> :\n");} + if ((p.getCid() == c.second.getCid())){ + line+= QString("[") + "Verified Message" + QString("]"); ////Todo: Render a green checkmark instead of QString + } } line += QString("[") + myDateTime.toString("dd.MM.yyyy hh:mm:ss ") + QString("] "); line += QString("<") + QString("incoming") + QString("> :\n"); @@ -152,7 +153,7 @@ QString ChatModel::getCidByTx(QString tx) { for(auto& pair : this->cidMap) { - qDebug() << "TXID=" << pair.first << " CID=" << pair.second; + // qDebug() << "TXID=" << pair.first << " CID=" << pair.second; } if(this->cidMap.count(tx) > 0) diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 913907f..32affce 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -1393,9 +1393,9 @@ - 720 + 350 50 - 481 + 291 20 @@ -1527,8 +1527,8 @@ - 870 - 90 + 820 + 60 331 20 @@ -1537,6 +1537,19 @@ <html><head/><body><p align="center"><br/></p></body></html> + + + + 690 + 60 + 131 + 20 + + + + <html><head/><body><p align="center">Conversation ID:</p></body></html> + +