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

0001 /*
0002  * This file is part of LibKGAPI library
0003  *
0004  * SPDX-FileCopyrightText: 2020 David Barchiesi <david@barchie.si>
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 "fileabstractresumablejob.h"
0012 #include "kgapidrive_export.h"
0013 
0014 namespace KGAPI2
0015 {
0016 
0017 namespace Drive
0018 {
0019 
0020 class KGAPIDRIVE_EXPORT FileResumableModifyJob : public KGAPI2::Drive::FileAbstractResumableJob
0021 {
0022     Q_OBJECT
0023 
0024     /**
0025      * Whether a blob upload should create a new revision. If set to false,
0026      * the blob data in the current head revision is replaced. If true, a new
0027      * blob is created as head revision, and previous revisions are preserved
0028      * (causing increased use of the user's data storage quota).
0029      *
0030      * Default value is true.
0031      *
0032      * This property can be modified only when the job is not running.
0033      */
0034     Q_PROPERTY(bool createNewRevision READ createNewRevision WRITE setCreateNewRevision)
0035 
0036     /**
0037      * Whether to set the modified date with the supplied modified date.
0038      *
0039      * Default value is false.
0040      *
0041      * This property can be modified only when the job is not running.
0042      */
0043     Q_PROPERTY(bool updateModifiedDate READ updateModifiedDate WRITE setUpdateModifiedDate)
0044 
0045     /**
0046      * Whether to update the view date after successfully updating the file.
0047      *
0048      * Default value is true.
0049      *
0050      * This property can be modified only when the job is not running.
0051      */
0052     Q_PROPERTY(bool updateViewedDate READ updateViewedDate WRITE setUpdateViewedDate)
0053 
0054 public:
0055     explicit FileResumableModifyJob(const FilePtr &metadata, const AccountPtr &account, QObject *parent = nullptr);
0056 
0057     explicit FileResumableModifyJob(const QString &fileId, const AccountPtr &account, QObject *parent = nullptr);
0058     explicit FileResumableModifyJob(QIODevice *device, const FilePtr &metadata, const AccountPtr &account, QObject *parent = nullptr);
0059     explicit FileResumableModifyJob(QIODevice *device, const QString &fileId, const AccountPtr &account, QObject *parent = nullptr);
0060     ~FileResumableModifyJob() override;
0061 
0062     [[nodiscard]] bool createNewRevision() const;
0063     void setCreateNewRevision(bool createNewRevision);
0064 
0065     [[nodiscard]] bool updateModifiedDate() const;
0066     void setUpdateModifiedDate(bool updateModifiedDate);
0067 
0068     [[nodiscard]] bool updateViewedDate() const;
0069     void setUpdateViewedDate(bool updateViewedDate);
0070 
0071 protected:
0072     QUrl createUrl() override;
0073 
0074 private:
0075     class Private;
0076     QScopedPointer<Private> d;
0077     friend class Private;
0078 };
0079 
0080 } // namespace Drive
0081 
0082 } // namespace KGAPI2