File indexing completed on 2024-05-12 05:22:32
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 "createjob.h" 0012 #include "kgapitasks_export.h" 0013 0014 #include <QScopedPointer> 0015 0016 namespace KGAPI2 0017 { 0018 0019 /** 0020 * @brief A job to create one or more new tasks in Google Tasks 0021 * 0022 * @author Daniel Vrátil <dvratil@redhat.com> 0023 * @since 2.0 0024 */ 0025 class KGAPITASKS_EXPORT TaskCreateJob : public KGAPI2::CreateJob 0026 { 0027 Q_OBJECT 0028 0029 /** 0030 * @brief Specified ID of item that the newly created tasks will be 0031 * subtasks of 0032 * 0033 * By default this property is empty and all tasks are created in the top 0034 * level of their parent tasklist 0035 * 0036 * This property can only be modified when job is not running. 0037 * 0038 * @see setParentItem, parentItem 0039 */ 0040 Q_PROPERTY(QString parentItem READ parentItem WRITE setParentItem) 0041 0042 /** 0043 * @brief Previous sibling task identifier. If the task is created at the 0044 * first position among its siblings, this parameter is omitted. 0045 * 0046 * This property can only be modified when job is not running. 0047 * 0048 * @see setPrevious, previous 0049 */ 0050 Q_PROPERTY(QString previous READ previous WRITE setPrevious) 0051 0052 public: 0053 /** 0054 * @brief Constructs a job that will create given @p task in a tasklist 0055 * with id @p taskListId 0056 * 0057 * @param task Task to store 0058 * @param taskListId ID of tasklist to create the task in 0059 * @param account Account to authenticate the request 0060 * @param parent 0061 */ 0062 explicit TaskCreateJob(const TaskPtr &task, const QString &taskListId, const AccountPtr &account, QObject *parent = nullptr); 0063 0064 /** 0065 * @brief Constructs a job that will create given @p tasks in a tasklist 0066 * with id @p taskListId 0067 * 0068 * @param tasks Tasks to store 0069 * @param taskListId ID of tasklist to create the task in 0070 * @param account Account to authenticate the request 0071 * @param parent 0072 */ 0073 explicit TaskCreateJob(const TasksList &tasks, const QString &taskListId, const AccountPtr &account, QObject *parent = nullptr); 0074 0075 /** 0076 * @brief Destructor 0077 */ 0078 ~TaskCreateJob() override; 0079 0080 /** 0081 * @brief Sets ID of parent task to create new tasks in 0082 * 0083 * @param parentId 0084 */ 0085 void setParentItem(const QString &parentId); 0086 0087 /** 0088 * @brief Returns ID of task the new items will be stored as subtasks of 0089 */ 0090 QString parentItem() const; 0091 0092 /** 0093 * @brief Sets previous sibling task identifier. If the task is created at the 0094 * first position among its siblings, this parameter is omitted. 0095 * 0096 * @param previousId 0097 */ 0098 void setPrevious(const QString &previousId); 0099 0100 /** 0101 * @brief Previous sibling task identifier. If the task is created at the 0102 * first position among its siblings, this parameter is omitted. 0103 */ 0104 QString previous() const; 0105 0106 protected: 0107 void start() override; 0108 ObjectsList handleReplyWithItems(const QNetworkReply *reply, const QByteArray &rawData) override; 0109 0110 private: 0111 class Private; 0112 QScopedPointer<Private> const d; 0113 friend class Private; 0114 }; 0115 0116 } // namespace KGAPI2