-rw-r--r-- | kabc/address.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/kabc/address.cpp b/kabc/address.cpp index 26e0b6a..c820a6c 100644 --- a/kabc/address.cpp +++ b/kabc/address.cpp | |||
@@ -245,122 +245,143 @@ QString Address::postalCodeLabel() | |||
245 | 245 | ||
246 | 246 | ||
247 | void Address::setCountry( const QString &s ) | 247 | void Address::setCountry( const QString &s ) |
248 | { | 248 | { |
249 | mEmpty = false; | 249 | mEmpty = false; |
250 | 250 | ||
251 | mCountry = s; | 251 | mCountry = s; |
252 | } | 252 | } |
253 | 253 | ||
254 | QString Address::country() const | 254 | QString Address::country() const |
255 | { | 255 | { |
256 | return mCountry; | 256 | return mCountry; |
257 | } | 257 | } |
258 | 258 | ||
259 | QString Address::countryLabel() | 259 | QString Address::countryLabel() |
260 | { | 260 | { |
261 | return i18n("Country"); | 261 | return i18n("Country"); |
262 | } | 262 | } |
263 | 263 | ||
264 | 264 | ||
265 | void Address::setLabel( const QString &s ) | 265 | void Address::setLabel( const QString &s ) |
266 | { | 266 | { |
267 | mEmpty = false; | 267 | mEmpty = false; |
268 | 268 | ||
269 | mLabel = s; | 269 | mLabel = s; |
270 | } | 270 | } |
271 | 271 | ||
272 | QString Address::label() const | 272 | QString Address::label() const |
273 | { | 273 | { |
274 | return mLabel; | 274 | return mLabel; |
275 | } | 275 | } |
276 | 276 | ||
277 | QString Address::labelLabel() | 277 | QString Address::labelLabel() |
278 | { | 278 | { |
279 | return i18n("Delivery Label"); | 279 | return i18n("Delivery Label"); |
280 | } | 280 | } |
281 | 281 | ||
282 | Address::TypeList Address::typeList() | 282 | Address::TypeList Address::typeList() |
283 | { | 283 | { |
284 | TypeList list; | 284 | TypeList list; |
285 | 285 | ||
286 | list << Dom << Intl << Postal << Parcel << Home << Work << Pref; | 286 | list << Dom << Intl << Postal << Parcel << Home << Work << Pref; |
287 | 287 | ||
288 | return list; | 288 | return list; |
289 | } | 289 | } |
290 | 290 | ||
291 | QString Address::typeLabel( int type ) | 291 | QString Address::typeLabel( int type ) |
292 | { | 292 | { |
293 | QString label; | ||
294 | if ( type & Dom ) | ||
295 | label += i18n("Domestic")+" "; | ||
296 | if ( type & Intl ) | ||
297 | label += i18n("International")+" "; | ||
298 | if ( type & Postal ) | ||
299 | label += i18n("Postal")+" "; | ||
300 | if ( type & Parcel ) | ||
301 | label += i18n("Parcel")+" "; | ||
302 | if ( type & Work ) | ||
303 | label += i18n("Work Address", "Work")+" "; | ||
304 | if ( type & Home ) | ||
305 | label += i18n("Home Address", "Home") +" "; | ||
306 | if ( type & Pref ) | ||
307 | label += i18n("Preferred Address", "(p)"); | ||
308 | if ( label.isEmpty() ) | ||
309 | label = i18n("Other"); | ||
310 | return label; | ||
311 | |||
312 | #if 0 | ||
293 | switch ( type ) { | 313 | switch ( type ) { |
294 | case Dom: | 314 | case Dom: |
295 | return i18n("Domestic"); | 315 | return i18n("Domestic"); |
296 | break; | 316 | break; |
297 | case Intl: | 317 | case Intl: |
298 | return i18n("International"); | 318 | return i18n("International"); |
299 | break; | 319 | break; |
300 | case Postal: | 320 | case Postal: |
301 | return i18n("Postal"); | 321 | return i18n("Postal"); |
302 | break; | 322 | break; |
303 | case Parcel: | 323 | case Parcel: |
304 | return i18n("Parcel"); | 324 | return i18n("Parcel"); |
305 | break; | 325 | break; |
306 | case Home: | 326 | case Home: |
307 | return i18n("Home Address", "Home"); | 327 | return i18n("Home Address", "Home"); |
308 | break; | 328 | break; |
309 | case Work: | 329 | case Work: |
310 | return i18n("Work Address", "Work"); | 330 | return i18n("Work Address", "Work"); |
311 | break; | 331 | break; |
312 | case Pref: | 332 | case Pref: |
313 | return i18n("Preferred Address"); | 333 | return i18n("Preferred Address"); |
314 | break; | 334 | break; |
315 | default: | 335 | default: |
316 | return i18n("Other"); | 336 | return i18n("Other"); |
317 | break; | 337 | break; |
318 | } | 338 | } |
339 | #endif | ||
319 | } | 340 | } |
320 | 341 | ||
321 | void Address::dump() const | 342 | void Address::dump() const |
322 | { | 343 | { |
323 | qDebug("Address::dump() +++++++++++++++++ "); | 344 | qDebug("Address::dump() +++++++++++++++++ "); |
324 | #if 0 | 345 | #if 0 |
325 | kdDebug(5700) << " Address {" << endl; | 346 | kdDebug(5700) << " Address {" << endl; |
326 | kdDebug(5700) << " Id: " << id() << endl; | 347 | kdDebug(5700) << " Id: " << id() << endl; |
327 | kdDebug(5700) << " Extended: " << extended() << endl; | 348 | kdDebug(5700) << " Extended: " << extended() << endl; |
328 | kdDebug(5700) << " Street: " << street() << endl; | 349 | kdDebug(5700) << " Street: " << street() << endl; |
329 | kdDebug(5700) << " Postal Code: " << postalCode() << endl; | 350 | kdDebug(5700) << " Postal Code: " << postalCode() << endl; |
330 | kdDebug(5700) << " Locality: " << locality() << endl; | 351 | kdDebug(5700) << " Locality: " << locality() << endl; |
331 | kdDebug(5700) << " }" << endl; | 352 | kdDebug(5700) << " }" << endl; |
332 | #endif | 353 | #endif |
333 | } | 354 | } |
334 | 355 | ||
335 | 356 | ||
336 | QString Address::formattedAddress( const QString &realName | 357 | QString Address::formattedAddress( const QString &realName |
337 | , const QString &orgaName ) const | 358 | , const QString &orgaName ) const |
338 | { | 359 | { |
339 | QString ciso; | 360 | QString ciso; |
340 | QString addrTemplate; | 361 | QString addrTemplate; |
341 | QString ret; | 362 | QString ret; |
342 | 363 | ||
343 | // ************************************************************** | 364 | // ************************************************************** |
344 | // LR: currently we have no iso handling - we will format the address manually here | 365 | // LR: currently we have no iso handling - we will format the address manually here |
345 | 366 | ||
346 | QString text; | 367 | QString text; |
347 | if ( !street().isEmpty() ) | 368 | if ( !street().isEmpty() ) |
348 | text += street() + "\n"; | 369 | text += street() + "\n"; |
349 | 370 | ||
350 | if ( !postOfficeBox().isEmpty() ) | 371 | if ( !postOfficeBox().isEmpty() ) |
351 | text += postOfficeBox() + "\n"; | 372 | text += postOfficeBox() + "\n"; |
352 | 373 | ||
353 | text += locality() + QString(" ") + region(); | 374 | text += locality() + QString(" ") + region(); |
354 | 375 | ||
355 | if ( !postalCode().isEmpty() ) | 376 | if ( !postalCode().isEmpty() ) |
356 | text += QString(", ") + postalCode(); | 377 | text += QString(", ") + postalCode(); |
357 | 378 | ||
358 | text += "\n"; | 379 | text += "\n"; |
359 | 380 | ||
360 | if ( !country().isEmpty() ) | 381 | if ( !country().isEmpty() ) |
361 | text += country() + "\n"; | 382 | text += country() + "\n"; |
362 | 383 | ||
363 | text += extended(); | 384 | text += extended(); |
364 | 385 | ||
365 | 386 | ||
366 | return text; | 387 | return text; |