application/src/PodcastShowsView.cpp
branchtwolistboxes
changeset 316 841ccfa933ac
parent 314 e7776f6a2198
child 317 5afc95a6ad83
equal deleted inserted replaced
315:091fa3bf3295 316:841ccfa933ac
    36 
    36 
    37 _LIT(KSizeDownloadingOf, "%.1f/%.1f MB");
    37 _LIT(KSizeDownloadingOf, "%.1f/%.1f MB");
    38 _LIT(KShowsSizeFormatS60, "%.1f MB");
    38 _LIT(KShowsSizeFormatS60, "%.1f MB");
    39 
    39 
    40 _LIT(KShowFormat, "%d\t%S\t%S%S");
    40 _LIT(KShowFormat, "%d\t%S\t%S%S");
       
    41 _LIT(KShowFormatLandscape, "%d\t%S");
    41 
    42 
    42 // these must correspond with TShowsIconIndex
    43 // these must correspond with TShowsIconIndex
    43 
    44 
    44 const TUint KShowIconArrayIds[] =
    45 const TUint KShowIconArrayIds[] =
    45 	{
    46 	{
   457 		{
   458 		{
   458 		infoSize.Insert(0,_L(", "));
   459 		infoSize.Insert(0,_L(", "));
   459 		}
   460 		}
   460 		
   461 		
   461 	iListboxFormatbuffer.Format(KShowFormat(), iconIndex, &aShowInfo.Title(), &showDate, &infoSize);
   462 	iListboxFormatbuffer.Format(KShowFormat(), iconIndex, &aShowInfo.Title(), &showDate, &infoSize);
       
   463 	iListboxFormatbufferShort.Format(KShowFormatLandscape(), iconIndex, &aShowInfo.Title(), &showDate, &infoSize);
   462 	}
   464 	}
   463 
   465 
   464 void CPodcastShowsView::GetShowErrorText(TDes &aErrorMessage, TInt aErrorCode)
   466 void CPodcastShowsView::GetShowErrorText(TDes &aErrorMessage, TInt aErrorCode)
   465 	{
   467 	{
   466 	TRAP_IGNORE(((CPodcastAppUi*)AppUi())->GetErrorTextL(aErrorMessage,aErrorCode));
   468 	TRAP_IGNORE(((CPodcastAppUi*)AppUi())->GetErrorTextL(aErrorMessage,aErrorCode));
   468 
   470 
   469 void CPodcastShowsView::UpdateShowItemDataL(CShowInfo* aShowInfo,TInt aIndex, TInt aSizeDownloaded)
   471 void CPodcastShowsView::UpdateShowItemDataL(CShowInfo* aShowInfo,TInt aIndex, TInt aSizeDownloaded)
   470 {
   472 {
   471 	FormatShowInfoListBoxItemL(*aShowInfo, aSizeDownloaded);
   473 	FormatShowInfoListBoxItemL(*aShowInfo, aSizeDownloaded);
   472 	iItemArray->Delete(aIndex);
   474 	iItemArray->Delete(aIndex);
       
   475 	iItemArrayShort->Delete(aIndex);
       
   476 	
   473 	if(aIndex>= iItemArray->MdcaCount())
   477 	if(aIndex>= iItemArray->MdcaCount())
   474 		{
   478 		{
   475 		iItemArray->AppendL(iListboxFormatbuffer);
   479 		iItemArray->AppendL(iListboxFormatbuffer);
       
   480 		iItemArrayShort->AppendL(iListboxFormatbufferShort);
   476 		}
   481 		}
   477 	else
   482 	else
   478 		{
   483 		{
   479 		iItemArray->InsertL(aIndex, iListboxFormatbuffer);
   484 		iItemArray->InsertL(aIndex, iListboxFormatbuffer);
   480 		}
   485 		iItemArrayShort->InsertL(aIndex, iListboxFormatbufferShort);
   481 	
   486 		}
   482 	iListContainer->SetTextArray(iItemArray);
       
   483 }
   487 }
   484 
   488 
   485 void CPodcastShowsView::UpdateShowItemL(TUint aUid, TInt aSizeDownloaded)
   489 void CPodcastShowsView::UpdateShowItemL(TUint aUid, TInt aSizeDownloaded)
   486 {
   490 {
   487 	RShowInfoArray& array = iPodcastModel.ActiveShowList();
   491 	RShowInfoArray& array = iPodcastModel.ActiveShowList();
   540 				{
   544 				{
   541 				iListContainer->Listbox()->ItemDrawer()->ClearAllPropertiesL();
   545 				iListContainer->Listbox()->ItemDrawer()->ClearAllPropertiesL();
   542 				iListContainer->Listbox()->Reset();
   546 				iListContainer->Listbox()->Reset();
   543 				iItemIdArray.Reset();
   547 				iItemIdArray.Reset();
   544 				iItemArray->Reset();
   548 				iItemArray->Reset();
   545 
   549 				iItemArrayShort->Reset();
       
   550 				
   546 				if (len > 0)
   551 				if (len > 0)
   547 					{
   552 					{
   548 					for (TInt i=0; i<len; i++)
   553 					for (TInt i=0; i<len; i++)
   549 						{
   554 						{
   550 						CShowInfo *si = fItems[i];
   555 						CShowInfo *si = fItems[i];
   551 						FormatShowInfoListBoxItemL(*si);
   556 						FormatShowInfoListBoxItemL(*si);
   552 						iItemIdArray.Append(si->Uid());						
   557 						iItemIdArray.Append(si->Uid());						
   553 						iItemArray->AppendL(iListboxFormatbuffer);
   558 						iItemArray->AppendL(iListboxFormatbuffer);
       
   559 						iItemArrayShort->AppendL(iListboxFormatbufferShort);
       
   560 												
   554 						}
   561 						}
   555 					}
   562 					}
   556 				else
   563 				else
   557 					{
   564 					{
   558 					iItemArray->Reset();
   565 					iItemArray->Reset();
       
   566 					iItemArrayShort->Reset();
   559 					iItemIdArray.Reset();
   567 					iItemIdArray.Reset();
   560 					
   568 					
   561 					itemProps.SetDimmed(ETrue);
   569 					itemProps.SetDimmed(ETrue);
   562 					itemProps.SetHiddenSelection(ETrue);
   570 					itemProps.SetHiddenSelection(ETrue);
   563 					}
   571 					}
   564 				iListContainer->SetTextArray(iItemArray);
       
   565 				iListContainer->Listbox()->HandleItemAdditionL();
   572 				iListContainer->Listbox()->HandleItemAdditionL();
   566 				}				
   573 				}				
   567 			}
   574 			}
   568 		}
   575 		}
   569 	}
   576 	}