ChatDataStore::getAllContactRequests()
for(auto &c: this->data)
{
if (
- (c.second.getType() == "cont") &&
- (c.second.isOutgoing() == false) &&
+ (c.second.isOutgoing() == false) &&
+ (c.second.getType() == "cont") &&
(c.second.getMemo().startsWith("{"))
)
{
diff --git a/src/Model/ChatItem.cpp b/src/Model/ChatItem.cpp
index 39d4a68..afdde53 100644
--- a/src/Model/ChatItem.cpp
+++ b/src/Model/ChatItem.cpp
@@ -1,8 +1,11 @@
+// Copyright 2019-2020 The Hush developers
+// GPLv3
+
#include "ChatItem.h"
ChatItem::ChatItem() {}
-ChatItem::ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid)
+ChatItem::ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, int confirmations)
{
_timestamp = timestamp;
_address = address;
@@ -12,10 +15,11 @@ ChatItem::ChatItem(long timestamp, QString address, QString contact, QString mem
_type = type;
_cid = cid;
_txid = txid;
+ _confirmations = confirmations;
_outgoing = false;
}
-ChatItem::ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, bool outgoing)
+ChatItem::ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, int confirmations, bool outgoing)
{
_timestamp = timestamp;
_address = address;
@@ -25,6 +29,7 @@ ChatItem::ChatItem(long timestamp, QString address, QString contact, QString mem
_type = type;
_cid = cid;
_txid = txid;
+ _confirmations = confirmations;
_outgoing = outgoing;
}
@@ -66,6 +71,10 @@ QString ChatItem::getTxid()
{
return _txid;
}
+int ChatItem::getConfirmations()
+{
+ return _confirmations;
+}
bool ChatItem::isOutgoing()
{
@@ -110,26 +119,38 @@ void ChatItem::setTxid(QString txid)
{
_txid = txid;
}
+void ChatItem::setConfirmations(int confirmations)
+{
+ _confirmations = confirmations;
+}
void ChatItem::toggleOutgo()
{
_outgoing = true;
}
+
QString ChatItem::toChatLine()
{
QDateTime myDateTime;
+ QString lock;
myDateTime.setTime_t(_timestamp);
- QString line = QString("[") + myDateTime.toString("d.M.yy hh:mm") + QString("] ");
- line += QString("") + QString(_memo) + QString("\n\n");
+
+ if (_confirmations == 0){
+ lock = " ";
+ }else{
+
+ lock = " ";
+
+ }
+
+ QString line = QString("") + myDateTime.toString("dd.MM.yyyy hh:mm");
+ line += QString(lock) + QString("");
+ line += QString("") + _memo.toHtmlEscaped() + QString("
");
return line;
}
ChatItem::~ChatItem()
{
- /*delete timestamp;
- delete address;
- delete contact;
- delete memo;
- delete outgoing;*/
+
}
\ No newline at end of file
diff --git a/src/Model/ChatItem.h b/src/Model/ChatItem.h
index 467341f..6f27609 100644
--- a/src/Model/ChatItem.h
+++ b/src/Model/ChatItem.h
@@ -1,3 +1,6 @@
+// Copyright 2019-2020 The Hush developers
+// GPLv3
+
#ifndef CHATITEM_H
#define CHATITEM_H
@@ -14,12 +17,13 @@ class ChatItem
QString _type;
QString _cid;
QString _txid;
+ int _confirmations;
bool _outgoing = false;
public:
ChatItem();
- ChatItem(long timestamp, QString address, QString contact, QString memo,QString requestZaddr, QString type, QString cid, QString txid);
- ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, bool outgoing);
+ ChatItem(long timestamp, QString address, QString contact, QString memo,QString requestZaddr, QString type, QString cid, QString txid, int confirmations);
+ ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, int confirmations, bool outgoing);
long getTimestamp();
QString getAddress();
QString getContact();
@@ -28,6 +32,7 @@ class ChatItem
QString getType();
QString getCid();
QString getTxid();
+ int getConfirmations();
bool isOutgoing();
void setTimestamp(long timestamp);
void setAddress(QString address);
@@ -37,6 +42,7 @@ class ChatItem
void setType(QString type);
void setCid(QString cid);
void setTxid(QString txid);
+ void setConfirmations(int confirmations);
void toggleOutgo();
QString toChatLine();
~ChatItem();
diff --git a/src/addressbook.cpp b/src/addressbook.cpp
index d17726c..c3fdc6c 100644
--- a/src/addressbook.cpp
+++ b/src/addressbook.cpp
@@ -1,5 +1,6 @@
// Copyright 2019-2020 The Hush developers
// GPLv3
+
#include "addressbook.h"
#include "ui_addressbook.h"
#include "ui_mainwindow.h"
diff --git a/src/chatmodel.h b/src/chatmodel.h
index 04493b8..bf3e255 100644
--- a/src/chatmodel.h
+++ b/src/chatmodel.h
@@ -1,3 +1,6 @@
+// Copyright 2019-2020 The Hush developers
+// GPLv3
+
#ifndef CHATMODEL_H
#define CHATMODEL_H
#include
diff --git a/src/contactmodel.cpp b/src/contactmodel.cpp
index ad58ccb..6f452fa 100644
--- a/src/contactmodel.cpp
+++ b/src/contactmodel.cpp
@@ -1,5 +1,6 @@
// Copyright 2019-2020 The Hush developers
// GPLv3
+
#include "contactmodel.h"
#include "addressbook.h"
#include "mainwindow.h"
diff --git a/src/controller.cpp b/src/controller.cpp
index 47a1a1e..534fffe 100644
--- a/src/controller.cpp
+++ b/src/controller.cpp
@@ -878,9 +878,11 @@ void Controller::refreshTransactions() {
QString(""),
cid,
txid,
+ confirmations,
true
);
qDebug()<<"Memo : " <setData(ChatIDGenerator::getInstance()->generateID(item), item);
@@ -973,9 +975,11 @@ void Controller::refreshTransactions() {
type,
cid,
txid,
+ confirmations,
false
);
qDebug()<< "Position : " << position;
+ qDebug()<<"Confirmation :" << confirmations;
DataStore::getChatDataStore()->setData(ChatIDGenerator::getInstance()->generateID(item), item);
}
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 7a1f6c2..de034ac 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -1,5 +1,6 @@
// Copyright 2019-2020 The Hush developers
// GPLv3
+
#include "mainwindow.h"
#include "addressbook.h"
#include "viewalladdresses.h"