author | zautrix <zautrix> | 2004-09-19 11:44:45 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-19 11:44:45 (UTC) |
commit | 5a78d90ce7a9824e52e70f40f41aa6e17f0d3d0d (patch) (unidiff) | |
tree | 45ccbce00f69f5bb75878b4cbb0ffa38260628d4 /kabc | |
parent | eea0ff04703dffdbe8b67a0dc9f592597d7450c1 (diff) | |
download | kdepimpi-5a78d90ce7a9824e52e70f40f41aa6e17f0d3d0d.zip kdepimpi-5a78d90ce7a9824e52e70f40f41aa6e17f0d3d0d.tar.gz kdepimpi-5a78d90ce7a9824e52e70f40f41aa6e17f0d3d0d.tar.bz2 |
more AB sync
-rw-r--r-- | kabc/addressee.cpp | 28 | ||||
-rw-r--r-- | kabc/addressee.h | 2 |
2 files changed, 17 insertions, 13 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index 711c261..0157721 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp | |||
@@ -228,110 +228,114 @@ void Addressee::computeCsum(const QString &dev) | |||
228 | //if ( !mData->photo.isEmpty() ) l.append( ); | 228 | //if ( !mData->photo.isEmpty() ) l.append( ); |
229 | //if ( !mData->sound.isEmpty() ) l.append( ); | 229 | //if ( !mData->sound.isEmpty() ) l.append( ); |
230 | //if ( !mData->agent.isEmpty() ) l.append( ); | 230 | //if ( !mData->agent.isEmpty() ) l.append( ); |
231 | //if ( mData->url.isValid() ) l.append( ); | 231 | //if ( mData->url.isValid() ) l.append( ); |
232 | #if 0 | 232 | #if 0 |
233 | if ( !mData->phoneNumbers.isEmpty() ) l.append( ); | 233 | if ( !mData->phoneNumbers.isEmpty() ) l.append( ); |
234 | if ( !mData->addresses.isEmpty() ) l.append( ); | 234 | if ( !mData->addresses.isEmpty() ) l.append( ); |
235 | //if ( !mData->keys.isEmpty() ) l.append( ); | 235 | //if ( !mData->keys.isEmpty() ) l.append( ); |
236 | if ( !mData->emails.isEmpty() ) l.append( ); | 236 | if ( !mData->emails.isEmpty() ) l.append( ); |
237 | if ( !mData->categories .isEmpty() ) l.append( ); | 237 | if ( !mData->categories .isEmpty() ) l.append( ); |
238 | if ( !mData->custom.isEmpty() ) l.append( ); | 238 | if ( !mData->custom.isEmpty() ) l.append( ); |
239 | #endif | 239 | #endif |
240 | KABC::PhoneNumber::List phoneNumbers; | 240 | KABC::PhoneNumber::List phoneNumbers; |
241 | KABC::PhoneNumber::List::Iterator phoneIter; | 241 | KABC::PhoneNumber::List::Iterator phoneIter; |
242 | 242 | ||
243 | QStringList t; | 243 | QStringList t; |
244 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 244 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
245 | ++phoneIter ) | 245 | ++phoneIter ) |
246 | t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) ); | 246 | t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) ); |
247 | t.sort(); | 247 | t.sort(); |
248 | uint iii; | 248 | uint iii; |
249 | for ( iii = 0; iii < t.count(); ++iii) | 249 | for ( iii = 0; iii < t.count(); ++iii) |
250 | l.append( t[iii] ); | 250 | l.append( t[iii] ); |
251 | t = mData->emails; | 251 | t = mData->emails; |
252 | t.sort(); | 252 | t.sort(); |
253 | for ( iii = 0; iii < t.count(); ++iii) | 253 | for ( iii = 0; iii < t.count(); ++iii) |
254 | l.append( t[iii] ); | 254 | l.append( t[iii] ); |
255 | t = mData->categories; | 255 | t = mData->categories; |
256 | t.sort(); | 256 | t.sort(); |
257 | for ( iii = 0; iii < t.count(); ++iii) | 257 | for ( iii = 0; iii < t.count(); ++iii) |
258 | l.append( t[iii] ); | 258 | l.append( t[iii] ); |
259 | t = mData->custom; | 259 | t = mData->custom; |
260 | t.sort(); | 260 | t.sort(); |
261 | for ( iii = 0; iii < t.count(); ++iii) | 261 | for ( iii = 0; iii < t.count(); ++iii) |
262 | l.append( t[iii] ); | 262 | l.append( t[iii] ); |
263 | KABC::Address::List::Iterator addressIter; | 263 | KABC::Address::List::Iterator addressIter; |
264 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); | 264 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); |
265 | ++addressIter ) { | 265 | ++addressIter ) { |
266 | t = (*addressIter).asList(); | 266 | t = (*addressIter).asList(); |
267 | t.sort(); | 267 | t.sort(); |
268 | for ( iii = 0; iii < t.count(); ++iii) | 268 | for ( iii = 0; iii < t.count(); ++iii) |
269 | l.append( t[iii] ); | 269 | l.append( t[iii] ); |
270 | } | 270 | } |
271 | uint cs = getCsum4List(l); | 271 | uint cs = getCsum4List(l); |
272 | // qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); | 272 | // qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); |
273 | setCsum( dev, QString::number (cs )); | 273 | setCsum( dev, QString::number (cs )); |
274 | } | 274 | } |
275 | 275 | ||
276 | void Addressee::mergeContact( Addressee ad ) | 276 | void Addressee::mergeContact( const Addressee& ad ) |
277 | { | 277 | { |
278 | |||
279 | detach(); | ||
280 | if ( mData->name.isEmpty() ) mData->name = ad.mData->name; | ||
281 | if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; | ||
282 | if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; | ||
283 | if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; | ||
284 | if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; | ||
285 | if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix; | ||
286 | if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix; | ||
287 | if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName; | ||
288 | if ( !mData->birthday.isValid() ) | ||
289 | if ( ad.mData->birthday.isValid()) | ||
290 | mData->birthday = ad.mData->birthday; | ||
291 | if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; | ||
278 | #if 0 | 292 | #if 0 |
279 | if ( !mData->name.isEmpty() ) l.append(mData->name); | 293 | if ( !mData->timeZone.isValid() ) l.append( mData->timeZone.asString() ); |
280 | if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName ); | ||
281 | if ( !mData->familyName.isEmpty() ) l.append( mData->familyName ); | ||
282 | if ( !mData->givenName.isEmpty() ) l.append(mData->givenName ); | ||
283 | if ( !mData->additionalName ) l.append( mData->additionalName ); | ||
284 | if ( !mData->prefix.isEmpty() ) l.append( mData->prefix ); | ||
285 | if ( !mData->suffix.isEmpty() ) l.append( mData->suffix ); | ||
286 | if ( !mData->nickName.isEmpty() ) l.append( mData->nickName ); | ||
287 | if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() ); | ||
288 | if ( !mData->mailer.isEmpty() ) l.append( mData->mailer ); | ||
289 | if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() ); | ||
290 | if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); | 294 | if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); |
291 | if ( !mData->title .isEmpty() ) l.append( mData->title ); | 295 | if ( !mData->title .isEmpty() ) l.append( mData->title ); |
292 | if ( !mData->role.isEmpty() ) l.append( mData->role ); | 296 | if ( !mData->role.isEmpty() ) l.append( mData->role ); |
293 | if ( !mData->organization.isEmpty() ) l.append( mData->organization ); | 297 | if ( !mData->organization.isEmpty() ) l.append( mData->organization ); |
294 | if ( !mData->note.isEmpty() ) l.append( mData->note ); | 298 | if ( !mData->note.isEmpty() ) l.append( mData->note ); |
295 | if ( !mData->productId.isEmpty() ) l.append(mData->productId ); | 299 | if ( !mData->productId.isEmpty() ) l.append(mData->productId ); |
296 | if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); | 300 | if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); |
297 | if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); | 301 | if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); |
298 | #endif | 302 | #endif |
299 | } | 303 | } |
300 | 304 | ||
301 | void Addressee::removeID(const QString &prof) | 305 | void Addressee::removeID(const QString &prof) |
302 | { | 306 | { |
303 | detach(); | 307 | detach(); |
304 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); | 308 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); |
305 | 309 | ||
306 | } | 310 | } |
307 | void Addressee::setID( const QString & prof , const QString & id ) | 311 | void Addressee::setID( const QString & prof , const QString & id ) |
308 | { | 312 | { |
309 | detach(); | 313 | detach(); |
310 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); | 314 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); |
311 | //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); | 315 | //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); |
312 | } | 316 | } |
313 | void Addressee::setTempSyncStat( int id ) | 317 | void Addressee::setTempSyncStat( int id ) |
314 | { | 318 | { |
315 | if ( mData->mTempSyncStat == id ) return; | 319 | if ( mData->mTempSyncStat == id ) return; |
316 | detach(); | 320 | detach(); |
317 | mData->mTempSyncStat = id; | 321 | mData->mTempSyncStat = id; |
318 | } | 322 | } |
319 | int Addressee::tempSyncStat() const | 323 | int Addressee::tempSyncStat() const |
320 | { | 324 | { |
321 | return mData->mTempSyncStat; | 325 | return mData->mTempSyncStat; |
322 | } | 326 | } |
323 | 327 | ||
324 | QString Addressee::getID( const QString & prof) | 328 | QString Addressee::getID( const QString & prof) |
325 | { | 329 | { |
326 | return KIdManager::getId ( mData->mExternalId, prof ); | 330 | return KIdManager::getId ( mData->mExternalId, prof ); |
327 | } | 331 | } |
328 | 332 | ||
329 | void Addressee::setCsum( const QString & prof , const QString & id ) | 333 | void Addressee::setCsum( const QString & prof , const QString & id ) |
330 | { | 334 | { |
331 | detach(); | 335 | detach(); |
332 | //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); | 336 | //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); |
333 | mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); | 337 | mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); |
334 | //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); | 338 | //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); |
335 | } | 339 | } |
336 | 340 | ||
337 | QString Addressee::getCsum( const QString & prof) | 341 | QString Addressee::getCsum( const QString & prof) |
diff --git a/kabc/addressee.h b/kabc/addressee.h index 59fcbd8..3ba7777 100644 --- a/kabc/addressee.h +++ b/kabc/addressee.h | |||
@@ -69,97 +69,97 @@ class Resource; | |||
69 | naming. formattedName() is the full name with the correct formatting. | 69 | naming. formattedName() is the full name with the correct formatting. |
70 | It is used as an override, when the correct formatting can't be generated | 70 | It is used as an override, when the correct formatting can't be generated |
71 | from the other name fields automatically. | 71 | from the other name fields automatically. |
72 | 72 | ||
73 | realName() returns a fully formatted name(). It uses formattedName, if set, | 73 | realName() returns a fully formatted name(). It uses formattedName, if set, |
74 | otherwise it constucts the name from the name fields. As fallback, if | 74 | otherwise it constucts the name from the name fields. As fallback, if |
75 | nothing else is set it uses name(). | 75 | nothing else is set it uses name(). |
76 | 76 | ||
77 | name() is the NAME type of RFC2426. It can be used as internal name for the | 77 | name() is the NAME type of RFC2426. It can be used as internal name for the |
78 | data enty, but shouldn't be used for displaying the data to the user. | 78 | data enty, but shouldn't be used for displaying the data to the user. |
79 | */ | 79 | */ |
80 | class Addressee | 80 | class Addressee |
81 | { | 81 | { |
82 | friend QDataStream &operator<<( QDataStream &, const Addressee & ); | 82 | friend QDataStream &operator<<( QDataStream &, const Addressee & ); |
83 | friend QDataStream &operator>>( QDataStream &, Addressee & ); | 83 | friend QDataStream &operator>>( QDataStream &, Addressee & ); |
84 | 84 | ||
85 | public: | 85 | public: |
86 | typedef QValueList<Addressee> List; | 86 | typedef QValueList<Addressee> List; |
87 | 87 | ||
88 | /** | 88 | /** |
89 | Construct an empty address book entry. | 89 | Construct an empty address book entry. |
90 | */ | 90 | */ |
91 | Addressee(); | 91 | Addressee(); |
92 | ~Addressee(); | 92 | ~Addressee(); |
93 | 93 | ||
94 | Addressee( const Addressee & ); | 94 | Addressee( const Addressee & ); |
95 | Addressee &operator=( const Addressee & ); | 95 | Addressee &operator=( const Addressee & ); |
96 | 96 | ||
97 | bool operator==( const Addressee & ) const; | 97 | bool operator==( const Addressee & ) const; |
98 | bool operator!=( const Addressee & ) const; | 98 | bool operator!=( const Addressee & ) const; |
99 | // sync stuff | 99 | // sync stuff |
100 | void setTempSyncStat(int id); | 100 | void setTempSyncStat(int id); |
101 | int tempSyncStat() const; | 101 | int tempSyncStat() const; |
102 | void setIDStr( const QString & ); | 102 | void setIDStr( const QString & ); |
103 | QString IDStr() const; | 103 | QString IDStr() const; |
104 | void setID( const QString &, const QString & ); | 104 | void setID( const QString &, const QString & ); |
105 | QString getID( const QString & ); | 105 | QString getID( const QString & ); |
106 | void setCsum( const QString &, const QString & ); | 106 | void setCsum( const QString &, const QString & ); |
107 | QString getCsum( const QString & ); | 107 | QString getCsum( const QString & ); |
108 | void removeID(const QString &); | 108 | void removeID(const QString &); |
109 | void computeCsum(const QString &dev); | 109 | void computeCsum(const QString &dev); |
110 | ulong getCsum4List( const QStringList & attList); | 110 | ulong getCsum4List( const QStringList & attList); |
111 | /** | 111 | /** |
112 | Return, if the address book entry is empty. | 112 | Return, if the address book entry is empty. |
113 | */ | 113 | */ |
114 | bool isEmpty() const; | 114 | bool isEmpty() const; |
115 | void setExternalUID( const QString &id ); | 115 | void setExternalUID( const QString &id ); |
116 | QString externalUID() const; | 116 | QString externalUID() const; |
117 | void mergeContact( Addressee ad ); | 117 | void mergeContact( const Addressee& ad ); |
118 | /** | 118 | /** |
119 | Set unique identifier. | 119 | Set unique identifier. |
120 | */ | 120 | */ |
121 | void setUid( const QString &uid ); | 121 | void setUid( const QString &uid ); |
122 | /** | 122 | /** |
123 | Return unique identifier. | 123 | Return unique identifier. |
124 | */ | 124 | */ |
125 | QString uid() const; | 125 | QString uid() const; |
126 | /** | 126 | /** |
127 | Return translated label for uid field. | 127 | Return translated label for uid field. |
128 | */ | 128 | */ |
129 | static QString uidLabel(); | 129 | static QString uidLabel(); |
130 | 130 | ||
131 | /** | 131 | /** |
132 | Set name. | 132 | Set name. |
133 | */ | 133 | */ |
134 | void setName( const QString &name ); | 134 | void setName( const QString &name ); |
135 | /** | 135 | /** |
136 | Return name. | 136 | Return name. |
137 | */ | 137 | */ |
138 | QString name() const; | 138 | QString name() const; |
139 | /** | 139 | /** |
140 | Return translated label for name field. | 140 | Return translated label for name field. |
141 | */ | 141 | */ |
142 | static QString nameLabel(); | 142 | static QString nameLabel(); |
143 | 143 | ||
144 | /** | 144 | /** |
145 | Set formatted name. | 145 | Set formatted name. |
146 | */ | 146 | */ |
147 | void setFormattedName( const QString &formattedName ); | 147 | void setFormattedName( const QString &formattedName ); |
148 | /** | 148 | /** |
149 | Return formatted name. | 149 | Return formatted name. |
150 | */ | 150 | */ |
151 | QString formattedName() const; | 151 | QString formattedName() const; |
152 | /** | 152 | /** |
153 | Return translated label for formattedName field. | 153 | Return translated label for formattedName field. |
154 | */ | 154 | */ |
155 | static QString formattedNameLabel(); | 155 | static QString formattedNameLabel(); |
156 | 156 | ||
157 | /** | 157 | /** |
158 | Set family name. | 158 | Set family name. |
159 | */ | 159 | */ |
160 | void setFamilyName( const QString &familyName ); | 160 | void setFamilyName( const QString &familyName ); |
161 | /** | 161 | /** |
162 | Return family name. | 162 | Return family name. |
163 | */ | 163 | */ |
164 | QString familyName() const; | 164 | QString familyName() const; |
165 | /** | 165 | /** |