harvesterplugins/messaging/smsmms/src/cmessagedatahandler.cpp
changeset 11 773be20e0a25
parent 7 51d10d255e92
child 12 993ab30e92fc
equal deleted inserted replaced
7:51d10d255e92 11:773be20e0a25
    64 _LIT(KBccField, BCC_FIELD);
    64 _LIT(KBccField, BCC_FIELD);
    65 _LIT(KFromField, FROM_FIELD);
    65 _LIT(KFromField, FROM_FIELD);
    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 
    69 _LIT(KAttachmentField, ATTACHMENT_FIELD);
       
    70 _LIT(KValueAttachment, "Attachment");
    70 // ============================ MEMBER FUNCTIONS ===============================
    71 // ============================ MEMBER FUNCTIONS ===============================
    71 
    72 
    72 // ---------------------------------------------------------------------------
    73 // ---------------------------------------------------------------------------
    73 // CMessageDataHandler::NewL
    74 // CMessageDataHandler::NewL
    74 // ---------------------------------------------------------------------------
    75 // ---------------------------------------------------------------------------
   356 	// (iSmsMtm->SmsHeader().FromAddress() - only returns the number)
   357 	// (iSmsMtm->SmsHeader().FromAddress() - only returns the number)
   357 	TMsvEntry entry;
   358 	TMsvEntry entry;
   358 	TMsvId service = 0;
   359 	TMsvId service = 0;
   359 	iMsvSession.GetEntry(aMsvId, service, entry);
   360 	iMsvSession.GetEntry(aMsvId, service, entry);
   360 	HBufC *fromNameOrNumberBuf = entry.iDetails.AllocLC();
   361 	HBufC *fromNameOrNumberBuf = entry.iDetails.AllocLC();
   361 	index_item->AddFieldL(KFromField, *fromNameOrNumberBuf);
   362 	index_item->AddFieldL(KFromField, *fromNameOrNumberBuf,
       
   363 	        CDocumentField::EStoreYes | CDocumentField::EIndexTokenized | CDocumentField::EIndexFreeText);
   362 
   364 
   363 	// Add the recipients as content items
   365 	// Add the recipients as content items
   364 	TBuf<64> to_field;
   366 	TBuf<64> to_field;
   365 	const CDesCArray
   367 	const CDesCArray
   366 			& recipientArray =
   368 			& recipientArray =
   368 	for (TInt i = 0; i < recipientArray.MdcaCount(); i++)
   370 	for (TInt i = 0; i < recipientArray.MdcaCount(); i++)
   369 		{
   371 		{
   370 		to_field = KToField;
   372 		to_field = KToField;
   371 		if (i>0)
   373 		if (i>0)
   372 			to_field.AppendNum(i);
   374 			to_field.AppendNum(i);
   373 		index_item->AddFieldL(to_field, recipientArray.MdcaPoint(i));
   375 		index_item->AddFieldL(to_field, recipientArray.MdcaPoint(i),
       
   376 		        CDocumentField::EStoreYes | CDocumentField::EIndexTokenized | CDocumentField::EIndexFreeText);
   374 		}
   377 		}
   375 
   378 
   376 	// Add the body text as a content item
   379 	// Add the body text as a content item
   377 	TInt msgLength = iSmsMtm->Body().DocumentLength();
   380 	TInt msgLength = iSmsMtm->Body().DocumentLength();
   378 	HBufC* bodyText = HBufC::NewLC(msgLength);
   381 	HBufC* bodyText = HBufC::NewLC(msgLength);
   434     TBool excerptFieldAdded(EFalse);
   437     TBool excerptFieldAdded(EFalse);
   435     TInt bodycount = 0;
   438     TInt bodycount = 0;
   436     CMsvStore* msvStore = iMmsMtm->Entry().ReadStoreL();
   439     CMsvStore* msvStore = iMmsMtm->Entry().ReadStoreL();
   437 	CleanupStack::PushL( msvStore );
   440 	CleanupStack::PushL( msvStore );
   438 	MMsvAttachmentManager& attManager = msvStore->AttachmentManagerL();
   441 	MMsvAttachmentManager& attManager = msvStore->AttachmentManagerL();
       
   442 	//Add attachment value field
       
   443 	TInt count = attManager.AttachmentCount();
       
   444 	if (count > 0)
       
   445 	   index_item->AddFieldL(KAttachmentField, KValueAttachment);	
       
   446 	
   439 	for ( TInt i = 0; i < attManager.AttachmentCount(); i++ )
   447 	for ( TInt i = 0; i < attManager.AttachmentCount(); i++ )
   440 	    {
   448 	    {
   441 		CMsvAttachment* attInfo = attManager.GetAttachmentInfoL(i);
   449 		CMsvAttachment* attInfo = attManager.GetAttachmentInfoL(i);
   442 		CleanupStack::PushL( attInfo );
   450 		CleanupStack::PushL( attInfo );
   443 		
   451