author | zautrix <zautrix> | 2004-10-29 14:01:58 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-29 14:01:58 (UTC) |
commit | 102cc4a711e303372efea9797623ee2d9f27f63c (patch) (unidiff) | |
tree | 32e56b436e52b5b1bab701839a24fc175288d57c /kabc/addressee.cpp | |
parent | 8c55eb6afe84ef69bb284d384a0c9f1ef1484ad8 (diff) | |
download | kdepimpi-102cc4a711e303372efea9797623ee2d9f27f63c.zip kdepimpi-102cc4a711e303372efea9797623ee2d9f27f63c.tar.gz kdepimpi-102cc4a711e303372efea9797623ee2d9f27f63c.tar.bz2 |
removed debug output
-rw-r--r-- | kabc/addressee.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index 3d4992c..028d3bb 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp | |||
@@ -179,193 +179,193 @@ bool Addressee::isEmpty() const | |||
179 | return mData->empty; | 179 | return mData->empty; |
180 | } | 180 | } |
181 | ulong Addressee::getCsum4List( const QStringList & attList) | 181 | ulong Addressee::getCsum4List( const QStringList & attList) |
182 | { | 182 | { |
183 | int max = attList.count(); | 183 | int max = attList.count(); |
184 | ulong cSum = 0; | 184 | ulong cSum = 0; |
185 | int j,k,i; | 185 | int j,k,i; |
186 | int add; | 186 | int add; |
187 | for ( i = 0; i < max ; ++i ) { | 187 | for ( i = 0; i < max ; ++i ) { |
188 | QString s = attList[i]; | 188 | QString s = attList[i]; |
189 | if ( ! s.isEmpty() ){ | 189 | if ( ! s.isEmpty() ){ |
190 | j = s.length(); | 190 | j = s.length(); |
191 | for ( k = 0; k < j; ++k ) { | 191 | for ( k = 0; k < j; ++k ) { |
192 | int mul = k +1; | 192 | int mul = k +1; |
193 | add = s[k].unicode (); | 193 | add = s[k].unicode (); |
194 | if ( k < 16 ) | 194 | if ( k < 16 ) |
195 | mul = mul * mul; | 195 | mul = mul * mul; |
196 | int ii = i+1; | 196 | int ii = i+1; |
197 | add = add * mul *ii*ii*ii; | 197 | add = add * mul *ii*ii*ii; |
198 | cSum += add; | 198 | cSum += add; |
199 | } | 199 | } |
200 | } | 200 | } |
201 | 201 | ||
202 | } | 202 | } |
203 | //QString dump = attList.join(","); | 203 | //QString dump = attList.join(","); |
204 | //qDebug("csum: %d %s", cSum,dump.latin1()); | 204 | //qDebug("csum: %d %s", cSum,dump.latin1()); |
205 | 205 | ||
206 | return cSum; | 206 | return cSum; |
207 | 207 | ||
208 | } | 208 | } |
209 | void Addressee::computeCsum(const QString &dev) | 209 | void Addressee::computeCsum(const QString &dev) |
210 | { | 210 | { |
211 | QStringList l; | 211 | QStringList l; |
212 | //if ( !mData->name.isEmpty() ) l.append(mData->name); | 212 | //if ( !mData->name.isEmpty() ) l.append(mData->name); |
213 | //if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName ); | 213 | //if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName ); |
214 | if ( !mData->familyName.isEmpty() ) l.append( mData->familyName ); | 214 | if ( !mData->familyName.isEmpty() ) l.append( mData->familyName ); |
215 | if ( !mData->givenName.isEmpty() ) l.append(mData->givenName ); | 215 | if ( !mData->givenName.isEmpty() ) l.append(mData->givenName ); |
216 | if ( !mData->additionalName.isEmpty() ) l.append( mData->additionalName ); | 216 | if ( !mData->additionalName.isEmpty() ) l.append( mData->additionalName ); |
217 | if ( !mData->prefix.isEmpty() ) l.append( mData->prefix ); | 217 | if ( !mData->prefix.isEmpty() ) l.append( mData->prefix ); |
218 | if ( !mData->suffix.isEmpty() ) l.append( mData->suffix ); | 218 | if ( !mData->suffix.isEmpty() ) l.append( mData->suffix ); |
219 | if ( !mData->nickName.isEmpty() ) l.append( mData->nickName ); | 219 | if ( !mData->nickName.isEmpty() ) l.append( mData->nickName ); |
220 | if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() ); | 220 | if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() ); |
221 | if ( !mData->mailer.isEmpty() ) l.append( mData->mailer ); | 221 | if ( !mData->mailer.isEmpty() ) l.append( mData->mailer ); |
222 | if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() ); | 222 | if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() ); |
223 | if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); | 223 | if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); |
224 | if ( !mData->title .isEmpty() ) l.append( mData->title ); | 224 | if ( !mData->title .isEmpty() ) l.append( mData->title ); |
225 | if ( !mData->role.isEmpty() ) l.append( mData->role ); | 225 | if ( !mData->role.isEmpty() ) l.append( mData->role ); |
226 | if ( !mData->organization.isEmpty() ) l.append( mData->organization ); | 226 | if ( !mData->organization.isEmpty() ) l.append( mData->organization ); |
227 | if ( !mData->note.isEmpty() ) l.append( mData->note ); | 227 | if ( !mData->note.isEmpty() ) l.append( mData->note ); |
228 | if ( !mData->productId.isEmpty() ) l.append(mData->productId ); | 228 | if ( !mData->productId.isEmpty() ) l.append(mData->productId ); |
229 | if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); | 229 | if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); |
230 | if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); | 230 | if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); |
231 | // if ( !mData->logo.isEmpty() ) l.append( ); | 231 | // if ( !mData->logo.isEmpty() ) l.append( ); |
232 | //if ( !mData->photo.isEmpty() ) l.append( ); | 232 | //if ( !mData->photo.isEmpty() ) l.append( ); |
233 | //if ( !mData->sound.isEmpty() ) l.append( ); | 233 | //if ( !mData->sound.isEmpty() ) l.append( ); |
234 | //if ( !mData->agent.isEmpty() ) l.append( ); | 234 | //if ( !mData->agent.isEmpty() ) l.append( ); |
235 | if ( mData->url.isValid() ) | 235 | if ( mData->url.isValid() ) |
236 | if ( ! mData->url.path().isEmpty()) l.append( mData->url.path() ); | 236 | if ( ! mData->url.path().isEmpty()) l.append( mData->url.path() ); |
237 | KABC::PhoneNumber::List phoneNumbers; | 237 | KABC::PhoneNumber::List phoneNumbers; |
238 | KABC::PhoneNumber::List::Iterator phoneIter; | 238 | KABC::PhoneNumber::List::Iterator phoneIter; |
239 | 239 | ||
240 | QStringList t; | 240 | QStringList t; |
241 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 241 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
242 | ++phoneIter ) | 242 | ++phoneIter ) |
243 | t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) ); | 243 | t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) ); |
244 | t.sort(); | 244 | t.sort(); |
245 | uint iii; | 245 | uint iii; |
246 | for ( iii = 0; iii < t.count(); ++iii) | 246 | for ( iii = 0; iii < t.count(); ++iii) |
247 | l.append( t[iii] ); | 247 | l.append( t[iii] ); |
248 | t = mData->emails; | 248 | t = mData->emails; |
249 | t.sort(); | 249 | t.sort(); |
250 | for ( iii = 0; iii < t.count(); ++iii) | 250 | for ( iii = 0; iii < t.count(); ++iii) |
251 | l.append( t[iii] ); | 251 | l.append( t[iii] ); |
252 | t = mData->categories; | 252 | t = mData->categories; |
253 | t.sort(); | 253 | t.sort(); |
254 | for ( iii = 0; iii < t.count(); ++iii) | 254 | for ( iii = 0; iii < t.count(); ++iii) |
255 | l.append( t[iii] ); | 255 | l.append( t[iii] ); |
256 | t = mData->custom; | 256 | t = mData->custom; |
257 | t.sort(); | 257 | t.sort(); |
258 | for ( iii = 0; iii < t.count(); ++iii) | 258 | for ( iii = 0; iii < t.count(); ++iii) |
259 | if ( t[iii].left( 25 ) != "KADDRESSBOOK-X-ExternalID" ) { | 259 | if ( t[iii].left( 25 ) != "KADDRESSBOOK-X-ExternalID" ) { |
260 | int find = t[iii].find (':')+1; | 260 | int find = t[iii].find (':')+1; |
261 | //qDebug("lennnn %d %d ", find, t[iii].length()); | 261 | //qDebug("lennnn %d %d ", find, t[iii].length()); |
262 | if ( find < t[iii].length()) | 262 | if ( find < t[iii].length()) |
263 | l.append( t[iii] ); | 263 | l.append( t[iii] ); |
264 | 264 | ||
265 | } | 265 | } |
266 | KABC::Address::List::Iterator addressIter; | 266 | KABC::Address::List::Iterator addressIter; |
267 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); | 267 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); |
268 | ++addressIter ) { | 268 | ++addressIter ) { |
269 | t = (*addressIter).asList(); | 269 | t = (*addressIter).asList(); |
270 | t.sort(); | 270 | t.sort(); |
271 | for ( iii = 0; iii < t.count(); ++iii) | 271 | for ( iii = 0; iii < t.count(); ++iii) |
272 | l.append( t[iii] ); | 272 | l.append( t[iii] ); |
273 | } | 273 | } |
274 | uint cs = getCsum4List(l); | 274 | uint cs = getCsum4List(l); |
275 | #if 1 | 275 | #if 0 |
276 | for ( iii = 0; iii < l.count(); ++iii) | 276 | for ( iii = 0; iii < l.count(); ++iii) |
277 | qDebug("%d***%s***",iii,l[iii].latin1()); | 277 | qDebug("%d***%s***",iii,l[iii].latin1()); |
278 | qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); | 278 | qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); |
279 | #endif | 279 | #endif |
280 | setCsum( dev, QString::number (cs )); | 280 | setCsum( dev, QString::number (cs )); |
281 | } | 281 | } |
282 | 282 | ||
283 | void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) | 283 | void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) |
284 | { | 284 | { |
285 | 285 | ||
286 | detach(); | 286 | detach(); |
287 | if ( mData->name.isEmpty() ) mData->name = ad.mData->name; | 287 | if ( mData->name.isEmpty() ) mData->name = ad.mData->name; |
288 | if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; | 288 | if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; |
289 | if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; | 289 | if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; |
290 | if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; | 290 | if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; |
291 | if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; | 291 | if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; |
292 | if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix; | 292 | if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix; |
293 | if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix; | 293 | if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix; |
294 | if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName; | 294 | if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName; |
295 | if ( !mData->birthday.isValid() ) | 295 | if ( !mData->birthday.isValid() ) |
296 | if ( ad.mData->birthday.isValid()) | 296 | if ( ad.mData->birthday.isValid()) |
297 | mData->birthday = ad.mData->birthday; | 297 | mData->birthday = ad.mData->birthday; |
298 | if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; | 298 | if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; |
299 | if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone; | 299 | if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone; |
300 | if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo; | 300 | if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo; |
301 | if ( mData->title .isEmpty() ) mData->title = ad.mData->title ; | 301 | if ( mData->title .isEmpty() ) mData->title = ad.mData->title ; |
302 | if ( mData->role.isEmpty() ) mData->role = ad.mData->role ; | 302 | if ( mData->role.isEmpty() ) mData->role = ad.mData->role ; |
303 | if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ; | 303 | if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ; |
304 | if ( mData->note.isEmpty() ) mData->note = ad.mData->note ; | 304 | if ( mData->note.isEmpty() ) mData->note = ad.mData->note ; |
305 | if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId; | 305 | if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId; |
306 | if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString; | 306 | if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString; |
307 | if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy; | 307 | if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy; |
308 | if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ; | 308 | if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ; |
309 | QStringList t; | 309 | QStringList t; |
310 | QStringList tAD; | 310 | QStringList tAD; |
311 | uint iii; | 311 | uint iii; |
312 | 312 | ||
313 | // ********** phone numbers | 313 | // ********** phone numbers |
314 | PhoneNumber::List phoneAD = ad.phoneNumbers(); | 314 | PhoneNumber::List phoneAD = ad.phoneNumbers(); |
315 | PhoneNumber::List::Iterator phoneItAD; | 315 | PhoneNumber::List::Iterator phoneItAD; |
316 | for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) { | 316 | for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) { |
317 | bool found = false; | 317 | bool found = false; |
318 | PhoneNumber::List::Iterator it; | 318 | PhoneNumber::List::Iterator it; |
319 | for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { | 319 | for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { |
320 | if ( ( *phoneItAD ).contains( (*it) ) ) { | 320 | if ( ( *phoneItAD ).contains( (*it) ) ) { |
321 | found = true; | 321 | found = true; |
322 | (*it).setType( ( *phoneItAD ).type() ); | 322 | (*it).setType( ( *phoneItAD ).type() ); |
323 | (*it).setNumber( ( *phoneItAD ).number() ); | 323 | (*it).setNumber( ( *phoneItAD ).number() ); |
324 | break; | 324 | break; |
325 | } | 325 | } |
326 | } | 326 | } |
327 | if ( isSubSet && ! found ) | 327 | if ( isSubSet && ! found ) |
328 | mData->phoneNumbers.append( *phoneItAD ); | 328 | mData->phoneNumbers.append( *phoneItAD ); |
329 | } | 329 | } |
330 | if ( isSubSet ) { | 330 | if ( isSubSet ) { |
331 | // ************* emails; | 331 | // ************* emails; |
332 | t = mData->emails; | 332 | t = mData->emails; |
333 | tAD = ad.mData->emails; | 333 | tAD = ad.mData->emails; |
334 | for ( iii = 0; iii < tAD.count(); ++iii) | 334 | for ( iii = 0; iii < tAD.count(); ++iii) |
335 | if ( !t.contains(tAD[iii] ) ) | 335 | if ( !t.contains(tAD[iii] ) ) |
336 | mData->emails.append( tAD[iii] ); | 336 | mData->emails.append( tAD[iii] ); |
337 | } | 337 | } |
338 | 338 | ||
339 | // ************* categories; | 339 | // ************* categories; |
340 | t = mData->categories; | 340 | t = mData->categories; |
341 | tAD = ad.mData->categories; | 341 | tAD = ad.mData->categories; |
342 | for ( iii = 0; iii < tAD.count(); ++iii) | 342 | for ( iii = 0; iii < tAD.count(); ++iii) |
343 | if ( !t.contains(tAD[iii] ) ) | 343 | if ( !t.contains(tAD[iii] ) ) |
344 | mData->categories.append( tAD[iii] ); | 344 | mData->categories.append( tAD[iii] ); |
345 | QStringList::ConstIterator it; | 345 | QStringList::ConstIterator it; |
346 | for( it = ad.mData->custom.begin(); it != ad.mData->custom.end(); ++it ) { | 346 | for( it = ad.mData->custom.begin(); it != ad.mData->custom.end(); ++it ) { |
347 | QString qualifiedName = (*it).left( (*it).find( ":" )); | 347 | QString qualifiedName = (*it).left( (*it).find( ":" )); |
348 | bool found = false; | 348 | bool found = false; |
349 | QStringList::ConstIterator itL; | 349 | QStringList::ConstIterator itL; |
350 | for( itL = mData->custom.begin(); itL != mData->custom.end(); ++itL ) { | 350 | for( itL = mData->custom.begin(); itL != mData->custom.end(); ++itL ) { |
351 | if ( (*itL).startsWith( qualifiedName ) ) { | 351 | if ( (*itL).startsWith( qualifiedName ) ) { |
352 | found = true; | 352 | found = true; |
353 | break; | 353 | break; |
354 | } | 354 | } |
355 | } | 355 | } |
356 | if ( ! found ) { | 356 | if ( ! found ) { |
357 | mData->custom.append( *it ); | 357 | mData->custom.append( *it ); |
358 | } | 358 | } |
359 | } | 359 | } |
360 | if ( mData->logo.undefined() && !ad.mData->logo.undefined() ) mData->logo = ad.mData->logo; | 360 | if ( mData->logo.undefined() && !ad.mData->logo.undefined() ) mData->logo = ad.mData->logo; |
361 | if ( mData->photo.undefined() && !ad.mData->photo.undefined() ) mData->photo = ad.mData->photo; | 361 | if ( mData->photo.undefined() && !ad.mData->photo.undefined() ) mData->photo = ad.mData->photo; |
362 | if ( !mData->sound.isIntern() ) { | 362 | if ( !mData->sound.isIntern() ) { |
363 | if ( mData->sound.url().isEmpty() ) { | 363 | if ( mData->sound.url().isEmpty() ) { |
364 | mData->sound = ad.mData->sound; | 364 | mData->sound = ad.mData->sound; |
365 | } | 365 | } |
366 | } | 366 | } |
367 | if ( !mData->agent.isIntern() ) { | 367 | if ( !mData->agent.isIntern() ) { |
368 | if ( mData->agent.url().isEmpty() ) { | 368 | if ( mData->agent.url().isEmpty() ) { |
369 | mData->agent = ad.mData->agent; | 369 | mData->agent = ad.mData->agent; |
370 | } | 370 | } |
371 | } | 371 | } |