harvesterplugins/messaging/smsmms/src/cmessagedatahandler.cpp
changeset 5 3bc31ad99ee7
parent 2 208a4ba3894c
child 7 51d10d255e92
equal deleted inserted replaced
3:6832643895f7 5:3bc31ad99ee7
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:  Harvester message plugin
    14 * Description:  Harvester message plugin
    15  *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 //  INCLUDES 
    19 //  INCLUDES 
    20 
    20 
   628 											const CDesCArray& aRecipientArray,
   628 											const CDesCArray& aRecipientArray,
   629 											const TDesC& aSubject,
   629 											const TDesC& aSubject,
   630 											const TDesC& aBodyText,
   630 											const TDesC& aBodyText,
   631 											const TMsvId& aFolderId)
   631 											const TMsvId& aFolderId)
   632 	{
   632 	{
       
   633     //Note:Only From/To (as appropriate): and Body: fields to be added to excerpt for now. 
       
   634     //See appclass-hierarchy.txt for details.  
       
   635     
   633 	_LIT(KEllipsis, "...");
   636 	_LIT(KEllipsis, "...");
   634 	_LIT(KSpace, " ");
   637 	_LIT(KSpace, " ");
   635 	TInt excerptLength = KMsgBodyExcerptSymbols + KEllipsis().Length(); 
   638 	TInt excerptLength = KMsgBodyExcerptSymbols + KEllipsis().Length(); 
   636 
   639 
   637 	TMsvEntry entry;
   640 	//Not removing commented out code as this may come back into use in near future.
   638 	TMsvId service = 0;
   641 //	TMsvEntry entry;
   639 	iMsvSession.GetEntry(aFolderId, service, entry);
   642 //	TMsvId service = 0;
   640 	HBufC *folder_str = entry.iDetails.AllocLC();
   643 //	iMsvSession.GetEntry(aFolderId, service, entry);
   641 
   644 //	HBufC *folder_str = entry.iDetails.AllocLC();
   642 	excerptLength += folder_str->Length();
   645 //
   643 	excerptLength += KSpace().Length();
   646 //	excerptLength += folder_str->Length();
   644 
   647 //	excerptLength += KSpace().Length();
   645 	if ((aFromAddress.Length() > 0) && (aFolderId == KMsvGlobalInBoxIndexEntryIdValue))
   648 
   646 		{
   649 	if( aFolderId == KMsvGlobalInBoxIndexEntryIdValue && aFromAddress.Length() > 0 )
   647 		excerptLength += aFromAddress.Length();
   650 	    {
   648 		excerptLength += KSpace().Length();
   651         excerptLength += aFromAddress.Length();
   649 		}
   652         excerptLength += KSpace().Length();
   650 	if ((aRecipientArray.MdcaCount() > 0) && (aFolderId != KMsvGlobalInBoxIndexEntryIdValue))
   653 	    }
   651 		{
   654 	else if( aFolderId != KMsvGlobalInBoxIndexEntryIdValue && aRecipientArray.MdcaCount() > 0 )
   652 		excerptLength += aRecipientArray.MdcaPoint(0).Length();
   655 	    {
   653 		excerptLength += KSpace().Length(); 
   656         excerptLength += aRecipientArray.MdcaPoint(0).Length();
   654 		}
   657         excerptLength += KSpace().Length(); 
   655 	if (aSubject.Length() > 0)
   658 	    }
   656 		{
       
   657 		excerptLength += aSubject.Length();
       
   658 		excerptLength += KSpace().Length();
       
   659 		}
       
   660 
   659 
   661 	HBufC* excerpt = HBufC::NewL(excerptLength);
   660 	HBufC* excerpt = HBufC::NewL(excerptLength);
   662 	TPtr excerptPtr = excerpt->Des();
   661 	TPtr excerptPtr = excerpt->Des();
   663 
   662 
   664 	excerptPtr.Copy(*folder_str);
   663 	//Not removing commented out code as this may come back into use in near future.
   665 	excerptPtr.Append(KSpace);
   664 //	excerptPtr.Copy(*folder_str);
       
   665 //	excerptPtr.Append(KSpace);
   666 	
   666 	
   667 	if ((aFromAddress.Length() > 0) && (aFolderId == KMsvGlobalInBoxIndexEntryIdValue))
   667 	//For inbox items, From: is present while for sent items To: is present.
   668 		{
   668     if ((aFromAddress.Length() > 0) && (aFolderId == KMsvGlobalInBoxIndexEntryIdValue))
   669 		excerptPtr.Append(aFromAddress);
   669         {
   670 		excerptPtr.Append(KSpace);
   670         excerptPtr.Append(aFromAddress);
   671 		}
   671         excerptPtr.Append(KSpace);
   672 	if ((aRecipientArray.MdcaCount() > 0) && (aFolderId != KMsvGlobalInBoxIndexEntryIdValue))
   672         }
   673 		{
   673     else if ((aRecipientArray.MdcaCount() > 0) && (aFolderId != KMsvGlobalInBoxIndexEntryIdValue))
   674 		excerptPtr.Append(aRecipientArray.MdcaPoint(0));
   674         {
   675 		excerptPtr.Append(KSpace);
   675         excerptPtr.Append(aRecipientArray.MdcaPoint(0));
   676 		}
   676         excerptPtr.Append(KSpace);
   677 	if (aSubject.Length() > 0)
   677         }
   678 		{
   678 
   679 		excerptPtr.Append(aSubject);
   679 	//Not deleting this code as it might have to be brought back into use
   680 		excerptPtr.Append(KSpace);
   680 	//in (possibly near) future.
   681 		}
   681 //	if (aSubject.Length() > 0)
       
   682 //		{
       
   683 //		excerptPtr.Append(aSubject);
       
   684 //		excerptPtr.Append(KSpace);
       
   685 //		}
   682 
   686 
   683 	excerptPtr.Append(aBodyText.Left(KMsgBodyExcerptSymbols));
   687 	excerptPtr.Append(aBodyText.Left(KMsgBodyExcerptSymbols));
   684 	if (aBodyText.Length() > KMsgBodyExcerptSymbols)
   688 	if (aBodyText.Length() > KMsgBodyExcerptSymbols)
   685 		excerptPtr.Append(KEllipsis);
   689 		excerptPtr.Append(KEllipsis);
   686 
   690 
   687 	CleanupStack::PopAndDestroy(folder_str);
   691 //	CleanupStack::PopAndDestroy(folder_str);
   688 	CleanupStack::PushL(excerpt);
   692 	CleanupStack::PushL(excerpt);
   689 	return excerpt;
   693 	return excerpt;
   690 	}
   694 	}
   691 
   695 
   692 // ---------------------------------------------------------------------------
   696 // ---------------------------------------------------------------------------