author | zautrix <zautrix> | 2004-10-26 22:19:18 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-26 22:19:18 (UTC) |
commit | 6385f303bef3cbcd19d097a7b05c30e144d5dd6e (patch) (unidiff) | |
tree | 770795d94ea6ec1dc8bcaa67cc174a9c0add564a /kabc/addressee.cpp | |
parent | 13e996beddabc5e88f4f2fe49b2ce6cb8408eb30 (diff) | |
download | kdepimpi-6385f303bef3cbcd19d097a7b05c30e144d5dd6e.zip kdepimpi-6385f303bef3cbcd19d097a7b05c30e144d5dd6e.tar.gz kdepimpi-6385f303bef3cbcd19d097a7b05c30e144d5dd6e.tar.bz2 |
implemented remove sync info for kopi and kapi
-rw-r--r-- | kabc/addressee.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index 40877ef..a660a9d 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp | |||
@@ -172,769 +172,772 @@ bool Addressee::operator==( const Addressee &a ) const | |||
172 | bool Addressee::operator!=( const Addressee &a ) const | 172 | bool Addressee::operator!=( const Addressee &a ) const |
173 | { | 173 | { |
174 | return !( a == *this ); | 174 | return !( a == *this ); |
175 | } | 175 | } |
176 | 176 | ||
177 | bool Addressee::isEmpty() const | 177 | bool Addressee::isEmpty() const |
178 | { | 178 | { |
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 ) l.append( mData->additionalName ); | 216 | if ( !mData->additionalName ) 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 | l.append( t[iii] ); | 259 | l.append( t[iii] ); |
260 | KABC::Address::List::Iterator addressIter; | 260 | KABC::Address::List::Iterator addressIter; |
261 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); | 261 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); |
262 | ++addressIter ) { | 262 | ++addressIter ) { |
263 | t = (*addressIter).asList(); | 263 | t = (*addressIter).asList(); |
264 | t.sort(); | 264 | t.sort(); |
265 | for ( iii = 0; iii < t.count(); ++iii) | 265 | for ( iii = 0; iii < t.count(); ++iii) |
266 | l.append( t[iii] ); | 266 | l.append( t[iii] ); |
267 | } | 267 | } |
268 | uint cs = getCsum4List(l); | 268 | uint cs = getCsum4List(l); |
269 | // qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); | 269 | // qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); |
270 | setCsum( dev, QString::number (cs )); | 270 | setCsum( dev, QString::number (cs )); |
271 | } | 271 | } |
272 | 272 | ||
273 | void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) | 273 | void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) |
274 | { | 274 | { |
275 | 275 | ||
276 | detach(); | 276 | detach(); |
277 | if ( mData->name.isEmpty() ) mData->name = ad.mData->name; | 277 | if ( mData->name.isEmpty() ) mData->name = ad.mData->name; |
278 | if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; | 278 | if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; |
279 | if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; | 279 | if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; |
280 | if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; | 280 | if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; |
281 | if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; | 281 | if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; |
282 | if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix; | 282 | if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix; |
283 | if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix; | 283 | if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix; |
284 | if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName; | 284 | if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName; |
285 | if ( !mData->birthday.isValid() ) | 285 | if ( !mData->birthday.isValid() ) |
286 | if ( ad.mData->birthday.isValid()) | 286 | if ( ad.mData->birthday.isValid()) |
287 | mData->birthday = ad.mData->birthday; | 287 | mData->birthday = ad.mData->birthday; |
288 | if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; | 288 | if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; |
289 | if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone; | 289 | if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone; |
290 | if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo; | 290 | if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo; |
291 | if ( mData->title .isEmpty() ) mData->title = ad.mData->title ; | 291 | if ( mData->title .isEmpty() ) mData->title = ad.mData->title ; |
292 | if ( mData->role.isEmpty() ) mData->role = ad.mData->role ; | 292 | if ( mData->role.isEmpty() ) mData->role = ad.mData->role ; |
293 | if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ; | 293 | if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ; |
294 | if ( mData->note.isEmpty() ) mData->note = ad.mData->note ; | 294 | if ( mData->note.isEmpty() ) mData->note = ad.mData->note ; |
295 | if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId; | 295 | if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId; |
296 | if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString; | 296 | if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString; |
297 | if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy; | 297 | if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy; |
298 | if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ; | 298 | if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ; |
299 | QStringList t; | 299 | QStringList t; |
300 | QStringList tAD; | 300 | QStringList tAD; |
301 | uint iii; | 301 | uint iii; |
302 | 302 | ||
303 | // ********** phone numbers | 303 | // ********** phone numbers |
304 | PhoneNumber::List phoneAD = ad.phoneNumbers(); | 304 | PhoneNumber::List phoneAD = ad.phoneNumbers(); |
305 | PhoneNumber::List::Iterator phoneItAD; | 305 | PhoneNumber::List::Iterator phoneItAD; |
306 | for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) { | 306 | for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) { |
307 | bool found = false; | 307 | bool found = false; |
308 | PhoneNumber::List::Iterator it; | 308 | PhoneNumber::List::Iterator it; |
309 | for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { | 309 | for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { |
310 | if ( ( *phoneItAD ).contains( (*it) ) ) { | 310 | if ( ( *phoneItAD ).contains( (*it) ) ) { |
311 | found = true; | 311 | found = true; |
312 | (*it).setType( ( *phoneItAD ).type() ); | 312 | (*it).setType( ( *phoneItAD ).type() ); |
313 | (*it).setNumber( ( *phoneItAD ).number() ); | 313 | (*it).setNumber( ( *phoneItAD ).number() ); |
314 | break; | 314 | break; |
315 | } | 315 | } |
316 | } | 316 | } |
317 | if ( isSubSet && ! found ) | 317 | if ( isSubSet && ! found ) |
318 | mData->phoneNumbers.append( *phoneItAD ); | 318 | mData->phoneNumbers.append( *phoneItAD ); |
319 | } | 319 | } |
320 | if ( isSubSet ) { | 320 | if ( isSubSet ) { |
321 | // ************* emails; | 321 | // ************* emails; |
322 | t = mData->emails; | 322 | t = mData->emails; |
323 | tAD = ad.mData->emails; | 323 | tAD = ad.mData->emails; |
324 | for ( iii = 0; iii < tAD.count(); ++iii) | 324 | for ( iii = 0; iii < tAD.count(); ++iii) |
325 | if ( !t.contains(tAD[iii] ) ) | 325 | if ( !t.contains(tAD[iii] ) ) |
326 | mData->emails.append( tAD[iii] ); | 326 | mData->emails.append( tAD[iii] ); |
327 | } | 327 | } |
328 | 328 | ||
329 | // ************* categories; | 329 | // ************* categories; |
330 | t = mData->categories; | 330 | t = mData->categories; |
331 | tAD = ad.mData->categories; | 331 | tAD = ad.mData->categories; |
332 | for ( iii = 0; iii < tAD.count(); ++iii) | 332 | for ( iii = 0; iii < tAD.count(); ++iii) |
333 | if ( !t.contains(tAD[iii] ) ) | 333 | if ( !t.contains(tAD[iii] ) ) |
334 | mData->categories.append( tAD[iii] ); | 334 | mData->categories.append( tAD[iii] ); |
335 | QStringList::ConstIterator it; | 335 | QStringList::ConstIterator it; |
336 | for( it = ad.mData->custom.begin(); it != ad.mData->custom.end(); ++it ) { | 336 | for( it = ad.mData->custom.begin(); it != ad.mData->custom.end(); ++it ) { |
337 | QString qualifiedName = (*it).left( (*it).find( ":" )); | 337 | QString qualifiedName = (*it).left( (*it).find( ":" )); |
338 | bool found = false; | 338 | bool found = false; |
339 | QStringList::ConstIterator itL; | 339 | QStringList::ConstIterator itL; |
340 | for( itL = mData->custom.begin(); itL != mData->custom.end(); ++itL ) { | 340 | for( itL = mData->custom.begin(); itL != mData->custom.end(); ++itL ) { |
341 | if ( (*itL).startsWith( qualifiedName ) ) { | 341 | if ( (*itL).startsWith( qualifiedName ) ) { |
342 | found = true; | 342 | found = true; |
343 | break; | 343 | break; |
344 | } | 344 | } |
345 | } | 345 | } |
346 | if ( ! found ) { | 346 | if ( ! found ) { |
347 | mData->custom.append( *it ); | 347 | mData->custom.append( *it ); |
348 | } | 348 | } |
349 | } | 349 | } |
350 | if ( mData->logo.undefined() && !ad.mData->logo.undefined() ) mData->logo = ad.mData->logo; | 350 | if ( mData->logo.undefined() && !ad.mData->logo.undefined() ) mData->logo = ad.mData->logo; |
351 | if ( mData->photo.undefined() && !ad.mData->photo.undefined() ) mData->photo = ad.mData->photo; | 351 | if ( mData->photo.undefined() && !ad.mData->photo.undefined() ) mData->photo = ad.mData->photo; |
352 | if ( !mData->sound.isIntern() ) { | 352 | if ( !mData->sound.isIntern() ) { |
353 | if ( mData->sound.url().isEmpty() ) { | 353 | if ( mData->sound.url().isEmpty() ) { |
354 | mData->sound = ad.mData->sound; | 354 | mData->sound = ad.mData->sound; |
355 | } | 355 | } |
356 | } | 356 | } |
357 | if ( !mData->agent.isIntern() ) { | 357 | if ( !mData->agent.isIntern() ) { |
358 | if ( mData->agent.url().isEmpty() ) { | 358 | if ( mData->agent.url().isEmpty() ) { |
359 | mData->agent = ad.mData->agent; | 359 | mData->agent = ad.mData->agent; |
360 | } | 360 | } |
361 | } | 361 | } |
362 | { | 362 | { |
363 | Key::List::Iterator itA; | 363 | Key::List::Iterator itA; |
364 | for( itA = ad.mData->keys.begin(); itA != ad.mData->keys.end(); ++itA ) { | 364 | for( itA = ad.mData->keys.begin(); itA != ad.mData->keys.end(); ++itA ) { |
365 | bool found = false; | 365 | bool found = false; |
366 | Key::List::Iterator it; | 366 | Key::List::Iterator it; |
367 | for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { | 367 | for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { |
368 | if ( (*it) == (*itA)) { | 368 | if ( (*it) == (*itA)) { |
369 | found = true; | 369 | found = true; |
370 | break; | 370 | break; |
371 | 371 | ||
372 | } | 372 | } |
373 | } | 373 | } |
374 | if ( ! found ) { | 374 | if ( ! found ) { |
375 | mData->keys.append( *itA ); | 375 | mData->keys.append( *itA ); |
376 | } | 376 | } |
377 | } | 377 | } |
378 | } | 378 | } |
379 | KABC::Address::List::Iterator addressIterA; | 379 | KABC::Address::List::Iterator addressIterA; |
380 | for ( addressIterA = ad.mData->addresses.begin(); addressIterA != ad.mData->addresses.end(); ++addressIterA ) { | 380 | for ( addressIterA = ad.mData->addresses.begin(); addressIterA != ad.mData->addresses.end(); ++addressIterA ) { |
381 | bool found = false; | 381 | bool found = false; |
382 | KABC::Address::List::Iterator addressIter; | 382 | KABC::Address::List::Iterator addressIter; |
383 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); | 383 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); |
384 | ++addressIter ) { | 384 | ++addressIter ) { |
385 | if ( (*addressIter) == (*addressIterA)) { | 385 | if ( (*addressIter) == (*addressIterA)) { |
386 | found = true; | 386 | found = true; |
387 | (*addressIter).setType( (*addressIterA).type() ); | 387 | (*addressIter).setType( (*addressIterA).type() ); |
388 | break; | 388 | break; |
389 | } | 389 | } |
390 | 390 | ||
391 | } | 391 | } |
392 | if ( isSubSet && ! found ) { | 392 | if ( isSubSet && ! found ) { |
393 | mData->addresses.append( *addressIterA ); | 393 | mData->addresses.append( *addressIterA ); |
394 | } | 394 | } |
395 | } | 395 | } |
396 | //qDebug("merge contact %s ", ad.uid().latin1()); | 396 | //qDebug("merge contact %s ", ad.uid().latin1()); |
397 | setUid( ad.uid() ); | 397 | setUid( ad.uid() ); |
398 | setRevision( ad.revision() ); | 398 | setRevision( ad.revision() ); |
399 | } | 399 | } |
400 | 400 | ||
401 | bool Addressee::removeVoice() | 401 | bool Addressee::removeVoice() |
402 | { | 402 | { |
403 | PhoneNumber::List phoneN = phoneNumbers(); | 403 | PhoneNumber::List phoneN = phoneNumbers(); |
404 | PhoneNumber::List::Iterator phoneIt; | 404 | PhoneNumber::List::Iterator phoneIt; |
405 | bool found = false; | 405 | bool found = false; |
406 | for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) { | 406 | for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) { |
407 | if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found | 407 | if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found |
408 | if ((*phoneIt).type() - PhoneNumber::Voice ) { | 408 | if ((*phoneIt).type() - PhoneNumber::Voice ) { |
409 | (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); | 409 | (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); |
410 | insertPhoneNumber( (*phoneIt) ); | 410 | insertPhoneNumber( (*phoneIt) ); |
411 | found = true; | 411 | found = true; |
412 | } | 412 | } |
413 | } | 413 | } |
414 | 414 | ||
415 | } | 415 | } |
416 | return found; | 416 | return found; |
417 | } | 417 | } |
418 | 418 | ||
419 | bool Addressee::containsAdr(const Addressee& ad ) | 419 | bool Addressee::containsAdr(const Addressee& ad ) |
420 | { | 420 | { |
421 | if ( ! ad.mData->familyName.isEmpty() ) if ( mData->familyName != ad.mData->familyName) return false; | 421 | if ( ! ad.mData->familyName.isEmpty() ) if ( mData->familyName != ad.mData->familyName) return false; |
422 | if ( ! ad.mData->givenName.isEmpty() )if ( mData->givenName != ad.mData->givenName ) return false; | 422 | if ( ! ad.mData->givenName.isEmpty() )if ( mData->givenName != ad.mData->givenName ) return false; |
423 | if ( ad.mData->url.isValid() ) if (mData->url != ad.mData->url) return false ; | 423 | if ( ad.mData->url.isValid() ) if (mData->url != ad.mData->url) return false ; |
424 | if ( ! ad.mData->role.isEmpty() ) if (mData->role != ad.mData->role) return false ; | 424 | if ( ! ad.mData->role.isEmpty() ) if (mData->role != ad.mData->role) return false ; |
425 | if ( ! ad.mData->organization.isEmpty() ) if (mData->organization != ad.mData->organization) return false ; | 425 | if ( ! ad.mData->organization.isEmpty() ) if (mData->organization != ad.mData->organization) return false ; |
426 | if ( ! ad.mData->note.isEmpty() ) if (mData->note != ad.mData->note) return false ; | 426 | if ( ! ad.mData->note.isEmpty() ) if (mData->note != ad.mData->note) return false ; |
427 | if ( ! ad.mData->title .isEmpty() ) if (mData->title != ad.mData->title ) return false ; | 427 | if ( ! ad.mData->title .isEmpty() ) if (mData->title != ad.mData->title ) return false ; |
428 | 428 | ||
429 | // compare phone numbers | 429 | // compare phone numbers |
430 | PhoneNumber::List phoneN = ad.phoneNumbers(); | 430 | PhoneNumber::List phoneN = ad.phoneNumbers(); |
431 | PhoneNumber::List::Iterator phoneIt; | 431 | PhoneNumber::List::Iterator phoneIt; |
432 | bool found = false; | 432 | bool found = false; |
433 | for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) { | 433 | for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) { |
434 | bool found = false; | 434 | bool found = false; |
435 | PhoneNumber::List phoneL = ad.phoneNumbers(); | 435 | PhoneNumber::List phoneL = ad.phoneNumbers(); |
436 | PhoneNumber::List::Iterator phoneItL; | 436 | PhoneNumber::List::Iterator phoneItL; |
437 | for ( phoneItL = phoneL.begin(); phoneItL != phoneL.end(); ++phoneItL ) { | 437 | for ( phoneItL = phoneL.begin(); phoneItL != phoneL.end(); ++phoneItL ) { |
438 | if ( ( *phoneItL ).number() == ( *phoneIt ).number() ) { | 438 | if ( ( *phoneItL ).number() == ( *phoneIt ).number() ) { |
439 | found = true; | 439 | found = true; |
440 | break; | 440 | break; |
441 | } | 441 | } |
442 | } | 442 | } |
443 | if ( ! found ) | 443 | if ( ! found ) |
444 | return false; | 444 | return false; |
445 | } | 445 | } |
446 | return true; | 446 | return true; |
447 | 447 | ||
448 | } | 448 | } |
449 | void Addressee::simplifyAddresses() | 449 | void Addressee::simplifyAddresses() |
450 | { | 450 | { |
451 | 451 | ||
452 | 452 | ||
453 | Address::List list; | 453 | Address::List list; |
454 | Address::List::Iterator it; | 454 | Address::List::Iterator it; |
455 | Address::List::Iterator it2; | 455 | Address::List::Iterator it2; |
456 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { | 456 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { |
457 | it2 = it; | 457 | it2 = it; |
458 | ++it2; | 458 | ++it2; |
459 | for( ; it2 != mData->addresses.end(); ++it2 ) { | 459 | for( ; it2 != mData->addresses.end(); ++it2 ) { |
460 | if ( (*it) == (*it2) ) { | 460 | if ( (*it) == (*it2) ) { |
461 | list.append( *it ); | 461 | list.append( *it ); |
462 | break; | 462 | break; |
463 | } | 463 | } |
464 | } | 464 | } |
465 | } | 465 | } |
466 | for( it = list.begin(); it != list.end(); ++it ) { | 466 | for( it = list.begin(); it != list.end(); ++it ) { |
467 | removeAddress( (*it) ); | 467 | removeAddress( (*it) ); |
468 | } | 468 | } |
469 | 469 | ||
470 | list.clear(); | 470 | list.clear(); |
471 | int max = 2; | 471 | int max = 2; |
472 | if ( mData->url.isValid() ) | 472 | if ( mData->url.isValid() ) |
473 | max = 1; | 473 | max = 1; |
474 | if ( mData->addresses.count() <= max ) return ; | 474 | if ( mData->addresses.count() <= max ) return ; |
475 | int count = 0; | 475 | int count = 0; |
476 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { | 476 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { |
477 | if ( count >= max ) | 477 | if ( count >= max ) |
478 | list.append( *it ); | 478 | list.append( *it ); |
479 | ++count; | 479 | ++count; |
480 | } | 480 | } |
481 | for( it = list.begin(); it != list.end(); ++it ) { | 481 | for( it = list.begin(); it != list.end(); ++it ) { |
482 | removeAddress( (*it) ); | 482 | removeAddress( (*it) ); |
483 | } | 483 | } |
484 | } | 484 | } |
485 | 485 | ||
486 | // removes all emails but the first | 486 | // removes all emails but the first |
487 | // needed by phone sync | 487 | // needed by phone sync |
488 | void Addressee::simplifyEmails() | 488 | void Addressee::simplifyEmails() |
489 | { | 489 | { |
490 | if ( mData->emails.count() == 0 ) return ; | 490 | if ( mData->emails.count() == 0 ) return ; |
491 | QString email = mData->emails.first(); | 491 | QString email = mData->emails.first(); |
492 | detach(); | 492 | detach(); |
493 | mData->emails.clear(); | 493 | mData->emails.clear(); |
494 | mData->emails.append( email ); | 494 | mData->emails.append( email ); |
495 | } | 495 | } |
496 | 496 | ||
497 | void Addressee::simplifyPhoneNumbers() | 497 | void Addressee::simplifyPhoneNumbers() |
498 | { | 498 | { |
499 | int max = 4; | 499 | int max = 4; |
500 | int inList = mData->phoneNumbers.count(); | 500 | int inList = mData->phoneNumbers.count(); |
501 | KABC::PhoneNumber::List removeNumbers; | 501 | KABC::PhoneNumber::List removeNumbers; |
502 | KABC::PhoneNumber::List::Iterator phoneIter; | 502 | KABC::PhoneNumber::List::Iterator phoneIter; |
503 | if ( inList > max ) { | 503 | if ( inList > max ) { |
504 | // delete non-preferred numbers | 504 | // delete non-preferred numbers |
505 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 505 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
506 | ++phoneIter ) { | 506 | ++phoneIter ) { |
507 | if ( inList > max ) { | 507 | if ( inList > max ) { |
508 | if ( ! (( *phoneIter ).type() & PhoneNumber::Pref )) { | 508 | if ( ! (( *phoneIter ).type() & PhoneNumber::Pref )) { |
509 | removeNumbers.append( ( *phoneIter ) ); | 509 | removeNumbers.append( ( *phoneIter ) ); |
510 | --inList; | 510 | --inList; |
511 | } | 511 | } |
512 | } else | 512 | } else |
513 | break; | 513 | break; |
514 | } | 514 | } |
515 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); | 515 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); |
516 | ++phoneIter ) { | 516 | ++phoneIter ) { |
517 | removePhoneNumber(( *phoneIter )); | 517 | removePhoneNumber(( *phoneIter )); |
518 | } | 518 | } |
519 | // delete preferred numbers | 519 | // delete preferred numbers |
520 | if ( inList > max ) { | 520 | if ( inList > max ) { |
521 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 521 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
522 | ++phoneIter ) { | 522 | ++phoneIter ) { |
523 | if ( inList > max ) { | 523 | if ( inList > max ) { |
524 | removeNumbers.append( ( *phoneIter ) ); | 524 | removeNumbers.append( ( *phoneIter ) ); |
525 | --inList; | 525 | --inList; |
526 | } else | 526 | } else |
527 | break; | 527 | break; |
528 | } | 528 | } |
529 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); | 529 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); |
530 | ++phoneIter ) { | 530 | ++phoneIter ) { |
531 | removePhoneNumber(( *phoneIter )); | 531 | removePhoneNumber(( *phoneIter )); |
532 | } | 532 | } |
533 | } | 533 | } |
534 | } | 534 | } |
535 | // remove non-numeric characters | 535 | // remove non-numeric characters |
536 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 536 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
537 | ++phoneIter ) { | 537 | ++phoneIter ) { |
538 | if ( ! ( *phoneIter ).simplifyNumber() ) | 538 | if ( ! ( *phoneIter ).simplifyNumber() ) |
539 | removeNumbers.append( ( *phoneIter ) ); | 539 | removeNumbers.append( ( *phoneIter ) ); |
540 | } | 540 | } |
541 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); | 541 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); |
542 | ++phoneIter ) { | 542 | ++phoneIter ) { |
543 | removePhoneNumber(( *phoneIter )); | 543 | removePhoneNumber(( *phoneIter )); |
544 | } | 544 | } |
545 | } | 545 | } |
546 | void Addressee::simplifyPhoneNumberTypes() | 546 | void Addressee::simplifyPhoneNumberTypes() |
547 | { | 547 | { |
548 | KABC::PhoneNumber::List::Iterator phoneIter; | 548 | KABC::PhoneNumber::List::Iterator phoneIter; |
549 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 549 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
550 | ++phoneIter ) | 550 | ++phoneIter ) |
551 | ( *phoneIter ).simplifyType(); | 551 | ( *phoneIter ).simplifyType(); |
552 | } | 552 | } |
553 | void Addressee::removeID(const QString &prof) | 553 | void Addressee::removeID(const QString &prof) |
554 | { | 554 | { |
555 | detach(); | 555 | detach(); |
556 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); | 556 | if ( prof.isEmpty() ) |
557 | mData->mExternalId = ":"; | ||
558 | else | ||
559 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); | ||
557 | 560 | ||
558 | } | 561 | } |
559 | void Addressee::setID( const QString & prof , const QString & id ) | 562 | void Addressee::setID( const QString & prof , const QString & id ) |
560 | { | 563 | { |
561 | detach(); | 564 | detach(); |
562 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); | 565 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); |
563 | //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); | 566 | //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); |
564 | } | 567 | } |
565 | void Addressee::setTempSyncStat( int id ) | 568 | void Addressee::setTempSyncStat( int id ) |
566 | { | 569 | { |
567 | if ( mData->mTempSyncStat == id ) return; | 570 | if ( mData->mTempSyncStat == id ) return; |
568 | detach(); | 571 | detach(); |
569 | mData->mTempSyncStat = id; | 572 | mData->mTempSyncStat = id; |
570 | } | 573 | } |
571 | int Addressee::tempSyncStat() const | 574 | int Addressee::tempSyncStat() const |
572 | { | 575 | { |
573 | return mData->mTempSyncStat; | 576 | return mData->mTempSyncStat; |
574 | } | 577 | } |
575 | 578 | ||
576 | QString Addressee::getID( const QString & prof) | 579 | QString Addressee::getID( const QString & prof) |
577 | { | 580 | { |
578 | return KIdManager::getId ( mData->mExternalId, prof ); | 581 | return KIdManager::getId ( mData->mExternalId, prof ); |
579 | } | 582 | } |
580 | 583 | ||
581 | void Addressee::setCsum( const QString & prof , const QString & id ) | 584 | void Addressee::setCsum( const QString & prof , const QString & id ) |
582 | { | 585 | { |
583 | detach(); | 586 | detach(); |
584 | //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); | 587 | //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); |
585 | mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); | 588 | mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); |
586 | //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); | 589 | //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); |
587 | } | 590 | } |
588 | 591 | ||
589 | QString Addressee::getCsum( const QString & prof) | 592 | QString Addressee::getCsum( const QString & prof) |
590 | { | 593 | { |
591 | return KIdManager::getCsum ( mData->mExternalId, prof ); | 594 | return KIdManager::getCsum ( mData->mExternalId, prof ); |
592 | } | 595 | } |
593 | 596 | ||
594 | void Addressee::setIDStr( const QString & s ) | 597 | void Addressee::setIDStr( const QString & s ) |
595 | { | 598 | { |
596 | detach(); | 599 | detach(); |
597 | mData->mExternalId = s; | 600 | mData->mExternalId = s; |
598 | } | 601 | } |
599 | 602 | ||
600 | QString Addressee::IDStr() const | 603 | QString Addressee::IDStr() const |
601 | { | 604 | { |
602 | return mData->mExternalId; | 605 | return mData->mExternalId; |
603 | } | 606 | } |
604 | 607 | ||
605 | void Addressee::setExternalUID( const QString &id ) | 608 | void Addressee::setExternalUID( const QString &id ) |
606 | { | 609 | { |
607 | if ( id == mData->externalUID ) return; | 610 | if ( id == mData->externalUID ) return; |
608 | detach(); | 611 | detach(); |
609 | mData->empty = false; | 612 | mData->empty = false; |
610 | mData->externalUID = id; | 613 | mData->externalUID = id; |
611 | } | 614 | } |
612 | 615 | ||
613 | QString Addressee::externalUID() const | 616 | QString Addressee::externalUID() const |
614 | { | 617 | { |
615 | return mData->externalUID; | 618 | return mData->externalUID; |
616 | } | 619 | } |
617 | void Addressee::setOriginalExternalUID( const QString &id ) | 620 | void Addressee::setOriginalExternalUID( const QString &id ) |
618 | { | 621 | { |
619 | if ( id == mData->originalExternalUID ) return; | 622 | if ( id == mData->originalExternalUID ) return; |
620 | detach(); | 623 | detach(); |
621 | mData->empty = false; | 624 | mData->empty = false; |
622 | //qDebug("*******Set orig uid %s ", id.latin1()); | 625 | //qDebug("*******Set orig uid %s ", id.latin1()); |
623 | mData->originalExternalUID = id; | 626 | mData->originalExternalUID = id; |
624 | } | 627 | } |
625 | 628 | ||
626 | QString Addressee::originalExternalUID() const | 629 | QString Addressee::originalExternalUID() const |
627 | { | 630 | { |
628 | return mData->originalExternalUID; | 631 | return mData->originalExternalUID; |
629 | } | 632 | } |
630 | 633 | ||
631 | void Addressee::setUid( const QString &id ) | 634 | void Addressee::setUid( const QString &id ) |
632 | { | 635 | { |
633 | if ( id == mData->uid ) return; | 636 | if ( id == mData->uid ) return; |
634 | detach(); | 637 | detach(); |
635 | //qDebug("****setuid %s ", id.latin1()); | 638 | //qDebug("****setuid %s ", id.latin1()); |
636 | mData->empty = false; | 639 | mData->empty = false; |
637 | mData->uid = id; | 640 | mData->uid = id; |
638 | } | 641 | } |
639 | 642 | ||
640 | QString Addressee::uid() const | 643 | QString Addressee::uid() const |
641 | { | 644 | { |
642 | if ( mData->uid.isEmpty() ) | 645 | if ( mData->uid.isEmpty() ) |
643 | mData->uid = KApplication::randomString( 10 ); | 646 | mData->uid = KApplication::randomString( 10 ); |
644 | 647 | ||
645 | return mData->uid; | 648 | return mData->uid; |
646 | } | 649 | } |
647 | 650 | ||
648 | QString Addressee::uidLabel() | 651 | QString Addressee::uidLabel() |
649 | { | 652 | { |
650 | return i18n("Unique Identifier"); | 653 | return i18n("Unique Identifier"); |
651 | } | 654 | } |
652 | 655 | ||
653 | void Addressee::setName( const QString &name ) | 656 | void Addressee::setName( const QString &name ) |
654 | { | 657 | { |
655 | if ( name == mData->name ) return; | 658 | if ( name == mData->name ) return; |
656 | detach(); | 659 | detach(); |
657 | mData->empty = false; | 660 | mData->empty = false; |
658 | mData->name = name; | 661 | mData->name = name; |
659 | } | 662 | } |
660 | 663 | ||
661 | QString Addressee::name() const | 664 | QString Addressee::name() const |
662 | { | 665 | { |
663 | return mData->name; | 666 | return mData->name; |
664 | } | 667 | } |
665 | 668 | ||
666 | QString Addressee::nameLabel() | 669 | QString Addressee::nameLabel() |
667 | { | 670 | { |
668 | return i18n("Name"); | 671 | return i18n("Name"); |
669 | } | 672 | } |
670 | 673 | ||
671 | 674 | ||
672 | void Addressee::setFormattedName( const QString &formattedName ) | 675 | void Addressee::setFormattedName( const QString &formattedName ) |
673 | { | 676 | { |
674 | if ( formattedName == mData->formattedName ) return; | 677 | if ( formattedName == mData->formattedName ) return; |
675 | detach(); | 678 | detach(); |
676 | mData->empty = false; | 679 | mData->empty = false; |
677 | mData->formattedName = formattedName; | 680 | mData->formattedName = formattedName; |
678 | } | 681 | } |
679 | 682 | ||
680 | QString Addressee::formattedName() const | 683 | QString Addressee::formattedName() const |
681 | { | 684 | { |
682 | return mData->formattedName; | 685 | return mData->formattedName; |
683 | } | 686 | } |
684 | 687 | ||
685 | QString Addressee::formattedNameLabel() | 688 | QString Addressee::formattedNameLabel() |
686 | { | 689 | { |
687 | return i18n("Formatted Name"); | 690 | return i18n("Formatted Name"); |
688 | } | 691 | } |
689 | 692 | ||
690 | 693 | ||
691 | void Addressee::setFamilyName( const QString &familyName ) | 694 | void Addressee::setFamilyName( const QString &familyName ) |
692 | { | 695 | { |
693 | if ( familyName == mData->familyName ) return; | 696 | if ( familyName == mData->familyName ) return; |
694 | detach(); | 697 | detach(); |
695 | mData->empty = false; | 698 | mData->empty = false; |
696 | mData->familyName = familyName; | 699 | mData->familyName = familyName; |
697 | } | 700 | } |
698 | 701 | ||
699 | QString Addressee::familyName() const | 702 | QString Addressee::familyName() const |
700 | { | 703 | { |
701 | return mData->familyName; | 704 | return mData->familyName; |
702 | } | 705 | } |
703 | 706 | ||
704 | QString Addressee::familyNameLabel() | 707 | QString Addressee::familyNameLabel() |
705 | { | 708 | { |
706 | return i18n("Family Name"); | 709 | return i18n("Family Name"); |
707 | } | 710 | } |
708 | 711 | ||
709 | 712 | ||
710 | void Addressee::setGivenName( const QString &givenName ) | 713 | void Addressee::setGivenName( const QString &givenName ) |
711 | { | 714 | { |
712 | if ( givenName == mData->givenName ) return; | 715 | if ( givenName == mData->givenName ) return; |
713 | detach(); | 716 | detach(); |
714 | mData->empty = false; | 717 | mData->empty = false; |
715 | mData->givenName = givenName; | 718 | mData->givenName = givenName; |
716 | } | 719 | } |
717 | 720 | ||
718 | QString Addressee::givenName() const | 721 | QString Addressee::givenName() const |
719 | { | 722 | { |
720 | return mData->givenName; | 723 | return mData->givenName; |
721 | } | 724 | } |
722 | 725 | ||
723 | QString Addressee::givenNameLabel() | 726 | QString Addressee::givenNameLabel() |
724 | { | 727 | { |
725 | return i18n("Given Name"); | 728 | return i18n("Given Name"); |
726 | } | 729 | } |
727 | 730 | ||
728 | 731 | ||
729 | void Addressee::setAdditionalName( const QString &additionalName ) | 732 | void Addressee::setAdditionalName( const QString &additionalName ) |
730 | { | 733 | { |
731 | if ( additionalName == mData->additionalName ) return; | 734 | if ( additionalName == mData->additionalName ) return; |
732 | detach(); | 735 | detach(); |
733 | mData->empty = false; | 736 | mData->empty = false; |
734 | mData->additionalName = additionalName; | 737 | mData->additionalName = additionalName; |
735 | } | 738 | } |
736 | 739 | ||
737 | QString Addressee::additionalName() const | 740 | QString Addressee::additionalName() const |
738 | { | 741 | { |
739 | return mData->additionalName; | 742 | return mData->additionalName; |
740 | } | 743 | } |
741 | 744 | ||
742 | QString Addressee::additionalNameLabel() | 745 | QString Addressee::additionalNameLabel() |
743 | { | 746 | { |
744 | return i18n("Additional Names"); | 747 | return i18n("Additional Names"); |
745 | } | 748 | } |
746 | 749 | ||
747 | 750 | ||
748 | void Addressee::setPrefix( const QString &prefix ) | 751 | void Addressee::setPrefix( const QString &prefix ) |
749 | { | 752 | { |
750 | if ( prefix == mData->prefix ) return; | 753 | if ( prefix == mData->prefix ) return; |
751 | detach(); | 754 | detach(); |
752 | mData->empty = false; | 755 | mData->empty = false; |
753 | mData->prefix = prefix; | 756 | mData->prefix = prefix; |
754 | } | 757 | } |
755 | 758 | ||
756 | QString Addressee::prefix() const | 759 | QString Addressee::prefix() const |
757 | { | 760 | { |
758 | return mData->prefix; | 761 | return mData->prefix; |
759 | } | 762 | } |
760 | 763 | ||
761 | QString Addressee::prefixLabel() | 764 | QString Addressee::prefixLabel() |
762 | { | 765 | { |
763 | return i18n("Honorific Prefixes"); | 766 | return i18n("Honorific Prefixes"); |
764 | } | 767 | } |
765 | 768 | ||
766 | 769 | ||
767 | void Addressee::setSuffix( const QString &suffix ) | 770 | void Addressee::setSuffix( const QString &suffix ) |
768 | { | 771 | { |
769 | if ( suffix == mData->suffix ) return; | 772 | if ( suffix == mData->suffix ) return; |
770 | detach(); | 773 | detach(); |
771 | mData->empty = false; | 774 | mData->empty = false; |
772 | mData->suffix = suffix; | 775 | mData->suffix = suffix; |
773 | } | 776 | } |
774 | 777 | ||
775 | QString Addressee::suffix() const | 778 | QString Addressee::suffix() const |
776 | { | 779 | { |
777 | return mData->suffix; | 780 | return mData->suffix; |
778 | } | 781 | } |
779 | 782 | ||
780 | QString Addressee::suffixLabel() | 783 | QString Addressee::suffixLabel() |
781 | { | 784 | { |
782 | return i18n("Honorific Suffixes"); | 785 | return i18n("Honorific Suffixes"); |
783 | } | 786 | } |
784 | 787 | ||
785 | 788 | ||
786 | void Addressee::setNickName( const QString &nickName ) | 789 | void Addressee::setNickName( const QString &nickName ) |
787 | { | 790 | { |
788 | if ( nickName == mData->nickName ) return; | 791 | if ( nickName == mData->nickName ) return; |
789 | detach(); | 792 | detach(); |
790 | mData->empty = false; | 793 | mData->empty = false; |
791 | mData->nickName = nickName; | 794 | mData->nickName = nickName; |
792 | } | 795 | } |
793 | 796 | ||
794 | QString Addressee::nickName() const | 797 | QString Addressee::nickName() const |
795 | { | 798 | { |
796 | return mData->nickName; | 799 | return mData->nickName; |
797 | } | 800 | } |
798 | 801 | ||
799 | QString Addressee::nickNameLabel() | 802 | QString Addressee::nickNameLabel() |
800 | { | 803 | { |
801 | return i18n("Nick Name"); | 804 | return i18n("Nick Name"); |
802 | } | 805 | } |
803 | 806 | ||
804 | 807 | ||
805 | void Addressee::setBirthday( const QDateTime &birthday ) | 808 | void Addressee::setBirthday( const QDateTime &birthday ) |
806 | { | 809 | { |
807 | if ( birthday == mData->birthday ) return; | 810 | if ( birthday == mData->birthday ) return; |
808 | detach(); | 811 | detach(); |
809 | mData->empty = false; | 812 | mData->empty = false; |
810 | mData->birthday = birthday; | 813 | mData->birthday = birthday; |
811 | } | 814 | } |
812 | 815 | ||
813 | QDateTime Addressee::birthday() const | 816 | QDateTime Addressee::birthday() const |
814 | { | 817 | { |
815 | return mData->birthday; | 818 | return mData->birthday; |
816 | } | 819 | } |
817 | 820 | ||
818 | QString Addressee::birthdayLabel() | 821 | QString Addressee::birthdayLabel() |
819 | { | 822 | { |
820 | return i18n("Birthday"); | 823 | return i18n("Birthday"); |
821 | } | 824 | } |
822 | 825 | ||
823 | 826 | ||
824 | QString Addressee::homeAddressStreetLabel() | 827 | QString Addressee::homeAddressStreetLabel() |
825 | { | 828 | { |
826 | return i18n("Home Address Street"); | 829 | return i18n("Home Address Street"); |
827 | } | 830 | } |
828 | 831 | ||
829 | 832 | ||
830 | QString Addressee::homeAddressLocalityLabel() | 833 | QString Addressee::homeAddressLocalityLabel() |
831 | { | 834 | { |
832 | return i18n("Home Address Locality"); | 835 | return i18n("Home Address Locality"); |
833 | } | 836 | } |
834 | 837 | ||
835 | 838 | ||
836 | QString Addressee::homeAddressRegionLabel() | 839 | QString Addressee::homeAddressRegionLabel() |
837 | { | 840 | { |
838 | return i18n("Home Address Region"); | 841 | return i18n("Home Address Region"); |
839 | } | 842 | } |
840 | 843 | ||
841 | 844 | ||
842 | QString Addressee::homeAddressPostalCodeLabel() | 845 | QString Addressee::homeAddressPostalCodeLabel() |
843 | { | 846 | { |
844 | return i18n("Home Address Postal Code"); | 847 | return i18n("Home Address Postal Code"); |
845 | } | 848 | } |
846 | 849 | ||
847 | 850 | ||
848 | QString Addressee::homeAddressCountryLabel() | 851 | QString Addressee::homeAddressCountryLabel() |
849 | { | 852 | { |
850 | return i18n("Home Address Country"); | 853 | return i18n("Home Address Country"); |
851 | } | 854 | } |
852 | 855 | ||
853 | 856 | ||
854 | QString Addressee::homeAddressLabelLabel() | 857 | QString Addressee::homeAddressLabelLabel() |
855 | { | 858 | { |
856 | return i18n("Home Address Label"); | 859 | return i18n("Home Address Label"); |
857 | } | 860 | } |
858 | 861 | ||
859 | 862 | ||
860 | QString Addressee::businessAddressStreetLabel() | 863 | QString Addressee::businessAddressStreetLabel() |
861 | { | 864 | { |
862 | return i18n("Business Address Street"); | 865 | return i18n("Business Address Street"); |
863 | } | 866 | } |
864 | 867 | ||
865 | 868 | ||
866 | QString Addressee::businessAddressLocalityLabel() | 869 | QString Addressee::businessAddressLocalityLabel() |
867 | { | 870 | { |
868 | return i18n("Business Address Locality"); | 871 | return i18n("Business Address Locality"); |
869 | } | 872 | } |
870 | 873 | ||
871 | 874 | ||
872 | QString Addressee::businessAddressRegionLabel() | 875 | QString Addressee::businessAddressRegionLabel() |
873 | { | 876 | { |
874 | return i18n("Business Address Region"); | 877 | return i18n("Business Address Region"); |
875 | } | 878 | } |
876 | 879 | ||
877 | 880 | ||
878 | QString Addressee::businessAddressPostalCodeLabel() | 881 | QString Addressee::businessAddressPostalCodeLabel() |
879 | { | 882 | { |
880 | return i18n("Business Address Postal Code"); | 883 | return i18n("Business Address Postal Code"); |
881 | } | 884 | } |
882 | 885 | ||
883 | 886 | ||
884 | QString Addressee::businessAddressCountryLabel() | 887 | QString Addressee::businessAddressCountryLabel() |
885 | { | 888 | { |
886 | return i18n("Business Address Country"); | 889 | return i18n("Business Address Country"); |
887 | } | 890 | } |
888 | 891 | ||
889 | 892 | ||
890 | QString Addressee::businessAddressLabelLabel() | 893 | QString Addressee::businessAddressLabelLabel() |
891 | { | 894 | { |
892 | return i18n("Business Address Label"); | 895 | return i18n("Business Address Label"); |
893 | } | 896 | } |
894 | 897 | ||
895 | 898 | ||
896 | QString Addressee::homePhoneLabel() | 899 | QString Addressee::homePhoneLabel() |
897 | { | 900 | { |
898 | return i18n("Home Phone"); | 901 | return i18n("Home Phone"); |
899 | } | 902 | } |
900 | 903 | ||
901 | 904 | ||
902 | QString Addressee::businessPhoneLabel() | 905 | QString Addressee::businessPhoneLabel() |
903 | { | 906 | { |
904 | return i18n("Business Phone"); | 907 | return i18n("Business Phone"); |
905 | } | 908 | } |
906 | 909 | ||
907 | 910 | ||
908 | QString Addressee::mobilePhoneLabel() | 911 | QString Addressee::mobilePhoneLabel() |
909 | { | 912 | { |
910 | return i18n("Mobile Phone"); | 913 | return i18n("Mobile Phone"); |
911 | } | 914 | } |
912 | 915 | ||
913 | 916 | ||
914 | QString Addressee::homeFaxLabel() | 917 | QString Addressee::homeFaxLabel() |
915 | { | 918 | { |
916 | return i18n("Home Fax"); | 919 | return i18n("Home Fax"); |
917 | } | 920 | } |
918 | 921 | ||
919 | 922 | ||
920 | QString Addressee::businessFaxLabel() | 923 | QString Addressee::businessFaxLabel() |
921 | { | 924 | { |
922 | return i18n("Business Fax"); | 925 | return i18n("Business Fax"); |
923 | } | 926 | } |
924 | 927 | ||
925 | 928 | ||
926 | QString Addressee::carPhoneLabel() | 929 | QString Addressee::carPhoneLabel() |
927 | { | 930 | { |
928 | return i18n("Car Phone"); | 931 | return i18n("Car Phone"); |
929 | } | 932 | } |
930 | 933 | ||
931 | 934 | ||
932 | QString Addressee::isdnLabel() | 935 | QString Addressee::isdnLabel() |
933 | { | 936 | { |
934 | return i18n("ISDN"); | 937 | return i18n("ISDN"); |
935 | } | 938 | } |
936 | 939 | ||
937 | 940 | ||
938 | QString Addressee::pagerLabel() | 941 | QString Addressee::pagerLabel() |
939 | { | 942 | { |
940 | return i18n("Pager"); | 943 | return i18n("Pager"); |