File indexing completed on 2024-05-12 05:22:20

0001 /*
0002  * This file is part of LibKGAPI library
0003  *
0004  * SPDX-FileCopyrightText: 2013 Daniel Vrátil <dvratil@redhat.com>
0005  *
0006  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007  */
0008 
0009 #pragma once
0010 
0011 #include "fetchjob.h"
0012 #include "kgapidrive_export.h"
0013 
0014 #include <QStringList>
0015 
0016 namespace KGAPI2
0017 {
0018 
0019 namespace Drive
0020 {
0021 
0022 class FileSearchQuery;
0023 class KGAPIDRIVE_EXPORT FileFetchJob : public KGAPI2::FetchJob
0024 {
0025     Q_OBJECT
0026 
0027     /**
0028      * Whether to update the view date after successfully retrieving files.
0029      *
0030      * Default value is false.
0031      *
0032      * This property can be modified only when the job is not running.
0033      */
0034     Q_PROPERTY(bool updateViewedDate READ updateViewedDate WRITE setUpdateViewedDate)
0035 
0036 public:
0037     struct FieldShorthands {
0038         static const QStringList BasicFields;
0039         static const QStringList AccessFields;
0040         static const QStringList SharingFields;
0041     };
0042 
0043     explicit FileFetchJob(const QString &fileId, const AccountPtr &account, QObject *parent = nullptr);
0044     explicit FileFetchJob(const QStringList &filesIds, const AccountPtr &account, QObject *parent = nullptr);
0045     explicit FileFetchJob(const FileSearchQuery &query, const AccountPtr &account, QObject *parent = nullptr);
0046     explicit FileFetchJob(const AccountPtr &account, QObject *parent = nullptr);
0047     ~FileFetchJob() override;
0048 
0049     void setFields(const QStringList &fields);
0050     QStringList fields() const;
0051 
0052     bool updateViewedDate() const;
0053     void setUpdateViewedDate(bool updateViewedDate);
0054 
0055     /**
0056      * @brief Whether both My Drive and shared drive items should be included in results.
0057      *
0058      * @deprecated This parameter will only be effective until June 1, 2020. Afterwards shared drive items will be included in the results.
0059      */
0060     KGAPIDRIVE_DEPRECATED bool includeItemsFromAllDrives() const;
0061 
0062     /**
0063      * @brief Sets whether both My Drive and shared drive items should be included in results.
0064      *
0065      * Set to true by default as LibKGAPI supports Team Drives.
0066      *
0067      * @deprecated This parameter will only be effective until June 1, 2020. Afterwards shared drive items will be included in the results.
0068      */
0069     KGAPIDRIVE_DEPRECATED void setIncludeItemsFromAllDrives(bool includeItemsFromAllDrives);
0070 
0071     /**
0072      * @brief Whether the request supports both My Drives and shared drives.
0073      *
0074      * Set to true by default as LibKGAPI supports Team Drives.
0075      *
0076      * @deprecated This parameter will only be effective until June 1, 2020. Afterwards all applications
0077      * are assumed to support shared drives.
0078      */
0079     KGAPIDRIVE_DEPRECATED bool supportsAllDrives() const;
0080 
0081     /**
0082      * @brief Sets whether the request supports both My Drives and shared drives.
0083      *
0084      * Set to true by default as LibKGAPI supports Team Drives.
0085      *
0086      * @deprecated This parameter will only be effective until June 1, 2020. Afterwards all applications
0087      * are assumed to support shared drives.
0088      */
0089     KGAPIDRIVE_DEPRECATED void setSupportsAllDrives(bool supportsAllDrives);
0090 
0091 protected:
0092     void start() override;
0093     KGAPI2::ObjectsList handleReplyWithItems(const QNetworkReply *reply, const QByteArray &rawData) override;
0094 
0095 private:
0096     class Private;
0097     Private *const d;
0098     friend class Private;
0099 };
0100 
0101 } // namespace Drive
0102 
0103 } // namespace KGAPI2