|
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include <ineturilist.h> |
|
17 #include <ineturi.h> |
|
18 #include "ineturilistimpl.h" |
|
19 |
|
20 |
|
21 /** |
|
22 A default RInetUriList constructor. |
|
23 */ |
|
24 EXPORT_C RInetUriList::RInetUriList () |
|
25 : iInetUriListImpl ( NULL ) |
|
26 { |
|
27 |
|
28 } |
|
29 |
|
30 /** |
|
31 Opens a URI list object. The function connects to the URI list server. |
|
32 */ |
|
33 EXPORT_C void RInetUriList::OpenL () |
|
34 { |
|
35 if ( !iInetUriListImpl ) |
|
36 { |
|
37 // List is not opened so open it. |
|
38 iInetUriListImpl = CInetUriListImpl::NewL (); |
|
39 } |
|
40 } |
|
41 |
|
42 /** |
|
43 Closes the URI list object. |
|
44 */ |
|
45 EXPORT_C void RInetUriList::Close () |
|
46 { |
|
47 delete iInetUriListImpl; |
|
48 iInetUriListImpl = NULL; |
|
49 } |
|
50 |
|
51 /** |
|
52 Add a new URI object to the list and its associated storage. Requires WriteDeviceData capability. |
|
53 |
|
54 @param aInetUri URI object that needs to be added. |
|
55 @leave KErrPermissionDenied If the application is not having WriteDeviceData capabilities. |
|
56 |
|
57 @publishedPartner |
|
58 @released |
|
59 */ |
|
60 EXPORT_C void RInetUriList::AddL ( const RInetUri& aInetUri ) |
|
61 { |
|
62 // The handle must be open and attached to a concrete internet URI list object |
|
63 __ASSERT_ALWAYS( iInetUriListImpl, User::Panic( KInetUriListErrHandleNotOpen, KErrNotOpen ) ); |
|
64 |
|
65 iInetUriListImpl->AddL ( aInetUri ); |
|
66 } |
|
67 |
|
68 /** |
|
69 Removes a URI object from the list and its associated storage. Requires WriteDeviceData capabilities. |
|
70 |
|
71 @param aInetUri URI object that needs to be removed. |
|
72 @leave KErrPermissionDenied If the application is not having WriteDeviceData capabilities. |
|
73 @leave KErrUriReadOnly URI object is read-only and cannot be removed. |
|
74 |
|
75 @publishedPartner |
|
76 @released |
|
77 */ |
|
78 EXPORT_C void RInetUriList::RemoveL ( const RInetUri& aInetUri ) |
|
79 { |
|
80 // The handle must be open and attached to a concrete internet URI list object |
|
81 __ASSERT_ALWAYS( iInetUriListImpl, User::Panic( KInetUriListErrHandleNotOpen, KErrNotOpen ) ); |
|
82 iInetUriListImpl->RemoveL ( aInetUri ); |
|
83 } |
|
84 |
|
85 /** |
|
86 Updates the URI object properties. Only favourite name and list type can be modified. Requires WriteDeviceData |
|
87 capabilities. |
|
88 |
|
89 @param aInetUri URI object that needs to be updated |
|
90 @leave KErrPermissionDenied If the application is not having WriteDeviceData capabilities. |
|
91 @leave KErrUriReadOnly URI object is read-only and cannot be modified. |
|
92 |
|
93 @publishedPartner |
|
94 @released |
|
95 */ |
|
96 EXPORT_C void RInetUriList::UpdateL ( const RInetUri& aInetUri ) |
|
97 { |
|
98 // The handle must be open and attached to a concrete internet URI list object |
|
99 __ASSERT_ALWAYS( iInetUriListImpl, User::Panic( KInetUriListErrHandleNotOpen, KErrNotOpen ) ); |
|
100 iInetUriListImpl->UpdateL ( aInetUri ); |
|
101 } |
|
102 |
|
103 /** |
|
104 Opens a URI object, which can be used to idenitfy the properties associated with the URI. Removing or updating |
|
105 the URI from the list can be done with this object. Requires ReadDeviceData capabilities. |
|
106 |
|
107 @param aUri URI input descriptor for which the information need to be retrieved |
|
108 @param aServiceType Service type of the URI |
|
109 |
|
110 @return RInetUri type object |
|
111 |
|
112 @leave KErrPermissionDenied The application is not having ReadDeviceData capabilities. |
|
113 @leave KErrUriNotFound The URI is not present in the list for the specified service type. |
|
114 */ |
|
115 EXPORT_C RInetUri RInetUriList::OpenInetUriL ( const TDesC8& aUri, TServiceType aServiceType ) |
|
116 { |
|
117 // The handle must be open and attached to a concrete internet URI list object |
|
118 __ASSERT_ALWAYS( iInetUriListImpl, User::Panic( KInetUriListErrHandleNotOpen, KErrNotOpen ) ); |
|
119 return iInetUriListImpl->QueryUriL ( aUri, aServiceType ); |
|
120 } |
|
121 |
|
122 /** |
|
123 Returns the number of URIs present in the list based on the given service type and list type. Requires |
|
124 ReadDeviceData capabilities. |
|
125 |
|
126 @param aServiceType Service type (EBrowser, EWapPush, EPushEMail, EVoip and so on.) |
|
127 @param aListType List type (EWhiteList and EBlackList) |
|
128 |
|
129 @return Number of URIs present in the list. |
|
130 */ |
|
131 EXPORT_C TInt RInetUriList::Count ( TServiceType aServiceType, TListType aListType ) |
|
132 { |
|
133 // The handle must be open and attached to a concrete internet URI list object |
|
134 __ASSERT_ALWAYS( iInetUriListImpl, User::Panic( KInetUriListErrHandleNotOpen, KErrNotOpen ) ); |
|
135 return iInetUriListImpl->Count ( aServiceType, aListType ); |
|
136 } |
|
137 |
|
138 /** |
|
139 Retrieves the type associated with the URI by a given service type. Requires no capabilities. |
|
140 |
|
141 @param aUri URI descriptor for which list type need to be retrieved |
|
142 @param aServiceType The servicetype associated with the URI |
|
143 @param aListType Returns the list type of URI( EWhiteList or EBlackList ) |
|
144 |
|
145 @return KErrUriNotFound if the URI is not located in the list, otherwise returns KErrNone. |
|
146 */ |
|
147 EXPORT_C TInt RInetUriList::GetListType ( const TDesC8& aUri, TServiceType aServiceType,TListType& aListType ) |
|
148 { |
|
149 // The handle must be open and attached to a concrete internet URI list object |
|
150 __ASSERT_ALWAYS( iInetUriListImpl, User::Panic( KInetUriListErrHandleNotOpen, KErrNotOpen ) ); |
|
151 return iInetUriListImpl->GetListType ( aUri, aServiceType, aListType ); |
|
152 } |
|
153 |
|
154 /** |
|
155 Queries the URI on the list. Different options are available for query operation. See |
|
156 TQueryArgs. The service type needs to be set in the query arguments for all queries. If |
|
157 a URI is set and no match criteria is specified, function will take EExact match as the |
|
158 matching criteria. The application must implement the result's callback function to receive |
|
159 the query results. The results can be controlled in the callback function, that is, the |
|
160 application can stop receiving the query results by returning EFalse from the query callback. |
|
161 Application can also implement URI customisation callback if it wishes to do protocol/ |
|
162 scheme-based normalisation before query. |
|
163 |
|
164 @param aArgs Query arguments. |
|
165 @param aQueryCallback Callback function that will be called on each query result. |
|
166 @param aUriCustomiser URI customiser callback function to do protocol/scheme-based normalisation before query. |
|
167 |
|
168 @leave KErrServiceTypeNotPresent The service type is not specified in the query argument. |
|
169 */ |
|
170 EXPORT_C void RInetUriList::QueryUriL ( const TQueryArgs& aArgs, MQueryResultsCallback* aQueryCallback, MUriCustomiser* aUriCustomiser /* =NULL */ ) |
|
171 { |
|
172 // The handle must be open and attached to a concrete internet URI list object |
|
173 __ASSERT_ALWAYS( iInetUriListImpl, User::Panic( KInetUriListErrHandleNotOpen, KErrNotOpen ) ); |
|
174 iInetUriListImpl->QueryUriL ( aArgs, *aQueryCallback, aUriCustomiser ); |
|
175 } |
|
176 |
|
177 /** |
|
178 Queries on Uri either to fetch the TLD Policy data or get the List type of the given Uri. |
|
179 |
|
180 @param aArgs TPolicyQueryArgs argument. The Uri and Querytype are mandatory. |
|
181 To fetch Charset, List type is Mandatory, whereas to fetch List type it is not. |
|
182 @param aResultArgs is out parmeter contains either List type info or Charset info. Based on the QueryType. |
|
183 |
|
184 @leave KErrInvalidTLD The TLD type if No policy data is available for the given TLD. |
|
185 */ |
|
186 EXPORT_C void RInetUriList::QueryTldInfoL ( const TPolicyQueryArgs& aQueryArgs, TQueryResults& aResultArgs ) |
|
187 { |
|
188 // The handle must be open and attached to a concrete internet URI list object |
|
189 __ASSERT_ALWAYS( iInetUriListImpl, User::Panic( KInetUriListErrHandleNotOpen, KErrNotOpen ) ); |
|
190 iInetUriListImpl->QueryTldInfoL ( aQueryArgs, aResultArgs ); |
|
191 } |
|
192 |