File indexing completed on 2023-09-24 04:08:29
0001 // -*- c++ -*- 0002 /* 0003 This file is part of the KDE libraries 0004 SPDX-FileCopyrightText: 2002 Jan-Pascal van Best <janpascal@vanbest.org> 0005 0006 SPDX-License-Identifier: LGPL-2.0-or-later 0007 */ 0008 0009 #ifndef KIO_DAVJOB_H 0010 #define KIO_DAVJOB_H 0011 0012 #include "global.h" 0013 #include "kiocore_export.h" 0014 #include "transferjob.h" 0015 0016 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 86) 0017 #include <QDomDocument> 0018 #endif 0019 #include <QObject> 0020 #include <QPointer> 0021 #include <QString> 0022 #include <QStringList> 0023 0024 #include <sys/stat.h> 0025 #include <sys/types.h> 0026 0027 namespace KIO 0028 { 0029 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 101) 0030 // unused forward declaration 0031 class Slave; 0032 #endif 0033 0034 class DavJobPrivate; 0035 /** 0036 * @class KIO::DavJob davjob.h <KIO/DavJob> 0037 * 0038 * The transfer job pumps data into and/or out of a KIO worker. 0039 * Data is sent to the worker on request of the worker ( dataReq). 0040 * If data coming from the worker can not be handled, the 0041 * reading of data from the worker should be suspended. 0042 * @see KIO::davPropFind() 0043 * @see KIO::davPropPatch() 0044 * @see KIO::davSearch() 0045 */ 0046 class KIOCORE_EXPORT DavJob : public TransferJob 0047 { 0048 Q_OBJECT 0049 public: 0050 /** 0051 * Returns the reponse data. 0052 * @since 5.86 0053 */ 0054 QByteArray responseData() const; 0055 0056 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 86) 0057 /** 0058 * Returns the response as a QDomDocument. 0059 * @return the response document 0060 * @deprecated Since 5.86. Use QDomDocument::setContent(job->responseData()) if you need 0061 * a QDomDocument of the resonse, but be aware that you need to handle the case that 0062 * responseData() doesn't return valid XML if that is a relevant error scenario for you 0063 * (response() does wrap such data into a DAV error XML structure). 0064 */ 0065 KIOCORE_DEPRECATED_VERSION(5, 86, "Use responseData() instead.") 0066 QDomDocument &response(); 0067 #endif 0068 0069 protected Q_SLOTS: 0070 void slotFinished() override; 0071 void slotData(const QByteArray &data) override; 0072 0073 protected: 0074 KIOCORE_NO_EXPORT DavJob(DavJobPrivate &dd, int, const QString &); 0075 0076 private: 0077 Q_DECLARE_PRIVATE(DavJob) 0078 }; 0079 0080 /** 0081 * Creates a new DavJob that issues a PROPFIND command. PROPFIND retrieves 0082 * the properties of the resource identified by the given @p url. 0083 * 0084 * @param url the URL of the resource 0085 * @param properties a propfind document that describes the properties that 0086 * should be retrieved 0087 * @param depth the depth of the request. Can be "0", "1" or "infinity" 0088 * @param flags We support HideProgressInfo here 0089 * @return the new DavJob 0090 * @since 5.84 0091 */ 0092 KIOCORE_EXPORT DavJob *davPropFind(const QUrl &url, const QString &properties, const QString &depth, JobFlags flags = DefaultFlags); 0093 0094 /** 0095 * Creates a new DavJob that issues a PROPPATCH command. PROPPATCH sets 0096 * the properties of the resource identified by the given @p url. 0097 * 0098 * @param url the URL of the resource 0099 * @param properties a PROPPACTCH document that describes the properties that 0100 * should be modified and its new values 0101 * @param flags We support HideProgressInfo here 0102 * @return the new DavJob 0103 * @since 5.84 0104 */ 0105 KIOCORE_EXPORT DavJob *davPropPatch(const QUrl &url, const QString &properties, JobFlags flags = DefaultFlags); 0106 0107 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 84) 0108 /** 0109 * Creates a new DavJob that issues a PROPFIND command. PROPFIND retrieves 0110 * the properties of the resource identified by the given @p url. 0111 * 0112 * @param url the URL of the resource 0113 * @param properties a propfind document that describes the properties that 0114 * should be retrieved 0115 * @param depth the depth of the request. Can be "0", "1" or "infinity" 0116 * @param flags We support HideProgressInfo here 0117 * @return the new DavJob 0118 * @deprecated since 5.84, use the overload taking a @c QString @p properties argument instead. 0119 * This can typically be done by replacing the properties argument with <tt>properties.toString()</tt>. 0120 */ 0121 KIOCORE_EXPORT 0122 KIOCORE_DEPRECATED_VERSION(5, 84, "Use davPropFind(const QUrl &, const QString &, const QString &, JobFlags) instead.") 0123 DavJob *davPropFind(const QUrl &url, const QDomDocument &properties, const QString &depth, JobFlags flags = DefaultFlags); 0124 #endif 0125 0126 #if KIOCORE_ENABLE_DEPRECATED_SINCE(5, 84) 0127 /** 0128 * Creates a new DavJob that issues a PROPPATCH command. PROPPATCH sets 0129 * the properties of the resource identified by the given @p url. 0130 * 0131 * @param url the URL of the resource 0132 * @param properties a PROPPACTCH document that describes the properties that 0133 * should be modified and its new values 0134 * @param flags We support HideProgressInfo here 0135 * @return the new DavJob 0136 * @deprecated since 5.84, use the overload taking a @c QString @p properties argument instead. 0137 * This can typically be done by replacing the properties argument with <tt>properties.toString()</tt>. 0138 */ 0139 KIOCORE_EXPORT 0140 KIOCORE_DEPRECATED_VERSION(5, 84, "Use davPropPatch(const QUrl &, const QString &, JobFlags) instead.") 0141 DavJob *davPropPatch(const QUrl &url, const QDomDocument &properties, JobFlags flags = DefaultFlags); 0142 #endif 0143 0144 /** 0145 * Creates a new DavJob that issues a SEARCH command. 0146 * 0147 * @param url the URL of the resource 0148 * @param nsURI the URI of the search method's qualified name 0149 * @param qName the local part of the search method's qualified name 0150 * @param query the search string 0151 * @param flags We support HideProgressInfo here 0152 * @return the new DavJob 0153 */ 0154 KIOCORE_EXPORT DavJob *davSearch(const QUrl &url, const QString &nsURI, const QString &qName, const QString &query, JobFlags flags = DefaultFlags); 0155 0156 /** 0157 * Creates a new DavJob that issues a REPORT command. 0158 * 0159 * @param url the URL of the resource 0160 * @param report a REPORT document that describes the request to make 0161 * @param depth the depth of the request. Can be "0", "1" or "infinity" 0162 * @param flags We support HideProgressInfo here 0163 * @return the new DavJob 0164 * @since 4.4 0165 */ 0166 KIOCORE_EXPORT DavJob *davReport(const QUrl &url, const QString &report, const QString &depth, JobFlags flags = DefaultFlags); 0167 0168 } 0169 0170 #endif