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

0001 /*
0002  * SPDX-FileCopyrightText: 2014 Kevin Ottens <ervin@kde.org>
0003    SPDX-FileCopyrightText: 2014 RĂ©mi Benoit <r3m1.benoit@gmail.com>
0004    * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005    */
0006 
0007 
0008 #ifndef AKONADI_SERIALIZER_H
0009 #define AKONADI_SERIALIZER_H
0010 
0011 #include "akonadiserializerinterface.h"
0012 
0013 namespace Akonadi {
0014 
0015 class Item;
0016 
0017 class Serializer : public SerializerInterface
0018 {
0019 public:
0020     Serializer();
0021     virtual ~Serializer();
0022 
0023     bool representsCollection(QObjectPtr object, Collection collection) override;
0024     bool representsItem(QObjectPtr object, Item item) override;
0025 
0026     QString itemUid(const Item &item) override;
0027 
0028     Domain::DataSource::Ptr createDataSourceFromCollection(Akonadi::Collection collection, DataSourceNameScheme naming) override;
0029     void updateDataSourceFromCollection(Domain::DataSource::Ptr dataSource, Akonadi::Collection collection, DataSourceNameScheme naming) override;
0030     virtual Akonadi::Collection createCollectionFromDataSource(Domain::DataSource::Ptr dataSource) override;
0031     virtual bool isSelectedCollection(Akonadi::Collection collection) override;
0032     virtual bool isTaskCollection(Akonadi::Collection collection) override;
0033 
0034     bool isTaskItem(Akonadi::Item item) override;
0035     Domain::Task::Ptr createTaskFromItem(Akonadi::Item item) override;
0036     void updateTaskFromItem(Domain::Task::Ptr task, Akonadi::Item item) override;
0037     Akonadi::Item createItemFromTask(Domain::Task::Ptr task) override;
0038     bool isTaskChild(Domain::Task::Ptr task, Akonadi::Item item) override;
0039     QString relatedUidFromItem(Akonadi::Item item) override;
0040     void updateItemParent(Akonadi::Item item, Domain::Task::Ptr parent) override;
0041     void updateItemProject(Akonadi::Item item, Domain::Project::Ptr project) override;
0042     void removeItemParent(Akonadi::Item item) override;
0043     void promoteItemToProject(Akonadi::Item item) override;
0044     void clearItem(Akonadi::Item *item) override;
0045     Akonadi::Item::List filterDescendantItems(const Akonadi::Item::List &potentialChildren, const Akonadi::Item &ancestorItem) override;
0046 
0047     bool isProjectItem(Akonadi::Item item) override;
0048     Domain::Project::Ptr createProjectFromItem(Akonadi::Item item) override;
0049     void updateProjectFromItem(Domain::Project::Ptr project, Akonadi::Item item) override;
0050     Akonadi::Item createItemFromProject(Domain::Project::Ptr project) override;
0051     bool isProjectChild(Domain::Project::Ptr project, Akonadi::Item item) override;
0052 
0053     bool isContextChild(Domain::Context::Ptr context, Akonadi::Item item) const override;
0054     bool isContext(Akonadi::Item item) override;
0055     Domain::Context::Ptr createContextFromItem(Akonadi::Item item) override;
0056     Akonadi::Item createItemFromContext(Domain::Context::Ptr context) override;
0057     void updateContextFromItem(Domain::Context::Ptr context, Akonadi::Item item) override;
0058     void addContextToTask(Domain::Context::Ptr context, Akonadi::Item item) override;
0059     void removeContextFromTask(Domain::Context::Ptr context, Akonadi::Item item) override;
0060     QString contextUid(Akonadi::Item item) override;
0061 
0062     static QByteArray customPropertyAppName();
0063     static QByteArray customPropertyIsProject();
0064     static QByteArray customPropertyIsContext();
0065     static QByteArray customPropertyIsRunning();
0066     static QByteArray customPropertyContextList();
0067 
0068 };
0069 
0070 }
0071 
0072 #endif // AKONADI_SERIALIZERINTERFACE_H