1 | /* |
2 | This file is part of KDE. |
3 | |
4 | SPDX-FileCopyrightText: 2009 Eckhart Wörner <ewoerner@kde.org> |
5 | |
6 | SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
7 | */ |
8 | |
9 | #include "event.h" |
10 | |
11 | using namespace Attica; |
12 | |
13 | class Q_DECL_HIDDEN Event::Private : public QSharedData |
14 | { |
15 | public: |
16 | QString m_id; |
17 | QString m_name; |
18 | QString m_description; |
19 | QString m_user; |
20 | QDate m_startDate; |
21 | QDate m_endDate; |
22 | qreal m_latitude; |
23 | qreal m_longitude; |
24 | QUrl m_homepage; |
25 | QString m_country; |
26 | QString m_city; |
27 | QMap<QString, QString> m_extendedAttributes; |
28 | |
29 | Private() |
30 | : m_latitude(0) |
31 | , m_longitude(0) |
32 | { |
33 | } |
34 | }; |
35 | |
36 | Event::Event() |
37 | : d(new Private) |
38 | { |
39 | } |
40 | |
41 | Event::Event(const Event &other) |
42 | : d(other.d) |
43 | { |
44 | } |
45 | |
46 | Event &Event::operator=(const Event &other) |
47 | { |
48 | d = other.d; |
49 | return *this; |
50 | } |
51 | |
52 | Event::~Event() |
53 | { |
54 | } |
55 | |
56 | void Event::setId(const QString &id) |
57 | { |
58 | d->m_id = id; |
59 | } |
60 | |
61 | QString Event::id() const |
62 | { |
63 | return d->m_id; |
64 | } |
65 | |
66 | void Event::setName(const QString &name) |
67 | { |
68 | d->m_name = name; |
69 | } |
70 | |
71 | QString Event::name() const |
72 | { |
73 | return d->m_name; |
74 | } |
75 | |
76 | void Event::setDescription(const QString &text) |
77 | { |
78 | d->m_description = text; |
79 | } |
80 | |
81 | QString Event::description() const |
82 | { |
83 | return d->m_description; |
84 | } |
85 | |
86 | void Event::setUser(const QString &id) |
87 | { |
88 | d->m_user = id; |
89 | } |
90 | |
91 | QString Event::user() const |
92 | { |
93 | return d->m_user; |
94 | } |
95 | |
96 | void Event::setStartDate(const QDate &date) |
97 | { |
98 | d->m_startDate = date; |
99 | } |
100 | |
101 | QDate Event::startDate() const |
102 | { |
103 | return d->m_startDate; |
104 | } |
105 | |
106 | void Event::setEndDate(const QDate &date) |
107 | { |
108 | d->m_endDate = date; |
109 | } |
110 | |
111 | QDate Event::endDate() const |
112 | { |
113 | return d->m_endDate; |
114 | } |
115 | |
116 | void Event::setLatitude(qreal lat) |
117 | { |
118 | d->m_latitude = lat; |
119 | } |
120 | |
121 | qreal Event::latitude() const |
122 | { |
123 | return d->m_latitude; |
124 | } |
125 | |
126 | void Event::setLongitude(qreal lon) |
127 | { |
128 | d->m_longitude = lon; |
129 | } |
130 | |
131 | qreal Event::longitude() const |
132 | { |
133 | return d->m_longitude; |
134 | } |
135 | |
136 | void Event::setHomepage(const QUrl &url) |
137 | { |
138 | d->m_homepage = url; |
139 | } |
140 | |
141 | QUrl Event::homepage() const |
142 | { |
143 | return d->m_homepage; |
144 | } |
145 | |
146 | void Event::setCountry(const QString &country) |
147 | { |
148 | d->m_country = country; |
149 | } |
150 | |
151 | QString Event::country() const |
152 | { |
153 | return d->m_country; |
154 | } |
155 | |
156 | void Event::setCity(const QString &city) |
157 | { |
158 | d->m_city = city; |
159 | } |
160 | |
161 | QString Event::city() const |
162 | { |
163 | return d->m_city; |
164 | } |
165 | |
166 | void Event::addExtendedAttribute(const QString &key, const QString &value) |
167 | { |
168 | d->m_extendedAttributes.insert(key, value); |
169 | } |
170 | |
171 | QString Event::extendedAttribute(const QString &key) const |
172 | { |
173 | return d->m_extendedAttributes.value(key); |
174 | } |
175 | |
176 | QMap<QString, QString> Event::extendedAttributes() const |
177 | { |
178 | return d->m_extendedAttributes; |
179 | } |
180 | |
181 | bool Event::isValid() const |
182 | { |
183 | return !(d->m_id.isEmpty()); |
184 | } |
185 | |