KContacts::Address
#include <address.h>
Public Types | |
typedef QVector< Address > | List |
typedef QFlags< TypeFlag > | Type |
enum | TypeFlag { Dom = 1, Intl = 2, Postal = 4, Parcel = 8, Home = 16, Work = 32, Pref = 64 } |
typedef QList< TypeFlag > | TypeList |
Properties | |
QString | country |
QString | extended |
QString | formattedAddress |
KContacts::Geo | geo |
QString | id |
bool | isEmpty |
QString | label |
QString | locality |
QString | postalCode |
QString | postOfficeBox |
QString | region |
QString | street |
Type | type |
QString | typeLabel |
Public Member Functions | |
Address () | |
Address (const Address &address) | |
Address (Type type) | |
~Address () | |
void | clear () |
QString | country () const |
QString | extended () const |
Q_INVOKABLE QString | formatted (KContacts::AddressFormatStyle style, const QString &realName=QString(), const QString &orgaName=QString()) const |
QString | formattedAddress (const QString &realName=QString(), const QString &orgaName=QString()) const |
Geo | geo () const |
QString | id () const |
bool | isEmpty () const |
QString | label () const |
QString | locality () const |
bool | operator!= (const Address &other) const |
Address & | operator= (const Address &other) |
bool | operator== (const Address &other) const |
QString | postalCode () const |
QString | postOfficeBox () const |
QString | region () const |
void | setCountry (const QString &country) |
void | setExtended (const QString &extended) |
void | setGeo (const Geo &geo) |
void | setId (const QString &identifier) |
void | setLabel (const QString &label) |
void | setLocality (const QString &locality) |
void | setPostalCode (const QString &code) |
void | setPostOfficeBox (const QString &postOfficeBox) |
void | setRegion (const QString ®ion) |
void | setStreet (const QString &street) |
void | setType (Type type) |
QString | street () const |
QString | toString () const |
Type | type () const |
QString | typeLabel () const |
Static Public Member Functions | |
static QString | countryLabel () |
static QString | countryToISO (const QString &cname) |
static QString | extendedLabel () |
static QString | ISOtoCountry (const QString &ISOname) |
static QString | labelLabel () |
static QString | localityLabel () |
static QString | postalCodeLabel () |
static QString | postOfficeBoxLabel () |
static QString | regionLabel () |
static QString | streetLabel () |
static QString | typeFlagLabel (TypeFlag type) |
static QString | typeLabel (Type type) |
static TypeList | typeList () |
Detailed Description
Postal address information.
This class represents information about a postal address.
Member Typedef Documentation
◆ List
typedef QVector<Address> KContacts::Address::List |
◆ Type
typedef QFlags< TypeFlag > KContacts::Address::Type |
◆ TypeList
typedef QList<TypeFlag> KContacts::Address::TypeList |
Member Enumeration Documentation
◆ TypeFlag
Property Documentation
◆ formattedAddress
|
read |
Country-specific formatted address without an addressee using postal address style.
This is the same as calling formatted(AddressFormatStyle::Postal) with empty arguments.
- See also
- formatted()
- Since
- 5.12
Constructor & Destructor Documentation
◆ Address() [1/3]
Address::Address | ( | ) |
Creates an empty address.
Definition at line 66 of file address.cpp.
◆ Address() [2/3]
Address::Address | ( | Type | type | ) |
Creates an address of the given type
.
Definition at line 71 of file address.cpp.
◆ Address() [3/3]
Address::Address | ( | const Address & | address | ) |
Copy constructor.
Definition at line 77 of file address.cpp.
◆ ~Address()
Address::~Address | ( | ) |
Destroys the address.
Definition at line 82 of file address.cpp.
Member Function Documentation
◆ clear()
void Address::clear | ( | ) |
Clears all entries of the address.
Definition at line 145 of file address.cpp.
◆ country()
QString KContacts::Address::country | ( | ) | const |
Returns the country.
◆ countryLabel()
|
static |
Returns the translated label for country field.
Definition at line 317 of file address.cpp.
◆ countryToISO()
Returns ISO code for a localized country name.
Only localized country names will be understood.
- Parameters
-
cname name of the country
- Returns
- two digit ISO code, empty string if the country was not recognized
- Deprecated:
- since 5.88, use KCountry::fromName() instead. Note that this function returned the ISO code incorrectly in lower case, while KCountry does not do that.
Definition at line 421 of file address.cpp.
◆ extended()
QString KContacts::Address::extended | ( | ) | const |
Returns the extended address information.
◆ extendedLabel()
|
static |
Returns the translated label for extended field.
Definition at line 237 of file address.cpp.
◆ formatted()
QString Address::formatted | ( | KContacts::AddressFormatStyle | style, |
const QString & | realName = QString() , |
||
const QString & | orgaName = QString() |
||
) | 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.
- Parameters
-
style the formatting style variant to use realName the formatted name of the contact orgaName the name of the organization or company
- Returns
- the formatted address
- Since
- 5.92
Definition at line 408 of file address.cpp.
◆ formattedAddress()
QString Address::formattedAddress | ( | const QString & | realName = QString() , |
const QString & | orgaName = QString() |
||
) | const |
Returns this address formatted according to the country-specific postal 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)
- Deprecated:
- since 5.92, use formatted() instead, using AddressFormatStyle::Postal to obtain the identical result.
Definition at line 402 of file address.cpp.
◆ geo()
Geo KContacts::Address::geo | ( | ) | const |
Return geographic position.
◆ id()
QString KContacts::Address::id | ( | ) | const |
Returns the unique identifier.
◆ isEmpty()
bool KContacts::Address::isEmpty | ( | ) | const |
Returns true, if the address is empty.
◆ ISOtoCountry()
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
- Deprecated:
- since 5.88, use KCountry::fromAlpha2() instead. Note that this function returns
ISOname
if that is not a valid country code, while KCountry will need an explicit check for that case.
Definition at line 428 of file address.cpp.
◆ label()
QString KContacts::Address::label | ( | ) | const |
Returns the delivery label.
◆ labelLabel()
|
static |
Returns the translated label for delivery label field.
Definition at line 333 of file address.cpp.
◆ locality()
QString KContacts::Address::locality | ( | ) | const |
Returns the locality.
◆ localityLabel()
|
static |
Returns the translated label for locality field.
Definition at line 269 of file address.cpp.
◆ operator!=()
bool Address::operator!= | ( | const Address & | other | ) | const |
Not-equal operator.
- Parameters
-
addr the address to compare to
- Returns
true
ifthis
andaddr
are not equal, otherwisefalse
Definition at line 135 of file address.cpp.
◆ operator=()
Assignment operator.
- Parameters
-
addr the address data to assign to this
- Returns
- a reference to
this
Definition at line 86 of file address.cpp.
◆ operator==()
bool Address::operator== | ( | const Address & | other | ) | const |
Equality operator.
- Parameters
-
addr the address to compare to
- Returns
true
ifthis
andaddr
are equal, otherwisefalse
Definition at line 95 of file address.cpp.
◆ postalCode()
QString KContacts::Address::postalCode | ( | ) | const |
Returns the postal code.
◆ postalCodeLabel()
|
static |
Returns the translated label for postal code field.
Definition at line 301 of file address.cpp.
◆ postOfficeBox()
QString KContacts::Address::postOfficeBox | ( | ) | const |
Returns the post office box.
◆ postOfficeBoxLabel()
|
static |
Returns the translated label for post office box field.
Definition at line 221 of file address.cpp.
◆ region()
QString KContacts::Address::region | ( | ) | const |
Returns the region.
◆ regionLabel()
|
static |
Returns the translated label for region field.
Definition at line 285 of file address.cpp.
◆ setCountry()
void Address::setCountry | ( | const QString & | country | ) |
Sets the country
.
Definition at line 306 of file address.cpp.
◆ setExtended()
void Address::setExtended | ( | const QString & | extended | ) |
Sets the extended
address information.
Definition at line 226 of file address.cpp.
◆ setGeo()
void Address::setGeo | ( | const Geo & | geo | ) |
Set geographic position.
Definition at line 370 of file address.cpp.
◆ setId()
void Address::setId | ( | const QString & | identifier | ) |
Sets the unique identifier
.
Definition at line 150 of file address.cpp.
◆ setLabel()
void Address::setLabel | ( | const QString & | label | ) |
Sets the delivery label
.
This is the literal text to be used as label.
- Parameters
-
label the string to use for delivery labels
Definition at line 322 of file address.cpp.
◆ setLocality()
void Address::setLocality | ( | const QString & | locality | ) |
Sets the locality
, e.g.
city.
- Parameters
-
locality the locality of the address, e.g. city
Definition at line 258 of file address.cpp.
◆ setPostalCode()
void Address::setPostalCode | ( | const QString & | code | ) |
Sets the postal code
.
Definition at line 290 of file address.cpp.
◆ setPostOfficeBox()
void Address::setPostOfficeBox | ( | const QString & | postOfficeBox | ) |
Sets the post office box.
Definition at line 210 of file address.cpp.
◆ setRegion()
void Address::setRegion | ( | const QString & | region | ) |
Sets the region
, e.g.
state.
- Parameters
-
region the region the address falls into, e.g. state
Definition at line 274 of file address.cpp.
◆ setStreet()
void Address::setStreet | ( | const QString & | street | ) |
Sets the street
(including house number).
Definition at line 242 of file address.cpp.
◆ setType()
void Address::setType | ( | Type | type | ) |
Sets the type of address.
See enum for definition of types.
- Parameters
-
type type, can be a bitwise or of multiple types.
Definition at line 161 of file address.cpp.
◆ street()
QString KContacts::Address::street | ( | ) | const |
Returns the street.
◆ streetLabel()
|
static |
Returns the translated label for street field.
Definition at line 253 of file address.cpp.
◆ toString()
QString Address::toString | ( | ) | const |
Returns a string representation of the address.
Definition at line 381 of file address.cpp.
◆ type()
Type KContacts::Address::type | ( | ) | const |
Returns the type of address.
Can be a bitwise or of multiple types.
◆ typeLabel() [1/2]
QString KContacts::Address::typeLabel | ( | ) | const |
Returns a translated string of all types the address has.
◆ typeLabel() [2/2]
Returns the translated label for the given type
.
Definition at line 172 of file address.cpp.
◆ typeList()
|
static |
Returns the list of available types.
Definition at line 338 of file address.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2022 The KDE developers.
Generated on Fri Aug 19 2022 04:14:41 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.