add txid and cid to chatmodel
This commit is contained in:
@@ -8,8 +8,11 @@
|
|||||||
#include "ui_memodialog.h"
|
#include "ui_memodialog.h"
|
||||||
#include "addressbook.h"
|
#include "addressbook.h"
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
|
#include <bits/stdc++.h>
|
||||||
|
#include <boost/algorithm/string.hpp>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace boost;
|
||||||
|
|
||||||
ChatModel::ChatModel(std::map<long, ChatItem> chatItems)
|
ChatModel::ChatModel(std::map<long, ChatItem> chatItems)
|
||||||
{
|
{
|
||||||
@@ -89,8 +92,9 @@ void ChatModel::renderChatBox(Ui::MainWindow* ui, QListWidget *view)
|
|||||||
|
|
||||||
myDateTime.setTime_t(c.second.getTimestamp());
|
myDateTime.setTime_t(c.second.getTimestamp());
|
||||||
|
|
||||||
//////Render only Memos for selected contacts. Do not render empty Memos
|
//////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("[") + myDateTime.toString("dd.MM.yyyy hh:mm:ss ") + QString("] ");
|
||||||
line += QString("<") + QString("Outgoing") + QString("> :\n");
|
line += QString("<") + QString("Outgoing") + QString("> :\n");
|
||||||
line += QString(c.second.getMemo()) + QString("\n");
|
line += QString(c.second.getMemo()) + QString("\n");
|
||||||
|
|||||||
@@ -17,27 +17,33 @@ class ChatItem
|
|||||||
QString _address;
|
QString _address;
|
||||||
QString _contact;
|
QString _contact;
|
||||||
QString _memo;
|
QString _memo;
|
||||||
|
QString _cid;
|
||||||
|
QString _txid;
|
||||||
bool _outgoing = false;
|
bool _outgoing = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ChatItem() {}
|
ChatItem() {}
|
||||||
|
|
||||||
ChatItem(long timestamp, QString address, QString contact, QString memo)
|
ChatItem(long timestamp, QString address, QString contact, QString memo, QString cid, QString txid)
|
||||||
{
|
{
|
||||||
_timestamp = timestamp;
|
_timestamp = timestamp;
|
||||||
_address = address;
|
_address = address;
|
||||||
_contact = contact;
|
_contact = contact;
|
||||||
_memo = memo;
|
_memo = memo;
|
||||||
|
_cid = cid;
|
||||||
|
_txid = txid;
|
||||||
_outgoing = false;
|
_outgoing = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatItem(long timestamp, QString address, QString contact, QString memo, bool outgoing)
|
ChatItem(long timestamp, QString address, QString contact, QString memo, QString cid, QString txid, bool outgoing)
|
||||||
{
|
{
|
||||||
_timestamp = timestamp;
|
_timestamp = timestamp;
|
||||||
_address = address;
|
_address = address;
|
||||||
_contact = contact;
|
_contact = contact;
|
||||||
_memo = memo;
|
_memo = memo;
|
||||||
|
_cid = cid;
|
||||||
|
_txid = txid;
|
||||||
_outgoing = outgoing;
|
_outgoing = outgoing;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -62,6 +68,16 @@ class ChatItem
|
|||||||
return _memo;
|
return _memo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString getCid()
|
||||||
|
{
|
||||||
|
return _cid;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString getTxid()
|
||||||
|
{
|
||||||
|
return _cid;
|
||||||
|
}
|
||||||
|
|
||||||
bool isOutgoing()
|
bool isOutgoing()
|
||||||
{
|
{
|
||||||
return _outgoing;
|
return _outgoing;
|
||||||
@@ -87,6 +103,15 @@ class ChatItem
|
|||||||
_memo = memo;
|
_memo = memo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setCid(QString cid)
|
||||||
|
{
|
||||||
|
_cid = cid;
|
||||||
|
}
|
||||||
|
void setTxid(QString txid)
|
||||||
|
{
|
||||||
|
_txid = txid;
|
||||||
|
}
|
||||||
|
|
||||||
void toggleOutgo()
|
void toggleOutgo()
|
||||||
{
|
{
|
||||||
_outgoing = true;
|
_outgoing = true;
|
||||||
|
|||||||
@@ -884,7 +884,9 @@ void Controller::refreshTransactions() {
|
|||||||
datetime,
|
datetime,
|
||||||
address,
|
address,
|
||||||
QString(""),
|
QString(""),
|
||||||
memo
|
memo,
|
||||||
|
"", // we have to set the cid here,
|
||||||
|
txid
|
||||||
// true // is an outgoing message
|
// true // is an outgoing message
|
||||||
);
|
);
|
||||||
chatModel->addMessage(item);
|
chatModel->addMessage(item);
|
||||||
@@ -933,7 +935,9 @@ void Controller::refreshTransactions() {
|
|||||||
datetime,
|
datetime,
|
||||||
address,
|
address,
|
||||||
QString(""),
|
QString(""),
|
||||||
memo
|
memo,
|
||||||
|
"", // we have to set the cid here
|
||||||
|
txid
|
||||||
);
|
);
|
||||||
chatModel->addMessage(item);
|
chatModel->addMessage(item);
|
||||||
|
|
||||||
|
|||||||
@@ -1001,6 +1001,7 @@ void MainWindow::setupchatTab() {
|
|||||||
ui->ContactZaddr->setText(p.getPartnerAddress());
|
ui->ContactZaddr->setText(p.getPartnerAddress());
|
||||||
ui->MyZaddr->setText(p.getMyAddress());
|
ui->MyZaddr->setText(p.getMyAddress());
|
||||||
ui->contactNameMemo->setText(p.getName());
|
ui->contactNameMemo->setText(p.getName());
|
||||||
|
ui->contactCid->setText(p.getCid());
|
||||||
|
|
||||||
rpc->refresh(true);
|
rpc->refresh(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1524,6 +1524,19 @@
|
|||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QLabel" name="contactCid">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>870</x>
|
||||||
|
<y>90</y>
|
||||||
|
<width>331</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p align="center"><br/></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
Reference in New Issue
Block a user