File indexing completed on 2025-01-19 04:56:44
0001 /* 0002 * SPDX-FileCopyrightText: 2015 Kevin Ottens <ervin@kde.org> 0003 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0004 */ 0005 0006 0007 #ifndef TESTLIB_AKONADIFAKESTORAGE_H 0008 #define TESTLIB_AKONADIFAKESTORAGE_H 0009 0010 #include "akonadi/akonadistorageinterface.h" 0011 0012 namespace Testlib { 0013 0014 class AkonadiFakeData; 0015 0016 class AkonadiFakeStorage : public Akonadi::StorageInterface 0017 { 0018 public: 0019 explicit AkonadiFakeStorage(AkonadiFakeData *data); 0020 0021 Akonadi::Collection defaultCollection() override; 0022 0023 KJob *createItem(Akonadi::Item item, Akonadi::Collection collection) override; 0024 KJob *updateItem(Akonadi::Item item, QObject *parent) override; 0025 KJob *removeItem(Akonadi::Item item, QObject *parent) override; 0026 KJob *removeItems(Akonadi::Item::List items, QObject *parent) override; 0027 KJob *moveItem(Akonadi::Item item, Akonadi::Collection collection, QObject *parent) override; 0028 KJob *moveItems(Akonadi::Item::List items, Akonadi::Collection collection, QObject *parent) override; 0029 0030 KJob *createCollection(Akonadi::Collection collection, QObject *parent) override; 0031 KJob *updateCollection(Akonadi::Collection collection, QObject *parent) override; 0032 KJob *removeCollection(Akonadi::Collection collection, QObject *parent) override; 0033 0034 KJob *createTransaction(QObject *parent) override; 0035 0036 Akonadi::CollectionFetchJobInterface *fetchCollections(Akonadi::Collection collection, FetchDepth depth, QObject *parent) override; 0037 Akonadi::ItemFetchJobInterface *fetchItems(Akonadi::Collection collection, QObject *parent) override; 0038 Akonadi::ItemFetchJobInterface *fetchItem(Akonadi::Item item, QObject *parent) override; 0039 0040 private: 0041 Akonadi::Collection::Id findId(const Akonadi::Collection &collection); 0042 Akonadi::Item::Id findId(const Akonadi::Item &item); 0043 Akonadi::Collection::List collectChildren(const Akonadi::Collection &root); 0044 0045 AkonadiFakeData *m_data; 0046 }; 0047 0048 } 0049 0050 #endif // TESTLIB_AKONADIFAKESTORAGE_H