Symbian3/SDK/Source/GUID-F8159093-6349-516B-8301-C50BD2AC9F2C.dita
changeset 0 89d6a7a84779
equal deleted inserted replaced
-1:000000000000 0:89d6a7a84779
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept id="GUID-F8159093-6349-516B-8301-C50BD2AC9F2C" xml:lang="en"><title>Using
       
    13 URIs from the URI List</title><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    14 <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
       
    15 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
       
    16 a handle to the entire list and provides APIs for adding URIs to the list,
       
    17 removing URIs from the list, and updating URIs in the list. Before performing
       
    18 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>
       
    19 <p>This section contains the following subsections: </p>
       
    20 <ul>
       
    21 <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>
       
    22 <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>
       
    23 <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>
       
    24 </ul>
       
    25 <section id="GUID-D466B837-760E-5FD9-84C0-D80DDB205C97"><title>Adding a URI
       
    26 to the list</title> <p>A URI can be added to the list using the following
       
    27 API: </p> <p> <codeph>void AddL(const RInetUri&amp;           aInetUri)</codeph> </p> <p>Where
       
    28 the <xref href="GUID-75AC6BC8-1D10-33FC-8BB2-98EEDF16BCB4.dita"><apiname>RInetUri</apiname></xref> parameter is the <codeph>Uri</codeph> property
       
    29 object that contains all properties of a URI. Sample code to add URIs to the
       
    30 list is shown here. </p> <codeblock id="GUID-9F38C56A-C5D1-5DE9-A7B1-5FC9C456B184" xml:space="preserve">//Create the URI
       
    31 _LIT8(KUri, “http://www.symbian.org”);
       
    32 
       
    33 //Create a RInetUri object
       
    34 RInetUri uriObject;
       
    35 
       
    36 //Now initialise the object with Uri properties. 
       
    37     uriObject.CreateL ( KUri, EWapPush, EBlackList);
       
    38     CleanupClosePushL(uriObject);
       
    39 
       
    40 //Now create the RInetUriList object
       
    41     RInetUriList uriListObj;
       
    42 
       
    43 //Create a server session
       
    44     uriListObj.OpenL();
       
    45     CleanupClosePushL(uriListObj);
       
    46 
       
    47 //Now add the Uri to list. 
       
    48     uriListObj.AddL(uriObject);
       
    49 
       
    50 //Pop and close the server session.
       
    51 CleanupStack::PopAndDestroy ( &amp;uriListObj);
       
    52 
       
    53 //Pop and free up memory of uri property object.
       
    54 CleanupStack::PopAndDestroy ( &amp;uriObject);
       
    55 </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
       
    56 a reference to an 8-bit descriptor only. By default, the permission attribute
       
    57 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
       
    58 be called to free up the memory. </p> </section>
       
    59 <section id="GUID-7FA78C8E-74A5-5FF8-99DF-11A6D9A04F83"><title>Removing a
       
    60 URI from the list</title> <p>The <xref href="GUID-6F5E2A42-5047-3AB2-9929-D893B88F2BD2.dita"><apiname>RInetUriList</apiname></xref> class provides
       
    61 the following API for removing a URI from the list: </p> <p> <codeph>void
       
    62 RemoveL(const RInetUri&amp;           aInetUri)</codeph> </p> <p>Where the <xref href="GUID-75AC6BC8-1D10-33FC-8BB2-98EEDF16BCB4.dita"><apiname>RInetUri</apiname></xref> parameter
       
    63 is the <codeph>Uri</codeph> property object. This object handle can be obtained
       
    64 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
       
    65 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”);
       
    66     RInetUri uriObject;
       
    67     RInetUriList uriListObj;
       
    68     uriListObj.OpenL();
       
    69     CleanupClosePushL(uriListObj);
       
    70 
       
    71     uriObject = uriListObj. OpenInetUriL(KUri, EBrowser);
       
    72     CleanupClosePushL(uriObject);
       
    73     uriListObj.RemoveL(uriObject);
       
    74 
       
    75 //Pop and close the server session.
       
    76 CleanupStack::PopAndDestroy ( &amp;uriListObj);
       
    77 
       
    78 //Pop and free up memory of uri property object.
       
    79 CleanupStack::PopAndDestroy ( &amp;uriObject);
       
    80 </codeblock> </section>
       
    81 <section id="GUID-202A44E4-3E28-5B84-8C8C-E1B1D094B9D5"><title>Updating a
       
    82 URI in the list</title> <p>The <xref href="GUID-6F5E2A42-5047-3AB2-9929-D893B88F2BD2.dita"><apiname>RInetUriList</apiname></xref> class provides
       
    83 the following API for updating properties of a URI in the list: </p> <p> <codeph>void
       
    84 UpdateL(const RInetUri&amp;           aInetUri)</codeph> </p> <p>Where the <xref href="GUID-75AC6BC8-1D10-33FC-8BB2-98EEDF16BCB4.dita"><apiname>RInetUri</apiname></xref> parameter
       
    85 is the <codeph>Uri</codeph> property object. This object handle can be obtained
       
    86 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
       
    87 and service type. Only <i>favourite name</i> and <i>list type</i> of a URI
       
    88 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”);
       
    89     _LIT8(KUriFavoritename “Home Page of Symbian”);
       
    90     RInetUri uriObject;
       
    91     RInetUriList uriListObj;
       
    92     uriListObj.OpenL();
       
    93     CleanupClosePushL(uriListObj);
       
    94 
       
    95     uriObject = uriListObj. OpenInetUriL(KUri, EBrowser);
       
    96     CleanupClosePushL(uriObject);
       
    97     uriObject.SetListType(EBlackList);
       
    98     uriObject.SetFavoriteNameL(KUriFavoritename);
       
    99     uriListObj.UpdateL(uriObject);
       
   100 
       
   101 //Pop and close the server session.
       
   102 CleanupStack::PopAndDestroy ( &amp;uriListObj);
       
   103 
       
   104 //Pop and free up memory of uri property object.
       
   105 CleanupStack::PopAndDestroy ( &amp;uriObject);
       
   106 </codeblock> </section>
       
   107 </conbody></concept>