kabc Library API Documentation

KABC::Address Class Reference

Postal address information. More...

#include <address.h>

List of all members.

Public Types

typedef QValueList< AddressList
typedef QValueList< int > TypeList
enum  Type {
  Dom = 1, Intl = 2, Postal = 4, Parcel = 8,
  Home = 16, Work = 32, Pref = 64
}

Public Member Functions

 Address ()
 Address (int)
bool operator== (const Address &) const
bool operator!= (const Address &) const
bool isEmpty () const
void clear ()
void setId (const QString &)
QString id () const
void setType (int type)
int type () const
QString typeLabel () const
void setPostOfficeBox (const QString &)
QString postOfficeBox () const
void setExtended (const QString &)
QString extended () const
void setStreet (const QString &)
QString street () const
void setLocality (const QString &)
QString locality () const
void setRegion (const QString &)
QString region () const
void setPostalCode (const QString &)
QString postalCode () const
void setCountry (const QString &)
QString country () const
void setLabel (const QString &)
QString label () const
void dump () const
QString formattedAddress (const QString &realName=QString::null, const QString &orgaName=QString::null) const

Static Public Member Functions

QString postOfficeBoxLabel ()
QString extendedLabel ()
QString streetLabel ()
QString localityLabel ()
QString regionLabel ()
QString postalCodeLabel ()
QString countryLabel ()
QString labelLabel ()
TypeList typeList ()
QString typeLabel (int type)
QString countryToISO (const QString &cname)
QString ISOtoCountry (const QString &ISOname)

Friends

QDataStreamoperator<< (QDataStream &, const Address &)
QDataStreamoperator>> (QDataStream &, Address &)


Detailed Description

Postal address information.

This class represents information about a postal address.

Definition at line 53 of file address.h.


Member Typedef Documentation

typedef QValueList<Address> KABC::Address::List
 

List of addresses.

Definition at line 62 of file address.h.


Member Enumeration Documentation

enum KABC::Address::Type
 

Address types:.

  • Dom - domestic
  • Intl - international
  • Postal - postal
  • Parcel - parcel
  • Home - home address
  • Work - address at work
  • Pref - preferred address

Definition at line 76 of file address.h.


Constructor & Destructor Documentation

Address::Address  ) 
 

Constructor that creates an empty Address, which is initialized with a unique id (see id()).

Definition at line 35 of file address.cpp.

References KApplication::randomString().

Referenced by clear().

Address::Address int   ) 
 

This is like Address() just above, with the difference that you can specify the type.

Definition at line 41 of file address.cpp.

References KApplication::randomString().


Member Function Documentation

bool Address::isEmpty  )  const
 

Returns true, if the address is empty.

Definition at line 66 of file address.cpp.

References QString::isEmpty().

void Address::clear  ) 
 

Clears all entries of the address.

Definition at line 81 of file address.cpp.

References Address().

void Address::setId const QString  ) 
 

Sets the unique id.

Definition at line 86 of file address.cpp.

void Address::setType int  type  ) 
 

Sets the type of address.

See enum for definiton of types.

Parameters:
type type, can be a bitwise or of multiple types.

Definition at line 98 of file address.cpp.

Referenced by KABC::VCard21Parser::readAddressFromQStringList().

int Address::type  )  const
 

Returns the type of address.

Can be a bitwise or of multiple types.

Definition at line 105 of file address.cpp.

Referenced by typeLabel().

QString Address::typeLabel  )  const
 

Returns a translated string of all types the address has.

Definition at line 110 of file address.cpp.

References QString::append(), QValueList< int >::begin(), QValueList< int >::end(), type(), and typeList().

void Address::setPostOfficeBox const QString  ) 
 

Sets the post office box.

Definition at line 129 of file address.cpp.

Referenced by KABC::VCard21Parser::readAddressFromQStringList().

QString Address::postOfficeBox  )  const
 

Returns the post office box.

Definition at line 136 of file address.cpp.

QString Address::postOfficeBoxLabel  )  [static]
 

Returns the translated label for post office box field.

Definition at line 141 of file address.cpp.

void Address::setExtended const QString  ) 
 

Sets the extended address information.

Definition at line 147 of file address.cpp.

Referenced by KABC::VCard21Parser::readAddressFromQStringList().

QString Address::extended  )  const
 

Returns the extended address information.

Definition at line 154 of file address.cpp.

Referenced by dump().

QString Address::extendedLabel  )  [static]
 

Returns the translated label for extended field.

Definition at line 159 of file address.cpp.

void Address::setStreet const QString  ) 
 

Sets the street (including number).

Definition at line 165 of file address.cpp.

Referenced by KABC::VCard21Parser::readAddressFromQStringList().

QString Address::street  )  const
 

Returns the street.

