summaryrefslogtreecommitdiffabout
path: root/kabc
authorzautrix <zautrix>2005-10-29 22:45:39 (UTC)
committer zautrix <zautrix>2005-10-29 22:45:39 (UTC)
commitb06fa1090f3fa7a71ab2710be444815df8bd6c17 (patch) (unidiff)
tree16f5aed10d0c78c255ae732959e3dd184ae5e218 /kabc
parenta4f17bd35c56280c45bda847b42b7d3a003b0a42 (diff)
downloadkdepimpi-b06fa1090f3fa7a71ab2710be444815df8bd6c17.zip
kdepimpi-b06fa1090f3fa7a71ab2710be444815df8bd6c17.tar.gz
kdepimpi-b06fa1090f3fa7a71ab2710be444815df8bd6c17.tar.bz2
commit
Diffstat (limited to 'kabc') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressee.cpp2
-rw-r--r--kabc/addresseeview.cpp29
-rw-r--r--kabc/phonenumber.cpp15
3 files changed, 38 insertions, 8 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 2f4a9af..6cfac80 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -1089,13 +1089,13 @@ QString Addressee::otherPhoneLabel()
1089{ 1089{
1090 return i18n("Other Phone"); 1090 return i18n("Other Phone");
1091} 1091}
1092 1092
1093QString Addressee::sipLabel() 1093QString Addressee::sipLabel()
1094{ 1094{
1095 return i18n("SIP"); 1095 return i18n("SiP");
1096} 1096}
1097 1097
1098QString Addressee::emailLabel() 1098QString Addressee::emailLabel()
1099{ 1099{
1100 return i18n("Email Address"); 1100 return i18n("Email Address");
1101} 1101}
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
551QString AddresseeView::getPhoneNumbers( KABC::PhoneNumber::List phones ,bool preferred ) 551QString 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 )
diff --git a/kabc/phonenumber.cpp b/kabc/phonenumber.cpp
index 6db1bcf..897c56d 100644
--- a/kabc/phonenumber.cpp
+++ b/kabc/phonenumber.cpp
@@ -96,23 +96,26 @@ int PhoneNumber::getCompatType( int type )
96 } 96 }
97 return Work; 97 return Work;
98 } 98 }
99 if ((type & Pcs) == Pcs) { 99 if ((type & Pcs) == Pcs) {
100 if ((type & Pref) == Pref) 100 if ((type & Pref) == Pref)
101 return Pcs | Pref; 101 return Pcs | Pref;
102 if ((type & Voice) == Voice)
103 return Pcs | Voice;
102 return Pcs; 104 return Pcs;
103 } 105 }
104 if ((type & Car) == Car) 106 if ((type & Car) == Car)
105 return Car; 107 return Car;
106 if ((type & Pager) == Pager) 108 if ((type & Pager) == Pager)
107 return Pager; 109 return Pager;
108 if ((type & Isdn) == Isdn) 110 if ((type & Isdn) == Isdn)
109 return Isdn; 111 return Isdn;
112#if 0
110 if ((type & Video) == Video) 113 if ((type & Video) == Video)
111 return Video; 114 return Video;
112 115#endif
113 if ((type & Msg) == Msg) 116 if ((type & Msg) == Msg)
114 return Msg; 117 return Msg;
115 if ((type & Fax) == Fax) 118 if ((type & Fax) == Fax)
116 return Fax; 119 return Fax;
117 120
118 if ((type & Pref) == Pref) 121 if ((type & Pref) == Pref)
@@ -223,20 +226,20 @@ PhoneNumber::TypeList PhoneNumber::typeList()
223 return list; 226 return list;
224} 227}
225PhoneNumber::TypeList PhoneNumber::supportedTypeList() 228PhoneNumber::TypeList PhoneNumber::supportedTypeList()
226{ 229{
227 static TypeList list; 230 static TypeList list;
228 if ( list.count() == 0 ) 231 if ( list.count() == 0 )
229 list << (Home| Pref) << (Work| Pref) << Cell <<(Pcs|Pref)<< Pcs<< Home << Work << Car << (Work| Msg | Voice) << (Work| Msg) << (Home | Fax) << (Work| Fax) << Fax<< Pager << Isdn << Video << Msg << Pref << Voice; 232 list << (Home| Pref) << (Work| Pref) << Cell <<(Pcs|Pref)<< (Pcs|Voice)<< Home << Work << Car << Pcs <<(Work| Msg | Voice) << (Work| Msg) << (Home | Fax) << (Work| Fax) << Fax<< Pager << Isdn << Msg << Pref << Voice;
230 return list; 233 return list;
231} 234}
232QStringList PhoneNumber::supportedTypeListNames() 235QStringList PhoneNumber::supportedTypeListNames()
233{ 236{
234 static QStringList list; 237 static QStringList list;
235 if ( list.count() == 0 ) 238 if ( list.count() == 0 )
236 list << i18n("Home") << i18n("Work") << i18n("Mobile") << i18n("SIP") << i18n("VoIP") <<i18n("Home2")<< i18n("Work2") << i18n("Mobile2") << i18n("Assistent") << i18n("Company") << i18n("Fax (Home)") << i18n("Fax (Work)") << i18n("Fax (Other)") << i18n("Pager") << i18n("ISDN") << i18n("Video") << i18n("Callback") << i18n("Primary")<< i18n("Other"); 239 list << i18n("Home") << i18n("Work") << i18n("Mobile") << i18n("SIP") << i18n("VoIP") <<i18n("Home2")<< i18n("Work2") << i18n("Mobile2") << i18n("SIP2") << i18n("Assistent") << i18n("Company") << i18n("Fax (Home)") << i18n("Fax (Work)") << i18n("Fax (Other)") << i18n("Pager") << i18n("ISDN") << i18n("Callback") << i18n("Primary")<< i18n("Other");
237 return list; 240 return list;
238} 241}
239 242
240int PhoneNumber::typeListIndex4Type(int type ) 243int PhoneNumber::typeListIndex4Type(int type )
241{ 244{
242 TypeList list = supportedTypeList(); 245 TypeList list = supportedTypeList();
@@ -277,14 +280,16 @@ QString PhoneNumber::typeLabel( int type )
277 return i18n("Company"); 280 return i18n("Company");
278 } 281 }
279 return i18n("Work2"); 282 return i18n("Work2");
280 } 283 }
281 if ((type & Pcs) == Pcs) { 284 if ((type & Pcs) == Pcs) {
282 if ((type & Pref) == Pref) 285 if ((type & Pref) == Pref)
283 return i18n("SIP"); 286 return i18n("SiP");
284 return i18n("VoIP"); 287 if ((type & Voice) == Voice)
288 return i18n("VoIP");
289 return i18n("SiP2");
285 } 290 }
286 if ((type & Car) == Car) 291 if ((type & Car) == Car)
287 return i18n("Mobile2"); 292 return i18n("Mobile2");
288 if ((type & Pager) == Pager) 293 if ((type & Pager) == Pager)
289 return i18n("Pager"); 294 return i18n("Pager");
290 if ((type & Isdn) == Isdn) 295 if ((type & Isdn) == Isdn)