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/phonenumber.cpp | |
parent | a4f17bd35c56280c45bda847b42b7d3a003b0a42 (diff) | |
download | kdepimpi-b06fa1090f3fa7a71ab2710be444815df8bd6c17.zip kdepimpi-b06fa1090f3fa7a71ab2710be444815df8bd6c17.tar.gz kdepimpi-b06fa1090f3fa7a71ab2710be444815df8bd6c17.tar.bz2 |
commit
-rw-r--r-- | kabc/phonenumber.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/kabc/phonenumber.cpp b/kabc/phonenumber.cpp index 6db1bcf..897c56d 100644 --- a/kabc/phonenumber.cpp +++ b/kabc/phonenumber.cpp | |||
@@ -78,59 +78,62 @@ int PhoneNumber::getCompatType( int type ) | |||
78 | return Cell; | 78 | return Cell; |
79 | } | 79 | } |
80 | if ((type & Home) == Home) { | 80 | if ((type & Home) == Home) { |
81 | if ((type & Pref) == Pref) | 81 | if ((type & Pref) == Pref) |
82 | return (Home | Pref); | 82 | return (Home | Pref); |
83 | if ((type & Fax) == Fax) | 83 | if ((type & Fax) == Fax) |
84 | return (Home | Fax); | 84 | return (Home | Fax); |
85 | return (Home); | 85 | return (Home); |
86 | } | 86 | } |
87 | if ((type & Work) == Work) { | 87 | if ((type & Work) == Work) { |
88 | if ((type & Pref) == Pref) | 88 | if ((type & Pref) == Pref) |
89 | return (Work| Pref); | 89 | return (Work| Pref); |
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() |
125 | { | 128 | { |
126 | QString Number; | 129 | QString Number; |
127 | int i; | 130 | int i; |
128 | Number = mNumber.stripWhiteSpace (); | 131 | Number = mNumber.stripWhiteSpace (); |
129 | mNumber = ""; | 132 | mNumber = ""; |
130 | for ( i = 0; i < Number.length(); ++i) { | 133 | for ( i = 0; i < Number.length(); ++i) { |
131 | if ( Number.at(i).isDigit() || Number.at(i) == '+'|| Number.at(i) == '*'|| Number.at(i) == '#' ) | 134 | if ( Number.at(i).isDigit() || Number.at(i) == '+'|| Number.at(i) == '*'|| Number.at(i) == '#' ) |
132 | mNumber += Number.at(i); | 135 | mNumber += Number.at(i); |
133 | } | 136 | } |
134 | return ( mNumber.length() > 0 ); | 137 | return ( mNumber.length() > 0 ); |
135 | } | 138 | } |
136 | // make cellphone compatible | 139 | // make cellphone compatible |
@@ -205,104 +208,106 @@ QString PhoneNumber::typeLabel() const | |||
205 | } | 208 | } |
206 | } | 209 | } |
207 | 210 | ||
208 | return label; | 211 | return label; |
209 | } | 212 | } |
210 | 213 | ||
211 | QString PhoneNumber::label() const | 214 | QString PhoneNumber::label() const |
212 | { | 215 | { |
213 | return typeLabel( type() ); | 216 | return typeLabel( type() ); |
214 | } | 217 | } |
215 | 218 | ||
216 | PhoneNumber::TypeList PhoneNumber::typeList() | 219 | 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 | } |
249 | return list.count()-1; | 252 | return list.count()-1; |
250 | } | 253 | } |
251 | 254 | ||
252 | QString PhoneNumber::label( int type ) | 255 | QString PhoneNumber::label( int type ) |
253 | { | 256 | { |
254 | return typeLabel( type ); | 257 | return typeLabel( type ); |
255 | } | 258 | } |
256 | 259 | ||
257 | QString PhoneNumber::typeLabel( int type ) | 260 | QString PhoneNumber::typeLabel( int type ) |
258 | { | 261 | { |
259 | if ((type & Cell) == Cell) | 262 | if ((type & Cell) == Cell) |
260 | return i18n("Mobile"); | 263 | return i18n("Mobile"); |
261 | if ((type & Home) == Home) { | 264 | if ((type & Home) == Home) { |
262 | if ((type & Pref) == Pref) | 265 | if ((type & Pref) == Pref) |
263 | return i18n("Home"); | 266 | return i18n("Home"); |
264 | if ((type & Fax) == Fax) | 267 | if ((type & Fax) == Fax) |
265 | return i18n("Fax (Home)"); | 268 | return i18n("Fax (Home)"); |
266 | return i18n("Home2"); | 269 | return i18n("Home2"); |
267 | } | 270 | } |
268 | 271 | ||
269 | if ((type & Work) == Work) { | 272 | if ((type & Work) == Work) { |
270 | if ((type & Pref) == Pref) | 273 | if ((type & Pref) == Pref) |
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"); |
297 | if ((type & Fax) == Fax) | 302 | if ((type & Fax) == Fax) |
298 | return i18n("Fax (Other)"); | 303 | return i18n("Fax (Other)"); |
299 | 304 | ||
300 | if ((type & Pref) == Pref) | 305 | if ((type & Pref) == Pref) |
301 | return i18n("Primary"); | 306 | return i18n("Primary"); |
302 | 307 | ||
303 | 308 | ||
304 | return i18n("Other"); | 309 | return i18n("Other"); |
305 | 310 | ||
306 | 311 | ||
307 | #if 0 | 312 | #if 0 |
308 | 313 | ||