ContactPicker
#include <bb/cascades/pickers/ContactPicker>
To link against this class, add the following line to your .pro file: LIBS += -lbbcascadespickers
A picker for selecting a contact, multiple contacts, or an attribute of a contact.
A ContactPicker is a full screen control that allows the user to select a contact, multiple contacts, or an attribute of a contact. The picker can be configured to show only contacts that match specific criteria. When selection is completed, a signal is emitted from the picker with the selected information. A canceled() signal is emitted if the user cancels the selection.
Filter criteria:
Account - The ContactPicker can be filtered to show only contacts belonging to a specific contacts account.
Kind - Only contacts that have a specific kind of ContactAttribute (e.g. Email, Phone) will be shown in the picker. When the picker is in ContactAttributeSelection mode, only those attributes will be shown.
SubKind - Only contacts that have a specific kind/subKind pair (e.g. Work Email) will be shown in the picker. When the picker is in ContactAttributeSelection mode, only those attributes will be shown.
The following example demonstrates how to create a ContactPicker for selecting multiple contacts that are filtered to show only contacts that have phone numbers:
ContactPicker *contactPicker = new ContactPicker();
contactPicker->setMode(ContactSelectionMode::Multiple);
contactPicker->setKindFilters(QSet<bb::pim::contacts::AttributeKind::Type>()
<< bb::pim::contacts::AttributeKind::Phone);
QObject::connect(contactPicker,
SIGNAL(contactsSelected(QList<int> &)),
this,
SLOT(onContactsSelected(QList<int> &)));
QObject::connect(contactPicker,
SIGNAL(canceled()),
this,
SLOT(onCanceled()));
contactPicker->open();
*
BlackBerry 10.0.0
QML properties
| mode | : bb::cascades::pickers::ContactSelectionMode::Type |
| title | : QString |
| confirmButtonLabel | : QString |
| account | : int |
QML signals
Properties Index
Public Functions Index
| ContactPicker (QObject *parent=0) | |
| virtual | ~ContactPicker () |
| Q_SLOT void | open () |
| Q_SLOT void | close () |
| Q_SLOT void | setMode (bb::cascades::pickers::ContactSelectionMode::Type mode) |
| bb::cascades::pickers::ContactSelectionMode::Type | mode () const |
| Q_SLOT void | setTitle (const QString &title) |
| QString | title () const |
| Q_SLOT void | setAccount (int accountId) |
| int | account () const |
| Q_SLOT void | setExcludeAccounts (const QList< int > &accountIds) |
| QList< int > | excludedAccounts () const |
| Q_SLOT void | setConfirmButtonLabel (const QString &confirmButtonLabel) |
| QString | confirmButtonLabel () const |
| Q_SLOT void | setKindFilters (const QSet< bb::pim::contacts::AttributeKind::Type > &kindFilters) |
| QSet< bb::pim::contacts::AttributeKind::Type > | kindFilters () const |
| Q_SLOT void | setSubKindFilters (const QSet< bb::pim::contacts::KindSubKindSpecifier > &subKindFilters) |
| QSet< bb::pim::contacts::KindSubKindSpecifier > | subKindFilters () const |
| int | selectedContactId () const |
| QList< int > | selectedContactsIds () const |
| SelectedContactAttribute | selectedContactAttribute () const |
| void | setPerimeter (bb::system::SecurityPerimeter::Type perimeter) |
Signals Index
| void | canceled () |
| void | error () |
| void | contactSelected (int contactId) |
| void | contactsSelected (const QList< int > &contactIds) |
| void | contactAttributeSelected (const bb::cascades::pickers::SelectedContactAttribute &attribute) |
| void | modeChanged (bb::cascades::pickers::ContactSelectionMode::Type newMode) |
| void | confirmButtonLabelChanged (const QString &newLabel) |
| void | kindFiltersChanged (const QSet< bb::pim::contacts::AttributeKind::Type > &kindFilters) |
| void | subKindFiltersChanged (const QSet< bb::pim::contacts::KindSubKindSpecifier > &subKindFilters) |
| void | titleChanged (const QString &newTitle) |
| void | accountChanged (int newAccount) |
| void | excludedAccountsChanged (const QList< int > &accountIds) |
Properties
bb::cascades::pickers::ContactSelectionMode::Type
The mode the picker should be launched in.
BlackBerry 10.0.0
QString
A custom label to be displayed in the confirmation button of the picker.
BlackBerry 10.0.0
int
A specific account to select contacts from.
When this is set, only contacts that belong to this account will be displayed.
BlackBerry 10.0.0
Public Functions
Constructs a ContactPicker.
By default the picker is in the ContactSelectionMode::Single mode.
| Parameters | |
|---|---|
| parent |
The parent or 0. If not 0, the ownership of constructed ContactPicker will be transferred to the parent. |
BlackBerry 10.0.0
virtual
Destructor.
BlackBerry 10.0.0
Q_SLOT void
Opens the ContactPicker.
Q_SLOT void
Closes the picker.
Use this only when the user's input is no longer needed. Typically, the picker is closed as soon the user completes the selection.
BlackBerry 10.0.0
Q_SLOT void
Sets the mode the picker should be launched in.
By default, the picker is launched in ContactSelectionMode::Single mode.
| Parameters | |
|---|---|
| ContactSelectionMode |
The selection mode for the picker. |
BlackBerry 10.0.0
bb::cascades::pickers::ContactSelectionMode::Type
Returns the mode of the picker.
The ContactSelectionMode.
BlackBerry 10.0.0
Q_SLOT void
Sets a message to be displayed in the title of the picker.
If this is not set, the default title will be used.
| Parameters | |
|---|---|
| QString |
The title for the picker. |
BlackBerry 10.0.0
QString
Returns the title of the picker.
The title of the picker as a QString.
BlackBerry 10.0.0
Q_SLOT void
Sets a specific account to select contacts from.
When this is set, only contacts that belong to this account will be displayed.
AccountService
| Parameters | |
|---|---|
| accountId |
The account id |
BlackBerry 10.0.0
int
BlackBerry 10.0.0
Q_SLOT void
Filters the list of contacts displayed to contain only contacts where the sources of the contact do not belong to any of the provided account IDs.
| Parameters | |
|---|---|
| accountIds |
The set of account IDs to filter based on. |
QList< int >
excludeAccounts()
Q_SLOT void
Sets a custom label to be displayed in the confirmation button of the picker.
If this is not set, the default label will be used.
| Parameters | |
|---|---|
| confirmButtonLabel |
The label displayed in the confirmation button. |
BlackBerry 10.0.0
QString
BlackBerry 10.0.0
Q_SLOT void
Sets a set of attribute kinds (e.g.
Email, Phone) that should be used for filtering the contacts in the picker.
A contact must have one or more of the attributes in this set in order to be displayed.
ContactConsts
| Parameters | |
|---|---|
| kindFilters |
The set of filters. |
BlackBerry 10.0.0
QSet< bb::pim::contacts::AttributeKind::Type >
Returns the attribute kind filters.
BlackBerry 10.0.0
Q_SLOT void
Sets a set of Attribute kind/subKind pairs to should be used for filtering the contacts in the picker.
A contact must have at least one attribute that matches one of the pairs of kind/subKind.
ContactConsts
| Parameters | |
|---|---|
| subKindFilters |
The set of kindSubKindSpecifier. |
BlackBerry 10.0.0
QSet< bb::pim::contacts::KindSubKindSpecifier >
BlackBerry 10.0.0
int
Returns the id of the contact that was selected in the ContactPicker when in ContactSelectionMode::Single mode.
If the picker mode is not ContactSelectionMode::Single, this value is undefined.
BlackBerry 10.0.0
QList< int >
Returns the ids of the contacts that were selected in the ContactPicker when in ContactSelectionMode::Multiple mode.
If the picker mode is not ContactSelectionMode::Multiple, this value is undefined.
BlackBerry 10.0.0
SelectedContactAttribute
Returns the attribute selected in the ContactPicker when in ContactSelectionMode::Attribute mode.
If the picker mode is not ContactSelectionMode::Attribute, this value is undefined.
BlackBerry 10.0.0
void
Sets the security perimeter in which ContactPicker should be invoked.
Only required for hybrid applications using this api.
| Parameters | |
|---|---|
| perimeter |
Security perimeter to use for ContactPicker invocation. |
BlackBerry 10.1.0
Signals
void
Emitted when the cancel button is clicked in the ContactPicker.
BlackBerry 10.0.0
void
Emitted when launching the picker fails.
This occurs only when system resources are depleted.
BlackBerry 10.0.0
void
Emitted when a contact is selected when not in multi-select mode.
| Parameters | |
|---|---|
| contactId |
The id of the selected contact. |
BlackBerry 10.0.0
void
Emitted completes the selection when in multi-select mode.
| Parameters | |
|---|---|
| contactIds |
The list of selected contactIds. |
BlackBerry 10.0.0
void
Emitted when a contact attribute is selected.
| Parameters | |
|---|---|
| attribute |
A SelectedContactAttribute object populated with the values of the selected attribute. |
BlackBerry 10.0.0
void
Emitted when the Mode property changes.
| Parameters | |
|---|---|
| newMode |
The new Mode of the ContactPicker. |
BlackBerry 10.0.0
void
Emitted when the confirm label changes.
| Parameters | |
|---|---|
| newLabel |
The new Mode of the ContactPicker. |
BlackBerry 10.0.0
void
Emitted when the kind filter list is replaced.
BlackBerry 10.0.0
void
Emitted when the kind filter list is replaced.
BlackBerry 10.0.0
void
Emitted when the title property changes.
| Parameters | |
|---|---|
| newTitle |
The new title for the ContactPicker. |
BlackBerry 10.0.0
void
Emitted when the account filter changes.
| Parameters | |
|---|---|
| newAccount |
The new account id. |
BlackBerry 10.0.0
void
Emitted when the excluded accounts change.
| Parameters | |
|---|---|
| accountIds |
The new set of excluded accounts. |