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 <QSet>
0011 #include <QSortFilterProxyModel>
0012 
0013 namespace Akonadi
0014 {
0015 class EntityTreeModel;
0016 }
0017 
0018 class PimCalendarsModel : public QSortFilterProxyModel
0019 {
0020     Q_OBJECT
0021 public:
0022     enum Roles {
0023         CollectionIdRole = Qt::UserRole + 1,
0024         NameRole,
0025         EnabledRole,
0026         CheckedRole,
0027         IconNameRole,
0028     };
0029 
0030     explicit PimCalendarsModel(QObject *parent = nullptr);
0031     ~PimCalendarsModel() override;
0032 
0033     QHash<int, QByteArray> roleNames() const override;
0034     QVariant data(const QModelIndex &index, int role) const override;
0035 
0036 public Q_SLOTS:
0037     void setChecked(qint64 collectionId, bool checked);
0038     void saveConfig();
0039 
0040 private:
0041     Akonadi::EntityTreeModel *mEtm = nullptr;
0042     QSet<qint64> mEnabledCalendars;
0043 };