This commit is contained in:
Martin Rotter 2021-03-29 12:44:21 +02:00 committed by Martin Rotter
parent 8f0495b18a
commit fecfe22e7d
3 changed files with 4 additions and 4 deletions

View File

@ -130,7 +130,7 @@ QDateTime TextFactory::parseDateTime(const QString& date_time) {
} }
QDateTime TextFactory::parseDateTime(qint64 milis_from_epoch) { QDateTime TextFactory::parseDateTime(qint64 milis_from_epoch) {
return QDateTime::fromMSecsSinceEpoch(milis_from_epoch); return QDateTime::fromMSecsSinceEpoch(milis_from_epoch, Qt::TimeSpec::UTC);
} }
QString TextFactory::encrypt(const QString& text) { QString TextFactory::encrypt(const QString& text) {

View File

@ -26,7 +26,7 @@ class TextFactory {
static QDateTime parseDateTime(const QString& date_time); static QDateTime parseDateTime(const QString& date_time);
// Converts 1970-epoch miliseconds to date/time. // Converts 1970-epoch miliseconds to date/time.
// NOTE: This apparently returns date/time in localtime. // NOTE: This method tries to always return time in UTC.
static QDateTime parseDateTime(qint64 milis_from_epoch); static QDateTime parseDateTime(qint64 milis_from_epoch);
static QString encrypt(const QString& text); static QString encrypt(const QString& text);
static QString decrypt(const QString& text); static QString decrypt(const QString& text);

View File

@ -580,7 +580,7 @@ QList<Message>OwnCloudGetMessagesResponse::messages() const {
msg.m_contents = message_map["body"].toString(); msg.m_contents = message_map["body"].toString();
msg.m_created = TextFactory::parseDateTime(message_map["pubDate"].toDouble() * 1000); msg.m_created = TextFactory::parseDateTime(message_map["pubDate"].toDouble() * 1000);
msg.m_createdFromFeed = true; msg.m_createdFromFeed = true;
msg.m_customId = message_map["id"].isString() ? message_map["id"].toString() : QString::number(message_map["id"].toInt()); msg.m_customId = message_map["id"].toVariant().toString();
msg.m_customHash = message_map["guidHash"].toString(); msg.m_customHash = message_map["guidHash"].toString();
QString enclosure_link = message_map["enclosureLink"].toString(); QString enclosure_link = message_map["enclosureLink"].toString();
@ -593,7 +593,7 @@ QList<Message>OwnCloudGetMessagesResponse::messages() const {
msg.m_enclosures.append(enclosure); msg.m_enclosures.append(enclosure);
} }
msg.m_feedId = message_map["feedId"].toString(); msg.m_feedId = message_map["feedId"].toVariant().toString();
msg.m_isImportant = message_map["starred"].toBool(); msg.m_isImportant = message_map["starred"].toBool();
msg.m_isRead = !message_map["unread"].toBool(); msg.m_isRead = !message_map["unread"].toBool();
msg.m_title = message_map["title"].toString(); msg.m_title = message_map["title"].toString();