| 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_DAVCOLLECTIONSMULTIFETCHJOB_H |
| 8 | #define KDAV_DAVCOLLECTIONSMULTIFETCHJOB_H |
| 9 | |
| 10 | #include "kdav_export.h" |
| 11 | |
| 12 | #include "davcollection.h" |
| 13 | #include "davurl.h" |
| 14 | |
| 15 | #include <KCompositeJob> |
| 16 | |
| 17 | #include <memory> |
| 18 | |
| 19 | namespace KDAV |
| 20 | { |
| 21 | class DavCollectionsMultiFetchJobPrivate; |
| 22 | |
| 23 | /*! |
| 24 | * \class KDAV::DavCollectionsMultiFetchJob |
| 25 | * \inheaderfile KDAV/DavCollectionsMultiFetchJob |
| 26 | * \inmodule KDAV |
| 27 | * |
| 28 | * \brief A job that fetches all DAV collection. |
| 29 | * |
| 30 | * This job is used to fetch all DAV collection that are available |
| 31 | * under a certain list of DAV URLs. |
| 32 | * |
| 33 | * \note This class just combines multiple calls of DavCollectionsFetchJob |
| 34 | * into one job. |
| 35 | */ |
| 36 | class KDAV_EXPORT DavCollectionsMultiFetchJob : public KCompositeJob |
| 37 | { |
| 38 | Q_OBJECT |
| 39 | |
| 40 | public: |
| 41 | /*! |
| 42 | * Creates a new DAV collections multi fetch job. |
| 43 | * |
| 44 | * \a urls The list of DAV URLs whose sub collections shall be fetched. |
| 45 | * |
| 46 | * \a parent The parent object. |
| 47 | */ |
| 48 | explicit DavCollectionsMultiFetchJob(const DavUrl::List &urls, QObject *parent = nullptr); |
| 49 | ~DavCollectionsMultiFetchJob() override; |
| 50 | |
| 51 | /*! |
| 52 | * Starts the job. |
| 53 | */ |
| 54 | void start() override; |
| 55 | |
| 56 | /*! |
| 57 | * Returns the list of fetched DAV collections. |
| 58 | */ |
| 59 | Q_REQUIRED_RESULT DavCollection::List collections() const; |
| 60 | |
| 61 | Q_SIGNALS: |
| 62 | /*! |
| 63 | * This signal is emitted every time a new collection has been discovered. |
| 64 | * |
| 65 | * \a collectionUrl The URL of the discovered collection |
| 66 | * |
| 67 | * \a configuredUrl The URL given to the job |
| 68 | */ |
| 69 | void collectionDiscovered(KDAV::Protocol protocol, const QString &collectionUrl, const QString &configuredUrl); |
| 70 | |
| 71 | private: |
| 72 | void slotResult(KJob *) override; |
| 73 | |
| 74 | const std::unique_ptr<DavCollectionsMultiFetchJobPrivate> d; |
| 75 | }; |
| 76 | } |
| 77 | |
| 78 | #endif |
| 79 | |