Symbian3/SDK/Source/GUID-F8159093-6349-516B-8301-C50BD2AC9F2C.dita
author Graeme Price <GRAEME.PRICE@NOKIA.COM>
Fri, 15 Oct 2010 14:32:18 +0100
changeset 15 307f4279f433
parent 0 89d6a7a84779
permissions -rw-r--r--
Initial contribution of the Adaptation Documentation.

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="GUID-F8159093-6349-516B-8301-C50BD2AC9F2C" xml:lang="en"><title>Using
URIs from the URI List</title><prolog><metadata><keywords/></metadata></prolog><conbody>
<p>The URI List framework provides two classes for URI list operation: <xref href="GUID-75AC6BC8-1D10-33FC-8BB2-98EEDF16BCB4.dita"><apiname>RInetUri</apiname></xref> and <xref href="GUID-6F5E2A42-5047-3AB2-9929-D893B88F2BD2.dita"><apiname>RInetUriList</apiname></xref>. <xref href="GUID-75AC6BC8-1D10-33FC-8BB2-98EEDF16BCB4.dita"><apiname>RInetUri</apiname></xref> represents a handle to the URI and its associated properties (like <i>service
type</i>, <i>list type</i>, <i>permission</i> and <i>favourite name</i>). <xref href="GUID-6F5E2A42-5047-3AB2-9929-D893B88F2BD2.dita"><apiname>RInetUriList</apiname></xref> 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 <xref href="GUID-6F5E2A42-5047-3AB2-9929-D893B88F2BD2.dita#GUID-6F5E2A42-5047-3AB2-9929-D893B88F2BD2/GUID-216A97DE-FB70-3465-8989-75914D4698C2"><apiname>RInetUriList::OpenL()</apiname></xref>. </p>
<p>This section contains the following subsections: </p>
<ul>
<li id="GUID-2D38354A-5FD7-5D72-B9D2-E02D9345E60A"><p> <xref href="GUID-F8159093-6349-516B-8301-C50BD2AC9F2C.dita#GUID-F8159093-6349-516B-8301-C50BD2AC9F2C/GUID-D466B837-760E-5FD9-84C0-D80DDB205C97">Adding a URI to the list</xref>  </p> </li>
<li id="GUID-7E954F3C-81F6-5EAB-975F-3E6619EFB312"><p> <xref href="GUID-F8159093-6349-516B-8301-C50BD2AC9F2C.dita#GUID-F8159093-6349-516B-8301-C50BD2AC9F2C/GUID-7FA78C8E-74A5-5FF8-99DF-11A6D9A04F83">Removing a URI from the list</xref>  </p> </li>
<li id="GUID-12EC94EA-75C5-52D7-8415-7E888144F491"><p> <xref href="GUID-F8159093-6349-516B-8301-C50BD2AC9F2C.dita#GUID-F8159093-6349-516B-8301-C50BD2AC9F2C/GUID-202A44E4-3E28-5B84-8C8C-E1B1D094B9D5">Updating a URI in the list </xref>  </p> </li>
</ul>
<section id="GUID-D466B837-760E-5FD9-84C0-D80DDB205C97"><title>Adding a URI
to the list</title> <p>A URI can be added to the list using the following
API: </p> <p> <codeph>void AddL(const RInetUri&amp;           aInetUri)</codeph> </p> <p>Where
the <xref href="GUID-75AC6BC8-1D10-33FC-8BB2-98EEDF16BCB4.dita"><apiname>RInetUri</apiname></xref> parameter is the <codeph>Uri</codeph> property
object that contains all properties of a URI. Sample code to add URIs to the
list is shown here. </p> <codeblock id="GUID-9F38C56A-C5D1-5DE9-A7B1-5FC9C456B184" xml:space="preserve">//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 ( &amp;uriListObj);

