The URI List framework provides two classes for URI list operation: RInetUri and RInetUriList. RInetUri represents a handle to the URI and its associated properties (like service type, list type, permission and favourite name). RInetUriList represents a handle to the entire list and provides APIs for adding URIs to the list, removing URIs from the list, and updating URIs in the list. Before performing any operation, a session with URI List Server should be created by calling RInetUriList::OpenL().
This section contains the following subsections:
A URI can be added to the list using the following API:
void AddL(const RInetUri& aInetUri)
Where the RInetUri parameter is the Uri property object that contains all properties of a URI. Sample code to add URIs to the list is shown here.
//Create the URI _LIT8(KUri, “http://www.symbian.org”); //Create a RInetUri object RInetUri uriObject; //Now initialise the object with Uri properties. uriObject.CreateL ( KUri, EWapPush, EBlackList); CleanupClosePushL(uriObject); //Now create the RInetUriList object RInetUriList uriListObj; //Create a server session uriListObj.OpenL(); CleanupClosePushL(uriListObj); //Now add the Uri to list. uriListObj.AddL(uriObject); //Pop and close the server session. CleanupStack::PopAndDestroy ( &uriListObj); //Pop and free up memory of uri property object. CleanupStack::PopAndDestroy ( &uriObject);
The RInetUri::CreateL function accepts a reference to an 8-bit descriptor only. By default, the permission attribute of Uri is set to EReadWrite. RInetUri::Close should be called to free up the memory.
The RInetUriList class provides the following API for removing a URI from the list:
void RemoveL(const RInetUri& aInetUri)
Where the RInetUri parameter is the Uri property object. This object handle can be obtained by calling RInetUriList::OpenInetUriL(), and passing URI and service type. Sample code to remove URIs from the list is shown here:
_LIT8(KUri “http://www.symbian.org”); RInetUri uriObject; RInetUriList uriListObj; uriListObj.OpenL(); CleanupClosePushL(uriListObj); uriObject = uriListObj. OpenInetUriL(KUri, EBrowser); CleanupClosePushL(uriObject); uriListObj.RemoveL(uriObject); //Pop and close the server session. CleanupStack::PopAndDestroy ( &uriListObj); //Pop and free up memory of uri property object. CleanupStack::PopAndDestroy ( &uriObject);
The RInetUriList class provides the following API for updating properties of a URI in the list:
void UpdateL(const RInetUri& aInetUri)
Where the RInetUri parameter is the Uri property object. This object handle can be obtained by calling RInetUriList::OpenInetUriL(), and passing URI and service type. Only favourite name and list type of a URI can be updated. Sample code to update a URI in the list is shown here.
_LIT8(KUri “http://www.symbian.org”); _LIT8(KUriFavoritename “Home Page of Symbian”); RInetUri uriObject; RInetUriList uriListObj; uriListObj.OpenL(); CleanupClosePushL(uriListObj); uriObject = uriListObj. OpenInetUriL(KUri, EBrowser); CleanupClosePushL(uriObject); uriObject.SetListType(EBlackList); uriObject.SetFavoriteNameL(KUriFavoritename); uriListObj.UpdateL(uriObject); //Pop and close the server session. CleanupStack::PopAndDestroy ( &uriListObj); //Pop and free up memory of uri property object. CleanupStack::PopAndDestroy ( &uriObject);