-rw-r--r-- | libopie/pim/ocontact.cpp | 8 | ||||
-rw-r--r-- | libopie2/opiepim/ocontact.cpp | 8 |
2 files changed, 12 insertions, 4 deletions
diff --git a/libopie/pim/ocontact.cpp b/libopie/pim/ocontact.cpp index efa2777..6aec62e 100644 --- a/libopie/pim/ocontact.cpp +++ b/libopie/pim/ocontact.cpp | |||
@@ -377,259 +377,263 @@ OContact::~OContact() | |||
377 | 377 | ||
378 | /*! \fn QString OContact::gender() const | 378 | /*! \fn QString OContact::gender() const |
379 | Returns the gender of the contact. | 379 | Returns the gender of the contact. |
380 | */ | 380 | */ |
381 | 381 | ||
382 | /*! \fn QString OContact::nickname() const | 382 | /*! \fn QString OContact::nickname() const |
383 | Returns the nickname of the contact. | 383 | Returns the nickname of the contact. |
384 | */ | 384 | */ |
385 | 385 | ||
386 | /*! \fn QString OContact::children() const | 386 | /*! \fn QString OContact::children() const |
387 | Returns the children of the contact. | 387 | Returns the children of the contact. |
388 | */ | 388 | */ |
389 | 389 | ||
390 | /*! \fn QString OContact::notes() const | 390 | /*! \fn QString OContact::notes() const |
391 | Returns the notes relating to the the contact. | 391 | Returns the notes relating to the the contact. |
392 | */ | 392 | */ |
393 | 393 | ||
394 | /*! \fn QString OContact::groups() const | 394 | /*! \fn QString OContact::groups() const |
395 | \internal | 395 | \internal |
396 | Returns the groups for the contact. | 396 | Returns the groups for the contact. |
397 | */ | 397 | */ |
398 | 398 | ||
399 | /*! \fn QStringList OContact::groupList() const | 399 | /*! \fn QStringList OContact::groupList() const |
400 | \internal | 400 | \internal |
401 | */ | 401 | */ |
402 | 402 | ||
403 | /*! \fn QString OContact::field(int) const | 403 | /*! \fn QString OContact::field(int) const |
404 | \internal | 404 | \internal |
405 | */ | 405 | */ |
406 | 406 | ||
407 | /*! \fn void OContact::saveJournal( journal_action, const QString & = QString::null ) | 407 | /*! \fn void OContact::saveJournal( journal_action, const QString & = QString::null ) |
408 | \internal | 408 | \internal |
409 | */ | 409 | */ |
410 | 410 | ||
411 | /*! \fn void OContact::setUid( int id ) | 411 | /*! \fn void OContact::setUid( int id ) |
412 | \internal | 412 | \internal |
413 | Sets the uid for this record to \a id. | 413 | Sets the uid for this record to \a id. |
414 | */ | 414 | */ |
415 | 415 | ||
416 | /*! \enum OContact::journal_action | 416 | /*! \enum OContact::journal_action |
417 | \internal | 417 | \internal |
418 | */ | 418 | */ |
419 | 419 | ||
420 | /*! | 420 | /*! |
421 | \internal | 421 | \internal |
422 | */ | 422 | */ |
423 | QMap<int, QString> OContact::toMap() const | 423 | QMap<int, QString> OContact::toMap() const |
424 | { | 424 | { |
425 | QMap<int, QString> map = mMap; | 425 | QMap<int, QString> map = mMap; |
426 | QString cats = idsToString( categories() ); | 426 | QString cats = idsToString( categories() ); |
427 | if ( !cats.isEmpty() ) | 427 | if ( !cats.isEmpty() ) |
428 | map.insert( Qtopia::AddressCategory, cats ); | 428 | map.insert( Qtopia::AddressCategory, cats ); |
429 | return map; | 429 | return map; |
430 | } | 430 | } |
431 | 431 | ||
432 | /*! | 432 | /*! |
433 | Returns a rich text formatted QString representing the contents the contact. | 433 | Returns a rich text formatted QString representing the contents the contact. |
434 | */ | 434 | */ |
435 | QString OContact::toRichText() const | 435 | QString OContact::toRichText() const |
436 | { | 436 | { |
437 | QString text; | 437 | QString text; |
438 | QString value, comp, state; | 438 | QString value, comp, state; |
439 | 439 | ||
440 | // name, jobtitle and company | 440 | // name, jobtitle and company |
441 | if ( !(value = fullName()).isEmpty() ) | 441 | if ( !(value = fullName()).isEmpty() ) |
442 | text += "<b>" + Qtopia::escapeString(value) + "</b><br>"; | 442 | text += "<b>" + Qtopia::escapeString(value) + "</b><br>"; |
443 | if ( !(value = jobTitle()).isEmpty() ) | 443 | if ( !(value = jobTitle()).isEmpty() ) |
444 | text += Qtopia::escapeString(value) + "<br>"; | 444 | text += Qtopia::escapeString(value) + "<br>"; |
445 | 445 | ||
446 | comp = company(); | 446 | comp = company(); |
447 | if ( !(value = department()).isEmpty() ) { | 447 | if ( !(value = department()).isEmpty() ) { |
448 | text += Qtopia::escapeString(value); | 448 | text += Qtopia::escapeString(value); |
449 | if ( comp ) | 449 | if ( comp ) |
450 | text += ", "; | 450 | text += ", "; |
451 | else | 451 | else |
452 | text += "<br>"; | 452 | text += "<br>"; |
453 | } | 453 | } |
454 | if ( !comp.isEmpty() ) | 454 | if ( !comp.isEmpty() ) |
455 | text += Qtopia::escapeString(comp) + "<br>"; | 455 | text += Qtopia::escapeString(comp) + "<br>"; |
456 | 456 | ||
457 | // business address | 457 | // business address |
458 | if ( !businessStreet().isEmpty() || !businessCity().isEmpty() || | 458 | if ( !businessStreet().isEmpty() || !businessCity().isEmpty() || |
459 | !businessZip().isEmpty() || !businessCountry().isEmpty() ) { | 459 | !businessZip().isEmpty() || !businessCountry().isEmpty() ) { |
460 | text += "<br>"; | 460 | text += "<br>"; |
461 | text += QObject::tr( "<b>Work Address:</b>" ); | 461 | text += QObject::tr( "<b>Work Address:</b>" ); |
462 | text += "<br>"; | 462 | text += "<br>"; |
463 | } | 463 | } |
464 | 464 | ||
465 | if ( !(value = businessStreet()).isEmpty() ) | 465 | if ( !(value = businessStreet()).isEmpty() ) |
466 | text += Qtopia::escapeString(value) + "<br>"; | 466 | text += Qtopia::escapeString(value) + "<br>"; |
467 | state = businessState(); | 467 | state = businessState(); |
468 | if ( !(value = businessCity()).isEmpty() ) { | 468 | if ( !(value = businessCity()).isEmpty() ) { |
469 | text += Qtopia::escapeString(value); | 469 | text += Qtopia::escapeString(value); |
470 | if ( state ) | 470 | if ( state ) |
471 | text += ", " + Qtopia::escapeString(state); | 471 | text += ", " + Qtopia::escapeString(state); |
472 | text += "<br>"; | 472 | text += "<br>"; |
473 | } else if ( !state.isEmpty() ) | 473 | } else if ( !state.isEmpty() ) |
474 | text += Qtopia::escapeString(state) + "<br>"; | 474 | text += Qtopia::escapeString(state) + "<br>"; |
475 | if ( !(value = businessZip()).isEmpty() ) | 475 | if ( !(value = businessZip()).isEmpty() ) |
476 | text += Qtopia::escapeString(value) + "<br>"; | 476 | text += Qtopia::escapeString(value) + "<br>"; |
477 | if ( !(value = businessCountry()).isEmpty() ) | 477 | if ( !(value = businessCountry()).isEmpty() ) |
478 | text += Qtopia::escapeString(value) + "<br>"; | 478 | text += Qtopia::escapeString(value) + "<br>"; |
479 | 479 | ||
480 | // home address | 480 | // home address |
481 | if ( !homeStreet().isEmpty() || !homeCity().isEmpty() || | 481 | if ( !homeStreet().isEmpty() || !homeCity().isEmpty() || |
482 | !homeZip().isEmpty() || !homeCountry().isEmpty() ) { | 482 | !homeZip().isEmpty() || !homeCountry().isEmpty() ) { |
483 | text += "<br>"; | 483 | text += "<br>"; |
484 | text += QObject::tr( "<b>Home Address:</b>" ); | 484 | text += QObject::tr( "<b>Home Address:</b>" ); |
485 | text += "<br>"; | 485 | text += "<br>"; |
486 | } | 486 | } |
487 | 487 | ||
488 | if ( !(value = homeStreet()).isEmpty() ) | 488 | if ( !(value = homeStreet()).isEmpty() ) |
489 | text += Qtopia::escapeString(value) + "<br>"; | 489 | text += Qtopia::escapeString(value) + "<br>"; |
490 | state = homeState(); | 490 | state = homeState(); |
491 | if ( !(value = homeCity()).isEmpty() ) { | 491 | if ( !(value = homeCity()).isEmpty() ) { |
492 | text += Qtopia::escapeString(value); | 492 | text += Qtopia::escapeString(value); |
493 | if ( !state.isEmpty() ) | 493 | if ( !state.isEmpty() ) |
494 | text += ", " + Qtopia::escapeString(state); | 494 | text += ", " + Qtopia::escapeString(state); |
495 | text += "<br>"; | 495 | text += "<br>"; |
496 | } else if (!state.isEmpty()) | 496 | } else if (!state.isEmpty()) |
497 | text += Qtopia::escapeString(state) + "<br>"; | 497 | text += Qtopia::escapeString(state) + "<br>"; |
498 | if ( !(value = homeZip()).isEmpty() ) | 498 | if ( !(value = homeZip()).isEmpty() ) |
499 | text += Qtopia::escapeString(value) + "<br>"; | 499 | text += Qtopia::escapeString(value) + "<br>"; |
500 | if ( !(value = homeCountry()).isEmpty() ) | 500 | if ( !(value = homeCountry()).isEmpty() ) |
501 | text += Qtopia::escapeString(value) + "<br>"; | 501 | text += Qtopia::escapeString(value) + "<br>"; |
502 | 502 | ||
503 | // the others... | 503 | // the others... |
504 | QString str; | 504 | QString str; |
505 | QString defEmail = defaultEmail(); | ||
506 | if ( !defEmail.isEmpty() ) | ||
507 | text += "<b>" + QObject::tr("Default Email: ") + "</b>" | ||
508 | + Qtopia::escapeString(defEmail) + "<br>"; | ||
505 | str = emails(); | 509 | str = emails(); |
506 | if ( !str.isEmpty() ) | 510 | if ( !str.isEmpty() && ( str != defEmail ) ) |
507 | text += "<b>" + QObject::tr("Email Addresses: ") + "</b>" | 511 | text += "<b>" + QObject::tr("All Emails: ") + "</b>" |
508 | + Qtopia::escapeString(str) + "<br>"; | 512 | + Qtopia::escapeString(str) + "<br>"; |
509 | str = homePhone(); | 513 | str = homePhone(); |
510 | if ( !str.isEmpty() ) | 514 | if ( !str.isEmpty() ) |
511 | text += "<b>" + QObject::tr("Home Phone: ") + "</b>" | 515 | text += "<b>" + QObject::tr("Home Phone: ") + "</b>" |
512 | + Qtopia::escapeString(str) + "<br>"; | 516 | + Qtopia::escapeString(str) + "<br>"; |
513 | str = homeFax(); | 517 | str = homeFax(); |
514 | if ( !str.isEmpty() ) | 518 | if ( !str.isEmpty() ) |
515 | text += "<b>" + QObject::tr("Home Fax: ") + "</b>" | 519 | text += "<b>" + QObject::tr("Home Fax: ") + "</b>" |
516 | + Qtopia::escapeString(str) + "<br>"; | 520 | + Qtopia::escapeString(str) + "<br>"; |
517 | str = homeMobile(); | 521 | str = homeMobile(); |
518 | if ( !str.isEmpty() ) | 522 | if ( !str.isEmpty() ) |
519 | text += "<b>" + QObject::tr("Home Mobile: ") + "</b>" | 523 | text += "<b>" + QObject::tr("Home Mobile: ") + "</b>" |
520 | + Qtopia::escapeString(str) + "<br>"; | 524 | + Qtopia::escapeString(str) + "<br>"; |
521 | str = homeWebpage(); | 525 | str = homeWebpage(); |
522 | if ( !str.isEmpty() ) | 526 | if ( !str.isEmpty() ) |
523 | text += "<b>" + QObject::tr("Home Web Page: ") + "</b>" | 527 | text += "<b>" + QObject::tr("Home Web Page: ") + "</b>" |
524 | + Qtopia::escapeString(str) + "<br>"; | 528 | + Qtopia::escapeString(str) + "<br>"; |
525 | str = businessWebpage(); | 529 | str = businessWebpage(); |
526 | if ( !str.isEmpty() ) | 530 | if ( !str.isEmpty() ) |
527 | text += "<b>" + QObject::tr("Business Web Page: ") + "</b>" | 531 | text += "<b>" + QObject::tr("Business Web Page: ") + "</b>" |
528 | + Qtopia::escapeString(str) + "<br>"; | 532 | + Qtopia::escapeString(str) + "<br>"; |
529 | str = office(); | 533 | str = office(); |
530 | if ( !str.isEmpty() ) | 534 | if ( !str.isEmpty() ) |
531 | text += "<b>" + QObject::tr("Office: ") + "</b>" | 535 | text += "<b>" + QObject::tr("Office: ") + "</b>" |
532 | + Qtopia::escapeString(str) + "<br>"; | 536 | + Qtopia::escapeString(str) + "<br>"; |
533 | str = businessPhone(); | 537 | str = businessPhone(); |
534 | if ( !str.isEmpty() ) | 538 | if ( !str.isEmpty() ) |
535 | text += "<b>" + QObject::tr("Business Phone: ") + "</b>" | 539 | text += "<b>" + QObject::tr("Business Phone: ") + "</b>" |
536 | + Qtopia::escapeString(str) + "<br>"; | 540 | + Qtopia::escapeString(str) + "<br>"; |
537 | str = businessFax(); | 541 | str = businessFax(); |
538 | if ( !str.isEmpty() ) | 542 | if ( !str.isEmpty() ) |
539 | text += "<b>" + QObject::tr("Business Fax: ") + "</b>" | 543 | text += "<b>" + QObject::tr("Business Fax: ") + "</b>" |
540 | + Qtopia::escapeString(str) + "<br>"; | 544 | + Qtopia::escapeString(str) + "<br>"; |
541 | str = businessMobile(); | 545 | str = businessMobile(); |
542 | if ( !str.isEmpty() ) | 546 | if ( !str.isEmpty() ) |
543 | text += "<b>" + QObject::tr("Business Mobile: ") + "</b>" | 547 | text += "<b>" + QObject::tr("Business Mobile: ") + "</b>" |
544 | + Qtopia::escapeString(str) + "<br>"; | 548 | + Qtopia::escapeString(str) + "<br>"; |
545 | str = businessPager(); | 549 | str = businessPager(); |
546 | if ( !str.isEmpty() ) | 550 | if ( !str.isEmpty() ) |
547 | text += "<b>" + QObject::tr("Business Pager: ") + "</b>" | 551 | text += "<b>" + QObject::tr("Business Pager: ") + "</b>" |
548 | + Qtopia::escapeString(str) + "<br>"; | 552 | + Qtopia::escapeString(str) + "<br>"; |
549 | str = profession(); | 553 | str = profession(); |
550 | if ( !str.isEmpty() ) | 554 | if ( !str.isEmpty() ) |
551 | text += "<b>" + QObject::tr("Profession: ") + "</b>" | 555 | text += "<b>" + QObject::tr("Profession: ") + "</b>" |
552 | + Qtopia::escapeString(str) + "<br>"; | 556 | + Qtopia::escapeString(str) + "<br>"; |
553 | str = assistant(); | 557 | str = assistant(); |
554 | if ( !str.isEmpty() ) | 558 | if ( !str.isEmpty() ) |
555 | text += "<b>" + QObject::tr("Assistant: ") + "</b>" | 559 | text += "<b>" + QObject::tr("Assistant: ") + "</b>" |
556 | + Qtopia::escapeString(str) + "<br>"; | 560 | + Qtopia::escapeString(str) + "<br>"; |
557 | str = manager(); | 561 | str = manager(); |
558 | if ( !str.isEmpty() ) | 562 | if ( !str.isEmpty() ) |
559 | text += "<b>" + QObject::tr("Manager: ") + "</b>" | 563 | text += "<b>" + QObject::tr("Manager: ") + "</b>" |
560 | + Qtopia::escapeString(str) + "<br>"; | 564 | + Qtopia::escapeString(str) + "<br>"; |
561 | str = gender(); | 565 | str = gender(); |
562 | if ( !str.isEmpty() && str.toInt() != 0 ) { | 566 | if ( !str.isEmpty() && str.toInt() != 0 ) { |
563 | if ( str.toInt() == 1 ) | 567 | if ( str.toInt() == 1 ) |
564 | str = QObject::tr( "Male" ); | 568 | str = QObject::tr( "Male" ); |
565 | else if ( str.toInt() == 2 ) | 569 | else if ( str.toInt() == 2 ) |
566 | str = QObject::tr( "Female" ); | 570 | str = QObject::tr( "Female" ); |
567 | text += "<b>" + QObject::tr("Gender: ") + "</b>" + str + "<br>"; | 571 | text += "<b>" + QObject::tr("Gender: ") + "</b>" + str + "<br>"; |
568 | } | 572 | } |
569 | str = spouse(); | 573 | str = spouse(); |
570 | if ( !str.isEmpty() ) | 574 | if ( !str.isEmpty() ) |
571 | text += "<b>" + QObject::tr("Spouse: ") + "</b>" | 575 | text += "<b>" + QObject::tr("Spouse: ") + "</b>" |
572 | + Qtopia::escapeString(str) + "<br>"; | 576 | + Qtopia::escapeString(str) + "<br>"; |
573 | if ( birthday().isValid() ){ | 577 | if ( birthday().isValid() ){ |
574 | str = TimeString::numberDateString( birthday() ); | 578 | str = TimeString::numberDateString( birthday() ); |
575 | text += "<b>" + QObject::tr("Birthday: ") + "</b>" | 579 | text += "<b>" + QObject::tr("Birthday: ") + "</b>" |
576 | + Qtopia::escapeString(str) + "<br>"; | 580 | + Qtopia::escapeString(str) + "<br>"; |
577 | } | 581 | } |
578 | if ( anniversary().isValid() ){ | 582 | if ( anniversary().isValid() ){ |
579 | str = TimeString::numberDateString( anniversary() ); | 583 | str = TimeString::numberDateString( anniversary() ); |
580 | text += "<b>" + QObject::tr("Anniversary: ") + "</b>" | 584 | text += "<b>" + QObject::tr("Anniversary: ") + "</b>" |
581 | + Qtopia::escapeString(str) + "<br>"; | 585 | + Qtopia::escapeString(str) + "<br>"; |
582 | } | 586 | } |
583 | str = nickname(); | 587 | str = nickname(); |
584 | if ( !str.isEmpty() ) | 588 | if ( !str.isEmpty() ) |
585 | text += "<b>" + QObject::tr("Nickname: ") + "</b>" | 589 | text += "<b>" + QObject::tr("Nickname: ") + "</b>" |
586 | + Qtopia::escapeString(str) + "<br>"; | 590 | + Qtopia::escapeString(str) + "<br>"; |
587 | 591 | ||
588 | if ( categoryNames().count() ){ | 592 | if ( categoryNames().count() ){ |
589 | text += "<b>" + QObject::tr( "Category:") + "</b> "; | 593 | text += "<b>" + QObject::tr( "Category:") + "</b> "; |
590 | text += categoryNames().join(", "); | 594 | text += categoryNames().join(", "); |
591 | text += "<br>"; | 595 | text += "<br>"; |
592 | } | 596 | } |
593 | 597 | ||
594 | // notes last | 598 | // notes last |
595 | if ( (value = notes()) ) { | 599 | if ( (value = notes()) ) { |
596 | QRegExp reg("\n"); | 600 | QRegExp reg("\n"); |
597 | 601 | ||
598 | //QString tmp = Qtopia::escapeString(value); | 602 | //QString tmp = Qtopia::escapeString(value); |
599 | QString tmp = QStyleSheet::convertFromPlainText(value); | 603 | QString tmp = QStyleSheet::convertFromPlainText(value); |
600 | //tmp.replace( reg, "<br>" ); | 604 | //tmp.replace( reg, "<br>" ); |
601 | text += "<br>" + tmp + "<br>"; | 605 | text += "<br>" + tmp + "<br>"; |
602 | } | 606 | } |
603 | return text; | 607 | return text; |
604 | } | 608 | } |
605 | 609 | ||
606 | /*! | 610 | /*! |
607 | \internal | 611 | \internal |
608 | */ | 612 | */ |
609 | void OContact::insert( int key, const QString &v ) | 613 | void OContact::insert( int key, const QString &v ) |
610 | { | 614 | { |
611 | QString value = v.stripWhiteSpace(); | 615 | QString value = v.stripWhiteSpace(); |
612 | if ( value.isEmpty() ) | 616 | if ( value.isEmpty() ) |
613 | mMap.remove( key ); | 617 | mMap.remove( key ); |
614 | else | 618 | else |
615 | mMap.insert( key, value ); | 619 | mMap.insert( key, value ); |
616 | } | 620 | } |
617 | 621 | ||
618 | /*! | 622 | /*! |
619 | \internal | 623 | \internal |
620 | */ | 624 | */ |
621 | void OContact::replace( int key, const QString & v ) | 625 | void OContact::replace( int key, const QString & v ) |
622 | { | 626 | { |
623 | QString value = v.stripWhiteSpace(); | 627 | QString value = v.stripWhiteSpace(); |
624 | if ( value.isEmpty() ) | 628 | if ( value.isEmpty() ) |
625 | mMap.remove( key ); | 629 | mMap.remove( key ); |
626 | else | 630 | else |
627 | mMap.replace( key, value ); | 631 | mMap.replace( key, value ); |
628 | } | 632 | } |
629 | 633 | ||
630 | /*! | 634 | /*! |
631 | \internal | 635 | \internal |
632 | */ | 636 | */ |
633 | QString OContact::find( int key ) const | 637 | QString OContact::find( int key ) const |
634 | { | 638 | { |
635 | return mMap[key]; | 639 | return mMap[key]; |
diff --git a/libopie2/opiepim/ocontact.cpp b/libopie2/opiepim/ocontact.cpp index efa2777..6aec62e 100644 --- a/libopie2/opiepim/ocontact.cpp +++ b/libopie2/opiepim/ocontact.cpp | |||
@@ -377,259 +377,263 @@ OContact::~OContact() | |||
377 | 377 | ||
378 | /*! \fn QString OContact::gender() const | 378 | /*! \fn QString OContact::gender() const |
379 | Returns the gender of the contact. | 379 | Returns the gender of the contact. |
380 | */ | 380 | */ |
381 | 381 | ||
382 | /*! \fn QString OContact::nickname() const | 382 | /*! \fn QString OContact::nickname() const |
383 | Returns the nickname of the contact. | 383 | Returns the nickname of the contact. |
384 | */ | 384 | */ |
385 | 385 | ||
386 | /*! \fn QString OContact::children() const | 386 | /*! \fn QString OContact::children() const |
387 | Returns the children of the contact. | 387 | Returns the children of the contact. |
388 | */ | 388 | */ |
389 | 389 | ||
390 | /*! \fn QString OContact::notes() const | 390 | /*! \fn QString OContact::notes() const |
391 | Returns the notes relating to the the contact. | 391 | Returns the notes relating to the the contact. |
392 | */ | 392 | */ |
393 | 393 | ||
394 | /*! \fn QString OContact::groups() const | 394 | /*! \fn QString OContact::groups() const |
395 | \internal | 395 | \internal |
396 | Returns the groups for the contact. | 396 | Returns the groups for the contact. |
397 | */ | 397 | */ |
398 | 398 | ||
399 | /*! \fn QStringList OContact::groupList() const | 399 | /*! \fn QStringList OContact::groupList() const |
400 | \internal | 400 | \internal |
401 | */ | 401 | */ |
402 | 402 | ||
403 | /*! \fn QString OContact::field(int) const | 403 | /*! \fn QString OContact::field(int) const |
404 | \internal | 404 | \internal |
405 | */ | 405 | */ |
406 | 406 | ||
407 | /*! \fn void OContact::saveJournal( journal_action, const QString & = QString::null ) | 407 | /*! \fn void OContact::saveJournal( journal_action, const QString & = QString::null ) |
408 | \internal | 408 | \internal |
409 | */ | 409 | */ |
410 | 410 | ||
411 | /*! \fn void OContact::setUid( int id ) | 411 | /*! \fn void OContact::setUid( int id ) |
412 | \internal | 412 | \internal |
413 | Sets the uid for this record to \a id. | 413 | Sets the uid for this record to \a id. |
414 | */ | 414 | */ |
415 | 415 | ||
416 | /*! \enum OContact::journal_action | 416 | /*! \enum OContact::journal_action |
417 | \internal | 417 | \internal |
418 | */ | 418 | */ |
419 | 419 | ||
420 | /*! | 420 | /*! |
421 | \internal | 421 | \internal |
422 | */ | 422 | */ |
423 | QMap<int, QString> OContact::toMap() const | 423 | QMap<int, QString> OContact::toMap() const |
424 | { | 424 | { |
425 | QMap<int, QString> map = mMap; | 425 | QMap<int, QString> map = mMap; |
426 | QString cats = idsToString( categories() ); | 426 | QString cats = idsToString( categories() ); |
427 | if ( !cats.isEmpty() ) | 427 | if ( !cats.isEmpty() ) |
428 | map.insert( Qtopia::AddressCategory, cats ); | 428 | map.insert( Qtopia::AddressCategory, cats ); |
429 | return map; | 429 | return map; |
430 | } | 430 | } |
431 | 431 | ||
432 | /*! | 432 | /*! |
433 | Returns a rich text formatted QString representing the contents the contact. | 433 | Returns a rich text formatted QString representing the contents the contact. |
434 | */ | 434 | */ |
435 | QString OContact::toRichText() const | 435 | QString OContact::toRichText() const |
436 | { | 436 | { |
437 | QString text; | 437 | QString text; |
438 | QString value, comp, state; | 438 | QString value, comp, state; |
439 | 439 | ||
440 | // name, jobtitle and company | 440 | // name, jobtitle and company |
441 | if ( !(value = fullName()).isEmpty() ) | 441 | if ( !(value = fullName()).isEmpty() ) |
442 | text += "<b>" + Qtopia::escapeString(value) + "</b><br>"; | 442 | text += "<b>" + Qtopia::escapeString(value) + "</b><br>"; |
443 | if ( !(value = jobTitle()).isEmpty() ) | 443 | if ( !(value = jobTitle()).isEmpty() ) |
444 | text += Qtopia::escapeString(value) + "<br>"; | 444 | text += Qtopia::escapeString(value) + "<br>"; |
445 | 445 | ||
446 | comp = company(); | 446 | comp = company(); |
447 | if ( !(value = department()).isEmpty() ) { | 447 | if ( !(value = department()).isEmpty() ) { |
448 | text += Qtopia::escapeString(value); | 448 | text += Qtopia::escapeString(value); |
449 | if ( comp ) | 449 | if ( comp ) |
450 | text += ", "; | 450 | text += ", "; |
451 | else | 451 | else |
452 | text += "<br>"; | 452 | text += "<br>"; |
453 | } | 453 | } |
454 | if ( !comp.isEmpty() ) | 454 | if ( !comp.isEmpty() ) |
455 | text += Qtopia::escapeString(comp) + "<br>"; | 455 | text += Qtopia::escapeString(comp) + "<br>"; |
456 | 456 | ||
457 | // business address | 457 | // business address |
458 | if ( !businessStreet().isEmpty() || !businessCity().isEmpty() || | 458 | if ( !businessStreet().isEmpty() || !businessCity().isEmpty() || |
459 | !businessZip().isEmpty() || !businessCountry().isEmpty() ) { | 459 | !businessZip().isEmpty() || !businessCountry().isEmpty() ) { |
460 | text += "<br>"; | 460 | text += "<br>"; |
461 | text += QObject::tr( "<b>Work Address:</b>" ); | 461 | text += QObject::tr( "<b>Work Address:</b>" ); |
462 | text += "<br>"; | 462 | text += "<br>"; |
463 | } | 463 | } |
464 | 464 | ||
465 | if ( !(value = businessStreet()).isEmpty() ) | 465 | if ( !(value = businessStreet()).isEmpty() ) |
466 | text += Qtopia::escapeString(value) + "<br>"; | 466 | text += Qtopia::escapeString(value) + "<br>"; |
467 | state = businessState(); | 467 | state = businessState(); |
468 | if ( !(value = businessCity()).isEmpty() ) { | 468 | if ( !(value = businessCity()).isEmpty() ) { |
469 | text += Qtopia::escapeString(value); | 469 | text += Qtopia::escapeString(value); |
470 | if ( state ) | 470 | if ( state ) |
471 | text += ", " + Qtopia::escapeString(state); | 471 | text += ", " + Qtopia::escapeString(state); |
472 | text += "<br>"; | 472 | text += "<br>"; |
473 | } else if ( !state.isEmpty() ) | 473 | } else if ( !state.isEmpty() ) |
474 | text += Qtopia::escapeString(state) + "<br>"; | 474 | text += Qtopia::escapeString(state) + "<br>"; |
475 | if ( !(value = businessZip()).isEmpty() ) | 475 | if ( !(value = businessZip()).isEmpty() ) |
476 | text += Qtopia::escapeString(value) + "<br>"; | 476 | text += Qtopia::escapeString(value) + "<br>"; |
477 | if ( !(value = businessCountry()).isEmpty() ) | 477 | if ( !(value = businessCountry()).isEmpty() ) |
478 | text += Qtopia::escapeString(value) + "<br>"; | 478 | text += Qtopia::escapeString(value) + "<br>"; |
479 | 479 | ||
480 | // home address | 480 | // home address |
481 | if ( !homeStreet().isEmpty() || !homeCity().isEmpty() || | 481 | if ( !homeStreet().isEmpty() || !homeCity().isEmpty() || |
482 | !homeZip().isEmpty() || !homeCountry().isEmpty() ) { | 482 | !homeZip().isEmpty() || !homeCountry().isEmpty() ) { |
483 | text += "<br>"; | 483 | text += "<br>"; |
484 | text += QObject::tr( "<b>Home Address:</b>" ); | 484 | text += QObject::tr( "<b>Home Address:</b>" ); |
485 | text += "<br>"; | 485 | text += "<br>"; |
486 | } | 486 | } |
487 | 487 | ||
488 | if ( !(value = homeStreet()).isEmpty() ) | 488 | if ( !(value = homeStreet()).isEmpty() ) |
489 | text += Qtopia::escapeString(value) + "<br>"; | 489 | text += Qtopia::escapeString(value) + "<br>"; |
490 | state = homeState(); | 490 | state = homeState(); |
491 | if ( !(value = homeCity()).isEmpty() ) { | 491 | if ( !(value = homeCity()).isEmpty() ) { |
492 | text += Qtopia::escapeString(value); | 492 | text += Qtopia::escapeString(value); |
493 | if ( !state.isEmpty() ) | 493 | if ( !state.isEmpty() ) |
494 | text += ", " + Qtopia::escapeString(state); | 494 | text += ", " + Qtopia::escapeString(state); |
495 | text += "<br>"; | 495 | text += "<br>"; |
496 | } else if (!state.isEmpty()) | 496 | } else if (!state.isEmpty()) |
497 | text += Qtopia::escapeString(state) + "<br>"; | 497 | text += Qtopia::escapeString(state) + "<br>"; |
498 | if ( !(value = homeZip()).isEmpty() ) | 498 | if ( !(value = homeZip()).isEmpty() ) |
499 | text += Qtopia::escapeString(value) + "<br>"; | 499 | text += Qtopia::escapeString(value) + "<br>"; |
500 | if ( !(value = homeCountry()).isEmpty() ) | 500 | if ( !(value = homeCountry()).isEmpty() ) |
501 | text += Qtopia::escapeString(value) + "<br>"; | 501 | text += Qtopia::escapeString(value) + "<br>"; |
502 | 502 | ||
503 | // the others... | 503 | // the others... |
504 | QString str; | 504 | QString str; |
505 | QString defEmail = defaultEmail(); | ||
506 | if ( !defEmail.isEmpty() ) | ||
507 | text += "<b>" + QObject::tr("Default Email: ") + "</b>" | ||
508 | + Qtopia::escapeString(defEmail) + "<br>"; | ||
505 | str = emails(); | 509 | str = emails(); |
506 | if ( !str.isEmpty() ) | 510 | if ( !str.isEmpty() && ( str != defEmail ) ) |
507 | text += "<b>" + QObject::tr("Email Addresses: ") + "</b>" | 511 | text += "<b>" + QObject::tr("All Emails: ") + "</b>" |
508 | + Qtopia::escapeString(str) + "<br>"; | 512 | + Qtopia::escapeString(str) + "<br>"; |
509 | str = homePhone(); | 513 | str = homePhone(); |
510 | if ( !str.isEmpty() ) | 514 | if ( !str.isEmpty() ) |
511 | text += "<b>" + QObject::tr("Home Phone: ") + "</b>" | 515 | text += "<b>" + QObject::tr("Home Phone: ") + "</b>" |
512 | + Qtopia::escapeString(str) + "<br>"; | 516 | + Qtopia::escapeString(str) + "<br>"; |
513 | str = homeFax(); | 517 | str = homeFax(); |
514 | if ( !str.isEmpty() ) | 518 | if ( !str.isEmpty() ) |
515 | text += "<b>" + QObject::tr("Home Fax: ") + "</b>" | 519 | text += "<b>" + QObject::tr("Home Fax: ") + "</b>" |
516 | + Qtopia::escapeString(str) + "<br>"; | 520 | + Qtopia::escapeString(str) + "<br>"; |
517 | str = homeMobile(); | 521 | str = homeMobile(); |
518 | if ( !str.isEmpty() ) | 522 | if ( !str.isEmpty() ) |
519 | text += "<b>" + QObject::tr("Home Mobile: ") + "</b>" | 523 | text += "<b>" + QObject::tr("Home Mobile: ") + "</b>" |
520 | + Qtopia::escapeString(str) + "<br>"; | 524 | + Qtopia::escapeString(str) + "<br>"; |
521 | str = homeWebpage(); | 525 | str = homeWebpage(); |
522 | if ( !str.isEmpty() ) | 526 | if ( !str.isEmpty() ) |
523 | text += "<b>" + QObject::tr("Home Web Page: ") + "</b>" | 527 | text += "<b>" + QObject::tr("Home Web Page: ") + "</b>" |
524 | + Qtopia::escapeString(str) + "<br>"; | 528 | + Qtopia::escapeString(str) + "<br>"; |
525 | str = businessWebpage(); | 529 | str = businessWebpage(); |
526 | if ( !str.isEmpty() ) | 530 | if ( !str.isEmpty() ) |
527 | text += "<b>" + QObject::tr("Business Web Page: ") + "</b>" | 531 | text += "<b>" + QObject::tr("Business Web Page: ") + "</b>" |
528 | + Qtopia::escapeString(str) + "<br>"; | 532 | + Qtopia::escapeString(str) + "<br>"; |
529 | str = office(); | 533 | str = office(); |
530 | if ( !str.isEmpty() ) | 534 | if ( !str.isEmpty() ) |
531 | text += "<b>" + QObject::tr("Office: ") + "</b>" | 535 | text += "<b>" + QObject::tr("Office: ") + "</b>" |
532 | + Qtopia::escapeString(str) + "<br>"; | 536 | + Qtopia::escapeString(str) + "<br>"; |
533 | str = businessPhone(); | 537 | str = businessPhone(); |
534 | if ( !str.isEmpty() ) | 538 | if ( !str.isEmpty() ) |
535 | text += "<b>" + QObject::tr("Business Phone: ") + "</b>" | 539 | text += "<b>" + QObject::tr("Business Phone: ") + "</b>" |
536 | + Qtopia::escapeString(str) + "<br>"; | 540 | + Qtopia::escapeString(str) + "<br>"; |
537 | str = businessFax(); | 541 | str = businessFax(); |
538 | if ( !str.isEmpty() ) | 542 | if ( !str.isEmpty() ) |
539 | text += "<b>" + QObject::tr("Business Fax: ") + "</b>" | 543 | text += "<b>" + QObject::tr("Business Fax: ") + "</b>" |
540 | + Qtopia::escapeString(str) + "<br>"; | 544 | + Qtopia::escapeString(str) + "<br>"; |
541 | str = businessMobile(); | 545 | str = businessMobile(); |
542 | if ( !str.isEmpty() ) | 546 | if ( !str.isEmpty() ) |
543 | text += "<b>" + QObject::tr("Business Mobile: ") + "</b>" | 547 | text += "<b>" + QObject::tr("Business Mobile: ") + "</b>" |
544 | + Qtopia::escapeString(str) + "<br>"; | 548 | + Qtopia::escapeString(str) + "<br>"; |
545 | str = businessPager(); | 549 | str = businessPager(); |
546 | if ( !str.isEmpty() ) | 550 | if ( !str.isEmpty() ) |
547 | text += "<b>" + QObject::tr("Business Pager: ") + "</b>" | 551 | text += "<b>" + QObject::tr("Business Pager: ") + "</b>" |
548 | + Qtopia::escapeString(str) + "<br>"; | 552 | + Qtopia::escapeString(str) + "<br>"; |
549 | str = profession(); | 553 | str = profession(); |
550 | if ( !str.isEmpty() ) | 554 | if ( !str.isEmpty() ) |
551 | text += "<b>" + QObject::tr("Profession: ") + "</b>" | 555 | text += "<b>" + QObject::tr("Profession: ") + "</b>" |
552 | + Qtopia::escapeString(str) + "<br>"; | 556 | + Qtopia::escapeString(str) + "<br>"; |
553 | str = assistant(); | 557 | str = assistant(); |
554 | if ( !str.isEmpty() ) | 558 | if ( !str.isEmpty() ) |
555 | text += "<b>" + QObject::tr("Assistant: ") + "</b>" | 559 | text += "<b>" + QObject::tr("Assistant: ") + "</b>" |
556 | + Qtopia::escapeString(str) + "<br>"; | 560 | + Qtopia::escapeString(str) + "<br>"; |
557 | str = manager(); | 561 | str = manager(); |
558 | if ( !str.isEmpty() ) | 562 | if ( !str.isEmpty() ) |
559 | text += "<b>" + QObject::tr("Manager: ") + "</b>" | 563 | text += "<b>" + QObject::tr("Manager: ") + "</b>" |
560 | + Qtopia::escapeString(str) + "<br>"; | 564 | + Qtopia::escapeString(str) + "<br>"; |
561 | str = gender(); | 565 | str = gender(); |
562 | if ( !str.isEmpty() && str.toInt() != 0 ) { | 566 | if ( !str.isEmpty() && str.toInt() != 0 ) { |
563 | if ( str.toInt() == 1 ) | 567 | if ( str.toInt() == 1 ) |
564 | str = QObject::tr( "Male" ); | 568 | str = QObject::tr( "Male" ); |
565 | else if ( str.toInt() == 2 ) | 569 | else if ( str.toInt() == 2 ) |
566 | str = QObject::tr( "Female" ); | 570 | str = QObject::tr( "Female" ); |
567 | text += "<b>" + QObject::tr("Gender: ") + "</b>" + str + "<br>"; | 571 | text += "<b>" + QObject::tr("Gender: ") + "</b>" + str + "<br>"; |
568 | } | 572 | } |
569 | str = spouse(); | 573 | str = spouse(); |
570 | if ( !str.isEmpty() ) | 574 | if ( !str.isEmpty() ) |
571 | text += "<b>" + QObject::tr("Spouse: ") + "</b>" | 575 | text += "<b>" + QObject::tr("Spouse: ") + "</b>" |
572 | + Qtopia::escapeString(str) + "<br>"; | 576 | + Qtopia::escapeString(str) + "<br>"; |
573 | if ( birthday().isValid() ){ | 577 | if ( birthday().isValid() ){ |
574 | str = TimeString::numberDateString( birthday() ); | 578 | str = TimeString::numberDateString( birthday() ); |
575 | text += "<b>" + QObject::tr("Birthday: ") + "</b>" | 579 | text += "<b>" + QObject::tr("Birthday: ") + "</b>" |
576 | + Qtopia::escapeString(str) + "<br>"; | 580 | + Qtopia::escapeString(str) + "<br>"; |
577 | } | 581 | } |
578 | if ( anniversary().isValid() ){ | 582 | if ( anniversary().isValid() ){ |
579 | str = TimeString::numberDateString( anniversary() ); | 583 | str = TimeString::numberDateString( anniversary() ); |
580 | text += "<b>" + QObject::tr("Anniversary: ") + "</b>" | 584 | text += "<b>" + QObject::tr("Anniversary: ") + "</b>" |
581 | + Qtopia::escapeString(str) + "<br>"; | 585 | + Qtopia::escapeString(str) + "<br>"; |
582 | } | 586 | } |
583 | str = nickname(); | 587 | str = nickname(); |
584 | if ( !str.isEmpty() ) | 588 | if ( !str.isEmpty() ) |
585 | text += "<b>" + QObject::tr("Nickname: ") + "</b>" | 589 | text += "<b>" + QObject::tr("Nickname: ") + "</b>" |
586 | + Qtopia::escapeString(str) + "<br>"; | 590 | + Qtopia::escapeString(str) + "<br>"; |
587 | 591 | ||
588 | if ( categoryNames().count() ){ | 592 | if ( categoryNames().count() ){ |
589 | text += "<b>" + QObject::tr( "Category:") + "</b> "; | 593 | text += "<b>" + QObject::tr( "Category:") + "</b> "; |
590 | text += categoryNames().join(", "); | 594 | text += categoryNames().join(", "); |
591 | text += "<br>"; | 595 | text += "<br>"; |
592 | } | 596 | } |
593 | 597 | ||
594 | // notes last | 598 | // notes last |
595 | if ( (value = notes()) ) { | 599 | if ( (value = notes()) ) { |
596 | QRegExp reg("\n"); | 600 | QRegExp reg("\n"); |
597 | 601 | ||
598 | //QString tmp = Qtopia::escapeString(value); | 602 | //QString tmp = Qtopia::escapeString(value); |
599 | QString tmp = QStyleSheet::convertFromPlainText(value); | 603 | QString tmp = QStyleSheet::convertFromPlainText(value); |
600 | //tmp.replace( reg, "<br>" ); | 604 | //tmp.replace( reg, "<br>" ); |
601 | text += "<br>" + tmp + "<br>"; | 605 | text += "<br>" + tmp + "<br>"; |
602 | } | 606 | } |
603 | return text; | 607 | return text; |
604 | } | 608 | } |
605 | 609 | ||
606 | /*! | 610 | /*! |
607 | \internal | 611 | \internal |
608 | */ | 612 | */ |
609 | void OContact::insert( int key, const QString &v ) | 613 | void OContact::insert( int key, const QString &v ) |
610 | { | 614 | { |
611 | QString value = v.stripWhiteSpace(); | 615 | QString value = v.stripWhiteSpace(); |
612 | if ( value.isEmpty() ) | 616 | if ( value.isEmpty() ) |
613 | mMap.remove( key ); | 617 | mMap.remove( key ); |
614 | else | 618 | else |
615 | mMap.insert( key, value ); | 619 | mMap.insert( key, value ); |
616 | } | 620 | } |
617 | 621 | ||
618 | /*! | 622 | /*! |
619 | \internal | 623 | \internal |
620 | */ | 624 | */ |
621 | void OContact::replace( int key, const QString & v ) | 625 | void OContact::replace( int key, const QString & v ) |
622 | { | 626 | { |
623 | QString value = v.stripWhiteSpace(); | 627 | QString value = v.stripWhiteSpace(); |
624 | if ( value.isEmpty() ) | 628 | if ( value.isEmpty() ) |
625 | mMap.remove( key ); | 629 | mMap.remove( key ); |
626 | else | 630 | else |
627 | mMap.replace( key, value ); | 631 | mMap.replace( key, value ); |
628 | } | 632 | } |
629 | 633 | ||
630 | /*! | 634 | /*! |
631 | \internal | 635 | \internal |
632 | */ | 636 | */ |
633 | QString OContact::find( int key ) const | 637 | QString OContact::find( int key ) const |
634 | { | 638 | { |
635 | return mMap[key]; | 639 | return mMap[key]; |