1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
21 #include <msvapi.h> // TMsvEntry, CMsvOperation etc
22 #include <mentact.h> // CMsgActive
23 #include <miuthdr.h> // CImHeader, CImMimeHeader
24 #include <txtrich.h> // CRichText etc
25 #include <miutdef.h> // CImHeader, CImMimeHeader
29 #include <miutpars.h> // TImMessageField
31 #include <barsc.h> // RResourceFile
37 //#include <mmsvattachmentmanager.h>
40 //Content-Transfer-Encoding: types
41 _LIT8(KMimeQuotedPrintable, " quoted-printable");
42 _LIT8(KMimeApplOctet, " application/octet-stream");
43 _LIT8(KMime7Bit, " 7-bit");
44 _LIT8(KMimeBase64, " base64");
45 _LIT8(KMimeMime, "MIME*");
46 // Content-Disposition: types
47 _LIT8(KMimeInline, "inline");
48 _LIT8(KMimeAttachment, "attachment");
49 // Content-Type: types
50 _LIT8(KMimeMultipart, "multipart");
51 _LIT8(KMimeText, "text");
52 _LIT8(KMimeImage, "image");
53 _LIT8(KMimeAudio, "audio");
54 _LIT8(KMimeVideo, "video");
55 _LIT8(KMimeApplication, "application");
56 _LIT8(KMimeMessage, "message");
57 // Content-Type: Multipart types
58 _LIT8(KMimeMixed, "mixed");
59 _LIT8(KMimeRelated, "related");
60 _LIT8(KMimeAlternative, "alternative");
61 _LIT8(KMimeEncrypted, "encrypted");
62 _LIT8(KMimeParallel, "parallel");
63 _LIT8(KMimeDigest, "digest");
64 _LIT8(KMimeSigned, "signed");
65 // Content-Type: Text types
66 _LIT8(KMimeHtml, "html");
67 _LIT8(KMimePlain, "plain");
68 _LIT8(KMimeDirectory, "directory");
69 // Content-Type: Message types
70 _LIT8(KMimePartial, "partial");
71 _LIT8(KMimeExternal, "external-body");
72 _LIT8(KMimeRfc822, "rfc822");
73 // Content-Type: Directory types
74 _LIT8(KMimeProfile, "profile");
75 _LIT(KMimeVCardExtension, ".vcf");
76 _LIT8(KMimeVCalender, "vcalendar");
77 // Content-Type: Image, Audio, Video, Application types
78 _LIT8(KMimeBmp, "bmp");
79 _LIT8(KMimeGif, "gif");
80 _LIT8(KMimeJpeg, "jpeg");
81 _LIT8(KMimeTiff, "tiff");
82 _LIT8(KMimeWav, "wav");
83 _LIT8(KMimeZip, "x-gzip");
84 _LIT(KMimeHtmlExtension, ".html");
85 _LIT(KMiutMsgDefaultHtmlFileName, "attachment.html");
86 const TUid KUidMimeHeaders = {0x10204281};
88 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
89 #include "cimmessagepart.h"
92 class CImHtmlConverter;
94 class CImAttachmentManager;
95 class CMsvMimeHeaders;
96 class CImPlainBodyText;
98 // Mixin provides interface to Browser control to resolve MHTML URIs.
100 class MImURITranslator
101 /** Translates a URI in an MHTML message into a message body part file name.
103 MHTML messages may contain multiple HTML body parts. Each of these body parts
104 is able to reference another body part within the same multipart structure,
105 or a body part within a parent multipart structure [RFC2110]. These references
108 When an MHTML message is parsed by the message engine, the HTML body of each
109 part is stored as a binary file. This interface provides a means of finding
110 the file name of the body part that corresponds to a given a URI.
112 The URI resolving process has the potential to become time consuming, therefore
113 it is broken into two steps:
115 Resolve asynchronously the relative URI into an absolute URI. The message
116 body parts are recursively searched in order to find an absolute base for
117 the relative URI [RFC2110, RFC1808].
119 Once a relative URI has been resolved in to an absolute URI, then the message
120 is searched for a body part that corresponds to it [RFC2110].
122 If no matching body part can be found, then the absolute URI is returned to
123 the caller in place of the filename. This absolute URI should be used to search
124 for the required data externally, for example by using HTTP.
132 /** Starts an asynchronous operation to resolve a specified URI.
134 @param aMessageId The ID of the body part containing the URI which is to be
135 resolved. CImEmailMessage::FindFirstHTMLPageL() can be used to find the aMessageId
136 parameter for the first HTML page in a message.
137 @param rBase The base parameter from the HTML part that contains the URI to
138 be resolved. If there is no base parameter in the HTML, then an empty descriptor
140 @param rURI The URI to be resolved.
141 @param aStatus Asynchronous status word */
142 virtual void FindUniversalResourceIdentifierL(TMsvId aMessageId, const TDesC& rBase, const TDesC& rURI, TRequestStatus &aStatus) = 0;
144 /** Gets the results after a search.
146 @param aLinkedEntryId On return, the message ID of the linked body part, providing
147 one is found. Note that you should keep a record of the returned message ID
148 as it is required for resolving any URI's that may be found in the linked
150 @param aFileFound On return, true if a linked body part has been found. It
151 is set to false otherwise.
152 @return If successful, the filename that corresponds to the URI, or the absolute
153 URI if no matching file can be found. If failed, NULL. */
154 virtual HBufC* GetUniversalResourceIdentifierL(TMsvId& aLinkedEntryId, TBool& aFileFound) const = 0;
156 /** Starts an asynchronous operation to resolve a specified URI.
158 @param aMessageId The ID of the body part containing the URI which is to be
159 resolved. CImEmailMessage::FindFirstHTMLPageFileHandleL() can be used to find the aMessageId
160 parameter for the first HTML page in a message.
161 @param aBase The base parameter from the HTML part that contains the URI to
162 be resolved. If there is no base parameter in the HTML, then an empty descriptor
164 @param aURI The URI to be resolved.
165 @param aStatus Asynchronous status word */
166 virtual void FindUniversalResourceIdentifierFileHandleL(TMsvId aMessageId, const TDesC& aBase, const TDesC& aURI, TRequestStatus &aStatus) = 0;
168 /** Gets the results after a search.
170 @param aLinkedEntryId On return, the message ID of the linked body part, providing
171 one is found. Note that you should keep a record of the returned message ID
172 as it is required for resolving any URI's that may be found in the linked
175 @param aFile On return, the file handle corresponding to the URI if successful.
176 If not successful, then this is not valid.
178 @return KErrNone if successful and therefore aFile contains the filehandle
179 that corresponds to the URI. An error code if unsuccessful and therefore
180 aFile is not valid. */
181 virtual TInt GetUniversalResourceIdentifierFileHandle(TMsvId& aLinkedEntryId, RFile& aFile) const = 0;
187 class CImMhtmlUriResolver;
188 class CImRemoveMessagePart;
189 class CImStoreMessagePart;
192 class CImEmailMessage : public CMsgActive , public MImURITranslator
194 This class can be used to manipulate new emails that
195 have been created using CImEmailOperation when composing a message.
197 Use an instance of this class to add attachments, MHTML parts, body
198 text, and existing messages to a new message before it is to be sent.
200 This class can also be used to retrieve the body text, list of attachments,
201 and embedded messages from emails that have been downloaded and stored within
204 If the store_8bit_body_text flag in imcm.rss is enabled, an instance of this class
205 can be used to retrieve the original body text character set for a particular message.
206 It can also be used to override the original body text character set so it will
207 be decoded in a new character set next time it is viewed.
209 @see CImEmailOperation
216 /** Flags that specify to process on any messages embedded in this message. */
217 enum TImEmailEntryType
219 /** Do not process embedded messages. */
221 /** Process embedded messages. */
222 EThisMessageAndEmbeddedMessages // i.e messages with in a message
224 /** Flags to specify types of attachment. */
225 enum TImAttachmentType
227 /** All attachments. */
228 EAllAttachments=0, // all attachment files contained within this message (but not inside messages within this message)
233 /** VCards, VCalendars and ICalendars. */
234 EVEntries, // ie VCards, VCalendars or ICalendars (or all three)
240 ESecure, // ie Encrypted or signed (or both)
243 //.. add new items here
246 IMPORT_C static CImEmailMessage* NewL(CMsvEntry& aEntry);
247 IMPORT_C static CImEmailMessage* NewLC(CMsvEntry& aEntry);
248 IMPORT_C ~CImEmailMessage();
250 IMPORT_C void GetAttachmentsListL(TRequestStatus& aStatus, TMsvId aMessageId, TImAttachmentType aAttachmentType,TImEmailEntryType aEntryType);
251 IMPORT_C void GetAttachmentsListL(TMsvId aMessageId, TImAttachmentType aAttachmentType,TImEmailEntryType aEntryType);
252 void DoGetAttachmentsListL(TMsvId aMessageId, TImAttachmentType aAttachmentType,TImEmailEntryType aEntryType);
254 IMPORT_C void FindFirstHTMLPageL(TMsvId aMessageId, TRequestStatus& aStatus);
256 IMPORT_C const CMsvEntrySelection& Selection() const; // return selection
257 IMPORT_C const TDesC8& ProgressL() const;
259 IMPORT_C void GetBodyTextL(TRequestStatus& aStatus, TMsvId aMessageId, TImEmailEntryType aEntryType, CRichText& aRichText,CParaFormatLayer& aParaLayer,CCharFormatLayer& aCharLayer);
260 IMPORT_C void GetBodyTextL(TMsvId aMessageId, TImEmailEntryType aEntryType, CRichText& aRichText,CParaFormatLayer& aParaLayer,CCharFormatLayer& aCharLayer);
261 void DoGetBodyTextInitL(TMsvId aMessageId, TImEmailEntryType aEntryType, CRichText& aRichText,CParaFormatLayer& aParaLayer, CCharFormatLayer& aCharLayer);
263 IMPORT_C void GetBodyTextEntryIdL(TRequestStatus& aStatus, TMsvId aMessageId, TImEmailEntryType aEntryType);
264 IMPORT_C void GetBodyTextEntryIdL(TMsvId aMessageId, TImEmailEntryType aEntryType);
266 IMPORT_C CImPlainBodyText* OpenPlainBodyTextForWriteL();
268 IMPORT_C CImPlainBodyText* OpenPlainBodyTextForReadL(TImEmailEntryType aEntryType, TInt aChunkLength);
270 IMPORT_C virtual void FindUniversalResourceIdentifierL(TMsvId aMessageId, const TDesC& aBase, const TDesC& aURI, TRequestStatus &aStatus);
271 IMPORT_C virtual HBufC* GetUniversalResourceIdentifierL(TMsvId& aLinkedEntryId, TBool& aFileFound) const;
272 IMPORT_C void FindUniversalResourceIdentifierFileHandleL(TMsvId aMessageId, const TDesC& aBase, const TDesC& aURI, TRequestStatus &aStatus);
273 IMPORT_C void FindFirstHTMLPageFileHandleL(TMsvId aMessageId, TRequestStatus& aStatus);
274 IMPORT_C virtual TInt GetUniversalResourceIdentifierFileHandle(TMsvId& aLinkedEntryId, RFile& aFile) const;
275 IMPORT_C MMsvAttachmentManager& AttachmentManager() const;
276 void AddAttachmentL(const TDesC& aFilePath, CMsvAttachment* aAttachmentInfo, TRequestStatus& aStatus);
277 void AddAttachmentL(RFile& aFileHandle, CMsvAttachment* aAttachmentInfo, TRequestStatus& aStatus);
278 void AddLinkedAttachmentL(const TDesC& aFilePath, CMsvAttachment* aAttachmentInfo,TRequestStatus& aStatus);
279 void AddEntryAsAttachmentL(TMsvId aAttachmentEntryId, CMsvAttachment* aAttachmentInfo,TRequestStatus& aStatus);
280 const RPointerArray<CMsvAttachment>& AttachmentInfoSelection() const;
281 void RemoveAttachmentL(TMsvAttachmentId aAttachmentId,TRequestStatus& aStatus) ;
282 void RemoveAttachedMessageL(TMsvAttachmentId aAttachmentId,TRequestStatus& aStatus) ;
283 void CreateAttachmentL(const TDesC& aFileName, RFile& aAttachmentFile, CMsvAttachment* aAttachmentInfo, TRequestStatus& aStatus);
284 void CheckEntryAndResetStoreMessageL(TMsvId aMessageId);
285 void CheckEntryAndResetRemoveMessageL(TMsvId aMessageId);
286 void DoSetActive(TRequestStatus& aStatus);
287 CImMimeHeader* ConvertToImMimeHeadersL(CMsvMimeHeaders* aMimeHeaders);
288 CMsvMimeHeaders* ConvertToMsvMimeHeadersL(CImMimeHeader* aMimeHeader);
289 void AppendEntryAttachmentInfoL();
290 IMPORT_C void AddRelatedPartL(TMsvId aMessageId, const TDesC& aAttachmentFullName, TRequestStatus& aStatus, TMsvId aRelatedPartId, const TDesC8& aContentId);
291 IMPORT_C void StoreBodyTextL(TMsvId aMessageId, CRichText& aRichText, TRequestStatus& aStatus);
292 IMPORT_C void StoreBodyTextL(TMsvId aMessageId, CRichText& aRichText, TRequestStatus& aStatus, TBool aUsePlainTextStorage);
293 IMPORT_C void GetMessageDigestEntriesL(TRequestStatus& aStatus, TMsvId aMessageId);
294 IMPORT_C void GetCharacterSetL(TMsvId aMessageId, TUint& aCharacterSetId, TBool& aOverride);
295 IMPORT_C void SetCharacterSetL(TMsvId aMessageId, TUint aCharacterSetId);
296 IMPORT_C void StoreBodyTextWithMimeHeaderL(TMsvId aMessageId, CRichText& aRichText, const CImMimeHeader& aMimeHeader, TRequestStatus& aStatus);
298 TMsvId EmailEntryId();
303 CImEmailMessage(CMsvEntry& aEntry);
305 void DoComplete(TInt&);
308 void Start(TRequestStatus& aStatus);
312 void ChangeMessageContextL();
313 void CompareChildrenAndPopulateSelL();
314 void AttachmentInfoL();
315 void AssembleBodyTextL();
316 void CheckAndInitialiseL(TMsvId aMessageId);
318 void AppendAttachmentL();
319 TBool MessageDigestEntry();
320 TBool HandleDifferentFolderTypesL();
321 void GetTextForAlternateFolderL();
322 void GetTextForRelatedFolderL();
323 void GetAttachmentsForRelatedFolderL();
324 TBool GetBodyTextCharacterSetL();
325 TUint GetOverrideCharacterSetL();
326 TInt FindFilename(const CImMimeHeader& aMimeInfo, TPtrC8& aFilename);
327 void FindFilenameDecodeL(
328 const CImMimeHeader& aMimeInfo, TFileName& aFileName, TUint aCharset);
329 void AppendAttachmentNameL();
330 void SetBodyTextCharacterSetL(TMsvId aEntryId, TUint8 aNewCharacterSetId);
331 void FindFirstBodyTextPartL(TMsvId aEntryId, TBool& found);
333 CImMimeHeader* FindAttachmentMimeHeaderL();
334 TMsvEntry FindIdEntryL(TMsvId aMessageId);
336 void DoGetBodyTextEntryIdL(TMsvId aMessageId, TImEmailEntryType aEntryType);
339 enum TImEmailMessageStates
344 ETextEntryIdForThisMsg,
345 ETextEntryIdMsgDigest,
346 ETextForThisMsgGetCharacterSet,
347 EAttachmentsForThisMsg,
348 EAttachmentsForMsgDigest,
355 CMsvEntry& iClientEntry;
356 CMsvEntrySelection* iCompleteSel;
357 CMsvEntrySelection* iResultSel;
359 CRichText* iRichText;
360 CParaFormatLayer* iParaLayer;
361 CCharFormatLayer* iCharLayer;
362 TMsvId iParentMsgId; // the Id passed into Getxxx() function representing the 'parent' message ID
363 TImEmailMessageStates iState;
364 TImAttachmentType iAttachmentType;
365 TMsvEmailEntry iEntry;
366 CImMhtmlUriResolver* iUriResolver;
368 CImStoreMessagePart* iStoreMessagePart;
369 CImRemoveMessagePart* iRemoveMessagePart;
370 TPckgBuf<TMsvId> iProgress;
371 TImEmailEntryType iEntryType;
372 TBool iIsAMHTMLmessage;
373 TUint iCharacterSetId;
375 CDesCArray* iAttachmentNameList;
376 CImAttachmentManager* iAttachmentManager;
379 // This is the entry Id using which the CImEmailMessage was created.
380 // store this , so that when the message id to which attachment is
381 // retrieved then the CIMEmailMessage is reset with this Id.
382 TMsvId iEmailEntryId;
383 enum TImAttachmentStates
390 TInt iAttachmentState;
394 class CImEmailOperation : public CMsvOperation
395 /** Provides simple email messages creation functions, including creation of new
396 messages, replies, forwarded messages, and receipts.
398 Both plain-text and HTML messages, with or without attachments, can be created.
404 IMPORT_C static CImEmailOperation* CreateNewL(TRequestStatus& aObserverRequestStatus, CMsvSession& aMsvSession, TMsvId aDestination, TMsvPartList aPartList, const TMsvEmailTypeList& aMsvEmailTypeList, TUid aMsgType);
405 IMPORT_C static CImEmailOperation* CreateNewL(TRequestStatus& aObserverRequestStatus, CMsvSession& aMsvSession, TMsvId aDestination, TMsvId aSmtpServiceId, TMsvPartList aPartList, const TMsvEmailTypeList& aMsvEmailTypeList, TUid aMsgType, TInt aPriority = EPriorityStandard);
407 IMPORT_C static CImEmailOperation* CreateNewL(TRequestStatus& aObserverRequestStatus, CMsvSession& aMsvSession, TMsvId aDestination, TMsvId aSmtpServiceId, TMsvPartList aPartList, const TMsvEmailTypeList& aMsvEmailTypeList, TUid aMsgType, TInt aPriority , TBool aUsePlainTextStorage);
409 IMPORT_C static CImEmailOperation* CreateReplyL(TRequestStatus& aObserverRequestStatus, CMsvSession& aMsvSession, TMsvId aMessageId, TMsvId aDestination, TMsvPartList aPartList, const TDesC& aFormatString, const TMsvEmailTypeList& aMsvEmailTypeList, TUid aMsgType);
410 IMPORT_C static CImEmailOperation* CreateReplyL(TRequestStatus& aObserverRequestStatus, CMsvSession& aMsvSession, TMsvId aMessageId, TMsvId aDestination, TMsvPartList aPartList, const TMsvEmailTypeList& aMsvEmailTypeList, TUid aMsgType);
411 IMPORT_C static CImEmailOperation* CreateReplyL(TRequestStatus& aObserverRequestStatus, CMsvSession& aMsvSession, TMsvId aMessageId, TMsvId aDestination, TMsvPartList aPartList, const TMsvEmailTypeList& aMsvEmailTypeList, TUid aMsgType, TInt aPriority);
412 IMPORT_C static CImEmailOperation* CreateReplyL(TRequestStatus& aObserverRequestStatus, CMsvSession& aMsvSession, TMsvId aMessageId, TMsvId aDestination, TMsvPartList aPartList, const TMsvEmailTypeList& aMsvEmailTypeList, TUid aMsgType, TInt aPriority, TBool aUsePlainTextStorage);
413 IMPORT_C static CImEmailOperation* CreateForwardL(TRequestStatus& aObserverRequestStatus, CMsvSession& aMsvSession, TMsvId aMessageId, TMsvId aDestination, TMsvPartList aPartList, const TDesC& aFormatString, const TMsvEmailTypeList& aMsvEmailTypeList, TUid aMsgType);
414 IMPORT_C static CImEmailOperation* CreateForwardL(TRequestStatus& aObserverRequestStatus, CMsvSession& aMsvSession, TMsvId aMessageId, TMsvId aDestination, TMsvPartList aPartList, const TMsvEmailTypeList& aMsvEmailTypeList, TUid aMsgType);
415 IMPORT_C static CImEmailOperation* CreateForwardL(TRequestStatus& aObserverRequestStatus, CMsvSession& aMsvSession, TMsvId aMessageId, TMsvId aDestination, TMsvId aSmtpServiceId, TMsvPartList aPartList, const TMsvEmailTypeList& aMsvEmailTypeList, TUid aMsgType, TInt aPriority = EPriorityStandard);
416 IMPORT_C static CImEmailOperation* CreateForwardL(TRequestStatus& aObserverRequestStatus, CMsvSession& aMsvSession, TMsvId aMessageId, TMsvId aDestination, TMsvId aSmtpServiceId, TMsvPartList aPartList, const TMsvEmailTypeList& aMsvEmailTypeList, TUid aMsgType, TInt aPriority, TBool aUsePlainTextStorage);
417 IMPORT_C static CImEmailOperation* CreateForwardAsAttachmentL(TRequestStatus& aObserverRequestStatus, CMsvSession& aMsvSession, TMsvId aMessageId, TMsvId aDestination, TMsvPartList aPartList, const TMsvEmailTypeList& aMsvEmailTypeList, TUid aMsgType);
418 IMPORT_C static CImEmailOperation* CreateForwardAsAttachmentL(TRequestStatus& aObserverRequestStatus, CMsvSession& aMsvSession, TMsvId aMessageId, TMsvId aSmtpServiceId, TMsvId aDestination, TMsvPartList aPartList, const TMsvEmailTypeList& aMsvEmailTypeList, TUid aMsgType, TInt aPriority = EPriorityStandard);
419 IMPORT_C static CImEmailOperation* CreateReceiptL(TRequestStatus& aObserverRequestStatus, CMsvSession& aMsvSession, TMsvId aMessageId, TMsvId aDestination, TMsvPartList aPartList, const TDesC& aFormatString, const TMsvEmailTypeList& aMsvEmailTypeList, TUid aMsgType);
420 IMPORT_C static CImEmailOperation* CreateReceiptL(TRequestStatus& aObserverRequestStatus, CMsvSession& aMsvSession, TMsvId aMessageId, TMsvId aDestination, TMsvPartList aPartList, const TMsvEmailTypeList& aMsvEmailTypeList, TUid aMsgType);
421 IMPORT_C static CImEmailOperation* CreateReceiptL(TRequestStatus& aObserverRequestStatus, CMsvSession& aMsvSession, TMsvId aMessageId, TMsvId aDestination, TMsvPartList aPartList, const TMsvEmailTypeList& aMsvEmailTypeList, TUid aMsgType, TInt aPriority);
422 IMPORT_C static CImEmailOperation* CreateReceiptL(TRequestStatus& aObserverRequestStatus, CMsvSession& aMsvSession, TMsvId aMessageId, TMsvId aDestination, TMsvPartList aPartList, const TMsvEmailTypeList& aMsvEmailTypeList, TUid aMsgType, TInt aPriority, TBool aUsePlainTextStorage);
423 IMPORT_C ~CImEmailOperation();
424 IMPORT_C const TDesC8& FinalProgress();
427 const TDesC8& ProgressL();
429 static CImEmailOperation* CreateCopyL(TRequestStatus& aObserverRequestStatus, CMsvSession& aMsvSession, TMsvId aMessageId, TMsvId aDestination, TMsvPartList aPartList, const TMsvEmailTypeList& aMsvEmailTypeList, TUid aMsgType);
432 enum TImEmailOperation
438 EDeletingBadEmail = 4,
440 EAttachOriginal = 0x80,
441 EForwardAsAttachment = EForward | EAttachOriginal,
442 EReplyAsAttachment = EReply | EAttachOriginal
446 CImEmailOperation(TRequestStatus& aObserverRequestStatus, CMsvSession& aMsvSession, TMsvId aDestination, TMsvId aSmtpServiceId, TMsvPartList aPartList, const TMsvEmailTypeList& aMsvEmailTypeList, TUid aMsgType, TInt aPriority, TBool aUsePlainTextStorage);
447 void ConstructL(TMsvId aMessageId, const TDesC& aFormatString, TImEmailOperation aOperation);
448 void ConstructL(TMsvId aMessageId, TImEmailOperation aOperation);
449 void ConstructL(TImEmailOperation aOperation);
450 void OpenAndReadResourceFileL();
451 void SetSmtpServiceFromDefaultsL();
452 void SetSmtpServiceFromOriginalMessageL();
453 void ErrorRecovery(TInt error);
454 void SelectNextStateL();
455 void ProcessStateL();
456 void SelectAndProcessNextStateL();
457 void RequestComplete(TInt aError);
458 void CreateNewHeaderL();
460 TInt RemoveIncompleteAttachments();
461 void CreateEntryDetails(TMsvEmailEntry& aMsvEmailEntry);
462 void CreateNewMessageL(TMsvId aDestinationId);
463 void CreateMultipartMixedFolderEntryL();
464 void CreateTextEntryL(TMsvId aFolderId);
466 void StorePlainBodyL();
467 void CheckForSignatureOrVCardL();
468 void CreateAttachmentEntryL();
469 void StoreAttachmentL();
470 void CreateMultipartAlternativeFolderEntryL();
471 void AppendHtmlAttachmentL();
472 void AttachOriginalMessageToNewMessageL();
473 void CompleteEmailOperationL();
474 void CreateHTMLEntryL();
475 void PrepareToStoreHTMLEntryTextL();
476 void StoreHTMLEntryTextL();
477 void CreateVCardAttachmentL();
478 void AddVCardAttachmentL();
479 void AddMessageAsAttachmentL();
480 TPtrC GetDefaultAttachmentName();
481 void RestoreSmtpSettingsL();
483 TBool NeedMultipartMixedFolder() const;
484 void ReadDefaultHtmlAttachmentNameL(TDes& aFileName);
485 void CreateDefaultAttachmentL();
486 void AddMessageAttachmentInfoL(TMsvId aAttachmentMessageId);
488 void CreateAddressListStringL(HBufC*& aListBuffer, const CDesCArray& aAddressArray);
489 void RestoreOriginalHeaderL();
490 void SetBodyHeaderFormatL();
491 static void ClosePlainBodyTextArray(TAny* aPtr);
492 void StorePlainTextL();
493 TInt GetPlainBodyTextSizeL();
496 enum TImEmailOperationState
502 ECreateNewMessageEntry,
503 ECheckMultipartMixedFolderRequired,
504 ECreateMultipartMixedFolderEntry,
505 ECheckMultipartAlternativeFolderRequired,
506 ECreateMultipartAlternativeFolderEntry,
507 ECheckTextEntryRequired,
511 ECreateVCardAttachment,
513 ECheckHTMLEntryRequired,
515 EPrepareToStoreHTMLEntryText,
517 ECheckAttachOriginalMessageRequired,
518 EAttachOriginalMessage,
519 ECheckHTMLPageRequired,
521 ECopyHTMLPartToAttachment,
522 ECheckAttachmentsRequired,
523 ECreateAttachmentEntry,
525 ECheckEmbeddedMessagesRequired,
526 EAddEmbeddedMessagesAsAttachments,
527 ECompleteEmailOperation,
529 ,ECreateDefaultHtmlAttachment,
530 EStoreHTMLTextInEntry,
531 EAddMessageAttachmentInfo
534 // Flags specifying format of body header information to include
535 // in reply and forwarded email addresses
536 enum TImBodyHeaderFormat
544 CMsvEntry* iMsvEntry;
545 CMsvOperation* iMsvOperation;
547 CImHeader* iNewHeader;
548 CParaFormatLayer* iParaLayer;
549 CCharFormatLayer* iCharLayer;
550 CRichText* iRichText;
551 CImEmailMessage* iEmailMessage;
552 HBufC* iFormatString;
554 CImSmtpSettings* iSmtpSettings;
556 TImEmailOperation iOperation;
557 TMsvId iDestinationId;
558 TMsvId iMultipartMixedId;
559 TMsvId iMultipartAlternativeId;
560 TMsvId iOrigMessageId;
561 TMsvId iNewMessageId;
562 TMsvId iSmtpServiceId;
563 TMsvId iAttachedMessageId;
565 TMsvPartList iPartList;
566 TMsvEmailTypeList iMsvEmailTypeList;
567 TInt iAttachmentCount;
568 TInt iTotalAttachments;
569 TPckgBuf<TMsvId> iDataMember;
570 HBufC* iBodyHeaderFormatString;
571 HBufC* iBodyHeaderDateTimeFormatString;
572 HBufC* iBodyHeaderToString;
573 HBufC* iBodyHeaderCcString;
575 HBufC* iUserEmailAddress;
577 TInt iVCardAndHtmlSize;
578 TBool iOrigMessageHtml;
579 TBool iHtmlNoTextAlt;
580 TInt iEmbeddedMessagesToProcess;
581 TImMessageField iMessageField;
583 // for MIME messages:
584 TBool iCreateHtmlMessage;
585 TBool iMultipartMixedFolderCreated;
586 TBool iMultipartAlternativeFolderCreated;
591 // Used when converting rich text to html
592 CImHtmlConverter* iHtmlConverter;
593 TBool iFinishedConvertingHTML;
595 // Relating to adding Signature and/or Vcard to an email
596 TBool iNeedToAddVCardAttachment;
597 HBufC* iDefaultVCardNameFormatString;
598 TStreamId iVcardStoreId;
599 CStreamStore* iVcardStore;
600 CRichText* iSignatureText;
602 TImAttachmentFile iAttachmentFile;
605 TMsvId iPCMailServiceId;
606 RPointerArray<CMsvAttachment> iAttachmentInfoList;
607 // set this anytime during the object life cycle attachment manager was used
608 TBool iAttachmentMgrUsed;
612 TImBodyHeaderFormat iBodyHeaderFormat;
613 CImHeader* iOriginalHeader;
614 /** Indicates if the body text entry is plain text */
615 TBool iUsePlainTextStorage;
616 // The error value returned when CRichText is populated with message body text.
620 #endif // __MIUTMSG_H__