emailservices/emailclientapi/src/emailtextcontent.cpp
branchRCL_3
changeset 12 4ce476e64c59
parent 11 0396474f30f5
child 24 d189ee25cf9d
equal deleted inserted replaced
11:0396474f30f5 12:4ce476e64c59
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 #include "emailcontent.h"
    18 #include "emailcontent.h"
    19 #include "emailtextcontent.h"
    19 #include "emailtextcontent.h"
       
    20 #include "emailmessage.h"
    20 #include "emailclientapi.hrh"
    21 #include "emailclientapi.hrh"
    21 
    22 
    22 // CEmailTextContent
    23 // CEmailTextContent
    23 
    24 
    24 // -----------------------------------------------------------------------------
    25 // -----------------------------------------------------------------------------
    46         CPluginData& aPluginData,
    47         CPluginData& aPluginData,
    47         const TMessageContentId& aMsgContentId,
    48         const TMessageContentId& aMsgContentId,
    48         CFSMailMessagePart* aPart )
    49         CFSMailMessagePart* aPart )
    49     {
    50     {
    50     iEmailMsgContent = CEmailMessageContent::NewL( aPluginData, aMsgContentId, aPart );
    51     iEmailMsgContent = CEmailMessageContent::NewL( aPluginData, aMsgContentId, aPart );
    51 
    52     TContentType contentType( aPart->GetContentType() );
    52     if (!CheckParameterFormatL( aPart->GetContentType() ).Compare(KFSMailContentTypeTextHtml))
    53     if ( contentType.Equals( KFSMailContentTypeTextHtml ) )
    53         {
    54         {
    54         iTextType = EHtmlText;        
    55         iTextType = EHtmlText;        
    55         }
    56         }
    56     }
    57     }
    57 
    58 
   312 MEmailAttachment* CEmailTextContent::AsAttachmentOrNull() const
   313 MEmailAttachment* CEmailTextContent::AsAttachmentOrNull() const
   313     {
   314     {
   314     return NULL;
   315     return NULL;
   315     }
   316     }
   316 
   317 
   317 // -----------------------------------------------------------------------------
       
   318 // 
       
   319 // -----------------------------------------------------------------------------
       
   320 //
       
   321 const TDesC& CEmailTextContent::CheckParameterFormatL( const TDesC& aParam )
       
   322     {    
       
   323     _LIT( KSeparator, ";" );
       
   324     _LIT( KSlash, "/" );
       
   325     // Check for a type separator in the string
       
   326     TInt endPos = aParam.Find( KSeparator );
       
   327     // Construct the compare string
       
   328     TPtrC extractString( aParam.Left( endPos ) );
       
   329     HBufC* compareBuf = extractString.AllocLC();
       
   330     TPtr compareString = compareBuf->Des();
       
   331     TInt slashPos = aParam.Find( KSlash );
       
   332     TInt stringLen = compareString.Length();
       
   333          
       
   334     const TDesC& leftPart = extractString.Left( slashPos );
       
   335     HBufC* leftPartBuf = leftPart.AllocLC();
       
   336     TPtr leftPartString = leftPartBuf->Des();
       
   337     leftPartString.Trim();
       
   338          
       
   339     const TDesC& rightPart = extractString.Right( stringLen - ( slashPos + 1 ) );
       
   340     HBufC* rightPartBuf = rightPart.AllocLC();
       
   341     TPtr rightPartString = rightPartBuf->Des();
       
   342     rightPartString.Trim();
       
   343          
       
   344     compareString.Delete( 0, endPos );
       
   345     compareString.Append( leftPartString );
       
   346     compareString.Append( KSlash );
       
   347     compareString.Append( rightPartString );
       
   348     compareString.LowerCase();   
       
   349     CleanupStack::PopAndDestroy( rightPartBuf );
       
   350     CleanupStack::PopAndDestroy( leftPartBuf );
       
   351     
       
   352     const TDesC& retParam = compareString;
       
   353     CleanupStack::PopAndDestroy( compareBuf );
       
   354     
       
   355     return retParam;
       
   356     }
       
   357 
   318 
   358 // -----------------------------------------------------------------------------
   319 // -----------------------------------------------------------------------------
   359 // 
   320 // 
   360 // -----------------------------------------------------------------------------
   321 // -----------------------------------------------------------------------------
   361 //
   322 //