Libkdav2

davcollectionsfetchjob.h
1 /*
2  Copyright (c) 2010 Tobias Koenig <[email protected]>
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18 
19 #ifndef KDAV2_DAVCOLLECTIONSFETCHJOB_H
20 #define KDAV2_DAVCOLLECTIONSFETCHJOB_H
21 
22 #include "kpimkdav2_export.h"
23 
24 #include "davcollection.h"
25 #include "davjobbase.h"
26 #include "davurl.h"
27 
28 #include <KCoreAddons/KJob>
29 
30 namespace KDAV2
31 {
32 
33 /**
34  * @short A job that fetches all DAV collection.
35  *
36  * This job is used to fetch all DAV collection that are available
37  * under a certain DAV url.
38  */
39 class KPIMKDAV2_EXPORT DavCollectionsFetchJob : public DavJobBase
40 {
41  Q_OBJECT
42 
43 public:
44  /**
45  * Creates a new dav collections fetch job.
46  *
47  * @param url The DAV url of the DAV collection whose sub collections shall be fetched.
48  * @param parent The parent object.
49  */
50  explicit DavCollectionsFetchJob(const DavUrl &url, QObject *parent = nullptr);
51 
52  /**
53  * Starts the job.
54  */
55  void start() Q_DECL_OVERRIDE;
56 
57  /**
58  * Returns the list of fetched DAV collections.
59  */
60  DavCollection::List collections() const;
61 
62  /**
63  * Return the DavUrl used by this job
64  */
65  DavUrl davUrl() const;
66 
67 Q_SIGNALS:
68  /**
69  * This signal is emitted every time a new collection has been discovered.
70  *
71  * @param collectionUrl The URL of the discovered collection
72  * @param configuredUrl The URL given to the job
73  */
74  void collectionDiscovered(int protocol, const QString &collectionUrl, const QString &configuredUrl);
75 
76 private Q_SLOTS:
77  void principalFetchFinished(KJob *);
78  void collectionsFetchFinished(KJob *);
79  void individualCollectionRefreshed(KJob *);
80 
81 private:
82  void doCollectionsFetch(const QUrl &url);
83  void refreshIndividualCollection(const DavCollection &);
84  void subjobFinished();
85 
86  DavUrl mUrl;
87  DavCollection::List mCollections;
88  uint mSubJobCount;
89 };
90 
91 }
92 
93 #endif
A helper class to combine url and protocol of a DAV url.
Definition: davurl.h:35
Q_SCRIPTABLE Q_NOREPLY void start()
A helper class to store information about DAV collection.
Definition: davcollection.h:49
base class for the jobs used by the resource.
Definition: davjobbase.h:37
A job that fetches all DAV collection.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Wed Aug 10 2022 04:09:53 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.