10#include <akonadi-calendar_version.h>
11#if AKONADICALENDAR_VERSION > QT_VERSION_CHECK(5, 19, 41)
12#include <Akonadi/ETMCalendar>
13#include <Akonadi/IncidenceChanger>
15#include <Akonadi/Calendar/ETMCalendar>
16#include <Akonadi/Calendar/IncidenceChanger>
19#include <Akonadi/CollectionFilterProxyModel>
20#include <KConfigWatcher>
22#include <akonadi-calendar_version.h>
28class ETMViewStateSaver;
38class CalendarManager :
public QObject
44 Q_PROPERTY(
bool loading READ loading NOTIFY loadingChanged)
45 Q_PROPERTY(QAbstractProxyModel *collections READ collections CONSTANT)
46 Q_PROPERTY(QAbstractItemModel *todoCollections READ todoCollections CONSTANT)
47 Q_PROPERTY(QAbstractItemModel *viewCollections READ viewCollections CONSTANT)
48 Q_PROPERTY(QVector<qint64> enabledTodoCollections READ enabledTodoCollections NOTIFY enabledTodoCollectionsChanged)
49 Q_PROPERTY(Akonadi::CollectionFilterProxyModel *allCalendars READ allCalendars CONSTANT)
50 Q_PROPERTY(Akonadi::CollectionFilterProxyModel *selectableCalendars READ selectableCalendars CONSTANT)
51 Q_PROPERTY(Akonadi::CollectionFilterProxyModel *selectableEventCalendars READ selectableEventCalendars CONSTANT)
52 Q_PROPERTY(Akonadi::CollectionFilterProxyModel *selectableTodoCalendars READ selectableTodoCalendars CONSTANT)
53 Q_PROPERTY(Akonadi::ETMCalendar::Ptr calendar READ calendar CONSTANT)
54 Q_PROPERTY(Akonadi::IncidenceChanger *incidenceChanger READ incidenceChanger CONSTANT)
55 Q_PROPERTY(QVariantMap undoRedoData READ undoRedoData NOTIFY undoRedoDataChanged)
58 static CalendarManager *instance();
60 ~CalendarManager()
override;
62 KCheckableProxyModel *collectionSelectionProxyModel()
const;
63 void setCollectionSelectionProxyModel(KCheckableProxyModel *);
66 QAbstractProxyModel *collections();
67 QAbstractItemModel *todoCollections();
68 QAbstractItemModel *viewCollections();
69 QVector<qint64> enabledTodoCollections();
70 void refreshEnabledTodoCollections();
73 Akonadi::ETMCalendar::Ptr calendar()
const;
74 Akonadi::IncidenceChanger *incidenceChanger()
const;
75 Akonadi::CollectionFilterProxyModel *allCalendars();
76 Akonadi::CollectionFilterProxyModel *selectableCalendars()
const;
77 Akonadi::CollectionFilterProxyModel *selectableEventCalendars()
const;
78 Akonadi::CollectionFilterProxyModel *selectableTodoCalendars()
const;
79 Q_INVOKABLE qint64 defaultCalendarId(IncidenceWrapper *incidenceWrapper);
80 Q_INVOKABLE int getCalendarSelectableIndex(IncidenceWrapper *incidenceWrapper);
81 QVariantMap undoRedoData();
84 Akonadi::Item incidenceItem(
const QString &uid)
const;
87 Q_INVOKABLE void addIncidence(IncidenceWrapper *incidenceWrapper);
88 Q_INVOKABLE void editIncidence(IncidenceWrapper *incidenceWrapper);
89 Q_INVOKABLE void updateIncidenceDates(IncidenceWrapper *incidenceWrapper,
93 const QDateTime &occurrenceDate = QDateTime());
98 void changeIncidenceCollection(Akonadi::Item item, qint64 collectionId);
99 Q_INVOKABLE QVariantMap getCollectionDetails(QVariant collectionId);
100 Q_INVOKABLE void setCollectionColor(qint64 collectionId,
const QColor &color);
106 Q_INVOKABLE void updateCollection(qint64 collectionId);
107 Q_INVOKABLE void deleteCollection(qint64 collectionId);
108 Q_INVOKABLE void editCollection(qint64 collectionId);
109 Q_INVOKABLE void toggleCollection(qint64 collectionId);
115 void loadingChanged();
116 void calendarChanged();
117 void undoRedoDataChanged();
118 void enabledTodoCollectionsChanged();
119 void updateIncidenceDatesCompleted();
120 void collectionColorsChanged();
121 void incidenceAdded();
124 Akonadi::ETMCalendar::Ptr m_calendar =
nullptr;
125 Akonadi::IncidenceChanger *m_changer =
nullptr;
126 KDescendantsProxyModel *m_flatCollectionTreeModel =
nullptr;
127 ColorProxyModel *m_baseModel =
nullptr;
128 KCheckableProxyModel *m_selectionProxyModel =
nullptr;
129 Akonadi::ETMViewStateSaver *mCollectionSelectionModelStateSaver =
nullptr;
130 Akonadi::CollectionFilterProxyModel *m_allCalendars =
nullptr;
131 Akonadi::CollectionFilterProxyModel *m_eventMimeTypeFilterModel =
nullptr;
133 Akonadi::EntityRightsFilterModel *m_allCollectionsRightsFilterModel =
nullptr;
134 Akonadi::EntityRightsFilterModel *m_eventRightsFilterModel =
nullptr;
135 Akonadi::EntityRightsFilterModel *m_todoRightsFilterModel =
nullptr;
136 Akonadi::CollectionFilterProxyModel *m_selectableCollectionsModel =
nullptr;
137 Akonadi::CollectionFilterProxyModel *m_selectableEventCollectionsModel =
nullptr;
138 Akonadi::CollectionFilterProxyModel *m_selectableTodoCollectionsModel =
nullptr;
139 Akonadi::CollectionFilterProxyModel *m_todoViewCollectionModel =
nullptr;
140 Akonadi::CollectionFilterProxyModel *m_viewCollectionModel =
nullptr;
141 QVector<qint64> m_enabledTodoCollections;
142 KConfigWatcher::Ptr m_colorWatcher;
145Q_DECLARE_METATYPE(Akonadi::ETMCalendar::Ptr)
Despite the name, this handles the presentation of collections including display text and icons,...
This class is a wrapper for a KCalendarCore::Incidence::Ptr object.
QSharedPointer< Incidence > Ptr
QObject * parent() const const