File indexing completed on 2024-11-24 04:44:28
0001 /* 0002 This file is part of oxaccess. 0003 0004 SPDX-FileCopyrightText: 2009 Tobias Koenig <tokoe@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.0-or-later 0007 */ 0008 0009 #pragma once 0010 0011 #include <QUrl> 0012 0013 namespace KIO 0014 { 0015 class DavJob; 0016 } 0017 0018 class QDomDocument; 0019 0020 namespace OXA 0021 { 0022 /** 0023 * @short A class that manages DAV specific information. 0024 * 0025 * The DavManager stores the base url of the DAV service that 0026 * shall be accessed and provides factory methods for creating 0027 * DAV find and patch jobs. 0028 * 0029 * @author Tobias Koenig <tokoe@kde.org> 0030 */ 0031 class DavManager 0032 { 0033 public: 0034 /** 0035 * Destroys the DAV manager. 0036 */ 0037 ~DavManager(); 0038 0039 /** 0040 * Returns the global instance of the DAV manager. 0041 */ 0042 static DavManager *self(); 0043 0044 /** 0045 * Sets the base @p url the DAV manager should use. 0046 */ 0047 void setBaseUrl(const QUrl &url); 0048 0049 /** 0050 * Returns the base url the DAV manager uses. 0051 */ 0052 [[nodiscard]] QUrl baseUrl() const; 0053 0054 /** 0055 * Returns a new DAV find job. 0056 * 0057 * @param path The path that is appended to the base url. 0058 * @param document The request XML document. 0059 */ 0060 KIO::DavJob *createFindJob(const QString &path, const QDomDocument &document) const; 0061 0062 /** 0063 * Returns a new DAV patch job. 0064 * 0065 * @param path The path that is appended to the base url. 0066 * @param document The request XML document. 0067 */ 0068 KIO::DavJob *createPatchJob(const QString &path, const QDomDocument &document) const; 0069 0070 private: 0071 /** 0072 * Creates a new DAV manager. 0073 */ 0074 DavManager(); 0075 0076 QUrl mBaseUrl; 0077 static DavManager *mSelf; 0078 }; 0079 }