author | zautrix <zautrix> | 2005-10-29 22:45:39 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-10-29 22:45:39 (UTC) |
commit | b06fa1090f3fa7a71ab2710be444815df8bd6c17 (patch) (unidiff) | |
tree | 16f5aed10d0c78c255ae732959e3dd184ae5e218 /kabc | |
parent | a4f17bd35c56280c45bda847b42b7d3a003b0a42 (diff) | |
download | kdepimpi-b06fa1090f3fa7a71ab2710be444815df8bd6c17.zip kdepimpi-b06fa1090f3fa7a71ab2710be444815df8bd6c17.tar.gz kdepimpi-b06fa1090f3fa7a71ab2710be444815df8bd6c17.tar.bz2 |
commit
-rw-r--r-- | kabc/addressee.cpp | 2 | ||||
-rw-r--r-- | kabc/addresseeview.cpp | 29 | ||||
-rw-r--r-- | kabc/phonenumber.cpp | 15 |
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 | |||
@@ -1083,25 +1083,25 @@ QString Addressee::isdnLabel() | |||
1083 | 1083 | ||
1084 | QString Addressee::pagerLabel() | 1084 | QString Addressee::pagerLabel() |
1085 | { | 1085 | { |
1086 | return i18n("Pager"); | 1086 | return i18n("Pager"); |
1087 | } | 1087 | } |
1088 | QString Addressee::otherPhoneLabel() | 1088 | QString Addressee::otherPhoneLabel() |
1089 | { | 1089 | { |
1090 | return i18n("Other Phone"); | 1090 | return i18n("Other Phone"); |
1091 | } | 1091 | } |
1092 | 1092 | ||
1093 | QString Addressee::sipLabel() | 1093 | QString Addressee::sipLabel() |
1094 | { | 1094 | { |
1095 | return i18n("SIP"); | 1095 | return i18n("SiP"); |
1096 | } | 1096 | } |
1097 | 1097 | ||
1098 | QString Addressee::emailLabel() | 1098 | QString Addressee::emailLabel() |
1099 | { | 1099 | { |
1100 | return i18n("Email Address"); | 1100 | return i18n("Email Address"); |
1101 | } | 1101 | } |
1102 | 1102 | ||
1103 | 1103 | ||
1104 | void Addressee::setMailer( const QString &mailer ) | 1104 | void Addressee::setMailer( const QString &mailer ) |
1105 | { | 1105 | { |
1106 | if ( mailer == mData->mailer ) return; | 1106 | if ( mailer == mData->mailer ) return; |
1107 | detach(); | 1107 | detach(); |
diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp index 5c24acf..cde19a1 100644 --- a/kabc/addresseeview.cpp +++ b/kabc/addresseeview.cpp | |||
@@ -539,41 +539,66 @@ mText = "<table width=\"100%\">\n"; | |||
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 |
diff --git a/kabc/phonenumber.cpp b/kabc/phonenumber.cpp index 6db1bcf..897c56d 100644 --- a/kabc/phonenumber.cpp +++ b/kabc/phonenumber.cpp | |||
@@ -90,35 +90,38 @@ int PhoneNumber::getCompatType( int type ) | |||
90 | if ((type & Fax) == Fax) | 90 | if ((type & Fax) == Fax) |
91 | return (Fax |Work); | 91 | return (Fax |Work); |
92 | if ((type & Msg) == Msg) { | 92 | if ((type & Msg) == Msg) { |
93 | if ((type & Voice) == Voice) | 93 | if ((type & Voice) == Voice) |
94 | return ( Msg | Voice |Work); | 94 | return ( Msg | Voice |Work); |
95 | return ( Msg | Work); | 95 | return ( Msg | Work); |
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) |
119 | return Pref; | 122 | return Pref; |
120 | 123 | ||
121 | return Voice; | 124 | return Voice; |
122 | 125 | ||
123 | } | 126 | } |
124 | bool PhoneNumber::simplifyNumber() | 127 | bool PhoneNumber::simplifyNumber() |
@@ -217,32 +220,32 @@ PhoneNumber::TypeList PhoneNumber::typeList() | |||
217 | { | 220 | { |
218 | TypeList list; | 221 | TypeList list; |
219 | 222 | ||
220 | list << Home << Work << Msg << Pref << Voice << Fax << Cell << Video | 223 | list << Home << Work << Msg << Pref << Voice << Fax << Cell << Video |
221 | << Bbs << Modem << Car << Isdn << Pcs << Pager; | 224 | << Bbs << Modem << Car << Isdn << Pcs << Pager; |
222 | 225 | ||
223 | return list; | 226 | return list; |
224 | } | 227 | } |
225 | PhoneNumber::TypeList PhoneNumber::supportedTypeList() | 228 | PhoneNumber::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 | } |
232 | QStringList PhoneNumber::supportedTypeListNames() | 235 | QStringList 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 | ||
240 | int PhoneNumber::typeListIndex4Type(int type ) | 243 | int PhoneNumber::typeListIndex4Type(int type ) |
241 | { | 244 | { |
242 | TypeList list = supportedTypeList(); | 245 | TypeList list = supportedTypeList(); |
243 | int i = 0; | 246 | int i = 0; |
244 | while ( i < list.count() ) { | 247 | while ( i < list.count() ) { |
245 | if ( list [i] == type ) | 248 | if ( list [i] == type ) |
246 | return i; | 249 | return i; |
247 | ++i; | 250 | ++i; |
248 | } | 251 | } |
@@ -271,26 +274,28 @@ QString PhoneNumber::typeLabel( int type ) | |||
271 | return i18n("Work"); | 274 | return i18n("Work"); |
272 | if ((type & Fax) == Fax) | 275 | if ((type & Fax) == Fax) |
273 | return i18n("Fax (Work)"); | 276 | return i18n("Fax (Work)"); |
274 | if ((type & Msg) == Msg) { | 277 | if ((type & Msg) == Msg) { |
275 | if ((type & Voice) == Voice) | 278 | if ((type & Voice) == Voice) |
276 | return i18n("Assistent"); | 279 | return i18n("Assistent"); |
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) |
291 | return i18n("ISDN"); | 296 | return i18n("ISDN"); |
292 | if ((type & Video) == Video) | 297 | if ((type & Video) == Video) |
293 | return i18n("Video"); | 298 | return i18n("Video"); |
294 | 299 | ||
295 | if ((type & Msg) == Msg) | 300 | if ((type & Msg) == Msg) |
296 | return i18n("Callback"); | 301 | return i18n("Callback"); |