application/src/PodcastShowsView.cpp
branchsymbian1
changeset 336 3d6c1417e8bd
parent 288 757e84a30b9a
child 347 b8d687bb7ca1
equal deleted inserted replaced
296:80f1da5ac28b 336:3d6c1417e8bd
    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 	iStylusPopupMenu = CAknStylusPopUpMenu::NewL( this , TPoint(0,0));
   117 	iStylusPopupMenu = CAknStylusPopUpMenu::NewL( this , TPoint(0,0));
   119 	TResourceReader reader;
   118 	TResourceReader reader;
   145 		icons->AppendL(CGulIcon::NewL(bitmap, mask) );
   144 		icons->AppendL(CGulIcon::NewL(bitmap, mask) );
   146 		CleanupStack::Pop(2); // bitmap, mask
   145 		CleanupStack::Pop(2); // bitmap, mask
   147 		pos+=2;
   146 		pos+=2;
   148 		}
   147 		}
   149 		
   148 		
   150 	iListContainer->Listbox()->ItemDrawer()->FormattedCellData()->SetIconArrayL(icons);
   149 	//iListContainer->Listbox()->ItemDrawer()->FormattedCellData()->SetIconArrayL(icons);
       
   150 	iListContainer->SetListboxIcons(icons);
   151 	CleanupStack::Pop(icons); // icons
   151 	CleanupStack::Pop(icons); // icons
   152 	}
   152 	}
   153 
   153 
   154 TKeyResponse CPodcastShowsView::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
   154 TKeyResponse CPodcastShowsView::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
   155 	{
   155 	{
   217 	
   217 	
   218 	iPreviousView = TVwsViewId(KUidPodcast, KUidPodcastFeedViewID);
   218 	iPreviousView = TVwsViewId(KUidPodcast, KUidPodcastFeedViewID);
   219 	
   219 	
   220 	UpdateViewTitleL();
   220 	UpdateViewTitleL();
   221 	UpdateFeedUpdateStateL();
   221 	UpdateFeedUpdateStateL();
   222 	UpdateToolbar();
       
   223 	DP("CPodcastShowsView::DoActivateL END");
   222 	DP("CPodcastShowsView::DoActivateL END");
   224 	}
   223 	}
   225 
   224 
   226 void CPodcastShowsView::DoDeactivate()
   225 void CPodcastShowsView::DoDeactivate()
   227 	{
   226 	{
   459 		{
   458 		{
   460 		infoSize.Insert(0,_L(", "));
   459 		infoSize.Insert(0,_L(", "));
   461 		}
   460 		}
   462 		
   461 		
   463 	iListboxFormatbuffer.Format(KShowFormat(), iconIndex, &aShowInfo.Title(), &showDate, &infoSize);
   462 	iListboxFormatbuffer.Format(KShowFormat(), iconIndex, &aShowInfo.Title(), &showDate, &infoSize);
       
   463 	iListboxFormatbufferShort.Format(KShowFormatLandscape(), iconIndex, &aShowInfo.Title());
   464 	}
   464 	}
   465 
   465 
   466 void CPodcastShowsView::GetShowErrorText(TDes &aErrorMessage, TInt aErrorCode)
   466 void CPodcastShowsView::GetShowErrorText(TDes &aErrorMessage, TInt aErrorCode)
   467 	{
   467 	{
   468 	TRAP_IGNORE(((CPodcastAppUi*)AppUi())->GetErrorTextL(aErrorMessage,aErrorCode));
   468 	TRAP_IGNORE(((CPodcastAppUi*)AppUi())->GetErrorTextL(aErrorMessage,aErrorCode));
   470 
   470 
   471 void CPodcastShowsView::UpdateShowItemDataL(CShowInfo* aShowInfo,TInt aIndex, TInt aSizeDownloaded)
   471 void CPodcastShowsView::UpdateShowItemDataL(CShowInfo* aShowInfo,TInt aIndex, TInt aSizeDownloaded)
   472 {
   472 {
   473 	FormatShowInfoListBoxItemL(*aShowInfo, aSizeDownloaded);
   473 	FormatShowInfoListBoxItemL(*aShowInfo, aSizeDownloaded);
   474 	iItemArray->Delete(aIndex);
   474 	iItemArray->Delete(aIndex);
       
   475 	iItemArrayShort->Delete(aIndex);
       
   476 	
   475 	if(aIndex>= iItemArray->MdcaCount())
   477 	if(aIndex>= iItemArray->MdcaCount())
   476 		{
   478 		{
   477 		iItemArray->AppendL(iListboxFormatbuffer);
   479 		iItemArray->AppendL(iListboxFormatbuffer);
       
   480 		iItemArrayShort->AppendL(iListboxFormatbufferShort);
   478 		}
   481 		}
   479 	else
   482 	else
   480 		{
   483 		{
   481 		iItemArray->InsertL(aIndex, iListboxFormatbuffer);
   484 		iItemArray->InsertL(aIndex, iListboxFormatbuffer);
       
   485 		iItemArrayShort->InsertL(aIndex, iListboxFormatbufferShort);
   482 		}
   486 		}
   483 }
   487 }
   484 
   488 
   485 void CPodcastShowsView::UpdateShowItemL(TUint aUid, TInt aSizeDownloaded)
   489 void CPodcastShowsView::UpdateShowItemL(TUint aUid, TInt aSizeDownloaded)
   486 {
   490 {
   497 	}
   501 	}
   498 }
   502 }
   499 
   503 
   500 void CPodcastShowsView::UpdateListboxItemsL()
   504 void CPodcastShowsView::UpdateListboxItemsL()
   501 	{
   505 	{
       
   506 	DP("CPodcastShowsView::UpdateListboxItemsL BEGIN");
   502 	if (iListContainer->IsVisible())
   507 	if (iListContainer->IsVisible())
   503 		{
   508 		{
   504 		TListItemProperties itemProps;
   509 		TListItemProperties itemProps;
   505 		TInt len = 0;
   510 		TInt len = 0;
   506 
   511 
   536 					}
   541 					}
   537 				iListContainer->Listbox()->DrawNow();
   542 				iListContainer->Listbox()->DrawNow();
   538 				}
   543 				}
   539 			else
   544 			else
   540 				{
   545 				{
   541 				iListContainer->Listbox()->ItemDrawer()->ClearAllPropertiesL();
   546 				//iListContainer->Listbox()->ItemDrawer()->ClearAllPropertiesL();
   542 				iListContainer->Listbox()->Reset();
   547 				iListContainer->Listbox()->Reset();
   543 				iItemIdArray.Reset();
   548 				iItemIdArray.Reset();
   544 				iItemArray->Reset();
   549 				iItemArray->Reset();
   545 
   550 				iItemArrayShort->Reset();
       
   551 				
   546 				if (len > 0)
   552 				if (len > 0)
   547 					{
   553 					{
   548 					for (TInt i=0; i<len; i++)
   554 					for (TInt i=0; i<len; i++)
   549 						{
   555 						{
   550 						CShowInfo *si = fItems[i];
   556 						CShowInfo *si = fItems[i];
   551 						FormatShowInfoListBoxItemL(*si);
   557 						FormatShowInfoListBoxItemL(*si);
   552 						iItemIdArray.Append(si->Uid());						
   558 						iItemIdArray.Append(si->Uid());						
   553 						iItemArray->AppendL(iListboxFormatbuffer);
   559 						iItemArray->AppendL(iListboxFormatbuffer);
       
   560 						iItemArrayShort->AppendL(iListboxFormatbufferShort);
       
   561 												
   554 						}
   562 						}
   555 					}
   563 					}
   556 				else
   564 				else
   557 					{
   565 					{
   558 					iItemArray->Reset();
   566 					iItemArray->Reset();
       
   567 					iItemArrayShort->Reset();
   559 					iItemIdArray.Reset();
   568 					iItemIdArray.Reset();
   560 					
   569 					
   561 					itemProps.SetDimmed(ETrue);
   570 					itemProps.SetDimmed(ETrue);
   562 					itemProps.SetHiddenSelection(ETrue);
   571 					itemProps.SetHiddenSelection(ETrue);
   563 					}
   572 					}
   564 				iListContainer->Listbox()->HandleItemAdditionL();
   573 				iListContainer->Listbox()->HandleItemAdditionL();
   565 				}				
   574 				}				
   566 			}
   575 			}
   567 		}
   576 		}
       
   577 	DP("CPodcastShowsView::UpdateListboxItemsL END");
   568 	}
   578 	}
   569 
   579 
   570 /** 
   580 /** 
   571  * Command handling function intended for overriding by sub classes. 
   581  * Command handling function intended for overriding by sub classes. 
   572  * Default implementation is empty.  
   582  * Default implementation is empty.