File indexing completed on 2024-11-24 04:43:41
0001 /* 0002 * SPDX-FileCopyrightText: 2020 Shashwat Jolly <shashwat.jolly@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <Akonadi/Collection> 0010 #include <Akonadi/Item> 0011 #include <KJob> 0012 0013 #include "etebaseadapter.h" 0014 #include "etesyncclientstate.h" 0015 0016 namespace EteSyncAPI 0017 { 0018 class EntriesFetchJob : public KJob 0019 { 0020 Q_OBJECT 0021 0022 public: 0023 explicit EntriesFetchJob(const EteSyncClientState *mClientState, 0024 const Akonadi::Collection &collection, 0025 EtebaseCollectionPtr etesyncCollection, 0026 QObject *parent = nullptr); 0027 0028 void start() override; 0029 0030 [[nodiscard]] Akonadi::Item::List items() const 0031 { 0032 return mItems; 0033 } 0034 0035 [[nodiscard]] Akonadi::Item::List removedItems() const 0036 { 0037 return mRemovedItems; 0038 } 0039 0040 [[nodiscard]] Akonadi::Collection collection() const 0041 { 0042 return mCollection; 0043 } 0044 0045 protected: 0046 void fetchEntries(); 0047 void setupItem(const EtebaseItem *etesyncItem, const QString &type); 0048 0049 private: 0050 const EteSyncClientState *const mClientState; 0051 Akonadi::Collection mCollection; 0052 const EtebaseCollectionPtr mEtesyncCollection; 0053 Akonadi::Item::List mItems; 0054 Akonadi::Item::List mRemovedItems; 0055 }; 0056 } // namespace EteSyncAPI