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