File indexing completed on 2024-12-22 04:57:04
0001 /* 0002 SPDX-FileCopyrightText: 2015-2016 Krzysztof Nowicki <krissn@op.pl> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "ewsfolder.h" 0010 #include "ewsfoldershape.h" 0011 #include "ewsrequest.h" 0012 #include "ewstypes.h" 0013 0014 class EwsSyncFolderHierarchyRequest : public EwsRequest 0015 { 0016 Q_OBJECT 0017 public: 0018 enum ChangeType { 0019 Create, 0020 Update, 0021 Delete, 0022 Unknown, 0023 }; 0024 0025 class Response; 0026 0027 class Change 0028 { 0029 public: 0030 typedef QList<Change> List; 0031 0032 ChangeType type() const 0033 { 0034 return mType; 0035 } 0036 0037 const EwsId &folderId() const 0038 { 0039 return mId; 0040 } 0041 0042 const EwsFolder &folder() const 0043 { 0044 return mFolder; 0045 } 0046 0047 protected: 0048 Change(QXmlStreamReader &reader); 0049 bool isValid() const 0050 { 0051 return mType != Unknown; 0052 } 0053 0054 ChangeType mType; 0055 EwsId mId; 0056 EwsFolder mFolder; 0057 0058 friend class Response; 0059 }; 0060 0061 EwsSyncFolderHierarchyRequest(EwsClient &client, QObject *parent); 0062 ~EwsSyncFolderHierarchyRequest() override; 0063 0064 void setFolderId(const EwsId &id); 0065 void setFolderShape(const EwsFolderShape &shape); 0066 void setSyncState(const QString &state); 0067 0068 void start() override; 0069 0070 bool includesLastItem() const 0071 { 0072 return mIncludesLastItem; 0073 } 0074 0075 const Change::List &changes() const 0076 { 0077 return mChanges; 0078 } 0079 0080 const QString &syncState() const 0081 { 0082 return mSyncState; 0083 } 0084 0085 protected: 0086 bool parseResult(QXmlStreamReader &reader) override; 0087 bool parseItemsResponse(QXmlStreamReader &reader); 0088 0089 private: 0090 EwsId mFolderId; 0091 EwsFolderShape mShape; 0092 QString mSyncState; 0093 Change::List mChanges; 0094 bool mIncludesLastItem; 0095 }; 0096 0097 Q_DECLARE_METATYPE(EwsSyncFolderHierarchyRequest::Change::List)