entriesfetchjob.h 1.23 KB
Newer Older
1
/*
2
 * SPDX-FileCopyrightText: 2020 Shashwat Jolly <shashwat.jolly@gmail.com>
Laurent Montel's avatar
Laurent Montel committed
3
 *
4
 * SPDX-License-Identifier: GPL-2.0-or-later
5 6 7 8 9
 */

#ifndef ETESYNCENTRIESFETCHJOB_H
#define ETESYNCENTRIESFETCHJOB_H

10
#include <AkonadiCore/Collection>
11
#include <AkonadiCore/Item>
12 13
#include <KJob>

14
#include "etebaseadapter.h"
15
#include "etesyncclientstate.h"
16 17

namespace EteSyncAPI {
Laurent Montel's avatar
Laurent Montel committed
18 19 20 21 22
class EntriesFetchJob : public KJob
{
    Q_OBJECT

public:
23
    explicit EntriesFetchJob(const EteSyncClientState *mClientState, const Akonadi::Collection &collection, EtebaseCollectionPtr etesyncCollection, QObject *parent = nullptr);
Laurent Montel's avatar
Laurent Montel committed
24 25 26

    void start() override;

27
    Akonadi::Item::List items() const
Laurent Montel's avatar
Laurent Montel committed
28
    {
29
        return mItems;
Laurent Montel's avatar
Laurent Montel committed
30 31
    }

32
    Akonadi::Item::List removedItems() const
Laurent Montel's avatar
Laurent Montel committed
33
    {
34
        return mRemovedItems;
Laurent Montel's avatar
Laurent Montel committed
35 36 37 38 39 40 41 42 43
    }

    Akonadi::Collection collection() const
    {
        return mCollection;
    }

protected:
    void fetchEntries();
44
    void setupItem(Akonadi::Item &item, const EtebaseItem *etesyncItem, const QString &type);
Laurent Montel's avatar
Laurent Montel committed
45 46

private:
47
    const EteSyncClientState *mClientState = nullptr;
Laurent Montel's avatar
Laurent Montel committed
48
    Akonadi::Collection mCollection;
49
    const EtebaseCollectionPtr mEtesyncCollection;
50 51
    Akonadi::Item::List mItems;
    Akonadi::Item::List mRemovedItems;
Laurent Montel's avatar
Laurent Montel committed
52
};
53 54 55
}  // namespace EteSyncAPI

#endif