201 |
201 |
202 void CPodcastShowsView::DoActivateL(const TVwsViewId& aPrevViewId, |
202 void CPodcastShowsView::DoActivateL(const TVwsViewId& aPrevViewId, |
203 TUid aCustomMessageId, const TDesC8& aCustomMessage) |
203 TUid aCustomMessageId, const TDesC8& aCustomMessage) |
204 { |
204 { |
205 DP("CPodcastShowsView::DoActivateL BEGIN"); |
205 DP("CPodcastShowsView::DoActivateL BEGIN"); |
|
206 CPodcastListView::DoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage); |
|
207 |
|
208 iPreviousView = TVwsViewId(KUidPodcast, KUidPodcastFeedViewID); |
206 |
209 |
207 UpdateViewTitleL(); |
210 UpdateViewTitleL(); |
208 |
|
209 CPodcastListView::DoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage); |
|
210 iPreviousView = TVwsViewId(KUidPodcast, KUidPodcastFeedViewID); |
|
211 |
|
212 UpdateFeedUpdateStateL(); |
211 UpdateFeedUpdateStateL(); |
213 UpdateToolbar(); |
212 UpdateToolbar(); |
214 DP("CPodcastShowsView::DoActivateL END"); |
213 DP("CPodcastShowsView::DoActivateL END"); |
215 } |
214 } |
216 |
215 |
217 void CPodcastShowsView::DoDeactivate() |
216 void CPodcastShowsView::DoDeactivate() |
218 { |
217 { |
219 CAknTitlePane* titlePane = static_cast<CAknTitlePane*> |
|
220 ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
221 |
|
222 // titlePane->SetSmallPicture(NULL, NULL, ETrue); |
|
223 titlePane->SetPicture(NULL, NULL); |
|
224 titlePane->SetTextToDefaultL(); |
|
225 CPodcastListView::DoDeactivate(); |
218 CPodcastListView::DoDeactivate(); |
226 } |
219 } |
227 |
220 |
228 // Engine callback when new shows are available |
221 // Engine callback when new shows are available |
229 void CPodcastShowsView::ShowListUpdatedL() |
222 void CPodcastShowsView::ShowListUpdatedL() |
561 void CPodcastShowsView::HandleCommandL(TInt aCommand) |
554 void CPodcastShowsView::HandleCommandL(TInt aCommand) |
562 { |
555 { |
563 switch (aCommand) |
556 switch (aCommand) |
564 { |
557 { |
565 case EPodcastMarkAsPlayed: |
558 case EPodcastMarkAsPlayed: |
566 HandleSetShowPlayed(ETrue); |
559 HandleSetShowPlayedL(ETrue); |
567 break; |
560 break; |
568 case EPodcastMarkAsUnplayed: |
561 case EPodcastMarkAsUnplayed: |
569 HandleSetShowPlayed(EFalse); |
562 HandleSetShowPlayedL(EFalse); |
570 break; |
563 break; |
571 case EPodcastMarkAllPlayed: |
564 case EPodcastMarkAllPlayed: |
572 iPodcastModel.MarkSelectionPlayed(); |
565 iPodcastModel.MarkSelectionPlayedL(); |
573 UpdateListboxItemsL(); |
566 UpdateListboxItemsL(); |
574 break; |
567 break; |
575 case EPodcastDeleteShow: |
568 case EPodcastDeleteShow: |
576 HandleDeleteShow(); |
569 HandleDeleteShowL(); |
577 break; |
570 break; |
578 case EPodcastDownloadShow: |
571 case EPodcastDownloadShow: |
579 { |
572 { |
580 TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
573 TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
581 |
574 |
625 { |
618 { |
626 TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid(); |
619 TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid(); |
627 aMenuPane->SetItemDimmed(EPodcastMarkAllPlayed, updatingState); |
620 aMenuPane->SetItemDimmed(EPodcastMarkAllPlayed, updatingState); |
628 } |
621 } |
629 } |
622 } |
630 |
|
631 void CPodcastShowsView::ImageOperationCompleteL(TInt aError, TUint /*aHandle*/, CPodcastModel& /*aPodcastModel*/) |
|
632 { |
|
633 iLastImageHandlerError = aError; |
|
634 if(iSetTitlebarImage) |
|
635 { |
|
636 iSetTitlebarImage = EFalse; |
|
637 if(aError == KErrNone) |
|
638 { |
|
639 CAknTitlePane* titlePane = static_cast<CAknTitlePane*> |
|
640 ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
641 titlePane->SetSmallPicture(iPodcastModel.ImageHandler().ScaledBitmap(), NULL, ETrue); |
|
642 } |
|
643 else |
|
644 { |
|
645 iPodcastModel.ImageHandler().ScaledBitmap(); |
|
646 } |
|
647 |
|
648 } |
|
649 else |
|
650 { |
|
651 CActiveScheduler::Stop(); |
|
652 } |
|
653 } |
|
654 |
623 |
655 void CPodcastShowsView::DisplayShowInfoDialogL() |
624 void CPodcastShowsView::DisplayShowInfoDialogL() |
656 { |
625 { |
657 TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
626 TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
658 if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
627 if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
681 TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && |
650 TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && |
682 iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid(); |
651 iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid(); |
683 |
652 |
684 toolbar->HideItem(EPodcastUpdateFeed, updatingState, ETrue ); |
653 toolbar->HideItem(EPodcastUpdateFeed, updatingState, ETrue ); |
685 toolbar->HideItem(EPodcastCancelUpdateAllFeeds, !updatingState, ETrue ); |
654 toolbar->HideItem(EPodcastCancelUpdateAllFeeds, !updatingState, ETrue ); |
686 |
655 #ifndef SYMBIAN1_UI |
687 #ifdef SYMBIAN1_UI |
656 // there seems to be drawing bugs in the toolbar if there is only |
|
657 // one or two buttons defined in the resource, so we have download |
|
658 // there but always hidden |
|
659 toolbar->HideItem(EPodcastDownloadShow, ETrue, ETrue ); |
|
660 #else SYMBIAN1_UI |
688 RShowInfoArray &fItems = iPodcastModel.ActiveShowList(); |
661 RShowInfoArray &fItems = iPodcastModel.ActiveShowList(); |
689 TInt itemCnt = fItems.Count(); |
662 TInt itemCnt = fItems.Count(); |
690 |
663 |
691 TBool hideDownloadShowCmd = EFalse; |
664 TBool hideDownloadShowCmd = EFalse; |
692 TBool dimDownloadShowCmd = EFalse; |
665 TBool dimDownloadShowCmd = EFalse; |
746 |
719 |
747 void CPodcastShowsView::HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& /* aPenEventScreenLocation */) |
720 void CPodcastShowsView::HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& /* aPenEventScreenLocation */) |
748 { |
721 { |
749 DP("CPodcastShowsView::HandleLongTapEventL BEGIN"); |
722 DP("CPodcastShowsView::HandleLongTapEventL BEGIN"); |
750 |
723 |
751 iListContainer->SetLongTapDetected(ETrue); |
724 iListContainer->SetLongTapDetectedL(ETrue); |
752 |
725 |
753 const TInt KListboxDefaultHeight = 19; // for some reason it returns 19 for an empty listbox in S^1 |
726 const TInt KListboxDefaultHeight = 19; // for some reason it returns 19 for an empty listbox in S^1 |
754 TInt lbHeight = iListContainer->Listbox()->CalcHeightBasedOnNumOfItems( |
727 TInt lbHeight = iListContainer->Listbox()->CalcHeightBasedOnNumOfItems( |
755 iListContainer->Listbox()->Model()->NumberOfItems()) - KListboxDefaultHeight; |
728 iListContainer->Listbox()->Model()->NumberOfItems()) - KListboxDefaultHeight; |
756 |
729 |
775 iStylusPopupMenu->SetPosition(aPenEventLocation); |
748 iStylusPopupMenu->SetPosition(aPenEventLocation); |
776 } |
749 } |
777 DP("CPodcastShowsView::HandleLongTapEventL END"); |
750 DP("CPodcastShowsView::HandleLongTapEventL END"); |
778 } |
751 } |
779 |
752 |
780 void CPodcastShowsView::HandleSetShowPlayed(TBool aPlayed) |
753 void CPodcastShowsView::HandleSetShowPlayedL(TBool aPlayed) |
781 { |
754 { |
782 |
755 |
783 TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
756 TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
784 |
757 |
785 if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
758 if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
786 { |
759 { |
787 CShowInfo *info = iPodcastModel.ActiveShowList()[index]; |
760 CShowInfo *info = iPodcastModel.ActiveShowList()[index]; |
788 info->SetPlayState(aPlayed ? EPlayed : ENeverPlayed); |
761 info->SetPlayState(aPlayed ? EPlayed : ENeverPlayed); |
789 iPodcastModel.ShowEngine().UpdateShow(*info); |
762 iPodcastModel.ShowEngine().UpdateShowL(*info); |
790 UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0); |
763 UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0); |
791 iListContainer->Listbox()->DrawItem(index); |
764 iListContainer->Listbox()->DrawItem(index); |
792 } |
765 } |
793 } |
766 } |
794 |
767 |
795 void CPodcastShowsView::HandleDeleteShow() |
768 void CPodcastShowsView::HandleDeleteShowL() |
796 { |
769 { |
797 TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
770 TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
798 |
771 |
799 if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
772 if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
800 { |
773 { |
801 CShowInfo *info = iPodcastModel.ActiveShowList()[index]; |
774 CShowInfo *info = iPodcastModel.ActiveShowList()[index]; |
802 TBuf<KMaxMessageLength> msg; |
775 TBuf<KMaxMessageLength> msg; |
803 TBuf<KMaxMessageLength> templ; |
776 TBuf<KMaxMessageLength> templ; |
804 iEikonEnv->ReadResourceL(templ, R_PODCAST_DELETE_SHOW_PROMPT); |
777 iEikonEnv->ReadResourceL(templ, R_PODCAST_DELETE_SHOW_PROMPT); |
805 msg.Format(templ, &(info->Title())); |
778 msg.Format(templ, &(info->Title())); |
806 if (ShowQueryMessage(msg)) |
779 if (ShowQueryMessageL(msg)) |
807 { |
780 { |
808 iPodcastModel.ShowEngine().DeleteShowL(iPodcastModel.ActiveShowList()[index]->Uid()); |
781 iPodcastModel.ShowEngine().DeleteShowL(iPodcastModel.ActiveShowList()[index]->Uid()); |
809 |
782 |
810 // and mark as played, and not downloaded |
783 // and mark as played, and not downloaded |
811 |
784 |
812 info->SetDownloadState(ENotDownloaded); |
785 info->SetDownloadState(ENotDownloaded); |
813 info->SetPlayState(EPlayed); |
786 info->SetPlayState(EPlayed); |
814 iPodcastModel.ShowEngine().UpdateShow(*info); |
787 iPodcastModel.ShowEngine().UpdateShowL(*info); |
815 |
788 |
816 UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0); |
789 UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0); |
817 iListContainer->Listbox()->DrawItem(index); |
790 iListContainer->Listbox()->DrawItem(index); |
818 } |
791 } |
819 } |
792 } |
820 } |
793 } |
821 |
794 |
822 void CPodcastShowsView::DownloadQueueUpdatedL(TInt aDownloadingShows, TInt aQueuedShows) |
795 void CPodcastShowsView::DownloadQueueUpdatedL(TInt aDownloadingShows, TInt aQueuedShows) |
823 { |
796 { |
824 ((CPodcastAppUi*)AppUi())->UpdateQueueTab(aDownloadingShows+aQueuedShows); |
797 ((CPodcastAppUi*)AppUi())->UpdateQueueTabL(aDownloadingShows+aQueuedShows); |
825 UpdateListboxItemsL(); |
798 UpdateListboxItemsL(); |
826 } |
799 } |
827 |
800 |
828 void CPodcastShowsView::FeedUpdateAllCompleteL(TFeedState /*aState*/) |
801 void CPodcastShowsView::FeedUpdateAllCompleteL(TFeedState /*aState*/) |
829 { |
802 { |