413 |
413 |
414 void CPodcastShowsView::GetShowIcons(CShowInfo* aShowInfo, TInt& aIconIndex) |
414 void CPodcastShowsView::GetShowIcons(CShowInfo* aShowInfo, TInt& aIconIndex) |
415 { |
415 { |
416 TBool dlStop = iPodcastModel.SettingsEngine().DownloadSuspended(); |
416 TBool dlStop = iPodcastModel.SettingsEngine().DownloadSuspended(); |
417 TBool isNew = aShowInfo->PlayState() == ENeverPlayed; |
417 TBool isNew = aShowInfo->PlayState() == ENeverPlayed; |
418 DP1("downloadstate=%d", aShowInfo->DownloadState()); |
|
419 switch (aShowInfo->DownloadState()) |
418 switch (aShowInfo->DownloadState()) |
420 { |
419 { |
421 case EDownloaded: |
420 case EDownloaded: |
422 aIconIndex = isNew ? EDownloadedShowIconNew : EDownloadedShowIcon; |
421 aIconIndex = isNew ? EDownloadedShowIconNew : EDownloadedShowIcon; |
423 break; |
422 break; |
441 if (aShowInfo->ShowType() == EVideoPodcast) |
440 if (aShowInfo->ShowType() == EVideoPodcast) |
442 { |
441 { |
443 aIconIndex += KVideoIconOffset; |
442 aIconIndex += KVideoIconOffset; |
444 } |
443 } |
445 |
444 |
446 DP3("dlStop=%d, isNew=%d, aIconIndex=%d", dlStop, isNew, aIconIndex); |
445 //DP3("dlStop=%d, isNew=%d, aIconIndex=%d", dlStop, isNew, aIconIndex); |
447 } |
446 } |
448 |
447 |
449 |
448 |
450 void CPodcastShowsView::UpdateFeedUpdateStateL() |
449 void CPodcastShowsView::UpdateFeedUpdateStateL() |
451 { |
450 { |
474 |
473 |
475 if(aSizeDownloaded > 0) |
474 if(aSizeDownloaded > 0) |
476 { |
475 { |
477 if (aShowInfo.ShowSize() > 0) |
476 if (aShowInfo.ShowSize() > 0) |
478 { |
477 { |
|
478 TUint showSize = aShowInfo.ShowSize() >= aSizeDownloaded ? aShowInfo.ShowSize() : aSizeDownloaded; |
479 infoSize.Format(KSizeDownloadingOf(), ((float) aSizeDownloaded / (float) KSizeMb), |
479 infoSize.Format(KSizeDownloadingOf(), ((float) aSizeDownloaded / (float) KSizeMb), |
480 ((float)aShowInfo.ShowSize() / (float)KSizeMb)); |
480 ((float) showSize / (float)KSizeMb)); |
481 } |
481 } |
482 else |
482 else |
483 { |
483 { |
484 infoSize.Format(KShowsSizeFormatS60(), (float)aSizeDownloaded / (float)KSizeMb); |
484 infoSize.Format(KShowsSizeFormatS60(), (float)aSizeDownloaded / (float)KSizeMb); |
485 } |
485 } |
646 { |
646 { |
647 switch (aCommand) |
647 switch (aCommand) |
648 { |
648 { |
649 case EPodcastMarkAsPlayed: |
649 case EPodcastMarkAsPlayed: |
650 HandleSetShowPlayedL(ETrue); |
650 HandleSetShowPlayedL(ETrue); |
651 if (iShowNewShows) UpdateListboxItemsL(); |
|
652 break; |
651 break; |
653 case EPodcastMarkAsUnplayed: |
652 case EPodcastMarkAsUnplayed: |
654 HandleSetShowPlayedL(EFalse); |
653 HandleSetShowPlayedL(EFalse); |
655 if (iShowNewShows) UpdateListboxItemsL(); |
|
656 break; |
654 break; |
657 case EPodcastMarkAllPlayed: |
655 case EPodcastMarkAllPlayed: |
658 iPodcastModel.MarkSelectionPlayedL(); |
656 iPodcastModel.MarkSelectionPlayedL(); |
659 UpdateListboxItemsL(); |
657 UpdateListboxItemsL(); |
660 break; |
658 break; |
807 toolbar->HideItem(EPodcastDeleteShow, ETrue, ETrue); |
805 toolbar->HideItem(EPodcastDeleteShow, ETrue, ETrue); |
808 toolbar->HideItem(EPodcastMarkAsPlayed, ETrue, ETrue ); |
806 toolbar->HideItem(EPodcastMarkAsPlayed, ETrue, ETrue ); |
809 toolbar->HideItem(EPodcastMarkAsUnplayed, ETrue, ETrue ); |
807 toolbar->HideItem(EPodcastMarkAsUnplayed, ETrue, ETrue ); |
810 |
808 |
811 TBool showDownloadAll = EFalse; |
809 TBool showDownloadAll = EFalse; |
812 for (int i=0;i<iPodcastModel.ActiveShowList().Count();i++) |
810 TInt count = iPodcastModel.ActiveShowList().Count(); |
|
811 for (int i=0;i<count;i++) |
813 { |
812 { |
814 CShowInfo* info = iPodcastModel.ActiveShowList()[i]; |
813 CShowInfo* info = iPodcastModel.ActiveShowList()[i]; |
815 if (info->DownloadState() == ENotDownloaded) |
814 if (info->DownloadState() == ENotDownloaded) |
816 { |
815 { |
817 showDownloadAll = ETrue; |
816 showDownloadAll = ETrue; |
818 } |
817 } |
819 } |
818 } |
820 |
819 |
|
820 toolbar->SetItemDimmed(EPodcastMarkAllPlayed, !count, ETrue); |
821 toolbar->SetItemDimmed(EPodcastDownloadAll, !showDownloadAll, ETrue); |
821 toolbar->SetItemDimmed(EPodcastDownloadAll, !showDownloadAll, ETrue); |
822 } |
822 } |
823 else |
823 else |
824 { |
824 { |
825 RShowInfoArray &fItems = iPodcastModel.ActiveShowList(); |
825 RShowInfoArray &fItems = iPodcastModel.ActiveShowList(); |
921 |
921 |
922 if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
922 if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
923 { |
923 { |
924 CShowInfo *info = iPodcastModel.ActiveShowList()[index]; |
924 CShowInfo *info = iPodcastModel.ActiveShowList()[index]; |
925 info->SetPlayState(aPlayed ? EPlayed : ENeverPlayed); |
925 info->SetPlayState(aPlayed ? EPlayed : ENeverPlayed); |
926 iPodcastModel.ShowEngine().UpdateShowL(*info); |
926 if (aPlayed) |
927 UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0); |
927 { |
928 iListContainer->Listbox()->DrawItem(index); |
928 // PostPlayHandling calls UpdateShow, which is slow, so we don't need to do it again |
|
929 iPodcastModel.ShowEngine().PostPlayHandling(info); |
|
930 } |
|
931 else |
|
932 { |
|
933 iPodcastModel.ShowEngine().UpdateShowL(*info); |
|
934 } |
|
935 |
|
936 if (iShowNewShows) |
|
937 { |
|
938 UpdateListboxItemsL(); |
|
939 |
|
940 if (index > 0) |
|
941 { |
|
942 iListContainer->Listbox()->SetCurrentItemIndex(index - 1); |
|
943 } |
|
944 } |
|
945 else |
|
946 { |
|
947 UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0); |
|
948 iListContainer->Listbox()->DrawItem(index); |
|
949 } |
929 } |
950 } |
930 } |
951 } |
931 |
952 |
932 void CPodcastShowsView::HandleDeleteShowL() |
953 void CPodcastShowsView::HandleDeleteShowL() |
933 { |
954 { |