File indexing completed on 2025-01-05 04:49:48
0001 /* 0002 * SPDX-FileCopyrightText: 2016 Daniel Vrátil <dvratil@kde.org> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 * 0006 */ 0007 0008 #pragma once 0009 0010 #include <Akonadi/CalendarBase> 0011 #include <QList> 0012 0013 namespace Akonadi 0014 { 0015 class Monitor; 0016 } 0017 0018 class EventModel : public Akonadi::CalendarBase 0019 { 0020 Q_OBJECT 0021 public: 0022 explicit EventModel(QObject *parent = nullptr); 0023 ~EventModel() override; 0024 0025 [[nodiscard]] QList<Akonadi::Collection> collections() const; 0026 0027 [[nodiscard]] Akonadi::Collection collection(qint64 id) const; 0028 0029 public Q_SLOTS: 0030 void addCalendar(const Akonadi::Collection &col); 0031 void removeCalendar(const Akonadi::Collection &col); 0032 0033 private Q_SLOTS: 0034 void onItemsReceived(const Akonadi::Item::List &items); 0035 0036 private: 0037 void createMonitor(); 0038 void populateCollection(const Akonadi::Collection &col); 0039 void removeCollection(const Akonadi::Collection &col); 0040 0041 QList<Akonadi::Collection> mCols; 0042 Akonadi::Monitor *mMonitor = nullptr; 0043 QMap<Akonadi::Collection::Id, KJob *> mFetchJobs; 0044 };