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_DAVMANAGER_P_H |
8 | #define KDAV_DAVMANAGER_P_H |
9 | |
10 | #include "enums.h" |
11 | |
12 | #include <QString> |
13 | |
14 | #include <memory> |
15 | |
16 | namespace KIO |
17 | { |
18 | class DavJob; |
19 | } |
20 | |
21 | class QUrl; |
22 | |
23 | /** CalDav/CardDav protocol implementation. */ |
24 | namespace KDAV |
25 | { |
26 | class DavProtocolBase; |
27 | |
28 | /** |
29 | * @short A factory class for handling DAV jobs. |
30 | * |
31 | * This class provides factory methods to create preconfigured |
32 | * low-level DAV jobs and has access to the global DAV protocol dialect |
33 | * objects which abstract the access to the various DAV protocol dialects. |
34 | */ |
35 | class DavManager |
36 | { |
37 | public: |
38 | /** |
39 | * Destroys the DAV manager. |
40 | */ |
41 | ~DavManager(); |
42 | |
43 | /** |
44 | * Returns the global instance of the DAV manager. |
45 | */ |
46 | static DavManager *self(); |
47 | |
48 | /** |
49 | * Returns a preconfigured DAV PROPFIND job. |
50 | * |
51 | * @param url The target URL of the job. |
52 | * @param document The query XML document. |
53 | * @param depth The Depth: value to send in the HTTP request |
54 | */ |
55 | KIO::DavJob *createPropFindJob(const QUrl &url, const QString &document, const QString &depth = QStringLiteral("1" )) const; |
56 | |
57 | /** |
58 | * Returns a preconfigured DAV REPORT job. |
59 | * |
60 | * @param url The target URL of the job. |
61 | * @param document The query XML document. |
62 | * @param depth The Depth: value to send in the HTTP request |
63 | */ |
64 | KIO::DavJob *createReportJob(const QUrl &url, const QString &document, const QString &depth = QStringLiteral("1" )) const; |
65 | |
66 | /** |
67 | * Returns a preconfigured DAV PROPPATCH job. |
68 | * |
69 | * @param url The target URL of the job. |
70 | * @param document The query XML document. |
71 | */ |
72 | KIO::DavJob *createPropPatchJob(const QUrl &url, const QString &document) const; |
73 | |
74 | /** |
75 | * Returns the DAV protocol dialect object for the given DAV @p protocol. |
76 | */ |
77 | static const DavProtocolBase *davProtocol(Protocol protocol); |
78 | |
79 | private: |
80 | /** |
81 | * Creates a new DAV manager. |
82 | */ |
83 | DavManager(); |
84 | |
85 | std::unique_ptr<DavProtocolBase> mProtocols[3]; |
86 | }; |
87 | } |
88 | |
89 | #endif |
90 | |