File indexing completed on 2024-05-05 16:07:09

0001 /*
0002     SPDX-FileCopyrightText: 2015 Martin Klapetek <mklapetek@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "calendareventsplugin.h"
0008 
0009 #include <QSharedData>
0010 
0011 class CalendarEvents::EventData::Private : public QSharedData
0012 {
0013 public:
0014     Private()
0015         : isAllDay(false)
0016         , isMinor(false)
0017     {
0018     }
0019     Private(const Private &other)
0020         : QSharedData(other)
0021     {
0022         startDateTime = other.startDateTime;
0023         endDateTime = other.endDateTime;
0024         title = other.title;
0025         description = other.description;
0026         uid = other.uid;
0027         eventColor = other.eventColor;
0028         type = other.type;
0029         isAllDay = other.isAllDay;
0030         isMinor = other.isMinor;
0031     }
0032     ~Private()
0033     {
0034     }
0035     QDateTime startDateTime; // Start of the event
0036     QDateTime endDateTime; // End of the event
0037     QString title; // Title of the event
0038     QString description; // Additional info of the event
0039     QString uid; // An internal event id, useful mostly just for the eventModified/Removed signals
0040     QString eventColor; // Optional color of the event in the HTML hex format, eg. #AARRGGBB or #RRGGBB
0041     EventType type; // Type of the event
0042     bool isAllDay; // True if the event takes all day, then it won't be displayed with any time
0043     bool isMinor; // A minor holiday that will not create a colored entry in the calendar
0044 };
0045 
0046 //---------------------------------------------------
0047 
0048 namespace CalendarEvents
0049 {
0050 EventData::EventData()
0051     : d(new Private())
0052 {
0053 }
0054 
0055 EventData::EventData(const EventData &other)
0056     : d(other.d)
0057 {
0058 }
0059 
0060 EventData::~EventData()
0061 {
0062 }
0063 
0064 EventData &EventData::operator=(const EventData &other)
0065 {
0066     if (this == &other) {
0067         return *this;
0068     }
0069 
0070     d = other.d;
0071     return *this;
0072 }
0073 
0074 QDateTime EventData::startDateTime() const
0075 {
0076     return d->startDateTime;
0077 }
0078 
0079 void EventData::setStartDateTime(const QDateTime &startDateTime)
0080 {
0081     d->startDateTime = startDateTime;
0082 }
0083 
0084 QDateTime EventData::endDateTime() const
0085 {
0086     return d->endDateTime;
0087 }
0088 
0089 void EventData::setEndDateTime(const QDateTime &endDateTime)
0090 {
0091     d->endDateTime = endDateTime;
0092 }
0093 
0094 bool EventData::isAllDay() const
0095 {
0096     return d->isAllDay;
0097 }
0098 
0099 void EventData::setIsAllDay(bool isAllDay)
0100 {
0101     d->isAllDay = isAllDay;
0102 }
0103 
0104 bool EventData::isMinor() const
0105 {
0106     return d->isMinor;
0107 }
0108 
0109 void EventData::setIsMinor(bool isMinor)
0110 {
0111     d->isMinor = isMinor;
0112 }
0113 
0114 QString EventData::title() const
0115 {
0116     return d->title;
0117 }
0118 
0119 void EventData::setTitle(const QString &title)
0120 {
0121     d->title = title;
0122 }
0123 
0124 QString EventData::description() const
0125 {
0126     return d->description;
0127 }
0128 
0129 void EventData::setDescription(const QString &description)
0130 {
0131     d->description = description;
0132 }
0133 
0134 QString EventData::uid() const
0135 {
0136     return d->uid;
0137 }
0138 
0139 void EventData::setUid(const QString &uid)
0140 {
0141     d->uid = uid;
0142 }
0143 
0144 EventData::EventType EventData::type() const
0145 {
0146     return d->type;
0147 }
0148 
0149 void EventData::setEventType(EventData::EventType type)
0150 {
0151     d->type = type;
0152 }
0153 
0154 QString EventData::eventColor() const
0155 {
0156     return d->eventColor;
0157 }
0158 
0159 void EventData::setEventColor(const QString &color)
0160 {
0161     d->eventColor = color;
0162 }
0163 
0164 }