File indexing completed on 2025-01-05 04:59:43
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 CONTEXTPAGEMODEL_H 0009 #define CONTEXTPAGEMODEL_H 0010 0011 #include "presentation/pagemodel.h" 0012 0013 #include "domain/contextqueries.h" 0014 #include "domain/contextrepository.h" 0015 #include "domain/taskqueries.h" 0016 #include "domain/taskrepository.h" 0017 0018 namespace Presentation { 0019 0020 class ContextPageModel : public PageModel 0021 { 0022 Q_OBJECT 0023 public: 0024 explicit ContextPageModel(const Domain::Context::Ptr &context, 0025 const Domain::ContextQueries::Ptr &contextQueries, 0026 const Domain::ContextRepository::Ptr &contextRepository, 0027 const Domain::TaskQueries::Ptr &taskQueries, 0028 const Domain::TaskRepository::Ptr &taskRepository, 0029 QObject *parent = nullptr); 0030 0031 Domain::Context::Ptr context() const; 0032 public slots: 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::Context::Ptr m_context; 0041 Domain::ContextQueries::Ptr m_contextQueries; 0042 Domain::ContextRepository::Ptr m_contextRepository; 0043 Domain::TaskQueries::Ptr m_taskQueries; 0044 Domain::TaskRepository::Ptr m_taskRepository; 0045 }; 0046 0047 } 0048 #endif // CONTEXTPAGEMODEL_H