Changeset View
Changeset View
Standalone View
Standalone View
src/drive/filefetchjob.cpp
Show All 40 Lines | 40 | public: | |||
---|---|---|---|---|---|
41 | Private(FileFetchJob *parent); | 41 | Private(FileFetchJob *parent); | ||
42 | void processNext(); | 42 | void processNext(); | ||
43 | QNetworkRequest createRequest(const QUrl &url); | 43 | QNetworkRequest createRequest(const QUrl &url); | ||
44 | QStringList fieldsToStrings(qulonglong fields); | 44 | QStringList fieldsToStrings(qulonglong fields); | ||
45 | 45 | | |||
46 | FileSearchQuery searchQuery; | 46 | FileSearchQuery searchQuery; | ||
47 | QStringList filesIDs; | 47 | QStringList filesIDs; | ||
48 | bool isFeed; | 48 | bool isFeed; | ||
49 | bool includeTeamDriveItems; | ||||
49 | 50 | | |||
50 | bool updateViewedDate; | 51 | bool updateViewedDate; | ||
51 | 52 | | |||
52 | qulonglong fields; | 53 | qulonglong fields; | ||
53 | 54 | | |||
54 | private: | 55 | private: | ||
55 | FileFetchJob *const q; | 56 | FileFetchJob *const q; | ||
56 | }; | 57 | }; | ||
▲ Show 20 Lines • Show All 176 Lines • ▼ Show 20 Line(s) | 231 | if (isFeed) { | |||
233 | if (!searchQuery.isEmpty()) { | 234 | if (!searchQuery.isEmpty()) { | ||
234 | query.addQueryItem(QStringLiteral("q"), searchQuery.serialize()); | 235 | query.addQueryItem(QStringLiteral("q"), searchQuery.serialize()); | ||
235 | } | 236 | } | ||
236 | if (fields != FileFetchJob::AllFields) { | 237 | if (fields != FileFetchJob::AllFields) { | ||
237 | const QStringList fieldsStrings = fieldsToStrings(fields); | 238 | const QStringList fieldsStrings = fieldsToStrings(fields); | ||
238 | query.addQueryItem(QStringLiteral("fields"), | 239 | query.addQueryItem(QStringLiteral("fields"), | ||
239 | QStringLiteral("etag,kind,nextLink,nextPageToken,selfLink,items(%1)").arg(fieldsStrings.join(QStringLiteral(",")))); | 240 | QStringLiteral("etag,kind,nextLink,nextPageToken,selfLink,items(%1)").arg(fieldsStrings.join(QStringLiteral(",")))); | ||
240 | } | 241 | } | ||
242 | | ||||
243 | if (includeTeamDriveItems) { | ||||
244 | query.addQueryItem(QStringLiteral("includeTeamDriveItems"), QStringLiteral("true")); | ||||
245 | query.addQueryItem(QStringLiteral("supportsTeamDrives"), QStringLiteral("true")); | ||||
246 | } | ||||
247 | | ||||
241 | url.setQuery(query); | 248 | url.setQuery(query); | ||
242 | } else { | 249 | } else { | ||
243 | if (filesIDs.isEmpty()) { | 250 | if (filesIDs.isEmpty()) { | ||
244 | q->emitFinished(); | 251 | q->emitFinished(); | ||
245 | return; | 252 | return; | ||
246 | } | 253 | } | ||
247 | 254 | | |||
248 | const QString fileId = filesIDs.takeFirst(); | 255 | const QString fileId = filesIDs.takeFirst(); | ||
▲ Show 20 Lines • Show All 72 Lines • ▼ Show 20 Line(s) | 327 | { | |||
321 | d->fields = fields; | 328 | d->fields = fields; | ||
322 | } | 329 | } | ||
323 | 330 | | |||
324 | qulonglong FileFetchJob::fields() const | 331 | qulonglong FileFetchJob::fields() const | ||
325 | { | 332 | { | ||
326 | return d->fields; | 333 | return d->fields; | ||
327 | } | 334 | } | ||
328 | 335 | | |||
336 | bool FileFetchJob::includeTeamDriveItems() const | ||||
337 | { | ||||
338 | return d->includeTeamDriveItems; | ||||
339 | } | ||||
340 | | ||||
341 | void FileFetchJob::setIncludeTeamDriveItems(bool includeTeamDriveItems) | ||||
342 | { | ||||
343 | d->includeTeamDriveItems = includeTeamDriveItems; | ||||
344 | } | ||||
345 | | ||||
329 | 346 | | |||
330 | ObjectsList FileFetchJob::handleReplyWithItems(const QNetworkReply *reply, | 347 | ObjectsList FileFetchJob::handleReplyWithItems(const QNetworkReply *reply, | ||
331 | const QByteArray &rawData) | 348 | const QByteArray &rawData) | ||
332 | { | 349 | { | ||
333 | ObjectsList items; | 350 | ObjectsList items; | ||
334 | 351 | | |||
335 | const QString contentType = reply->header(QNetworkRequest::ContentTypeHeader).toString(); | 352 | const QString contentType = reply->header(QNetworkRequest::ContentTypeHeader).toString(); | ||
336 | ContentType ct = Utils::stringToContentType(contentType); | 353 | ContentType ct = Utils::stringToContentType(contentType); | ||
Show All 27 Lines |