-rw-r--r-- | kabc/addressee.cpp | 62 |
1 files changed, 33 insertions, 29 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index 6b282e2..4cdd5e5 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp | |||
@@ -36,1565 +36,1569 @@ $Id$ | |||
36 | #include <kstandarddirs.h> | 36 | #include <kstandarddirs.h> |
37 | 37 | ||
38 | //US #include "resource.h" | 38 | //US #include "resource.h" |
39 | #include "addressee.h" | 39 | #include "addressee.h" |
40 | 40 | ||
41 | using namespace KABC; | 41 | using namespace KABC; |
42 | 42 | ||
43 | static bool matchBinaryPattern( int value, int pattern ); | 43 | static bool matchBinaryPattern( int value, int pattern ); |
44 | 44 | ||
45 | struct Addressee::AddresseeData : public KShared | 45 | struct Addressee::AddresseeData : public KShared |
46 | { | 46 | { |
47 | QString uid; | 47 | QString uid; |
48 | QString name; | 48 | QString name; |
49 | QString formattedName; | 49 | QString formattedName; |
50 | QString familyName; | 50 | QString familyName; |
51 | QString givenName; | 51 | QString givenName; |
52 | QString additionalName; | 52 | QString additionalName; |
53 | QString prefix; | 53 | QString prefix; |
54 | QString suffix; | 54 | QString suffix; |
55 | QString nickName; | 55 | QString nickName; |
56 | QDateTime birthday; | 56 | QDateTime birthday; |
57 | QString mailer; | 57 | QString mailer; |
58 | TimeZone timeZone; | 58 | TimeZone timeZone; |
59 | Geo geo; | 59 | Geo geo; |
60 | QString title; | 60 | QString title; |
61 | QString role; | 61 | QString role; |
62 | QString organization; | 62 | QString organization; |
63 | QString note; | 63 | QString note; |
64 | QString productId; | 64 | QString productId; |
65 | QDateTime revision; | 65 | QDateTime revision; |
66 | QString sortString; | 66 | QString sortString; |
67 | KURL url; | 67 | KURL url; |
68 | Secrecy secrecy; | 68 | Secrecy secrecy; |
69 | Picture logo; | 69 | Picture logo; |
70 | Picture photo; | 70 | Picture photo; |
71 | Sound sound; | 71 | Sound sound; |
72 | Agent agent; | 72 | Agent agent; |
73 | 73 | ||
74 | PhoneNumber::List phoneNumbers; | 74 | PhoneNumber::List phoneNumbers; |
75 | Address::List addresses; | 75 | Address::List addresses; |
76 | Key::List keys; | 76 | Key::List keys; |
77 | QStringList emails; | 77 | QStringList emails; |
78 | QStringList categories; | 78 | QStringList categories; |
79 | QStringList custom; | 79 | QStringList custom; |
80 | 80 | ||
81 | Resource *resource; | 81 | Resource *resource; |
82 | 82 | ||
83 | bool empty :1; | 83 | bool empty :1; |
84 | bool changed :1; | 84 | bool changed :1; |
85 | }; | 85 | }; |
86 | 86 | ||
87 | Addressee::Addressee() | 87 | Addressee::Addressee() |
88 | { | 88 | { |
89 | mData = new AddresseeData; | 89 | mData = new AddresseeData; |
90 | mData->empty = true; | 90 | mData->empty = true; |
91 | mData->changed = false; | 91 | mData->changed = false; |
92 | mData->resource = 0; | 92 | mData->resource = 0; |
93 | } | 93 | } |
94 | 94 | ||
95 | Addressee::~Addressee() | 95 | Addressee::~Addressee() |
96 | { | 96 | { |
97 | } | 97 | } |
98 | 98 | ||
99 | Addressee::Addressee( const Addressee &a ) | 99 | Addressee::Addressee( const Addressee &a ) |
100 | { | 100 | { |
101 | mData = a.mData; | 101 | mData = a.mData; |
102 | } | 102 | } |
103 | 103 | ||
104 | Addressee &Addressee::operator=( const Addressee &a ) | 104 | Addressee &Addressee::operator=( const Addressee &a ) |
105 | { | 105 | { |
106 | mData = a.mData; | 106 | mData = a.mData; |
107 | return (*this); | 107 | return (*this); |
108 | } | 108 | } |
109 | 109 | ||
110 | Addressee Addressee::copy() | 110 | Addressee Addressee::copy() |
111 | { | 111 | { |
112 | Addressee a; | 112 | Addressee a; |
113 | *(a.mData) = *mData; | 113 | *(a.mData) = *mData; |
114 | return a; | 114 | return a; |
115 | } | 115 | } |
116 | 116 | ||
117 | void Addressee::detach() | 117 | void Addressee::detach() |
118 | { | 118 | { |
119 | if ( mData.count() == 1 ) return; | 119 | if ( mData.count() == 1 ) return; |
120 | *this = copy(); | 120 | *this = copy(); |
121 | } | 121 | } |
122 | 122 | ||
123 | bool Addressee::operator==( const Addressee &a ) const | 123 | bool Addressee::operator==( const Addressee &a ) const |
124 | { | 124 | { |
125 | if ( uid() != a.uid() ) return false; | 125 | if ( uid() != a.uid() ) return false; |
126 | if ( mData->name != a.mData->name ) return false; | 126 | if ( mData->name != a.mData->name ) return false; |
127 | if ( mData->formattedName != a.mData->formattedName ) return false; | 127 | if ( mData->formattedName != a.mData->formattedName ) return false; |
128 | if ( mData->familyName != a.mData->familyName ) return false; | 128 | if ( mData->familyName != a.mData->familyName ) return false; |
129 | if ( mData->givenName != a.mData->givenName ) return false; | 129 | if ( mData->givenName != a.mData->givenName ) return false; |
130 | if ( mData->additionalName != a.mData->additionalName ) return false; | 130 | if ( mData->additionalName != a.mData->additionalName ) return false; |
131 | if ( mData->prefix != a.mData->prefix ) return false; | 131 | if ( mData->prefix != a.mData->prefix ) return false; |
132 | if ( mData->suffix != a.mData->suffix ) return false; | 132 | if ( mData->suffix != a.mData->suffix ) return false; |
133 | if ( mData->nickName != a.mData->nickName ) return false; | 133 | if ( mData->nickName != a.mData->nickName ) return false; |
134 | if ( mData->birthday != a.mData->birthday ) return false; | 134 | if ( mData->birthday != a.mData->birthday ) return false; |
135 | if ( mData->mailer != a.mData->mailer ) return false; | 135 | if ( mData->mailer != a.mData->mailer ) return false; |
136 | if ( mData->timeZone != a.mData->timeZone ) return false; | 136 | if ( mData->timeZone != a.mData->timeZone ) return false; |
137 | if ( mData->geo != a.mData->geo ) return false; | 137 | if ( mData->geo != a.mData->geo ) return false; |
138 | if ( mData->title != a.mData->title ) return false; | 138 | if ( mData->title != a.mData->title ) return false; |
139 | if ( mData->role != a.mData->role ) return false; | 139 | if ( mData->role != a.mData->role ) return false; |
140 | if ( mData->organization != a.mData->organization ) return false; | 140 | if ( mData->organization != a.mData->organization ) return false; |
141 | if ( mData->note != a.mData->note ) return false; | 141 | if ( mData->note != a.mData->note ) return false; |
142 | if ( mData->productId != a.mData->productId ) return false; | 142 | if ( mData->productId != a.mData->productId ) return false; |
143 | if ( mData->revision != a.mData->revision ) return false; | 143 | if ( mData->revision != a.mData->revision ) return false; |
144 | if ( mData->sortString != a.mData->sortString ) return false; | 144 | if ( mData->sortString != a.mData->sortString ) return false; |
145 | if ( mData->secrecy != a.mData->secrecy ) return false; | 145 | if ( mData->secrecy != a.mData->secrecy ) return false; |
146 | if ( mData->logo != a.mData->logo ) return false; | 146 | if ( mData->logo != a.mData->logo ) return false; |
147 | if ( mData->photo != a.mData->photo ) return false; | 147 | if ( mData->photo != a.mData->photo ) return false; |
148 | if ( mData->sound != a.mData->sound ) return false; | 148 | if ( mData->sound != a.mData->sound ) return false; |
149 | if ( mData->agent != a.mData->agent ) return false; | 149 | if ( mData->agent != a.mData->agent ) return false; |
150 | if ( ( mData->url.isValid() || a.mData->url.isValid() ) && | 150 | if ( ( mData->url.isValid() || a.mData->url.isValid() ) && |
151 | ( mData->url != a.mData->url ) ) return false; | 151 | ( mData->url != a.mData->url ) ) return false; |
152 | if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false; | 152 | if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false; |
153 | if ( mData->addresses != a.mData->addresses ) return false; | 153 | if ( mData->addresses != a.mData->addresses ) return false; |
154 | if ( mData->keys != a.mData->keys ) return false; | 154 | if ( mData->keys != a.mData->keys ) return false; |
155 | if ( mData->emails != a.mData->emails ) return false; | 155 | if ( mData->emails != a.mData->emails ) return false; |
156 | if ( mData->categories != a.mData->categories ) return false; | 156 | if ( mData->categories != a.mData->categories ) return false; |
157 | if ( mData->custom != a.mData->custom ) return false; | 157 | if ( mData->custom != a.mData->custom ) return false; |
158 | 158 | ||
159 | return true; | 159 | return true; |
160 | } | 160 | } |
161 | 161 | ||
162 | bool Addressee::operator!=( const Addressee &a ) const | 162 | bool Addressee::operator!=( const Addressee &a ) const |
163 | { | 163 | { |
164 | return !( a == *this ); | 164 | return !( a == *this ); |
165 | } | 165 | } |
166 | 166 | ||
167 | bool Addressee::isEmpty() const | 167 | bool Addressee::isEmpty() const |
168 | { | 168 | { |
169 | return mData->empty; | 169 | return mData->empty; |
170 | } | 170 | } |
171 | 171 | ||
172 | void Addressee::setUid( const QString &id ) | 172 | void Addressee::setUid( const QString &id ) |
173 | { | 173 | { |
174 | if ( id == mData->uid ) return; | 174 | if ( id == mData->uid ) return; |
175 | detach(); | 175 | detach(); |
176 | mData->empty = false; | 176 | mData->empty = false; |
177 | mData->uid = id; | 177 | mData->uid = id; |
178 | } | 178 | } |
179 | 179 | ||
180 | QString Addressee::uid() const | 180 | QString Addressee::uid() const |
181 | { | 181 | { |
182 | if ( mData->uid.isEmpty() ) | 182 | if ( mData->uid.isEmpty() ) |
183 | mData->uid = KApplication::randomString( 10 ); | 183 | mData->uid = KApplication::randomString( 10 ); |
184 | 184 | ||
185 | return mData->uid; | 185 | return mData->uid; |
186 | } | 186 | } |
187 | 187 | ||
188 | QString Addressee::uidLabel() | 188 | QString Addressee::uidLabel() |
189 | { | 189 | { |
190 | return i18n("Unique Identifier"); | 190 | return i18n("Unique Identifier"); |
191 | } | 191 | } |
192 | 192 | ||
193 | void Addressee::setName( const QString &name ) | 193 | void Addressee::setName( const QString &name ) |
194 | { | 194 | { |
195 | if ( name == mData->name ) return; | 195 | if ( name == mData->name ) return; |
196 | detach(); | 196 | detach(); |
197 | mData->empty = false; | 197 | mData->empty = false; |
198 | mData->name = name; | 198 | mData->name = name; |
199 | } | 199 | } |
200 | 200 | ||
201 | QString Addressee::name() const | 201 | QString Addressee::name() const |
202 | { | 202 | { |
203 | return mData->name; | 203 | return mData->name; |
204 | } | 204 | } |
205 | 205 | ||
206 | QString Addressee::nameLabel() | 206 | QString Addressee::nameLabel() |
207 | { | 207 | { |
208 | return i18n("Name"); | 208 | return i18n("Name"); |
209 | } | 209 | } |
210 | 210 | ||
211 | 211 | ||
212 | void Addressee::setFormattedName( const QString &formattedName ) | 212 | void Addressee::setFormattedName( const QString &formattedName ) |
213 | { | 213 | { |
214 | if ( formattedName == mData->formattedName ) return; | 214 | if ( formattedName == mData->formattedName ) return; |
215 | detach(); | 215 | detach(); |
216 | mData->empty = false; | 216 | mData->empty = false; |
217 | mData->formattedName = formattedName; | 217 | mData->formattedName = formattedName; |
218 | } | 218 | } |
219 | 219 | ||
220 | QString Addressee::formattedName() const | 220 | QString Addressee::formattedName() const |
221 | { | 221 | { |
222 | return mData->formattedName; | 222 | return mData->formattedName; |
223 | } | 223 | } |
224 | 224 | ||
225 | QString Addressee::formattedNameLabel() | 225 | QString Addressee::formattedNameLabel() |
226 | { | 226 | { |
227 | return i18n("Formatted Name"); | 227 | return i18n("Formatted Name"); |
228 | } | 228 | } |
229 | 229 | ||
230 | 230 | ||
231 | void Addressee::setFamilyName( const QString &familyName ) | 231 | void Addressee::setFamilyName( const QString &familyName ) |
232 | { | 232 | { |
233 | if ( familyName == mData->familyName ) return; | 233 | if ( familyName == mData->familyName ) return; |
234 | detach(); | 234 | detach(); |
235 | mData->empty = false; | 235 | mData->empty = false; |
236 | mData->familyName = familyName; | 236 | mData->familyName = familyName; |
237 | } | 237 | } |
238 | 238 | ||
239 | QString Addressee::familyName() const | 239 | QString Addressee::familyName() const |
240 | { | 240 | { |
241 | return mData->familyName; | 241 | return mData->familyName; |
242 | } | 242 | } |
243 | 243 | ||
244 | QString Addressee::familyNameLabel() | 244 | QString Addressee::familyNameLabel() |
245 | { | 245 | { |
246 | return i18n("Family Name"); | 246 | return i18n("Family Name"); |
247 | } | 247 | } |
248 | 248 | ||
249 | 249 | ||
250 | void Addressee::setGivenName( const QString &givenName ) | 250 | void Addressee::setGivenName( const QString &givenName ) |
251 | { | 251 | { |
252 | if ( givenName == mData->givenName ) return; | 252 | if ( givenName == mData->givenName ) return; |
253 | detach(); | 253 | detach(); |
254 | mData->empty = false; | 254 | mData->empty = false; |
255 | mData->givenName = givenName; | 255 | mData->givenName = givenName; |
256 | } | 256 | } |
257 | 257 | ||
258 | QString Addressee::givenName() const | 258 | QString Addressee::givenName() const |
259 | { | 259 | { |
260 | return mData->givenName; | 260 | return mData->givenName; |
261 | } | 261 | } |
262 | 262 | ||
263 | QString Addressee::givenNameLabel() | 263 | QString Addressee::givenNameLabel() |
264 | { | 264 | { |
265 | return i18n("Given Name"); | 265 | return i18n("Given Name"); |
266 | } | 266 | } |
267 | 267 | ||
268 | 268 | ||
269 | void Addressee::setAdditionalName( const QString &additionalName ) | 269 | void Addressee::setAdditionalName( const QString &additionalName ) |
270 | { | 270 | { |
271 | if ( additionalName == mData->additionalName ) return; | 271 | if ( additionalName == mData->additionalName ) return; |
272 | detach(); | 272 | detach(); |
273 | mData->empty = false; | 273 | mData->empty = false; |
274 | mData->additionalName = additionalName; | 274 | mData->additionalName = additionalName; |
275 | } | 275 | } |
276 | 276 | ||
277 | QString Addressee::additionalName() const | 277 | QString Addressee::additionalName() const |
278 | { | 278 | { |
279 | return mData->additionalName; | 279 | return mData->additionalName; |
280 | } | 280 | } |
281 | 281 | ||
282 | QString Addressee::additionalNameLabel() | 282 | QString Addressee::additionalNameLabel() |
283 | { | 283 | { |
284 | return i18n("Additional Names"); | 284 | return i18n("Additional Names"); |
285 | } | 285 | } |
286 | 286 | ||
287 | 287 | ||
288 | void Addressee::setPrefix( const QString &prefix ) | 288 | void Addressee::setPrefix( const QString &prefix ) |
289 | { | 289 | { |
290 | if ( prefix == mData->prefix ) return; | 290 | if ( prefix == mData->prefix ) return; |
291 | detach(); | 291 | detach(); |
292 | mData->empty = false; | 292 | mData->empty = false; |
293 | mData->prefix = prefix; | 293 | mData->prefix = prefix; |
294 | } | 294 | } |
295 | 295 | ||
296 | QString Addressee::prefix() const | 296 | QString Addressee::prefix() const |
297 | { | 297 | { |
298 | return mData->prefix; | 298 | return mData->prefix; |
299 | } | 299 | } |
300 | 300 | ||
301 | QString Addressee::prefixLabel() | 301 | QString Addressee::prefixLabel() |
302 | { | 302 | { |
303 | return i18n("Honorific Prefixes"); | 303 | return i18n("Honorific Prefixes"); |
304 | } | 304 | } |
305 | 305 | ||
306 | 306 | ||
307 | void Addressee::setSuffix( const QString &suffix ) | 307 | void Addressee::setSuffix( const QString &suffix ) |
308 | { | 308 | { |
309 | if ( suffix == mData->suffix ) return; | 309 | if ( suffix == mData->suffix ) return; |
310 | detach(); | 310 | detach(); |
311 | mData->empty = false; | 311 | mData->empty = false; |
312 | mData->suffix = suffix; | 312 | mData->suffix = suffix; |
313 | } | 313 | } |
314 | 314 | ||
315 | QString Addressee::suffix() const | 315 | QString Addressee::suffix() const |
316 | { | 316 | { |
317 | return mData->suffix; | 317 | return mData->suffix; |
318 | } | 318 | } |
319 | 319 | ||
320 | QString Addressee::suffixLabel() | 320 | QString Addressee::suffixLabel() |
321 | { | 321 | { |
322 | return i18n("Honorific Suffixes"); | 322 | return i18n("Honorific Suffixes"); |
323 | } | 323 | } |
324 | 324 | ||
325 | 325 | ||
326 | void Addressee::setNickName( const QString &nickName ) | 326 | void Addressee::setNickName( const QString &nickName ) |
327 | { | 327 | { |
328 | if ( nickName == mData->nickName ) return; | 328 | if ( nickName == mData->nickName ) return; |
329 | detach(); | 329 | detach(); |
330 | mData->empty = false; | 330 | mData->empty = false; |
331 | mData->nickName = nickName; | 331 | mData->nickName = nickName; |
332 | } | 332 | } |
333 | 333 | ||
334 | QString Addressee::nickName() const | 334 | QString Addressee::nickName() const |
335 | { | 335 | { |
336 | return mData->nickName; | 336 | return mData->nickName; |
337 | } | 337 | } |
338 | 338 | ||
339 | QString Addressee::nickNameLabel() | 339 | QString Addressee::nickNameLabel() |
340 | { | 340 | { |
341 | return i18n("Nick Name"); | 341 | return i18n("Nick Name"); |
342 | } | 342 | } |
343 | 343 | ||
344 | 344 | ||
345 | void Addressee::setBirthday( const QDateTime &birthday ) | 345 | void Addressee::setBirthday( const QDateTime &birthday ) |
346 | { | 346 | { |
347 | if ( birthday == mData->birthday ) return; | 347 | if ( birthday == mData->birthday ) return; |
348 | detach(); | 348 | detach(); |
349 | mData->empty = false; | 349 | mData->empty = false; |
350 | mData->birthday = birthday; | 350 | mData->birthday = birthday; |
351 | } | 351 | } |
352 | 352 | ||
353 | QDateTime Addressee::birthday() const | 353 | QDateTime Addressee::birthday() const |
354 | { | 354 | { |
355 | return mData->birthday; | 355 | return mData->birthday; |
356 | } | 356 | } |
357 | 357 | ||
358 | QString Addressee::birthdayLabel() | 358 | QString Addressee::birthdayLabel() |
359 | { | 359 | { |
360 | return i18n("Birthday"); | 360 | return i18n("Birthday"); |
361 | } | 361 | } |
362 | 362 | ||
363 | 363 | ||
364 | QString Addressee::homeAddressStreetLabel() | 364 | QString Addressee::homeAddressStreetLabel() |
365 | { | 365 | { |
366 | return i18n("Home Address Street"); | 366 | return i18n("Home Address Street"); |
367 | } | 367 | } |
368 | 368 | ||
369 | 369 | ||
370 | QString Addressee::homeAddressLocalityLabel() | 370 | QString Addressee::homeAddressLocalityLabel() |
371 | { | 371 | { |
372 | return i18n("Home Address Locality"); | 372 | return i18n("Home Address Locality"); |
373 | } | 373 | } |
374 | 374 | ||
375 | 375 | ||
376 | QString Addressee::homeAddressRegionLabel() | 376 | QString Addressee::homeAddressRegionLabel() |
377 | { | 377 | { |
378 | return i18n("Home Address Region"); | 378 | return i18n("Home Address Region"); |
379 | } | 379 | } |
380 | 380 | ||
381 | 381 | ||
382 | QString Addressee::homeAddressPostalCodeLabel() | 382 | QString Addressee::homeAddressPostalCodeLabel() |
383 | { | 383 | { |
384 | return i18n("Home Address Postal Code"); | 384 | return i18n("Home Address Postal Code"); |
385 | } | 385 | } |
386 | 386 | ||
387 | 387 | ||
388 | QString Addressee::homeAddressCountryLabel() | 388 | QString Addressee::homeAddressCountryLabel() |
389 | { | 389 | { |
390 | return i18n("Home Address Country"); | 390 | return i18n("Home Address Country"); |
391 | } | 391 | } |
392 | 392 | ||
393 | 393 | ||
394 | QString Addressee::homeAddressLabelLabel() | 394 | QString Addressee::homeAddressLabelLabel() |
395 | { | 395 | { |
396 | return i18n("Home Address Label"); | 396 | return i18n("Home Address Label"); |
397 | } | 397 | } |
398 | 398 | ||
399 | 399 | ||
400 | QString Addressee::businessAddressStreetLabel() | 400 | QString Addressee::businessAddressStreetLabel() |
401 | { | 401 | { |
402 | return i18n("Business Address Street"); | 402 | return i18n("Business Address Street"); |
403 | } | 403 | } |
404 | 404 | ||
405 | 405 | ||
406 | QString Addressee::businessAddressLocalityLabel() | 406 | QString Addressee::businessAddressLocalityLabel() |
407 | { | 407 | { |
408 | return i18n("Business Address Locality"); | 408 | return i18n("Business Address Locality"); |
409 | } | 409 | } |
410 | 410 | ||
411 | 411 | ||
412 | QString Addressee::businessAddressRegionLabel() | 412 | QString Addressee::businessAddressRegionLabel() |
413 | { | 413 | { |
414 | return i18n("Business Address Region"); | 414 | return i18n("Business Address Region"); |
415 | } | 415 | } |
416 | 416 | ||
417 | 417 | ||
418 | QString Addressee::businessAddressPostalCodeLabel() | 418 | QString Addressee::businessAddressPostalCodeLabel() |
419 | { | 419 | { |
420 | return i18n("Business Address Postal Code"); | 420 | return i18n("Business Address Postal Code"); |
421 | } | 421 | } |
422 | 422 | ||
423 | 423 | ||
424 | QString Addressee::businessAddressCountryLabel() | 424 | QString Addressee::businessAddressCountryLabel() |
425 | { | 425 | { |
426 | return i18n("Business Address Country"); | 426 | return i18n("Business Address Country"); |
427 | } | 427 | } |
428 | 428 | ||
429 | 429 | ||
430 | QString Addressee::businessAddressLabelLabel() | 430 | QString Addressee::businessAddressLabelLabel() |
431 | { | 431 | { |
432 | return i18n("Business Address Label"); | 432 | return i18n("Business Address Label"); |
433 | } | 433 | } |
434 | 434 | ||
435 | 435 | ||
436 | QString Addressee::homePhoneLabel() | 436 | QString Addressee::homePhoneLabel() |
437 | { | 437 | { |
438 | return i18n("Home Phone"); | 438 | return i18n("Home Phone"); |
439 | } | 439 | } |
440 | 440 | ||
441 | 441 | ||
442 | QString Addressee::businessPhoneLabel() | 442 | QString Addressee::businessPhoneLabel() |
443 | { | 443 | { |
444 | return i18n("Business Phone"); | 444 | return i18n("Business Phone"); |
445 | } | 445 | } |
446 | 446 | ||
447 | 447 | ||
448 | QString Addressee::mobilePhoneLabel() | 448 | QString Addressee::mobilePhoneLabel() |
449 | { | 449 | { |
450 | return i18n("Mobile Phone"); | 450 | return i18n("Mobile Phone"); |
451 | } | 451 | } |
452 | 452 | ||
453 | 453 | ||
454 | QString Addressee::homeFaxLabel() | 454 | QString Addressee::homeFaxLabel() |
455 | { | 455 | { |
456 | return i18n("Home Fax"); | 456 | return i18n("Home Fax"); |
457 | } | 457 | } |
458 | 458 | ||
459 | 459 | ||
460 | QString Addressee::businessFaxLabel() | 460 | QString Addressee::businessFaxLabel() |
461 | { | 461 | { |
462 | return i18n("Business Fax"); | 462 | return i18n("Business Fax"); |
463 | } | 463 | } |
464 | 464 | ||
465 | 465 | ||
466 | QString Addressee::carPhoneLabel() | 466 | QString Addressee::carPhoneLabel() |
467 | { | 467 | { |
468 | return i18n("Car Phone"); | 468 | return i18n("Car Phone"); |
469 | } | 469 | } |
470 | 470 | ||
471 | 471 | ||
472 | QString Addressee::isdnLabel() | 472 | QString Addressee::isdnLabel() |
473 | { | 473 | { |
474 | return i18n("ISDN"); | 474 | return i18n("ISDN"); |
475 | } | 475 | } |
476 | 476 | ||
477 | 477 | ||
478 | QString Addressee::pagerLabel() | 478 | QString Addressee::pagerLabel() |
479 | { | 479 | { |
480 | return i18n("Pager"); | 480 | return i18n("Pager"); |
481 | } | 481 | } |
482 | 482 | ||
483 | QString Addressee::sipLabel() | 483 | QString Addressee::sipLabel() |
484 | { | 484 | { |
485 | return i18n("SIP"); | 485 | return i18n("SIP"); |
486 | } | 486 | } |
487 | 487 | ||
488 | QString Addressee::emailLabel() | 488 | QString Addressee::emailLabel() |
489 | { | 489 | { |
490 | return i18n("Email Address"); | 490 | return i18n("Email Address"); |
491 | } | 491 | } |
492 | 492 | ||
493 | 493 | ||
494 | void Addressee::setMailer( const QString &mailer ) | 494 | void Addressee::setMailer( const QString &mailer ) |
495 | { | 495 | { |
496 | if ( mailer == mData->mailer ) return; | 496 | if ( mailer == mData->mailer ) return; |
497 | detach(); | 497 | detach(); |
498 | mData->empty = false; | 498 | mData->empty = false; |
499 | mData->mailer = mailer; | 499 | mData->mailer = mailer; |
500 | } | 500 | } |
501 | 501 | ||
502 | QString Addressee::mailer() const | 502 | QString Addressee::mailer() const |
503 | { | 503 | { |
504 | return mData->mailer; | 504 | return mData->mailer; |
505 | } | 505 | } |
506 | 506 | ||
507 | QString Addressee::mailerLabel() | 507 | QString Addressee::mailerLabel() |
508 | { | 508 | { |
509 | return i18n("Mail Client"); | 509 | return i18n("Mail Client"); |
510 | } | 510 | } |
511 | 511 | ||
512 | 512 | ||
513 | void Addressee::setTimeZone( const TimeZone &timeZone ) | 513 | void Addressee::setTimeZone( const TimeZone &timeZone ) |
514 | { | 514 | { |
515 | if ( timeZone == mData->timeZone ) return; | 515 | if ( timeZone == mData->timeZone ) return; |
516 | detach(); | 516 | detach(); |
517 | mData->empty = false; | 517 | mData->empty = false; |
518 | mData->timeZone = timeZone; | 518 | mData->timeZone = timeZone; |
519 | } | 519 | } |
520 | 520 | ||
521 | TimeZone Addressee::timeZone() const | 521 | TimeZone Addressee::timeZone() const |
522 | { | 522 | { |
523 | return mData->timeZone; | 523 | return mData->timeZone; |
524 | } | 524 | } |
525 | 525 | ||
526 | QString Addressee::timeZoneLabel() | 526 | QString Addressee::timeZoneLabel() |
527 | { | 527 | { |
528 | return i18n("Time Zone"); | 528 | return i18n("Time Zone"); |
529 | } | 529 | } |
530 | 530 | ||
531 | 531 | ||
532 | void Addressee::setGeo( const Geo &geo ) | 532 | void Addressee::setGeo( const Geo &geo ) |
533 | { | 533 | { |
534 | if ( geo == mData->geo ) return; | 534 | if ( geo == mData->geo ) return; |
535 | detach(); | 535 | detach(); |
536 | mData->empty = false; | 536 | mData->empty = false; |
537 | mData->geo = geo; | 537 | mData->geo = geo; |
538 | } | 538 | } |
539 | 539 | ||
540 | Geo Addressee::geo() const | 540 | Geo Addressee::geo() const |
541 | { | 541 | { |
542 | return mData->geo; | 542 | return mData->geo; |
543 | } | 543 | } |
544 | 544 | ||
545 | QString Addressee::geoLabel() | 545 | QString Addressee::geoLabel() |
546 | { | 546 | { |
547 | return i18n("Geographic Position"); | 547 | return i18n("Geographic Position"); |
548 | } | 548 | } |
549 | 549 | ||
550 | 550 | ||
551 | void Addressee::setTitle( const QString &title ) | 551 | void Addressee::setTitle( const QString &title ) |
552 | { | 552 | { |
553 | if ( title == mData->title ) return; | 553 | if ( title == mData->title ) return; |
554 | detach(); | 554 | detach(); |
555 | mData->empty = false; | 555 | mData->empty = false; |
556 | mData->title = title; | 556 | mData->title = title; |
557 | } | 557 | } |
558 | 558 | ||
559 | QString Addressee::title() const | 559 | QString Addressee::title() const |
560 | { | 560 | { |
561 | return mData->title; | 561 | return mData->title; |
562 | } | 562 | } |
563 | 563 | ||
564 | QString Addressee::titleLabel() | 564 | QString Addressee::titleLabel() |
565 | { | 565 | { |
566 | return i18n("Title"); | 566 | return i18n("Title"); |
567 | } | 567 | } |
568 | 568 | ||
569 | 569 | ||
570 | void Addressee::setRole( const QString &role ) | 570 | void Addressee::setRole( const QString &role ) |
571 | { | 571 | { |
572 | if ( role == mData->role ) return; | 572 | if ( role == mData->role ) return; |
573 | detach(); | 573 | detach(); |
574 | mData->empty = false; | 574 | mData->empty = false; |
575 | mData->role = role; | 575 | mData->role = role; |
576 | } | 576 | } |
577 | 577 | ||
578 | QString Addressee::role() const | 578 | QString Addressee::role() const |
579 | { | 579 | { |
580 | return mData->role; | 580 | return mData->role; |
581 | } | 581 | } |
582 | 582 | ||
583 | QString Addressee::roleLabel() | 583 | QString Addressee::roleLabel() |
584 | { | 584 | { |
585 | return i18n("Role"); | 585 | return i18n("Role"); |
586 | } | 586 | } |
587 | 587 | ||
588 | 588 | ||
589 | void Addressee::setOrganization( const QString &organization ) | 589 | void Addressee::setOrganization( const QString &organization ) |
590 | { | 590 | { |
591 | if ( organization == mData->organization ) return; | 591 | if ( organization == mData->organization ) return; |
592 | detach(); | 592 | detach(); |
593 | mData->empty = false; | 593 | mData->empty = false; |
594 | mData->organization = organization; | 594 | mData->organization = organization; |
595 | } | 595 | } |
596 | 596 | ||
597 | QString Addressee::organization() const | 597 | QString Addressee::organization() const |
598 | { | 598 | { |
599 | return mData->organization; | 599 | return mData->organization; |
600 | } | 600 | } |
601 | 601 | ||
602 | QString Addressee::organizationLabel() | 602 | QString Addressee::organizationLabel() |
603 | { | 603 | { |
604 | return i18n("Organization"); | 604 | return i18n("Organization"); |
605 | } | 605 | } |
606 | 606 | ||
607 | 607 | ||
608 | void Addressee::setNote( const QString ¬e ) | 608 | void Addressee::setNote( const QString ¬e ) |
609 | { | 609 | { |
610 | if ( note == mData->note ) return; | 610 | if ( note == mData->note ) return; |
611 | detach(); | 611 | detach(); |
612 | mData->empty = false; | 612 | mData->empty = false; |
613 | mData->note = note; | 613 | mData->note = note; |
614 | } | 614 | } |
615 | 615 | ||
616 | QString Addressee::note() const | 616 | QString Addressee::note() const |
617 | { | 617 | { |
618 | return mData->note; | 618 | return mData->note; |
619 | } | 619 | } |
620 | 620 | ||
621 | QString Addressee::noteLabel() | 621 | QString Addressee::noteLabel() |
622 | { | 622 | { |
623 | return i18n("Note"); | 623 | return i18n("Note"); |
624 | } | 624 | } |
625 | 625 | ||
626 | 626 | ||
627 | void Addressee::setProductId( const QString &productId ) | 627 | void Addressee::setProductId( const QString &productId ) |
628 | { | 628 | { |
629 | if ( productId == mData->productId ) return; | 629 | if ( productId == mData->productId ) return; |
630 | detach(); | 630 | detach(); |
631 | mData->empty = false; | 631 | mData->empty = false; |
632 | mData->productId = productId; | 632 | mData->productId = productId; |
633 | } | 633 | } |
634 | 634 | ||
635 | QString Addressee::productId() const | 635 | QString Addressee::productId() const |
636 | { | 636 | { |
637 | return mData->productId; | 637 | return mData->productId; |
638 | } | 638 | } |
639 | 639 | ||
640 | QString Addressee::productIdLabel() | 640 | QString Addressee::productIdLabel() |
641 | { | 641 | { |
642 | return i18n("Product Identifier"); | 642 | return i18n("Product Identifier"); |
643 | } | 643 | } |
644 | 644 | ||
645 | 645 | ||
646 | void Addressee::setRevision( const QDateTime &revision ) | 646 | void Addressee::setRevision( const QDateTime &revision ) |
647 | { | 647 | { |
648 | if ( revision == mData->revision ) return; | 648 | if ( revision == mData->revision ) return; |
649 | detach(); | 649 | detach(); |
650 | mData->empty = false; | 650 | mData->empty = false; |
651 | mData->revision = revision; | 651 | mData->revision = revision; |
652 | } | 652 | } |
653 | 653 | ||
654 | QDateTime Addressee::revision() const | 654 | QDateTime Addressee::revision() const |
655 | { | 655 | { |
656 | return mData->revision; | 656 | return mData->revision; |
657 | } | 657 | } |
658 | 658 | ||
659 | QString Addressee::revisionLabel() | 659 | QString Addressee::revisionLabel() |
660 | { | 660 | { |
661 | return i18n("Revision Date"); | 661 | return i18n("Revision Date"); |
662 | } | 662 | } |
663 | 663 | ||
664 | 664 | ||
665 | void Addressee::setSortString( const QString &sortString ) | 665 | void Addressee::setSortString( const QString &sortString ) |
666 | { | 666 | { |
667 | if ( sortString == mData->sortString ) return; | 667 | if ( sortString == mData->sortString ) return; |
668 | detach(); | 668 | detach(); |
669 | mData->empty = false; | 669 | mData->empty = false; |
670 | mData->sortString = sortString; | 670 | mData->sortString = sortString; |
671 | } | 671 | } |
672 | 672 | ||
673 | QString Addressee::sortString() const | 673 | QString Addressee::sortString() const |
674 | { | 674 | { |
675 | return mData->sortString; | 675 | return mData->sortString; |
676 | } | 676 | } |
677 | 677 | ||
678 | QString Addressee::sortStringLabel() | 678 | QString Addressee::sortStringLabel() |
679 | { | 679 | { |
680 | return i18n("Sort String"); | 680 | return i18n("Sort String"); |
681 | } | 681 | } |
682 | 682 | ||
683 | 683 | ||
684 | void Addressee::setUrl( const KURL &url ) | 684 | void Addressee::setUrl( const KURL &url ) |
685 | { | 685 | { |
686 | if ( url == mData->url ) return; | 686 | if ( url == mData->url ) return; |
687 | detach(); | 687 | detach(); |
688 | mData->empty = false; | 688 | mData->empty = false; |
689 | mData->url = url; | 689 | mData->url = url; |
690 | } | 690 | } |
691 | 691 | ||
692 | KURL Addressee::url() const | 692 | KURL Addressee::url() const |
693 | { | 693 | { |
694 | return mData->url; | 694 | return mData->url; |
695 | } | 695 | } |
696 | 696 | ||
697 | QString Addressee::urlLabel() | 697 | QString Addressee::urlLabel() |
698 | { | 698 | { |
699 | return i18n("URL"); | 699 | return i18n("URL"); |
700 | } | 700 | } |
701 | 701 | ||
702 | 702 | ||
703 | void Addressee::setSecrecy( const Secrecy &secrecy ) | 703 | void Addressee::setSecrecy( const Secrecy &secrecy ) |
704 | { | 704 | { |
705 | if ( secrecy == mData->secrecy ) return; | 705 | if ( secrecy == mData->secrecy ) return; |
706 | detach(); | 706 | detach(); |
707 | mData->empty = false; | 707 | mData->empty = false; |
708 | mData->secrecy = secrecy; | 708 | mData->secrecy = secrecy; |
709 | } | 709 | } |
710 | 710 | ||
711 | Secrecy Addressee::secrecy() const | 711 | Secrecy Addressee::secrecy() const |
712 | { | 712 | { |
713 | return mData->secrecy; | 713 | return mData->secrecy; |
714 | } | 714 | } |
715 | 715 | ||
716 | QString Addressee::secrecyLabel() | 716 | QString Addressee::secrecyLabel() |
717 | { | 717 | { |
718 | return i18n("Security Class"); | 718 | return i18n("Security Class"); |
719 | } | 719 | } |
720 | 720 | ||
721 | 721 | ||
722 | void Addressee::setLogo( const Picture &logo ) | 722 | void Addressee::setLogo( const Picture &logo ) |
723 | { | 723 | { |
724 | if ( logo == mData->logo ) return; | 724 | if ( logo == mData->logo ) return; |
725 | detach(); | 725 | detach(); |
726 | mData->empty = false; | 726 | mData->empty = false; |
727 | mData->logo = logo; | 727 | mData->logo = logo; |
728 | } | 728 | } |
729 | 729 | ||
730 | Picture Addressee::logo() const | 730 | Picture Addressee::logo() const |
731 | { | 731 | { |
732 | return mData->logo; | 732 | return mData->logo; |
733 | } | 733 | } |
734 | 734 | ||
735 | QString Addressee::logoLabel() | 735 | QString Addressee::logoLabel() |
736 | { | 736 | { |
737 | return i18n("Logo"); | 737 | return i18n("Logo"); |
738 | } | 738 | } |
739 | 739 | ||
740 | 740 | ||
741 | void Addressee::setPhoto( const Picture &photo ) | 741 | void Addressee::setPhoto( const Picture &photo ) |
742 | { | 742 | { |
743 | if ( photo == mData->photo ) return; | 743 | if ( photo == mData->photo ) return; |
744 | detach(); | 744 | detach(); |
745 | mData->empty = false; | 745 | mData->empty = false; |
746 | mData->photo = photo; | 746 | mData->photo = photo; |
747 | } | 747 | } |
748 | 748 | ||
749 | Picture Addressee::photo() const | 749 | Picture Addressee::photo() const |
750 | { | 750 | { |
751 | return mData->photo; | 751 | return mData->photo; |
752 | } | 752 | } |
753 | 753 | ||
754 | QString Addressee::photoLabel() | 754 | QString Addressee::photoLabel() |
755 | { | 755 | { |
756 | return i18n("Photo"); | 756 | return i18n("Photo"); |
757 | } | 757 | } |
758 | 758 | ||
759 | 759 | ||
760 | void Addressee::setSound( const Sound &sound ) | 760 | void Addressee::setSound( const Sound &sound ) |
761 | { | 761 | { |
762 | if ( sound == mData->sound ) return; | 762 | if ( sound == mData->sound ) return; |
763 | detach(); | 763 | detach(); |
764 | mData->empty = false; | 764 | mData->empty = false; |
765 | mData->sound = sound; | 765 | mData->sound = sound; |
766 | } | 766 | } |
767 | 767 | ||
768 | Sound Addressee::sound() const | 768 | Sound Addressee::sound() const |
769 | { | 769 | { |
770 | return mData->sound; | 770 | return mData->sound; |
771 | } | 771 | } |
772 | 772 | ||
773 | QString Addressee::soundLabel() | 773 | QString Addressee::soundLabel() |
774 | { | 774 | { |
775 | return i18n("Sound"); | 775 | return i18n("Sound"); |
776 | } | 776 | } |
777 | 777 | ||
778 | 778 | ||
779 | void Addressee::setAgent( const Agent &agent ) | 779 | void Addressee::setAgent( const Agent &agent ) |
780 | { | 780 | { |
781 | if ( agent == mData->agent ) return; | 781 | if ( agent == mData->agent ) return; |
782 | detach(); | 782 | detach(); |
783 | mData->empty = false; | 783 | mData->empty = false; |
784 | mData->agent = agent; | 784 | mData->agent = agent; |
785 | } | 785 | } |
786 | 786 | ||
787 | Agent Addressee::agent() const | 787 | Agent Addressee::agent() const |
788 | { | 788 | { |
789 | return mData->agent; | 789 | return mData->agent; |
790 | } | 790 | } |
791 | 791 | ||
792 | QString Addressee::agentLabel() | 792 | QString Addressee::agentLabel() |
793 | { | 793 | { |
794 | return i18n("Agent"); | 794 | return i18n("Agent"); |
795 | } | 795 | } |
796 | 796 | ||
797 | 797 | ||
798 | 798 | ||
799 | void Addressee::setNameFromString( const QString &str ) | 799 | void Addressee::setNameFromString( const QString &str ) |
800 | { | 800 | { |
801 | setFormattedName( str ); | 801 | setFormattedName( str ); |
802 | setName( str ); | 802 | setName( str ); |
803 | 803 | ||
804 | QStringList titles; | 804 | static bool first = true; |
805 | titles += i18n( "Dr." ); | 805 | static QStringList titles; |
806 | titles += i18n( "Miss" ); | 806 | static QStringList suffixes; |
807 | titles += i18n( "Mr." ); | 807 | static QStringList prefixes; |
808 | titles += i18n( "Mrs." ); | 808 | |
809 | titles += i18n( "Ms." ); | 809 | if ( first ) { |
810 | titles += i18n( "Prof." ); | 810 | first = false; |
811 | 811 | titles += i18n( "Dr." ); | |
812 | QStringList suffixes; | 812 | titles += i18n( "Miss" ); |
813 | suffixes += i18n( "I" ); | 813 | titles += i18n( "Mr." ); |
814 | suffixes += i18n( "II" ); | 814 | titles += i18n( "Mrs." ); |
815 | suffixes += i18n( "III" ); | 815 | titles += i18n( "Ms." ); |
816 | suffixes += i18n( "Jr." ); | 816 | titles += i18n( "Prof." ); |
817 | suffixes += i18n( "Sr." ); | 817 | |
818 | 818 | suffixes += i18n( "I" ); | |
819 | QStringList prefixes; | 819 | suffixes += i18n( "II" ); |
820 | prefixes += "van"; | 820 | suffixes += i18n( "III" ); |
821 | prefixes += "von"; | 821 | suffixes += i18n( "Jr." ); |
822 | prefixes += "de"; | 822 | suffixes += i18n( "Sr." ); |
823 | 823 | ||
824 | //US KConfig config( "kabcrc" ); | 824 | prefixes += "van"; |
825 | KConfig config( locateLocal( "config", "kabcrc") ); | 825 | prefixes += "von"; |
826 | config.setGroup( "General" ); | 826 | prefixes += "de"; |
827 | titles += config.readListEntry( "Prefixes" ); | 827 | |
828 | titles.remove( "" ); | 828 | KConfig config( locateLocal( "config", "kabcrc") ); |
829 | prefixes += config.readListEntry( "Inclusions" ); | 829 | config.setGroup( "General" ); |
830 | prefixes.remove( "" ); | 830 | titles += config.readListEntry( "Prefixes" ); |
831 | suffixes += config.readListEntry( "Suffixes" ); | 831 | titles.remove( "" ); |
832 | suffixes.remove( "" ); | 832 | prefixes += config.readListEntry( "Inclusions" ); |
833 | prefixes.remove( "" ); | ||
834 | suffixes += config.readListEntry( "Suffixes" ); | ||
835 | suffixes.remove( "" ); | ||
836 | } | ||
833 | 837 | ||
834 | // clear all name parts | 838 | // clear all name parts |
835 | setPrefix( "" ); | 839 | setPrefix( "" ); |
836 | setGivenName( "" ); | 840 | setGivenName( "" ); |
837 | setAdditionalName( "" ); | 841 | setAdditionalName( "" ); |
838 | setFamilyName( "" ); | 842 | setFamilyName( "" ); |
839 | setSuffix( "" ); | 843 | setSuffix( "" ); |
840 | 844 | ||
841 | if ( str.isEmpty() ) | 845 | if ( str.isEmpty() ) |
842 | return; | 846 | return; |
843 | 847 | ||
844 | int i = str.find(','); | 848 | int i = str.find(','); |
845 | if( i < 0 ) { | 849 | if( i < 0 ) { |
846 | QStringList parts = QStringList::split( " ", str ); | 850 | QStringList parts = QStringList::split( " ", str ); |
847 | int leftOffset = 0; | 851 | int leftOffset = 0; |
848 | int rightOffset = parts.count() - 1; | 852 | int rightOffset = parts.count() - 1; |
849 | 853 | ||
850 | QString suffix; | 854 | QString suffix; |
851 | while ( rightOffset >= 0 ) { | 855 | while ( rightOffset >= 0 ) { |
852 | if ( suffixes.contains( parts[ rightOffset ] ) ) { | 856 | if ( suffixes.contains( parts[ rightOffset ] ) ) { |
853 | suffix.prepend(parts[ rightOffset ] + (suffix.isEmpty() ? "" : " ")); | 857 | suffix.prepend(parts[ rightOffset ] + (suffix.isEmpty() ? "" : " ")); |
854 | rightOffset--; | 858 | rightOffset--; |
855 | } else | 859 | } else |
856 | break; | 860 | break; |
857 | } | 861 | } |
858 | setSuffix( suffix ); | 862 | setSuffix( suffix ); |
859 | 863 | ||
860 | if ( rightOffset < 0 ) | 864 | if ( rightOffset < 0 ) |
861 | return; | 865 | return; |
862 | 866 | ||
863 | if ( rightOffset - 1 >= 0 && prefixes.contains( parts[ rightOffset - 1 ].lower() ) ) { | 867 | if ( rightOffset - 1 >= 0 && prefixes.contains( parts[ rightOffset - 1 ].lower() ) ) { |
864 | setFamilyName( parts[ rightOffset - 1 ] + " " + parts[ rightOffset ] ); | 868 | setFamilyName( parts[ rightOffset - 1 ] + " " + parts[ rightOffset ] ); |
865 | rightOffset--; | 869 | rightOffset--; |
866 | } else | 870 | } else |
867 | setFamilyName( parts[ rightOffset ] ); | 871 | setFamilyName( parts[ rightOffset ] ); |
868 | 872 | ||
869 | QString prefix; | 873 | QString prefix; |
870 | while ( leftOffset < rightOffset ) { | 874 | while ( leftOffset < rightOffset ) { |
871 | if ( titles.contains( parts[ leftOffset ] ) ) { | 875 | if ( titles.contains( parts[ leftOffset ] ) ) { |
872 | prefix.append( ( prefix.isEmpty() ? "" : " ") + parts[ leftOffset ] ); | 876 | prefix.append( ( prefix.isEmpty() ? "" : " ") + parts[ leftOffset ] ); |
873 | leftOffset++; | 877 | leftOffset++; |
874 | } else | 878 | } else |
875 | break; | 879 | break; |
876 | } | 880 | } |
877 | setPrefix( prefix ); | 881 | setPrefix( prefix ); |
878 | 882 | ||
879 | if ( leftOffset < rightOffset ) { | 883 | if ( leftOffset < rightOffset ) { |
880 | setGivenName( parts[ leftOffset ] ); | 884 | setGivenName( parts[ leftOffset ] ); |
881 | leftOffset++; | 885 | leftOffset++; |
882 | } | 886 | } |
883 | 887 | ||
884 | QString additionalName; | 888 | QString additionalName; |
885 | while ( leftOffset < rightOffset ) { | 889 | while ( leftOffset < rightOffset ) { |
886 | additionalName.append( ( additionalName.isEmpty() ? "" : " ") + parts[ leftOffset ] ); | 890 | additionalName.append( ( additionalName.isEmpty() ? "" : " ") + parts[ leftOffset ] ); |
887 | leftOffset++; | 891 | leftOffset++; |
888 | } | 892 | } |
889 | setAdditionalName( additionalName ); | 893 | setAdditionalName( additionalName ); |
890 | } else { | 894 | } else { |
891 | QString part1 = str.left( i ); | 895 | QString part1 = str.left( i ); |
892 | QString part2 = str.mid( i + 1 ); | 896 | QString part2 = str.mid( i + 1 ); |
893 | 897 | ||
894 | QStringList parts = QStringList::split( " ", part1 ); | 898 | QStringList parts = QStringList::split( " ", part1 ); |
895 | int leftOffset = 0; | 899 | int leftOffset = 0; |
896 | int rightOffset = parts.count() - 1; | 900 | int rightOffset = parts.count() - 1; |
897 | 901 | ||
898 | QString suffix; | 902 | QString suffix; |
899 | while ( rightOffset >= 0 ) { | 903 | while ( rightOffset >= 0 ) { |
900 | if ( suffixes.contains( parts[ rightOffset ] ) ) { | 904 | if ( suffixes.contains( parts[ rightOffset ] ) ) { |
901 | suffix.prepend(parts[ rightOffset ] + (suffix.isEmpty() ? "" : " ")); | 905 | suffix.prepend(parts[ rightOffset ] + (suffix.isEmpty() ? "" : " ")); |
902 | rightOffset--; | 906 | rightOffset--; |
903 | } else | 907 | } else |
904 | break; | 908 | break; |
905 | } | 909 | } |
906 | setSuffix( suffix ); | 910 | setSuffix( suffix ); |
907 | 911 | ||
908 | if ( rightOffset - 1 >= 0 && prefixes.contains( parts[ rightOffset - 1 ].lower() ) ) { | 912 | if ( rightOffset - 1 >= 0 && prefixes.contains( parts[ rightOffset - 1 ].lower() ) ) { |
909 | setFamilyName( parts[ rightOffset - 1 ] + " " + parts[ rightOffset ] ); | 913 | setFamilyName( parts[ rightOffset - 1 ] + " " + parts[ rightOffset ] ); |
910 | rightOffset--; | 914 | rightOffset--; |
911 | } else | 915 | } else |
912 | setFamilyName( parts[ rightOffset ] ); | 916 | setFamilyName( parts[ rightOffset ] ); |
913 | 917 | ||
914 | QString prefix; | 918 | QString prefix; |
915 | while ( leftOffset < rightOffset ) { | 919 | while ( leftOffset < rightOffset ) { |
916 | if ( titles.contains( parts[ leftOffset ] ) ) { | 920 | if ( titles.contains( parts[ leftOffset ] ) ) { |
917 | prefix.append( ( prefix.isEmpty() ? "" : " ") + parts[ leftOffset ] ); | 921 | prefix.append( ( prefix.isEmpty() ? "" : " ") + parts[ leftOffset ] ); |
918 | leftOffset++; | 922 | leftOffset++; |
919 | } else | 923 | } else |
920 | break; | 924 | break; |
921 | } | 925 | } |
922 | 926 | ||
923 | parts = QStringList::split( " ", part2 ); | 927 | parts = QStringList::split( " ", part2 ); |
924 | 928 | ||
925 | leftOffset = 0; | 929 | leftOffset = 0; |
926 | rightOffset = parts.count(); | 930 | rightOffset = parts.count(); |
927 | 931 | ||
928 | while ( leftOffset < rightOffset ) { | 932 | while ( leftOffset < rightOffset ) { |
929 | if ( titles.contains( parts[ leftOffset ] ) ) { | 933 | if ( titles.contains( parts[ leftOffset ] ) ) { |
930 | prefix.append( ( prefix.isEmpty() ? "" : " ") + parts[ leftOffset ] ); | 934 | prefix.append( ( prefix.isEmpty() ? "" : " ") + parts[ leftOffset ] ); |
931 | leftOffset++; | 935 | leftOffset++; |
932 | } else | 936 | } else |
933 | break; | 937 | break; |
934 | } | 938 | } |
935 | setPrefix( prefix ); | 939 | setPrefix( prefix ); |
936 | 940 | ||
937 | if ( leftOffset < rightOffset ) { | 941 | if ( leftOffset < rightOffset ) { |
938 | setGivenName( parts[ leftOffset ] ); | 942 | setGivenName( parts[ leftOffset ] ); |
939 | leftOffset++; | 943 | leftOffset++; |
940 | } | 944 | } |
941 | 945 | ||
942 | QString additionalName; | 946 | QString additionalName; |
943 | while ( leftOffset < rightOffset ) { | 947 | while ( leftOffset < rightOffset ) { |
944 | additionalName.append( ( additionalName.isEmpty() ? "" : " ") + parts[ leftOffset ] ); | 948 | additionalName.append( ( additionalName.isEmpty() ? "" : " ") + parts[ leftOffset ] ); |
945 | leftOffset++; | 949 | leftOffset++; |
946 | } | 950 | } |
947 | setAdditionalName( additionalName ); | 951 | setAdditionalName( additionalName ); |
948 | } | 952 | } |
949 | } | 953 | } |
950 | 954 | ||
951 | QString Addressee::realName() const | 955 | QString Addressee::realName() const |
952 | { | 956 | { |
953 | if ( !formattedName().isEmpty() ) | 957 | if ( !formattedName().isEmpty() ) |
954 | return formattedName(); | 958 | return formattedName(); |
955 | 959 | ||
956 | QString n = assembledName(); | 960 | QString n = assembledName(); |
957 | 961 | ||
958 | if ( n.isEmpty() ) | 962 | if ( n.isEmpty() ) |
959 | n = name(); | 963 | n = name(); |
960 | 964 | ||
961 | return n; | 965 | return n; |
962 | } | 966 | } |
963 | 967 | ||
964 | QString Addressee::assembledName() const | 968 | QString Addressee::assembledName() const |
965 | { | 969 | { |
966 | QString name = prefix() + " " + givenName() + " " + additionalName() + " " + | 970 | QString name = prefix() + " " + givenName() + " " + additionalName() + " " + |
967 | familyName() + " " + suffix(); | 971 | familyName() + " " + suffix(); |
968 | 972 | ||
969 | return name.simplifyWhiteSpace(); | 973 | return name.simplifyWhiteSpace(); |
970 | } | 974 | } |
971 | 975 | ||
972 | QString Addressee::fullEmail( const QString &email ) const | 976 | QString Addressee::fullEmail( const QString &email ) const |
973 | { | 977 | { |
974 | QString e; | 978 | QString e; |
975 | if ( email.isNull() ) { | 979 | if ( email.isNull() ) { |
976 | e = preferredEmail(); | 980 | e = preferredEmail(); |
977 | } else { | 981 | } else { |
978 | e = email; | 982 | e = email; |
979 | } | 983 | } |
980 | if ( e.isEmpty() ) return QString::null; | 984 | if ( e.isEmpty() ) return QString::null; |
981 | 985 | ||
982 | QString text; | 986 | QString text; |
983 | if ( realName().isEmpty() ) | 987 | if ( realName().isEmpty() ) |
984 | text = e; | 988 | text = e; |
985 | else | 989 | else |
986 | text = assembledName() + " <" + e + ">"; | 990 | text = assembledName() + " <" + e + ">"; |
987 | 991 | ||
988 | return text; | 992 | return text; |
989 | } | 993 | } |
990 | 994 | ||
991 | void Addressee::insertEmail( const QString &email, bool preferred ) | 995 | void Addressee::insertEmail( const QString &email, bool preferred ) |
992 | { | 996 | { |
993 | detach(); | 997 | detach(); |
994 | 998 | ||
995 | QStringList::Iterator it = mData->emails.find( email ); | 999 | QStringList::Iterator it = mData->emails.find( email ); |
996 | 1000 | ||
997 | if ( it != mData->emails.end() ) { | 1001 | if ( it != mData->emails.end() ) { |
998 | if ( !preferred || it == mData->emails.begin() ) return; | 1002 | if ( !preferred || it == mData->emails.begin() ) return; |
999 | mData->emails.remove( it ); | 1003 | mData->emails.remove( it ); |
1000 | mData->emails.prepend( email ); | 1004 | mData->emails.prepend( email ); |
1001 | } else { | 1005 | } else { |
1002 | if ( preferred ) { | 1006 | if ( preferred ) { |
1003 | mData->emails.prepend( email ); | 1007 | mData->emails.prepend( email ); |
1004 | } else { | 1008 | } else { |
1005 | mData->emails.append( email ); | 1009 | mData->emails.append( email ); |
1006 | } | 1010 | } |
1007 | } | 1011 | } |
1008 | } | 1012 | } |
1009 | 1013 | ||
1010 | void Addressee::removeEmail( const QString &email ) | 1014 | void Addressee::removeEmail( const QString &email ) |
1011 | { | 1015 | { |
1012 | detach(); | 1016 | detach(); |
1013 | 1017 | ||
1014 | QStringList::Iterator it = mData->emails.find( email ); | 1018 | QStringList::Iterator it = mData->emails.find( email ); |
1015 | if ( it == mData->emails.end() ) return; | 1019 | if ( it == mData->emails.end() ) return; |
1016 | 1020 | ||
1017 | mData->emails.remove( it ); | 1021 | mData->emails.remove( it ); |
1018 | } | 1022 | } |
1019 | 1023 | ||
1020 | QString Addressee::preferredEmail() const | 1024 | QString Addressee::preferredEmail() const |
1021 | { | 1025 | { |
1022 | if ( mData->emails.count() == 0 ) return QString::null; | 1026 | if ( mData->emails.count() == 0 ) return QString::null; |
1023 | else return mData->emails.first(); | 1027 | else return mData->emails.first(); |
1024 | } | 1028 | } |
1025 | 1029 | ||
1026 | QStringList Addressee::emails() const | 1030 | QStringList Addressee::emails() const |
1027 | { | 1031 | { |
1028 | return mData->emails; | 1032 | return mData->emails; |
1029 | } | 1033 | } |
1030 | void Addressee::setEmails( const QStringList& emails ) { | 1034 | void Addressee::setEmails( const QStringList& emails ) { |
1031 | detach(); | 1035 | detach(); |
1032 | mData->emails = emails; | 1036 | mData->emails = emails; |
1033 | } | 1037 | } |
1034 | void Addressee::insertPhoneNumber( const PhoneNumber &phoneNumber ) | 1038 | void Addressee::insertPhoneNumber( const PhoneNumber &phoneNumber ) |
1035 | { | 1039 | { |
1036 | detach(); | 1040 | detach(); |
1037 | mData->empty = false; | 1041 | mData->empty = false; |
1038 | 1042 | ||
1039 | PhoneNumber::List::Iterator it; | 1043 | PhoneNumber::List::Iterator it; |
1040 | for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { | 1044 | for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { |
1041 | if ( (*it).id() == phoneNumber.id() ) { | 1045 | if ( (*it).id() == phoneNumber.id() ) { |
1042 | *it = phoneNumber; | 1046 | *it = phoneNumber; |
1043 | return; | 1047 | return; |
1044 | } | 1048 | } |
1045 | } | 1049 | } |
1046 | mData->phoneNumbers.append( phoneNumber ); | 1050 | mData->phoneNumbers.append( phoneNumber ); |
1047 | } | 1051 | } |
1048 | 1052 | ||
1049 | void Addressee::removePhoneNumber( const PhoneNumber &phoneNumber ) | 1053 | void Addressee::removePhoneNumber( const PhoneNumber &phoneNumber ) |
1050 | { | 1054 | { |
1051 | detach(); | 1055 | detach(); |
1052 | 1056 | ||
1053 | PhoneNumber::List::Iterator it; | 1057 | PhoneNumber::List::Iterator it; |
1054 | for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { | 1058 | for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { |
1055 | if ( (*it).id() == phoneNumber.id() ) { | 1059 | if ( (*it).id() == phoneNumber.id() ) { |
1056 | mData->phoneNumbers.remove( it ); | 1060 | mData->phoneNumbers.remove( it ); |
1057 | return; | 1061 | return; |
1058 | } | 1062 | } |
1059 | } | 1063 | } |
1060 | } | 1064 | } |
1061 | 1065 | ||
1062 | PhoneNumber Addressee::phoneNumber( int type ) const | 1066 | PhoneNumber Addressee::phoneNumber( int type ) const |
1063 | { | 1067 | { |
1064 | PhoneNumber phoneNumber( "", type ); | 1068 | PhoneNumber phoneNumber( "", type ); |
1065 | PhoneNumber::List::ConstIterator it; | 1069 | PhoneNumber::List::ConstIterator it; |
1066 | for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { | 1070 | for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { |
1067 | if ( matchBinaryPattern( (*it).type(), type ) ) { | 1071 | if ( matchBinaryPattern( (*it).type(), type ) ) { |
1068 | if ( (*it).type() & PhoneNumber::Pref ) | 1072 | if ( (*it).type() & PhoneNumber::Pref ) |
1069 | return (*it); | 1073 | return (*it); |
1070 | else if ( phoneNumber.number().isEmpty() ) | 1074 | else if ( phoneNumber.number().isEmpty() ) |
1071 | phoneNumber = (*it); | 1075 | phoneNumber = (*it); |
1072 | } | 1076 | } |
1073 | } | 1077 | } |
1074 | 1078 | ||
1075 | return phoneNumber; | 1079 | return phoneNumber; |
1076 | } | 1080 | } |
1077 | 1081 | ||
1078 | PhoneNumber::List Addressee::phoneNumbers() const | 1082 | PhoneNumber::List Addressee::phoneNumbers() const |
1079 | { | 1083 | { |
1080 | return mData->phoneNumbers; | 1084 | return mData->phoneNumbers; |
1081 | } | 1085 | } |
1082 | 1086 | ||
1083 | PhoneNumber::List Addressee::phoneNumbers( int type ) const | 1087 | PhoneNumber::List Addressee::phoneNumbers( int type ) const |
1084 | { | 1088 | { |
1085 | PhoneNumber::List list; | 1089 | PhoneNumber::List list; |
1086 | 1090 | ||
1087 | PhoneNumber::List::ConstIterator it; | 1091 | PhoneNumber::List::ConstIterator it; |
1088 | for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { | 1092 | for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { |
1089 | if ( matchBinaryPattern( (*it).type(), type ) ) { | 1093 | if ( matchBinaryPattern( (*it).type(), type ) ) { |
1090 | list.append( *it ); | 1094 | list.append( *it ); |
1091 | } | 1095 | } |
1092 | } | 1096 | } |
1093 | return list; | 1097 | return list; |
1094 | } | 1098 | } |
1095 | 1099 | ||
1096 | PhoneNumber Addressee::findPhoneNumber( const QString &id ) const | 1100 | PhoneNumber Addressee::findPhoneNumber( const QString &id ) const |
1097 | { | 1101 | { |
1098 | PhoneNumber::List::ConstIterator it; | 1102 | PhoneNumber::List::ConstIterator it; |
1099 | for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { | 1103 | for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { |
1100 | if ( (*it).id() == id ) { | 1104 | if ( (*it).id() == id ) { |
1101 | return *it; | 1105 | return *it; |
1102 | } | 1106 | } |
1103 | } | 1107 | } |
1104 | return PhoneNumber(); | 1108 | return PhoneNumber(); |
1105 | } | 1109 | } |
1106 | 1110 | ||
1107 | void Addressee::insertKey( const Key &key ) | 1111 | void Addressee::insertKey( const Key &key ) |
1108 | { | 1112 | { |
1109 | detach(); | 1113 | detach(); |
1110 | mData->empty = false; | 1114 | mData->empty = false; |
1111 | 1115 | ||
1112 | Key::List::Iterator it; | 1116 | Key::List::Iterator it; |
1113 | for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { | 1117 | for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { |
1114 | if ( (*it).id() == key.id() ) { | 1118 | if ( (*it).id() == key.id() ) { |
1115 | *it = key; | 1119 | *it = key; |
1116 | return; | 1120 | return; |
1117 | } | 1121 | } |
1118 | } | 1122 | } |
1119 | mData->keys.append( key ); | 1123 | mData->keys.append( key ); |
1120 | } | 1124 | } |
1121 | 1125 | ||
1122 | void Addressee::removeKey( const Key &key ) | 1126 | void Addressee::removeKey( const Key &key ) |
1123 | { | 1127 | { |
1124 | detach(); | 1128 | detach(); |
1125 | 1129 | ||
1126 | Key::List::Iterator it; | 1130 | Key::List::Iterator it; |
1127 | for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { | 1131 | for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { |
1128 | if ( (*it).id() == key.id() ) { | 1132 | if ( (*it).id() == key.id() ) { |
1129 | mData->keys.remove( key ); | 1133 | mData->keys.remove( key ); |
1130 | return; | 1134 | return; |
1131 | } | 1135 | } |
1132 | } | 1136 | } |
1133 | } | 1137 | } |
1134 | 1138 | ||
1135 | Key Addressee::key( int type, QString customTypeString ) const | 1139 | Key Addressee::key( int type, QString customTypeString ) const |
1136 | { | 1140 | { |
1137 | Key::List::ConstIterator it; | 1141 | Key::List::ConstIterator it; |
1138 | for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { | 1142 | for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { |
1139 | if ( (*it).type() == type ) { | 1143 | if ( (*it).type() == type ) { |
1140 | if ( type == Key::Custom ) { | 1144 | if ( type == Key::Custom ) { |
1141 | if ( customTypeString.isEmpty() ) { | 1145 | if ( customTypeString.isEmpty() ) { |
1142 | return *it; | 1146 | return *it; |
1143 | } else { | 1147 | } else { |
1144 | if ( (*it).customTypeString() == customTypeString ) | 1148 | if ( (*it).customTypeString() == customTypeString ) |
1145 | return (*it); | 1149 | return (*it); |
1146 | } | 1150 | } |
1147 | } else { | 1151 | } else { |
1148 | return *it; | 1152 | return *it; |
1149 | } | 1153 | } |
1150 | } | 1154 | } |
1151 | } | 1155 | } |
1152 | return Key( QString(), type ); | 1156 | return Key( QString(), type ); |
1153 | } | 1157 | } |
1154 | void Addressee::setKeys( const Key::List& list ) { | 1158 | void Addressee::setKeys( const Key::List& list ) { |
1155 | detach(); | 1159 | detach(); |
1156 | mData->keys = list; | 1160 | mData->keys = list; |
1157 | } | 1161 | } |
1158 | 1162 | ||
1159 | Key::List Addressee::keys() const | 1163 | Key::List Addressee::keys() const |
1160 | { | 1164 | { |
1161 | return mData->keys; | 1165 | return mData->keys; |
1162 | } | 1166 | } |
1163 | 1167 | ||
1164 | Key::List Addressee::keys( int type, QString customTypeString ) const | 1168 | Key::List Addressee::keys( int type, QString customTypeString ) const |
1165 | { | 1169 | { |
1166 | Key::List list; | 1170 | Key::List list; |
1167 | 1171 | ||
1168 | Key::List::ConstIterator it; | 1172 | Key::List::ConstIterator it; |
1169 | for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { | 1173 | for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { |
1170 | if ( (*it).type() == type ) { | 1174 | if ( (*it).type() == type ) { |
1171 | if ( type == Key::Custom ) { | 1175 | if ( type == Key::Custom ) { |
1172 | if ( customTypeString.isEmpty() ) { | 1176 | if ( customTypeString.isEmpty() ) { |
1173 | list.append(*it); | 1177 | list.append(*it); |
1174 | } else { | 1178 | } else { |
1175 | if ( (*it).customTypeString() == customTypeString ) | 1179 | if ( (*it).customTypeString() == customTypeString ) |
1176 | list.append(*it); | 1180 | list.append(*it); |
1177 | } | 1181 | } |
1178 | } else { | 1182 | } else { |
1179 | list.append(*it); | 1183 | list.append(*it); |
1180 | } | 1184 | } |
1181 | } | 1185 | } |
1182 | } | 1186 | } |
1183 | return list; | 1187 | return list; |
1184 | } | 1188 | } |
1185 | 1189 | ||
1186 | Key Addressee::findKey( const QString &id ) const | 1190 | Key Addressee::findKey( const QString &id ) const |
1187 | { | 1191 | { |
1188 | Key::List::ConstIterator it; | 1192 | Key::List::ConstIterator it; |
1189 | for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { | 1193 | for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { |
1190 | if ( (*it).id() == id ) { | 1194 | if ( (*it).id() == id ) { |
1191 | return *it; | 1195 | return *it; |
1192 | } | 1196 | } |
1193 | } | 1197 | } |
1194 | return Key(); | 1198 | return Key(); |
1195 | } | 1199 | } |
1196 | 1200 | ||
1197 | QString Addressee::asString() const | 1201 | QString Addressee::asString() const |
1198 | { | 1202 | { |
1199 | return "Smith, agent Smith..."; | 1203 | return "Smith, agent Smith..."; |
1200 | } | 1204 | } |
1201 | 1205 | ||
1202 | void Addressee::dump() const | 1206 | void Addressee::dump() const |
1203 | { | 1207 | { |
1204 | return; | 1208 | return; |
1205 | kdDebug(5700) << "Addressee {" << endl; | 1209 | kdDebug(5700) << "Addressee {" << endl; |
1206 | 1210 | ||
1207 | kdDebug(5700) << " Uid: '" << uid() << "'" << endl; | 1211 | kdDebug(5700) << " Uid: '" << uid() << "'" << endl; |
1208 | 1212 | ||
1209 | kdDebug(5700) << " Name: '" << name() << "'" << endl; | 1213 | kdDebug(5700) << " Name: '" << name() << "'" << endl; |
1210 | kdDebug(5700) << " FormattedName: '" << formattedName() << "'" << endl; | 1214 | kdDebug(5700) << " FormattedName: '" << formattedName() << "'" << endl; |
1211 | kdDebug(5700) << " FamilyName: '" << familyName() << "'" << endl; | 1215 | kdDebug(5700) << " FamilyName: '" << familyName() << "'" << endl; |
1212 | kdDebug(5700) << " GivenName: '" << givenName() << "'" << endl; | 1216 | kdDebug(5700) << " GivenName: '" << givenName() << "'" << endl; |
1213 | kdDebug(5700) << " AdditionalName: '" << additionalName() << "'" << endl; | 1217 | kdDebug(5700) << " AdditionalName: '" << additionalName() << "'" << endl; |
1214 | kdDebug(5700) << " Prefix: '" << prefix() << "'" << endl; | 1218 | kdDebug(5700) << " Prefix: '" << prefix() << "'" << endl; |
1215 | kdDebug(5700) << " Suffix: '" << suffix() << "'" << endl; | 1219 | kdDebug(5700) << " Suffix: '" << suffix() << "'" << endl; |
1216 | kdDebug(5700) << " NickName: '" << nickName() << "'" << endl; | 1220 | kdDebug(5700) << " NickName: '" << nickName() << "'" << endl; |
1217 | kdDebug(5700) << " Birthday: '" << birthday().toString() << "'" << endl; | 1221 | kdDebug(5700) << " Birthday: '" << birthday().toString() << "'" << endl; |
1218 | kdDebug(5700) << " Mailer: '" << mailer() << "'" << endl; | 1222 | kdDebug(5700) << " Mailer: '" << mailer() << "'" << endl; |
1219 | kdDebug(5700) << " TimeZone: '" << timeZone().asString() << "'" << endl; | 1223 | kdDebug(5700) << " TimeZone: '" << timeZone().asString() << "'" << endl; |
1220 | kdDebug(5700) << " Geo: '" << geo().asString() << "'" << endl; | 1224 | kdDebug(5700) << " Geo: '" << geo().asString() << "'" << endl; |
1221 | kdDebug(5700) << " Title: '" << title() << "'" << endl; | 1225 | kdDebug(5700) << " Title: '" << title() << "'" << endl; |
1222 | kdDebug(5700) << " Role: '" << role() << "'" << endl; | 1226 | kdDebug(5700) << " Role: '" << role() << "'" << endl; |
1223 | kdDebug(5700) << " Organization: '" << organization() << "'" << endl; | 1227 | kdDebug(5700) << " Organization: '" << organization() << "'" << endl; |
1224 | kdDebug(5700) << " Note: '" << note() << "'" << endl; | 1228 | kdDebug(5700) << " Note: '" << note() << "'" << endl; |
1225 | kdDebug(5700) << " ProductId: '" << productId() << "'" << endl; | 1229 | kdDebug(5700) << " ProductId: '" << productId() << "'" << endl; |
1226 | kdDebug(5700) << " Revision: '" << revision().toString() << "'" << endl; | 1230 | kdDebug(5700) << " Revision: '" << revision().toString() << "'" << endl; |
1227 | kdDebug(5700) << " SortString: '" << sortString() << "'" << endl; | 1231 | kdDebug(5700) << " SortString: '" << sortString() << "'" << endl; |
1228 | kdDebug(5700) << " Url: '" << url().url() << "'" << endl; | 1232 | kdDebug(5700) << " Url: '" << url().url() << "'" << endl; |
1229 | kdDebug(5700) << " Secrecy: '" << secrecy().asString() << "'" << endl; | 1233 | kdDebug(5700) << " Secrecy: '" << secrecy().asString() << "'" << endl; |
1230 | kdDebug(5700) << " Logo: '" << logo().asString() << "'" << endl; | 1234 | kdDebug(5700) << " Logo: '" << logo().asString() << "'" << endl; |
1231 | kdDebug(5700) << " Photo: '" << photo().asString() << "'" << endl; | 1235 | kdDebug(5700) << " Photo: '" << photo().asString() << "'" << endl; |
1232 | kdDebug(5700) << " Sound: '" << sound().asString() << "'" << endl; | 1236 | kdDebug(5700) << " Sound: '" << sound().asString() << "'" << endl; |
1233 | kdDebug(5700) << " Agent: '" << agent().asString() << "'" << endl; | 1237 | kdDebug(5700) << " Agent: '" << agent().asString() << "'" << endl; |
1234 | 1238 | ||
1235 | kdDebug(5700) << " Emails {" << endl; | 1239 | kdDebug(5700) << " Emails {" << endl; |
1236 | QStringList e = emails(); | 1240 | QStringList e = emails(); |
1237 | QStringList::ConstIterator it; | 1241 | QStringList::ConstIterator it; |
1238 | for( it = e.begin(); it != e.end(); ++it ) { | 1242 | for( it = e.begin(); it != e.end(); ++it ) { |
1239 | kdDebug(5700) << " " << (*it) << endl; | 1243 | kdDebug(5700) << " " << (*it) << endl; |
1240 | } | 1244 | } |
1241 | kdDebug(5700) << " }" << endl; | 1245 | kdDebug(5700) << " }" << endl; |
1242 | 1246 | ||
1243 | kdDebug(5700) << " PhoneNumbers {" << endl; | 1247 | kdDebug(5700) << " PhoneNumbers {" << endl; |
1244 | PhoneNumber::List p = phoneNumbers(); | 1248 | PhoneNumber::List p = phoneNumbers(); |
1245 | PhoneNumber::List::ConstIterator it2; | 1249 | PhoneNumber::List::ConstIterator it2; |
1246 | for( it2 = p.begin(); it2 != p.end(); ++it2 ) { | 1250 | for( it2 = p.begin(); it2 != p.end(); ++it2 ) { |
1247 | kdDebug(5700) << " Type: " << int((*it2).type()) << " Number: " << (*it2).number() << endl; | 1251 | kdDebug(5700) << " Type: " << int((*it2).type()) << " Number: " << (*it2).number() << endl; |
1248 | } | 1252 | } |
1249 | kdDebug(5700) << " }" << endl; | 1253 | kdDebug(5700) << " }" << endl; |
1250 | 1254 | ||
1251 | Address::List a = addresses(); | 1255 | Address::List a = addresses(); |
1252 | Address::List::ConstIterator it3; | 1256 | Address::List::ConstIterator it3; |
1253 | for( it3 = a.begin(); it3 != a.end(); ++it3 ) { | 1257 | for( it3 = a.begin(); it3 != a.end(); ++it3 ) { |
1254 | (*it3).dump(); | 1258 | (*it3).dump(); |
1255 | } | 1259 | } |
1256 | 1260 | ||
1257 | kdDebug(5700) << " Keys {" << endl; | 1261 | kdDebug(5700) << " Keys {" << endl; |
1258 | Key::List k = keys(); | 1262 | Key::List k = keys(); |
1259 | Key::List::ConstIterator it4; | 1263 | Key::List::ConstIterator it4; |
1260 | for( it4 = k.begin(); it4 != k.end(); ++it4 ) { | 1264 | for( it4 = k.begin(); it4 != k.end(); ++it4 ) { |
1261 | kdDebug(5700) << " Type: " << int((*it4).type()) << | 1265 | kdDebug(5700) << " Type: " << int((*it4).type()) << |
1262 | " Key: " << (*it4).textData() << | 1266 | " Key: " << (*it4).textData() << |
1263 | " CustomString: " << (*it4).customTypeString() << endl; | 1267 | " CustomString: " << (*it4).customTypeString() << endl; |
1264 | } | 1268 | } |
1265 | kdDebug(5700) << " }" << endl; | 1269 | kdDebug(5700) << " }" << endl; |
1266 | 1270 | ||
1267 | kdDebug(5700) << "}" << endl; | 1271 | kdDebug(5700) << "}" << endl; |
1268 | } | 1272 | } |
1269 | 1273 | ||
1270 | 1274 | ||
1271 | void Addressee::insertAddress( const Address &address ) | 1275 | void Addressee::insertAddress( const Address &address ) |
1272 | { | 1276 | { |
1273 | detach(); | 1277 | detach(); |
1274 | mData->empty = false; | 1278 | mData->empty = false; |
1275 | 1279 | ||
1276 | Address::List::Iterator it; | 1280 | Address::List::Iterator it; |
1277 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { | 1281 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { |
1278 | if ( (*it).id() == address.id() ) { | 1282 | if ( (*it).id() == address.id() ) { |
1279 | *it = address; | 1283 | *it = address; |
1280 | return; | 1284 | return; |
1281 | } | 1285 | } |
1282 | } | 1286 | } |
1283 | mData->addresses.append( address ); | 1287 | mData->addresses.append( address ); |
1284 | } | 1288 | } |
1285 | 1289 | ||
1286 | void Addressee::removeAddress( const Address &address ) | 1290 | void Addressee::removeAddress( const Address &address ) |
1287 | { | 1291 | { |
1288 | detach(); | 1292 | detach(); |
1289 | 1293 | ||
1290 | Address::List::Iterator it; | 1294 | Address::List::Iterator it; |
1291 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { | 1295 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { |
1292 | if ( (*it).id() == address.id() ) { | 1296 | if ( (*it).id() == address.id() ) { |
1293 | mData->addresses.remove( it ); | 1297 | mData->addresses.remove( it ); |
1294 | return; | 1298 | return; |
1295 | } | 1299 | } |
1296 | } | 1300 | } |
1297 | } | 1301 | } |
1298 | 1302 | ||
1299 | Address Addressee::address( int type ) const | 1303 | Address Addressee::address( int type ) const |
1300 | { | 1304 | { |
1301 | Address address( type ); | 1305 | Address address( type ); |
1302 | Address::List::ConstIterator it; | 1306 | Address::List::ConstIterator it; |
1303 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { | 1307 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { |
1304 | if ( matchBinaryPattern( (*it).type(), type ) ) { | 1308 | if ( matchBinaryPattern( (*it).type(), type ) ) { |
1305 | if ( (*it).type() & Address::Pref ) | 1309 | if ( (*it).type() & Address::Pref ) |
1306 | return (*it); | 1310 | return (*it); |
1307 | else if ( address.isEmpty() ) | 1311 | else if ( address.isEmpty() ) |
1308 | address = (*it); | 1312 | address = (*it); |
1309 | } | 1313 | } |
1310 | } | 1314 | } |
1311 | 1315 | ||
1312 | return address; | 1316 | return address; |
1313 | } | 1317 | } |
1314 | 1318 | ||
1315 | Address::List Addressee::addresses() const | 1319 | Address::List Addressee::addresses() const |
1316 | { | 1320 | { |
1317 | return mData->addresses; | 1321 | return mData->addresses; |
1318 | } | 1322 | } |
1319 | 1323 | ||
1320 | Address::List Addressee::addresses( int type ) const | 1324 | Address::List Addressee::addresses( int type ) const |
1321 | { | 1325 | { |
1322 | Address::List list; | 1326 | Address::List list; |
1323 | 1327 | ||
1324 | Address::List::ConstIterator it; | 1328 | Address::List::ConstIterator it; |
1325 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { | 1329 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { |
1326 | if ( matchBinaryPattern( (*it).type(), type ) ) { | 1330 | if ( matchBinaryPattern( (*it).type(), type ) ) { |
1327 | list.append( *it ); | 1331 | list.append( *it ); |
1328 | } | 1332 | } |
1329 | } | 1333 | } |
1330 | 1334 | ||
1331 | return list; | 1335 | return list; |
1332 | } | 1336 | } |
1333 | 1337 | ||
1334 | Address Addressee::findAddress( const QString &id ) const | 1338 | Address Addressee::findAddress( const QString &id ) const |
1335 | { | 1339 | { |
1336 | Address::List::ConstIterator it; | 1340 | Address::List::ConstIterator it; |
1337 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { | 1341 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { |
1338 | if ( (*it).id() == id ) { | 1342 | if ( (*it).id() == id ) { |
1339 | return *it; | 1343 | return *it; |
1340 | } | 1344 | } |
1341 | } | 1345 | } |
1342 | return Address(); | 1346 | return Address(); |
1343 | } | 1347 | } |
1344 | 1348 | ||
1345 | void Addressee::insertCategory( const QString &c ) | 1349 | void Addressee::insertCategory( const QString &c ) |
1346 | { | 1350 | { |
1347 | detach(); | 1351 | detach(); |
1348 | mData->empty = false; | 1352 | mData->empty = false; |
1349 | 1353 | ||
1350 | if ( mData->categories.contains( c ) ) return; | 1354 | if ( mData->categories.contains( c ) ) return; |
1351 | 1355 | ||
1352 | mData->categories.append( c ); | 1356 | mData->categories.append( c ); |
1353 | } | 1357 | } |
1354 | 1358 | ||
1355 | void Addressee::removeCategory( const QString &c ) | 1359 | void Addressee::removeCategory( const QString &c ) |
1356 | { | 1360 | { |
1357 | detach(); | 1361 | detach(); |
1358 | 1362 | ||
1359 | QStringList::Iterator it = mData->categories.find( c ); | 1363 | QStringList::Iterator it = mData->categories.find( c ); |
1360 | if ( it == mData->categories.end() ) return; | 1364 | if ( it == mData->categories.end() ) return; |
1361 | 1365 | ||
1362 | mData->categories.remove( it ); | 1366 | mData->categories.remove( it ); |
1363 | } | 1367 | } |
1364 | 1368 | ||
1365 | bool Addressee::hasCategory( const QString &c ) const | 1369 | bool Addressee::hasCategory( const QString &c ) const |
1366 | { | 1370 | { |
1367 | return ( mData->categories.contains( c ) ); | 1371 | return ( mData->categories.contains( c ) ); |
1368 | } | 1372 | } |
1369 | 1373 | ||
1370 | void Addressee::setCategories( const QStringList &c ) | 1374 | void Addressee::setCategories( const QStringList &c ) |
1371 | { | 1375 | { |
1372 | detach(); | 1376 | detach(); |
1373 | mData->empty = false; | 1377 | mData->empty = false; |
1374 | 1378 | ||
1375 | mData->categories = c; | 1379 | mData->categories = c; |
1376 | } | 1380 | } |
1377 | 1381 | ||
1378 | QStringList Addressee::categories() const | 1382 | QStringList Addressee::categories() const |
1379 | { | 1383 | { |
1380 | return mData->categories; | 1384 | return mData->categories; |
1381 | } | 1385 | } |
1382 | 1386 | ||
1383 | void Addressee::insertCustom( const QString &app, const QString &name, | 1387 | void Addressee::insertCustom( const QString &app, const QString &name, |
1384 | const QString &value ) | 1388 | const QString &value ) |
1385 | { | 1389 | { |
1386 | if ( value.isNull() || name.isEmpty() || app.isEmpty() ) return; | 1390 | if ( value.isNull() || name.isEmpty() || app.isEmpty() ) return; |
1387 | 1391 | ||
1388 | detach(); | 1392 | detach(); |
1389 | mData->empty = false; | 1393 | mData->empty = false; |
1390 | 1394 | ||
1391 | QString qualifiedName = app + "-" + name + ":"; | 1395 | QString qualifiedName = app + "-" + name + ":"; |
1392 | 1396 | ||
1393 | QStringList::Iterator it; | 1397 | QStringList::Iterator it; |
1394 | for( it = mData->custom.begin(); it != mData->custom.end(); ++it ) { | 1398 | for( it = mData->custom.begin(); it != mData->custom.end(); ++it ) { |
1395 | if ( (*it).startsWith( qualifiedName ) ) { | 1399 | if ( (*it).startsWith( qualifiedName ) ) { |
1396 | (*it) = qualifiedName + value; | 1400 | (*it) = qualifiedName + value; |
1397 | return; | 1401 | return; |
1398 | } | 1402 | } |
1399 | } | 1403 | } |
1400 | 1404 | ||
1401 | mData->custom.append( qualifiedName + value ); | 1405 | mData->custom.append( qualifiedName + value ); |
1402 | } | 1406 | } |
1403 | 1407 | ||
1404 | void Addressee::removeCustom( const QString &app, const QString &name) | 1408 | void Addressee::removeCustom( const QString &app, const QString &name) |
1405 | { | 1409 | { |
1406 | detach(); | 1410 | detach(); |
1407 | 1411 | ||
1408 | QString qualifiedName = app + "-" + name + ":"; | 1412 | QString qualifiedName = app + "-" + name + ":"; |
1409 | 1413 | ||
1410 | QStringList::Iterator it; | 1414 | QStringList::Iterator it; |
1411 | for( it = mData->custom.begin(); it != mData->custom.end(); ++it ) { | 1415 | for( it = mData->custom.begin(); it != mData->custom.end(); ++it ) { |
1412 | if ( (*it).startsWith( qualifiedName ) ) { | 1416 | if ( (*it).startsWith( qualifiedName ) ) { |
1413 | mData->custom.remove( it ); | 1417 | mData->custom.remove( it ); |
1414 | return; | 1418 | return; |
1415 | } | 1419 | } |
1416 | } | 1420 | } |
1417 | } | 1421 | } |
1418 | 1422 | ||
1419 | QString Addressee::custom( const QString &app, const QString &name ) const | 1423 | QString Addressee::custom( const QString &app, const QString &name ) const |
1420 | { | 1424 | { |
1421 | QString qualifiedName = app + "-" + name + ":"; | 1425 | QString qualifiedName = app + "-" + name + ":"; |
1422 | QString value; | 1426 | QString value; |
1423 | 1427 | ||
1424 | QStringList::ConstIterator it; | 1428 | QStringList::ConstIterator it; |
1425 | for( it = mData->custom.begin(); it != mData->custom.end(); ++it ) { | 1429 | for( it = mData->custom.begin(); it != mData->custom.end(); ++it ) { |
1426 | if ( (*it).startsWith( qualifiedName ) ) { | 1430 | if ( (*it).startsWith( qualifiedName ) ) { |
1427 | value = (*it).mid( (*it).find( ":" ) + 1 ); | 1431 | value = (*it).mid( (*it).find( ":" ) + 1 ); |
1428 | break; | 1432 | break; |
1429 | } | 1433 | } |
1430 | } | 1434 | } |
1431 | 1435 | ||
1432 | return value; | 1436 | return value; |
1433 | } | 1437 | } |
1434 | 1438 | ||
1435 | void Addressee::setCustoms( const QStringList &l ) | 1439 | void Addressee::setCustoms( const QStringList &l ) |
1436 | { | 1440 | { |
1437 | detach(); | 1441 | detach(); |
1438 | mData->empty = false; | 1442 | mData->empty = false; |
1439 | 1443 | ||
1440 | mData->custom = l; | 1444 | mData->custom = l; |
1441 | } | 1445 | } |
1442 | 1446 | ||
1443 | QStringList Addressee::customs() const | 1447 | QStringList Addressee::customs() const |
1444 | { | 1448 | { |
1445 | return mData->custom; | 1449 | return mData->custom; |
1446 | } | 1450 | } |
1447 | 1451 | ||
1448 | void Addressee::parseEmailAddress( const QString &rawEmail, QString &fullName, | 1452 | void Addressee::parseEmailAddress( const QString &rawEmail, QString &fullName, |
1449 | QString &email) | 1453 | QString &email) |
1450 | { | 1454 | { |
1451 | int startPos, endPos, len; | 1455 | int startPos, endPos, len; |
1452 | QString partA, partB, result; | 1456 | QString partA, partB, result; |
1453 | char endCh = '>'; | 1457 | char endCh = '>'; |
1454 | 1458 | ||
1455 | startPos = rawEmail.find('<'); | 1459 | startPos = rawEmail.find('<'); |
1456 | if (startPos < 0) | 1460 | if (startPos < 0) |
1457 | { | 1461 | { |
1458 | startPos = rawEmail.find('('); | 1462 | startPos = rawEmail.find('('); |
1459 | endCh = ')'; | 1463 | endCh = ')'; |
1460 | } | 1464 | } |
1461 | if (startPos < 0) | 1465 | if (startPos < 0) |
1462 | { | 1466 | { |
1463 | // We couldn't find any separators, so we assume the whole string | 1467 | // We couldn't find any separators, so we assume the whole string |
1464 | // is the email address | 1468 | // is the email address |
1465 | email = rawEmail; | 1469 | email = rawEmail; |
1466 | fullName = ""; | 1470 | fullName = ""; |
1467 | } | 1471 | } |
1468 | else | 1472 | else |
1469 | { | 1473 | { |
1470 | // We have a start position, try to find an end | 1474 | // We have a start position, try to find an end |
1471 | endPos = rawEmail.find(endCh, startPos+1); | 1475 | endPos = rawEmail.find(endCh, startPos+1); |
1472 | 1476 | ||
1473 | if (endPos < 0) | 1477 | if (endPos < 0) |
1474 | { | 1478 | { |
1475 | // We couldn't find the end of the email address. We can only | 1479 | // We couldn't find the end of the email address. We can only |
1476 | // assume the entire string is the email address. | 1480 | // assume the entire string is the email address. |
1477 | email = rawEmail; | 1481 | email = rawEmail; |
1478 | fullName = ""; | 1482 | fullName = ""; |
1479 | } | 1483 | } |
1480 | else | 1484 | else |
1481 | { | 1485 | { |
1482 | // We have a start and end to the email address | 1486 | // We have a start and end to the email address |
1483 | 1487 | ||
1484 | // Grab the name part | 1488 | // Grab the name part |
1485 | fullName = rawEmail.left(startPos).stripWhiteSpace(); | 1489 | fullName = rawEmail.left(startPos).stripWhiteSpace(); |
1486 | 1490 | ||
1487 | // grab the email part | 1491 | // grab the email part |
1488 | email = rawEmail.mid(startPos+1, endPos-startPos-1).stripWhiteSpace(); | 1492 | email = rawEmail.mid(startPos+1, endPos-startPos-1).stripWhiteSpace(); |
1489 | 1493 | ||
1490 | // Check that we do not have any extra characters on the end of the | 1494 | // Check that we do not have any extra characters on the end of the |
1491 | // strings | 1495 | // strings |
1492 | len = fullName.length(); | 1496 | len = fullName.length(); |
1493 | if (fullName[0]=='"' && fullName[len-1]=='"') | 1497 | if (fullName[0]=='"' && fullName[len-1]=='"') |
1494 | fullName = fullName.mid(1, len-2); | 1498 | fullName = fullName.mid(1, len-2); |
1495 | else if (fullName[0]=='<' && fullName[len-1]=='>') | 1499 | else if (fullName[0]=='<' && fullName[len-1]=='>') |
1496 | fullName = fullName.mid(1, len-2); | 1500 | fullName = fullName.mid(1, len-2); |
1497 | else if (fullName[0]=='(' && fullName[len-1]==')') | 1501 | else if (fullName[0]=='(' && fullName[len-1]==')') |
1498 | fullName = fullName.mid(1, len-2); | 1502 | fullName = fullName.mid(1, len-2); |
1499 | } | 1503 | } |
1500 | } | 1504 | } |
1501 | } | 1505 | } |
1502 | 1506 | ||
1503 | void Addressee::setResource( Resource *resource ) | 1507 | void Addressee::setResource( Resource *resource ) |
1504 | { | 1508 | { |
1505 | detach(); | 1509 | detach(); |
1506 | mData->resource = resource; | 1510 | mData->resource = resource; |
1507 | } | 1511 | } |
1508 | 1512 | ||
1509 | Resource *Addressee::resource() const | 1513 | Resource *Addressee::resource() const |
1510 | { | 1514 | { |
1511 | return mData->resource; | 1515 | return mData->resource; |
1512 | } | 1516 | } |
1513 | 1517 | ||
1514 | //US | 1518 | //US |
1515 | QString Addressee::resourceLabel() | 1519 | QString Addressee::resourceLabel() |
1516 | { | 1520 | { |
1517 | return i18n("Resource"); | 1521 | return i18n("Resource"); |
1518 | } | 1522 | } |
1519 | 1523 | ||
1520 | void Addressee::setChanged( bool value ) | 1524 | void Addressee::setChanged( bool value ) |
1521 | { | 1525 | { |
1522 | detach(); | 1526 | detach(); |
1523 | mData->changed = value; | 1527 | mData->changed = value; |
1524 | } | 1528 | } |
1525 | 1529 | ||
1526 | bool Addressee::changed() const | 1530 | bool Addressee::changed() const |
1527 | { | 1531 | { |
1528 | return mData->changed; | 1532 | return mData->changed; |
1529 | } | 1533 | } |
1530 | 1534 | ||
1531 | QDataStream &KABC::operator<<( QDataStream &s, const Addressee &a ) | 1535 | QDataStream &KABC::operator<<( QDataStream &s, const Addressee &a ) |
1532 | { | 1536 | { |
1533 | if (!a.mData) return s; | 1537 | if (!a.mData) return s; |
1534 | 1538 | ||
1535 | s << a.uid(); | 1539 | s << a.uid(); |
1536 | 1540 | ||
1537 | s << a.mData->name; | 1541 | s << a.mData->name; |
1538 | s << a.mData->formattedName; | 1542 | s << a.mData->formattedName; |
1539 | s << a.mData->familyName; | 1543 | s << a.mData->familyName; |
1540 | s << a.mData->givenName; | 1544 | s << a.mData->givenName; |
1541 | s << a.mData->additionalName; | 1545 | s << a.mData->additionalName; |
1542 | s << a.mData->prefix; | 1546 | s << a.mData->prefix; |
1543 | s << a.mData->suffix; | 1547 | s << a.mData->suffix; |
1544 | s << a.mData->nickName; | 1548 | s << a.mData->nickName; |
1545 | s << a.mData->birthday; | 1549 | s << a.mData->birthday; |
1546 | s << a.mData->mailer; | 1550 | s << a.mData->mailer; |
1547 | s << a.mData->timeZone; | 1551 | s << a.mData->timeZone; |
1548 | s << a.mData->geo; | 1552 | s << a.mData->geo; |
1549 | s << a.mData->title; | 1553 | s << a.mData->title; |
1550 | s << a.mData->role; | 1554 | s << a.mData->role; |
1551 | s << a.mData->organization; | 1555 | s << a.mData->organization; |
1552 | s << a.mData->note; | 1556 | s << a.mData->note; |
1553 | s << a.mData->productId; | 1557 | s << a.mData->productId; |
1554 | s << a.mData->revision; | 1558 | s << a.mData->revision; |
1555 | s << a.mData->sortString; | 1559 | s << a.mData->sortString; |
1556 | s << a.mData->url; | 1560 | s << a.mData->url; |
1557 | s << a.mData->secrecy; | 1561 | s << a.mData->secrecy; |
1558 | s << a.mData->logo; | 1562 | s << a.mData->logo; |
1559 | s << a.mData->photo; | 1563 | s << a.mData->photo; |
1560 | s << a.mData->sound; | 1564 | s << a.mData->sound; |
1561 | s << a.mData->agent; | 1565 | s << a.mData->agent; |
1562 | s << a.mData->phoneNumbers; | 1566 | s << a.mData->phoneNumbers; |
1563 | s << a.mData->addresses; | 1567 | s << a.mData->addresses; |
1564 | s << a.mData->emails; | 1568 | s << a.mData->emails; |
1565 | s << a.mData->categories; | 1569 | s << a.mData->categories; |
1566 | s << a.mData->custom; | 1570 | s << a.mData->custom; |
1567 | s << a.mData->keys; | 1571 | s << a.mData->keys; |
1568 | return s; | 1572 | return s; |
1569 | } | 1573 | } |
1570 | 1574 | ||
1571 | QDataStream &KABC::operator>>( QDataStream &s, Addressee &a ) | 1575 | QDataStream &KABC::operator>>( QDataStream &s, Addressee &a ) |
1572 | { | 1576 | { |
1573 | if (!a.mData) return s; | 1577 | if (!a.mData) return s; |
1574 | 1578 | ||
1575 | s >> a.mData->uid; | 1579 | s >> a.mData->uid; |
1576 | 1580 | ||
1577 | s >> a.mData->name; | 1581 | s >> a.mData->name; |
1578 | s >> a.mData->formattedName; | 1582 | s >> a.mData->formattedName; |
1579 | s >> a.mData->familyName; | 1583 | s >> a.mData->familyName; |
1580 | s >> a.mData->givenName; | 1584 | s >> a.mData->givenName; |
1581 | s >> a.mData->additionalName; | 1585 | s >> a.mData->additionalName; |
1582 | s >> a.mData->prefix; | 1586 | s >> a.mData->prefix; |
1583 | s >> a.mData->suffix; | 1587 | s >> a.mData->suffix; |
1584 | s >> a.mData->nickName; | 1588 | s >> a.mData->nickName; |
1585 | s >> a.mData->birthday; | 1589 | s >> a.mData->birthday; |
1586 | s >> a.mData->mailer; | 1590 | s >> a.mData->mailer; |
1587 | s >> a.mData->timeZone; | 1591 | s >> a.mData->timeZone; |
1588 | s >> a.mData->geo; | 1592 | s >> a.mData->geo; |
1589 | s >> a.mData->title; | 1593 | s >> a.mData->title; |
1590 | s >> a.mData->role; | 1594 | s >> a.mData->role; |
1591 | s >> a.mData->organization; | 1595 | s >> a.mData->organization; |
1592 | s >> a.mData->note; | 1596 | s >> a.mData->note; |
1593 | s >> a.mData->productId; | 1597 | s >> a.mData->productId; |
1594 | s >> a.mData->revision; | 1598 | s >> a.mData->revision; |
1595 | s >> a.mData->sortString; | 1599 | s >> a.mData->sortString; |
1596 | s >> a.mData->url; | 1600 | s >> a.mData->url; |
1597 | s >> a.mData->secrecy; | 1601 | s >> a.mData->secrecy; |
1598 | s >> a.mData->logo; | 1602 | s >> a.mData->logo; |
1599 | s >> a.mData->photo; | 1603 | s >> a.mData->photo; |
1600 | s >> a.mData->sound; | 1604 | s >> a.mData->sound; |