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

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_TASKREPOSITORY_H
0008 #define AKONADI_TASKREPOSITORY_H
0009 
0010 #include "domain/taskrepository.h"
0011 
0012 #include <Akonadi/Collection>
0013 #include <Akonadi/Item>
0014 
0015 #include "akonadi/akonadiserializerinterface.h"
0016 #include "akonadi/akonadistorageinterface.h"
0017 
0018 namespace Akonadi {
0019 
0020 class TaskRepository : public QObject, public Domain::TaskRepository
0021 {
0022     Q_OBJECT
0023 public:
0024     typedef QSharedPointer<TaskRepository> Ptr;
0025 
0026     TaskRepository(const StorageInterface::Ptr &storage,
0027                    const SerializerInterface::Ptr &serializer);
0028 
0029     virtual KJob *create(Domain::Task::Ptr task) override;
0030     virtual KJob *createChild(Domain::Task::Ptr task, Domain::Task::Ptr parent) override;
0031     virtual KJob *createInProject(Domain::Task::Ptr task, Domain::Project::Ptr project) override;
0032     virtual KJob *createInContext(Domain::Task::Ptr task, Domain::Context::Ptr context) override;
0033 
0034     virtual KJob *update(Domain::Task::Ptr task) override;
0035     virtual KJob *remove(Domain::Task::Ptr task) override;
0036 
0037     virtual KJob *promoteToProject(Domain::Task::Ptr task) override;
0038 
0039     virtual KJob *associate(Domain::Task::Ptr parent, Domain::Task::Ptr child) override;
0040     virtual KJob *dissociate(Domain::Task::Ptr child) override;
0041     virtual KJob *dissociateAll(Domain::Task::Ptr child) override;
0042 
0043 private:
0044     StorageInterface::Ptr m_storage;
0045     SerializerInterface::Ptr m_serializer;
0046 
0047     KJob *createItem(const Akonadi::Item &item);
0048 };
0049 
0050 }
0051 
0052 #endif // AKONADI_TASKREPOSITORY_H