Changeset View
Changeset View
Standalone View
Standalone View
src/calendar/eventfetchjob.cpp
Show First 20 Lines • Show All 160 Lines • ▼ Show 20 Line(s) | 160 | } else { | |||
---|---|---|---|---|---|
161 | url = CalendarService::fetchEventUrl(d->calendarId, d->eventId); | 161 | url = CalendarService::fetchEventUrl(d->calendarId, d->eventId); | ||
162 | } | 162 | } | ||
163 | const QNetworkRequest request = CalendarService::prepareRequest(url); | 163 | const QNetworkRequest request = CalendarService::prepareRequest(url); | ||
164 | enqueueRequest(request); | 164 | enqueueRequest(request); | ||
165 | } | 165 | } | ||
166 | 166 | | |||
167 | ObjectsList EventFetchJob::handleReplyWithItems(const QNetworkReply *reply, const QByteArray& rawData) | 167 | ObjectsList EventFetchJob::handleReplyWithItems(const QNetworkReply *reply, const QByteArray& rawData) | ||
168 | { | 168 | { | ||
169 | #if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0)) | ||||
170 | if (reply->error() == QNetworkReply::ContentGoneError | ||||
171 | #else | ||||
172 | if (reply->networkError() == QNetworkReply::ContentGoneError | ||||
173 | #endif | ||||
174 | || reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == Gone) { | ||||
175 | // Full sync required by server, redo request with no updatedMin | ||||
176 | d->updatedTimestamp = 0; | ||||
177 | start(); | ||||
178 | // Errors are not cleared on success | ||||
179 | // Do it here or else the job will fail | ||||
180 | setError(KGAPI2::NoError); | ||||
181 | setErrorString(QString()); | ||||
182 | return ObjectsList(); | ||||
183 | } | ||||
184 | | ||||
169 | FeedData feedData; | 185 | FeedData feedData; | ||
170 | feedData.requestUrl = reply->url(); | 186 | feedData.requestUrl = reply->url(); | ||
171 | ObjectsList items; | 187 | ObjectsList items; | ||
172 | const QString contentType = reply->header(QNetworkRequest::ContentTypeHeader).toString(); | 188 | const QString contentType = reply->header(QNetworkRequest::ContentTypeHeader).toString(); | ||
173 | ContentType ct = Utils::stringToContentType(contentType); | 189 | ContentType ct = Utils::stringToContentType(contentType); | ||
174 | if (ct == KGAPI2::JSON) { | 190 | if (ct == KGAPI2::JSON) { | ||
175 | if (d->eventId.isEmpty()) { | 191 | if (d->eventId.isEmpty()) { | ||
176 | items = CalendarService::parseEventJSONFeed(rawData, feedData); | 192 | items = CalendarService::parseEventJSONFeed(rawData, feedData); | ||
Show All 19 Lines |