From 0c7387f84f62d12d7beddc82ab69c16ae82038e9 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Thu, 24 Nov 2016 17:26:04 +0100 Subject: [PATCH] feat(Linphone/Chat): format correcly sections --- tests/src/components/chat/ChatModel.cpp | 8 ++++---- tests/ui/modules/Linphone/Chat/Chat.qml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/src/components/chat/ChatModel.cpp b/tests/src/components/chat/ChatModel.cpp index 888e828a8..a4c0b376c 100644 --- a/tests/src/components/chat/ChatModel.cpp +++ b/tests/src/components/chat/ChatModel.cpp @@ -21,10 +21,10 @@ QVariant ChatModel::data (const QModelIndex &index, int role) const { return QVariant(); switch (role) { - case: Roles::ChatEntry + case Roles::ChatEntry: return QVariant::fromValue(m_entries[row]); - case: Roles::SectionDate - return QVariant::fromValue(m_entries[row]["sectionDate"]); + case Roles::SectionDate: + return QVariant::fromValue(m_entries[row]["timestamp"].toDate()); } return QVariant(); @@ -58,7 +58,7 @@ void ChatModel::setSipAddress (const QString &sip_address) { for (auto &message : chat_room->getHistory(0)) { QVariantMap map; - map["sectionDate"] = 1465389121; + // UTC format. map["timestamp"] = QDateTime::fromTime_t(message->getTime()); map["type"] = "message"; map["content"] = Utils::linphoneStringToQString( diff --git a/tests/ui/modules/Linphone/Chat/Chat.qml b/tests/ui/modules/Linphone/Chat/Chat.qml index 1da0d8ba9..28d2908d8 100644 --- a/tests/ui/modules/Linphone/Chat/Chat.qml +++ b/tests/ui/modules/Linphone/Chat/Chat.qml @@ -65,7 +65,7 @@ ColumnLayout { // Cast section to integer because Qt converts the // sectionDate in string!!! - text: new Date(+section).toLocaleDateString( + text: new Date(section).toLocaleDateString( Qt.locale(App.locale()) ) }