-rw-r--r-- | kabc/addressee.cpp | 4 | ||||
-rw-r--r-- | kabc/addressee.h | 5 | ||||
-rw-r--r-- | kabc/field.cpp | 8 | ||||
-rw-r--r-- | kabc/phonenumber.cpp | 4 | ||||
-rw-r--r-- | kabc/phonenumber.h | 3 | ||||
-rw-r--r-- | kabc/vcard21parser.cpp | 5 | ||||
-rw-r--r-- | kabc/vcard21parser.h | 1 | ||||
-rw-r--r-- | kabc/vcardformatimpl.cpp | 2 | ||||
-rw-r--r-- | kabc/vcardparser/vcardtool.cpp | 1 |
9 files changed, 29 insertions, 4 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index d484073..6b282e2 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp | |||
@@ -459,48 +459,52 @@ QString Addressee::homeFaxLabel() | |||
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() | ||
484 | { | ||
485 | return i18n("SIP"); | ||
486 | } | ||
483 | 487 | ||
484 | QString Addressee::emailLabel() | 488 | QString Addressee::emailLabel() |
485 | { | 489 | { |
486 | return i18n("Email Address"); | 490 | return i18n("Email Address"); |
487 | } | 491 | } |
488 | 492 | ||
489 | 493 | ||
490 | void Addressee::setMailer( const QString &mailer ) | 494 | void Addressee::setMailer( const QString &mailer ) |
491 | { | 495 | { |
492 | if ( mailer == mData->mailer ) return; | 496 | if ( mailer == mData->mailer ) return; |
493 | detach(); | 497 | detach(); |
494 | mData->empty = false; | 498 | mData->empty = false; |
495 | mData->mailer = mailer; | 499 | mData->mailer = mailer; |
496 | } | 500 | } |
497 | 501 | ||
498 | QString Addressee::mailer() const | 502 | QString Addressee::mailer() const |
499 | { | 503 | { |
500 | return mData->mailer; | 504 | return mData->mailer; |
501 | } | 505 | } |
502 | 506 | ||
503 | QString Addressee::mailerLabel() | 507 | QString Addressee::mailerLabel() |
504 | { | 508 | { |
505 | return i18n("Mail Client"); | 509 | return i18n("Mail Client"); |
506 | } | 510 | } |
diff --git a/kabc/addressee.h b/kabc/addressee.h index 393d1cc..27782f9 100644 --- a/kabc/addressee.h +++ b/kabc/addressee.h | |||
@@ -312,48 +312,53 @@ class Addressee | |||
312 | */ | 312 | */ |
313 | static QString homeFaxLabel(); | 313 | static QString homeFaxLabel(); |
314 | 314 | ||
315 | /** | 315 | /** |
316 | Return translated label for businessFax field. | 316 | Return translated label for businessFax field. |
317 | */ | 317 | */ |
318 | static QString businessFaxLabel(); | 318 | static QString businessFaxLabel(); |
319 | 319 | ||
320 | /** | 320 | /** |
321 | Return translated label for carPhone field. | 321 | Return translated label for carPhone field. |
322 | */ | 322 | */ |
323 | static QString carPhoneLabel(); | 323 | static QString carPhoneLabel(); |
324 | 324 | ||
325 | /** | 325 | /** |
326 | Return translated label for isdn field. | 326 | Return translated label for isdn field. |
327 | */ | 327 | */ |
328 | static QString isdnLabel(); | 328 | static QString isdnLabel(); |
329 | 329 | ||
330 | /** | 330 | /** |
331 | Return translated label for pager field. | 331 | Return translated label for pager field. |
332 | */ | 332 | */ |
333 | static QString pagerLabel(); | 333 | static QString pagerLabel(); |
334 | 334 | ||
335 | /** | 335 | /** |
336 | Return translated label for sip field. | ||
337 | */ | ||
338 | static QString sipLabel(); | ||
339 | |||
340 | /** | ||
336 | Return translated label for email field. | 341 | Return translated label for email field. |
337 | */ | 342 | */ |
338 | static QString emailLabel(); | 343 | static QString emailLabel(); |
339 | 344 | ||
340 | /** | 345 | /** |
341 | Set mail client. | 346 | Set mail client. |
342 | */ | 347 | */ |
343 | void setMailer( const QString &mailer ); | 348 | void setMailer( const QString &mailer ); |
344 | /** | 349 | /** |
345 | Return mail client. | 350 | Return mail client. |
346 | */ | 351 | */ |
347 | QString mailer() const; | 352 | QString mailer() const; |
348 | /** | 353 | /** |
349 | Return translated label for mailer field. | 354 | Return translated label for mailer field. |
350 | */ | 355 | */ |
351 | static QString mailerLabel(); | 356 | static QString mailerLabel(); |
352 | 357 | ||
353 | /** | 358 | /** |
354 | Set time zone. | 359 | Set time zone. |
355 | */ | 360 | */ |
356 | void setTimeZone( const TimeZone &timeZone ); | 361 | void setTimeZone( const TimeZone &timeZone ); |
357 | /** | 362 | /** |
358 | Return time zone. | 363 | Return time zone. |
359 | */ | 364 | */ |
diff --git a/kabc/field.cpp b/kabc/field.cpp index e27970e..d95cd19 100644 --- a/kabc/field.cpp +++ b/kabc/field.cpp | |||
@@ -63,49 +63,50 @@ class Field::FieldImpl | |||
63 | HomeAddressPostalCode, | 63 | HomeAddressPostalCode, |
64 | HomeAddressCountry, | 64 | HomeAddressCountry, |
65 | HomeAddressLabel, | 65 | HomeAddressLabel, |
66 | BusinessAddressStreet, | 66 | BusinessAddressStreet, |
67 | BusinessAddressLocality, | 67 | BusinessAddressLocality, |
68 | BusinessAddressRegion, | 68 | BusinessAddressRegion, |
69 | BusinessAddressPostalCode, | 69 | BusinessAddressPostalCode, |
70 | BusinessAddressCountry, | 70 | BusinessAddressCountry, |
71 | BusinessAddressLabel, | 71 | BusinessAddressLabel, |
72 | HomePhone, | 72 | HomePhone, |
73 | BusinessPhone, | 73 | BusinessPhone, |
74 | MobilePhone, | 74 | MobilePhone, |
75 | HomeFax, | 75 | HomeFax, |
76 | BusinessFax, | 76 | BusinessFax, |
77 | CarPhone, | 77 | CarPhone, |
78 | Isdn, | 78 | Isdn, |
79 | Pager, | 79 | Pager, |
80 | Email, | 80 | Email, |
81 | Mailer, | 81 | Mailer, |
82 | Title, | 82 | Title, |
83 | Role, | 83 | Role, |
84 | Organization, | 84 | Organization, |
85 | Note, | 85 | Note, |
86 | Url, | 86 | Url, |
87 | Resource | 87 | Resource, |
88 | Sip | ||
88 | }; | 89 | }; |
89 | 90 | ||
90 | int fieldId() { return mFieldId; } | 91 | int fieldId() { return mFieldId; } |
91 | int category() { return mCategory; } | 92 | int category() { return mCategory; } |
92 | 93 | ||
93 | QString label() { return mLabel; } | 94 | QString label() { return mLabel; } |
94 | QString key() { return mKey; } | 95 | QString key() { return mKey; } |
95 | QString app() { return mApp; } | 96 | QString app() { return mApp; } |
96 | 97 | ||
97 | private: | 98 | private: |
98 | int mFieldId; | 99 | int mFieldId; |
99 | int mCategory; | 100 | int mCategory; |
100 | 101 | ||
101 | QString mLabel; | 102 | QString mLabel; |
102 | QString mKey; | 103 | QString mKey; |
103 | QString mApp; | 104 | QString mApp; |
104 | }; | 105 | }; |
105 | 106 | ||
106 | 107 | ||
107 | Field::List Field::mAllFields; | 108 | Field::List Field::mAllFields; |
108 | Field::List Field::mDefaultFields; | 109 | Field::List Field::mDefaultFields; |
109 | Field::List Field::mCustomFields; | 110 | Field::List Field::mCustomFields; |
110 | 111 | ||
111 | 112 | ||
@@ -173,48 +174,50 @@ QString Field::label() | |||
173 | case FieldImpl::BusinessFax: | 174 | case FieldImpl::BusinessFax: |
174 | return Addressee::businessFaxLabel(); | 175 | return Addressee::businessFaxLabel(); |
175 | case FieldImpl::CarPhone: | 176 | case FieldImpl::CarPhone: |
176 | return Addressee::carPhoneLabel(); | 177 | return Addressee::carPhoneLabel(); |
177 | case FieldImpl::Isdn: | 178 | case FieldImpl::Isdn: |
178 | return Addressee::isdnLabel(); | 179 | return Addressee::isdnLabel(); |
179 | case FieldImpl::Pager: | 180 | case FieldImpl::Pager: |
180 | return Addressee::pagerLabel(); | 181 | return Addressee::pagerLabel(); |
181 | case FieldImpl::Email: | 182 | case FieldImpl::Email: |
182 | return Addressee::emailLabel(); | 183 | return Addressee::emailLabel(); |
183 | case FieldImpl::Mailer: | 184 | case FieldImpl::Mailer: |
184 | return Addressee::mailerLabel(); | 185 | return Addressee::mailerLabel(); |
185 | case FieldImpl::Title: | 186 | case FieldImpl::Title: |
186 | return Addressee::titleLabel(); | 187 | return Addressee::titleLabel(); |
187 | case FieldImpl::Role: | 188 | case FieldImpl::Role: |
188 | return Addressee::roleLabel(); | 189 | return Addressee::roleLabel(); |
189 | case FieldImpl::Organization: | 190 | case FieldImpl::Organization: |
190 | return Addressee::organizationLabel(); | 191 | return Addressee::organizationLabel(); |
191 | case FieldImpl::Note: | 192 | case FieldImpl::Note: |
192 | return Addressee::noteLabel(); | 193 | return Addressee::noteLabel(); |
193 | case FieldImpl::Url: | 194 | case FieldImpl::Url: |
194 | return Addressee::urlLabel(); | 195 | return Addressee::urlLabel(); |
195 | case FieldImpl::Resource: | 196 | case FieldImpl::Resource: |
196 | return Addressee::resourceLabel(); | 197 | return Addressee::resourceLabel(); |
198 | case FieldImpl::Sip: | ||
199 | return Addressee::sipLabel(); | ||
197 | case FieldImpl::CustomField: | 200 | case FieldImpl::CustomField: |
198 | return mImpl->label(); | 201 | return mImpl->label(); |
199 | default: | 202 | default: |
200 | return i18n("Unknown Field"); | 203 | return i18n("Unknown Field"); |
201 | } | 204 | } |
202 | } | 205 | } |
203 | 206 | ||
204 | int Field::category() | 207 | int Field::category() |
205 | { | 208 | { |
206 | return mImpl->category(); | 209 | return mImpl->category(); |
207 | } | 210 | } |
208 | 211 | ||
209 | QString Field::categoryLabel( int category ) | 212 | QString Field::categoryLabel( int category ) |
210 | { | 213 | { |
211 | switch ( category ) { | 214 | switch ( category ) { |
212 | case All: | 215 | case All: |
213 | return i18n("All"); | 216 | return i18n("All"); |
214 | case Frequent: | 217 | case Frequent: |
215 | return i18n("Frequent"); | 218 | return i18n("Frequent"); |
216 | case Address: | 219 | case Address: |
217 | return i18n("Address"); | 220 | return i18n("Address"); |
218 | case Email: | 221 | case Email: |
219 | return i18n("Email"); | 222 | return i18n("Email"); |
220 | case Personal: | 223 | case Personal: |
@@ -269,48 +272,50 @@ QString Field::value( const KABC::Addressee &a ) | |||
269 | } | 272 | } |
270 | else | 273 | else |
271 | return QString::null; | 274 | return QString::null; |
272 | case FieldImpl::Url: | 275 | case FieldImpl::Url: |
273 | return a.url().prettyURL(); | 276 | return a.url().prettyURL(); |
274 | //US | 277 | //US |
275 | case FieldImpl::Resource: | 278 | case FieldImpl::Resource: |
276 | return a.resource()->resourceName(); | 279 | return a.resource()->resourceName(); |
277 | case FieldImpl::HomePhone: | 280 | case FieldImpl::HomePhone: |
278 | return a.phoneNumber( PhoneNumber::Home ).number(); | 281 | return a.phoneNumber( PhoneNumber::Home ).number(); |
279 | case FieldImpl::BusinessPhone: | 282 | case FieldImpl::BusinessPhone: |
280 | return a.phoneNumber( PhoneNumber::Work ).number(); | 283 | return a.phoneNumber( PhoneNumber::Work ).number(); |
281 | case FieldImpl::MobilePhone: | 284 | case FieldImpl::MobilePhone: |
282 | return a.phoneNumber( PhoneNumber::Cell ).number(); | 285 | return a.phoneNumber( PhoneNumber::Cell ).number(); |
283 | case FieldImpl::HomeFax: | 286 | case FieldImpl::HomeFax: |
284 | return a.phoneNumber( PhoneNumber::Home | PhoneNumber::Fax ).number(); | 287 | return a.phoneNumber( PhoneNumber::Home | PhoneNumber::Fax ).number(); |
285 | case FieldImpl::BusinessFax: | 288 | case FieldImpl::BusinessFax: |
286 | return a.phoneNumber( PhoneNumber::Work | PhoneNumber::Fax ).number(); | 289 | return a.phoneNumber( PhoneNumber::Work | PhoneNumber::Fax ).number(); |
287 | case FieldImpl::CarPhone: | 290 | case FieldImpl::CarPhone: |
288 | return a.phoneNumber( PhoneNumber::Car ).number(); | 291 | return a.phoneNumber( PhoneNumber::Car ).number(); |
289 | case FieldImpl::Isdn: | 292 | case FieldImpl::Isdn: |
290 | return a.phoneNumber( PhoneNumber::Isdn ).number(); | 293 | return a.phoneNumber( PhoneNumber::Isdn ).number(); |
291 | case FieldImpl::Pager: | 294 | case FieldImpl::Pager: |
292 | return a.phoneNumber( PhoneNumber::Pager ).number(); | 295 | return a.phoneNumber( PhoneNumber::Pager ).number(); |
296 | case FieldImpl::Sip: | ||
297 | return a.phoneNumber( PhoneNumber::Sip ).number(); | ||
293 | case FieldImpl::HomeAddressStreet: | 298 | case FieldImpl::HomeAddressStreet: |
294 | return a.address( Address::Home ).street(); | 299 | return a.address( Address::Home ).street(); |
295 | case FieldImpl::HomeAddressLocality: | 300 | case FieldImpl::HomeAddressLocality: |
296 | return a.address( Address::Home ).locality(); | 301 | return a.address( Address::Home ).locality(); |
297 | case FieldImpl::HomeAddressRegion: | 302 | case FieldImpl::HomeAddressRegion: |
298 | return a.address( Address::Home ).region(); | 303 | return a.address( Address::Home ).region(); |
299 | case FieldImpl::HomeAddressPostalCode: | 304 | case FieldImpl::HomeAddressPostalCode: |
300 | return a.address( Address::Home ).postalCode(); | 305 | return a.address( Address::Home ).postalCode(); |
301 | case FieldImpl::HomeAddressCountry: | 306 | case FieldImpl::HomeAddressCountry: |
302 | return a.address( Address::Home ).country(); | 307 | return a.address( Address::Home ).country(); |
303 | case FieldImpl::BusinessAddressStreet: | 308 | case FieldImpl::BusinessAddressStreet: |
304 | return a.address( Address::Work ).street(); | 309 | return a.address( Address::Work ).street(); |
305 | case FieldImpl::BusinessAddressLocality: | 310 | case FieldImpl::BusinessAddressLocality: |
306 | return a.address( Address::Work ).locality(); | 311 | return a.address( Address::Work ).locality(); |
307 | case FieldImpl::BusinessAddressRegion: | 312 | case FieldImpl::BusinessAddressRegion: |
308 | return a.address( Address::Work ).region(); | 313 | return a.address( Address::Work ).region(); |
309 | case FieldImpl::BusinessAddressPostalCode: | 314 | case FieldImpl::BusinessAddressPostalCode: |
310 | return a.address( Address::Work ).postalCode(); | 315 | return a.address( Address::Work ).postalCode(); |
311 | case FieldImpl::BusinessAddressCountry: | 316 | case FieldImpl::BusinessAddressCountry: |
312 | return a.address( Address::Work ).country(); | 317 | return a.address( Address::Work ).country(); |
313 | case FieldImpl::CustomField: | 318 | case FieldImpl::CustomField: |
314 | return a.custom( mImpl->app(), mImpl->key() ); | 319 | return a.custom( mImpl->app(), mImpl->key() ); |
315 | default: | 320 | default: |
316 | return QString::null; | 321 | return QString::null; |
@@ -397,48 +402,49 @@ Field::List Field::allFields() | |||
397 | createField( FieldImpl::HomeAddressCountry, Address|Personal ); | 402 | createField( FieldImpl::HomeAddressCountry, Address|Personal ); |
398 | createField( FieldImpl::HomeAddressLabel, Address|Personal ); | 403 | createField( FieldImpl::HomeAddressLabel, Address|Personal ); |
399 | createField( FieldImpl::BusinessAddressStreet, Address|Organization ); | 404 | createField( FieldImpl::BusinessAddressStreet, Address|Organization ); |
400 | createField( FieldImpl::BusinessAddressLocality, Address|Organization ); | 405 | createField( FieldImpl::BusinessAddressLocality, Address|Organization ); |
401 | createField( FieldImpl::BusinessAddressRegion, Address|Organization ); | 406 | createField( FieldImpl::BusinessAddressRegion, Address|Organization ); |
402 | createField( FieldImpl::BusinessAddressPostalCode, Address|Organization ); | 407 | createField( FieldImpl::BusinessAddressPostalCode, Address|Organization ); |
403 | createField( FieldImpl::BusinessAddressCountry, Address|Organization ); | 408 | createField( FieldImpl::BusinessAddressCountry, Address|Organization ); |
404 | createField( FieldImpl::BusinessAddressLabel, Address|Organization ); | 409 | createField( FieldImpl::BusinessAddressLabel, Address|Organization ); |
405 | createField( FieldImpl::HomePhone, Personal|Frequent ); | 410 | createField( FieldImpl::HomePhone, Personal|Frequent ); |
406 | createField( FieldImpl::BusinessPhone, Organization|Frequent ); | 411 | createField( FieldImpl::BusinessPhone, Organization|Frequent ); |
407 | createField( FieldImpl::MobilePhone, Frequent ); | 412 | createField( FieldImpl::MobilePhone, Frequent ); |
408 | createField( FieldImpl::HomeFax ); | 413 | createField( FieldImpl::HomeFax ); |
409 | createField( FieldImpl::BusinessFax ); | 414 | createField( FieldImpl::BusinessFax ); |
410 | createField( FieldImpl::CarPhone ); | 415 | createField( FieldImpl::CarPhone ); |
411 | createField( FieldImpl::Isdn ); | 416 | createField( FieldImpl::Isdn ); |
412 | createField( FieldImpl::Pager ); | 417 | createField( FieldImpl::Pager ); |
413 | createField( FieldImpl::Email, Email|Frequent ); | 418 | createField( FieldImpl::Email, Email|Frequent ); |
414 | createField( FieldImpl::Mailer, Email ); | 419 | createField( FieldImpl::Mailer, Email ); |
415 | createField( FieldImpl::Title, Organization ); | 420 | createField( FieldImpl::Title, Organization ); |
416 | createField( FieldImpl::Role, Organization ); | 421 | createField( FieldImpl::Role, Organization ); |
417 | createField( FieldImpl::Organization, Organization ); | 422 | createField( FieldImpl::Organization, Organization ); |
418 | createField( FieldImpl::Note ); | 423 | createField( FieldImpl::Note ); |
419 | createField( FieldImpl::Url ); | 424 | createField( FieldImpl::Url ); |
420 | createField( FieldImpl::Resource ); | 425 | createField( FieldImpl::Resource ); |
426 | createField( FieldImpl::Sip ); | ||
421 | } | 427 | } |
422 | 428 | ||
423 | return mAllFields; | 429 | return mAllFields; |
424 | } | 430 | } |
425 | 431 | ||
426 | Field::List Field::defaultFields() | 432 | Field::List Field::defaultFields() |
427 | { | 433 | { |
428 | if ( mDefaultFields.isEmpty() ) { | 434 | if ( mDefaultFields.isEmpty() ) { |
429 | createDefaultField( FieldImpl::GivenName ); | 435 | createDefaultField( FieldImpl::GivenName ); |
430 | createDefaultField( FieldImpl::FamilyName ); | 436 | createDefaultField( FieldImpl::FamilyName ); |
431 | createDefaultField( FieldImpl::Email ); | 437 | createDefaultField( FieldImpl::Email ); |
432 | } | 438 | } |
433 | 439 | ||
434 | return mDefaultFields; | 440 | return mDefaultFields; |
435 | } | 441 | } |
436 | 442 | ||
437 | void Field::createField( int id, int category ) | 443 | void Field::createField( int id, int category ) |
438 | { | 444 | { |
439 | mAllFields.append( new Field( new FieldImpl( id, category ) ) ); | 445 | mAllFields.append( new Field( new FieldImpl( id, category ) ) ); |
440 | } | 446 | } |
441 | 447 | ||
442 | void Field::createDefaultField( int id, int category ) | 448 | void Field::createDefaultField( int id, int category ) |
443 | { | 449 | { |
444 | mDefaultFields.append( new Field( new FieldImpl( id, category ) ) ); | 450 | mDefaultFields.append( new Field( new FieldImpl( id, category ) ) ); |
diff --git a/kabc/phonenumber.cpp b/kabc/phonenumber.cpp index 4ad608d..7aeb2ee 100644 --- a/kabc/phonenumber.cpp +++ b/kabc/phonenumber.cpp | |||
@@ -104,94 +104,96 @@ QString PhoneNumber::typeLabel() const | |||
104 | TypeList list = typeList(); | 104 | TypeList list = typeList(); |
105 | 105 | ||
106 | TypeList::Iterator it; | 106 | TypeList::Iterator it; |
107 | for ( it = list.begin(); it != list.end(); ++it ) { | 107 | for ( it = list.begin(); it != list.end(); ++it ) { |
108 | if ( ( type() & (*it) ) && ( (*it) != Pref ) ) { | 108 | if ( ( type() & (*it) ) && ( (*it) != Pref ) ) { |
109 | label.append( ( first ? "" : "/" ) + typeLabel( *it ) ); | 109 | label.append( ( first ? "" : "/" ) + typeLabel( *it ) ); |
110 | if ( first ) | 110 | if ( first ) |
111 | first = false; | 111 | first = false; |
112 | } | 112 | } |
113 | } | 113 | } |
114 | 114 | ||
115 | return label; | 115 | return label; |
116 | } | 116 | } |
117 | 117 | ||
118 | QString PhoneNumber::label() const | 118 | QString PhoneNumber::label() const |
119 | { | 119 | { |
120 | return typeLabel( type() ); | 120 | return typeLabel( type() ); |
121 | } | 121 | } |
122 | 122 | ||
123 | PhoneNumber::TypeList PhoneNumber::typeList() | 123 | PhoneNumber::TypeList PhoneNumber::typeList() |
124 | { | 124 | { |
125 | TypeList list; | 125 | TypeList list; |
126 | 126 | ||
127 | list << Home << Work << Msg << Pref << Voice << Fax << Cell << Video | 127 | list << Home << Work << Msg << Pref << Voice << Fax << Cell << Video |
128 | << Bbs << Modem << Car << Isdn << Pcs << Pager; | 128 | << Bbs << Modem << Car << Isdn << Pcs << Pager << Sip; |
129 | 129 | ||
130 | return list; | 130 | return list; |
131 | } | 131 | } |
132 | 132 | ||
133 | QString PhoneNumber::label( int type ) | 133 | QString PhoneNumber::label( int type ) |
134 | { | 134 | { |
135 | return typeLabel( type ); | 135 | return typeLabel( type ); |
136 | } | 136 | } |
137 | 137 | ||
138 | QString PhoneNumber::typeLabel( int type ) | 138 | QString PhoneNumber::typeLabel( int type ) |
139 | { | 139 | { |
140 | QString typeString; | 140 | QString typeString; |
141 | 141 | ||
142 | if ((type & Home) == Home) | 142 | if ((type & Home) == Home) |
143 | typeString += i18n("Home"); | 143 | typeString += i18n("Home"); |
144 | else if ((type & Work) == Work) | 144 | else if ((type & Work) == Work) |
145 | typeString += i18n("Work"); | 145 | typeString += i18n("Work"); |
146 | 146 | ||
147 | if (!typeString.isEmpty()) | 147 | if (!typeString.isEmpty()) |
148 | typeString += " "; | 148 | typeString += " "; |
149 | 149 | ||
150 | if ((type & Cell) == Cell) | 150 | if ((type & Cell) == Cell) |
151 | typeString += i18n("Mobile"); | 151 | typeString += i18n("Mobile"); |
152 | else if ((type & Fax) == Fax) | 152 | else if ((type & Fax) == Fax) |
153 | typeString += i18n("Fax"); | 153 | typeString += i18n("Fax"); |
154 | else if ((type & Msg) == Msg) | 154 | else if ((type & Msg) == Msg) |
155 | typeString += i18n("Messenger"); | 155 | typeString += i18n("Messenger"); |
156 | else if ((type & Voice) == Voice) { | 156 | else if ((type & Voice) == Voice) { |
157 | // add nothing in case of the Voice flag | 157 | // add nothing in case of the Voice flag |
158 | // typeString += i18n("Voice"); | 158 | // typeString += i18n("Voice"); |
159 | } | 159 | } |
160 | else if ((type & Video) == Video) | 160 | else if ((type & Video) == Video) |
161 | typeString += i18n("Video"); | 161 | typeString += i18n("Video"); |
162 | else if ((type & Bbs) == Bbs) | 162 | else if ((type & Bbs) == Bbs) |
163 | typeString += i18n("Mailbox"); | 163 | typeString += i18n("Mailbox"); |
164 | else if ((type & Modem) == Modem) | 164 | else if ((type & Modem) == Modem) |
165 | typeString += i18n("Modem"); | 165 | typeString += i18n("Modem"); |
166 | else if ((type & Car) == Car) | 166 | else if ((type & Car) == Car) |
167 | typeString += i18n("Car"); | 167 | typeString += i18n("Car"); |
168 | else if ((type & Isdn) == Isdn) | 168 | else if ((type & Isdn) == Isdn) |
169 | typeString += i18n("ISDN"); | 169 | typeString += i18n("ISDN"); |
170 | else if ((type & Pcs) == Pcs) | 170 | else if ((type & Pcs) == Pcs) |
171 | typeString += i18n("PCS"); | 171 | typeString += i18n("PCS"); |
172 | else if ((type & Pager) == Pager) | 172 | else if ((type & Pager) == Pager) |
173 | typeString += i18n("Pager"); | 173 | typeString += i18n("Pager"); |
174 | else if ((type & Sip) == Sip) | ||
175 | typeString += i18n("SIP"); | ||
174 | 176 | ||
175 | // add the prefered flag | 177 | // add the prefered flag |
176 | if (!typeString.isEmpty()) | 178 | if (!typeString.isEmpty()) |
177 | typeString += " "; | 179 | typeString += " "; |
178 | 180 | ||
179 | if ((type & Pref) == Pref) | 181 | if ((type & Pref) == Pref) |
180 | typeString += i18n("(p)"); | 182 | typeString += i18n("(p)"); |
181 | 183 | ||
182 | //if we still have no match, return "other" | 184 | //if we still have no match, return "other" |
183 | if (typeString.isEmpty()) | 185 | if (typeString.isEmpty()) |
184 | return i18n("Other"); | 186 | return i18n("Other"); |
185 | 187 | ||
186 | 188 | ||
187 | return typeString; | 189 | return typeString; |
188 | } | 190 | } |
189 | 191 | ||
190 | QDataStream &KABC::operator<<( QDataStream &s, const PhoneNumber &phone ) | 192 | QDataStream &KABC::operator<<( QDataStream &s, const PhoneNumber &phone ) |
191 | { | 193 | { |
192 | return s << phone.mId << phone.mType << phone.mNumber; | 194 | return s << phone.mId << phone.mType << phone.mNumber; |
193 | } | 195 | } |
194 | 196 | ||
195 | QDataStream &KABC::operator>>( QDataStream &s, PhoneNumber &phone ) | 197 | QDataStream &KABC::operator>>( QDataStream &s, PhoneNumber &phone ) |
196 | { | 198 | { |
197 | s >> phone.mId >> phone.mType >> phone.mNumber; | 199 | s >> phone.mId >> phone.mType >> phone.mNumber; |
diff --git a/kabc/phonenumber.h b/kabc/phonenumber.h index 6a9c8cb..1df344f 100644 --- a/kabc/phonenumber.h +++ b/kabc/phonenumber.h | |||
@@ -43,52 +43,53 @@ namespace KABC { | |||
43 | class PhoneNumber | 43 | class PhoneNumber |
44 | { | 44 | { |
45 | friend QDataStream &operator<<( QDataStream &, const PhoneNumber & ); | 45 | friend QDataStream &operator<<( QDataStream &, const PhoneNumber & ); |
46 | friend QDataStream &operator>>( QDataStream &, PhoneNumber & ); | 46 | friend QDataStream &operator>>( QDataStream &, PhoneNumber & ); |
47 | 47 | ||
48 | public: | 48 | public: |
49 | typedef QValueList<PhoneNumber> List; | 49 | typedef QValueList<PhoneNumber> List; |
50 | typedef QValueList<int> TypeList; | 50 | typedef QValueList<int> TypeList; |
51 | 51 | ||
52 | /** | 52 | /** |
53 | @li @p Home - Home number | 53 | @li @p Home - Home number |
54 | @li @p Work - Office number | 54 | @li @p Work - Office number |
55 | @li @p Msg - Messaging | 55 | @li @p Msg - Messaging |
56 | @li @p Pref - Preferred number | 56 | @li @p Pref - Preferred number |
57 | @li @p Voice - Voice | 57 | @li @p Voice - Voice |
58 | @li @p Fax - Fax machine | 58 | @li @p Fax - Fax machine |
59 | @li @p Cell - Cell phone | 59 | @li @p Cell - Cell phone |
60 | @li @p Video - Video phone | 60 | @li @p Video - Video phone |
61 | @li @p Bbs - Mailbox | 61 | @li @p Bbs - Mailbox |
62 | @li @p Modem - Modem | 62 | @li @p Modem - Modem |
63 | @li @p Car - Car phone | 63 | @li @p Car - Car phone |
64 | @li @p Isdn - ISDN connection | 64 | @li @p Isdn - ISDN connection |
65 | @li @p Pcs - Personal Communication Service | 65 | @li @p Pcs - Personal Communication Service |
66 | @li @p Pager - Pager | 66 | @li @p Pager - Pager |
67 | @li @p SIP - VoIP | ||
67 | */ | 68 | */ |
68 | enum Types { Home = 1, Work = 2, Msg = 4, Pref = 8, Voice = 16, Fax = 32, | 69 | enum Types { Home = 1, Work = 2, Msg = 4, Pref = 8, Voice = 16, Fax = 32, |
69 | Cell = 64, Video = 128, Bbs = 256, Modem = 512, Car = 1024, | 70 | Cell = 64, Video = 128, Bbs = 256, Modem = 512, Car = 1024, |
70 | Isdn = 2048, Pcs = 4096, Pager = 8192 }; | 71 | Isdn = 2048, Pcs = 4096, Pager = 8192, Sip = 16384 }; |
71 | 72 | ||
72 | /** | 73 | /** |
73 | Create an empty phone number object. | 74 | Create an empty phone number object. |
74 | */ | 75 | */ |
75 | PhoneNumber(); | 76 | PhoneNumber(); |
76 | 77 | ||
77 | /** | 78 | /** |
78 | Create a phonenumber object. | 79 | Create a phonenumber object. |
79 | 80 | ||
80 | @param number Number | 81 | @param number Number |
81 | @param type Type as defined in enum. Multiple types can be | 82 | @param type Type as defined in enum. Multiple types can be |
82 | specified by combining them by a logical or. | 83 | specified by combining them by a logical or. |
83 | */ | 84 | */ |
84 | PhoneNumber( const QString &number, int type = Home ); | 85 | PhoneNumber( const QString &number, int type = Home ); |
85 | 86 | ||
86 | /** | 87 | /** |
87 | Destructor. | 88 | Destructor. |
88 | */ | 89 | */ |
89 | ~PhoneNumber(); | 90 | ~PhoneNumber(); |
90 | 91 | ||
91 | bool operator==( const PhoneNumber & ) const; | 92 | bool operator==( const PhoneNumber & ) const; |
92 | bool operator!=( const PhoneNumber & ) const; | 93 | bool operator!=( const PhoneNumber & ) const; |
93 | 94 | ||
94 | /** | 95 | /** |
diff --git a/kabc/vcard21parser.cpp b/kabc/vcard21parser.cpp index b02aac4..277de22 100644 --- a/kabc/vcard21parser.cpp +++ b/kabc/vcard21parser.cpp | |||
@@ -149,49 +149,50 @@ bool VCardLineX::isValid() const | |||
149 | break; | 149 | break; |
150 | 150 | ||
151 | case 's': | 151 | case 's': |
152 | if ( name == VCARD_SOURCE ) | 152 | if ( name == VCARD_SOURCE ) |
153 | return true; | 153 | return true; |
154 | if ( name == VCARD_SOUND ) | 154 | if ( name == VCARD_SOUND ) |
155 | return true; | 155 | return true; |
156 | break; | 156 | break; |
157 | 157 | ||
158 | case 't': | 158 | case 't': |
159 | if ( name == VCARD_TEL && qualified && | 159 | if ( name == VCARD_TEL && qualified && |
160 | (qualifiers.contains(VCARD_TEL_HOME) || | 160 | (qualifiers.contains(VCARD_TEL_HOME) || |
161 | qualifiers.contains(VCARD_TEL_WORK) || | 161 | qualifiers.contains(VCARD_TEL_WORK) || |
162 | qualifiers.contains(VCARD_TEL_PREF) || | 162 | qualifiers.contains(VCARD_TEL_PREF) || |
163 | qualifiers.contains(VCARD_TEL_VOICE) || | 163 | qualifiers.contains(VCARD_TEL_VOICE) || |
164 | qualifiers.contains(VCARD_TEL_FAX) || | 164 | qualifiers.contains(VCARD_TEL_FAX) || |
165 | qualifiers.contains(VCARD_TEL_MSG) || | 165 | qualifiers.contains(VCARD_TEL_MSG) || |
166 | qualifiers.contains(VCARD_TEL_CELL) || | 166 | qualifiers.contains(VCARD_TEL_CELL) || |
167 | qualifiers.contains(VCARD_TEL_PAGER) || | 167 | qualifiers.contains(VCARD_TEL_PAGER) || |
168 | qualifiers.contains(VCARD_TEL_BBS) || | 168 | qualifiers.contains(VCARD_TEL_BBS) || |
169 | qualifiers.contains(VCARD_TEL_MODEM) || | 169 | qualifiers.contains(VCARD_TEL_MODEM) || |
170 | qualifiers.contains(VCARD_TEL_CAR) || | 170 | qualifiers.contains(VCARD_TEL_CAR) || |
171 | qualifiers.contains(VCARD_TEL_ISDN) || | 171 | qualifiers.contains(VCARD_TEL_ISDN) || |
172 | qualifiers.contains(VCARD_TEL_VIDEO) || | 172 | qualifiers.contains(VCARD_TEL_VIDEO) || |
173 | qualifiers.contains(VCARD_TEL_PCS) | 173 | qualifiers.contains(VCARD_TEL_PCS) || |
174 | qualifiers.contains(VCARD_TEL_SIP) | ||
174 | ) ) | 175 | ) ) |
175 | return true; | 176 | return true; |
176 | if ( name == VCARD_TZ ) | 177 | if ( name == VCARD_TZ ) |
177 | return true; | 178 | return true; |
178 | if ( name == VCARD_TITLE ) | 179 | if ( name == VCARD_TITLE ) |
179 | return true; | 180 | return true; |
180 | break; | 181 | break; |
181 | 182 | ||
182 | case 'u': | 183 | case 'u': |
183 | if ( name == VCARD_URL ) | 184 | if ( name == VCARD_URL ) |
184 | return true; | 185 | return true; |
185 | if ( name == VCARD_UID ) | 186 | if ( name == VCARD_UID ) |
186 | return true; | 187 | return true; |
187 | break; | 188 | break; |
188 | 189 | ||
189 | case 'v': | 190 | case 'v': |
190 | if ( name == VCARD_VERSION ) | 191 | if ( name == VCARD_VERSION ) |
191 | return true; | 192 | return true; |
192 | break; | 193 | break; |
193 | default: | 194 | default: |
194 | break; | 195 | break; |
195 | } | 196 | } |
196 | 197 | ||
197 | return false; | 198 | return false; |
@@ -280,48 +281,50 @@ KABC::Addressee VCard21Parser::readFromString( const QString &data) | |||
280 | if ( (*i).qualifiers.contains( VCARD_TEL_PREF ) ) | 281 | if ( (*i).qualifiers.contains( VCARD_TEL_PREF ) ) |
281 | type |= PhoneNumber::Pref; | 282 | type |= PhoneNumber::Pref; |
282 | // if ( (*i).qualifiers.contains( VCARD_TEL_VOICE ) ) | 283 | // if ( (*i).qualifiers.contains( VCARD_TEL_VOICE ) ) |
283 | // type |= PhoneNumber::Voice; | 284 | // type |= PhoneNumber::Voice; |
284 | if ( (*i).qualifiers.contains( VCARD_TEL_FAX ) ) | 285 | if ( (*i).qualifiers.contains( VCARD_TEL_FAX ) ) |
285 | type |= PhoneNumber::Fax; | 286 | type |= PhoneNumber::Fax; |
286 | if ( (*i).qualifiers.contains( VCARD_TEL_MSG ) ) | 287 | if ( (*i).qualifiers.contains( VCARD_TEL_MSG ) ) |
287 | type |= PhoneNumber::Msg; | 288 | type |= PhoneNumber::Msg; |
288 | if ( (*i).qualifiers.contains( VCARD_TEL_CELL ) ) | 289 | if ( (*i).qualifiers.contains( VCARD_TEL_CELL ) ) |
289 | type |= PhoneNumber::Cell; | 290 | type |= PhoneNumber::Cell; |
290 | if ( (*i).qualifiers.contains( VCARD_TEL_PAGER ) ) | 291 | if ( (*i).qualifiers.contains( VCARD_TEL_PAGER ) ) |
291 | type |= PhoneNumber::Pager; | 292 | type |= PhoneNumber::Pager; |
292 | if ( (*i).qualifiers.contains( VCARD_TEL_BBS ) ) | 293 | if ( (*i).qualifiers.contains( VCARD_TEL_BBS ) ) |
293 | type |= PhoneNumber::Bbs; | 294 | type |= PhoneNumber::Bbs; |
294 | if ( (*i).qualifiers.contains( VCARD_TEL_MODEM ) ) | 295 | if ( (*i).qualifiers.contains( VCARD_TEL_MODEM ) ) |
295 | type |= PhoneNumber::Modem; | 296 | type |= PhoneNumber::Modem; |
296 | if ( (*i).qualifiers.contains( VCARD_TEL_CAR ) ) | 297 | if ( (*i).qualifiers.contains( VCARD_TEL_CAR ) ) |
297 | type |= PhoneNumber::Car; | 298 | type |= PhoneNumber::Car; |
298 | if ( (*i).qualifiers.contains( VCARD_TEL_ISDN ) ) | 299 | if ( (*i).qualifiers.contains( VCARD_TEL_ISDN ) ) |
299 | type |= PhoneNumber::Isdn; | 300 | type |= PhoneNumber::Isdn; |
300 | if ( (*i).qualifiers.contains( VCARD_TEL_VIDEO ) ) | 301 | if ( (*i).qualifiers.contains( VCARD_TEL_VIDEO ) ) |
301 | type |= PhoneNumber::Video; | 302 | type |= PhoneNumber::Video; |
302 | if ( (*i).qualifiers.contains( VCARD_TEL_PCS ) ) | 303 | if ( (*i).qualifiers.contains( VCARD_TEL_PCS ) ) |
303 | type |= PhoneNumber::Pcs; | 304 | type |= PhoneNumber::Pcs; |
305 | if ( (*i).qualifiers.contains( VCARD_TEL_SIP ) ) | ||
306 | type |= PhoneNumber::Sip; | ||
304 | } | 307 | } |
305 | addressee.insertPhoneNumber( PhoneNumber( (*i).parameters[ 0 ], type ) ); | 308 | addressee.insertPhoneNumber( PhoneNumber( (*i).parameters[ 0 ], type ) ); |
306 | } | 309 | } |
307 | } | 310 | } |
308 | 311 | ||
309 | //set the addressee's addresses | 312 | //set the addressee's addresses |
310 | for ( QValueListIterator<VCardLineX> i = mVCard->_vcdata->begin();i != mVCard->_vcdata->end(); ++i ) { | 313 | for ( QValueListIterator<VCardLineX> i = mVCard->_vcdata->begin();i != mVCard->_vcdata->end(); ++i ) { |
311 | if ( (*i).name == VCARD_ADR ) { | 314 | if ( (*i).name == VCARD_ADR ) { |
312 | int type = 0; | 315 | int type = 0; |
313 | if ( (*i).qualified ) { | 316 | if ( (*i).qualified ) { |
314 | if ( (*i).qualifiers.contains( VCARD_ADR_DOM ) ) | 317 | if ( (*i).qualifiers.contains( VCARD_ADR_DOM ) ) |
315 | type |= Address::Dom; | 318 | type |= Address::Dom; |
316 | if ( (*i).qualifiers.contains( VCARD_ADR_INTL ) ) | 319 | if ( (*i).qualifiers.contains( VCARD_ADR_INTL ) ) |
317 | type |= Address::Intl; | 320 | type |= Address::Intl; |
318 | if ( (*i).qualifiers.contains( VCARD_ADR_POSTAL ) ) | 321 | if ( (*i).qualifiers.contains( VCARD_ADR_POSTAL ) ) |
319 | type |= Address::Postal; | 322 | type |= Address::Postal; |
320 | if ( (*i).qualifiers.contains( VCARD_ADR_PARCEL ) ) | 323 | if ( (*i).qualifiers.contains( VCARD_ADR_PARCEL ) ) |
321 | type |= Address::Parcel; | 324 | type |= Address::Parcel; |
322 | if ( (*i).qualifiers.contains( VCARD_ADR_HOME ) ) | 325 | if ( (*i).qualifiers.contains( VCARD_ADR_HOME ) ) |
323 | type |= Address::Home; | 326 | type |= Address::Home; |
324 | if ( (*i).qualifiers.contains( VCARD_ADR_WORK ) ) | 327 | if ( (*i).qualifiers.contains( VCARD_ADR_WORK ) ) |
325 | type |= Address::Work; | 328 | type |= Address::Work; |
326 | if ( (*i).qualifiers.contains( VCARD_ADR_PREF ) ) | 329 | if ( (*i).qualifiers.contains( VCARD_ADR_PREF ) ) |
327 | type |= Address::Pref; | 330 | type |= Address::Pref; |
diff --git a/kabc/vcard21parser.h b/kabc/vcard21parser.h index 24b0eb2..77e69b6 100644 --- a/kabc/vcard21parser.h +++ b/kabc/vcard21parser.h | |||
@@ -71,48 +71,49 @@ $Id$ | |||
71 | #define VCARD_ADR_STREET "Street" | 71 | #define VCARD_ADR_STREET "Street" |
72 | #define VCARD_ADR_LOCALITY "Locality" | 72 | #define VCARD_ADR_LOCALITY "Locality" |
73 | #define VCARD_ADR_REGION "Region" | 73 | #define VCARD_ADR_REGION "Region" |
74 | #define VCARD_ADR_POSTCODE "Postal Code" | 74 | #define VCARD_ADR_POSTCODE "Postal Code" |
75 | #define VCARD_ADR_COUNTRY "Country Name" | 75 | #define VCARD_ADR_COUNTRY "Country Name" |
76 | #define VCARD_LABEL "label" | 76 | #define VCARD_LABEL "label" |
77 | #define VCARD_PROFILE "profile" | 77 | #define VCARD_PROFILE "profile" |
78 | #define VCARD_SOURCE "source" | 78 | #define VCARD_SOURCE "source" |
79 | #define VCARD_TEL "tel" | 79 | #define VCARD_TEL "tel" |
80 | // types | 80 | // types |
81 | #define VCARD_TEL_HOME "home" | 81 | #define VCARD_TEL_HOME "home" |
82 | #define VCARD_TEL_WORK "work" | 82 | #define VCARD_TEL_WORK "work" |
83 | #define VCARD_TEL_PREF "pref" | 83 | #define VCARD_TEL_PREF "pref" |
84 | #define VCARD_TEL_VOICE "voice" | 84 | #define VCARD_TEL_VOICE "voice" |
85 | #define VCARD_TEL_FAX "fax" | 85 | #define VCARD_TEL_FAX "fax" |
86 | #define VCARD_TEL_MSG "msg" | 86 | #define VCARD_TEL_MSG "msg" |
87 | #define VCARD_TEL_CELL "cell" | 87 | #define VCARD_TEL_CELL "cell" |
88 | #define VCARD_TEL_PAGER "pager" | 88 | #define VCARD_TEL_PAGER "pager" |
89 | #define VCARD_TEL_BBS "bbs" | 89 | #define VCARD_TEL_BBS "bbs" |
90 | #define VCARD_TEL_MODEM "modem" | 90 | #define VCARD_TEL_MODEM "modem" |
91 | #define VCARD_TEL_CAR "car" | 91 | #define VCARD_TEL_CAR "car" |
92 | #define VCARD_TEL_ISDN "isdn" | 92 | #define VCARD_TEL_ISDN "isdn" |
93 | #define VCARD_TEL_VIDEO "video" | 93 | #define VCARD_TEL_VIDEO "video" |
94 | #define VCARD_TEL_PCS "pcs" | 94 | #define VCARD_TEL_PCS "pcs" |
95 | #define VCARD_TEL_SIP "sip" | ||
95 | #define VCARD_EMAIL "email" | 96 | #define VCARD_EMAIL "email" |
96 | // types | 97 | // types |
97 | #define VCARD_EMAIL_PREF "pref" | 98 | #define VCARD_EMAIL_PREF "pref" |
98 | #define VCARD_EMAIL_INTERNET "internet" | 99 | #define VCARD_EMAIL_INTERNET "internet" |
99 | #define VCARD_EMAIL_X400 "x400" | 100 | #define VCARD_EMAIL_X400 "x400" |
100 | #define VCARD_TZ "tz" | 101 | #define VCARD_TZ "tz" |
101 | #define VCARD_GEO "geo" | 102 | #define VCARD_GEO "geo" |
102 | #define VCARD_MAILER "mailer" | 103 | #define VCARD_MAILER "mailer" |
103 | #define VCARD_TITLE "title" | 104 | #define VCARD_TITLE "title" |
104 | #define VCARD_ROLE "role" | 105 | #define VCARD_ROLE "role" |
105 | #define VCARD_LOGO "logo" | 106 | #define VCARD_LOGO "logo" |
106 | #define VCARD_AGENT "agent" | 107 | #define VCARD_AGENT "agent" |
107 | #define VCARD_ORG "org" | 108 | #define VCARD_ORG "org" |
108 | #define VCARD_CATEGORIES "categories" | 109 | #define VCARD_CATEGORIES "categories" |
109 | #define VCARD_NOTE "note" | 110 | #define VCARD_NOTE "note" |
110 | #define VCARD_PRODID "prodid" | 111 | #define VCARD_PRODID "prodid" |
111 | #define VCARD_REV "rev" | 112 | #define VCARD_REV "rev" |
112 | #define VCARD_SOUND "sound" | 113 | #define VCARD_SOUND "sound" |
113 | #define VCARD_UID "uid" | 114 | #define VCARD_UID "uid" |
114 | #define VCARD_URL "url" | 115 | #define VCARD_URL "url" |
115 | #define VCARD_CLASS "class" | 116 | #define VCARD_CLASS "class" |
116 | #define VCARD_CLASS_PUBLIC "public" | 117 | #define VCARD_CLASS_PUBLIC "public" |
117 | #define VCARD_CLASS_PRIVATE "private" | 118 | #define VCARD_CLASS_PRIVATE "private" |
118 | #define VCARD_CLASS_CONFIDENTIAL "confidential" | 119 | #define VCARD_CLASS_CONFIDENTIAL "confidential" |
diff --git a/kabc/vcardformatimpl.cpp b/kabc/vcardformatimpl.cpp index bffaa64..2d6eb3d 100644 --- a/kabc/vcardformatimpl.cpp +++ b/kabc/vcardformatimpl.cpp | |||
@@ -570,80 +570,82 @@ void VCardFormatImpl::readNValue( ContentLine *cl, Addressee &a ) | |||
570 | void VCardFormatImpl::addTelephoneValue( VCard *v, const PhoneNumber &p ) | 570 | void VCardFormatImpl::addTelephoneValue( VCard *v, const PhoneNumber &p ) |
571 | { | 571 | { |
572 | if ( p.number().isEmpty() ) | 572 | if ( p.number().isEmpty() ) |
573 | return; | 573 | return; |
574 | 574 | ||
575 | ContentLine cl; | 575 | ContentLine cl; |
576 | cl.setName(EntityTypeToParamName(EntityTelephone)); | 576 | cl.setName(EntityTypeToParamName(EntityTelephone)); |
577 | cl.setValue(new TelValue( p.number().utf8() )); | 577 | cl.setValue(new TelValue( p.number().utf8() )); |
578 | 578 | ||
579 | ParamList params; | 579 | ParamList params; |
580 | if( p.type() & PhoneNumber::Home ) params.append( new Param( "TYPE", "home" ) ); | 580 | if( p.type() & PhoneNumber::Home ) params.append( new Param( "TYPE", "home" ) ); |
581 | if( p.type() & PhoneNumber::Work ) params.append( new Param( "TYPE", "work" ) ); | 581 | if( p.type() & PhoneNumber::Work ) params.append( new Param( "TYPE", "work" ) ); |
582 | if( p.type() & PhoneNumber::Msg ) params.append( new Param( "TYPE", "msg" ) ); | 582 | if( p.type() & PhoneNumber::Msg ) params.append( new Param( "TYPE", "msg" ) ); |
583 | if( p.type() & PhoneNumber::Pref ) params.append( new Param( "TYPE", "pref" ) ); | 583 | if( p.type() & PhoneNumber::Pref ) params.append( new Param( "TYPE", "pref" ) ); |
584 | if( p.type() & PhoneNumber::Voice ) params.append( new Param( "TYPE", "voice" ) ); | 584 | if( p.type() & PhoneNumber::Voice ) params.append( new Param( "TYPE", "voice" ) ); |
585 | if( p.type() & PhoneNumber::Fax ) params.append( new Param( "TYPE", "fax" ) ); | 585 | if( p.type() & PhoneNumber::Fax ) params.append( new Param( "TYPE", "fax" ) ); |
586 | if( p.type() & PhoneNumber::Cell ) params.append( new Param( "TYPE", "cell" ) ); | 586 | if( p.type() & PhoneNumber::Cell ) params.append( new Param( "TYPE", "cell" ) ); |
587 | if( p.type() & PhoneNumber::Video ) params.append( new Param( "TYPE", "video" ) ); | 587 | if( p.type() & PhoneNumber::Video ) params.append( new Param( "TYPE", "video" ) ); |
588 | if( p.type() & PhoneNumber::Bbs ) params.append( new Param( "TYPE", "bbs" ) ); | 588 | if( p.type() & PhoneNumber::Bbs ) params.append( new Param( "TYPE", "bbs" ) ); |
589 | if( p.type() & PhoneNumber::Modem ) params.append( new Param( "TYPE", "modem" ) ); | 589 | if( p.type() & PhoneNumber::Modem ) params.append( new Param( "TYPE", "modem" ) ); |
590 | if( p.type() & PhoneNumber::Car ) params.append( new Param( "TYPE", "car" ) ); | 590 | if( p.type() & PhoneNumber::Car ) params.append( new Param( "TYPE", "car" ) ); |
591 | if( p.type() & PhoneNumber::Isdn ) params.append( new Param( "TYPE", "isdn" ) ); | 591 | if( p.type() & PhoneNumber::Isdn ) params.append( new Param( "TYPE", "isdn" ) ); |
592 | if( p.type() & PhoneNumber::Pcs ) params.append( new Param( "TYPE", "pcs" ) ); | 592 | if( p.type() & PhoneNumber::Pcs ) params.append( new Param( "TYPE", "pcs" ) ); |
593 | if( p.type() & PhoneNumber::Pager ) params.append( new Param( "TYPE", "pager" ) ); | 593 | if( p.type() & PhoneNumber::Pager ) params.append( new Param( "TYPE", "pager" ) ); |
594 | if( p.type() & PhoneNumber::Sip ) params.append( new Param( "TYPE", "sip" ) ); | ||
594 | cl.setParamList( params ); | 595 | cl.setParamList( params ); |
595 | 596 | ||
596 | v->add(cl); | 597 | v->add(cl); |
597 | } | 598 | } |
598 | 599 | ||
599 | PhoneNumber VCardFormatImpl::readTelephoneValue( ContentLine *cl ) | 600 | PhoneNumber VCardFormatImpl::readTelephoneValue( ContentLine *cl ) |
600 | { | 601 | { |
601 | PhoneNumber p; | 602 | PhoneNumber p; |
602 | TelValue *value = (TelValue *)cl->value(); | 603 | TelValue *value = (TelValue *)cl->value(); |
603 | p.setNumber( QString::fromUtf8( value->asString() ) ); | 604 | p.setNumber( QString::fromUtf8( value->asString() ) ); |
604 | 605 | ||
605 | int type = 0; | 606 | int type = 0; |
606 | ParamList params = cl->paramList(); | 607 | ParamList params = cl->paramList(); |
607 | ParamListIterator it( params ); | 608 | ParamListIterator it( params ); |
608 | QCString tmpStr; | 609 | QCString tmpStr; |
609 | for( ; it.current(); ++it ) { | 610 | for( ; it.current(); ++it ) { |
610 | if ( (*it)->name() == "TYPE" ) { | 611 | if ( (*it)->name() == "TYPE" ) { |
611 | tmpStr = (*it)->value().lower(); | 612 | tmpStr = (*it)->value().lower(); |
612 | if ( tmpStr == "home" ) type |= PhoneNumber::Home; | 613 | if ( tmpStr == "home" ) type |= PhoneNumber::Home; |
613 | else if ( tmpStr == "work" ) type |= PhoneNumber::Work; | 614 | else if ( tmpStr == "work" ) type |= PhoneNumber::Work; |
614 | else if ( tmpStr == "msg" ) type |= PhoneNumber::Msg; | 615 | else if ( tmpStr == "msg" ) type |= PhoneNumber::Msg; |
615 | else if ( tmpStr == "pref" ) type |= PhoneNumber::Pref; | 616 | else if ( tmpStr == "pref" ) type |= PhoneNumber::Pref; |
616 | else if ( tmpStr == "voice" ) type |= PhoneNumber::Voice; | 617 | else if ( tmpStr == "voice" ) type |= PhoneNumber::Voice; |
617 | else if ( tmpStr == "fax" ) type |= PhoneNumber::Fax; | 618 | else if ( tmpStr == "fax" ) type |= PhoneNumber::Fax; |
618 | else if ( tmpStr == "cell" ) type |= PhoneNumber::Cell; | 619 | else if ( tmpStr == "cell" ) type |= PhoneNumber::Cell; |
619 | else if ( tmpStr == "video" ) type |= PhoneNumber::Video; | 620 | else if ( tmpStr == "video" ) type |= PhoneNumber::Video; |
620 | else if ( tmpStr == "bbs" ) type |= PhoneNumber::Bbs; | 621 | else if ( tmpStr == "bbs" ) type |= PhoneNumber::Bbs; |
621 | else if ( tmpStr == "modem" ) type |= PhoneNumber::Modem; | 622 | else if ( tmpStr == "modem" ) type |= PhoneNumber::Modem; |
622 | else if ( tmpStr == "car" ) type |= PhoneNumber::Car; | 623 | else if ( tmpStr == "car" ) type |= PhoneNumber::Car; |
623 | else if ( tmpStr == "isdn" ) type |= PhoneNumber::Isdn; | 624 | else if ( tmpStr == "isdn" ) type |= PhoneNumber::Isdn; |
624 | else if ( tmpStr == "pcs" ) type |= PhoneNumber::Pcs; | 625 | else if ( tmpStr == "pcs" ) type |= PhoneNumber::Pcs; |
625 | else if ( tmpStr == "pager" ) type |= PhoneNumber::Pager; | 626 | else if ( tmpStr == "pager" ) type |= PhoneNumber::Pager; |
627 | else if ( tmpStr == "sip" ) type |= PhoneNumber::Sip; | ||
626 | } | 628 | } |
627 | } | 629 | } |
628 | p.setType( type ); | 630 | p.setType( type ); |
629 | 631 | ||
630 | return p; | 632 | return p; |
631 | } | 633 | } |
632 | 634 | ||
633 | QString VCardFormatImpl::readTextValue( ContentLine *cl ) | 635 | QString VCardFormatImpl::readTextValue( ContentLine *cl ) |
634 | { | 636 | { |
635 | VCARD::Value *value = cl->value(); | 637 | VCARD::Value *value = cl->value(); |
636 | if ( value ) { | 638 | if ( value ) { |
637 | return QString::fromUtf8( value->asString() ); | 639 | return QString::fromUtf8( value->asString() ); |
638 | } else { | 640 | } else { |
639 | kdDebug(5700) << "No value: " << cl->asString() << endl; | 641 | kdDebug(5700) << "No value: " << cl->asString() << endl; |
640 | return QString::null; | 642 | return QString::null; |
641 | } | 643 | } |
642 | } | 644 | } |
643 | 645 | ||
644 | QDate VCardFormatImpl::readDateValue( ContentLine *cl ) | 646 | QDate VCardFormatImpl::readDateValue( ContentLine *cl ) |
645 | { | 647 | { |
646 | DateValue *dateValue = (DateValue *)cl->value(); | 648 | DateValue *dateValue = (DateValue *)cl->value(); |
647 | if ( dateValue ) | 649 | if ( dateValue ) |
648 | return dateValue->qdate(); | 650 | return dateValue->qdate(); |
649 | else | 651 | else |
diff --git a/kabc/vcardparser/vcardtool.cpp b/kabc/vcardparser/vcardtool.cpp index 71f29d7..3fb212e 100644 --- a/kabc/vcardparser/vcardtool.cpp +++ b/kabc/vcardparser/vcardtool.cpp | |||
@@ -36,48 +36,49 @@ using namespace KABC; | |||
36 | VCardTool::VCardTool() | 36 | VCardTool::VCardTool() |
37 | { | 37 | { |
38 | mAddressTypeMap.insert( "dom", Address::Dom ); | 38 | mAddressTypeMap.insert( "dom", Address::Dom ); |
39 | mAddressTypeMap.insert( "intl", Address::Intl ); | 39 | mAddressTypeMap.insert( "intl", Address::Intl ); |
40 | mAddressTypeMap.insert( "postal", Address::Postal ); | 40 | mAddressTypeMap.insert( "postal", Address::Postal ); |
41 | mAddressTypeMap.insert( "parcel", Address::Parcel ); | 41 | mAddressTypeMap.insert( "parcel", Address::Parcel ); |
42 | mAddressTypeMap.insert( "home", Address::Home ); | 42 | mAddressTypeMap.insert( "home", Address::Home ); |
43 | mAddressTypeMap.insert( "work", Address::Work ); | 43 | mAddressTypeMap.insert( "work", Address::Work ); |
44 | mAddressTypeMap.insert( "pref", Address::Pref ); | 44 | mAddressTypeMap.insert( "pref", Address::Pref ); |
45 | 45 | ||
46 | mPhoneTypeMap.insert( "HOME", PhoneNumber::Home ); | 46 | mPhoneTypeMap.insert( "HOME", PhoneNumber::Home ); |
47 | mPhoneTypeMap.insert( "WORK", PhoneNumber::Work ); | 47 | mPhoneTypeMap.insert( "WORK", PhoneNumber::Work ); |
48 | mPhoneTypeMap.insert( "MSG", PhoneNumber::Msg ); | 48 | mPhoneTypeMap.insert( "MSG", PhoneNumber::Msg ); |
49 | mPhoneTypeMap.insert( "PREF", PhoneNumber::Pref ); | 49 | mPhoneTypeMap.insert( "PREF", PhoneNumber::Pref ); |
50 | mPhoneTypeMap.insert( "VOICE", PhoneNumber::Voice ); | 50 | mPhoneTypeMap.insert( "VOICE", PhoneNumber::Voice ); |
51 | mPhoneTypeMap.insert( "FAX", PhoneNumber::Fax ); | 51 | mPhoneTypeMap.insert( "FAX", PhoneNumber::Fax ); |
52 | mPhoneTypeMap.insert( "CELL", PhoneNumber::Cell ); | 52 | mPhoneTypeMap.insert( "CELL", PhoneNumber::Cell ); |
53 | mPhoneTypeMap.insert( "VIDEO", PhoneNumber::Video ); | 53 | mPhoneTypeMap.insert( "VIDEO", PhoneNumber::Video ); |
54 | mPhoneTypeMap.insert( "BBS", PhoneNumber::Bbs ); | 54 | mPhoneTypeMap.insert( "BBS", PhoneNumber::Bbs ); |
55 | mPhoneTypeMap.insert( "MODEM", PhoneNumber::Modem ); | 55 | mPhoneTypeMap.insert( "MODEM", PhoneNumber::Modem ); |
56 | mPhoneTypeMap.insert( "CAR", PhoneNumber::Car ); | 56 | mPhoneTypeMap.insert( "CAR", PhoneNumber::Car ); |
57 | mPhoneTypeMap.insert( "ISDN", PhoneNumber::Isdn ); | 57 | mPhoneTypeMap.insert( "ISDN", PhoneNumber::Isdn ); |
58 | mPhoneTypeMap.insert( "PCS", PhoneNumber::Pcs ); | 58 | mPhoneTypeMap.insert( "PCS", PhoneNumber::Pcs ); |
59 | mPhoneTypeMap.insert( "PAGER", PhoneNumber::Pager ); | 59 | mPhoneTypeMap.insert( "PAGER", PhoneNumber::Pager ); |
60 | mPhoneTypeMap.insert( "SIP", PhoneNumber::Sip ); | ||
60 | } | 61 | } |
61 | 62 | ||
62 | VCardTool::~VCardTool() | 63 | VCardTool::~VCardTool() |
63 | { | 64 | { |
64 | } | 65 | } |
65 | 66 | ||
66 | QString VCardTool::createVCards( Addressee::List list, VCard::Version version ) | 67 | QString VCardTool::createVCards( Addressee::List list, VCard::Version version ) |
67 | { | 68 | { |
68 | VCard::List vCardList; | 69 | VCard::List vCardList; |
69 | 70 | ||
70 | Addressee::List::Iterator addrIt; | 71 | Addressee::List::Iterator addrIt; |
71 | for ( addrIt = list.begin(); addrIt != list.end(); ++addrIt ) { | 72 | for ( addrIt = list.begin(); addrIt != list.end(); ++addrIt ) { |
72 | VCard card; | 73 | VCard card; |
73 | QStringList::ConstIterator strIt; | 74 | QStringList::ConstIterator strIt; |
74 | 75 | ||
75 | // ADR + LABEL | 76 | // ADR + LABEL |
76 | Address::List addresses = (*addrIt).addresses(); | 77 | Address::List addresses = (*addrIt).addresses(); |
77 | for ( Address::List::Iterator it = addresses.begin(); it != addresses.end(); ++it ) { | 78 | for ( Address::List::Iterator it = addresses.begin(); it != addresses.end(); ++it ) { |
78 | QStringList address; | 79 | QStringList address; |
79 | 80 | ||
80 | /*US | 81 | /*US |
81 | address.append( (*it).postOfficeBox().replace( ';', "\\;" ) ); | 82 | address.append( (*it).postOfficeBox().replace( ';', "\\;" ) ); |
82 | address.append( (*it).extended().replace( ';', "\\;" ) ); | 83 | address.append( (*it).extended().replace( ';', "\\;" ) ); |
83 | address.append( (*it).street().replace( ';', "\\;" ) ); | 84 | address.append( (*it).street().replace( ';', "\\;" ) ); |