|
1 /* |
|
2 * Copyright (c) 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 /*glxmlwrapper_p.cpp*/ |
|
19 //external includes |
|
20 #include <hbicon.h> |
|
21 #include <glxtracer.h> |
|
22 #include <mglxmedialist.h> |
|
23 #include <glxlog.h> |
|
24 #include <glxthumbnailcontext.h> |
|
25 #include <glxattributecontext.h> |
|
26 #include <glxuistd.h> |
|
27 #include <glxcollectionpluginall.hrh> |
|
28 #include <glxcollectionpluginalbums.hrh> |
|
29 #include <glxcollectiongeneraldefs.h> |
|
30 #include <glxthumbnailattributeinfo.h> |
|
31 #include <glxfilterfactory.h> |
|
32 #include <glxmedia.h> |
|
33 #include <glxerrormanager.h> |
|
34 #include <glxattributecontext.h> |
|
35 #include <glxuistd.h> |
|
36 #include <glxlistdefs.h> |
|
37 #include <glxmediaid.h> |
|
38 #include <caf/caferr.h> |
|
39 //internal includes |
|
40 #include "glxmlwrapper_p.h" |
|
41 #include "glxmlgenericobserver.h" |
|
42 #include "glxattributeretriever.h" |
|
43 #include "glxicondefs.h" //Contains the icon names/Ids |
|
44 #include "glxerrors.h" |
|
45 |
|
46 //#define GLXPERFORMANCE_LOG |
|
47 #include <glxperformancemacro.h> |
|
48 #include "glxtitlefetcher.h" |
|
49 #include"glxdrmutility.h" |
|
50 |
|
51 //constant declaration |
|
52 const TInt KTBAttributeAvailable(1); |
|
53 const TInt KTBAttributeUnavailable(0); |
|
54 const TInt KTBAttributeCorrupt(-1); |
|
55 const TInt KListDataWindowSize(10); |
|
56 const TInt KGridTNWIdth (127); |
|
57 const TInt KGridTNHeight (110); |
|
58 const TInt KGridTNPTWIdth (119); |
|
59 const TInt KGridTNPTHeight (103); |
|
60 const TInt KFullScreenTNLSWidth (640); |
|
61 const TInt KFullScreenTNLSHeight (360); |
|
62 const TInt KFullScreenTNPTWidth (360); |
|
63 const TInt KFullScreenTNPTHeight (640); |
|
64 |
|
65 // ======== MEMBER FUNCTIONS ======== |
|
66 |
|
67 // --------------------------------------------------------------------------- |
|
68 // Two-phased constructor. |
|
69 // --------------------------------------------------------------------------- |
|
70 // |
|
71 GlxMLWrapperPrivate* GlxMLWrapperPrivate::Instance(GlxMLWrapper* aMLWrapper, |
|
72 int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType,QString uri) |
|
73 { |
|
74 TRACER("GlxMLWrapperPrivate::NewLC()"); |
|
75 |
|
76 GlxMLWrapperPrivate* self = new GlxMLWrapperPrivate(aMLWrapper); |
|
77 if(self){ |
|
78 TRAPD(err,self->ConstructL(aCollectionId, aHierarchyId, aFilterType,uri)); |
|
79 if(err != KErrNone){ |
|
80 delete self; |
|
81 self = NULL; |
|
82 } |
|
83 } |
|
84 |
|
85 return self; |
|
86 } |
|
87 // --------------------------------------------------------------------------- |
|
88 // C++ default constructor can NOT contain any code, that |
|
89 // might leave. |
|
90 // --------------------------------------------------------------------------- |
|
91 // |
|
92 GlxMLWrapperPrivate::GlxMLWrapperPrivate(GlxMLWrapper* aMLWrapper) |
|
93 : iMLWrapper(aMLWrapper), |
|
94 iGridContextActivated(EFalse), |
|
95 iLsFsContextActivated(EFalse), |
|
96 iPtFsContextActivated(EFalse), |
|
97 iPtListContextActivated(EFalse), |
|
98 iDetailsContextActivated(EFalse), |
|
99 iSelectionListContextActivated(EFalse) |
|
100 { |
|
101 TRACER("GlxMLWrapperPrivate::GlxMLWrapperPrivate"); |
|
102 iGridThumbnailContext = NULL; |
|
103 iPtFsThumbnailContext = NULL; |
|
104 iLsFsThumbnailContext = NULL; |
|
105 iTitleAttributeContext = NULL; |
|
106 iSubtitleAttributeContext = NULL; |
|
107 iListThumbnailContext = NULL; |
|
108 iFocusGridThumbnailContext = NULL; |
|
109 iFocusFsThumbnailContext = NULL; |
|
110 iFavouriteContext = NULL; |
|
111 iTitleFetcher = NULL; |
|
112 iViewTitle = QString(); |
|
113 } |
|
114 |
|
115 // --------------------------------------------------------------------------- |
|
116 // Symbian 2nd phase constructor can leave. |
|
117 // --------------------------------------------------------------------------- |
|
118 // |
|
119 void GlxMLWrapperPrivate::ConstructL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType,QString uri) |
|
120 { |
|
121 TRACER("GlxMLWrapperPrivate::ConstructL"); |
|
122 if(aCollectionId == KGlxCollectionPluginFavoritesAlbumId) |
|
123 { |
|
124 CreateMediaListFavoritesItemL(aCollectionId, aHierarchyId,aFilterType,uri); |
|
125 } |
|
126 else if(aCollectionId != KGlxAlbumsMediaId) |
|
127 { |
|
128 CreateMediaListL(aCollectionId, aHierarchyId,aFilterType); |
|
129 } |
|
130 else |
|
131 { |
|
132 //for creating Medial List for Albums Media path Items |
|
133 CreateMediaListAlbumItemL(aCollectionId, aHierarchyId,aFilterType); |
|
134 } |
|
135 iMLGenericObserver = CGlxMLGenericObserver::NewL(*iMediaList,this); |
|
136 iBlockyIteratorForFilmStrip.SetRangeOffsets(0,0); |
|
137 iDrmUtility = CGlxDRMUtility::InstanceL(); |
|
138 } |
|
139 |
|
140 // --------------------------------------------------------------------------- |
|
141 // Destructor |
|
142 // --------------------------------------------------------------------------- |
|
143 // |
|
144 GlxMLWrapperPrivate::~GlxMLWrapperPrivate() |
|
145 { |
|
146 TRACER("GlxMLWrapperPrivate::~GlxMLWrapperPrivate"); |
|
147 if ( iDrmUtility ) |
|
148 { |
|
149 iDrmUtility->Close(); |
|
150 } |
|
151 RemoveGridContext(); |
|
152 RemovePtFsContext(); |
|
153 RemoveLsFsContext(); |
|
154 RemoveListContext(); |
|
155 RemoveFavouriteContext(); |
|
156 delete iMLGenericObserver; |
|
157 iMLGenericObserver = NULL; |
|
158 if (iMediaList) |
|
159 { |
|
160 iMediaList->Close(); |
|
161 } |
|
162 } |
|
163 |
|
164 // --------------------------------------------------------------------------- |
|
165 // SetContextMode |
|
166 // --------------------------------------------------------------------------- |
|
167 // |
|
168 void GlxMLWrapperPrivate::SetContextMode(GlxContextMode aContextMode) |
|
169 { |
|
170 TInt err = KErrNone; |
|
171 if(aContextMode <= GlxContextPtFs) |
|
172 { |
|
173 TRAP(err, SetThumbnailContextL(aContextMode) ); //todo add a trap here |
|
174 } |
|
175 else if(aContextMode == GlxContextFavorite) |
|
176 { |
|
177 TRAP(err,SetFavouriteContextL()); |
|
178 } |
|
179 else if(aContextMode == GlxContextComment) |
|
180 { |
|
181 TRAP(err,SetDescontextL()); |
|
182 } |
|
183 else |
|
184 { |
|
185 TRAP(err, SetListContextL(aContextMode) ); |
|
186 } |
|
187 |
|
188 GLX_LOG_INFO1("GlxMLWrapperPrivate::SetContextMode error %d", err); |
|
189 iContextMode = aContextMode; |
|
190 } |
|
191 |
|
192 // --------------------------------------------------------------------------- |
|
193 // RemoveContextMode |
|
194 // --------------------------------------------------------------------------- |
|
195 // |
|
196 void GlxMLWrapperPrivate::RemoveContextMode(GlxContextMode aContextMode) |
|
197 { |
|
198 if(aContextMode == GlxContextComment) |
|
199 { |
|
200 RemoveDescContext(); |
|
201 } |
|
202 } |
|
203 // --------------------------------------------------------------------------- |
|
204 // SetFavouriteContextL |
|
205 // --------------------------------------------------------------------------- |
|
206 // |
|
207 void GlxMLWrapperPrivate::SetFavouriteContextL() |
|
208 { |
|
209 iFavouriteContext = CGlxDefaultAttributeContext::NewL(); |
|
210 iFavouriteContext->AddAttributeL( KMPXMediaGeneralCount ); |
|
211 iMediaList->AddContextL( iFavouriteContext, KGlxFetchContextPriorityLow ); |
|
212 } |
|
213 |
|
214 // --------------------------------------------------------------------------- |
|
215 // RemoveFavouriteContext |
|
216 // --------------------------------------------------------------------------- |
|
217 // |
|
218 void GlxMLWrapperPrivate::RemoveFavouriteContext() |
|
219 { |
|
220 if(iFavouriteContext ) |
|
221 { |
|
222 iMediaList->RemoveContext(iFavouriteContext); |
|
223 delete iFavouriteContext; |
|
224 iFavouriteContext = NULL; |
|
225 } |
|
226 } |
|
227 |
|
228 // --------------------------------------------------------------------------- |
|
229 // SetListContextL |
|
230 // --------------------------------------------------------------------------- |
|
231 // |
|
232 void GlxMLWrapperPrivate::SetListContextL(GlxContextMode aContextMode) |
|
233 { |
|
234 if(GlxContextLsList == aContextMode || GlxContextPtList == aContextMode) |
|
235 { |
|
236 if(!iPtListContextActivated) |
|
237 { |
|
238 if(NULL == iTitleAttributeContext) |
|
239 { |
|
240 iTitleAttributeContext = CGlxDefaultListAttributeContext::NewL(); |
|
241 iTitleAttributeContext->SetRangeOffsets( KListDataWindowSize, |
|
242 KListDataWindowSize ); |
|
243 iTitleAttributeContext->AddAttributeL( KMPXMediaGeneralTitle ); |
|
244 iTitleAttributeContext->AddAttributeL( KGlxMediaGeneralSlideshowableContent ); |
|
245 iTitleAttributeContext->AddAttributeL( KGlxMediaGeneralSystemItem ); |
|
246 iMediaList->AddContextL( iTitleAttributeContext, KGlxFetchContextPriorityNormal ); |
|
247 } |
|
248 if(NULL == iSubtitleAttributeContext) |
|
249 { |
|
250 iSubtitleAttributeContext = CGlxDefaultListAttributeContext::NewL(); |
|
251 iSubtitleAttributeContext->SetRangeOffsets( KListDataWindowSize, |
|
252 KListDataWindowSize ); |
|
253 iSubtitleAttributeContext->AddAttributeL( |
|
254 KGlxMediaCollectionPluginSpecificSubTitle ); |
|
255 iMediaList->AddContextL( iSubtitleAttributeContext, KGlxFetchContextPriorityNormal ); |
|
256 |
|
257 } |
|
258 if(NULL == iListThumbnailContext) |
|
259 { |
|
260 iThumbnailIterator.SetRangeOffsets(KListDataWindowSize,2); |
|
261 iListThumbnailContext = CGlxThumbnailContext::NewL(&iThumbnailIterator); |
|
262 iListThumbnailContext->SetDefaultSpec(KGridTNWIdth,KGridTNHeight ); |
|
263 iMediaList->AddContextL(iListThumbnailContext ,KGlxFetchContextPriorityNormal ); |
|
264 } |
|
265 iPtListContextActivated = ETrue; |
|
266 } |
|
267 } |
|
268 else if(GlxContextSelectionList == aContextMode ) |
|
269 { |
|
270 if(NULL == iTitleAttributeContext) |
|
271 { |
|
272 iTitleAttributeContext = CGlxDefaultListAttributeContext::NewL(); |
|
273 iTitleAttributeContext->SetRangeOffsets( KListDataWindowSize, KListDataWindowSize ); |
|
274 iTitleAttributeContext->AddAttributeL( KMPXMediaGeneralTitle ); |
|
275 iTitleAttributeContext->AddAttributeL( KGlxMediaGeneralSlideshowableContent ); |
|
276 iTitleAttributeContext->AddAttributeL( KGlxMediaGeneralSystemItem ); |
|
277 iMediaList->AddContextL( iTitleAttributeContext, KGlxFetchContextPriorityNormal ); |
|
278 } |
|
279 iSelectionListContextActivated = ETrue; |
|
280 } |
|
281 } |
|
282 |
|
283 |
|
284 // --------------------------------------------------------------------------- |
|
285 // CreateThumbnailContext |
|
286 // --------------------------------------------------------------------------- |
|
287 // |
|
288 void GlxMLWrapperPrivate::SetThumbnailContextL(GlxContextMode aContextMode) |
|
289 { |
|
290 TRACER("GlxMLWrapperPrivate::SetThumbnailContext()"); |
|
291 if( aContextMode == GlxContextLsGrid || aContextMode == GlxContextPtGrid) { |
|
292 if(!iGridContextActivated) { |
|
293 CreateGridContextL(); |
|
294 } |
|
295 |
|
296 if(iPtFsContextActivated) { |
|
297 RemovePtFsContext(); |
|
298 } |
|
299 |
|
300 if(iLsFsContextActivated) { |
|
301 RemoveLsFsContext(); |
|
302 } |
|
303 } |
|
304 |
|
305 if(aContextMode == GlxContextLsFs && !iLsFsContextActivated) { |
|
306 if(!iGridContextActivated) { |
|
307 CreateGridContextL(); |
|
308 } |
|
309 if(iPtFsContextActivated) { |
|
310 RemovePtFsContext(); |
|
311 } |
|
312 CreateLsFsContextL(); |
|
313 } |
|
314 |
|
315 if(aContextMode == GlxContextPtFs && !iPtFsContextActivated) { |
|
316 if(!iGridContextActivated) { |
|
317 CreateGridContextL(); |
|
318 } |
|
319 if(iLsFsContextActivated) { |
|
320 RemoveLsFsContext(); |
|
321 } |
|
322 CreatePtFsContextL(); |
|
323 } |
|
324 } |
|
325 |
|
326 // --------------------------------------------------------------------------- |
|
327 // CreateGridContextL |
|
328 // --------------------------------------------------------------------------- |
|
329 // |
|
330 void GlxMLWrapperPrivate::CreateGridContextL() |
|
331 { |
|
332 TRACER("GlxMLWrapperPrivate::CreateGridContextL()"); |
|
333 if(iGridThumbnailContext && !iGridContextActivated) |
|
334 { |
|
335 delete iGridThumbnailContext; |
|
336 iGridThumbnailContext = NULL; |
|
337 } |
|
338 if(!iGridContextActivated) |
|
339 { |
|
340 iGridThumbnailContext = CGlxThumbnailContext::NewL( &iBlockyIterator ); // set the thumbnail context |
|
341 iGridThumbnailContext->SetDefaultSpec( KGridTNWIdth, KGridTNHeight ); //todo get these image sizes from the layout. |
|
342 // show static items if required |
|
343 iMediaList->SetStaticItemsEnabled(EFalse); |
|
344 iMediaList->AddContextL(iGridThumbnailContext, KGlxFetchContextPriorityNormal ); |
|
345 iGridContextActivated = ETrue; |
|
346 } |
|
347 |
|
348 CMPXCollectionPath* path = iMediaList->PathLC( NGlxListDefs::EPathParent ); |
|
349 iTitleFetcher = CGlxTitleFetcher::NewL(*this, path); |
|
350 CleanupStack::PopAndDestroy(path); |
|
351 |
|
352 } |
|
353 |
|
354 // --------------------------------------------------------------------------- |
|
355 // CreateLsFsContextL |
|
356 // --------------------------------------------------------------------------- |
|
357 // |
|
358 void GlxMLWrapperPrivate::CreateLsFsContextL() |
|
359 { |
|
360 TRACER("GlxMLWrapperPrivate::CreateGridContextL()"); |
|
361 if(iLsFsThumbnailContext && !iLsFsContextActivated) |
|
362 { |
|
363 delete iLsFsThumbnailContext; |
|
364 iLsFsThumbnailContext = NULL; |
|
365 } |
|
366 if(!iLsFsContextActivated) |
|
367 { |
|
368 iLsFsThumbnailContext = CGlxDefaultThumbnailContext::NewL(); |
|
369 iLsFsThumbnailContext->SetRangeOffsets(2,2); |
|
370 iLsFsThumbnailContext->SetDefaultSpec( KFullScreenTNLSWidth, KFullScreenTNLSHeight ); //todo get these image sizes from the layout. |
|
371 |
|
372 if(!iFocusFsThumbnailContext) |
|
373 { |
|
374 iFocusFsThumbnailContext = CGlxDefaultThumbnailContext::NewL(); |
|
375 iFocusFsThumbnailContext->SetRangeOffsets(0,0); |
|
376 iFocusFsThumbnailContext->SetDefaultSpec( KFullScreenTNLSWidth, KFullScreenTNLSHeight ); //todo get these image sizes from the layout. |
|
377 } |
|
378 if(!iFocusGridThumbnailContext) |
|
379 { |
|
380 iFocusGridThumbnailContext = CGlxDefaultThumbnailContext::NewL(); // set the thumbnail context for Focus Grid |
|
381 iFocusGridThumbnailContext->SetRangeOffsets(0,0); |
|
382 iFocusGridThumbnailContext->SetDefaultSpec( KGridTNWIdth, KGridTNHeight ); //todo get these image sizes from the layout. |
|
383 } |
|
384 |
|
385 // show static items if required |
|
386 iMediaList->SetStaticItemsEnabled(EFalse); |
|
387 iMediaList->AddContextL(iFocusFsThumbnailContext, KGlxFetchContextPriorityNormal ); // Temp will change this number |
|
388 iMediaList->AddContextL(iFocusGridThumbnailContext, KGlxFetchContextPriorityNormal ); // Temp will change this number |
|
389 iMediaList->AddContextL(iLsFsThumbnailContext, KGlxFetchContextPriorityNormal ); |
|
390 iLsFsContextActivated = ETrue; |
|
391 } |
|
392 } |
|
393 |
|
394 // --------------------------------------------------------------------------- |
|
395 // CreatePtFsContextL |
|
396 // --------------------------------------------------------------------------- |
|
397 // |
|
398 void GlxMLWrapperPrivate::CreatePtFsContextL() |
|
399 { |
|
400 TRACER("GlxMLWrapperPrivate::CreateGridContextL()"); |
|
401 if(iPtFsThumbnailContext && !iPtFsContextActivated) |
|
402 { |
|
403 delete iPtFsThumbnailContext; |
|
404 iPtFsThumbnailContext = NULL; |
|
405 } |
|
406 if(!iPtFsContextActivated) |
|
407 { |
|
408 iPtFsThumbnailContext = CGlxDefaultThumbnailContext::NewL(); // set the thumbnail context |
|
409 iPtFsThumbnailContext->SetRangeOffsets(2,2); |
|
410 iPtFsThumbnailContext->SetDefaultSpec( KFullScreenTNPTWidth, KFullScreenTNPTHeight ); //todo get these image sizes from the layout. |
|
411 |
|
412 if(!iFocusFsThumbnailContext) |
|
413 { |
|
414 iFocusFsThumbnailContext = CGlxDefaultThumbnailContext::NewL(); |
|
415 iFocusFsThumbnailContext->SetRangeOffsets(0,0); |
|
416 iFocusFsThumbnailContext->SetDefaultSpec( KFullScreenTNPTWidth, KFullScreenTNPTHeight ); //todo get these image sizes from the layout. |
|
417 } |
|
418 if(!iFocusGridThumbnailContext) |
|
419 { |
|
420 iFocusGridThumbnailContext = CGlxDefaultThumbnailContext::NewL(); // set the thumbnail context for Focus Grid |
|
421 iFocusGridThumbnailContext->SetRangeOffsets(0,0); |
|
422 iFocusGridThumbnailContext->SetDefaultSpec( KGridTNWIdth, KGridTNHeight ); //todo get these image sizes from the layout. |
|
423 } |
|
424 |
|
425 // show static items if required |
|
426 iMediaList->SetStaticItemsEnabled(EFalse); |
|
427 iMediaList->AddContextL(iFocusFsThumbnailContext, KGlxFetchContextPriorityNormal ); // Temp will change this number |
|
428 iMediaList->AddContextL(iFocusGridThumbnailContext, KGlxFetchContextPriorityNormal ); // Temp will change this number |
|
429 iMediaList->AddContextL(iPtFsThumbnailContext, KGlxFetchContextPriorityNormal ); |
|
430 iPtFsContextActivated = ETrue; |
|
431 } |
|
432 } |
|
433 |
|
434 // --------------------------------------------------------------------------- |
|
435 // RemoveGridContext |
|
436 // --------------------------------------------------------------------------- |
|
437 // |
|
438 void GlxMLWrapperPrivate::RemoveGridContext() |
|
439 { |
|
440 if(iGridThumbnailContext && iGridContextActivated) |
|
441 { |
|
442 iMediaList->RemoveContext(iGridThumbnailContext); |
|
443 delete iGridThumbnailContext; |
|
444 iGridThumbnailContext = NULL; |
|
445 iGridContextActivated = EFalse; |
|
446 } |
|
447 delete iTitleFetcher; |
|
448 iTitleFetcher = NULL; |
|
449 } |
|
450 |
|
451 // --------------------------------------------------------------------------- |
|
452 // RemoveLsFsContext |
|
453 // --------------------------------------------------------------------------- |
|
454 // |
|
455 void GlxMLWrapperPrivate::RemoveLsFsContext() |
|
456 { |
|
457 if(iLsFsThumbnailContext && iLsFsContextActivated) |
|
458 { |
|
459 iMediaList->RemoveContext(iLsFsThumbnailContext); |
|
460 delete iLsFsThumbnailContext; |
|
461 iLsFsThumbnailContext = NULL; |
|
462 |
|
463 if(iFocusFsThumbnailContext) |
|
464 { |
|
465 iMediaList->RemoveContext(iFocusFsThumbnailContext); |
|
466 delete iFocusFsThumbnailContext; |
|
467 iFocusFsThumbnailContext = NULL; |
|
468 } |
|
469 |
|
470 if(iFocusGridThumbnailContext) |
|
471 { |
|
472 iMediaList->RemoveContext(iFocusGridThumbnailContext); |
|
473 delete iFocusGridThumbnailContext; |
|
474 iFocusGridThumbnailContext = NULL; |
|
475 } |
|
476 |
|
477 iLsFsContextActivated = EFalse; |
|
478 } |
|
479 } |
|
480 |
|
481 // --------------------------------------------------------------------------- |
|
482 // RemovePtFsContext |
|
483 // --------------------------------------------------------------------------- |
|
484 // |
|
485 void GlxMLWrapperPrivate::RemovePtFsContext() |
|
486 { |
|
487 if(iPtFsThumbnailContext && iPtFsContextActivated) |
|
488 { |
|
489 iMediaList->RemoveContext(iPtFsThumbnailContext); |
|
490 delete iPtFsThumbnailContext; |
|
491 iPtFsThumbnailContext = NULL; |
|
492 |
|
493 if(iFocusFsThumbnailContext) |
|
494 { |
|
495 iMediaList->RemoveContext(iFocusFsThumbnailContext); |
|
496 delete iFocusFsThumbnailContext; |
|
497 iFocusFsThumbnailContext = NULL; |
|
498 } |
|
499 |
|
500 if(iFocusGridThumbnailContext) |
|
501 { |
|
502 iMediaList->RemoveContext(iFocusGridThumbnailContext); |
|
503 delete iFocusGridThumbnailContext; |
|
504 iFocusGridThumbnailContext = NULL; |
|
505 } |
|
506 |
|
507 iPtFsContextActivated = EFalse; |
|
508 } |
|
509 } |
|
510 |
|
511 |
|
512 // --------------------------------------------------------------------------- |
|
513 // RemoveListContext |
|
514 // --------------------------------------------------------------------------- |
|
515 // |
|
516 void GlxMLWrapperPrivate::RemoveListContext() |
|
517 { |
|
518 if(iPtListContextActivated || iSelectionListContextActivated) |
|
519 { |
|
520 if(iTitleAttributeContext) |
|
521 { |
|
522 iMediaList->RemoveContext(iTitleAttributeContext); |
|
523 delete iTitleAttributeContext; |
|
524 iTitleAttributeContext = NULL; |
|
525 } |
|
526 if(iSubtitleAttributeContext) |
|
527 { |
|
528 iMediaList->RemoveContext(iSubtitleAttributeContext); |
|
529 delete iSubtitleAttributeContext; |
|
530 iSubtitleAttributeContext = NULL; |
|
531 } |
|
532 if(iListThumbnailContext) |
|
533 { |
|
534 iMediaList->RemoveContext(iListThumbnailContext); |
|
535 delete iListThumbnailContext; |
|
536 iListThumbnailContext = NULL; |
|
537 } |
|
538 iPtListContextActivated = EFalse; |
|
539 iSelectionListContextActivated = EFalse; |
|
540 } |
|
541 } |
|
542 // --------------------------------------------------------------------------- |
|
543 // GetItemCount |
|
544 // --------------------------------------------------------------------------- |
|
545 // |
|
546 int GlxMLWrapperPrivate::GetItemCount() |
|
547 { |
|
548 return iMediaList->Count(); |
|
549 } |
|
550 |
|
551 // --------------------------------------------------------------------------- |
|
552 // CreateMediaListAlbumItemL() |
|
553 // Creates the media list for the album Item |
|
554 // --------------------------------------------------------------------------- |
|
555 void GlxMLWrapperPrivate::CreateMediaListAlbumItemL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType) |
|
556 { |
|
557 TRACER("GlxMLWrapperPrivate::CreateMediaListAlbumItemL"); |
|
558 Q_UNUSED(aCollectionId); |
|
559 Q_UNUSED(aHierarchyId); |
|
560 //retrieve the instance of Media list for ALBUMS LIST which will be saved in iMediaList |
|
561 CreateMediaListL(KGlxCollectionPluginAlbumsImplementationUid,0,EGlxFilterAlbum); |
|
562 //retrieve the path of the focussed item of the MediaList |
|
563 CMPXCollectionPath* path = iMediaList->PathLC(NGlxListDefs:: EPathFocusOrSelection); |
|
564 //close the existing instance of Media List |
|
565 iMediaList->Close(); |
|
566 iMediaList = NULL; |
|
567 //create new media list with the derived path |
|
568 CMPXFilter* filter = TGlxFilterFactory::CreateItemTypeFilterL(aFilterType); //todo take actual filter type |
|
569 CleanupStack::PushL(filter); |
|
570 iMediaList = MGlxMediaList::InstanceL( *path, |
|
571 TGlxHierarchyId(0), filter ); //todo take actual hierarchy |
|
572 CleanupStack::PopAndDestroy( filter ); |
|
573 |
|
574 GLX_LOG_INFO1("GlxMLWrapperPrivate::CreateMediaListAlbumItemL - Path level = %d", |
|
575 path->Levels()); |
|
576 CleanupStack::PopAndDestroy(path); |
|
577 } |
|
578 // --------------------------------------------------------------------------- |
|
579 // CreateMediaListL() |
|
580 // Creates a collection path |
|
581 // Create a filter as requested filtertype |
|
582 // Creates the medialist |
|
583 // --------------------------------------------------------------------------- |
|
584 void GlxMLWrapperPrivate::CreateMediaListL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType) |
|
585 { |
|
586 TRACER("GlxMLWrapperPrivate::CreateMediaListL"); |
|
587 Q_UNUSED(aHierarchyId); |
|
588 // Create path to the list of images and videos |
|
589 CMPXCollectionPath* path = CMPXCollectionPath::NewL(); |
|
590 CleanupStack::PushL( path ); |
|
591 //path->AppendL(KGlxCollectionPluginAllImplementationUid); // All item collection plugin //todo take actual collection path |
|
592 path->AppendL(aCollectionId); |
|
593 // Create filter to filter out either images or videos |
|
594 GLX_LOG_INFO1("GlxMLWrapperPrivate::MediaListL - Filter Type = %d",aFilterType); |
|
595 CMPXFilter* filter = NULL; |
|
596 if( EGlxFilterExcludeCamera == aFilterType) |
|
597 { |
|
598 filter = TGlxFilterFactory::CreateCameraAlbumExclusionFilterL(); |
|
599 CleanupStack::PushL(filter); |
|
600 } |
|
601 else if(EGlxFilterImage == aFilterType) |
|
602 { |
|
603 filter = TGlxFilterFactory::CreateExcludeDrmImageTypeFilterL(aFilterType); |
|
604 CleanupStack::PushL(filter); |
|
605 } |
|
606 else |
|
607 { |
|
608 filter = TGlxFilterFactory::CreateItemTypeFilterL(aFilterType); //todo take actual filter type |
|
609 CleanupStack::PushL(filter); |
|
610 } |
|
611 // Create the media list |
|
612 iMediaList = MGlxMediaList::InstanceL( *path, |
|
613 TGlxHierarchyId(aHierarchyId), filter ); //todo take actual hierarchy |
|
614 CleanupStack::PopAndDestroy( filter ); |
|
615 |
|
616 GLX_LOG_INFO1("GlxMLWrapperPrivate::MediaListL - Path level = %d", |
|
617 path->Levels()); |
|
618 CleanupStack::PopAndDestroy(path); |
|
619 } |
|
620 |
|
621 // --------------------------------------------------------------------------- |
|
622 // CreateMediaListL() for Favorites Album |
|
623 // Creates a collection path |
|
624 // Create a filter as requested filtertype |
|
625 // Creates the medialist |
|
626 // --------------------------------------------------------------------------- |
|
627 void GlxMLWrapperPrivate::CreateMediaListFavoritesItemL(int aCollectionId, int aHierarchyId, TGlxFilterItemType aFilterType,QString uri) |
|
628 { |
|
629 TRACER("GlxMLWrapperPrivate::CreateMediaListFavoritesItemL"); |
|
630 Q_UNUSED(aHierarchyId); |
|
631 Q_UNUSED(aCollectionId); |
|
632 Q_UNUSED(aFilterType); |
|
633 // Create path to the list of images and videos |
|
634 CMPXCollectionPath* path = CMPXCollectionPath::NewL(); |
|
635 CleanupStack::PushL( path ); |
|
636 path->AppendL(KGlxCollectionPluginAlbumsImplementationUid); |
|
637 path->AppendL( TMPXItemId(KGlxCollectionFavoritesId) ); |
|
638 path->Set( 0 ); |
|
639 TPtrC16 str(reinterpret_cast<const TUint16*>(uri.utf16())); |
|
640 HBufC *ptr = str.Alloc(); |
|
641 CMPXFilter* filter = TGlxFilterFactory::CreateURIFilterL(*ptr); |
|
642 CleanupStack::PushL(filter); |
|
643 iMediaList = MGlxMediaList::InstanceL( *path, |
|
644 TGlxHierarchyId(KGlxCollectionPluginAlbumsDllUid), filter ); |
|
645 CleanupStack::PopAndDestroy( filter ); |
|
646 CleanupStack::PopAndDestroy( path ); |
|
647 } |
|
648 |
|
649 /* |
|
650 * retrieveItemIcon |
|
651 */ |
|
652 HbIcon* GlxMLWrapperPrivate::RetrieveItemIcon(int aItemIndex, GlxTBContextType aTBContextType) |
|
653 { |
|
654 TInt itemHeight = 0; |
|
655 TInt itemWidth = 0; |
|
656 switch (aTBContextType) { |
|
657 case GlxTBContextGrid: { |
|
658 itemHeight = KGridTNHeight; |
|
659 itemWidth = KGridTNWIdth; |
|
660 } |
|
661 break; |
|
662 |
|
663 case GlxTBContextPtFs: { |
|
664 itemHeight = KFullScreenTNPTHeight; |
|
665 itemWidth = KFullScreenTNPTWidth; |
|
666 } |
|
667 break; |
|
668 |
|
669 case GlxTBContextLsFs: { |
|
670 itemHeight = KFullScreenTNLSHeight; |
|
671 itemWidth = KFullScreenTNLSWidth; |
|
672 } |
|
673 break; |
|
674 |
|
675 default : |
|
676 break; |
|
677 } |
|
678 |
|
679 const TGlxMedia& item = iMediaList->Item( aItemIndex ); |
|
680 TMPXAttribute thumbnailAttribute( KGlxMediaIdThumbnail, |
|
681 GlxFullThumbnailAttributeId( ETrue, itemWidth, itemHeight ) ); //todo map icon size with actual mode |
|
682 const CGlxThumbnailAttribute* value = item.ThumbnailAttribute( thumbnailAttribute ); |
|
683 TInt tnError = GlxErrorManager::HasAttributeErrorL( item.Properties(), KGlxMediaIdThumbnail ); |
|
684 |
|
685 if ( value && value->iBitmap != NULL ) { |
|
686 if( aTBContextType == GlxTBContextGrid ) { |
|
687 GLX_LOG_INFO1("### GlxMLWrapperPrivate::RetrieveItemIcon value-Index is %d",aItemIndex); |
|
688 |
|
689 if ( iContextMode == GlxContextPtGrid ) { |
|
690 return convertFBSBitmapToHbIcon( value->iBitmap , KGridTNPTWIdth, KGridTNPTHeight); |
|
691 } |
|
692 else { |
|
693 return convertFBSBitmapToHbIcon( value->iBitmap ); |
|
694 } |
|
695 } |
|
696 else { |
|
697 return convertFBSBitmapToHbIcon( value->iBitmap, itemWidth, itemHeight ) ; |
|
698 } |
|
699 } |
|
700 /*else if (item.GetIconInfo(icon)) //todo will be required if we are planning to have static item else remove |
|
701 { |
|
702 GLX_LOG_INFO1("### GlxMLWrapperPrivate::HandleAttributesAvailableL GetIconInfo-Index is %d",aItemIndex); |
|
703 }*/ |
|
704 //handle DRM case |
|
705 |
|
706 |
|
707 GLX_LOG_INFO1("### GlxMLWrapperPrivate::RetrieveItemIcon value-Index is %d and have returned empty icon",aItemIndex); |
|
708 return NULL; |
|
709 } |
|
710 |
|
711 QImage GlxMLWrapperPrivate::RetrieveItemImage(int aItemIndex, GlxTBContextType aTBContextType) |
|
712 { |
|
713 TInt itemHeight = 0; |
|
714 TInt itemWidth = 0; |
|
715 switch (aTBContextType) |
|
716 { |
|
717 case GlxTBContextGrid: |
|
718 { |
|
719 itemHeight = KGridTNHeight; |
|
720 itemWidth = KGridTNWIdth; |
|
721 } |
|
722 break; |
|
723 case GlxTBContextPtFs: |
|
724 { |
|
725 itemHeight = KFullScreenTNPTHeight; |
|
726 itemWidth = KFullScreenTNPTWidth; |
|
727 } |
|
728 break; |
|
729 case GlxTBContextLsFs: |
|
730 { |
|
731 itemHeight = KFullScreenTNLSHeight; |
|
732 itemWidth = KFullScreenTNLSWidth; |
|
733 } |
|
734 break; |
|
735 } |
|
736 const TGlxMedia& item = iMediaList->Item( aItemIndex ); |
|
737 TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, |
|
738 GlxFullThumbnailAttributeId( ETrue,itemWidth,itemHeight ) ); |
|
739 const CGlxThumbnailAttribute* value = item.ThumbnailAttribute( |
|
740 thumbnailAttribute ); |
|
741 TInt tnError = GlxErrorManager::HasAttributeErrorL( |
|
742 item.Properties(), KGlxMediaIdThumbnail ); |
|
743 TSize iconSize(itemWidth, itemHeight); |
|
744 |
|
745 if (value && value->iBitmap != NULL) |
|
746 { |
|
747 value->iBitmap->LockHeap(); |
|
748 TUint32 *tempData = value->iBitmap->DataAddress(); |
|
749 uchar *data = (uchar *)(tempData); |
|
750 int bytesPerLine = value->iBitmap->ScanLineLength(value->iBitmap->SizeInPixels().iWidth , value->iBitmap->DisplayMode()); |
|
751 QImage image = QImage(data, value->iBitmap->SizeInPixels().iWidth, value->iBitmap->SizeInPixels().iHeight, bytesPerLine, QImage::Format_RGB16).convertToFormat(QImage::Format_ARGB32_Premultiplied); |
|
752 value->iBitmap->UnlockHeap(); |
|
753 return image; |
|
754 } |
|
755 else if( tnError == KErrCANoRights) |
|
756 { |
|
757 //handle DRM case |
|
758 } |
|
759 else if( tnError ) |
|
760 { |
|
761 if(iCorruptImage.isNull()) |
|
762 { |
|
763 HbIcon *icon = new HbIcon(GLXICON_CORRUPT); |
|
764 if(!icon->isNull()) |
|
765 { |
|
766 // this image Creation is Slow. |
|
767 // But what to do, Q class's Does not undersatnd our Localised File names |
|
768 iCorruptImage = icon->pixmap().toImage(); |
|
769 } |
|
770 delete icon; |
|
771 } |
|
772 return iCorruptImage; |
|
773 } |
|
774 |
|
775 return QImage(); |
|
776 } |
|
777 // --------------------------------------------------------------------------- |
|
778 // RetrieveListTitle |
|
779 // --------------------------------------------------------------------------- |
|
780 // |
|
781 QString GlxMLWrapperPrivate::RetrieveListTitle(int aItemIndex) |
|
782 { |
|
783 const TGlxMedia& item = iMediaList->Item( aItemIndex ); |
|
784 const TDesC &title = item.Title(); |
|
785 QString albumTitle = QString::fromUtf16(title.Ptr(), title.Length()); |
|
786 return albumTitle; |
|
787 } |
|
788 |
|
789 // --------------------------------------------------------------------------- |
|
790 // RetrieveListSubTitle |
|
791 // --------------------------------------------------------------------------- |
|
792 // |
|
793 QString GlxMLWrapperPrivate::RetrieveListSubTitle(int aItemIndex) |
|
794 { |
|
795 const TGlxMedia& item = iMediaList->Item( aItemIndex ); |
|
796 const TDesC &subTitle = item.SubTitle(); |
|
797 QString albumSubTitle = QString::fromUtf16(subTitle.Ptr(), subTitle.Length()); |
|
798 return albumSubTitle; |
|
799 } |
|
800 |
|
801 // --------------------------------------------------------------------------- |
|
802 // RetrieveListDesc |
|
803 // --------------------------------------------------------------------------- |
|
804 // |
|
805 QString GlxMLWrapperPrivate::RetrieveListDesc(int aItemIndex) |
|
806 { |
|
807 const TGlxMedia& item = iMediaList->Item( aItemIndex ); |
|
808 const TDesC &commentstring = item.Comment(); |
|
809 QString descstring = QString::fromUtf16(commentstring.Ptr(), commentstring.Length()); |
|
810 return descstring; |
|
811 } |
|
812 |
|
813 // --------------------------------------------------------------------------- |
|
814 // Retrieve number of image contained by album list |
|
815 // --------------------------------------------------------------------------- |
|
816 // |
|
817 int GlxMLWrapperPrivate::RetrieveListItemCount(int aItemIndex) |
|
818 { |
|
819 const TGlxMedia& item = iMediaList->Item( aItemIndex ); |
|
820 int count = 0; |
|
821 TBool ret = item.GetSlideshowPlayableContainedItemCount(count); |
|
822 if(ret) |
|
823 return count; |
|
824 else |
|
825 return 0; |
|
826 } |
|
827 |
|
828 // --------------------------------------------------------------------------- |
|
829 // Retrieve the item is system item or not |
|
830 // --------------------------------------------------------------------------- |
|
831 // |
|
832 bool GlxMLWrapperPrivate::isSystemItem( int aItemIndex ) |
|
833 { |
|
834 const TGlxMedia& item = iMediaList->Item( aItemIndex ); |
|
835 TBool systemItem = false; |
|
836 item.GetSystemItem( systemItem ); |
|
837 return systemItem ; |
|
838 } |
|
839 |
|
840 // --------------------------------------------------------------------------- |
|
841 // RetrieveItemUri |
|
842 // --------------------------------------------------------------------------- |
|
843 // |
|
844 QString GlxMLWrapperPrivate::RetrieveItemUri(int aItemIndex) |
|
845 { |
|
846 const TGlxMedia& item = iMediaList->Item( aItemIndex ); |
|
847 const TDesC &uri = item.Uri(); |
|
848 QString itemUri = QString::fromUtf16(uri.Ptr(), uri.Length()); |
|
849 return itemUri; |
|
850 } |
|
851 |
|
852 // --------------------------------------------------------------------------- |
|
853 // RetrieveItemFrameCount |
|
854 // --------------------------------------------------------------------------- |
|
855 // |
|
856 int GlxMLWrapperPrivate::RetrieveItemFrameCount(int aItemIndex) |
|
857 { |
|
858 const TGlxMedia& item = iMediaList->Item( aItemIndex ); |
|
859 TInt frameCount(0); |
|
860 TBool frameCountStatus = item.GetFrameCount(frameCount); |
|
861 return frameCount; |
|
862 } |
|
863 |
|
864 // --------------------------------------------------------------------------- |
|
865 // RetrieveItemDimension |
|
866 // --------------------------------------------------------------------------- |
|
867 // |
|
868 QSize GlxMLWrapperPrivate::RetrieveItemDimension(int aItemIndex) |
|
869 { |
|
870 const TGlxMedia& item = iMediaList->Item( aItemIndex ); |
|
871 TSize size(0,0); |
|
872 TBool result = item.GetDimensions(size); |
|
873 QSize itemSize(size.iWidth,size.iHeight); |
|
874 return itemSize; |
|
875 } |
|
876 |
|
877 // --------------------------------------------------------------------------- |
|
878 // RetrieveItemSize |
|
879 // --------------------------------------------------------------------------- |
|
880 // |
|
881 int GlxMLWrapperPrivate::RetrieveItemSize(int aItemIndex) |
|
882 { |
|
883 const TGlxMedia& item = iMediaList->Item( aItemIndex ); |
|
884 TUint itemSize ; |
|
885 item.GetSize(itemSize); |
|
886 return itemSize; |
|
887 } |
|
888 |
|
889 // --------------------------------------------------------------------------- |
|
890 // RetrieveItemDate |
|
891 // --------------------------------------------------------------------------- |
|
892 // |
|
893 QDate GlxMLWrapperPrivate::RetrieveItemDate(int index) |
|
894 { |
|
895 GLX_LOG_INFO1("GlxMLWrapperPrivate::RetrieveItemDate %d",index); |
|
896 const TGlxMedia& item = iMediaList->Item( index ); |
|
897 TTime dateValue; |
|
898 QDate date = QDate(); |
|
899 TBool returnValue =item.GetDate(dateValue); |
|
900 if(returnValue) |
|
901 { |
|
902 GLX_LOG_INFO1("GlxMLWrapperPrivate::RetrieveItemDate %d",returnValue); |
|
903 TDateTime dateTime = dateValue.DateTime(); |
|
904 date = QDate(dateTime.Year(),TInt(dateTime.Month()+1),(dateTime.Day()+1)); |
|
905 } |
|
906 return date; |
|
907 } |
|
908 |
|
909 // --------------------------------------------------------------------------- |
|
910 // RetrieveItemTime |
|
911 // --------------------------------------------------------------------------- |
|
912 // |
|
913 QTime GlxMLWrapperPrivate::RetrieveItemTime(int index) |
|
914 { |
|
915 GLX_LOG_INFO1("GlxMLWrapperPrivate::RetrieveItemTime %d",index); |
|
916 const TGlxMedia& item = iMediaList->Item( index ); |
|
917 TTime TimeValue; |
|
918 QTime time = QTime(); |
|
919 TBool returnValue =item.GetDate(TimeValue); |
|
920 |
|
921 if(returnValue) |
|
922 { |
|
923 GLX_LOG_INFO1("GlxMLWrapperPrivate::RetrieveItemDate %d",returnValue); |
|
924 TDateTime dateTime = TimeValue.DateTime(); |
|
925 time = QTime(dateTime.Hour(),dateTime.Minute()); |
|
926 } |
|
927 return time; |
|
928 } |
|
929 |
|
930 |
|
931 |
|
932 // --------------------------------------------------------------------------- |
|
933 // RetrieveFsBitmap |
|
934 // --------------------------------------------------------------------------- |
|
935 // |
|
936 CFbsBitmap* GlxMLWrapperPrivate::RetrieveBitmap(int aItemIndex) |
|
937 { |
|
938 GLX_LOG_INFO1("GlxMLWrapperPrivate::RetrieveBitmap %d",aItemIndex); |
|
939 const TGlxMedia& item = iMediaList->Item( aItemIndex ); |
|
940 TInt height =KFullScreenTNPTWidth; // default as portrait |
|
941 TInt width =KFullScreenTNPTHeight; |
|
942 if (iPtFsContextActivated ) |
|
943 { |
|
944 GLX_LOG_INFO("GlxMLWrapperPrivate::RetrieveBitmap - CGlxHdmi :PT"); |
|
945 width = KFullScreenTNPTWidth; |
|
946 height = KFullScreenTNPTHeight; |
|
947 } |
|
948 else if (iLsFsContextActivated) |
|
949 { |
|
950 GLX_LOG_INFO("GlxMLWrapperPrivate::RetrieveBitmap - CGlxHdmi :LS"); |
|
951 width = KFullScreenTNLSWidth; |
|
952 height = KFullScreenTNLSHeight; |
|
953 } |
|
954 TMPXAttribute fsTnAttrib= TMPXAttribute(KGlxMediaIdThumbnail, |
|
955 GlxFullThumbnailAttributeId(ETrue, width, height)); |
|
956 const CGlxThumbnailAttribute* fsTnValue = item.ThumbnailAttribute( |
|
957 fsTnAttrib); |
|
958 if (fsTnValue) |
|
959 { |
|
960 GLX_LOG_INFO("GlxMLWrapperPrivate::RetrieveBitmap - returning FS bitmap"); |
|
961 CFbsBitmap* fsTnBitmap = new (ELeave) CFbsBitmap; |
|
962 fsTnBitmap->Duplicate( fsTnValue->iBitmap->Handle()); |
|
963 |
|
964 GLX_LOG_INFO2("GlxMLWrapperPrivate::RetrieveBitmap - bitmap height=%d, bitmap width=%d", |
|
965 fsTnBitmap->SizeInPixels().iHeight,fsTnBitmap->SizeInPixels().iWidth); |
|
966 |
|
967 return fsTnBitmap; |
|
968 } |
|
969 else // fetch grid Thumbnail |
|
970 { |
|
971 TMPXAttribute gridTnAttrib = TMPXAttribute(KGlxMediaIdThumbnail, |
|
972 GlxFullThumbnailAttributeId(ETrue, KGridTNWIdth, |
|
973 KGridTNHeight)); |
|
974 const CGlxThumbnailAttribute* gridTnValue = item.ThumbnailAttribute( |
|
975 gridTnAttrib); |
|
976 if (gridTnValue) |
|
977 { |
|
978 GLX_LOG_INFO("GlxMLWrapperPrivate::RetrieveBitmap - returning Grid bitmap"); |
|
979 CFbsBitmap* gridTnBitmap = new (ELeave) CFbsBitmap; |
|
980 gridTnBitmap->Duplicate( gridTnValue->iBitmap->Handle()); |
|
981 |
|
982 GLX_LOG_INFO2("GlxMLWrapperPrivate::RetrieveBitmap - bitmap height=%d, bitmap width=%d", |
|
983 gridTnBitmap->SizeInPixels().iHeight,gridTnBitmap->SizeInPixels().iWidth); |
|
984 return gridTnBitmap; |
|
985 } |
|
986 else |
|
987 { |
|
988 GLX_LOG_INFO("GlxMLWrapperPrivate::RetrieveBitmap - returning default bitmap"); |
|
989 CFbsBitmap* defaultBitmap = new (ELeave) CFbsBitmap; |
|
990 return defaultBitmap; |
|
991 } |
|
992 } |
|
993 } |
|
994 |
|
995 // --------------------------------------------------------------------------- |
|
996 // HandleItemAddedL |
|
997 // --------------------------------------------------------------------------- |
|
998 // |
|
999 void GlxMLWrapperPrivate::HandleItemAddedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* /*aList*/ ) |
|
1000 { |
|
1001 iMLWrapper->itemsAdded(aStartIndex,aEndIndex); |
|
1002 } |
|
1003 // --------------------------------------------------------------------------- |
|
1004 // GetItemCount |
|
1005 // --------------------------------------------------------------------------- |
|
1006 // |
|
1007 void GlxMLWrapperPrivate::HandleItemRemovedL( TInt aStartIndex, TInt aEndIndex, MGlxMediaList* aList ) |
|
1008 { |
|
1009 Q_UNUSED(aList); |
|
1010 iMLWrapper->itemsRemoved(aStartIndex,aEndIndex); |
|
1011 TInt mediaCount = aList->Count(); |
|
1012 if (mediaCount <=0) |
|
1013 { |
|
1014 if(iMediaList->VisibleWindowIndex() > iMediaList->Count()) |
|
1015 { |
|
1016 iMediaList->SetVisibleWindowIndexL(0); |
|
1017 } |
|
1018 } |
|
1019 else if (iMediaList->VisibleWindowIndex() > iMediaList->Count()) |
|
1020 { |
|
1021 iMediaList->SetVisibleWindowIndexL(iMediaList->Count()-1); |
|
1022 } |
|
1023 } |
|
1024 // --------------------------------------------------------------------------- |
|
1025 // HandleAttributesAvailableL |
|
1026 // check for Grid PtFS and LsFs thumbnails. If any of them is available notify |
|
1027 // iMLWrapper |
|
1028 // --------------------------------------------------------------------------- |
|
1029 // |
|
1030 void GlxMLWrapperPrivate::HandleAttributesAvailableL( TInt aItemIndex, |
|
1031 const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* aList ) |
|
1032 { |
|
1033 GLX_LOG_INFO1("### GlxMLWrapperPrivate::HandleAttributesAvailableL %d",aItemIndex); |
|
1034 Q_UNUSED(aList); |
|
1035 // char temp[100]; |
|
1036 // sprintf(temp, "execution time of update %d", aItemIndex); |
|
1037 // PERFORMANCE_ADV( d1, temp) { |
|
1038 if ( iGridContextActivated || iLsFsContextActivated || iPtFsContextActivated ) |
|
1039 CheckGridTBAttribute(aItemIndex, aAttributes); |
|
1040 if ( iPtFsContextActivated ) |
|
1041 CheckPtFsTBAttribute(aItemIndex, aAttributes); |
|
1042 if ( iLsFsContextActivated ) |
|
1043 CheckLsFsTBAttribute(aItemIndex, aAttributes); |
|
1044 if (iPtListContextActivated || iSelectionListContextActivated) |
|
1045 CheckListAttributes(aItemIndex, aAttributes); |
|
1046 if( iDetailsContextActivated && aItemIndex == iMediaList->FocusIndex() ) |
|
1047 CheckDetailsAttributes(aItemIndex, aAttributes); |
|
1048 |
|
1049 } |
|
1050 // --------------------------------------------------------------------------- |
|
1051 // CheckGridTBAttribute |
|
1052 // --------------------------------------------------------------------------- |
|
1053 // |
|
1054 void GlxMLWrapperPrivate::CheckGridTBAttribute(TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes) |
|
1055 { |
|
1056 TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, |
|
1057 GlxFullThumbnailAttributeId( ETrue, KGridTNWIdth, KGridTNHeight ) ); //todo map icon size with actual mode |
|
1058 TInt searchStatus = CheckTBAttributesPresenceandSanity(aItemIndex, aAttributes, thumbnailAttribute); |
|
1059 if(searchStatus == KTBAttributeAvailable) |
|
1060 { |
|
1061 GLX_LOG_INFO1("### GlxMLWrapperPrivate::CheckGridTBAttribute %d",aItemIndex); |
|
1062 iMLWrapper->handleReceivedIcon(aItemIndex, GlxTBContextGrid); |
|
1063 } |
|
1064 else if(searchStatus == KTBAttributeCorrupt) |
|
1065 { |
|
1066 iMLWrapper->handleIconCorrupt(aItemIndex); |
|
1067 } |
|
1068 } |
|
1069 |
|
1070 // --------------------------------------------------------------------------- |
|
1071 // CheckPtFsTBAttribute |
|
1072 // --------------------------------------------------------------------------- |
|
1073 // |
|
1074 void GlxMLWrapperPrivate::CheckPtFsTBAttribute(TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes) |
|
1075 { |
|
1076 TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, |
|
1077 GlxFullThumbnailAttributeId( ETrue, KFullScreenTNPTWidth, KFullScreenTNPTHeight ) ); //todo map icon size with actual mode |
|
1078 TInt searchStatus = CheckTBAttributesPresenceandSanity(aItemIndex, aAttributes, thumbnailAttribute); |
|
1079 if(searchStatus == KTBAttributeAvailable) |
|
1080 { |
|
1081 iMLWrapper->handleReceivedIcon(aItemIndex, GlxTBContextPtFs); |
|
1082 } |
|
1083 else if(searchStatus == KTBAttributeCorrupt) |
|
1084 { |
|
1085 iMLWrapper->handleIconCorrupt(aItemIndex); |
|
1086 } |
|
1087 } |
|
1088 |
|
1089 // --------------------------------------------------------------------------- |
|
1090 // CheckLsFsTBAttribute |
|
1091 // --------------------------------------------------------------------------- |
|
1092 // |
|
1093 void GlxMLWrapperPrivate::CheckLsFsTBAttribute(TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes) |
|
1094 { |
|
1095 TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, |
|
1096 GlxFullThumbnailAttributeId( ETrue, KFullScreenTNLSWidth, KFullScreenTNLSHeight ) ); //todo map icon size with actual mode |
|
1097 TInt searchStatus = CheckTBAttributesPresenceandSanity(aItemIndex, aAttributes, thumbnailAttribute); |
|
1098 if(searchStatus == KTBAttributeAvailable) |
|
1099 { |
|
1100 iMLWrapper->handleReceivedIcon(aItemIndex, GlxTBContextLsFs); |
|
1101 } |
|
1102 else if(searchStatus == KTBAttributeCorrupt) |
|
1103 { |
|
1104 iMLWrapper->handleIconCorrupt(aItemIndex); |
|
1105 } |
|
1106 } |
|
1107 // --------------------------------------------------------------------------- |
|
1108 // CheckLsFsTBAttribute |
|
1109 // --------------------------------------------------------------------------- |
|
1110 // |
|
1111 void GlxMLWrapperPrivate::CheckListAttributes(TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes) |
|
1112 { |
|
1113 GLX_LOG_INFO1("### GlxMLWrapperPrivate::CheckListAttributes %d",aItemIndex); |
|
1114 TBool attribPresent = EFalse; |
|
1115 TMPXAttribute titleAttrib(KMPXMediaGeneralTitle); |
|
1116 TMPXAttribute subTitleAttrib(KGlxMediaCollectionPluginSpecificSubTitle); |
|
1117 TIdentityRelation< TMPXAttribute > match ( &TMPXAttribute::Match ); |
|
1118 |
|
1119 const TGlxMedia& item = iMediaList->Item(aItemIndex); |
|
1120 |
|
1121 if (KErrNotFound != aAttributes.Find(titleAttrib, match)) |
|
1122 { |
|
1123 attribPresent = ETrue; |
|
1124 GLX_LOG_INFO1("### GlxMLWrapperPrivate::CheckListAttributes title present %d",aItemIndex); |
|
1125 } |
|
1126 |
|
1127 if (KErrNotFound != aAttributes.Find(subTitleAttrib, match)) |
|
1128 { |
|
1129 attribPresent = ETrue; |
|
1130 GLX_LOG_INFO1("### GlxMLWrapperPrivate::CheckListAttributes subtitle present %d",aItemIndex); |
|
1131 } |
|
1132 TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, |
|
1133 GlxFullThumbnailAttributeId( ETrue, KGridTNWIdth, KGridTNHeight ) ); //todo map icon size with actual mode |
|
1134 TInt searchStatus = CheckTBAttributesPresenceandSanity(aItemIndex, aAttributes, thumbnailAttribute); |
|
1135 if(searchStatus == KTBAttributeAvailable) |
|
1136 { |
|
1137 attribPresent = ETrue; |
|
1138 GLX_LOG_INFO1("### GlxMLWrapperPrivate::CheckListAttributes Thumbnail present %d",aItemIndex); |
|
1139 } |
|
1140 if(attribPresent) |
|
1141 { |
|
1142 iMLWrapper->handleListItemAvailable(aItemIndex); |
|
1143 } |
|
1144 } |
|
1145 // --------------------------------------------------------------------------- |
|
1146 // CheckTBAttributesPresenceandSanity |
|
1147 // check if the requested attributes are present and their sanity |
|
1148 // --------------------------------------------------------------------------- |
|
1149 // |
|
1150 TInt GlxMLWrapperPrivate::CheckTBAttributesPresenceandSanity( TInt aItemIndex, |
|
1151 const RArray<TMPXAttribute>& aAttributes, TMPXAttribute aThumbnailAttribute ) |
|
1152 { |
|
1153 GLX_LOG_INFO1("### GlxMLWrapperPrivate::CheckTBAttributesPresenceandSanity %d",aItemIndex); |
|
1154 TInt searchStatus = KTBAttributeUnavailable; |
|
1155 const TGlxMedia& item = iMediaList->Item( aItemIndex ); |
|
1156 TIdentityRelation< TMPXAttribute > match ( &TMPXAttribute::Match ); |
|
1157 if (KErrNotFound != aAttributes.Find( aThumbnailAttribute, match )) |
|
1158 { |
|
1159 const CGlxThumbnailAttribute* value = item.ThumbnailAttribute( |
|
1160 aThumbnailAttribute ); |
|
1161 TInt tnError = GlxErrorManager::HasAttributeErrorL( |
|
1162 item.Properties(), KGlxMediaIdThumbnail ); |
|
1163 if(value) |
|
1164 { |
|
1165 searchStatus = KTBAttributeAvailable; |
|
1166 } |
|
1167 else if ( KErrNone != tnError && KErrNotSupported != tnError ) |
|
1168 { |
|
1169 searchStatus = KTBAttributeCorrupt; |
|
1170 } |
|
1171 } |
|
1172 else |
|
1173 { |
|
1174 searchStatus = KTBAttributeUnavailable; |
|
1175 } |
|
1176 return searchStatus; |
|
1177 |
|
1178 } |
|
1179 |
|
1180 // --------------------------------------------------------------------------- |
|
1181 // CheckDetailsAttributes |
|
1182 // --------------------------------------------------------------------------- |
|
1183 // |
|
1184 void GlxMLWrapperPrivate::CheckDetailsAttributes(TInt aItemIndex, const RArray<TMPXAttribute>& aAttributes) |
|
1185 { |
|
1186 qDebug("GlxMLWrapperPrivate::CheckDetailsAttributes"); |
|
1187 |
|
1188 TMPXAttribute titleAttrib(KMPXMediaGeneralComment); |
|
1189 TIdentityRelation< TMPXAttribute > match ( &TMPXAttribute::Match ); |
|
1190 |
|
1191 const TGlxMedia& item = iMediaList->Item(aItemIndex); |
|
1192 |
|
1193 if (KErrNotFound != aAttributes.Find(titleAttrib, match)) |
|
1194 { |
|
1195 qDebug("GlxMLWrapperPrivate::CheckDetailsAttributes TRUE"); |
|
1196 |
|
1197 iMLWrapper->handleDetailsItemAvailable(aItemIndex); |
|
1198 GLX_LOG_INFO1("### GlxMLWrapperPrivate::CheckDetailsAttributes title present %d",aItemIndex); |
|
1199 } |
|
1200 } |
|
1201 |
|
1202 // --------------------------------------------------------------------------- |
|
1203 // GetItemCount |
|
1204 // --------------------------------------------------------------------------- |
|
1205 // |
|
1206 void GlxMLWrapperPrivate::HandleFocusChangedL( NGlxListDefs::TFocusChangeType aType, |
|
1207 TInt aNewIndex, TInt aOldIndex, MGlxMediaList* aList ) |
|
1208 { |
|
1209 Q_UNUSED(aType); |
|
1210 Q_UNUSED(aNewIndex); |
|
1211 Q_UNUSED(aOldIndex); |
|
1212 Q_UNUSED(aList); |
|
1213 } |
|
1214 // --------------------------------------------------------------------------- |
|
1215 // GetItemCount |
|
1216 // --------------------------------------------------------------------------- |
|
1217 // |
|
1218 void GlxMLWrapperPrivate::HandleItemSelectedL(TInt aIndex, TBool aSelected, MGlxMediaList* aList ) |
|
1219 { |
|
1220 Q_UNUSED(aIndex); |
|
1221 Q_UNUSED(aSelected); |
|
1222 Q_UNUSED(aList); |
|
1223 } |
|
1224 // --------------------------------------------------------------------------- |
|
1225 // GetItemCount |
|
1226 // --------------------------------------------------------------------------- |
|
1227 // |
|
1228 void GlxMLWrapperPrivate::HandleMessageL( const CMPXMessage& aMessage, MGlxMediaList* aList ) |
|
1229 { |
|
1230 Q_UNUSED(aMessage); |
|
1231 Q_UNUSED(aList); |
|
1232 } |
|
1233 // --------------------------------------------------------------------------- |
|
1234 // GetItemCount |
|
1235 // --------------------------------------------------------------------------- |
|
1236 // |
|
1237 void GlxMLWrapperPrivate::HandleError( TInt aError ) |
|
1238 { |
|
1239 Q_UNUSED(aError); |
|
1240 GLX_LOG_INFO1("GlxMLWrapperPrivate::HandleError Error %d", aError); |
|
1241 |
|
1242 for ( TInt i = 0; i < iMediaList->Count(); i++ ) |
|
1243 { |
|
1244 const TGlxMedia& item = iMediaList->Item( i ); |
|
1245 TInt thumbnailError = GlxErrorManager::HasAttributeErrorL( |
|
1246 item.Properties(), KGlxMediaIdThumbnail ); |
|
1247 GLX_LOG_INFO1("GlxMLWrapperPrivate::HandleError thumbnailError %d", thumbnailError); |
|
1248 if (thumbnailError) |
|
1249 { |
|
1250 GLX_LOG_INFO1("GlxMLWrapperPrivate::HandleError Index %d", i); |
|
1251 iMLWrapper->handleIconCorrupt(i); |
|
1252 } |
|
1253 } |
|
1254 |
|
1255 |
|
1256 } |
|
1257 // --------------------------------------------------------------------------- |
|
1258 // GetItemCount |
|
1259 // --------------------------------------------------------------------------- |
|
1260 // |
|
1261 /*void GlxMLWrapperPrivate::HandleCommandCompleteL( CMPXCommand* aCommandResult, TInt aError, |
|
1262 MGlxMediaList* aList ) |
|
1263 {}*/ //todo add handle command complete |
|
1264 // --------------------------------------------------------------------------- |
|
1265 // GetItemCount |
|
1266 // --------------------------------------------------------------------------- |
|
1267 // |
|
1268 void GlxMLWrapperPrivate::HandleMediaL( TInt aListIndex, MGlxMediaList* aList ) |
|
1269 { |
|
1270 Q_UNUSED(aListIndex); |
|
1271 Q_UNUSED(aList); |
|
1272 } |
|
1273 // --------------------------------------------------------------------------- |
|
1274 // GetItemCount |
|
1275 // --------------------------------------------------------------------------- |
|
1276 // |
|
1277 void GlxMLWrapperPrivate::HandleItemModifiedL( const RArray<TInt>& aItemIndexes, MGlxMediaList* aList ) |
|
1278 { |
|
1279 Q_UNUSED(aItemIndexes); |
|
1280 Q_UNUSED(aList); |
|
1281 } |
|
1282 |
|
1283 void GlxMLWrapperPrivate::HandlePopulatedL(MGlxMediaList* aList) |
|
1284 { |
|
1285 Q_UNUSED(aList); |
|
1286 iMLWrapper->handlepopulated(); |
|
1287 } |
|
1288 |
|
1289 // --------------------------------------------------------------------------- |
|
1290 // GetItemCount |
|
1291 // --------------------------------------------------------------------------- |
|
1292 // |
|
1293 HbIcon * GlxMLWrapperPrivate::convertFBSBitmapToHbIcon(CFbsBitmap* aBitmap) |
|
1294 { |
|
1295 GLX_LOG_INFO1("### GlxMLWrapperPrivate::convertFBSBitmapToHbIcon %d", 0); |
|
1296 aBitmap->LockHeap(); |
|
1297 TUint32 *tempData = aBitmap->DataAddress(); |
|
1298 uchar *data = (uchar *)(tempData); |
|
1299 int bytesPerLine = aBitmap->ScanLineLength(aBitmap->SizeInPixels().iWidth , aBitmap->DisplayMode()); |
|
1300 //QImage share the memory occupied by data |
|
1301 QImage image(data, aBitmap->SizeInPixels().iWidth, aBitmap->SizeInPixels().iHeight, bytesPerLine, QImage::Format_RGB16); |
|
1302 aBitmap->UnlockHeap(); |
|
1303 HbIcon* targetIcon = new HbIcon( QIcon( QPixmap::fromImage(image) ) ); |
|
1304 return targetIcon; |
|
1305 } |
|
1306 |
|
1307 HbIcon * GlxMLWrapperPrivate::convertFBSBitmapToHbIcon(CFbsBitmap* aBitmap, TInt itemWidth, TInt itemHeight) |
|
1308 { |
|
1309 GLX_LOG_INFO1("### GlxMLWrapperPrivate::convertFBSBitmapToHbIcon 1 %d", 0); |
|
1310 |
|
1311 aBitmap->LockHeap(); |
|
1312 TUint32 *tempData = aBitmap->DataAddress(); |
|
1313 uchar *data = (uchar *)(tempData); |
|
1314 int bytesPerLine = aBitmap->ScanLineLength(aBitmap->SizeInPixels().iWidth , aBitmap->DisplayMode()); |
|
1315 //QImage share the memory occupied by data |
|
1316 QImage image(data, aBitmap->SizeInPixels().iWidth, aBitmap->SizeInPixels().iHeight, bytesPerLine, QImage::Format_RGB16); |
|
1317 |
|
1318 QPixmap pixmap = QPixmap::fromImage(image); |
|
1319 pixmap = pixmap.scaled( itemWidth, itemHeight, Qt::KeepAspectRatio ); |
|
1320 |
|
1321 |
|
1322 aBitmap->UnlockHeap(); |
|
1323 HbIcon* targetIcon = new HbIcon( QIcon( pixmap ) ); |
|
1324 return targetIcon; |
|
1325 } |
|
1326 |
|
1327 // --------------------------------------------------------------------------- |
|
1328 // GetFocusIndex |
|
1329 // --------------------------------------------------------------------------- |
|
1330 // |
|
1331 int GlxMLWrapperPrivate::GetFocusIndex() const |
|
1332 { |
|
1333 return (iMediaList->FocusIndex()); |
|
1334 } |
|
1335 // --------------------------------------------------------------------------- |
|
1336 // GetFocusIndex |
|
1337 // --------------------------------------------------------------------------- |
|
1338 // |
|
1339 void GlxMLWrapperPrivate::SetFocusIndex(int aItemIndex) |
|
1340 { |
|
1341 iMediaList->SetFocusL(NGlxListDefs::EAbsolute,aItemIndex); |
|
1342 } |
|
1343 |
|
1344 // --------------------------------------------------------------------------- |
|
1345 // SetFocusIndex |
|
1346 // --------------------------------------------------------------------------- |
|
1347 // |
|
1348 void GlxMLWrapperPrivate::SetSelectedIndex(int aItemIndex) |
|
1349 { |
|
1350 iMediaList->SetSelectedL(aItemIndex,ETrue); |
|
1351 } |
|
1352 |
|
1353 // --------------------------------------------------------------------------- |
|
1354 // GetVisibleWindowIndex |
|
1355 // --------------------------------------------------------------------------- |
|
1356 // |
|
1357 int GlxMLWrapperPrivate::GetVisibleWindowIndex() |
|
1358 { |
|
1359 return (iMediaList->VisibleWindowIndex()); |
|
1360 } |
|
1361 // --------------------------------------------------------------------------- |
|
1362 // SetVisibleWindowIndex |
|
1363 // --------------------------------------------------------------------------- |
|
1364 // |
|
1365 void GlxMLWrapperPrivate::SetVisibleWindowIndex(int aItemIndex) |
|
1366 { |
|
1367 iMediaList->SetVisibleWindowIndexL(aItemIndex); |
|
1368 } |
|
1369 |
|
1370 // ----------------------------------------------------------------------------- |
|
1371 // HandleTitleAvailableL |
|
1372 // ----------------------------------------------------------------------------- |
|
1373 // |
|
1374 void GlxMLWrapperPrivate::HandleTitleAvailableL( |
|
1375 const TDesC& aTitle) |
|
1376 { |
|
1377 iViewTitle = QString::fromUtf16(aTitle.Ptr(), aTitle.Length()); |
|
1378 iMLWrapper->handleTitleAvailable(iViewTitle); |
|
1379 } |
|
1380 |
|
1381 QString GlxMLWrapperPrivate::RetrieveViewTitle() |
|
1382 { |
|
1383 return iViewTitle; |
|
1384 } |
|
1385 |
|
1386 bool GlxMLWrapperPrivate::IsPopulated() |
|
1387 { |
|
1388 return iMediaList->IsPopulated(); |
|
1389 } |
|
1390 |
|
1391 // --------------------------------------------------------------------------- |
|
1392 // SetDescontextL |
|
1393 // --------------------------------------------------------------------------- |
|
1394 // |
|
1395 void GlxMLWrapperPrivate::SetDescontextL() |
|
1396 { |
|
1397 iDescContext = CGlxDefaultAttributeContext::NewL(); |
|
1398 iDescContext->AddAttributeL( KMPXMediaGeneralComment ); |
|
1399 iMediaList->AddContextL( iDescContext, KGlxFetchContextPriorityLow ); |
|
1400 iDetailsContextActivated = ETrue; |
|
1401 } |
|
1402 |
|
1403 // --------------------------------------------------------------------------- |
|
1404 // RemoveDescContext |
|
1405 // --------------------------------------------------------------------------- |
|
1406 // |
|
1407 void GlxMLWrapperPrivate::RemoveDescContext() |
|
1408 { |
|
1409 if(iDescContext ) |
|
1410 { |
|
1411 iMediaList->RemoveContext(iDescContext); |
|
1412 delete iDescContext; |
|
1413 iDescContext = NULL; |
|
1414 iDetailsContextActivated = EFalse; |
|
1415 } |
|
1416 } |
|
1417 |
|
1418 bool GlxMLWrapperPrivate::IsDrmProtected(int index) |
|
1419 { |
|
1420 TInt itemIndex = index; |
|
1421 if(-1 == itemIndex) |
|
1422 { |
|
1423 itemIndex = iMediaList->FocusIndex(); |
|
1424 } |
|
1425 const TGlxMedia& media = iMediaList->Item(itemIndex); |
|
1426 return media.IsDrmProtected(); |
|
1427 } |
|
1428 |
|
1429 bool GlxMLWrapperPrivate::IsDrmValid(int index) |
|
1430 { |
|
1431 TInt itemIndex = index; |
|
1432 if(-1 == itemIndex) |
|
1433 { |
|
1434 itemIndex = iMediaList->FocusIndex(); |
|
1435 } |
|
1436 |
|
1437 const TGlxMedia& media = iMediaList->Item(itemIndex); |
|
1438 TGlxMediaGeneralRightsValidity isValid = EGlxDrmRightsValidityUnknown; |
|
1439 TBool ret = media.GetDrmValidity(isValid); |
|
1440 if(ret && EGlxDrmRightsValidityUnknown == isValid ) |
|
1441 { |
|
1442 // check rights |
|
1443 TMPXGeneralCategory cat = media.Category(); |
|
1444 const TDesC& uri = media.Uri(); |
|
1445 if ( uri.Length() && cat != EMPXNoCategory ) |
|
1446 { |
|
1447 TBool valid = iDrmUtility->ItemRightsValidityCheckL( uri, ( cat == EMPXImage ) ); |
|
1448 CGlxMedia* properties = const_cast<CGlxMedia*>(media.Properties()); |
|
1449 if( valid ) |
|
1450 { |
|
1451 |
|
1452 isValid = EGlxDrmRightsValid; |
|
1453 } |
|
1454 else |
|
1455 { |
|
1456 |
|
1457 isValid = EGlxDrmRightsInvalid; |
|
1458 } |
|
1459 properties->SetTObjectValueL(KGlxMediaGeneralDRMRightsValid, isValid); |
|
1460 } |
|
1461 } |
|
1462 return ( EGlxDrmRightsValid == isValid ); |
|
1463 } |
|
1464 |
|
1465 void GlxMLWrapperPrivate::setDrmValid(int index,bool valid) |
|
1466 { |
|
1467 const TGlxMedia& media = iMediaList->Item(index); |
|
1468 CGlxMedia* properties = const_cast<CGlxMedia*>(media.Properties()); |
|
1469 if(valid) |
|
1470 { |
|
1471 properties->SetTObjectValueL(KGlxMediaGeneralDRMRightsValid, EGlxDrmRightsValid); |
|
1472 } |
|
1473 else |
|
1474 { |
|
1475 properties->SetTObjectValueL(KGlxMediaGeneralDRMRightsValid, EGlxDrmRightsInvalid); |
|
1476 } |
|
1477 } |
|
1478 |
|
1479 bool GlxMLWrapperPrivate::IsCorruptedImage( int aItemIndex ) |
|
1480 { |
|
1481 const TGlxMedia& item = iMediaList->Item( aItemIndex ); |
|
1482 qDebug("GlxMLWrapperPrivate::IsCorruptedImage item property %u ", item.Properties() ); |
|
1483 TInt tnError = GlxErrorManager::HasAttributeErrorL( item.Properties(), KGlxMediaIdThumbnail ); |
|
1484 qDebug("GlxMLWrapperPrivate::IsCorruptedImage index %d error %d ", aItemIndex, tnError); |
|
1485 if ( KErrNone == tnError |
|
1486 || KErrNotSupported == tnError |
|
1487 || KErrCANoRights == tnError |
|
1488 || KErrGlxEmptyContainer == tnError ) { |
|
1489 return false ; |
|
1490 } |
|
1491 else { |
|
1492 return true ; |
|
1493 } |
|
1494 } |