application/src/PodcastQueueView.cpp
changeset 82 d87e984bd8b8
parent 78 12c59f14a031
child 83 a2e43aa1ad11
equal deleted inserted replaced
81:27f6f5827e5d 82:d87e984bd8b8
   387 		}
   387 		}
   388 	else
   388 	else
   389 		{
   389 		{
   390 		aShowInfo.PubDate().FormatL(showDate, KDateFormatShort());
   390 		aShowInfo.PubDate().FormatL(showDate, KDateFormatShort());
   391 		}
   391 		}
   392 
   392 	
   393 	if (infoSize.Length() > 0) {
   393 	if(aShowInfo.LastError() != KErrNone)
       
   394 		{
       
   395 		((CPodcastAppUi*)AppUi())->GetErrorText(infoSize, aShowInfo.LastError());
       
   396 		showDate.Zero();
       
   397 		}
       
   398 		
       
   399 	if (infoSize.Length() > 0 && showDate.Length() > 0)
       
   400 		{
   394 		infoSize.Insert(0,_L(", "));
   401 		infoSize.Insert(0,_L(", "));
   395 	}
   402 		}
   396 	
   403 
   397 	iListboxFormatbuffer.Format(KShowQueueFormat(), iconIndex, &aShowInfo.Title(), &showDate, &infoSize);
   404 	iListboxFormatbuffer.Format(KShowQueueFormat(), iconIndex, &aShowInfo.Title(), &showDate, &infoSize);
   398 	}
   405 	}
   399 
   406 
   400 void CPodcastQueueView::UpdateShowItemDataL(CShowInfo* aShowInfo,TInt aIndex, TInt aSizeDownloaded)
   407 void CPodcastQueueView::UpdateShowItemDataL(CShowInfo* aShowInfo,TInt aIndex, TInt aSizeDownloaded)
   401 {
   408 {
   520 		case EPodcastRemoveDownload:
   527 		case EPodcastRemoveDownload:
   521 			{
   528 			{
   522 			TInt index = iListContainer->Listbox()->CurrentItemIndex();
   529 			TInt index = iListContainer->Listbox()->CurrentItemIndex();
   523 			if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
   530 			if (index >= 0 && index < iPodcastModel.ActiveShowList().Count())
   524 				{
   531 				{
       
   532 				iEatQueueUpdate = ETrue;
   525 				TRAPD(err, iPodcastModel.ShowEngine().RemoveDownloadL(iPodcastModel.ActiveShowList()[index]->Uid()));
   533 				TRAPD(err, iPodcastModel.ShowEngine().RemoveDownloadL(iPodcastModel.ActiveShowList()[index]->Uid()));
   526 				
   534 				
   527 				if (err == KErrNone)
   535 				if (err == KErrNone)
   528 					{
   536 					{
   529 					iItemArray->Delete(index);
   537 					iItemArray->Delete(index);
   530 					iItemIdArray.Remove(index);						
   538 					iItemIdArray.Remove(index);						
   531 					iListContainer->Listbox()->HandleItemRemovalL();
   539 					iListContainer->Listbox()->HandleItemRemovalL();
   532 					iListContainer->Listbox()->SetCurrentItemIndex(index - 1 > 0 ? index - 1 : 0);
   540 					iListContainer->Listbox()->SetCurrentItemIndex(index - 1 > 0 ? index - 1 : 0);
   533 					iListContainer->Listbox()->DrawNow();
   541 					iListContainer->Listbox()->DrawNow();
   534 					
       
   535 					delete iPodcastModel.ActiveShowList()[index];
       
   536 					iPodcastModel.ActiveShowList().Remove(index);
       
   537 					}
   542 					}
       
   543 				iEatQueueUpdate = EFalse;
   538 				}
   544 				}
   539 			}
   545 			}
   540 			break;
   546 			break;
   541 		case EPodcastSuspendDownloads:
   547 		case EPodcastSuspendDownloads:
   542 			{
   548 			{
   587 	}
   593 	}
   588 }
   594 }
   589 
   595 
   590 void CPodcastQueueView::DownloadQueueUpdatedL(TInt /*aDownloadingShows*/, TInt /*aQueuedShows*/)
   596 void CPodcastQueueView::DownloadQueueUpdatedL(TInt /*aDownloadingShows*/, TInt /*aQueuedShows*/)
   591 	{
   597 	{
   592 	UpdateListboxItemsL();
   598 	if (!iEatQueueUpdate)
       
   599 		UpdateListboxItemsL();
   593 	}
   600 	}
   594 
   601 
   595 void CPodcastQueueView::FeedUpdateAllCompleteL(TFeedState /*aState*/)
   602 void CPodcastQueueView::FeedUpdateAllCompleteL(TFeedState /*aState*/)
   596 	{
   603 	{
   597 	UpdateListboxItemsL();
   604 	UpdateListboxItemsL();