KIO

davjob.h
1 // -*- c++ -*-
2 /*
3  This file is part of the KDE libraries
4  SPDX-FileCopyrightText: 2002 Jan-Pascal van Best <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8 
9 #ifndef KIO_DAVJOB_H
10 #define KIO_DAVJOB_H
11 
12 #include "global.h"
13 #include "kiocore_export.h"
14 #include "transferjob.h"
15 
16 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 86)
17 #include <QDomDocument>
18 #endif
19 #include <QObject>
20 #include <QPointer>
21 #include <QString>
22 #include <QStringList>
23 
24 #include <sys/stat.h>
25 #include <sys/types.h>
26 
27 namespace KIO
28 {
29 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 101)
30 // unused forward declaration
31 class Slave;
32 #endif
33 
34 class DavJobPrivate;
35 /**
36  * @class KIO::DavJob davjob.h <KIO/DavJob>
37  *
38  * The transfer job pumps data into and/or out of a KIO worker.
39  * Data is sent to the worker on request of the worker ( dataReq).
40  * If data coming from the worker can not be handled, the
41  * reading of data from the worker should be suspended.
42  * @see KIO::davPropFind()
43  * @see KIO::davPropPatch()
44  * @see KIO::davSearch()
45  */
46 class KIOCORE_EXPORT DavJob : public TransferJob
47 {
48  Q_OBJECT
49 public:
50  /**
51  * Returns the reponse data.
52  * @since 5.86
53  */
54  QByteArray responseData() const;
55 
56 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 86)
57  /**
58  * Returns the response as a QDomDocument.
59  * @return the response document
60  * @deprecated Since 5.86. Use QDomDocument::setContent(job->responseData()) if you need
61  * a QDomDocument of the resonse, but be aware that you need to handle the case that
62  * responseData() doesn't return valid XML if that is a relevant error scenario for you
63  * (response() does wrap such data into a DAV error XML structure).
64  */
65  KIOCORE_DEPRECATED_VERSION(5, 86, "Use responseData() instead.")
66  QDomDocument &response();
67 #endif
68 
69 protected Q_SLOTS:
70  void slotFinished() override;
71  void slotData(const QByteArray &data) override;
72 
73 protected:
74  KIOCORE_NO_EXPORT DavJob(DavJobPrivate &dd, int, const QString &);
75 
76 private:
77  Q_DECLARE_PRIVATE(DavJob)
78 };
79 
80 /**
81  * Creates a new DavJob that issues a PROPFIND command. PROPFIND retrieves
82  * the properties of the resource identified by the given @p url.
83  *
84  * @param url the URL of the resource
85  * @param properties a propfind document that describes the properties that
86  * should be retrieved
87  * @param depth the depth of the request. Can be "0", "1" or "infinity"
88  * @param flags We support HideProgressInfo here
89  * @return the new DavJob
90  * @since 5.84
91  */
92 KIOCORE_EXPORT DavJob *davPropFind(const QUrl &url, const QString &properties, const QString &depth, JobFlags flags = DefaultFlags);
93 
94 /**
95  * Creates a new DavJob that issues a PROPPATCH command. PROPPATCH sets
96  * the properties of the resource identified by the given @p url.
97  *
98  * @param url the URL of the resource
99  * @param properties a PROPPACTCH document that describes the properties that
100  * should be modified and its new values
101  * @param flags We support HideProgressInfo here
102  * @return the new DavJob
103  * @since 5.84
104  */
105 KIOCORE_EXPORT DavJob *davPropPatch(const QUrl &url, const QString &properties, JobFlags flags = DefaultFlags);
106 
107 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 84)
108 /**
109  * Creates a new DavJob that issues a PROPFIND command. PROPFIND retrieves
110  * the properties of the resource identified by the given @p url.
111  *
112  * @param url the URL of the resource
113  * @param properties a propfind document that describes the properties that
114  * should be retrieved
115  * @param depth the depth of the request. Can be "0", "1" or "infinity"
116  * @param flags We support HideProgressInfo here
117  * @return the new DavJob
118  * @deprecated since 5.84, use the overload taking a @c QString @p properties argument instead.
119  * This can typically be done by replacing the properties argument with <tt>properties.toString()</tt>.
120  */
121 KIOCORE_EXPORT
122 KIOCORE_DEPRECATED_VERSION(5, 84, "Use davPropFind(const QUrl &, const QString &, const QString &, JobFlags) instead.")
123 DavJob *davPropFind(const QUrl &url, const QDomDocument &properties, const QString &depth, JobFlags flags = DefaultFlags);
124 #endif
125 
126 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 84)
127 /**
128  * Creates a new DavJob that issues a PROPPATCH command. PROPPATCH sets
129  * the properties of the resource identified by the given @p url.
130  *
131  * @param url the URL of the resource
132  * @param properties a PROPPACTCH document that describes the properties that
133  * should be modified and its new values
134  * @param flags We support HideProgressInfo here
135  * @return the new DavJob
136  * @deprecated since 5.84, use the overload taking a @c QString @p properties argument instead.
137  * This can typically be done by replacing the properties argument with <tt>properties.toString()</tt>.
138  */
139 KIOCORE_EXPORT
140 KIOCORE_DEPRECATED_VERSION(5, 84, "Use davPropPatch(const QUrl &, const QString &, JobFlags) instead.")
141 DavJob *davPropPatch(const QUrl &url, const QDomDocument &properties, JobFlags flags = DefaultFlags);
142 #endif
143 
144 /**
145  * Creates a new DavJob that issues a SEARCH command.
146  *
147  * @param url the URL of the resource
148  * @param nsURI the URI of the search method's qualified name
149  * @param qName the local part of the search method's qualified name
150  * @param query the search string
151  * @param flags We support HideProgressInfo here
152  * @return the new DavJob
153  */
154 KIOCORE_EXPORT DavJob *davSearch(const QUrl &url, const QString &nsURI, const QString &qName, const QString &query, JobFlags flags = DefaultFlags);
155 
156 /**
157  * Creates a new DavJob that issues a REPORT command.
158  *
159  * @param url the URL of the resource
160  * @param report a REPORT document that describes the request to make
161  * @param depth the depth of the request. Can be "0", "1" or "infinity"
162  * @param flags We support HideProgressInfo here
163  * @return the new DavJob
164  * @since 4.4
165  */
166 KIOCORE_EXPORT DavJob *davReport(const QUrl &url, const QString &report, const QString &depth, JobFlags flags = DefaultFlags);
167 
168 }
169 
170 #endif
KIOCORE_EXPORT DavJob * davSearch(const QUrl &url, const QString &nsURI, const QString &qName, const QString &query, JobFlags flags=DefaultFlags)
Creates a new DavJob that issues a SEARCH command.
Definition: davjob.cpp:157
@ DefaultFlags
Show the progress info GUI, no Resume and no Overwrite.
Definition: job_base.h:270
KIOCORE_EXPORT DavJob * davReport(const QUrl &url, const QString &report, const QString &depth, JobFlags flags=DefaultFlags)
Creates a new DavJob that issues a REPORT command.
Definition: davjob.cpp:169
KIOCORE_EXPORT DavJob * davPropFind(const QUrl &url, const QString &properties, const QString &depth, JobFlags flags=DefaultFlags)
Creates a new DavJob that issues a PROPFIND command.
Definition: davjob.cpp:131
A namespace for KIO globals.
KIOCORE_EXPORT DavJob * davPropPatch(const QUrl &url, const QString &properties, JobFlags flags=DefaultFlags)
Creates a new DavJob that issues a PROPPATCH command.
Definition: davjob.cpp:138
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon May 8 2023 03:54:42 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.