summaryrefslogtreecommitdiffabout
path: root/kabc/phonenumber.cpp
Unidiff
Diffstat (limited to 'kabc/phonenumber.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/phonenumber.cpp24
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
190int PhoneNumber::type() const 190int PhoneNumber::type() const
191{ 191{
192 return mType; 192 return mType;
193} 193}
194 194
195QString PhoneNumber::typeLabel() const 195QString 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
214QString PhoneNumber::label() const 214QString PhoneNumber::label() const
215{ 215{
216 return typeLabel( type() ); 216 return typeLabel( type() );
217} 217}
218 218
219PhoneNumber::TypeList PhoneNumber::typeList() 219PhoneNumber::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}
228PhoneNumber::TypeList PhoneNumber::supportedTypeList() 228PhoneNumber::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
237Home| Pref i18n("Home") Home
238Work| Pref i18n("Work") Business
239Cell i18n("Mobile") Mobile
240Pcs|Pref i18n("SiP") Radio
241Pcs|Voice i18n("VoIP") TTY/TTD
242Home i18n("Home2") Home 2
243Work i18n("Work2") Business 2
244Car i18n("Mobile2") Car
245Pcs i18n("SiP2") Telex
246Work| Msg | Voice i18n("Assistent") Assistent
247Work| Msg i18n("Company") Company
248Home | Fax i18n("Fax (Home)") Home Fax
249Work| Fax i18n("Fax (Work)") Business Fax
250Fax i18n("Fax (Other)") Other Fax
251Pager i18n("Pager") Pager
252Isdn i18n("ISDN") Isdn
253Msg i18n("Callback") Callback
254Pref i18n("Primary") Primary
255Voice; i18n("Other") Other
256
257#endif
258
235QStringList PhoneNumber::supportedTypeListNames() 259QStringList 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
243int PhoneNumber::typeListIndex4Type(int type ) 267int 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
255QString PhoneNumber::label( int type ) 279QString PhoneNumber::label( int type )
256{ 280{
257 return typeLabel( type ); 281 return typeLabel( type );
258} 282}
259 283
260QString PhoneNumber::typeLabel( int type ) 284QString 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");