File indexing completed on 2024-12-22 04:57:00

0001 /*
0002     SPDX-FileCopyrightText: 2015-2017 Krzysztof Nowicki <krissn@op.pl>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QList>
0010 
0011 #include "ewsitem.h"
0012 #include "ewsrequest.h"
0013 #include "ewstypes.h"
0014 
0015 class QXmlStreamReader;
0016 
0017 class EwsDeleteItemRequest : public EwsRequest
0018 {
0019     Q_OBJECT
0020 public:
0021     enum Type {
0022         HardDelete = 0,
0023         SoftDelete,
0024         MoveToDeletedItems,
0025     };
0026 
0027     class Response : public EwsRequest::Response
0028     {
0029     public:
0030     protected:
0031         explicit Response(QXmlStreamReader &reader);
0032 
0033         friend class EwsDeleteItemRequest;
0034     };
0035 
0036     EwsDeleteItemRequest(EwsClient &client, QObject *parent);
0037     ~EwsDeleteItemRequest() override;
0038 
0039     void setItemIds(const EwsId::List &ids)
0040     {
0041         mIds = ids;
0042     }
0043 
0044     void setType(Type type)
0045     {
0046         mType = type;
0047     }
0048 
0049     void start() override;
0050 
0051     const QList<Response> &responses() const
0052     {
0053         return mResponses;
0054     }
0055 
0056 protected:
0057     bool parseResult(QXmlStreamReader &reader) override;
0058     bool parseItemsResponse(QXmlStreamReader &reader);
0059 
0060 private:
0061     EwsId::List mIds;
0062     Type mType;
0063     QList<Response> mResponses;
0064 };