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

0001 /*
0002     Copyright (c) 2010 Tobias Koenig <tokoe@kde.org>
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_DAVITEMDELETEJOB_H
0020 #define KDAV2_DAVITEMDELETEJOB_H
0021 
0022 #include "kpimkdav2_export.h"
0023 
0024 #include "davitem.h"
0025 #include "davjobbase.h"
0026 #include "davurl.h"
0027 
0028 namespace KDAV2
0029 {
0030 
0031 /**
0032  * @short A job to delete a DAV item on the DAV server.
0033  */
0034 class KPIMKDAV2_EXPORT DavItemDeleteJob : public DavJobBase
0035 {
0036     Q_OBJECT
0037 
0038 public:
0039     /**
0040      * Creates a new dav item delete job.
0041      *
0042      * @param item The item that shall be deleted.
0043      * @param parent The parent object.
0044      */
0045     DavItemDeleteJob(const DavItem &item, QObject *parent = nullptr);
0046 
0047     /**
0048      * Starts the job.
0049      */
0050     void start() Q_DECL_OVERRIDE;
0051 
0052     /**
0053      * Returns the item that triggered the conflict, if any.
0054      */
0055     DavItem freshItem() const;
0056 
0057     /**
0058      * Returns the http response code we got when fetching the fresh item.
0059      */
0060     int freshResponseCode() const;
0061 
0062 private Q_SLOTS:
0063     void davJobFinished(KJob *);
0064     void conflictingItemFetched(KJob *);
0065 
0066 private:
0067     DavItem mItem;
0068     DavItem mFreshItem;
0069     int mFreshResponseCode;
0070 };
0071 
0072 }
0073 
0074 #endif