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 #include "davmanager.h" 0010 0011 #include <KIO/DavJob> 0012 0013 #include <QDomDocument> 0014 0015 using namespace OXA; 0016 0017 DavManager *DavManager::mSelf = nullptr; 0018 0019 DavManager::DavManager() = default; 0020 0021 DavManager::~DavManager() = default; 0022 0023 DavManager *DavManager::self() 0024 { 0025 if (!mSelf) { 0026 mSelf = new DavManager(); 0027 } 0028 0029 return mSelf; 0030 } 0031 0032 void DavManager::setBaseUrl(const QUrl &url) 0033 { 0034 mBaseUrl = url; 0035 } 0036 0037 QUrl DavManager::baseUrl() const 0038 { 0039 return mBaseUrl; 0040 } 0041 0042 KIO::DavJob *DavManager::createFindJob(const QString &path, const QDomDocument &document) const 0043 { 0044 QUrl url(mBaseUrl); 0045 url.setPath(path); 0046 0047 return KIO::davPropFind(url, document.toString(), QStringLiteral("0"), KIO::HideProgressInfo); 0048 } 0049 0050 KIO::DavJob *DavManager::createPatchJob(const QString &path, const QDomDocument &document) const 0051 { 0052 QUrl url(mBaseUrl); 0053 url.setPath(path); 0054 0055 return KIO::davPropPatch(url, document.toString(), KIO::HideProgressInfo); 0056 }