File indexing completed on 2024-05-12 05:10:43
0001 /* 0002 SPDX-FileCopyrightText: 2022 Volker Krause <vkrause@kde.org> 0003 SPDX-FileCopyrightText: 2023 Daniel Vrátil <dvratil@kde.org> 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "akonadi-calendar_export.h" 0010 #include "calendarbase.h" 0011 0012 namespace Akonadi 0013 { 0014 class Collection; 0015 class EntityTreeModel; 0016 0017 class CollectionCalendarPrivate; 0018 0019 /** Calendar representing a single Akonadi::Collection. */ 0020 class AKONADI_CALENDAR_EXPORT CollectionCalendar : public Akonadi::CalendarBase 0021 { 0022 Q_OBJECT 0023 public: 0024 using Ptr = QSharedPointer<CollectionCalendar>; 0025 0026 explicit CollectionCalendar(const Akonadi::Collection &col, QObject *parent = nullptr); 0027 CollectionCalendar(Akonadi::EntityTreeModel *model, const Akonadi::Collection &col, QObject *parent = nullptr); 0028 ~CollectionCalendar() override; 0029 0030 Akonadi::Collection collection() const; 0031 void setCollection(const Akonadi::Collection &c); 0032 0033 Akonadi::EntityTreeModel *model() const; 0034 0035 bool addEvent(const KCalendarCore::Event::Ptr &event) override; 0036 bool addTodo(const KCalendarCore::Todo::Ptr &todo) override; 0037 bool addJournal(const KCalendarCore::Journal::Ptr &journal) override; 0038 0039 bool hasRight(Akonadi::Collection::Right right) const; 0040 0041 Q_SIGNALS: 0042 /** 0043 * @brief Emitted whenever an incidence is added, removed or changed 0044 */ 0045 void calendarChanged(); 0046 0047 private: 0048 Q_DECLARE_PRIVATE(CollectionCalendar) 0049 }; 0050 0051 } // namespace Akonadi