File indexing completed on 2025-01-19 04:56:36
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_SERIALIZERINTERFACE_H 0008 #define AKONADI_SERIALIZERINTERFACE_H 0009 0010 #include "domain/datasource.h" 0011 #include "domain/task.h" 0012 #include "domain/project.h" 0013 #include "domain/context.h" 0014 0015 #include <Akonadi/Item> 0016 0017 namespace Akonadi { 0018 0019 class Collection; 0020 class Item; 0021 0022 class SerializerInterface 0023 { 0024 public: 0025 typedef QSharedPointer<SerializerInterface> Ptr; 0026 typedef QSharedPointer<QObject> QObjectPtr; 0027 0028 enum DataSourceNameScheme { 0029 FullPath, 0030 BaseName 0031 }; 0032 0033 SerializerInterface(); 0034 virtual ~SerializerInterface(); 0035 0036 // Passing Akonadi::Item and Akonadi::Collection by value is a bit wasteful (lots of copy constructor) 0037 // but is currently necessary because of mockitopp. 0038 0039 virtual bool representsCollection(QObjectPtr object, Akonadi::Collection collection) = 0; 0040 virtual bool representsItem(QObjectPtr object, Akonadi::Item item) = 0; 0041 0042 virtual QString itemUid(const Item &item) = 0; 0043 0044 virtual Domain::DataSource::Ptr createDataSourceFromCollection(Akonadi::Collection collection, DataSourceNameScheme naming) = 0; 0045 virtual void updateDataSourceFromCollection(Domain::DataSource::Ptr dataSource, Akonadi::Collection collection, DataSourceNameScheme naming) = 0; 0046 virtual Akonadi::Collection createCollectionFromDataSource(Domain::DataSource::Ptr dataSource) = 0; 0047 virtual bool isSelectedCollection(Akonadi::Collection collection) = 0; 0048 virtual bool isTaskCollection(Akonadi::Collection collection) = 0; 0049 0050 virtual bool isTaskItem(Akonadi::Item item) = 0; 0051 virtual Domain::Task::Ptr createTaskFromItem(Akonadi::Item item) = 0; 0052 virtual void updateTaskFromItem(Domain::Task::Ptr task, Akonadi::Item item) = 0; 0053 virtual Akonadi::Item createItemFromTask(Domain::Task::Ptr task) = 0; 0054 0055 virtual bool isTaskChild(Domain::Task::Ptr task, Akonadi::Item item) = 0; 0056 virtual QString relatedUidFromItem(Akonadi::Item item) = 0; 0057 virtual void updateItemParent(Akonadi::Item item, Domain::Task::Ptr parent) = 0; 0058 virtual void updateItemProject(Akonadi::Item item, Domain::Project::Ptr project) = 0; 0059 virtual void removeItemParent(Akonadi::Item item) = 0; 0060 virtual void promoteItemToProject(Akonadi::Item item) = 0; 0061 virtual void clearItem(Akonadi::Item *item) = 0; 0062 virtual Akonadi::Item::List filterDescendantItems(const Akonadi::Item::List &potentialChildren, const Akonadi::Item &ancestorItem) = 0; 0063 0064 virtual bool isProjectItem(Akonadi::Item item) = 0; 0065 virtual Domain::Project::Ptr createProjectFromItem(Akonadi::Item item) = 0; 0066 virtual void updateProjectFromItem(Domain::Project::Ptr project, Akonadi::Item item) = 0; 0067 virtual Akonadi::Item createItemFromProject(Domain::Project::Ptr project) = 0; 0068 virtual bool isProjectChild(Domain::Project::Ptr project, Akonadi::Item item) = 0; 0069 0070 virtual bool isContextChild(Domain::Context::Ptr context, Akonadi::Item item) const = 0; 0071 virtual bool isContext(Akonadi::Item item) = 0; 0072 virtual Domain::Context::Ptr createContextFromItem(Akonadi::Item item) = 0; 0073 virtual Akonadi::Item createItemFromContext(Domain::Context::Ptr project) = 0; 0074 virtual void updateContextFromItem(Domain::Context::Ptr context, Akonadi::Item item) = 0; 0075 virtual void addContextToTask(Domain::Context::Ptr context, Akonadi::Item item) = 0; 0076 virtual void removeContextFromTask(Domain::Context::Ptr context, Akonadi::Item item) = 0; 0077 virtual QString contextUid(Akonadi::Item item) = 0; 0078 }; 0079 0080 } 0081 0082 #endif // AKONADI_SERIALIZERINTERFACE_H