22 #include <ganes/HgItem.h> |
22 #include <ganes/HgItem.h> |
23 #include <ganes/HgGrid.h> //Hg Grid Widget |
23 #include <ganes/HgGrid.h> //Hg Grid Widget |
24 //#include <hg/hgcontextutility.h> |
24 //#include <hg/hgcontextutility.h> |
25 #include <gulicon.h> |
25 #include <gulicon.h> |
26 |
26 |
27 //Gallery Headers |
27 //Photos Headers |
28 #include <glxtracer.h> // For Tracer |
28 #include <glxtracer.h> // For Tracer |
29 #include <glxlog.h> // For Glx Logging |
29 #include <glxlog.h> // For Glx Logging |
30 #include <glxuiutility.h> // For UiUtility instance |
30 #include <glxuiutility.h> // For UiUtility instance |
31 #include <glxicons.mbg> // For Corrupted and not created icons |
31 #include <glxicons.mbg> // For Corrupted and not created icons |
32 #include <glxerrormanager.h> // For CGlxErrormanager |
32 #include <glxerrormanager.h> // For CGlxErrormanager |
35 #include <glxthumbnailattributeinfo.h> // KGlxMediaIdThumbnail |
35 #include <glxthumbnailattributeinfo.h> // KGlxMediaIdThumbnail |
36 #include <glxdrmutility.h> // DRM utility class to provide DRM-related functionality |
36 #include <glxdrmutility.h> // DRM utility class to provide DRM-related functionality |
37 #include <mpxmediadrmdefs.h> // KMPXMediaDrmProtected |
37 #include <mpxmediadrmdefs.h> // KMPXMediaDrmProtected |
38 #include <glxcollectionplugindownloads.hrh> |
38 #include <glxcollectionplugindownloads.hrh> |
39 #include <glxgridviewdata.rsg> // Gridview resource |
39 #include <glxgridviewdata.rsg> // Gridview resource |
|
40 #include <glxgeneraluiutilities.h> |
40 |
41 |
41 // Framework |
42 // Framework |
42 #include <data_caging_path_literals.hrh> |
43 #include <data_caging_path_literals.hrh> |
43 #include <StringLoader.h> |
44 #include <StringLoader.h> |
44 |
|
45 #include <bldvariant.hrh> // For feature constants |
45 #include <bldvariant.hrh> // For feature constants |
46 #include <featmgr.h> // Feature Manager |
46 #include <featmgr.h> // Feature Manager |
47 #include <caf/caferr.h> |
47 #include <caf/caferr.h> |
48 #include <AknUtils.h> |
48 #include <AknUtils.h> |
49 |
49 |
57 // --------------------------------------------------------------------------- |
57 // --------------------------------------------------------------------------- |
58 // |
58 // |
59 EXPORT_C CGlxGridViewMLObserver* CGlxGridViewMLObserver::NewL( |
59 EXPORT_C CGlxGridViewMLObserver* CGlxGridViewMLObserver::NewL( |
60 MGlxMediaList& aMediaList, CHgGrid* aHgGrid) |
60 MGlxMediaList& aMediaList, CHgGrid* aHgGrid) |
61 { |
61 { |
62 TRACER("CGlxGridViewMLObserver::NewLC()"); |
62 TRACER("CGlxGridViewMLObserver::NewL()"); |
63 CGlxGridViewMLObserver* self = |
63 CGlxGridViewMLObserver* self = |
64 new (ELeave) CGlxGridViewMLObserver(aMediaList, aHgGrid); |
64 new (ELeave) CGlxGridViewMLObserver(aMediaList, aHgGrid); |
65 CleanupStack::PushL(self); |
65 CleanupStack::PushL(self); |
66 self->ConstructL(); |
66 self->ConstructL(); |
67 CleanupStack::Pop(self); |
67 CleanupStack::Pop(self); |
73 // --------------------------------------------------------------------------- |
73 // --------------------------------------------------------------------------- |
74 // |
74 // |
75 CGlxGridViewMLObserver::CGlxGridViewMLObserver(MGlxMediaList& aMediaList, |
75 CGlxGridViewMLObserver::CGlxGridViewMLObserver(MGlxMediaList& aMediaList, |
76 CHgGrid* aHgGrid ) : iMediaList(aMediaList), iHgGrid(aHgGrid) |
76 CHgGrid* aHgGrid ) : iMediaList(aMediaList), iHgGrid(aHgGrid) |
77 { |
77 { |
78 TRACER("CGlxGridViewMLObserver::CGlxGridViewMLObserver"); |
78 TRACER("CGlxGridViewMLObserver::CGlxGridViewMLObserver()"); |
79 } |
79 } |
80 |
80 |
81 // --------------------------------------------------------------------------- |
81 // --------------------------------------------------------------------------- |
82 // Symbian 2nd phase constructor can leave. |
82 // Symbian 2nd phase constructor can leave. |
83 // --------------------------------------------------------------------------- |
83 // --------------------------------------------------------------------------- |
84 // |
84 // |
85 void CGlxGridViewMLObserver::ConstructL() |
85 void CGlxGridViewMLObserver::ConstructL() |
86 { |
86 { |
87 TRACER("CGlxGridViewMLObserver::ConstructL"); |
87 TRACER("CGlxGridViewMLObserver::ConstructL()"); |
88 iMediaList.AddMediaListObserverL(this); |
88 iMediaList.AddMediaListObserverL(this); |
89 // For DRm Utility |
89 // For DRm Utility |
90 iDRMUtility = CGlxDRMUtility::InstanceL(); |
90 iDRMUtility = CGlxDRMUtility::InstanceL(); |
91 |
91 |
92 CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); |
92 CGlxUiUtility* uiUtility = CGlxUiUtility::UtilityL(); |
101 iGridIconSize.iHeight ) ); |
101 iGridIconSize.iHeight ) ); |
102 |
102 |
103 iSpeedTnAttrib = TMPXAttribute (KGlxMediaIdThumbnail, |
103 iSpeedTnAttrib = TMPXAttribute (KGlxMediaIdThumbnail, |
104 GlxFullThumbnailAttributeId( EFalse, iGridIconSize.iWidth, |
104 GlxFullThumbnailAttributeId( EFalse, iGridIconSize.iWidth, |
105 iGridIconSize.iHeight ) ); |
105 iGridIconSize.iHeight ) ); |
|
106 |
|
107 iDiskErrorIntimated = EFalse ; |
106 } |
108 } |
107 |
109 |
108 // --------------------------------------------------------------------------- |
110 // --------------------------------------------------------------------------- |
109 // Destructor |
111 // Destructor |
110 // --------------------------------------------------------------------------- |
112 // --------------------------------------------------------------------------- |
111 // |
113 // |
112 CGlxGridViewMLObserver::~CGlxGridViewMLObserver() |
114 CGlxGridViewMLObserver::~CGlxGridViewMLObserver() |
113 { |
115 { |
114 TRACER("CGlxGridViewMLObserver::~CGlxGridViewMLObserver"); |
116 TRACER("CGlxGridViewMLObserver::~CGlxGridViewMLObserver()"); |
115 iMediaList.RemoveMediaListObserver( this ); |
117 iMediaList.RemoveMediaListObserver( this ); |
116 if (iDRMUtility) |
118 if (iDRMUtility) |
117 { |
119 { |
118 iDRMUtility->Close(); |
120 iDRMUtility->Close(); |
119 } |
121 } |
287 // ---------------------------------------------------------------------------- |
289 // ---------------------------------------------------------------------------- |
288 // |
290 // |
289 void CGlxGridViewMLObserver::HandleItemSelectedL(TInt /*aIndex*/, |
291 void CGlxGridViewMLObserver::HandleItemSelectedL(TInt /*aIndex*/, |
290 TBool /*aSelected*/, MGlxMediaList* /*aList*/ ) |
292 TBool /*aSelected*/, MGlxMediaList* /*aList*/ ) |
291 { |
293 { |
292 TRACER("CGlxGridViewMLObserver::HandleItemSelectedL"); |
294 TRACER("CGlxGridViewMLObserver::HandleItemSelectedL()"); |
293 } |
295 } |
294 |
296 |
295 // ---------------------------------------------------------------------------- |
297 // ---------------------------------------------------------------------------- |
296 // HandleMessageL |
298 // HandleMessageL |
297 // ---------------------------------------------------------------------------- |
299 // ---------------------------------------------------------------------------- |
317 // ---------------------------------------------------------------------------- |
319 // ---------------------------------------------------------------------------- |
318 // |
320 // |
319 void CGlxGridViewMLObserver::HandleErrorL() |
321 void CGlxGridViewMLObserver::HandleErrorL() |
320 { |
322 { |
321 TRACER("CGlxGridViewMLObserver::HandleErrorL()"); |
323 TRACER("CGlxGridViewMLObserver::HandleErrorL()"); |
|
324 |
|
325 TInt bitmapId = EMbmGlxiconsQgn_prop_image_notcreated; |
|
326 TInt flags = CHgItem::EHgItemFlagsNone ; |
|
327 |
322 for ( TInt i = 0; i < iMediaList.Count(); i++ ) |
328 for ( TInt i = 0; i < iMediaList.Count(); i++ ) |
323 { |
329 { |
324 const TGlxMedia& item = iMediaList.Item( i ); |
330 const TGlxMedia& item = iMediaList.Item( i ); |
325 TInt thumbnailError = GlxErrorManager::HasAttributeErrorL( |
331 TInt thumbnailError = GlxErrorManager::HasAttributeErrorL( |
326 item.Properties(), KGlxMediaIdThumbnail ); |
332 item.Properties(), KGlxMediaIdThumbnail ); |
327 |
333 |
328 if( thumbnailError== KErrCANoRights) |
334 if (KErrNone != thumbnailError) |
329 { |
335 { |
330 /*fix for EABI-7RKHDG |
336 switch (thumbnailError) |
331 * this is a safe code added to show default |
337 { |
332 * TNM returns -17452 in case SD DRM files |
338 case KErrCANoRights:; // Err id = -17452 |
333 */ |
339 bitmapId = EMbmGlxiconsQgn_prop_image_notcreated; |
334 TFileName resFile(KDC_APP_BITMAP_DIR); |
340 flags = CHgItem::EHgItemFlagsDrmRightsExpired; |
335 resFile.Append(KGlxIconsFilename); |
341 break; |
336 CFbsBitmap* bitmap = AknIconUtils::CreateIconL(resFile, |
342 case KErrDiskFull: |
337 EMbmGlxiconsQgn_prop_image_notcreated); |
343 bitmapId = EMbmGlxiconsQgn_prop_image_notcreated; |
338 AknIconUtils::SetSize(bitmap, CHgGrid::PreferredImageSize()); |
344 flags = CHgItem::EHgItemFlagsNone ; |
339 iHgGrid->ItemL(i).SetIcon(CGulIcon::NewL(bitmap), |
345 if (!iDiskErrorIntimated) |
340 CHgItem::EHgItemFlagsDrmRightsExpired); |
346 { |
341 } |
347 DisplayErrorNote(KErrDiskFull); |
342 else if (thumbnailError) |
348 } |
343 { |
349 break; |
|
350 default: |
|
351 bitmapId = EMbmGlxiconsQgn_prop_image_corrupted; |
|
352 flags = CHgItem::EHgItemFlagsNone ; |
|
353 break; |
|
354 } |
|
355 |
344 TFileName resFile(KDC_APP_BITMAP_DIR); |
356 TFileName resFile(KDC_APP_BITMAP_DIR); |
345 resFile.Append(KGlxIconsFilename); |
357 resFile.Append(KGlxIconsFilename); |
346 |
358 |
347 CFbsBitmap* bitmap = AknIconUtils::CreateIconL(resFile, |
359 CFbsBitmap* bitmap = AknIconUtils::CreateIconL(resFile, bitmapId); |
348 EMbmGlxiconsQgn_prop_image_corrupted); |
|
349 |
|
350 //@ Fix for EABI-7RJA8C, Changes for HG grid for corrupted icon. |
|
351 AknIconUtils::SetSize(bitmap, CHgGrid::PreferredImageSize() ); |
360 AknIconUtils::SetSize(bitmap, CHgGrid::PreferredImageSize() ); |
352 |
361 |
353 iHgGrid->ItemL(i).SetIcon(CGulIcon::NewL(bitmap), |
362 iHgGrid->ItemL(i).SetIcon(CGulIcon::NewL(bitmap), flags); |
354 CHgItem::EHgItemFlagsNone); |
|
355 } |
363 } |
356 } |
364 } |
357 iHgGrid->RefreshScreen(iHgGrid->FirstIndexOnScreen()); |
365 iHgGrid->RefreshScreen(iHgGrid->FirstIndexOnScreen()); |
358 } |
366 } |
359 // ---------------------------------------------------------------------------- |
367 // ---------------------------------------------------------------------------- |
441 // ---------------------------------------------------------------------------- |
449 // ---------------------------------------------------------------------------- |
442 // |
450 // |
443 void CGlxGridViewMLObserver::RefreshScreen(TInt aItemIndex, |
451 void CGlxGridViewMLObserver::RefreshScreen(TInt aItemIndex, |
444 const RArray<TMPXAttribute>& aAttributes) |
452 const RArray<TMPXAttribute>& aAttributes) |
445 { |
453 { |
|
454 TRACER("CGlxGridViewMLObserver::RefreshScreen()"); |
446 TInt mediaCount = iMediaList.Count(); |
455 TInt mediaCount = iMediaList.Count(); |
447 TInt firstIndex = iHgGrid->FirstIndexOnScreen(); |
456 TInt firstIndex = iHgGrid->FirstIndexOnScreen(); |
448 firstIndex = (firstIndex<0 ? 0 : firstIndex); |
457 firstIndex = (firstIndex<0 ? 0 : firstIndex); |
449 TInt lastOnScreen = firstIndex + iHgGrid->ItemsOnScreen() - 1; |
458 TInt lastOnScreen = firstIndex + iHgGrid->ItemsOnScreen() - 1; |
450 lastOnScreen = (lastOnScreen >mediaCount-1? mediaCount-1:lastOnScreen); |
459 lastOnScreen = (lastOnScreen >mediaCount-1? mediaCount-1:lastOnScreen); |
509 |
518 |
510 // ---------------------------------------------------------------------------- |
519 // ---------------------------------------------------------------------------- |
511 // UpdateItemsL |
520 // UpdateItemsL |
512 // ---------------------------------------------------------------------------- |
521 // ---------------------------------------------------------------------------- |
513 // |
522 // |
514 void CGlxGridViewMLObserver::UpdateItemsL (TInt aItemIndex, |
523 void CGlxGridViewMLObserver::UpdateItemsL(TInt aItemIndex, |
515 const RArray<TMPXAttribute>& aAttributes) |
524 const RArray<TMPXAttribute>& aAttributes) |
516 { |
525 { |
|
526 TRACER("CGlxGridViewMLObserver::UpdateItemsL()"); |
517 TInt mediaCount = iMediaList.Count(); |
527 TInt mediaCount = iMediaList.Count(); |
518 const TGlxMedia& item = iMediaList.Item( aItemIndex ); |
528 const TGlxMedia& item = iMediaList.Item( aItemIndex ); |
519 TIdentityRelation< TMPXAttribute > match ( &TMPXAttribute::Match ); |
529 TIdentityRelation< TMPXAttribute > match ( &TMPXAttribute::Match ); |
520 |
530 |
521 if (aAttributes.Find(KMPXMediaDrmProtected, match) != KErrNotFound) |
531 if (aAttributes.Find(KMPXMediaDrmProtected, match) != KErrNotFound) |