Definition at line 172 of file address.cpp.

Referenced by dump().

QString Address::streetLabel  )  [static]
 

Returns the translated label for street field.

Definition at line 177 of file address.cpp.

void Address::setLocality const QString  ) 
 

Sets the locality, e.g.

city.

Definition at line 183 of file address.cpp.

Referenced by KABC::VCard21Parser::readAddressFromQStringList().

QString Address::locality  )  const
 

Returns the locality.

Definition at line 190 of file address.cpp.

Referenced by dump().

QString Address::localityLabel  )  [static]
 

Returns the translated label for locality field.

Definition at line 195 of file address.cpp.

void Address::setRegion const QString  ) 
 

Sets the region, e.g.

state.

Definition at line 201 of file address.cpp.

Referenced by KABC::VCard21Parser::readAddressFromQStringList().

QString Address::region  )  const
 

Returns the region.

Definition at line 208 of file address.cpp.

QString Address::regionLabel  )  [static]
 

Returns the translated label for region field.

Definition at line 213 of file address.cpp.

void Address::setPostalCode const QString  ) 
 

Sets the postal code.

Definition at line 219 of file address.cpp.

Referenced by KABC::VCard21Parser::readAddressFromQStringList().

QString Address::postalCode  )  const
 

Returns the postal code.

Definition at line 226 of file address.cpp.

Referenced by dump().

QString Address::postalCodeLabel  )  [static]
 

Returns the translated label for postal code field.

Definition at line 231 of file address.cpp.

void Address::setCountry const QString  ) 
 

Sets the country.

Definition at line 237 of file address.cpp.

Referenced by KABC::VCard21Parser::readAddressFromQStringList().

QString Address::country  )  const
 

Returns the country.

Definition at line 244 of file address.cpp.

Referenced by formattedAddress().

QString Address::countryLabel  )  [static]
 

Returns the translated label for country field.

Definition at line 249 of file address.cpp.

void Address::setLabel const QString  ) 
 

Sets the delivery label.

This is the literal text to be used as label.

Definition at line 255 of file address.cpp.

Referenced by KABC::VCard21Parser::readFromString().

QString Address::label  )  const
 

Returns the delivery label.

Definition at line 262 of file address.cpp.

QString Address::labelLabel  )  [static]
 

Returns the translated label for delivery label field.

Definition at line 267 of file address.cpp.

Address::TypeList Address::typeList  )  [static]
 

Returns the list of available types.

Definition at line 272 of file address.cpp.

Referenced by typeLabel().

QString Address::typeLabel int  type  )  [static]
 

Returns the translated label for a special type.

Definition at line 281 of file address.cpp.

void Address::dump  )  const
 

Used for debug output.

Definition at line 314 of file address.cpp.

References extended(), kdDebug(), locality(), postalCode(), and street().

QString Address::formattedAddress const QString realName = QString::null,
const QString orgaName = QString::null
const
 

Returns this address formatted according to the country-specific address formatting rules.

The formatting rules applied depend on either the addresses country field, or (if the latter is empty) on the system country setting. If companyName is provided, an available business address format will be preferred.

Parameters:
realName the formatted name of the contact
orgaName the name of the organization or company
Returns:
the formatted address (containing newline characters)

Definition at line 326 of file address.cpp.

References KLocale::country(), country(), countryToISO(), QString::isEmpty(), QString::isNull(), kdWarning(), KGlobal::locale(), locate(), KConfigBase::readEntry(), KConfigBase::setGroup(), and QString::upper().

QString Address::countryToISO const QString cname  )  [static]
 

Returns ISO code for a localized country name.

Only localized country names will be understood. This might be replaced by a KLocale method in the future.

Parameters:
cname name of the country
Returns:
two digit ISO code

Definition at line 507 of file address.cpp.

References QFile::close(), KLocale::country(), KGlobal::dirs(), KStandardDirs::findResource(), QString::findRev(), QString::isEmpty(), QString::isNull(), KGlobal::locale(), QString::mid(), QFile::open(), QTextStream::readLine(), and QString::startsWith().

Referenced by formattedAddress().

QString Address::ISOtoCountry const QString ISOname  )  [static]
 

Returns a localized country name for a ISO code.

This might be replaced by a KLocale method in the future.

Parameters:
ISOname two digit ISO code
Returns:
localized name of the country
Since:
3.2

Definition at line 541 of file address.cpp.

References QFile::close(), KGlobal::dirs(), QString::find(), KStandardDirs::findResource(), QString::isNull(), QString::left(), QFile::open(), QTextStream::readLine(), and QString::simplifyWhiteSpace().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kabc Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed May 5 07:18:02 2004 by doxygen 1.3.6 written by Dimitri van Heesch, © 1997-2003