Libkdav2

davmanager.h
1/*
2 Copyright (c) 2010 Tobias Koenig <tokoe@kde.org>
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_DAVMANAGER_H
20#define KDAV2_DAVMANAGER_H
21
22#include "kpimkdav2_export.h"
23
24#include "enums.h"
25
26#include <QtCore/QMap>
27#include <QtCore/QString>
28
29
30class QUrl;
31
32class QDomDocument;
33class QWebdav;
35
36namespace KDAV2
37{
38
39class DavJob;
40class DavProtocolBase;
41
42/**
43 * @short A factory class for handling DAV jobs.
44 *
45 * This class provides factory methods to create preconfigured
46 * low-level DAV jobs and has access to the global DAV protocol dialect
47 * objects which abstract the access to the various DAV protocol dialects.
48 */
49class KPIMKDAV2_EXPORT DavManager
50{
51public:
52 /**
53 * Destroys the DAV manager.
54 */
56
57 /**
58 * Returns the global instance of the DAV manager.
59 */
60 static DavManager *self();
61
62 /**
63 * Returns a preconfigured DAV PROPFIND job.
64 *
65 * @param url The target url of the job.
66 * @param document The query XML document.
67 * @param depth The Depth: value to send in the HTTP request
68 */
69 DavJob *createPropFindJob(const QUrl &url, const QDomDocument &document, const QString &depth = QStringLiteral("1"));
70
71 /**
72 * Returns a preconfigured DAV GET job.
73 *
74 * @param url The target url of the job.
75 */
76 DavJob *createGetJob(const QUrl &url);
77
78 /**
79 * Returns a preconfigured DAV DELETE job.
80 *
81 * @param url The target url of the job.
82 */
83 DavJob *createDeleteJob(const QUrl &url);
84
85 /**
86 * Returns a preconfigured DAV PUT job with a If-None-Match header.
87 *
88 * @param data The data to PUT.
89 * @param url The target url of the job.
90 * @param contentType The content-type.
91 */
92 DavJob *createCreateJob(const QByteArray &data, const QUrl &url, const QByteArray &contentType);
93
94 /**
95 * Returns a preconfigured DAV PUT job with a If-Match header, that matches the @param etag.
96 *
97 * @param data The data to PUT.
98 * @param url The target url of the job.
99 * @param contentType The content-type.
100 * @param etag The etag of the entity to modify.
101 */
102 DavJob *createModifyJob(const QByteArray &data, const QUrl &url, const QByteArray &contentType, const QByteArray &etag);
103
104 /**
105 * Returns a preconfigured DAV REPORT job.
106 *
107 * @param url The target url of the job.
108 * @param document The query XML document.
109 * @param depth The Depth: value to send in the HTTP request
110 */
111 DavJob *createReportJob(const QUrl &url, const QDomDocument &document, const QString &depth = QStringLiteral("1"));
112
113 /**
114 * Returns a preconfigured DAV PROPPATCH job.
115 *
116 * @param url The target url of the job.
117 * @param document The query XML document.
118 */
119 DavJob *createPropPatchJob(const QUrl &url, const QDomDocument &document);
120
121 /**
122 * Returns a preconfigured DAV MKCOL job.
123 *
124 * @param url The url to MKCOL (may be empty).
125 */
126 DavJob *createMkColJob(const QUrl &url);
127
128 /**
129 * Returns a preconfigured extended CardDAV MKCOL job.
130 *
131 * @param url The url to MKCOL (may be empty).
132 * @param document The query of the extended MKCOL request
133 */
134 DavJob *createMkColJob(const QUrl &url, const QDomDocument &document);
135
136 /**
137 * Returns a preconfigured DAV MKCALENDAR job.
138 *
139 * @param url The url of the new calendar
140 * @param document The query of the MKCALENDAR request
141 */
142 DavJob *createMkCalendarJob(const QUrl &url, const QDomDocument &document);
143
144 /**
145 * Returns the DAV protocol dialect object for the given DAV @p protocol.
146 */
147 const DavProtocolBase *davProtocol(Protocol protocol);
148
149 /**
150 * Provides access to the internally used network access manager.
151 */
152 static QNetworkAccessManager *networkAccessManager();
153
154 /**
155 * Ignore all ssl errors.
156 *
157 * If you want to handle ssl errors yourself via the networkAccessManager, then set to false.
158 *
159 * Enabled by default.
160 */
161 void setIgnoreSslErrors(bool);
162
163private:
164 /**
165 * Creates a new DAV manager.
166 */
167 DavManager();
168
169 void setConnectionSettings(const QUrl &url);
170
171 /**
172 * Creates a new protocol.
173 */
174 bool createProtocol(Protocol protocol);
175
177 protocolsMap mProtocols;
178 static DavManager *mSelf;
179 QWebdav *mWebDav;
180 bool mIgnoreSslErrors;
181};
182
183}
184
185#endif
A factory class for handling DAV jobs.
Definition davmanager.h:50
Base class for various DAV groupware dialects.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:13:28 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.