File indexing completed on 2025-01-19 04:56:39

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 
0008 #ifndef PRESENTATION_PROJECTPAGEMODEL_H
0009 #define PRESENTATION_PROJECTPAGEMODEL_H
0010 
0011 #include "presentation/pagemodel.h"
0012 
0013 #include "domain/projectqueries.h"
0014 #include "domain/projectrepository.h"
0015 #include "domain/taskqueries.h"
0016 #include "domain/taskrepository.h"
0017 
0018 namespace Presentation {
0019 
0020 class ProjectPageModel : public PageModel
0021 {
0022     Q_OBJECT
0023 public:
0024     explicit ProjectPageModel(const Domain::Project::Ptr &project,
0025                               const Domain::ProjectQueries::Ptr &projectQueries,
0026                               const Domain::ProjectRepository::Ptr &projectRepository,
0027                               const Domain::TaskQueries::Ptr &taskQueries,
0028                               const Domain::TaskRepository::Ptr &taskRepository,
0029                               QObject *parent = nullptr);
0030 
0031     Domain::Project::Ptr project() const;
0032 
0033     Domain::Task::Ptr addItem(const QString &title, const QModelIndex &parentIndex = QModelIndex()) override;
0034     void removeItem(const QModelIndex &index) override;
0035     void promoteItem(const QModelIndex &index) override;
0036 
0037 private:
0038     QAbstractItemModel *createCentralListModel() override;
0039 
0040     Domain::ProjectQueries::Ptr m_projectQueries;
0041     Domain::ProjectRepository::Ptr m_projectRepository;
0042     Domain::Project::Ptr m_project;
0043 
0044     Domain::TaskQueries::Ptr m_taskQueries;
0045     Domain::TaskRepository::Ptr m_taskRepository;
0046 };
0047 
0048 }
0049 
0050 #endif // PRESENTATION_PROJECTPAGEMODEL_H