-rw-r--r-- | libopie2/opiepim/ocontact.cpp | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/libopie2/opiepim/ocontact.cpp b/libopie2/opiepim/ocontact.cpp index a7ca975..a2fb68c 100644 --- a/libopie2/opiepim/ocontact.cpp +++ b/libopie2/opiepim/ocontact.cpp | |||
@@ -431,50 +431,53 @@ QMap<int, QString> OContact::toMap() const | |||
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 | */ |
434 | QString OContact::toRichText() const | 434 | QString 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><img src=\"addressbook/AddressBook\">" + Qtopia::escapeString(value) + "</h3></b>"; |
444 | |||
444 | if ( !(value = jobTitle()).isEmpty() ) | 445 | if ( !(value = jobTitle()).isEmpty() ) |
445 | text += Qtopia::escapeString(value) + "<br>"; | 446 | text += Qtopia::escapeString(value) + "<br>"; |
446 | 447 | ||
447 | comp = company(); | 448 | comp = company(); |
448 | if ( !(value = department()).isEmpty() ) { | 449 | if ( !(value = department()).isEmpty() ) { |
449 | text += Qtopia::escapeString(value); | 450 | text += Qtopia::escapeString(value); |
450 | if ( comp ) | 451 | if ( comp ) |
451 | text += ", "; | 452 | text += ", "; |
452 | else | 453 | else |
453 | text += "<br>"; | 454 | text += "<br>"; |
454 | } | 455 | } |
455 | if ( !comp.isEmpty() ) | 456 | if ( !comp.isEmpty() ) |
456 | text += Qtopia::escapeString(comp) + "<br>"; | 457 | text += Qtopia::escapeString(comp) + "<br>"; |
457 | 458 | ||
459 | text += "<hr><br>"; | ||
460 | |||
461 | // defailt email | ||
458 | QString defEmail = defaultEmail(); | 462 | QString defEmail = defaultEmail(); |
459 | if ( !defEmail.isEmpty() ) | 463 | if ( !defEmail.isEmpty() ) |
460 | text += "<b>" + QObject::tr("Default Email: ") + "</b>" | 464 | text += "<b><img src=\"addressbook/email\">" + QObject::tr("Default Email: ") + "</b>" |
461 | + Qtopia::escapeString(defEmail) + "<br>"; | 465 | + Qtopia::escapeString(defEmail) + "<br>"; |
462 | 466 | ||
463 | text += "<hr>"; | 467 | text += "<br>"; |
464 | 468 | ||
465 | // business address | 469 | // business address |
466 | if ( !businessStreet().isEmpty() || !businessCity().isEmpty() || | 470 | if ( !businessStreet().isEmpty() || !businessCity().isEmpty() || |
467 | !businessZip().isEmpty() || !businessCountry().isEmpty() ) { | 471 | !businessZip().isEmpty() || !businessCountry().isEmpty() ) { |
468 | text += "<br>"; | ||
469 | text += QObject::tr( "<b>Work Address:</b>" ); | 472 | text += QObject::tr( "<b>Work Address:</b>" ); |
470 | text += "<br>"; | 473 | text += "<br>"; |
471 | marker = true; | 474 | marker = true; |
472 | } | 475 | } |
473 | 476 | ||
474 | if ( !(value = businessStreet()).isEmpty() ) | 477 | if ( !(value = businessStreet()).isEmpty() ) |
475 | text += Qtopia::escapeString(value) + "<br>"; | 478 | text += Qtopia::escapeString(value) + "<br>"; |
476 | state = businessState(); | 479 | state = businessState(); |
477 | if ( !(value = businessZip()).isEmpty() ) | 480 | if ( !(value = businessZip()).isEmpty() ) |
478 | text += Qtopia::escapeString(value) + " "; | 481 | text += Qtopia::escapeString(value) + " "; |
479 | if ( !(value = businessCity()).isEmpty() ) { | 482 | if ( !(value = businessCity()).isEmpty() ) { |
480 | text += Qtopia::escapeString(value); | 483 | text += Qtopia::escapeString(value); |
@@ -487,98 +490,99 @@ QString OContact::toRichText() const | |||
487 | if ( !(value = businessCountry()).isEmpty() ) | 490 | if ( !(value = businessCountry()).isEmpty() ) |
488 | text += Qtopia::escapeString(value) + "<br>"; | 491 | text += Qtopia::escapeString(value) + "<br>"; |
489 | 492 | ||
490 | // rest of Business data | 493 | // rest of Business data |
491 | str = office(); | 494 | str = office(); |
492 | if ( !str.isEmpty() ){ | 495 | if ( !str.isEmpty() ){ |
493 | text += "<b>" + QObject::tr("Office: ") + "</b>" | 496 | text += "<b>" + QObject::tr("Office: ") + "</b>" |
494 | + Qtopia::escapeString(str) + "<br>"; | 497 | + Qtopia::escapeString(str) + "<br>"; |
495 | marker = true; | 498 | marker = true; |
496 | } | 499 | } |
497 | str = businessWebpage(); | 500 | str = businessWebpage(); |
498 | if ( !str.isEmpty() ){ | 501 | if ( !str.isEmpty() ){ |
499 | text += "<b>" + QObject::tr("Business Web Page: ") + "</b>" | 502 | text += "<b><img src=\"addressbook/webpagework\">" + QObject::tr("Business Web Page: ") + "</b>" |
500 | + Qtopia::escapeString(str) + "<br>"; | 503 | + Qtopia::escapeString(str) + "<br>"; |
501 | marker = true; | 504 | marker = true; |
502 | } | 505 | } |
503 | str = businessPhone(); | 506 | str = businessPhone(); |
504 | if ( !str.isEmpty() ){ | 507 | if ( !str.isEmpty() ){ |
505 | text += "<b>" + QObject::tr("Business Phone: ") + "</b>" | 508 | text += "<b><img src=\"addressbook/phonework\">" + QObject::tr("Business Phone: ") + "</b>" |
506 | + Qtopia::escapeString(str) + "<br>"; | 509 | + Qtopia::escapeString(str) + "<br>"; |
507 | marker = true; | 510 | marker = true; |
508 | } | 511 | } |
509 | str = businessFax(); | 512 | str = businessFax(); |
510 | if ( !str.isEmpty() ){ | 513 | if ( !str.isEmpty() ){ |
511 | text += "<b>" + QObject::tr("Business Fax: ") + "</b>" | 514 | text += "<b><img src=\"addressbook/faxwork\">" + QObject::tr("Business Fax: ") + "</b>" |
512 | + Qtopia::escapeString(str) + "<br>"; | 515 | + Qtopia::escapeString(str) + "<br>"; |
513 | marker = true; | 516 | marker = true; |
514 | } | 517 | } |
515 | str = businessMobile(); | 518 | str = businessMobile(); |
516 | if ( !str.isEmpty() ){ | 519 | if ( !str.isEmpty() ){ |
517 | text += "<b>" + QObject::tr("Business Mobile: ") + "</b>" | 520 | text += "<b><img src=\"addressbook/mobilework\">" + QObject::tr("Business Mobile: ") + "</b>" |
518 | + Qtopia::escapeString(str) + "<br>"; | 521 | + Qtopia::escapeString(str) + "<br>"; |
519 | marker = true; | 522 | marker = true; |
520 | } | 523 | } |
521 | str = businessPager(); | 524 | str = businessPager(); |
522 | if ( !str.isEmpty() ){ | 525 | if ( !str.isEmpty() ){ |
523 | text += "<b>" + QObject::tr("Business Pager: ") + "</b>" | 526 | text += "<b>" + QObject::tr("Business Pager: ") + "</b>" |
524 | + Qtopia::escapeString(str) + "<br>"; | 527 | + Qtopia::escapeString(str) + "<br>"; |
525 | marker = true; | 528 | marker = true; |
526 | } | 529 | } |
527 | 530 | ||
531 | text += "<br>"; | ||
532 | |||
528 | // home address | 533 | // home address |
529 | if ( !homeStreet().isEmpty() || !homeCity().isEmpty() || | 534 | if ( !homeStreet().isEmpty() || !homeCity().isEmpty() || |
530 | !homeZip().isEmpty() || !homeCountry().isEmpty() ) { | 535 | !homeZip().isEmpty() || !homeCountry().isEmpty() ) { |
531 | text += "<br>"; | ||
532 | text += QObject::tr( "<b>Home Address:</b>" ); | 536 | text += QObject::tr( "<b>Home Address:</b>" ); |
533 | text += "<br>"; | 537 | text += "<br>"; |
534 | } | 538 | } |
535 | 539 | ||
536 | if ( !(value = homeStreet()).isEmpty() ) | 540 | if ( !(value = homeStreet()).isEmpty() ) |
537 | text += Qtopia::escapeString(value) + "<br>"; | 541 | text += Qtopia::escapeString(value) + "<br>"; |
538 | state = homeState(); | 542 | state = homeState(); |
539 | if ( !(value = homeZip()).isEmpty() ) | 543 | if ( !(value = homeZip()).isEmpty() ) |
540 | text += Qtopia::escapeString(value) + " "; | 544 | text += Qtopia::escapeString(value) + " "; |
541 | if ( !(value = homeCity()).isEmpty() ) { | 545 | if ( !(value = homeCity()).isEmpty() ) { |
542 | text += Qtopia::escapeString(value); | 546 | text += Qtopia::escapeString(value); |
543 | if ( !state.isEmpty() ) | 547 | if ( !state.isEmpty() ) |
544 | text += ", " + Qtopia::escapeString(state); | 548 | text += ", " + Qtopia::escapeString(state); |
545 | text += "<br>"; | 549 | text += "<br>"; |
546 | } else if (!state.isEmpty()) | 550 | } else if (!state.isEmpty()) |
547 | text += Qtopia::escapeString(state) + "<br>"; | 551 | text += Qtopia::escapeString(state) + "<br>"; |
548 | if ( !(value = homeCountry()).isEmpty() ) | 552 | if ( !(value = homeCountry()).isEmpty() ) |
549 | text += Qtopia::escapeString(value) + "<br>"; | 553 | text += Qtopia::escapeString(value) + "<br>"; |
550 | 554 | ||
551 | // rest of Home data | 555 | // rest of Home data |
552 | str = homeWebpage(); | 556 | str = homeWebpage(); |
553 | if ( !str.isEmpty() ){ | 557 | if ( !str.isEmpty() ){ |
554 | text += "<b>" + QObject::tr("Home Web Page: ") + "</b>" | 558 | text += "<b><img src=\"addressbook/webpagehome\">" + QObject::tr("Home Web Page: ") + "</b>" |
555 | + Qtopia::escapeString(str) + "<br>"; | 559 | + Qtopia::escapeString(str) + "<br>"; |
556 | marker = true; | 560 | marker = true; |
557 | } | 561 | } |
558 | str = homePhone(); | 562 | str = homePhone(); |
559 | if ( !str.isEmpty() ){ | 563 | if ( !str.isEmpty() ){ |
560 | text += "<b>" + QObject::tr("Home Phone: ") + "</b>" | 564 | text += "<b><img src=\"addressbook/phonehome\">" + QObject::tr("Home Phone: ") + "</b>" |
561 | + Qtopia::escapeString(str) + "<br>"; | 565 | + Qtopia::escapeString(str) + "<br>"; |
562 | marker = true; | 566 | marker = true; |
563 | } | 567 | } |
564 | str = homeFax(); | 568 | str = homeFax(); |
565 | if ( !str.isEmpty() ){ | 569 | if ( !str.isEmpty() ){ |
566 | text += "<b>" + QObject::tr("Home Fax: ") + "</b>" | 570 | text += "<b><img src=\"addressbook/faxhome\">" + QObject::tr("Home Fax: ") + "</b>" |
567 | + Qtopia::escapeString(str) + "<br>"; | 571 | + Qtopia::escapeString(str) + "<br>"; |
568 | marker = true; | 572 | marker = true; |
569 | } | 573 | } |
570 | str = homeMobile(); | 574 | str = homeMobile(); |
571 | if ( !str.isEmpty() ){ | 575 | if ( !str.isEmpty() ){ |
572 | text += "<b>" + QObject::tr("Home Mobile: ") + "</b>" | 576 | text += "<b><img src=\"addressbook/mobilehome\">" + QObject::tr("Home Mobile: ") + "</b>" |
573 | + Qtopia::escapeString(str) + "<br>"; | 577 | + Qtopia::escapeString(str) + "<br>"; |
574 | marker = true; | 578 | marker = true; |
575 | } | 579 | } |
576 | 580 | ||
577 | if ( marker ) | 581 | if ( marker ) |
578 | text += "<br><hr><br>"; | 582 | text += "<br><hr><br>"; |
579 | // the others... | 583 | // the others... |
580 | str = emails(); | 584 | str = emails(); |
581 | if ( !str.isEmpty() && ( str != defEmail ) ) | 585 | if ( !str.isEmpty() && ( str != defEmail ) ) |
582 | text += "<b>" + QObject::tr("All Emails: ") + "</b>" | 586 | text += "<b>" + QObject::tr("All Emails: ") + "</b>" |
583 | + Qtopia::escapeString(str) + "<br>"; | 587 | + Qtopia::escapeString(str) + "<br>"; |
584 | str = profession(); | 588 | str = profession(); |
@@ -616,24 +620,25 @@ QString OContact::toRichText() const | |||
616 | + Qtopia::escapeString(str) + "<br>"; | 620 | + Qtopia::escapeString(str) + "<br>"; |
617 | } | 621 | } |
618 | str = children(); | 622 | str = children(); |
619 | if ( !str.isEmpty() ) | 623 | if ( !str.isEmpty() ) |
620 | text += "<b>" + QObject::tr("Children: ") + "</b>" | 624 | text += "<b>" + QObject::tr("Children: ") + "</b>" |
621 | + Qtopia::escapeString(str) + "<br>"; | 625 | + Qtopia::escapeString(str) + "<br>"; |
622 | 626 | ||
623 | str = nickname(); | 627 | str = nickname(); |
624 | if ( !str.isEmpty() ) | 628 | if ( !str.isEmpty() ) |
625 | text += "<b>" + QObject::tr("Nickname: ") + "</b>" | 629 | text += "<b>" + QObject::tr("Nickname: ") + "</b>" |
626 | + Qtopia::escapeString(str) + "<br>"; | 630 | + Qtopia::escapeString(str) + "<br>"; |
627 | 631 | ||
632 | // categories | ||
628 | if ( categoryNames("Contacts").count() ){ | 633 | if ( categoryNames("Contacts").count() ){ |
629 | text += "<b>" + QObject::tr( "Category:") + "</b> "; | 634 | text += "<b>" + QObject::tr( "Category:") + "</b> "; |
630 | text += categoryNames("Contacts").join(", "); | 635 | text += categoryNames("Contacts").join(", "); |
631 | text += "<br>"; | 636 | text += "<br>"; |
632 | } | 637 | } |
633 | 638 | ||
634 | // notes last | 639 | // notes last |
635 | if ( !(value = notes()).isEmpty() ) { | 640 | if ( !(value = notes()).isEmpty() ) { |
636 | text += "<br><hr><b>" + QObject::tr( "Notes:") + "</b> "; | 641 | text += "<br><hr><b>" + QObject::tr( "Notes:") + "</b> "; |
637 | QRegExp reg("\n"); | 642 | QRegExp reg("\n"); |
638 | 643 | ||
639 | //QString tmp = Qtopia::escapeString(value); | 644 | //QString tmp = Qtopia::escapeString(value); |