application/src/PodcastShowsView.cpp
changeset 36 e010fc411ddc
parent 35 66c5303f3610
parent 34 a6046405f1aa
child 41 56821195bd44
equal deleted inserted replaced
35:66c5303f3610 36:e010fc411ddc
   243 		{
   243 		{
   244 		UpdateShowItemL(info->Uid(), aBytesOfCurrentDownload);
   244 		UpdateShowItemL(info->Uid(), aBytesOfCurrentDownload);
   245 		}		
   245 		}		
   246 	}
   246 	}
   247 
   247 
   248 void CPodcastShowsView::ShowDownloadFinishedL(TUint /*aShowUid*/, TInt aError)
   248 void CPodcastShowsView::ShowDownloadFinishedL(TUint aShowUid, TInt aError)
   249 	{
   249 	{
   250 	iProgressAdded = EFalse;
   250 	iProgressAdded = EFalse;
       
   251 	CShowInfo *info = NULL;
       
   252 	RShowInfoArray &fItems = iPodcastModel.ActiveShowList();
       
   253 	
       
   254 	for (TInt i=0;i<fItems.Count();i++)
       
   255 		{
       
   256 		if (fItems[i]->Uid() == aShowUid)
       
   257 			{
       
   258 			info = fItems[i];
       
   259 			}
       
   260 		}
       
   261 	
       
   262 	if (info == NULL) {
       
   263 		return;
       
   264 	}
   251 	
   265 	
   252 	switch(aError)
   266 	switch(aError)
   253 		{
   267 		{
   254 		case KErrCouldNotConnect:
   268 		case KErrCouldNotConnect:
   255 			{
   269 			{
   334 	}
   348 	}
   335 
   349 
   336 void CPodcastShowsView::GetShowIcons(CShowInfo* aShowInfo, TInt& aIconIndex)
   350 void CPodcastShowsView::GetShowIcons(CShowInfo* aShowInfo, TInt& aIconIndex)
   337 	{
   351 	{
   338 	TBool dlStop = iPodcastModel.SettingsEngine().DownloadSuspended();
   352 	TBool dlStop = iPodcastModel.SettingsEngine().DownloadSuspended();
   339 	TUint showDownloadingUid = iPodcastModel.ShowEngine().ShowDownloading() ? iPodcastModel.ShowEngine().ShowDownloading()->Uid() : 0;
   353 
   340 	
   354 	switch (aShowInfo->DownloadState())
   341 	if (showDownloadingUid == aShowInfo->Uid())
   355 		{
   342 		{
   356 		case EDownloaded:
   343 		aIconIndex = dlStop ? ESuspendedShowIcon : EDownloadingShowIcon;		
   357 			if (aShowInfo->PlayState() == ENeverPlayed) {
   344 		}
   358 				aIconIndex = EDownloadedNewShowIcon;
   345 	else
   359 			} else {
   346 		{
   360 				aIconIndex = EDownloadedShowIcon;
   347 		switch (aShowInfo->DownloadState())
   361 			}
   348 			{
   362 			break;
   349 			case EDownloaded:
   363 		case ENotDownloaded:
   350 				if (aShowInfo->PlayState() == ENeverPlayed) {
   364 			if (aShowInfo->PlayState() == ENeverPlayed) {
   351 					aIconIndex = EDownloadedNewShowIcon;
   365 				aIconIndex = ENewShowIcon;
   352 				} else {
   366 			} else {
   353 					aIconIndex = EDownloadedShowIcon;
   367 				aIconIndex = EShowIcon;
   354 				}
   368 			}
   355 				break;
   369 			break;
   356 			case ENotDownloaded:
   370 		case EQueued:
   357 				if (aShowInfo->PlayState() == ENeverPlayed) {
   371 			aIconIndex = dlStop ? ESuspendedShowIcon : EQuedShowIcon;
   358 					aIconIndex = ENewShowIcon;
   372 			break;
   359 				} else {
   373 		case EDownloading:
   360 					aIconIndex = EShowIcon;
   374 			aIconIndex = dlStop ? ESuspendedShowIcon : EDownloadingShowIcon;		
   361 				}
   375 			break;
   362 				break;
   376 		case EFailedDownload:
   363 			case EQueued:
   377 			aIconIndex = EFailedShowIcon;
   364 				aIconIndex = dlStop ? ESuspendedShowIcon : EQuedShowIcon;
   378 			break;
   365 				break;
       
   366 			case EDownloading:
       
   367 				aIconIndex = dlStop ? ESuspendedShowIcon : EDownloadingShowIcon;		
       
   368 				break;
       
   369 			case EFailedDownload:
       
   370 				aIconIndex = EFailedShowIcon;
       
   371 				break;
       
   372 			}
       
   373 		}
   379 		}
   374 	}
   380 	}
   375 	
   381 	
   376 
   382 
   377 void CPodcastShowsView::UpdateFeedUpdateStateL()
   383 void CPodcastShowsView::UpdateFeedUpdateStateL()
   507 				}
   513 				}
   508 
   514 
   509 			if (allUidsMatch && len > 0)
   515 			if (allUidsMatch && len > 0)
   510 				{
   516 				{
   511 				for (TInt loop = 0; loop< len; loop++)
   517 				for (TInt loop = 0; loop< len; loop++)
   512 					{					
   518 					{
   513 					UpdateShowItemDataL(fItems[loop], loop);
   519 					UpdateShowItemDataL(fItems[loop], loop);
   514 					//iListContainer->Listbox()->DrawItem(loop);
       
   515 					}
   520 					}
       
   521 				iListContainer->Listbox()->DrawNow();
   516 				}
   522 				}
   517 			else
   523 			else
   518 				{
   524 				{
   519 				iListContainer->Listbox()->ItemDrawer()->ClearAllPropertiesL();
   525 				iListContainer->Listbox()->ItemDrawer()->ClearAllPropertiesL();
   520 				iListContainer->Listbox()->Reset();
   526 				iListContainer->Listbox()->Reset();
   568 			HandleDeleteShowL();
   574 			HandleDeleteShowL();
   569 			break;
   575 			break;
   570 		case EPodcastDownloadShow:
   576 		case EPodcastDownloadShow:
   571 			{
   577 			{
   572 			TInt index = iListContainer->Listbox()->CurrentItemIndex();
   578 			TInt index = iListContainer->Listbox()->CurrentItemIndex();
       
   579 			
   573 			if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
   580 			if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
   574 				{
   581 				{
   575 				iPodcastModel.ShowEngine().AddDownloadL(*iPodcastModel.ActiveShowList()[index]);
   582 				iPodcastModel.ShowEngine().AddDownloadL(*iPodcastModel.ActiveShowList()[index]);
   576 				UpdateShowItemL(iPodcastModel.ActiveShowList()[index]->Uid(),-1);
   583 				UpdateShowItemL(iPodcastModel.ActiveShowList()[index]->Uid(),-1);
   577 				}
   584 				}
   617 		TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid();
   624 		TBool updatingState = iPodcastModel.FeedEngine().ClientState() != EIdle && iPodcastModel.FeedEngine().ActiveClientUid() == iPodcastModel.ActiveFeedInfo()->Uid();
   618 		aMenuPane->SetItemDimmed(EPodcastMarkAllPlayed, updatingState);
   625 		aMenuPane->SetItemDimmed(EPodcastMarkAllPlayed, updatingState);
   619 		}
   626 		}
   620 }
   627 }
   621 	
   628 	
   622 void CPodcastShowsView::ImageOperationCompleteL(TInt aError)
   629 void CPodcastShowsView::ImageOperationCompleteL(TInt aError, TUint /*aHandle*/)
   623 	{
   630 	{
   624 	iLastImageHandlerError = aError;
   631 	iLastImageHandlerError = aError;
   625 	if(iSetTitlebarImage)
   632 	if(iSetTitlebarImage)
   626 		{
   633 		{
   627 		iSetTitlebarImage = EFalse;
   634 		iSetTitlebarImage = EFalse;
   811 	}
   818 	}
   812 
   819 
   813 void CPodcastShowsView::DownloadQueueUpdatedL(TInt aDownloadingShows, TInt aQueuedShows)
   820 void CPodcastShowsView::DownloadQueueUpdatedL(TInt aDownloadingShows, TInt aQueuedShows)
   814 	{
   821 	{
   815 	((CPodcastAppUi*)AppUi())->UpdateQueueTabL(aDownloadingShows+aQueuedShows);
   822 	((CPodcastAppUi*)AppUi())->UpdateQueueTabL(aDownloadingShows+aQueuedShows);
       
   823 	UpdateListboxItemsL();
   816 	}
   824 	}
   817 
   825 
   818 void CPodcastShowsView::FeedUpdateAllCompleteL(TFeedState /*aState*/)
   826 void CPodcastShowsView::FeedUpdateAllCompleteL(TFeedState /*aState*/)
   819 	{
   827 	{
   820 	UpdateListboxItemsL();
   828 	UpdateListboxItemsL();