//Pop and free up memory of uri property object.
CleanupStack::PopAndDestroy ( &amp;uriObject);
</codeblock> <p>The <xref href="GUID-75AC6BC8-1D10-33FC-8BB2-98EEDF16BCB4.dita#GUID-75AC6BC8-1D10-33FC-8BB2-98EEDF16BCB4/GUID-693DB5EF-B91F-3AD1-BD59-66F7D6987C76"><apiname>RInetUri::CreateL</apiname></xref> function accepts
a reference to an 8-bit descriptor only. By default, the permission attribute
of <codeph>Uri</codeph> is set to <codeph>EReadWrite</codeph>. <xref href="GUID-75AC6BC8-1D10-33FC-8BB2-98EEDF16BCB4.dita#GUID-75AC6BC8-1D10-33FC-8BB2-98EEDF16BCB4/GUID-089BEF50-85CB-36E8-BD4E-FB836A687307"><apiname>RInetUri::Close</apiname></xref> should
be called to free up the memory. </p> </section>
<section id="GUID-7FA78C8E-74A5-5FF8-99DF-11A6D9A04F83"><title>Removing a
URI from the list</title> <p>The <xref href="GUID-6F5E2A42-5047-3AB2-9929-D893B88F2BD2.dita"><apiname>RInetUriList</apiname></xref> class provides
the following API for removing a URI from the list: </p> <p> <codeph>void
RemoveL(const RInetUri&amp;           aInetUri)</codeph> </p> <p>Where the <xref href="GUID-75AC6BC8-1D10-33FC-8BB2-98EEDF16BCB4.dita"><apiname>RInetUri</apiname></xref> parameter
is the <codeph>Uri</codeph> property object. This object handle can be obtained
by calling <xref href="GUID-6F5E2A42-5047-3AB2-9929-D893B88F2BD2.dita#GUID-6F5E2A42-5047-3AB2-9929-D893B88F2BD2/GUID-0F1C347F-1F7F-343D-B36A-B3924C7FA795"><apiname>RInetUriList::OpenInetUriL()</apiname></xref>, and passing URI
and service type. Sample code to remove URIs from the list is shown here: </p> <codeblock id="GUID-DC259A5E-3B9D-5946-93DE-D30510C69A90" xml:space="preserve">_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 ( &amp;uriListObj);

//Pop and free up memory of uri property object.
CleanupStack::PopAndDestroy ( &amp;uriObject);
</codeblock> </section>
<section id="GUID-202A44E4-3E28-5B84-8C8C-E1B1D094B9D5"><title>Updating a
URI in the list</title> <p>The <xref href="GUID-6F5E2A42-5047-3AB2-9929-D893B88F2BD2.dita"><apiname>RInetUriList</apiname></xref> class provides
the following API for updating properties of a URI in the list: </p> <p> <codeph>void
UpdateL(const RInetUri&amp;           aInetUri)</codeph> </p> <p>Where the <xref href="GUID-75AC6BC8-1D10-33FC-8BB2-98EEDF16BCB4.dita"><apiname>RInetUri</apiname></xref> parameter
is the <codeph>Uri</codeph> property object. This object handle can be obtained
by calling <xref href="GUID-6F5E2A42-5047-3AB2-9929-D893B88F2BD2.dita#GUID-6F5E2A42-5047-3AB2-9929-D893B88F2BD2/GUID-0F1C347F-1F7F-343D-B36A-B3924C7FA795"><apiname>RInetUriList::OpenInetUriL()</apiname></xref>, and passing URI
and service type. Only <i>favourite name</i> and <i>list type</i> of a URI
can be updated. Sample code to update a URI in the list is shown here. </p> <codeblock id="GUID-777AEE6D-FE05-57FF-9F3D-A80A93A1F965" xml:space="preserve">_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 ( &amp;uriListObj);

//Pop and free up memory of uri property object.
CleanupStack::PopAndDestroy ( &amp;uriObject);
</codeblock> </section>
</conbody></concept>