S60 Speed Dial Utility Control API Specification: Using Speed Dial Utility Control API

Assigning a Speed Dial number

When the client application wants to assign a contact to a particular speed dial index, AssignDialIndexL function from Speed Dial Utility Control API is used. This API takes a speed dial index as the parameter. If the given speed dial index is already assigned, it asks for confirmation from the user to remove the existing contact and to add a new one. If there is no contact assigned to the speed dial, the user can select any contact from the contact list and assign the speed dial index to it. See the usage of AssignDialIndexL function below.

//Assigns the index data at the index in the phone book's contact entry. index is a index of array. Returns ETrue if successful and EFalse if fails.
TInt index(3); /* A valid speed dial index */
CSpdiaControl* speedDialCtrl = CSpdiaControl::NewL();
speedDialCtrl ->AssignDialIndexL(index);

Another way of assigning a SpeedDial Number from Speed Dial Utility Control API is by using ExecuteLD function. When the client application already has a contact item and it wants to assign a speed dial number to a particular field in that contact item. The API ExecuteLD() is provided for this purpose. The API client should provide a valid contact item id and the field index to which he wants the speed dial to be assigned. The following code explains how to use this API.

TContactItemId  cId (3256); /* This should be a valid contact item id */
TInt fieldIdx (3); /* This should be a valid field id */
CSpdiaControl* speedDialCtrl = CSpdiaControl::NewL();
// Runs the Speed Dial Selection Grid Dialog, If accepted sets speed dial key to fieldIdx.
// cId a contact item id. fieldIdx index to aItems field set. Returns nonzero if accepted, zero if canceled.

speedDialCtrl ->ExecuteLD(cId,fieldIdx);

Removing a Speed Dial number

RemoveDialIndexL API is used to remove the contact item assigned to a speed dial index. The speed dial index for removal is given as parameter to this API. The code below illustrates how to use it.

TInt index(3); /* A valid speed dial index */
CSpdiaControl* speedDialCtrl = CSpdiaControl::NewL();

// Removes a speed dial from the Phonebook's contact entry. aIndex is a index of an array. Returns ETrue if success
speedDialCtrl ->RemoveDialIndexL(index);

Error handling

Normal Symbian error handling practises should be used, including e.g. using cleanup stack and trap harness. Leaves and system wide error codes as function return values are used if the error is recoverable. A client application can handle these errors similarly as a normal Symbian platform application.


Copyright © Nokia Corporation 2001-2008
Back to top