561 void CPodcastShowsView::HandleCommandL(TInt aCommand) |
561 void CPodcastShowsView::HandleCommandL(TInt aCommand) |
562 { |
562 { |
563 switch (aCommand) |
563 switch (aCommand) |
564 { |
564 { |
565 case EPodcastMarkAsPlayed: |
565 case EPodcastMarkAsPlayed: |
566 HandleSetShowPlayed(ETrue); |
566 HandleSetShowPlayedL(ETrue); |
567 break; |
567 break; |
568 case EPodcastMarkAsUnplayed: |
568 case EPodcastMarkAsUnplayed: |
569 HandleSetShowPlayed(EFalse); |
569 HandleSetShowPlayedL(EFalse); |
570 break; |
570 break; |
571 case EPodcastMarkAllPlayed: |
571 case EPodcastMarkAllPlayed: |
572 iPodcastModel.MarkSelectionPlayed(); |
572 iPodcastModel.MarkSelectionPlayedL(); |
573 UpdateListboxItemsL(); |
573 UpdateListboxItemsL(); |
574 break; |
574 break; |
575 case EPodcastDeleteShow: |
575 case EPodcastDeleteShow: |
576 HandleDeleteShow(); |
576 HandleDeleteShowL(); |
577 break; |
577 break; |
578 case EPodcastDownloadShow: |
578 case EPodcastDownloadShow: |
579 { |
579 { |
580 TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
580 TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
581 |
581 |
746 |
746 |
747 void CPodcastShowsView::HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& /* aPenEventScreenLocation */) |
747 void CPodcastShowsView::HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& /* aPenEventScreenLocation */) |
748 { |
748 { |
749 DP("CPodcastShowsView::HandleLongTapEventL BEGIN"); |
749 DP("CPodcastShowsView::HandleLongTapEventL BEGIN"); |
750 |
750 |
751 iListContainer->SetLongTapDetected(ETrue); |
751 iListContainer->SetLongTapDetectedL(ETrue); |
752 |
752 |
753 const TInt KListboxDefaultHeight = 19; // for some reason it returns 19 for an empty listbox in S^1 |
753 const TInt KListboxDefaultHeight = 19; // for some reason it returns 19 for an empty listbox in S^1 |
754 TInt lbHeight = iListContainer->Listbox()->CalcHeightBasedOnNumOfItems( |
754 TInt lbHeight = iListContainer->Listbox()->CalcHeightBasedOnNumOfItems( |
755 iListContainer->Listbox()->Model()->NumberOfItems()) - KListboxDefaultHeight; |
755 iListContainer->Listbox()->Model()->NumberOfItems()) - KListboxDefaultHeight; |
756 |
756 |
775 iStylusPopupMenu->SetPosition(aPenEventLocation); |
775 iStylusPopupMenu->SetPosition(aPenEventLocation); |
776 } |
776 } |
777 DP("CPodcastShowsView::HandleLongTapEventL END"); |
777 DP("CPodcastShowsView::HandleLongTapEventL END"); |
778 } |
778 } |
779 |
779 |
780 void CPodcastShowsView::HandleSetShowPlayed(TBool aPlayed) |
780 void CPodcastShowsView::HandleSetShowPlayedL(TBool aPlayed) |
781 { |
781 { |
782 |
782 |
783 TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
783 TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
784 |
784 |
785 if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
785 if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
786 { |
786 { |
787 CShowInfo *info = iPodcastModel.ActiveShowList()[index]; |
787 CShowInfo *info = iPodcastModel.ActiveShowList()[index]; |
788 info->SetPlayState(aPlayed ? EPlayed : ENeverPlayed); |
788 info->SetPlayState(aPlayed ? EPlayed : ENeverPlayed); |
789 iPodcastModel.ShowEngine().UpdateShow(*info); |
789 iPodcastModel.ShowEngine().UpdateShowL(*info); |
790 UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0); |
790 UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0); |
791 iListContainer->Listbox()->DrawItem(index); |
791 iListContainer->Listbox()->DrawItem(index); |
792 } |
792 } |
793 } |
793 } |
794 |
794 |
795 void CPodcastShowsView::HandleDeleteShow() |
795 void CPodcastShowsView::HandleDeleteShowL() |
796 { |
796 { |
797 TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
797 TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
798 |
798 |
799 if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
799 if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
800 { |
800 { |
801 CShowInfo *info = iPodcastModel.ActiveShowList()[index]; |
801 CShowInfo *info = iPodcastModel.ActiveShowList()[index]; |
802 TBuf<KMaxMessageLength> msg; |
802 TBuf<KMaxMessageLength> msg; |
803 TBuf<KMaxMessageLength> templ; |
803 TBuf<KMaxMessageLength> templ; |
804 iEikonEnv->ReadResourceL(templ, R_PODCAST_DELETE_SHOW_PROMPT); |
804 iEikonEnv->ReadResourceL(templ, R_PODCAST_DELETE_SHOW_PROMPT); |
805 msg.Format(templ, &(info->Title())); |
805 msg.Format(templ, &(info->Title())); |
806 if (ShowQueryMessage(msg)) |
806 if (ShowQueryMessageL(msg)) |
807 { |
807 { |
808 iPodcastModel.ShowEngine().DeleteShowL(iPodcastModel.ActiveShowList()[index]->Uid()); |
808 iPodcastModel.ShowEngine().DeleteShowL(iPodcastModel.ActiveShowList()[index]->Uid()); |
809 |
809 |
810 // and mark as played, and not downloaded |
810 // and mark as played, and not downloaded |
811 |
811 |
812 info->SetDownloadState(ENotDownloaded); |
812 info->SetDownloadState(ENotDownloaded); |
813 info->SetPlayState(EPlayed); |
813 info->SetPlayState(EPlayed); |
814 iPodcastModel.ShowEngine().UpdateShow(*info); |
814 iPodcastModel.ShowEngine().UpdateShowL(*info); |
815 |
815 |
816 UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0); |
816 UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0); |
817 iListContainer->Listbox()->DrawItem(index); |
817 iListContainer->Listbox()->DrawItem(index); |
818 } |
818 } |
819 } |
819 } |
820 } |
820 } |
821 |
821 |
822 void CPodcastShowsView::DownloadQueueUpdatedL(TInt aDownloadingShows, TInt aQueuedShows) |
822 void CPodcastShowsView::DownloadQueueUpdatedL(TInt aDownloadingShows, TInt aQueuedShows) |
823 { |
823 { |
824 ((CPodcastAppUi*)AppUi())->UpdateQueueTab(aDownloadingShows+aQueuedShows); |
824 ((CPodcastAppUi*)AppUi())->UpdateQueueTabL(aDownloadingShows+aQueuedShows); |
825 UpdateListboxItemsL(); |
825 UpdateListboxItemsL(); |
826 } |
826 } |
827 |
827 |
828 void CPodcastShowsView::FeedUpdateAllCompleteL(TFeedState /*aState*/) |
828 void CPodcastShowsView::FeedUpdateAllCompleteL(TFeedState /*aState*/) |
829 { |
829 { |