|
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 CNcdNodeIcon class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef NCD_NODE_ICON_IMPL_H |
|
20 #define NCD_NODE_ICON_IMPL_H |
|
21 |
|
22 |
|
23 // For streams |
|
24 #include <s32mem.h> |
|
25 |
|
26 #include "ncdcommunicable.h" |
|
27 #include "ncdstoragedataitem.h" |
|
28 #include "ncdnodeclassids.h" |
|
29 |
|
30 |
|
31 class MNcdPreminetProtocolDataEntity; |
|
32 class CNcdNodeManager; |
|
33 class CNcdNodeMetaData; |
|
34 |
|
35 |
|
36 /** |
|
37 * This server side class contains the data and the functionality |
|
38 * that the proxy objects will use to internalize itself. |
|
39 * |
|
40 * This object should be added to the session. So, it will be usable |
|
41 * in the proxy side by using the handle gotten during addition. |
|
42 * The handle is used to identify to what object the proxy directs |
|
43 * the function call. When objects are added to sessions, |
|
44 * multiple handles may be gotten for the same object if addition is |
|
45 * done multiple times. |
|
46 * |
|
47 * @lib ?library |
|
48 * @since S60 v3.2 |
|
49 */ |
|
50 class CNcdNodeIcon : public CNcdCommunicable, |
|
51 public MNcdStorageDataItem |
|
52 { |
|
53 |
|
54 public: |
|
55 |
|
56 /** |
|
57 * NewL |
|
58 * |
|
59 * @return CNcdNodeIcon* Pointer to the created object |
|
60 * of this class. |
|
61 */ |
|
62 static CNcdNodeIcon* NewL( |
|
63 CNcdNodeManager& aNodeManager, |
|
64 const CNcdNodeMetaData& aParentMetaData, |
|
65 TBool aUsePurchaseDetailsIcon = EFalse ); |
|
66 |
|
67 /** |
|
68 * NewLC |
|
69 * |
|
70 * @return CNcdNodeIcon* Pointer to the created object |
|
71 * of this class. |
|
72 */ |
|
73 static CNcdNodeIcon* NewLC( |
|
74 CNcdNodeManager& aNodeManager, |
|
75 const CNcdNodeMetaData& aParentMetaData, |
|
76 TBool aUsePurchaseDetailsIcon = EFalse ); |
|
77 |
|
78 |
|
79 /** |
|
80 * Destructor |
|
81 * |
|
82 * @note Because this is CCatalogsCommunicable function the |
|
83 * session that owns this object should delete this class object. |
|
84 * So, instead of directly deleting this object from some other |
|
85 * class. Close-method should be used instead. |
|
86 */ |
|
87 virtual ~CNcdNodeIcon(); |
|
88 |
|
89 |
|
90 /** |
|
91 * Retrieves the data type that informs what class the data is for. |
|
92 * By checking the data type information, an InternalizeL function |
|
93 * of a right class can be called when the object data is set |
|
94 * from the storage. |
|
95 * The data type may be decided and set in a object that creates this |
|
96 * class object. |
|
97 * |
|
98 * @return NcdNodeClassIds::TNcdNodeClassId Describes the data type. |
|
99 */ |
|
100 NcdNodeClassIds::TNcdNodeClassId ClassId() const; |
|
101 |
|
102 |
|
103 /** |
|
104 * This function is called when the owner of this object |
|
105 * wants to internalize the content according to the data |
|
106 * that has been received from the parser. |
|
107 * |
|
108 * @param aData The data is set in the protocol parser and can |
|
109 * be used to initialize this class object. |
|
110 */ |
|
111 void InternalizeL( MNcdPreminetProtocolDataEntity& aData ); |
|
112 |
|
113 |
|
114 public: // MNcdStorageDataItem |
|
115 |
|
116 // These functions are used to get the data from and to insert the data |
|
117 // into the database using by the given stream. |
|
118 |
|
119 /** |
|
120 * @see MNcdStorageDataItem::ExternalizeL |
|
121 */ |
|
122 virtual void ExternalizeL( RWriteStream& aStream ); |
|
123 |
|
124 |
|
125 /** |
|
126 * @see MNcdStorageDataItem::InternalizeL |
|
127 */ |
|
128 virtual void InternalizeL( RReadStream& aStream ); |
|
129 |
|
130 |
|
131 public: // CCatalogsCommunicable |
|
132 |
|
133 /** |
|
134 * @see CCatalogsCommunicable::ReceiveMessage |
|
135 */ |
|
136 virtual void ReceiveMessage( MCatalogsBaseMessage* aMessage, |
|
137 TInt aFunctionNumber ); |
|
138 |
|
139 /** |
|
140 * @see CCatalogsCommunicable::CounterPartLost |
|
141 */ |
|
142 virtual void CounterPartLost( const MCatalogsSession& aSession ); |
|
143 |
|
144 |
|
145 public: |
|
146 |
|
147 /** |
|
148 * Get icon data block. |
|
149 * |
|
150 * @return Data block. |
|
151 */ |
|
152 const TDesC& DataBlock() const; |
|
153 |
|
154 /** |
|
155 * Get icon ID. |
|
156 * |
|
157 * @return Icon ID. |
|
158 */ |
|
159 const TDesC& IconId() const; |
|
160 |
|
161 /** |
|
162 * Set the icon ID. |
|
163 * |
|
164 * @param aIconId The icon id. |
|
165 */ |
|
166 void SetIconIdL( const TDesC& aIconId ); |
|
167 |
|
168 /** |
|
169 * Get icon URI. |
|
170 * |
|
171 * @return Icon URI. |
|
172 */ |
|
173 const TDesC& Uri() const; |
|
174 |
|
175 /** |
|
176 * Set icon URI. |
|
177 * |
|
178 * @param aUri The URI. |
|
179 */ |
|
180 void SetUriL( const TDesC& aUri ); |
|
181 |
|
182 /** |
|
183 * Get icon data. |
|
184 * |
|
185 * @return Icon data. |
|
186 */ |
|
187 HBufC8* IconDataL() const; |
|
188 |
|
189 /** |
|
190 * Tells whether the icon data is ready. |
|
191 * |
|
192 * @return True if ready, otherwise false. |
|
193 */ |
|
194 TBool IconDataReady() const; |
|
195 |
|
196 /** |
|
197 * Set the icon data ready flag. |
|
198 * |
|
199 * @param aValue True if ready, false otherwise. |
|
200 */ |
|
201 void SetIconDataReady( TBool aValue ); |
|
202 |
|
203 protected: |
|
204 |
|
205 /** |
|
206 * Constructor |
|
207 * @param aClassId Identifies this class. |
|
208 * Is set in the NewLC function |
|
209 */ |
|
210 CNcdNodeIcon( |
|
211 NcdNodeClassIds::TNcdNodeClassId aClassId, |
|
212 CNcdNodeManager& aNodeManager, |
|
213 const CNcdNodeMetaData& aParentMetaData, |
|
214 TBool aUsePurchaseDetailsIcon ); |
|
215 |
|
216 /** |
|
217 * ConstructL |
|
218 */ |
|
219 virtual void ConstructL(); |
|
220 |
|
221 |
|
222 // These functions are called from the ReceiveMessage when |
|
223 // the given function id has matched to the function. |
|
224 |
|
225 /** |
|
226 * This function is called when the proxy wants to get the |
|
227 * data from the serverside. This function calls the |
|
228 * InternalizeDataForRequestL which may be overloaded in the |
|
229 * child classes. |
|
230 * @param aMessage Contains data from the proxy and can be used |
|
231 * to send data back to proxy |
|
232 */ |
|
233 void InternalizeRequestL( MCatalogsBaseMessage& aMessage ) const; |
|
234 |
|
235 /** |
|
236 * This function writes the object data to the stream. |
|
237 * The stream content will be sent to the proxy that requested the data. |
|
238 * Child classes should add their own data after this parent data. |
|
239 * @param aStream The data content of this class object will be written |
|
240 * into this stream. |
|
241 */ |
|
242 virtual void ExternalizeDataForRequestL( RWriteStream& aStream ) const; |
|
243 |
|
244 /** |
|
245 * This function is called when the proxy wants to get the |
|
246 * icon data from the serverside. |
|
247 * @param aMessage Can be used to send data back to proxy. |
|
248 */ |
|
249 void IconDataRequestL( MCatalogsBaseMessage& aMessage ) const; |
|
250 |
|
251 /** |
|
252 * This function is called from the proxy side. When the proxy |
|
253 * is deleted. |
|
254 * @param aMessage Contains data from the proxy and can be used |
|
255 * to send data back to proxy |
|
256 */ |
|
257 void ReleaseRequest( MCatalogsBaseMessage& aMessage ) const; |
|
258 |
|
259 |
|
260 private: |
|
261 |
|
262 // Prevent these two if they are not implemented |
|
263 CNcdNodeIcon( const CNcdNodeIcon& aObject ); |
|
264 CNcdNodeIcon& operator =( const CNcdNodeIcon& aObject ); |
|
265 |
|
266 |
|
267 private: // data |
|
268 |
|
269 // Node manager. |
|
270 CNcdNodeManager& iNodeManager; |
|
271 |
|
272 // Parent meta data. |
|
273 const CNcdNodeMetaData& iParentMetaData; |
|
274 |
|
275 // The class id identifies this class. The id may be used to identify |
|
276 // what kind of class object is created when data is gotten from the db. |
|
277 NcdNodeClassIds::TNcdNodeClassId iClassId; |
|
278 |
|
279 // The message is set when ReceiveMessage is called. The message |
|
280 // is used in the CounterPartLost-function that informs the message |
|
281 // if the session has been lost. |
|
282 MCatalogsBaseMessage* iMessage; |
|
283 |
|
284 // Icon data |
|
285 HBufC* iDataBlock; |
|
286 HBufC* iIconId; |
|
287 HBufC* iUri; |
|
288 |
|
289 // Tells whether the icon data is ready. |
|
290 TBool iIconDataReady; |
|
291 |
|
292 // If set then icon data is retrieved from purchase details. |
|
293 TBool iUsePurchaseDetailsIcon; |
|
294 |
|
295 }; |
|
296 |
|
297 #endif // NCD_NODE_ICON_IMPL_H |