summaryrefslogtreecommitdiff
path: root/libopie/pim/ocontact.cpp
Side-by-side diff
Diffstat (limited to 'libopie/pim/ocontact.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libopie/pim/ocontact.cpp11
1 files changed, 10 insertions, 1 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
@@ -1443,49 +1443,58 @@ void OContact::writeVCard( const QString &filename, const OContact &contact)
qWarning("Unable to open vcard write");
return;
}
VObject *obj = createVObject( contact );
writeVObject( f.directHandle() , obj );
cleanVObject( obj );
cleanStrTbl();
}
/*!
Returns the set of contacts read as VCards from the file \a filename.
*/
QValueList<OContact> OContact::readVCard( const QString &filename )
{
qDebug("trying to open %s, exists=%d", filename.utf8().data(), QFileInfo( filename.utf8().data() ).size() );
VObject *obj = Parse_MIME_FromFileName( (char *)filename.utf8().data() );
qDebug("vobject = %p", obj );
QValueList<OContact> contacts;
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 );
VObject *t = obj;
obj = nextVObjectInList(obj);
cleanVObject( t );
}
return contacts;
}
/*!
Returns TRUE if the contact matches the regular expression \a regexp.
Otherwise returns FALSE.
*/
bool OContact::match( const QString &regexp ) const
{
return match(QRegExp(regexp));
}
/*!
\overload
Returns TRUE if the contact matches the regular expression \a regexp.
Otherwise returns FALSE.
*/
bool OContact::match( const QRegExp &r ) const