1 /*
2     This file is part of oxaccess.
3 
4     SPDX-FileCopyrightText: 2009 Tobias Koenig <tokoe@kde.org>
5 
6     SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8 
9 #pragma once
10 
11 #include <QUrl>
12 
13 namespace KIO
14 {
15 class DavJob;
16 }
17 
18 class QDomDocument;
19 
20 namespace OXA
21 {
22 /**
23  * @short A class that manages DAV specific information.
24  *
25  * The DavManager stores the base url of the DAV service that
26  * shall be accessed and provides factory methods for creating
27  * DAV find and patch jobs.
28  *
29  * @author Tobias Koenig <tokoe@kde.org>
30  */
31 class DavManager
32 {
33 public:
34     /**
35      * Destroys the DAV manager.
36      */
37     ~DavManager();
38 
39     /**
40      * Returns the global instance of the DAV manager.
41      */
42     static DavManager *self();
43 
44     /**
45      * Sets the base @p url the DAV manager should use.
46      */
47     void setBaseUrl(const QUrl &url);
48 
49     /**
50      * Returns the base url the DAV manager uses.
51      */
52     QUrl baseUrl() const;
53 
54     /**
55      * Returns a new DAV find job.
56      *
57      * @param path The path that is appended to the base url.
58      * @param document The request XML document.
59      */
60     KIO::DavJob *createFindJob(const QString &path, const QDomDocument &document) const;
61 
62     /**
63      * Returns a new DAV patch job.
64      *
65      * @param path The path that is appended to the base url.
66      * @param document The request XML document.
67      */
68     KIO::DavJob *createPatchJob(const QString &path, const QDomDocument &document) const;
69 
70 private:
71     /**
72      * Creates a new DAV manager.
73      */
74     DavManager();
75 
76     QUrl mBaseUrl;
77     static DavManager *mSelf;
78 };
79 }
80 
81