summaryrefslogtreecommitdiff
path: root/libopie/pim
authoreilers <eilers>2002-11-01 09:03:40 (UTC)
committer eilers <eilers>2002-11-01 09:03:40 (UTC)
commitdb5e359a4477b61d49328ee9d060e92bf1098980 (patch) (unidiff)
tree1a6e5face7043a1d2798b9fa8f6b7a8479a2af12 /libopie/pim
parent9764202a3e4d35d8b2a0b6330ecfad5a29d56e01 (diff)
downloadopie-db5e359a4477b61d49328ee9d060e92bf1098980.zip
opie-db5e359a4477b61d49328ee9d060e92bf1098980.tar.gz
opie-db5e359a4477b61d49328ee9d060e92bf1098980.tar.bz2
Bugfix #383 && #356
Diffstat (limited to 'libopie/pim') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/ocontact.cpp33
1 files changed, 19 insertions, 14 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
@@ -69,15 +69,17 @@ OContact::OContact( const QMap<int, QString> &fromMap ) :
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/*!
@@ -571,12 +573,12 @@ QString OContact::toRichText() const
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>";
@@ -1123,7 +1125,7 @@ static VObject *createVObject( const OContact &c )
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 )
@@ -1169,11 +1171,15 @@ static QDate convVCardDateToDate( const QString& datestr )
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();
@@ -1549,13 +1555,12 @@ void OContact::setAnniversary( const QDate &v )
1549*/ 1555*/
1550QDate OContact::birthday() const 1556QDate 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