File indexing completed on 2024-06-16 04:52:27
0001 /* 0002 Copyright (c) 2010 Grégory Oestreicher <greg@kamago.net> 0003 0004 This program is free software; you can redistribute it and/or modify 0005 it under the terms of the GNU General Public License as published by 0006 the Free Software Foundation; either version 2 of the License, or 0007 (at your option) any later version. 0008 0009 This program is distributed in the hope that it will be useful, 0010 but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0012 GNU General Public License for more details. 0013 0014 You should have received a copy of the GNU General Public License 0015 along with this program; if not, write to the Free Software 0016 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 0017 */ 0018 0019 #ifndef KDAV2_DAVCOLLECTIONMODIFYJOB_H 0020 #define KDAV2_DAVCOLLECTIONMODIFYJOB_H 0021 0022 #include "kpimkdav2_export.h" 0023 0024 #include "davjobbase.h" 0025 #include "davurl.h" 0026 0027 #include <QtCore/QList> 0028 #include <QtXml/QDomDocument> 0029 0030 #include <KCoreAddons/KJob> 0031 0032 namespace KDAV2 0033 { 0034 0035 /** 0036 * @short A job that modifies a DAV collection. 0037 * 0038 * This job is used to modify a property of a DAV collection 0039 * on the DAV server. 0040 */ 0041 class KPIMKDAV2_EXPORT DavCollectionModifyJob : public DavJobBase 0042 { 0043 Q_OBJECT 0044 0045 public: 0046 /** 0047 * Creates a new dav collection modify job. 0048 * 0049 * @param url The DAV url that identifies the collection. 0050 * @param parent The parent object. 0051 */ 0052 explicit DavCollectionModifyJob(const DavUrl &url, QObject *parent = nullptr); 0053 0054 /** 0055 * Sets the property that shall be modified by the job. 0056 * 0057 * @param property The name of the property. 0058 * @param value The value of the property. 0059 * @param ns The XML namespace that shall be used for the property name. 0060 */ 0061 void setProperty(const QString &property, const QString &value, const QString &ns = QString()); 0062 0063 /** 0064 * Sets the property that shall be removed by the job. 0065 * 0066 * @param property The name of the property. 0067 * @param ns The XML namespace that shall be used for the property name. 0068 */ 0069 void removeProperty(const QString &property, const QString &ns); 0070 0071 /** 0072 * Starts the job. 0073 */ 0074 void start() Q_DECL_OVERRIDE; 0075 0076 private Q_SLOTS: 0077 void davJobFinished(KJob *job); 0078 0079 private: 0080 DavUrl mUrl; 0081 QDomDocument mQuery; 0082 0083 QVector<QDomElement> mSetProperties; 0084 QVector<QDomElement> mRemoveProperties; 0085 }; 0086 0087 } 0088 0089 #endif