MauiKit Calendar

recurrenceexceptionsmodel.h
1// SPDX-FileCopyrightText: 2021 Claudio Cambra <claudio.cambra@gmail.com>
2// SPDX-License-Identifier: LGPL-2.1-or-later
3
4#pragma once
5
6#include <KCalendarCore/Calendar>
7#include <QAbstractListModel>
8
9class RecurrenceExceptionsModel : public QAbstractListModel
10{
12 Q_PROPERTY(KCalendarCore::Incidence::Ptr incidencePtr READ incidencePtr WRITE setIncidencePtr NOTIFY incidencePtrChanged)
13 Q_PROPERTY(QList<QDate> exceptions READ exceptions NOTIFY exceptionsChanged)
14 Q_PROPERTY(QVariantMap dataroles READ dataroles CONSTANT)
15
16public:
17 enum Roles {
18 DateRole = Qt::UserRole + 1,
19 };
20 Q_ENUM(Roles);
21
22 explicit RecurrenceExceptionsModel(QObject *parent = nullptr, KCalendarCore::Incidence::Ptr incidencePtr = nullptr);
23 ~RecurrenceExceptionsModel() override = default;
24
25 KCalendarCore::Incidence::Ptr incidencePtr();
26 void setIncidencePtr(KCalendarCore::Incidence::Ptr incidence);
27 QList<QDate> exceptions();
28 void updateExceptions();
29 QVariantMap dataroles();
30
31 QVariant data(const QModelIndex &idx, int role) const override;
32 QHash<int, QByteArray> roleNames() const override;
33 int rowCount(const QModelIndex &parent = {}) const override;
34
35 Q_INVOKABLE void addExceptionDateTime(QDateTime date);
36 Q_INVOKABLE void deleteExceptionDateTime(QDateTime date);
37
39 void incidencePtrChanged();
40 void exceptionsChanged();
41
42private:
44 QList<QDate> m_exceptions;
45 QVariantMap m_dataRoles;
46};
Q_INVOKABLEQ_INVOKABLE
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
QObject * parent() const const
UserRole
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Sep 27 2024 11:56:15 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.