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 "pimdatasource.h"
0011 #include <EventViews/Prefs>
0012 #include <QObject>
0013 
0014 class EventModel;
0015 
0016 class AkonadiPimDataSource : public QObject, public PimDataSource
0017 {
0018     Q_OBJECT
0019 
0020 public:
0021     explicit AkonadiPimDataSource(QObject *parent = nullptr);
0022     ~AkonadiPimDataSource() override;
0023 
0024     [[nodiscard]] qint64 akonadiIdForIncidence(const KCalendarCore::Incidence::Ptr &incidence) const override;
0025     [[nodiscard]] KCalendarCore::Calendar *calendar() const override;
0026     [[nodiscard]] QString calendarColorForIncidence(const KCalendarCore::Incidence::Ptr &incidence) const override;
0027 
0028 private Q_SLOTS:
0029     void onSettingsChanged();
0030 
0031 private:
0032     EventModel *const mCalendar;
0033     EventViews::PrefsPtr mEventViewsPrefs;
0034     mutable QHash<qint64, QString> mColorCache;
0035 };