Commit 7a1381f8 authored by Daniel Vrátil's avatar Daniel Vrátil 🤖

Calendar: remove the maxResults query parameter

The default value used by Google API when the argument is not specified is
250, which makes more sense than 20, which causes unnecessary pagination.
parent 9b8cce2e
...@@ -116,9 +116,6 @@ QUrl fetchEventsUrl(const QString& calendarID) ...@@ -116,9 +116,6 @@ QUrl fetchEventsUrl(const QString& calendarID)
{ {
QUrl url(Private::GoogleApisUrl); QUrl url(Private::GoogleApisUrl);
url.setPath(Private::CalendarBasePath % QLatin1Char('/') % calendarID % QLatin1String("/events")); url.setPath(Private::CalendarBasePath % QLatin1Char('/') % calendarID % QLatin1String("/events"));
QUrlQuery query(url);
query.addQueryItem(QStringLiteral("maxResults"), QStringLiteral("20"));
url.setQuery(query);
return url; return url;
} }
...@@ -281,9 +278,6 @@ ObjectsList parseCalendarJSONFeed(const QByteArray& jsonFeed, FeedData& feedData ...@@ -281,9 +278,6 @@ ObjectsList parseCalendarJSONFeed(const QByteArray& jsonFeed, FeedData& feedData
feedData.nextPageUrl = fetchCalendarsUrl(); feedData.nextPageUrl = fetchCalendarsUrl();
QUrlQuery query(feedData.nextPageUrl); QUrlQuery query(feedData.nextPageUrl);
query.addQueryItem(QStringLiteral("pageToken"), data.value(QStringLiteral("nextPageToken")).toString()); query.addQueryItem(QStringLiteral("pageToken"), data.value(QStringLiteral("nextPageToken")).toString());
if (query.queryItemValue(QStringLiteral("maxResults")).isEmpty()) {
query.addQueryItem(QStringLiteral("maxResults"),QStringLiteral("20"));
}
feedData.nextPageUrl.setQuery(query); feedData.nextPageUrl.setQuery(query);
} }
} else { } else {
...@@ -770,9 +764,6 @@ ObjectsList parseEventJSONFeed(const QByteArray& jsonFeed, FeedData& feedData) ...@@ -770,9 +764,6 @@ ObjectsList parseEventJSONFeed(const QByteArray& jsonFeed, FeedData& feedData)
QUrlQuery query(feedData.nextPageUrl); QUrlQuery query(feedData.nextPageUrl);
query.removeQueryItem(QStringLiteral("pageToken")); query.removeQueryItem(QStringLiteral("pageToken"));
query.addQueryItem(QStringLiteral("pageToken"), data.value(QStringLiteral("nextPageToken")).toString()); query.addQueryItem(QStringLiteral("pageToken"), data.value(QStringLiteral("nextPageToken")).toString());
if (query.queryItemValue(QStringLiteral("maxResults")).isEmpty()) {
query.addQueryItem(QStringLiteral("maxResults"), QStringLiteral("20"));
}
feedData.nextPageUrl.setQuery(query); feedData.nextPageUrl.setQuery(query);
} }
if (data.contains(QStringLiteral("timeZone"))) { if (data.contains(QStringLiteral("timeZone"))) {
......
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