66 _LIT(KFolderField, FOLDER_FIELD); |
66 _LIT(KFolderField, FOLDER_FIELD); |
67 _LIT(KBodyField, BODY_FIELD); |
67 _LIT(KBodyField, BODY_FIELD); |
68 _LIT(KSubjectField, SUBJECT_FIELD); |
68 _LIT(KSubjectField, SUBJECT_FIELD); |
69 _LIT(KAttachmentField, ATTACHMENT_FIELD); |
69 _LIT(KAttachmentField, ATTACHMENT_FIELD); |
70 _LIT(KValueAttachment, "Attachment"); |
70 _LIT(KValueAttachment, "Attachment"); |
|
71 #ifdef USE_HIGHLIGHTER |
|
72 _LIT(KExcerptDelimiter, " "); |
|
73 #endif |
71 // ============================ MEMBER FUNCTIONS =============================== |
74 // ============================ MEMBER FUNCTIONS =============================== |
72 |
75 |
73 // --------------------------------------------------------------------------- |
76 // --------------------------------------------------------------------------- |
74 // CMessageDataHandler::NewL |
77 // CMessageDataHandler::NewL |
75 // --------------------------------------------------------------------------- |
78 // --------------------------------------------------------------------------- |
297 TMsvId service = 0; |
300 TMsvId service = 0; |
298 iMsvSession.GetEntry(aMsvId, service, entry); |
301 iMsvSession.GetEntry(aMsvId, service, entry); |
299 HBufC *fromNameOrNumberBuf = entry.iDetails.AllocLC(); |
302 HBufC *fromNameOrNumberBuf = entry.iDetails.AllocLC(); |
300 index_item->AddFieldL(KFromField, *fromNameOrNumberBuf, |
303 index_item->AddFieldL(KFromField, *fromNameOrNumberBuf, |
301 CDocumentField::EStoreYes | CDocumentField::EIndexTokenized | CDocumentField::EIndexFreeText); |
304 CDocumentField::EStoreYes | CDocumentField::EIndexTokenized | CDocumentField::EIndexFreeText); |
|
305 #ifdef USE_HIGHLIGHTER |
|
306 if( aFolderId == KMsvGlobalInBoxIndexEntryIdValue) |
|
307 { |
|
308 index_item->AddHLDisplayFieldL(*fromNameOrNumberBuf); |
|
309 } |
|
310 #endif |
302 |
311 |
303 // Add the recipients as content items |
312 // Add the recipients as content items |
304 TBuf<64> to_field; |
313 TBuf<64> to_field; |
|
314 |
|
315 #ifdef USE_HIGHLIGHTER |
|
316 HBufC* toList = HBufC::NewL(5); |
|
317 #endif |
305 const CDesCArray |
318 const CDesCArray |
306 & recipientArray = |
319 & recipientArray = |
307 static_cast<const CDesCArray&> (iSmsMtm->AddresseeList().RecipientList()); |
320 static_cast<const CDesCArray&> (iSmsMtm->AddresseeList().RecipientList()); |
308 for (TInt i = 0; i < recipientArray.MdcaCount(); i++) |
321 for (TInt i = 0; i < recipientArray.MdcaCount(); i++) |
309 { |
322 { |
310 to_field = KToField; |
323 to_field = KToField; |
311 if (i>0) |
324 if (i>0) |
312 to_field.AppendNum(i); |
325 to_field.AppendNum(i); |
313 index_item->AddFieldL(to_field, recipientArray.MdcaPoint(i), |
326 index_item->AddFieldL(to_field, recipientArray.MdcaPoint(i), |
314 CDocumentField::EStoreYes | CDocumentField::EIndexTokenized | CDocumentField::EIndexFreeText); |
327 CDocumentField::EStoreYes | CDocumentField::EIndexTokenized | CDocumentField::EIndexFreeText); |
315 } |
328 |
316 |
329 #ifdef USE_HIGHLIGHTER |
|
330 // Folder field |
|
331 // Iterate through the list of recipients and add them under To field |
|
332 if( aFolderId != KMsvGlobalInBoxIndexEntryIdValue) |
|
333 { |
|
334 TInt currentSize = toList->Size(); |
|
335 TInt newSize = currentSize + recipientArray.MdcaPoint(i).Size() + 1; |
|
336 if(newSize > currentSize) //New size is bigger so we have to reallocate |
|
337 { |
|
338 toList = toList->ReAllocL(newSize); |
|
339 } |
|
340 TPtr ptr = toList->Des(); |
|
341 ptr.Append(recipientArray.MdcaPoint(i)); |
|
342 ptr.Append(KExcerptDelimiter); |
|
343 } |
|
344 #endif |
|
345 } |
|
346 #ifdef USE_HIGHLIGHTER |
|
347 if( aFolderId != KMsvGlobalInBoxIndexEntryIdValue) |
|
348 { |
|
349 index_item->AddHLDisplayFieldL( *toList); |
|
350 } |
|
351 delete toList; |
|
352 toList = NULL; |
|
353 #endif |
317 // Add the body text as a content item |
354 // Add the body text as a content item |
318 TInt msgLength = iSmsMtm->Body().DocumentLength(); |
355 TInt msgLength = iSmsMtm->Body().DocumentLength(); |
319 HBufC* bodyText = HBufC::NewLC(msgLength); |
356 HBufC* bodyText = HBufC::NewLC(msgLength); |
320 TPtr body_ptr = bodyText->Des(); |
357 TPtr body_ptr = bodyText->Des(); |
321 iSmsMtm->Body().Extract(body_ptr); |
358 iSmsMtm->Body().Extract(body_ptr); |
350 docid_str.AppendNum(aMsvId); |
387 docid_str.AppendNum(aMsvId); |
351 CSearchDocument* index_item = CSearchDocument::NewLC(docid_str, _L(MMSAPPCLASS)); |
388 CSearchDocument* index_item = CSearchDocument::NewLC(docid_str, _L(MMSAPPCLASS)); |
352 |
389 |
353 // Add from field |
390 // Add from field |
354 index_item->AddFieldL(KFromField, iMmsMtm->Sender()); |
391 index_item->AddFieldL(KFromField, iMmsMtm->Sender()); |
|
392 #ifdef USE_HIGHLIGHTER |
|
393 if( aFolderId == KMsvGlobalInBoxIndexEntryIdValue) |
|
394 { |
|
395 index_item->AddHLDisplayFieldL(iMmsMtm->Sender()); |
|
396 } |
|
397 #endif |
355 |
398 |
356 // Add the recipients as content items |
399 // Add the recipients as content items |
357 TBuf<64> to_field; |
400 TBuf<64> to_field; |
|
401 #ifdef USE_HIGHLIGHTER |
|
402 HBufC* toList = HBufC::NewL(5); |
|
403 #endif |
358 const CDesCArray |
404 const CDesCArray |
359 & recipientArray = |
405 & recipientArray = |
360 static_cast<const CDesCArray&> (iMmsMtm->AddresseeList().RecipientList()); |
406 static_cast<const CDesCArray&> (iMmsMtm->AddresseeList().RecipientList()); |
361 for (TInt i = 0; i < recipientArray.MdcaCount(); i++) |
407 for (TInt i = 0; i < recipientArray.MdcaCount(); i++) |
362 { |
408 { |
363 to_field = KToField; |
409 to_field = KToField; |
364 if (i>0) |
410 if (i>0) |
365 to_field.AppendNum(i); |
411 to_field.AppendNum(i); |
366 index_item->AddFieldL(to_field, recipientArray.MdcaPoint(i)); |
412 index_item->AddFieldL(to_field, recipientArray.MdcaPoint(i)); |
367 } |
413 |
368 |
414 #ifdef USE_HIGHLIGHTER |
|
415 // Folder field |
|
416 // Iterate through the list of recipients and add them under To field |
|
417 if( aFolderId != KMsvGlobalInBoxIndexEntryIdValue) |
|
418 { |
|
419 TInt currentSize = toList->Size(); |
|
420 TInt newSize = currentSize + recipientArray.MdcaPoint(i).Size() + 1; |
|
421 if(newSize > currentSize) //New size is bigger so we have to reallocate |
|
422 { |
|
423 toList = toList->ReAllocL(newSize); |
|
424 } |
|
425 TPtr ptr = toList->Des(); |
|
426 ptr.Append(recipientArray.MdcaPoint(i)); |
|
427 ptr.Append(KExcerptDelimiter); |
|
428 } |
|
429 #endif |
|
430 } |
|
431 |
|
432 #ifdef USE_HIGHLIGHTER |
|
433 if( aFolderId != KMsvGlobalInBoxIndexEntryIdValue) |
|
434 { |
|
435 index_item->AddHLDisplayFieldL( *toList); |
|
436 } |
|
437 delete toList; |
|
438 toList = NULL; |
|
439 #endif |
369 // Add subject |
440 // Add subject |
370 TPtrC subject(iMmsMtm->SubjectL()); |
441 TPtrC subject(iMmsMtm->SubjectL()); |
371 index_item->AddFieldL(KSubjectField, subject); |
442 index_item->AddFieldL(KSubjectField, subject); |
372 |
443 |
373 // Add the body parts as a content items |
444 // Add the body parts as a content items |
513 excerptLength += aFromAddress.Length(); |
584 excerptLength += aFromAddress.Length(); |
514 excerptLength += KSpace().Length(); |
585 excerptLength += KSpace().Length(); |
515 } |
586 } |
516 else if( aFolderId != KMsvGlobalInBoxIndexEntryIdValue && aRecipientArray.MdcaCount() > 0 ) |
587 else if( aFolderId != KMsvGlobalInBoxIndexEntryIdValue && aRecipientArray.MdcaCount() > 0 ) |
517 { |
588 { |
518 excerptLength += aRecipientArray.MdcaPoint(0).Length(); |
589 //Multiple recepent added to excerpt |
519 excerptLength += KSpace().Length(); |
590 for(TInt i = 0; i< aRecipientArray.MdcaCount(); i++) |
|
591 { |
|
592 excerptLength += aRecipientArray.MdcaPoint(i).Length(); |
|
593 excerptLength += KSpace().Length(); |
|
594 } |
520 } |
595 } |
521 |
596 |
522 HBufC* excerpt = HBufC::NewL(excerptLength); |
597 HBufC* excerpt = HBufC::NewL(excerptLength); |
523 TPtr excerptPtr = excerpt->Des(); |
598 TPtr excerptPtr = excerpt->Des(); |
524 |
599 |
532 excerptPtr.Append(aFromAddress); |
607 excerptPtr.Append(aFromAddress); |
533 excerptPtr.Append(KSpace); |
608 excerptPtr.Append(KSpace); |
534 } |
609 } |
535 else if ((aRecipientArray.MdcaCount() > 0) && (aFolderId != KMsvGlobalInBoxIndexEntryIdValue)) |
610 else if ((aRecipientArray.MdcaCount() > 0) && (aFolderId != KMsvGlobalInBoxIndexEntryIdValue)) |
536 { |
611 { |
537 excerptPtr.Append(aRecipientArray.MdcaPoint(0)); |
612 for(TInt i = 0; i< aRecipientArray.MdcaCount(); i++) |
538 excerptPtr.Append(KSpace); |
613 { |
|
614 excerptPtr.Append(aRecipientArray.MdcaPoint(i)); |
|
615 excerptPtr.Append(KSpace); |
|
616 } |
539 } |
617 } |
540 |
618 |
541 //Not deleting this code as it might have to be brought back into use |
619 //Not deleting this code as it might have to be brought back into use |
542 //in (possibly near) future. |
620 //in (possibly near) future. |
543 // if (aSubject.Length() > 0) |
621 // if (aSubject.Length() > 0) |