File indexing completed on 2024-11-17 04:44:00

0001 /*
0002     Copyright (c) 2010 Grégory Oestreicher <greg@kamago.net>
0003     Copyright (c) 2018 Rémi Nicole <minijackson@riseup.net>
0004 
0005     This program is free software; you can redistribute it and/or modify
0006     it under the terms of the GNU General Public License as published by
0007     the Free Software Foundation; either version 2 of the License, or
0008     (at your option) any later version.
0009 
0010     This program is distributed in the hope that it will be useful,
0011     but WITHOUT ANY WARRANTY; without even the implied warranty of
0012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0013     GNU General Public License for more details.
0014 
0015     You should have received a copy of the GNU General Public License
0016     along with this program; if not, write to the Free Software
0017     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0018 */
0019 
0020 #ifndef KDAV2_DAVCOLLECTIONCREATEJOB_H
0021 #define KDAV2_DAVCOLLECTIONCREATEJOB_H
0022 
0023 #include "kpimkdav2_export.h"
0024 
0025 #include "davjobbase.h"
0026 #include "davcollection.h"
0027 #include "davurl.h"
0028 
0029 namespace KDAV2
0030 {
0031 
0032 /**
0033  * @short A job that creates a DAV collection.
0034  */
0035 class KPIMKDAV2_EXPORT DavCollectionCreateJob : public DavJobBase
0036 {
0037     Q_OBJECT
0038 
0039 public:
0040     /**
0041      * Creates a new dav collection create job.
0042      *
0043      * @param collection The collection that shall be created.
0044      * @param parent The parent object.
0045      */
0046     DavCollectionCreateJob(const DavCollection &collection, QObject *parent = nullptr);
0047 
0048     /**
0049      * Starts the job.
0050      */
0051     void start() Q_DECL_OVERRIDE;
0052 
0053     /**
0054      * Returns the created DAV item including the correct identifier url
0055      * and current etag information.
0056      */
0057     DavCollection collection() const;
0058 
0059     QUrl collectionUrl() const;
0060 
0061 private Q_SLOTS:
0062     void collectionCreated(KJob *);
0063     void collectionModified(KJob *);
0064     void collectionRefreshed(KJob *);
0065 
0066 private:
0067     DavCollection mCollection;
0068     int mRedirectCount;
0069 
0070     void createCalendar();
0071     void createAddressbook();
0072 };
0073 
0074 }
0075 
0076 #endif