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

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_PROJECTQUERIES_H
0008 #define AKONADI_PROJECTQUERIES_H
0009 
0010 #include "domain/projectqueries.h"
0011 
0012 #include "akonadi/akonadilivequeryhelpers.h"
0013 #include "akonadi/akonadilivequeryintegrator.h"
0014 
0015 namespace Akonadi {
0016 
0017 class ProjectQueries : public QObject, public Domain::ProjectQueries
0018 {
0019     Q_OBJECT
0020 public:
0021     typedef QSharedPointer<ProjectQueries> Ptr;
0022 
0023     typedef Domain::LiveQueryInput<Akonadi::Item> ItemInputQuery;
0024     typedef Domain::LiveQueryOutput<Domain::Project::Ptr> ProjectQueryOutput;
0025     typedef Domain::QueryResultProvider<Domain::Project::Ptr> ProjectProvider;
0026     typedef Domain::QueryResult<Domain::Project::Ptr> ProjectResult;
0027 
0028     typedef Domain::LiveQueryOutput<Domain::Task::Ptr> TaskQueryOutput;
0029     typedef Domain::QueryResultProvider<Domain::Task::Ptr> TaskProvider;
0030     typedef Domain::QueryResult<Domain::Task::Ptr> TaskResult;
0031 
0032     ProjectQueries(const StorageInterface::Ptr &storage,
0033                    const SerializerInterface::Ptr &serializer,
0034                    const MonitorInterface::Ptr &monitor);
0035 
0036     ProjectResult::Ptr findAll() const override;
0037     TaskResult::Ptr findTopLevel(Domain::Project::Ptr project) const override;
0038 
0039 private:
0040     SerializerInterface::Ptr m_serializer;
0041     LiveQueryHelpers::Ptr m_helpers;
0042     LiveQueryIntegrator::Ptr m_integrator;
0043 
0044     mutable ProjectQueryOutput::Ptr m_findAll;
0045     mutable QHash<Akonadi::Item::Id, TaskQueryOutput::Ptr> m_findTopLevel;
0046 };
0047 
0048 }
0049 
0050 #endif // AKONADI_PROJECTQUERIES_H