553 void CPodcastShowsView::HandleCommandL(TInt aCommand) |
553 void CPodcastShowsView::HandleCommandL(TInt aCommand) |
554 { |
554 { |
555 switch (aCommand) |
555 switch (aCommand) |
556 { |
556 { |
557 case EPodcastMarkAsPlayed: |
557 case EPodcastMarkAsPlayed: |
558 HandleSetShowPlayed(ETrue); |
558 HandleSetShowPlayedL(ETrue); |
559 break; |
559 break; |
560 case EPodcastMarkAsUnplayed: |
560 case EPodcastMarkAsUnplayed: |
561 HandleSetShowPlayed(EFalse); |
561 HandleSetShowPlayedL(EFalse); |
562 break; |
562 break; |
563 case EPodcastMarkAllPlayed: |
563 case EPodcastMarkAllPlayed: |
564 iPodcastModel.MarkSelectionPlayed(); |
564 iPodcastModel.MarkSelectionPlayedL(); |
565 UpdateListboxItemsL(); |
565 UpdateListboxItemsL(); |
566 break; |
566 break; |
567 case EPodcastDeleteShow: |
567 case EPodcastDeleteShow: |
568 HandleDeleteShow(); |
568 HandleDeleteShowL(); |
569 break; |
569 break; |
570 case EPodcastDownloadShow: |
570 case EPodcastDownloadShow: |
571 { |
571 { |
572 TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
572 TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
573 if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
573 if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
737 |
737 |
738 void CPodcastShowsView::HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& /* aPenEventScreenLocation */) |
738 void CPodcastShowsView::HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& /* aPenEventScreenLocation */) |
739 { |
739 { |
740 DP("CPodcastShowsView::HandleLongTapEventL BEGIN"); |
740 DP("CPodcastShowsView::HandleLongTapEventL BEGIN"); |
741 |
741 |
742 iListContainer->SetLongTapDetected(ETrue); |
742 iListContainer->SetLongTapDetectedL(ETrue); |
743 |
743 |
744 const TInt KListboxDefaultHeight = 19; // for some reason it returns 19 for an empty listbox in S^1 |
744 const TInt KListboxDefaultHeight = 19; // for some reason it returns 19 for an empty listbox in S^1 |
745 TInt lbHeight = iListContainer->Listbox()->CalcHeightBasedOnNumOfItems( |
745 TInt lbHeight = iListContainer->Listbox()->CalcHeightBasedOnNumOfItems( |
746 iListContainer->Listbox()->Model()->NumberOfItems()) - KListboxDefaultHeight; |
746 iListContainer->Listbox()->Model()->NumberOfItems()) - KListboxDefaultHeight; |
747 |
747 |
766 iStylusPopupMenu->SetPosition(aPenEventLocation); |
766 iStylusPopupMenu->SetPosition(aPenEventLocation); |
767 } |
767 } |
768 DP("CPodcastShowsView::HandleLongTapEventL END"); |
768 DP("CPodcastShowsView::HandleLongTapEventL END"); |
769 } |
769 } |
770 |
770 |
771 void CPodcastShowsView::HandleSetShowPlayed(TBool aPlayed) |
771 void CPodcastShowsView::HandleSetShowPlayedL(TBool aPlayed) |
772 { |
772 { |
773 |
773 |
774 TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
774 TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
775 |
775 |
776 if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
776 if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
777 { |
777 { |
778 CShowInfo *info = iPodcastModel.ActiveShowList()[index]; |
778 CShowInfo *info = iPodcastModel.ActiveShowList()[index]; |
779 info->SetPlayState(aPlayed ? EPlayed : ENeverPlayed); |
779 info->SetPlayState(aPlayed ? EPlayed : ENeverPlayed); |
780 iPodcastModel.ShowEngine().UpdateShow(*info); |
780 iPodcastModel.ShowEngine().UpdateShowL(*info); |
781 UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0); |
781 UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0); |
782 iListContainer->Listbox()->DrawItem(index); |
782 iListContainer->Listbox()->DrawItem(index); |
783 } |
783 } |
784 } |
784 } |
785 |
785 |
786 void CPodcastShowsView::HandleDeleteShow() |
786 void CPodcastShowsView::HandleDeleteShowL() |
787 { |
787 { |
788 TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
788 TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
789 |
789 |
790 if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
790 if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
791 { |
791 { |
792 CShowInfo *info = iPodcastModel.ActiveShowList()[index]; |
792 CShowInfo *info = iPodcastModel.ActiveShowList()[index]; |
793 TBuf<KMaxMessageLength> msg; |
793 TBuf<KMaxMessageLength> msg; |
794 TBuf<KMaxMessageLength> templ; |
794 TBuf<KMaxMessageLength> templ; |
795 iEikonEnv->ReadResourceL(templ, R_PODCAST_DELETE_SHOW_PROMPT); |
795 iEikonEnv->ReadResourceL(templ, R_PODCAST_DELETE_SHOW_PROMPT); |
796 msg.Format(templ, &(info->Title())); |
796 msg.Format(templ, &(info->Title())); |
797 if (ShowQueryMessage(msg)) |
797 if (ShowQueryMessageL(msg)) |
798 { |
798 { |
799 iPodcastModel.ShowEngine().DeleteShowL(iPodcastModel.ActiveShowList()[index]->Uid()); |
799 iPodcastModel.ShowEngine().DeleteShowL(iPodcastModel.ActiveShowList()[index]->Uid()); |
800 |
800 |
801 // and mark as played, and not downloaded |
801 // and mark as played, and not downloaded |
802 |
802 |
803 info->SetDownloadState(ENotDownloaded); |
803 info->SetDownloadState(ENotDownloaded); |
804 info->SetPlayState(EPlayed); |
804 info->SetPlayState(EPlayed); |
805 iPodcastModel.ShowEngine().UpdateShow(*info); |
805 iPodcastModel.ShowEngine().UpdateShowL(*info); |
806 |
806 |
807 UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0); |
807 UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0); |
808 iListContainer->Listbox()->DrawItem(index); |
808 iListContainer->Listbox()->DrawItem(index); |
809 } |
809 } |
810 } |
810 } |
811 } |
811 } |
812 |
812 |
813 void CPodcastShowsView::DownloadQueueUpdatedL(TInt aDownloadingShows, TInt aQueuedShows) |
813 void CPodcastShowsView::DownloadQueueUpdatedL(TInt aDownloadingShows, TInt aQueuedShows) |
814 { |
814 { |
815 ((CPodcastAppUi*)AppUi())->UpdateQueueTab(aDownloadingShows+aQueuedShows); |
815 ((CPodcastAppUi*)AppUi())->UpdateQueueTabL(aDownloadingShows+aQueuedShows); |
816 } |
816 } |
817 |
817 |
818 void CPodcastShowsView::FeedUpdateAllCompleteL(TFeedState /*aState*/) |
818 void CPodcastShowsView::FeedUpdateAllCompleteL(TFeedState /*aState*/) |
819 { |
819 { |
820 UpdateListboxItemsL(); |
820 UpdateListboxItemsL(); |