File indexing completed on 2024-04-21 03:53:53
0001 /* 0002 SPDX-FileCopyrightText: 2010 Tobias Koenig <tokoe@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef KDAV_DAVMANAGER_P_H 0008 #define KDAV_DAVMANAGER_P_H 0009 0010 #include "enums.h" 0011 0012 #include <QString> 0013 0014 #include <memory> 0015 0016 namespace KIO 0017 { 0018 class DavJob; 0019 } 0020 0021 class QUrl; 0022 0023 /** CalDav/CardDav protocol implementation. */ 0024 namespace KDAV 0025 { 0026 class DavProtocolBase; 0027 0028 /** 0029 * @short A factory class for handling DAV jobs. 0030 * 0031 * This class provides factory methods to create preconfigured 0032 * low-level DAV jobs and has access to the global DAV protocol dialect 0033 * objects which abstract the access to the various DAV protocol dialects. 0034 */ 0035 class DavManager 0036 { 0037 public: 0038 /** 0039 * Destroys the DAV manager. 0040 */ 0041 ~DavManager(); 0042 0043 /** 0044 * Returns the global instance of the DAV manager. 0045 */ 0046 static DavManager *self(); 0047 0048 /** 0049 * Returns a preconfigured DAV PROPFIND job. 0050 * 0051 * @param url The target URL of the job. 0052 * @param document The query XML document. 0053 * @param depth The Depth: value to send in the HTTP request 0054 */ 0055 KIO::DavJob *createPropFindJob(const QUrl &url, const QString &document, const QString &depth = QStringLiteral("1")) const; 0056 0057 /** 0058 * Returns a preconfigured DAV REPORT job. 0059 * 0060 * @param url The target URL of the job. 0061 * @param document The query XML document. 0062 * @param depth The Depth: value to send in the HTTP request 0063 */ 0064 KIO::DavJob *createReportJob(const QUrl &url, const QString &document, const QString &depth = QStringLiteral("1")) const; 0065 0066 /** 0067 * Returns a preconfigured DAV PROPPATCH job. 0068 * 0069 * @param url The target URL of the job. 0070 * @param document The query XML document. 0071 */ 0072 KIO::DavJob *createPropPatchJob(const QUrl &url, const QString &document) const; 0073 0074 /** 0075 * Returns the DAV protocol dialect object for the given DAV @p protocol. 0076 */ 0077 static const DavProtocolBase *davProtocol(Protocol protocol); 0078 0079 private: 0080 /** 0081 * Creates a new DAV manager. 0082 */ 0083 DavManager(); 0084 0085 std::unique_ptr<DavProtocolBase> mProtocols[3]; 0086 }; 0087 } 0088 0089 #endif