-rw-r--r-- | kabc/addressee.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index fb32f6e..7f04d8f 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp | |||
@@ -1,351 +1,352 @@ | |||
1 | /*** Warning! This file has been generated by the script makeaddressee ***/ | 1 | /*** Warning! This file has been generated by the script makeaddressee ***/ |
2 | /* | 2 | /* |
3 | This file is part of libkabc. | 3 | This file is part of libkabc. |
4 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either | 8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. |
10 | 10 | ||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | /* | 22 | /* |
23 | Enhanced Version of the file for platform independent KDE tools. | 23 | Enhanced Version of the file for platform independent KDE tools. |
24 | Copyright (c) 2004 Ulf Schenk | 24 | Copyright (c) 2004 Ulf Schenk |
25 | 25 | ||
26 | $Id$ | 26 | $Id$ |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <kconfig.h> | 29 | #include <kconfig.h> |
30 | 30 | ||
31 | #include <ksharedptr.h> | 31 | #include <ksharedptr.h> |
32 | #include <kdebug.h> | 32 | #include <kdebug.h> |
33 | #include <kapplication.h> | 33 | #include <kapplication.h> |
34 | #include <klocale.h> | 34 | #include <klocale.h> |
35 | #include <kidmanager.h> | 35 | #include <kidmanager.h> |
36 | //US | 36 | //US |
37 | #include <kstandarddirs.h> | 37 | #include <kstandarddirs.h> |
38 | #include <libkcal/syncdefines.h> | 38 | #include <libkcal/syncdefines.h> |
39 | 39 | ||
40 | //US #include "resource.h" | 40 | //US #include "resource.h" |
41 | #include "addressee.h" | 41 | #include "addressee.h" |
42 | 42 | ||
43 | using namespace KABC; | 43 | using namespace KABC; |
44 | 44 | ||
45 | static bool matchBinaryPattern( int value, int pattern ); | 45 | static bool matchBinaryPattern( int value, int pattern ); |
46 | 46 | ||
47 | struct Addressee::AddresseeData : public KShared | 47 | struct Addressee::AddresseeData : public KShared |
48 | { | 48 | { |
49 | QString uid; | 49 | QString uid; |
50 | QString name; | 50 | QString name; |
51 | QString formattedName; | 51 | QString formattedName; |
52 | QString familyName; | 52 | QString familyName; |
53 | QString givenName; | 53 | QString givenName; |
54 | QString additionalName; | 54 | QString additionalName; |
55 | QString prefix; | 55 | QString prefix; |
56 | QString suffix; | 56 | QString suffix; |
57 | QString nickName; | 57 | QString nickName; |
58 | QDateTime birthday; | 58 | QDateTime birthday; |
59 | QString mailer; | 59 | QString mailer; |
60 | TimeZone timeZone; | 60 | TimeZone timeZone; |
61 | Geo geo; | 61 | Geo geo; |
62 | QString title; | 62 | QString title; |
63 | QString role; | 63 | QString role; |
64 | QString organization; | 64 | QString organization; |
65 | QString note; | 65 | QString note; |
66 | QString productId; | 66 | QString productId; |
67 | QDateTime revision; | 67 | QDateTime revision; |
68 | QString sortString; | 68 | QString sortString; |
69 | KURL url; | 69 | KURL url; |
70 | Secrecy secrecy; | 70 | Secrecy secrecy; |
71 | Picture logo; | 71 | Picture logo; |
72 | Picture photo; | 72 | Picture photo; |
73 | Sound sound; | 73 | Sound sound; |
74 | Agent agent; | 74 | Agent agent; |
75 | QString mExternalId; | 75 | QString mExternalId; |
76 | PhoneNumber::List phoneNumbers; | 76 | PhoneNumber::List phoneNumbers; |
77 | Address::List addresses; | 77 | Address::List addresses; |
78 | Key::List keys; | 78 | Key::List keys; |
79 | QStringList emails; | 79 | QStringList emails; |
80 | QStringList categories; | 80 | QStringList categories; |
81 | QStringList custom; | 81 | QStringList custom; |
82 | 82 | ||
83 | Resource *resource; | 83 | Resource *resource; |
84 | 84 | ||
85 | bool empty :1; | 85 | bool empty :1; |
86 | bool changed :1; | 86 | bool changed :1; |
87 | }; | 87 | }; |
88 | 88 | ||
89 | Addressee::Addressee() | 89 | Addressee::Addressee() |
90 | { | 90 | { |
91 | mData = new AddresseeData; | 91 | mData = new AddresseeData; |
92 | mData->empty = true; | 92 | mData->empty = true; |
93 | mData->changed = false; | 93 | mData->changed = false; |
94 | mData->resource = 0; | 94 | mData->resource = 0; |
95 | mData->mExternalId = ":"; | 95 | mData->mExternalId = ":"; |
96 | mData->revision = QDateTime ( QDate( 2004,1,1)); | ||
96 | mTempSyncStat = SYNC_TEMPSTATE_INITIAL; | 97 | mTempSyncStat = SYNC_TEMPSTATE_INITIAL; |
97 | } | 98 | } |
98 | 99 | ||
99 | Addressee::~Addressee() | 100 | Addressee::~Addressee() |
100 | { | 101 | { |
101 | } | 102 | } |
102 | 103 | ||
103 | Addressee::Addressee( const Addressee &a ) | 104 | Addressee::Addressee( const Addressee &a ) |
104 | { | 105 | { |
105 | mData = a.mData; | 106 | mData = a.mData; |
106 | mTempSyncStat = SYNC_TEMPSTATE_INITIAL; | 107 | mTempSyncStat = SYNC_TEMPSTATE_INITIAL; |
107 | } | 108 | } |
108 | 109 | ||
109 | Addressee &Addressee::operator=( const Addressee &a ) | 110 | Addressee &Addressee::operator=( const Addressee &a ) |
110 | { | 111 | { |
111 | mData = a.mData; | 112 | mData = a.mData; |
112 | return (*this); | 113 | return (*this); |
113 | } | 114 | } |
114 | 115 | ||
115 | Addressee Addressee::copy() | 116 | Addressee Addressee::copy() |
116 | { | 117 | { |
117 | Addressee a; | 118 | Addressee a; |
118 | *(a.mData) = *mData; | 119 | *(a.mData) = *mData; |
119 | return a; | 120 | return a; |
120 | } | 121 | } |
121 | 122 | ||
122 | void Addressee::detach() | 123 | void Addressee::detach() |
123 | { | 124 | { |
124 | if ( mData.count() == 1 ) return; | 125 | if ( mData.count() == 1 ) return; |
125 | *this = copy(); | 126 | *this = copy(); |
126 | } | 127 | } |
127 | 128 | ||
128 | bool Addressee::operator==( const Addressee &a ) const | 129 | bool Addressee::operator==( const Addressee &a ) const |
129 | { | 130 | { |
130 | if ( uid() != a.uid() ) return false; | 131 | if ( uid() != a.uid() ) return false; |
131 | if ( mData->name != a.mData->name ) return false; | 132 | if ( mData->name != a.mData->name ) return false; |
132 | if ( mData->formattedName != a.mData->formattedName ) return false; | 133 | if ( mData->formattedName != a.mData->formattedName ) return false; |
133 | if ( mData->familyName != a.mData->familyName ) return false; | 134 | if ( mData->familyName != a.mData->familyName ) return false; |
134 | if ( mData->givenName != a.mData->givenName ) return false; | 135 | if ( mData->givenName != a.mData->givenName ) return false; |
135 | if ( mData->additionalName != a.mData->additionalName ) return false; | 136 | if ( mData->additionalName != a.mData->additionalName ) return false; |
136 | if ( mData->prefix != a.mData->prefix ) return false; | 137 | if ( mData->prefix != a.mData->prefix ) return false; |
137 | if ( mData->suffix != a.mData->suffix ) return false; | 138 | if ( mData->suffix != a.mData->suffix ) return false; |
138 | if ( mData->nickName != a.mData->nickName ) return false; | 139 | if ( mData->nickName != a.mData->nickName ) return false; |
139 | if ( mData->birthday != a.mData->birthday ) return false; | 140 | if ( mData->birthday != a.mData->birthday ) return false; |
140 | if ( mData->mailer != a.mData->mailer ) return false; | 141 | if ( mData->mailer != a.mData->mailer ) return false; |
141 | if ( mData->timeZone != a.mData->timeZone ) return false; | 142 | if ( mData->timeZone != a.mData->timeZone ) return false; |
142 | if ( mData->geo != a.mData->geo ) return false; | 143 | if ( mData->geo != a.mData->geo ) return false; |
143 | if ( mData->title != a.mData->title ) return false; | 144 | if ( mData->title != a.mData->title ) return false; |
144 | if ( mData->role != a.mData->role ) return false; | 145 | if ( mData->role != a.mData->role ) return false; |
145 | if ( mData->organization != a.mData->organization ) return false; | 146 | if ( mData->organization != a.mData->organization ) return false; |
146 | if ( mData->note != a.mData->note ) return false; | 147 | if ( mData->note != a.mData->note ) return false; |
147 | if ( mData->productId != a.mData->productId ) return false; | 148 | if ( mData->productId != a.mData->productId ) return false; |
148 | if ( mData->revision != a.mData->revision ) return false; | 149 | if ( mData->revision != a.mData->revision ) return false; |
149 | if ( mData->sortString != a.mData->sortString ) return false; | 150 | if ( mData->sortString != a.mData->sortString ) return false; |
150 | if ( mData->secrecy != a.mData->secrecy ) return false; | 151 | if ( mData->secrecy != a.mData->secrecy ) return false; |
151 | if ( mData->logo != a.mData->logo ) return false; | 152 | if ( mData->logo != a.mData->logo ) return false; |
152 | if ( mData->photo != a.mData->photo ) return false; | 153 | if ( mData->photo != a.mData->photo ) return false; |
153 | if ( mData->sound != a.mData->sound ) return false; | 154 | if ( mData->sound != a.mData->sound ) return false; |
154 | if ( mData->agent != a.mData->agent ) return false; | 155 | if ( mData->agent != a.mData->agent ) return false; |
155 | if ( ( mData->url.isValid() || a.mData->url.isValid() ) && | 156 | if ( ( mData->url.isValid() || a.mData->url.isValid() ) && |
156 | ( mData->url != a.mData->url ) ) return false; | 157 | ( mData->url != a.mData->url ) ) return false; |
157 | if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false; | 158 | if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false; |
158 | if ( mData->addresses != a.mData->addresses ) return false; | 159 | if ( mData->addresses != a.mData->addresses ) return false; |
159 | if ( mData->keys != a.mData->keys ) return false; | 160 | if ( mData->keys != a.mData->keys ) return false; |
160 | if ( mData->emails != a.mData->emails ) return false; | 161 | if ( mData->emails != a.mData->emails ) return false; |
161 | if ( mData->categories != a.mData->categories ) return false; | 162 | if ( mData->categories != a.mData->categories ) return false; |
162 | if ( mData->custom != a.mData->custom ) return false; | 163 | if ( mData->custom != a.mData->custom ) return false; |
163 | 164 | ||
164 | return true; | 165 | return true; |
165 | } | 166 | } |
166 | 167 | ||
167 | bool Addressee::operator!=( const Addressee &a ) const | 168 | bool Addressee::operator!=( const Addressee &a ) const |
168 | { | 169 | { |
169 | return !( a == *this ); | 170 | return !( a == *this ); |
170 | } | 171 | } |
171 | 172 | ||
172 | bool Addressee::isEmpty() const | 173 | bool Addressee::isEmpty() const |
173 | { | 174 | { |
174 | return mData->empty; | 175 | return mData->empty; |
175 | } | 176 | } |
176 | void Addressee::removeID(const QString &prof) | 177 | void Addressee::removeID(const QString &prof) |
177 | { | 178 | { |
178 | detach(); | 179 | detach(); |
179 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); | 180 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); |
180 | 181 | ||
181 | } | 182 | } |
182 | void Addressee::setID( const QString & prof , const QString & id ) | 183 | void Addressee::setID( const QString & prof , const QString & id ) |
183 | { | 184 | { |
184 | detach(); | 185 | detach(); |
185 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); | 186 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); |
186 | } | 187 | } |
187 | void Addressee::setTempSyncStat( int id ) | 188 | void Addressee::setTempSyncStat( int id ) |
188 | { | 189 | { |
189 | mTempSyncStat = id; | 190 | mTempSyncStat = id; |
190 | } | 191 | } |
191 | int Addressee::tempSyncStat() const | 192 | int Addressee::tempSyncStat() const |
192 | { | 193 | { |
193 | return mTempSyncStat; | 194 | return mTempSyncStat; |
194 | } | 195 | } |
195 | 196 | ||
196 | QString Addressee::getID( const QString & prof) | 197 | QString Addressee::getID( const QString & prof) |
197 | { | 198 | { |
198 | return KIdManager::getId ( mData->mExternalId, prof ); | 199 | return KIdManager::getId ( mData->mExternalId, prof ); |
199 | } | 200 | } |
200 | 201 | ||
201 | void Addressee::setCsum( const QString & prof , const QString & id ) | 202 | void Addressee::setCsum( const QString & prof , const QString & id ) |
202 | { | 203 | { |
203 | detach(); | 204 | detach(); |
204 | mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); | 205 | mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); |
205 | } | 206 | } |
206 | 207 | ||
207 | QString Addressee::getCsum( const QString & prof) | 208 | QString Addressee::getCsum( const QString & prof) |
208 | { | 209 | { |
209 | return KIdManager::getCsum ( mData->mExternalId, prof ); | 210 | return KIdManager::getCsum ( mData->mExternalId, prof ); |
210 | } | 211 | } |
211 | 212 | ||
212 | void Addressee::setIDStr( const QString & s ) | 213 | void Addressee::setIDStr( const QString & s ) |
213 | { | 214 | { |
214 | detach(); | 215 | detach(); |
215 | mData->mExternalId = s; | 216 | mData->mExternalId = s; |
216 | } | 217 | } |
217 | 218 | ||
218 | QString Addressee::IDStr() const | 219 | QString Addressee::IDStr() const |
219 | { | 220 | { |
220 | return mData->mExternalId; | 221 | return mData->mExternalId; |
221 | } | 222 | } |
222 | 223 | ||
223 | 224 | ||
224 | void Addressee::setUid( const QString &id ) | 225 | void Addressee::setUid( const QString &id ) |
225 | { | 226 | { |
226 | if ( id == mData->uid ) return; | 227 | if ( id == mData->uid ) return; |
227 | detach(); | 228 | detach(); |
228 | mData->empty = false; | 229 | mData->empty = false; |
229 | mData->uid = id; | 230 | mData->uid = id; |
230 | } | 231 | } |
231 | 232 | ||
232 | QString Addressee::uid() const | 233 | QString Addressee::uid() const |
233 | { | 234 | { |
234 | if ( mData->uid.isEmpty() ) | 235 | if ( mData->uid.isEmpty() ) |
235 | mData->uid = KApplication::randomString( 10 ); | 236 | mData->uid = KApplication::randomString( 10 ); |
236 | 237 | ||
237 | return mData->uid; | 238 | return mData->uid; |
238 | } | 239 | } |
239 | 240 | ||
240 | QString Addressee::uidLabel() | 241 | QString Addressee::uidLabel() |
241 | { | 242 | { |
242 | return i18n("Unique Identifier"); | 243 | return i18n("Unique Identifier"); |
243 | } | 244 | } |
244 | 245 | ||
245 | void Addressee::setName( const QString &name ) | 246 | void Addressee::setName( const QString &name ) |
246 | { | 247 | { |
247 | if ( name == mData->name ) return; | 248 | if ( name == mData->name ) return; |
248 | detach(); | 249 | detach(); |
249 | mData->empty = false; | 250 | mData->empty = false; |
250 | mData->name = name; | 251 | mData->name = name; |
251 | } | 252 | } |
252 | 253 | ||
253 | QString Addressee::name() const | 254 | QString Addressee::name() const |
254 | { | 255 | { |
255 | return mData->name; | 256 | return mData->name; |
256 | } | 257 | } |
257 | 258 | ||
258 | QString Addressee::nameLabel() | 259 | QString Addressee::nameLabel() |
259 | { | 260 | { |
260 | return i18n("Name"); | 261 | return i18n("Name"); |
261 | } | 262 | } |
262 | 263 | ||
263 | 264 | ||
264 | void Addressee::setFormattedName( const QString &formattedName ) | 265 | void Addressee::setFormattedName( const QString &formattedName ) |
265 | { | 266 | { |
266 | if ( formattedName == mData->formattedName ) return; | 267 | if ( formattedName == mData->formattedName ) return; |
267 | detach(); | 268 | detach(); |
268 | mData->empty = false; | 269 | mData->empty = false; |
269 | mData->formattedName = formattedName; | 270 | mData->formattedName = formattedName; |
270 | } | 271 | } |
271 | 272 | ||
272 | QString Addressee::formattedName() const | 273 | QString Addressee::formattedName() const |
273 | { | 274 | { |
274 | return mData->formattedName; | 275 | return mData->formattedName; |
275 | } | 276 | } |
276 | 277 | ||
277 | QString Addressee::formattedNameLabel() | 278 | QString Addressee::formattedNameLabel() |
278 | { | 279 | { |
279 | return i18n("Formatted Name"); | 280 | return i18n("Formatted Name"); |
280 | } | 281 | } |
281 | 282 | ||
282 | 283 | ||
283 | void Addressee::setFamilyName( const QString &familyName ) | 284 | void Addressee::setFamilyName( const QString &familyName ) |
284 | { | 285 | { |
285 | if ( familyName == mData->familyName ) return; | 286 | if ( familyName == mData->familyName ) return; |
286 | detach(); | 287 | detach(); |
287 | mData->empty = false; | 288 | mData->empty = false; |
288 | mData->familyName = familyName; | 289 | mData->familyName = familyName; |
289 | } | 290 | } |
290 | 291 | ||
291 | QString Addressee::familyName() const | 292 | QString Addressee::familyName() const |
292 | { | 293 | { |
293 | return mData->familyName; | 294 | return mData->familyName; |
294 | } | 295 | } |
295 | 296 | ||
296 | QString Addressee::familyNameLabel() | 297 | QString Addressee::familyNameLabel() |
297 | { | 298 | { |
298 | return i18n("Family Name"); | 299 | return i18n("Family Name"); |
299 | } | 300 | } |
300 | 301 | ||
301 | 302 | ||
302 | void Addressee::setGivenName( const QString &givenName ) | 303 | void Addressee::setGivenName( const QString &givenName ) |
303 | { | 304 | { |
304 | if ( givenName == mData->givenName ) return; | 305 | if ( givenName == mData->givenName ) return; |
305 | detach(); | 306 | detach(); |
306 | mData->empty = false; | 307 | mData->empty = false; |
307 | mData->givenName = givenName; | 308 | mData->givenName = givenName; |
308 | } | 309 | } |
309 | 310 | ||
310 | QString Addressee::givenName() const | 311 | QString Addressee::givenName() const |
311 | { | 312 | { |
312 | return mData->givenName; | 313 | return mData->givenName; |
313 | } | 314 | } |
314 | 315 | ||
315 | QString Addressee::givenNameLabel() | 316 | QString Addressee::givenNameLabel() |
316 | { | 317 | { |
317 | return i18n("Given Name"); | 318 | return i18n("Given Name"); |
318 | } | 319 | } |
319 | 320 | ||
320 | 321 | ||
321 | void Addressee::setAdditionalName( const QString &additionalName ) | 322 | void Addressee::setAdditionalName( const QString &additionalName ) |
322 | { | 323 | { |
323 | if ( additionalName == mData->additionalName ) return; | 324 | if ( additionalName == mData->additionalName ) return; |
324 | detach(); | 325 | detach(); |
325 | mData->empty = false; | 326 | mData->empty = false; |
326 | mData->additionalName = additionalName; | 327 | mData->additionalName = additionalName; |
327 | } | 328 | } |
328 | 329 | ||
329 | QString Addressee::additionalName() const | 330 | QString Addressee::additionalName() const |
330 | { | 331 | { |
331 | return mData->additionalName; | 332 | return mData->additionalName; |
332 | } | 333 | } |
333 | 334 | ||
334 | QString Addressee::additionalNameLabel() | 335 | QString Addressee::additionalNameLabel() |
335 | { | 336 | { |
336 | return i18n("Additional Names"); | 337 | return i18n("Additional Names"); |
337 | } | 338 | } |
338 | 339 | ||
339 | 340 | ||
340 | void Addressee::setPrefix( const QString &prefix ) | 341 | void Addressee::setPrefix( const QString &prefix ) |
341 | { | 342 | { |
342 | if ( prefix == mData->prefix ) return; | 343 | if ( prefix == mData->prefix ) return; |
343 | detach(); | 344 | detach(); |
344 | mData->empty = false; | 345 | mData->empty = false; |
345 | mData->prefix = prefix; | 346 | mData->prefix = prefix; |
346 | } | 347 | } |
347 | 348 | ||
348 | QString Addressee::prefix() const | 349 | QString Addressee::prefix() const |
349 | { | 350 | { |
350 | return mData->prefix; | 351 | return mData->prefix; |
351 | } | 352 | } |