application/src/PodcastShowsView.cpp
changeset 5 ba42cd6670b8
parent 4 be243543a361
child 6 e211a78d3037
equal deleted inserted replaced
4:be243543a361 5:ba42cd6670b8
    43 const TInt KSizeBufLen = 64;
    43 const TInt KSizeBufLen = 64;
    44 const TInt KDefaultGran = 5;
    44 const TInt KDefaultGran = 5;
    45 _LIT(KSizeDownloadingOf, "%.1f/%.1f MB");
    45 _LIT(KSizeDownloadingOf, "%.1f/%.1f MB");
    46 _LIT(KShowsSizeFormatS60, "%.1f MB");
    46 _LIT(KShowsSizeFormatS60, "%.1f MB");
    47 
    47 
    48 _LIT(KShowFormat, "%d\t%S\t%S %S\t");
    48 _LIT(KShowFormat, "%d\t%S\t%S%S\t");
    49 _LIT(KShowErrorFormat, "%d\t%S\t%S\t");
    49 _LIT(KShowErrorFormat, "%d\t%S\t%S\t");
    50 _LIT(KShowQueueFormat, "%d\t%S\t%S%S\t");
    50 _LIT(KShowQueueFormat, "%d\t%S\t%S%S\t");
    51 
    51 
    52 // these must correspond with TShowsIconIndex
    52 // these must correspond with TShowsIconIndex
    53 
    53 
   590 void CPodcastShowsView::HandleCommandL(TInt aCommand)
   590 void CPodcastShowsView::HandleCommandL(TInt aCommand)
   591 	{
   591 	{
   592 	switch (aCommand)
   592 	switch (aCommand)
   593 		{
   593 		{
   594 		case EPodcastMarkAsPlayed:
   594 		case EPodcastMarkAsPlayed:
   595 			SetShowPlayed(ETrue);
   595 			HandleSetShowPlayed(ETrue);
   596 			break;
   596 			break;
   597 		case EPodcastMarkAsUnplayed:
   597 		case EPodcastMarkAsUnplayed:
   598 			SetShowPlayed(EFalse);
   598 			HandleSetShowPlayed(EFalse);
   599 			break;
   599 			break;
   600 		case EPodcastMarkAllPlayed:
   600 		case EPodcastMarkAllPlayed:
   601 			iPodcastModel.MarkSelectionPlayed();
   601 			iPodcastModel.MarkSelectionPlayed();
   602 			UpdateListboxItemsL();
   602 			UpdateListboxItemsL();
   603 			break;
   603 			break;
   604 		case EPodcastDeleteShow:
   604 		case EPodcastDeleteShow:
   605 			DeleteShow();
   605 			HandleDeleteShow();
   606 			break;
   606 			break;
   607 		case EPodcastDownloadShow:
   607 		case EPodcastDownloadShow:
   608 			{
   608 			{
   609 			TInt index = iListContainer->Listbox()->CurrentItemIndex();
   609 			TInt index = iListContainer->Listbox()->CurrentItemIndex();
   610 			if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
   610 			if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
   621 				{
   621 				{
   622 				TRAPD(error, iPodcastModel.FeedEngine().UpdateFeedL(iPodcastModel.ActiveFeedInfo()->Uid()));
   622 				TRAPD(error, iPodcastModel.FeedEngine().UpdateFeedL(iPodcastModel.ActiveFeedInfo()->Uid()));
   623 
   623 
   624 				if (error != KErrNone)
   624 				if (error != KErrNone)
   625 					{
   625 					{
   626 					HBufC
   626 					HBufC* str =
   627 							* str =
       
   628 							iEikonEnv->AllocReadResourceLC(R_PODCAST_FEEDS_UPDATE_ERROR);
   627 							iEikonEnv->AllocReadResourceLC(R_PODCAST_FEEDS_UPDATE_ERROR);
   629 					User::InfoPrint(*str);
   628 					User::InfoPrint(*str);
   630 					CleanupStack::PopAndDestroy(str);
   629 					CleanupStack::PopAndDestroy(str);
   631 					}
   630 					}
   632 				}
   631 				}
   821 		iStylusPopupMenu->SetPosition(aPenEventLocation);
   820 		iStylusPopupMenu->SetPosition(aPenEventLocation);
   822     }
   821     }
   823 	DP("CPodcastShowsView::HandleLongTapEventL END");
   822 	DP("CPodcastShowsView::HandleLongTapEventL END");
   824 }
   823 }
   825 
   824 
   826 void CPodcastShowsView::SetShowPlayed(TBool aPlayed)
   825 void CPodcastShowsView::HandleSetShowPlayed(TBool aPlayed)
   827 	{
   826 	{
   828 
   827 
   829 	TInt index = iListContainer->Listbox()->CurrentItemIndex();
   828 	TInt index = iListContainer->Listbox()->CurrentItemIndex();
   830 				
   829 				
   831 	if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
   830 	if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
   836 		UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0);
   835 		UpdateShowItemDataL(iPodcastModel.ActiveShowList()[index], index, 0);
   837 		iListContainer->Listbox()->DrawItem(index);					
   836 		iListContainer->Listbox()->DrawItem(index);					
   838 		}
   837 		}
   839 	}
   838 	}
   840 
   839 
   841 void CPodcastShowsView::DeleteShow()
   840 void CPodcastShowsView::HandleDeleteShow()
   842 	{
   841 	{
   843 	TInt index = iListContainer->Listbox()->CurrentItemIndex();
   842 	TInt index = iListContainer->Listbox()->CurrentItemIndex();
   844 
   843 
   845 	if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
   844 	if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
   846 		{
   845 		{