Browse Source

create a cid in addressbook but make it editable for the beginning

pull/130/head
DenioD 4 years ago
parent
commit
f515be1aa8
  1. 9
      src/addressbook.cpp
  2. 25
      src/addressbook.ui
  3. 7
      src/chatmodel.cpp
  4. 21
      src/mainwindow.ui

9
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<json::array_t>()[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())

25
src/addressbook.ui

@ -27,9 +27,23 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Nickname</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLineEdit" name="addr"/>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="label">
<property name="maxLength">
<number>40</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
@ -41,20 +55,13 @@
<widget class="QLineEdit" name="addr_chat"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Label</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Conversation ID (editable):&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLineEdit" name="label">
<property name="maxLength">
<number>40</number>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLineEdit" name="cid"/>
</item>
<item row="6" column="1">

7
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)

21
src/mainwindow.ui

@ -1393,9 +1393,9 @@
<widget class="QLabel" name="contactNameMemo">
<property name="geometry">
<rect>
<x>720</x>
<x>350</x>
<y>50</y>
<width>481</width>
<width>291</width>
<height>20</height>
</rect>
</property>
@ -1527,8 +1527,8 @@
<widget class="QLabel" name="contactCid">
<property name="geometry">
<rect>
<x>870</x>
<y>90</y>
<x>820</x>
<y>60</y>
<width>331</width>
<height>20</height>
</rect>
@ -1537,6 +1537,19 @@
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QLabel" name="contactNameMemo_2">
<property name="geometry">
<rect>
<x>690</x>
<y>60</y>
<width>131</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;Conversation ID:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</widget>
</widget>
</item>

Loading…
Cancel
Save