1 | /* |
2 | SPDX-FileCopyrightText: 2010 Tobias Koenig <tokoe@kde.org> |
3 | |
4 | SPDX-License-Identifier: LGPL-2.0-or-later |
5 | */ |
6 | |
7 | #ifndef KDAV_DAVITEMSLISTJOB_H |
8 | #define KDAV_DAVITEMSLISTJOB_H |
9 | |
10 | #include "kdav_export.h" |
11 | |
12 | #include "davitem.h" |
13 | #include "davjobbase.h" |
14 | |
15 | #include <memory> |
16 | |
17 | #include <QStringList> |
18 | |
19 | namespace KDAV |
20 | { |
21 | class EtagCache; |
22 | class DavUrl; |
23 | class DavItemsListJobPrivate; |
24 | |
25 | /** |
26 | * @class DavItemsListJob davitemslistjob.h <KDAV/DavItemsListJob> |
27 | * |
28 | * @short A job that lists all DAV items inside a DAV collection. |
29 | */ |
30 | class KDAV_EXPORT DavItemsListJob : public DavJobBase |
31 | { |
32 | Q_OBJECT |
33 | |
34 | public: |
35 | /** |
36 | * Creates a new DAV items list job. |
37 | * |
38 | * @param url The URL of the DAV collection. |
39 | * @param parent The parent object. |
40 | */ |
41 | DavItemsListJob(const DavUrl &url, const std::shared_ptr<EtagCache> &cache, QObject *parent = nullptr); |
42 | |
43 | ~DavItemsListJob() override; |
44 | |
45 | /** |
46 | * Limits the mime types of the items requested. |
47 | * |
48 | * If no mime type is given then all will be requested. |
49 | * |
50 | * @param types The list of mime types to include |
51 | */ |
52 | void setContentMimeTypes(const QStringList &types); |
53 | |
54 | /** |
55 | * Sets the start and end time to list items for. |
56 | * |
57 | * @param start The range start, in format "date with UTC time" |
58 | * @param end The range end, in format "date with UTC time" |
59 | */ |
60 | void setTimeRange(const QString &start, const QString &end); |
61 | |
62 | /** |
63 | * Starts the job. |
64 | */ |
65 | void start() override; |
66 | |
67 | /** |
68 | * Returns the list of items seen including identifier URL and ETag information. |
69 | */ |
70 | Q_REQUIRED_RESULT DavItem::List items() const; |
71 | |
72 | /** |
73 | * Returns the list of items that were changed on the server. |
74 | */ |
75 | Q_REQUIRED_RESULT DavItem::List changedItems() const; |
76 | |
77 | /** |
78 | * Returns the list of items URLs that were not seen in the backend. |
79 | * As this is based on the ETag cache this may contain dependent items. |
80 | */ |
81 | Q_REQUIRED_RESULT QStringList deletedItems() const; |
82 | |
83 | private: |
84 | Q_DECLARE_PRIVATE(DavItemsListJob) |
85 | }; |
86 | } |
87 | |
88 | #endif |
89 | |