- Qt 5.0
- Qt 5.0.0 Reference Documentation

# Contact QML Type

The Contact element represents an addressbook contact. More...

Import Statement: | import QtContacts 5.0

- List of all members, including inherited members

## Properties

- address : Address
- addresses : list<Address>
- anniversary : Anniversary
- avatar : Avatar
- birthday : Birthday
- contactDetails : list<ContactDetail>
- contactId : int
- displayLabel : DisplayLabel
- email : EmailAddress
- emails : list<EmailAddress>
- extendedDetail : ExtendedDetail
- extendedDetails : list<ExtendedDetail>
- family : Family
- favorite : Favorite
- gender : Gender
- geolocation : GeoLocation
- globalPresence : GlobalPresence
- guid : Guid
- hobby : Hobby
- manager : string
- modified : bool
- name : Name
- nickname : Nickname
- note : Note
- onlineAccount : OnlineAccount
- organization : Organization
- organizations : list<Organization>
- phoneNumber : PhoneNumber
- phoneNumbers : list<PhoneNumber>
- presence : Presence
- ringtone : Ringtone
- syncTarget : SyncTarget
- tag : Tag
- timestamp : Timestamp
- type : enumeration
- url : Url
- urls : list<Url>
- version : Version

## Methods

- addDetail(detail)
- clearDetails()
- isPreferredDetail(actionName, detail)
- preferredDetail(actionName, detail)
- removeDetail(detail)
- save()
- setPreferredDetail(actionName, detail)

## Detailed Description

The Contact element is part of the QtContacts module.

A Contact object has a collection of details (like a name, phone numbers and email addresses). Each detail (which can have multiple fields) is stored in an appropriate subclass of ContactDetail, and the Contact allows retrieving these details in various ways.

If some of the contact details are not unique details, all of this type of detail values can be accessed by the property with the name in plural. For example, if there are 3 phone numbers stored in a contact, they can be accessed by contact.phoneNumbers property, which holds a list of all PhoneNumber details. If a contact does not contain a detail of particular type, the value of the corresponding singular property (e.g. phoneNumber) in undefined and the plural (e.g. phoneNumbers) is empty. The list of properties which support multiple detail instances depends on the contact engine implementations.

See also QContact.

## Property Documentation

address : Address

This property holds the address detail of the Contact object. In case a contact has several addresses then the first one is returned.

addresses : list<Address>

This property holds the address details of the Contact object.

anniversary : Anniversary

This property holds the anniversary detail of the Contact object.

avatar : Avatar

This property holds the avatar detail of the Contact object.

birthday : Birthday

This property holds the birthday detail of the Contact object.

contactDetails : list<ContactDetail>

This property holds the list of all the details that the contact has.

contactId : int

This property holds the id of the Contact object. This property is read only.

displayLabel : DisplayLabel

This property holds the displayLabel detail of the Contact object. display label is the one which gets displayed when a contact is created as per versit doc specs this is a "FN" property

email : EmailAddress

This property holds the email address detail of the Contact object. In case a contact has several email addresses then the first one is returned.

emails : list<EmailAddress>

This property holds the email address details of the Contact object.

extendedDetail : ExtendedDetail

This property holds the extended detail of the Contact object. In case a contact has several extended details then the first one is returned.

extendedDetails : list<ExtendedDetail>

This property holds the extended details of the Contact object.

family : Family

This property holds the family detail of the Contact object.

favorite : Favorite

This property holds the favorite detail of the Contact object.

gender : Gender

This property holds the gender detail of the Contact object.

geolocation : GeoLocation

This property holds the geolocation detail of the Contact object.

globalPresence : GlobalPresence

This property holds the globalPresence detail of the Contact object.

guid : Guid

This property holds the guid detail of the Contact object.

hobby : Hobby

This property holds the hobby detail of the Contact object.

manager : string

This property holds the manager name which the Contact object comes from.

modified : bool

This property holds the dirty flag of the Contact object. If the Contact has been changed, returns true, otherwise returns false.

name : Name

This property holds the name detail of the Contact object.

nickname : Nickname

This property holds the nickname detail of the Contact object.

note : Note

This property holds the note detail of the Contact object.

onlineAccount : OnlineAccount

This property holds the onlineAccount detail of the Contact object. In case a contact has several accounts then the first one is returned.

organization : Organization

This property holds the organization detail of the Contact object.

organizations : list<Organization>

This property holds the organization details of the Contact object.

phoneNumber : PhoneNumber

This property holds the phone number detail of the Contact object. In case a contact has several numbers then the first one is returned.

phoneNumbers : list<PhoneNumber>

This property holds the phone number details of the Contact object.

presence : Presence

This property holds the presence detail of the Contact object.

ringtone : Ringtone

This property holds the ringtone detail of the Contact object.

syncTarget : SyncTarget

This property holds the syncTarget detail of the Contact object.

tag : Tag

This property holds the tag detail of the Contact object.

timestamp : Timestamp

This property holds the timestamp detail of the Contact object.

type : enumeration

This property holds type of the Contact, the value can be one of:

- Contact.Contact
- Contact.Group
- Contact.Facet

url : Url

This property holds the url detail of the Contact object.

urls : list<Url>

This property holds the url details of the Contact object.

version : Version

This property holds the version detail of the Contact object.

## Method Documentation

addDetail(detail)

Adds the given contact detail to the contact, returns true if successful, otherwise returns false.

Note: If the detail has been added into the same contact before, this operation will be ignored, so if you want to add a detail multiple times, the detail should be copied before calling this function.

clearDetails()

Remove all detail objects in this contact.

isPreferredDetail(actionName, detail)

Returns true if the given detail is a preferred detail for the given actionName, or for any action if the actionName is empty.

See also preferredDetail().

preferredDetail(actionName, detail)

Returns the preferred detail for a given actionName.

If the actionName is empty, or there is no preference recorded for the supplied actionName, returns null.

See also setPreferredDetail() and preferredDetails().

removeDetail(detail)

Removes the given contact detail from the contact, returns true if successful, otherwise returns false.

save()

Saves this Contact if the contact has been modified.

See also Contact::modified.

setPreferredDetail(actionName, detail)

Set a particular detail (preferredDetail) as the preferred detail for any actions with the given actionName.

The preferredDetail object must exist in this object, and the actionName cannot be empty.

Returns true if the preference could be recorded, and false otherwise.

See also preferredDetail().