35 #include <AknsBasicBackgroundControlContext.h> |
35 #include <AknsBasicBackgroundControlContext.h> |
36 #include <mglxmedialist.h> //MGlxMediaList |
36 #include <mglxmedialist.h> //MGlxMediaList |
37 #include <glxtracer.h> |
37 #include <glxtracer.h> |
38 #include <glxlog.h> //Glx Logs |
38 #include <glxlog.h> //Glx Logs |
39 #include <glxlistviewplugin.rsg> |
39 #include <glxlistviewplugin.rsg> |
40 #include <glxmedialistmulmodelprovider.h> //CGlxMediaListMulModelProvider |
|
41 #include <aknViewAppUi.h> |
40 #include <aknViewAppUi.h> |
42 #include <StringLoader.h> //StringLoader |
41 #include <StringLoader.h> //StringLoader |
43 #include <glxsetappstate.h> |
42 #include <glxsetappstate.h> |
44 #include <glxthumbnailattributeinfo.h> |
43 #include <glxthumbnailattributeinfo.h> |
45 #include <glxcollectionpluginalbums.hrh> |
44 #include <glxcollectionpluginalbums.hrh> |
114 toolbar->DisableToolbarL(ETrue); |
113 toolbar->DisableToolbarL(ETrue); |
115 } |
114 } |
116 |
115 |
117 //Register the view to recieve toolbar events. ViewBase handles the events |
116 //Register the view to recieve toolbar events. ViewBase handles the events |
118 SetToolbarObserver(this); |
117 SetToolbarObserver(this); |
119 |
|
120 iBackwardNavigation = EFalse; |
118 iBackwardNavigation = EFalse; |
|
119 iIsRefreshNeeded = EFalse; |
121 } |
120 } |
122 |
121 |
123 // --------------------------------------------------------------------------- |
122 // --------------------------------------------------------------------------- |
124 // Destructor |
123 // Destructor |
125 // --------------------------------------------------------------------------- |
124 // --------------------------------------------------------------------------- |
215 { |
214 { |
216 iPopulateListTNs = ETrue; |
215 iPopulateListTNs = ETrue; |
217 CMPXCollectionPath* path = iMediaList->PathLC( |
216 CMPXCollectionPath* path = iMediaList->PathLC( |
218 NGlxListDefs::EPathFocusOrSelection ); |
217 NGlxListDefs::EPathFocusOrSelection ); |
219 iPreviewTNBinding->HandleItemChangedL(*path, |
218 iPreviewTNBinding->HandleItemChangedL(*path, |
220 iPopulateListTNs, iBackwardNavigation); |
219 iPopulateListTNs, iIsRefreshNeeded, iBackwardNavigation); |
221 CleanupStack::PopAndDestroy( path ); |
220 CleanupStack::PopAndDestroy( path ); |
222 } |
221 } |
223 |
222 |
224 } |
223 } |
225 |
224 |
418 { |
417 { |
419 TRACER("CGlxListViewImp::HandleOpenL"); |
418 TRACER("CGlxListViewImp::HandleOpenL"); |
420 if( iNextViewActivationEnabled && ( aIndex >= 0 && aIndex < |
419 if( iNextViewActivationEnabled && ( aIndex >= 0 && aIndex < |
421 iMediaList->Count())) |
420 iMediaList->Count())) |
422 { |
421 { |
|
422 //Delete the PreviewTNMBinding as in forward navigation |
|
423 //we do not get the medialist callback. |
|
424 delete iPreviewTNBinding; |
|
425 iPreviewTNBinding = NULL; |
|
426 |
423 iMediaList->SetFocusL(NGlxListDefs::EAbsolute,aIndex); |
427 iMediaList->SetFocusL(NGlxListDefs::EAbsolute,aIndex); |
424 iLastFocusedIndex = iMediaList->FocusIndex(); |
428 iLastFocusedIndex = iMediaList->FocusIndex(); |
425 iNextViewActivationEnabled = EFalse; |
429 iNextViewActivationEnabled = EFalse; |
426 iUiUtility->SetViewNavigationDirection(EGlxNavigationForwards); |
430 iUiUtility->SetViewNavigationDirection(EGlxNavigationForwards); |
427 //Navigate to the next view |
431 //Navigate to the next view |
428 CMPXCollectionPath* path = |
432 CMPXCollectionPath* path = |
429 iMediaList->PathLC( NGlxListDefs::EPathFocusOrSelection ); |
433 iMediaList->PathLC( NGlxListDefs::EPathFocusOrSelection ); |
430 iCollectionUtility->Collection().OpenL(*path); |
434 iCollectionUtility->Collection().OpenL(*path); |
431 CleanupStack::PopAndDestroy(path); |
435 CleanupStack::PopAndDestroy(path); |
|
436 |
432 } |
437 } |
433 } |
438 } |
434 |
439 |
435 void CGlxListViewImp::PreviewTNReadyL(CFbsBitmap* aBitmap, CFbsBitmap* |
440 void CGlxListViewImp::PreviewTNReadyL(CFbsBitmap* aBitmap, CFbsBitmap* |
436 /*aMask*/, TInt /*aIndex*/) |
441 /*aMask*/, TBool aPopulateList) |
437 { |
442 { |
438 TRACER("CGlxListViewImp::PreviewTNReadyL"); |
443 TRACER("CGlxListViewImp::PreviewTNReadyL"); |
439 |
444 |
440 iPreviewTNBinding->StopTimer(); |
445 iPreviewTNBinding->StopTimer(); |
441 |
446 |
442 TInt focusIndex = iMediaList->FocusIndex(); |
447 TInt focusIndex = iMediaList->FocusIndex(); |
443 TInt mediaCount = iMediaList->Count(); |
448 TInt mediaCount = iMediaList->Count(); |
|
449 iPopulateListTNs = aPopulateList; |
444 |
450 |
445 if (aBitmap) |
451 if (aBitmap) |
446 { |
452 { |
447 iList->ItemL(focusIndex).SetIcon(CGulIcon::NewL(aBitmap)); |
453 iList->ItemL(focusIndex).SetIcon(CGulIcon::NewL(aBitmap)); |
448 } |
454 } |
491 iMediaList->SetFocusL(NGlxListDefs::EAbsolute, focus); |
497 iMediaList->SetFocusL(NGlxListDefs::EAbsolute, focus); |
492 } |
498 } |
493 else |
499 else |
494 { |
500 { |
495 iPopulateListTNs = EFalse; |
501 iPopulateListTNs = EFalse; |
|
502 iIsRefreshNeeded = EFalse; |
496 |
503 |
497 // iStartIndex holds the focus index of the item. |
504 // iStartIndex holds the focus index of the item. |
498 // If the focus is not on 0th index and if USB is Connected/Disconnected |
505 // If the focus is not on 0th index and if USB is Connected/Disconnected |
499 // or some files are deleted from file manager, |
506 // or some files are deleted from file manager, |
500 // Once the updation of all items is done, the focus should be set to |
507 // Once the updation of all items is done, the focus should be set to |
590 { |
597 { |
591 const TGlxMedia& item = iMediaList->Item(i); |
598 const TGlxMedia& item = iMediaList->Item(i); |
592 iList->ItemL(i).SetTitleL(item.Title()); |
599 iList->ItemL(i).SetTitleL(item.Title()); |
593 iList->ItemL(i).SetTextL(item.SubTitle()); |
600 iList->ItemL(i).SetTextL(item.SubTitle()); |
594 } |
601 } |
595 |
602 GLX_DEBUG3("CGlxListViewImp::CreateListL() Medialist Count = %d, " |
|
603 "iLastFocusIndex %d",mediaCount,iLastFocusedIndex); |
|
604 if(iLastFocusedIndex >= mediaCount) |
|
605 { |
|
606 iLastFocusedIndex = (mediaCount - 1); |
|
607 } |
596 iMediaList->SetFocusL(NGlxListDefs::EAbsolute, iLastFocusedIndex); |
608 iMediaList->SetFocusL(NGlxListDefs::EAbsolute, iLastFocusedIndex); |
597 iList->SetSelectedIndex(iLastFocusedIndex); |
609 iList->SetSelectedIndex(iLastFocusedIndex); |
598 iList->RefreshScreen(iLastFocusedIndex); |
610 iList->RefreshScreen(iLastFocusedIndex); |
599 } |
611 } |
600 } |
612 } |
660 // |
672 // |
661 void CGlxListViewImp::HandleAttributesAvailableL( TInt aItemIndex, |
673 void CGlxListViewImp::HandleAttributesAvailableL( TInt aItemIndex, |
662 const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* /*aList*/ ) |
674 const RArray<TMPXAttribute>& aAttributes, MGlxMediaList* /*aList*/ ) |
663 { |
675 { |
664 TRACER("CGlxListViewImp::HandleAttributesAvailableL"); |
676 TRACER("CGlxListViewImp::HandleAttributesAvailableL"); |
665 |
677 |
666 TMPXAttribute titleAttrib(KMPXMediaGeneralTitle); |
678 TMPXAttribute titleAttrib(KMPXMediaGeneralTitle); |
667 TMPXAttribute subTitleAttrib(KGlxMediaCollectionPluginSpecificSubTitle); |
679 TMPXAttribute subTitleAttrib(KGlxMediaCollectionPluginSpecificSubTitle); |
668 TIdentityRelation< TMPXAttribute > match ( &TMPXAttribute::Match ); |
680 TIdentityRelation<TMPXAttribute> match(&TMPXAttribute::Match); |
669 |
681 |
670 const TGlxMedia& item = iMediaList->Item(aItemIndex); |
682 const TGlxMedia& item = iMediaList->Item(aItemIndex); |
671 |
683 |
672 if (KErrNotFound != aAttributes.Find(titleAttrib, match)) |
684 if (KErrNotFound != aAttributes.Find(titleAttrib, match)) |
673 { |
685 { |
674 iList->ItemL(aItemIndex).SetTitleL(item.Title()); |
686 iList->ItemL(aItemIndex).SetTitleL(item.Title()); |
675 iList->RefreshScreen(aItemIndex); |
687 iList->RefreshScreen(aItemIndex); |
676 } |
688 } |
677 |
689 |
678 if (KErrNotFound != aAttributes.Find(subTitleAttrib, match)) |
690 if (KErrNotFound != aAttributes.Find(subTitleAttrib, match)) |
679 { |
691 { |
680 iList->ItemL(aItemIndex).SetTextL(item.SubTitle()); |
692 iList->ItemL(aItemIndex).SetTextL(item.SubTitle()); |
681 iList->RefreshScreen(aItemIndex); |
693 iList->RefreshScreen(aItemIndex); |
682 |
694 |
|
695 // If there is some modified in grid/fullscreen view, |
|
696 // HandleAttributesAvailableL will get called. Here we are setting |
|
697 // iIsRefreshNeeded flag to ETrue |
|
698 if (!iIsRefreshNeeded && iUiUtility->ViewNavigationDirection() |
|
699 == EGlxNavigationBackwards) |
|
700 { |
|
701 iIsRefreshNeeded = ETrue; |
|
702 iPopulateListTNs = EFalse; |
|
703 } |
|
704 |
683 // Set iPopulateListTNs to ETrue and refresh all the items in |
705 // Set iPopulateListTNs to ETrue and refresh all the items in |
684 // list view if subtitle is updated |
706 // list view if subtitle is updated |
685 if (iPreviewTNBinding && !iPopulateListTNs) |
707 if (iPreviewTNBinding && !iPopulateListTNs) |
686 { |
708 { |
687 iPopulateListTNs = ETrue; |
709 iPopulateListTNs = ETrue; |
688 iStartIndex = KErrNotFound; |
710 iStartIndex = KErrNotFound; |
689 CMPXCollectionPath* path = iMediaList->PathLC( |
711 CMPXCollectionPath* path = iMediaList->PathLC( |
690 NGlxListDefs::EPathFocusOrSelection ); |
712 NGlxListDefs::EPathFocusOrSelection); |
691 iPreviewTNBinding->HandleItemChangedL(*path, |
713 iPreviewTNBinding->HandleItemChangedL(*path, iPopulateListTNs, |
692 iPopulateListTNs, iBackwardNavigation); |
714 iIsRefreshNeeded, iBackwardNavigation); |
693 CleanupStack::PopAndDestroy( path ); |
715 CleanupStack::PopAndDestroy(path); |
694 } |
716 } |
695 } |
717 } |
696 } |
718 } |
697 |
719 |
698 // ---------------------------------------------------------------------------- |
720 // ---------------------------------------------------------------------------- |
699 // HandleFocusChangedL |
721 // HandleFocusChangedL |
700 // ---------------------------------------------------------------------------- |
722 // ---------------------------------------------------------------------------- |
708 if (iPreviewTNBinding) |
730 if (iPreviewTNBinding) |
709 { |
731 { |
710 CMPXCollectionPath* path = iMediaList->PathLC( |
732 CMPXCollectionPath* path = iMediaList->PathLC( |
711 NGlxListDefs::EPathFocusOrSelection ); |
733 NGlxListDefs::EPathFocusOrSelection ); |
712 iPreviewTNBinding->HandleItemChangedL(*path, |
734 iPreviewTNBinding->HandleItemChangedL(*path, |
713 iPopulateListTNs, iBackwardNavigation); |
735 iPopulateListTNs, iIsRefreshNeeded, iBackwardNavigation); |
714 CleanupStack::PopAndDestroy( path ); |
736 CleanupStack::PopAndDestroy( path ); |
715 } |
737 } |
716 } |
738 } |
717 |
739 |
718 // ---------------------------------------------------------------------------- |
740 // ---------------------------------------------------------------------------- |