diff --git a/src/calendar.h b/src/calendar.h --- a/src/calendar.h +++ b/src/calendar.h @@ -94,6 +94,16 @@ JournalSortSummary /**< Sort Journals alphabetically, by summary */ }; +/** + Type of calendar, i.e. whether it can be written to or is read only. + @since 5.70 +*/ +enum CalendarType +{ + ReadOnly, + ReadWrite +}; + /** @brief Represents the main calendar class. @@ -122,6 +132,10 @@ Q_OBJECT Q_PROPERTY(QString productId READ productId WRITE setProductId) //clazy:exclude=qproperty-without-notify Q_PROPERTY(KCalendarCore::Person owner READ owner WRITE setOwner) + Q_PROPERTY(QString id READ id WRITE setId NOTIFY idChanged) + Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + Q_PROPERTY(QString iconName READ iconName WRITE setIconName NOTIFY iconNameChanged) + Q_PROPERTY(CalendarType type READ type WRITE setType NOTIFY typeChanged) public: @@ -1197,6 +1211,61 @@ */ virtual Alarm::List alarms(const QDateTime &from, const QDateTime &to, bool excludeBlockedAlarms = false) const = 0; + /** + * A unique identifier for this calendar. + * @since 5.70 + * @see setId() + */ + QString id() const; + + /** + * set a unique identifier for this calendar. + * @since 5.70 + * @see id() + */ + void setId(const QString &id); + + /** + * The user-visible name for this calendar. + * @since 5.70 + * @see setName() + */ + QString name() const; + /** + * Set the user-visible name for this calendar. + * @since 5.70 + * @see name() + */ + void setName(const QString &name); + + /** + * This calendar's icon name accordind to the freedesktop.org icon theme spec. + * @since 5.70 + * @see setIconName() + */ + QString iconName() const; + /** + * Set this calendar's icon name accordind to the freedesktop.org icon theme spec. + * @since 5.70 + * @see icon() + */ + void setIconName(const QString &icon); + + /** + * This calendar's CalendarType, i.e. whether it is writable or read-only. + * Defaults to ReadWrite. + * @since 5.70 + * @see setType() + */ + CalendarType type() const; + + /** + * Set this calendar's CalendarType, i.e. whether it is writable or read-only. + * @since 5.70 + * @see type() + */ + void setType(const CalendarType type); + // Observer Specific Methods // /** @@ -1390,6 +1459,34 @@ */ void filterChanged(); + /** + * Emitted when the id changes. + * @since 5.70 + * @see id() + */ + void idChanged(); + + /** + * Emitted when the name changes. + * @since 5.70 + * @see name() + */ + void nameChanged(); + + /** + * Emitted when the icon name changes. + * @since 5.70 + * @see icon() + */ + void iconNameChanged(); + + /** + * Emitted when the type changes. + * @since 5.70 + * @see type() + */ + void typeChanged(); + private: friend class ICalFormat; diff --git a/src/calendar.cpp b/src/calendar.cpp --- a/src/calendar.cpp +++ b/src/calendar.cpp @@ -1373,3 +1373,52 @@ Q_ASSERT(false); } +QString Calendar::id() const +{ + return d->mId; +} + +void Calendar::setId(const QString &id) +{ + if (d->mId != id) { + d->mId = id; + Q_EMIT idChanged(); + } +} + +QString Calendar::name() const +{ + return d->mName; +} + +void Calendar::setName(const QString &name) +{ + if (d->mName != name) { + d->mName = name; + Q_EMIT nameChanged(); + } +} + +QString Calendar::iconName() const +{ + return d->mIconName; +} + +void Calendar::setIconName(const QString &icon) +{ + d->mIconName = icon; + Q_EMIT iconNameChanged(); +} + +CalendarType Calendar::type() const +{ + return d->mType; +} + +void Calendar::setType(const CalendarType type) +{ + if (d->mType != type) { + d->mType = type; + Q_EMIT typeChanged(); + } +} diff --git a/src/calendar_p.h b/src/calendar_p.h --- a/src/calendar_p.h +++ b/src/calendar_p.h @@ -75,6 +75,10 @@ QMap mIncidenceRelations; bool batchAddingInProgress = false; bool mDeletionTracking = false; + QString mId; + QString mName; + QString mIconName; + CalendarType mType = ReadWrite; }; }