application/src/PodcastSearchView.cpp
branchRCL_3
changeset 319 0ad6784f49b8
parent 318 a231cc388498
child 367 4b75876aa85a
equal deleted inserted replaced
312:2faae209e72b 319:0ad6784f49b8
    41 
    41 
    42 const TInt KMaxFeedNameLength = 100;
    42 const TInt KMaxFeedNameLength = 100;
    43 #define KMaxMessageLength 200
    43 #define KMaxMessageLength 200
    44 #define KMaxTitleLength 100
    44 #define KMaxTitleLength 100
    45 _LIT(KSearchResultFormat, "%d\t%S\t%S");
    45 _LIT(KSearchResultFormat, "%d\t%S\t%S");
       
    46 _LIT(KSearchResultFormatLandscape, "%d\t%S");
    46 
    47 
    47 CPodcastSearchView* CPodcastSearchView::NewL(CPodcastModel& aPodcastModel)
    48 CPodcastSearchView* CPodcastSearchView::NewL(CPodcastModel& aPodcastModel)
    48     {
    49     {
    49     CPodcastSearchView* self = CPodcastSearchView::NewLC(aPodcastModel);
    50     CPodcastSearchView* self = CPodcastSearchView::NewLC(aPodcastModel);
    50     CleanupStack::Pop( self );
    51     CleanupStack::Pop( self );
    82 	CleanupStack::PushL( bitmap );		
    83 	CleanupStack::PushL( bitmap );		
    83 	CleanupStack::PushL( mask );		
    84 	CleanupStack::PushL( mask );		
    84 	icons->AppendL( CGulIcon::NewL( bitmap, mask ) );
    85 	icons->AppendL( CGulIcon::NewL( bitmap, mask ) );
    85 	CleanupStack::Pop(2); // bitmap, mask
    86 	CleanupStack::Pop(2); // bitmap, mask
    86 	
    87 	
    87 	iListContainer->Listbox()->ItemDrawer()->FormattedCellData()->SetIconArrayL( icons );
    88 	iListContainer->SetListboxIcons(icons);
    88 	CleanupStack::Pop(icons); // icons
    89 	CleanupStack::Pop(icons); // icons
    89 
       
    90 	iListContainer->Listbox()->SetListBoxObserver(this);
       
    91 	
    90 	
    92 	SetEmptyTextL(R_PODCAST_EMPTY_SEARCH);
    91 	SetEmptyTextL(R_PODCAST_EMPTY_SEARCH);
    93 }
    92 }
    94     
    93     
    95 CPodcastSearchView::~CPodcastSearchView()
    94 CPodcastSearchView::~CPodcastSearchView()
   161 	const RFeedInfoArray* searchItems = NULL;
   160 	const RFeedInfoArray* searchItems = NULL;
   162 	searchItems = &iPodcastModel.FeedEngine().GetSearchResults();
   161 	searchItems = &iPodcastModel.FeedEngine().GetSearchResults();
   163 	TInt len = searchItems->Count();
   162 	TInt len = searchItems->Count();
   164 	TListItemProperties itemProps;
   163 	TListItemProperties itemProps;
   165 	iListContainer->Listbox()->Reset();
   164 	iListContainer->Listbox()->Reset();
   166 	iListContainer->Listbox()->ItemDrawer()->ClearAllPropertiesL();
   165 	//iListContainer->Listbox()->ItemDrawer()->ClearAllPropertiesL();
   167 	iItemIdArray.Reset();
   166 	iItemIdArray.Reset();
   168 	iItemArray->Reset();
   167 	iItemArray->Reset();
   169 		
   168 		
   170 	if (len > 0) 
   169 	if (len > 0) 
   171 		{
   170 		{
   178 			TBuf<512> descr;
   177 			TBuf<512> descr;
   179 			descr.Copy(fi->Description().Left(512));
   178 			descr.Copy(fi->Description().Left(512));
   180 			PodcastUtils::RemoveAllFormatting(descr);
   179 			PodcastUtils::RemoveAllFormatting(descr);
   181 			iListboxFormatbuffer.Format(KSearchResultFormat(), iconIndex, &fi->Title(), &descr);
   180 			iListboxFormatbuffer.Format(KSearchResultFormat(), iconIndex, &fi->Title(), &descr);
   182 			iItemArray->AppendL(iListboxFormatbuffer);
   181 			iItemArray->AppendL(iListboxFormatbuffer);
   183 			iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(i, itemProps);
   182 			iListboxFormatbufferShort.Format(KSearchResultFormatLandscape(), iconIndex, &fi->Title());
       
   183 			iItemArrayShort->AppendL(iListboxFormatbufferShort);
       
   184 			//iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(i, itemProps);
   184 			}
   185 			}
   185 		} 
   186 		} 
   186 	else 
   187 	else 
   187 		{					
   188 		{					
   188 		TBuf<KMaxFeedNameLength> itemName;
   189 		TBuf<KMaxFeedNameLength> itemName;
   189 		iEikonEnv->ReadResourceL(itemName, R_PODCAST_NO_SEARCH_RESULTS);
   190 		iEikonEnv->ReadResourceL(itemName, R_PODCAST_NO_SEARCH_RESULTS);
   190 		iItemArray->Reset();
   191 		iItemArray->Reset();
       
   192 		iItemArrayShort->Reset();
   191 		iItemIdArray.Reset();
   193 		iItemIdArray.Reset();
   192 
   194 
   193 		TListItemProperties itemProps;
   195 		TListItemProperties itemProps;
   194 		itemProps.SetDimmed(ETrue);
   196 		itemProps.SetDimmed(ETrue);
   195 		itemProps.SetHiddenSelection(ETrue);								
   197 		itemProps.SetHiddenSelection(ETrue);								
   196 		iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(0, itemProps);
   198 		//iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(0, itemProps);
   197 		}
   199 		}
   198 	iListContainer->Listbox()->HandleItemAdditionL();
   200 	iListContainer->Listbox()->HandleItemAdditionL();
   199 	DP("CPodcastSearchView::UpdateListboxItemsL END");
   201 	DP("CPodcastSearchView::UpdateListboxItemsL END");
   200 	}
   202 	}
   201 
   203