From 399defe5a61e7a216bf5f3095534105ca4eb28ee Mon Sep 17 00:00:00 2001 From: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com> Date: Wed, 11 Jan 2023 10:24:26 -0500 Subject: [PATCH] chatview: fix undefined timestamp warning Change-Id: If3ee1fd3f074e8807fedc66fc02758df62789b39 --- src/app/commoncomponents/TimestampInfo.qml | 4 ++-- src/libclient/messagelistmodel.cpp | 2 +- src/libclient/messagelistmodel.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/commoncomponents/TimestampInfo.qml b/src/app/commoncomponents/TimestampInfo.qml index 09aff1d00..584596848 100644 --- a/src/app/commoncomponents/TimestampInfo.qml +++ b/src/app/commoncomponents/TimestampInfo.qml @@ -37,8 +37,8 @@ ColumnLayout { Connections { target: MessagesAdapter.messageListModel - function onTimestampUpdate() { - if (showTime || showDay) { + function onTimestampUpdated() { + if ((showTime || showDay) && Timestamp !== undefined) { formattedTime = MessagesAdapter.getFormattedTime(Timestamp) } } diff --git a/src/libclient/messagelistmodel.cpp b/src/libclient/messagelistmodel.cpp index fe0a00fbf..5e9a4f8ec 100644 --- a/src/libclient/messagelistmodel.cpp +++ b/src/libclient/messagelistmodel.cpp @@ -39,7 +39,7 @@ MessageListModel::MessageListModel(QObject* parent) : QAbstractListModel(parent) , timestampTimer_(new QTimer(this)) { - connect(timestampTimer_, &QTimer::timeout, this, &MessageListModel::timestampUpdate); + connect(timestampTimer_, &QTimer::timeout, this, &MessageListModel::timestampUpdated); timestampTimer_->start(1000); } diff --git a/src/libclient/messagelistmodel.h b/src/libclient/messagelistmodel.h index b79b2eefa..2625a6125 100644 --- a/src/libclient/messagelistmodel.h +++ b/src/libclient/messagelistmodel.h @@ -134,7 +134,7 @@ public: void emitDataChanged(const QString& msgId, VectorInt roles = {}); bool isOnlyEmoji(const QString& text) const; - Q_SIGNAL void timestampUpdate(); + Q_SIGNAL void timestampUpdated(); void addEdition(const QString& msgId, const interaction::Info& info, bool end); void addReaction(const QString& messageId, const QString& reactionId); -- GitLab