-rw-r--r-- | kabc/addresseeview.cpp | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp index 5c24acf..cde19a1 100644 --- a/kabc/addresseeview.cpp +++ b/kabc/addresseeview.cpp | |||
@@ -519,81 +519,106 @@ mText = "<table width=\"100%\">\n"; | |||
519 | #endif | 519 | #endif |
520 | 520 | ||
521 | mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; | 521 | mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; |
522 | 522 | ||
523 | mText += "<table><td colspan=\"2\"> </td>"; | 523 | mText += "<table><td colspan=\"2\"> </td>"; |
524 | /* | 524 | /* |
525 | mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>" | 525 | mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>" |
526 | "<td align=\"left\"><b>%2</b></td></tr>" ) | 526 | "<td align=\"left\"><b>%2</b></td></tr>" ) |
527 | .arg( i18n(" ") ) | 527 | .arg( i18n(" ") ) |
528 | .arg( name ); | 528 | .arg( name ); |
529 | */ | 529 | */ |
530 | if ( ! mAddressee.role().isEmpty() ) | 530 | if ( ! mAddressee.role().isEmpty() ) |
531 | mText += QString("<tr><td align=\"right\"><b>%1</b></td>" | 531 | mText += QString("<tr><td align=\"right\"><b>%1</b></td>" |
532 | "<td align=\"left\">%2</td></tr>" ) | 532 | "<td align=\"left\">%2</td></tr>" ) |
533 | .arg( i18n(" ") ) | 533 | .arg( i18n(" ") ) |
534 | .arg( mAddressee.role()); | 534 | .arg( mAddressee.role()); |
535 | if ( ! mAddressee.organization().isEmpty() ) | 535 | if ( ! mAddressee.organization().isEmpty() ) |
536 | mText += QString("<tr><td align=\"right\"><b>%1</b></td>" | 536 | mText += QString("<tr><td align=\"right\"><b>%1</b></td>" |
537 | "<td align=\"left\">%2</td></tr>" ) | 537 | "<td align=\"left\">%2</td></tr>" ) |
538 | .arg( i18n(" ") ) | 538 | .arg( i18n(" ") ) |
539 | .arg( mAddressee.organization()); | 539 | .arg( mAddressee.organization()); |
540 | mText += dynamicPart; | 540 | mText += dynamicPart; |
541 | mText += notes; | 541 | mText += notes; |
542 | mText += "</table>"; | 542 | mText += "</table>"; |
543 | 543 | ||
544 | } | 544 | } |
545 | 545 | ||
546 | // at last display it... | 546 | // at last display it... |
547 | setText( mText ); | 547 | setText( mText ); |
548 | 548 | ||
549 | } | 549 | } |
550 | 550 | ||
551 | QString AddresseeView::getPhoneNumbers( KABC::PhoneNumber::List phones ,bool preferred ) | 551 | QString AddresseeView::getPhoneNumbers( KABC::PhoneNumber::List phones_unsorted ,bool preferred ) |
552 | { | 552 | { |
553 | ExternalAppHandler* eah = ExternalAppHandler::instance(); | 553 | ExternalAppHandler* eah = ExternalAppHandler::instance(); |
554 | bool kphoneAvail = eah->isPhoneAppAvailable(); | 554 | bool kphoneAvail = eah->isPhoneAppAvailable(); |
555 | bool kfaxAvail = eah->isFaxAppAvailable(); | 555 | bool kfaxAvail = eah->isFaxAppAvailable(); |
556 | bool ksmsAvail = eah->isSMSAppAvailable(); | 556 | bool ksmsAvail = eah->isSMSAppAvailable(); |
557 | bool kpagerAvail = eah->isPagerAppAvailable(); | 557 | bool kpagerAvail = eah->isPagerAppAvailable(); |
558 | bool ksipAvail = eah->isSIPAppAvailable(); | 558 | bool ksipAvail = eah->isSIPAppAvailable(); |
559 | QString dynamicPart; | 559 | QString dynamicPart; |
560 | KABC::PhoneNumber::List::ConstIterator phoneIt; | 560 | KABC::PhoneNumber::List::ConstIterator phoneIt; |
561 | QString extension; | 561 | QString extension; |
562 | int phonetype; | 562 | int phonetype; |
563 | QString sms; | 563 | QString sms; |
564 | |||
565 | KABC::PhoneNumber::List::Iterator it; | ||
566 | KABC::PhoneNumber::List phones ; | ||
567 | |||
568 | PhoneNumber::TypeList tList = PhoneNumber::supportedTypeList(); | ||
569 | int i = 0; | ||
570 | int max = tList.count(); | ||
571 | while ( i < max-1 ) { | ||
572 | for ( it = phones_unsorted.begin(); it != phones_unsorted.end(); ++it ) { | ||
573 | if ( (*it).type() == tList[i] ) { | ||
574 | phones.append( (*it ) ); | ||
575 | break; | ||
576 | } | ||
577 | } | ||
578 | ++i; | ||
579 | } | ||
580 | for ( it = phones_unsorted.begin(); it != phones_unsorted.end(); ++it ) { | ||
581 | if ( (*it).type() == tList[ max-1 ] ) | ||
582 | phones.append( (*it ) ); | ||
583 | } | ||
584 | |||
564 | for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) { | 585 | for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) { |
565 | phonetype = (*phoneIt).type(); | 586 | phonetype = (*phoneIt).type(); |
566 | if ( ((phonetype & KABC::PhoneNumber::Pref) == 0 ) == preferred ) | 587 | bool con = false; |
588 | if ( ((phonetype & KABC::PhoneNumber::Pref) == 0 ) == preferred ) con = true; | ||
589 | if ((phonetype & KABC::PhoneNumber::Cell) == KABC::PhoneNumber::Cell ) con = !preferred;; | ||
590 | if ( con ) | ||
567 | continue; | 591 | continue; |
592 | |||
568 | if (ksmsAvail && | 593 | if (ksmsAvail && |
569 | ( | 594 | ( |
570 | ((phonetype & KABC::PhoneNumber::Car) == KABC::PhoneNumber::Car) || | 595 | ((phonetype & KABC::PhoneNumber::Car) == KABC::PhoneNumber::Car) || |
571 | ((phonetype & KABC::PhoneNumber::Cell) == KABC::PhoneNumber::Cell) | 596 | ((phonetype & KABC::PhoneNumber::Cell) == KABC::PhoneNumber::Cell) |
572 | ) | 597 | ) |
573 | ) | 598 | ) |
574 | { | 599 | { |
575 | sms = QString("<a href=\"smsto:%1 \">(sms)</a>" ) | 600 | sms = QString("<a href=\"smsto:%1 \">(sms)</a>" ) |
576 | .arg( (*phoneIt).number() ); | 601 | .arg( (*phoneIt).number() ); |
577 | 602 | ||
578 | } | 603 | } |
579 | else | 604 | else |
580 | sms = ""; | 605 | sms = ""; |
581 | 606 | ||
582 | extension = QString::null; | 607 | extension = QString::null; |
583 | if ((phonetype & KABC::PhoneNumber::Fax) == KABC::PhoneNumber::Fax) { | 608 | if ((phonetype & KABC::PhoneNumber::Fax) == KABC::PhoneNumber::Fax) { |
584 | if (kfaxAvail) extension = "faxto:"; | 609 | if (kfaxAvail) extension = "faxto:"; |
585 | } | 610 | } |
586 | else if ((phonetype & KABC::PhoneNumber::Pager) == KABC::PhoneNumber::Pager) { | 611 | else if ((phonetype & KABC::PhoneNumber::Pager) == KABC::PhoneNumber::Pager) { |
587 | if (kpagerAvail) extension = "pagerto:"; | 612 | if (kpagerAvail) extension = "pagerto:"; |
588 | } | 613 | } |
589 | #if 0 | 614 | #if 0 |
590 | else if ((phonetype & KABC::PhoneNumber::Sip) == KABC::PhoneNumber::Sip) { | 615 | else if ((phonetype & KABC::PhoneNumber::Sip) == KABC::PhoneNumber::Sip) { |
591 | if (ksipAvail) extension = "sipto:"; | 616 | if (ksipAvail) extension = "sipto:"; |
592 | } | 617 | } |
593 | #endif | 618 | #endif |
594 | else if (kphoneAvail) { | 619 | else if (kphoneAvail) { |
595 | extension = "phoneto:"; | 620 | extension = "phoneto:"; |
596 | } | 621 | } |
597 | else | 622 | else |
598 | extension = QString::null; | 623 | extension = QString::null; |
599 | 624 | ||