File indexing completed on 2024-11-24 04:43:42

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 <KJob>
0010 
0011 #include "etebaseadapter.h"
0012 #include "etesyncclientstate.h"
0013 
0014 #include <Akonadi/Collection>
0015 
0016 namespace EteSyncAPI
0017 {
0018 class JournalsFetchJob : public KJob
0019 {
0020     Q_OBJECT
0021 
0022 public:
0023     explicit JournalsFetchJob(const EteSyncClientState *mClientState, const Akonadi::Collection &resourceCollection, QObject *parent = nullptr);
0024 
0025     void start() override;
0026 
0027     Akonadi::Collection::List collections() const
0028     {
0029         return mCollections;
0030     }
0031 
0032     Akonadi::Collection::List removedCollections() const
0033     {
0034         return mRemovedCollections;
0035     }
0036 
0037     QString syncToken() const
0038     {
0039         return mSyncToken;
0040     }
0041 
0042 protected:
0043     void fetchJournals();
0044     void setupCollection(const EtebaseCollection *etesyncCollection);
0045 
0046 private:
0047     const EteSyncClientState *mClientState = nullptr;
0048     Akonadi::Collection::List mCollections;
0049     Akonadi::Collection::List mRemovedCollections;
0050     const Akonadi::Collection mResourceCollection;
0051     QString mSyncToken;
0052 };
0053 } // namespace EteSyncAPI