Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions |
The QContactModel class provides access to the Contacts data. More...
#include <QContactModel>
Inherits QPimModel.
Inherited by ServerContactModel.
The QContactModel class provides access to the Contacts data.
User contacts are represented in the contact model as a table, with each row corresponding to a particular contact and each column as on of the fields of the contact. Complete QContact objects can be retrieved using the contact() function which takes either a row, index, or unique identifier.
The contact model is a descendant of QAbstractItemModel, so it is suitable for use with the Qt View classes such as QListView and QTableView, as well as QContactView and any custom views.
The contact model provides functions for sorting and some filtering of items. For filters or sorting that is not provided by the contact model it is recommended that QSortFilterProxyModel is used to wrap the contact model.
A QContactModel instance will also reflect changes made in other instances of QContactModel, both within this application and from other applications. This will result in the modelReset() signal being emitted.
See also QContact, QContactListView, QSortFilterProxyModel, and Pim Library.
Enumerates the columns when in table mode and columns used for sorting. Is a subset of data retrievable from a QContact.
Constant | Value | Description |
---|---|---|
QContactModel::Invalid | -1 | An invalid field |
QContactModel::Label | 0 | An appropriate text label for the contact |
QContactModel::NameTitle | 1 | The contact's title, such as Mr or Dr. |
QContactModel::FirstName | 2 | The first name of the contact |
QContactModel::MiddleName | 3 | The middle name of the contact |
QContactModel::LastName | 4 | The last name of the contact |
QContactModel::Suffix | 5 | The contact's suffix, such as Jr or II. |
QContactModel::JobTitle | 6 | The contact's job title |
QContactModel::Department | 7 | The contact's department |
QContactModel::Company | 8 | The contact's company |
QContactModel::BusinessPhone | 9 | The business phone number of the contact |
QContactModel::BusinessFax | 10 | The business fax number of the contact |
QContactModel::BusinessMobile | 11 | The business mobile number of the contact |
QContactModel::BusinessPager | 28 | The business pager number of the contact |
QContactModel::HomePhone | 19 | The home phone number of the contact |
QContactModel::HomeFax | 20 | The home fax number of the contact |
QContactModel::HomeMobile | 21 | The home mobile number of the contact |
QContactModel::DefaultPhone | 14 | The default phone number for the contact |
QContactModel::DefaultEmail | 12 | The default email address for the contact |
QContactModel::Emails | 13 | The list of email addresses for the contact |
QContactModel::BusinessStreet | 23 | The business street address for the contact |
QContactModel::BusinessCity | 24 | The city for the business address of the contact |
QContactModel::BusinessState | 25 | The state for the business address of the contact |
QContactModel::BusinessZip | 26 | The zip code for the business address of the contact |
QContactModel::BusinessCountry | 27 | The country for the business address of the contact |
QContactModel::BusinessWebPage | 29 | The business web page address of the contact |
QContactModel::Office | 30 | The contact's office |
QContactModel::Profession | 31 | The contact's profession |
QContactModel::Assistant | 32 | The contact's assistant |
QContactModel::Manager | 33 | The contact's manager |
QContactModel::HomeStreet | 34 | The home street address for the contact |
QContactModel::HomeCity | 35 | The city for the home address of the contact |
QContactModel::HomeState | 36 | The state for the home address of the contact |
QContactModel::HomeZip | 37 | The zip code for the home address of the contact |
QContactModel::HomeCountry | 38 | The country for the home address of the contact |
QContactModel::HomeWebPage | 39 | The home web page address of the contact |
QContactModel::Spouse | 40 | The contact's spouse |
QContactModel::Gender | 41 | The contact's gender |
QContactModel::Birthday | 42 | The contact's birthday |
QContactModel::Anniversary | 43 | The contact's anniversary |
QContactModel::Nickname | 44 | The nickname of the contact |
QContactModel::Children | 45 | The contact's children |
QContactModel::Portrait | 46 | The portrait of the contact |
QContactModel::Notes | 47 | The notes relating to the contact |
QContactModel::LastNamePronunciation | 48 | The pronunciation of the last name of the contact |
QContactModel::FirstNamePronunciation | 49 | The pronunciation of the first name of the contact |
QContactModel::CompanyPronunciation | 50 | The pronunciation of the contact's company |
QContactModel::Identifier | 51 | The identifier of the contact |
QContactModel::Categories | 52 | The list of categories the contact belongs to |
QContactModel::HomeVOIP | 54 | The URI for the contact's home VOIP id |
QContactModel::BusinessVOIP | 55 | The URI for the contact's business VOIP id |
QContactModel::PresenceStatus | 56 | A map (QPresenceTypeMap) of presence URIs to presence status types for this contact |
QContactModel::PresenceStatusString | 57 | A map (QPresenceStringMap) of presence URIs to presence status strings for this contact |
QContactModel::PresenceMessage | 61 | A map (QPresenceStringMap) of presence URIs to presence messages for this contact |
QContactModel::PresenceDisplayName | 58 | A map (QPresenceStringMap) of presence URIs to display names for this contact |
QContactModel::PresenceUpdateTime | 59 | A map (QPresenceDateTimeMap) of presence URIs to last update time for this contact |
QContactModel::PresenceAvatar | 62 | A map (QPresenceStringMap) of presence URIs to avatar file paths for this contact |
QContactModel::PresenceCapabilities | 60 | A map (QPresenceCapabilityMap) of presence URIs to presence capabilities for this contact |
See also localeNameTitles() and localeSuffixes().
These flags describe what kind of contact information to filter contacts on.
Constant | Value | Description |
---|---|---|
QContactModel::ContainsPhoneNumber | 0x00100 | The contact must provide one or more phone numbers. |
QContactModel::ContainsEmail | 0x0200 | The contact must provide one or more email addresses. |
QContactModel::ContainsMailing | 0x0400 | The contact must provide one or more mailing addresses. |
QContactModel::ContainsChat | 0x0800 | The contact must provide one or more chat addresses. |
See also setFilter().
Extends Qt::ItemDataRole
Constant | Value | Description |
---|---|---|
QContactModel::LabelRole | Qt::UserRole | A short formatted text label of the contacts name. |
QContactModel::SubLabelRole | Qt::UserRole + 1 | A short formatted text label with supplementary contact information, like phone number, email address or company. |
QContactModel::PortraitRole | Qt::UserRole + 2 | A pixmap of the contacts image, or a default image if none is specifically set. |
QContactModel::StatusIconRole | Qt::UserRole + 3 | An icon providing additional information about the contact. For instance marking as a business contact or marking the contact as recently called. |
The QContactModel::SortField structure provides sorting instructions.
This structure holds a QContactModel field to sort by, and a sorting direction. Typically an ordered list of these structures is used to allows arbitrary sorting to be performed on a QContactModel.
See also QContactModel.
Constructs contact model with the given parent.
Destroys the contact model.
Adds the contact to the model under the specified storage source. If source is null the function will add the contact to the default storage source.
Returns a valid identifier for the contact if the contact was successfully added. Otherwise returns a null identifier.
Note the current identifier of the specified appointment is ignored.
See also phoneSource(), simSource(), and mirrorToSource().
Adds the PIM record encoded in bytes to the model under the specified storage source. The format of the record in bytes is given by format. An empty format string will cause the record to be read using the data stream operators for the PIM data type of the model. If the specified source is null the function will add the record to the default storage source.
Returns a valid identifier for the record if the record was successfully added. Otherwise returns a null identifier.
Can only add PIM data that is represented by the model. This means that only contact data can be added using a contact model. Valid formats are "vCard" or an empty string.
Reimplemented from QPimModel.
Clears contact name and type filtering for the model. Does not affect category or presence filtering.
Clears the personal details of the device owner. Does not remove and contacts from the contact model.
/sa setPersonalDetails()
Clears any presence filtering done by the model.
See also setPresenceFilter().
Returns the contact for the row specified by index. The column of index is ignored.
This is an overloaded member function, provided for convenience.
Return the contact for the given row.
This is an overloaded member function, provided for convenience.
Returns the contact in the model with the given identifier. The contact does not have to be in the current filter mode for it to be returned.
Returns the value for the specified field of the given contact.
See also setContactField().
Returns the data stored under the given role for the item referred to by the index.
The row of the index specifies which contact to access and the column of the index is treated as a QContactModel::Field.
Reimplemented from QAbstractItemModel.
See also setData() and contactField().
Returns a icon representing the contact model field.
Returns a null icon if no icon is available.
See also fieldLabel(), fieldIdentifier(), and identifierField().
Returns a non-translated string describing the contact model field.
See also fieldLabel(), fieldIcon(), and identifierField().
Returns a translated string describing the contact model field.
See also fieldIcon(), fieldIdentifier(), and identifierField().
Returns the filter flags being used by the model.
See also setFilter().
Returns the filter text being used by the model.
See also setFilter().
Returns the index of the first entry for a SIM cnotact data source.
Returns true if a contact in the contact model is specified as the personal details of the device owner.
Returns the contact model field for the non-translated field identifier.
See also fieldLabel(), fieldIcon(), and fieldIdentifier().
Returns true if the contact for the specified row represents the personal details of the device owner.
This is an overloaded member function, provided for convenience.
Returns true if the contact at the given row represents the personal details of the device owner.
This is an overloaded member function, provided for convenience.
Returns true if the contact with specified identifier represents the personal details of the device owner.
Returns true if the contact at the given index is stored on the SIM card.
This is an overloaded member function, provided for convenience.
Returns true if the contact with the given identifier is on the SIM card.
Returns the contact model fields that represent the label for a contact.
Returns the index of the last entry for a SIM contact data source.
Returns true if the entries for the given SIM contact source are still being loaded into SQL storage.
See also simLoaded().
Returns known name titles for the current language settings. These are used to assist in parsing and constructing contact name information. Contacts are not restricted to these name titles.
Returns known suffixes for the current language settings. These are used to assist in parsing and constructing contact name information. Contacts are not restricted to these suffixes.
Returns a list of indexes for the items where the data in the field value matches the specified value. The list that is returned may be empty.
The search starts from the start row and continues until the number of matching data items equals hits or the search reaches the last row.
The flags argument can contain any of the following flags:
- Qt::MatchWildcard - Qt::MatchFixedString (or equivalently Qt::MatchExactly) - Qt::MatchContains - Qt::MatchStartsWith - Qt::MatchCaseSensitive
This is an overloaded member function, provided for convenience.
Returns a list of indexes for the items where the data matches the specified value. The list that is returned may be empty.
The search starts from the start index and continues until the number of matching data items equals hits or the search reaches the last row
The arguments role and flags are currently ignored.
Returns the best match for the chat address text. If the provider is not empty, restricts matches to contacts with chat addresses from that QCollectivePresence provider. If no contact in the model has a chat address matching the given text returns a null contact.
See also QCollectivePresence.
Returns the best match for the email address text. If no contact in the model has an email address matching the given text returns a null contact.
Returns the best match for the phone number text. If no contact in the model has a phone number matching the given text returns a null contact.
Exports the contacts stored in source storage source and imports them into the destination storage source. The contacts are modified by the source and destination storage contexts to account for storage restrictions.
Returns true upon success.
See also mirrorToSource().
Exports the contact in the model with the specified identifier and imports it into the destination storage source. The contact is modified by the source and destination storage contexts to account for storage restrictions. For instance a contact may be split into multiple contacts when mirrored to the active SIM card and contacts from the SIM card will be merged into contacts in local storage if they have equal name information.
Returns true upon success.
See also mirrorAll().
Returns the contact representing the personal details of the device owner.
If no contact is specified as the personal details of the device owner, will return a null contact.
See also setPersonalDetails().
Returns the identifier for the contact representing the personal details of the device owner.
If no contact is specified as the personal details of the device owner, will return a null identifier.
Returns the contact model fields that represent the phone numbers for a contact.
Returns the default identifier for storage sources relating to the device memory.
Returns the presence filter being used by the model.
See also setPresenceFilter().
Returns the record in the model with the specified identifier encoded in the format specified by the format string. An empty format string will cause the record to be written using the data stream operators for the PIM data type of the model.
Valid formats are "vCard" or an empty string.
Reimplemented from QPimModel.
See also contact().
Removes the contact from the model with the same identifier as the specified contact.
Returns true if the contact was successfully removed.
This is an overloaded member function, provided for convenience.
Removes the contact from the model with the specified identifier.
Returns true if the contact was successfully removed.
Removes the records in the model specified by the list of identifiers.
Returns true if contacts were successfully removed.
Removes the record from the model with the specified identifier.
Returns true if the record was successfully removed.
Reimplemented from QPimModel.
Sets the value for the specified field of the given contact to value.
Returns true if the contact was modified.
See also contactField() and setData().
Sets the role data for the item at index to value. Returns true if successful.
The contact model only accepts data for the EditRole. The column of the specified index specifies the QContactModel::Field to set and the row of the index specifies which contact to modify.
Reimplemented from QAbstractItemModel.
See also data() and setContactField().
Sets the model to filter contacts by labels that start with text and contact type information specified flags. By default flags is 0 which means filtering will only occur based on label text.
See also FilterFlags, filterFlags(), and filterText().
Sets the personal details of the device owner to the contact with the given identifier. If there is no contact with the specified identifier in the contact model this will clear the personal details.
See also personalDetails() and clearPersonalDetails().
Sets the model to only contain those contacts that have a presence status in the supplied types.
See also presenceFilter().
Returns the identifier for the currently inserted SIM card.
Returns the list of indexes in the given source of contact data on a SIM card for the contact with the given identifier.
Returns the number of free indexes for a given SIM contact data source.
Returns the total number of indexes available for a given SIM contact data source.
Returns the maximum number of characters for the label component of a SIM contact data source entry.
Note that when storing contacts with multiple phone numbers to a SIM, part of the label may be used to indicate the type phone number for the entries used.
This signal is emitted when the given source of contact data on a SIM card completes syncing to the SQL storage.
See also loadingSim().
Returns the maximum number of characters for the number component of a SIM contact data source entry.
Returns the identifier for storage sources relating to the SIM Card.
Returns the number of indexes used for a given SIM contact data source.
Sorts the model by the fields specified in list. Each entry in the list specifies a field and an order (ascending or descending).
This is an overloaded member function, provided for convenience.
Sorts the model by column in the specified order.
Reimplemented from QAbstractItemModel.
Updates the contact in the model with the same identifier as the specified contact to equal the specified contact.
Returns true if the contact was successfully updated.
Updates the corresponding record in the model to equal the record encoded in bytes. The format of the record in bytes is given by the format string. An empty format string will cause the record to be read using the data stream operators for the PIM data type of the model. If id is not null will set the record identifier to id before attempting to update the record.
Returns true if the record was successfully updated.
Valid formats are "vCalendar" or an empty string.
Reimplemented from QPimModel.
See also updateContact().
Write vCards for all visible contacts in the model to the file specified by filename.
Returns true if successful.
Copyright © 2009 Trolltech | Trademarks | Qt Extended 4.4.3 |