|
1 /* |
|
2 * Copyright (c) 2003-2009 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: Declares container control for details view |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef DRMRIGHTSMGRDETAILSCONTAINER_H |
|
20 #define DRMRIGHTSMGRDETAILSCONTAINER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <coecntrl.h> |
|
24 #include <eiklbo.h> |
|
25 #include <eiktxlbx.h> |
|
26 |
|
27 #include <aknnavide.h> |
|
28 #include <eikspane.h> |
|
29 #include <aknappui.h> |
|
30 |
|
31 // caf |
|
32 #include <caf/caf.h> |
|
33 #include <caf/caftypes.h> |
|
34 #include <caf/rightsinfo.h> |
|
35 |
|
36 #include "drmrightsmgrdetailscontainer.h" |
|
37 |
|
38 // FORWARD DECLARATIONS |
|
39 class CDRMRightsConstraints; |
|
40 |
|
41 /** |
|
42 * Status of the RO |
|
43 */ |
|
44 enum TDRMUIRightsStatus |
|
45 { |
|
46 EDRMUIStatusInvalid, // RO is invalid |
|
47 EDRMUIStatusValid, // RO is valid |
|
48 EDRMUIStatusFuture, // RO has future rights |
|
49 EDRMUIStatusExpired // RO expired |
|
50 }; |
|
51 |
|
52 |
|
53 // STRUCT DEFINITIONS |
|
54 |
|
55 /** |
|
56 * Data about a certain RightsObject |
|
57 */ |
|
58 struct TRights |
|
59 { |
|
60 // Status of the RO |
|
61 TDRMUIRightsStatus iStatus; |
|
62 |
|
63 // Play constraints |
|
64 CDRMRightsConstraints* iPlayConstraint; |
|
65 |
|
66 // Display constraints |
|
67 CDRMRightsConstraints* iDisplayConstraint; |
|
68 |
|
69 // Print constraints |
|
70 CDRMRightsConstraints* iPrintConstraint; |
|
71 |
|
72 // Execute constraints |
|
73 CDRMRightsConstraints* iExecuteConstraint; |
|
74 }; |
|
75 |
|
76 /** |
|
77 * Data about a certain Content |
|
78 */ |
|
79 struct TDetails |
|
80 { |
|
81 // Array containing data about related rights |
|
82 CArrayFixFlat<TRights>* iRights; |
|
83 |
|
84 // The index in the array of the active RO |
|
85 TInt iActiveROindex; |
|
86 |
|
87 // ETrue if the object can be sent |
|
88 TBool iContentCanBeSent; |
|
89 |
|
90 // Location of the content |
|
91 TFileName iContentPath; |
|
92 |
|
93 // ETrue if Individual constraint exists |
|
94 TBool iIndividualConstraint; |
|
95 |
|
96 // ETrue if content can be used with current SIM |
|
97 TBool iUsageAllowed; |
|
98 |
|
99 // The DRM protection of the given file. |
|
100 TInt iDrmScheme; |
|
101 |
|
102 }; |
|
103 |
|
104 |
|
105 // CLASS DECLARATION |
|
106 |
|
107 /** |
|
108 * CDRMRightsMgrDetailsContainer |
|
109 * container control class. |
|
110 */ |
|
111 class CDRMRightsMgrDetailsContainer : public CCoeControl, |
|
112 public MEikListBoxObserver, |
|
113 private MCoeControlObserver |
|
114 |
|
115 { |
|
116 public: // Constructors and destructor |
|
117 /** |
|
118 * C++ constructor. |
|
119 * @param aDetails The details to be displayed |
|
120 * @param aStartEmbedded ETrue if it has to display details when DRMUI |
|
121 * was started embedded. |
|
122 */ |
|
123 CDRMRightsMgrDetailsContainer( TDetails& aDetails, |
|
124 TBool aStartEmbedded ); |
|
125 |
|
126 /** |
|
127 * Symbian default constructor. |
|
128 * const TRect& aRect Frame rectangle for container. |
|
129 */ |
|
130 void ConstructL( const TRect& aRect ); |
|
131 |
|
132 /** |
|
133 * Destructor. |
|
134 */ |
|
135 ~CDRMRightsMgrDetailsContainer(); |
|
136 |
|
137 protected: // Functions from base classes |
|
138 /** |
|
139 * Handle resource change events. |
|
140 * @param aType: The type of resources that have changed |
|
141 */ |
|
142 void HandleResourceChange( TInt aType ); |
|
143 |
|
144 /** |
|
145 * From CoeControl. Responds to size changes to sets the size and |
|
146 * position of the contents of this control. |
|
147 */ |
|
148 void SizeChanged(); |
|
149 |
|
150 /** |
|
151 * Handle key events. |
|
152 * @param aKeyEvent: key event |
|
153 * @param aType: type of event |
|
154 * @return The key response, if it was consumed or not. |
|
155 */ |
|
156 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, |
|
157 TEventCode aType ); |
|
158 |
|
159 /** |
|
160 * From CoeControl. Responds to focus changes. |
|
161 */ |
|
162 void FocusChanged(TDrawNow aDrawNow); |
|
163 |
|
164 private: // Functions from base classes |
|
165 |
|
166 /** |
|
167 * From CoeControl. Gets the number of controls contained in a compound |
|
168 * control. |
|
169 * @return The number of component controls contained. |
|
170 */ |
|
171 TInt CountComponentControls() const; |
|
172 |
|
173 /** |
|
174 * From CCoeControl. Gets the specified component of a compound control. |
|
175 * @param The index of the control to get |
|
176 * @return The component control with an index of aIndex |
|
177 */ |
|
178 CCoeControl* ComponentControl( TInt aIndex ) const; |
|
179 |
|
180 /** |
|
181 * From CCoeControl. Draw controls |
|
182 * @param aRect The region of the control to be redrawn. |
|
183 */ |
|
184 void Draw( const TRect& aRect ) const; |
|
185 |
|
186 /** |
|
187 * Event handling section |
|
188 * @param aControl The control that sent the event |
|
189 * @param aEventType The event type |
|
190 */ |
|
191 virtual void HandleControlEventL( CCoeControl* aControl, |
|
192 TCoeEvent aEventType ); |
|
193 |
|
194 public: // New functions |
|
195 /** |
|
196 * Updates scrollbar in order to draw correct scroll bar. |
|
197 */ |
|
198 void SetScrollBarL(); |
|
199 |
|
200 /** |
|
201 * Updates content of the listbox. |
|
202 * @param aDetails The details to be displayed |
|
203 */ |
|
204 void UpdateListBoxContentL( TDetails& aDetails ); |
|
205 |
|
206 |
|
207 private: // New functions |
|
208 /** |
|
209 * Constructs listbox and initializes its sub-folders |
|
210 * @param aResLbxId resource ID of the listbox item array |
|
211 */ |
|
212 void ConstructListBoxL(); |
|
213 |
|
214 /** |
|
215 * Appending icons from resource file |
|
216 */ |
|
217 virtual void SetIconsL(); |
|
218 |
|
219 /** Handles listbox event. |
|
220 * @param aListBox The originating list box |
|
221 * @param aEventType Type of event to be handled. |
|
222 */ |
|
223 void HandleListBoxEventL( CEikListBox* aListBox, |
|
224 TListBoxEvent aEventType ); |
|
225 |
|
226 /** |
|
227 * Add Rights details line(s) in listbox. |
|
228 * @param aNumberOfKey The index of the key to be processed |
|
229 * @param aDetails The details to be displayed |
|
230 * @param aItems Array where the listbox items have to be added |
|
231 */ |
|
232 void AddRightsDetailsL( TInt aNumberOfKey, TDetails& aDetails, |
|
233 CDesCArray* aItems ); |
|
234 /** |
|
235 * Add Status line in listbox. |
|
236 * @param aStatus Status of the key that is processed |
|
237 * @param aItems Array where the listbox items have to be added |
|
238 */ |
|
239 void AddStatusLineL( TDRMUIRightsStatus aStatus, CDesCArray* aItems ); |
|
240 |
|
241 /** |
|
242 * Add Content Sending line in listbox. |
|
243 * @param aContentCanBeSent ETrue if content can be sent |
|
244 * @param aItems Array where the listbox items have to be added |
|
245 */ |
|
246 void AddContentSendingLineL( TBool aContentCanBeSent, |
|
247 CDesCArray* aItems ); |
|
248 |
|
249 /** |
|
250 * Add Content use line in listbox. |
|
251 * @param aUsageAllowed ETrue if content can be used with this SIM |
|
252 * @param aItems Array where the listbox items have to be added |
|
253 */ |
|
254 void AddContentUseLineL( TBool aUsageAllowed, |
|
255 CDesCArray* aItems ); |
|
256 |
|
257 /** |
|
258 * Add Rights line in listbox. |
|
259 * @param aResourceId Resource Id of the type of right |
|
260 * @param aConstraint Constraint to be parsed |
|
261 * @param aItems Array where the listbox items have to be added |
|
262 * @param aIsWmDrm Whether WM DRM or OMA DRM file is concerned |
|
263 * @param aIntent The usage intent of the file, possible values |
|
264 ContentAccess:EPlay, ContentAccess:EView, |
|
265 ContentAccess:EExecute and ContentAccess:EPrint |
|
266 */ |
|
267 void AddRightsLineL( CDRMRightsConstraints* aConstraint, |
|
268 CDesCArray* aItems, |
|
269 const TBool aIsWmDrm, |
|
270 const TUint32& aIntent ); |
|
271 |
|
272 /** |
|
273 * Split time in single elements |
|
274 * @param aInterval Time interval to be split |
|
275 * @param aIntYrs Contains in output the number of years |
|
276 * @param aIntMon Contains in output the number of months |
|
277 * @param aIntDay Contains in output the number of days |
|
278 * @param aIntHrs Contains in output the number of hours |
|
279 * @param aIntMin Contains in output the number of minutes |
|
280 * @param aIntSec Contains in output the number of seconds |
|
281 */ |
|
282 void SplitTime( const TTimeIntervalSeconds& aInterval, |
|
283 TInt& aIntYrs, TInt& aIntMon, TInt& aIntDay, |
|
284 TInt& aIntHrs, TInt& aIntMin, TInt& aIntSec ); |
|
285 |
|
286 /** |
|
287 * Add elements of time to the string |
|
288 * @param aIntYrs Number of years |
|
289 * @param aIntMon Number of months |
|
290 * @param aIntDay Number of days |
|
291 * @param aIntHrs Number of hours |
|
292 * @param aIntMin Number of minutes |
|
293 * @param aIntSec Number of seconds |
|
294 * @return Buffer where the parts have to be written |
|
295 */ |
|
296 HBufC* AddPartsOfTimeL( TInt aIntYrs, TInt aIntMon, TInt aIntDay, |
|
297 TInt aIntHrs, TInt aIntMin, TInt aIntSec ); |
|
298 |
|
299 /** |
|
300 * Add a single element of time to the string array |
|
301 * @param aNumOfElements Number of elements of the interval |
|
302 * @param aResourceIdSingle Resource id to be used in case of |
|
303 * single unit |
|
304 * @param aResourceIdOneFinal Resource id to be used in case of |
|
305 * units ending with 1, from 21 |
|
306 * (requested by Slavic languages) |
|
307 * @param aResourceIdTwoFour Resource id to be used in case of |
|
308 * units included from two to four, except |
|
309 * 12-14 (requested by Slavic languages) |
|
310 * @param aResourceIdFiveZero Resource id to be used in case of |
|
311 * units ending from 5 to 9, plus range |
|
312 * from 11 to 14 (requested by Slavic |
|
313 * languages) |
|
314 * @param aStrings Array of strings where to add the |
|
315 * element |
|
316 */ |
|
317 void AddSinglePartOfTimeL( TInt aNumOfElements, |
|
318 TInt aResourceIdSingle, |
|
319 TInt aResourceIdOneFinal, |
|
320 TInt aResourceIdTwoFour, |
|
321 TInt aResourceIdFiveZero, |
|
322 CDesCArrayFlat* aStrings ); |
|
323 |
|
324 /** |
|
325 * Add File location line in listbox. |
|
326 * @param aContent Array containing paths of related MOs |
|
327 * @param aItems Array where the listbox items have to be added |
|
328 */ |
|
329 void AddLocationLineL( const TDesC& aContentPath, |
|
330 CDesCArray* aItems ); |
|
331 |
|
332 /** |
|
333 * Add "Usage rights" line |
|
334 * @param aItems Array where the listbox items have to be added |
|
335 * @param aTypeOfRights String reporting the type of rights |
|
336 ContentAccess:EPlay, ContentAccess:EView, |
|
337 ContentAccess:EExecute and ContentAccess:EPrint |
|
338 */ |
|
339 void AddUsageRightsL( CDesCArray* aItems, |
|
340 const TUint32& aIntent ); |
|
341 |
|
342 /** |
|
343 * Add "Usage times left" line |
|
344 * @param aCounter Number of times |
|
345 * @param aItems Array where the listbox items have to be added |
|
346 * @param aTypeOfRights String reporting the type of rights |
|
347 ContentAccess:EPlay, ContentAccess:EView, |
|
348 ContentAccess:EExecute and ContentAccess:EPrint |
|
349 */ |
|
350 void AddUsageTimesLeftL( TUint32 aCounter, CDesCArray* aItems, |
|
351 const TUint32& aIntent ); |
|
352 |
|
353 /** |
|
354 * Add "Rights valid from" line |
|
355 * @param aStartDateTime Start Datetime |
|
356 * @param aItems Array where the listbox items have to be added |
|
357 * @param aTypeOfRights String reporting the type of rights |
|
358 ContentAccess:EPlay, ContentAccess:EView, |
|
359 ContentAccess:EExecute and ContentAccess:EPrint |
|
360 */ |
|
361 void AddRightsValidFromL( const TTime& aStartDateTime, |
|
362 CDesCArray* aItems, |
|
363 const TUint32& aIntent ); |
|
364 |
|
365 /** |
|
366 * Add "Rights valid until" line |
|
367 * @param aEndDateTime Expiring Datetime |
|
368 * @param aItems Array where the listbox items have to be added |
|
369 * @param aTypeOfRights String reporting the type of rights |
|
370 ContentAccess:EPlay, ContentAccess:EView, |
|
371 ContentAccess:EExecute and ContentAccess:EPrint |
|
372 */ |
|
373 void AddRightsValidUntilL( const TTime& aEndDateTime, |
|
374 CDesCArray* aItems, |
|
375 const TUint32& aIntent ); |
|
376 |
|
377 /** |
|
378 * Add "Usage time left" line |
|
379 * @param aInterval Interval of usage time left |
|
380 * @param aItems Array where the listbox items have to be added |
|
381 * @param aIsAccumulatedTime ETrue if the line is for accumulated time |
|
382 |
|
383 ContentAccess:EPlay, ContentAccess:EView, |
|
384 ContentAccess:EExecute and ContentAccess:EPrint |
|
385 */ |
|
386 void AddUsageTimeLeftL( const TTimeIntervalSeconds& aInterval, |
|
387 CDesCArray* aItems, |
|
388 const TBool aIsAccumulatedTime, |
|
389 const TUint32& aIntent ); |
|
390 |
|
391 private: //data |
|
392 // The details to be displayed |
|
393 TDetails iDetails; |
|
394 |
|
395 // Tells if it has to display details when DRMUI was started embedded. |
|
396 TBool iStartEmbedded; |
|
397 |
|
398 //pointer to newly created list box. |
|
399 CEikTextListBox* iListBox; |
|
400 |
|
401 }; |
|
402 |
|
403 #endif |
|
404 |
|
405 // End of File |