aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlink2xt <link2xt@testrun.org>2021-08-28 12:03:48 +0000
committerlink2xt <link2xt@testrun.org>2021-08-28 15:05:39 +0300
commit6d2fc32a423b7b470521c67d94d9b59c168a948f (patch)
treed5eb1cdf41c769a9b7aea5677eff2f4b193452f8
parent7767e2843c0301bb8ee64eca324707cc93dcad09 (diff)
downloadkdeltachat-6d2fc32a423b7b470521c67d94d9b59c168a948f.tar.gz
kdeltachat-6d2fc32a423b7b470521c67d94d9b59c168a948f.zip
Show message timestamps
-rw-r--r--message.cpp6
-rw-r--r--message.h4
-rw-r--r--qml/Message.qml5
3 files changed, 12 insertions, 3 deletions
diff --git a/message.cpp b/message.cpp
index 90723d9..4aae043 100644
--- a/message.cpp
+++ b/message.cpp
@@ -46,6 +46,12 @@ DcMessage::getState()
return dc_msg_get_state(m_message);
}
+QDateTime
+DcMessage::getTimestamp()
+{
+ return QDateTime::fromSecsSinceEpoch (dc_msg_get_timestamp(m_message), Qt::UTC);
+}
+
void
DcMessage::setText(QString text)
{
diff --git a/message.h b/message.h
index 2ce81e2..d70703d 100644
--- a/message.h
+++ b/message.h
@@ -1,5 +1,6 @@
#pragma once
+#include <QDateTime>
#include <QObject>
#include <deltachat.h>
@@ -13,6 +14,7 @@ class DcMessage : public QObject {
Q_PROPERTY(uint32_t chatId READ getChatId CONSTANT)
Q_PROPERTY(int viewtype READ getViewtype CONSTANT)
Q_PROPERTY(int state READ getState CONSTANT)
+ Q_PROPERTY(QDateTime timestamp READ getTimestamp CONSTANT)
Q_PROPERTY(QString text READ getText WRITE setText)
Q_PROPERTY(QString subject READ getSubject CONSTANT)
Q_PROPERTY(QString file READ getFile CONSTANT)
@@ -37,7 +39,7 @@ public:
Q_INVOKABLE uint32_t getChatId();
Q_INVOKABLE int getViewtype();
Q_INVOKABLE int getState();
- //Q_INVOKABLE int64_t getTimestamp();
+ Q_INVOKABLE QDateTime getTimestamp();
//Q_INVOKABLE int64_t getReceivedTimestamp();
//Q_INVOKABLE int64_t getSortTimestamp();
Q_INVOKABLE void setText(QString);
diff --git a/qml/Message.qml b/qml/Message.qml
index 85cc2ac..c7daf07 100644
--- a/qml/Message.qml
+++ b/qml/Message.qml
@@ -218,10 +218,11 @@ RowLayout {
}
Label {
Layout.fillWidth: true
- text: messageObject.message.state == 26 ? "✓"
+ text: Qt.formatDateTime(messageObject.message.timestamp, "dd. MMM yyyy, hh:mm")
+ + (messageObject.message.state == 26 ? "✓"
: messageObject.message.state == 28 ? "✓✓"
: messageObject.message.state == 24 ? "✗"
- : "";
+ : "");
}
}
}