ipsservices/ipssosplugin/src/ipsplgmsgmapper.cpp
changeset 65 478bc57ad291
parent 59 16ed8d08d0b1
equal deleted inserted replaced
59:16ed8d08d0b1 65:478bc57ad291
   940 
   940 
   941 // ---------------------------------------------------------------------------
   941 // ---------------------------------------------------------------------------
   942 // ---------------------------------------------------------------------------
   942 // ---------------------------------------------------------------------------
   943 // <cmail>
   943 // <cmail>
   944 TInt CIpsPlgMsgMapper::ConvertBodyPartMimeType(
   944 TInt CIpsPlgMsgMapper::ConvertBodyPartMimeType(
   945     const TUid& aEntryType,
   945     const TMsvEmailEntry& aEntry,
   946     TDes& aMimeType )
   946     TDes& aMimeType )
   947     {
   947     {
   948     FUNC_LOG;
   948     FUNC_LOG;
   949     TInt result( KErrNone );
   949     TInt result( KErrNone );
   950 
   950 
   951     switch ( aEntryType.iUid )
   951     switch ( aEntry.iType.iUid )
   952     {
   952     {
   953     case KUidMsvEmailTextEntryValue:
   953     case KUidMsvEmailTextEntryValue:
   954         {
   954         {
       
   955         if( aEntry.ICalendar() )
       
   956             {
       
   957             aMimeType.Append( KFSMailContentTypeTextCalendar );
       
   958             }
       
   959         else
       
   960             {
   955             aMimeType.Append( KMimeTypeTextPlain );
   961             aMimeType.Append( KMimeTypeTextPlain );
       
   962             }
   956         break;
   963         break;
   957         }
   964         }
   958     case KUidMsvEmailHtmlEntryValue:
   965     case KUidMsvEmailHtmlEntryValue:
   959         {
   966         {
   960             aMimeType.Append( KMimeTypeTextHtml );
   967             aMimeType.Append( KMimeTypeTextHtml );
  1162     const TFSMailMsgId& aMessageId )
  1169     const TFSMailMsgId& aMessageId )
  1163     {
  1170     {
  1164     FUNC_LOG;
  1171     FUNC_LOG;
  1165     CFSMailMessagePart* result( NULL );
  1172     CFSMailMessagePart* result( NULL );
  1166     TInt status;
  1173     TInt status;
  1167 // <cmail>
       
  1168     HBufC* buf = HBufC::NewLC( KMaxContentTypeLength );
  1174     HBufC* buf = HBufC::NewLC( KMaxContentTypeLength );
  1169     TPtr contentType = buf->Des();
  1175     TPtr contentType = buf->Des();
  1170 
  1176 
  1171     status = ConvertBodyPartMimeType( aEntry.iType, contentType );
  1177     status = ConvertBodyPartMimeType( aEntry, contentType );
       
  1178     
  1172     __ASSERT_DEBUG( ( status == KErrNone ),
  1179     __ASSERT_DEBUG( ( status == KErrNone ),
  1173         User::Panic( KIpsPlgPanicCategory, EIpsPlgInvalidEntry ) );
  1180         User::Panic( KIpsPlgPanicCategory, EIpsPlgInvalidEntry ) );
  1174     if ( status == KErrNone )
  1181     if ( status == KErrNone )
  1175         {
  1182         {
  1176         result = CFSMailMessagePart::NewLC(
  1183         result = CFSMailMessagePart::NewLC(
  1179         // If mimetype is 'text/html' add charset parameter
  1186         // If mimetype is 'text/html' add charset parameter
  1180         if ( aEntry.iType.iUid == KUidMsvEmailHtmlEntryValue )
  1187         if ( aEntry.iType.iUid == KUidMsvEmailHtmlEntryValue )
  1181             {
  1188             {
  1182             GetCharsetParameterL( aEntry, contentType );
  1189             GetCharsetParameterL( aEntry, contentType );
  1183             }
  1190             }
  1184 // </cmail>
       
  1185         result->SetContentType( contentType );
  1191         result->SetContentType( contentType );
  1186         result->SetMailBoxId( aMailBoxId );
  1192         result->SetMailBoxId( aMailBoxId );
  1187 
  1193 
  1188         // Size
  1194         // Size
  1189         result->SetContentSize( aEntry.iSize );
  1195         result->SetContentSize( aEntry.iSize );