Kgapi

taskcreatejob.h
1/*
2 * This file is part of LibKGAPI library
3 *
4 * SPDX-FileCopyrightText: 2013 Daniel Vrátil <dvratil@redhat.com>
5 *
6 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7 */
8
9#pragma once
10
11#include "createjob.h"
12#include "kgapitasks_export.h"
13
14#include <QScopedPointer>
15
16namespace KGAPI2
17{
18
19/**
20 * @brief A job to create one or more new tasks in Google Tasks
21 *
22 * @author Daniel Vrátil <dvratil@redhat.com>
23 * @since 2.0
24 */
25class KGAPITASKS_EXPORT TaskCreateJob : public KGAPI2::CreateJob
26{
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 */
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 */
51
52public:
53 /**
54 * @brief Constructs a job that will create given @p task in a tasklist
55 * with id @p taskListId
56 *
57 * @param task Task to store
58 * @param taskListId ID of tasklist to create the task in
59 * @param account Account to authenticate the request
60 * @param parent
61 */
62 explicit TaskCreateJob(const TaskPtr &task, const QString &taskListId, const AccountPtr &account, QObject *parent = nullptr);
63
64 /**
65 * @brief Constructs a job that will create given @p tasks in a tasklist
66 * with id @p taskListId
67 *
68 * @param tasks Tasks to store
69 * @param taskListId ID of tasklist to create the task in
70 * @param account Account to authenticate the request
71 * @param parent
72 */
73 explicit TaskCreateJob(const TasksList &tasks, const QString &taskListId, const AccountPtr &account, QObject *parent = nullptr);
74
75 /**
76 * @brief Destructor
77 */
78 ~TaskCreateJob() override;
79
80 /**
81 * @brief Sets ID of parent task to create new tasks in
82 *
83 * @param parentId
84 */
85 void setParentItem(const QString &parentId);
86
87 /**
88 * @brief Returns ID of task the new items will be stored as subtasks of
89 */
90 QString parentItem() const;
91
92 /**
93 * @brief Sets previous sibling task identifier. If the task is created at the
94 * first position among its siblings, this parameter is omitted.
95 *
96 * @param previousId
97 */
98 void setPrevious(const QString &previousId);
99
100 /**
101 * @brief Previous sibling task identifier. If the task is created at the
102 * first position among its siblings, this parameter is omitted.
103 */
104 QString previous() const;
105
106protected:
107 void start() override;
108 ObjectsList handleReplyWithItems(const QNetworkReply *reply, const QByteArray &rawData) override;
109
110private:
111 class Private;
112 QScopedPointer<Private> const d;
113 friend class Private;
114};
115
116} // namespace KGAPI2
Abstract superclass for all jobs that create new objects on the server.
Definition createjob.h:26
AccountPtr account() const
Returns account used to authenticate requests.
Definition job.cpp:436
void setParentItem(const QString &parentId)
Sets ID of parent task to create new tasks in.
ObjectsList handleReplyWithItems(const QNetworkReply *reply, const QByteArray &rawData) override
A reply handler that returns items parsed from @ rawData.
void start() override
This method is invoked when job is started.
QString parentItem
Specified ID of item that the newly created tasks will be subtasks of.
QString previous
Previous sibling task identifier.
TaskCreateJob(const TaskPtr &task, const QString &taskListId, const AccountPtr &account, QObject *parent=nullptr)
Constructs a job that will create given task in a tasklist with id taskListId.
void setPrevious(const QString &previousId)
Sets previous sibling task identifier.
A job to fetch a single map tile described by a StaticMapUrl.
Definition blog.h:16
QObject(QObject *parent)
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 31 2025 12:07:24 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.