File indexing completed on 2024-12-08 03:37:11

0001 /*
0002     This file is part of KDE.
0003 
0004     SPDX-FileCopyrightText: 2009 Eckhart Wörner <ewoerner@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007 */
0008 
0009 #include "event.h"
0010 
0011 using namespace Attica;
0012 
0013 class Q_DECL_HIDDEN Event::Private : public QSharedData
0014 {
0015 public:
0016     QString m_id;
0017     QString m_name;
0018     QString m_description;
0019     QString m_user;
0020     QDate m_startDate;
0021     QDate m_endDate;
0022     qreal m_latitude;
0023     qreal m_longitude;
0024     QUrl m_homepage;
0025     QString m_country;
0026     QString m_city;
0027     QMap<QString, QString> m_extendedAttributes;
0028 
0029     Private()
0030         : m_latitude(0)
0031         , m_longitude(0)
0032     {
0033     }
0034 };
0035 
0036 Event::Event()
0037     : d(new Private)
0038 {
0039 }
0040 
0041 Event::Event(const Event &other)
0042     : d(other.d)
0043 {
0044 }
0045 
0046 Event &Event::operator=(const Event &other)
0047 {
0048     d = other.d;
0049     return *this;
0050 }
0051 
0052 Event::~Event()
0053 {
0054 }
0055 
0056 void Event::setId(const QString &id)
0057 {
0058     d->m_id = id;
0059 }
0060 
0061 QString Event::id() const
0062 {
0063     return d->m_id;
0064 }
0065 
0066 void Event::setName(const QString &name)
0067 {
0068     d->m_name = name;
0069 }
0070 
0071 QString Event::name() const
0072 {
0073     return d->m_name;
0074 }
0075 
0076 void Event::setDescription(const QString &text)
0077 {
0078     d->m_description = text;
0079 }
0080 
0081 QString Event::description() const
0082 {
0083     return d->m_description;
0084 }
0085 
0086 void Event::setUser(const QString &id)
0087 {
0088     d->m_user = id;
0089 }
0090 
0091 QString Event::user() const
0092 {
0093     return d->m_user;
0094 }
0095 
0096 void Event::setStartDate(const QDate &date)
0097 {
0098     d->m_startDate = date;
0099 }
0100 
0101 QDate Event::startDate() const
0102 {
0103     return d->m_startDate;
0104 }
0105 
0106 void Event::setEndDate(const QDate &date)
0107 {
0108     d->m_endDate = date;
0109 }
0110 
0111 QDate Event::endDate() const
0112 {
0113     return d->m_endDate;
0114 }
0115 
0116 void Event::setLatitude(qreal lat)
0117 {
0118     d->m_latitude = lat;
0119 }
0120 
0121 qreal Event::latitude() const
0122 {
0123     return d->m_latitude;
0124 }
0125 
0126 void Event::setLongitude(qreal lon)
0127 {
0128     d->m_longitude = lon;
0129 }
0130 
0131 qreal Event::longitude() const
0132 {
0133     return d->m_longitude;
0134 }
0135 
0136 void Event::setHomepage(const QUrl &url)
0137 {
0138     d->m_homepage = url;
0139 }
0140 
0141 QUrl Event::homepage() const
0142 {
0143     return d->m_homepage;
0144 }
0145 
0146 void Event::setCountry(const QString &country)
0147 {
0148     d->m_country = country;
0149 }
0150 
0151 QString Event::country() const
0152 {
0153     return d->m_country;
0154 }
0155 
0156 void Event::setCity(const QString &city)
0157 {
0158     d->m_city = city;
0159 }
0160 
0161 QString Event::city() const
0162 {
0163     return d->m_city;
0164 }
0165 
0166 void Event::addExtendedAttribute(const QString &key, const QString &value)
0167 {
0168     d->m_extendedAttributes.insert(key, value);
0169 }
0170 
0171 QString Event::extendedAttribute(const QString &key) const
0172 {
0173     return d->m_extendedAttributes.value(key);
0174 }
0175 
0176 QMap<QString, QString> Event::extendedAttributes() const
0177 {
0178     return d->m_extendedAttributes;
0179 }
0180 
0181 bool Event::isValid() const
0182 {
0183     return !(d->m_id.isEmpty());
0184 }