-rw-r--r-- | kabc/phonenumber.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/kabc/phonenumber.cpp b/kabc/phonenumber.cpp index 12b9b09..1752745 100644 --- a/kabc/phonenumber.cpp +++ b/kabc/phonenumber.cpp | |||
@@ -187,96 +187,120 @@ void PhoneNumber::setType( int type ) | |||
187 | mType = type; | 187 | mType = type; |
188 | } | 188 | } |
189 | 189 | ||
190 | int PhoneNumber::type() const | 190 | int PhoneNumber::type() const |
191 | { | 191 | { |
192 | return mType; | 192 | return mType; |
193 | } | 193 | } |
194 | 194 | ||
195 | QString PhoneNumber::typeLabel() const | 195 | QString PhoneNumber::typeLabel() const |
196 | { | 196 | { |
197 | QString label; | 197 | QString label; |
198 | bool first = true; | 198 | bool first = true; |
199 | 199 | ||
200 | TypeList list = typeList(); | 200 | TypeList list = typeList(); |
201 | 201 | ||
202 | TypeList::Iterator it; | 202 | TypeList::Iterator it; |
203 | for ( it = list.begin(); it != list.end(); ++it ) { | 203 | for ( it = list.begin(); it != list.end(); ++it ) { |
204 | if ( ( type() & (*it) ) && ( (*it) != Pref ) ) { | 204 | if ( ( type() & (*it) ) && ( (*it) != Pref ) ) { |
205 | label.append( ( first ? "" : "/" ) + typeLabel( *it ) ); | 205 | label.append( ( first ? "" : "/" ) + typeLabel( *it ) ); |
206 | if ( first ) | 206 | if ( first ) |
207 | first = false; | 207 | first = false; |
208 | } | 208 | } |
209 | } | 209 | } |
210 | 210 | ||
211 | return label; | 211 | return label; |
212 | } | 212 | } |
213 | 213 | ||
214 | QString PhoneNumber::label() const | 214 | QString PhoneNumber::label() const |
215 | { | 215 | { |
216 | return typeLabel( type() ); | 216 | return typeLabel( type() ); |
217 | } | 217 | } |
218 | 218 | ||
219 | PhoneNumber::TypeList PhoneNumber::typeList() | 219 | PhoneNumber::TypeList PhoneNumber::typeList() |
220 | { | 220 | { |
221 | TypeList list; | 221 | TypeList list; |
222 | 222 | ||
223 | list << Home << Work << Msg << Pref << Voice << Fax << Cell << Video | 223 | list << Home << Work << Msg << Pref << Voice << Fax << Cell << Video |
224 | << Bbs << Modem << Car << Isdn << Pcs << Pager; | 224 | << Bbs << Modem << Car << Isdn << Pcs << Pager; |
225 | 225 | ||
226 | return list; | 226 | return list; |
227 | } | 227 | } |
228 | PhoneNumber::TypeList PhoneNumber::supportedTypeList() | 228 | PhoneNumber::TypeList PhoneNumber::supportedTypeList() |
229 | { | 229 | { |
230 | static TypeList list; | 230 | static TypeList list; |
231 | if ( list.count() == 0 ) | 231 | if ( list.count() == 0 ) |
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; | 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; |
233 | return list; | 233 | return list; |
234 | } | 234 | } |
235 | |||
236 | #if 0 | ||
237 | Home| Pref i18n("Home") Home | ||
238 | Work| Pref i18n("Work") Business | ||
239 | Cell i18n("Mobile") Mobile | ||
240 | Pcs|Pref i18n("SiP") Radio | ||
241 | Pcs|Voice i18n("VoIP") TTY/TTD | ||
242 | Home i18n("Home2") Home 2 | ||
243 | Work i18n("Work2") Business 2 | ||
244 | Car i18n("Mobile2") Car | ||
245 | Pcs i18n("SiP2") Telex | ||
246 | Work| Msg | Voice i18n("Assistent") Assistent | ||
247 | Work| Msg i18n("Company") Company | ||
248 | Home | Fax i18n("Fax (Home)") Home Fax | ||
249 | Work| Fax i18n("Fax (Work)") Business Fax | ||
250 | Fax i18n("Fax (Other)") Other Fax | ||
251 | Pager i18n("Pager") Pager | ||
252 | Isdn i18n("ISDN") Isdn | ||
253 | Msg i18n("Callback") Callback | ||
254 | Pref i18n("Primary") Primary | ||
255 | Voice; i18n("Other") Other | ||
256 | |||
257 | #endif | ||
258 | |||
235 | QStringList PhoneNumber::supportedTypeListNames() | 259 | QStringList PhoneNumber::supportedTypeListNames() |
236 | { | 260 | { |
237 | static QStringList list; | 261 | static QStringList list; |
238 | if ( list.count() == 0 ) | 262 | if ( list.count() == 0 ) |
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"); | 263 | 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"); |
240 | return list; | 264 | return list; |
241 | } | 265 | } |
242 | 266 | ||
243 | int PhoneNumber::typeListIndex4Type(int type ) | 267 | int PhoneNumber::typeListIndex4Type(int type ) |
244 | { | 268 | { |
245 | TypeList list = supportedTypeList(); | 269 | TypeList list = supportedTypeList(); |
246 | int i = 0; | 270 | int i = 0; |
247 | while ( i < list.count() ) { | 271 | while ( i < list.count() ) { |
248 | if ( list [i] == type ) | 272 | if ( list [i] == type ) |
249 | return i; | 273 | return i; |
250 | ++i; | 274 | ++i; |
251 | } | 275 | } |
252 | return list.count()-1; | 276 | return list.count()-1; |
253 | } | 277 | } |
254 | 278 | ||
255 | QString PhoneNumber::label( int type ) | 279 | QString PhoneNumber::label( int type ) |
256 | { | 280 | { |
257 | return typeLabel( type ); | 281 | return typeLabel( type ); |
258 | } | 282 | } |
259 | 283 | ||
260 | QString PhoneNumber::typeLabel( int type ) | 284 | QString PhoneNumber::typeLabel( int type ) |
261 | { | 285 | { |
262 | if ((type & Cell) == Cell) | 286 | if ((type & Cell) == Cell) |
263 | return i18n("Mobile"); | 287 | return i18n("Mobile"); |
264 | if ((type & Home) == Home) { | 288 | if ((type & Home) == Home) { |
265 | if ((type & Pref) == Pref) | 289 | if ((type & Pref) == Pref) |
266 | return i18n("Home"); | 290 | return i18n("Home"); |
267 | if ((type & Fax) == Fax) | 291 | if ((type & Fax) == Fax) |
268 | return i18n("Fax (Home)"); | 292 | return i18n("Fax (Home)"); |
269 | return i18n("Home2"); | 293 | return i18n("Home2"); |
270 | } | 294 | } |
271 | 295 | ||
272 | if ((type & Work) == Work) { | 296 | if ((type & Work) == Work) { |
273 | if ((type & Pref) == Pref) | 297 | if ((type & Pref) == Pref) |
274 | return i18n("Work"); | 298 | return i18n("Work"); |
275 | if ((type & Fax) == Fax) | 299 | if ((type & Fax) == Fax) |
276 | return i18n("Fax (Work)"); | 300 | return i18n("Fax (Work)"); |
277 | if ((type & Msg) == Msg) { | 301 | if ((type & Msg) == Msg) { |
278 | if ((type & Voice) == Voice) | 302 | if ((type & Voice) == Voice) |
279 | return i18n("Assistent"); | 303 | return i18n("Assistent"); |
280 | return i18n("Company"); | 304 | return i18n("Company"); |
281 | } | 305 | } |
282 | return i18n("Work2"); | 306 | return i18n("Work2"); |