ContactAttribute

Since: BlackBerry 10.0.0

#include <bb/pim/contacts/ContactAttribute>

To link against this class, add the following line to your .pro file: LIBS += -lbbpim

The ContactAttribute class represents a property of a Contact.

A ContactAttribute is a single piece of information about a Contact, such as a phone number or email address. A ContactAttribute has a kind, which specifies high-level metadata about the attribute. Kinds of attributes are represented by the AttributeKind::Type enumeration and include email, phone number, name, and so on. A ContactAttribute also has a sub-kind, which specifies additional, more granular metadata about the attribute. Sub-kinds are represented by the AttributeSubKind::Type enumeration and include values such as Work (for emails), Home (for phone numbers), and so on.

There is no limit to the number of attributes a Contact can have. You specify the values for a ContactAttribute by using a ContactAttributeBuilder.


Overview

Public Functions Index

ContactAttribute ()
ContactAttribute (const ContactAttribute &copy)
~ContactAttribute ()
QStringattributeDisplayLabel () const
ContactAttributeBuilderedit ()
QStringgroupKey () const
intid () const
boolisEnhancement () const
boolisPrimaryAttribute () const
boolisValid () const
AttributeKind::Typekind () const
QStringlabel () const
QUrllaunchUrl () const
booloperator!= (const ContactAttribute &operand) const
ContactAttribute &operator= (const ContactAttribute &operand)
booloperator== (const ContactAttribute &operand) const
QList< AccountId >sources () const
AttributeSubKind::TypesubKind () const
QStringvalue () const
QDateTimevalueAsDateTime () const

Static Public Functions Index

QStringdetermineAttributeDisplayLabel (AttributeKind::Type kind, AttributeSubKind::Type subkind, QString label)

Public Functions

ContactAttribute ()

Constructs an empty ContactAttribute.

Creating a ContactAttribute using this function will result in an attribute that has no data in it. You should populate the data for the attribute by using a ContactAttributeBuilder.

Since:

BlackBerry 10.0.0

