ContactAttributeBuilder

Since: BlackBerry 10.0.0

#include <bb/pim/contacts/ContactAttributeBuilder>

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

The ContactAttributeBuilder class lets you create, and specify properties for, a new ContactAttribute or edit an existing ContactAttribute.

You can use this class to set properties, such as kind, sub-kind, and value, for a ContactAttribute. This class uses the builder pattern to create a ContactAttribute and set its properties. Each of the set*() functions returns a self reference to the builder, allowing you to chain function calls together. For example, here's how to create a ContactAttribute with a kind, sub-kind, and value using the builder pattern:

ContactAttribute attr = ContactAttributeBuilder()
                         .setKind(AttributeKind::Name)
                         .setSubKind(AttributeSubKind::NameGiven)
                         .setValue("Joe");


Overview

Public Functions Index

ContactAttributeBuilder ()
ContactAttributeBuilder (const ContactAttributeBuilder &copy)
ContactAttributeBuilder (ContactAttribute &editAttribute)
~ContactAttributeBuilder ()
operator ContactAttribute ()
ContactAttributeBuilder &operator= (const ContactAttributeBuilder &operand)
ContactAttributeBuilder &setGroupKey (const QString &groupkey)
ContactAttributeBuilder &setKind (AttributeKind::Type kind)
ContactAttributeBuilder &setLabel (const QString &label)
ContactAttributeBuilder &setLaunchUrl (const QUrl &launchUrl)
ContactAttributeBuilder &setSubKind (AttributeSubKind::Type subkind)
ContactAttributeBuilder &setValue (const QString &value)
ContactAttributeBuilder &setValue (const QDateTime &value)

Static Public Functions Index

Public Functions

ContactAttributeBuilder ()

Constructs a new ContactAttributeBuilder.

Since:

BlackBerry 10.0.0

ContactAttributeBuilder (

Copy constructor.

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

Parameters
copy

The ContactAttributeBuilder to be copied.

Since:

BlackBerry 10.0.0

ContactAttributeBuilder (

Edits the provided ContactAttribute.

You can use this function to edit the properties of an existing ContactAttribute, as an alternative to calling ContactAttribute::edit().

Parameters
editAttribute

The ContactAttribute to edit.

Since:

BlackBerry 10.0.0

~ContactAttributeBuilder ()

Destructor.

Since:

BlackBerry 10.0.0

operator ContactAttribute ()

Cast operator.

This operator casts an object to the ContactAttribute type.

Since:

BlackBerry 10.0.0

ContactAttributeBuilder & operator= (

Assignment operator.

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

Parameters
operand

The ContactAttributeBuilder from which to copy all values.

Since:

BlackBerry 10.0.0

ContactAttributeBuilder & setGroupKey (

Sets the group key of the attribute.

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.

Parameters
groupkey

The group key to set.

Return:

A ContactAttributeBuilder with the provided group key.

Since:

BlackBerry 10.0.0

ContactAttributeBuilder & setKind (

Sets the kind value of the attribute.

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.

Parameters
kind

The kind to set.

Return:

A ContactAttributeBuilder with the provided kind value.

Since:

BlackBerry 10.0.0

ContactAttributeBuilder & setLabel (

Sets the label of the attribute.

This label can be any QString, and you can use it as a custom label for the attribute, if needed. For example, here's how to set a label for an attribute:

attributeBuilder.setLabel("My father's cousin's roommate's cell phone number");
Parameters
label

The label to set.

Return:

A ContactAttributeBuilder with the provided label.

Since:

BlackBerry 10.0.0

ContactAttributeBuilder & setLaunchUrl (
  • const QUrl &launchUrl)

Sets the URL that's associated with the attribute.

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

Parameters
launchUrl

The URL to set.

Return:

A ContactAttributeBuilder with the provided URL.

Since:

BlackBerry 10.0.0

ContactAttributeBuilder & setSubKind (

Sets the sub-kind value of the attribute.

Similar to the kind of an attribute, the sub-kind refers to a sub-type of an attribute. 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.

Parameters
subkind

The sub-kind to set.

Return:

A ContactAttributeBuilder with the provided sub-kind value.

Since:

BlackBerry 10.0.0

ContactAttributeBuilder & setValue (

Sets the value of the attribute.

Parameters
value

The value to set.

Return:

A ContactAttributeBuilder with the provided value.

Since:

BlackBerry 10.0.0

ContactAttributeBuilder & setValue (

Sets the value of the attribute using the provided QDateTime object.

The provided QDateTime object is converted internally into a string value, so the QString value is the definitive value for an attribute.

Parameters
value

The value to set, as a QDateTime object.

Return:

A ContactAttributeBuilder with the provided QDateTime value.

Since:

BlackBerry 10.0.0

Static Public Functions

AttributeKind::Type determineAttributeKind (

Finds or creates an AttributeKind using the provided string value.

This function lets you create custom attribute kinds to store application-specific data in a contact. Use this function along with determineAttributeSubKind() to add custom attributes.

Parameters
kindValue

A non-empty string value to find or create an AttributeKind::Type for.

Return:

An attribute kind based on the provided string value, or an invalid kind if the kindValue parameter is empty.

Since:

BlackBerry 10.0.0

AttributeSubKind::Type determineAttributeSubKind (

Finds or creates an AttributeSubKind using the provided string value.

This function lets you create custom attribute sub-kinds to store application-specific data in a contact. Use this function along with determineAttributeKind() to add custom attributes.

For example, you might add a custom attribute kind called "Hidden" (using determineAttributeKind()) and then create a custom attribute sub-kind called "Secret" (using this function), which is not part of the AttributeSubKind::Type enumeration.

Parameters
subKindValue

A non-empty string value to find or create an AttributeSubKind::Type for.

Return:

An attribute sub-kind based on the provided string value, or an invalid sub-kind if the subKindValue parameter is empty.

Since:

BlackBerry 10.0.0

Last modified: 2014-06-24



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus