| 1 | /* |
|---|---|
| 2 | SPDX-FileCopyrightText: 2015 Martin Klapetek <mklapetek@kde.org> |
| 3 | |
| 4 | SPDX-License-Identifier: LGPL-2.0-or-later |
| 5 | */ |
| 6 | |
| 7 | #include "calendareventsplugin.h" |
| 8 | |
| 9 | #include <QSharedData> |
| 10 | |
| 11 | class CalendarEvents::EventData::Private : public QSharedData |
| 12 | { |
| 13 | public: |
| 14 | Private() |
| 15 | : isAllDay(false) |
| 16 | , isMinor(false) |
| 17 | { |
| 18 | } |
| 19 | Private(const Private &other) |
| 20 | : QSharedData(other) |
| 21 | { |
| 22 | startDateTime = other.startDateTime; |
| 23 | endDateTime = other.endDateTime; |
| 24 | title = other.title; |
| 25 | description = other.description; |
| 26 | uid = other.uid; |
| 27 | eventColor = other.eventColor; |
| 28 | type = other.type; |
| 29 | isAllDay = other.isAllDay; |
| 30 | isMinor = other.isMinor; |
| 31 | } |
| 32 | ~Private() |
| 33 | { |
| 34 | } |
| 35 | QDateTime startDateTime; // Start of the event |
| 36 | QDateTime endDateTime; // End of the event |
| 37 | QString title; // Title of the event |
| 38 | QString description; // Additional info of the event |
| 39 | QString uid; // An internal event id, useful mostly just for the eventModified/Removed signals |
| 40 | QString eventColor; // Optional color of the event in the HTML hex format, eg. #AARRGGBB or #RRGGBB |
| 41 | EventType type; // Type of the event |
| 42 | bool isAllDay; // True if the event takes all day, then it won't be displayed with any time |
| 43 | bool isMinor; // A minor holiday that will not create a colored entry in the calendar |
| 44 | }; |
| 45 | |
| 46 | //--------------------------------------------------- |
| 47 | |
| 48 | namespace CalendarEvents |
| 49 | { |
| 50 | EventData::EventData() |
| 51 | : d(new Private()) |
| 52 | { |
| 53 | } |
| 54 | |
| 55 | EventData::EventData(const EventData &other) |
| 56 | : d(other.d) |
| 57 | { |
| 58 | } |
| 59 | |
| 60 | EventData::~EventData() |
| 61 | { |
| 62 | } |
| 63 | |
| 64 | EventData &EventData::operator=(const EventData &other) |
| 65 | { |
| 66 | if (this == &other) { |
| 67 | return *this; |
| 68 | } |
| 69 | |
| 70 | d = other.d; |
| 71 | return *this; |
| 72 | } |
| 73 | |
| 74 | QDateTime EventData::startDateTime() const |
| 75 | { |
| 76 | return d->startDateTime; |
| 77 | } |
| 78 | |
| 79 | void EventData::setStartDateTime(const QDateTime &startDateTime) |
| 80 | { |
| 81 | d->startDateTime = startDateTime; |
| 82 | } |
| 83 | |
| 84 | QDateTime EventData::endDateTime() const |
| 85 | { |
| 86 | return d->endDateTime; |
| 87 | } |
| 88 | |
| 89 | void EventData::setEndDateTime(const QDateTime &endDateTime) |
| 90 | { |
| 91 | d->endDateTime = endDateTime; |
| 92 | } |
| 93 | |
| 94 | bool EventData::isAllDay() const |
| 95 | { |
| 96 | return d->isAllDay; |
| 97 | } |
| 98 | |
| 99 | void EventData::setIsAllDay(bool isAllDay) |
| 100 | { |
| 101 | d->isAllDay = isAllDay; |
| 102 | } |
| 103 | |
| 104 | bool EventData::isMinor() const |
| 105 | { |
| 106 | return d->isMinor; |
| 107 | } |
| 108 | |
| 109 | void EventData::setIsMinor(bool isMinor) |
| 110 | { |
| 111 | d->isMinor = isMinor; |
| 112 | } |
| 113 | |
| 114 | QString EventData::title() const |
| 115 | { |
| 116 | return d->title; |
| 117 | } |
| 118 | |
| 119 | void EventData::setTitle(const QString &title) |
| 120 | { |
| 121 | d->title = title; |
| 122 | } |
| 123 | |
| 124 | QString EventData::description() const |
| 125 | { |
| 126 | return d->description; |
| 127 | } |
| 128 | |
| 129 | void EventData::setDescription(const QString &description) |
| 130 | { |
| 131 | d->description = description; |
| 132 | } |
| 133 | |
| 134 | QString EventData::uid() const |
| 135 | { |
| 136 | return d->uid; |
| 137 | } |
| 138 | |
| 139 | void EventData::setUid(const QString &uid) |
| 140 | { |
| 141 | d->uid = uid; |
| 142 | } |
| 143 | |
| 144 | EventData::EventType EventData::type() const |
| 145 | { |
| 146 | return d->type; |
| 147 | } |
| 148 | |
| 149 | void EventData::setEventType(EventData::EventType type) |
| 150 | { |
| 151 | d->type = type; |
| 152 | } |
| 153 | |
| 154 | QString EventData::eventColor() const |
| 155 | { |
| 156 | return d->eventColor; |
| 157 | } |
| 158 | |
| 159 | void EventData::setEventColor(const QString &color) |
| 160 | { |
| 161 | d->eventColor = color; |
| 162 | } |
| 163 | |
| 164 | } |
| 165 |
