summaryrefslogtreecommitdiff
authoreilers <eilers>2002-11-01 09:03:40 (UTC)
committer eilers <eilers>2002-11-01 09:03:40 (UTC)
commitdb5e359a4477b61d49328ee9d060e92bf1098980 (patch) (side-by-side diff)
tree1a6e5face7043a1d2798b9fa8f6b7a8479a2af12
parent9764202a3e4d35d8b2a0b6330ecfad5a29d56e01 (diff)
downloadopie-db5e359a4477b61d49328ee9d060e92bf1098980.zip
opie-db5e359a4477b61d49328ee9d060e92bf1098980.tar.gz
opie-db5e359a4477b61d49328ee9d060e92bf1098980.tar.bz2
Bugfix #383 && #356
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/ocontact.cpp33
-rw-r--r--libopie2/opiepim/ocontact.cpp33
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
@@ -71,11 +71,13 @@ OContact::OContact( const QMap<int, QString> &fromMap ) :
setCategories( idsFromString( cats ) );
+
QString uidStr = find( Qtopia::AddressUid );
- if ( uidStr.isEmpty() )
+ if ( uidStr.isEmpty() || (uidStr.toInt() == 0) ){
+ qWarning( "Invalid UID found. Generate new one.." );
setUid( uidGen().generate() );
- else
+ }else
setUid( uidStr.toInt() );
- if ( !uidStr.isEmpty() )
- setUid( uidStr.toInt() );
+// if ( !uidStr.isEmpty() )
+// setUid( uidStr.toInt() );
}
@@ -573,3 +575,3 @@ QString OContact::toRichText() const
+ Qtopia::escapeString(str) + "<br>";
- if ( !birthday().isValid() ){
+ if ( birthday().isValid() ){
str = TimeString::numberDateString( birthday() );
@@ -578,3 +580,3 @@ QString OContact::toRichText() const
}
- if ( !anniversary().isValid() ){
+ if ( anniversary().isValid() ){
str = TimeString::numberDateString( anniversary() );
@@ -1125,3 +1127,3 @@ static VObject *createVObject( const OContact &c )
// Exporting Birthday regarding RFC 2425 (5.8.4)
- if ( !c.birthday().isValid() ){
+ if ( c.birthday().isValid() ){
QString birthd_rfc2425 = QString("%1-%2-%3")
@@ -1171,7 +1173,11 @@ static QDate convVCardDateToDate( const QString& datestr )
qDebug("fromString didn't find - in str = %s; mpos = %d ypos = %d", datestr.latin1(), monthPos, dayPos );
- // Ok.. Outlook is violating ISO 8601, therefore we will try to read their format ( YYYYMMDD )
- monthPos = 4;
- dayPos = 6;
- sep_ignore = 0;
- qDebug("Try with follwing positions str = %s; mpos = %d ypos = %d", datestr.latin1(), monthPos, dayPos );
+ // Ok.. No "-" found, therefore we will try to read other format ( YYYYMMDD )
+ if ( datestr.length() == 8 ){
+ monthPos = 4;
+ dayPos = 6;
+ sep_ignore = 0;
+ qDebug("Try with follwing positions str = %s; mpos = %d ypos = %d", datestr.latin1(), monthPos, dayPos );
+ } else {
+ return QDate();
+ }
}
@@ -1551,3 +1557,2 @@ QDate OContact::birthday() const
{
- QDate empty;
QString str = find( Qtopia::Birthday );
@@ -1557,3 +1562,3 @@ QDate OContact::birthday() const
else
- return empty;
+ return QDate();
}
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
@@ -71,11 +71,13 @@ OContact::OContact( const QMap<int, QString> &fromMap ) :
setCategories( idsFromString( cats ) );
+
QString uidStr = find( Qtopia::AddressUid );
- if ( uidStr.isEmpty() )
+ if ( uidStr.isEmpty() || (uidStr.toInt() == 0) ){
+ qWarning( "Invalid UID found. Generate new one.." );
setUid( uidGen().generate() );
- else
+ }else
setUid( uidStr.toInt() );
- if ( !uidStr.isEmpty() )
- setUid( uidStr.toInt() );
+// if ( !uidStr.isEmpty() )
+// setUid( uidStr.toInt() );
}
@@ -573,3 +575,3 @@ QString OContact::toRichText() const
+ Qtopia::escapeString(str) + "<br>";
- if ( !birthday().isValid() ){
+ if ( birthday().isValid() ){
str = TimeString::numberDateString( birthday() );
@@ -578,3 +580,3 @@ QString OContact::toRichText() const
}
- if ( !anniversary().isValid() ){
+ if ( anniversary().isValid() ){
str = TimeString::numberDateString( anniversary() );
@@ -1125,3 +1127,3 @@ static VObject *createVObject( const OContact &c )
// Exporting Birthday regarding RFC 2425 (5.8.4)
- if ( !c.birthday().isValid() ){
+ if ( c.birthday().isValid() ){
QString birthd_rfc2425 = QString("%1-%2-%3")
@@ -1171,7 +1173,11 @@ static QDate convVCardDateToDate( const QString& datestr )
qDebug("fromString didn't find - in str = %s; mpos = %d ypos = %d", datestr.latin1(), monthPos, dayPos );
- // Ok.. Outlook is violating ISO 8601, therefore we will try to read their format ( YYYYMMDD )
- monthPos = 4;
- dayPos = 6;
- sep_ignore = 0;
- qDebug("Try with follwing positions str = %s; mpos = %d ypos = %d", datestr.latin1(), monthPos, dayPos );
+ // Ok.. No "-" found, therefore we will try to read other format ( YYYYMMDD )
+ if ( datestr.length() == 8 ){
+ monthPos = 4;
+ dayPos = 6;
+ sep_ignore = 0;
+ qDebug("Try with follwing positions str = %s; mpos = %d ypos = %d", datestr.latin1(), monthPos, dayPos );
+ } else {
+ return QDate();
+ }
}
@@ -1551,3 +1557,2 @@ QDate OContact::birthday() const
{
- QDate empty;
QString str = find( Qtopia::Birthday );
@@ -1557,3 +1562,3 @@ QDate OContact::birthday() const
else
- return empty;
+ return QDate();
}