summaryrefslogtreecommitdiff
authoreilers <eilers>2003-01-02 10:24:30 (UTC)
committer eilers <eilers>2003-01-02 10:24:30 (UTC)
commit8a56de0062724c2ed52481af0a22e0f69423ff51 (patch) (unidiff)
tree7a9bf841e129d1e84d5b8b15887f37630ca32f06
parentbd26d4cab11d12f3382bb6fb6e0f7c7815975013 (diff)
downloadopie-8a56de0062724c2ed52481af0a22e0f69423ff51.zip
opie-8a56de0062724c2ed52481af0a22e0f69423ff51.tar.gz
opie-8a56de0062724c2ed52481af0a22e0f69423ff51.tar.bz2
Detailview cleanup..
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/pim/ocontact.cpp122
-rw-r--r--libopie2/opiepim/ocontact.cpp122
2 files changed, 154 insertions, 90 deletions
diff --git a/libopie/pim/ocontact.cpp b/libopie/pim/ocontact.cpp
index c9084ad..9230b8b 100644
--- a/libopie/pim/ocontact.cpp
+++ b/libopie/pim/ocontact.cpp
@@ -437,10 +437,12 @@ QString OContact::toRichText() const
437{ 437{
438 QString text; 438 QString text;
439 QString value, comp, state; 439 QString value, comp, state;
440 QString str;
441 bool marker = false;
440 442
441 // name, jobtitle and company 443 // name, jobtitle and company
442 if ( !(value = fullName()).isEmpty() ) 444 if ( !(value = fullName()).isEmpty() )
443 text += "<b>" + Qtopia::escapeString(value) + "</b><br>"; 445 text += "<b><h3>" + Qtopia::escapeString(value) + "</h3></b><br>";
444 if ( !(value = jobTitle()).isEmpty() ) 446 if ( !(value = jobTitle()).isEmpty() )
445 text += Qtopia::escapeString(value) + "<br>"; 447 text += Qtopia::escapeString(value) + "<br>";
446 448
@@ -455,12 +457,20 @@ QString OContact::toRichText() const
455 if ( !comp.isEmpty() ) 457 if ( !comp.isEmpty() )
456 text += Qtopia::escapeString(comp) + "<br>"; 458 text += Qtopia::escapeString(comp) + "<br>";
457 459
460 QString defEmail = defaultEmail();
461 if ( !defEmail.isEmpty() )
462 text += "<b>" + QObject::tr("Default Email: ") + "</b>"
463 + Qtopia::escapeString(defEmail) + "<br>";
464
465 text += "<hr>";
466
458 // business address 467 // business address
459 if ( !businessStreet().isEmpty() || !businessCity().isEmpty() || 468 if ( !businessStreet().isEmpty() || !businessCity().isEmpty() ||
460 !businessZip().isEmpty() || !businessCountry().isEmpty() ) { 469 !businessZip().isEmpty() || !businessCountry().isEmpty() ) {
461 text += "<br>"; 470 text += "<br>";
462 text += QObject::tr( "<b>Work Address:</b>" ); 471 text += QObject::tr( "<b>Work Address:</b>" );
463 text += "<br>"; 472 text += "<br>";
473 marker = true;
464 } 474 }
465 475
466 if ( !(value = businessStreet()).isEmpty() ) 476 if ( !(value = businessStreet()).isEmpty() )
@@ -478,6 +488,44 @@ QString OContact::toRichText() const
478 if ( !(value = businessCountry()).isEmpty() ) 488 if ( !(value = businessCountry()).isEmpty() )
479 text += Qtopia::escapeString(value) + "<br>"; 489 text += Qtopia::escapeString(value) + "<br>";
480 490
491 // rest of Business data
492 str = office();
493 if ( !str.isEmpty() ){
494 text += "<b>" + QObject::tr("Office: ") + "</b>"
495 + Qtopia::escapeString(str) + "<br>";
496 marker = true;
497 }
498 str = businessWebpage();
499 if ( !str.isEmpty() ){
500 text += "<b>" + QObject::tr("Business Web Page: ") + "</b>"
501 + Qtopia::escapeString(str) + "<br>";
502 marker = true;
503 }
504 str = businessPhone();
505 if ( !str.isEmpty() ){
506 text += "<b>" + QObject::tr("Business Phone: ") + "</b>"
507 + Qtopia::escapeString(str) + "<br>";
508 marker = true;
509 }
510 str = businessFax();
511 if ( !str.isEmpty() ){
512 text += "<b>" + QObject::tr("Business Fax: ") + "</b>"
513 + Qtopia::escapeString(str) + "<br>";
514 marker = true;
515 }
516 str = businessMobile();
517 if ( !str.isEmpty() ){
518 text += "<b>" + QObject::tr("Business Mobile: ") + "</b>"
519 + Qtopia::escapeString(str) + "<br>";
520 marker = true;
521 }
522 str = businessPager();
523 if ( !str.isEmpty() ){
524 text += "<b>" + QObject::tr("Business Pager: ") + "</b>"
525 + Qtopia::escapeString(str) + "<br>";
526 marker = true;
527 }
528
481 // home address 529 // home address
482 if ( !homeStreet().isEmpty() || !homeCity().isEmpty() || 530 if ( !homeStreet().isEmpty() || !homeCity().isEmpty() ||
483 !homeZip().isEmpty() || !homeCountry().isEmpty() ) { 531 !homeZip().isEmpty() || !homeCountry().isEmpty() ) {
@@ -501,55 +549,38 @@ QString OContact::toRichText() const
501 if ( !(value = homeCountry()).isEmpty() ) 549 if ( !(value = homeCountry()).isEmpty() )
502 text += Qtopia::escapeString(value) + "<br>"; 550 text += Qtopia::escapeString(value) + "<br>";
503 551
504 // the others... 552 // rest of Home data
505 QString str; 553 str = homeWebpage();
506 QString defEmail = defaultEmail(); 554 if ( !str.isEmpty() ){
507 if ( !defEmail.isEmpty() ) 555 text += "<b>" + QObject::tr("Home Web Page: ") + "</b>"
508 text += "<b>" + QObject::tr("Default Email: ") + "</b>"
509 + Qtopia::escapeString(defEmail) + "<br>";
510 str = emails();
511 if ( !str.isEmpty() && ( str != defEmail ) )
512 text += "<b>" + QObject::tr("All Emails: ") + "</b>"
513 + Qtopia::escapeString(str) + "<br>"; 556 + Qtopia::escapeString(str) + "<br>";
557 marker = true;
558 }
514 str = homePhone(); 559 str = homePhone();
515 if ( !str.isEmpty() ) 560 if ( !str.isEmpty() ){
516 text += "<b>" + QObject::tr("Home Phone: ") + "</b>" 561 text += "<b>" + QObject::tr("Home Phone: ") + "</b>"
517 + Qtopia::escapeString(str) + "<br>"; 562 + Qtopia::escapeString(str) + "<br>";
563 marker = true;
564 }
518 str = homeFax(); 565 str = homeFax();
519 if ( !str.isEmpty() ) 566 if ( !str.isEmpty() ){
520 text += "<b>" + QObject::tr("Home Fax: ") + "</b>" 567 text += "<b>" + QObject::tr("Home Fax: ") + "</b>"
521 + Qtopia::escapeString(str) + "<br>"; 568 + Qtopia::escapeString(str) + "<br>";
569 marker = true;
570 }
522 str = homeMobile(); 571 str = homeMobile();
523 if ( !str.isEmpty() ) 572 if ( !str.isEmpty() ){
524 text += "<b>" + QObject::tr("Home Mobile: ") + "</b>" 573 text += "<b>" + QObject::tr("Home Mobile: ") + "</b>"
525 + Qtopia::escapeString(str) + "<br>"; 574 + Qtopia::escapeString(str) + "<br>";
526 str = homeWebpage(); 575 marker = true;
527 if ( !str.isEmpty() ) 576 }
528 text += "<b>" + QObject::tr("Home Web Page: ") + "</b>" 577
529 + Qtopia::escapeString(str) + "<br>"; 578 if ( marker )
530 str = businessWebpage(); 579 text += "<br><hr><br>";
531 if ( !str.isEmpty() ) 580 // the others...
532 text += "<b>" + QObject::tr("Business Web Page: ") + "</b>" 581 str = emails();
533 + Qtopia::escapeString(str) + "<br>"; 582 if ( !str.isEmpty() && ( str != defEmail ) )
534 str = office(); 583 text += "<b>" + QObject::tr("All Emails: ") + "</b>"
535 if ( !str.isEmpty() )
536 text += "<b>" + QObject::tr("Office: ") + "</b>"
537 + Qtopia::escapeString(str) + "<br>";
538 str = businessPhone();
539 if ( !str.isEmpty() )
540 text += "<b>" + QObject::tr("Business Phone: ") + "</b>"
541 + Qtopia::escapeString(str) + "<br>";
542 str = businessFax();
543 if ( !str.isEmpty() )
544 text += "<b>" + QObject::tr("Business Fax: ") + "</b>"
545 + Qtopia::escapeString(str) + "<br>";
546 str = businessMobile();
547 if ( !str.isEmpty() )
548 text += "<b>" + QObject::tr("Business Mobile: ") + "</b>"
549 + Qtopia::escapeString(str) + "<br>";
550 str = businessPager();
551 if ( !str.isEmpty() )
552 text += "<b>" + QObject::tr("Business Pager: ") + "</b>"
553 + Qtopia::escapeString(str) + "<br>"; 584 + Qtopia::escapeString(str) + "<br>";
554 str = profession(); 585 str = profession();
555 if ( !str.isEmpty() ) 586 if ( !str.isEmpty() )
@@ -603,12 +634,13 @@ QString OContact::toRichText() const
603 634
604 // notes last 635 // notes last
605 if ( (value = notes()) ) { 636 if ( (value = notes()) ) {
606 QRegExp reg("\n"); 637 text += "<br><hr><b>" + QObject::tr( "Notes:") + "</b> ";
638 QRegExp reg("\n");
607 639
608 //QString tmp = Qtopia::escapeString(value); 640 //QString tmp = Qtopia::escapeString(value);
609 QString tmp = QStyleSheet::convertFromPlainText(value); 641 QString tmp = QStyleSheet::convertFromPlainText(value);
610 //tmp.replace( reg, "<br>" ); 642 //tmp.replace( reg, "<br>" );
611 text += "<br>" + tmp + "<br>"; 643 text += "<br>" + tmp + "<br>";
612 } 644 }
613 return text; 645 return text;
614} 646}
diff --git a/libopie2/opiepim/ocontact.cpp b/libopie2/opiepim/ocontact.cpp
index c9084ad..9230b8b 100644
--- a/libopie2/opiepim/ocontact.cpp
+++ b/libopie2/opiepim/ocontact.cpp
@@ -437,10 +437,12 @@ QString OContact::toRichText() const
437{ 437{
438 QString text; 438 QString text;
439 QString value, comp, state; 439 QString value, comp, state;
440 QString str;
441 bool marker = false;
440 442
441 // name, jobtitle and company 443 // name, jobtitle and company
442 if ( !(value = fullName()).isEmpty() ) 444 if ( !(value = fullName()).isEmpty() )
443 text += "<b>" + Qtopia::escapeString(value) + "</b><br>"; 445 text += "<b><h3>" + Qtopia::escapeString(value) + "</h3></b><br>";
444 if ( !(value = jobTitle()).isEmpty() ) 446 if ( !(value = jobTitle()).isEmpty() )
445 text += Qtopia::escapeString(value) + "<br>"; 447 text += Qtopia::escapeString(value) + "<br>";
446 448
@@ -455,12 +457,20 @@ QString OContact::toRichText() const
455 if ( !comp.isEmpty() ) 457 if ( !comp.isEmpty() )
456 text += Qtopia::escapeString(comp) + "<br>"; 458 text += Qtopia::escapeString(comp) + "<br>";
457 459
460 QString defEmail = defaultEmail();
461 if ( !defEmail.isEmpty() )
462 text += "<b>" + QObject::tr("Default Email: ") + "</b>"
463 + Qtopia::escapeString(defEmail) + "<br>";
464
465 text += "<hr>";
466
458 // business address 467 // business address
459 if ( !businessStreet().isEmpty() || !businessCity().isEmpty() || 468 if ( !businessStreet().isEmpty() || !businessCity().isEmpty() ||
460 !businessZip().isEmpty() || !businessCountry().isEmpty() ) { 469 !businessZip().isEmpty() || !businessCountry().isEmpty() ) {
461 text += "<br>"; 470 text += "<br>";
462 text += QObject::tr( "<b>Work Address:</b>" ); 471 text += QObject::tr( "<b>Work Address:</b>" );
463 text += "<br>"; 472 text += "<br>";
473 marker = true;
464 } 474 }
465 475
466 if ( !(value = businessStreet()).isEmpty() ) 476 if ( !(value = businessStreet()).isEmpty() )
@@ -478,6 +488,44 @@ QString OContact::toRichText() const
478 if ( !(value = businessCountry()).isEmpty() ) 488 if ( !(value = businessCountry()).isEmpty() )
479 text += Qtopia::escapeString(value) + "<br>"; 489 text += Qtopia::escapeString(value) + "<br>";
480 490
491 // rest of Business data
492 str = office();
493 if ( !str.isEmpty() ){
494 text += "<b>" + QObject::tr("Office: ") + "</b>"
495 + Qtopia::escapeString(str) + "<br>";
496 marker = true;
497 }
498 str = businessWebpage();
499 if ( !str.isEmpty() ){
500 text += "<b>" + QObject::tr("Business Web Page: ") + "</b>"
501 + Qtopia::escapeString(str) + "<br>";
502 marker = true;
503 }
504 str = businessPhone();
505 if ( !str.isEmpty() ){
506 text += "<b>" + QObject::tr("Business Phone: ") + "</b>"
507 + Qtopia::escapeString(str) + "<br>";
508 marker = true;
509 }
510 str = businessFax();
511 if ( !str.isEmpty() ){
512 text += "<b>" + QObject::tr("Business Fax: ") + "</b>"
513 + Qtopia::escapeString(str) + "<br>";
514 marker = true;
515 }
516 str = businessMobile();
517 if ( !str.isEmpty() ){
518 text += "<b>" + QObject::tr("Business Mobile: ") + "</b>"
519 + Qtopia::escapeString(str) + "<br>";
520 marker = true;
521 }
522 str = businessPager();
523 if ( !str.isEmpty() ){
524 text += "<b>" + QObject::tr("Business Pager: ") + "</b>"
525 + Qtopia::escapeString(str) + "<br>";
526 marker = true;
527 }
528
481 // home address 529 // home address
482 if ( !homeStreet().isEmpty() || !homeCity().isEmpty() || 530 if ( !homeStreet().isEmpty() || !homeCity().isEmpty() ||
483 !homeZip().isEmpty() || !homeCountry().isEmpty() ) { 531 !homeZip().isEmpty() || !homeCountry().isEmpty() ) {
@@ -501,55 +549,38 @@ QString OContact::toRichText() const
501 if ( !(value = homeCountry()).isEmpty() ) 549 if ( !(value = homeCountry()).isEmpty() )
502 text += Qtopia::escapeString(value) + "<br>"; 550 text += Qtopia::escapeString(value) + "<br>";
503 551
504 // the others... 552 // rest of Home data
505 QString str; 553 str = homeWebpage();
506 QString defEmail = defaultEmail(); 554 if ( !str.isEmpty() ){
507 if ( !defEmail.isEmpty() ) 555 text += "<b>" + QObject::tr("Home Web Page: ") + "</b>"
508 text += "<b>" + QObject::tr("Default Email: ") + "</b>"
509 + Qtopia::escapeString(defEmail) + "<br>";
510 str = emails();
511 if ( !str.isEmpty() && ( str != defEmail ) )
512 text += "<b>" + QObject::tr("All Emails: ") + "</b>"
513 + Qtopia::escapeString(str) + "<br>"; 556 + Qtopia::escapeString(str) + "<br>";
557 marker = true;
558 }
514 str = homePhone(); 559 str = homePhone();
515 if ( !str.isEmpty() ) 560 if ( !str.isEmpty() ){
516 text += "<b>" + QObject::tr("Home Phone: ") + "</b>" 561 text += "<b>" + QObject::tr("Home Phone: ") + "</b>"
517 + Qtopia::escapeString(str) + "<br>"; 562 + Qtopia::escapeString(str) + "<br>";
563 marker = true;
564 }
518 str = homeFax(); 565 str = homeFax();
519 if ( !str.isEmpty() ) 566 if ( !str.isEmpty() ){
520 text += "<b>" + QObject::tr("Home Fax: ") + "</b>" 567 text += "<b>" + QObject::tr("Home Fax: ") + "</b>"
521 + Qtopia::escapeString(str) + "<br>"; 568 + Qtopia::escapeString(str) + "<br>";
569 marker = true;
570 }
522 str = homeMobile(); 571 str = homeMobile();
523 if ( !str.isEmpty() ) 572 if ( !str.isEmpty() ){
524 text += "<b>" + QObject::tr("Home Mobile: ") + "</b>" 573 text += "<b>" + QObject::tr("Home Mobile: ") + "</b>"
525 + Qtopia::escapeString(str) + "<br>"; 574 + Qtopia::escapeString(str) + "<br>";
526 str = homeWebpage(); 575 marker = true;
527 if ( !str.isEmpty() ) 576 }
528 text += "<b>" + QObject::tr("Home Web Page: ") + "</b>" 577
529 + Qtopia::escapeString(str) + "<br>"; 578 if ( marker )
530 str = businessWebpage(); 579 text += "<br><hr><br>";
531 if ( !str.isEmpty() ) 580 // the others...
532 text += "<b>" + QObject::tr("Business Web Page: ") + "</b>" 581 str = emails();
533 + Qtopia::escapeString(str) + "<br>"; 582 if ( !str.isEmpty() && ( str != defEmail ) )
534 str = office(); 583 text += "<b>" + QObject::tr("All Emails: ") + "</b>"
535 if ( !str.isEmpty() )
536 text += "<b>" + QObject::tr("Office: ") + "</b>"
537 + Qtopia::escapeString(str) + "<br>";
538 str = businessPhone();
539 if ( !str.isEmpty() )
540 text += "<b>" + QObject::tr("Business Phone: ") + "</b>"
541 + Qtopia::escapeString(str) + "<br>";
542 str = businessFax();
543 if ( !str.isEmpty() )
544 text += "<b>" + QObject::tr("Business Fax: ") + "</b>"
545 + Qtopia::escapeString(str) + "<br>";
546 str = businessMobile();
547 if ( !str.isEmpty() )
548 text += "<b>" + QObject::tr("Business Mobile: ") + "</b>"
549 + Qtopia::escapeString(str) + "<br>";
550 str = businessPager();
551 if ( !str.isEmpty() )
552 text += "<b>" + QObject::tr("Business Pager: ") + "</b>"
553 + Qtopia::escapeString(str) + "<br>"; 584 + Qtopia::escapeString(str) + "<br>";
554 str = profession(); 585 str = profession();
555 if ( !str.isEmpty() ) 586 if ( !str.isEmpty() )
@@ -603,12 +634,13 @@ QString OContact::toRichText() const
603 634
604 // notes last 635 // notes last
605 if ( (value = notes()) ) { 636 if ( (value = notes()) ) {
606 QRegExp reg("\n"); 637 text += "<br><hr><b>" + QObject::tr( "Notes:") + "</b> ";
638 QRegExp reg("\n");
607 639
608 //QString tmp = Qtopia::escapeString(value); 640 //QString tmp = Qtopia::escapeString(value);
609 QString tmp = QStyleSheet::convertFromPlainText(value); 641 QString tmp = QStyleSheet::convertFromPlainText(value);
610 //tmp.replace( reg, "<br>" ); 642 //tmp.replace( reg, "<br>" );
611 text += "<br>" + tmp + "<br>"; 643 text += "<br>" + tmp + "<br>";
612 } 644 }
613 return text; 645 return text;
614} 646}