summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/ocontact.cpp1
-rw-r--r--libopie/pim/ocontact.h5
-rw-r--r--libopie2/opiepim/ocontact.cpp1
-rw-r--r--libopie2/opiepim/ocontact.h5
4 files changed, 10 insertions, 2 deletions
diff --git a/libopie/pim/ocontact.cpp b/libopie/pim/ocontact.cpp
index a38b62b..aeb69ee 100644
--- a/libopie/pim/ocontact.cpp
+++ b/libopie/pim/ocontact.cpp
@@ -193,945 +193,946 @@ OContact::~OContact()
193 Sets the business fax number of the contact to \a str. 193 Sets the business fax number of the contact to \a str.
194*/ 194*/
195 195
196/*! \fn void OContact::setBusinessMobile( const QString &str ) 196/*! \fn void OContact::setBusinessMobile( const QString &str )
197 Sets the business mobile phone number of the contact to \a str. 197 Sets the business mobile phone number of the contact to \a str.
198*/ 198*/
199 199
200/*! \fn void OContact::setBusinessPager( const QString &str ) 200/*! \fn void OContact::setBusinessPager( const QString &str )
201 Sets the business pager number of the contact to \a str. 201 Sets the business pager number of the contact to \a str.
202*/ 202*/
203 203
204/*! \fn void OContact::setBusinessWebpage( const QString &str ) 204/*! \fn void OContact::setBusinessWebpage( const QString &str )
205 Sets the business webpage of the contact to \a str. 205 Sets the business webpage of the contact to \a str.
206*/ 206*/
207 207
208/*! \fn void OContact::setProfession( const QString &str ) 208/*! \fn void OContact::setProfession( const QString &str )
209 Sets the profession of the contact to \a str. 209 Sets the profession of the contact to \a str.
210*/ 210*/
211 211
212/*! \fn void OContact::setAssistant( const QString &str ) 212/*! \fn void OContact::setAssistant( const QString &str )
213 Sets the assistant of the contact to \a str. 213 Sets the assistant of the contact to \a str.
214*/ 214*/
215 215
216/*! \fn void OContact::setManager( const QString &str ) 216/*! \fn void OContact::setManager( const QString &str )
217 Sets the manager of the contact to \a str. 217 Sets the manager of the contact to \a str.
218*/ 218*/
219 219
220/*! \fn void OContact::setSpouse( const QString &str ) 220/*! \fn void OContact::setSpouse( const QString &str )
221 Sets the spouse of the contact to \a str. 221 Sets the spouse of the contact to \a str.
222*/ 222*/
223 223
224/*! \fn void OContact::setGender( const QString &str ) 224/*! \fn void OContact::setGender( const QString &str )
225 Sets the gender of the contact to \a str. 225 Sets the gender of the contact to \a str.
226*/ 226*/
227 227
228/*! \fn void OContact::setNickname( const QString &str ) 228/*! \fn void OContact::setNickname( const QString &str )
229 Sets the nickname of the contact to \a str. 229 Sets the nickname of the contact to \a str.
230*/ 230*/
231 231
232/*! \fn void OContact::setNotes( const QString &str ) 232/*! \fn void OContact::setNotes( const QString &str )
233 Sets the notes about the contact to \a str. 233 Sets the notes about the contact to \a str.
234*/ 234*/
235 235
236/*! \fn QString OContact::title() const 236/*! \fn QString OContact::title() const
237 Returns the title of the contact. 237 Returns the title of the contact.
238*/ 238*/
239 239
240/*! \fn QString OContact::firstName() const 240/*! \fn QString OContact::firstName() const
241 Returns the first name of the contact. 241 Returns the first name of the contact.
242*/ 242*/
243 243
244/*! \fn QString OContact::middleName() const 244/*! \fn QString OContact::middleName() const
245 Returns the middle name of the contact. 245 Returns the middle name of the contact.
246*/ 246*/
247 247
248/*! \fn QString OContact::lastName() const 248/*! \fn QString OContact::lastName() const
249 Returns the last name of the contact. 249 Returns the last name of the contact.
250*/ 250*/
251 251
252/*! \fn QString OContact::suffix() const 252/*! \fn QString OContact::suffix() const
253 Returns the suffix of the contact. 253 Returns the suffix of the contact.
254*/ 254*/
255 255
256/*! \fn QString OContact::fileAs() const 256/*! \fn QString OContact::fileAs() const
257 Returns the string the contact is filed as. 257 Returns the string the contact is filed as.
258*/ 258*/
259 259
260/*! \fn QString OContact::defaultEmail() const 260/*! \fn QString OContact::defaultEmail() const
261 Returns the default email address of the contact. 261 Returns the default email address of the contact.
262*/ 262*/
263 263
264/*! \fn QString OContact::emails() const 264/*! \fn QString OContact::emails() const
265 Returns the list of email address for a contact separated by ';'s in a single 265 Returns the list of email address for a contact separated by ';'s in a single
266 string. 266 string.
267*/ 267*/
268 268
269/*! \fn QString OContact::homeStreet() const 269/*! \fn QString OContact::homeStreet() const
270 Returns the home street address of the contact. 270 Returns the home street address of the contact.
271*/ 271*/
272 272
273/*! \fn QString OContact::homeCity() const 273/*! \fn QString OContact::homeCity() const
274 Returns the home city of the contact. 274 Returns the home city of the contact.
275*/ 275*/
276 276
277/*! \fn QString OContact::homeState() const 277/*! \fn QString OContact::homeState() const
278 Returns the home state of the contact. 278 Returns the home state of the contact.
279*/ 279*/
280 280
281/*! \fn QString OContact::homeZip() const 281/*! \fn QString OContact::homeZip() const
282 Returns the home zip of the contact. 282 Returns the home zip of the contact.
283*/ 283*/
284 284
285/*! \fn QString OContact::homeCountry() const 285/*! \fn QString OContact::homeCountry() const
286 Returns the home country of the contact. 286 Returns the home country of the contact.
287*/ 287*/
288 288
289/*! \fn QString OContact::homePhone() const 289/*! \fn QString OContact::homePhone() const
290 Returns the home phone number of the contact. 290 Returns the home phone number of the contact.
291*/ 291*/
292 292
293/*! \fn QString OContact::homeFax() const 293/*! \fn QString OContact::homeFax() const
294 Returns the home fax number of the contact. 294 Returns the home fax number of the contact.
295*/ 295*/
296 296
297/*! \fn QString OContact::homeMobile() const 297/*! \fn QString OContact::homeMobile() const
298 Returns the home mobile number of the contact. 298 Returns the home mobile number of the contact.
299*/ 299*/
300 300
301/*! \fn QString OContact::homeWebpage() const 301/*! \fn QString OContact::homeWebpage() const
302 Returns the home webpage of the contact. 302 Returns the home webpage of the contact.
303*/ 303*/
304 304
305/*! \fn QString OContact::company() const 305/*! \fn QString OContact::company() const
306 Returns the company for the contact. 306 Returns the company for the contact.
307*/ 307*/
308 308
309/*! \fn QString OContact::department() const 309/*! \fn QString OContact::department() const
310 Returns the department for the contact. 310 Returns the department for the contact.
311*/ 311*/
312 312
313/*! \fn QString OContact::office() const 313/*! \fn QString OContact::office() const
314 Returns the office for the contact. 314 Returns the office for the contact.
315*/ 315*/
316 316
317/*! \fn QString OContact::jobTitle() const 317/*! \fn QString OContact::jobTitle() const
318 Returns the job title of the contact. 318 Returns the job title of the contact.
319*/ 319*/
320 320
321/*! \fn QString OContact::profession() const 321/*! \fn QString OContact::profession() const
322 Returns the profession of the contact. 322 Returns the profession of the contact.
323*/ 323*/
324 324
325/*! \fn QString OContact::assistant() const 325/*! \fn QString OContact::assistant() const
326 Returns the assistant of the contact. 326 Returns the assistant of the contact.
327*/ 327*/
328 328
329/*! \fn QString OContact::manager() const 329/*! \fn QString OContact::manager() const
330 Returns the manager of the contact. 330 Returns the manager of the contact.
331*/ 331*/
332 332
333/*! \fn QString OContact::businessStreet() const 333/*! \fn QString OContact::businessStreet() const
334 Returns the business street address of the contact. 334 Returns the business street address of the contact.
335*/ 335*/
336 336
337/*! \fn QString OContact::businessCity() const 337/*! \fn QString OContact::businessCity() const
338 Returns the business city of the contact. 338 Returns the business city of the contact.
339*/ 339*/
340 340
341/*! \fn QString OContact::businessState() const 341/*! \fn QString OContact::businessState() const
342 Returns the business state of the contact. 342 Returns the business state of the contact.
343*/ 343*/
344 344
345/*! \fn QString OContact::businessZip() const 345/*! \fn QString OContact::businessZip() const
346 Returns the business zip of the contact. 346 Returns the business zip of the contact.
347*/ 347*/
348 348
349/*! \fn QString OContact::businessCountry() const 349/*! \fn QString OContact::businessCountry() const
350 Returns the business country of the contact. 350 Returns the business country of the contact.
351*/ 351*/
352 352
353/*! \fn QString OContact::businessPhone() const 353/*! \fn QString OContact::businessPhone() const
354 Returns the business phone number of the contact. 354 Returns the business phone number of the contact.
355*/ 355*/
356 356
357/*! \fn QString OContact::businessFax() const 357/*! \fn QString OContact::businessFax() const
358 Returns the business fax number of the contact. 358 Returns the business fax number of the contact.
359*/ 359*/
360 360
361/*! \fn QString OContact::businessMobile() const 361/*! \fn QString OContact::businessMobile() const
362 Returns the business mobile number of the contact. 362 Returns the business mobile number of the contact.
363*/ 363*/
364 364
365/*! \fn QString OContact::businessPager() const 365/*! \fn QString OContact::businessPager() const
366 Returns the business pager number of the contact. 366 Returns the business pager number of the contact.
367*/ 367*/
368 368
369/*! \fn QString OContact::businessWebpage() const 369/*! \fn QString OContact::businessWebpage() const
370 Returns the business webpage of the contact. 370 Returns the business webpage of the contact.
371*/ 371*/
372 372
373/*! \fn QString OContact::spouse() const 373/*! \fn QString OContact::spouse() const
374 Returns the spouse of the contact. 374 Returns the spouse of the contact.
375*/ 375*/
376 376
377/*! \fn QString OContact::gender() const 377/*! \fn QString OContact::gender() const
378 Returns the gender of the contact. 378 Returns the gender of the contact.
379*/ 379*/
380 380
381/*! \fn QString OContact::nickname() const 381/*! \fn QString OContact::nickname() const
382 Returns the nickname of the contact. 382 Returns the nickname of the contact.
383*/ 383*/
384 384
385/*! \fn QString OContact::children() const 385/*! \fn QString OContact::children() const
386 Returns the children of the contact. 386 Returns the children of the contact.
387*/ 387*/
388 388
389/*! \fn QString OContact::notes() const 389/*! \fn QString OContact::notes() const
390 Returns the notes relating to the the contact. 390 Returns the notes relating to the the contact.
391*/ 391*/
392 392
393/*! \fn QString OContact::groups() const 393/*! \fn QString OContact::groups() const
394 \internal 394 \internal
395 Returns the groups for the contact. 395 Returns the groups for the contact.
396*/ 396*/
397 397
398/*! \fn QStringList OContact::groupList() const 398/*! \fn QStringList OContact::groupList() const
399 \internal 399 \internal
400*/ 400*/
401 401
402/*! \fn QString OContact::field(int) const 402/*! \fn QString OContact::field(int) const
403 \internal 403 \internal
404*/ 404*/
405 405
406/*! \fn void OContact::saveJournal( journal_action, const QString & = QString::null ) 406/*! \fn void OContact::saveJournal( journal_action, const QString & = QString::null )
407 \internal 407 \internal
408*/ 408*/
409 409
410/*! \fn void OContact::setUid( int id ) 410/*! \fn void OContact::setUid( int id )
411 \internal 411 \internal
412 Sets the uid for this record to \a id. 412 Sets the uid for this record to \a id.
413*/ 413*/
414 414
415/*! \enum OContact::journal_action 415/*! \enum OContact::journal_action
416 \internal 416 \internal
417*/ 417*/
418 418
419/*! 419/*!
420 \internal 420 \internal
421*/ 421*/
422QMap<int, QString> OContact::toMap() const 422QMap<int, QString> OContact::toMap() const
423{ 423{
424 QMap<int, QString> map = mMap; 424 QMap<int, QString> map = mMap;
425 QString cats = idsToString( categories() ); 425 QString cats = idsToString( categories() );
426 if ( !cats.isEmpty() ) 426 if ( !cats.isEmpty() )
427 map.insert( Qtopia::AddressCategory, cats ); 427 map.insert( Qtopia::AddressCategory, cats );
428 return map; 428 return map;
429} 429}
430 430
431/*! 431/*!
432 Returns a rich text formatted QString representing the contents the contact. 432 Returns a rich text formatted QString representing the contents the contact.
433*/ 433*/
434QString OContact::toRichText() const 434QString OContact::toRichText() const
435{ 435{
436 QString text; 436 QString text;
437 QString value, comp, state; 437 QString value, comp, state;
438 QString str; 438 QString str;
439 bool marker = false; 439 bool marker = false;
440 440
441 // name, jobtitle and company 441 // name, jobtitle and company
442 if ( !(value = fullName()).isEmpty() ) 442 if ( !(value = fullName()).isEmpty() )
443 text += "<b><h3>" + Qtopia::escapeString(value) + "</h3></b><br>"; 443 text += "<b><h3>" + Qtopia::escapeString(value) + "</h3></b><br>";
444 if ( !(value = jobTitle()).isEmpty() ) 444 if ( !(value = jobTitle()).isEmpty() )
445 text += Qtopia::escapeString(value) + "<br>"; 445 text += Qtopia::escapeString(value) + "<br>";
446 446
447 comp = company(); 447 comp = company();
448 if ( !(value = department()).isEmpty() ) { 448 if ( !(value = department()).isEmpty() ) {
449 text += Qtopia::escapeString(value); 449 text += Qtopia::escapeString(value);
450 if ( comp ) 450 if ( comp )
451 text += ", "; 451 text += ", ";
452 else 452 else
453 text += "<br>"; 453 text += "<br>";
454 } 454 }
455 if ( !comp.isEmpty() ) 455 if ( !comp.isEmpty() )
456 text += Qtopia::escapeString(comp) + "<br>"; 456 text += Qtopia::escapeString(comp) + "<br>";
457 457
458 QString defEmail = defaultEmail(); 458 QString defEmail = defaultEmail();
459 if ( !defEmail.isEmpty() ) 459 if ( !defEmail.isEmpty() )
460 text += "<b>" + QObject::tr("Default Email: ") + "</b>" 460 text += "<b>" + QObject::tr("Default Email: ") + "</b>"
461 + Qtopia::escapeString(defEmail) + "<br>"; 461 + Qtopia::escapeString(defEmail) + "<br>";
462 462
463 text += "<hr>"; 463 text += "<hr>";
464 464
465 // business address 465 // business address
466 if ( !businessStreet().isEmpty() || !businessCity().isEmpty() || 466 if ( !businessStreet().isEmpty() || !businessCity().isEmpty() ||
467 !businessZip().isEmpty() || !businessCountry().isEmpty() ) { 467 !businessZip().isEmpty() || !businessCountry().isEmpty() ) {
468 text += "<br>"; 468 text += "<br>";
469 text += QObject::tr( "<b>Work Address:</b>" ); 469 text += QObject::tr( "<b>Work Address:</b>" );
470 text += "<br>"; 470 text += "<br>";
471 marker = true; 471 marker = true;
472 } 472 }
473 473
474 if ( !(value = businessStreet()).isEmpty() ) 474 if ( !(value = businessStreet()).isEmpty() )
475 text += Qtopia::escapeString(value) + "<br>"; 475 text += Qtopia::escapeString(value) + "<br>";
476 state = businessState(); 476 state = businessState();
477 if ( !(value = businessZip()).isEmpty() ) 477 if ( !(value = businessZip()).isEmpty() )
478 text += Qtopia::escapeString(value) + " "; 478 text += Qtopia::escapeString(value) + " ";
479 if ( !(value = businessCity()).isEmpty() ) { 479 if ( !(value = businessCity()).isEmpty() ) {
480 text += Qtopia::escapeString(value); 480 text += Qtopia::escapeString(value);
481 if ( state ) 481 if ( state )
482 text += ", " + Qtopia::escapeString(state); 482 text += ", " + Qtopia::escapeString(state);
483 text += "<br>"; 483 text += "<br>";
484 } else if ( !state.isEmpty() ) 484 } else if ( !state.isEmpty() )
485 text += Qtopia::escapeString(state) + "<br>"; 485 text += Qtopia::escapeString(state) + "<br>";
486 486
487 if ( !(value = businessCountry()).isEmpty() ) 487 if ( !(value = businessCountry()).isEmpty() )
488 text += Qtopia::escapeString(value) + "<br>"; 488 text += Qtopia::escapeString(value) + "<br>";
489 489
490 // rest of Business data 490 // rest of Business data
491 str = office(); 491 str = office();
492 if ( !str.isEmpty() ){ 492 if ( !str.isEmpty() ){
493 text += "<b>" + QObject::tr("Office: ") + "</b>" 493 text += "<b>" + QObject::tr("Office: ") + "</b>"
494 + Qtopia::escapeString(str) + "<br>"; 494 + Qtopia::escapeString(str) + "<br>";
495 marker = true; 495 marker = true;
496 } 496 }
497 str = businessWebpage(); 497 str = businessWebpage();
498 if ( !str.isEmpty() ){ 498 if ( !str.isEmpty() ){
499 text += "<b>" + QObject::tr("Business Web Page: ") + "</b>" 499 text += "<b>" + QObject::tr("Business Web Page: ") + "</b>"
500 + Qtopia::escapeString(str) + "<br>"; 500 + Qtopia::escapeString(str) + "<br>";
501 marker = true; 501 marker = true;
502 } 502 }
503 str = businessPhone(); 503 str = businessPhone();
504 if ( !str.isEmpty() ){ 504 if ( !str.isEmpty() ){
505 text += "<b>" + QObject::tr("Business Phone: ") + "</b>" 505 text += "<b>" + QObject::tr("Business Phone: ") + "</b>"
506 + Qtopia::escapeString(str) + "<br>"; 506 + Qtopia::escapeString(str) + "<br>";
507 marker = true; 507 marker = true;
508 } 508 }
509 str = businessFax(); 509 str = businessFax();
510 if ( !str.isEmpty() ){ 510 if ( !str.isEmpty() ){
511 text += "<b>" + QObject::tr("Business Fax: ") + "</b>" 511 text += "<b>" + QObject::tr("Business Fax: ") + "</b>"
512 + Qtopia::escapeString(str) + "<br>"; 512 + Qtopia::escapeString(str) + "<br>";
513 marker = true; 513 marker = true;
514 } 514 }
515 str = businessMobile(); 515 str = businessMobile();
516 if ( !str.isEmpty() ){ 516 if ( !str.isEmpty() ){
517 text += "<b>" + QObject::tr("Business Mobile: ") + "</b>" 517 text += "<b>" + QObject::tr("Business Mobile: ") + "</b>"
518 + Qtopia::escapeString(str) + "<br>"; 518 + Qtopia::escapeString(str) + "<br>";
519 marker = true; 519 marker = true;
520 } 520 }
521 str = businessPager(); 521 str = businessPager();
522 if ( !str.isEmpty() ){ 522 if ( !str.isEmpty() ){
523 text += "<b>" + QObject::tr("Business Pager: ") + "</b>" 523 text += "<b>" + QObject::tr("Business Pager: ") + "</b>"
524 + Qtopia::escapeString(str) + "<br>"; 524 + Qtopia::escapeString(str) + "<br>";
525 marker = true; 525 marker = true;
526 } 526 }
527 527
528 // home address 528 // home address
529 if ( !homeStreet().isEmpty() || !homeCity().isEmpty() || 529 if ( !homeStreet().isEmpty() || !homeCity().isEmpty() ||
530 !homeZip().isEmpty() || !homeCountry().isEmpty() ) { 530 !homeZip().isEmpty() || !homeCountry().isEmpty() ) {
531 text += "<br>"; 531 text += "<br>";
532 text += QObject::tr( "<b>Home Address:</b>" ); 532 text += QObject::tr( "<b>Home Address:</b>" );
533 text += "<br>"; 533 text += "<br>";
534 } 534 }
535 535
536 if ( !(value = homeStreet()).isEmpty() ) 536 if ( !(value = homeStreet()).isEmpty() )
537 text += Qtopia::escapeString(value) + "<br>"; 537 text += Qtopia::escapeString(value) + "<br>";
538 state = homeState(); 538 state = homeState();
539 if ( !(value = homeZip()).isEmpty() ) 539 if ( !(value = homeZip()).isEmpty() )
540 text += Qtopia::escapeString(value) + " "; 540 text += Qtopia::escapeString(value) + " ";
541 if ( !(value = homeCity()).isEmpty() ) { 541 if ( !(value = homeCity()).isEmpty() ) {
542 text += Qtopia::escapeString(value); 542 text += Qtopia::escapeString(value);
543 if ( !state.isEmpty() ) 543 if ( !state.isEmpty() )
544 text += ", " + Qtopia::escapeString(state); 544 text += ", " + Qtopia::escapeString(state);
545 text += "<br>"; 545 text += "<br>";
546 } else if (!state.isEmpty()) 546 } else if (!state.isEmpty())
547 text += Qtopia::escapeString(state) + "<br>"; 547 text += Qtopia::escapeString(state) + "<br>";
548 if ( !(value = homeCountry()).isEmpty() ) 548 if ( !(value = homeCountry()).isEmpty() )
549 text += Qtopia::escapeString(value) + "<br>"; 549 text += Qtopia::escapeString(value) + "<br>";
550 550
551 // rest of Home data 551 // rest of Home data
552 str = homeWebpage(); 552 str = homeWebpage();
553 if ( !str.isEmpty() ){ 553 if ( !str.isEmpty() ){
554 text += "<b>" + QObject::tr("Home Web Page: ") + "</b>" 554 text += "<b>" + QObject::tr("Home Web Page: ") + "</b>"
555 + Qtopia::escapeString(str) + "<br>"; 555 + Qtopia::escapeString(str) + "<br>";
556 marker = true; 556 marker = true;
557 } 557 }
558 str = homePhone(); 558 str = homePhone();
559 if ( !str.isEmpty() ){ 559 if ( !str.isEmpty() ){
560 text += "<b>" + QObject::tr("Home Phone: ") + "</b>" 560 text += "<b>" + QObject::tr("Home Phone: ") + "</b>"
561 + Qtopia::escapeString(str) + "<br>"; 561 + Qtopia::escapeString(str) + "<br>";
562 marker = true; 562 marker = true;
563 } 563 }
564 str = homeFax(); 564 str = homeFax();
565 if ( !str.isEmpty() ){ 565 if ( !str.isEmpty() ){
566 text += "<b>" + QObject::tr("Home Fax: ") + "</b>" 566 text += "<b>" + QObject::tr("Home Fax: ") + "</b>"
567 + Qtopia::escapeString(str) + "<br>"; 567 + Qtopia::escapeString(str) + "<br>";
568 marker = true; 568 marker = true;
569 } 569 }
570 str = homeMobile(); 570 str = homeMobile();
571 if ( !str.isEmpty() ){ 571 if ( !str.isEmpty() ){
572 text += "<b>" + QObject::tr("Home Mobile: ") + "</b>" 572 text += "<b>" + QObject::tr("Home Mobile: ") + "</b>"
573 + Qtopia::escapeString(str) + "<br>"; 573 + Qtopia::escapeString(str) + "<br>";
574 marker = true; 574 marker = true;
575 } 575 }
576 576
577 if ( marker ) 577 if ( marker )
578 text += "<br><hr><br>"; 578 text += "<br><hr><br>";
579 // the others... 579 // the others...
580 str = emails(); 580 str = emails();
581 if ( !str.isEmpty() && ( str != defEmail ) ) 581 if ( !str.isEmpty() && ( str != defEmail ) )
582 text += "<b>" + QObject::tr("All Emails: ") + "</b>" 582 text += "<b>" + QObject::tr("All Emails: ") + "</b>"
583 + Qtopia::escapeString(str) + "<br>"; 583 + Qtopia::escapeString(str) + "<br>";
584 str = profession(); 584 str = profession();
585 if ( !str.isEmpty() ) 585 if ( !str.isEmpty() )
586 text += "<b>" + QObject::tr("Profession: ") + "</b>" 586 text += "<b>" + QObject::tr("Profession: ") + "</b>"
587 + Qtopia::escapeString(str) + "<br>"; 587 + Qtopia::escapeString(str) + "<br>";
588 str = assistant(); 588 str = assistant();
589 if ( !str.isEmpty() ) 589 if ( !str.isEmpty() )
590 text += "<b>" + QObject::tr("Assistant: ") + "</b>" 590 text += "<b>" + QObject::tr("Assistant: ") + "</b>"
591 + Qtopia::escapeString(str) + "<br>"; 591 + Qtopia::escapeString(str) + "<br>";
592 str = manager(); 592 str = manager();
593 if ( !str.isEmpty() ) 593 if ( !str.isEmpty() )
594 text += "<b>" + QObject::tr("Manager: ") + "</b>" 594 text += "<b>" + QObject::tr("Manager: ") + "</b>"
595 + Qtopia::escapeString(str) + "<br>"; 595 + Qtopia::escapeString(str) + "<br>";
596 str = gender(); 596 str = gender();
597 if ( !str.isEmpty() && str.toInt() != 0 ) { 597 if ( !str.isEmpty() && str.toInt() != 0 ) {
598 if ( str.toInt() == 1 ) 598 if ( str.toInt() == 1 )
599 str = QObject::tr( "Male" ); 599 str = QObject::tr( "Male" );
600 else if ( str.toInt() == 2 ) 600 else if ( str.toInt() == 2 )
601 str = QObject::tr( "Female" ); 601 str = QObject::tr( "Female" );
602 text += "<b>" + QObject::tr("Gender: ") + "</b>" + str + "<br>"; 602 text += "<b>" + QObject::tr("Gender: ") + "</b>" + str + "<br>";
603 } 603 }
604 str = spouse(); 604 str = spouse();
605 if ( !str.isEmpty() ) 605 if ( !str.isEmpty() )
606 text += "<b>" + QObject::tr("Spouse: ") + "</b>" 606 text += "<b>" + QObject::tr("Spouse: ") + "</b>"
607 + Qtopia::escapeString(str) + "<br>"; 607 + Qtopia::escapeString(str) + "<br>";
608 if ( birthday().isValid() ){ 608 if ( birthday().isValid() ){
609 str = TimeString::numberDateString( birthday() ); 609 str = TimeString::numberDateString( birthday() );
610 text += "<b>" + QObject::tr("Birthday: ") + "</b>" 610 text += "<b>" + QObject::tr("Birthday: ") + "</b>"
611 + Qtopia::escapeString(str) + "<br>"; 611 + Qtopia::escapeString(str) + "<br>";
612 } 612 }
613 if ( anniversary().isValid() ){ 613 if ( anniversary().isValid() ){
614 str = TimeString::numberDateString( anniversary() ); 614 str = TimeString::numberDateString( anniversary() );
615 text += "<b>" + QObject::tr("Anniversary: ") + "</b>" 615 text += "<b>" + QObject::tr("Anniversary: ") + "</b>"
616 + Qtopia::escapeString(str) + "<br>"; 616 + Qtopia::escapeString(str) + "<br>";
617 } 617 }
618 str = children(); 618 str = children();
619 if ( !str.isEmpty() ) 619 if ( !str.isEmpty() )
620 text += "<b>" + QObject::tr("Children: ") + "</b>" 620 text += "<b>" + QObject::tr("Children: ") + "</b>"
621 + Qtopia::escapeString(str) + "<br>"; 621 + Qtopia::escapeString(str) + "<br>";
622 622
623 str = nickname(); 623 str = nickname();
624 if ( !str.isEmpty() ) 624 if ( !str.isEmpty() )
625 text += "<b>" + QObject::tr("Nickname: ") + "</b>" 625 text += "<b>" + QObject::tr("Nickname: ") + "</b>"
626 + Qtopia::escapeString(str) + "<br>"; 626 + Qtopia::escapeString(str) + "<br>";
627 627
628 if ( categoryNames("Contacts").count() ){ 628 if ( categoryNames("Contacts").count() ){
629 text += "<b>" + QObject::tr( "Category:") + "</b> "; 629 text += "<b>" + QObject::tr( "Category:") + "</b> ";
630 text += categoryNames("Contacts").join(", "); 630 text += categoryNames("Contacts").join(", ");
631 text += "<br>"; 631 text += "<br>";
632 } 632 }
633 633
634 // notes last 634 // notes last
635 if ( !(value = notes()).isEmpty() ) { 635 if ( !(value = notes()).isEmpty() ) {
636 text += "<br><hr><b>" + QObject::tr( "Notes:") + "</b> "; 636 text += "<br><hr><b>" + QObject::tr( "Notes:") + "</b> ";
637 QRegExp reg("\n"); 637 QRegExp reg("\n");
638 638
639 //QString tmp = Qtopia::escapeString(value); 639 //QString tmp = Qtopia::escapeString(value);
640 QString tmp = QStyleSheet::convertFromPlainText(value); 640 QString tmp = QStyleSheet::convertFromPlainText(value);
641 //tmp.replace( reg, "<br>" ); 641 //tmp.replace( reg, "<br>" );
642 text += "<br>" + tmp + "<br>"; 642 text += "<br>" + tmp + "<br>";
643 } 643 }
644 return text; 644 return text;
645} 645}
646 646
647/*! 647/*!
648 \internal 648 \internal
649*/ 649*/
650void OContact::insert( int key, const QString &v ) 650void OContact::insert( int key, const QString &v )
651{ 651{
652 QString value = v.stripWhiteSpace(); 652 QString value = v.stripWhiteSpace();
653 if ( value.isEmpty() ) 653 if ( value.isEmpty() )
654 mMap.remove( key ); 654 mMap.remove( key );
655 else 655 else
656 mMap.insert( key, value ); 656 mMap.insert( key, value );
657} 657}
658 658
659/*! 659/*!
660 \internal 660 \internal
661*/ 661*/
662void OContact::replace( int key, const QString & v ) 662void OContact::replace( int key, const QString & v )
663{ 663{
664 QString value = v.stripWhiteSpace(); 664 QString value = v.stripWhiteSpace();
665 if ( value.isEmpty() ) 665 if ( value.isEmpty() )
666 mMap.remove( key ); 666 mMap.remove( key );
667 else 667 else
668 mMap.replace( key, value ); 668 mMap.replace( key, value );
669} 669}
670 670
671/*! 671/*!
672 \internal 672 \internal
673*/ 673*/
674QString OContact::find( int key ) const 674QString OContact::find( int key ) const
675{ 675{
676 return mMap[key]; 676 return mMap[key];
677} 677}
678 678
679/*! 679/*!
680 \internal 680 \internal
681*/ 681*/
682QString OContact::displayAddress( const QString &street, 682QString OContact::displayAddress( const QString &street,
683 const QString &city, 683 const QString &city,
684 const QString &state, 684 const QString &state,
685 const QString &zip, 685 const QString &zip,
686 const QString &country ) const 686 const QString &country ) const
687{ 687{
688 QString s = street; 688 QString s = street;
689 if ( !street.isEmpty() ) 689 if ( !street.isEmpty() )
690 s+= "\n"; 690 s+= "\n";
691 s += city; 691 s += city;
692 if ( !city.isEmpty() && !state.isEmpty() ) 692 if ( !city.isEmpty() && !state.isEmpty() )
693 s += ", "; 693 s += ", ";
694 s += state; 694 s += state;
695 if ( !state.isEmpty() && !zip.isEmpty() ) 695 if ( !state.isEmpty() && !zip.isEmpty() )
696 s += " "; 696 s += " ";
697 s += zip; 697 s += zip;
698 if ( !country.isEmpty() && !s.isEmpty() ) 698 if ( !country.isEmpty() && !s.isEmpty() )
699 s += "\n"; 699 s += "\n";
700 s += country; 700 s += country;
701 return s; 701 return s;
702} 702}
703 703
704/*! 704/*!
705 \internal 705 \internal
706*/ 706*/
707QString OContact::displayBusinessAddress() const 707QString OContact::displayBusinessAddress() const
708{ 708{
709 return displayAddress( businessStreet(), businessCity(), 709 return displayAddress( businessStreet(), businessCity(),
710 businessState(), businessZip(), 710 businessState(), businessZip(),
711 businessCountry() ); 711 businessCountry() );
712} 712}
713 713
714/*! 714/*!
715 \internal 715 \internal
716*/ 716*/
717QString OContact::displayHomeAddress() const 717QString OContact::displayHomeAddress() const
718{ 718{
719 return displayAddress( homeStreet(), homeCity(), 719 return displayAddress( homeStreet(), homeCity(),
720 homeState(), homeZip(), 720 homeState(), homeZip(),
721 homeCountry() ); 721 homeCountry() );
722} 722}
723 723
724/*! 724/*!
725 Returns the full name of the contact 725 Returns the full name of the contact
726*/ 726*/
727QString OContact::fullName() const 727QString OContact::fullName() const
728{ 728{
729 QString title = find( Qtopia::Title ); 729 QString title = find( Qtopia::Title );
730 QString firstName = find( Qtopia::FirstName ); 730 QString firstName = find( Qtopia::FirstName );
731 QString middleName = find( Qtopia::MiddleName ); 731 QString middleName = find( Qtopia::MiddleName );
732 QString lastName = find( Qtopia::LastName ); 732 QString lastName = find( Qtopia::LastName );
733 QString suffix = find( Qtopia::Suffix ); 733 QString suffix = find( Qtopia::Suffix );
734 734
735 QString name = title; 735 QString name = title;
736 if ( !firstName.isEmpty() ) { 736 if ( !firstName.isEmpty() ) {
737 if ( !name.isEmpty() ) 737 if ( !name.isEmpty() )
738 name += " "; 738 name += " ";
739 name += firstName; 739 name += firstName;
740 } 740 }
741 if ( !middleName.isEmpty() ) { 741 if ( !middleName.isEmpty() ) {
742 if ( !name.isEmpty() ) 742 if ( !name.isEmpty() )
743 name += " "; 743 name += " ";
744 name += middleName; 744 name += middleName;
745 } 745 }
746 if ( !lastName.isEmpty() ) { 746 if ( !lastName.isEmpty() ) {
747 if ( !name.isEmpty() ) 747 if ( !name.isEmpty() )
748 name += " "; 748 name += " ";
749 name += lastName; 749 name += lastName;
750 } 750 }
751 if ( !suffix.isEmpty() ) { 751 if ( !suffix.isEmpty() ) {
752 if ( !name.isEmpty() ) 752 if ( !name.isEmpty() )
753 name += " "; 753 name += " ";
754 name += suffix; 754 name += suffix;
755 } 755 }
756 return name.simplifyWhiteSpace(); 756 return name.simplifyWhiteSpace();
757} 757}
758 758
759/*! 759/*!
760 Returns a list of the names of the children of the contact. 760 Returns a list of the names of the children of the contact.
761*/ 761*/
762QStringList OContact::childrenList() const 762QStringList OContact::childrenList() const
763{ 763{
764 return QStringList::split( " ", find( Qtopia::Children ) ); 764 return QStringList::split( " ", find( Qtopia::Children ) );
765} 765}
766 766
767/*! \fn void OContact::insertEmail( const QString &email ) 767/*! \fn void OContact::insertEmail( const QString &email )
768 768
769 Insert \a email into the email list. Ensures \a email can only be added 769 Insert \a email into the email list. Ensures \a email can only be added
770 once. If there is no default email address set, it sets it to the \a email. 770 once. If there is no default email address set, it sets it to the \a email.
771*/ 771*/
772 772
773/*! \fn void OContact::removeEmail( const QString &email ) 773/*! \fn void OContact::removeEmail( const QString &email )
774 774
775 Removes the \a email from the email list. If the default email was \a email, 775 Removes the \a email from the email list. If the default email was \a email,
776 then the default email address is assigned to the first email in the 776 then the default email address is assigned to the first email in the
777 email list 777 email list
778*/ 778*/
779 779
780/*! \fn void OContact::clearEmails() 780/*! \fn void OContact::clearEmails()
781 781
782 Clears the email list. 782 Clears the email list.
783 */ 783 */
784 784
785/*! \fn void OContact::insertEmails( const QStringList &emailList ) 785/*! \fn void OContact::insertEmails( const QStringList &emailList )
786 786
787 Appends the \a emailList to the exiting email list 787 Appends the \a emailList to the exiting email list
788 */ 788 */
789 789
790/*! 790/*!
791 Returns a list of email addresses belonging to the contact, including 791 Returns a list of email addresses belonging to the contact, including
792 the default email address. 792 the default email address.
793*/ 793*/
794QStringList OContact::emailList() const 794QStringList OContact::emailList() const
795{ 795{
796 QString emailStr = emails(); 796 QString emailStr = emails();
797 797
798 QStringList r; 798 QStringList r;
799 if ( !emailStr.isEmpty() ) { 799 if ( !emailStr.isEmpty() ) {
800 qDebug(" emailstr "); 800 qDebug(" emailstr ");
801 QStringList l = QStringList::split( emailSeparator(), emailStr ); 801 QStringList l = QStringList::split( emailSeparator(), emailStr );
802 for ( QStringList::ConstIterator it = l.begin();it != l.end();++it ) 802 for ( QStringList::ConstIterator it = l.begin();it != l.end();++it )
803 r += (*it).simplifyWhiteSpace(); 803 r += (*it).simplifyWhiteSpace();
804 } 804 }
805 805
806 return r; 806 return r;
807} 807}
808 808
809/*! 809/*!
810 \overload 810 \overload
811 811
812 Generates the string for the contact to be filed as from the first, 812 Generates the string for the contact to be filed as from the first,
813 middle and last name of the contact. 813 middle and last name of the contact.
814*/ 814*/
815void OContact::setFileAs() 815void OContact::setFileAs()
816{ 816{
817 QString lastName, firstName, middleName, fileas; 817 QString lastName, firstName, middleName, fileas;
818 818
819 lastName = find( Qtopia::LastName ); 819 lastName = find( Qtopia::LastName );
820 firstName = find( Qtopia::FirstName ); 820 firstName = find( Qtopia::FirstName );
821 middleName = find( Qtopia::MiddleName ); 821 middleName = find( Qtopia::MiddleName );
822 if ( !lastName.isEmpty() && !firstName.isEmpty() 822 if ( !lastName.isEmpty() && !firstName.isEmpty()
823 && !middleName.isEmpty() ) 823 && !middleName.isEmpty() )
824 fileas = lastName + ", " + firstName + " " + middleName; 824 fileas = lastName + ", " + firstName + " " + middleName;
825 else if ( !lastName.isEmpty() && !firstName.isEmpty() ) 825 else if ( !lastName.isEmpty() && !firstName.isEmpty() )
826 fileas = lastName + ", " + firstName; 826 fileas = lastName + ", " + firstName;
827 else if ( !lastName.isEmpty() || !firstName.isEmpty() || 827 else if ( !lastName.isEmpty() || !firstName.isEmpty() ||
828 !middleName.isEmpty() ) 828 !middleName.isEmpty() )
829 fileas = firstName + ( firstName.isEmpty() ? "" : " " ) 829 fileas = firstName + ( firstName.isEmpty() ? "" : " " )
830 + middleName + ( middleName.isEmpty() ? "" : " " ) 830 + middleName + ( middleName.isEmpty() ? "" : " " )
831 + lastName; 831 + lastName;
832 832
833 replace( Qtopia::FileAs, fileas ); 833 replace( Qtopia::FileAs, fileas );
834} 834}
835 835
836/*! 836/*!
837 \internal 837 \internal
838 Appends the contact information to \a buf. 838 Appends the contact information to \a buf.
839*/ 839*/
840void OContact::save( QString &buf ) const 840void OContact::save( QString &buf ) const
841{ 841{
842 static const QStringList SLFIELDS = fields(); 842 static const QStringList SLFIELDS = fields();
843 // I'm expecting "<Contact " in front of this... 843 // I'm expecting "<Contact " in front of this...
844 for ( QMap<int, QString>::ConstIterator it = mMap.begin(); 844 for ( QMap<int, QString>::ConstIterator it = mMap.begin();
845 it != mMap.end(); ++it ) { 845 it != mMap.end(); ++it ) {
846 const QString &value = it.data(); 846 const QString &value = it.data();
847 int key = it.key(); 847 int key = it.key();
848 if ( !value.isEmpty() ) { 848 if ( !value.isEmpty() ) {
849 if ( key == Qtopia::AddressCategory || key == Qtopia::AddressUid) 849 if ( key == Qtopia::AddressCategory || key == Qtopia::AddressUid)
850 continue; 850 continue;
851 851
852 key -= Qtopia::AddressCategory+1; 852 key -= Qtopia::AddressCategory+1;
853 buf += SLFIELDS[key]; 853 buf += SLFIELDS[key];
854 buf += "=\"" + Qtopia::escapeString(value) + "\" "; 854 buf += "=\"" + Qtopia::escapeString(value) + "\" ";
855 } 855 }
856 } 856 }
857 buf += customToXml(); 857 buf += customToXml();
858 if ( categories().count() > 0 ) 858 if ( categories().count() > 0 )
859 buf += "Categories=\"" + idsToString( categories() ) + "\" "; 859 buf += "Categories=\"" + idsToString( categories() ) + "\" ";
860 buf += "Uid=\"" + QString::number( uid() ) + "\" "; 860 buf += "Uid=\"" + QString::number( uid() ) + "\" ";
861 // You need to close this yourself 861 // You need to close this yourself
862} 862}
863 863
864 864
865/*! 865/*!
866 \internal 866 \internal
867 Returns the list of fields belonging to a contact 867 Returns the list of fields belonging to a contact
868 Never change order of this list ! It has to be regarding 868 Never change order of this list ! It has to be regarding
869 enum AddressBookFields !! 869 enum AddressBookFields !!
870*/ 870*/
871QStringList OContact::fields() 871QStringList OContact::fields()
872{ 872{
873 QStringList list; 873 QStringList list;
874 874
875 list.append( "Title" ); // Not Used! 875 list.append( "Title" ); // Not Used!
876 list.append( "FirstName" ); 876 list.append( "FirstName" );
877 list.append( "MiddleName" ); 877 list.append( "MiddleName" );
878 list.append( "LastName" ); 878 list.append( "LastName" );
879 list.append( "Suffix" ); 879 list.append( "Suffix" );
880 list.append( "FileAs" ); 880 list.append( "FileAs" );
881 881
882 list.append( "JobTitle" ); 882 list.append( "JobTitle" );
883 list.append( "Department" ); 883 list.append( "Department" );
884 list.append( "Company" ); 884 list.append( "Company" );
885 list.append( "BusinessPhone" ); 885 list.append( "BusinessPhone" );
886 list.append( "BusinessFax" ); 886 list.append( "BusinessFax" );
887 list.append( "BusinessMobile" ); 887 list.append( "BusinessMobile" );
888 888
889 list.append( "DefaultEmail" ); 889 list.append( "DefaultEmail" );
890 list.append( "Emails" ); 890 list.append( "Emails" );
891 891
892 list.append( "HomePhone" ); 892 list.append( "HomePhone" );
893 list.append( "HomeFax" ); 893 list.append( "HomeFax" );
894 list.append( "HomeMobile" ); 894 list.append( "HomeMobile" );
895 895
896 list.append( "BusinessStreet" ); 896 list.append( "BusinessStreet" );
897 list.append( "BusinessCity" ); 897 list.append( "BusinessCity" );
898 list.append( "BusinessState" ); 898 list.append( "BusinessState" );
899 list.append( "BusinessZip" ); 899 list.append( "BusinessZip" );
900 list.append( "BusinessCountry" ); 900 list.append( "BusinessCountry" );
901 list.append( "BusinessPager" ); 901 list.append( "BusinessPager" );
902 list.append( "BusinessWebPage" ); 902 list.append( "BusinessWebPage" );
903 903
904 list.append( "Office" ); 904 list.append( "Office" );
905 list.append( "Profession" ); 905 list.append( "Profession" );
906 list.append( "Assistant" ); 906 list.append( "Assistant" );
907 list.append( "Manager" ); 907 list.append( "Manager" );
908 908
909 list.append( "HomeStreet" ); 909 list.append( "HomeStreet" );
910 list.append( "HomeCity" ); 910 list.append( "HomeCity" );
911 list.append( "HomeState" ); 911 list.append( "HomeState" );
912 list.append( "HomeZip" ); 912 list.append( "HomeZip" );
913 list.append( "HomeCountry" ); 913 list.append( "HomeCountry" );
914 list.append( "HomeWebPage" ); 914 list.append( "HomeWebPage" );
915 915
916 list.append( "Spouse" ); 916 list.append( "Spouse" );
917 list.append( "Gender" ); 917 list.append( "Gender" );
918 list.append( "Birthday" ); 918 list.append( "Birthday" );
919 list.append( "Anniversary" ); 919 list.append( "Anniversary" );
920 list.append( "Nickname" ); 920 list.append( "Nickname" );
921 list.append( "Children" ); 921 list.append( "Children" );
922 922
923 list.append( "Notes" ); 923 list.append( "Notes" );
924 list.append( "Groups" ); 924 list.append( "Groups" );
925 925
926 return list; 926 return list;
927} 927}
928 928
929 929
930/*! 930/*!
931 Sets the list of email address for contact to those contained in \a str. 931 Sets the list of email address for contact to those contained in \a str.
932 Email address should be separated by ';'s. 932 Email address should be separated by ';'s.
933*/ 933*/
934void OContact::setEmails( const QString &str ) 934void OContact::setEmails( const QString &str )
935{ 935{
936 replace( Qtopia::Emails, str ); 936 replace( Qtopia::Emails, str );
937 if ( str.isEmpty() ) 937 if ( str.isEmpty() )
938 setDefaultEmail( QString::null ); 938 setDefaultEmail( QString::null );
939} 939}
940 940
941/*! 941/*!
942 Sets the list of children for the contact to those contained in \a str. 942 Sets the list of children for the contact to those contained in \a str.
943*/ 943*/
944void OContact::setChildren( const QString &str ) 944void OContact::setChildren( const QString &str )
945{ 945{
946 replace( Qtopia::Children, str ); 946 replace( Qtopia::Children, str );
947} 947}
948 948
949/*! 949/*!
950 \overload 950 \overload
951 Returns TRUE if the contact matches the regular expression \a regexp. 951 Returns TRUE if the contact matches the regular expression \a regexp.
952 Otherwise returns FALSE. 952 Otherwise returns FALSE.
953*/ 953*/
954bool OContact::match( const QRegExp &r ) const 954bool OContact::match( const QRegExp &r ) const
955{ 955{
956 bool match; 956 bool match;
957 match = false; 957 match = false;
958 QMap<int, QString>::ConstIterator it; 958 QMap<int, QString>::ConstIterator it;
959 for ( it = mMap.begin(); it != mMap.end(); ++it ) { 959 for ( it = mMap.begin(); it != mMap.end(); ++it ) {
960 if ( (*it).find( r ) > -1 ) { 960 if ( (*it).find( r ) > -1 ) {
961 setLastHitField( it.key() );
961 match = true; 962 match = true;
962 break; 963 break;
963 } 964 }
964 } 965 }
965 return match; 966 return match;
966} 967}
967 968
968 969
969QString OContact::toShortText() const 970QString OContact::toShortText() const
970{ 971{
971 return ( fullName() ); 972 return ( fullName() );
972} 973}
973QString OContact::type() const 974QString OContact::type() const
974{ 975{
975 return QString::fromLatin1( "OContact" ); 976 return QString::fromLatin1( "OContact" );
976} 977}
977 978
978// Definition is missing ! (se) 979// Definition is missing ! (se)
979QMap<QString,QString> OContact::toExtraMap() const 980QMap<QString,QString> OContact::toExtraMap() const
980{ 981{
981 qWarning ("Function not implemented: OContact::toExtraMap()"); 982 qWarning ("Function not implemented: OContact::toExtraMap()");
982 QMap <QString,QString> useless; 983 QMap <QString,QString> useless;
983 return useless; 984 return useless;
984} 985}
985 986
986class QString OContact::recordField( int pos ) const 987class QString OContact::recordField( int pos ) const
987{ 988{
988 QStringList SLFIELDS = fields(); // ?? why this ? (se) 989 QStringList SLFIELDS = fields(); // ?? why this ? (se)
989 return SLFIELDS[pos]; 990 return SLFIELDS[pos];
990} 991}
991 992
992// In future releases, we should store birthday and anniversary 993// In future releases, we should store birthday and anniversary
993// internally as QDate instead of QString ! 994// internally as QDate instead of QString !
994// QString is always too complicate to interprete (DD.MM.YY, DD/MM/YY, MM/DD/YY, etc..)(se) 995// QString is always too complicate to interprete (DD.MM.YY, DD/MM/YY, MM/DD/YY, etc..)(se)
995 996
996/*! \fn void OContact::setBirthday( const QDate& date ) 997/*! \fn void OContact::setBirthday( const QDate& date )
997 Sets the birthday for the contact to \a date. If date is null 998 Sets the birthday for the contact to \a date. If date is null
998 the current stored date will be removed. 999 the current stored date will be removed.
999*/ 1000*/
1000void OContact::setBirthday( const QDate &v ) 1001void OContact::setBirthday( const QDate &v )
1001{ 1002{
1002 if ( v.isNull() ){ 1003 if ( v.isNull() ){
1003 qWarning( "Remove Birthday"); 1004 qWarning( "Remove Birthday");
1004 replace( Qtopia::Birthday, QString::null ); 1005 replace( Qtopia::Birthday, QString::null );
1005 return; 1006 return;
1006 } 1007 }
1007 1008
1008 if ( v.isValid() ) 1009 if ( v.isValid() )
1009 replace( Qtopia::Birthday, OConversion::dateToString( v ) ); 1010 replace( Qtopia::Birthday, OConversion::dateToString( v ) );
1010 1011
1011} 1012}
1012 1013
1013 1014
1014/*! \fn void OContact::setAnniversary( const QDate &date ) 1015/*! \fn void OContact::setAnniversary( const QDate &date )
1015 Sets the anniversary of the contact to \a date. If date is 1016 Sets the anniversary of the contact to \a date. If date is
1016 null, the current stored date will be removed. 1017 null, the current stored date will be removed.
1017*/ 1018*/
1018void OContact::setAnniversary( const QDate &v ) 1019void OContact::setAnniversary( const QDate &v )
1019{ 1020{
1020 if ( v.isNull() ){ 1021 if ( v.isNull() ){
1021 qWarning( "Remove Anniversary"); 1022 qWarning( "Remove Anniversary");
1022 replace( Qtopia::Anniversary, QString::null ); 1023 replace( Qtopia::Anniversary, QString::null );
1023 return; 1024 return;
1024 } 1025 }
1025 1026
1026 if ( v.isValid() ) 1027 if ( v.isValid() )
1027 replace( Qtopia::Anniversary, OConversion::dateToString( v ) ); 1028 replace( Qtopia::Anniversary, OConversion::dateToString( v ) );
1028} 1029}
1029 1030
1030/*! \fn QDate OContact::birthday() const 1031/*! \fn QDate OContact::birthday() const
1031 Returns the birthday of the contact. 1032 Returns the birthday of the contact.
1032*/ 1033*/
1033QDate OContact::birthday() const 1034QDate OContact::birthday() const
1034{ 1035{
1035 QString str = find( Qtopia::Birthday ); 1036 QString str = find( Qtopia::Birthday );
1036 qWarning ("Birthday %s", str.latin1() ); 1037 qWarning ("Birthday %s", str.latin1() );
1037 if ( !str.isEmpty() ) 1038 if ( !str.isEmpty() )
1038 return OConversion::dateFromString ( str ); 1039 return OConversion::dateFromString ( str );
1039 else 1040 else
1040 return QDate(); 1041 return QDate();
1041} 1042}
1042 1043
1043 1044
1044/*! \fn QDate OContact::anniversary() const 1045/*! \fn QDate OContact::anniversary() const
1045 Returns the anniversary of the contact. 1046 Returns the anniversary of the contact.
1046*/ 1047*/
1047QDate OContact::anniversary() const 1048QDate OContact::anniversary() const
1048{ 1049{
1049 QDate empty; 1050 QDate empty;
1050 QString str = find( Qtopia::Anniversary ); 1051 QString str = find( Qtopia::Anniversary );
1051 qWarning ("Anniversary %s", str.latin1() ); 1052 qWarning ("Anniversary %s", str.latin1() );
1052 if ( !str.isEmpty() ) 1053 if ( !str.isEmpty() )
1053 return OConversion::dateFromString ( str ); 1054 return OConversion::dateFromString ( str );
1054 else 1055 else
1055 return empty; 1056 return empty;
1056} 1057}
1057 1058
1058 1059
1059void OContact::insertEmail( const QString &v ) 1060void OContact::insertEmail( const QString &v )
1060{ 1061{
1061 //qDebug("insertEmail %s", v.latin1()); 1062 //qDebug("insertEmail %s", v.latin1());
1062 QString e = v.simplifyWhiteSpace(); 1063 QString e = v.simplifyWhiteSpace();
1063 QString def = defaultEmail(); 1064 QString def = defaultEmail();
1064 1065
1065 // if no default, set it as the default email and don't insert 1066 // if no default, set it as the default email and don't insert
1066 if ( def.isEmpty() ) { 1067 if ( def.isEmpty() ) {
1067 setDefaultEmail( e ); // will insert into the list for us 1068 setDefaultEmail( e ); // will insert into the list for us
1068 return; 1069 return;
1069 } 1070 }
1070 1071
1071 // otherwise, insert assuming doesn't already exist 1072 // otherwise, insert assuming doesn't already exist
1072 QString emailsStr = find( Qtopia::Emails ); 1073 QString emailsStr = find( Qtopia::Emails );
1073 if ( emailsStr.contains( e )) 1074 if ( emailsStr.contains( e ))
1074 return; 1075 return;
1075 if ( !emailsStr.isEmpty() ) 1076 if ( !emailsStr.isEmpty() )
1076 emailsStr += emailSeparator(); 1077 emailsStr += emailSeparator();
1077 emailsStr += e; 1078 emailsStr += e;
1078 replace( Qtopia::Emails, emailsStr ); 1079 replace( Qtopia::Emails, emailsStr );
1079} 1080}
1080 1081
1081void OContact::removeEmail( const QString &v ) 1082void OContact::removeEmail( const QString &v )
1082{ 1083{
1083 QString e = v.simplifyWhiteSpace(); 1084 QString e = v.simplifyWhiteSpace();
1084 QString def = defaultEmail(); 1085 QString def = defaultEmail();
1085 QString emailsStr = find( Qtopia::Emails ); 1086 QString emailsStr = find( Qtopia::Emails );
1086 QStringList emails = emailList(); 1087 QStringList emails = emailList();
1087 1088
1088 // otherwise, must first contain it 1089 // otherwise, must first contain it
1089 if ( !emailsStr.contains( e ) ) 1090 if ( !emailsStr.contains( e ) )
1090 return; 1091 return;
1091 1092
1092 // remove it 1093 // remove it
1093 //qDebug(" removing email from list %s", e.latin1()); 1094 //qDebug(" removing email from list %s", e.latin1());
1094 emails.remove( e ); 1095 emails.remove( e );
1095 // reset the string 1096 // reset the string
1096 emailsStr = emails.join(emailSeparator()); // Sharp's brain dead separator 1097 emailsStr = emails.join(emailSeparator()); // Sharp's brain dead separator
1097 replace( Qtopia::Emails, emailsStr ); 1098 replace( Qtopia::Emails, emailsStr );
1098 1099
1099 // if default, then replace the default email with the first one 1100 // if default, then replace the default email with the first one
1100 if ( def == e ) { 1101 if ( def == e ) {
1101 //qDebug("removeEmail is default; setting new default"); 1102 //qDebug("removeEmail is default; setting new default");
1102 if ( !emails.count() ) 1103 if ( !emails.count() )
1103 clearEmails(); 1104 clearEmails();
1104 else // setDefaultEmail will remove e from the list 1105 else // setDefaultEmail will remove e from the list
1105 setDefaultEmail( emails.first() ); 1106 setDefaultEmail( emails.first() );
1106 } 1107 }
1107} 1108}
1108void OContact::clearEmails() 1109void OContact::clearEmails()
1109{ 1110{
1110 mMap.remove( Qtopia::DefaultEmail ); 1111 mMap.remove( Qtopia::DefaultEmail );
1111 mMap.remove( Qtopia::Emails ); 1112 mMap.remove( Qtopia::Emails );
1112} 1113}
1113void OContact::setDefaultEmail( const QString &v ) 1114void OContact::setDefaultEmail( const QString &v )
1114{ 1115{
1115 QString e = v.simplifyWhiteSpace(); 1116 QString e = v.simplifyWhiteSpace();
1116 1117
1117 //qDebug("OContact::setDefaultEmail %s", e.latin1()); 1118 //qDebug("OContact::setDefaultEmail %s", e.latin1());
1118 replace( Qtopia::DefaultEmail, e ); 1119 replace( Qtopia::DefaultEmail, e );
1119 1120
1120 if ( !e.isEmpty() ) 1121 if ( !e.isEmpty() )
1121 insertEmail( e ); 1122 insertEmail( e );
1122 1123
1123} 1124}
1124 1125
1125void OContact::insertEmails( const QStringList &v ) 1126void OContact::insertEmails( const QStringList &v )
1126{ 1127{
1127 for ( QStringList::ConstIterator it = v.begin(); it != v.end(); ++it ) 1128 for ( QStringList::ConstIterator it = v.begin(); it != v.end(); ++it )
1128 insertEmail( *it ); 1129 insertEmail( *it );
1129} 1130}
1130int OContact::rtti() { 1131int OContact::rtti() {
1131 return OPimResolver::AddressBook; 1132 return OPimResolver::AddressBook;
1132} 1133}
1133void OContact::setUid( int i ) 1134void OContact::setUid( int i )
1134{ 1135{
1135 OPimRecord::setUid(i); 1136 OPimRecord::setUid(i);
1136 replace( Qtopia::AddressUid , QString::number(i)); 1137 replace( Qtopia::AddressUid , QString::number(i));
1137} 1138}
diff --git a/libopie/pim/ocontact.h b/libopie/pim/ocontact.h
index 0e6cbd2..f79f0f3 100644
--- a/libopie/pim/ocontact.h
+++ b/libopie/pim/ocontact.h
@@ -1,241 +1,244 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** Copyright (C) 2002-2003 by Stefan Eilers (eilers.stefan@epost.de) 3** Copyright (C) 2002-2003 by Stefan Eilers (eilers.stefan@epost.de)
4** 4**
5** This file may be distributed and/or modified under the terms of the 5** This file may be distributed and/or modified under the terms of the
6** GNU General Public License version 2 as published by the Free Software 6** GNU General Public License version 2 as published by the Free Software
7** Foundation and appearing in the file LICENSE.GPL included in the 7** Foundation and appearing in the file LICENSE.GPL included in the
8** packaging of this file. 8** packaging of this file.
9** 9**
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12** 12**
13** See http://www.trolltech.com/gpl/ for GPL licensing information. 13** See http://www.trolltech.com/gpl/ for GPL licensing information.
14** 14**
15** Contact info@trolltech.com if any conditions of this licensing are 15** Contact info@trolltech.com if any conditions of this licensing are
16** not clear to you. 16** not clear to you.
17** 17**
18**********************************************************************/ 18**********************************************************************/
19 19
20#ifndef __OCONTACT_H__ 20#ifndef __OCONTACT_H__
21#define __OCONTACT_H__ 21#define __OCONTACT_H__
22 22
23#include <opie/opimrecord.h> 23#include <opie/opimrecord.h>
24#include <qpe/recordfields.h> 24#include <qpe/recordfields.h>
25 25
26#include <qdatetime.h> 26#include <qdatetime.h>
27#include <qstringlist.h> 27#include <qstringlist.h>
28 28
29#if defined(QPC_TEMPLATEDLL) 29#if defined(QPC_TEMPLATEDLL)
30// MOC_SKIP_BEGIN 30// MOC_SKIP_BEGIN
31QPC_TEMPLATEEXTERN template class QPC_EXPORT QMap<int, QString>; 31QPC_TEMPLATEEXTERN template class QPC_EXPORT QMap<int, QString>;
32// MOC_SKIP_END 32// MOC_SKIP_END
33#endif 33#endif
34 34
35class ContactPrivate; 35class ContactPrivate;
36 36
37/** 37/**
38 * OContact class represents a specialised PIM Record for contacts. 38 * OContact class represents a specialised PIM Record for contacts.
39 * It does store all kind of persopn related information. 39 * It does store all kind of persopn related information.
40 * 40 *
41 * @short Contact Container 41 * @short Contact Container
42 * @author TT, Stefan Eiler, Holger Freyther 42 * @author TT, Stefan Eiler, Holger Freyther
43 */ 43 */
44class QPC_EXPORT OContact : public OPimRecord 44class QPC_EXPORT OContact : public OPimRecord
45{ 45{
46 friend class DataSet; 46 friend class DataSet;
47public: 47public:
48 OContact(); 48 OContact();
49 OContact( const QMap<int, QString> &fromMap ); 49 OContact( const QMap<int, QString> &fromMap );
50 virtual ~OContact(); 50 virtual ~OContact();
51 51
52 /* 52 /*
53 * do we need to inline them 53 * do we need to inline them
54 * if yes do we need to inline them this way? 54 * if yes do we need to inline them this way?
55 * -zecke 55 * -zecke
56 */ 56 */
57 void setTitle( const QString &v ) { replace( Qtopia::Title, v ); } 57 void setTitle( const QString &v ) { replace( Qtopia::Title, v ); }
58 void setFirstName( const QString &v ) { replace( Qtopia::FirstName, v ); } 58 void setFirstName( const QString &v ) { replace( Qtopia::FirstName, v ); }
59 void setMiddleName( const QString &v ) { replace( Qtopia::MiddleName, v ); } 59 void setMiddleName( const QString &v ) { replace( Qtopia::MiddleName, v ); }
60 void setLastName( const QString &v ) { replace( Qtopia::LastName, v ); } 60 void setLastName( const QString &v ) { replace( Qtopia::LastName, v ); }
61 void setSuffix( const QString &v ) { replace( Qtopia::Suffix, v ); } 61 void setSuffix( const QString &v ) { replace( Qtopia::Suffix, v ); }
62 void setFileAs( const QString &v ) { replace( Qtopia::FileAs, v ); } 62 void setFileAs( const QString &v ) { replace( Qtopia::FileAs, v ); }
63 void setFileAs(); 63 void setFileAs();
64 64
65 // default email address 65 // default email address
66 void setDefaultEmail( const QString &v ); 66 void setDefaultEmail( const QString &v );
67 // inserts email to list and ensure's doesn't already exist 67 // inserts email to list and ensure's doesn't already exist
68 void insertEmail( const QString &v ); 68 void insertEmail( const QString &v );
69 void removeEmail( const QString &v ); 69 void removeEmail( const QString &v );
70 void clearEmails(); 70 void clearEmails();
71 void insertEmails( const QStringList &v ); 71 void insertEmails( const QStringList &v );
72 72
73 // home 73 // home
74 void setHomeStreet( const QString &v ) { replace( Qtopia::HomeStreet, v ); } 74 void setHomeStreet( const QString &v ) { replace( Qtopia::HomeStreet, v ); }
75 void setHomeCity( const QString &v ) { replace( Qtopia::HomeCity, v ); } 75 void setHomeCity( const QString &v ) { replace( Qtopia::HomeCity, v ); }
76 void setHomeState( const QString &v ) { replace( Qtopia::HomeState, v ); } 76 void setHomeState( const QString &v ) { replace( Qtopia::HomeState, v ); }
77 void setHomeZip( const QString &v ) { replace( Qtopia::HomeZip, v ); } 77 void setHomeZip( const QString &v ) { replace( Qtopia::HomeZip, v ); }
78 void setHomeCountry( const QString &v ) { replace( Qtopia::HomeCountry, v ); } 78 void setHomeCountry( const QString &v ) { replace( Qtopia::HomeCountry, v ); }
79 void setHomePhone( const QString &v ) { replace( Qtopia::HomePhone, v ); } 79 void setHomePhone( const QString &v ) { replace( Qtopia::HomePhone, v ); }
80 void setHomeFax( const QString &v ) { replace( Qtopia::HomeFax, v ); } 80 void setHomeFax( const QString &v ) { replace( Qtopia::HomeFax, v ); }
81 void setHomeMobile( const QString &v ) { replace( Qtopia::HomeMobile, v ); } 81 void setHomeMobile( const QString &v ) { replace( Qtopia::HomeMobile, v ); }
82 void setHomeWebpage( const QString &v ) { replace( Qtopia::HomeWebPage, v ); } 82 void setHomeWebpage( const QString &v ) { replace( Qtopia::HomeWebPage, v ); }
83 83
84 // business 84 // business
85 void setCompany( const QString &v ) { replace( Qtopia::Company, v ); } 85 void setCompany( const QString &v ) { replace( Qtopia::Company, v ); }
86 void setBusinessStreet( const QString &v ) { replace( Qtopia::BusinessStreet, v ); } 86 void setBusinessStreet( const QString &v ) { replace( Qtopia::BusinessStreet, v ); }
87 void setBusinessCity( const QString &v ) { replace( Qtopia::BusinessCity, v ); } 87 void setBusinessCity( const QString &v ) { replace( Qtopia::BusinessCity, v ); }
88 void setBusinessState( const QString &v ) { replace( Qtopia::BusinessState, v ); } 88 void setBusinessState( const QString &v ) { replace( Qtopia::BusinessState, v ); }
89 void setBusinessZip( const QString &v ) { replace( Qtopia::BusinessZip, v ); } 89 void setBusinessZip( const QString &v ) { replace( Qtopia::BusinessZip, v ); }
90 void setBusinessCountry( const QString &v ) { replace( Qtopia::BusinessCountry, v ); } 90 void setBusinessCountry( const QString &v ) { replace( Qtopia::BusinessCountry, v ); }
91 void setBusinessWebpage( const QString &v ) { replace( Qtopia::BusinessWebPage, v ); } 91 void setBusinessWebpage( const QString &v ) { replace( Qtopia::BusinessWebPage, v ); }
92 void setJobTitle( const QString &v ) { replace( Qtopia::JobTitle, v ); } 92 void setJobTitle( const QString &v ) { replace( Qtopia::JobTitle, v ); }
93 void setDepartment( const QString &v ) { replace( Qtopia::Department, v ); } 93 void setDepartment( const QString &v ) { replace( Qtopia::Department, v ); }
94 void setOffice( const QString &v ) { replace( Qtopia::Office, v ); } 94 void setOffice( const QString &v ) { replace( Qtopia::Office, v ); }
95 void setBusinessPhone( const QString &v ) { replace( Qtopia::BusinessPhone, v ); } 95 void setBusinessPhone( const QString &v ) { replace( Qtopia::BusinessPhone, v ); }
96 void setBusinessFax( const QString &v ) { replace( Qtopia::BusinessFax, v ); } 96 void setBusinessFax( const QString &v ) { replace( Qtopia::BusinessFax, v ); }
97 void setBusinessMobile( const QString &v ) { replace( Qtopia::BusinessMobile, v ); } 97 void setBusinessMobile( const QString &v ) { replace( Qtopia::BusinessMobile, v ); }
98 void setBusinessPager( const QString &v ) { replace( Qtopia::BusinessPager, v ); } 98 void setBusinessPager( const QString &v ) { replace( Qtopia::BusinessPager, v ); }
99 void setProfession( const QString &v ) { replace( Qtopia::Profession, v ); } 99 void setProfession( const QString &v ) { replace( Qtopia::Profession, v ); }
100 void setAssistant( const QString &v ) { replace( Qtopia::Assistant, v ); } 100 void setAssistant( const QString &v ) { replace( Qtopia::Assistant, v ); }
101 void setManager( const QString &v ) { replace( Qtopia::Manager, v ); } 101 void setManager( const QString &v ) { replace( Qtopia::Manager, v ); }
102 102
103 // personal 103 // personal
104 void setSpouse( const QString &v ) { replace( Qtopia::Spouse, v ); } 104 void setSpouse( const QString &v ) { replace( Qtopia::Spouse, v ); }
105 void setGender( const QString &v ) { replace( Qtopia::Gender, v ); } 105 void setGender( const QString &v ) { replace( Qtopia::Gender, v ); }
106 void setBirthday( const QDate &v ); 106 void setBirthday( const QDate &v );
107 void setAnniversary( const QDate &v ); 107 void setAnniversary( const QDate &v );
108 void setNickname( const QString &v ) { replace( Qtopia::Nickname, v ); } 108 void setNickname( const QString &v ) { replace( Qtopia::Nickname, v ); }
109 void setChildren( const QString &v ); 109 void setChildren( const QString &v );
110 110
111 // other 111 // other
112 void setNotes( const QString &v ) { replace( Qtopia::Notes, v); } 112 void setNotes( const QString &v ) { replace( Qtopia::Notes, v); }
113 113
114 virtual bool match( const QRegExp &regexp ) const; 114 virtual bool match( const QRegExp &regexp ) const;
115 115
116// // custom 116// // custom
117// void setCustomField( const QString &key, const QString &v ) 117// void setCustomField( const QString &key, const QString &v )
118// { replace(Custom- + key, v ); } 118// { replace(Custom- + key, v ); }
119 119
120 // name 120 // name
121 QString fullName() const; 121 QString fullName() const;
122 QString title() const { return find( Qtopia::Title ); } 122 QString title() const { return find( Qtopia::Title ); }
123 QString firstName() const { return find( Qtopia::FirstName ); } 123 QString firstName() const { return find( Qtopia::FirstName ); }
124 QString middleName() const { return find( Qtopia::MiddleName ); } 124 QString middleName() const { return find( Qtopia::MiddleName ); }
125 QString lastName() const { return find( Qtopia::LastName ); } 125 QString lastName() const { return find( Qtopia::LastName ); }
126 QString suffix() const { return find( Qtopia::Suffix ); } 126 QString suffix() const { return find( Qtopia::Suffix ); }
127 QString fileAs() const { return find( Qtopia::FileAs ); } 127 QString fileAs() const { return find( Qtopia::FileAs ); }
128 128
129 // email 129 // email
130 QString defaultEmail() const { return find( Qtopia::DefaultEmail ); } 130 QString defaultEmail() const { return find( Qtopia::DefaultEmail ); }
131 QStringList emailList() const; 131 QStringList emailList() const;
132 132
133 // home 133 // home
134 /* 134 /*
135 * OPimAddress address(enum Location)const; 135 * OPimAddress address(enum Location)const;
136 * would be some how nicer... 136 * would be some how nicer...
137 * -zecke 137 * -zecke
138 */ 138 */
139 QString homeStreet() const { return find( Qtopia::HomeStreet ); } 139 QString homeStreet() const { return find( Qtopia::HomeStreet ); }
140 QString homeCity() const { return find( Qtopia::HomeCity ); } 140 QString homeCity() const { return find( Qtopia::HomeCity ); }
141 QString homeState() const { return find( Qtopia::HomeState ); } 141 QString homeState() const { return find( Qtopia::HomeState ); }
142 QString homeZip() const { return find( Qtopia::HomeZip ); } 142 QString homeZip() const { return find( Qtopia::HomeZip ); }
143 QString homeCountry() const { return find( Qtopia::HomeCountry ); } 143 QString homeCountry() const { return find( Qtopia::HomeCountry ); }
144 QString homePhone() const { return find( Qtopia::HomePhone ); } 144 QString homePhone() const { return find( Qtopia::HomePhone ); }
145 QString homeFax() const { return find( Qtopia::HomeFax ); } 145 QString homeFax() const { return find( Qtopia::HomeFax ); }
146 QString homeMobile() const { return find( Qtopia::HomeMobile ); } 146 QString homeMobile() const { return find( Qtopia::HomeMobile ); }
147 QString homeWebpage() const { return find( Qtopia::HomeWebPage ); } 147 QString homeWebpage() const { return find( Qtopia::HomeWebPage ); }
148 /** Multi line string containing all non-empty address info in the form 148 /** Multi line string containing all non-empty address info in the form
149 * Street 149 * Street
150 * City, State Zip 150 * City, State Zip
151 * Country 151 * Country
152 */ 152 */
153 QString displayHomeAddress() const; 153 QString displayHomeAddress() const;
154 154
155 // business 155 // business
156 QString company() const { return find( Qtopia::Company ); } 156 QString company() const { return find( Qtopia::Company ); }
157 QString businessStreet() const { return find( Qtopia::BusinessStreet ); } 157 QString businessStreet() const { return find( Qtopia::BusinessStreet ); }
158 QString businessCity() const { return find( Qtopia::BusinessCity ); } 158 QString businessCity() const { return find( Qtopia::BusinessCity ); }
159 QString businessState() const { return find( Qtopia::BusinessState ); } 159 QString businessState() const { return find( Qtopia::BusinessState ); }
160 QString businessZip() const { return find( Qtopia::BusinessZip ); } 160 QString businessZip() const { return find( Qtopia::BusinessZip ); }
161 QString businessCountry() const { return find( Qtopia::BusinessCountry ); } 161 QString businessCountry() const { return find( Qtopia::BusinessCountry ); }
162 QString businessWebpage() const { return find( Qtopia::BusinessWebPage ); } 162 QString businessWebpage() const { return find( Qtopia::BusinessWebPage ); }
163 QString jobTitle() const { return find( Qtopia::JobTitle ); } 163 QString jobTitle() const { return find( Qtopia::JobTitle ); }
164 QString department() const { return find( Qtopia::Department ); } 164 QString department() const { return find( Qtopia::Department ); }
165 QString office() const { return find( Qtopia::Office ); } 165 QString office() const { return find( Qtopia::Office ); }
166 QString businessPhone() const { return find( Qtopia::BusinessPhone ); } 166 QString businessPhone() const { return find( Qtopia::BusinessPhone ); }
167 QString businessFax() const { return find( Qtopia::BusinessFax ); } 167 QString businessFax() const { return find( Qtopia::BusinessFax ); }
168 QString businessMobile() const { return find( Qtopia::BusinessMobile ); } 168 QString businessMobile() const { return find( Qtopia::BusinessMobile ); }
169 QString businessPager() const { return find( Qtopia::BusinessPager ); } 169 QString businessPager() const { return find( Qtopia::BusinessPager ); }
170 QString profession() const { return find( Qtopia::Profession ); } 170 QString profession() const { return find( Qtopia::Profession ); }
171 QString assistant() const { return find( Qtopia::Assistant ); } 171 QString assistant() const { return find( Qtopia::Assistant ); }
172 QString manager() const { return find( Qtopia::Manager ); } 172 QString manager() const { return find( Qtopia::Manager ); }
173 /** Multi line string containing all non-empty address info in the form 173 /** Multi line string containing all non-empty address info in the form
174 * Street 174 * Street
175 * City, State Zip 175 * City, State Zip
176 * Country 176 * Country
177 */ 177 */
178 QString displayBusinessAddress() const; 178 QString displayBusinessAddress() const;
179 179
180 //personal 180 //personal
181 QString spouse() const { return find( Qtopia::Spouse ); } 181 QString spouse() const { return find( Qtopia::Spouse ); }
182 QString gender() const { return find( Qtopia::Gender ); } 182 QString gender() const { return find( Qtopia::Gender ); }
183 QDate birthday() const; 183 QDate birthday() const;
184 QDate anniversary() const; 184 QDate anniversary() const;
185 QString nickname() const { return find( Qtopia::Nickname ); } 185 QString nickname() const { return find( Qtopia::Nickname ); }
186 QString children() const { return find( Qtopia::Children ); } 186 QString children() const { return find( Qtopia::Children ); }
187 QStringList childrenList() const; 187 QStringList childrenList() const;
188 188
189 // other 189 // other
190 QString notes() const { return find( Qtopia::Notes ); } 190 QString notes() const { return find( Qtopia::Notes ); }
191 QString groups() const { return find( Qtopia::Groups ); } 191 QString groups() const { return find( Qtopia::Groups ); }
192 QStringList groupList() const; 192 QStringList groupList() const;
193 193
194// // custom 194// // custom
195// const QString &customField( const QString &key ) 195// const QString &customField( const QString &key )
196// { return find( Custom- + key ); } 196// { return find( Custom- + key ); }
197 197
198 198
199 QString toRichText() const; 199 QString toRichText() const;
200 QMap<int, QString> toMap() const; 200 QMap<int, QString> toMap() const;
201 QString field( int key ) const { return find( key ); } 201 QString field( int key ) const { return find( key ); }
202 202
203 203
204 void setUid( int i ); 204 void setUid( int i );
205 205
206 QString toShortText()const; 206 QString toShortText()const;
207 QString OContact::type()const; 207 QString OContact::type()const;
208 QMap<QString,QString> OContact::toExtraMap() const; 208 QMap<QString,QString> OContact::toExtraMap() const;
209 class QString OContact::recordField(int) const; 209 class QString OContact::recordField(int) const;
210 210
211 // Why private ? (eilers,se) 211 // Why private ? (eilers,se)
212 QString emailSeparator() const { return " "; } 212 QString emailSeparator() const { return " "; }
213 // the emails should be seperated by a comma 213 // the emails should be seperated by a comma
214 void setEmails( const QString &v ); 214 void setEmails( const QString &v );
215 QString emails() const { return find( Qtopia::Emails ); } 215 QString emails() const { return find( Qtopia::Emails ); }
216 static int rtti(); 216 static int rtti();
217 217 int lastHitField() const {return m_lastHitField;};
218protected:
219 mutable int m_lastHitField;
220 void setLastHitField(int i) const { m_lastHitField = i; };
218 221
219private: 222private:
220 // The XML-Backend needs some access to the private functions 223 // The XML-Backend needs some access to the private functions
221 friend class OContactAccessBackend_XML; 224 friend class OContactAccessBackend_XML;
222 225
223 void insert( int key, const QString &value ); 226 void insert( int key, const QString &value );
224 void replace( int key, const QString &value ); 227 void replace( int key, const QString &value );
225 QString find( int key ) const; 228 QString find( int key ) const;
226 static QStringList fields(); 229 static QStringList fields();
227 230
228 void save( QString &buf ) const; 231 void save( QString &buf ) const;
229 232
230 QString displayAddress( const QString &street, 233 QString displayAddress( const QString &street,
231 const QString &city, 234 const QString &city,
232 const QString &state, 235 const QString &state,
233 const QString &zip, 236 const QString &zip,
234 const QString &country ) const; 237 const QString &country ) const;
235 238
236 QMap<int, QString> mMap; 239 QMap<int, QString> mMap;
237 ContactPrivate *d; 240 ContactPrivate *d;
238}; 241};
239 242
240 243
241#endif 244#endif
diff --git a/libopie2/opiepim/ocontact.cpp b/libopie2/opiepim/ocontact.cpp
index a38b62b..aeb69ee 100644
--- a/libopie2/opiepim/ocontact.cpp
+++ b/libopie2/opiepim/ocontact.cpp
@@ -193,945 +193,946 @@ OContact::~OContact()
193 Sets the business fax number of the contact to \a str. 193 Sets the business fax number of the contact to \a str.
194*/ 194*/
195 195
196/*! \fn void OContact::setBusinessMobile( const QString &str ) 196/*! \fn void OContact::setBusinessMobile( const QString &str )
197 Sets the business mobile phone number of the contact to \a str. 197 Sets the business mobile phone number of the contact to \a str.
198*/ 198*/
199 199
200/*! \fn void OContact::setBusinessPager( const QString &str ) 200/*! \fn void OContact::setBusinessPager( const QString &str )
201 Sets the business pager number of the contact to \a str. 201 Sets the business pager number of the contact to \a str.
202*/ 202*/
203 203
204/*! \fn void OContact::setBusinessWebpage( const QString &str ) 204/*! \fn void OContact::setBusinessWebpage( const QString &str )
205 Sets the business webpage of the contact to \a str. 205 Sets the business webpage of the contact to \a str.
206*/ 206*/
207 207
208/*! \fn void OContact::setProfession( const QString &str ) 208/*! \fn void OContact::setProfession( const QString &str )
209 Sets the profession of the contact to \a str. 209 Sets the profession of the contact to \a str.
210*/ 210*/
211 211
212/*! \fn void OContact::setAssistant( const QString &str ) 212/*! \fn void OContact::setAssistant( const QString &str )
213 Sets the assistant of the contact to \a str. 213 Sets the assistant of the contact to \a str.
214*/ 214*/
215 215
216/*! \fn void OContact::setManager( const QString &str ) 216/*! \fn void OContact::setManager( const QString &str )
217 Sets the manager of the contact to \a str. 217 Sets the manager of the contact to \a str.
218*/ 218*/
219 219
220/*! \fn void OContact::setSpouse( const QString &str ) 220/*! \fn void OContact::setSpouse( const QString &str )
221 Sets the spouse of the contact to \a str. 221 Sets the spouse of the contact to \a str.
222*/ 222*/
223 223
224/*! \fn void OContact::setGender( const QString &str ) 224/*! \fn void OContact::setGender( const QString &str )
225 Sets the gender of the contact to \a str. 225 Sets the gender of the contact to \a str.
226*/ 226*/
227 227
228/*! \fn void OContact::setNickname( const QString &str ) 228/*! \fn void OContact::setNickname( const QString &str )
229 Sets the nickname of the contact to \a str. 229 Sets the nickname of the contact to \a str.
230*/ 230*/
231 231
232/*! \fn void OContact::setNotes( const QString &str ) 232/*! \fn void OContact::setNotes( const QString &str )
233 Sets the notes about the contact to \a str. 233 Sets the notes about the contact to \a str.
234*/ 234*/
235 235
236/*! \fn QString OContact::title() const 236/*! \fn QString OContact::title() const
237 Returns the title of the contact. 237 Returns the title of the contact.
238*/ 238*/
239 239
240/*! \fn QString OContact::firstName() const 240/*! \fn QString OContact::firstName() const
241 Returns the first name of the contact. 241 Returns the first name of the contact.
242*/ 242*/
243 243
244/*! \fn QString OContact::middleName() const 244/*! \fn QString OContact::middleName() const
245 Returns the middle name of the contact. 245 Returns the middle name of the contact.
246*/ 246*/
247 247
248/*! \fn QString OContact::lastName() const 248/*! \fn QString OContact::lastName() const
249 Returns the last name of the contact. 249 Returns the last name of the contact.
250*/ 250*/
251 251
252/*! \fn QString OContact::suffix() const 252/*! \fn QString OContact::suffix() const
253 Returns the suffix of the contact. 253 Returns the suffix of the contact.
254*/ 254*/
255 255
256/*! \fn QString OContact::fileAs() const 256/*! \fn QString OContact::fileAs() const
257 Returns the string the contact is filed as. 257 Returns the string the contact is filed as.
258*/ 258*/
259 259
260/*! \fn QString OContact::defaultEmail() const 260/*! \fn QString OContact::defaultEmail() const
261 Returns the default email address of the contact. 261 Returns the default email address of the contact.
262*/ 262*/
263 263
264/*! \fn QString OContact::emails() const 264/*! \fn QString OContact::emails() const
265 Returns the list of email address for a contact separated by ';'s in a single 265 Returns the list of email address for a contact separated by ';'s in a single
266 string. 266 string.
267*/ 267*/
268 268
269/*! \fn QString OContact::homeStreet() const 269/*! \fn QString OContact::homeStreet() const
270 Returns the home street address of the contact. 270 Returns the home street address of the contact.
271*/ 271*/
272 272
273/*! \fn QString OContact::homeCity() const 273/*! \fn QString OContact::homeCity() const
274 Returns the home city of the contact. 274 Returns the home city of the contact.
275*/ 275*/
276 276
277/*! \fn QString OContact::homeState() const 277/*! \fn QString OContact::homeState() const
278 Returns the home state of the contact. 278 Returns the home state of the contact.
279*/ 279*/
280 280
281/*! \fn QString OContact::homeZip() const 281/*! \fn QString OContact::homeZip() const
282 Returns the home zip of the contact. 282 Returns the home zip of the contact.
283*/ 283*/
284 284
285/*! \fn QString OContact::homeCountry() const 285/*! \fn QString OContact::homeCountry() const
286 Returns the home country of the contact. 286 Returns the home country of the contact.
287*/ 287*/
288 288
289/*! \fn QString OContact::homePhone() const 289/*! \fn QString OContact::homePhone() const
290 Returns the home phone number of the contact. 290 Returns the home phone number of the contact.
291*/ 291*/
292 292
293/*! \fn QString OContact::homeFax() const 293/*! \fn QString OContact::homeFax() const
294 Returns the home fax number of the contact. 294 Returns the home fax number of the contact.
295*/ 295*/
296 296
297/*! \fn QString OContact::homeMobile() const 297/*! \fn QString OContact::homeMobile() const
298 Returns the home mobile number of the contact. 298 Returns the home mobile number of the contact.
299*/ 299*/
300 300
301/*! \fn QString OContact::homeWebpage() const 301/*! \fn QString OContact::homeWebpage() const
302 Returns the home webpage of the contact. 302 Returns the home webpage of the contact.
303*/ 303*/
304 304
305/*! \fn QString OContact::company() const 305/*! \fn QString OContact::company() const
306 Returns the company for the contact. 306 Returns the company for the contact.
307*/ 307*/
308 308
309/*! \fn QString OContact::department() const 309/*! \fn QString OContact::department() const
310 Returns the department for the contact. 310 Returns the department for the contact.
311*/ 311*/
312 312
313/*! \fn QString OContact::office() const 313/*! \fn QString OContact::office() const
314 Returns the office for the contact. 314 Returns the office for the contact.
315*/ 315*/
316 316
317/*! \fn QString OContact::jobTitle() const 317/*! \fn QString OContact::jobTitle() const
318 Returns the job title of the contact. 318 Returns the job title of the contact.
319*/ 319*/
320 320
321/*! \fn QString OContact::profession() const 321/*! \fn QString OContact::profession() const
322 Returns the profession of the contact. 322 Returns the profession of the contact.
323*/ 323*/
324 324
325/*! \fn QString OContact::assistant() const 325/*! \fn QString OContact::assistant() const
326 Returns the assistant of the contact. 326 Returns the assistant of the contact.
327*/ 327*/
328 328
329/*! \fn QString OContact::manager() const 329/*! \fn QString OContact::manager() const
330 Returns the manager of the contact. 330 Returns the manager of the contact.
331*/ 331*/
332 332
333/*! \fn QString OContact::businessStreet() const 333/*! \fn QString OContact::businessStreet() const
334 Returns the business street address of the contact. 334 Returns the business street address of the contact.
335*/ 335*/
336 336
337/*! \fn QString OContact::businessCity() const 337/*! \fn QString OContact::businessCity() const
338 Returns the business city of the contact. 338 Returns the business city of the contact.
339*/ 339*/
340 340
341/*! \fn QString OContact::businessState() const 341/*! \fn QString OContact::businessState() const
342 Returns the business state of the contact. 342 Returns the business state of the contact.
343*/ 343*/
344 344
345/*! \fn QString OContact::businessZip() const 345/*! \fn QString OContact::businessZip() const
346 Returns the business zip of the contact. 346 Returns the business zip of the contact.
347*/ 347*/
348 348
349/*! \fn QString OContact::businessCountry() const 349/*! \fn QString OContact::businessCountry() const
350 Returns the business country of the contact. 350 Returns the business country of the contact.
351*/ 351*/
352 352
353/*! \fn QString OContact::businessPhone() const 353/*! \fn QString OContact::businessPhone() const
354 Returns the business phone number of the contact. 354 Returns the business phone number of the contact.
355*/ 355*/
356 356
357/*! \fn QString OContact::businessFax() const 357/*! \fn QString OContact::businessFax() const
358 Returns the business fax number of the contact. 358 Returns the business fax number of the contact.
359*/ 359*/
360 360
361/*! \fn QString OContact::businessMobile() const 361/*! \fn QString OContact::businessMobile() const
362 Returns the business mobile number of the contact. 362 Returns the business mobile number of the contact.
363*/ 363*/
364 364
365/*! \fn QString OContact::businessPager() const 365/*! \fn QString OContact::businessPager() const
366 Returns the business pager number of the contact. 366 Returns the business pager number of the contact.
367*/ 367*/
368 368
369/*! \fn QString OContact::businessWebpage() const 369/*! \fn QString OContact::businessWebpage() const
370 Returns the business webpage of the contact. 370 Returns the business webpage of the contact.
371*/ 371*/
372 372
373/*! \fn QString OContact::spouse() const 373/*! \fn QString OContact::spouse() const
374 Returns the spouse of the contact. 374 Returns the spouse of the contact.
375*/ 375*/
376 376
377/*! \fn QString OContact::gender() const 377/*! \fn QString OContact::gender() const
378 Returns the gender of the contact. 378 Returns the gender of the contact.
379*/ 379*/
380 380
381/*! \fn QString OContact::nickname() const 381/*! \fn QString OContact::nickname() const
382 Returns the nickname of the contact. 382 Returns the nickname of the contact.
383*/ 383*/
384 384
385/*! \fn QString OContact::children() const 385/*! \fn QString OContact::children() const
386 Returns the children of the contact. 386 Returns the children of the contact.
387*/ 387*/
388 388
389/*! \fn QString OContact::notes() const 389/*! \fn QString OContact::notes() const
390 Returns the notes relating to the the contact. 390 Returns the notes relating to the the contact.
391*/ 391*/
392 392
393/*! \fn QString OContact::groups() const 393/*! \fn QString OContact::groups() const
394 \internal 394 \internal
395 Returns the groups for the contact. 395 Returns the groups for the contact.
396*/ 396*/
397 397
398/*! \fn QStringList OContact::groupList() const 398/*! \fn QStringList OContact::groupList() const
399 \internal 399 \internal
400*/ 400*/
401 401
402/*! \fn QString OContact::field(int) const 402/*! \fn QString OContact::field(int) const
403 \internal 403 \internal
404*/ 404*/
405 405
406/*! \fn void OContact::saveJournal( journal_action, const QString & = QString::null ) 406/*! \fn void OContact::saveJournal( journal_action, const QString & = QString::null )
407 \internal 407 \internal
408*/ 408*/
409 409
410/*! \fn void OContact::setUid( int id ) 410/*! \fn void OContact::setUid( int id )
411 \internal 411 \internal
412 Sets the uid for this record to \a id. 412 Sets the uid for this record to \a id.
413*/ 413*/
414 414
415/*! \enum OContact::journal_action 415/*! \enum OContact::journal_action
416 \internal 416 \internal
417*/ 417*/
418 418
419/*! 419/*!
420 \internal 420 \internal
421*/ 421*/
422QMap<int, QString> OContact::toMap() const 422QMap<int, QString> OContact::toMap() const
423{ 423{
424 QMap<int, QString> map = mMap; 424 QMap<int, QString> map = mMap;
425 QString cats = idsToString( categories() ); 425 QString cats = idsToString( categories() );
426 if ( !cats.isEmpty() ) 426 if ( !cats.isEmpty() )
427 map.insert( Qtopia::AddressCategory, cats ); 427 map.insert( Qtopia::AddressCategory, cats );
428 return map; 428 return map;
429} 429}
430 430
431/*! 431/*!
432 Returns a rich text formatted QString representing the contents the contact. 432 Returns a rich text formatted QString representing the contents the contact.
433*/ 433*/
434QString OContact::toRichText() const 434QString OContact::toRichText() const
435{ 435{
436 QString text; 436 QString text;
437 QString value, comp, state; 437 QString value, comp, state;
438 QString str; 438 QString str;
439 bool marker = false; 439 bool marker = false;
440 440
441 // name, jobtitle and company 441 // name, jobtitle and company
442 if ( !(value = fullName()).isEmpty() ) 442 if ( !(value = fullName()).isEmpty() )
443 text += "<b><h3>" + Qtopia::escapeString(value) + "</h3></b><br>"; 443 text += "<b><h3>" + Qtopia::escapeString(value) + "</h3></b><br>";
444 if ( !(value = jobTitle()).isEmpty() ) 444 if ( !(value = jobTitle()).isEmpty() )
445 text += Qtopia::escapeString(value) + "<br>"; 445 text += Qtopia::escapeString(value) + "<br>";
446 446
447 comp = company(); 447 comp = company();
448 if ( !(value = department()).isEmpty() ) { 448 if ( !(value = department()).isEmpty() ) {
449 text += Qtopia::escapeString(value); 449 text += Qtopia::escapeString(value);
450 if ( comp ) 450 if ( comp )
451 text += ", "; 451 text += ", ";
452 else 452 else
453 text += "<br>"; 453 text += "<br>";
454 } 454 }
455 if ( !comp.isEmpty() ) 455 if ( !comp.isEmpty() )
456 text += Qtopia::escapeString(comp) + "<br>"; 456 text += Qtopia::escapeString(comp) + "<br>";
457 457
458 QString defEmail = defaultEmail(); 458 QString defEmail = defaultEmail();
459 if ( !defEmail.isEmpty() ) 459 if ( !defEmail.isEmpty() )
460 text += "<b>" + QObject::tr("Default Email: ") + "</b>" 460 text += "<b>" + QObject::tr("Default Email: ") + "</b>"
461 + Qtopia::escapeString(defEmail) + "<br>"; 461 + Qtopia::escapeString(defEmail) + "<br>";
462 462
463 text += "<hr>"; 463 text += "<hr>";
464 464
465 // business address 465 // business address
466 if ( !businessStreet().isEmpty() || !businessCity().isEmpty() || 466 if ( !businessStreet().isEmpty() || !businessCity().isEmpty() ||
467 !businessZip().isEmpty() || !businessCountry().isEmpty() ) { 467 !businessZip().isEmpty() || !businessCountry().isEmpty() ) {
468 text += "<br>"; 468 text += "<br>";
469 text += QObject::tr( "<b>Work Address:</b>" ); 469 text += QObject::tr( "<b>Work Address:</b>" );
470 text += "<br>"; 470 text += "<br>";
471 marker = true; 471 marker = true;
472 } 472 }
473 473
474 if ( !(value = businessStreet()).isEmpty() ) 474 if ( !(value = businessStreet()).isEmpty() )
475 text += Qtopia::escapeString(value) + "<br>"; 475 text += Qtopia::escapeString(value) + "<br>";
476 state = businessState(); 476 state = businessState();
477 if ( !(value = businessZip()).isEmpty() ) 477 if ( !(value = businessZip()).isEmpty() )
478 text += Qtopia::escapeString(value) + " "; 478 text += Qtopia::escapeString(value) + " ";
479 if ( !(value = businessCity()).isEmpty() ) { 479 if ( !(value = businessCity()).isEmpty() ) {
480 text += Qtopia::escapeString(value); 480 text += Qtopia::escapeString(value);
481 if ( state ) 481 if ( state )
482 text += ", " + Qtopia::escapeString(state); 482 text += ", " + Qtopia::escapeString(state);
483 text += "<br>"; 483 text += "<br>";
484 } else if ( !state.isEmpty() ) 484 } else if ( !state.isEmpty() )
485 text += Qtopia::escapeString(state) + "<br>"; 485 text += Qtopia::escapeString(state) + "<br>";
486 486
487 if ( !(value = businessCountry()).isEmpty() ) 487 if ( !(value = businessCountry()).isEmpty() )
488 text += Qtopia::escapeString(value) + "<br>"; 488 text += Qtopia::escapeString(value) + "<br>";
489 489
490 // rest of Business data 490 // rest of Business data
491 str = office(); 491 str = office();
492 if ( !str.isEmpty() ){ 492 if ( !str.isEmpty() ){
493 text += "<b>" + QObject::tr("Office: ") + "</b>" 493 text += "<b>" + QObject::tr("Office: ") + "</b>"
494 + Qtopia::escapeString(str) + "<br>"; 494 + Qtopia::escapeString(str) + "<br>";
495 marker = true; 495 marker = true;
496 } 496 }
497 str = businessWebpage(); 497 str = businessWebpage();
498 if ( !str.isEmpty() ){ 498 if ( !str.isEmpty() ){
499 text += "<b>" + QObject::tr("Business Web Page: ") + "</b>" 499 text += "<b>" + QObject::tr("Business Web Page: ") + "</b>"
500 + Qtopia::escapeString(str) + "<br>"; 500 + Qtopia::escapeString(str) + "<br>";
501 marker = true; 501 marker = true;
502 } 502 }
503 str = businessPhone(); 503 str = businessPhone();
504 if ( !str.isEmpty() ){ 504 if ( !str.isEmpty() ){
505 text += "<b>" + QObject::tr("Business Phone: ") + "</b>" 505 text += "<b>" + QObject::tr("Business Phone: ") + "</b>"
506 + Qtopia::escapeString(str) + "<br>"; 506 + Qtopia::escapeString(str) + "<br>";
507 marker = true; 507 marker = true;
508 } 508 }
509 str = businessFax(); 509 str = businessFax();
510 if ( !str.isEmpty() ){ 510 if ( !str.isEmpty() ){
511 text += "<b>" + QObject::tr("Business Fax: ") + "</b>" 511 text += "<b>" + QObject::tr("Business Fax: ") + "</b>"
512 + Qtopia::escapeString(str) + "<br>"; 512 + Qtopia::escapeString(str) + "<br>";
513 marker = true; 513 marker = true;
514 } 514 }
515 str = businessMobile(); 515 str = businessMobile();
516 if ( !str.isEmpty() ){ 516 if ( !str.isEmpty() ){
517 text += "<b>" + QObject::tr("Business Mobile: ") + "</b>" 517 text += "<b>" + QObject::tr("Business Mobile: ") + "</b>"
518 + Qtopia::escapeString(str) + "<br>"; 518 + Qtopia::escapeString(str) + "<br>";
519 marker = true; 519 marker = true;
520 } 520 }
521 str = businessPager(); 521 str = businessPager();
522 if ( !str.isEmpty() ){ 522 if ( !str.isEmpty() ){
523 text += "<b>" + QObject::tr("Business Pager: ") + "</b>" 523 text += "<b>" + QObject::tr("Business Pager: ") + "</b>"
524 + Qtopia::escapeString(str) + "<br>"; 524 + Qtopia::escapeString(str) + "<br>";
525 marker = true; 525 marker = true;
526 } 526 }
527 527
528 // home address 528 // home address
529 if ( !homeStreet().isEmpty() || !homeCity().isEmpty() || 529 if ( !homeStreet().isEmpty() || !homeCity().isEmpty() ||
530 !homeZip().isEmpty() || !homeCountry().isEmpty() ) { 530 !homeZip().isEmpty() || !homeCountry().isEmpty() ) {
531 text += "<br>"; 531 text += "<br>";
532 text += QObject::tr( "<b>Home Address:</b>" ); 532 text += QObject::tr( "<b>Home Address:</b>" );
533 text += "<br>"; 533 text += "<br>";
534 } 534 }
535 535
536 if ( !(value = homeStreet()).isEmpty() ) 536 if ( !(value = homeStreet()).isEmpty() )
537 text += Qtopia::escapeString(value) + "<br>"; 537 text += Qtopia::escapeString(value) + "<br>";
538 state = homeState(); 538 state = homeState();
539 if ( !(value = homeZip()).isEmpty() ) 539 if ( !(value = homeZip()).isEmpty() )
540 text += Qtopia::escapeString(value) + " "; 540 text += Qtopia::escapeString(value) + " ";
541 if ( !(value = homeCity()).isEmpty() ) { 541 if ( !(value = homeCity()).isEmpty() ) {
542 text += Qtopia::escapeString(value); 542 text += Qtopia::escapeString(value);
543 if ( !state.isEmpty() ) 543 if ( !state.isEmpty() )
544 text += ", " + Qtopia::escapeString(state); 544 text += ", " + Qtopia::escapeString(state);
545 text += "<br>"; 545 text += "<br>";
546 } else if (!state.isEmpty()) 546 } else if (!state.isEmpty())
547 text += Qtopia::escapeString(state) + "<br>"; 547 text += Qtopia::escapeString(state) + "<br>";
548 if ( !(value = homeCountry()).isEmpty() ) 548 if ( !(value = homeCountry()).isEmpty() )
549 text += Qtopia::escapeString(value) + "<br>"; 549 text += Qtopia::escapeString(value) + "<br>";
550 550
551 // rest of Home data 551 // rest of Home data
552 str = homeWebpage(); 552 str = homeWebpage();
553 if ( !str.isEmpty() ){ 553 if ( !str.isEmpty() ){
554 text += "<b>" + QObject::tr("Home Web Page: ") + "</b>" 554 text += "<b>" + QObject::tr("Home Web Page: ") + "</b>"
555 + Qtopia::escapeString(str) + "<br>"; 555 + Qtopia::escapeString(str) + "<br>";
556 marker = true; 556 marker = true;
557 } 557 }
558 str = homePhone(); 558 str = homePhone();
559 if ( !str.isEmpty() ){ 559 if ( !str.isEmpty() ){
560 text += "<b>" + QObject::tr("Home Phone: ") + "</b>" 560 text += "<b>" + QObject::tr("Home Phone: ") + "</b>"
561 + Qtopia::escapeString(str) + "<br>"; 561 + Qtopia::escapeString(str) + "<br>";
562 marker = true; 562 marker = true;
563 } 563 }
564 str = homeFax(); 564 str = homeFax();
565 if ( !str.isEmpty() ){ 565 if ( !str.isEmpty() ){
566 text += "<b>" + QObject::tr("Home Fax: ") + "</b>" 566 text += "<b>" + QObject::tr("Home Fax: ") + "</b>"
567 + Qtopia::escapeString(str) + "<br>"; 567 + Qtopia::escapeString(str) + "<br>";
568 marker = true; 568 marker = true;
569 } 569 }
570 str = homeMobile(); 570 str = homeMobile();
571 if ( !str.isEmpty() ){ 571 if ( !str.isEmpty() ){
572 text += "<b>" + QObject::tr("Home Mobile: ") + "</b>" 572 text += "<b>" + QObject::tr("Home Mobile: ") + "</b>"
573 + Qtopia::escapeString(str) + "<br>"; 573 + Qtopia::escapeString(str) + "<br>";
574 marker = true; 574 marker = true;
575 } 575 }
576 576
577 if ( marker ) 577 if ( marker )
578 text += "<br><hr><br>"; 578 text += "<br><hr><br>";
579 // the others... 579 // the others...
580 str = emails(); 580 str = emails();
581 if ( !str.isEmpty() && ( str != defEmail ) ) 581 if ( !str.isEmpty() && ( str != defEmail ) )
582 text += "<b>" + QObject::tr("All Emails: ") + "</b>" 582 text += "<b>" + QObject::tr("All Emails: ") + "</b>"
583 + Qtopia::escapeString(str) + "<br>"; 583 + Qtopia::escapeString(str) + "<br>";
584 str = profession(); 584 str = profession();
585 if ( !str.isEmpty() ) 585 if ( !str.isEmpty() )
586 text += "<b>" + QObject::tr("Profession: ") + "</b>" 586 text += "<b>" + QObject::tr("Profession: ") + "</b>"
587 + Qtopia::escapeString(str) + "<br>"; 587 + Qtopia::escapeString(str) + "<br>";
588 str = assistant(); 588 str = assistant();
589 if ( !str.isEmpty() ) 589 if ( !str.isEmpty() )
590 text += "<b>" + QObject::tr("Assistant: ") + "</b>" 590 text += "<b>" + QObject::tr("Assistant: ") + "</b>"
591 + Qtopia::escapeString(str) + "<br>"; 591 + Qtopia::escapeString(str) + "<br>";
592 str = manager(); 592 str = manager();
593 if ( !str.isEmpty() ) 593 if ( !str.isEmpty() )
594 text += "<b>" + QObject::tr("Manager: ") + "</b>" 594 text += "<b>" + QObject::tr("Manager: ") + "</b>"
595 + Qtopia::escapeString(str) + "<br>"; 595 + Qtopia::escapeString(str) + "<br>";
596 str = gender(); 596 str = gender();
597 if ( !str.isEmpty() && str.toInt() != 0 ) { 597 if ( !str.isEmpty() && str.toInt() != 0 ) {
598 if ( str.toInt() == 1 ) 598 if ( str.toInt() == 1 )
599 str = QObject::tr( "Male" ); 599 str = QObject::tr( "Male" );
600 else if ( str.toInt() == 2 ) 600 else if ( str.toInt() == 2 )
601 str = QObject::tr( "Female" ); 601 str = QObject::tr( "Female" );
602 text += "<b>" + QObject::tr("Gender: ") + "</b>" + str + "<br>"; 602 text += "<b>" + QObject::tr("Gender: ") + "</b>" + str + "<br>";
603 } 603 }
604 str = spouse(); 604 str = spouse();
605 if ( !str.isEmpty() ) 605 if ( !str.isEmpty() )
606 text += "<b>" + QObject::tr("Spouse: ") + "</b>" 606 text += "<b>" + QObject::tr("Spouse: ") + "</b>"
607 + Qtopia::escapeString(str) + "<br>"; 607 + Qtopia::escapeString(str) + "<br>";
608 if ( birthday().isValid() ){ 608 if ( birthday().isValid() ){
609 str = TimeString::numberDateString( birthday() ); 609 str = TimeString::numberDateString( birthday() );
610 text += "<b>" + QObject::tr("Birthday: ") + "</b>" 610 text += "<b>" + QObject::tr("Birthday: ") + "</b>"
611 + Qtopia::escapeString(str) + "<br>"; 611 + Qtopia::escapeString(str) + "<br>";
612 } 612 }
613 if ( anniversary().isValid() ){ 613 if ( anniversary().isValid() ){
614 str = TimeString::numberDateString( anniversary() ); 614 str = TimeString::numberDateString( anniversary() );
615 text += "<b>" + QObject::tr("Anniversary: ") + "</b>" 615 text += "<b>" + QObject::tr("Anniversary: ") + "</b>"
616 + Qtopia::escapeString(str) + "<br>"; 616 + Qtopia::escapeString(str) + "<br>";
617 } 617 }
618 str = children(); 618 str = children();
619 if ( !str.isEmpty() ) 619 if ( !str.isEmpty() )
620 text += "<b>" + QObject::tr("Children: ") + "</b>" 620 text += "<b>" + QObject::tr("Children: ") + "</b>"
621 + Qtopia::escapeString(str) + "<br>"; 621 + Qtopia::escapeString(str) + "<br>";
622 622
623 str = nickname(); 623 str = nickname();
624 if ( !str.isEmpty() ) 624 if ( !str.isEmpty() )
625 text += "<b>" + QObject::tr("Nickname: ") + "</b>" 625 text += "<b>" + QObject::tr("Nickname: ") + "</b>"
626 + Qtopia::escapeString(str) + "<br>"; 626 + Qtopia::escapeString(str) + "<br>";
627 627
628 if ( categoryNames("Contacts").count() ){ 628 if ( categoryNames("Contacts").count() ){
629 text += "<b>" + QObject::tr( "Category:") + "</b> "; 629 text += "<b>" + QObject::tr( "Category:") + "</b> ";
630 text += categoryNames("Contacts").join(", "); 630 text += categoryNames("Contacts").join(", ");
631 text += "<br>"; 631 text += "<br>";
632 } 632 }
633 633
634 // notes last 634 // notes last
635 if ( !(value = notes()).isEmpty() ) { 635 if ( !(value = notes()).isEmpty() ) {
636 text += "<br><hr><b>" + QObject::tr( "Notes:") + "</b> "; 636 text += "<br><hr><b>" + QObject::tr( "Notes:") + "</b> ";
637 QRegExp reg("\n"); 637 QRegExp reg("\n");
638 638
639 //QString tmp = Qtopia::escapeString(value); 639 //QString tmp = Qtopia::escapeString(value);
640 QString tmp = QStyleSheet::convertFromPlainText(value); 640 QString tmp = QStyleSheet::convertFromPlainText(value);
641 //tmp.replace( reg, "<br>" ); 641 //tmp.replace( reg, "<br>" );
642 text += "<br>" + tmp + "<br>"; 642 text += "<br>" + tmp + "<br>";
643 } 643 }
644 return text; 644 return text;
645} 645}
646 646
647/*! 647/*!
648 \internal 648 \internal
649*/ 649*/
650void OContact::insert( int key, const QString &v ) 650void OContact::insert( int key, const QString &v )
651{ 651{
652 QString value = v.stripWhiteSpace(); 652 QString value = v.stripWhiteSpace();
653 if ( value.isEmpty() ) 653 if ( value.isEmpty() )
654 mMap.remove( key ); 654 mMap.remove( key );
655 else 655 else
656 mMap.insert( key, value ); 656 mMap.insert( key, value );
657} 657}
658 658
659/*! 659/*!
660 \internal 660 \internal
661*/ 661*/
662void OContact::replace( int key, const QString & v ) 662void OContact::replace( int key, const QString & v )
663{ 663{
664 QString value = v.stripWhiteSpace(); 664 QString value = v.stripWhiteSpace();
665 if ( value.isEmpty() ) 665 if ( value.isEmpty() )
666 mMap.remove( key ); 666 mMap.remove( key );
667 else 667 else
668 mMap.replace( key, value ); 668 mMap.replace( key, value );
669} 669}
670 670
671/*! 671/*!
672 \internal 672 \internal
673*/ 673*/
674QString OContact::find( int key ) const 674QString OContact::find( int key ) const
675{ 675{
676 return mMap[key]; 676 return mMap[key];
677} 677}
678 678
679/*! 679/*!
680 \internal 680 \internal
681*/ 681*/
682QString OContact::displayAddress( const QString &street, 682QString OContact::displayAddress( const QString &street,
683 const QString &city, 683 const QString &city,
684 const QString &state, 684 const QString &state,
685 const QString &zip, 685 const QString &zip,
686 const QString &country ) const 686 const QString &country ) const
687{ 687{
688 QString s = street; 688 QString s = street;
689 if ( !street.isEmpty() ) 689 if ( !street.isEmpty() )
690 s+= "\n"; 690 s+= "\n";
691 s += city; 691 s += city;
692 if ( !city.isEmpty() && !state.isEmpty() ) 692 if ( !city.isEmpty() && !state.isEmpty() )
693 s += ", "; 693 s += ", ";
694 s += state; 694 s += state;
695 if ( !state.isEmpty() && !zip.isEmpty() ) 695 if ( !state.isEmpty() && !zip.isEmpty() )
696 s += " "; 696 s += " ";
697 s += zip; 697 s += zip;
698 if ( !country.isEmpty() && !s.isEmpty() ) 698 if ( !country.isEmpty() && !s.isEmpty() )
699 s += "\n"; 699 s += "\n";
700 s += country; 700 s += country;
701 return s; 701 return s;
702} 702}
703 703
704/*! 704/*!
705 \internal 705 \internal
706*/ 706*/
707QString OContact::displayBusinessAddress() const 707QString OContact::displayBusinessAddress() const
708{ 708{
709 return displayAddress( businessStreet(), businessCity(), 709 return displayAddress( businessStreet(), businessCity(),
710 businessState(), businessZip(), 710 businessState(), businessZip(),
711 businessCountry() ); 711 businessCountry() );
712} 712}
713 713
714/*! 714/*!
715 \internal 715 \internal
716*/ 716*/
717QString OContact::displayHomeAddress() const 717QString OContact::displayHomeAddress() const
718{ 718{
719 return displayAddress( homeStreet(), homeCity(), 719 return displayAddress( homeStreet(), homeCity(),
720 homeState(), homeZip(), 720 homeState(), homeZip(),
721 homeCountry() ); 721 homeCountry() );
722} 722}
723 723
724/*! 724/*!
725 Returns the full name of the contact 725 Returns the full name of the contact
726*/ 726*/
727QString OContact::fullName() const 727QString OContact::fullName() const
728{ 728{
729 QString title = find( Qtopia::Title ); 729 QString title = find( Qtopia::Title );
730 QString firstName = find( Qtopia::FirstName ); 730 QString firstName = find( Qtopia::FirstName );
731 QString middleName = find( Qtopia::MiddleName ); 731 QString middleName = find( Qtopia::MiddleName );
732 QString lastName = find( Qtopia::LastName ); 732 QString lastName = find( Qtopia::LastName );
733 QString suffix = find( Qtopia::Suffix ); 733 QString suffix = find( Qtopia::Suffix );
734 734
735 QString name = title; 735 QString name = title;
736 if ( !firstName.isEmpty() ) { 736 if ( !firstName.isEmpty() ) {
737 if ( !name.isEmpty() ) 737 if ( !name.isEmpty() )
738 name += " "; 738 name += " ";
739 name += firstName; 739 name += firstName;
740 } 740 }
741 if ( !middleName.isEmpty() ) { 741 if ( !middleName.isEmpty() ) {
742 if ( !name.isEmpty() ) 742 if ( !name.isEmpty() )
743 name += " "; 743 name += " ";
744 name += middleName; 744 name += middleName;
745 } 745 }
746 if ( !lastName.isEmpty() ) { 746 if ( !lastName.isEmpty() ) {
747 if ( !name.isEmpty() ) 747 if ( !name.isEmpty() )
748 name += " "; 748 name += " ";
749 name += lastName; 749 name += lastName;
750 } 750 }
751 if ( !suffix.isEmpty() ) { 751 if ( !suffix.isEmpty() ) {
752 if ( !name.isEmpty() ) 752 if ( !name.isEmpty() )
753 name += " "; 753 name += " ";
754 name += suffix; 754 name += suffix;
755 } 755 }
756 return name.simplifyWhiteSpace(); 756 return name.simplifyWhiteSpace();
757} 757}
758 758
759/*! 759/*!
760 Returns a list of the names of the children of the contact. 760 Returns a list of the names of the children of the contact.
761*/ 761*/
762QStringList OContact::childrenList() const 762QStringList OContact::childrenList() const
763{ 763{
764 return QStringList::split( " ", find( Qtopia::Children ) ); 764 return QStringList::split( " ", find( Qtopia::Children ) );
765} 765}
766 766
767/*! \fn void OContact::insertEmail( const QString &email ) 767/*! \fn void OContact::insertEmail( const QString &email )
768 768
769 Insert \a email into the email list. Ensures \a email can only be added 769 Insert \a email into the email list. Ensures \a email can only be added
770 once. If there is no default email address set, it sets it to the \a email. 770 once. If there is no default email address set, it sets it to the \a email.
771*/ 771*/
772 772
773/*! \fn void OContact::removeEmail( const QString &email ) 773/*! \fn void OContact::removeEmail( const QString &email )
774 774
775 Removes the \a email from the email list. If the default email was \a email, 775 Removes the \a email from the email list. If the default email was \a email,
776 then the default email address is assigned to the first email in the 776 then the default email address is assigned to the first email in the
777 email list 777 email list
778*/ 778*/
779 779
780/*! \fn void OContact::clearEmails() 780/*! \fn void OContact::clearEmails()
781 781
782 Clears the email list. 782 Clears the email list.
783 */ 783 */
784 784
785/*! \fn void OContact::insertEmails( const QStringList &emailList ) 785/*! \fn void OContact::insertEmails( const QStringList &emailList )
786 786
787 Appends the \a emailList to the exiting email list 787 Appends the \a emailList to the exiting email list
788 */ 788 */
789 789
790/*! 790/*!
791 Returns a list of email addresses belonging to the contact, including 791 Returns a list of email addresses belonging to the contact, including
792 the default email address. 792 the default email address.
793*/ 793*/
794QStringList OContact::emailList() const 794QStringList OContact::emailList() const
795{ 795{
796 QString emailStr = emails(); 796 QString emailStr = emails();
797 797
798 QStringList r; 798 QStringList r;
799 if ( !emailStr.isEmpty() ) { 799 if ( !emailStr.isEmpty() ) {
800 qDebug(" emailstr "); 800 qDebug(" emailstr ");
801 QStringList l = QStringList::split( emailSeparator(), emailStr ); 801 QStringList l = QStringList::split( emailSeparator(), emailStr );
802 for ( QStringList::ConstIterator it = l.begin();it != l.end();++it ) 802 for ( QStringList::ConstIterator it = l.begin();it != l.end();++it )
803 r += (*it).simplifyWhiteSpace(); 803 r += (*it).simplifyWhiteSpace();
804 } 804 }
805 805
806 return r; 806 return r;
807} 807}
808 808
809/*! 809/*!
810 \overload 810 \overload
811 811
812 Generates the string for the contact to be filed as from the first, 812 Generates the string for the contact to be filed as from the first,
813 middle and last name of the contact. 813 middle and last name of the contact.
814*/ 814*/
815void OContact::setFileAs() 815void OContact::setFileAs()
816{ 816{
817 QString lastName, firstName, middleName, fileas; 817 QString lastName, firstName, middleName, fileas;
818 818
819 lastName = find( Qtopia::LastName ); 819 lastName = find( Qtopia::LastName );
820 firstName = find( Qtopia::FirstName ); 820 firstName = find( Qtopia::FirstName );
821 middleName = find( Qtopia::MiddleName ); 821 middleName = find( Qtopia::MiddleName );
822 if ( !lastName.isEmpty() && !firstName.isEmpty() 822 if ( !lastName.isEmpty() && !firstName.isEmpty()
823 && !middleName.isEmpty() ) 823 && !middleName.isEmpty() )
824 fileas = lastName + ", " + firstName + " " + middleName; 824 fileas = lastName + ", " + firstName + " " + middleName;
825 else if ( !lastName.isEmpty() && !firstName.isEmpty() ) 825 else if ( !lastName.isEmpty() && !firstName.isEmpty() )
826 fileas = lastName + ", " + firstName; 826 fileas = lastName + ", " + firstName;
827 else if ( !lastName.isEmpty() || !firstName.isEmpty() || 827 else if ( !lastName.isEmpty() || !firstName.isEmpty() ||
828 !middleName.isEmpty() ) 828 !middleName.isEmpty() )
829 fileas = firstName + ( firstName.isEmpty() ? "" : " " ) 829 fileas = firstName + ( firstName.isEmpty() ? "" : " " )
830 + middleName + ( middleName.isEmpty() ? "" : " " ) 830 + middleName + ( middleName.isEmpty() ? "" : " " )
831 + lastName; 831 + lastName;
832 832
833 replace( Qtopia::FileAs, fileas ); 833 replace( Qtopia::FileAs, fileas );
834} 834}
835 835
836/*! 836/*!
837 \internal 837 \internal
838 Appends the contact information to \a buf. 838 Appends the contact information to \a buf.
839*/ 839*/
840void OContact::save( QString &buf ) const 840void OContact::save( QString &buf ) const
841{ 841{
842 static const QStringList SLFIELDS = fields(); 842 static const QStringList SLFIELDS = fields();
843 // I'm expecting "<Contact " in front of this... 843 // I'm expecting "<Contact " in front of this...
844 for ( QMap<int, QString>::ConstIterator it = mMap.begin(); 844 for ( QMap<int, QString>::ConstIterator it = mMap.begin();
845 it != mMap.end(); ++it ) { 845 it != mMap.end(); ++it ) {
846 const QString &value = it.data(); 846 const QString &value = it.data();
847 int key = it.key(); 847 int key = it.key();
848 if ( !value.isEmpty() ) { 848 if ( !value.isEmpty() ) {
849 if ( key == Qtopia::AddressCategory || key == Qtopia::AddressUid) 849 if ( key == Qtopia::AddressCategory || key == Qtopia::AddressUid)
850 continue; 850 continue;
851 851
852 key -= Qtopia::AddressCategory+1; 852 key -= Qtopia::AddressCategory+1;
853 buf += SLFIELDS[key]; 853 buf += SLFIELDS[key];
854 buf += "=\"" + Qtopia::escapeString(value) + "\" "; 854 buf += "=\"" + Qtopia::escapeString(value) + "\" ";
855 } 855 }
856 } 856 }
857 buf += customToXml(); 857 buf += customToXml();
858 if ( categories().count() > 0 ) 858 if ( categories().count() > 0 )
859 buf += "Categories=\"" + idsToString( categories() ) + "\" "; 859 buf += "Categories=\"" + idsToString( categories() ) + "\" ";
860 buf += "Uid=\"" + QString::number( uid() ) + "\" "; 860 buf += "Uid=\"" + QString::number( uid() ) + "\" ";
861 // You need to close this yourself 861 // You need to close this yourself
862} 862}
863 863
864 864
865/*! 865/*!
866 \internal 866 \internal
867 Returns the list of fields belonging to a contact 867 Returns the list of fields belonging to a contact
868 Never change order of this list ! It has to be regarding 868 Never change order of this list ! It has to be regarding
869 enum AddressBookFields !! 869 enum AddressBookFields !!
870*/ 870*/
871QStringList OContact::fields() 871QStringList OContact::fields()
872{ 872{
873 QStringList list; 873 QStringList list;
874 874
875 list.append( "Title" ); // Not Used! 875 list.append( "Title" ); // Not Used!
876 list.append( "FirstName" ); 876 list.append( "FirstName" );
877 list.append( "MiddleName" ); 877 list.append( "MiddleName" );
878 list.append( "LastName" ); 878 list.append( "LastName" );
879 list.append( "Suffix" ); 879 list.append( "Suffix" );
880 list.append( "FileAs" ); 880 list.append( "FileAs" );
881 881
882 list.append( "JobTitle" ); 882 list.append( "JobTitle" );
883 list.append( "Department" ); 883 list.append( "Department" );
884 list.append( "Company" ); 884 list.append( "Company" );
885 list.append( "BusinessPhone" ); 885 list.append( "BusinessPhone" );
886 list.append( "BusinessFax" ); 886 list.append( "BusinessFax" );
887 list.append( "BusinessMobile" ); 887 list.append( "BusinessMobile" );
888 888
889 list.append( "DefaultEmail" ); 889 list.append( "DefaultEmail" );
890 list.append( "Emails" ); 890 list.append( "Emails" );
891 891
892 list.append( "HomePhone" ); 892 list.append( "HomePhone" );
893 list.append( "HomeFax" ); 893 list.append( "HomeFax" );
894 list.append( "HomeMobile" ); 894 list.append( "HomeMobile" );
895 895
896 list.append( "BusinessStreet" ); 896 list.append( "BusinessStreet" );
897 list.append( "BusinessCity" ); 897 list.append( "BusinessCity" );
898 list.append( "BusinessState" ); 898 list.append( "BusinessState" );
899 list.append( "BusinessZip" ); 899 list.append( "BusinessZip" );
900 list.append( "BusinessCountry" ); 900 list.append( "BusinessCountry" );
901 list.append( "BusinessPager" ); 901 list.append( "BusinessPager" );
902 list.append( "BusinessWebPage" ); 902 list.append( "BusinessWebPage" );
903 903
904 list.append( "Office" ); 904 list.append( "Office" );
905 list.append( "Profession" ); 905 list.append( "Profession" );
906 list.append( "Assistant" ); 906 list.append( "Assistant" );
907 list.append( "Manager" ); 907 list.append( "Manager" );
908 908
909 list.append( "HomeStreet" ); 909 list.append( "HomeStreet" );
910 list.append( "HomeCity" ); 910 list.append( "HomeCity" );
911 list.append( "HomeState" ); 911 list.append( "HomeState" );
912 list.append( "HomeZip" ); 912 list.append( "HomeZip" );
913 list.append( "HomeCountry" ); 913 list.append( "HomeCountry" );
914 list.append( "HomeWebPage" ); 914 list.append( "HomeWebPage" );
915 915
916 list.append( "Spouse" ); 916 list.append( "Spouse" );
917 list.append( "Gender" ); 917 list.append( "Gender" );
918 list.append( "Birthday" ); 918 list.append( "Birthday" );
919 list.append( "Anniversary" ); 919 list.append( "Anniversary" );
920 list.append( "Nickname" ); 920 list.append( "Nickname" );
921 list.append( "Children" ); 921 list.append( "Children" );
922 922
923 list.append( "Notes" ); 923 list.append( "Notes" );
924 list.append( "Groups" ); 924 list.append( "Groups" );
925 925
926 return list; 926 return list;
927} 927}
928 928
929 929
930/*! 930/*!
931 Sets the list of email address for contact to those contained in \a str. 931 Sets the list of email address for contact to those contained in \a str.
932 Email address should be separated by ';'s. 932 Email address should be separated by ';'s.
933*/ 933*/
934void OContact::setEmails( const QString &str ) 934void OContact::setEmails( const QString &str )
935{ 935{
936 replace( Qtopia::Emails, str ); 936 replace( Qtopia::Emails, str );
937 if ( str.isEmpty() ) 937 if ( str.isEmpty() )
938 setDefaultEmail( QString::null ); 938 setDefaultEmail( QString::null );
939} 939}
940 940
941/*! 941/*!
942 Sets the list of children for the contact to those contained in \a str. 942 Sets the list of children for the contact to those contained in \a str.
943*/ 943*/
944void OContact::setChildren( const QString &str ) 944void OContact::setChildren( const QString &str )
945{ 945{
946 replace( Qtopia::Children, str ); 946 replace( Qtopia::Children, str );
947} 947}
948 948
949/*! 949/*!
950 \overload 950 \overload
951 Returns TRUE if the contact matches the regular expression \a regexp. 951 Returns TRUE if the contact matches the regular expression \a regexp.
952 Otherwise returns FALSE. 952 Otherwise returns FALSE.
953*/ 953*/
954bool OContact::match( const QRegExp &r ) const 954bool OContact::match( const QRegExp &r ) const
955{ 955{
956 bool match; 956 bool match;
957 match = false; 957 match = false;
958 QMap<int, QString>::ConstIterator it; 958 QMap<int, QString>::ConstIterator it;
959 for ( it = mMap.begin(); it != mMap.end(); ++it ) { 959 for ( it = mMap.begin(); it != mMap.end(); ++it ) {
960 if ( (*it).find( r ) > -1 ) { 960 if ( (*it).find( r ) > -1 ) {
961 setLastHitField( it.key() );
961 match = true; 962 match = true;
962 break; 963 break;
963 } 964 }
964 } 965 }
965 return match; 966 return match;
966} 967}
967 968
968 969
969QString OContact::toShortText() const 970QString OContact::toShortText() const
970{ 971{
971 return ( fullName() ); 972 return ( fullName() );
972} 973}
973QString OContact::type() const 974QString OContact::type() const
974{ 975{
975 return QString::fromLatin1( "OContact" ); 976 return QString::fromLatin1( "OContact" );
976} 977}
977 978
978// Definition is missing ! (se) 979// Definition is missing ! (se)
979QMap<QString,QString> OContact::toExtraMap() const 980QMap<QString,QString> OContact::toExtraMap() const
980{ 981{
981 qWarning ("Function not implemented: OContact::toExtraMap()"); 982 qWarning ("Function not implemented: OContact::toExtraMap()");
982 QMap <QString,QString> useless; 983 QMap <QString,QString> useless;
983 return useless; 984 return useless;
984} 985}
985 986
986class QString OContact::recordField( int pos ) const 987class QString OContact::recordField( int pos ) const
987{ 988{
988 QStringList SLFIELDS = fields(); // ?? why this ? (se) 989 QStringList SLFIELDS = fields(); // ?? why this ? (se)
989 return SLFIELDS[pos]; 990 return SLFIELDS[pos];
990} 991}
991 992
992// In future releases, we should store birthday and anniversary 993// In future releases, we should store birthday and anniversary
993// internally as QDate instead of QString ! 994// internally as QDate instead of QString !
994// QString is always too complicate to interprete (DD.MM.YY, DD/MM/YY, MM/DD/YY, etc..)(se) 995// QString is always too complicate to interprete (DD.MM.YY, DD/MM/YY, MM/DD/YY, etc..)(se)
995 996
996/*! \fn void OContact::setBirthday( const QDate& date ) 997/*! \fn void OContact::setBirthday( const QDate& date )
997 Sets the birthday for the contact to \a date. If date is null 998 Sets the birthday for the contact to \a date. If date is null
998 the current stored date will be removed. 999 the current stored date will be removed.
999*/ 1000*/
1000void OContact::setBirthday( const QDate &v ) 1001void OContact::setBirthday( const QDate &v )
1001{ 1002{
1002 if ( v.isNull() ){ 1003 if ( v.isNull() ){
1003 qWarning( "Remove Birthday"); 1004 qWarning( "Remove Birthday");
1004 replace( Qtopia::Birthday, QString::null ); 1005 replace( Qtopia::Birthday, QString::null );
1005 return; 1006 return;
1006 } 1007 }
1007 1008
1008 if ( v.isValid() ) 1009 if ( v.isValid() )
1009 replace( Qtopia::Birthday, OConversion::dateToString( v ) ); 1010 replace( Qtopia::Birthday, OConversion::dateToString( v ) );
1010 1011
1011} 1012}
1012 1013
1013 1014
1014/*! \fn void OContact::setAnniversary( const QDate &date ) 1015/*! \fn void OContact::setAnniversary( const QDate &date )
1015 Sets the anniversary of the contact to \a date. If date is 1016 Sets the anniversary of the contact to \a date. If date is
1016 null, the current stored date will be removed. 1017 null, the current stored date will be removed.
1017*/ 1018*/
1018void OContact::setAnniversary( const QDate &v ) 1019void OContact::setAnniversary( const QDate &v )
1019{ 1020{
1020 if ( v.isNull() ){ 1021 if ( v.isNull() ){
1021 qWarning( "Remove Anniversary"); 1022 qWarning( "Remove Anniversary");
1022 replace( Qtopia::Anniversary, QString::null ); 1023 replace( Qtopia::Anniversary, QString::null );
1023 return; 1024 return;
1024 } 1025 }
1025 1026
1026 if ( v.isValid() ) 1027 if ( v.isValid() )
1027 replace( Qtopia::Anniversary, OConversion::dateToString( v ) ); 1028 replace( Qtopia::Anniversary, OConversion::dateToString( v ) );
1028} 1029}
1029 1030
1030/*! \fn QDate OContact::birthday() const 1031/*! \fn QDate OContact::birthday() const
1031 Returns the birthday of the contact. 1032 Returns the birthday of the contact.
1032*/ 1033*/
1033QDate OContact::birthday() const 1034QDate OContact::birthday() const
1034{ 1035{
1035 QString str = find( Qtopia::Birthday ); 1036 QString str = find( Qtopia::Birthday );
1036 qWarning ("Birthday %s", str.latin1() ); 1037 qWarning ("Birthday %s", str.latin1() );
1037 if ( !str.isEmpty() ) 1038 if ( !str.isEmpty() )
1038 return OConversion::dateFromString ( str ); 1039 return OConversion::dateFromString ( str );
1039 else 1040 else
1040 return QDate(); 1041 return QDate();
1041} 1042}
1042 1043
1043 1044
1044/*! \fn QDate OContact::anniversary() const 1045/*! \fn QDate OContact::anniversary() const
1045 Returns the anniversary of the contact. 1046 Returns the anniversary of the contact.
1046*/ 1047*/
1047QDate OContact::anniversary() const 1048QDate OContact::anniversary() const
1048{ 1049{
1049 QDate empty; 1050 QDate empty;
1050 QString str = find( Qtopia::Anniversary ); 1051 QString str = find( Qtopia::Anniversary );
1051 qWarning ("Anniversary %s", str.latin1() ); 1052 qWarning ("Anniversary %s", str.latin1() );
1052 if ( !str.isEmpty() ) 1053 if ( !str.isEmpty() )
1053 return OConversion::dateFromString ( str ); 1054 return OConversion::dateFromString ( str );
1054 else 1055 else
1055 return empty; 1056 return empty;
1056} 1057}
1057 1058
1058 1059
1059void OContact::insertEmail( const QString &v ) 1060void OContact::insertEmail( const QString &v )
1060{ 1061{
1061 //qDebug("insertEmail %s", v.latin1()); 1062 //qDebug("insertEmail %s", v.latin1());
1062 QString e = v.simplifyWhiteSpace(); 1063 QString e = v.simplifyWhiteSpace();
1063 QString def = defaultEmail(); 1064 QString def = defaultEmail();
1064 1065
1065 // if no default, set it as the default email and don't insert 1066 // if no default, set it as the default email and don't insert
1066 if ( def.isEmpty() ) { 1067 if ( def.isEmpty() ) {
1067 setDefaultEmail( e ); // will insert into the list for us 1068 setDefaultEmail( e ); // will insert into the list for us
1068 return; 1069 return;
1069 } 1070 }
1070 1071
1071 // otherwise, insert assuming doesn't already exist 1072 // otherwise, insert assuming doesn't already exist
1072 QString emailsStr = find( Qtopia::Emails ); 1073 QString emailsStr = find( Qtopia::Emails );
1073 if ( emailsStr.contains( e )) 1074 if ( emailsStr.contains( e ))
1074 return; 1075 return;
1075 if ( !emailsStr.isEmpty() ) 1076 if ( !emailsStr.isEmpty() )
1076 emailsStr += emailSeparator(); 1077 emailsStr += emailSeparator();
1077 emailsStr += e; 1078 emailsStr += e;
1078 replace( Qtopia::Emails, emailsStr ); 1079 replace( Qtopia::Emails, emailsStr );
1079} 1080}
1080 1081
1081void OContact::removeEmail( const QString &v ) 1082void OContact::removeEmail( const QString &v )
1082{ 1083{
1083 QString e = v.simplifyWhiteSpace(); 1084 QString e = v.simplifyWhiteSpace();
1084 QString def = defaultEmail(); 1085 QString def = defaultEmail();
1085 QString emailsStr = find( Qtopia::Emails ); 1086 QString emailsStr = find( Qtopia::Emails );
1086 QStringList emails = emailList(); 1087 QStringList emails = emailList();
1087 1088
1088 // otherwise, must first contain it 1089 // otherwise, must first contain it
1089 if ( !emailsStr.contains( e ) ) 1090 if ( !emailsStr.contains( e ) )
1090 return; 1091 return;
1091 1092
1092 // remove it 1093 // remove it
1093 //qDebug(" removing email from list %s", e.latin1()); 1094 //qDebug(" removing email from list %s", e.latin1());
1094 emails.remove( e ); 1095 emails.remove( e );
1095 // reset the string 1096 // reset the string
1096 emailsStr = emails.join(emailSeparator()); // Sharp's brain dead separator 1097 emailsStr = emails.join(emailSeparator()); // Sharp's brain dead separator
1097 replace( Qtopia::Emails, emailsStr ); 1098 replace( Qtopia::Emails, emailsStr );
1098 1099
1099 // if default, then replace the default email with the first one 1100 // if default, then replace the default email with the first one
1100 if ( def == e ) { 1101 if ( def == e ) {
1101 //qDebug("removeEmail is default; setting new default"); 1102 //qDebug("removeEmail is default; setting new default");
1102 if ( !emails.count() ) 1103 if ( !emails.count() )
1103 clearEmails(); 1104 clearEmails();
1104 else // setDefaultEmail will remove e from the list 1105 else // setDefaultEmail will remove e from the list
1105 setDefaultEmail( emails.first() ); 1106 setDefaultEmail( emails.first() );
1106 } 1107 }
1107} 1108}
1108void OContact::clearEmails() 1109void OContact::clearEmails()
1109{ 1110{
1110 mMap.remove( Qtopia::DefaultEmail ); 1111 mMap.remove( Qtopia::DefaultEmail );
1111 mMap.remove( Qtopia::Emails ); 1112 mMap.remove( Qtopia::Emails );
1112} 1113}
1113void OContact::setDefaultEmail( const QString &v ) 1114void OContact::setDefaultEmail( const QString &v )
1114{ 1115{
1115 QString e = v.simplifyWhiteSpace(); 1116 QString e = v.simplifyWhiteSpace();
1116 1117
1117 //qDebug("OContact::setDefaultEmail %s", e.latin1()); 1118 //qDebug("OContact::setDefaultEmail %s", e.latin1());
1118 replace( Qtopia::DefaultEmail, e ); 1119 replace( Qtopia::DefaultEmail, e );
1119 1120
1120 if ( !e.isEmpty() ) 1121 if ( !e.isEmpty() )
1121 insertEmail( e ); 1122 insertEmail( e );
1122 1123
1123} 1124}
1124 1125
1125void OContact::insertEmails( const QStringList &v ) 1126void OContact::insertEmails( const QStringList &v )
1126{ 1127{
1127 for ( QStringList::ConstIterator it = v.begin(); it != v.end(); ++it ) 1128 for ( QStringList::ConstIterator it = v.begin(); it != v.end(); ++it )
1128 insertEmail( *it ); 1129 insertEmail( *it );
1129} 1130}
1130int OContact::rtti() { 1131int OContact::rtti() {
1131 return OPimResolver::AddressBook; 1132 return OPimResolver::AddressBook;
1132} 1133}
1133void OContact::setUid( int i ) 1134void OContact::setUid( int i )
1134{ 1135{
1135 OPimRecord::setUid(i); 1136 OPimRecord::setUid(i);
1136 replace( Qtopia::AddressUid , QString::number(i)); 1137 replace( Qtopia::AddressUid , QString::number(i));
1137} 1138}
diff --git a/libopie2/opiepim/ocontact.h b/libopie2/opiepim/ocontact.h
index 0e6cbd2..f79f0f3 100644
--- a/libopie2/opiepim/ocontact.h
+++ b/libopie2/opiepim/ocontact.h
@@ -1,241 +1,244 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** Copyright (C) 2002-2003 by Stefan Eilers (eilers.stefan@epost.de) 3** Copyright (C) 2002-2003 by Stefan Eilers (eilers.stefan@epost.de)
4** 4**
5** This file may be distributed and/or modified under the terms of the 5** This file may be distributed and/or modified under the terms of the
6** GNU General Public License version 2 as published by the Free Software 6** GNU General Public License version 2 as published by the Free Software
7** Foundation and appearing in the file LICENSE.GPL included in the 7** Foundation and appearing in the file LICENSE.GPL included in the
8** packaging of this file. 8** packaging of this file.
9** 9**
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12** 12**
13** See http://www.trolltech.com/gpl/ for GPL licensing information. 13** See http://www.trolltech.com/gpl/ for GPL licensing information.
14** 14**
15** Contact info@trolltech.com if any conditions of this licensing are 15** Contact info@trolltech.com if any conditions of this licensing are
16** not clear to you. 16** not clear to you.
17** 17**
18**********************************************************************/ 18**********************************************************************/
19 19
20#ifndef __OCONTACT_H__ 20#ifndef __OCONTACT_H__
21#define __OCONTACT_H__ 21#define __OCONTACT_H__
22 22
23#include <opie/opimrecord.h> 23#include <opie/opimrecord.h>
24#include <qpe/recordfields.h> 24#include <qpe/recordfields.h>
25 25
26#include <qdatetime.h> 26#include <qdatetime.h>
27#include <qstringlist.h> 27#include <qstringlist.h>
28 28
29#if defined(QPC_TEMPLATEDLL) 29#if defined(QPC_TEMPLATEDLL)
30// MOC_SKIP_BEGIN 30// MOC_SKIP_BEGIN
31QPC_TEMPLATEEXTERN template class QPC_EXPORT QMap<int, QString>; 31QPC_TEMPLATEEXTERN template class QPC_EXPORT QMap<int, QString>;
32// MOC_SKIP_END 32// MOC_SKIP_END
33#endif 33#endif
34 34
35class ContactPrivate; 35class ContactPrivate;
36 36
37/** 37/**
38 * OContact class represents a specialised PIM Record for contacts. 38 * OContact class represents a specialised PIM Record for contacts.
39 * It does store all kind of persopn related information. 39 * It does store all kind of persopn related information.
40 * 40 *
41 * @short Contact Container 41 * @short Contact Container
42 * @author TT, Stefan Eiler, Holger Freyther 42 * @author TT, Stefan Eiler, Holger Freyther
43 */ 43 */
44class QPC_EXPORT OContact : public OPimRecord 44class QPC_EXPORT OContact : public OPimRecord
45{ 45{
46 friend class DataSet; 46 friend class DataSet;
47public: 47public:
48 OContact(); 48 OContact();
49 OContact( const QMap<int, QString> &fromMap ); 49 OContact( const QMap<int, QString> &fromMap );
50 virtual ~OContact(); 50 virtual ~OContact();
51 51
52 /* 52 /*
53 * do we need to inline them 53 * do we need to inline them
54 * if yes do we need to inline them this way? 54 * if yes do we need to inline them this way?
55 * -zecke 55 * -zecke
56 */ 56 */
57 void setTitle( const QString &v ) { replace( Qtopia::Title, v ); } 57 void setTitle( const QString &v ) { replace( Qtopia::Title, v ); }
58 void setFirstName( const QString &v ) { replace( Qtopia::FirstName, v ); } 58 void setFirstName( const QString &v ) { replace( Qtopia::FirstName, v ); }
59 void setMiddleName( const QString &v ) { replace( Qtopia::MiddleName, v ); } 59 void setMiddleName( const QString &v ) { replace( Qtopia::MiddleName, v ); }
60 void setLastName( const QString &v ) { replace( Qtopia::LastName, v ); } 60 void setLastName( const QString &v ) { replace( Qtopia::LastName, v ); }
61 void setSuffix( const QString &v ) { replace( Qtopia::Suffix, v ); } 61 void setSuffix( const QString &v ) { replace( Qtopia::Suffix, v ); }
62 void setFileAs( const QString &v ) { replace( Qtopia::FileAs, v ); } 62 void setFileAs( const QString &v ) { replace( Qtopia::FileAs, v ); }
63 void setFileAs(); 63 void setFileAs();
64 64
65 // default email address 65 // default email address
66 void setDefaultEmail( const QString &v ); 66 void setDefaultEmail( const QString &v );
67 // inserts email to list and ensure's doesn't already exist 67 // inserts email to list and ensure's doesn't already exist
68 void insertEmail( const QString &v ); 68 void insertEmail( const QString &v );
69 void removeEmail( const QString &v ); 69 void removeEmail( const QString &v );
70 void clearEmails(); 70 void clearEmails();
71 void insertEmails( const QStringList &v ); 71 void insertEmails( const QStringList &v );
72 72
73 // home 73 // home
74 void setHomeStreet( const QString &v ) { replace( Qtopia::HomeStreet, v ); } 74 void setHomeStreet( const QString &v ) { replace( Qtopia::HomeStreet, v ); }
75 void setHomeCity( const QString &v ) { replace( Qtopia::HomeCity, v ); } 75 void setHomeCity( const QString &v ) { replace( Qtopia::HomeCity, v ); }
76 void setHomeState( const QString &v ) { replace( Qtopia::HomeState, v ); } 76 void setHomeState( const QString &v ) { replace( Qtopia::HomeState, v ); }
77 void setHomeZip( const QString &v ) { replace( Qtopia::HomeZip, v ); } 77 void setHomeZip( const QString &v ) { replace( Qtopia::HomeZip, v ); }
78 void setHomeCountry( const QString &v ) { replace( Qtopia::HomeCountry, v ); } 78 void setHomeCountry( const QString &v ) { replace( Qtopia::HomeCountry, v ); }
79 void setHomePhone( const QString &v ) { replace( Qtopia::HomePhone, v ); } 79 void setHomePhone( const QString &v ) { replace( Qtopia::HomePhone, v ); }
80 void setHomeFax( const QString &v ) { replace( Qtopia::HomeFax, v ); } 80 void setHomeFax( const QString &v ) { replace( Qtopia::HomeFax, v ); }
81 void setHomeMobile( const QString &v ) { replace( Qtopia::HomeMobile, v ); } 81 void setHomeMobile( const QString &v ) { replace( Qtopia::HomeMobile, v ); }
82 void setHomeWebpage( const QString &v ) { replace( Qtopia::HomeWebPage, v ); } 82 void setHomeWebpage( const QString &v ) { replace( Qtopia::HomeWebPage, v ); }
83 83
84 // business 84 // business
85 void setCompany( const QString &v ) { replace( Qtopia::Company, v ); } 85 void setCompany( const QString &v ) { replace( Qtopia::Company, v ); }
86 void setBusinessStreet( const QString &v ) { replace( Qtopia::BusinessStreet, v ); } 86 void setBusinessStreet( const QString &v ) { replace( Qtopia::BusinessStreet, v ); }
87 void setBusinessCity( const QString &v ) { replace( Qtopia::BusinessCity, v ); } 87 void setBusinessCity( const QString &v ) { replace( Qtopia::BusinessCity, v ); }
88 void setBusinessState( const QString &v ) { replace( Qtopia::BusinessState, v ); } 88 void setBusinessState( const QString &v ) { replace( Qtopia::BusinessState, v ); }
89 void setBusinessZip( const QString &v ) { replace( Qtopia::BusinessZip, v ); } 89 void setBusinessZip( const QString &v ) { replace( Qtopia::BusinessZip, v ); }
90 void setBusinessCountry( const QString &v ) { replace( Qtopia::BusinessCountry, v ); } 90 void setBusinessCountry( const QString &v ) { replace( Qtopia::BusinessCountry, v ); }
91 void setBusinessWebpage( const QString &v ) { replace( Qtopia::BusinessWebPage, v ); } 91 void setBusinessWebpage( const QString &v ) { replace( Qtopia::BusinessWebPage, v ); }
92 void setJobTitle( const QString &v ) { replace( Qtopia::JobTitle, v ); } 92 void setJobTitle( const QString &v ) { replace( Qtopia::JobTitle, v ); }
93 void setDepartment( const QString &v ) { replace( Qtopia::Department, v ); } 93 void setDepartment( const QString &v ) { replace( Qtopia::Department, v ); }
94 void setOffice( const QString &v ) { replace( Qtopia::Office, v ); } 94 void setOffice( const QString &v ) { replace( Qtopia::Office, v ); }
95 void setBusinessPhone( const QString &v ) { replace( Qtopia::BusinessPhone, v ); } 95 void setBusinessPhone( const QString &v ) { replace( Qtopia::BusinessPhone, v ); }
96 void setBusinessFax( const QString &v ) { replace( Qtopia::BusinessFax, v ); } 96 void setBusinessFax( const QString &v ) { replace( Qtopia::BusinessFax, v ); }
97 void setBusinessMobile( const QString &v ) { replace( Qtopia::BusinessMobile, v ); } 97 void setBusinessMobile( const QString &v ) { replace( Qtopia::BusinessMobile, v ); }
98 void setBusinessPager( const QString &v ) { replace( Qtopia::BusinessPager, v ); } 98 void setBusinessPager( const QString &v ) { replace( Qtopia::BusinessPager, v ); }
99 void setProfession( const QString &v ) { replace( Qtopia::Profession, v ); } 99 void setProfession( const QString &v ) { replace( Qtopia::Profession, v ); }
100 void setAssistant( const QString &v ) { replace( Qtopia::Assistant, v ); } 100 void setAssistant( const QString &v ) { replace( Qtopia::Assistant, v ); }
101 void setManager( const QString &v ) { replace( Qtopia::Manager, v ); } 101 void setManager( const QString &v ) { replace( Qtopia::Manager, v ); }
102 102
103 // personal 103 // personal
104 void setSpouse( const QString &v ) { replace( Qtopia::Spouse, v ); } 104 void setSpouse( const QString &v ) { replace( Qtopia::Spouse, v ); }
105 void setGender( const QString &v ) { replace( Qtopia::Gender, v ); } 105 void setGender( const QString &v ) { replace( Qtopia::Gender, v ); }
106 void setBirthday( const QDate &v ); 106 void setBirthday( const QDate &v );
107 void setAnniversary( const QDate &v ); 107 void setAnniversary( const QDate &v );
108 void setNickname( const QString &v ) { replace( Qtopia::Nickname, v ); } 108 void setNickname( const QString &v ) { replace( Qtopia::Nickname, v ); }
109 void setChildren( const QString &v ); 109 void setChildren( const QString &v );
110 110
111 // other 111 // other
112 void setNotes( const QString &v ) { replace( Qtopia::Notes, v); } 112 void setNotes( const QString &v ) { replace( Qtopia::Notes, v); }
113 113
114 virtual bool match( const QRegExp &regexp ) const; 114 virtual bool match( const QRegExp &regexp ) const;
115 115
116// // custom 116// // custom
117// void setCustomField( const QString &key, const QString &v ) 117// void setCustomField( const QString &key, const QString &v )
118// { replace(Custom- + key, v ); } 118// { replace(Custom- + key, v ); }
119 119
120 // name 120 // name
121 QString fullName() const; 121 QString fullName() const;
122 QString title() const { return find( Qtopia::Title ); } 122 QString title() const { return find( Qtopia::Title ); }
123 QString firstName() const { return find( Qtopia::FirstName ); } 123 QString firstName() const { return find( Qtopia::FirstName ); }
124 QString middleName() const { return find( Qtopia::MiddleName ); } 124 QString middleName() const { return find( Qtopia::MiddleName ); }
125 QString lastName() const { return find( Qtopia::LastName ); } 125 QString lastName() const { return find( Qtopia::LastName ); }
126 QString suffix() const { return find( Qtopia::Suffix ); } 126 QString suffix() const { return find( Qtopia::Suffix ); }
127 QString fileAs() const { return find( Qtopia::FileAs ); } 127 QString fileAs() const { return find( Qtopia::FileAs ); }
128 128
129 // email 129 // email
130 QString defaultEmail() const { return find( Qtopia::DefaultEmail ); } 130 QString defaultEmail() const { return find( Qtopia::DefaultEmail ); }
131 QStringList emailList() const; 131 QStringList emailList() const;
132 132
133 // home 133 // home
134 /* 134 /*
135 * OPimAddress address(enum Location)const; 135 * OPimAddress address(enum Location)const;
136 * would be some how nicer... 136 * would be some how nicer...
137 * -zecke 137 * -zecke
138 */ 138 */
139 QString homeStreet() const { return find( Qtopia::HomeStreet ); } 139 QString homeStreet() const { return find( Qtopia::HomeStreet ); }
140 QString homeCity() const { return find( Qtopia::HomeCity ); } 140 QString homeCity() const { return find( Qtopia::HomeCity ); }
141 QString homeState() const { return find( Qtopia::HomeState ); } 141 QString homeState() const { return find( Qtopia::HomeState ); }
142 QString homeZip() const { return find( Qtopia::HomeZip ); } 142 QString homeZip() const { return find( Qtopia::HomeZip ); }
143 QString homeCountry() const { return find( Qtopia::HomeCountry ); } 143 QString homeCountry() const { return find( Qtopia::HomeCountry ); }
144 QString homePhone() const { return find( Qtopia::HomePhone ); } 144 QString homePhone() const { return find( Qtopia::HomePhone ); }
145 QString homeFax() const { return find( Qtopia::HomeFax ); } 145 QString homeFax() const { return find( Qtopia::HomeFax ); }
146 QString homeMobile() const { return find( Qtopia::HomeMobile ); } 146 QString homeMobile() const { return find( Qtopia::HomeMobile ); }
147 QString homeWebpage() const { return find( Qtopia::HomeWebPage ); } 147 QString homeWebpage() const { return find( Qtopia::HomeWebPage ); }
148 /** Multi line string containing all non-empty address info in the form 148 /** Multi line string containing all non-empty address info in the form
149 * Street 149 * Street
150 * City, State Zip 150 * City, State Zip
151 * Country 151 * Country
152 */ 152 */
153 QString displayHomeAddress() const; 153 QString displayHomeAddress() const;
154 154
155 // business 155 // business
156 QString company() const { return find( Qtopia::Company ); } 156 QString company() const { return find( Qtopia::Company ); }
157 QString businessStreet() const { return find( Qtopia::BusinessStreet ); } 157 QString businessStreet() const { return find( Qtopia::BusinessStreet ); }
158 QString businessCity() const { return find( Qtopia::BusinessCity ); } 158 QString businessCity() const { return find( Qtopia::BusinessCity ); }
159 QString businessState() const { return find( Qtopia::BusinessState ); } 159 QString businessState() const { return find( Qtopia::BusinessState ); }
160 QString businessZip() const { return find( Qtopia::BusinessZip ); } 160 QString businessZip() const { return find( Qtopia::BusinessZip ); }
161 QString businessCountry() const { return find( Qtopia::BusinessCountry ); } 161 QString businessCountry() const { return find( Qtopia::BusinessCountry ); }
162 QString businessWebpage() const { return find( Qtopia::BusinessWebPage ); } 162 QString businessWebpage() const { return find( Qtopia::BusinessWebPage ); }
163 QString jobTitle() const { return find( Qtopia::JobTitle ); } 163 QString jobTitle() const { return find( Qtopia::JobTitle ); }
164 QString department() const { return find( Qtopia::Department ); } 164 QString department() const { return find( Qtopia::Department ); }
165 QString office() const { return find( Qtopia::Office ); } 165 QString office() const { return find( Qtopia::Office ); }
166 QString businessPhone() const { return find( Qtopia::BusinessPhone ); } 166 QString businessPhone() const { return find( Qtopia::BusinessPhone ); }
167 QString businessFax() const { return find( Qtopia::BusinessFax ); } 167 QString businessFax() const { return find( Qtopia::BusinessFax ); }
168 QString businessMobile() const { return find( Qtopia::BusinessMobile ); } 168 QString businessMobile() const { return find( Qtopia::BusinessMobile ); }
169 QString businessPager() const { return find( Qtopia::BusinessPager ); } 169 QString businessPager() const { return find( Qtopia::BusinessPager ); }
170 QString profession() const { return find( Qtopia::Profession ); } 170 QString profession() const { return find( Qtopia::Profession ); }
171 QString assistant() const { return find( Qtopia::Assistant ); } 171 QString assistant() const { return find( Qtopia::Assistant ); }
172 QString manager() const { return find( Qtopia::Manager ); } 172 QString manager() const { return find( Qtopia::Manager ); }
173 /** Multi line string containing all non-empty address info in the form 173 /** Multi line string containing all non-empty address info in the form
174 * Street 174 * Street
175 * City, State Zip 175 * City, State Zip
176 * Country 176 * Country
177 */ 177 */
178 QString displayBusinessAddress() const; 178 QString displayBusinessAddress() const;
179 179
180 //personal 180 //personal
181 QString spouse() const { return find( Qtopia::Spouse ); } 181 QString spouse() const { return find( Qtopia::Spouse ); }
182 QString gender() const { return find( Qtopia::Gender ); } 182 QString gender() const { return find( Qtopia::Gender ); }
183 QDate birthday() const; 183 QDate birthday() const;
184 QDate anniversary() const; 184 QDate anniversary() const;
185 QString nickname() const { return find( Qtopia::Nickname ); } 185 QString nickname() const { return find( Qtopia::Nickname ); }
186 QString children() const { return find( Qtopia::Children ); } 186 QString children() const { return find( Qtopia::Children ); }
187 QStringList childrenList() const; 187 QStringList childrenList() const;
188 188
189 // other 189 // other
190 QString notes() const { return find( Qtopia::Notes ); } 190 QString notes() const { return find( Qtopia::Notes ); }
191 QString groups() const { return find( Qtopia::Groups ); } 191 QString groups() const { return find( Qtopia::Groups ); }
192 QStringList groupList() const; 192 QStringList groupList() const;
193 193
194// // custom 194// // custom
195// const QString &customField( const QString &key ) 195// const QString &customField( const QString &key )
196// { return find( Custom- + key ); } 196// { return find( Custom- + key ); }
197 197
198 198
199 QString toRichText() const; 199 QString toRichText() const;
200 QMap<int, QString> toMap() const; 200 QMap<int, QString> toMap() const;
201 QString field( int key ) const { return find( key ); } 201 QString field( int key ) const { return find( key ); }
202 202
203 203
204 void setUid( int i ); 204 void setUid( int i );
205 205
206 QString toShortText()const; 206 QString toShortText()const;
207 QString OContact::type()const; 207 QString OContact::type()const;
208 QMap<QString,QString> OContact::toExtraMap() const; 208 QMap<QString,QString> OContact::toExtraMap() const;
209 class QString OContact::recordField(int) const; 209 class QString OContact::recordField(int) const;
210 210
211 // Why private ? (eilers,se) 211 // Why private ? (eilers,se)
212 QString emailSeparator() const { return " "; } 212 QString emailSeparator() const { return " "; }
213 // the emails should be seperated by a comma 213 // the emails should be seperated by a comma
214 void setEmails( const QString &v ); 214 void setEmails( const QString &v );
215 QString emails() const { return find( Qtopia::Emails ); } 215 QString emails() const { return find( Qtopia::Emails ); }
216 static int rtti(); 216 static int rtti();
217 217 int lastHitField() const {return m_lastHitField;};
218protected:
219 mutable int m_lastHitField;
220 void setLastHitField(int i) const { m_lastHitField = i; };
218 221
219private: 222private:
220 // The XML-Backend needs some access to the private functions 223 // The XML-Backend needs some access to the private functions
221 friend class OContactAccessBackend_XML; 224 friend class OContactAccessBackend_XML;
222 225
223 void insert( int key, const QString &value ); 226 void insert( int key, const QString &value );
224 void replace( int key, const QString &value ); 227 void replace( int key, const QString &value );
225 QString find( int key ) const; 228 QString find( int key ) const;
226 static QStringList fields(); 229 static QStringList fields();
227 230
228 void save( QString &buf ) const; 231 void save( QString &buf ) const;
229 232
230 QString displayAddress( const QString &street, 233 QString displayAddress( const QString &street,
231 const QString &city, 234 const QString &city,
232 const QString &state, 235 const QString &state,
233 const QString &zip, 236 const QString &zip,
234 const QString &country ) const; 237 const QString &country ) const;
235 238
236 QMap<int, QString> mMap; 239 QMap<int, QString> mMap;
237 ContactPrivate *d; 240 ContactPrivate *d;
238}; 241};
239 242
240 243
241#endif 244#endif