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

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 <QPointer>
0010 
0011 #include <Akonadi/Collection>
0012 #include <Akonadi/Item>
0013 
0014 #include "ewsclient.h"
0015 #include "ewsgetitemrequest.h"
0016 #include "ewsid.h"
0017 #include "ewsitem.h"
0018 #include "ewsjob.h"
0019 #include "ewstypes.h"
0020 
0021 class EwsFetchItemDetailJob : public EwsJob
0022 {
0023     Q_OBJECT
0024 public:
0025     EwsFetchItemDetailJob(EwsClient &client, QObject *parent, const Akonadi::Collection &collection);
0026     ~EwsFetchItemDetailJob() override;
0027 
0028     void setItemLists(const Akonadi::Item::List &changedItems, Akonadi::Item::List *deletedItems);
0029 
0030     Akonadi::Item::List changedItems() const
0031     {
0032         return mChangedItems;
0033     }
0034 
0035     void start() override;
0036 
0037 protected:
0038     virtual void processItems(const EwsGetItemRequest::Response::List &responses) = 0;
0039 
0040     QPointer<EwsGetItemRequest> mRequest;
0041     Akonadi::Item::List mChangedItems;
0042     Akonadi::Item::List *mDeletedItems = nullptr;
0043     EwsClient &mClient;
0044     const Akonadi::Collection mCollection;
0045 private Q_SLOTS:
0046     void itemDetailFetched(KJob *job);
0047 };