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 #include <QSharedPointer>
0011 
0012 #include "ewsitem.h"
0013 #include "ewsrequest.h"
0014 #include "ewstypes.h"
0015 
0016 class QXmlStreamReader;
0017 
0018 class EwsCreateItemRequest : public EwsRequest
0019 {
0020     Q_OBJECT
0021 public:
0022     class Response : public EwsRequest::Response
0023     {
0024     public:
0025         const EwsId &itemId() const
0026         {
0027             return mId;
0028         }
0029 
0030     protected:
0031         Response(QXmlStreamReader &reader);
0032 
0033         EwsId mId;
0034 
0035         friend class EwsCreateItemRequest;
0036     };
0037 
0038     EwsCreateItemRequest(EwsClient &client, QObject *parent);
0039     ~EwsCreateItemRequest() override;
0040 
0041     void setItems(const EwsItem::List &items)
0042     {
0043         mItems = items;
0044     }
0045 
0046     void setMessageDisposition(EwsMessageDisposition disp)
0047     {
0048         mMessageDisp = disp;
0049     }
0050 
0051     void setMeetingDisposition(EwsMeetingDisposition disp)
0052     {
0053         mMeetingDisp = disp;
0054     }
0055 
0056     void setSavedFolderId(const EwsId &id)
0057     {
0058         mSavedFolderId = id;
0059     }
0060 
0061     void start() override;
0062 
0063     const QList<Response> &responses() const
0064     {
0065         return mResponses;
0066     }
0067 
0068 protected:
0069     bool parseResult(QXmlStreamReader &reader) override;
0070     bool parseItemsResponse(QXmlStreamReader &reader);
0071 
0072 private:
0073     EwsItem::List mItems;
0074     EwsId mSavedFolderId;
0075     EwsMessageDisposition mMessageDisp;
0076     EwsMeetingDisposition mMeetingDisp;
0077     QList<Response> mResponses;
0078 };