application/src/PodcastQueueView.cpp
changeset 107 17da6d3a5a4b
parent 100 eefed4bda2e2
child 114 f94dbd678dda
equal deleted inserted replaced
106:b4be6bc78573 107:17da6d3a5a4b
   253 				{
   253 				{
   254 				TRAP_IGNORE(iPodcastModel.ShowEngine().RemoveDownloadL(iPodcastModel.ActiveShowList()[index]->Uid()));
   254 				TRAP_IGNORE(iPodcastModel.ShowEngine().RemoveDownloadL(iPodcastModel.ActiveShowList()[index]->Uid()));
   255 				}
   255 				}
   256 			}
   256 			}
   257 			break;
   257 			break;
       
   258 		case EPodcastMoveDownloadUp:
       
   259 			{
       
   260 			TInt index = iListContainer->Listbox()->CurrentItemIndex();
       
   261 			TBool resumeAfterMove = EFalse;
       
   262 			if (index == 1 && !iPodcastModel.SettingsEngine().DownloadSuspended())
       
   263 				{
       
   264 				iPodcastModel.ShowEngine().SuspendDownloads();
       
   265 				resumeAfterMove = ETrue;
       
   266 				}
       
   267 			
       
   268 			if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
       
   269 				{
       
   270 				TRAP_IGNORE(iPodcastModel.ShowEngine().MoveDownloadUpL(iPodcastModel.ActiveShowList()[index]->Uid()));
       
   271 				}
       
   272 			
       
   273 			if(resumeAfterMove)
       
   274 				{
       
   275 				iPodcastModel.ShowEngine().ResumeDownloadsL();
       
   276 				}
       
   277 				
       
   278 			UpdateListboxItemsL();
       
   279 			}
       
   280 			break;
       
   281 		case EPodcastMoveDownloadDown:
       
   282 			{
       
   283 			TInt index = iListContainer->Listbox()->CurrentItemIndex();
       
   284 			TBool resumeAfterMove = EFalse;
       
   285 			if (index == 0 && !iPodcastModel.SettingsEngine().DownloadSuspended())
       
   286 				{
       
   287 				iPodcastModel.ShowEngine().SuspendDownloads();
       
   288 				resumeAfterMove = ETrue;
       
   289 				}
       
   290 			
       
   291 			if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
       
   292 				{
       
   293 				TRAP_IGNORE(iPodcastModel.ShowEngine().MoveDownloadDownL(iPodcastModel.ActiveShowList()[index]->Uid()));
       
   294 				}
       
   295 			
       
   296 			if(resumeAfterMove)
       
   297 				{
       
   298 				iPodcastModel.ShowEngine().ResumeDownloadsL();
       
   299 				}
       
   300 			
       
   301 			UpdateListboxItemsL();
       
   302 			}
       
   303 			break;
   258 		case EPodcastSuspendDownloads:
   304 		case EPodcastSuspendDownloads:
   259 			{
   305 			{
   260 			iPodcastModel.ShowEngine().SuspendDownloads();
   306 			iPodcastModel.ShowEngine().SuspendDownloads();
   261 			UpdateListboxItemsL();
   307 			UpdateListboxItemsL();
   262 			}
   308 			}
   298 		toolbar->HideItem(EPodcastSuspendDownloads,iPodcastModel.SettingsEngine().DownloadSuspended(), ETrue);
   344 		toolbar->HideItem(EPodcastSuspendDownloads,iPodcastModel.SettingsEngine().DownloadSuspended(), ETrue);
   299 		toolbar->HideItem(EPodcastResumeDownloads,!iPodcastModel.SettingsEngine().DownloadSuspended(), ETrue);	
   345 		toolbar->HideItem(EPodcastResumeDownloads,!iPodcastModel.SettingsEngine().DownloadSuspended(), ETrue);	
   300 		toolbar->SetItemDimmed(EPodcastRemoveDownload, itemCnt == 0, ETrue);		
   346 		toolbar->SetItemDimmed(EPodcastRemoveDownload, itemCnt == 0, ETrue);		
   301 	}
   347 	}
   302 }
   348 }
       
   349 
       
   350 void CPodcastQueueView::HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& /* aPenEventScreenLocation */)
       
   351 {
       
   352 	DP("CPodcastQueueView::HandleLongTapEventL BEGIN");
       
   353 	iListContainer->SetLongTapDetectedL(ETrue);
       
   354 	
       
   355 	const TInt KListboxDefaultHeight = 19; // for some reason it returns 19 for an empty listbox in S^1
       
   356 	TInt lbHeight = iListContainer->Listbox()->CalcHeightBasedOnNumOfItems(
       
   357 			iListContainer->Listbox()->Model()->NumberOfItems()) - KListboxDefaultHeight;
       
   358 
       
   359     if(iStylusPopupMenu && aPenEventLocation.iY < lbHeight)
       
   360     {
       
   361 		TBool dimDown = (iListContainer->Listbox()->CurrentItemIndex() >= iPodcastModel.ActiveShowList().Count() - 1 ?
       
   362 				ETrue : EFalse);
       
   363 		TBool dimUp = (iListContainer->Listbox()->CurrentItemIndex() <= 0 ?
       
   364 				ETrue : EFalse);
       
   365 		
       
   366 		iStylusPopupMenu->SetItemDimmed(EPodcastMoveDownloadDown, dimDown);
       
   367 		iStylusPopupMenu->SetItemDimmed(EPodcastMoveDownloadUp, dimUp);
       
   368 		
       
   369 		iStylusPopupMenu->ShowMenu();
       
   370 		iStylusPopupMenu->SetPosition(aPenEventLocation);
       
   371     }
       
   372     
       
   373 	DP("CPodcastQueueView::HandleLongTapEventL END");
       
   374 }