Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 46974344 authored by Daniel Vrátil's avatar Daniel Vrátil 🤖

Adapt to KCalCore lastModified/created API changes

parent b71bf079
......@@ -24,6 +24,7 @@
#include "calendar.h"
#include "event.h"
#include "reminder.h"
#include "utils.h"
#include "../debug.h"
#include <KCalCore/Alarm>
......@@ -310,10 +311,10 @@ ObjectPtr Private::JSONToEvent(const QVariantMap& data, const QString &timezone)
}
/* Created */
event->setCreated(KDateTime::fromString(data.value(QStringLiteral("created")).toString(), KDateTime::RFC3339Date));
event->setCreated(Utils::rfc3339DateFromString(data.value(QStringLiteral("created")).toString()));
/* Last updated */
event->setLastModified(KDateTime::fromString(data.value(QStringLiteral("updated")).toString(), KDateTime::RFC3339Date));
event->setLastModified(Utils::rfc3339DateFromString(data.value(QStringLiteral("updated")).toString()));
/* Summary */
event->setSummary(data.value(QStringLiteral("summary")).toString());
......
......@@ -47,3 +47,13 @@ QString Utils::ts2Str(quint64 ts)
{
return QDateTime::fromTime_t(ts).toUTC().toString(Qt::ISODate);
}
QDateTime Utils::rfc3339DateFromString(const QString &string)
{
return QDateTime::fromString(string, Qt::ISODate);
}
QString Utils::rfc3339DateToString(const QDateTime& dt)
{
return dt.toUTC().toString(Qt::ISODate);
}
......@@ -55,6 +55,16 @@ namespace Utils
*/
KGAPICORE_EXPORT QString ts2Str(quint64 timestamp);
/**
* @brief Converts given string in RFC3339 format into QDateTime
*/
KGAPICORE_EXPORT QDateTime rfc3339DateFromString(const QString &string);
/**
* @brief Converts given date time to RFC3339 format
*/
KGAPICORE_EXPORT QString rfc3339DateToString(const QDateTime &dt);
} // namespace Utils
#endif // LIBKGAPI2_UTILS_H
......@@ -22,6 +22,7 @@
#include "object.h"
#include "task.h"
#include "tasklist.h"
#include "utils.h"
#include <QJsonDocument>
......@@ -191,7 +192,7 @@ ObjectPtr Private::JSONToTask(const QVariantMap &jsonData)
task->setUid(jsonData.value(QStringLiteral("id")).toString());
task->setEtag(jsonData.value(QStringLiteral("etag")).toString());
task->setSummary(jsonData.value(QStringLiteral("title")).toString());;
task->setLastModified(KDateTime::fromString(jsonData.value(QStringLiteral("updated")).toString(), KDateTime::RFC3339Date));
task->setLastModified(Utils::rfc3339DateFromString(jsonData.value(QStringLiteral("updated")).toString()));
task->setDescription(jsonData.value(QStringLiteral("notes")).toString());
if (jsonData.value(QStringLiteral("status")).toString() == QStringLiteral("needsAction")) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment