File indexing completed on 2024-04-21 03:53:52

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_DAVCOLLECTIONSFETCHJOB_H
0008 #define KDAV_DAVCOLLECTIONSFETCHJOB_H
0009 
0010 #include "kdav_export.h"
0011 
0012 #include "davcollection.h"
0013 #include "davjobbase.h"
0014 #include "davurl.h"
0015 
0016 namespace KDAV
0017 {
0018 class DavCollectionsFetchJobPrivate;
0019 
0020 /**
0021  * @class DavCollectionsFetchJob davcollectionsfetchjob.h <KDAV/DavCollectionsFetchJob>
0022  *
0023  * @short A job that fetches all DAV collection.
0024  *
0025  * This job is used to fetch all DAV collection that are available
0026  * under a certain DAV URL.
0027  */
0028 class KDAV_EXPORT DavCollectionsFetchJob : public DavJobBase
0029 {
0030     Q_OBJECT
0031 
0032 public:
0033     /**
0034      * Creates a new DAV collections fetch job.
0035      *
0036      * @param url The DAV URL of the DAV collection whose sub collections shall be fetched.
0037      * @param parent The parent object.
0038      */
0039     explicit DavCollectionsFetchJob(const DavUrl &url, QObject *parent = nullptr);
0040 
0041     /**
0042      * Starts the job.
0043      */
0044     void start() override;
0045 
0046     /**
0047      * Returns the list of fetched DAV collections.
0048      */
0049     Q_REQUIRED_RESULT DavCollection::List collections() const;
0050 
0051     /**
0052      * Return the DavUrl used by this job
0053      */
0054     Q_REQUIRED_RESULT DavUrl davUrl() const;
0055 
0056 Q_SIGNALS:
0057     /**
0058      * This signal is emitted every time a new collection has been discovered.
0059      *
0060      * @param collectionUrl The URL of the discovered collection
0061      * @param configuredUrl The URL given to the job
0062      */
0063     void collectionDiscovered(KDAV::Protocol protocol, const QString &collectionUrl, const QString &configuredUrl);
0064 
0065 private:
0066     Q_DECLARE_PRIVATE(DavCollectionsFetchJob)
0067 };
0068 }
0069 
0070 #endif