Kgapi

taskfetchjob.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 "fetchjob.h"
12#include "kgapitasks_export.h"
13
14#include <QScopedPointer>
15
16namespace KGAPI2
17{
18
19/**
20 * @brief A job to fetch all tasks from given tasklist in user's Google Tasks
21 * account.
22 *
23 * @author Daniel Vrátil <dvratil@redhat.com>
24 * @since 2.0
25 */
26class KGAPITASKS_EXPORT TaskFetchJob : public KGAPI2::FetchJob
27{
28 Q_OBJECT
29
30 /**
31 * @brief Whether to fetch deleted tasks as well
32 *
33 * When an tasks is deleted from tasklist, it's stored as a placeholder
34 * on Google server and can still be retrieved. Such task will have
35 * KGAPI2::Task::deleted set to @p true.
36 *
37 * By default, the job will fetch deleted tasks.
38 *
39 * This property does not have any effect when fetching a specific task and
40 * can be modified only when the job is not running.
41 *
42 * @see setFetchDeleted, fetchDeleted
43 */
44 Q_PROPERTY(bool fetchDeleted READ fetchDeleted WRITE setFetchDeleted)
45
46 /**
47 * @brief Whether to fetch completed tasks as well
48 *
49 * By default, the job will fetch completed tasks.
50 *
51 * This property does not have any effect when fetching a specific event and
52 * can be modified only when the job is not running.
53 *
54 * @see setFetchCompleted, fetchCompleted
55 */
56 Q_PROPERTY(bool fetchCompleted READ fetchCompleted WRITE setFetchCompleted)
57
58 /**
59 * @brief Timestamp to fetch only tasks modified since then
60 *
61 * When set, this job will only fetch tasks that have been modified since
62 * given timestamp.
63 *
64 * By default the timestamp is 0 and all tasks are fetched.
65 *
66 * This property does not have any effect when fetching a specific task and
67 * can be modified only when the job is not running.
68 *
69 * @see setFetchOnlyUpdated, fetchOnlyUpdated
70 */
71 Q_PROPERTY(quint64 fetchOnlyUpdated READ fetchOnlyUpdated WRITE setFetchOnlyUpdated)
72
73 /**
74 * @brief Timestamp of the newest completed task that will be fetched
75 *
76 * Only tasks that have been completed before or precisely at the time
77 * indicated by this property will be fetched.
78 *
79 * By default the timestamp is 0 and no limit is applied.
80 *
81 * This property does not have any effect when fetching a specific task and
82 * can be modified only when the job is not running.
83 *
84 * @see completedMax, setCompletedMax
85 */
86 Q_PROPERTY(quint64 completedMax READ completedMax WRITE setCompletedMax)
87
88 /**
89 * @brief Timestamp of the oldest completed task that will be fetched
90 *
91 * Only tasks that have been completed after or precisely at the time
92 * indicated by this property will be fetched.
93 *
94 * By default the timestamp is 0 and no limit is applied.
95 *
96 * This property does not have any effect when fetching a specific task and
97 * can be modified only when the job is not running.
98 *
99 * @see completedMin, setCompletedMin
100 */
101 Q_PROPERTY(quint64 completedMin READ completedMin WRITE setCompletedMin)
102
103 /**
104 * @brief Timestamp of the newest due task that will be fetched
105 *
106 * Only tasks that are due before or precisely at the time indicated by
107 * this property will be fetched.
108 *
109 * By default the timestamp is 0 and no limit is applied.
110 *
111 * This property does not have any effect when fetching a specific task and
112 * can be modified only when the job is not running.
113 *
114 * @see dueMax, setDueMax
115 */
116 Q_PROPERTY(quint64 dueMax READ dueMax WRITE setDueMax)
117
118 /**
119 * @brief Timestamp of the oldest due task that will be fetched
120 *
121 * Only tasks that are due after or precisely at the time indicated by
122 * this property will be fetched.
123 *
124 * By default the timestamp is 0 and no limit is applied.
125 *
126 * This property does not have any effect when fetching a specific task and
127 * can be modified only when the job is not running.
128 *
129 * @see dueMin, setDueMin
130 */
131 Q_PROPERTY(quint64 dueMin READ dueMin WRITE setDueMin)
132
133public:
134 /**
135 * @brief Constructs a job that will fetch all tasks from a tasklist with
136 * given @p taskListId
137 *
138 * Result of this job might not contain all tasks, depending on configured
139 * filters.
140 *
141 * @param taskListId ID of tasklist from which to fetch tasks
142 * @param account Account to authenticate the request
143 * @param parent
144 */
145 explicit TaskFetchJob(const QString &taskListId, const AccountPtr &account, QObject *parent = nullptr);
146
147 /**
148 * @brief Constructs a job that will fetch a task with given @p taskId
149 * from a tasklist with given @p taskListId
150 *
151 * Note that none of the properties fetchDeleted, fetchCompleted,
152 * fetchOnlyUpdated, completedMax, completedMin, dueMax or dueMin are applied
153 * in this case.
154 *
155 * @param taskId ID of task to fetch
156 * @param taskListId ID of tasklist in which the event is
157 * @param account Account to authenticate the request
158 * @param parent
159 */
160 explicit TaskFetchJob(const QString &taskId, const QString &taskListId, const AccountPtr &account, QObject *parent = nullptr);
161
162 /**
163 * @brief Destructor
164 */
165 ~TaskFetchJob() override;
166
167 /**
168 * @brief Sets whether to fetch should deleted tasks
169 *
170 * @param fetchDeleted
171 */
172 void setFetchDeleted(bool fetchDeleted = true);
173
174 /**
175 * @brief Returns whether to fetch will deleted tasks
176 */
177 bool fetchDeleted() const;
178
179 /**
180 * @brief Sets whether the job should fetch completed tasks
181 *
182 * @param fetchCompleted
183 */
184 void setFetchCompleted(bool fetchCompleted = true);
185
186 /**
187 * @brief Returns whether the job will fetch completed tasks
188 */
189 bool fetchCompleted() const;
190
191 /**
192 * @brief Sets the job to fetch only events modified since @p timestamp
193 *
194 * @param timestamp
195 */
196 void setFetchOnlyUpdated(quint64 timestamp);
197
198 /**
199 * @brief Returns whether the job will fetch only modified events
200 *
201 * @return 0 when all events will be fetched, a timestamp of since when the
202 * modified events will be fetched.
203 */
204 quint64 fetchOnlyUpdated();
205
206 /**
207 * @brief Sets timestamp of newest completed task that can be fetched.
208 *
209 * @param timestamp
210 */
211 void setCompletedMax(quint64 timestamp);
212
213 /**
214 * @brief Returns upper date limit for fetching completed tasks
215 */
216 quint64 completedMax() const;
217
218 /**
219 * @brief Sets timestamp of oldest completed task that can be fetched.
220 *
221 * @param timestamp
222 */
223 void setCompletedMin(quint64 timestamp);
224
225 /**
226 * @brief Returns bottom date limit for fetching completed tasks
227 */
228 quint64 completedMin() const;
229
230 /**
231 * @brief Sets timestamp of newest due task that can be fetched.
232 *
233 * @param timestamp
234 */
235 void setDueMax(quint64 timestamp);
236
237 /**
238 * @brief Returns upper date limit for fetching due tasks
239 */
240 quint64 dueMax() const;
241
242 /**
243 * @brief Sets timestamp of oldest due task that can be fetched.
244 *
245 * @param timestamp
246 */
247 void setDueMin(quint64 timestamp);
248
249 /**
250 * @brief Returns bottom date limit for fetching due tasks.
251 */
252 quint64 dueMin() const;
253
254protected:
255 /**
256 * @brief KGAPI2::Job::start implementation
257 */
258 void start() override;
259
260 /**
261 * @brief KGAPI2::FetchJob::handleReplyWithItems implementation
262 *
263 * @param reply
264 * @param rawData
265 */
266 ObjectsList handleReplyWithItems(const QNetworkReply *reply, const QByteArray &rawData) override;
267
268private:
269 class Private;
270 QScopedPointer<Private> const d;
271 friend class Private;
272};
273
274} // namespace KGAPI2
Abstract superclass for all jobs that fetch resources from Google.
Definition fetchjob.h:25
A job to fetch all tasks from given tasklist in user's Google Tasks account.
Q_SCRIPTABLE Q_NOREPLY void start()
A job to fetch a single map tile described by a StaticMapUrl.
Definition blog.h:16
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:36:14 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.