ContactFavouriteAction
#include <bb/pim/contacts/ContactFavouriteAction>
To link against this class, add the following line to your .pro file: LIBS += -lbbpim
The ContactFavouriteAction class represents a favorite action for a ContactAttribute.
You can use a ContactFavouriteAction to specify the most common action for a particular attribute of a contact. For example, you could make sure that an attribute is always associated with the "email" action. You can specify more than one favorite action for a contact attribute.
You can set and retrieve favorite actions for a contact attribute by using functions in the ContactService class (ContactService::favouriteActions() and ContactService::setFavouriteAction()). You can create a new ContactFavouriteAction and specify values for an existing ContactFavouriteAction by using a ContactFavouriteActionBuilder.
Here's how to set a favorite action for a contact:
qDebug() << "Creating a new contact";
Contact returnData = service.createContact(builder, false);
qDebug() << "Create done";
EXPECT_TRUE(returnData.id() != 0);
int contact_id = returnData.id();
// Get the contact
qDebug() << "getting contact details for contact " << contact_id;
Contact contact = service.contactDetails(contact_id);
printContact(contact);
EXPECT_TRUE(contact.attributes().size() == 1);
// set favourite action
QVariantMap action;
ContactFavouriteActionBuilder ab;
ab.setActionName("call");
ab.setAttributeAssociation(contact.attributes().first().id());
service.setFavouriteAction(contact_id, ab);
// get favourite actions
QList<ContactFavouriteAction> actions = service.favouriteActions(contact_id);
EXPECT_TRUE(actions.count() > 0);
EXPECT_TRUE(actions[0].attributeId() == contact.attributes().first().id());
EXPECT_TRUE(actions[0].actionName() == QString("call"));
BlackBerry 10.0.0
Public Functions Index
| ContactFavouriteAction () | |
| ContactFavouriteAction (const ContactFavouriteAction ©) | |
| ~ContactFavouriteAction () | |
| ContactFavouriteAction & | operator= (const ContactFavouriteAction &operand) |
| int | id () const |
| int | attributeId () const |
| QString | actionName () const |
Public Functions
Copy constructor.
This function constructs a ContactFavouriteAction containing exactly the same values as the provided ContactFavouriteAction.
| Parameters | |
|---|---|
| copy |
The ContactFavouriteAction to be copied. |
BlackBerry 10.0.0
Destructor.
BlackBerry 10.0.0
ContactFavouriteAction &
Assignment operator.
This operator copies all values from the provided ContactFavouriteAction into this ContactFavouriteAction.
| Parameters | |
|---|---|
| operand |
The ContactFavouriteAction from which to copy all values. |
A ContactFavouriteAction with all copied data
BlackBerry 10.0.0
int
Retrieves the ID of this ContactFavouriteAction.
The ID uniquely identifies this ContactFavouriteAction, and is assigned when the action is created.
The ID of this ContactFavouriteAction.
BlackBerry 10.0.0
int
Retrieves the attribute ID that's associated with this ContactFavouriteAction.
The attribute ID specifies which attribute this action is associated with.
The attribute ID of this ContactFavouriteAction.
BlackBerry 10.0.0
QString
Retrieves the name of the action of this ContactFavouriteAction.
This value is the name of the action that's associated with the attribute, and can be a QString such as "phone", "email", "text", and so on.
The name of the action of this ContactFavouriteAction.
BlackBerry 10.0.0