From 2981b8f55f4a33860452f4571ef9f04781267489 Mon Sep 17 00:00:00 2001 From: zecke Date: Sun, 03 Nov 2002 17:56:17 +0000 Subject: 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 --- 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 @@ -48,7 +48,6 @@ \ingroup qtopiadesktop */ -Qtopia::UidGen OContact::sUidGen( Qtopia::UidGen::Qtopia ); /*! Creates a new, empty contact. @@ -1470,8 +1469,10 @@ QValueList OContact::readVCard( const QString &filename ) * 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 ); 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 @@ -200,7 +200,7 @@ public: 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; @@ -230,10 +230,6 @@ private: const QString &zip, const QString &country ) const; - Qtopia::UidGen &uidGen() { return sUidGen; } - - - static Qtopia::UidGen sUidGen; QMap mMap; ContactPrivate *d; }; 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 @@ -122,11 +122,9 @@ QString OPimRecord::crossToString()const { } /* 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() { diff --git a/libopie2/opiepim/core/opimrecord.cpp b/libopie2/opiepim/core/opimrecord.cpp index 62dc353..21cf131 100644 --- a/libopie2/opiepim/core/opimrecord.cpp +++ b/libopie2/opiepim/core/opimrecord.cpp @@ -122,11 +122,9 @@ QString OPimRecord::crossToString()const { } /* 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() { diff --git a/libopie2/opiepim/ocontact.cpp b/libopie2/opiepim/ocontact.cpp index cd238ef..8a0930b 100644 --- a/libopie2/opiepim/ocontact.cpp +++ b/libopie2/opiepim/ocontact.cpp @@ -48,7 +48,6 @@ \ingroup qtopiadesktop */ -Qtopia::UidGen OContact::sUidGen( Qtopia::UidGen::Qtopia ); /*! Creates a new, empty contact. @@ -1470,8 +1469,10 @@ QValueList OContact::readVCard( const QString &filename ) * 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 ); diff --git a/libopie2/opiepim/ocontact.h b/libopie2/opiepim/ocontact.h index 038a59f..81ac1c1 100644 --- a/libopie2/opiepim/ocontact.h +++ b/libopie2/opiepim/ocontact.h @@ -200,7 +200,7 @@ public: 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; @@ -230,10 +230,6 @@ private: const QString &zip, const QString &country ) const; - Qtopia::UidGen &uidGen() { return sUidGen; } - - - static Qtopia::UidGen sUidGen; QMap mMap; ContactPrivate *d; }; -- cgit v0.9.0.2