KContacts::Address Class
class KContacts::AddressPostal address information. More...
Header: | #include <KContacts/Address> |
CMake: | find_package(KF6 REQUIRED COMPONENTS Contacts) target_link_libraries(mytarget PRIVATE KF6::Contacts) |
In QML: | address |
Public Types
Properties
|
Public Functions
Address() | |
Address(KContacts::Address::Type type) | |
Address(const KContacts::Address &address) | |
~Address() | |
void | clear() |
QString | country() const |
QString | extended() const |
(since 5.92) QString | formatted(KContacts::AddressFormatStyle style, const QString &realName = QString(), const QString &orgaName = QString()) const |
KContacts::Geo | geo() const |
(since 5.106) QUrl | geoUri() const |
QString | id() const |
bool | isEmpty() const |
QString | label() const |
QString | locality() const |
QString | postOfficeBox() const |
QString | postalCode() const |
QString | region() const |
void | setCountry(const QString &country) |
void | setExtended(const QString &extended) |
void | setGeo(const KContacts::Geo &geo) |
void | setId(const QString &identifier) |
void | setLabel(const QString &label) |
void | setLocality(const QString &locality) |
void | setPostOfficeBox(const QString &postOfficeBox) |
void | setPostalCode(const QString &code) |
void | setRegion(const QString ®ion) |
void | setStreet(const QString &street) |
void | setType(KContacts::Address::Type type) |
QString | street() const |
QString | toString() const |
KContacts::Address::Type | type() const |
QString | typeLabel() const |
bool | operator!=(const KContacts::Address &other) const |
KContacts::Address & | operator=(const KContacts::Address &other) |
bool | operator==(const KContacts::Address &other) const |
Static Public Members
QString | countryLabel() |
QString | extendedLabel() |
QString | labelLabel() |
QString | localityLabel() |
QString | postOfficeBoxLabel() |
QString | postalCodeLabel() |
QString | regionLabel() |
QString | streetLabel() |
QString | typeFlagLabel(KContacts::Address::TypeFlag type) |
QString | typeLabel(KContacts::Address::Type type) |
KContacts::Address::TypeList | typeList() |
Related Non-Members
QDataStream & | operator<<(QDataStream &stream, const KContacts::Address &address) |
QDataStream & | operator>>(QDataStream &stream, KContacts::Address &address) |
Detailed Description
This class represents information about a postal address.
Member Type Documentation
Address::List
List of addresses.
enum Address::TypeFlag
flags Address::Type
Address types:
Constant | Value | Description |
---|---|---|
KContacts::Address::Dom | 1 | domestic |
KContacts::Address::Intl | 2 | international |
KContacts::Address::Postal | 4 | postal |
KContacts::Address::Parcel | 8 | parcel |
KContacts::Address::Home | 16 | home address |
KContacts::Address::Work | 32 | address at work |
KContacts::Address::Pref | 64 | preferred address |
The Type type is a typedef for QFlags<TypeFlag>. It stores an OR combination of TypeFlag values.
Address::TypeList
List of address types.
Property Documentation
country : QString
Access functions:
QString | country() const |
void | setCountry(const QString &country) |
extended : QString
Access functions:
QString | extended() const |
void | setExtended(const QString &extended) |
[read-only, since 5.12]
formattedAddress : const QString
Country-specific formatted address without an addressee using postal address style. This is the same as calling formatted(AddressFormatStyle::Postal) with empty arguments.
This property was introduced in 5.12.
See also formatted().
[since 5.106]
geo : KContacts::Geo
geo: URI for this address.
This property was introduced in 5.106.
Access functions:
See also Address::geoUri().
id : QString
Access functions:
[read-only]
isEmpty : const bool
Access functions:
bool | isEmpty() const |
label : QString
Access functions:
locality : QString
Access functions:
QString | locality() const |
void | setLocality(const QString &locality) |
postOfficeBox : QString
Access functions:
QString | postOfficeBox() const |
void | setPostOfficeBox(const QString &postOfficeBox) |
postalCode : QString
Access functions:
QString | postalCode() const |
void | setPostalCode(const QString &code) |
region : QString
Access functions:
street : QString
Access functions:
type : Type
Access functions:
[read-only]
typeLabel : const QString
Access functions:
Member Function Documentation
Address::Address()
Creates an empty address.
Address::Address(KContacts::Address::Type type)
Creates an address of the given type.
Address::Address(const KContacts::Address &address)
Copy constructor.
[noexcept]
Address::~Address()
Destroys the address.
void Address::clear()
Clears all entries of the address.
QString Address::country() const
Returns the country.
Note: Getter function for property country.
See also setCountry().
[static]
QString Address::countryLabel()
Returns the translated label for country field.
QString Address::extended() const
Returns the extended address information.
Note: Getter function for property extended.
See also setExtended().
[static]
QString Address::extendedLabel()
Returns the translated label for extended field.
[invokable, since 5.92]
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.
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
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
This function was introduced in 5.92.
KContacts::Geo Address::geo() const
Return geographic position.
Note: Getter function for property geo.
See also setGeo().
[since 5.106]
QUrl Address::geoUri() const
Returns a geo: URI representing this address.
This contains either the geographic coordinate if set, or the address as query term. This can be used to show the address in the default map view.
Note: Getter function for property geoUri.
This function was introduced in 5.106.
QString Address::id() const
Returns the unique identifier.
Note: Getter function for property id.
See also setId().
bool Address::isEmpty() const
Returns true
, if the address is empty.
Note: Getter function for property isEmpty.
QString Address::label() const
Returns the delivery label.
Note: Getter function for property label.
See also setLabel().
[static]
QString Address::labelLabel()
Returns the translated label for delivery label field.
QString Address::locality() const
Returns the locality.
Note: Getter function for property locality.
See also setLocality().
[static]
QString Address::localityLabel()
Returns the translated label for locality field.
QString Address::postOfficeBox() const
Returns the post office box.
Note: Getter function for property postOfficeBox.
See also setPostOfficeBox().
[static]
QString Address::postOfficeBoxLabel()
Returns the translated label for post office box field.
QString Address::postalCode() const
Returns the postal code.
Note: Getter function for property postalCode.
See also setPostalCode().
[static]
QString Address::postalCodeLabel()
Returns the translated label for postal code field.
QString Address::region() const
Returns the region.
Note: Getter function for property region.
See also setRegion().
[static]
QString Address::regionLabel()
Returns the translated label for region field.
void Address::setCountry(const QString &country)
Sets the country.
Note: Setter function for property country.
See also country().
void Address::setExtended(const QString &extended)
Sets the extended address information.
Note: Setter function for property extended.
See also extended().
void Address::setGeo(const KContacts::Geo &geo)
Set geographic position.
Note: Setter function for property geo.
See also geo().
void Address::setId(const QString &identifier)
Sets the unique identifier.
Note: Setter function for property id.
See also id().
void Address::setLabel(const QString &label)
Sets the delivery label. This is the literal text to be used as label.
label the string to use for delivery labels
Note: Setter function for property label.
See also label().
void Address::setLocality(const QString &locality)
Sets the locality, e.g. city.
locality the locality of the address, e.g. city
Note: Setter function for property locality.
See also locality().
void Address::setPostOfficeBox(const QString &postOfficeBox)
Sets the post office box.
Note: Setter function for property postOfficeBox.
See also postOfficeBox().
void Address::setPostalCode(const QString &code)
Sets the postal code.
Note: Setter function for property postalCode.
See also postalCode().
void Address::setRegion(const QString ®ion)
Sets the region, e.g. state.
region the region the address falls into, e.g. state
Note: Setter function for property region.
See also region().
void Address::setStreet(const QString &street)
Sets the street (including house number).
Note: Setter function for property street.
See also street().
void Address::setType(KContacts::Address::Type type)
Sets the type of address. See enum for definition of types.
type type, can be a bitwise or of multiple types.
Note: Setter function for property type.
See also type().
QString Address::street() const
Returns the street.
Note: Getter function for property street.
See also setStreet().
[static]
QString Address::streetLabel()
Returns the translated label for street field.
QString Address::toString() const
Returns a string representation of the address.
KContacts::Address::Type Address::type() const
Returns the type of address. Can be a bitwise or of multiple types.
Note: Getter function for property type.
See also setType().
[static]
QString Address::typeFlagLabel(KContacts::Address::TypeFlag type)
QString Address::typeLabel() const
Returns a translated string of all types the address has.
Note: Getter function for property typeLabel.
[static]
QString Address::typeLabel(KContacts::Address::Type type)
Returns the translated label for the given type.
Note: Getter function for property typeLabel.
[static]
KContacts::Address::TypeList Address::typeList()
Returns the list of available types.
bool Address::operator!=(const KContacts::Address &other) const
Not-equal operator.
other the address to compare to
Returns true
if this
and other are not equal, otherwise false
KContacts::Address &Address::operator=(const KContacts::Address &other)
Assignment operator.
other the address data to assign to this
Returns a reference to this
bool Address::operator==(const KContacts::Address &other) const
Equality operator.
other the address to compare to
Returns true
if this
and other are equal, otherwise false
Related Non-Members
QDataStream &operator<<(QDataStream &stream, const KContacts::Address &address)
Serializes the address object into the stream.
QDataStream &operator>>(QDataStream &stream, KContacts::Address &address)
Initializes the address object from the stream.