summaryrefslogtreecommitdiff
path: root/libopie2/opiepim
Unidiff
Diffstat (limited to 'libopie2/opiepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp40
1 files changed, 26 insertions, 14 deletions
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp
index f3b6d56..0ffbb67 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp
+++ b/libopie2/opiepim/backend/ocontactaccessbackend_vcard.cpp
@@ -443,52 +443,64 @@ VObject* OPimContactAccessBackend_VCard::createVObject( const OPimContact &c )
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 VObject *home_adr= safeAddProp( vcard, VCAdrProp ); 455 if ( !( c.homeStreet().isEmpty()
456 safeAddProp( home_adr, VCHomeProp ); 456 && c.homeCity().isEmpty()
457 safeAddPropValue( home_adr, VCStreetAddressProp, c.homeStreet() ); 457 && c.homeState().isEmpty()
458 safeAddPropValue( home_adr, VCCityProp, c.homeCity() ); 458 && c.homeZip().isEmpty()
459 safeAddPropValue( home_adr, VCRegionProp, c.homeState() ); 459 && c.homeCountry().isEmpty() ) ){
460 safeAddPropValue( home_adr, VCPostalCodeProp, c.homeZip() ); 460 VObject *home_adr= safeAddProp( vcard, VCAdrProp );
461 safeAddPropValue( home_adr, VCCountryNameProp, c.homeCountry() ); 461 safeAddProp( home_adr, VCHomeProp );
462 safeAddPropValue( home_adr, VCStreetAddressProp, c.homeStreet() );
463 safeAddPropValue( home_adr, VCCityProp, c.homeCity() );
464 safeAddPropValue( home_adr, VCRegionProp, c.homeState() );
465 safeAddPropValue( home_adr, VCPostalCodeProp, c.homeZip() );
466 safeAddPropValue( home_adr, VCCountryNameProp, c.homeCountry() );
467 }
462 468
463 VObject *home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homePhone() ); 469 VObject *home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homePhone() );
464 safeAddProp( home_phone, VCHomeProp ); 470 safeAddProp( home_phone, VCHomeProp );
465 home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeMobile() ); 471 home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeMobile() );
466 safeAddProp( home_phone, VCHomeProp ); 472 safeAddProp( home_phone, VCHomeProp );
467 safeAddProp( home_phone, VCCellularProp ); 473 safeAddProp( home_phone, VCCellularProp );
468 home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeFax() ); 474 home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeFax() );
469 safeAddProp( home_phone, VCHomeProp ); 475 safeAddProp( home_phone, VCHomeProp );
470 safeAddProp( home_phone, VCFaxProp ); 476 safeAddProp( home_phone, VCFaxProp );
471 477
472 VObject *url = safeAddPropValue( vcard, VCURLProp, c.homeWebpage() ); 478 VObject *url = safeAddPropValue( vcard, VCURLProp, c.homeWebpage() );
473 safeAddProp( url, VCHomeProp ); 479 safeAddProp( url, VCHomeProp );
474 480
475 // work properties 481 // work properties
476 VObject *work_adr= safeAddProp( vcard, VCAdrProp ); 482 if ( !( c.businessStreet().isEmpty()
477 safeAddProp( work_adr, VCWorkProp ); 483 && c.businessCity().isEmpty()
478 safeAddPropValue( work_adr, VCStreetAddressProp, c.businessStreet() ); 484 && c.businessState().isEmpty()
479 safeAddPropValue( work_adr, VCCityProp, c.businessCity() ); 485 && c.businessZip().isEmpty()
480 safeAddPropValue( work_adr, VCRegionProp, c.businessState() ); 486 && c.businessCountry().isEmpty() ) ){
481 safeAddPropValue( work_adr, VCPostalCodeProp, c.businessZip() ); 487 VObject *work_adr= safeAddProp( vcard, VCAdrProp );
482 safeAddPropValue( work_adr, VCCountryNameProp, c.businessCountry() ); 488 safeAddProp( work_adr, VCWorkProp );
489 safeAddPropValue( work_adr, VCStreetAddressProp, c.businessStreet() );
490 safeAddPropValue( work_adr, VCCityProp, c.businessCity() );
491 safeAddPropValue( work_adr, VCRegionProp, c.businessState() );
492 safeAddPropValue( work_adr, VCPostalCodeProp, c.businessZip() );
493 safeAddPropValue( work_adr, VCCountryNameProp, c.businessCountry() );
494 }
483 495
484 VObject *work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPhone() ); 496 VObject *work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPhone() );
485 safeAddProp( work_phone, VCWorkProp ); 497 safeAddProp( work_phone, VCWorkProp );
486 work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessMobile() ); 498 work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessMobile() );
487 safeAddProp( work_phone, VCWorkProp ); 499 safeAddProp( work_phone, VCWorkProp );
488 safeAddProp( work_phone, VCCellularProp ); 500 safeAddProp( work_phone, VCCellularProp );
489 work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessFax() ); 501 work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessFax() );
490 safeAddProp( work_phone, VCWorkProp ); 502 safeAddProp( work_phone, VCWorkProp );
491 safeAddProp( work_phone, VCFaxProp ); 503 safeAddProp( work_phone, VCFaxProp );
492 work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPager() ); 504 work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPager() );
493 safeAddProp( work_phone, VCWorkProp ); 505 safeAddProp( work_phone, VCWorkProp );
494 safeAddProp( work_phone, VCPagerProp ); 506 safeAddProp( work_phone, VCPagerProp );