-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 | |||
@@ -545,29 +545,54 @@ mText = "<table width=\"100%\">\n"; | |||
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 | ) |