Kgapi

taskcreatejob.h
1 /*
2  * This file is part of LibKGAPI library
3  *
4  * SPDX-FileCopyrightText: 2013 Daniel Vrátil <[email protected]>
5  *
6  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7  */
8 
9 #ifndef LIBKGAPI2_TASKCREATEJOB_H
10 #define LIBKGAPI2_TASKCREATEJOB_H
11 
12 #include "createjob.h"
13 #include "kgapitasks_export.h"
14 
15 #include <QScopedPointer>
16 
17 namespace KGAPI2 {
18 
19 /**
20  * @brief A job to create one or more new tasks in Google Tasks
21  *
22  * @author Daniel Vrátil <[email protected]>
23  * @since 2.0
24  */
25 class KGAPITASKS_EXPORT TaskCreateJob : public KGAPI2::CreateJob
26 {
27  Q_OBJECT
28 
29  /**
30  * @brief Specified ID of item that the newly created tasks will be
31  * subtasks of
32  *
33  * By default this property is empty and all tasks are created in the top
34  * level of their parent tasklist
35  *
36  * This property can only be modified when job is not running.
37  *
38  * @see setParentItem, parentItem
39  */
40  Q_PROPERTY(QString parentItem READ parentItem WRITE setParentItem)
41 
42  /**
43  * @brief Previous sibling task identifier. If the task is created at the
44  * first position among its siblings, this parameter is omitted.
45  *
46  * This property can only be modified when job is not running.
47  *
48  * @see setPrevious, previous
49  */
50  Q_PROPERTY(QString previous READ previous WRITE setPrevious)
51 
52  public:
53 
54  /**
55  * @brief Constructs a job that will create given @p task in a tasklist
56  * with id @p taskListId
57  *
58  * @param task Task to store
59  * @param taskListId ID of tasklist to create the task in
60  * @param account Account to authenticate the request
61  * @param parent
62  */
63  explicit TaskCreateJob(const TaskPtr& task, const QString &taskListId,
64  const AccountPtr &account, QObject* parent = nullptr);
65 
66  /**
67  * @brief Constructs a job that will create given @p tasks in a tasklist
68  * with id @p taskListId
69  *
70  * @param tasks Tasks to store
71  * @param taskListId ID of tasklist to create the task in
72  * @param account Account to authenticate the request
73  * @param parent
74  */
75  explicit TaskCreateJob(const TasksList& tasks, const QString &taskListId,
76  const AccountPtr &account, QObject* parent = nullptr);
77 
78  /**
79  * @brief Destructor
80  */
81  ~TaskCreateJob() override;
82 
83  /**
84  * @brief Sets ID of parent task to create new tasks in
85  *
86  * @param parentId
87  */
88  void setParentItem(const QString &parentId);
89 
90  /**
91  * @brief Returns ID of task the new items will be stored as subtasks of
92  */
93  QString parentItem() const;
94 
95  /**
96  * @brief Sets previous sibling task identifier. If the task is created at the
97  * first position among its siblings, this parameter is omitted.
98  *
99  * @param previousId
100  */
101  void setPrevious(const QString &previousId);
102 
103  /**
104  * @brief Previous sibling task identifier. If the task is created at the
105  * first position among its siblings, this parameter is omitted.
106  */
107  QString previous() const;
108 
109  protected:
110  void start() override;
111  ObjectsList handleReplyWithItems(const QNetworkReply *reply, const QByteArray& rawData) override;
112 
113  private:
114  class Private;
115  QScopedPointer<Private> const d;
116  friend class Private;
117 };
118 
119 } // namespace KGAPI2
120 
121 #endif // KGAPI2_TASKCREATEJOB_H
Abstract superclass for all jobs that create new objects on the server.
Definition: createjob.h:25
A job to fetch a single map tile described by a StaticMapUrl.
Definition: blog.h:16
A job to create one or more new tasks in Google Tasks.
Definition: taskcreatejob.h:25
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Mar 8 2021 23:10:41 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.