summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/ocontact.cpp29
-rw-r--r--libopie2/opiepim/ocontact.cpp29
2 files changed, 42 insertions, 16 deletions
diff --git a/libopie/pim/ocontact.cpp b/libopie/pim/ocontact.cpp
index 734f5a2..bf27d0f 100644
--- a/libopie/pim/ocontact.cpp
+++ b/libopie/pim/ocontact.cpp
@@ -478,198 +478,198 @@ QString OContact::toRichText() const
478 if ( !(value = businessCountry()).isEmpty() ) 478 if ( !(value = businessCountry()).isEmpty() )
479 text += Qtopia::escapeString(value) + "<br>"; 479 text += Qtopia::escapeString(value) + "<br>";
480 480
481 // home address 481 // home address
482 if ( !homeStreet().isEmpty() || !homeCity().isEmpty() || 482 if ( !homeStreet().isEmpty() || !homeCity().isEmpty() ||
483 !homeZip().isEmpty() || !homeCountry().isEmpty() ) { 483 !homeZip().isEmpty() || !homeCountry().isEmpty() ) {
484 text += "<br>"; 484 text += "<br>";
485 text += QObject::tr( "<b>Home Address:</b>" ); 485 text += QObject::tr( "<b>Home Address:</b>" );
486 text += "<br>"; 486 text += "<br>";
487 } 487 }
488 488
489 if ( !(value = homeStreet()).isEmpty() ) 489 if ( !(value = homeStreet()).isEmpty() )
490 text += Qtopia::escapeString(value) + "<br>"; 490 text += Qtopia::escapeString(value) + "<br>";
491 state = homeState(); 491 state = homeState();
492 if ( !(value = homeCity()).isEmpty() ) { 492 if ( !(value = homeCity()).isEmpty() ) {
493 text += Qtopia::escapeString(value); 493 text += Qtopia::escapeString(value);
494 if ( !state.isEmpty() ) 494 if ( !state.isEmpty() )
495 text += ", " + Qtopia::escapeString(state); 495 text += ", " + Qtopia::escapeString(state);
496 text += "<br>"; 496 text += "<br>";
497 } else if (!state.isEmpty()) 497 } else if (!state.isEmpty())
498 text += Qtopia::escapeString(state) + "<br>"; 498 text += Qtopia::escapeString(state) + "<br>";
499 if ( !(value = homeZip()).isEmpty() ) 499 if ( !(value = homeZip()).isEmpty() )
500 text += Qtopia::escapeString(value) + "<br>"; 500 text += Qtopia::escapeString(value) + "<br>";
501 if ( !(value = homeCountry()).isEmpty() ) 501 if ( !(value = homeCountry()).isEmpty() )
502 text += Qtopia::escapeString(value) + "<br>"; 502 text += Qtopia::escapeString(value) + "<br>";
503 503
504 // the others... 504 // the others...
505 QString str; 505 QString str;
506 str = emails(); 506 str = emails();
507 if ( !str.isEmpty() ) 507 if ( !str.isEmpty() )
508 text += "<b>" + QObject::tr("Email Addresses: ") + "</b>" 508 text += "<b>" + QObject::tr("Email Addresses: ") + "</b>"
509 + Qtopia::escapeString(str) + "<br>"; 509 + Qtopia::escapeString(str) + "<br>";
510 str = homePhone(); 510 str = homePhone();
511 if ( !str.isEmpty() ) 511 if ( !str.isEmpty() )
512 text += "<b>" + QObject::tr("Home Phone: ") + "</b>" 512 text += "<b>" + QObject::tr("Home Phone: ") + "</b>"
513 + Qtopia::escapeString(str) + "<br>"; 513 + Qtopia::escapeString(str) + "<br>";
514 str = homeFax(); 514 str = homeFax();
515 if ( !str.isEmpty() ) 515 if ( !str.isEmpty() )
516 text += "<b>" + QObject::tr("Home Fax: ") + "</b>" 516 text += "<b>" + QObject::tr("Home Fax: ") + "</b>"
517 + Qtopia::escapeString(str) + "<br>"; 517 + Qtopia::escapeString(str) + "<br>";
518 str = homeMobile(); 518 str = homeMobile();
519 if ( !str.isEmpty() ) 519 if ( !str.isEmpty() )
520 text += "<b>" + QObject::tr("Home Mobile: ") + "</b>" 520 text += "<b>" + QObject::tr("Home Mobile: ") + "</b>"
521 + Qtopia::escapeString(str) + "<br>"; 521 + Qtopia::escapeString(str) + "<br>";
522 str = homeWebpage(); 522 str = homeWebpage();
523 if ( !str.isEmpty() ) 523 if ( !str.isEmpty() )
524 text += "<b>" + QObject::tr("Home Web Page: ") + "</b>" 524 text += "<b>" + QObject::tr("Home Web Page: ") + "</b>"
525 + Qtopia::escapeString(str) + "<br>"; 525 + Qtopia::escapeString(str) + "<br>";
526 str = businessWebpage(); 526 str = businessWebpage();
527 if ( !str.isEmpty() ) 527 if ( !str.isEmpty() )
528 text += "<b>" + QObject::tr("Business Web Page: ") + "</b>" 528 text += "<b>" + QObject::tr("Business Web Page: ") + "</b>"
529 + Qtopia::escapeString(str) + "<br>"; 529 + Qtopia::escapeString(str) + "<br>";
530 str = office(); 530 str = office();
531 if ( !str.isEmpty() ) 531 if ( !str.isEmpty() )
532 text += "<b>" + QObject::tr("Office: ") + "</b>" 532 text += "<b>" + QObject::tr("Office: ") + "</b>"
533 + Qtopia::escapeString(str) + "<br>"; 533 + Qtopia::escapeString(str) + "<br>";
534 str = businessPhone(); 534 str = businessPhone();
535 if ( !str.isEmpty() ) 535 if ( !str.isEmpty() )
536 text += "<b>" + QObject::tr("Business Phone: ") + "</b>" 536 text += "<b>" + QObject::tr("Business Phone: ") + "</b>"
537 + Qtopia::escapeString(str) + "<br>"; 537 + Qtopia::escapeString(str) + "<br>";
538 str = businessFax(); 538 str = businessFax();
539 if ( !str.isEmpty() ) 539 if ( !str.isEmpty() )
540 text += "<b>" + QObject::tr("Business Fax: ") + "</b>" 540 text += "<b>" + QObject::tr("Business Fax: ") + "</b>"
541 + Qtopia::escapeString(str) + "<br>"; 541 + Qtopia::escapeString(str) + "<br>";
542 str = businessMobile(); 542 str = businessMobile();
543 if ( !str.isEmpty() ) 543 if ( !str.isEmpty() )
544 text += "<b>" + QObject::tr("Business Mobile: ") + "</b>" 544 text += "<b>" + QObject::tr("Business Mobile: ") + "</b>"
545 + Qtopia::escapeString(str) + "<br>"; 545 + Qtopia::escapeString(str) + "<br>";
546 str = businessPager(); 546 str = businessPager();
547 if ( !str.isEmpty() ) 547 if ( !str.isEmpty() )
548 text += "<b>" + QObject::tr("Business Pager: ") + "</b>" 548 text += "<b>" + QObject::tr("Business Pager: ") + "</b>"
549 + Qtopia::escapeString(str) + "<br>"; 549 + Qtopia::escapeString(str) + "<br>";
550 str = profession(); 550 str = profession();
551 if ( !str.isEmpty() ) 551 if ( !str.isEmpty() )
552 text += "<b>" + QObject::tr("Profession: ") + "</b>" 552 text += "<b>" + QObject::tr("Profession: ") + "</b>"
553 + Qtopia::escapeString(str) + "<br>"; 553 + Qtopia::escapeString(str) + "<br>";
554 str = assistant(); 554 str = assistant();
555 if ( !str.isEmpty() ) 555 if ( !str.isEmpty() )
556 text += "<b>" + QObject::tr("Assistant: ") + "</b>" 556 text += "<b>" + QObject::tr("Assistant: ") + "</b>"
557 + Qtopia::escapeString(str) + "<br>"; 557 + Qtopia::escapeString(str) + "<br>";
558 str = manager(); 558 str = manager();
559 if ( !str.isEmpty() ) 559 if ( !str.isEmpty() )
560 text += "<b>" + QObject::tr("Manager: ") + "</b>" 560 text += "<b>" + QObject::tr("Manager: ") + "</b>"
561 + Qtopia::escapeString(str) + "<br>"; 561 + Qtopia::escapeString(str) + "<br>";
562 str = gender(); 562 str = gender();
563 if ( !str.isEmpty() && str.toInt() != 0 ) { 563 if ( !str.isEmpty() && str.toInt() != 0 ) {
564 if ( str.toInt() == 1 ) 564 if ( str.toInt() == 1 )
565 str = QObject::tr( "Male" ); 565 str = QObject::tr( "Male" );
566 else if ( str.toInt() == 2 ) 566 else if ( str.toInt() == 2 )
567 str = QObject::tr( "Female" ); 567 str = QObject::tr( "Female" );
568 text += "<b>" + QObject::tr("Gender: ") + "</b>" + str + "<br>"; 568 text += "<b>" + QObject::tr("Gender: ") + "</b>" + str + "<br>";
569 } 569 }
570 str = spouse(); 570 str = spouse();
571 if ( !str.isEmpty() ) 571 if ( !str.isEmpty() )
572 text += "<b>" + QObject::tr("Spouse: ") + "</b>" 572 text += "<b>" + QObject::tr("Spouse: ") + "</b>"
573 + Qtopia::escapeString(str) + "<br>"; 573 + Qtopia::escapeString(str) + "<br>";
574 if ( !birthday().isNull() ){ 574 if ( !birthday().isValid() ){
575 str = TimeString::numberDateString( birthday() ); 575 str = TimeString::numberDateString( birthday() );
576 text += "<b>" + QObject::tr("Birthday: ") + "</b>" 576 text += "<b>" + QObject::tr("Birthday: ") + "</b>"
577 + Qtopia::escapeString(str) + "<br>"; 577 + Qtopia::escapeString(str) + "<br>";
578 } 578 }
579 if ( !anniversary().isNull() ){ 579 if ( !anniversary().isValid() ){
580 str = TimeString::numberDateString( anniversary() ); 580 str = TimeString::numberDateString( anniversary() );
581 text += "<b>" + QObject::tr("Anniversary: ") + "</b>" 581 text += "<b>" + QObject::tr("Anniversary: ") + "</b>"
582 + Qtopia::escapeString(str) + "<br>"; 582 + Qtopia::escapeString(str) + "<br>";
583 } 583 }
584 str = nickname(); 584 str = nickname();
585 if ( !str.isEmpty() ) 585 if ( !str.isEmpty() )
586 text += "<b>" + QObject::tr("Nickname: ") + "</b>" 586 text += "<b>" + QObject::tr("Nickname: ") + "</b>"
587 + Qtopia::escapeString(str) + "<br>"; 587 + Qtopia::escapeString(str) + "<br>";
588 588
589 // notes last 589 // notes last
590 if ( (value = notes()) ) { 590 if ( (value = notes()) ) {
591 QRegExp reg("\n"); 591 QRegExp reg("\n");
592 592
593 //QString tmp = Qtopia::escapeString(value); 593 //QString tmp = Qtopia::escapeString(value);
594 QString tmp = QStyleSheet::convertFromPlainText(value); 594 QString tmp = QStyleSheet::convertFromPlainText(value);
595 //tmp.replace( reg, "<br>" ); 595 //tmp.replace( reg, "<br>" );
596 text += "<br>" + tmp + "<br>"; 596 text += "<br>" + tmp + "<br>";
597 } 597 }
598 return text; 598 return text;
599} 599}
600 600
601/*! 601/*!
602 \internal 602 \internal
603*/ 603*/
604void OContact::insert( int key, const QString &v ) 604void OContact::insert( int key, const QString &v )
605{ 605{
606 QString value = v.stripWhiteSpace(); 606 QString value = v.stripWhiteSpace();
607 if ( value.isEmpty() ) 607 if ( value.isEmpty() )
608 mMap.remove( key ); 608 mMap.remove( key );
609 else 609 else
610 mMap.insert( key, value ); 610 mMap.insert( key, value );
611} 611}
612 612
613/*! 613/*!
614 \internal 614 \internal
615*/ 615*/
616void OContact::replace( int key, const QString & v ) 616void OContact::replace( int key, const QString & v )
617{ 617{
618 QString value = v.stripWhiteSpace(); 618 QString value = v.stripWhiteSpace();
619 if ( value.isEmpty() ) 619 if ( value.isEmpty() )
620 mMap.remove( key ); 620 mMap.remove( key );
621 else 621 else
622 mMap.replace( key, value ); 622 mMap.replace( key, value );
623} 623}
624 624
625/*! 625/*!
626 \internal 626 \internal
627*/ 627*/
628QString OContact::find( int key ) const 628QString OContact::find( int key ) const
629{ 629{
630 return mMap[key]; 630 return mMap[key];
631} 631}
632 632
633/*! 633/*!
634 \internal 634 \internal
635*/ 635*/
636QString OContact::displayAddress( const QString &street, 636QString OContact::displayAddress( const QString &street,
637 const QString &city, 637 const QString &city,
638 const QString &state, 638 const QString &state,
639 const QString &zip, 639 const QString &zip,
640 const QString &country ) const 640 const QString &country ) const
641{ 641{
642 QString s = street; 642 QString s = street;
643 if ( !street.isEmpty() ) 643 if ( !street.isEmpty() )
644 s+= "\n"; 644 s+= "\n";
645 s += city; 645 s += city;
646 if ( !city.isEmpty() && !state.isEmpty() ) 646 if ( !city.isEmpty() && !state.isEmpty() )
647 s += ", "; 647 s += ", ";
648 s += state; 648 s += state;
649 if ( !state.isEmpty() && !zip.isEmpty() ) 649 if ( !state.isEmpty() && !zip.isEmpty() )
650 s += " "; 650 s += " ";
651 s += zip; 651 s += zip;
652 if ( !country.isEmpty() && !s.isEmpty() ) 652 if ( !country.isEmpty() && !s.isEmpty() )
653 s += "\n"; 653 s += "\n";
654 s += country; 654 s += country;
655 return s; 655 return s;
656} 656}
657 657
658/*! 658/*!
659 \internal 659 \internal
660*/ 660*/
661QString OContact::displayBusinessAddress() const 661QString OContact::displayBusinessAddress() const
662{ 662{
663 return displayAddress( businessStreet(), businessCity(), 663 return displayAddress( businessStreet(), businessCity(),
664 businessState(), businessZip(), 664 businessState(), businessZip(),
665 businessCountry() ); 665 businessCountry() );
666} 666}
667 667
668/*! 668/*!
669 \internal 669 \internal
670*/ 670*/
671QString OContact::displayHomeAddress() const 671QString OContact::displayHomeAddress() const
672{ 672{
673 return displayAddress( homeStreet(), homeCity(), 673 return displayAddress( homeStreet(), homeCity(),
674 homeState(), homeZip(), 674 homeState(), homeZip(),
675 homeCountry() ); 675 homeCountry() );
@@ -1030,236 +1030,249 @@ static inline VObject *safeAddPropValue( VObject *o, const char *prop, const QSt
1030 if ( o && !value.isEmpty() ) 1030 if ( o && !value.isEmpty() )
1031 ret = addPropValue( o, prop, value.latin1() ); 1031 ret = addPropValue( o, prop, value.latin1() );
1032 return ret; 1032 return ret;
1033} 1033}
1034 1034
1035/*! 1035/*!
1036 \internal 1036 \internal
1037*/ 1037*/
1038static inline VObject *safeAddProp( VObject *o, const char *prop) 1038static inline VObject *safeAddProp( VObject *o, const char *prop)
1039{ 1039{
1040 VObject *ret = 0; 1040 VObject *ret = 0;
1041 if ( o ) 1041 if ( o )
1042 ret = addProp( o, prop ); 1042 ret = addProp( o, prop );
1043 return ret; 1043 return ret;
1044} 1044}
1045 1045
1046/*! 1046/*!
1047 \internal 1047 \internal
1048*/ 1048*/
1049static VObject *createVObject( const OContact &c ) 1049static VObject *createVObject( const OContact &c )
1050{ 1050{
1051 VObject *vcard = newVObject( VCCardProp ); 1051 VObject *vcard = newVObject( VCCardProp );
1052 safeAddPropValue( vcard, VCVersionProp, "2.1" ); 1052 safeAddPropValue( vcard, VCVersionProp, "2.1" );
1053 safeAddPropValue( vcard, VCLastRevisedProp, TimeConversion::toISO8601( QDateTime::currentDateTime() ) ); 1053 safeAddPropValue( vcard, VCLastRevisedProp, TimeConversion::toISO8601( QDateTime::currentDateTime() ) );
1054 safeAddPropValue( vcard, VCUniqueStringProp, QString::number(c.uid()) ); 1054 safeAddPropValue( vcard, VCUniqueStringProp, QString::number(c.uid()) );
1055 1055
1056 // full name 1056 // full name
1057 safeAddPropValue( vcard, VCFullNameProp, c.fullName() ); 1057 safeAddPropValue( vcard, VCFullNameProp, c.fullName() );
1058 1058
1059 // name properties 1059 // name properties
1060 VObject *name = safeAddProp( vcard, VCNameProp ); 1060 VObject *name = safeAddProp( vcard, VCNameProp );
1061 safeAddPropValue( name, VCFamilyNameProp, c.lastName() ); 1061 safeAddPropValue( name, VCFamilyNameProp, c.lastName() );
1062 safeAddPropValue( name, VCGivenNameProp, c.firstName() ); 1062 safeAddPropValue( name, VCGivenNameProp, c.firstName() );
1063 safeAddPropValue( name, VCAdditionalNamesProp, c.middleName() ); 1063 safeAddPropValue( name, VCAdditionalNamesProp, c.middleName() );
1064 safeAddPropValue( name, VCNamePrefixesProp, c.title() ); 1064 safeAddPropValue( name, VCNamePrefixesProp, c.title() );
1065 safeAddPropValue( name, VCNameSuffixesProp, c.suffix() ); 1065 safeAddPropValue( name, VCNameSuffixesProp, c.suffix() );
1066 1066
1067 // home properties 1067 // home properties
1068 VObject *home_adr= safeAddProp( vcard, VCAdrProp ); 1068 VObject *home_adr= safeAddProp( vcard, VCAdrProp );
1069 safeAddProp( home_adr, VCHomeProp ); 1069 safeAddProp( home_adr, VCHomeProp );
1070 safeAddPropValue( home_adr, VCStreetAddressProp, c.homeStreet() ); 1070 safeAddPropValue( home_adr, VCStreetAddressProp, c.homeStreet() );
1071 safeAddPropValue( home_adr, VCCityProp, c.homeCity() ); 1071 safeAddPropValue( home_adr, VCCityProp, c.homeCity() );
1072 safeAddPropValue( home_adr, VCRegionProp, c.homeState() ); 1072 safeAddPropValue( home_adr, VCRegionProp, c.homeState() );
1073 safeAddPropValue( home_adr, VCPostalCodeProp, c.homeZip() ); 1073 safeAddPropValue( home_adr, VCPostalCodeProp, c.homeZip() );
1074 safeAddPropValue( home_adr, VCCountryNameProp, c.homeCountry() ); 1074 safeAddPropValue( home_adr, VCCountryNameProp, c.homeCountry() );
1075 1075
1076 VObject *home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homePhone() ); 1076 VObject *home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homePhone() );
1077 safeAddProp( home_phone, VCHomeProp ); 1077 safeAddProp( home_phone, VCHomeProp );
1078 home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeMobile() ); 1078 home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeMobile() );
1079 safeAddProp( home_phone, VCHomeProp ); 1079 safeAddProp( home_phone, VCHomeProp );
1080 safeAddProp( home_phone, VCCellularProp ); 1080 safeAddProp( home_phone, VCCellularProp );
1081 home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeFax() ); 1081 home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeFax() );
1082 safeAddProp( home_phone, VCHomeProp ); 1082 safeAddProp( home_phone, VCHomeProp );
1083 safeAddProp( home_phone, VCFaxProp ); 1083 safeAddProp( home_phone, VCFaxProp );
1084 1084
1085 VObject *url = safeAddPropValue( vcard, VCURLProp, c.homeWebpage() ); 1085 VObject *url = safeAddPropValue( vcard, VCURLProp, c.homeWebpage() );
1086 safeAddProp( url, VCHomeProp ); 1086 safeAddProp( url, VCHomeProp );
1087 1087
1088 // work properties 1088 // work properties
1089 VObject *work_adr= safeAddProp( vcard, VCAdrProp ); 1089 VObject *work_adr= safeAddProp( vcard, VCAdrProp );
1090 safeAddProp( work_adr, VCWorkProp ); 1090 safeAddProp( work_adr, VCWorkProp );
1091 safeAddPropValue( work_adr, VCStreetAddressProp, c.businessStreet() ); 1091 safeAddPropValue( work_adr, VCStreetAddressProp, c.businessStreet() );
1092 safeAddPropValue( work_adr, VCCityProp, c.businessCity() ); 1092 safeAddPropValue( work_adr, VCCityProp, c.businessCity() );
1093 safeAddPropValue( work_adr, VCRegionProp, c.businessState() ); 1093 safeAddPropValue( work_adr, VCRegionProp, c.businessState() );
1094 safeAddPropValue( work_adr, VCPostalCodeProp, c.businessZip() ); 1094 safeAddPropValue( work_adr, VCPostalCodeProp, c.businessZip() );
1095 safeAddPropValue( work_adr, VCCountryNameProp, c.businessCountry() ); 1095 safeAddPropValue( work_adr, VCCountryNameProp, c.businessCountry() );
1096 1096
1097 VObject *work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPhone() ); 1097 VObject *work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPhone() );
1098 safeAddProp( work_phone, VCWorkProp ); 1098 safeAddProp( work_phone, VCWorkProp );
1099 work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessMobile() ); 1099 work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessMobile() );
1100 safeAddProp( work_phone, VCWorkProp ); 1100 safeAddProp( work_phone, VCWorkProp );
1101 safeAddProp( work_phone, VCCellularProp ); 1101 safeAddProp( work_phone, VCCellularProp );
1102 work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessFax() ); 1102 work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessFax() );
1103 safeAddProp( work_phone, VCWorkProp ); 1103 safeAddProp( work_phone, VCWorkProp );
1104 safeAddProp( work_phone, VCFaxProp ); 1104 safeAddProp( work_phone, VCFaxProp );
1105 work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPager() ); 1105 work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPager() );
1106 safeAddProp( work_phone, VCWorkProp ); 1106 safeAddProp( work_phone, VCWorkProp );
1107 safeAddProp( work_phone, VCPagerProp ); 1107 safeAddProp( work_phone, VCPagerProp );
1108 1108
1109 url = safeAddPropValue( vcard, VCURLProp, c.businessWebpage() ); 1109 url = safeAddPropValue( vcard, VCURLProp, c.businessWebpage() );
1110 safeAddProp( url, VCWorkProp ); 1110 safeAddProp( url, VCWorkProp );
1111 1111
1112 VObject *title = safeAddPropValue( vcard, VCTitleProp, c.jobTitle() ); 1112 VObject *title = safeAddPropValue( vcard, VCTitleProp, c.jobTitle() );
1113 safeAddProp( title, VCWorkProp ); 1113 safeAddProp( title, VCWorkProp );
1114 1114
1115 1115
1116 QStringList emails = c.emailList(); 1116 QStringList emails = c.emailList();
1117 emails.prepend( c.defaultEmail() ); 1117 emails.prepend( c.defaultEmail() );
1118 for( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) { 1118 for( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) {
1119 VObject *email = safeAddPropValue( vcard, VCEmailAddressProp, *it ); 1119 VObject *email = safeAddPropValue( vcard, VCEmailAddressProp, *it );
1120 safeAddProp( email, VCInternetProp ); 1120 safeAddProp( email, VCInternetProp );
1121 } 1121 }
1122 1122
1123 safeAddPropValue( vcard, VCNoteProp, c.notes() ); 1123 safeAddPropValue( vcard, VCNoteProp, c.notes() );
1124 1124
1125 // Exporting Birthday regarding RFC 2425 (5.8.4) 1125 // Exporting Birthday regarding RFC 2425 (5.8.4)
1126 if ( !c.birthday().isNull() ){ 1126 if ( !c.birthday().isValid() ){
1127 QString birthd_rfc2425 = c.birthday().year() + QString( "-" ) + c.birthday().month() + QString( "-" ) + c.birthday().day(); 1127 QString birthd_rfc2425 = QString("%1-%2-%3")
1128 .arg( c.birthday().year() )
1129 .arg( c.birthday().month(), 2 )
1130 .arg( c.birthday().day(), 2 );
1131 // Now replace spaces with "0"...
1132 int pos = 0;
1133 while ( ( pos = birthd_rfc2425.find (' ') ) > 0 )
1134 birthd_rfc2425.replace( pos, 1, "0" );
1135
1128 qWarning("Exporting birthday as: %s", birthd_rfc2425.latin1()); 1136 qWarning("Exporting birthday as: %s", birthd_rfc2425.latin1());
1129 safeAddPropValue( vcard, VCBirthDateProp, birthd_rfc2425.latin1() ); 1137 safeAddPropValue( vcard, VCBirthDateProp, birthd_rfc2425.latin1() );
1130 } 1138 }
1131 1139
1132 if ( !c.company().isEmpty() || !c.department().isEmpty() || !c.office().isEmpty() ) { 1140 if ( !c.company().isEmpty() || !c.department().isEmpty() || !c.office().isEmpty() ) {
1133 VObject *org = safeAddProp( vcard, VCOrgProp ); 1141 VObject *org = safeAddProp( vcard, VCOrgProp );
1134 safeAddPropValue( org, VCOrgNameProp, c.company() ); 1142 safeAddPropValue( org, VCOrgNameProp, c.company() );
1135 safeAddPropValue( org, VCOrgUnitProp, c.department() ); 1143 safeAddPropValue( org, VCOrgUnitProp, c.department() );
1136 safeAddPropValue( org, VCOrgUnit2Prop, c.office() ); 1144 safeAddPropValue( org, VCOrgUnit2Prop, c.office() );
1137 } 1145 }
1138 1146
1139 // some values we have to export as custom fields 1147 // some values we have to export as custom fields
1140 safeAddPropValue( vcard, "X-Qtopia-Profession", c.profession() ); 1148 safeAddPropValue( vcard, "X-Qtopia-Profession", c.profession() );
1141 safeAddPropValue( vcard, "X-Qtopia-Manager", c.manager() ); 1149 safeAddPropValue( vcard, "X-Qtopia-Manager", c.manager() );
1142 safeAddPropValue( vcard, "X-Qtopia-Assistant", c.assistant() ); 1150 safeAddPropValue( vcard, "X-Qtopia-Assistant", c.assistant() );
1143 1151
1144 safeAddPropValue( vcard, "X-Qtopia-Spouse", c.spouse() ); 1152 safeAddPropValue( vcard, "X-Qtopia-Spouse", c.spouse() );
1145 safeAddPropValue( vcard, "X-Qtopia-Gender", c.gender() ); 1153 safeAddPropValue( vcard, "X-Qtopia-Gender", c.gender() );
1146 safeAddPropValue( vcard, "X-Qtopia-Anniversary", TimeConversion::toString( c.anniversary() ) ); 1154 safeAddPropValue( vcard, "X-Qtopia-Anniversary", TimeConversion::toString( c.anniversary() ) );
1147 safeAddPropValue( vcard, "X-Qtopia-Nickname", c.nickname() ); 1155 safeAddPropValue( vcard, "X-Qtopia-Nickname", c.nickname() );
1148 safeAddPropValue( vcard, "X-Qtopia-Children", c.children() ); 1156 safeAddPropValue( vcard, "X-Qtopia-Children", c.children() );
1149 1157
1150 return vcard; 1158 return vcard;
1151} 1159}
1152 1160
1153 1161
1154/*! 1162/*!
1155 \internal 1163 \internal
1156*/ 1164*/
1157static QDate convVCardDateToDate( const QString& datestr ) 1165static QDate convVCardDateToDate( const QString& datestr )
1158{ 1166{
1159 int monthPos = datestr.find('-'); 1167 int monthPos = datestr.find('-');
1160 int dayPos = datestr.find('-', monthPos+1 ); 1168 int dayPos = datestr.find('-', monthPos+1 );
1169 int sep_ignore = 1;
1161 if ( monthPos == -1 || dayPos == -1 ) { 1170 if ( monthPos == -1 || dayPos == -1 ) {
1162 qDebug("fromString didn't find - in str = %s; mpos = %d ypos = %d", datestr.latin1(), monthPos, dayPos ); 1171 qDebug("fromString didn't find - in str = %s; mpos = %d ypos = %d", datestr.latin1(), monthPos, dayPos );
1163 return QDate(); 1172 // Ok.. Outlook is violating ISO 8601, therefore we will try to read their format ( YYYYMMDD )
1173 monthPos = 4;
1174 dayPos = 6;
1175 sep_ignore = 0;
1176 qDebug("Try with follwing positions str = %s; mpos = %d ypos = %d", datestr.latin1(), monthPos, dayPos );
1164 } 1177 }
1165 int y = datestr.left( monthPos ).toInt(); 1178 int y = datestr.left( monthPos ).toInt();
1166 int m = datestr.mid( monthPos+1, dayPos - monthPos - 1 ).toInt(); 1179 int m = datestr.mid( monthPos + sep_ignore, dayPos - monthPos - sep_ignore ).toInt();
1167 int d = datestr.mid( dayPos+1 ).toInt(); 1180 int d = datestr.mid( dayPos + sep_ignore ).toInt();
1168 QDate date ( y,m,d );
1169 qDebug("TimeConversion::fromString ymd = %s => %d %d %d; mpos = %d ypos = %d", datestr.latin1(), y, m, d, monthPos, dayPos); 1181 qDebug("TimeConversion::fromString ymd = %s => %d %d %d; mpos = %d ypos = %d", datestr.latin1(), y, m, d, monthPos, dayPos);
1182 QDate date ( y,m,d );
1170 return date; 1183 return date;
1171} 1184}
1172 1185
1173static OContact parseVObject( VObject *obj ) 1186static OContact parseVObject( VObject *obj )
1174{ 1187{
1175 OContact c; 1188 OContact c;
1176 1189
1177 VObjectIterator it; 1190 VObjectIterator it;
1178 initPropIterator( &it, obj ); 1191 initPropIterator( &it, obj );
1179 while( moreIteration( &it ) ) { 1192 while( moreIteration( &it ) ) {
1180 VObject *o = nextVObject( &it ); 1193 VObject *o = nextVObject( &it );
1181 QCString name = vObjectName( o ); 1194 QCString name = vObjectName( o );
1182 QCString value = vObjectStringZValue( o ); 1195 QCString value = vObjectStringZValue( o );
1183 if ( name == VCNameProp ) { 1196 if ( name == VCNameProp ) {
1184 VObjectIterator nit; 1197 VObjectIterator nit;
1185 initPropIterator( &nit, o ); 1198 initPropIterator( &nit, o );
1186 while( moreIteration( &nit ) ) { 1199 while( moreIteration( &nit ) ) {
1187 VObject *o = nextVObject( &nit ); 1200 VObject *o = nextVObject( &nit );
1188 QCString name = vObjectTypeInfo( o ); 1201 QCString name = vObjectTypeInfo( o );
1189 QString value = vObjectStringZValue( o ); 1202 QString value = vObjectStringZValue( o );
1190 if ( name == VCNamePrefixesProp ) 1203 if ( name == VCNamePrefixesProp )
1191 c.setTitle( value ); 1204 c.setTitle( value );
1192 else if ( name == VCNameSuffixesProp ) 1205 else if ( name == VCNameSuffixesProp )
1193 c.setSuffix( value ); 1206 c.setSuffix( value );
1194 else if ( name == VCFamilyNameProp ) 1207 else if ( name == VCFamilyNameProp )
1195 c.setLastName( value ); 1208 c.setLastName( value );
1196 else if ( name == VCGivenNameProp ) 1209 else if ( name == VCGivenNameProp )
1197 c.setFirstName( value ); 1210 c.setFirstName( value );
1198 else if ( name == VCAdditionalNamesProp ) 1211 else if ( name == VCAdditionalNamesProp )
1199 c.setMiddleName( value ); 1212 c.setMiddleName( value );
1200 } 1213 }
1201 } 1214 }
1202 else if ( name == VCAdrProp ) { 1215 else if ( name == VCAdrProp ) {
1203 bool work = TRUE; // default address is work address 1216 bool work = TRUE; // default address is work address
1204 QString street; 1217 QString street;
1205 QString city; 1218 QString city;
1206 QString region; 1219 QString region;
1207 QString postal; 1220 QString postal;
1208 QString country; 1221 QString country;
1209 1222
1210 VObjectIterator nit; 1223 VObjectIterator nit;
1211 initPropIterator( &nit, o ); 1224 initPropIterator( &nit, o );
1212 while( moreIteration( &nit ) ) { 1225 while( moreIteration( &nit ) ) {
1213 VObject *o = nextVObject( &nit ); 1226 VObject *o = nextVObject( &nit );
1214 QCString name = vObjectName( o ); 1227 QCString name = vObjectName( o );
1215 QString value = vObjectStringZValue( o ); 1228 QString value = vObjectStringZValue( o );
1216 if ( name == VCHomeProp ) 1229 if ( name == VCHomeProp )
1217 work = FALSE; 1230 work = FALSE;
1218 else if ( name == VCWorkProp ) 1231 else if ( name == VCWorkProp )
1219 work = TRUE; 1232 work = TRUE;
1220 else if ( name == VCStreetAddressProp ) 1233 else if ( name == VCStreetAddressProp )
1221 street = value; 1234 street = value;
1222 else if ( name == VCCityProp ) 1235 else if ( name == VCCityProp )
1223 city = value; 1236 city = value;
1224 else if ( name == VCRegionProp ) 1237 else if ( name == VCRegionProp )
1225 region = value; 1238 region = value;
1226 else if ( name == VCPostalCodeProp ) 1239 else if ( name == VCPostalCodeProp )
1227 postal = value; 1240 postal = value;
1228 else if ( name == VCCountryNameProp ) 1241 else if ( name == VCCountryNameProp )
1229 country = value; 1242 country = value;
1230 } 1243 }
1231 if ( work ) { 1244 if ( work ) {
1232 c.setBusinessStreet( street ); 1245 c.setBusinessStreet( street );
1233 c.setBusinessCity( city ); 1246 c.setBusinessCity( city );
1234 c.setBusinessCountry( country ); 1247 c.setBusinessCountry( country );
1235 c.setBusinessZip( postal ); 1248 c.setBusinessZip( postal );
1236 c.setBusinessState( region ); 1249 c.setBusinessState( region );
1237 } else { 1250 } else {
1238 c.setHomeStreet( street ); 1251 c.setHomeStreet( street );
1239 c.setHomeCity( city ); 1252 c.setHomeCity( city );
1240 c.setHomeCountry( country ); 1253 c.setHomeCountry( country );
1241 c.setHomeZip( postal ); 1254 c.setHomeZip( postal );
1242 c.setHomeState( region ); 1255 c.setHomeState( region );
1243 } 1256 }
1244 } 1257 }
1245 else if ( name == VCTelephoneProp ) { 1258 else if ( name == VCTelephoneProp ) {
1246 enum { 1259 enum {
1247 HOME = 0x01, 1260 HOME = 0x01,
1248 WORK = 0x02, 1261 WORK = 0x02,
1249 VOICE = 0x04, 1262 VOICE = 0x04,
1250 CELL = 0x08, 1263 CELL = 0x08,
1251 FAX = 0x10, 1264 FAX = 0x10,
1252 PAGER = 0x20, 1265 PAGER = 0x20,
1253 UNKNOWN = 0x80 1266 UNKNOWN = 0x80
1254 }; 1267 };
1255 int type = 0; 1268 int type = 0;
1256 1269
1257 VObjectIterator nit; 1270 VObjectIterator nit;
1258 initPropIterator( &nit, o ); 1271 initPropIterator( &nit, o );
1259 while( moreIteration( &nit ) ) { 1272 while( moreIteration( &nit ) ) {
1260 VObject *o = nextVObject( &nit ); 1273 VObject *o = nextVObject( &nit );
1261 QCString name = vObjectTypeInfo( o ); 1274 QCString name = vObjectTypeInfo( o );
1262 if ( name == VCHomeProp ) 1275 if ( name == VCHomeProp )
1263 type |= HOME; 1276 type |= HOME;
1264 else if ( name == VCWorkProp ) 1277 else if ( name == VCWorkProp )
1265 type |= WORK; 1278 type |= WORK;
diff --git a/libopie2/opiepim/ocontact.cpp b/libopie2/opiepim/ocontact.cpp
index 734f5a2..bf27d0f 100644
--- a/libopie2/opiepim/ocontact.cpp
+++ b/libopie2/opiepim/ocontact.cpp
@@ -478,198 +478,198 @@ QString OContact::toRichText() const
478 if ( !(value = businessCountry()).isEmpty() ) 478 if ( !(value = businessCountry()).isEmpty() )
479 text += Qtopia::escapeString(value) + "<br>"; 479 text += Qtopia::escapeString(value) + "<br>";
480 480
481 // home address 481 // home address
482 if ( !homeStreet().isEmpty() || !homeCity().isEmpty() || 482 if ( !homeStreet().isEmpty() || !homeCity().isEmpty() ||
483 !homeZip().isEmpty() || !homeCountry().isEmpty() ) { 483 !homeZip().isEmpty() || !homeCountry().isEmpty() ) {
484 text += "<br>"; 484 text += "<br>";
485 text += QObject::tr( "<b>Home Address:</b>" ); 485 text += QObject::tr( "<b>Home Address:</b>" );
486 text += "<br>"; 486 text += "<br>";
487 } 487 }
488 488
489 if ( !(value = homeStreet()).isEmpty() ) 489 if ( !(value = homeStreet()).isEmpty() )
490 text += Qtopia::escapeString(value) + "<br>"; 490 text += Qtopia::escapeString(value) + "<br>";
491 state = homeState(); 491 state = homeState();
492 if ( !(value = homeCity()).isEmpty() ) { 492 if ( !(value = homeCity()).isEmpty() ) {
493 text += Qtopia::escapeString(value); 493 text += Qtopia::escapeString(value);
494 if ( !state.isEmpty() ) 494 if ( !state.isEmpty() )
495 text += ", " + Qtopia::escapeString(state); 495 text += ", " + Qtopia::escapeString(state);
496 text += "<br>"; 496 text += "<br>";
497 } else if (!state.isEmpty()) 497 } else if (!state.isEmpty())
498 text += Qtopia::escapeString(state) + "<br>"; 498 text += Qtopia::escapeString(state) + "<br>";
499 if ( !(value = homeZip()).isEmpty() ) 499 if ( !(value = homeZip()).isEmpty() )
500 text += Qtopia::escapeString(value) + "<br>"; 500 text += Qtopia::escapeString(value) + "<br>";
501 if ( !(value = homeCountry()).isEmpty() ) 501 if ( !(value = homeCountry()).isEmpty() )
502 text += Qtopia::escapeString(value) + "<br>"; 502 text += Qtopia::escapeString(value) + "<br>";
503 503
504 // the others... 504 // the others...
505 QString str; 505 QString str;
506 str = emails(); 506 str = emails();
507 if ( !str.isEmpty() ) 507 if ( !str.isEmpty() )
508 text += "<b>" + QObject::tr("Email Addresses: ") + "</b>" 508 text += "<b>" + QObject::tr("Email Addresses: ") + "</b>"
509 + Qtopia::escapeString(str) + "<br>"; 509 + Qtopia::escapeString(str) + "<br>";
510 str = homePhone(); 510 str = homePhone();
511 if ( !str.isEmpty() ) 511 if ( !str.isEmpty() )
512 text += "<b>" + QObject::tr("Home Phone: ") + "</b>" 512 text += "<b>" + QObject::tr("Home Phone: ") + "</b>"
513 + Qtopia::escapeString(str) + "<br>"; 513 + Qtopia::escapeString(str) + "<br>";
514 str = homeFax(); 514 str = homeFax();
515 if ( !str.isEmpty() ) 515 if ( !str.isEmpty() )
516 text += "<b>" + QObject::tr("Home Fax: ") + "</b>" 516 text += "<b>" + QObject::tr("Home Fax: ") + "</b>"
517 + Qtopia::escapeString(str) + "<br>"; 517 + Qtopia::escapeString(str) + "<br>";
518 str = homeMobile(); 518 str = homeMobile();
519 if ( !str.isEmpty() ) 519 if ( !str.isEmpty() )
520 text += "<b>" + QObject::tr("Home Mobile: ") + "</b>" 520 text += "<b>" + QObject::tr("Home Mobile: ") + "</b>"
521 + Qtopia::escapeString(str) + "<br>"; 521 + Qtopia::escapeString(str) + "<br>";
522 str = homeWebpage(); 522 str = homeWebpage();
523 if ( !str.isEmpty() ) 523 if ( !str.isEmpty() )
524 text += "<b>" + QObject::tr("Home Web Page: ") + "</b>" 524 text += "<b>" + QObject::tr("Home Web Page: ") + "</b>"
525 + Qtopia::escapeString(str) + "<br>"; 525 + Qtopia::escapeString(str) + "<br>";
526 str = businessWebpage(); 526 str = businessWebpage();
527 if ( !str.isEmpty() ) 527 if ( !str.isEmpty() )
528 text += "<b>" + QObject::tr("Business Web Page: ") + "</b>" 528 text += "<b>" + QObject::tr("Business Web Page: ") + "</b>"
529 + Qtopia::escapeString(str) + "<br>"; 529 + Qtopia::escapeString(str) + "<br>";
530 str = office(); 530 str = office();
531 if ( !str.isEmpty() ) 531 if ( !str.isEmpty() )
532 text += "<b>" + QObject::tr("Office: ") + "</b>" 532 text += "<b>" + QObject::tr("Office: ") + "</b>"
533 + Qtopia::escapeString(str) + "<br>"; 533 + Qtopia::escapeString(str) + "<br>";
534 str = businessPhone(); 534 str = businessPhone();
535 if ( !str.isEmpty() ) 535 if ( !str.isEmpty() )
536 text += "<b>" + QObject::tr("Business Phone: ") + "</b>" 536 text += "<b>" + QObject::tr("Business Phone: ") + "</b>"
537 + Qtopia::escapeString(str) + "<br>"; 537 + Qtopia::escapeString(str) + "<br>";
538 str = businessFax(); 538 str = businessFax();
539 if ( !str.isEmpty() ) 539 if ( !str.isEmpty() )
540 text += "<b>" + QObject::tr("Business Fax: ") + "</b>" 540 text += "<b>" + QObject::tr("Business Fax: ") + "</b>"
541 + Qtopia::escapeString(str) + "<br>"; 541 + Qtopia::escapeString(str) + "<br>";
542 str = businessMobile(); 542 str = businessMobile();
543 if ( !str.isEmpty() ) 543 if ( !str.isEmpty() )
544 text += "<b>" + QObject::tr("Business Mobile: ") + "</b>" 544 text += "<b>" + QObject::tr("Business Mobile: ") + "</b>"
545 + Qtopia::escapeString(str) + "<br>"; 545 + Qtopia::escapeString(str) + "<br>";
546 str = businessPager(); 546 str = businessPager();
547 if ( !str.isEmpty() ) 547 if ( !str.isEmpty() )
548 text += "<b>" + QObject::tr("Business Pager: ") + "</b>" 548 text += "<b>" + QObject::tr("Business Pager: ") + "</b>"
549 + Qtopia::escapeString(str) + "<br>"; 549 + Qtopia::escapeString(str) + "<br>";
550 str = profession(); 550 str = profession();
551 if ( !str.isEmpty() ) 551 if ( !str.isEmpty() )
552 text += "<b>" + QObject::tr("Profession: ") + "</b>" 552 text += "<b>" + QObject::tr("Profession: ") + "</b>"
553 + Qtopia::escapeString(str) + "<br>"; 553 + Qtopia::escapeString(str) + "<br>";
554 str = assistant(); 554 str = assistant();
555 if ( !str.isEmpty() ) 555 if ( !str.isEmpty() )
556 text += "<b>" + QObject::tr("Assistant: ") + "</b>" 556 text += "<b>" + QObject::tr("Assistant: ") + "</b>"
557 + Qtopia::escapeString(str) + "<br>"; 557 + Qtopia::escapeString(str) + "<br>";
558 str = manager(); 558 str = manager();
559 if ( !str.isEmpty() ) 559 if ( !str.isEmpty() )
560 text += "<b>" + QObject::tr("Manager: ") + "</b>" 560 text += "<b>" + QObject::tr("Manager: ") + "</b>"
561 + Qtopia::escapeString(str) + "<br>"; 561 + Qtopia::escapeString(str) + "<br>";
562 str = gender(); 562 str = gender();
563 if ( !str.isEmpty() && str.toInt() != 0 ) { 563 if ( !str.isEmpty() && str.toInt() != 0 ) {
564 if ( str.toInt() == 1 ) 564 if ( str.toInt() == 1 )
565 str = QObject::tr( "Male" ); 565 str = QObject::tr( "Male" );
566 else if ( str.toInt() == 2 ) 566 else if ( str.toInt() == 2 )
567 str = QObject::tr( "Female" ); 567 str = QObject::tr( "Female" );
568 text += "<b>" + QObject::tr("Gender: ") + "</b>" + str + "<br>"; 568 text += "<b>" + QObject::tr("Gender: ") + "</b>" + str + "<br>";
569 } 569 }
570 str = spouse(); 570 str = spouse();
571 if ( !str.isEmpty() ) 571 if ( !str.isEmpty() )
572 text += "<b>" + QObject::tr("Spouse: ") + "</b>" 572 text += "<b>" + QObject::tr("Spouse: ") + "</b>"
573 + Qtopia::escapeString(str) + "<br>"; 573 + Qtopia::escapeString(str) + "<br>";
574 if ( !birthday().isNull() ){ 574 if ( !birthday().isValid() ){
575 str = TimeString::numberDateString( birthday() ); 575 str = TimeString::numberDateString( birthday() );
576 text += "<b>" + QObject::tr("Birthday: ") + "</b>" 576 text += "<b>" + QObject::tr("Birthday: ") + "</b>"
577 + Qtopia::escapeString(str) + "<br>"; 577 + Qtopia::escapeString(str) + "<br>";
578 } 578 }
579 if ( !anniversary().isNull() ){ 579 if ( !anniversary().isValid() ){
580 str = TimeString::numberDateString( anniversary() ); 580 str = TimeString::numberDateString( anniversary() );
581 text += "<b>" + QObject::tr("Anniversary: ") + "</b>" 581 text += "<b>" + QObject::tr("Anniversary: ") + "</b>"
582 + Qtopia::escapeString(str) + "<br>"; 582 + Qtopia::escapeString(str) + "<br>";
583 } 583 }
584 str = nickname(); 584 str = nickname();
585 if ( !str.isEmpty() ) 585 if ( !str.isEmpty() )
586 text += "<b>" + QObject::tr("Nickname: ") + "</b>" 586 text += "<b>" + QObject::tr("Nickname: ") + "</b>"
587 + Qtopia::escapeString(str) + "<br>"; 587 + Qtopia::escapeString(str) + "<br>";
588 588
589 // notes last 589 // notes last
590 if ( (value = notes()) ) { 590 if ( (value = notes()) ) {
591 QRegExp reg("\n"); 591 QRegExp reg("\n");
592 592
593 //QString tmp = Qtopia::escapeString(value); 593 //QString tmp = Qtopia::escapeString(value);
594 QString tmp = QStyleSheet::convertFromPlainText(value); 594 QString tmp = QStyleSheet::convertFromPlainText(value);
595 //tmp.replace( reg, "<br>" ); 595 //tmp.replace( reg, "<br>" );
596 text += "<br>" + tmp + "<br>"; 596 text += "<br>" + tmp + "<br>";
597 } 597 }
598 return text; 598 return text;
599} 599}
600 600
601/*! 601/*!
602 \internal 602 \internal
603*/ 603*/
604void OContact::insert( int key, const QString &v ) 604void OContact::insert( int key, const QString &v )
605{ 605{
606 QString value = v.stripWhiteSpace(); 606 QString value = v.stripWhiteSpace();
607 if ( value.isEmpty() ) 607 if ( value.isEmpty() )
608 mMap.remove( key ); 608 mMap.remove( key );
609 else 609 else
610 mMap.insert( key, value ); 610 mMap.insert( key, value );
611} 611}
612 612
613/*! 613/*!
614 \internal 614 \internal
615*/ 615*/
616void OContact::replace( int key, const QString & v ) 616void OContact::replace( int key, const QString & v )
617{ 617{
618 QString value = v.stripWhiteSpace(); 618 QString value = v.stripWhiteSpace();
619 if ( value.isEmpty() ) 619 if ( value.isEmpty() )
620 mMap.remove( key ); 620 mMap.remove( key );
621 else 621 else
622 mMap.replace( key, value ); 622 mMap.replace( key, value );
623} 623}
624 624
625/*! 625/*!
626 \internal 626 \internal
627*/ 627*/
628QString OContact::find( int key ) const 628QString OContact::find( int key ) const
629{ 629{
630 return mMap[key]; 630 return mMap[key];
631} 631}
632 632
633/*! 633/*!
634 \internal 634 \internal
635*/ 635*/
636QString OContact::displayAddress( const QString &street, 636QString OContact::displayAddress( const QString &street,
637 const QString &city, 637 const QString &city,
638 const QString &state, 638 const QString &state,
639 const QString &zip, 639 const QString &zip,
640 const QString &country ) const 640 const QString &country ) const
641{ 641{
642 QString s = street; 642 QString s = street;
643 if ( !street.isEmpty() ) 643 if ( !street.isEmpty() )
644 s+= "\n"; 644 s+= "\n";
645 s += city; 645 s += city;
646 if ( !city.isEmpty() && !state.isEmpty() ) 646 if ( !city.isEmpty() && !state.isEmpty() )
647 s += ", "; 647 s += ", ";
648 s += state; 648 s += state;
649 if ( !state.isEmpty() && !zip.isEmpty() ) 649 if ( !state.isEmpty() && !zip.isEmpty() )
650 s += " "; 650 s += " ";
651 s += zip; 651 s += zip;
652 if ( !country.isEmpty() && !s.isEmpty() ) 652 if ( !country.isEmpty() && !s.isEmpty() )
653 s += "\n"; 653 s += "\n";
654 s += country; 654 s += country;
655 return s; 655 return s;
656} 656}
657 657
658/*! 658/*!
659 \internal 659 \internal
660*/ 660*/
661QString OContact::displayBusinessAddress() const 661QString OContact::displayBusinessAddress() const
662{ 662{
663 return displayAddress( businessStreet(), businessCity(), 663 return displayAddress( businessStreet(), businessCity(),
664 businessState(), businessZip(), 664 businessState(), businessZip(),
665 businessCountry() ); 665 businessCountry() );
666} 666}
667 667
668/*! 668/*!
669 \internal 669 \internal
670*/ 670*/
671QString OContact::displayHomeAddress() const 671QString OContact::displayHomeAddress() const
672{ 672{
673 return displayAddress( homeStreet(), homeCity(), 673 return displayAddress( homeStreet(), homeCity(),
674 homeState(), homeZip(), 674 homeState(), homeZip(),
675 homeCountry() ); 675 homeCountry() );
@@ -1030,236 +1030,249 @@ static inline VObject *safeAddPropValue( VObject *o, const char *prop, const QSt
1030 if ( o && !value.isEmpty() ) 1030 if ( o && !value.isEmpty() )
1031 ret = addPropValue( o, prop, value.latin1() ); 1031 ret = addPropValue( o, prop, value.latin1() );
1032 return ret; 1032 return ret;
1033} 1033}
1034 1034
1035/*! 1035/*!
1036 \internal 1036 \internal
1037*/ 1037*/
1038static inline VObject *safeAddProp( VObject *o, const char *prop) 1038static inline VObject *safeAddProp( VObject *o, const char *prop)
1039{ 1039{
1040 VObject *ret = 0; 1040 VObject *ret = 0;
1041 if ( o ) 1041 if ( o )
1042 ret = addProp( o, prop ); 1042 ret = addProp( o, prop );
1043 return ret; 1043 return ret;
1044} 1044}
1045 1045
1046/*! 1046/*!
1047 \internal 1047 \internal
1048*/ 1048*/
1049static VObject *createVObject( const OContact &c ) 1049static VObject *createVObject( const OContact &c )
1050{ 1050{
1051 VObject *vcard = newVObject( VCCardProp ); 1051 VObject *vcard = newVObject( VCCardProp );
1052 safeAddPropValue( vcard, VCVersionProp, "2.1" ); 1052 safeAddPropValue( vcard, VCVersionProp, "2.1" );
1053 safeAddPropValue( vcard, VCLastRevisedProp, TimeConversion::toISO8601( QDateTime::currentDateTime() ) ); 1053 safeAddPropValue( vcard, VCLastRevisedProp, TimeConversion::toISO8601( QDateTime::currentDateTime() ) );
1054 safeAddPropValue( vcard, VCUniqueStringProp, QString::number(c.uid()) ); 1054 safeAddPropValue( vcard, VCUniqueStringProp, QString::number(c.uid()) );
1055 1055
1056 // full name 1056 // full name
1057 safeAddPropValue( vcard, VCFullNameProp, c.fullName() ); 1057 safeAddPropValue( vcard, VCFullNameProp, c.fullName() );
1058 1058
1059 // name properties 1059 // name properties
1060 VObject *name = safeAddProp( vcard, VCNameProp ); 1060 VObject *name = safeAddProp( vcard, VCNameProp );
1061 safeAddPropValue( name, VCFamilyNameProp, c.lastName() ); 1061 safeAddPropValue( name, VCFamilyNameProp, c.lastName() );
1062 safeAddPropValue( name, VCGivenNameProp, c.firstName() ); 1062 safeAddPropValue( name, VCGivenNameProp, c.firstName() );
1063 safeAddPropValue( name, VCAdditionalNamesProp, c.middleName() ); 1063 safeAddPropValue( name, VCAdditionalNamesProp, c.middleName() );
1064 safeAddPropValue( name, VCNamePrefixesProp, c.title() ); 1064 safeAddPropValue( name, VCNamePrefixesProp, c.title() );
1065 safeAddPropValue( name, VCNameSuffixesProp, c.suffix() ); 1065 safeAddPropValue( name, VCNameSuffixesProp, c.suffix() );
1066 1066
1067 // home properties 1067 // home properties
1068 VObject *home_adr= safeAddProp( vcard, VCAdrProp ); 1068 VObject *home_adr= safeAddProp( vcard, VCAdrProp );
1069 safeAddProp( home_adr, VCHomeProp ); 1069 safeAddProp( home_adr, VCHomeProp );
1070 safeAddPropValue( home_adr, VCStreetAddressProp, c.homeStreet() ); 1070 safeAddPropValue( home_adr, VCStreetAddressProp, c.homeStreet() );
1071 safeAddPropValue( home_adr, VCCityProp, c.homeCity() ); 1071 safeAddPropValue( home_adr, VCCityProp, c.homeCity() );
1072 safeAddPropValue( home_adr, VCRegionProp, c.homeState() ); 1072 safeAddPropValue( home_adr, VCRegionProp, c.homeState() );
1073 safeAddPropValue( home_adr, VCPostalCodeProp, c.homeZip() ); 1073 safeAddPropValue( home_adr, VCPostalCodeProp, c.homeZip() );
1074 safeAddPropValue( home_adr, VCCountryNameProp, c.homeCountry() ); 1074 safeAddPropValue( home_adr, VCCountryNameProp, c.homeCountry() );
1075 1075
1076 VObject *home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homePhone() ); 1076 VObject *home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homePhone() );
1077 safeAddProp( home_phone, VCHomeProp ); 1077 safeAddProp( home_phone, VCHomeProp );
1078 home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeMobile() ); 1078 home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeMobile() );
1079 safeAddProp( home_phone, VCHomeProp ); 1079 safeAddProp( home_phone, VCHomeProp );
1080 safeAddProp( home_phone, VCCellularProp ); 1080 safeAddProp( home_phone, VCCellularProp );
1081 home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeFax() ); 1081 home_phone = safeAddPropValue( vcard, VCTelephoneProp, c.homeFax() );
1082 safeAddProp( home_phone, VCHomeProp ); 1082 safeAddProp( home_phone, VCHomeProp );
1083 safeAddProp( home_phone, VCFaxProp ); 1083 safeAddProp( home_phone, VCFaxProp );
1084 1084
1085 VObject *url = safeAddPropValue( vcard, VCURLProp, c.homeWebpage() ); 1085 VObject *url = safeAddPropValue( vcard, VCURLProp, c.homeWebpage() );
1086 safeAddProp( url, VCHomeProp ); 1086 safeAddProp( url, VCHomeProp );
1087 1087
1088 // work properties 1088 // work properties
1089 VObject *work_adr= safeAddProp( vcard, VCAdrProp ); 1089 VObject *work_adr= safeAddProp( vcard, VCAdrProp );
1090 safeAddProp( work_adr, VCWorkProp ); 1090 safeAddProp( work_adr, VCWorkProp );
1091 safeAddPropValue( work_adr, VCStreetAddressProp, c.businessStreet() ); 1091 safeAddPropValue( work_adr, VCStreetAddressProp, c.businessStreet() );
1092 safeAddPropValue( work_adr, VCCityProp, c.businessCity() ); 1092 safeAddPropValue( work_adr, VCCityProp, c.businessCity() );
1093 safeAddPropValue( work_adr, VCRegionProp, c.businessState() ); 1093 safeAddPropValue( work_adr, VCRegionProp, c.businessState() );
1094 safeAddPropValue( work_adr, VCPostalCodeProp, c.businessZip() ); 1094 safeAddPropValue( work_adr, VCPostalCodeProp, c.businessZip() );
1095 safeAddPropValue( work_adr, VCCountryNameProp, c.businessCountry() ); 1095 safeAddPropValue( work_adr, VCCountryNameProp, c.businessCountry() );
1096 1096
1097 VObject *work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPhone() ); 1097 VObject *work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPhone() );
1098 safeAddProp( work_phone, VCWorkProp ); 1098 safeAddProp( work_phone, VCWorkProp );
1099 work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessMobile() ); 1099 work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessMobile() );
1100 safeAddProp( work_phone, VCWorkProp ); 1100 safeAddProp( work_phone, VCWorkProp );
1101 safeAddProp( work_phone, VCCellularProp ); 1101 safeAddProp( work_phone, VCCellularProp );
1102 work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessFax() ); 1102 work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessFax() );
1103 safeAddProp( work_phone, VCWorkProp ); 1103 safeAddProp( work_phone, VCWorkProp );
1104 safeAddProp( work_phone, VCFaxProp ); 1104 safeAddProp( work_phone, VCFaxProp );
1105 work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPager() ); 1105 work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPager() );
1106 safeAddProp( work_phone, VCWorkProp ); 1106 safeAddProp( work_phone, VCWorkProp );
1107 safeAddProp( work_phone, VCPagerProp ); 1107 safeAddProp( work_phone, VCPagerProp );
1108 1108
1109 url = safeAddPropValue( vcard, VCURLProp, c.businessWebpage() ); 1109 url = safeAddPropValue( vcard, VCURLProp, c.businessWebpage() );
1110 safeAddProp( url, VCWorkProp ); 1110 safeAddProp( url, VCWorkProp );
1111 1111
1112 VObject *title = safeAddPropValue( vcard, VCTitleProp, c.jobTitle() ); 1112 VObject *title = safeAddPropValue( vcard, VCTitleProp, c.jobTitle() );
1113 safeAddProp( title, VCWorkProp ); 1113 safeAddProp( title, VCWorkProp );
1114 1114
1115 1115
1116 QStringList emails = c.emailList(); 1116 QStringList emails = c.emailList();
1117 emails.prepend( c.defaultEmail() ); 1117 emails.prepend( c.defaultEmail() );
1118 for( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) { 1118 for( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) {
1119 VObject *email = safeAddPropValue( vcard, VCEmailAddressProp, *it ); 1119 VObject *email = safeAddPropValue( vcard, VCEmailAddressProp, *it );
1120 safeAddProp( email, VCInternetProp ); 1120 safeAddProp( email, VCInternetProp );
1121 } 1121 }
1122 1122
1123 safeAddPropValue( vcard, VCNoteProp, c.notes() ); 1123 safeAddPropValue( vcard, VCNoteProp, c.notes() );
1124 1124
1125 // Exporting Birthday regarding RFC 2425 (5.8.4) 1125 // Exporting Birthday regarding RFC 2425 (5.8.4)
1126 if ( !c.birthday().isNull() ){ 1126 if ( !c.birthday().isValid() ){
1127 QString birthd_rfc2425 = c.birthday().year() + QString( "-" ) + c.birthday().month() + QString( "-" ) + c.birthday().day(); 1127 QString birthd_rfc2425 = QString("%1-%2-%3")
1128 .arg( c.birthday().year() )
1129 .arg( c.birthday().month(), 2 )
1130 .arg( c.birthday().day(), 2 );
1131 // Now replace spaces with "0"...
1132 int pos = 0;
1133 while ( ( pos = birthd_rfc2425.find (' ') ) > 0 )
1134 birthd_rfc2425.replace( pos, 1, "0" );
1135
1128 qWarning("Exporting birthday as: %s", birthd_rfc2425.latin1()); 1136 qWarning("Exporting birthday as: %s", birthd_rfc2425.latin1());
1129 safeAddPropValue( vcard, VCBirthDateProp, birthd_rfc2425.latin1() ); 1137 safeAddPropValue( vcard, VCBirthDateProp, birthd_rfc2425.latin1() );
1130 } 1138 }
1131 1139
1132 if ( !c.company().isEmpty() || !c.department().isEmpty() || !c.office().isEmpty() ) { 1140 if ( !c.company().isEmpty() || !c.department().isEmpty() || !c.office().isEmpty() ) {
1133 VObject *org = safeAddProp( vcard, VCOrgProp ); 1141 VObject *org = safeAddProp( vcard, VCOrgProp );
1134 safeAddPropValue( org, VCOrgNameProp, c.company() ); 1142 safeAddPropValue( org, VCOrgNameProp, c.company() );
1135 safeAddPropValue( org, VCOrgUnitProp, c.department() ); 1143 safeAddPropValue( org, VCOrgUnitProp, c.department() );
1136 safeAddPropValue( org, VCOrgUnit2Prop, c.office() ); 1144 safeAddPropValue( org, VCOrgUnit2Prop, c.office() );
1137 } 1145 }
1138 1146
1139 // some values we have to export as custom fields 1147 // some values we have to export as custom fields
1140 safeAddPropValue( vcard, "X-Qtopia-Profession", c.profession() ); 1148 safeAddPropValue( vcard, "X-Qtopia-Profession", c.profession() );
1141 safeAddPropValue( vcard, "X-Qtopia-Manager", c.manager() ); 1149 safeAddPropValue( vcard, "X-Qtopia-Manager", c.manager() );
1142 safeAddPropValue( vcard, "X-Qtopia-Assistant", c.assistant() ); 1150 safeAddPropValue( vcard, "X-Qtopia-Assistant", c.assistant() );
1143 1151
1144 safeAddPropValue( vcard, "X-Qtopia-Spouse", c.spouse() ); 1152 safeAddPropValue( vcard, "X-Qtopia-Spouse", c.spouse() );
1145 safeAddPropValue( vcard, "X-Qtopia-Gender", c.gender() ); 1153 safeAddPropValue( vcard, "X-Qtopia-Gender", c.gender() );
1146 safeAddPropValue( vcard, "X-Qtopia-Anniversary", TimeConversion::toString( c.anniversary() ) ); 1154 safeAddPropValue( vcard, "X-Qtopia-Anniversary", TimeConversion::toString( c.anniversary() ) );
1147 safeAddPropValue( vcard, "X-Qtopia-Nickname", c.nickname() ); 1155 safeAddPropValue( vcard, "X-Qtopia-Nickname", c.nickname() );
1148 safeAddPropValue( vcard, "X-Qtopia-Children", c.children() ); 1156 safeAddPropValue( vcard, "X-Qtopia-Children", c.children() );
1149 1157
1150 return vcard; 1158 return vcard;
1151} 1159}
1152 1160
1153 1161
1154/*! 1162/*!
1155 \internal 1163 \internal
1156*/ 1164*/
1157static QDate convVCardDateToDate( const QString& datestr ) 1165static QDate convVCardDateToDate( const QString& datestr )
1158{ 1166{
1159 int monthPos = datestr.find('-'); 1167 int monthPos = datestr.find('-');
1160 int dayPos = datestr.find('-', monthPos+1 ); 1168 int dayPos = datestr.find('-', monthPos+1 );
1169 int sep_ignore = 1;
1161 if ( monthPos == -1 || dayPos == -1 ) { 1170 if ( monthPos == -1 || dayPos == -1 ) {
1162 qDebug("fromString didn't find - in str = %s; mpos = %d ypos = %d", datestr.latin1(), monthPos, dayPos ); 1171 qDebug("fromString didn't find - in str = %s; mpos = %d ypos = %d", datestr.latin1(), monthPos, dayPos );
1163 return QDate(); 1172 // Ok.. Outlook is violating ISO 8601, therefore we will try to read their format ( YYYYMMDD )
1173 monthPos = 4;
1174 dayPos = 6;
1175 sep_ignore = 0;
1176 qDebug("Try with follwing positions str = %s; mpos = %d ypos = %d", datestr.latin1(), monthPos, dayPos );
1164 } 1177 }
1165 int y = datestr.left( monthPos ).toInt(); 1178 int y = datestr.left( monthPos ).toInt();
1166 int m = datestr.mid( monthPos+1, dayPos - monthPos - 1 ).toInt(); 1179 int m = datestr.mid( monthPos + sep_ignore, dayPos - monthPos - sep_ignore ).toInt();
1167 int d = datestr.mid( dayPos+1 ).toInt(); 1180 int d = datestr.mid( dayPos + sep_ignore ).toInt();
1168 QDate date ( y,m,d );
1169 qDebug("TimeConversion::fromString ymd = %s => %d %d %d; mpos = %d ypos = %d", datestr.latin1(), y, m, d, monthPos, dayPos); 1181 qDebug("TimeConversion::fromString ymd = %s => %d %d %d; mpos = %d ypos = %d", datestr.latin1(), y, m, d, monthPos, dayPos);
1182 QDate date ( y,m,d );
1170 return date; 1183 return date;
1171} 1184}
1172 1185
1173static OContact parseVObject( VObject *obj ) 1186static OContact parseVObject( VObject *obj )
1174{ 1187{
1175 OContact c; 1188 OContact c;
1176 1189
1177 VObjectIterator it; 1190 VObjectIterator it;
1178 initPropIterator( &it, obj ); 1191 initPropIterator( &it, obj );
1179 while( moreIteration( &it ) ) { 1192 while( moreIteration( &it ) ) {
1180 VObject *o = nextVObject( &it ); 1193 VObject *o = nextVObject( &it );
1181 QCString name = vObjectName( o ); 1194 QCString name = vObjectName( o );
1182 QCString value = vObjectStringZValue( o ); 1195 QCString value = vObjectStringZValue( o );
1183 if ( name == VCNameProp ) { 1196 if ( name == VCNameProp ) {
1184 VObjectIterator nit; 1197 VObjectIterator nit;
1185 initPropIterator( &nit, o ); 1198 initPropIterator( &nit, o );
1186 while( moreIteration( &nit ) ) { 1199 while( moreIteration( &nit ) ) {
1187 VObject *o = nextVObject( &nit ); 1200 VObject *o = nextVObject( &nit );
1188 QCString name = vObjectTypeInfo( o ); 1201 QCString name = vObjectTypeInfo( o );
1189 QString value = vObjectStringZValue( o ); 1202 QString value = vObjectStringZValue( o );
1190 if ( name == VCNamePrefixesProp ) 1203 if ( name == VCNamePrefixesProp )
1191 c.setTitle( value ); 1204 c.setTitle( value );
1192 else if ( name == VCNameSuffixesProp ) 1205 else if ( name == VCNameSuffixesProp )
1193 c.setSuffix( value ); 1206 c.setSuffix( value );
1194 else if ( name == VCFamilyNameProp ) 1207 else if ( name == VCFamilyNameProp )
1195 c.setLastName( value ); 1208 c.setLastName( value );
1196 else if ( name == VCGivenNameProp ) 1209 else if ( name == VCGivenNameProp )
1197 c.setFirstName( value ); 1210 c.setFirstName( value );
1198 else if ( name == VCAdditionalNamesProp ) 1211 else if ( name == VCAdditionalNamesProp )
1199 c.setMiddleName( value ); 1212 c.setMiddleName( value );
1200 } 1213 }
1201 } 1214 }
1202 else if ( name == VCAdrProp ) { 1215 else if ( name == VCAdrProp ) {
1203 bool work = TRUE; // default address is work address 1216 bool work = TRUE; // default address is work address
1204 QString street; 1217 QString street;
1205 QString city; 1218 QString city;
1206 QString region; 1219 QString region;
1207 QString postal; 1220 QString postal;
1208 QString country; 1221 QString country;
1209 1222
1210 VObjectIterator nit; 1223 VObjectIterator nit;
1211 initPropIterator( &nit, o ); 1224 initPropIterator( &nit, o );
1212 while( moreIteration( &nit ) ) { 1225 while( moreIteration( &nit ) ) {
1213 VObject *o = nextVObject( &nit ); 1226 VObject *o = nextVObject( &nit );
1214 QCString name = vObjectName( o ); 1227 QCString name = vObjectName( o );
1215 QString value = vObjectStringZValue( o ); 1228 QString value = vObjectStringZValue( o );
1216 if ( name == VCHomeProp ) 1229 if ( name == VCHomeProp )
1217 work = FALSE; 1230 work = FALSE;
1218 else if ( name == VCWorkProp ) 1231 else if ( name == VCWorkProp )
1219 work = TRUE; 1232 work = TRUE;
1220 else if ( name == VCStreetAddressProp ) 1233 else if ( name == VCStreetAddressProp )
1221 street = value; 1234 street = value;
1222 else if ( name == VCCityProp ) 1235 else if ( name == VCCityProp )
1223 city = value; 1236 city = value;
1224 else if ( name == VCRegionProp ) 1237 else if ( name == VCRegionProp )
1225 region = value; 1238 region = value;
1226 else if ( name == VCPostalCodeProp ) 1239 else if ( name == VCPostalCodeProp )
1227 postal = value; 1240 postal = value;
1228 else if ( name == VCCountryNameProp ) 1241 else if ( name == VCCountryNameProp )
1229 country = value; 1242 country = value;
1230 } 1243 }
1231 if ( work ) { 1244 if ( work ) {
1232 c.setBusinessStreet( street ); 1245 c.setBusinessStreet( street );
1233 c.setBusinessCity( city ); 1246 c.setBusinessCity( city );
1234 c.setBusinessCountry( country ); 1247 c.setBusinessCountry( country );
1235 c.setBusinessZip( postal ); 1248 c.setBusinessZip( postal );
1236 c.setBusinessState( region ); 1249 c.setBusinessState( region );
1237 } else { 1250 } else {
1238 c.setHomeStreet( street ); 1251 c.setHomeStreet( street );
1239 c.setHomeCity( city ); 1252 c.setHomeCity( city );
1240 c.setHomeCountry( country ); 1253 c.setHomeCountry( country );
1241 c.setHomeZip( postal ); 1254 c.setHomeZip( postal );
1242 c.setHomeState( region ); 1255 c.setHomeState( region );
1243 } 1256 }
1244 } 1257 }
1245 else if ( name == VCTelephoneProp ) { 1258 else if ( name == VCTelephoneProp ) {
1246 enum { 1259 enum {
1247 HOME = 0x01, 1260 HOME = 0x01,
1248 WORK = 0x02, 1261 WORK = 0x02,
1249 VOICE = 0x04, 1262 VOICE = 0x04,
1250 CELL = 0x08, 1263 CELL = 0x08,
1251 FAX = 0x10, 1264 FAX = 0x10,
1252 PAGER = 0x20, 1265 PAGER = 0x20,
1253 UNKNOWN = 0x80 1266 UNKNOWN = 0x80
1254 }; 1267 };
1255 int type = 0; 1268 int type = 0;
1256 1269
1257 VObjectIterator nit; 1270 VObjectIterator nit;
1258 initPropIterator( &nit, o ); 1271 initPropIterator( &nit, o );
1259 while( moreIteration( &nit ) ) { 1272 while( moreIteration( &nit ) ) {
1260 VObject *o = nextVObject( &nit ); 1273 VObject *o = nextVObject( &nit );
1261 QCString name = vObjectTypeInfo( o ); 1274 QCString name = vObjectTypeInfo( o );
1262 if ( name == VCHomeProp ) 1275 if ( name == VCHomeProp )
1263 type |= HOME; 1276 type |= HOME;
1264 else if ( name == VCWorkProp ) 1277 else if ( name == VCWorkProp )
1265 type |= WORK; 1278 type |= WORK;