| 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 KDAV::DavItemsListJob |
| 27 | * \inheaderfile KDAV/DavItemsListJob |
| 28 | * \inmodule KDAV |
| 29 | * |
| 30 | * \brief A job that lists all DAV items inside a DAV collection. |
| 31 | */ |
| 32 | class KDAV_EXPORT DavItemsListJob : public DavJobBase |
| 33 | { |
| 34 | Q_OBJECT |
| 35 | |
| 36 | public: |
| 37 | /*! |
| 38 | * Creates a new DAV items list job. |
| 39 | * |
| 40 | * \a url The URL of the DAV collection. |
| 41 | * |
| 42 | * \a parent The parent object. |
| 43 | */ |
| 44 | DavItemsListJob(const DavUrl &url, const std::shared_ptr<EtagCache> &cache, QObject *parent = nullptr); |
| 45 | |
| 46 | ~DavItemsListJob() override; |
| 47 | |
| 48 | /*! |
| 49 | * Limits the mime types of the items requested. |
| 50 | * |
| 51 | * If no mime type is given then all will be requested. |
| 52 | * |
| 53 | * \a types The list of mime types to include |
| 54 | */ |
| 55 | void setContentMimeTypes(const QStringList &types); |
| 56 | |
| 57 | /*! |
| 58 | * Sets the start and end time to list items for. |
| 59 | * |
| 60 | * \a start The range start, in format "date with UTC time" |
| 61 | * |
| 62 | * \a end The range end, in format "date with UTC time" |
| 63 | */ |
| 64 | void setTimeRange(const QString &start, const QString &end); |
| 65 | |
| 66 | /*! |
| 67 | * Starts the job. |
| 68 | */ |
| 69 | void start() override; |
| 70 | |
| 71 | /*! |
| 72 | * Returns the list of items seen including identifier URL and ETag information. |
| 73 | */ |
| 74 | Q_REQUIRED_RESULT DavItem::List items() const; |
| 75 | |
| 76 | /*! |
| 77 | * Returns the list of items that were changed on the server. |
| 78 | */ |
| 79 | Q_REQUIRED_RESULT DavItem::List changedItems() const; |
| 80 | |
| 81 | /*! |
| 82 | * Returns the list of items URLs that were not seen in the backend. |
| 83 | * As this is based on the ETag cache this may contain dependent items. |
| 84 | */ |
| 85 | Q_REQUIRED_RESULT QStringList deletedItems() const; |
| 86 | |
| 87 | private: |
| 88 | Q_DECLARE_PRIVATE(DavItemsListJob) |
| 89 | }; |
| 90 | } |
| 91 | |
| 92 | #endif |
| 93 | |