application/src/PodcastShowsView.cpp
branchRCL_3
changeset 319 0ad6784f49b8
parent 318 a231cc388498
child 367 4b75876aa85a
equal deleted inserted replaced
312:2faae209e72b 319:0ad6784f49b8
    35 #define KMaxMessageLength 200
    35 #define KMaxMessageLength 200
    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\t");
    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 	{
   107 	{
   108 	{
   108 	BaseConstructL(R_PODCAST_SHOWSVIEW);
   109 	BaseConstructL(R_PODCAST_SHOWSVIEW);
   109 	CPodcastListView::ConstructL();
   110 	CPodcastListView::ConstructL();
   110 	
   111 	
   111 	CreateIconsL();
   112 	CreateIconsL();
   112 	
   113 		
   113 	iListContainer->Listbox()->SetListBoxObserver(this);
       
   114 	
       
   115 	iPodcastModel.FeedEngine().AddObserver(this);
   114 	iPodcastModel.FeedEngine().AddObserver(this);
   116 	iPodcastModel.ShowEngine().AddObserver(this);
   115 	iPodcastModel.ShowEngine().AddObserver(this);
   117 	}
   116 	}
   118 
   117 
   119 void CPodcastShowsView::CreateIconsL()
   118 void CPodcastShowsView::CreateIconsL()
   138 		icons->AppendL(CGulIcon::NewL(bitmap, mask) );
   137 		icons->AppendL(CGulIcon::NewL(bitmap, mask) );
   139 		CleanupStack::Pop(2); // bitmap, mask
   138 		CleanupStack::Pop(2); // bitmap, mask
   140 		pos+=2;
   139 		pos+=2;
   141 		}
   140 		}
   142 		
   141 		
   143 	iListContainer->Listbox()->ItemDrawer()->FormattedCellData()->SetIconArrayL(icons);
   142 	//iListContainer->Listbox()->ItemDrawer()->FormattedCellData()->SetIconArrayL(icons);
       
   143 	iListContainer->SetListboxIcons(icons);
   144 	CleanupStack::Pop(icons); // icons
   144 	CleanupStack::Pop(icons); // icons
   145 	}
   145 	}
   146 
   146 
   147 TKeyResponse CPodcastShowsView::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
   147 TKeyResponse CPodcastShowsView::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
   148 	{
   148 	{
   450 		{
   450 		{
   451 		infoSize.Insert(0,_L(", "));
   451 		infoSize.Insert(0,_L(", "));
   452 		}
   452 		}
   453 		
   453 		
   454 	iListboxFormatbuffer.Format(KShowFormat(), iconIndex, &aShowInfo.Title(), &showDate, &infoSize);
   454 	iListboxFormatbuffer.Format(KShowFormat(), iconIndex, &aShowInfo.Title(), &showDate, &infoSize);
       
   455 	iListboxFormatbufferShort.Format(KShowFormatLandscape(), iconIndex, &aShowInfo.Title());
   455 	}
   456 	}
   456 
   457 
   457 void CPodcastShowsView::GetShowErrorText(TDes &aErrorMessage, TInt aErrorCode)
   458 void CPodcastShowsView::GetShowErrorText(TDes &aErrorMessage, TInt aErrorCode)
   458 	{
   459 	{
   459 	TRAP_IGNORE(((CPodcastAppUi*)AppUi())->GetErrorTextL(aErrorMessage,aErrorCode));
   460 	TRAP_IGNORE(((CPodcastAppUi*)AppUi())->GetErrorTextL(aErrorMessage,aErrorCode));
   461 
   462 
   462 void CPodcastShowsView::UpdateShowItemDataL(CShowInfo* aShowInfo,TInt aIndex, TInt aSizeDownloaded)
   463 void CPodcastShowsView::UpdateShowItemDataL(CShowInfo* aShowInfo,TInt aIndex, TInt aSizeDownloaded)
   463 {
   464 {
   464 	FormatShowInfoListBoxItemL(*aShowInfo, aSizeDownloaded);
   465 	FormatShowInfoListBoxItemL(*aShowInfo, aSizeDownloaded);
   465 	iItemArray->Delete(aIndex);
   466 	iItemArray->Delete(aIndex);
       
   467 	iItemArrayShort->Delete(aIndex);
       
   468 	
   466 	if(aIndex>= iItemArray->MdcaCount())
   469 	if(aIndex>= iItemArray->MdcaCount())
   467 		{
   470 		{
   468 		iItemArray->AppendL(iListboxFormatbuffer);
   471 		iItemArray->AppendL(iListboxFormatbuffer);
       
   472 		iItemArrayShort->AppendL(iListboxFormatbufferShort);
   469 		}
   473 		}
   470 	else
   474 	else
   471 		{
   475 		{
   472 		iItemArray->InsertL(aIndex, iListboxFormatbuffer);
   476 		iItemArray->InsertL(aIndex, iListboxFormatbuffer);
       
   477 		iItemArrayShort->InsertL(aIndex, iListboxFormatbufferShort);
   473 		}
   478 		}
   474 }
   479 }
   475 
   480 
   476 void CPodcastShowsView::UpdateShowItemL(TUint aUid, TInt aSizeDownloaded)
   481 void CPodcastShowsView::UpdateShowItemL(TUint aUid, TInt aSizeDownloaded)
   477 {
   482 {
   527 					}
   532 					}
   528 				iListContainer->Listbox()->DrawNow();
   533 				iListContainer->Listbox()->DrawNow();
   529 				}
   534 				}
   530 			else
   535 			else
   531 				{
   536 				{
   532 				iListContainer->Listbox()->ItemDrawer()->ClearAllPropertiesL();
   537 				//iListContainer->Listbox()->ItemDrawer()->ClearAllPropertiesL();
   533 				iListContainer->Listbox()->Reset();
   538 				iListContainer->Listbox()->Reset();
   534 				iItemIdArray.Reset();
   539 				iItemIdArray.Reset();
   535 				iItemArray->Reset();
   540 				iItemArray->Reset();
   536 
   541 				iItemArrayShort->Reset();
       
   542 				
   537 				if (len > 0)
   543 				if (len > 0)
   538 					{
   544 					{
   539 					for (TInt i=0; i<len; i++)
   545 					for (TInt i=0; i<len; i++)
   540 						{
   546 						{
   541 						CShowInfo *si = fItems[i];
   547 						CShowInfo *si = fItems[i];
   542 						FormatShowInfoListBoxItemL(*si);
   548 						FormatShowInfoListBoxItemL(*si);
   543 						iItemIdArray.Append(si->Uid());						
   549 						iItemIdArray.Append(si->Uid());						
   544 						iItemArray->AppendL(iListboxFormatbuffer);
   550 						iItemArray->AppendL(iListboxFormatbuffer);
       
   551 						iItemArrayShort->AppendL(iListboxFormatbufferShort);
       
   552 												
   545 						}
   553 						}
   546 					}
   554 					}
   547 				else
   555 				else
   548 					{
   556 					{
   549 					iItemArray->Reset();
   557 					iItemArray->Reset();
       
   558 					iItemArrayShort->Reset();
   550 					iItemIdArray.Reset();
   559 					iItemIdArray.Reset();
   551 					
   560 					
   552 					itemProps.SetDimmed(ETrue);
   561 					itemProps.SetDimmed(ETrue);
   553 					itemProps.SetHiddenSelection(ETrue);
   562 					itemProps.SetHiddenSelection(ETrue);
   554 					}
   563 					}