author | zecke <zecke> | 2002-11-03 17:56:17 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-11-03 17:56:17 (UTC) |
commit | 2981b8f55f4a33860452f4571ef9f04781267489 (patch) (side-by-side diff) | |
tree | 3d0fe68318c23efdbcf72acfae94b3e76e2b4a14 /libopie/pim | |
parent | 3bc2ff91e60f23dd235599b3d83471bde8be1c8a (diff) | |
download | opie-2981b8f55f4a33860452f4571ef9f04781267489.zip opie-2981b8f55f4a33860452f4571ef9f04781267489.tar.gz opie-2981b8f55f4a33860452f4571ef9f04781267489.tar.bz2 |
Oh OContact what a sucker ;)
first of all UID generation belongs to OPimRecord
and was removed from OContact
then setUid now actually calls OPimRecord::setUid instead
of Record::setUid
This finally fixes the problem with wrong uids
after beaming... At least locally on my machine
-rw-r--r-- | libopie/pim/ocontact.cpp | 5 | ||||
-rw-r--r-- | libopie/pim/ocontact.h | 6 | ||||
-rw-r--r-- | libopie/pim/opimrecord.cpp | 2 |
3 files changed, 4 insertions, 9 deletions
diff --git a/libopie/pim/ocontact.cpp b/libopie/pim/ocontact.cpp index cd238ef..8a0930b 100644 --- a/libopie/pim/ocontact.cpp +++ b/libopie/pim/ocontact.cpp @@ -35,33 +35,32 @@ #include <qfileinfo.h> #include <qmap.h> #include <stdio.h> /*! \class Contact contact.h \brief The Contact class holds the data of an address book entry. This data includes information the name of the person, contact information, and business information such as deparment and job title. \ingroup qtopiaemb \ingroup qtopiadesktop */ -Qtopia::UidGen OContact::sUidGen( Qtopia::UidGen::Qtopia ); /*! Creates a new, empty contact. */ OContact::OContact() : OPimRecord(), mMap(), d( 0 ) { } /*! \internal Creates a new contact. The properties of the contact are set from \a fromMap. */ OContact::OContact( const QMap<int, QString> &fromMap ) : OPimRecord(), mMap( fromMap ), d( 0 ) @@ -1457,34 +1456,36 @@ void OContact::writeVCard( const QString &filename, const OContact &contact) 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 ) { OContact con = parseVObject( obj ); /* * if uid is 0 assign a new one * this at least happens on * Nokia6210 */ - if ( con.uid() == 0 ) + if ( con.uid() == 0 ){ con.setUid( 1 ); + qWarning("assigned new uid %d",con.uid() ); + } 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 ®exp ) const diff --git a/libopie/pim/ocontact.h b/libopie/pim/ocontact.h index 038a59f..81ac1c1 100644 --- a/libopie/pim/ocontact.h +++ b/libopie/pim/ocontact.h @@ -187,56 +187,52 @@ public: // { return find( Custom- + key ); } static QStringList fields(); static QStringList trfields(); static QStringList untrfields(); QString toRichText() const; QMap<int, QString> toMap() const; QString field( int key ) const { return find( key ); } // journaling... void saveJournal( journal_action action, const QString &key = QString::null ); void save( QString &buf ) const; void setUid( int i ) -{ Record::setUid(i); replace( Qtopia::AddressUid , QString::number(i)); } +{ OPimRecord::setUid(i); replace( Qtopia::AddressUid , QString::number(i)); } QString toShortText()const; QString OContact::type()const; QMap<QString,QString> OContact::toExtraMap() const; class QString OContact::recordField(int) const; // Why private ? (eilers,se) QString emailSeparator() const { return " "; } // the emails should be seperated by a comma void setEmails( const QString &v ); QString emails() const { return find( Qtopia::Emails ); } private: friend class AbEditor; friend class AbTable; friend class AddressBookAccessPrivate; friend class XMLIO; void insert( int key, const QString &value ); void replace( int key, const QString &value ); QString find( int key ) const; QString displayAddress( const QString &street, const QString &city, const QString &state, const QString &zip, const QString &country ) const; - Qtopia::UidGen &uidGen() { return sUidGen; } - - - static Qtopia::UidGen sUidGen; QMap<int, QString> mMap; ContactPrivate *d; }; #endif diff --git a/libopie/pim/opimrecord.cpp b/libopie/pim/opimrecord.cpp index 62dc353..21cf131 100644 --- a/libopie/pim/opimrecord.cpp +++ b/libopie/pim/opimrecord.cpp @@ -109,26 +109,24 @@ void OPimRecord::setRelations( const QString& app, QArray<int> ids ) { QString OPimRecord::crossToString()const { QString str; QMap<QString, QArray<int> >::ConstIterator it; for (it = m_relations.begin(); it != m_relations.end(); ++it ) { QArray<int> id = it.data(); for ( uint i = 0; i < id.size(); ++i ) { str += it.key() + "," + QString::number( i ) + ";"; } } str = str.remove( str.length()-1, 1); // strip the ; //qWarning("IDS " + str ); return str; } /* if uid = 1 assign a new one */ void OPimRecord::setUid( int uid ) { -// qWarning("setting uid" ); if ( uid == 1) uid = uidGen().generate(); -// qWarning(" uid %d", uid); Qtopia::Record::setUid( uid ); }; Qtopia::UidGen &OPimRecord::uidGen() { return m_uidGen; } |