File indexing completed on 2025-01-05 04:59:41

0001 /*
0002  * SPDX-FileCopyrightText: 2014 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 AKONADI_STORAGEINTERFACE_H
0008 #define AKONADI_STORAGEINTERFACE_H
0009 
0010 #include <QFlags>
0011 #include <Akonadi/Item>
0012 
0013 class KJob;
0014 class QObject;
0015 class QByteArray;
0016 
0017 namespace Akonadi {
0018 
0019 class Collection;
0020 class CollectionFetchJobInterface;
0021 class ItemFetchJobInterface;
0022 
0023 
0024 class StorageInterface
0025 {
0026 public:
0027     typedef QSharedPointer<StorageInterface> Ptr;
0028 
0029     enum FetchDepth {
0030         Base,
0031         FirstLevel,
0032         Recursive
0033     };
0034 
0035     StorageInterface();
0036     virtual ~StorageInterface();
0037 
0038     virtual Akonadi::Collection defaultCollection() = 0;
0039 
0040     virtual KJob *createItem(Akonadi::Item item, Akonadi::Collection collection) = 0;
0041     virtual KJob *updateItem(Akonadi::Item item, QObject *parent) = 0;
0042     virtual KJob *removeItem(Akonadi::Item item, QObject *parent) = 0;
0043     virtual KJob *removeItems(Item::List items, QObject *parent) = 0;
0044     virtual KJob *moveItem(Item item, Collection collection, QObject *parent) = 0;
0045     virtual KJob *moveItems(Item::List item, Collection collection, QObject *parent) = 0;
0046 
0047     virtual KJob *createCollection(Collection collection, QObject *parent) = 0;
0048     virtual KJob *updateCollection(Collection collection, QObject *parent) = 0;
0049     virtual KJob *removeCollection(Collection collection, QObject *parent) = 0;
0050 
0051     virtual KJob *createTransaction(QObject *parent) = 0;
0052 
0053     virtual CollectionFetchJobInterface *fetchCollections(Akonadi::Collection collection, FetchDepth depth, QObject *parent) = 0;
0054     virtual ItemFetchJobInterface *fetchItems(Akonadi::Collection collection, QObject *parent) = 0;
0055     virtual ItemFetchJobInterface *fetchItem(Akonadi::Item item, QObject *parent) = 0;
0056 };
0057 
0058 }
0059 
0060 #endif // AKONADI_STORAGEINTERFACE_H