38 #include <glxlog.h> //Glx Logs |
38 #include <glxlog.h> //Glx Logs |
39 #include <glxlistviewplugin.rsg> |
39 #include <glxlistviewplugin.rsg> |
40 #include <aknViewAppUi.h> |
40 #include <aknViewAppUi.h> |
41 #include <StringLoader.h> //StringLoader |
41 #include <StringLoader.h> //StringLoader |
42 #include <glxsetappstate.h> |
42 #include <glxsetappstate.h> |
|
43 #include <mglxcache.h> |
|
44 #include <glxerrormanager.h> // For CGlxErrormanager |
|
45 #include <glxthumbnailcontext.h> |
43 #include <glxthumbnailattributeinfo.h> |
46 #include <glxthumbnailattributeinfo.h> |
44 #include <glxcollectionpluginalbums.hrh> |
47 #include <glxcollectionpluginalbums.hrh> |
45 #include <glxcollectionpluginmonths.hrh> |
48 #include <glxcollectionpluginmonths.hrh> |
46 #include <glxcollectionplugintype.hrh> |
49 #include <glxcollectionplugintype.hrh> |
47 #include <glxnavigationalstate.h> |
50 #include <glxnavigationalstate.h> |
48 |
51 |
49 #include <AknTransEffect.h> // For transition effects |
52 #include <akntranseffect.h> // For transition effects |
50 #include <GfxTransEffect/GfxTransEffect.h> // For transition effects |
53 #include <gfxtranseffect/gfxtranseffect.h> // For transition effects |
51 #include "glxgfxtranseffect.h" // For transition effects |
54 #include "glxgfxtranseffect.h" // For transition effects |
52 |
55 |
53 const TInt KListDataWindowSize(25); |
56 const TInt KListDataWindowSize(16); |
54 const TInt KNoOfPages(2); |
57 const TInt KNoOfPages(4); |
55 const TInt KBufferTresholdSize(6); |
|
56 const TInt KGlxCollectionRootLevel = 1; |
58 const TInt KGlxCollectionRootLevel = 1; |
57 |
59 |
58 |
60 |
59 // ======== MEMBER FUNCTIONS ======== |
61 // ======== MEMBER FUNCTIONS ======== |
60 |
62 |
213 } |
218 } |
214 |
219 |
215 GlxSetAppState::SetState(EGlxInListView); |
220 GlxSetAppState::SetState(EGlxInListView); |
216 |
221 |
217 // Separate contexts so that some attributes are loaded before others |
222 // Separate contexts so that some attributes are loaded before others |
218 iTitleAttributeContext = CGlxDefaultAttributeContext::NewL(); |
223 iThumbnailIterator.SetRangeOffsets(KListDataWindowSize, |
219 iTitleAttributeContext->SetRangeOffsets( KListDataWindowSize, |
224 KListDataWindowSize); |
220 KListDataWindowSize ); |
225 iTitleAttributeContext = new (ELeave) CGlxAttributeContext( |
221 iTitleAttributeContext->AddAttributeL( KMPXMediaGeneralTitle ); |
226 &iThumbnailIterator); |
222 |
227 iTitleAttributeContext->AddAttributeL(KMPXMediaGeneralTitle); |
223 iSubtitleAttributeContext = CGlxDefaultAttributeContext::NewL(); |
228 |
224 iSubtitleAttributeContext->SetRangeOffsets( KListDataWindowSize, |
229 iSubtitleAttributeContext = new (ELeave) CGlxAttributeContext( |
225 KListDataWindowSize ); |
230 &iThumbnailIterator); |
226 iSubtitleAttributeContext->AddAttributeL( |
231 iSubtitleAttributeContext->AddAttributeL( |
227 KGlxMediaCollectionPluginSpecificSubTitle ); |
232 KGlxMediaCollectionPluginSpecificSubTitle); |
228 |
233 |
229 iMediaList->AddContextL( iTitleAttributeContext, KMaxTInt ); |
234 iMediaList->AddContextL(iTitleAttributeContext, KMaxTInt); |
230 iMediaList->AddContextL( iSubtitleAttributeContext, KMaxTInt ); |
235 iMediaList->AddContextL(iSubtitleAttributeContext, KMaxTInt); |
231 |
236 if (iMediaList->IdSpaceId(0) != KGlxIdSpaceIdRoot) |
232 iMediaList->AddMediaListObserverL(this); |
237 { |
|
238 iThumbnailContext = new (ELeave) CGlxAttributeContext( |
|
239 &iThumbnailIterator); |
|
240 TMPXAttribute tnAttr(KGlxMediaIdThumbnail, |
|
241 GlxFullThumbnailAttributeId(ETrue, iGridIconSize.iWidth, |
|
242 iGridIconSize.iHeight)); |
|
243 iThumbnailContext->SetDefaultSpec(iGridIconSize.iWidth, |
|
244 iGridIconSize.iHeight); |
|
245 iThumbnailContext->AddAttributeL(tnAttr); |
|
246 iMediaList->AddContextL(iThumbnailContext, |
|
247 KGlxFetchContextPriorityNormal); |
|
248 } |
|
249 |
|
250 iMediaList->AddMediaListObserverL(this); |
233 TRect apRect = iEikonEnv->EikAppUi()->ApplicationRect(); |
251 TRect apRect = iEikonEnv->EikAppUi()->ApplicationRect(); |
234 iBgContext = CAknsBasicBackgroundControlContext::NewL( |
252 iBgContext = CAknsBasicBackgroundControlContext::NewL( |
235 KAknsIIDQsnBgScreen,apRect,ETrue); |
253 KAknsIIDQsnBgScreen,apRect,ETrue); |
236 |
254 |
237 if(iUiUtility->ViewNavigationDirection() == EGlxNavigationBackwards ) |
255 if(iUiUtility->ViewNavigationDirection() == EGlxNavigationBackwards ) |
239 iBackwardNavigation = ETrue; |
257 iBackwardNavigation = ETrue; |
240 } |
258 } |
241 |
259 |
242 iPreviewTNBinding = CGlxPreviewThumbnailBinding::NewL(*this); |
260 iPreviewTNBinding = CGlxPreviewThumbnailBinding::NewL(*this); |
243 CreateListL(); |
261 CreateListL(); |
244 if (iPreviewTNBinding && iBackwardNavigation && iMediaList->FocusIndex() |
262 if (iMediaList->IdSpaceId(0) == KGlxIdSpaceIdRoot && iPreviewTNBinding |
245 == 0) |
263 && iBackwardNavigation && iMediaList->FocusIndex() == 0) |
246 { |
264 { |
247 GLX_LOG_INFO("CGlxListViewImp::DoMLViewActivateL() - HandleItemChangedL()"); |
265 GLX_LOG_INFO("CGlxListViewImp::DoMLViewActivateL() - HandleItemChangedL()"); |
248 iPopulateListTNs = ETrue; |
266 iPopulateListTNs = ETrue; |
249 CMPXCollectionPath* path = iMediaList->PathLC( |
267 CMPXCollectionPath* path = iMediaList->PathLC( |
250 NGlxListDefs::EPathFocusOrSelection); |
268 NGlxListDefs::EPathFocusOrSelection); |
251 iPreviewTNBinding->HandleItemChangedL(*path, iPopulateListTNs, |
269 iPreviewTNBinding->HandleItemChangedL(*path, iPopulateListTNs, |
252 iIsRefreshNeeded, iBackwardNavigation); |
270 iIsRefreshNeeded, iBackwardNavigation); |
253 CleanupStack::PopAndDestroy(path); |
271 CleanupStack::PopAndDestroy(path); |
254 } |
272 } |
255 iProgressIndicator = CGlxProgressIndicator::NewL(*this); |
273 iProgressIndicator = CGlxProgressIndicator::NewL(*this); |
|
274 iProgressIndicator->ShowProgressbarL(); |
256 } |
275 } |
257 |
276 |
258 // --------------------------------------------------------------------------- |
277 // --------------------------------------------------------------------------- |
259 // From CAknView |
278 // From CAknView |
260 // View deactivation function. |
279 // View deactivation function. |
281 iTitleAttributeContext = NULL; |
300 iTitleAttributeContext = NULL; |
282 |
301 |
283 iMediaList->RemoveContext( iSubtitleAttributeContext ); |
302 iMediaList->RemoveContext( iSubtitleAttributeContext ); |
284 delete iSubtitleAttributeContext; |
303 delete iSubtitleAttributeContext; |
285 iSubtitleAttributeContext = NULL; |
304 iSubtitleAttributeContext = NULL; |
286 |
305 if (iMediaList->IdSpaceId(0) != KGlxIdSpaceIdRoot) |
|
306 { |
|
307 iMediaList->RemoveContext(iThumbnailContext); |
|
308 delete iThumbnailContext; |
|
309 iThumbnailContext = NULL; |
|
310 } |
287 iMediaList->RemoveMediaListObserver( this ); |
311 iMediaList->RemoveMediaListObserver( this ); |
288 delete iPreviewTNBinding; |
312 delete iPreviewTNBinding; |
289 iPreviewTNBinding = NULL; |
313 iPreviewTNBinding = NULL; |
290 DestroyListViewWidget(); |
314 DestroyListViewWidget(); |
291 #ifndef __WINSCW__ |
|
292 if(iProgressIndicator) |
315 if(iProgressIndicator) |
293 { |
316 { |
294 delete iProgressIndicator; |
317 delete iProgressIndicator; |
295 iProgressIndicator = NULL; |
318 iProgressIndicator = NULL; |
296 } |
319 } |
297 #endif |
|
298 } |
320 } |
299 |
321 |
300 // --------------------------------------------------------------------------- |
322 // --------------------------------------------------------------------------- |
301 // Destroys the Widget |
323 // Destroys the Widget |
302 // --------------------------------------------------------------------------- |
324 // --------------------------------------------------------------------------- |
419 for (TInt i=aRequestStart; i<= aRequestEnd; i++) |
441 for (TInt i=aRequestStart; i<= aRequestEnd; i++) |
420 { |
442 { |
421 const TGlxMedia& item = iMediaList->Item(i); |
443 const TGlxMedia& item = iMediaList->Item(i); |
422 iList->ItemL(i).SetTitleL(item.Title()); |
444 iList->ItemL(i).SetTitleL(item.Title()); |
423 iList->ItemL(i).SetTextL(item.SubTitle()); |
445 iList->ItemL(i).SetTextL(item.SubTitle()); |
|
446 UpdatePreviewL(i); |
|
447 iList->RefreshScreen(i); |
424 } |
448 } |
425 |
449 |
426 iList->RefreshScreen(visIndex); |
450 iList->RefreshScreen(visIndex); |
427 |
451 if(iMediaList->IdSpaceId(0) == KGlxIdSpaceIdRoot) |
428 if ( visIndex != iLastFocusedIndex && !iPopulateListTNs) |
452 { |
429 { |
453 if ( visIndex != iLastFocusedIndex && !iPopulateListTNs) |
430 GLX_LOG_INFO1("CGlxListViewImp::RequestL - SetFocusL()" |
454 { |
431 " iPopulateListTNs(%d)", iPopulateListTNs); |
455 GLX_LOG_INFO1("CGlxListViewImp::RequestL - SetFocusL()" |
432 GLX_LOG_INFO1("CGlxListViewImp::RequestL - SetFocusL()" |
456 " iPopulateListTNs(%d)", iPopulateListTNs); |
433 " visIndex(%d)", visIndex); |
457 GLX_LOG_INFO1("CGlxListViewImp::RequestL - SetFocusL()" |
434 iPopulateListTNs = ETrue; |
458 " visIndex(%d)", visIndex); |
435 iStartIndex = KErrNotFound; |
459 iPopulateListTNs = ETrue; |
|
460 iStartIndex = KErrNotFound; |
|
461 iMediaList->SetFocusL(NGlxListDefs::EAbsolute, visIndex); |
|
462 } |
|
463 } |
|
464 else |
|
465 { |
436 iMediaList->SetFocusL(NGlxListDefs::EAbsolute, visIndex); |
466 iMediaList->SetFocusL(NGlxListDefs::EAbsolute, visIndex); |
437 } |
467 } |
438 } |
468 } |
439 |
469 |
440 |
470 |
456 void CGlxListViewImp::HandleOpenL( TInt aIndex ) |
486 void CGlxListViewImp::HandleOpenL( TInt aIndex ) |
457 { |
487 { |
458 TRACER("CGlxListViewImp::HandleOpenL"); |
488 TRACER("CGlxListViewImp::HandleOpenL"); |
459 |
489 |
460 #ifndef __WINSCW__ |
490 #ifndef __WINSCW__ |
461 TInt leftVariable = 0; |
491 GLX_LOG_INFO1("CGlxListViewImp RProperty::Get leftVariable %d",(iUiUtility->GetItemsLeftCount())); |
462 TRAPD(err,leftVariable = iUiUtility->GetItemsLeftCountL()); |
492 |
463 GLX_LOG_INFO1("CGlxListViewImp RProperty::Get leftVariable %d",leftVariable); |
493 if (iUiUtility->GetItemsLeftCount()) |
464 isTnGenerationComplete = (leftVariable)?EFalse:ETrue; |
494 { |
465 GLX_LOG_INFO1("CGlxListViewImp isTnGenerationComplete %d",isTnGenerationComplete); |
495 if(!iProgressIndicator) |
466 if(err != KErrNone) |
496 { |
467 { |
497 iProgressIndicator = CGlxProgressIndicator::NewL(*this); |
468 GLX_LOG_INFO1("CGlxListViewImp RProperty::Get errorcode %d",err); |
498 } |
469 } |
499 iProgressIndicator->ShowProgressbarL(); |
470 if(!isTnGenerationComplete) |
|
471 { |
|
472 if(iProgressIndicator) |
|
473 { |
|
474 delete iProgressIndicator; |
|
475 iProgressIndicator = NULL; |
|
476 } |
|
477 iProgressIndicator = CGlxProgressIndicator::NewL(*this); |
|
478 if(iSchedulerWait) |
500 if(iSchedulerWait) |
479 { |
501 { |
480 delete iSchedulerWait; |
502 delete iSchedulerWait; |
481 iSchedulerWait = NULL; |
503 iSchedulerWait = NULL; |
482 } |
504 } |
483 iSchedulerWait = new (ELeave) CActiveSchedulerWait(); |
505 iSchedulerWait = new (ELeave) CActiveSchedulerWait(); |
484 iSchedulerWait->Start(); |
506 iSchedulerWait->Start(); |
485 } |
507 } |
486 #endif |
508 #endif |
487 if( iNextViewActivationEnabled && ( aIndex >= 0 && aIndex < |
509 if (iNextViewActivationEnabled && (aIndex >= 0 && aIndex |
488 iMediaList->Count()) && isTnGenerationComplete ) |
510 < iMediaList->Count()) && (iUiUtility->GetItemsLeftCount() == 0)) |
489 { |
511 { |
490 //Delete the PreviewTNMBinding as in forward navigation |
512 //Delete the PreviewTNMBinding as in forward navigation |
491 //we do not get the medialist callback. |
513 //we do not get the medialist callback. |
492 delete iPreviewTNBinding; |
514 delete iPreviewTNBinding; |
493 iPreviewTNBinding = NULL; |
515 iPreviewTNBinding = NULL; |
494 |
516 |
495 iMediaList->SetFocusL(NGlxListDefs::EAbsolute,aIndex); |
517 iMediaList->SetFocusL(NGlxListDefs::EAbsolute,aIndex); |
496 iLastFocusedIndex = iMediaList->FocusIndex(); |
518 iLastFocusedIndex = iMediaList->FocusIndex(); |
497 iNextViewActivationEnabled = EFalse; |
519 iNextViewActivationEnabled = EFalse; |
498 iUiUtility->SetViewNavigationDirection(EGlxNavigationForwards); |
520 iUiUtility->SetViewNavigationDirection(EGlxNavigationForwards); |
499 //Navigate to the next view |
521 //Navigate to the next view |
500 CMPXCollectionPath* path = |
522 CMPXCollectionPath* path = iMediaList->PathLC( |
501 iMediaList->PathLC( NGlxListDefs::EPathFocusOrSelection ); |
523 NGlxListDefs::EPathFocusOrSelection); |
502 iCollectionUtility->Collection().OpenL(*path); |
524 iCollectionUtility->Collection().OpenL(*path); |
503 CleanupStack::PopAndDestroy(path); |
525 CleanupStack::PopAndDestroy(path); |
504 |
|
505 } |
526 } |
506 } |
527 } |
507 |
528 |
508 void CGlxListViewImp::PreviewTNReadyL(CFbsBitmap* aBitmap, CFbsBitmap* |
529 void CGlxListViewImp::PreviewTNReadyL(CFbsBitmap* aBitmap, CFbsBitmap* |
509 /*aMask*/) |
530 /*aMask*/) |
606 * So we have to explicitly start the timer of 2 seconds after populating the list |
627 * So we have to explicitly start the timer of 2 seconds after populating the list |
607 * TN's ie., after gettting the first thumbnail. |
628 * TN's ie., after gettting the first thumbnail. |
608 * The callback is not given because the setfocus index is same as the focused index |
629 * The callback is not given because the setfocus index is same as the focused index |
609 * in medialist. |
630 * in medialist. |
610 */ |
631 */ |
611 if(count==1) |
632 if(count==1 ) |
612 { |
633 { |
613 CMPXCollectionPath* path = iMediaList->PathLC( |
634 if(id == KGlxIdSpaceIdRoot ) |
614 NGlxListDefs::EPathFocusOrSelection ); |
635 { |
615 GLX_LOG_INFO("CGlxListViewImp::PreviewTNReadyL() - HandleItemChangedL()"); |
636 CMPXCollectionPath* path = iMediaList->PathLC( |
616 iPreviewTNBinding->HandleItemChangedL(*path, |
637 NGlxListDefs::EPathFocusOrSelection ); |
617 iPopulateListTNs, iIsRefreshNeeded, iBackwardNavigation); |
638 GLX_LOG_INFO("CGlxListViewImp::PreviewTNReadyL() - HandleItemChangedL()"); |
618 CleanupStack::PopAndDestroy( path ); |
639 iPreviewTNBinding->HandleItemChangedL(*path, |
|
640 iPopulateListTNs, iIsRefreshNeeded, iBackwardNavigation); |
|
641 CleanupStack::PopAndDestroy( path ); |
|
642 } |
619 } |
643 } |
620 } |
644 } |
621 } |
645 } |
622 } |
646 } |
623 } |
647 } |
637 if (!iList) |
661 if (!iList) |
638 { |
662 { |
639 TFileName resFile(KDC_APP_BITMAP_DIR); |
663 TFileName resFile(KDC_APP_BITMAP_DIR); |
640 resFile.Append(KGlxIconsFilename); |
664 resFile.Append(KGlxIconsFilename); |
641 |
665 |
642 CFbsBitmap* bitmap; |
666 CFbsBitmap* bitmap = NULL; |
643 CMPXCollectionPath* path = iMediaList->PathLC( NGlxListDefs::EPathParent ); |
667 CFbsBitmap* mask = NULL; |
|
668 TInt bitmapId = 0; |
|
669 TInt maskId = 0; |
|
670 CMPXCollectionPath* path = iMediaList->PathLC( |
|
671 NGlxListDefs::EPathParent); |
644 if (path->Id() == KGlxCollectionPluginAlbumsImplementationUid) |
672 if (path->Id() == KGlxCollectionPluginAlbumsImplementationUid) |
645 { |
673 { |
646 bitmap = AknIconUtils::CreateIconL(resFile, |
674 bitmapId = EMbmGlxiconsQgn_prop_photo_album_large; |
647 EMbmGlxiconsQgn_prop_photo_album_large); |
675 maskId = EMbmGlxiconsQgn_prop_photo_album_large_mask; |
648 AknIconUtils::SetSize(bitmap, |
|
649 CHgDoubleGraphicListFlat::PreferredImageSize()); |
|
650 } |
676 } |
651 else if (path->Id() == KGlxCollectionPluginMonthsImplementationUid) |
677 else if (path->Id() == KGlxCollectionPluginMonthsImplementationUid) |
652 { |
678 { |
653 bitmap = AknIconUtils::CreateIconL(resFile, |
679 bitmapId = EMbmGlxiconsQgn_prop_photo_calendar_large; |
654 EMbmGlxiconsQgn_prop_photo_calendar_large); |
680 maskId = EMbmGlxiconsQgn_prop_photo_calendar_large_mask; |
655 AknIconUtils::SetSize(bitmap, |
|
656 CHgDoubleGraphicListFlat::PreferredImageSize()); |
|
657 } |
681 } |
658 else |
682 else |
659 { |
683 { |
660 bitmap = AknIconUtils::CreateIconL(resFile, |
684 bitmapId = EMbmGlxiconsQgn_prop_image_notcreated; |
661 EMbmGlxiconsQgn_prop_image_notcreated); |
685 maskId = EMbmGlxiconsQgn_prop_image_notcreated_mask; |
662 AknIconUtils::SetSize(bitmap, |
686 } |
663 CHgDoubleGraphicListFlat::PreferredImageSize()); |
687 |
664 } |
688 AknsUtils::CreateIconLC(AknsUtils::SkinInstance(), KAknsIIDNone, |
665 |
689 bitmap, mask, resFile, bitmapId, maskId); |
666 iList = CHgDoubleGraphicListFlat::NewL( |
690 __ASSERT_DEBUG(bitmap, Panic(EGlxPanicNullPointer)); |
667 ClientRect(), |
691 __ASSERT_DEBUG(mask, Panic(EGlxPanicNullPointer)); |
668 mediaCount, |
692 |
669 CGulIcon::NewL(bitmap) ); |
693 AknIconUtils::SetSize(bitmap, |
670 |
694 CHgDoubleGraphicListFlat::PreferredImageSize(), |
|
695 EAspectRatioPreservedAndUnusedSpaceRemoved); |
|
696 AknIconUtils::SetSize(mask, |
|
697 CHgDoubleGraphicListFlat::PreferredImageSize(), |
|
698 EAspectRatioPreservedAndUnusedSpaceRemoved); |
|
699 |
|
700 iList = CHgDoubleGraphicListFlat::NewL(ClientRect(), mediaCount, |
|
701 CGulIcon::NewL(bitmap, mask)); |
|
702 CleanupStack::Pop(mask); |
|
703 CleanupStack::Pop(bitmap); |
671 iList->SetMopParent(this); |
704 iList->SetMopParent(this); |
672 |
705 |
673 iList->SetSelectionObserver(*this); |
706 iList->SetSelectionObserver(*this); |
674 |
707 |
675 // Enable Buffer support |
708 TInt items = iList->ItemsOnScreen(); |
676 iList->EnableScrollBufferL(*this, (KNoOfPages * KBufferTresholdSize), |
709 // Enable Buffer support |
677 KBufferTresholdSize); |
710 iList->EnableScrollBufferL(*this, KNoOfPages * items, items); |
678 |
711 |
679 if (iUiUtility->ViewNavigationDirection() == EGlxNavigationBackwards) |
712 if (iUiUtility->ViewNavigationDirection() == EGlxNavigationBackwards) |
680 { |
713 { |
681 GLX_DEBUG1("CGlxListViewImp::CreateListL() - SetEmptyTextL()"); |
714 GLX_DEBUG1("CGlxListViewImp::CreateListL() - SetEmptyTextL()"); |
682 //set the text to be shown if the list is empty. |
715 //set the text to be shown if the list is empty. |
683 HBufC* emptyText = StringLoader::LoadLC(R_LIST_EMPTY_VIEW_TEXT); |
716 HBufC* emptyText = StringLoader::LoadLC(R_LIST_EMPTY_VIEW_TEXT); |
814 // iIsRefreshNeeded flag to ETrue |
847 // iIsRefreshNeeded flag to ETrue |
815 if (!iIsRefreshNeeded && iUiUtility->ViewNavigationDirection() |
848 if (!iIsRefreshNeeded && iUiUtility->ViewNavigationDirection() |
816 == EGlxNavigationBackwards) |
849 == EGlxNavigationBackwards) |
817 { |
850 { |
818 iIsRefreshNeeded = ETrue; |
851 iIsRefreshNeeded = ETrue; |
|
852 if(iMediaList->IdSpaceId(0) != KGlxIdSpaceIdRoot) |
|
853 { |
|
854 CleanUpL(); |
|
855 } |
819 } |
856 } |
820 |
857 if(iMediaList->IdSpaceId(0) != KGlxIdSpaceIdRoot) |
|
858 { |
|
859 UpdatePreviewL(aItemIndex); |
|
860 } |
821 // Set iPopulateListTNs to ETrue and refresh all the items in |
861 // Set iPopulateListTNs to ETrue and refresh all the items in |
822 // list view if subtitle is updated |
862 // list view if subtitle is updated |
823 if (iPreviewTNBinding && ((!iPopulateListTNs && aItemIndex |
863 else if (iPreviewTNBinding && ((!iPopulateListTNs && aItemIndex |
824 == aList->Count() - 1) || (iIsRefreshNeeded))) |
864 == aList->Count() - 1) || (iIsRefreshNeeded))) |
825 { |
865 { |
826 iPopulateListTNs = ETrue; |
866 iPopulateListTNs = ETrue; |
827 iStartIndex = KErrNotFound; |
867 iStartIndex = KErrNotFound; |
828 CMPXCollectionPath* path = iMediaList->PathLC( |
868 CMPXCollectionPath* path = iMediaList->PathLC( |
829 NGlxListDefs::EPathFocusOrSelection); |
869 NGlxListDefs::EPathFocusOrSelection); |
830 GLX_LOG_INFO("CGlxListViewImp::HandleAttributesAvailableL() - HandleItemChangedL()"); |
870 GLX_LOG_INFO("CGlxListViewImp::HandleAttributesAvailableL() - HandleItemChangedL()"); |
831 iPreviewTNBinding->HandleItemChangedL(*path, iPopulateListTNs, |
871 iPreviewTNBinding->HandleItemChangedL(*path, iPopulateListTNs, |
832 iIsRefreshNeeded, iBackwardNavigation); |
872 iIsRefreshNeeded, iBackwardNavigation); |
833 CleanupStack::PopAndDestroy(path); |
873 CleanupStack::PopAndDestroy(path); |
834 } |
874 } |
835 } |
875 } |
|
876 TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, |
|
877 GlxFullThumbnailAttributeId(ETrue, iGridIconSize.iWidth, |
|
878 iGridIconSize.iHeight)); |
|
879 if (KErrNotFound != aAttributes.Find(thumbnailAttribute, match)) |
|
880 { |
|
881 if (iMediaList->IdSpaceId(0) != KGlxIdSpaceIdRoot) |
|
882 { |
|
883 UpdatePreviewL(aItemIndex); |
|
884 iIsRefreshNeeded = EFalse; |
|
885 } |
|
886 } |
836 } |
887 } |
837 |
888 |
838 // ---------------------------------------------------------------------------- |
889 // ---------------------------------------------------------------------------- |
839 // HandleFocusChangedL |
890 // HandleFocusChangedL |
840 // ---------------------------------------------------------------------------- |
891 // ---------------------------------------------------------------------------- |
841 // |
892 // |
842 void CGlxListViewImp::HandleFocusChangedL( NGlxListDefs:: |
893 void CGlxListViewImp::HandleFocusChangedL( NGlxListDefs:: |
843 TFocusChangeType /*aType*/, TInt /*aNewIndex*/, TInt /*aOldIndex*/, |
894 TFocusChangeType /*aType*/, TInt /*aNewIndex*/, TInt /*aOldIndex*/, |
844 MGlxMediaList* /*aList*/ ) |
895 MGlxMediaList* /*aList*/ ) |
845 { |
896 { |
846 TRACER( "CGlxListViewImp::HandleFocusChangedL"); |
897 TRACER( "CGlxListViewImp::HandleFocusChangedL"); |
847 |
|
848 if (iPreviewTNBinding && iPopulateListTNs) |
898 if (iPreviewTNBinding && iPopulateListTNs) |
849 { |
899 { |
850 CMPXCollectionPath* path = iMediaList->PathLC( |
900 if(iMediaList->IdSpaceId(0) == KGlxIdSpaceIdRoot) |
851 NGlxListDefs::EPathFocusOrSelection); |
901 { |
852 if (!iBackwardNavigation && path->Levels() == KGlxCollectionRootLevel |
902 CMPXCollectionPath* path = iMediaList->PathLC( |
853 && path->Id(0) == KGlxCollectionPluginMonthsImplementationUid) |
903 NGlxListDefs::EPathFocusOrSelection); |
854 { |
904 if (!iBackwardNavigation && path->Levels() == KGlxCollectionRootLevel |
855 CleanupStack::PopAndDestroy(path); |
905 && path->Id(0) == KGlxCollectionPluginMonthsImplementationUid) |
856 return; |
906 { |
857 } |
907 CleanupStack::PopAndDestroy(path); |
858 GLX_LOG_INFO("CGlxListViewImp::HandleFocusChangedL() - HandleItemChangedL()"); |
908 return; |
859 iPreviewTNBinding->HandleItemChangedL(*path, iPopulateListTNs, |
909 } |
860 iIsRefreshNeeded, iBackwardNavigation); |
910 GLX_LOG_INFO("CGlxListViewImp::HandleFocusChangedL() - HandleItemChangedL()"); |
861 CleanupStack::PopAndDestroy(path); |
911 iPreviewTNBinding->HandleItemChangedL(*path, iPopulateListTNs, |
|
912 iIsRefreshNeeded, iBackwardNavigation); |
|
913 CleanupStack::PopAndDestroy(path); |
|
914 } |
862 } |
915 } |
863 } |
916 } |
864 |
917 |
865 // ---------------------------------------------------------------------------- |
918 // ---------------------------------------------------------------------------- |
866 // HandleItemSelected |
919 // HandleItemSelected |
883 |
936 |
884 // ---------------------------------------------------------------------------- |
937 // ---------------------------------------------------------------------------- |
885 // HandleError |
938 // HandleError |
886 // ---------------------------------------------------------------------------- |
939 // ---------------------------------------------------------------------------- |
887 // |
940 // |
888 void CGlxListViewImp::HandleError( TInt /*aError*/ ) |
941 void CGlxListViewImp::HandleError( TInt aError ) |
889 { |
942 { |
890 |
943 TRACER( "CGlxListViewImp::HandleError"); |
|
944 TRAP_IGNORE( DoHandleErrorL( aError ) ); |
|
945 } |
|
946 |
|
947 // ---------------------------------------------------------------------------- |
|
948 // DoHandleErrorL |
|
949 // ---------------------------------------------------------------------------- |
|
950 // |
|
951 void CGlxListViewImp::DoHandleErrorL(TInt /*aError*/) |
|
952 { |
|
953 TRACER( "CGlxListViewImp::DoHandleErrorL"); |
|
954 for (TInt i = 0; i < iMediaList->Count(); i++) |
|
955 { |
|
956 const TGlxMedia& item = iMediaList->Item(i); |
|
957 TInt tnError = GlxErrorManager::HasAttributeErrorL(item.Properties(), |
|
958 KGlxMediaIdThumbnail); |
|
959 if (tnError != KErrNone) |
|
960 { |
|
961 SetDefaultThumbnailL(i); |
|
962 } |
|
963 } |
891 } |
964 } |
892 |
965 |
893 // ---------------------------------------------------------------------------- |
966 // ---------------------------------------------------------------------------- |
894 // HandleCommandCompleteL |
967 // HandleCommandCompleteL |
895 // ---------------------------------------------------------------------------- |
968 // ---------------------------------------------------------------------------- |
965 // Mapping between switch, index and order of colleciton done on |
1041 // Mapping between switch, index and order of colleciton done on |
966 // the base of TGlxCollectionPluginPriority |
1042 // the base of TGlxCollectionPluginPriority |
967 switch(aIndex) |
1043 switch(aIndex) |
968 { |
1044 { |
969 case EGlxListItemAll: |
1045 case EGlxListItemAll: |
970 defaultBitmap = AknIconUtils::CreateIconL(resFile, |
1046 { |
971 EMbmGlxiconsQgn_prop_photo_all_large); |
1047 bitmapId = EMbmGlxiconsQgn_prop_photo_all_large; |
972 AknIconUtils::SetSize(defaultBitmap, |
1048 maskId = EMbmGlxiconsQgn_prop_photo_all_large_mask; |
973 CHgDoubleGraphicListFlat::PreferredImageSize()); |
1049 } |
974 break; |
1050 break; |
975 case EGlxListItemMonth: |
1051 case EGlxListItemMonth: |
976 defaultBitmap = AknIconUtils::CreateIconL(resFile, |
1052 { |
977 EMbmGlxiconsQgn_prop_photo_calendar_large); |
1053 bitmapId = EMbmGlxiconsQgn_prop_photo_calendar_large; |
978 AknIconUtils::SetSize(defaultBitmap, |
1054 maskId = EMbmGlxiconsQgn_prop_photo_calendar_large_mask; |
979 CHgDoubleGraphicListFlat::PreferredImageSize()); |
1055 } |
980 break; |
1056 break; |
981 case EGlxListItemAlbum: |
1057 case EGlxListItemAlbum: |
982 defaultBitmap = AknIconUtils::CreateIconL(resFile, |
1058 { |
983 EMbmGlxiconsQgn_prop_photo_album_large); |
1059 bitmapId = EMbmGlxiconsQgn_prop_photo_album_large; |
984 AknIconUtils::SetSize(defaultBitmap, |
1060 maskId = EMbmGlxiconsQgn_prop_photo_album_large_mask; |
985 CHgDoubleGraphicListFlat::PreferredImageSize()); |
1061 } |
986 break; |
1062 break; |
987 case EGlxLIstItemTag: |
1063 case EGlxLIstItemTag: |
988 defaultBitmap = AknIconUtils::CreateIconL(resFile, |
1064 { |
989 EMbmGlxiconsQgn_prop_photo_tag_large); |
1065 bitmapId = EMbmGlxiconsQgn_prop_photo_tag_large; |
990 AknIconUtils::SetSize(defaultBitmap, |
1066 maskId = EMbmGlxiconsQgn_prop_photo_tag_large_mask; |
991 CHgDoubleGraphicListFlat::PreferredImageSize()); |
1067 } |
992 break; |
1068 break; |
993 default: |
1069 default: |
994 break; |
1070 break; |
995 } |
1071 } |
996 } |
1072 } |
997 else |
1073 else |
998 { |
1074 { |
999 GLX_LOG_INFO1("CGlxListViewImp::SetDefaultThumbnail - For other list view " |
1075 GLX_LOG_INFO1("CGlxListViewImp::SetDefaultThumbnail - For other list view " |
1000 "aIndex %d",aIndex); |
1076 "aIndex %d",aIndex); |
1001 CMPXCollectionPath* path = iMediaList->PathLC( NGlxListDefs::EPathParent ); |
1077 CMPXCollectionPath* path = iMediaList->PathLC( |
|
1078 NGlxListDefs::EPathParent); |
1002 if(path->Id(0) == KGlxCollectionPluginAlbumsImplementationUid) |
1079 if(path->Id(0) == KGlxCollectionPluginAlbumsImplementationUid) |
1003 { |
1080 { |
1004 defaultBitmap = AknIconUtils::CreateIconL(resFile, |
1081 bitmapId = EMbmGlxiconsQgn_prop_photo_album_large; |
1005 EMbmGlxiconsQgn_prop_photo_album_large); |
1082 maskId = EMbmGlxiconsQgn_prop_photo_album_large_mask; |
1006 AknIconUtils::SetSize(defaultBitmap, |
|
1007 CHgDoubleGraphicListFlat::PreferredImageSize()); |
|
1008 } |
1083 } |
1009 else if(path->Id(0) == KGlxCollectionPluginMonthsImplementationUid) |
1084 else if(path->Id(0) == KGlxCollectionPluginMonthsImplementationUid) |
1010 { |
1085 { |
1011 defaultBitmap = AknIconUtils::CreateIconL(resFile, |
1086 bitmapId = EMbmGlxiconsQgn_prop_photo_calendar_large; |
1012 EMbmGlxiconsQgn_prop_photo_calendar_large); |
1087 maskId = EMbmGlxiconsQgn_prop_photo_calendar_large_mask; |
1013 AknIconUtils::SetSize(defaultBitmap, |
|
1014 CHgDoubleGraphicListFlat::PreferredImageSize()); |
|
1015 } |
1088 } |
1016 else |
1089 else |
1017 { |
1090 { |
1018 defaultBitmap = AknIconUtils::CreateIconL(resFile, |
1091 bitmapId = EMbmGlxiconsQgn_prop_image_notcreated; |
1019 EMbmGlxiconsQgn_prop_image_notcreated); |
1092 maskId = EMbmGlxiconsQgn_prop_image_notcreated_mask; |
1020 AknIconUtils::SetSize(defaultBitmap, |
|
1021 CHgDoubleGraphicListFlat::PreferredImageSize()); |
|
1022 } |
1093 } |
1023 CleanupStack::PopAndDestroy(path); |
1094 CleanupStack::PopAndDestroy(path); |
1024 } |
1095 } |
1025 iList->ItemL(aIndex).SetIcon(CGulIcon::NewL(defaultBitmap)); |
1096 |
1026 } |
1097 AknsUtils::CreateIconLC(AknsUtils::SkinInstance(), KAknsIIDNone, bitmap, |
1027 |
1098 mask, resFile, bitmapId, maskId); |
|
1099 __ASSERT_DEBUG(bitmap, Panic(EGlxPanicNullPointer)); |
|
1100 __ASSERT_DEBUG(mask, Panic(EGlxPanicNullPointer)); |
|
1101 |
|
1102 AknIconUtils::SetSize(bitmap, |
|
1103 CHgDoubleGraphicListFlat::PreferredImageSize(), |
|
1104 EAspectRatioPreservedAndUnusedSpaceRemoved); |
|
1105 AknIconUtils::SetSize(mask, |
|
1106 CHgDoubleGraphicListFlat::PreferredImageSize(), |
|
1107 EAspectRatioPreservedAndUnusedSpaceRemoved); |
|
1108 |
|
1109 iList->ItemL(aIndex).SetIcon(CGulIcon::NewL(bitmap, mask)); |
|
1110 CleanupStack::Pop(mask); |
|
1111 CleanupStack::Pop(bitmap); |
|
1112 } |
1028 |
1113 |
1029 // ---------------------------------------------------------------------------- |
1114 // ---------------------------------------------------------------------------- |
1030 // HandleDialogDismissedL |
1115 // HandleDialogDismissedL |
1031 // ---------------------------------------------------------------------------- |
1116 // ---------------------------------------------------------------------------- |
1032 // |
1117 // |
1033 void CGlxListViewImp::HandleDialogDismissedL() |
1118 void CGlxListViewImp::HandleDialogDismissedL() |
1034 { |
1119 { |
1035 TRACER("CGlxListViewImp::HandleDialogDismissedL()"); |
1120 TRACER("CGlxListViewImp::HandleDialogDismissedL()"); |
1036 isTnGenerationComplete = ETrue; |
|
1037 if(iSchedulerWait) |
1121 if(iSchedulerWait) |
1038 { |
1122 { |
1039 iSchedulerWait->AsyncStop(); |
1123 iSchedulerWait->AsyncStop(); |
1040 delete iSchedulerWait; |
1124 delete iSchedulerWait; |
1041 iSchedulerWait = NULL; |
1125 iSchedulerWait = NULL; |
1084 // |
1168 // |
1085 // --------------------------------------------------------------------------- |
1169 // --------------------------------------------------------------------------- |
1086 void CGlxListViewImp::NavigateToMainListL() |
1170 void CGlxListViewImp::NavigateToMainListL() |
1087 { |
1171 { |
1088 TRACER("CGlxListViewImp::NavigateToMainListL()"); |
1172 TRACER("CGlxListViewImp::NavigateToMainListL()"); |
1089 CMPXCollectionPath* naviState = iNavigationalState->StateLC(); |
1173 ProcessCommandL(EAknSoftkeyClose); |
1090 GLX_LOG_INFO1("From listview level = %d",naviState->Levels()); |
1174 } |
1091 // if ( naviState->Levels() >= 1) |
1175 // ---------------------------------------------------------------------------- |
1092 { |
1176 // CleanUpL |
1093 ProcessCommandL(EAknSoftkeyClose); |
1177 // ---------------------------------------------------------------------------- |
1094 } |
1178 // |
1095 CleanupStack::PopAndDestroy(naviState); |
1179 void CGlxListViewImp::CleanUpL() |
1096 } |
1180 { |
|
1181 GLX_LOG_INFO("CGlxListViewImp::CleanUpL()"); |
|
1182 MGlxCache* cacheManager = MGlxCache::InstanceL(); |
|
1183 for (TInt i = 0; i < iMediaList->Count(); i++) |
|
1184 { |
|
1185 cacheManager->ForceCleanupMedia(iMediaList->IdSpaceId(0), |
|
1186 iMediaList->Item(i).Id()); |
|
1187 } |
|
1188 cacheManager->Close(); |
|
1189 } |
|
1190 |
|
1191 // ---------------------------------------------------------------------------- |
|
1192 // UpdatePreviewL |
|
1193 // ---------------------------------------------------------------------------- |
|
1194 // |
|
1195 void CGlxListViewImp::UpdatePreviewL(TInt aIndex) |
|
1196 { |
|
1197 TRACER("CGlxListViewImp::UpdatePreviewL()"); |
|
1198 if (aIndex >= 0 && aIndex < iMediaList->Count()) |
|
1199 { |
|
1200 TMPXAttribute thumbnailAttribute(KGlxMediaIdThumbnail, |
|
1201 GlxFullThumbnailAttributeId(ETrue, iGridIconSize.iWidth, |
|
1202 iGridIconSize.iHeight)); |
|
1203 GLX_LOG_INFO1("CGlxListViewImp::UpdatePreviewL(aIndex = %d)", aIndex); |
|
1204 const TGlxMedia& item = iMediaList->Item(aIndex); |
|
1205 const CGlxThumbnailAttribute* value = item.ThumbnailAttribute( |
|
1206 thumbnailAttribute); |
|
1207 if (value) |
|
1208 { |
|
1209 CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; |
|
1210 CleanupStack::PushL(bitmap); |
|
1211 iPreviewTNBinding->ScaleBitmapToListSizeL(value->iBitmap, bitmap); |
|
1212 iList->ItemL(aIndex).SetIcon(CGulIcon::NewL(bitmap)); |
|
1213 iList->RefreshScreen(aIndex); |
|
1214 CleanupStack::Pop(bitmap); |
|
1215 } |
|
1216 } |
|
1217 } |
|
1218 |
1097 // End of File |
1219 // End of File |