554 void CPodcastShowsView::HandleCommandL(TInt aCommand) |
554 void CPodcastShowsView::HandleCommandL(TInt aCommand) |
555 { |
555 { |
556 switch (aCommand) |
556 switch (aCommand) |
557 { |
557 { |
558 case EPodcastMarkAsPlayed: |
558 case EPodcastMarkAsPlayed: |
559 HandleSetShowPlayed(ETrue); |
559 HandleSetShowPlayedL(ETrue); |
560 break; |
560 break; |
561 case EPodcastMarkAsUnplayed: |
561 case EPodcastMarkAsUnplayed: |
562 HandleSetShowPlayed(EFalse); |
562 HandleSetShowPlayedL(EFalse); |
563 break; |
563 break; |
564 case EPodcastMarkAllPlayed: |
564 case EPodcastMarkAllPlayed: |
565 iPodcastModel.MarkSelectionPlayed(); |
565 iPodcastModel.MarkSelectionPlayedL(); |
566 UpdateListboxItemsL(); |
566 UpdateListboxItemsL(); |
567 break; |
567 break; |
568 case EPodcastDeleteShow: |
568 case EPodcastDeleteShow: |
569 HandleDeleteShow(); |
569 HandleDeleteShowL(); |
570 break; |
570 break; |
571 case EPodcastDownloadShow: |
571 case EPodcastDownloadShow: |
572 { |
572 { |
573 TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
573 TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
574 |
574 |
715 |
715 |
716 void CPodcastShowsView::HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& /* aPenEventScreenLocation */) |
716 void CPodcastShowsView::HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& /* aPenEventScreenLocation */) |
717 { |
717 { |
718 DP("CPodcastShowsView::HandleLongTapEventL BEGIN"); |
718 DP("CPodcastShowsView::HandleLongTapEventL BEGIN"); |
719 |
719 |
720 iListContainer->SetLongTapDetected(ETrue); |
720 iListContainer->SetLongTapDetectedL(ETrue); |
721 |
721 |
722 const TInt KListboxDefaultHeight = 19; // for some reason it returns 19 for an empty listbox in S^1 |
722 const TInt KListboxDefaultHeight = 19; // for some reason it returns 19 for an empty listbox in S^1 |
723 TInt lbHeight = iListContainer->Listbox()->CalcHeightBasedOnNumOfItems( |
723 TInt lbHeight = iListContainer->Listbox()->CalcHeightBasedOnNumOfItems( |
724 iListContainer->Listbox()->Model()->NumberOfItems()) - KListboxDefaultHeight; |
724 iListContainer->Listbox()->Model()->NumberOfItems()) - KListboxDefaultHeight; |
725 |
725 |
744 iStylusPopupMenu->SetPosition(aPenEventLocation); |
744 iStylusPopupMenu->SetPosition(aPenEventLocation); |
745 } |
745 } |
746 DP("CPodcastShowsView::HandleLongTapEventL END"); |
746 DP("CPodcastShowsView::HandleLongTapEventL END"); |
747 } |
747 } |
748 |
748 |
749 void CPodcastShowsView::HandleSetShowPlayed(TBool aPlayed) |
749 void CPodcastShowsView::HandleSetShowPlayedL(TBool aPlayed) |
750 { |
750 { |
751 |
751 |
752 TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
752 TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
753 |
753 |
754 if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
754 if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
755 { |
755 { |
756 CShowInfo *info = iPodcastModel.ActiveShowList()[index]; |
756 CShowInfo *info = iPodcastModel.ActiveShowList()[index]; |
757 info->SetPlayState(aPlayed ? EPlayed : ENeverPlayed); |
757 info->SetPlayState(aPlayed ? EPlayed : ENeverPlayed); |
758 iPodcastModel.ShowEngine().UpdateShow(*info); |
758 iPodcastModel.ShowEngine().UpdateShowL(*info); |
759 UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0); |
759 UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0); |
760 iListContainer->Listbox()->DrawItem(index); |
760 iListContainer->Listbox()->DrawItem(index); |
761 } |
761 } |
762 } |
762 } |
763 |
763 |
764 void CPodcastShowsView::HandleDeleteShow() |
764 void CPodcastShowsView::HandleDeleteShowL() |
765 { |
765 { |
766 TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
766 TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
767 |
767 |
768 if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
768 if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
769 { |
769 { |
770 CShowInfo *info = iPodcastModel.ActiveShowList()[index]; |
770 CShowInfo *info = iPodcastModel.ActiveShowList()[index]; |
771 TBuf<KMaxMessageLength> msg; |
771 TBuf<KMaxMessageLength> msg; |
772 TBuf<KMaxMessageLength> templ; |
772 TBuf<KMaxMessageLength> templ; |
773 iEikonEnv->ReadResourceL(templ, R_PODCAST_DELETE_SHOW_PROMPT); |
773 iEikonEnv->ReadResourceL(templ, R_PODCAST_DELETE_SHOW_PROMPT); |
774 msg.Format(templ, &(info->Title())); |
774 msg.Format(templ, &(info->Title())); |
775 if (ShowQueryMessage(msg)) |
775 if (ShowQueryMessageL(msg)) |
776 { |
776 { |
777 iPodcastModel.ShowEngine().DeleteShowL(iPodcastModel.ActiveShowList()[index]->Uid()); |
777 iPodcastModel.ShowEngine().DeleteShowL(iPodcastModel.ActiveShowList()[index]->Uid()); |
778 |
778 |
779 // and mark as played, and not downloaded |
779 // and mark as played, and not downloaded |
780 |
780 |
781 info->SetDownloadState(ENotDownloaded); |
781 info->SetDownloadState(ENotDownloaded); |
782 info->SetPlayState(EPlayed); |
782 info->SetPlayState(EPlayed); |
783 iPodcastModel.ShowEngine().UpdateShow(*info); |
783 iPodcastModel.ShowEngine().UpdateShowL(*info); |
784 |
784 |
785 UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0); |
785 UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0); |
786 iListContainer->Listbox()->DrawItem(index); |
786 iListContainer->Listbox()->DrawItem(index); |
787 } |
787 } |
788 } |
788 } |
789 } |
789 } |
790 |
790 |
791 void CPodcastShowsView::DownloadQueueUpdatedL(TInt aDownloadingShows, TInt aQueuedShows) |
791 void CPodcastShowsView::DownloadQueueUpdatedL(TInt aDownloadingShows, TInt aQueuedShows) |
792 { |
792 { |
793 ((CPodcastAppUi*)AppUi())->UpdateQueueTab(aDownloadingShows+aQueuedShows); |
793 ((CPodcastAppUi*)AppUi())->UpdateQueueTabL(aDownloadingShows+aQueuedShows); |
794 UpdateListboxItemsL(); |
794 UpdateListboxItemsL(); |
795 } |
795 } |
796 |
796 |
797 void CPodcastShowsView::FeedUpdateAllCompleteL(TFeedState /*aState*/) |
797 void CPodcastShowsView::FeedUpdateAllCompleteL(TFeedState /*aState*/) |
798 { |
798 { |