summaryrefslogtreecommitdiff
authorar <ar>2005-12-10 16:43:43 (UTC)
committer ar <ar>2005-12-10 16:43:43 (UTC)
commit3948be20fed2f54054eda97f7a203084e904093b (patch) (unidiff)
tree920892aa9efe49cf040fe4bf5bc883ea947792cf
parentbb9f3cb27500b70124985fd51f90b7f8ded33588 (diff)
downloadopie-3948be20fed2f54054eda97f7a203084e904093b.zip
opie-3948be20fed2f54054eda97f7a203084e904093b.tar.gz
opie-3948be20fed2f54054eda97f7a203084e904093b.tar.bz2
- fix a problem with Sony Ericsson GSM. It can only handle vCards whitch have first set Cellular, Fax, Pager property and then HOME or WORK property.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp
index 0ffbb67..5bc2755 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp
+++ b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp
@@ -424,131 +424,131 @@ OPimContact OPimContactAccessBackend_VCard::parseVObject( VObject *obj )
424 QCString name = vObjectName( o ); 424 QCString name = vObjectName( o );
425 QString value = vObjectStringZValue( o ); 425 QString value = vObjectStringZValue( o );
426 printf(" subprop: %s = %s\n", name.data(), value.latin1() ); 426 printf(" subprop: %s = %s\n", name.data(), value.latin1() );
427 } 427 }
428 } 428 }
429#endif 429#endif
430 } 430 }
431 c.setFileAs(); 431 c.setFileAs();
432 return c; 432 return c;
433} 433}
434 434
435 435
436VObject* OPimContactAccessBackend_VCard::createVObject( const OPimContact &c ) 436VObject* OPimContactAccessBackend_VCard::createVObject( const OPimContact &c )
437{ 437{
438 VObject *vcard = newVObject( VCCardProp ); 438 VObject *vcard = newVObject( VCCardProp );
439 safeAddPropValue( vcard, VCVersionProp, "2.1" ); 439 safeAddPropValue( vcard, VCVersionProp, "2.1" );
440 safeAddPropValue( vcard, VCLastRevisedProp, TimeConversion::toISO8601( QDateTime::currentDateTime() ) ); 440 safeAddPropValue( vcard, VCLastRevisedProp, TimeConversion::toISO8601( QDateTime::currentDateTime() ) );
441 safeAddPropValue( vcard, VCUniqueStringProp, QString::number(c.uid()) ); 441 safeAddPropValue( vcard, VCUniqueStringProp, QString::number(c.uid()) );
442 442
443 // full name 443 // full name
444 safeAddPropValue( vcard, VCFullNameProp, c.fullName() ); 444 safeAddPropValue( vcard, VCFullNameProp, c.fullName() );
445 445
446 // name properties 446 // name properties
447 VObject *name = safeAddProp( vcard, VCNameProp ); 447 VObject *name = safeAddProp( vcard, VCNameProp );
448 safeAddPropValue( name, VCFamilyNameProp, c.lastName() ); 448 safeAddPropValue( name, VCFamilyNameProp, c.lastName() );
449 safeAddPropValue( name, VCGivenNameProp, c.firstName() ); 449 safeAddPropValue( name, VCGivenNameProp, c.firstName() );
450 safeAddPropValue( name, VCAdditionalNamesProp, c.middleName() ); 450 safeAddPropValue( name, VCAdditionalNamesProp, c.middleName() );
451 safeAddPropValue( name, VCNamePrefixesProp, c.title() ); 451 safeAddPropValue( name, VCNamePrefixesProp, c.title() );
452 safeAddPropValue( name, VCNameSuffixesProp, c.suffix() ); 452 safeAddPropValue( name, VCNameSuffixesProp, c.suffix() );
453 453
454 // home properties 454 // home properties
455 if ( !( c.homeStreet().isEmpty() 455 if ( !( c.homeStreet().isEmpty()
456 && c.homeCity().isEmpty() 456 && c.homeCity().isEmpty()
457 && c.homeState().isEmpty() 457 && c.homeState().isEmpty()
458 && c.homeZip().isEmpty() 458 && c.homeZip().isEmpty()
459 && c.homeCountry().isEmpty() ) ){ 459 && c.homeCountry().isEmpty() ) ){
460 VObject *home_adr= safeAddProp( vcard, VCAdrProp ); 460 VObject *home_adr= safeAddProp( vcard, VCAdrProp );
461 safeAddProp( home_adr, VCHomeProp ); 461 safeAddProp( home_adr, VCHomeProp );
462 safeAddPropValue( home_adr, VCStreetAddressProp, c.homeStreet() ); 462 safeAddPropValue( home_adr, VCStreetAddressProp, c.homeStreet() );
463 safeAddPropValue( home_adr, VCCityProp, c.homeCity() ); 463 safeAddPropValue( home_adr, VCCityProp, c.homeCity() );
464 safeAddPropValue( home_adr, VCRegionProp, c.homeState() ); 464 safeAddPropValue( home_adr, VCRegionProp, c.homeState() );
465 safeAddPropValue( home_adr, VCPostalCodeProp, c.homeZip() ); 465 safeAddPropValue( home_adr, VCPostalCodeProp, c.homeZip() );
466 safeAddPropValue( home_adr, VCCountryNameProp, c.homeCountry() ); 466 safeAddPropValue( home_adr, VCCountryNameProp, c.homeCountry() );
467 } 467 }
468 468
469 VObject *home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homePhone() ); 469 VObject *home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homePhone() );
470 safeAddProp( home_phone, VCHomeProp ); 470 safeAddProp( home_phone, VCHomeProp );
471 home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeMobile() ); 471 home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeMobile() );
472 safeAddProp( home_phone, VCHomeProp );
473 safeAddProp( home_phone, VCCellularProp ); 472 safeAddProp( home_phone, VCCellularProp );
474 home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeFax() );
475 safeAddProp( home_phone, VCHomeProp ); 473 safeAddProp( home_phone, VCHomeProp );
474 home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeFax() );
476 safeAddProp( home_phone, VCFaxProp ); 475 safeAddProp( home_phone, VCFaxProp );
476 safeAddProp( home_phone, VCHomeProp );
477 477
478 VObject *url = safeAddPropValue( vcard, VCURLProp, c.homeWebpage() ); 478 VObject *url = safeAddPropValue( vcard, VCURLProp, c.homeWebpage() );
479 safeAddProp( url, VCHomeProp ); 479 safeAddProp( url, VCHomeProp );
480 480
481 // work properties 481 // work properties
482 if ( !( c.businessStreet().isEmpty() 482 if ( !( c.businessStreet().isEmpty()
483 && c.businessCity().isEmpty() 483 && c.businessCity().isEmpty()
484 && c.businessState().isEmpty() 484 && c.businessState().isEmpty()
485 && c.businessZip().isEmpty() 485 && c.businessZip().isEmpty()
486 && c.businessCountry().isEmpty() ) ){ 486 && c.businessCountry().isEmpty() ) ){
487 VObject *work_adr= safeAddProp( vcard, VCAdrProp ); 487 VObject *work_adr= safeAddProp( vcard, VCAdrProp );
488 safeAddProp( work_adr, VCWorkProp ); 488 safeAddProp( work_adr, VCWorkProp );
489 safeAddPropValue( work_adr, VCStreetAddressProp, c.businessStreet() ); 489 safeAddPropValue( work_adr, VCStreetAddressProp, c.businessStreet() );
490 safeAddPropValue( work_adr, VCCityProp, c.businessCity() ); 490 safeAddPropValue( work_adr, VCCityProp, c.businessCity() );
491 safeAddPropValue( work_adr, VCRegionProp, c.businessState() ); 491 safeAddPropValue( work_adr, VCRegionProp, c.businessState() );
492 safeAddPropValue( work_adr, VCPostalCodeProp, c.businessZip() ); 492 safeAddPropValue( work_adr, VCPostalCodeProp, c.businessZip() );
493 safeAddPropValue( work_adr, VCCountryNameProp, c.businessCountry() ); 493 safeAddPropValue( work_adr, VCCountryNameProp, c.businessCountry() );
494 } 494 }
495 495
496 VObject *work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPhone() ); 496 VObject *work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPhone() );
497 safeAddProp( work_phone, VCWorkProp ); 497 safeAddProp( work_phone, VCWorkProp );
498 work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessMobile() ); 498 work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessMobile() );
499 safeAddProp( work_phone, VCWorkProp );
500 safeAddProp( work_phone, VCCellularProp ); 499 safeAddProp( work_phone, VCCellularProp );
501 work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessFax() );
502 safeAddProp( work_phone, VCWorkProp ); 500 safeAddProp( work_phone, VCWorkProp );
501 work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessFax() );
503 safeAddProp( work_phone, VCFaxProp ); 502 safeAddProp( work_phone, VCFaxProp );
504 work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPager() );
505 safeAddProp( work_phone, VCWorkProp ); 503 safeAddProp( work_phone, VCWorkProp );
504 work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPager() );
506 safeAddProp( work_phone, VCPagerProp ); 505 safeAddProp( work_phone, VCPagerProp );
506 safeAddProp( work_phone, VCWorkProp );
507 507
508 url = safeAddPropValue( vcard, VCURLProp, c.businessWebpage() ); 508 url = safeAddPropValue( vcard, VCURLProp, c.businessWebpage() );
509 safeAddProp( url, VCWorkProp ); 509 safeAddProp( url, VCWorkProp );
510 510
511 VObject *title = safeAddPropValue( vcard, VCTitleProp, c.jobTitle() ); 511 VObject *title = safeAddPropValue( vcard, VCTitleProp, c.jobTitle() );
512 safeAddProp( title, VCWorkProp ); 512 safeAddProp( title, VCWorkProp );
513 513
514 514
515 QStringList emails = c.emailList(); 515 QStringList emails = c.emailList();
516 // emails.prepend( c.defaultEmail() ); Fix for bugreport #1045 516 // emails.prepend( c.defaultEmail() ); Fix for bugreport #1045
517 for( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) { 517 for( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) {
518 VObject *email = safeAddPropValue( vcard, VCEmailAddressProp, *it ); 518 VObject *email = safeAddPropValue( vcard, VCEmailAddressProp, *it );
519 safeAddProp( email, VCInternetProp ); 519 safeAddProp( email, VCInternetProp );
520 } 520 }
521 521
522 safeAddPropValue( vcard, VCNoteProp, c.notes() ); 522 safeAddPropValue( vcard, VCNoteProp, c.notes() );
523 523
524 // Exporting Birthday regarding RFC 2425 (5.8.4) 524 // Exporting Birthday regarding RFC 2425 (5.8.4)
525 if ( c.birthday().isValid() ){ 525 if ( c.birthday().isValid() ){
526 safeAddPropValue( vcard, VCBirthDateProp, convDateToVCardDate( c.birthday() ) ); 526 safeAddPropValue( vcard, VCBirthDateProp, convDateToVCardDate( c.birthday() ) );
527 } 527 }
528 528
529 if ( !c.company().isEmpty() || !c.department().isEmpty() || !c.office().isEmpty() ) { 529 if ( !c.company().isEmpty() || !c.department().isEmpty() || !c.office().isEmpty() ) {
530 VObject *org = safeAddProp( vcard, VCOrgProp ); 530 VObject *org = safeAddProp( vcard, VCOrgProp );
531 safeAddPropValue( org, VCOrgNameProp, c.company() ); 531 safeAddPropValue( org, VCOrgNameProp, c.company() );
532 safeAddPropValue( org, VCOrgUnitProp, c.department() ); 532 safeAddPropValue( org, VCOrgUnitProp, c.department() );
533 safeAddPropValue( org, VCOrgUnit2Prop, c.office() ); 533 safeAddPropValue( org, VCOrgUnit2Prop, c.office() );
534 } 534 }
535 535
536 // some values we have to export as custom fields 536 // some values we have to export as custom fields
537 safeAddPropValue( vcard, "X-Qtopia-Profession", c.profession() ); 537 safeAddPropValue( vcard, "X-Qtopia-Profession", c.profession() );
538 safeAddPropValue( vcard, "X-Qtopia-Manager", c.manager() ); 538 safeAddPropValue( vcard, "X-Qtopia-Manager", c.manager() );
539 safeAddPropValue( vcard, "X-Qtopia-Assistant", c.assistant() ); 539 safeAddPropValue( vcard, "X-Qtopia-Assistant", c.assistant() );
540 540
541 safeAddPropValue( vcard, "X-Qtopia-Spouse", c.spouse() ); 541 safeAddPropValue( vcard, "X-Qtopia-Spouse", c.spouse() );
542 safeAddPropValue( vcard, "X-Qtopia-Gender", c.gender() ); 542 safeAddPropValue( vcard, "X-Qtopia-Gender", c.gender() );
543 if ( c.anniversary().isValid() ){ 543 if ( c.anniversary().isValid() ){
544 safeAddPropValue( vcard, "X-Qtopia-Anniversary", convDateToVCardDate( c.anniversary() ) ); 544 safeAddPropValue( vcard, "X-Qtopia-Anniversary", convDateToVCardDate( c.anniversary() ) );
545 } 545 }
546 safeAddPropValue( vcard, "X-Qtopia-Nickname", c.nickname() ); 546 safeAddPropValue( vcard, "X-Qtopia-Nickname", c.nickname() );
547 safeAddPropValue( vcard, "X-Qtopia-Children", c.children() ); 547 safeAddPropValue( vcard, "X-Qtopia-Children", c.children() );
548 548
549 return vcard; 549 return vcard;
550} 550}
551 551
552QString OPimContactAccessBackend_VCard::convDateToVCardDate( const QDate& d ) const 552QString OPimContactAccessBackend_VCard::convDateToVCardDate( const QDate& d ) const
553{ 553{
554 QString str_rfc2425 = QString("%1-%2-%3") 554 QString str_rfc2425 = QString("%1-%2-%3")