269 // ----------------------------------------------------------------------------- |
269 // ----------------------------------------------------------------------------- |
270 // CPbk2NameslistUiControlExtension::FormatDataL |
270 // CPbk2NameslistUiControlExtension::FormatDataL |
271 // ----------------------------------------------------------------------------- |
271 // ----------------------------------------------------------------------------- |
272 // |
272 // |
273 void CPbk2NameslistUiControlExtension::FormatDataL( |
273 void CPbk2NameslistUiControlExtension::FormatDataL( |
274 const MVPbkViewContact& aViewContact, |
274 const MVPbkContactLink& aContactLink, |
275 MPbk2DoubleListboxDataElement& aDataElement ) |
275 MPbk2DoubleListboxDataElement& aDataElement ) |
276 { |
276 { |
277 MVPbkContactLink* link = aViewContact.CreateLinkLC(); |
277 HBufC* txt = NULL; |
278 if( link ) |
278 TPbk2IconId iconId; |
279 { |
279 CSpbContentProvider::TSpbContentType type = CSpbContentProvider::ETypeNone; |
280 HBufC* txt = NULL; |
280 |
281 TPbk2IconId iconId; |
281 iContentProvider.GetContentL( |
282 CSpbContentProvider::TSpbContentType type = CSpbContentProvider::ETypeNone; |
282 *(const_cast<MVPbkContactLink*>(&aContactLink)), txt, iconId, type ); |
283 iContentProvider.GetContentL( *link, txt, iconId, type ); |
283 |
284 |
284 // select proper element type based on content type |
285 // select proper element type based on content type |
285 MPbk2DoubleListboxDataElement::TTextDataType elemType = |
286 MPbk2DoubleListboxDataElement::TTextDataType elemType = |
286 MPbk2DoubleListboxDataElement::ETypeGenericText; |
287 MPbk2DoubleListboxDataElement::ETypeGenericText; |
287 if( type == CSpbContentProvider::ETypePhoneNumber ) |
288 if( type == CSpbContentProvider::ETypePhoneNumber ) |
288 { |
289 { |
289 elemType = MPbk2DoubleListboxDataElement::ETypePhoneNumber; |
290 elemType = MPbk2DoubleListboxDataElement::ETypePhoneNumber; |
290 } |
291 } |
291 else if( type == CSpbContentProvider::ETypePhoneNumberMultiple && txt ) |
292 else if( type == CSpbContentProvider::ETypePhoneNumberMultiple && txt ) |
292 { |
293 { |
293 // if we get multiple phone numbers from content provider, then |
294 // if we get multiple phone numbers from content provider, then |
294 // the string only contains the count (as text). We need to format |
295 // the string only contains the count (as text). We need to format |
295 // that into proper UI text. |
296 // that into proper UI text. |
296 TInt num = 0; |
297 TInt num = 0; |
297 TLex16 lex( *txt ); |
298 TLex16 lex( *txt ); |
298 TInt err = lex.Val( num ); |
299 TInt err = lex.Val( num ); |
299 if( !err ) |
300 if( !err ) |
300 { |
301 { |
301 delete txt; |
302 delete txt; |
302 txt = StringLoader::LoadL( R_QTN_PHOB_N_NUMBERS, num ); |
303 txt = StringLoader::LoadL( R_QTN_PHOB_N_NUMBERS, num ); |
303 } |
304 } |
304 else |
305 else |
305 { |
306 { |
306 // in case of convert error |
307 // in case of convert error |
307 txt->Des().Zero(); |
308 txt->Des().Zero(); |
308 } |
309 } |
309 } |
310 } |
310 |
311 |
311 aDataElement.SetText( |
312 aDataElement.SetText( |
312 MPbk2DoubleListboxDataElement::EStatusText, txt, elemType ); |
313 MPbk2DoubleListboxDataElement::EStatusText, txt, elemType ); |
313 |
314 |
|
315 CleanupStack::PopAndDestroy(); // link |
|
316 } |
|
317 } |
314 } |
318 |
315 |
319 // ----------------------------------------------------------------------------- |
316 // ----------------------------------------------------------------------------- |
320 // CPbk2NameslistUiControlExtension::SetCommandItemUpdater |
317 // CPbk2NameslistUiControlExtension::SetCommandItemUpdater |
321 // ----------------------------------------------------------------------------- |
318 // ----------------------------------------------------------------------------- |