summaryrefslogtreecommitdiff
authorzecke <zecke>2002-11-03 17:56:17 (UTC)
committer zecke <zecke>2002-11-03 17:56:17 (UTC)
commit2981b8f55f4a33860452f4571ef9f04781267489 (patch) (unidiff)
tree3d0fe68318c23efdbcf72acfae94b3e76e2b4a14
parent3bc2ff91e60f23dd235599b3d83471bde8be1c8a (diff)
downloadopie-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
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/ocontact.cpp5
-rw-r--r--libopie/pim/ocontact.h6
-rw-r--r--libopie/pim/opimrecord.cpp2
-rw-r--r--libopie2/opiepim/core/opimrecord.cpp2
-rw-r--r--libopie2/opiepim/ocontact.cpp5
-rw-r--r--libopie2/opiepim/ocontact.h6
6 files changed, 8 insertions, 18 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
@@ -43,17 +43,16 @@
43 43
44 This data includes information the name of the person, contact 44 This data includes information the name of the person, contact
45 information, and business information such as deparment and job title. 45 information, and business information such as deparment and job title.
46 46
47 \ingroup qtopiaemb 47 \ingroup qtopiaemb
48 \ingroup qtopiadesktop 48 \ingroup qtopiadesktop
49*/ 49*/
50 50
51Qtopia::UidGen OContact::sUidGen( Qtopia::UidGen::Qtopia );
52 51
53/*! 52/*!
54 Creates a new, empty contact. 53 Creates a new, empty contact.
55*/ 54*/
56OContact::OContact() 55OContact::OContact()
57 : OPimRecord(), mMap(), d( 0 ) 56 : OPimRecord(), mMap(), d( 0 )
58{ 57{
59} 58}
@@ -1465,18 +1464,20 @@ QValueList<OContact> OContact::readVCard( const QString &filename )
1465 1464
1466 while ( obj ) { 1465 while ( obj ) {
1467 OContact con = parseVObject( obj ); 1466 OContact con = parseVObject( obj );
1468 /* 1467 /*
1469 * if uid is 0 assign a new one 1468 * if uid is 0 assign a new one
1470 * this at least happens on 1469 * this at least happens on
1471 * Nokia6210 1470 * Nokia6210
1472 */ 1471 */
1473 if ( con.uid() == 0 ) 1472 if ( con.uid() == 0 ){
1474 con.setUid( 1 ); 1473 con.setUid( 1 );
1474 qWarning("assigned new uid %d",con.uid() );
1475 }
1475 1476
1476 contacts.append(con ); 1477 contacts.append(con );
1477 1478
1478 VObject *t = obj; 1479 VObject *t = obj;
1479 obj = nextVObjectInList(obj); 1480 obj = nextVObjectInList(obj);
1480 cleanVObject( t ); 1481 cleanVObject( t );
1481 } 1482 }
1482 1483
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
@@ -195,17 +195,17 @@ public:
195 QString field( int key ) const { return find( key ); } 195 QString field( int key ) const { return find( key ); }
196 196
197 197
198 // journaling... 198 // journaling...
199 void saveJournal( journal_action action, const QString &key = QString::null ); 199 void saveJournal( journal_action action, const QString &key = QString::null );
200 void save( QString &buf ) const; 200 void save( QString &buf ) const;
201 201
202 void setUid( int i ) 202 void setUid( int i )
203{ Record::setUid(i); replace( Qtopia::AddressUid , QString::number(i)); } 203{ OPimRecord::setUid(i); replace( Qtopia::AddressUid , QString::number(i)); }
204 204
205 QString toShortText()const; 205 QString toShortText()const;
206 QString OContact::type()const; 206 QString OContact::type()const;
207 QMap<QString,QString> OContact::toExtraMap() const; 207 QMap<QString,QString> OContact::toExtraMap() const;
208 class QString OContact::recordField(int) const; 208 class QString OContact::recordField(int) const;
209 209
210 // Why private ? (eilers,se) 210 // Why private ? (eilers,se)
211 QString emailSeparator() const { return " "; } 211 QString emailSeparator() const { return " "; }
@@ -225,18 +225,14 @@ private:
225 QString find( int key ) const; 225 QString find( int key ) const;
226 226
227 QString displayAddress( const QString &street, 227 QString displayAddress( const QString &street,
228 const QString &city, 228 const QString &city,
229 const QString &state, 229 const QString &state,
230 const QString &zip, 230 const QString &zip,
231 const QString &country ) const; 231 const QString &country ) const;
232 232
233 Qtopia::UidGen &uidGen() { return sUidGen; }
234
235
236 static Qtopia::UidGen sUidGen;
237 QMap<int, QString> mMap; 233 QMap<int, QString> mMap;
238 ContactPrivate *d; 234 ContactPrivate *d;
239}; 235};
240 236
241 237
242#endif 238#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
@@ -117,18 +117,16 @@ QString OPimRecord::crossToString()const {
117 } 117 }
118 str = str.remove( str.length()-1, 1); // strip the ; 118 str = str.remove( str.length()-1, 1); // strip the ;
119 //qWarning("IDS " + str ); 119 //qWarning("IDS " + str );
120 120
121 return str; 121 return str;
122} 122}
123/* if uid = 1 assign a new one */ 123/* if uid = 1 assign a new one */
124void OPimRecord::setUid( int uid ) { 124void OPimRecord::setUid( int uid ) {
125// qWarning("setting uid" );
126 if ( uid == 1) 125 if ( uid == 1)
127 uid = uidGen().generate(); 126 uid = uidGen().generate();
128 127
129// qWarning(" uid %d", uid);
130 Qtopia::Record::setUid( uid ); 128 Qtopia::Record::setUid( uid );
131}; 129};
132Qtopia::UidGen &OPimRecord::uidGen() { 130Qtopia::UidGen &OPimRecord::uidGen() {
133 return m_uidGen; 131 return m_uidGen;
134} 132}
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
@@ -117,18 +117,16 @@ QString OPimRecord::crossToString()const {
117 } 117 }
118 str = str.remove( str.length()-1, 1); // strip the ; 118 str = str.remove( str.length()-1, 1); // strip the ;
119 //qWarning("IDS " + str ); 119 //qWarning("IDS " + str );
120 120
121 return str; 121 return str;
122} 122}
123/* if uid = 1 assign a new one */ 123/* if uid = 1 assign a new one */
124void OPimRecord::setUid( int uid ) { 124void OPimRecord::setUid( int uid ) {
125// qWarning("setting uid" );
126 if ( uid == 1) 125 if ( uid == 1)
127 uid = uidGen().generate(); 126 uid = uidGen().generate();
128 127
129// qWarning(" uid %d", uid);
130 Qtopia::Record::setUid( uid ); 128 Qtopia::Record::setUid( uid );
131}; 129};
132Qtopia::UidGen &OPimRecord::uidGen() { 130Qtopia::UidGen &OPimRecord::uidGen() {
133 return m_uidGen; 131 return m_uidGen;
134} 132}
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
@@ -43,17 +43,16 @@
43 43
44 This data includes information the name of the person, contact 44 This data includes information the name of the person, contact
45 information, and business information such as deparment and job title. 45 information, and business information such as deparment and job title.
46 46
47 \ingroup qtopiaemb 47 \ingroup qtopiaemb
48 \ingroup qtopiadesktop 48 \ingroup qtopiadesktop
49*/ 49*/
50 50
51Qtopia::UidGen OContact::sUidGen( Qtopia::UidGen::Qtopia );
52 51
53/*! 52/*!
54 Creates a new, empty contact. 53 Creates a new, empty contact.
55*/ 54*/
56OContact::OContact() 55OContact::OContact()
57 : OPimRecord(), mMap(), d( 0 ) 56 : OPimRecord(), mMap(), d( 0 )
58{ 57{
59} 58}
@@ -1465,18 +1464,20 @@ QValueList<OContact> OContact::readVCard( const QString &filename )
1465 1464
1466 while ( obj ) { 1465 while ( obj ) {
1467 OContact con = parseVObject( obj ); 1466 OContact con = parseVObject( obj );
1468 /* 1467 /*
1469 * if uid is 0 assign a new one 1468 * if uid is 0 assign a new one
1470 * this at least happens on 1469 * this at least happens on
1471 * Nokia6210 1470 * Nokia6210
1472 */ 1471 */
1473 if ( con.uid() == 0 ) 1472 if ( con.uid() == 0 ){
1474 con.setUid( 1 ); 1473 con.setUid( 1 );
1474 qWarning("assigned new uid %d",con.uid() );
1475 }
1475 1476
1476 contacts.append(con ); 1477 contacts.append(con );
1477 1478
1478 VObject *t = obj; 1479 VObject *t = obj;
1479 obj = nextVObjectInList(obj); 1480 obj = nextVObjectInList(obj);
1480 cleanVObject( t ); 1481 cleanVObject( t );
1481 } 1482 }
1482 1483
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
@@ -195,17 +195,17 @@ public:
195 QString field( int key ) const { return find( key ); } 195 QString field( int key ) const { return find( key ); }
196 196
197 197
198 // journaling... 198 // journaling...
199 void saveJournal( journal_action action, const QString &key = QString::null ); 199 void saveJournal( journal_action action, const QString &key = QString::null );
200 void save( QString &buf ) const; 200 void save( QString &buf ) const;
201 201
202 void setUid( int i ) 202 void setUid( int i )
203{ Record::setUid(i); replace( Qtopia::AddressUid , QString::number(i)); } 203{ OPimRecord::setUid(i); replace( Qtopia::AddressUid , QString::number(i)); }
204 204
205 QString toShortText()const; 205 QString toShortText()const;
206 QString OContact::type()const; 206 QString OContact::type()const;
207 QMap<QString,QString> OContact::toExtraMap() const; 207 QMap<QString,QString> OContact::toExtraMap() const;
208 class QString OContact::recordField(int) const; 208 class QString OContact::recordField(int) const;
209 209
210 // Why private ? (eilers,se) 210 // Why private ? (eilers,se)
211 QString emailSeparator() const { return " "; } 211 QString emailSeparator() const { return " "; }
@@ -225,18 +225,14 @@ private:
225 QString find( int key ) const; 225 QString find( int key ) const;
226 226
227 QString displayAddress( const QString &street, 227 QString displayAddress( const QString &street,
228 const QString &city, 228 const QString &city,
229 const QString &state, 229 const QString &state,
230 const QString &zip, 230 const QString &zip,
231 const QString &country ) const; 231 const QString &country ) const;
232 232
233 Qtopia::UidGen &uidGen() { return sUidGen; }
234
235
236 static Qtopia::UidGen sUidGen;
237 QMap<int, QString> mMap; 233 QMap<int, QString> mMap;
238 ContactPrivate *d; 234 ContactPrivate *d;
239}; 235};
240 236
241 237
242#endif 238#endif