emailservices/emailclientapi/src/emailmessage.cpp
branchRCL_3
changeset 63 d189ee25cf9d
parent 24 b5fbb9b25d57
child 64 3533d4323edc
equal deleted inserted replaced
61:dcf0eedfc1a3 63:d189ee25cf9d
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    31 #include "emailinterfacefactoryimpl.h"
    31 #include "emailinterfacefactoryimpl.h"
    32 #include "emailcontent.h"
    32 #include "emailcontent.h"
    33 #include "emailtextcontent.h"
    33 #include "emailtextcontent.h"
    34 #include "emailmultipart.h"
    34 #include "emailmultipart.h"
    35 #include "emailattachment.h"
    35 #include "emailattachment.h"
    36 #include "cfsmailplugin.h"
    36 #include "CFSMailPlugin.h"
    37 #include "FreestyleEmailUiConstants.h"
    37 #include "CFSMailClient.h"
    38 #include "cfsmailclient.h"
    38 
       
    39 #include <xqservicerequest.h>
       
    40 #include "email_services_api.h"
       
    41 
       
    42 const TInt KSendMessageRequestId = 100;
    39 
    43 
    40 // -----------------------------------------------------------------------------
    44 // -----------------------------------------------------------------------------
    41 // 
    45 // 
    42 // -----------------------------------------------------------------------------
    46 // -----------------------------------------------------------------------------
    43 CEmailMessage* CEmailMessage::NewL( CPluginData& aPluginData,
    47 CEmailMessage* CEmailMessage::NewL( CPluginData& aPluginData,
    45                                     const TDataOwner aOwner )
    49                                     const TDataOwner aOwner )
    46     {
    50     {
    47     CEmailMessage* message = new ( ELeave ) CEmailMessage( aPluginData, aFsMessage, aOwner );
    51     CEmailMessage* message = new ( ELeave ) CEmailMessage( aPluginData, aFsMessage, aOwner );
    48     CleanupStack::PushL( message );
    52     CleanupStack::PushL( message );
    49     message->ConstructL();
    53     message->ConstructL();
    50     CleanupStack::Pop();
    54     CleanupStack::Pop( message );
    51     return message;
    55     return message;
    52     }
    56     }
    53     
    57 
    54 // -----------------------------------------------------------------------------
    58 // -----------------------------------------------------------------------------
    55 // 
    59 // 
    56 // -----------------------------------------------------------------------------
    60 // -----------------------------------------------------------------------------
    57 CEmailMessage::CEmailMessage( 
    61 CEmailMessage::CEmailMessage(
    58         CPluginData& aPluginData,
    62         CPluginData& aPluginData,
    59         CFSMailMessage *aFsMessage,
    63         CFSMailMessage *aFsMessage,
    60         const TDataOwner aOwner)
    64         const TDataOwner aOwner)
    61         : iPluginData( aPluginData ), iPluginMessage( aFsMessage ), iOwner( aOwner )
    65         : iPluginData( aPluginData ), iPluginMessage( aFsMessage ), iOwner( aOwner )
    62     {
    66     {
    64 
    68 
    65 // -----------------------------------------------------------------------------
    69 // -----------------------------------------------------------------------------
    66 // 
    70 // 
    67 // -----------------------------------------------------------------------------
    71 // -----------------------------------------------------------------------------
    68 void CEmailMessage::ConstructL()
    72 void CEmailMessage::ConstructL()
    69     {    
    73     {
       
    74     User::LeaveIfNull( iPluginMessage );
    70     iPlugin = iPluginData.ClaimInstanceL();
    75     iPlugin = iPluginData.ClaimInstanceL();
    71     if ( iPluginMessage )
    76     if ( iPluginMessage )
    72         {
    77         {
    73         iMessageId = TMessageId( 
    78         iMessageId = TMessageId( 
    74             iPluginMessage->GetMessageId().Id(),
    79             iPluginMessage->GetMessageId().Id(),
    75             iPluginMessage->GetFolderId().Id(), 
    80             iPluginMessage->GetFolderId().Id(), 
    76             iPluginMessage->GetMailBoxId().Id() );
    81             iPluginMessage->GetMailBoxId().Id() );
    77         
    82 
    78         // Copy the message flags
    83         // Copy the message flags
    79         InitializeFlagValues();
    84         InitializeFlagValues();
    80         }
    85         }
    81     }
    86     }
    82 
    87 
    83 // -----------------------------------------------------------------------------
    88 // -----------------------------------------------------------------------------
    84 // 
    89 // 
    85 // -----------------------------------------------------------------------------
    90 // -----------------------------------------------------------------------------
    86 CEmailMessage::~CEmailMessage()
    91 CEmailMessage::~CEmailMessage()
    87     {
    92     {
    88     delete iPluginMessage;    
    93     delete iPluginMessage;
    89     delete iSender;
    94     delete iSender;
    90     delete iReplyTo;
    95     delete iReplyTo;
    91     delete iTextContent;
    96     delete iTextContent;
    92     delete iContent;
    97     delete iContent;
    93     iPluginData.ReleaseInstance();
    98     iPluginData.ReleaseInstance();
   107 // -----------------------------------------------------------------------------
   112 // -----------------------------------------------------------------------------
   108 void CEmailMessage::Release()
   113 void CEmailMessage::Release()
   109     {
   114     {
   110     if ( iOwner == EClientOwns )
   115     if ( iOwner == EClientOwns )
   111         {
   116         {
   112         delete this;        
   117         delete this;
   113         }
   118         }
   114     }
   119     }
   115     
   120 
   116 // -----------------------------------------------------------------------------
   121 // -----------------------------------------------------------------------------
   117 // 
   122 // 
   118 // -----------------------------------------------------------------------------
   123 // -----------------------------------------------------------------------------
   119 const TMessageId& CEmailMessage::MessageId() const
   124 const TMessageId& CEmailMessage::MessageId() const
   120     {
   125     {
   121     return iMessageId;
   126     return iMessageId;
   122     }
   127     }
   123     
   128 
   124 // -----------------------------------------------------------------------------
   129 // -----------------------------------------------------------------------------
   125 // 
   130 // 
   126 // -----------------------------------------------------------------------------
   131 // -----------------------------------------------------------------------------
   127 MEmailAddress* CEmailMessage::SenderAddressL() const
   132 MEmailAddress* CEmailMessage::SenderAddressL() const
   128     {
   133     {
       
   134     User::LeaveIfNull( iPluginMessage );
       
   135 
   129     CFSMailAddress* fsAddress = iPluginMessage->GetSender();
   136     CFSMailAddress* fsAddress = iPluginMessage->GetSender();
   130     if (fsAddress)
   137     if ( fsAddress )
   131         {
   138         {
   132         if (!iSender)
   139         if ( !iSender )
   133             {
   140             {
   134             iSender = CEmailAddress::NewL( MEmailAddress::ESender, EAPIOwns );
   141             iSender = CEmailAddress::NewL( MEmailAddress::ESender, EAPIOwns );
   135             }
   142             }
   136         iSender->SetAddressL(fsAddress->GetEmailAddress());
   143         iSender->SetAddressL(fsAddress->GetEmailAddress());
   137         iSender->SetDisplayNameL(fsAddress->GetDisplayName());
   144         iSender->SetDisplayNameL(fsAddress->GetDisplayName());
   142         delete iSender;
   149         delete iSender;
   143         iSender = NULL;
   150         iSender = NULL;
   144         }
   151         }
   145     return iSender;
   152     return iSender;
   146     }
   153     }
   147     
   154 
   148 // -----------------------------------------------------------------------------
   155 // -----------------------------------------------------------------------------
   149 // 
   156 // 
   150 // -----------------------------------------------------------------------------
   157 // -----------------------------------------------------------------------------
   151 MEmailAddress* CEmailMessage::ReplyToAddressL() const
   158 MEmailAddress* CEmailMessage::ReplyToAddressL() const
   152     {
   159     {
       
   160     User::LeaveIfNull( iPluginMessage );
       
   161 
   153     const CFSMailAddress& fsAddress = iPluginMessage->GetReplyToAddress();
   162     const CFSMailAddress& fsAddress = iPluginMessage->GetReplyToAddress();
   154     if ( &fsAddress )
   163     if ( &fsAddress )
   155         {
   164         {
   156         if (!iReplyTo)
   165         if ( !iReplyTo )
   157             {
   166             {
   158             iReplyTo = CEmailAddress::NewL( MEmailAddress::EReplyTo, EAPIOwns );
   167             iReplyTo = CEmailAddress::NewL( MEmailAddress::EReplyTo, EAPIOwns );
   159             }
   168             }
   160         iReplyTo->SetAddressL( fsAddress.GetEmailAddress() );
   169         iReplyTo->SetAddressL( fsAddress.GetEmailAddress() );
   161         iReplyTo->SetDisplayNameL( fsAddress.GetDisplayName() );
   170         iReplyTo->SetDisplayNameL( fsAddress.GetDisplayName() );
   165         delete iReplyTo;
   174         delete iReplyTo;
   166         iReplyTo = NULL;
   175         iReplyTo = NULL;
   167         }
   176         }
   168     return iReplyTo;
   177     return iReplyTo;
   169     }
   178     }
       
   179 
       
   180 // -----------------------------------------------------------------------------
       
   181 // 
       
   182 // -----------------------------------------------------------------------------
       
   183 void CEmailMessage::SetReplyToAddressL( const MEmailAddress& aSender )
       
   184     {
       
   185     User::LeaveIfNull( iPluginMessage );
   170     
   186     
   171 // -----------------------------------------------------------------------------
       
   172 // 
       
   173 // -----------------------------------------------------------------------------
       
   174 void CEmailMessage::SetReplyToAddressL( const MEmailAddress& aSender )
       
   175     {
       
   176     CFSMailAddress *fsAddress = CFSMailAddress::NewLC();
   187     CFSMailAddress *fsAddress = CFSMailAddress::NewLC();
   177     if (!iReplyTo)
   188     if ( !iReplyTo )
   178         {
   189         {
   179         iReplyTo = CEmailAddress::NewL( MEmailAddress::EReplyTo, EAPIOwns);
   190         iReplyTo = CEmailAddress::NewL( MEmailAddress::EReplyTo, EAPIOwns );
   180         }
   191         }
   181     fsAddress->SetDisplayName( aSender.DisplayName() );
   192     fsAddress->SetDisplayName( aSender.DisplayName() );
   182     fsAddress->SetEmailAddress( aSender.Address() );
   193     fsAddress->SetEmailAddress( aSender.Address() );
   183     iPluginMessage->SetReplyToAddress( fsAddress );
   194     iPluginMessage->SetReplyToAddress( fsAddress );
   184     iReplyTo->SetAddressL( fsAddress->GetEmailAddress() );
   195     iReplyTo->SetAddressL( fsAddress->GetEmailAddress() );
   185     iReplyTo->SetDisplayNameL( fsAddress->GetDisplayName() );
   196     iReplyTo->SetDisplayNameL( fsAddress->GetDisplayName() );
   186     CleanupStack::Pop();
   197     CleanupStack::Pop();
   187     }       
   198     }
   188     
   199 
   189 // -----------------------------------------------------------------------------
   200 // -----------------------------------------------------------------------------
   190 // 
   201 // 
   191 // -----------------------------------------------------------------------------
   202 // -----------------------------------------------------------------------------
   192 TInt CEmailMessage::GetRecipientsL( const MEmailAddress::TRole aRole,
   203 TInt CEmailMessage::GetRecipientsL( const MEmailAddress::TRole aRole,
   193         REmailAddressArray& aRecipients ) const
   204         REmailAddressArray& aRecipients ) const
   194     {
   205     {
   195     if( aRole == MEmailAddress::EReplyTo ||
   206     if( aRole == MEmailAddress::EReplyTo ||
   196         aRole == MEmailAddress::ESender    )
   207         aRole == MEmailAddress::ESender )
   197         {
   208         {
   198         User::Leave( KErrArgument );
   209         User::Leave( KErrArgument );
   199         }
   210         }
   200     else
   211     else 
   201         {
   212         {
       
   213         User::LeaveIfNull( iPluginMessage );
       
   214         
   202         if( aRole == MEmailAddress::ETo || 
   215         if( aRole == MEmailAddress::ETo || 
   203             aRole == MEmailAddress::EUndefined )
   216             aRole == MEmailAddress::EUndefined )
   204             {
   217             {
   205             RPointerArray<CFSMailAddress>& toRecipients = 
   218             const RPointerArray<CFSMailAddress>& toRecipients =
   206                 iPluginMessage->GetToRecipients();
   219                 iPluginMessage->GetToRecipients();
   207             ConvertAddressArrayL( 
   220             ConvertAddressArrayL( 
   208                     MEmailAddress::ETo, 
   221                     MEmailAddress::ETo, 
   209                     toRecipients, aRecipients );
   222                     toRecipients, aRecipients );
   210             }
   223             }
   211         if( aRole == MEmailAddress::ECc || 
   224         if( aRole == MEmailAddress::ECc || 
   212             aRole == MEmailAddress::EUndefined )
   225             aRole == MEmailAddress::EUndefined )
   213             {
   226             {
   214             RPointerArray<CFSMailAddress>& ccRecipients = 
   227             const RPointerArray<CFSMailAddress>& ccRecipients =
   215                 iPluginMessage->GetCCRecipients();
   228                 iPluginMessage->GetCCRecipients();
   216             ConvertAddressArrayL( 
   229             ConvertAddressArrayL( 
   217                     MEmailAddress::ECc, 
   230                     MEmailAddress::ECc, 
   218                     ccRecipients, aRecipients );
   231                     ccRecipients, aRecipients );
   219             }
   232             }
   220         if( aRole == MEmailAddress::EBcc || 
   233         if( aRole == MEmailAddress::EBcc || 
   221             aRole == MEmailAddress::EUndefined )
   234             aRole == MEmailAddress::EUndefined )
   222             {
   235             {
   223             RPointerArray<CFSMailAddress>& bccRecipients = 
   236             const RPointerArray<CFSMailAddress>& bccRecipients =
   224                 iPluginMessage->GetBCCRecipients();
   237                 iPluginMessage->GetBCCRecipients();
   225             ConvertAddressArrayL( 
   238             ConvertAddressArrayL( 
   226                     MEmailAddress::EBcc, 
   239                     MEmailAddress::EBcc, 
   227                     bccRecipients, aRecipients );
   240                     bccRecipients, aRecipients );
   228             }
   241             }
   229         }
   242         }
   230     return aRecipients.Count();
   243     return aRecipients.Count();
   231     }            
   244     }
   232     
   245     
   233 // -----------------------------------------------------------------------------
   246 // -----------------------------------------------------------------------------
   234 // 
   247 // 
   235 // -----------------------------------------------------------------------------
   248 // -----------------------------------------------------------------------------
   236 void CEmailMessage::SetRecipientsL( const MEmailAddress::TRole aRole, 
   249 void CEmailMessage::SetRecipientsL( const MEmailAddress::TRole aRole,
   237         REmailAddressArray& aRecipients )
   250         REmailAddressArray& aRecipients )
   238     {
   251     {
   239     TInt count( aRecipients.Count() );
   252     TInt count( aRecipients.Count() );
   240     
   253 
   241     for( TInt i=0;i<count;i++ )
   254     for( TInt i=0;i<count;i++ )
   242         {
   255         {
   243         const MEmailAddress* address = aRecipients[i];
   256         const MEmailAddress* address = aRecipients[i];
   244         CFSMailAddress* fsAddress = CFSMailAddress::NewLC();
   257         CFSMailAddress* fsAddress = CFSMailAddress::NewLC();
   245         fsAddress->SetEmailAddress( address->Address() );
   258         fsAddress->SetEmailAddress( address->Address() );
   246         fsAddress->SetDisplayName( address->DisplayName() );
   259         fsAddress->SetDisplayName( address->DisplayName() );
   247         
   260         
       
   261         User::LeaveIfNull( iPluginMessage );
       
   262         
   248         if( aRole == MEmailAddress::ETo )
   263         if( aRole == MEmailAddress::ETo )
   249             {
   264             {
   250             iPluginMessage->AppendToRecipient( fsAddress );
   265             iPluginMessage->AppendToRecipient( fsAddress );
   251             }
   266             }
   252         else if( aRole == MEmailAddress::ECc )
   267         else if( aRole == MEmailAddress::ECc )
   262             User::Leave( KErrArgument );
   277             User::Leave( KErrArgument );
   263             }
   278             }
   264         CleanupStack::Pop( fsAddress );
   279         CleanupStack::Pop( fsAddress );
   265         }
   280         }
   266     }
   281     }
   267     
   282 
   268 // -----------------------------------------------------------------------------
   283 // -----------------------------------------------------------------------------
   269 // 
   284 // 
   270 // -----------------------------------------------------------------------------
   285 // -----------------------------------------------------------------------------
   271 void CEmailMessage::RemoveRecipientL( const MEmailAddress& aRecipient )
   286 void CEmailMessage::RemoveRecipientL( const MEmailAddress& /*aRecipient*/ )
   272     {
   287     {
   273     TInt err( KErrNotFound );
   288     User::Leave( KErrNotSupported );
   274     RPointerArray<CFSMailAddress>* recipients = NULL;
   289     }
   275 
   290 
   276     switch (aRecipient.Role())
       
   277         {
       
   278         case MEmailAddress::ETo:
       
   279             recipients = &iPluginMessage->GetToRecipients();
       
   280             break;
       
   281         case MEmailAddress::ECc:
       
   282             recipients = &iPluginMessage->GetCCRecipients();
       
   283             break;
       
   284         case MEmailAddress::EBcc:
       
   285             recipients = &iPluginMessage->GetBCCRecipients();
       
   286             break;
       
   287         default:
       
   288             User::Leave( KErrArgument );
       
   289             break;
       
   290         }
       
   291     
       
   292     for( TInt i = 0; i < recipients->Count(); i++ )
       
   293         {
       
   294         if ( !aRecipient.Address().Compare( (*recipients)[i]->GetEmailAddress() ) )
       
   295             {
       
   296             recipients->Remove(i);
       
   297             err = KErrNone;
       
   298             // We could break now. But let's loop if there are several entries
       
   299             }
       
   300         }
       
   301     User::LeaveIfError( err );
       
   302     }
       
   303     
       
   304 // -----------------------------------------------------------------------------
   291 // -----------------------------------------------------------------------------
   305 // 
   292 // 
   306 // -----------------------------------------------------------------------------
   293 // -----------------------------------------------------------------------------
   307 TPtrC CEmailMessage::Subject() const
   294 TPtrC CEmailMessage::Subject() const
   308     {
   295     {
       
   296     if ( !iPluginMessage )
       
   297         return KNullDesC();
   309     return iPluginMessage->GetSubject();
   298     return iPluginMessage->GetSubject();
   310     }
   299     }
   311 
   300 
   312 // -----------------------------------------------------------------------------
   301 // -----------------------------------------------------------------------------
   313 // 
   302 // 
   314 // -----------------------------------------------------------------------------
   303 // -----------------------------------------------------------------------------
   315 void  CEmailMessage::SetSubjectL( const TPtrC& aSubject)
   304 void  CEmailMessage::SetSubjectL( const TPtrC& aSubject )
   316     {
   305     {
       
   306     User::LeaveIfNull( iPluginMessage );
   317     iPluginMessage->SetSubject( aSubject );
   307     iPluginMessage->SetSubject( aSubject );
   318     }
   308     }
   319     
   309 
   320 // -----------------------------------------------------------------------------
   310 // -----------------------------------------------------------------------------
   321 // 
   311 // 
   322 // -----------------------------------------------------------------------------
   312 // -----------------------------------------------------------------------------
   323 TTime CEmailMessage::Date() const
   313 TTime CEmailMessage::Date() const
   324     {
   314     {
   325     return iPluginMessage->GetDate();
   315     TTime time;
       
   316 
       
   317     if ( iPluginMessage ) {
       
   318         time = iPluginMessage->GetDate();
       
   319     }
       
   320 
       
   321     return time;
   326     }
   322     }
   327 
   323 
   328 // -----------------------------------------------------------------------------
   324 // -----------------------------------------------------------------------------
   329 // 
   325 // 
   330 // -----------------------------------------------------------------------------
   326 // -----------------------------------------------------------------------------
   338 // -----------------------------------------------------------------------------
   334 // -----------------------------------------------------------------------------
   339 void CEmailMessage::SetFlag( const TUint aFlag )
   335 void CEmailMessage::SetFlag( const TUint aFlag )
   340     {
   336     {
   341     iFlags |= aFlag;
   337     iFlags |= aFlag;
   342     TUint flag = MapFlags( aFlag );
   338     TUint flag = MapFlags( aFlag );
   343     iPluginMessage->SetFlag( flag );
   339     if ( iPluginMessage )
   344     }
   340         iPluginMessage->SetFlag( flag );
   345     
   341     }
       
   342 
   346 // -----------------------------------------------------------------------------
   343 // -----------------------------------------------------------------------------
   347 // 
   344 // 
   348 // -----------------------------------------------------------------------------
   345 // -----------------------------------------------------------------------------
   349 void CEmailMessage::ResetFlag( const TUint aFlag )
   346 void CEmailMessage::ResetFlag( const TUint aFlag )
   350     {
   347     {
   351     iFlags &= ~aFlag;
   348     iFlags &= ~aFlag;
   352     TUint flag = MapFlags( aFlag );
   349     TUint flag = MapFlags( aFlag );
   353     iPluginMessage->ResetFlag( flag );
   350     if ( iPluginMessage )
       
   351         iPluginMessage->ResetFlag( flag );
   354     }
   352     }
   355 
   353 
   356 // -----------------------------------------------------------------------------
   354 // -----------------------------------------------------------------------------
   357 // 
   355 // 
   358 // -----------------------------------------------------------------------------
   356 // -----------------------------------------------------------------------------
   359 void CEmailMessage::InitializeFlagValues()
   357 void CEmailMessage::InitializeFlagValues()
   360     {
   358     {
       
   359     if ( !iPluginMessage )
       
   360         return;
   361     // 1st reset member value, then start copying different flags
   361     // 1st reset member value, then start copying different flags
   362     iFlags = 0;
   362     iFlags = 0;
   363     
   363     
   364     // EFlag_Read
   364     // EFlag_Read
   365     if ( iPluginMessage->IsFlagSet( EFSMsgFlag_Read ) )
   365     if ( iPluginMessage->IsFlagSet( EFSMsgFlag_Read ) )
   492 // -----------------------------------------------------------------------------
   492 // -----------------------------------------------------------------------------
   493 // 
   493 // 
   494 // -----------------------------------------------------------------------------
   494 // -----------------------------------------------------------------------------
   495 MEmailMessageContent* CEmailMessage::ContentL() const
   495 MEmailMessageContent* CEmailMessage::ContentL() const
   496     {
   496     {
   497     if (iTextContent)
   497     if ( iTextContent )
   498         {
   498         {
   499         return iTextContent;        
   499         return iTextContent;
   500         }
   500         }
   501     if (iContent)
   501     if ( iContent )
   502         {
   502         {
   503         return iContent;
   503         return iContent;
   504         }
   504         }
   505 
   505 
       
   506     User::LeaveIfNull( iPluginMessage );
       
   507     
   506     RPointerArray<CFSMailMessagePart> parts;
   508     RPointerArray<CFSMailMessagePart> parts;
   507     CleanupResetAndDestroyPushL( parts );
   509     CleanupResetAndDestroyPushL( parts );
   508     iPluginMessage->ChildPartsL( parts );
   510     iPluginMessage->ChildPartsL( parts );
   509     TInt count( parts.Count() );
   511     TInt count( parts.Count() );
   510     if( count == 0 )
   512     if( count == 0 )
   512         /* No content, return NULL */
   514         /* No content, return NULL */
   513         CleanupStack::PopAndDestroy( &parts ); // in case heap allocated but not used
   515         CleanupStack::PopAndDestroy( &parts ); // in case heap allocated but not used
   514         return NULL;
   516         return NULL;
   515         }
   517         }
   516     CFSMailMessagePart* part = parts[0];
   518     CFSMailMessagePart* part = parts[0];
   517     TContentType contentType( part->GetContentType() ); 
   519     TContentType contentType( part->GetContentType() );
   518     TMessageContentId msgContentId = TMessageContentId( 
   520     TMessageContentId msgContentId = TMessageContentId(
   519                         part->GetPartId().Id(),
   521                         part->GetPartId().Id(),
   520                         iMessageId.iId,
   522                         iMessageId.iId,
   521                         iMessageId.iFolderId.iId,
   523                         iMessageId.iFolderId.iId,
   522                         iMessageId.iFolderId.iMailboxId ); 
   524                         iMessageId.iFolderId.iMailboxId );
   523 
   525 
   524     if ( contentType.Equals( KFSMailContentTypeTextPlain ) || 
   526     if ( contentType.Equals( KFSMailContentTypeTextPlain ) ||
   525         contentType.Equals( KFSMailContentTypeTextHtml ) )
   527         contentType.Equals( KFSMailContentTypeTextHtml ) )
   526         {                                
   528         {                                
   527         iTextContent = CEmailTextContent::NewL(iPluginData, msgContentId, part, EAPIOwns );
   529         iTextContent = CEmailTextContent::NewL(iPluginData, msgContentId, part, EAPIOwns );
   528         parts[0] = NULL; // ownership of part transferred
   530         parts[0] = NULL; // ownership of part transferred
   529         }
   531         }
   536         iContent = CEmailMultipart::NewL(iPluginData, msgContentId, part, EAPIOwns);
   538         iContent = CEmailMultipart::NewL(iPluginData, msgContentId, part, EAPIOwns);
   537         parts[0] = NULL; // ownership of part transferred
   539         parts[0] = NULL; // ownership of part transferred
   538         }
   540         }
   539 
   541 
   540     CleanupStack::PopAndDestroy( &parts ); // parts
   542     CleanupStack::PopAndDestroy( &parts ); // parts
   541     
   543 
   542     if (iTextContent)
   544     if (iTextContent)
   543         {
   545         {
   544         return iTextContent;        
   546         return iTextContent;
   545         }
   547         }
   546     return iContent;
   548     return iContent;
   547     }
   549     }
   548 
   550 
   549 // -----------------------------------------------------------------------------
   551 // -----------------------------------------------------------------------------
   550 // 
   552 // 
   551 // -----------------------------------------------------------------------------
   553 // -----------------------------------------------------------------------------
   552 void CEmailMessage::SetContentL( const MEmailMessageContent*  aContent )
   554 void CEmailMessage::SetContentL( const MEmailMessageContent*  aContent )
   553     {
   555     {
       
   556     User::LeaveIfNull( aContent );
   554     MEmailTextContent* textContent = aContent->AsTextContentOrNull();
   557     MEmailTextContent* textContent = aContent->AsTextContentOrNull();
   555     if (textContent)
   558     if ( textContent )
   556         {
   559         {
   557         if (iTextContent)
   560         if ( iTextContent )
   558             {
   561             {
   559             delete iTextContent; // Destroy old content
   562             delete iTextContent; // Destroy old content
   560             }
   563             }
   561         iTextContent = dynamic_cast<CEmailTextContent*>(textContent);
   564         iTextContent = dynamic_cast<CEmailTextContent*>( textContent );
   562 		if ( iTextContent )
   565         if ( iTextContent )
   563 			{
   566             {
   564 			iTextContent->SetOwner( EAPIOwns );
   567             iTextContent->SetOwner( EAPIOwns );
   565 			}
   568             }
   566         return;
   569         return;
   567         }
   570         }
   568     MEmailMultipart* mPart = aContent->AsMultipartOrNull();
   571     MEmailMultipart* mPart = aContent->AsMultipartOrNull();
   569     if (mPart)
   572     if ( mPart )
   570         {
   573         {
   571         if (iContent)
   574         if ( iContent )
   572             {
   575             {
   573             delete iContent;
   576             delete iContent;
   574             }
   577             }
   575         iContent = dynamic_cast<CEmailMultipart*>(mPart);
   578         iContent = dynamic_cast<CEmailMultipart*>( mPart );
   576 		if ( iContent )
   579         if ( iContent )
   577 			{
   580             {
   578 			iContent->SetOwner( EAPIOwns );
   581             iContent->SetOwner( EAPIOwns );
   579 			}
   582             }
   580         }    
   583         }    
   581     }
   584     }
   582     
   585 
   583 // -----------------------------------------------------------------------------
   586 // -----------------------------------------------------------------------------
   584 // 
   587 // 
   585 // -----------------------------------------------------------------------------
   588 // -----------------------------------------------------------------------------
   586 void CEmailMessage::SetPlainTextBodyL( const TDesC& aPlainText )
   589 void CEmailMessage::SetPlainTextBodyL( const TDesC& aPlainText )
   587     {
   590     {
   588     if (iTextContent)
   591     if ( iTextContent )
   589         {
   592         {
   590         iTextContent->SetTextL( MEmailTextContent::EPlainText, aPlainText );
   593         iTextContent->SetTextL( MEmailTextContent::EPlainText, aPlainText );
   591         return;
   594         return;
   592         }
   595         }
       
   596 
       
   597     User::LeaveIfNull( iPluginMessage );
       
   598 
   593     CFSMailMessagePart* msgTextPart = iPluginMessage->PlainTextBodyPartL();
   599     CFSMailMessagePart* msgTextPart = iPluginMessage->PlainTextBodyPartL();
   594     
   600     
   595     if( !msgTextPart )
   601     if( !msgTextPart )
   596         {
   602         {
   597         msgTextPart = iPluginMessage->NewChildPartL( TFSMailMsgId(), KFSMailContentTypeTextPlain );        
   603         msgTextPart = iPluginMessage->NewChildPartL( TFSMailMsgId(), KFSMailContentTypeTextPlain );
   598         }
   604         }
   599     CleanupStack::PushL( msgTextPart );
   605     CleanupStack::PushL( msgTextPart );
   600     
   606 
   601     TMessageContentId msgContentId = TMessageContentId( 
   607     TMessageContentId msgContentId = MessageContentId( msgTextPart->GetPartId().Id() );
   602                         msgTextPart->GetPartId().Id(),
   608 
   603                         iMessageId.iId,
   609     msgTextPart->SetContentType( KFSMailContentTypeTextPlain );
   604                         iMessageId.iFolderId.iId,
       
   605                         iMessageId.iFolderId.iMailboxId );
       
   606     
       
   607     msgTextPart->SetContentType( KFSMailContentTypeTextPlain );    
       
   608     iTextContent = CEmailTextContent::NewL( iPluginData, msgContentId, msgTextPart, EAPIOwns );
   610     iTextContent = CEmailTextContent::NewL( iPluginData, msgContentId, msgTextPart, EAPIOwns );
   609     if (iTextContent)
   611     if (iTextContent)
   610         {
   612         {
   611         iTextContent->SetTextL( MEmailTextContent::EPlainText, aPlainText );
   613         iTextContent->SetTextL( MEmailTextContent::EPlainText, aPlainText );
   612         }
   614         }
   613     CleanupStack::Pop(); // msgTextPart
   615     CleanupStack::Pop( msgTextPart );
   614     
   616 
   615     return;
   617     return;
   616     
   618 
   617     }
   619     }
   618 
   620 
   619 // -----------------------------------------------------------------------------
   621 // -----------------------------------------------------------------------------
   620 // 
   622 // 
   621 // -----------------------------------------------------------------------------
   623 // -----------------------------------------------------------------------------
   622 MEmailAttachment* CEmailMessage::AddAttachmentL( const TDesC& aFullPath )
   624 MEmailAttachment* CEmailMessage::AddAttachmentL( const TDesC& aFullPath )
   623     {
   625     {
   624     CFSMailMessagePart* part = iPluginMessage->AddNewAttachmentL(aFullPath, TFSMailMsgId());
   626     User::LeaveIfNull( iPluginMessage );
       
   627 
       
   628     CFSMailMessagePart* part = iPluginMessage->AddNewAttachmentL( aFullPath, TFSMailMsgId() );
   625     CleanupStack::PushL( part );    
   629     CleanupStack::PushL( part );    
   626     CEmailAttachment* att = CEmailAttachment::NewLC(iPluginData, iMsgContentId, part, EAPIOwns);
   630     CEmailAttachment* att = CEmailAttachment::NewLC( iPluginData, iMsgContentId, part, EAPIOwns );
   627     iAttachments.AppendL( att );
   631     iAttachments.AppendL( att );
   628     CleanupStack::Pop(2); // part, att
   632     CleanupStack::Pop( 2, part );
   629     
   633 
   630     return att;
   634     return att;
   631     }
   635     }
   632     
   636 
   633 // -----------------------------------------------------------------------------
   637 // -----------------------------------------------------------------------------
   634 // 
   638 // 
   635 // -----------------------------------------------------------------------------
   639 // -----------------------------------------------------------------------------
   636 
       
   637 MEmailAttachment* CEmailMessage::AddAttachmentL( RFile& aFile )
   640 MEmailAttachment* CEmailMessage::AddAttachmentL( RFile& aFile )
   638     {
   641     {
       
   642     User::LeaveIfNull( iPluginMessage );
   639     TBufC8 <1> mime;
   643     TBufC8 <1> mime;
   640     CFSMailMessagePart* part = iPluginMessage->AddNewAttachmentL(aFile, mime);
   644     CFSMailMessagePart* part = iPluginMessage->AddNewAttachmentL( aFile, mime );
   641     CleanupStack::PushL( part );
   645     CleanupStack::PushL( part );
   642     CEmailAttachment* att = CEmailAttachment::NewLC(iPluginData, iMsgContentId, part, EAPIOwns);
   646     CEmailAttachment* att = CEmailAttachment::NewLC( iPluginData, iMsgContentId, part, EAPIOwns );
   643     iAttachments.AppendL( att );
   647     iAttachments.AppendL( att );
   644     CleanupStack::Pop(2); // part, att
   648 
   645     
   649     CleanupStack::Pop( 2, part );
       
   650 
   646     return att;
   651     return att;
   647     }
   652     }
   648 
   653 
   649 // -----------------------------------------------------------------------------
   654 // -----------------------------------------------------------------------------
   650 // 
   655 // 
   651 // -----------------------------------------------------------------------------
   656 // -----------------------------------------------------------------------------
   652 TInt CEmailMessage::GetAttachmentsL( REmailAttachmentArray& aAttachments )
   657 TInt CEmailMessage::GetAttachmentsL( REmailAttachmentArray& aAttachments )
   653     {
   658     {
       
   659     User::LeaveIfNull( iPluginMessage );
       
   660 
   654     RPointerArray<CFSMailMessagePart> attachments;
   661     RPointerArray<CFSMailMessagePart> attachments;
   655     CleanupResetAndDestroyPushL( attachments );
   662     CleanupResetAndDestroyPushL( attachments );
   656     iPluginMessage->AttachmentListL(attachments);
   663     iPluginMessage->AttachmentListL( attachments );
   657     const TInt count( attachments.Count() );
   664     const TInt count( attachments.Count() );
   658     for (TInt i = 0; i < count; i++)
   665     for (TInt i = 0; i < count; i++)
   659         {
   666         {
   660             TMessageContentId msgContentId = TMessageContentId( 
   667         TMessageContentId msgContentId = MessageContentId( attachments[i]->GetPartId().Id() );
   661                             attachments[i]->GetPartId().Id(),
   668 
   662                             iMessageId.iId,
   669         CEmailAttachment* att = CEmailAttachment::NewL( 
   663                             iMessageId.iFolderId.iId,
   670             iPluginData, msgContentId, attachments[i], EClientOwns );
   664                             iMessageId.iFolderId.iMailboxId ); 
   671 
   665 
   672         aAttachments.AppendL( att );
   666             CEmailAttachment* att = CEmailAttachment::NewL(iPluginData, msgContentId, attachments[i], EClientOwns);
   673         }
   667             
   674     CleanupStack::Pop( &attachments );
   668             aAttachments.AppendL(att);
   675     return count;
   669         }
   676     }
   670     CleanupStack::Pop(); // attachments
   677 
   671     return count;    
   678 // -----------------------------------------------------------------------------
   672     }
   679 // 
       
   680 // -----------------------------------------------------------------------------
       
   681 void CEmailMessage::RemoveAttachmentL( const MEmailAttachment& /*aAttachment*/ )
       
   682     {
       
   683     User::Leave( KErrNotSupported );
       
   684     }
       
   685 
       
   686 // -----------------------------------------------------------------------------
       
   687 // 
       
   688 // -----------------------------------------------------------------------------
       
   689 const TFolderId& CEmailMessage::ParentFolderId() const
       
   690     {
       
   691     return iMessageId.iFolderId;
       
   692     }
       
   693 
       
   694 // -----------------------------------------------------------------------------
       
   695 // 
       
   696 // -----------------------------------------------------------------------------
       
   697 void CEmailMessage::SaveChangesL()
       
   698     {
       
   699     User::LeaveIfNull( iPluginMessage );
   673     
   700     
   674 // -----------------------------------------------------------------------------
       
   675 // 
       
   676 // -----------------------------------------------------------------------------
       
   677 void CEmailMessage::RemoveAttachmentL( const MEmailAttachment& aAttachment  )
       
   678     {
       
   679     iPluginMessage->RemoveChildPartL(FsMsgId( iPluginData, aAttachment.Id()));
       
   680     }
       
   681 
       
   682 // -----------------------------------------------------------------------------
       
   683 // 
       
   684 // -----------------------------------------------------------------------------
       
   685 const TFolderId& CEmailMessage::ParentFolderId() const
       
   686     {
       
   687     return iMessageId.iFolderId;
       
   688     }
       
   689 
       
   690 // -----------------------------------------------------------------------------
       
   691 // 
       
   692 // -----------------------------------------------------------------------------
       
   693 void CEmailMessage::SaveChangesL()
       
   694     {
       
   695     TFSMailMsgId mailboxId( 
   701     TFSMailMsgId mailboxId( 
   696             FsMsgId( iPluginData, iMessageId.iFolderId.iMailboxId ) );
   702             FsMsgId( iPluginData, iMessageId.iFolderId.iMailboxId ) );
   697     
   703     
   698     iPlugin->StoreMessageL( mailboxId, *iPluginMessage );
   704     iPlugin->StoreMessageL( mailboxId, *iPluginMessage );
   699     }
   705     }
   701 // -----------------------------------------------------------------------------
   707 // -----------------------------------------------------------------------------
   702 // 
   708 // 
   703 // -----------------------------------------------------------------------------
   709 // -----------------------------------------------------------------------------
   704 void CEmailMessage::SendL()
   710 void CEmailMessage::SendL()
   705     {
   711     {
       
   712     User::LeaveIfNull( iPluginMessage );
       
   713     
       
   714     if ( iEventLoop.isRunning() )
       
   715         User::Leave( KErrInUse );
       
   716     
   706     SaveChangesL();
   717     SaveChangesL();
   707     iPlugin->SendMessageL( *iPluginMessage );
   718     iError = KErrNone;
   708     }
   719     iPlugin->SendMessageL( *iPluginMessage, *this, KSendMessageRequestId );
   709 
   720     iEventLoop.exec();
   710 // -----------------------------------------------------------------------------
   721 
   711 // 
   722     User::LeaveIfError( iError );
   712 // -----------------------------------------------------------------------------
   723     }
   713 void CEmailMessage::ConvertAddressArrayL( 
   724 
       
   725 // -----------------------------------------------------------------------------
       
   726 // 
       
   727 // -----------------------------------------------------------------------------
       
   728 void CEmailMessage::RequestResponseL( TFSProgress aEvent, TInt aRequestId )
       
   729     {
       
   730     iError = aEvent.iError;
       
   731 
       
   732     if ( aRequestId == KSendMessageRequestId &&
       
   733             aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestComplete )
       
   734         iEventLoop.quit();
       
   735     }
       
   736 
       
   737 // -----------------------------------------------------------------------------
       
   738 // 
       
   739 // -----------------------------------------------------------------------------
       
   740 void CEmailMessage::ConvertAddressArrayL(
   714         const MEmailAddress::TRole aRole,
   741         const MEmailAddress::TRole aRole,
   715         RPointerArray<CFSMailAddress>& aSrc, 
   742         const RPointerArray<CFSMailAddress>& aSrc,
   716         REmailAddressArray& aDst ) const
   743         REmailAddressArray& aDst ) const
   717     {
   744     {
   718     for ( TInt i=0; i<aSrc.Count(); i++ )
   745     for ( TInt i=0; i<aSrc.Count(); i++ )
   719         {
   746         {
   720         CEmailAddress* recipient = CreateAddressLC( aRole, *aSrc[i] );
   747         CEmailAddress* recipient = CreateAddressLC( aRole, *aSrc[i] );
   724     }
   751     }
   725 
   752 
   726 // -----------------------------------------------------------------------------
   753 // -----------------------------------------------------------------------------
   727 //
   754 //
   728 // -----------------------------------------------------------------------------
   755 // -----------------------------------------------------------------------------
   729 //
   756 CEmailAddress* CEmailMessage::CreateAddressLC(
   730 CEmailAddress* CEmailMessage::CreateAddressLC( 
       
   731         const MEmailAddress::TRole aRole, 
   757         const MEmailAddress::TRole aRole, 
   732         CFSMailAddress& aFsAddress ) const
   758         CFSMailAddress& aFsAddress ) const
   733     {
   759     {
   734     CEmailAddress* address = CEmailAddress::NewLC( aRole, EClientOwns );
   760     CEmailAddress* address = CEmailAddress::NewLC( aRole, EClientOwns );
   735     TDesC& temp1 = aFsAddress.GetEmailAddress();
   761     TDesC& temp1 = aFsAddress.GetEmailAddress();
   746     }
   772     }
   747 
   773 
   748 // -----------------------------------------------------------------------------
   774 // -----------------------------------------------------------------------------
   749 //
   775 //
   750 // -----------------------------------------------------------------------------
   776 // -----------------------------------------------------------------------------
   751 //
       
   752 TUint CEmailMessage::MapFlags( const TUint& aFlag )
   777 TUint CEmailMessage::MapFlags( const TUint& aFlag )
   753     {
   778     {
   754     TUint flag = 0;
   779     TUint flag = 0;
   755     switch( aFlag )
   780     switch( aFlag )
   756         {
   781         {
   800             break;
   825             break;
   801         }
   826         }
   802     return flag;
   827     return flag;
   803     }
   828     }
   804 
   829 
   805 void CEmailMessage::ShowMessageViewerL( )
   830 // -----------------------------------------------------------------------------
       
   831 //
       
   832 // -----------------------------------------------------------------------------
       
   833 void CEmailMessage::ShowMessageViewerL()
   806     {   
   834     {   
   807     THtmlViewerActivationData htmlData;
   835     bool syncronous;
   808     htmlData.iActivationDataType = THtmlViewerActivationData::EMailMessage;
   836 
   809     htmlData.iMailBoxId = FsMsgId(iPluginData, iMessageId.iFolderId.iMailboxId);
   837     XQServiceRequest request(
   810     htmlData.iFolderId = FsMsgId(iPluginData, iMessageId.iFolderId);
   838        emailInterfaceNameMessage,
   811     htmlData.iMessageId = FsMsgId(iPluginData, iMessageId);
   839        emailOperationViewMessage,
   812     TPckgBuf<THtmlViewerActivationData> pckgData( htmlData );
   840        syncronous );
   813     CVwsSessionWrapper* viewSrvSession = CVwsSessionWrapper::NewLC();
   841 
   814     viewSrvSession->ActivateView(TVwsViewId(KFSEmailUiUid, HtmlViewerId), KHtmlViewerOpenNew, pckgData);
   842     TFSMailMsgId mailboxId = FsMsgId( iPluginData, iMessageId.iFolderId.iMailboxId );
   815     CleanupStack::PopAndDestroy();
   843     TFSMailMsgId folderId = FsMsgId( iPluginData, iMessageId.iFolderId );
   816     }    
   844     TFSMailMsgId messageId = FsMsgId( iPluginData, iMessageId );
   817 
   845 
   818 /** 
   846     QList<QVariant> list;
   819  * Launches Email application and new reply message in editor. 
   847     list.append( mailboxId.Id() );
   820  * The method follows "fire and forget" pattern, returns immediately.
   848     list.append( folderId.Id() );
   821  */
   849     list.append( messageId.Id() );
   822 void CEmailMessage::ReplyToMessageL( const TBool aReplyToAll )
   850     request.setArguments( list );
   823     {
   851 
   824     TEditorLaunchParams editorLaunchData;
   852     QVariant returnValue;
   825     editorLaunchData.iExtra = NULL;
   853     if ( !request.send( returnValue ) )
   826     editorLaunchData.iMailboxId = FsMsgId(iPluginData, iMessageId.iFolderId.iMailboxId);
   854         User::Leave( KErrGeneral );
   827     editorLaunchData.iFolderId = FsMsgId(iPluginData, iMessageId.iFolderId);
   855     }
   828     editorLaunchData.iMsgId = FsMsgId(iPluginData, iMessageId);
   856 
   829     editorLaunchData.iActivatedExternally = ETrue; 
   857 // -----------------------------------------------------------------------------
   830     
   858 // Launches Email application and new reply message in editor. 
   831     TPckgBuf<TEditorLaunchParams> pckgData( editorLaunchData );
   859 // The method follows "fire and forget" pattern, returns immediately.
   832     CVwsSessionWrapper* viewSrvSession = CVwsSessionWrapper::NewLC();
   860 // -----------------------------------------------------------------------------
   833     TUid command = TUid::Uid(KEditorCmdReplyAll);
   861 void CEmailMessage::ReplyToMessageL( const TBool /*aReplyToAll*/ )
   834     if ( !aReplyToAll )
   862     {
   835         {
   863     User::Leave( KErrNotSupported );
   836         command = TUid::Uid(KEditorCmdReply);
   864     }
   837         }
   865 
   838     viewSrvSession->ActivateView(TVwsViewId(KFSEmailUiUid, MailEditorId), command, pckgData);
   866 // -----------------------------------------------------------------------------
   839     CleanupStack::PopAndDestroy();   
   867 //
   840     }
   868 // -----------------------------------------------------------------------------
   841 
       
   842 void CEmailMessage::ForwardMessageL()
   869 void CEmailMessage::ForwardMessageL()
   843     {
   870     {
   844     TEditorLaunchParams editorLaunchData;
   871     User::Leave( KErrNotSupported );
   845     editorLaunchData.iExtra = NULL;
       
   846     editorLaunchData.iMailboxId = FsMsgId(iPluginData, iMessageId.iFolderId.iMailboxId);
       
   847     editorLaunchData.iFolderId = FsMsgId(iPluginData, iMessageId.iFolderId);
       
   848     editorLaunchData.iMsgId = FsMsgId(iPluginData, iMessageId);
       
   849     editorLaunchData.iActivatedExternally = ETrue; 
       
   850     
       
   851     TPckgBuf<TEditorLaunchParams> pckgData( editorLaunchData );
       
   852     CVwsSessionWrapper* viewSrvSession = CVwsSessionWrapper::NewLC();
       
   853     TUid command = TUid::Uid(KEditorCmdForward);
       
   854     viewSrvSession->ActivateView(TVwsViewId(KFSEmailUiUid, MailEditorId), command, pckgData);
       
   855     CleanupStack::PopAndDestroy();   
       
   856     }
   872     }
   857 
   873 
   858 // -----------------------------------------------------------------------------
   874 // -----------------------------------------------------------------------------
   859 //
   875 //
   860 // -----------------------------------------------------------------------------
   876 // -----------------------------------------------------------------------------
       
   877 TMessageContentId CEmailMessage::MessageContentId( TEntryId aContentId ) const
       
   878     {
       
   879     TMessageContentId msgContentId = TMessageContentId( 
       
   880                     aContentId,
       
   881                     iMessageId.iId,
       
   882                     iMessageId.iFolderId.iId,
       
   883                     iMessageId.iFolderId.iMailboxId );
       
   884     return msgContentId;
       
   885     }
       
   886 
       
   887 // -----------------------------------------------------------------------------
   861 //
   888 //
       
   889 // -----------------------------------------------------------------------------
   862 TContentType::TContentType( const TDesC& aContentType ) : iContentType( aContentType )
   890 TContentType::TContentType( const TDesC& aContentType ) : iContentType( aContentType )
   863     {
   891     {
   864     _LIT( KSeparator, ";" );
   892     _LIT( KSeparator, ";" );
   865     TInt end = aContentType.Find( KSeparator );
   893     TInt end = aContentType.Find( KSeparator );
   866     if ( end != KErrNotFound )
   894     if ( end != KErrNotFound )
   870     }
   898     }
   871 
   899 
   872 // -----------------------------------------------------------------------------
   900 // -----------------------------------------------------------------------------
   873 //
   901 //
   874 // -----------------------------------------------------------------------------
   902 // -----------------------------------------------------------------------------
   875 //
       
   876 TBool TContentType::Equals( const TDesC& aContentType )
   903 TBool TContentType::Equals( const TDesC& aContentType )
   877     {
   904     {
   878 	TBool ret = iContentType.CompareF( aContentType );
   905     TBool ret = iContentType.CompareF( aContentType );
   879     if ( ret == 0  )
   906     if ( ret == 0  )
   880     	return ETrue;
   907         return ETrue;
   881     else
   908     else
   882     	return EFalse;
   909         return EFalse;
   883     }
   910     }
   884 
   911 
   885 // End of file.
   912 // End of file