summaryrefslogtreecommitdiff
path: root/libopie/pim/ocontact.cpp
authorzecke <zecke>2002-11-02 12:36:34 (UTC)
committer zecke <zecke>2002-11-02 12:36:34 (UTC)
commitffd0a764e4ac7f9bf29edf3b9b4d341e153ecf4a (patch) (side-by-side diff)
tree601ac645a3768c1fe89fce01243f54a24f08dc15 /libopie/pim/ocontact.cpp
parent74f49994a9c19bdfdbfdfb57a5cf5e1a1f966b53 (diff)
downloadopie-ffd0a764e4ac7f9bf29edf3b9b4d341e153ecf4a.zip
opie-ffd0a764e4ac7f9bf29edf3b9b4d341e153ecf4a.tar.gz
opie-ffd0a764e4ac7f9bf29edf3b9b4d341e153ecf4a.tar.bz2
Fix a vCard problem in OContact
cell phones do not set the UId property... add some more states to otodo
Diffstat (limited to 'libopie/pim/ocontact.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/ocontact.cpp41
1 files changed, 25 insertions, 16 deletions
diff --git a/libopie/pim/ocontact.cpp b/libopie/pim/ocontact.cpp
index acd65c4..cd238ef 100644
--- a/libopie/pim/ocontact.cpp
+++ b/libopie/pim/ocontact.cpp
@@ -1129,3 +1129,3 @@ static VObject *createVObject( const OContact &c )
QString birthd_rfc2425 = QString("%1-%2-%3")
- .arg( c.birthday().year() )
+ .arg( c.birthday().year() )
.arg( c.birthday().month(), 2 )
@@ -1136,3 +1136,3 @@ static VObject *createVObject( const OContact &c )
birthd_rfc2425.replace( pos, 1, "0" );
-
+
qWarning("Exporting birthday as: %s", birthd_rfc2425.latin1());
@@ -1390,3 +1390,3 @@ static OContact parseVObject( VObject *obj )
c.setChildren( value );
- }
+ }
else if ( name == VCBirthDateProp ) {
@@ -1394,3 +1394,3 @@ static OContact parseVObject( VObject *obj )
c.setBirthday( convVCardDateToDate( value ) );
-
+
}
@@ -1466,3 +1466,12 @@ QValueList<OContact> OContact::readVCard( const QString &filename )
while ( obj ) {
- contacts.append( parseVObject( obj ) );
+ OContact con = parseVObject( obj );
+ /*
+ * if uid is 0 assign a new one
+ * this at least happens on
+ * Nokia6210
+ */
+ if ( con.uid() == 0 )
+ con.setUid( 1 );
+
+ contacts.append(con );
@@ -1529,3 +1538,3 @@ class QString OContact::recordField( int pos ) const
// In future releases, we should store birthday and anniversary
-// internally as QDate instead of QString !
+// internally as QDate instead of QString !
// QString is always too complicate to interprete (DD.MM.YY, DD/MM/YY, MM/DD/YY, etc..)(se)
@@ -1536,6 +1545,6 @@ class QString OContact::recordField( int pos ) const
void OContact::setBirthday( const QDate &v )
-{
+{
if ( ( !v.isNull() ) && ( v.isValid() ) )
replace( Qtopia::Birthday, TimeConversion::toString( v ) );
-
+
}
@@ -1555,4 +1564,4 @@ void OContact::setAnniversary( const QDate &v )
*/
-QDate OContact::birthday() const
-{
+QDate OContact::birthday() const
+{
QString str = find( Qtopia::Birthday );
@@ -1569,4 +1578,4 @@ QDate OContact::birthday() const
*/
-QDate OContact::anniversary() const
-{
+QDate OContact::anniversary() const
+{
QDate empty;
@@ -1575,3 +1584,3 @@ QDate OContact::anniversary() const
if ( !str.isEmpty() )
- return TimeConversion::fromString ( str );
+ return TimeConversion::fromString ( str );
else
@@ -1609,3 +1618,3 @@ void OContact::removeEmail( const QString &v )
QStringList emails = emailList();
-
+
// otherwise, must first contain it
@@ -1642,5 +1651,5 @@ void OContact::setDefaultEmail( const QString &v )
- if ( !e.isEmpty() )
+ if ( !e.isEmpty() )
insertEmail( e );
-
+
}