diff -r d0c0c3e6f7a1 -r cc0182a5da39 application/src/PodcastQueueView.cpp --- a/application/src/PodcastQueueView.cpp Sat May 15 11:13:19 2010 +0100 +++ b/application/src/PodcastQueueView.cpp Fri May 28 17:43:08 2010 +0100 @@ -67,6 +67,13 @@ iPodcastModel.FeedEngine().AddObserver(this); iPodcastModel.ShowEngine().AddObserver(this); + iStylusPopupMenu = CAknStylusPopUpMenu::NewL( this , TPoint(0,0)); + TResourceReader reader; + iCoeEnv->CreateResourceReaderLC(reader,R_QUEUEVIEW_POPUP_MENU); + iStylusPopupMenu->ConstructFromResourceL(reader); + + CleanupStack::PopAndDestroy(); + SetEmptyTextL(R_PODCAST_EMPTY_QUEUE); } @@ -246,6 +253,26 @@ } } break; + case EPodcastMoveDownloadUp: + { + TInt index = iListContainer->Listbox()->CurrentItemIndex(); + if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) + { + TRAP_IGNORE(iPodcastModel.ShowEngine().MoveDownloadUpL(iPodcastModel.ActiveShowList()[index]->Uid())); + } + UpdateListboxItemsL(); + } + break; + case EPodcastMoveDownloadDown: + { + TInt index = iListContainer->Listbox()->CurrentItemIndex(); + if (index >= 0 && index < iPodcastModel.ActiveShowList().Count()) + { + TRAP_IGNORE(iPodcastModel.ShowEngine().MoveDownloadDownL(iPodcastModel.ActiveShowList()[index]->Uid())); + } + UpdateListboxItemsL(); + } + break; case EPodcastSuspendDownloads: { iPodcastModel.ShowEngine().SuspendDownloads(); @@ -267,27 +294,56 @@ } void CPodcastQueueView::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane) -{ + { if(aResourceId == R_PODCAST_SHOWSVIEW_MENU) { aMenuPane->SetItemDimmed(EPodcastMarkAllPlayed, ETrue); } -} + } void CPodcastQueueView::UpdateToolbar(TBool aVisible) -{ + { CAknToolbar* toolbar = Toolbar(); - if (toolbar) { + if (toolbar) + { RShowInfoArray &fItems = iPodcastModel.ActiveShowList(); TInt itemCnt = fItems.Count(); - if (iListContainer->IsVisible()) { + if (iListContainer->IsVisible()) + { toolbar->SetToolbarVisibility(aVisible); - } + } + toolbar->HideItem(EPodcastRemoveAllDownloads, EFalse, ETrue); toolbar->SetItemDimmed(EPodcastRemoveAllDownloads, itemCnt == 0, ETrue); toolbar->HideItem(EPodcastSuspendDownloads,iPodcastModel.SettingsEngine().DownloadSuspended(), ETrue); toolbar->HideItem(EPodcastResumeDownloads,!iPodcastModel.SettingsEngine().DownloadSuspended(), ETrue); toolbar->SetItemDimmed(EPodcastRemoveDownload, itemCnt == 0, ETrue); + } } + +void CPodcastQueueView::HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& /* aPenEventScreenLocation */) +{ + DP("CPodcastQueueView::HandleLongTapEventL BEGIN"); + iListContainer->SetLongTapDetectedL(ETrue); + + const TInt KListboxDefaultHeight = 19; // for some reason it returns 19 for an empty listbox in S^1 + TInt lbHeight = iListContainer->Listbox()->CalcHeightBasedOnNumOfItems( + iListContainer->Listbox()->Model()->NumberOfItems()) - KListboxDefaultHeight; + + if(iStylusPopupMenu && aPenEventLocation.iY < lbHeight) + { + TBool dimDown = (iListContainer->Listbox()->CurrentItemIndex() >= iPodcastModel.ActiveShowList().Count() - 1 ? + ETrue : EFalse); + TBool dimUp = (iListContainer->Listbox()->CurrentItemIndex() <= 0 ? + ETrue : EFalse); + + iStylusPopupMenu->SetItemDimmed(EPodcastMoveDownloadDown, dimDown); + iStylusPopupMenu->SetItemDimmed(EPodcastMoveDownloadUp, dimUp); + + iStylusPopupMenu->ShowMenu(); + iStylusPopupMenu->SetPosition(aPenEventLocation); + } + + DP("CPodcastQueueView::HandleLongTapEventL END"); }