author | eilers <eilers> | 2002-11-01 09:03:40 (UTC) |
---|---|---|
committer | eilers <eilers> | 2002-11-01 09:03:40 (UTC) |
commit | db5e359a4477b61d49328ee9d060e92bf1098980 (patch) (unidiff) | |
tree | 1a6e5face7043a1d2798b9fa8f6b7a8479a2af12 | |
parent | 9764202a3e4d35d8b2a0b6330ecfad5a29d56e01 (diff) | |
download | opie-db5e359a4477b61d49328ee9d060e92bf1098980.zip opie-db5e359a4477b61d49328ee9d060e92bf1098980.tar.gz opie-db5e359a4477b61d49328ee9d060e92bf1098980.tar.bz2 |
Bugfix #383 && #356
-rw-r--r-- | libopie/pim/ocontact.cpp | 33 | ||||
-rw-r--r-- | libopie2/opiepim/ocontact.cpp | 33 |
2 files changed, 38 insertions, 28 deletions
diff --git a/libopie/pim/ocontact.cpp b/libopie/pim/ocontact.cpp index bf27d0f..acd65c4 100644 --- a/libopie/pim/ocontact.cpp +++ b/libopie/pim/ocontact.cpp | |||
@@ -48,57 +48,59 @@ | |||
48 | \ingroup qtopiadesktop | 48 | \ingroup qtopiadesktop |
49 | */ | 49 | */ |
50 | 50 | ||
51 | Qtopia::UidGen OContact::sUidGen( Qtopia::UidGen::Qtopia ); | 51 | Qtopia::UidGen OContact::sUidGen( Qtopia::UidGen::Qtopia ); |
52 | 52 | ||
53 | /*! | 53 | /*! |
54 | Creates a new, empty contact. | 54 | Creates a new, empty contact. |
55 | */ | 55 | */ |
56 | OContact::OContact() | 56 | OContact::OContact() |
57 | : OPimRecord(), mMap(), d( 0 ) | 57 | : OPimRecord(), mMap(), d( 0 ) |
58 | { | 58 | { |
59 | } | 59 | } |
60 | 60 | ||
61 | /*! | 61 | /*! |
62 | \internal | 62 | \internal |
63 | Creates a new contact. The properties of the contact are | 63 | Creates a new contact. The properties of the contact are |
64 | set from \a fromMap. | 64 | set from \a fromMap. |
65 | */ | 65 | */ |
66 | OContact::OContact( const QMap<int, QString> &fromMap ) : | 66 | OContact::OContact( const QMap<int, QString> &fromMap ) : |
67 | OPimRecord(), mMap( fromMap ), d( 0 ) | 67 | OPimRecord(), mMap( fromMap ), d( 0 ) |
68 | { | 68 | { |
69 | QString cats = mMap[ Qtopia::AddressCategory ]; | 69 | QString cats = mMap[ Qtopia::AddressCategory ]; |
70 | if ( !cats.isEmpty() ) | 70 | if ( !cats.isEmpty() ) |
71 | setCategories( idsFromString( cats ) ); | 71 | setCategories( idsFromString( cats ) ); |
72 | |||
72 | QString uidStr = find( Qtopia::AddressUid ); | 73 | QString uidStr = find( Qtopia::AddressUid ); |
73 | 74 | ||
74 | if ( uidStr.isEmpty() ) | 75 | if ( uidStr.isEmpty() || (uidStr.toInt() == 0) ){ |
76 | qWarning( "Invalid UID found. Generate new one.." ); | ||
75 | setUid( uidGen().generate() ); | 77 | setUid( uidGen().generate() ); |
76 | else | 78 | }else |
77 | setUid( uidStr.toInt() ); | 79 | setUid( uidStr.toInt() ); |
78 | 80 | ||
79 | if ( !uidStr.isEmpty() ) | 81 | // if ( !uidStr.isEmpty() ) |
80 | setUid( uidStr.toInt() ); | 82 | // setUid( uidStr.toInt() ); |
81 | } | 83 | } |
82 | 84 | ||
83 | /*! | 85 | /*! |
84 | Destroys a contact. | 86 | Destroys a contact. |
85 | */ | 87 | */ |
86 | OContact::~OContact() | 88 | OContact::~OContact() |
87 | { | 89 | { |
88 | } | 90 | } |
89 | 91 | ||
90 | /*! \fn void OContact::setTitle( const QString &str ) | 92 | /*! \fn void OContact::setTitle( const QString &str ) |
91 | Sets the title of the contact to \a str. | 93 | Sets the title of the contact to \a str. |
92 | */ | 94 | */ |
93 | 95 | ||
94 | /*! \fn void OContact::setFirstName( const QString &str ) | 96 | /*! \fn void OContact::setFirstName( const QString &str ) |
95 | Sets the first name of the contact to \a str. | 97 | Sets the first name of the contact to \a str. |
96 | */ | 98 | */ |
97 | 99 | ||
98 | /*! \fn void OContact::setMiddleName( const QString &str ) | 100 | /*! \fn void OContact::setMiddleName( const QString &str ) |
99 | Sets the middle name of the contact to \a str. | 101 | Sets the middle name of the contact to \a str. |
100 | */ | 102 | */ |
101 | 103 | ||
102 | /*! \fn void OContact::setLastName( const QString &str ) | 104 | /*! \fn void OContact::setLastName( const QString &str ) |
103 | Sets the last name of the contact to \a str. | 105 | Sets the last name of the contact to \a str. |
104 | */ | 106 | */ |
@@ -550,54 +552,54 @@ QString OContact::toRichText() const | |||
550 | str = profession(); | 552 | str = profession(); |
551 | if ( !str.isEmpty() ) | 553 | if ( !str.isEmpty() ) |
552 | text += "<b>" + QObject::tr("Profession: ") + "</b>" | 554 | text += "<b>" + QObject::tr("Profession: ") + "</b>" |
553 | + Qtopia::escapeString(str) + "<br>"; | 555 | + Qtopia::escapeString(str) + "<br>"; |
554 | str = assistant(); | 556 | str = assistant(); |
555 | if ( !str.isEmpty() ) | 557 | if ( !str.isEmpty() ) |
556 | text += "<b>" + QObject::tr("Assistant: ") + "</b>" | 558 | text += "<b>" + QObject::tr("Assistant: ") + "</b>" |
557 | + Qtopia::escapeString(str) + "<br>"; | 559 | + Qtopia::escapeString(str) + "<br>"; |
558 | str = manager(); | 560 | str = manager(); |
559 | if ( !str.isEmpty() ) | 561 | if ( !str.isEmpty() ) |
560 | text += "<b>" + QObject::tr("Manager: ") + "</b>" | 562 | text += "<b>" + QObject::tr("Manager: ") + "</b>" |
561 | + Qtopia::escapeString(str) + "<br>"; | 563 | + Qtopia::escapeString(str) + "<br>"; |
562 | str = gender(); | 564 | str = gender(); |
563 | if ( !str.isEmpty() && str.toInt() != 0 ) { | 565 | if ( !str.isEmpty() && str.toInt() != 0 ) { |
564 | if ( str.toInt() == 1 ) | 566 | if ( str.toInt() == 1 ) |
565 | str = QObject::tr( "Male" ); | 567 | str = QObject::tr( "Male" ); |
566 | else if ( str.toInt() == 2 ) | 568 | else if ( str.toInt() == 2 ) |
567 | str = QObject::tr( "Female" ); | 569 | str = QObject::tr( "Female" ); |
568 | text += "<b>" + QObject::tr("Gender: ") + "</b>" + str + "<br>"; | 570 | text += "<b>" + QObject::tr("Gender: ") + "</b>" + str + "<br>"; |
569 | } | 571 | } |
570 | str = spouse(); | 572 | str = spouse(); |
571 | if ( !str.isEmpty() ) | 573 | if ( !str.isEmpty() ) |
572 | text += "<b>" + QObject::tr("Spouse: ") + "</b>" | 574 | text += "<b>" + QObject::tr("Spouse: ") + "</b>" |
573 | + Qtopia::escapeString(str) + "<br>"; | 575 | + Qtopia::escapeString(str) + "<br>"; |
574 | if ( !birthday().isValid() ){ | 576 | if ( birthday().isValid() ){ |
575 | str = TimeString::numberDateString( birthday() ); | 577 | str = TimeString::numberDateString( birthday() ); |
576 | text += "<b>" + QObject::tr("Birthday: ") + "</b>" | 578 | text += "<b>" + QObject::tr("Birthday: ") + "</b>" |
577 | + Qtopia::escapeString(str) + "<br>"; | 579 | + Qtopia::escapeString(str) + "<br>"; |
578 | } | 580 | } |
579 | if ( !anniversary().isValid() ){ | 581 | if ( anniversary().isValid() ){ |
580 | str = TimeString::numberDateString( anniversary() ); | 582 | str = TimeString::numberDateString( anniversary() ); |
581 | text += "<b>" + QObject::tr("Anniversary: ") + "</b>" | 583 | text += "<b>" + QObject::tr("Anniversary: ") + "</b>" |
582 | + Qtopia::escapeString(str) + "<br>"; | 584 | + Qtopia::escapeString(str) + "<br>"; |
583 | } | 585 | } |
584 | str = nickname(); | 586 | str = nickname(); |
585 | if ( !str.isEmpty() ) | 587 | if ( !str.isEmpty() ) |
586 | text += "<b>" + QObject::tr("Nickname: ") + "</b>" | 588 | text += "<b>" + QObject::tr("Nickname: ") + "</b>" |
587 | + Qtopia::escapeString(str) + "<br>"; | 589 | + Qtopia::escapeString(str) + "<br>"; |
588 | 590 | ||
589 | // notes last | 591 | // notes last |
590 | if ( (value = notes()) ) { | 592 | if ( (value = notes()) ) { |
591 | QRegExp reg("\n"); | 593 | QRegExp reg("\n"); |
592 | 594 | ||
593 | //QString tmp = Qtopia::escapeString(value); | 595 | //QString tmp = Qtopia::escapeString(value); |
594 | QString tmp = QStyleSheet::convertFromPlainText(value); | 596 | QString tmp = QStyleSheet::convertFromPlainText(value); |
595 | //tmp.replace( reg, "<br>" ); | 597 | //tmp.replace( reg, "<br>" ); |
596 | text += "<br>" + tmp + "<br>"; | 598 | text += "<br>" + tmp + "<br>"; |
597 | } | 599 | } |
598 | return text; | 600 | return text; |
599 | } | 601 | } |
600 | 602 | ||
601 | /*! | 603 | /*! |
602 | \internal | 604 | \internal |
603 | */ | 605 | */ |
@@ -1102,99 +1104,103 @@ static VObject *createVObject( const OContact &c ) | |||
1102 | work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessFax() ); | 1104 | work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessFax() ); |
1103 | safeAddProp( work_phone, VCWorkProp ); | 1105 | safeAddProp( work_phone, VCWorkProp ); |
1104 | safeAddProp( work_phone, VCFaxProp ); | 1106 | safeAddProp( work_phone, VCFaxProp ); |
1105 | work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPager() ); | 1107 | work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPager() ); |
1106 | safeAddProp( work_phone, VCWorkProp ); | 1108 | safeAddProp( work_phone, VCWorkProp ); |
1107 | safeAddProp( work_phone, VCPagerProp ); | 1109 | safeAddProp( work_phone, VCPagerProp ); |
1108 | 1110 | ||
1109 | url = safeAddPropValue( vcard, VCURLProp, c.businessWebpage() ); | 1111 | url = safeAddPropValue( vcard, VCURLProp, c.businessWebpage() ); |
1110 | safeAddProp( url, VCWorkProp ); | 1112 | safeAddProp( url, VCWorkProp ); |
1111 | 1113 | ||
1112 | VObject *title = safeAddPropValue( vcard, VCTitleProp, c.jobTitle() ); | 1114 | VObject *title = safeAddPropValue( vcard, VCTitleProp, c.jobTitle() ); |
1113 | safeAddProp( title, VCWorkProp ); | 1115 | safeAddProp( title, VCWorkProp ); |
1114 | 1116 | ||
1115 | 1117 | ||
1116 | QStringList emails = c.emailList(); | 1118 | QStringList emails = c.emailList(); |
1117 | emails.prepend( c.defaultEmail() ); | 1119 | emails.prepend( c.defaultEmail() ); |
1118 | for( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) { | 1120 | for( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) { |
1119 | VObject *email = safeAddPropValue( vcard, VCEmailAddressProp, *it ); | 1121 | VObject *email = safeAddPropValue( vcard, VCEmailAddressProp, *it ); |
1120 | safeAddProp( email, VCInternetProp ); | 1122 | safeAddProp( email, VCInternetProp ); |
1121 | } | 1123 | } |
1122 | 1124 | ||
1123 | safeAddPropValue( vcard, VCNoteProp, c.notes() ); | 1125 | safeAddPropValue( vcard, VCNoteProp, c.notes() ); |
1124 | 1126 | ||
1125 | // Exporting Birthday regarding RFC 2425 (5.8.4) | 1127 | // Exporting Birthday regarding RFC 2425 (5.8.4) |
1126 | if ( !c.birthday().isValid() ){ | 1128 | if ( c.birthday().isValid() ){ |
1127 | QString birthd_rfc2425 = QString("%1-%2-%3") | 1129 | QString birthd_rfc2425 = QString("%1-%2-%3") |
1128 | .arg( c.birthday().year() ) | 1130 | .arg( c.birthday().year() ) |
1129 | .arg( c.birthday().month(), 2 ) | 1131 | .arg( c.birthday().month(), 2 ) |
1130 | .arg( c.birthday().day(), 2 ); | 1132 | .arg( c.birthday().day(), 2 ); |
1131 | // Now replace spaces with "0"... | 1133 | // Now replace spaces with "0"... |
1132 | int pos = 0; | 1134 | int pos = 0; |
1133 | while ( ( pos = birthd_rfc2425.find (' ') ) > 0 ) | 1135 | while ( ( pos = birthd_rfc2425.find (' ') ) > 0 ) |
1134 | birthd_rfc2425.replace( pos, 1, "0" ); | 1136 | birthd_rfc2425.replace( pos, 1, "0" ); |
1135 | 1137 | ||
1136 | qWarning("Exporting birthday as: %s", birthd_rfc2425.latin1()); | 1138 | qWarning("Exporting birthday as: %s", birthd_rfc2425.latin1()); |
1137 | safeAddPropValue( vcard, VCBirthDateProp, birthd_rfc2425.latin1() ); | 1139 | safeAddPropValue( vcard, VCBirthDateProp, birthd_rfc2425.latin1() ); |
1138 | } | 1140 | } |
1139 | 1141 | ||
1140 | if ( !c.company().isEmpty() || !c.department().isEmpty() || !c.office().isEmpty() ) { | 1142 | if ( !c.company().isEmpty() || !c.department().isEmpty() || !c.office().isEmpty() ) { |
1141 | VObject *org = safeAddProp( vcard, VCOrgProp ); | 1143 | VObject *org = safeAddProp( vcard, VCOrgProp ); |
1142 | safeAddPropValue( org, VCOrgNameProp, c.company() ); | 1144 | safeAddPropValue( org, VCOrgNameProp, c.company() ); |
1143 | safeAddPropValue( org, VCOrgUnitProp, c.department() ); | 1145 | safeAddPropValue( org, VCOrgUnitProp, c.department() ); |
1144 | safeAddPropValue( org, VCOrgUnit2Prop, c.office() ); | 1146 | safeAddPropValue( org, VCOrgUnit2Prop, c.office() ); |
1145 | } | 1147 | } |
1146 | 1148 | ||
1147 | // some values we have to export as custom fields | 1149 | // some values we have to export as custom fields |
1148 | safeAddPropValue( vcard, "X-Qtopia-Profession", c.profession() ); | 1150 | safeAddPropValue( vcard, "X-Qtopia-Profession", c.profession() ); |
1149 | safeAddPropValue( vcard, "X-Qtopia-Manager", c.manager() ); | 1151 | safeAddPropValue( vcard, "X-Qtopia-Manager", c.manager() ); |
1150 | safeAddPropValue( vcard, "X-Qtopia-Assistant", c.assistant() ); | 1152 | safeAddPropValue( vcard, "X-Qtopia-Assistant", c.assistant() ); |
1151 | 1153 | ||
1152 | safeAddPropValue( vcard, "X-Qtopia-Spouse", c.spouse() ); | 1154 | safeAddPropValue( vcard, "X-Qtopia-Spouse", c.spouse() ); |
1153 | safeAddPropValue( vcard, "X-Qtopia-Gender", c.gender() ); | 1155 | safeAddPropValue( vcard, "X-Qtopia-Gender", c.gender() ); |
1154 | safeAddPropValue( vcard, "X-Qtopia-Anniversary", TimeConversion::toString( c.anniversary() ) ); | 1156 | safeAddPropValue( vcard, "X-Qtopia-Anniversary", TimeConversion::toString( c.anniversary() ) ); |
1155 | safeAddPropValue( vcard, "X-Qtopia-Nickname", c.nickname() ); | 1157 | safeAddPropValue( vcard, "X-Qtopia-Nickname", c.nickname() ); |
1156 | safeAddPropValue( vcard, "X-Qtopia-Children", c.children() ); | 1158 | safeAddPropValue( vcard, "X-Qtopia-Children", c.children() ); |
1157 | 1159 | ||
1158 | return vcard; | 1160 | return vcard; |
1159 | } | 1161 | } |
1160 | 1162 | ||
1161 | 1163 | ||
1162 | /*! | 1164 | /*! |
1163 | \internal | 1165 | \internal |
1164 | */ | 1166 | */ |
1165 | static QDate convVCardDateToDate( const QString& datestr ) | 1167 | static QDate convVCardDateToDate( const QString& datestr ) |
1166 | { | 1168 | { |
1167 | int monthPos = datestr.find('-'); | 1169 | int monthPos = datestr.find('-'); |
1168 | int dayPos = datestr.find('-', monthPos+1 ); | 1170 | int dayPos = datestr.find('-', monthPos+1 ); |
1169 | int sep_ignore = 1; | 1171 | int sep_ignore = 1; |
1170 | if ( monthPos == -1 || dayPos == -1 ) { | 1172 | if ( monthPos == -1 || dayPos == -1 ) { |
1171 | qDebug("fromString didn't find - in str = %s; mpos = %d ypos = %d", datestr.latin1(), monthPos, dayPos ); | 1173 | qDebug("fromString didn't find - in str = %s; mpos = %d ypos = %d", datestr.latin1(), monthPos, dayPos ); |
1172 | // Ok.. Outlook is violating ISO 8601, therefore we will try to read their format ( YYYYMMDD ) | 1174 | // Ok.. No "-" found, therefore we will try to read other format ( YYYYMMDD ) |
1173 | monthPos = 4; | 1175 | if ( datestr.length() == 8 ){ |
1174 | dayPos = 6; | 1176 | monthPos = 4; |
1175 | sep_ignore = 0; | 1177 | dayPos = 6; |
1176 | qDebug("Try with follwing positions str = %s; mpos = %d ypos = %d", datestr.latin1(), monthPos, dayPos ); | 1178 | sep_ignore = 0; |
1179 | qDebug("Try with follwing positions str = %s; mpos = %d ypos = %d", datestr.latin1(), monthPos, dayPos ); | ||
1180 | } else { | ||
1181 | return QDate(); | ||
1182 | } | ||
1177 | } | 1183 | } |
1178 | int y = datestr.left( monthPos ).toInt(); | 1184 | int y = datestr.left( monthPos ).toInt(); |
1179 | int m = datestr.mid( monthPos + sep_ignore, dayPos - monthPos - sep_ignore ).toInt(); | 1185 | int m = datestr.mid( monthPos + sep_ignore, dayPos - monthPos - sep_ignore ).toInt(); |
1180 | int d = datestr.mid( dayPos + sep_ignore ).toInt(); | 1186 | int d = datestr.mid( dayPos + sep_ignore ).toInt(); |
1181 | qDebug("TimeConversion::fromString ymd = %s => %d %d %d; mpos = %d ypos = %d", datestr.latin1(), y, m, d, monthPos, dayPos); | 1187 | 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 ); | 1188 | QDate date ( y,m,d ); |
1183 | return date; | 1189 | return date; |
1184 | } | 1190 | } |
1185 | 1191 | ||
1186 | static OContact parseVObject( VObject *obj ) | 1192 | static OContact parseVObject( VObject *obj ) |
1187 | { | 1193 | { |
1188 | OContact c; | 1194 | OContact c; |
1189 | 1195 | ||
1190 | VObjectIterator it; | 1196 | VObjectIterator it; |
1191 | initPropIterator( &it, obj ); | 1197 | initPropIterator( &it, obj ); |
1192 | while( moreIteration( &it ) ) { | 1198 | while( moreIteration( &it ) ) { |
1193 | VObject *o = nextVObject( &it ); | 1199 | VObject *o = nextVObject( &it ); |
1194 | QCString name = vObjectName( o ); | 1200 | QCString name = vObjectName( o ); |
1195 | QCString value = vObjectStringZValue( o ); | 1201 | QCString value = vObjectStringZValue( o ); |
1196 | if ( name == VCNameProp ) { | 1202 | if ( name == VCNameProp ) { |
1197 | VObjectIterator nit; | 1203 | VObjectIterator nit; |
1198 | initPropIterator( &nit, o ); | 1204 | initPropIterator( &nit, o ); |
1199 | while( moreIteration( &nit ) ) { | 1205 | while( moreIteration( &nit ) ) { |
1200 | VObject *o = nextVObject( &nit ); | 1206 | VObject *o = nextVObject( &nit ); |
@@ -1528,55 +1534,54 @@ class QString OContact::recordField( int pos ) const | |||
1528 | Sets the birthday for the contact to \a date. | 1534 | Sets the birthday for the contact to \a date. |
1529 | */ | 1535 | */ |
1530 | void OContact::setBirthday( const QDate &v ) | 1536 | void OContact::setBirthday( const QDate &v ) |
1531 | { | 1537 | { |
1532 | if ( ( !v.isNull() ) && ( v.isValid() ) ) | 1538 | if ( ( !v.isNull() ) && ( v.isValid() ) ) |
1533 | replace( Qtopia::Birthday, TimeConversion::toString( v ) ); | 1539 | replace( Qtopia::Birthday, TimeConversion::toString( v ) ); |
1534 | 1540 | ||
1535 | } | 1541 | } |
1536 | 1542 | ||
1537 | 1543 | ||
1538 | /*! \fn void OContact::setAnniversary( const QDate &date ) | 1544 | /*! \fn void OContact::setAnniversary( const QDate &date ) |
1539 | Sets the anniversary of the contact to \a date. | 1545 | Sets the anniversary of the contact to \a date. |
1540 | */ | 1546 | */ |
1541 | void OContact::setAnniversary( const QDate &v ) | 1547 | void OContact::setAnniversary( const QDate &v ) |
1542 | { | 1548 | { |
1543 | if ( ( !v.isNull() ) && ( v.isValid() ) ) | 1549 | if ( ( !v.isNull() ) && ( v.isValid() ) ) |
1544 | replace( Qtopia::Anniversary, TimeConversion::toString( v ) ); | 1550 | replace( Qtopia::Anniversary, TimeConversion::toString( v ) ); |
1545 | } | 1551 | } |
1546 | 1552 | ||
1547 | /*! \fn QDate OContact::birthday() const | 1553 | /*! \fn QDate OContact::birthday() const |
1548 | Returns the birthday of the contact. | 1554 | Returns the birthday of the contact. |
1549 | */ | 1555 | */ |
1550 | QDate OContact::birthday() const | 1556 | QDate OContact::birthday() const |
1551 | { | 1557 | { |
1552 | QDate empty; | ||
1553 | QString str = find( Qtopia::Birthday ); | 1558 | QString str = find( Qtopia::Birthday ); |
1554 | qWarning ("Birthday %s", str.latin1() ); | 1559 | qWarning ("Birthday %s", str.latin1() ); |
1555 | if ( !str.isEmpty() ) | 1560 | if ( !str.isEmpty() ) |
1556 | return TimeConversion::fromString ( str ); | 1561 | return TimeConversion::fromString ( str ); |
1557 | else | 1562 | else |
1558 | return empty; | 1563 | return QDate(); |
1559 | } | 1564 | } |
1560 | 1565 | ||
1561 | 1566 | ||
1562 | /*! \fn QDate OContact::anniversary() const | 1567 | /*! \fn QDate OContact::anniversary() const |
1563 | Returns the anniversary of the contact. | 1568 | Returns the anniversary of the contact. |
1564 | */ | 1569 | */ |
1565 | QDate OContact::anniversary() const | 1570 | QDate OContact::anniversary() const |
1566 | { | 1571 | { |
1567 | QDate empty; | 1572 | QDate empty; |
1568 | QString str = find( Qtopia::Anniversary ); | 1573 | QString str = find( Qtopia::Anniversary ); |
1569 | qWarning ("Anniversary %s", str.latin1() ); | 1574 | qWarning ("Anniversary %s", str.latin1() ); |
1570 | if ( !str.isEmpty() ) | 1575 | if ( !str.isEmpty() ) |
1571 | return TimeConversion::fromString ( str ); | 1576 | return TimeConversion::fromString ( str ); |
1572 | else | 1577 | else |
1573 | return empty; | 1578 | return empty; |
1574 | } | 1579 | } |
1575 | 1580 | ||
1576 | 1581 | ||
1577 | void OContact::insertEmail( const QString &v ) | 1582 | void OContact::insertEmail( const QString &v ) |
1578 | { | 1583 | { |
1579 | //qDebug("insertEmail %s", v.latin1()); | 1584 | //qDebug("insertEmail %s", v.latin1()); |
1580 | QString e = v.simplifyWhiteSpace(); | 1585 | QString e = v.simplifyWhiteSpace(); |
1581 | QString def = defaultEmail(); | 1586 | QString def = defaultEmail(); |
1582 | 1587 | ||
diff --git a/libopie2/opiepim/ocontact.cpp b/libopie2/opiepim/ocontact.cpp index bf27d0f..acd65c4 100644 --- a/libopie2/opiepim/ocontact.cpp +++ b/libopie2/opiepim/ocontact.cpp | |||
@@ -48,57 +48,59 @@ | |||
48 | \ingroup qtopiadesktop | 48 | \ingroup qtopiadesktop |
49 | */ | 49 | */ |
50 | 50 | ||
51 | Qtopia::UidGen OContact::sUidGen( Qtopia::UidGen::Qtopia ); | 51 | Qtopia::UidGen OContact::sUidGen( Qtopia::UidGen::Qtopia ); |
52 | 52 | ||
53 | /*! | 53 | /*! |
54 | Creates a new, empty contact. | 54 | Creates a new, empty contact. |
55 | */ | 55 | */ |
56 | OContact::OContact() | 56 | OContact::OContact() |
57 | : OPimRecord(), mMap(), d( 0 ) | 57 | : OPimRecord(), mMap(), d( 0 ) |
58 | { | 58 | { |
59 | } | 59 | } |
60 | 60 | ||
61 | /*! | 61 | /*! |
62 | \internal | 62 | \internal |
63 | Creates a new contact. The properties of the contact are | 63 | Creates a new contact. The properties of the contact are |
64 | set from \a fromMap. | 64 | set from \a fromMap. |
65 | */ | 65 | */ |
66 | OContact::OContact( const QMap<int, QString> &fromMap ) : | 66 | OContact::OContact( const QMap<int, QString> &fromMap ) : |
67 | OPimRecord(), mMap( fromMap ), d( 0 ) | 67 | OPimRecord(), mMap( fromMap ), d( 0 ) |
68 | { | 68 | { |
69 | QString cats = mMap[ Qtopia::AddressCategory ]; | 69 | QString cats = mMap[ Qtopia::AddressCategory ]; |
70 | if ( !cats.isEmpty() ) | 70 | if ( !cats.isEmpty() ) |
71 | setCategories( idsFromString( cats ) ); | 71 | setCategories( idsFromString( cats ) ); |
72 | |||
72 | QString uidStr = find( Qtopia::AddressUid ); | 73 | QString uidStr = find( Qtopia::AddressUid ); |
73 | 74 | ||
74 | if ( uidStr.isEmpty() ) | 75 | if ( uidStr.isEmpty() || (uidStr.toInt() == 0) ){ |
76 | qWarning( "Invalid UID found. Generate new one.." ); | ||
75 | setUid( uidGen().generate() ); | 77 | setUid( uidGen().generate() ); |
76 | else | 78 | }else |
77 | setUid( uidStr.toInt() ); | 79 | setUid( uidStr.toInt() ); |
78 | 80 | ||
79 | if ( !uidStr.isEmpty() ) | 81 | // if ( !uidStr.isEmpty() ) |
80 | setUid( uidStr.toInt() ); | 82 | // setUid( uidStr.toInt() ); |
81 | } | 83 | } |
82 | 84 | ||
83 | /*! | 85 | /*! |
84 | Destroys a contact. | 86 | Destroys a contact. |
85 | */ | 87 | */ |
86 | OContact::~OContact() | 88 | OContact::~OContact() |
87 | { | 89 | { |
88 | } | 90 | } |
89 | 91 | ||
90 | /*! \fn void OContact::setTitle( const QString &str ) | 92 | /*! \fn void OContact::setTitle( const QString &str ) |
91 | Sets the title of the contact to \a str. | 93 | Sets the title of the contact to \a str. |
92 | */ | 94 | */ |
93 | 95 | ||
94 | /*! \fn void OContact::setFirstName( const QString &str ) | 96 | /*! \fn void OContact::setFirstName( const QString &str ) |
95 | Sets the first name of the contact to \a str. | 97 | Sets the first name of the contact to \a str. |
96 | */ | 98 | */ |
97 | 99 | ||
98 | /*! \fn void OContact::setMiddleName( const QString &str ) | 100 | /*! \fn void OContact::setMiddleName( const QString &str ) |
99 | Sets the middle name of the contact to \a str. | 101 | Sets the middle name of the contact to \a str. |
100 | */ | 102 | */ |
101 | 103 | ||
102 | /*! \fn void OContact::setLastName( const QString &str ) | 104 | /*! \fn void OContact::setLastName( const QString &str ) |
103 | Sets the last name of the contact to \a str. | 105 | Sets the last name of the contact to \a str. |
104 | */ | 106 | */ |
@@ -550,54 +552,54 @@ QString OContact::toRichText() const | |||
550 | str = profession(); | 552 | str = profession(); |
551 | if ( !str.isEmpty() ) | 553 | if ( !str.isEmpty() ) |
552 | text += "<b>" + QObject::tr("Profession: ") + "</b>" | 554 | text += "<b>" + QObject::tr("Profession: ") + "</b>" |
553 | + Qtopia::escapeString(str) + "<br>"; | 555 | + Qtopia::escapeString(str) + "<br>"; |
554 | str = assistant(); | 556 | str = assistant(); |
555 | if ( !str.isEmpty() ) | 557 | if ( !str.isEmpty() ) |
556 | text += "<b>" + QObject::tr("Assistant: ") + "</b>" | 558 | text += "<b>" + QObject::tr("Assistant: ") + "</b>" |
557 | + Qtopia::escapeString(str) + "<br>"; | 559 | + Qtopia::escapeString(str) + "<br>"; |
558 | str = manager(); | 560 | str = manager(); |
559 | if ( !str.isEmpty() ) | 561 | if ( !str.isEmpty() ) |
560 | text += "<b>" + QObject::tr("Manager: ") + "</b>" | 562 | text += "<b>" + QObject::tr("Manager: ") + "</b>" |
561 | + Qtopia::escapeString(str) + "<br>"; | 563 | + Qtopia::escapeString(str) + "<br>"; |
562 | str = gender(); | 564 | str = gender(); |
563 | if ( !str.isEmpty() && str.toInt() != 0 ) { | 565 | if ( !str.isEmpty() && str.toInt() != 0 ) { |
564 | if ( str.toInt() == 1 ) | 566 | if ( str.toInt() == 1 ) |
565 | str = QObject::tr( "Male" ); | 567 | str = QObject::tr( "Male" ); |
566 | else if ( str.toInt() == 2 ) | 568 | else if ( str.toInt() == 2 ) |
567 | str = QObject::tr( "Female" ); | 569 | str = QObject::tr( "Female" ); |
568 | text += "<b>" + QObject::tr("Gender: ") + "</b>" + str + "<br>"; | 570 | text += "<b>" + QObject::tr("Gender: ") + "</b>" + str + "<br>"; |
569 | } | 571 | } |
570 | str = spouse(); | 572 | str = spouse(); |
571 | if ( !str.isEmpty() ) | 573 | if ( !str.isEmpty() ) |
572 | text += "<b>" + QObject::tr("Spouse: ") + "</b>" | 574 | text += "<b>" + QObject::tr("Spouse: ") + "</b>" |
573 | + Qtopia::escapeString(str) + "<br>"; | 575 | + Qtopia::escapeString(str) + "<br>"; |
574 | if ( !birthday().isValid() ){ | 576 | if ( birthday().isValid() ){ |
575 | str = TimeString::numberDateString( birthday() ); | 577 | str = TimeString::numberDateString( birthday() ); |
576 | text += "<b>" + QObject::tr("Birthday: ") + "</b>" | 578 | text += "<b>" + QObject::tr("Birthday: ") + "</b>" |
577 | + Qtopia::escapeString(str) + "<br>"; | 579 | + Qtopia::escapeString(str) + "<br>"; |
578 | } | 580 | } |
579 | if ( !anniversary().isValid() ){ | 581 | if ( anniversary().isValid() ){ |
580 | str = TimeString::numberDateString( anniversary() ); | 582 | str = TimeString::numberDateString( anniversary() ); |
581 | text += "<b>" + QObject::tr("Anniversary: ") + "</b>" | 583 | text += "<b>" + QObject::tr("Anniversary: ") + "</b>" |
582 | + Qtopia::escapeString(str) + "<br>"; | 584 | + Qtopia::escapeString(str) + "<br>"; |
583 | } | 585 | } |
584 | str = nickname(); | 586 | str = nickname(); |
585 | if ( !str.isEmpty() ) | 587 | if ( !str.isEmpty() ) |
586 | text += "<b>" + QObject::tr("Nickname: ") + "</b>" | 588 | text += "<b>" + QObject::tr("Nickname: ") + "</b>" |
587 | + Qtopia::escapeString(str) + "<br>"; | 589 | + Qtopia::escapeString(str) + "<br>"; |
588 | 590 | ||
589 | // notes last | 591 | // notes last |
590 | if ( (value = notes()) ) { | 592 | if ( (value = notes()) ) { |
591 | QRegExp reg("\n"); | 593 | QRegExp reg("\n"); |
592 | 594 | ||
593 | //QString tmp = Qtopia::escapeString(value); | 595 | //QString tmp = Qtopia::escapeString(value); |
594 | QString tmp = QStyleSheet::convertFromPlainText(value); | 596 | QString tmp = QStyleSheet::convertFromPlainText(value); |
595 | //tmp.replace( reg, "<br>" ); | 597 | //tmp.replace( reg, "<br>" ); |
596 | text += "<br>" + tmp + "<br>"; | 598 | text += "<br>" + tmp + "<br>"; |
597 | } | 599 | } |
598 | return text; | 600 | return text; |
599 | } | 601 | } |
600 | 602 | ||
601 | /*! | 603 | /*! |
602 | \internal | 604 | \internal |
603 | */ | 605 | */ |
@@ -1102,99 +1104,103 @@ static VObject *createVObject( const OContact &c ) | |||
1102 | work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessFax() ); | 1104 | work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessFax() ); |
1103 | safeAddProp( work_phone, VCWorkProp ); | 1105 | safeAddProp( work_phone, VCWorkProp ); |
1104 | safeAddProp( work_phone, VCFaxProp ); | 1106 | safeAddProp( work_phone, VCFaxProp ); |
1105 | work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPager() ); | 1107 | work_phone = safeAddPropValue( vcard, VCTelephoneProp, c.businessPager() ); |
1106 | safeAddProp( work_phone, VCWorkProp ); | 1108 | safeAddProp( work_phone, VCWorkProp ); |
1107 | safeAddProp( work_phone, VCPagerProp ); | 1109 | safeAddProp( work_phone, VCPagerProp ); |
1108 | 1110 | ||
1109 | url = safeAddPropValue( vcard, VCURLProp, c.businessWebpage() ); | 1111 | url = safeAddPropValue( vcard, VCURLProp, c.businessWebpage() ); |
1110 | safeAddProp( url, VCWorkProp ); | 1112 | safeAddProp( url, VCWorkProp ); |
1111 | 1113 | ||
1112 | VObject *title = safeAddPropValue( vcard, VCTitleProp, c.jobTitle() ); | 1114 | VObject *title = safeAddPropValue( vcard, VCTitleProp, c.jobTitle() ); |
1113 | safeAddProp( title, VCWorkProp ); | 1115 | safeAddProp( title, VCWorkProp ); |
1114 | 1116 | ||
1115 | 1117 | ||
1116 | QStringList emails = c.emailList(); | 1118 | QStringList emails = c.emailList(); |
1117 | emails.prepend( c.defaultEmail() ); | 1119 | emails.prepend( c.defaultEmail() ); |
1118 | for( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) { | 1120 | for( QStringList::Iterator it = emails.begin(); it != emails.end(); ++it ) { |
1119 | VObject *email = safeAddPropValue( vcard, VCEmailAddressProp, *it ); | 1121 | VObject *email = safeAddPropValue( vcard, VCEmailAddressProp, *it ); |
1120 | safeAddProp( email, VCInternetProp ); | 1122 | safeAddProp( email, VCInternetProp ); |
1121 | } | 1123 | } |
1122 | 1124 | ||
1123 | safeAddPropValue( vcard, VCNoteProp, c.notes() ); | 1125 | safeAddPropValue( vcard, VCNoteProp, c.notes() ); |
1124 | 1126 | ||
1125 | // Exporting Birthday regarding RFC 2425 (5.8.4) | 1127 | // Exporting Birthday regarding RFC 2425 (5.8.4) |
1126 | if ( !c.birthday().isValid() ){ | 1128 | if ( c.birthday().isValid() ){ |
1127 | QString birthd_rfc2425 = QString("%1-%2-%3") | 1129 | QString birthd_rfc2425 = QString("%1-%2-%3") |
1128 | .arg( c.birthday().year() ) | 1130 | .arg( c.birthday().year() ) |
1129 | .arg( c.birthday().month(), 2 ) | 1131 | .arg( c.birthday().month(), 2 ) |
1130 | .arg( c.birthday().day(), 2 ); | 1132 | .arg( c.birthday().day(), 2 ); |
1131 | // Now replace spaces with "0"... | 1133 | // Now replace spaces with "0"... |
1132 | int pos = 0; | 1134 | int pos = 0; |
1133 | while ( ( pos = birthd_rfc2425.find (' ') ) > 0 ) | 1135 | while ( ( pos = birthd_rfc2425.find (' ') ) > 0 ) |
1134 | birthd_rfc2425.replace( pos, 1, "0" ); | 1136 | birthd_rfc2425.replace( pos, 1, "0" ); |
1135 | 1137 | ||
1136 | qWarning("Exporting birthday as: %s", birthd_rfc2425.latin1()); | 1138 | qWarning("Exporting birthday as: %s", birthd_rfc2425.latin1()); |
1137 | safeAddPropValue( vcard, VCBirthDateProp, birthd_rfc2425.latin1() ); | 1139 | safeAddPropValue( vcard, VCBirthDateProp, birthd_rfc2425.latin1() ); |
1138 | } | 1140 | } |
1139 | 1141 | ||
1140 | if ( !c.company().isEmpty() || !c.department().isEmpty() || !c.office().isEmpty() ) { | 1142 | if ( !c.company().isEmpty() || !c.department().isEmpty() || !c.office().isEmpty() ) { |
1141 | VObject *org = safeAddProp( vcard, VCOrgProp ); | 1143 | VObject *org = safeAddProp( vcard, VCOrgProp ); |
1142 | safeAddPropValue( org, VCOrgNameProp, c.company() ); | 1144 | safeAddPropValue( org, VCOrgNameProp, c.company() ); |
1143 | safeAddPropValue( org, VCOrgUnitProp, c.department() ); | 1145 | safeAddPropValue( org, VCOrgUnitProp, c.department() ); |
1144 | safeAddPropValue( org, VCOrgUnit2Prop, c.office() ); | 1146 | safeAddPropValue( org, VCOrgUnit2Prop, c.office() ); |
1145 | } | 1147 | } |
1146 | 1148 | ||
1147 | // some values we have to export as custom fields | 1149 | // some values we have to export as custom fields |
1148 | safeAddPropValue( vcard, "X-Qtopia-Profession", c.profession() ); | 1150 | safeAddPropValue( vcard, "X-Qtopia-Profession", c.profession() ); |
1149 | safeAddPropValue( vcard, "X-Qtopia-Manager", c.manager() ); | 1151 | safeAddPropValue( vcard, "X-Qtopia-Manager", c.manager() ); |
1150 | safeAddPropValue( vcard, "X-Qtopia-Assistant", c.assistant() ); | 1152 | safeAddPropValue( vcard, "X-Qtopia-Assistant", c.assistant() ); |
1151 | 1153 | ||
1152 | safeAddPropValue( vcard, "X-Qtopia-Spouse", c.spouse() ); | 1154 | safeAddPropValue( vcard, "X-Qtopia-Spouse", c.spouse() ); |
1153 | safeAddPropValue( vcard, "X-Qtopia-Gender", c.gender() ); | 1155 | safeAddPropValue( vcard, "X-Qtopia-Gender", c.gender() ); |
1154 | safeAddPropValue( vcard, "X-Qtopia-Anniversary", TimeConversion::toString( c.anniversary() ) ); | 1156 | safeAddPropValue( vcard, "X-Qtopia-Anniversary", TimeConversion::toString( c.anniversary() ) ); |
1155 | safeAddPropValue( vcard, "X-Qtopia-Nickname", c.nickname() ); | 1157 | safeAddPropValue( vcard, "X-Qtopia-Nickname", c.nickname() ); |
1156 | safeAddPropValue( vcard, "X-Qtopia-Children", c.children() ); | 1158 | safeAddPropValue( vcard, "X-Qtopia-Children", c.children() ); |
1157 | 1159 | ||
1158 | return vcard; | 1160 | return vcard; |
1159 | } | 1161 | } |
1160 | 1162 | ||
1161 | 1163 | ||
1162 | /*! | 1164 | /*! |
1163 | \internal | 1165 | \internal |
1164 | */ | 1166 | */ |
1165 | static QDate convVCardDateToDate( const QString& datestr ) | 1167 | static QDate convVCardDateToDate( const QString& datestr ) |
1166 | { | 1168 | { |
1167 | int monthPos = datestr.find('-'); | 1169 | int monthPos = datestr.find('-'); |
1168 | int dayPos = datestr.find('-', monthPos+1 ); | 1170 | int dayPos = datestr.find('-', monthPos+1 ); |
1169 | int sep_ignore = 1; | 1171 | int sep_ignore = 1; |
1170 | if ( monthPos == -1 || dayPos == -1 ) { | 1172 | if ( monthPos == -1 || dayPos == -1 ) { |
1171 | qDebug("fromString didn't find - in str = %s; mpos = %d ypos = %d", datestr.latin1(), monthPos, dayPos ); | 1173 | qDebug("fromString didn't find - in str = %s; mpos = %d ypos = %d", datestr.latin1(), monthPos, dayPos ); |
1172 | // Ok.. Outlook is violating ISO 8601, therefore we will try to read their format ( YYYYMMDD ) | 1174 | // Ok.. No "-" found, therefore we will try to read other format ( YYYYMMDD ) |
1173 | monthPos = 4; | 1175 | if ( datestr.length() == 8 ){ |
1174 | dayPos = 6; | 1176 | monthPos = 4; |
1175 | sep_ignore = 0; | 1177 | dayPos = 6; |
1176 | qDebug("Try with follwing positions str = %s; mpos = %d ypos = %d", datestr.latin1(), monthPos, dayPos ); | 1178 | sep_ignore = 0; |
1179 | qDebug("Try with follwing positions str = %s; mpos = %d ypos = %d", datestr.latin1(), monthPos, dayPos ); | ||
1180 | } else { | ||
1181 | return QDate(); | ||
1182 | } | ||
1177 | } | 1183 | } |
1178 | int y = datestr.left( monthPos ).toInt(); | 1184 | int y = datestr.left( monthPos ).toInt(); |
1179 | int m = datestr.mid( monthPos + sep_ignore, dayPos - monthPos - sep_ignore ).toInt(); | 1185 | int m = datestr.mid( monthPos + sep_ignore, dayPos - monthPos - sep_ignore ).toInt(); |
1180 | int d = datestr.mid( dayPos + sep_ignore ).toInt(); | 1186 | int d = datestr.mid( dayPos + sep_ignore ).toInt(); |
1181 | qDebug("TimeConversion::fromString ymd = %s => %d %d %d; mpos = %d ypos = %d", datestr.latin1(), y, m, d, monthPos, dayPos); | 1187 | 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 ); | 1188 | QDate date ( y,m,d ); |
1183 | return date; | 1189 | return date; |
1184 | } | 1190 | } |
1185 | 1191 | ||
1186 | static OContact parseVObject( VObject *obj ) | 1192 | static OContact parseVObject( VObject *obj ) |
1187 | { | 1193 | { |
1188 | OContact c; | 1194 | OContact c; |
1189 | 1195 | ||
1190 | VObjectIterator it; | 1196 | VObjectIterator it; |
1191 | initPropIterator( &it, obj ); | 1197 | initPropIterator( &it, obj ); |
1192 | while( moreIteration( &it ) ) { | 1198 | while( moreIteration( &it ) ) { |
1193 | VObject *o = nextVObject( &it ); | 1199 | VObject *o = nextVObject( &it ); |
1194 | QCString name = vObjectName( o ); | 1200 | QCString name = vObjectName( o ); |
1195 | QCString value = vObjectStringZValue( o ); | 1201 | QCString value = vObjectStringZValue( o ); |
1196 | if ( name == VCNameProp ) { | 1202 | if ( name == VCNameProp ) { |
1197 | VObjectIterator nit; | 1203 | VObjectIterator nit; |
1198 | initPropIterator( &nit, o ); | 1204 | initPropIterator( &nit, o ); |
1199 | while( moreIteration( &nit ) ) { | 1205 | while( moreIteration( &nit ) ) { |
1200 | VObject *o = nextVObject( &nit ); | 1206 | VObject *o = nextVObject( &nit ); |
@@ -1528,55 +1534,54 @@ class QString OContact::recordField( int pos ) const | |||
1528 | Sets the birthday for the contact to \a date. | 1534 | Sets the birthday for the contact to \a date. |
1529 | */ | 1535 | */ |
1530 | void OContact::setBirthday( const QDate &v ) | 1536 | void OContact::setBirthday( const QDate &v ) |
1531 | { | 1537 | { |
1532 | if ( ( !v.isNull() ) && ( v.isValid() ) ) | 1538 | if ( ( !v.isNull() ) && ( v.isValid() ) ) |
1533 | replace( Qtopia::Birthday, TimeConversion::toString( v ) ); | 1539 | replace( Qtopia::Birthday, TimeConversion::toString( v ) ); |
1534 | 1540 | ||
1535 | } | 1541 | } |
1536 | 1542 | ||
1537 | 1543 | ||
1538 | /*! \fn void OContact::setAnniversary( const QDate &date ) | 1544 | /*! \fn void OContact::setAnniversary( const QDate &date ) |
1539 | Sets the anniversary of the contact to \a date. | 1545 | Sets the anniversary of the contact to \a date. |
1540 | */ | 1546 | */ |
1541 | void OContact::setAnniversary( const QDate &v ) | 1547 | void OContact::setAnniversary( const QDate &v ) |
1542 | { | 1548 | { |
1543 | if ( ( !v.isNull() ) && ( v.isValid() ) ) | 1549 | if ( ( !v.isNull() ) && ( v.isValid() ) ) |
1544 | replace( Qtopia::Anniversary, TimeConversion::toString( v ) ); | 1550 | replace( Qtopia::Anniversary, TimeConversion::toString( v ) ); |
1545 | } | 1551 | } |
1546 | 1552 | ||
1547 | /*! \fn QDate OContact::birthday() const | 1553 | /*! \fn QDate OContact::birthday() const |
1548 | Returns the birthday of the contact. | 1554 | Returns the birthday of the contact. |
1549 | */ | 1555 | */ |
1550 | QDate OContact::birthday() const | 1556 | QDate OContact::birthday() const |
1551 | { | 1557 | { |
1552 | QDate empty; | ||
1553 | QString str = find( Qtopia::Birthday ); | 1558 | QString str = find( Qtopia::Birthday ); |
1554 | qWarning ("Birthday %s", str.latin1() ); | 1559 | qWarning ("Birthday %s", str.latin1() ); |
1555 | if ( !str.isEmpty() ) | 1560 | if ( !str.isEmpty() ) |
1556 | return TimeConversion::fromString ( str ); | 1561 | return TimeConversion::fromString ( str ); |
1557 | else | 1562 | else |
1558 | return empty; | 1563 | return QDate(); |
1559 | } | 1564 | } |
1560 | 1565 | ||
1561 | 1566 | ||
1562 | /*! \fn QDate OContact::anniversary() const | 1567 | /*! \fn QDate OContact::anniversary() const |
1563 | Returns the anniversary of the contact. | 1568 | Returns the anniversary of the contact. |
1564 | */ | 1569 | */ |
1565 | QDate OContact::anniversary() const | 1570 | QDate OContact::anniversary() const |
1566 | { | 1571 | { |
1567 | QDate empty; | 1572 | QDate empty; |
1568 | QString str = find( Qtopia::Anniversary ); | 1573 | QString str = find( Qtopia::Anniversary ); |
1569 | qWarning ("Anniversary %s", str.latin1() ); | 1574 | qWarning ("Anniversary %s", str.latin1() ); |
1570 | if ( !str.isEmpty() ) | 1575 | if ( !str.isEmpty() ) |
1571 | return TimeConversion::fromString ( str ); | 1576 | return TimeConversion::fromString ( str ); |
1572 | else | 1577 | else |
1573 | return empty; | 1578 | return empty; |
1574 | } | 1579 | } |
1575 | 1580 | ||
1576 | 1581 | ||
1577 | void OContact::insertEmail( const QString &v ) | 1582 | void OContact::insertEmail( const QString &v ) |
1578 | { | 1583 | { |
1579 | //qDebug("insertEmail %s", v.latin1()); | 1584 | //qDebug("insertEmail %s", v.latin1()); |
1580 | QString e = v.simplifyWhiteSpace(); | 1585 | QString e = v.simplifyWhiteSpace(); |
1581 | QString def = defaultEmail(); | 1586 | QString def = defaultEmail(); |
1582 | 1587 | ||