-rw-r--r-- | kabc/phonenumber.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kabc/phonenumber.cpp b/kabc/phonenumber.cpp index 897c56d..12b9b09 100644 --- a/kabc/phonenumber.cpp +++ b/kabc/phonenumber.cpp | |||
@@ -143,193 +143,193 @@ void PhoneNumber::simplifyType() | |||
143 | else if ( mType & Cell ) mType = Cell; | 143 | else if ( mType & Cell ) mType = Cell; |
144 | else if ( mType & Work ) mType = Work ; | 144 | else if ( mType & Work ) mType = Work ; |
145 | else if ( mType & Home ) mType = Home; | 145 | else if ( mType & Home ) mType = Home; |
146 | else mType = Pref; | 146 | else mType = Pref; |
147 | } | 147 | } |
148 | bool PhoneNumber::contains( const PhoneNumber &p ) | 148 | bool PhoneNumber::contains( const PhoneNumber &p ) |
149 | { | 149 | { |
150 | PhoneNumber myself; | 150 | PhoneNumber myself; |
151 | PhoneNumber other; | 151 | PhoneNumber other; |
152 | myself = *this; | 152 | myself = *this; |
153 | other = p; | 153 | other = p; |
154 | myself.simplifyNumber(); | 154 | myself.simplifyNumber(); |
155 | other.simplifyNumber(); | 155 | other.simplifyNumber(); |
156 | if ( myself.number() != other.number ()) | 156 | if ( myself.number() != other.number ()) |
157 | return false; | 157 | return false; |
158 | myself.simplifyType(); | 158 | myself.simplifyType(); |
159 | other.simplifyType(); | 159 | other.simplifyType(); |
160 | if ( myself.type() == other.type()) | 160 | if ( myself.type() == other.type()) |
161 | return true; | 161 | return true; |
162 | return false; | 162 | return false; |
163 | } | 163 | } |
164 | 164 | ||
165 | void PhoneNumber::setId( const QString &id ) | 165 | void PhoneNumber::setId( const QString &id ) |
166 | { | 166 | { |
167 | mId = id; | 167 | mId = id; |
168 | } | 168 | } |
169 | 169 | ||
170 | QString PhoneNumber::id() const | 170 | QString PhoneNumber::id() const |
171 | { | 171 | { |
172 | return mId; | 172 | return mId; |
173 | } | 173 | } |
174 | 174 | ||
175 | void PhoneNumber::setNumber( const QString &number ) | 175 | void PhoneNumber::setNumber( const QString &number ) |
176 | { | 176 | { |
177 | mNumber = number; | 177 | mNumber = number; |
178 | } | 178 | } |
179 | 179 | ||
180 | QString PhoneNumber::number() const | 180 | QString PhoneNumber::number() const |
181 | { | 181 | { |
182 | return mNumber; | 182 | return mNumber; |
183 | } | 183 | } |
184 | 184 | ||
185 | void PhoneNumber::setType( int type ) | 185 | void PhoneNumber::setType( int type ) |
186 | { | 186 | { |
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 | QStringList PhoneNumber::supportedTypeListNames() | 235 | QStringList PhoneNumber::supportedTypeListNames() |
236 | { | 236 | { |
237 | static QStringList list; | 237 | static QStringList list; |
238 | if ( list.count() == 0 ) | 238 | 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"); | 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"); |
240 | return list; | 240 | return list; |
241 | } | 241 | } |
242 | 242 | ||
243 | int PhoneNumber::typeListIndex4Type(int type ) | 243 | int PhoneNumber::typeListIndex4Type(int type ) |
244 | { | 244 | { |
245 | TypeList list = supportedTypeList(); | 245 | TypeList list = supportedTypeList(); |
246 | int i = 0; | 246 | int i = 0; |
247 | while ( i < list.count() ) { | 247 | while ( i < list.count() ) { |
248 | if ( list [i] == type ) | 248 | if ( list [i] == type ) |
249 | return i; | 249 | return i; |
250 | ++i; | 250 | ++i; |
251 | } | 251 | } |
252 | return list.count()-1; | 252 | return list.count()-1; |
253 | } | 253 | } |
254 | 254 | ||
255 | QString PhoneNumber::label( int type ) | 255 | QString PhoneNumber::label( int type ) |
256 | { | 256 | { |
257 | return typeLabel( type ); | 257 | return typeLabel( type ); |
258 | } | 258 | } |
259 | 259 | ||
260 | QString PhoneNumber::typeLabel( int type ) | 260 | QString PhoneNumber::typeLabel( int type ) |
261 | { | 261 | { |
262 | if ((type & Cell) == Cell) | 262 | if ((type & Cell) == Cell) |
263 | return i18n("Mobile"); | 263 | return i18n("Mobile"); |
264 | if ((type & Home) == Home) { | 264 | if ((type & Home) == Home) { |
265 | if ((type & Pref) == Pref) | 265 | if ((type & Pref) == Pref) |
266 | return i18n("Home"); | 266 | return i18n("Home"); |
267 | if ((type & Fax) == Fax) | 267 | if ((type & Fax) == Fax) |
268 | return i18n("Fax (Home)"); | 268 | return i18n("Fax (Home)"); |
269 | return i18n("Home2"); | 269 | return i18n("Home2"); |
270 | } | 270 | } |
271 | 271 | ||
272 | if ((type & Work) == Work) { | 272 | if ((type & Work) == Work) { |
273 | if ((type & Pref) == Pref) | 273 | if ((type & Pref) == Pref) |
274 | return i18n("Work"); | 274 | return i18n("Work"); |
275 | if ((type & Fax) == Fax) | 275 | if ((type & Fax) == Fax) |
276 | return i18n("Fax (Work)"); | 276 | return i18n("Fax (Work)"); |
277 | if ((type & Msg) == Msg) { | 277 | if ((type & Msg) == Msg) { |
278 | if ((type & Voice) == Voice) | 278 | if ((type & Voice) == Voice) |
279 | return i18n("Assistent"); | 279 | return i18n("Assistent"); |
280 | return i18n("Company"); | 280 | return i18n("Company"); |
281 | } | 281 | } |
282 | return i18n("Work2"); | 282 | return i18n("Work2"); |
283 | } | 283 | } |
284 | if ((type & Pcs) == Pcs) { | 284 | if ((type & Pcs) == Pcs) { |
285 | if ((type & Pref) == Pref) | 285 | if ((type & Pref) == Pref) |
286 | return i18n("SiP"); | 286 | return i18n("SiP"); |
287 | if ((type & Voice) == Voice) | 287 | if ((type & Voice) == Voice) |
288 | return i18n("VoIP"); | 288 | return i18n("VoIP"); |
289 | return i18n("SiP2"); | 289 | return i18n("SiP2"); |
290 | } | 290 | } |
291 | if ((type & Car) == Car) | 291 | if ((type & Car) == Car) |
292 | return i18n("Mobile2"); | 292 | return i18n("Mobile2"); |
293 | if ((type & Pager) == Pager) | 293 | if ((type & Pager) == Pager) |
294 | return i18n("Pager"); | 294 | return i18n("Pager"); |
295 | if ((type & Isdn) == Isdn) | 295 | if ((type & Isdn) == Isdn) |
296 | return i18n("ISDN"); | 296 | return i18n("ISDN"); |
297 | if ((type & Video) == Video) | 297 | if ((type & Video) == Video) |
298 | return i18n("Video"); | 298 | return i18n("Video"); |
299 | 299 | ||
300 | if ((type & Msg) == Msg) | 300 | if ((type & Msg) == Msg) |
301 | return i18n("Callback"); | 301 | return i18n("Callback"); |
302 | if ((type & Fax) == Fax) | 302 | if ((type & Fax) == Fax) |
303 | return i18n("Fax (Other)"); | 303 | return i18n("Fax (Other)"); |
304 | 304 | ||
305 | if ((type & Pref) == Pref) | 305 | if ((type & Pref) == Pref) |
306 | return i18n("Primary"); | 306 | return i18n("Primary"); |
307 | 307 | ||
308 | 308 | ||
309 | return i18n("Other"); | 309 | return i18n("Other"); |
310 | 310 | ||
311 | 311 | ||
312 | #if 0 | 312 | #if 0 |
313 | 313 | ||
314 | 314 | ||
315 | 315 | ||
316 | QString typeString; | 316 | QString typeString; |
317 | 317 | ||
318 | 318 | ||
319 | if ((type & Cell) == Cell) | 319 | if ((type & Cell) == Cell) |
320 | typeString += i18n("Mobile") +" "; | 320 | typeString += i18n("Mobile") +" "; |
321 | if ((type & Home) == Home) | 321 | if ((type & Home) == Home) |
322 | typeString += i18n("Home")+" "; | 322 | typeString += i18n("Home")+" "; |
323 | else if ((type & Work) == Work) | 323 | else if ((type & Work) == Work) |
324 | typeString += i18n("Work")+" "; | 324 | typeString += i18n("Work")+" "; |
325 | 325 | ||
326 | if ((type & Sip) == Sip) | 326 | if ((type & Sip) == Sip) |
327 | typeString += i18n("SIP")+" "; | 327 | typeString += i18n("SIP")+" "; |
328 | if ((type & Car) == Car) | 328 | if ((type & Car) == Car) |
329 | typeString += i18n("Car")+" "; | 329 | typeString += i18n("Car")+" "; |
330 | 330 | ||
331 | if ((type & Fax) == Fax) | 331 | if ((type & Fax) == Fax) |
332 | typeString += i18n("Fax"); | 332 | typeString += i18n("Fax"); |
333 | else if ((type & Msg) == Msg) | 333 | else if ((type & Msg) == Msg) |
334 | typeString += i18n("Messenger"); | 334 | typeString += i18n("Messenger"); |
335 | else if ((type & Video) == Video) | 335 | else if ((type & Video) == Video) |