File indexing completed on 2024-04-28 03:53:55

0001 /*
0002     SPDX-FileCopyrightText: 2010 Tobias Koenig <tokoe@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef KDAV_DAVITEMSLISTJOB_H
0008 #define KDAV_DAVITEMSLISTJOB_H
0009 
0010 #include "kdav_export.h"
0011 
0012 #include "davitem.h"
0013 #include "davjobbase.h"
0014 
0015 #include <memory>
0016 
0017 #include <QStringList>
0018 
0019 namespace KDAV
0020 {
0021 class EtagCache;
0022 class DavUrl;
0023 class DavItemsListJobPrivate;
0024 
0025 /**
0026  * @class DavItemsListJob davitemslistjob.h <KDAV/DavItemsListJob>
0027  *
0028  * @short A job that lists all DAV items inside a DAV collection.
0029  */
0030 class KDAV_EXPORT DavItemsListJob : public DavJobBase
0031 {
0032     Q_OBJECT
0033 
0034 public:
0035     /**
0036      * Creates a new DAV items list job.
0037      *
0038      * @param url The URL of the DAV collection.
0039      * @param parent The parent object.
0040      */
0041     DavItemsListJob(const DavUrl &url, const std::shared_ptr<EtagCache> &cache, QObject *parent = nullptr);
0042 
0043     ~DavItemsListJob() override;
0044 
0045     /**
0046      * Limits the mime types of the items requested.
0047      *
0048      * If no mime type is given then all will be requested.
0049      *
0050      * @param types The list of mime types to include
0051      */
0052     void setContentMimeTypes(const QStringList &types);
0053 
0054     /**
0055      * Sets the start and end time to list items for.
0056      *
0057      * @param start The range start, in format "date with UTC time"
0058      * @param end The range end, in format "date with UTC time"
0059      */
0060     void setTimeRange(const QString &start, const QString &end);
0061 
0062     /**
0063      * Starts the job.
0064      */
0065     void start() override;
0066 
0067     /**
0068      * Returns the list of items seen including identifier URL and ETag information.
0069      */
0070     Q_REQUIRED_RESULT DavItem::List items() const;
0071 
0072     /**
0073      * Returns the list of items that were changed on the server.
0074      */
0075     Q_REQUIRED_RESULT DavItem::List changedItems() const;
0076 
0077     /**
0078      * Returns the list of items URLs that were not seen in the backend.
0079      * As this is based on the ETag cache this may contain dependent items.
0080      */
0081     Q_REQUIRED_RESULT QStringList deletedItems() const;
0082 
0083 private:
0084     Q_DECLARE_PRIVATE(DavItemsListJob)
0085 };
0086 }
0087 
0088 #endif