112 |
112 |
113 iListContainer->Listbox()->SetListBoxObserver(this); |
113 iListContainer->Listbox()->SetListBoxObserver(this); |
114 |
114 |
115 iPodcastModel.FeedEngine().AddObserver(this); |
115 iPodcastModel.FeedEngine().AddObserver(this); |
116 iPodcastModel.ShowEngine().AddObserver(this); |
116 iPodcastModel.ShowEngine().AddObserver(this); |
117 |
|
118 iStylusPopupMenu = CAknStylusPopUpMenu::NewL( this , TPoint(0,0)); |
|
119 TResourceReader reader; |
|
120 iCoeEnv->CreateResourceReaderLC(reader,R_SHOWVIEW_POPUP_MENU); |
|
121 iStylusPopupMenu->ConstructFromResourceL(reader); |
|
122 |
|
123 CleanupStack::PopAndDestroy(); |
|
124 } |
117 } |
125 |
118 |
126 void CPodcastShowsView::CreateIconsL() |
119 void CPodcastShowsView::CreateIconsL() |
127 { |
120 { |
128 CArrayPtr< CGulIcon>* icons = new(ELeave) CArrayPtrFlat< CGulIcon>(1); |
121 CArrayPtr< CGulIcon>* icons = new(ELeave) CArrayPtrFlat< CGulIcon>(1); |
196 |
189 |
197 CPodcastShowsView::~CPodcastShowsView() |
190 CPodcastShowsView::~CPodcastShowsView() |
198 { |
191 { |
199 iPodcastModel.ShowEngine().RemoveObserver(this); |
192 iPodcastModel.ShowEngine().RemoveObserver(this); |
200 iPodcastModel.FeedEngine().RemoveObserver(this); |
193 iPodcastModel.FeedEngine().RemoveObserver(this); |
201 |
|
202 if(iStylusPopupMenu) |
|
203 delete iStylusPopupMenu, iStylusPopupMenu = NULL; |
|
204 } |
194 } |
205 |
195 |
206 |
196 |
207 TUid CPodcastShowsView::Id() const |
197 TUid CPodcastShowsView::Id() const |
208 { |
198 { |
627 }break; |
617 }break; |
628 default: |
618 default: |
629 CPodcastListView::HandleCommandL(aCommand); |
619 CPodcastListView::HandleCommandL(aCommand); |
630 break; |
620 break; |
631 } |
621 } |
632 iListContainer->SetLongTapDetectedL(EFalse); |
|
633 |
622 |
634 UpdateToolbar(); |
623 UpdateToolbar(); |
635 } |
624 } |
636 |
625 |
637 void CPodcastShowsView::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane) |
626 void CPodcastShowsView::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane) |
638 { |
627 { |
639 if(aResourceId == R_PODCAST_SHOWSVIEW_MENU) |
628 if(aResourceId == R_PODCAST_SHOWSVIEW_MENU) |
640 { |
629 { |
641 TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid(); |
630 TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid(); |
642 aMenuPane->SetItemDimmed(EPodcastMarkAllPlayed, updatingState); |
631 aMenuPane->SetItemDimmed(EPodcastMarkAllPlayed, updatingState); |
|
632 |
|
633 TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
|
634 |
|
635 if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
|
636 { |
|
637 CShowInfo* info = iPodcastModel.ActiveShowList()[index]; |
|
638 |
|
639 TBool hideDownloadShowCmd = info->DownloadState() != ENotDownloaded; |
|
640 TBool hideDeleteShowCmd = info->DownloadState() != EDownloaded; |
|
641 TBool hideMarkOld = info->PlayState() == EPlayed; |
|
642 |
|
643 aMenuPane->SetItemDimmed(EPodcastMarkAsPlayed, hideMarkOld); |
|
644 aMenuPane->SetItemDimmed(EPodcastMarkAsUnplayed, !hideMarkOld); |
|
645 |
|
646 aMenuPane->SetItemDimmed(EPodcastDownloadShow, hideDownloadShowCmd); |
|
647 aMenuPane->SetItemDimmed(EPodcastDeleteShow, hideDeleteShowCmd); |
|
648 } |
643 } |
649 } |
644 } |
650 } |
645 |
651 |
646 void CPodcastShowsView::DisplayShowInfoDialogL() |
652 void CPodcastShowsView::DisplayShowInfoDialogL() |
647 { |
653 { |
677 // there seems to be drawing bugs in the toolbar if there is only |
683 // there seems to be drawing bugs in the toolbar if there is only |
678 // one or two buttons defined in the resource, so we have download |
684 // one or two buttons defined in the resource, so we have download |
679 // there but always hidden |
685 // there but always hidden |
680 toolbar->HideItem(EPodcastDownloadShow, ETrue, ETrue ); |
686 toolbar->HideItem(EPodcastDownloadShow, ETrue, ETrue ); |
681 } |
687 } |
682 } |
|
683 |
|
684 void CPodcastShowsView::HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& /* aPenEventScreenLocation */) |
|
685 { |
|
686 DP("CPodcastShowsView::HandleLongTapEventL BEGIN"); |
|
687 |
|
688 iListContainer->SetLongTapDetectedL(ETrue); |
|
689 |
|
690 const TInt KListboxDefaultHeight = 19; // for some reason it returns 19 for an empty listbox in S^1 |
|
691 TInt lbHeight = iListContainer->Listbox()->CalcHeightBasedOnNumOfItems( |
|
692 iListContainer->Listbox()->Model()->NumberOfItems()) - KListboxDefaultHeight; |
|
693 |
|
694 if(iStylusPopupMenu && aPenEventLocation.iY < lbHeight) |
|
695 { |
|
696 TInt index = iListContainer->Listbox()->CurrentItemIndex(); |
|
697 if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) |
|
698 { |
|
699 CShowInfo *info = iPodcastModel.ActiveShowList()[index]; |
|
700 TBool hideDownloadShowCmd = info->DownloadState() != ENotDownloaded; |
|
701 TBool hideDeleteShowCmd = info->DownloadState() != EDownloaded; |
|
702 TBool hideMarkOld = info->PlayState() == EPlayed; |
|
703 |
|
704 iStylusPopupMenu->SetItemDimmed(EPodcastMarkAsPlayed, hideMarkOld); |
|
705 iStylusPopupMenu->SetItemDimmed(EPodcastMarkAsUnplayed, !hideMarkOld); |
|
706 |
|
707 iStylusPopupMenu->SetItemDimmed(EPodcastDownloadShow, hideDownloadShowCmd); |
|
708 iStylusPopupMenu->SetItemDimmed(EPodcastDeleteShow, hideDeleteShowCmd); |
|
709 } |
|
710 |
|
711 iStylusPopupMenu->ShowMenu(); |
|
712 iStylusPopupMenu->SetPosition(aPenEventLocation); |
|
713 } |
|
714 DP("CPodcastShowsView::HandleLongTapEventL END"); |
|
715 } |
688 } |
716 |
689 |
717 void CPodcastShowsView::HandleSetShowPlayedL(TBool aPlayed) |
690 void CPodcastShowsView::HandleSetShowPlayedL(TBool aPlayed) |
718 { |
691 { |
719 |
692 |