|
1 /* |
|
2 * Copyright (c) 2007-2008 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: item presentation model |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef HNITEMMODEL_H_ |
|
20 #define HNITEMMODEL_H_ |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <e32hashtab.h> |
|
24 |
|
25 class CHnMenuItemModel; |
|
26 class MHnMenuItemModelIterator; |
|
27 class CHnActionModel; |
|
28 class CHnToolbarModel; |
|
29 class CHnEventHandler; |
|
30 class CHnAttributeBase; |
|
31 class CLiwGenericParamList; |
|
32 class CHnButtonModel; |
|
33 |
|
34 /** |
|
35 * Item flag. Used to indicate if item is move locked, |
|
36 * remove locked or runs. |
|
37 */ |
|
38 enum TItemFlag |
|
39 { |
|
40 EItemFlagDefault = 0, |
|
41 EItemFlagRemoveLocked = 1, |
|
42 EItemFlagMoveLocked = 2, |
|
43 EItemFlagRunning = 4, |
|
44 EItemFlagDrmExpired = 8 |
|
45 }; |
|
46 |
|
47 /** |
|
48 * Service item type. Type of the item in service. |
|
49 */ |
|
50 enum TMcsItemType |
|
51 { |
|
52 EItemTypeUnknown = 0, |
|
53 EItemTypeFolder, |
|
54 EItemTypeSuite, |
|
55 EItemTypeApplication, |
|
56 EItemTypeParentFolder, |
|
57 }; |
|
58 |
|
59 /** |
|
60 * Item presentation model class. |
|
61 * |
|
62 * Instance of this class represents item visible |
|
63 * on the screen. A single CHnMdItem may lead to |
|
64 * creation of multiple CHnItemModel instances. |
|
65 * |
|
66 * @see CHnMdItem |
|
67 * @lib hnpresentationmodel |
|
68 * @since S60 5.0 |
|
69 * @ingroup group_hnpresentationmodel |
|
70 */ |
|
71 NONSHARABLE_CLASS( CHnItemModel ) : public CBase |
|
72 { |
|
73 |
|
74 public: |
|
75 |
|
76 /** |
|
77 * Two-phased constructor. |
|
78 * |
|
79 * @since S60 5.0 |
|
80 * @return Fully constructed object. |
|
81 */ |
|
82 IMPORT_C static CHnItemModel* NewL(); |
|
83 |
|
84 /** |
|
85 * Virtual Destructor. |
|
86 * |
|
87 * @since S60 5.0 |
|
88 */ |
|
89 ~CHnItemModel(); |
|
90 |
|
91 /** |
|
92 * Sets menu item model. |
|
93 * |
|
94 * @since S60 5.0 |
|
95 * @param aMenu visual model for menu item, transfers ownership. |
|
96 */ |
|
97 IMPORT_C void SetMenuItemModel( CHnMenuItemModel* aMenu ); |
|
98 |
|
99 /** |
|
100 * Gets menu item model. |
|
101 * |
|
102 * @since S60 5.0 |
|
103 * @return menu item structure |
|
104 */ |
|
105 MHnMenuItemModelIterator* GetMenuStructure(); |
|
106 |
|
107 /** |
|
108 * Gets actions models. |
|
109 * |
|
110 * @param aId Event id |
|
111 * @return Array of actions models corresponding to event id |
|
112 */ |
|
113 IMPORT_C CArrayPtr<CHnActionModel>* GetActions( TInt aId ); |
|
114 |
|
115 /** |
|
116 * Gets actions models. |
|
117 * |
|
118 * @return List of all actions for every event. |
|
119 */ |
|
120 IMPORT_C RHashMap< TInt, CArrayPtr<CHnActionModel>* >& GetActions(); |
|
121 |
|
122 /** |
|
123 * Gets toolbar model. |
|
124 * |
|
125 * @since S60 5.0 |
|
126 * @return Toolbar model for item, NULL if not exist |
|
127 */ |
|
128 IMPORT_C const CHnToolbarModel* GetToolbarModel() const; |
|
129 |
|
130 /** |
|
131 * Sets toolbar model. |
|
132 * |
|
133 * @since S60 5.0 |
|
134 * @param aToolbar Toolbar model for item, transfers ownership |
|
135 */ |
|
136 IMPORT_C void SetToolbarModel( CHnToolbarModel* aToolbar ); |
|
137 |
|
138 /** |
|
139 * event handling |
|
140 * |
|
141 * @since S60 5.0 |
|
142 * @param aEventHandler An instance of event handler. |
|
143 * @param aEventId Event id. |
|
144 * @param aEventParameters Parameters of that event |
|
145 * @return Error code |
|
146 */ |
|
147 TInt OfferHnEventL( CHnEventHandler & aEventHandler, |
|
148 const TInt aEventId, CLiwGenericParamList* aEventParameters ); |
|
149 |
|
150 /** |
|
151 * Sets attribute. |
|
152 * |
|
153 * @since S60 5.0 |
|
154 * @param aAttr Attribute name |
|
155 */ |
|
156 IMPORT_C void SetAttributeL( CHnAttributeBase* aAttr ); |
|
157 |
|
158 /** |
|
159 * Gets attribute. |
|
160 * |
|
161 * @since S60 5.0 |
|
162 * @param aAttribute Attribute name. |
|
163 * @return Attribute instance. |
|
164 */ |
|
165 IMPORT_C CHnAttributeBase* GetAttribute( const TDesC8 & aAttribute ); |
|
166 |
|
167 /** |
|
168 * Clears attributes. |
|
169 * |
|
170 * @since S60 5.0 |
|
171 */ |
|
172 IMPORT_C void ClearAttributesL(); |
|
173 |
|
174 /** |
|
175 * Gets template name. |
|
176 * |
|
177 * @since S60 5.0 |
|
178 * @return Template name |
|
179 */ |
|
180 IMPORT_C const TDesC8& GetTemplate(); |
|
181 |
|
182 /** |
|
183 * Sets middle soft key. |
|
184 * |
|
185 * @since S60 5.0 |
|
186 * @param aMsk Msk model for item. |
|
187 */ |
|
188 IMPORT_C void SetMiddleSoftKey( CHnButtonModel* aMsk ); |
|
189 |
|
190 /** |
|
191 * Gets middle soft key. |
|
192 * |
|
193 * @since S60 5.0 |
|
194 * @return Msk model for item. |
|
195 */ |
|
196 IMPORT_C CHnButtonModel* GetMiddleSoftKey(); |
|
197 |
|
198 /** |
|
199 * Sets template. |
|
200 * |
|
201 * @since S60 5.0 |
|
202 * @param aTemplate Template name. |
|
203 */ |
|
204 IMPORT_C void SetTemplateL( const TDesC8& aTemplate ); |
|
205 |
|
206 /** |
|
207 * Sets item's flag. |
|
208 * |
|
209 * @since S60 5.0 |
|
210 * @param aFlag A flag to be set. |
|
211 */ |
|
212 IMPORT_C void SetFlag( TInt aFlag ); |
|
213 |
|
214 /** |
|
215 * Removes all flags of the item. |
|
216 * |
|
217 * @since S60 5.0 |
|
218 */ |
|
219 IMPORT_C void ClearFlags(); |
|
220 |
|
221 /** |
|
222 * Returns true if deleting the item is locked. |
|
223 * |
|
224 * @since S60 5.0 |
|
225 * @return True if deleting the item is forbidden, otherwise - false |
|
226 */ |
|
227 IMPORT_C TBool IsDeleteLocked(); |
|
228 |
|
229 /** |
|
230 * Returns true if moving the item is locked. |
|
231 * |
|
232 * @since S60 5.0 |
|
233 * @return True if moving the item is forbidden, otherwise - false |
|
234 */ |
|
235 IMPORT_C TBool IsMoveLocked(); |
|
236 |
|
237 /** |
|
238 * Returns true if the item is running. |
|
239 * |
|
240 * @since S60 5.0 |
|
241 * @return True if the item is running, otherwise - false. |
|
242 */ |
|
243 IMPORT_C TBool IsRunning(); |
|
244 |
|
245 /** |
|
246 * Returns true if the item drm rights are expired. |
|
247 * |
|
248 * @since S60 5.0 |
|
249 * @return True if the item drm rights are expired, otherwise - false. |
|
250 */ |
|
251 IMPORT_C TBool IsDrmExpired(); |
|
252 |
|
253 /** |
|
254 * Sets type of the item. |
|
255 * |
|
256 * @since S60 5.0 |
|
257 * @param aType type |
|
258 */ |
|
259 IMPORT_C void SetType( const TDesC8& aType ); |
|
260 |
|
261 /** |
|
262 * Sets custom id. |
|
263 * |
|
264 * @since S60 5.0 |
|
265 * @param aCustomId Custom id. |
|
266 */ |
|
267 IMPORT_C void SetCustomId( TInt64 aCustomId ); |
|
268 |
|
269 /** |
|
270 * Returns custom id. |
|
271 * |
|
272 * @since S60 5.0 |
|
273 * @return Custom id. |
|
274 */ |
|
275 IMPORT_C TInt64 CustomId(); |
|
276 |
|
277 /** |
|
278 * Returns the type of the item. |
|
279 * |
|
280 * @since S60 5.0 |
|
281 * @return Item type. |
|
282 */ |
|
283 IMPORT_C TMcsItemType GetItemType(); |
|
284 |
|
285 /** |
|
286 * Returns the uid of the item. |
|
287 * |
|
288 * @since S60 5.0 |
|
289 * @return Item uid. |
|
290 */ |
|
291 IMPORT_C TUid GetItemUid(); |
|
292 |
|
293 /** |
|
294 * Sets uid of the item. |
|
295 * |
|
296 * @since S60 5.0 |
|
297 * @param Item uid. |
|
298 */ |
|
299 IMPORT_C void SetItemUidL( const TDesC8& aUid ); |
|
300 |
|
301 /** |
|
302 * Deletes all action models. |
|
303 * |
|
304 * @since S60 5.0 |
|
305 */ |
|
306 IMPORT_C void DeleteAllActionModels(); |
|
307 |
|
308 /** |
|
309 * Removes all LIW objects owned by this object. |
|
310 * |
|
311 * LIW objects owned by non-LIW objects that are owned by |
|
312 * this object are also removed. |
|
313 * @since S60 5.0 |
|
314 */ |
|
315 void RemoveLiwObjects(); |
|
316 |
|
317 private: |
|
318 |
|
319 /** |
|
320 * Default constructor. |
|
321 */ |
|
322 CHnItemModel(); |
|
323 |
|
324 /** |
|
325 * Second phase constructor. |
|
326 */ |
|
327 void ConstructL(); |
|
328 |
|
329 private: // data |
|
330 |
|
331 /** |
|
332 * Template. |
|
333 */ |
|
334 RBuf8 iTemplate; |
|
335 |
|
336 /** |
|
337 * Menu item structure |
|
338 * Own |
|
339 */ |
|
340 CHnMenuItemModel* iMenuModel; |
|
341 |
|
342 /** |
|
343 * Model for toolbar |
|
344 * Own |
|
345 */ |
|
346 CHnToolbarModel* iToolbarModel; |
|
347 |
|
348 /** |
|
349 * Actions corresponding to events |
|
350 * event id <=> array of actions models |
|
351 */ |
|
352 RHashMap< TInt, CArrayPtr<CHnActionModel>* > iActions; |
|
353 |
|
354 /** |
|
355 * Visual item model (Aakash) |
|
356 */ |
|
357 TBool iEditable; |
|
358 |
|
359 /** |
|
360 * Attributes. |
|
361 */ |
|
362 RPointerArray<CHnAttributeBase> iAttrs; |
|
363 |
|
364 /** |
|
365 * Flags. |
|
366 */ |
|
367 TInt iFlags; |
|
368 |
|
369 /** |
|
370 * Type of an item. |
|
371 */ |
|
372 TMcsItemType iType; |
|
373 |
|
374 /** |
|
375 * Uid of the item. |
|
376 */ |
|
377 TUid iUid; |
|
378 |
|
379 /** |
|
380 * Custom Id. |
|
381 */ |
|
382 TInt64 iCustomId; |
|
383 |
|
384 /** |
|
385 * Middel soft key model |
|
386 * Own |
|
387 */ |
|
388 CHnButtonModel* iMskModel; |
|
389 |
|
390 }; |
|
391 |
|
392 #endif // HNITEMMODEL_H_ |