-rw-r--r-- | kabc/addresseeview.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp index 05d604f..aae923c 100644 --- a/kabc/addresseeview.cpp +++ b/kabc/addresseeview.cpp | |||
@@ -523,131 +523,133 @@ mText = "<table width=\"100%\">\n"; | |||
523 | mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>" | 523 | mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>" |
524 | "<td align=\"left\"><b>%2</b></td></tr>" ) | 524 | "<td align=\"left\"><b>%2</b></td></tr>" ) |
525 | .arg( i18n(" ") ) | 525 | .arg( i18n(" ") ) |
526 | .arg( name ); | 526 | .arg( name ); |
527 | */ | 527 | */ |
528 | if ( ! mAddressee.role().isEmpty() ) | 528 | if ( ! mAddressee.role().isEmpty() ) |
529 | mText += QString("<tr><td align=\"right\"><b>%1</b></td>" | 529 | mText += QString("<tr><td align=\"right\"><b>%1</b></td>" |
530 | "<td align=\"left\">%2</td></tr>" ) | 530 | "<td align=\"left\">%2</td></tr>" ) |
531 | .arg( i18n(" ") ) | 531 | .arg( i18n(" ") ) |
532 | .arg( mAddressee.role()); | 532 | .arg( mAddressee.role()); |
533 | if ( ! mAddressee.organization().isEmpty() ) | 533 | if ( ! mAddressee.organization().isEmpty() ) |
534 | mText += QString("<tr><td align=\"right\"><b>%1</b></td>" | 534 | mText += QString("<tr><td align=\"right\"><b>%1</b></td>" |
535 | "<td align=\"left\">%2</td></tr>" ) | 535 | "<td align=\"left\">%2</td></tr>" ) |
536 | .arg( i18n(" ") ) | 536 | .arg( i18n(" ") ) |
537 | .arg( mAddressee.organization()); | 537 | .arg( mAddressee.organization()); |
538 | mText += dynamicPart; | 538 | mText += dynamicPart; |
539 | mText += notes; | 539 | mText += notes; |
540 | mText += "</table>"; | 540 | mText += "</table>"; |
541 | 541 | ||
542 | } | 542 | } |
543 | 543 | ||
544 | // at last display it... | 544 | // at last display it... |
545 | setText( mText ); | 545 | setText( mText ); |
546 | 546 | ||
547 | } | 547 | } |
548 | 548 | ||
549 | QString AddresseeView::getPhoneNumbers( KABC::PhoneNumber::List phones ,bool preferred ) | 549 | QString AddresseeView::getPhoneNumbers( KABC::PhoneNumber::List phones ,bool preferred ) |
550 | { | 550 | { |
551 | ExternalAppHandler* eah = ExternalAppHandler::instance(); | 551 | ExternalAppHandler* eah = ExternalAppHandler::instance(); |
552 | bool kphoneAvail = eah->isPhoneAppAvailable(); | 552 | bool kphoneAvail = eah->isPhoneAppAvailable(); |
553 | bool kfaxAvail = eah->isFaxAppAvailable(); | 553 | bool kfaxAvail = eah->isFaxAppAvailable(); |
554 | bool ksmsAvail = eah->isSMSAppAvailable(); | 554 | bool ksmsAvail = eah->isSMSAppAvailable(); |
555 | bool kpagerAvail = eah->isPagerAppAvailable(); | 555 | bool kpagerAvail = eah->isPagerAppAvailable(); |
556 | bool ksipAvail = eah->isSIPAppAvailable(); | 556 | bool ksipAvail = eah->isSIPAppAvailable(); |
557 | QString dynamicPart; | 557 | QString dynamicPart; |
558 | KABC::PhoneNumber::List::ConstIterator phoneIt; | 558 | KABC::PhoneNumber::List::ConstIterator phoneIt; |
559 | QString extension; | 559 | QString extension; |
560 | int phonetype; | 560 | int phonetype; |
561 | QString sms; | 561 | QString sms; |
562 | for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) { | 562 | for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) { |
563 | phonetype = (*phoneIt).type(); | 563 | phonetype = (*phoneIt).type(); |
564 | if ( ((phonetype & KABC::PhoneNumber::Pref) == 0 ) == preferred ) | 564 | if ( ((phonetype & KABC::PhoneNumber::Pref) == 0 ) == preferred ) |
565 | continue; | 565 | continue; |
566 | if (ksmsAvail && | 566 | if (ksmsAvail && |
567 | ( | 567 | ( |
568 | ((phonetype & KABC::PhoneNumber::Car) == KABC::PhoneNumber::Car) || | 568 | ((phonetype & KABC::PhoneNumber::Car) == KABC::PhoneNumber::Car) || |
569 | ((phonetype & KABC::PhoneNumber::Cell) == KABC::PhoneNumber::Cell) | 569 | ((phonetype & KABC::PhoneNumber::Cell) == KABC::PhoneNumber::Cell) |
570 | ) | 570 | ) |
571 | ) | 571 | ) |
572 | { | 572 | { |
573 | sms = QString("<a href=\"smsto:%1 \">(sms)</a>" ) | 573 | sms = QString("<a href=\"smsto:%1 \">(sms)</a>" ) |
574 | .arg( (*phoneIt).number() ); | 574 | .arg( (*phoneIt).number() ); |
575 | 575 | ||
576 | } | 576 | } |
577 | else | 577 | else |
578 | sms = ""; | 578 | sms = ""; |
579 | 579 | ||
580 | extension = QString::null; | 580 | extension = QString::null; |
581 | if ((phonetype & KABC::PhoneNumber::Fax) == KABC::PhoneNumber::Fax) { | 581 | if ((phonetype & KABC::PhoneNumber::Fax) == KABC::PhoneNumber::Fax) { |
582 | if (kfaxAvail) extension = "faxto:"; | 582 | if (kfaxAvail) extension = "faxto:"; |
583 | } | 583 | } |
584 | else if ((phonetype & KABC::PhoneNumber::Pager) == KABC::PhoneNumber::Pager) { | 584 | else if ((phonetype & KABC::PhoneNumber::Pager) == KABC::PhoneNumber::Pager) { |
585 | if (kpagerAvail) extension = "pagerto:"; | 585 | if (kpagerAvail) extension = "pagerto:"; |
586 | } | 586 | } |
587 | #if 0 | ||
587 | else if ((phonetype & KABC::PhoneNumber::Sip) == KABC::PhoneNumber::Sip) { | 588 | else if ((phonetype & KABC::PhoneNumber::Sip) == KABC::PhoneNumber::Sip) { |
588 | if (ksipAvail) extension = "sipto:"; | 589 | if (ksipAvail) extension = "sipto:"; |
589 | } | 590 | } |
591 | #endif | ||
590 | else if (kphoneAvail) { | 592 | else if (kphoneAvail) { |
591 | extension = "phoneto:"; | 593 | extension = "phoneto:"; |
592 | } | 594 | } |
593 | else | 595 | else |
594 | extension = QString::null; | 596 | extension = QString::null; |
595 | 597 | ||
596 | if ( !extension.isEmpty() ) { | 598 | if ( !extension.isEmpty() ) { |
597 | dynamicPart += QString( | 599 | dynamicPart += QString( |
598 | "<tr><td align=\"right\"><b>%1</b></td>" | 600 | "<tr><td align=\"right\"><b>%1</b></td>" |
599 | "<td align=\"left\"><a href=\"%2%3 \">%4</a> %5</td></tr>" ) | 601 | "<td align=\"left\"><a href=\"%2%3 \">%4</a> %5</td></tr>" ) |
600 | .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) | 602 | .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) |
601 | .arg( extension ) | 603 | .arg( extension ) |
602 | .arg( (*phoneIt).number() ) | 604 | .arg( (*phoneIt).number() ) |
603 | .arg( (*phoneIt).number() ) | 605 | .arg( (*phoneIt).number() ) |
604 | .arg( sms ); | 606 | .arg( sms ); |
605 | 607 | ||
606 | } else { | 608 | } else { |
607 | dynamicPart += QString( | 609 | dynamicPart += QString( |
608 | "<tr><td align=\"right\"><b>%1</b></td>" | 610 | "<tr><td align=\"right\"><b>%1</b></td>" |
609 | "<td align=\"left\">%2 %3</td></tr>" ) | 611 | "<td align=\"left\">%2 %3</td></tr>" ) |
610 | .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) | 612 | .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) |
611 | .arg( (*phoneIt).number() ) | 613 | .arg( (*phoneIt).number() ) |
612 | .arg( sms ); | 614 | .arg( sms ); |
613 | } | 615 | } |
614 | } | 616 | } |
615 | return dynamicPart; | 617 | return dynamicPart; |
616 | } | 618 | } |
617 | /* | 619 | /* |
618 | KABC::Addressee AddresseeView::addressee() const | 620 | KABC::Addressee AddresseeView::addressee() const |
619 | { | 621 | { |
620 | return mAddressee; | 622 | return mAddressee; |
621 | } | 623 | } |
622 | */ | 624 | */ |
623 | void AddresseeView::addTag(const QString & tag,const QString & text) | 625 | void AddresseeView::addTag(const QString & tag,const QString & text) |
624 | { | 626 | { |
625 | if ( text.isEmpty() ) | 627 | if ( text.isEmpty() ) |
626 | return; | 628 | return; |
627 | int number=text.contains("\n"); | 629 | int number=text.contains("\n"); |
628 | QString str = "<" + tag + ">"; | 630 | QString str = "<" + tag + ">"; |
629 | QString tmpText=text; | 631 | QString tmpText=text; |
630 | QString tmpStr=str; | 632 | QString tmpStr=str; |
631 | if(number !=-1) | 633 | if(number !=-1) |
632 | { | 634 | { |
633 | if (number > 0) { | 635 | if (number > 0) { |
634 | int pos=0; | 636 | int pos=0; |
635 | QString tmp; | 637 | QString tmp; |
636 | for(int i=0;i<=number;i++) { | 638 | for(int i=0;i<=number;i++) { |
637 | pos=tmpText.find("\n"); | 639 | pos=tmpText.find("\n"); |
638 | tmp=tmpText.left(pos); | 640 | tmp=tmpText.left(pos); |
639 | tmpText=tmpText.right(tmpText.length()-pos-1); | 641 | tmpText=tmpText.right(tmpText.length()-pos-1); |
640 | tmpStr+=tmp+"<br>"; | 642 | tmpStr+=tmp+"<br>"; |
641 | } | 643 | } |
642 | } | 644 | } |
643 | else tmpStr += tmpText; | 645 | else tmpStr += tmpText; |
644 | tmpStr+="</" + tag + ">"; | 646 | tmpStr+="</" + tag + ">"; |
645 | mText.append(tmpStr); | 647 | mText.append(tmpStr); |
646 | } | 648 | } |
647 | else | 649 | else |
648 | { | 650 | { |
649 | str += text + "</" + tag + ">"; | 651 | str += text + "</" + tag + ">"; |
650 | mText.append(str); | 652 | mText.append(str); |
651 | } | 653 | } |
652 | } | 654 | } |
653 | 655 | ||