|
1 /* |
|
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Contains CNcdSubscriptionGroupProxy class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_NCD_SUBSCRIPTION_GROUP_PROXY_H |
|
20 #define C_NCD_SUBSCRIPTION_GROUP_PROXY_H |
|
21 |
|
22 |
|
23 // For the streams |
|
24 #include <s32mem.h> |
|
25 #include <badesca.h> |
|
26 |
|
27 #include "ncdbaseproxy.h" |
|
28 |
|
29 class CNcdSubscriptionProxy; |
|
30 class CNcdOperationManagerProxy; |
|
31 class CNcdNodeManagerProxy; |
|
32 class CNcdNodeIdentifier; |
|
33 |
|
34 /** |
|
35 * This class implements the subscription group. |
|
36 * |
|
37 * @since S60 v3.2 |
|
38 */ |
|
39 class CNcdSubscriptionGroupProxy : public CNcdBaseProxy |
|
40 { |
|
41 |
|
42 public: |
|
43 |
|
44 /** |
|
45 * @param aSession The session between the client proxy and the |
|
46 * corresponding server object. |
|
47 * @param aHandle The handle which identifies the server object |
|
48 * that this proxy uses. |
|
49 * @param aOperationManager This class uses operation manager to get the |
|
50 * operations for certain tasks. |
|
51 * @param aNodeManager This class uses node manager to get certain |
|
52 * nodes. |
|
53 * @return CNcdSubscriptionGroupProxy* Pointer to the created object |
|
54 * of this class. |
|
55 */ |
|
56 static CNcdSubscriptionGroupProxy* NewL( |
|
57 MCatalogsClientServer& aSession, |
|
58 TInt aHandle, |
|
59 CNcdOperationManagerProxy& aOperationManager, |
|
60 CNcdNodeManagerProxy& aNodeManager ); |
|
61 |
|
62 /** |
|
63 * @param aSession The session between the client proxy and the |
|
64 * corresponding server object. |
|
65 * @param aHandle The handle which identifies the server object |
|
66 * that this proxy uses. |
|
67 * @param aOperationManager This class uses operation manager to get the |
|
68 * operations for certain tasks. |
|
69 * @param aNodeManager This class uses node manager to get certain |
|
70 * nodes. |
|
71 * @return CNcdSubscriptionGroupProxy* Pointer to the created object |
|
72 * of this class. |
|
73 */ |
|
74 static CNcdSubscriptionGroupProxy* NewLC( |
|
75 MCatalogsClientServer& aSession, |
|
76 TInt aHandle, |
|
77 CNcdOperationManagerProxy& aOperationManager, |
|
78 CNcdNodeManagerProxy& aNodeManager ); |
|
79 |
|
80 |
|
81 /** |
|
82 * Destructor. |
|
83 * The destructor is set public. So, the node that owns this object may |
|
84 * delete it directly when the reference count of the node reaches zero |
|
85 * and the destructor of the node is called. |
|
86 */ |
|
87 virtual ~CNcdSubscriptionGroupProxy(); |
|
88 |
|
89 |
|
90 /** |
|
91 * Gets the data for descriptors from the server side. This function is |
|
92 * called to update proxy data. The function uses the protected virtual |
|
93 * internalize functions. So, the child classes may provide their own |
|
94 * implementations for internalizations of certain metadata. |
|
95 */ |
|
96 void InternalizeL(); |
|
97 |
|
98 |
|
99 /** |
|
100 * Gets all subscriptions related to this subscriptiongroup. |
|
101 * No reference count changes are done to contents of returned |
|
102 * array before returning it. |
|
103 */ |
|
104 const RPointerArray<CNcdSubscriptionProxy>& Subscriptions(); |
|
105 |
|
106 /** |
|
107 * @return pointer to specified subscription if such a subscription |
|
108 * exists. (In other words if a subscription is made.) |
|
109 * NOTICE: Ownership is NOT transferred and reference |
|
110 * count is NOT incremented. |
|
111 */ |
|
112 CNcdSubscriptionProxy* Subscription( const TDesC& aPurchaseOptionId ); |
|
113 |
|
114 /** |
|
115 * Identifier of the meta data where from subscriptions of this |
|
116 * group have been bought from. |
|
117 * |
|
118 * @return Node identifier of the meta data. |
|
119 */ |
|
120 const CNcdNodeIdentifier& Identifier() const; |
|
121 |
|
122 /** |
|
123 * EntityId of the meta data where from subscriptions of this |
|
124 * group are bought from. |
|
125 */ |
|
126 const TDesC& EntityId() const; |
|
127 |
|
128 /** |
|
129 * Namespace of the meta data where from subscriptions of this |
|
130 * group are bought from. |
|
131 */ |
|
132 const TDesC& Namespace() const; |
|
133 |
|
134 /** |
|
135 * Server URI of the meta data where from subscriptions of this |
|
136 * group are bought from. |
|
137 */ |
|
138 const TDesC& ServerUri() const; |
|
139 |
|
140 /** |
|
141 * Icon of the meta data where from subscriptions of this |
|
142 * group are bought from. Notice that the ownership is |
|
143 * transferred. Uses RequestIconDataL function which retrieves the |
|
144 * icon from the server side. |
|
145 */ |
|
146 HBufC8* IconL() const; |
|
147 |
|
148 protected: |
|
149 |
|
150 /** |
|
151 * Constructor |
|
152 * |
|
153 * @param aSession The session between the client proxy and the |
|
154 * corresponding server object. |
|
155 * @param aHandle The handle which identifies the server object |
|
156 * that this proxy uses. |
|
157 * @param aOperationManager This class uses operation manager to get the |
|
158 * operations for certain tasks. |
|
159 * @param aNodeManager This class uses node manager to get certain |
|
160 * nodes. |
|
161 */ |
|
162 CNcdSubscriptionGroupProxy( |
|
163 MCatalogsClientServer& aSession, |
|
164 TInt aHandle, |
|
165 CNcdOperationManagerProxy& aOperationManager, |
|
166 CNcdNodeManagerProxy& aNodeManager ); |
|
167 |
|
168 /** |
|
169 * ConstructL |
|
170 */ |
|
171 virtual void ConstructL(); |
|
172 |
|
173 /** |
|
174 * @return CNcdOperationManagerProxy& Gives the operation manager proxy. |
|
175 * Operation manager may be asked to create new operations for this class |
|
176 * object. |
|
177 */ |
|
178 CNcdOperationManagerProxy& OperationManager() const; |
|
179 |
|
180 |
|
181 // These functions are used to update the data of this class object |
|
182 |
|
183 /** |
|
184 * @param aStream This stream will contain all the data content for |
|
185 * this class object. The stream is gotten from the server side. The |
|
186 * memeber variables will be updated according to the data from |
|
187 * the stream. |
|
188 */ |
|
189 virtual void InternalizeDataL( RReadStream& aStream ); |
|
190 |
|
191 |
|
192 private: |
|
193 |
|
194 // Prevent if not implemented |
|
195 CNcdSubscriptionGroupProxy( |
|
196 const CNcdSubscriptionGroupProxy& aObject ); |
|
197 CNcdSubscriptionGroupProxy& operator=( |
|
198 const CNcdSubscriptionGroupProxy& aObject ); |
|
199 |
|
200 /** |
|
201 * Function that goes through subscriptions-array and |
|
202 * calls internal release to each one of them. If |
|
203 * references are still left, it is the one's, that holds |
|
204 * the reference, duty to release it. |
|
205 * |
|
206 * @since S60 ?S60_version |
|
207 */ |
|
208 void DeleteSubscriptions(); |
|
209 |
|
210 /** |
|
211 * Request all the purchase option ids of the subscriptions |
|
212 * from server side and creates an array containing them. |
|
213 * |
|
214 * @return The array of purchase option ids. |
|
215 */ |
|
216 CDesCArray* RequestPurchaseOptionIdsL() const; |
|
217 |
|
218 /** |
|
219 * Deletes the subscriptions of which purchase option id |
|
220 * is not in the given descriptor array. |
|
221 * |
|
222 * @param aPurchaseOptionIds The purchase option ids. |
|
223 */ |
|
224 void DeleteMissingSubscriptions( |
|
225 const CDesCArray& aPurchaseOptionIds ); |
|
226 |
|
227 /** |
|
228 * Releases the given subscription. |
|
229 * |
|
230 * @param aSubscription The subscription. |
|
231 */ |
|
232 void DeleteSubscription( CNcdSubscriptionProxy* aSubscription ); |
|
233 |
|
234 /** |
|
235 * Internalizes the subscription group with the subscriptions of |
|
236 * which purchase option id is in the given array. |
|
237 * Those subscriptions must not exist in the proxy side yet. |
|
238 * |
|
239 * @param aPurchaseOptionIds The array of purchase option ids. |
|
240 */ |
|
241 void InternalizeL( |
|
242 const CDesCArray& aPurchaseOptionIds ); |
|
243 |
|
244 /** |
|
245 * Request the icon data of the subscriptions related to this |
|
246 * subscription group. |
|
247 * |
|
248 * @return The icon data descriptor. |
|
249 */ |
|
250 HBufC8* RequestIconDataL() const; |
|
251 |
|
252 private: // data |
|
253 |
|
254 CNcdOperationManagerProxy& iOperationManager; |
|
255 CNcdNodeManagerProxy& iNodeManager; |
|
256 |
|
257 |
|
258 RPointerArray<CNcdSubscriptionProxy> iSubscriptions; |
|
259 |
|
260 /** |
|
261 * NodeIdentifier to identify the node where from the |
|
262 * subscriptions within this group are bought from. |
|
263 * Own. |
|
264 */ |
|
265 CNcdNodeIdentifier* iOriginNodeIdentifier; |
|
266 |
|
267 }; |
|
268 |
|
269 |
|
270 #endif // C_NCD_SUBSCRIPTION_GROUP_PROXY_H |