ContactAttribute (

Copy constructor.

This function constructs a ContactAttribute containing exactly the same values as the provided ContactAttribute.

Parameters
copy

The ContactAttribute to be copied.

Since:

BlackBerry 10.0.0

~ContactAttribute ()

Destructor.

Since:

BlackBerry 10.0.0

QString attributeDisplayLabel ()

Retrieves the localized display label of this ContactAttribute.

This value might not exist for all combinations of kinds and sub-kinds. However, many well-known combinations should be available. For example, common combinations for phone numbers include the following:

If you've set a custom label for the attribute using ContactAttributeBuilder::setLabel(), then this function returns that label. If there isn't a label for the kind/sub-kind combination, then this function returns an empty QString.

Return:

The localized display label of this ContactAttribute, or an empty QString if there isn't a label for the kind/sub-kind combination.

Since:

BlackBerry 10.0.0

ContactAttributeBuilder edit ()

Edits the contents of this ContactAttribute.

This function returns a ContactAttributeBuilder that you can use to change the values of this ContactAttribute.

Return:

A ContactAttributeBuilder that you can use to change the values of this ContactAttribute.

Since:

BlackBerry 10.0.0

QString groupKey ()

Retrieves the group key of this ContactAttribute.

The group key is designed to group different types of attributes together. For example, consider a set of attributes that describe an employee. This set might contain different attributes for the company name, the employee's start date, and the employee's salary. If these attributes all share the same group key, then they can be seen as belonging together to make up a meaningful set of data.

Return:

The group key of this ContactAttribute.

Since:

BlackBerry 10.0.0

int id ()

Retrieves the ID of this ContactAttribute.

The ID uniquely identifies a ContactAttribute in a particular source account. The ID is assigned automatically by the database when a ContactAttribute is persisted using the ContactService. You can't set the ID of a ContactAttribute manually.

Return:

The ID of this ContactAttribute.

Since:

BlackBerry 10.0.0

bool isEnhancement ()

Attribute is a contact enhancement.

This attribute is an enhancement discovered through cloud services.

Return:

true if this ContactAttribute is an enhancement, false otherwise.

Since:

BlackBerry 10.0.0

bool isPrimaryAttribute ()

Indicates whether this ContactAttribute is a primary attribute.

An attribute can be a primary attribute only if its kind is either Name or OrganizationAffiliation. When a contact has more than one source provider, the contact might have multiple first names, last names, and company names. The system selects one first name as the primary attribute to make UI display choices easier.

Return:

true if this ContactAttribute is a primary attribute, false otherwise.

Since:

BlackBerry 10.0.0

bool isValid ()

Indicates whether this ContactAttribute is valid.

For a ContactAttribute to be considered valid, it must contain at least a valid kind, valid sub-kind, and non-empty value.

Return:

true if this ContactAttribute is valid, false otherwise.

Since:

BlackBerry 10.0.0

AttributeKind::Type kind ()

Retrieves the kind of this ContactAttribute.

The kind specifies metadata about the type of an attribute. The kind is represented by the AttributeKind::Type enumeration and can be values such as Name, Email, Phone, and so on.

Return:

The kind of this ContactAttribute.

See also:

subKind()

Since:

BlackBerry 10.0.0

QString label ()

Retrieves the label of this ContactAttribute.

You can use this value as a custom label for the ContactAttribute, if needed.

Return:

The label of this ContactAttribute.

Since:

BlackBerry 10.0.0

QUrl launchUrl ()

Retrieves the URL that's associated with this ContactAttribute.

You can think of this property as a hyperlink that points to related information about the attribute.

Return:

The URL that's associated with this ContactAttribute.

Since:

BlackBerry 10.0.0

bool operator!= (

Inequality operator.

This operator determines if this ContactAttribute has any different values from another ContactAttribute.

Parameters
operand

The ContactAttribute from which to compare.

Return:

true if any of the values are not considered equal, false otherwise.

Since:

BlackBerry 10.0.0

ContactAttribute & operator= (

Assignment operator.

This operator copies all values from the provided ContactAttribute into this ContactAttribute.

Parameters
operand

The ContactAttribute from which to copy all values.

Return:

A ContactAttribute with all copied data

Since:

BlackBerry 10.0.0

bool operator== (

Equality operator.

This operator determines if this ContactAttribute has the same values as another ContactAttribute.

Parameters
operand

The ContactAttribute from which to compare.

Return:

true if the values are considered equal, false otherwise.

Since:

BlackBerry 10.0.0

QList< AccountId > sources ()

Retrieves a list of account IDs for this ContactAttribute.

This function retrieves a list of all accounts that use this ContactAttribute.

Return:

A list of account IDs for this ContactAttribute.

Since:

BlackBerry 10.0.0

AttributeSubKind::Type subKind ()

Retrieves the sub-kind of this ContactAttribute.

Similar to the kind of an attribute, the sub-kind refers to a sub-type of an attribute. The sub-kind is represented by the AttributeSubKind::Type enumeration. For example, if the kind of attribute is a phone number, then possible sub-kinds might be Work, Home, and so on. By using combinations of kinds and sub-kinds, you can specify a wide range of attributes for contacts.

Return:

The sub-kind of this ContactAttribute.

See also:

kind()

Since:

BlackBerry 10.0.0

QString value ()

Retrieves the string value of this ContactAttribute.

Return:

The string value of this ContactAttribute.

Since:

BlackBerry 10.0.0

QDateTime valueAsDateTime ()

Retrieves the value of this ContactAttribute as a date/time value.

If this ContactAttribute can't be represented as a date/time value, then an invalid QDateTime is returned.

Return:

The value of this ContactAttribute as a date/time value, or an invalid QDateTime if this ContactAttribute can't be represented as a date/time value.

Since:

BlackBerry 10.0.0

Static Public Functions

QString determineAttributeDisplayLabel (

Retrieves the localized display label of this ContactAttribute, based on the provided kind, sub-kind, and label, to use to display the ContactAttribute.

This function is similar to attributeDisplayLabel(), but tries to find a displayable label based on the provided kind, sub-kind, and label, instead of those of this ContactAttribute. This function tries to find a displayable label for the ContactAttribute for UI display purposes. If none is returned, then it's up to the caller to find a proper display label to use.

Parameters
kind

The attribute kind.

subkind

The attribute sub-kind.

label

The default label value. This value is returned if the label parameter is not empty.

Return:

A localized display label if one is found, or an empty QString if one is not found.

Since:

BlackBerry 10.0.0

Last modified: 2014-03-13

comments powered by Disqus