|
1 /* |
|
2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: common email object |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __CFSMAILMESSAGE_H |
|
19 #define __CFSMAILMESSAGE_H |
|
20 |
|
21 //<cmail> |
|
22 #include "cfsmailmessagepart.h" |
|
23 //</cmail> |
|
24 |
|
25 /** |
|
26 * email data handling |
|
27 * |
|
28 * @lib FSFWCommonLib |
|
29 * @since S60 v3.1 |
|
30 */ |
|
31 class CFSMailMessage : public CFSMailMessagePart |
|
32 { |
|
33 public: |
|
34 |
|
35 /** |
|
36 * Two-phased constructor. |
|
37 * |
|
38 * @param aMessageId message id in plugin containing email |
|
39 */ |
|
40 IMPORT_C static CFSMailMessage* NewL( TFSMailMsgId aMessageId ); |
|
41 |
|
42 /** |
|
43 * Two-phased constructor. |
|
44 * |
|
45 * @param aMessageId message id in plugin containing email |
|
46 */ |
|
47 IMPORT_C static CFSMailMessage* NewLC( TFSMailMsgId aMessageId ); |
|
48 |
|
49 /** |
|
50 * saves this message |
|
51 */ |
|
52 IMPORT_C void SaveMessageL(); |
|
53 |
|
54 /** |
|
55 * destructor |
|
56 */ |
|
57 IMPORT_C ~CFSMailMessage(); |
|
58 |
|
59 /** |
|
60 * Adds new attachment to this email. |
|
61 * |
|
62 * @param aFilePath contains full path to new attachment file. |
|
63 * @param aInsertBefore specifies position where new attachment is created. |
|
64 * If NullId then new attachment is created as last. |
|
65 * |
|
66 * @return new email part object, ownership is transferred to user |
|
67 */ |
|
68 IMPORT_C CFSMailMessagePart* AddNewAttachmentL( const TDesC& aFilePath, |
|
69 const TFSMailMsgId aInsertBefore); |
|
70 |
|
71 /** |
|
72 * Adds new attachment to this email. |
|
73 * |
|
74 * @param aFile contains access to new attachment file. |
|
75 * @param aMimeType user can give content type of the new part, |
|
76 * otherwise content type is tried to recognized by method |
|
77 * |
|
78 * @return new email part object, ownership is transferred to user |
|
79 */ |
|
80 IMPORT_C CFSMailMessagePart* AddNewAttachmentL( RFile& aFile, |
|
81 const TDesC8& aMimeType ); |
|
82 |
|
83 /** |
|
84 * Returns a flat list of message parts that can be handled as attachments. |
|
85 * Excludes message parts that are multipart and parts that are considered |
|
86 * plain text or html body. |
|
87 * |
|
88 * @param aParts contains flat list of attachments |
|
89 */ |
|
90 IMPORT_C void AttachmentListL(RPointerArray<CFSMailMessagePart>& aParts); |
|
91 |
|
92 /** |
|
93 * Returns plain text body part for this email or NULL if not found. |
|
94 * |
|
95 * @return plain text email body part, ownership is transferred to user |
|
96 */ |
|
97 IMPORT_C CFSMailMessagePart* PlainTextBodyPartL(); |
|
98 |
|
99 /** |
|
100 * Returns html body part for this message or NULL if not found. |
|
101 * |
|
102 * @return html email body part, ownership is transferred to user |
|
103 */ |
|
104 IMPORT_C CFSMailMessagePart* HtmlBodyPartL(); |
|
105 |
|
106 /** |
|
107 * Returns ETrue if this part is actually a message. |
|
108 * In that case it shoud safe to cast this part to CFSMailMessage |
|
109 * |
|
110 * @return true if this message part is a message |
|
111 */ |
|
112 IMPORT_C TBool IsMessageL() const; |
|
113 |
|
114 /** |
|
115 * Returns a flat list of message parts that can be handled as attachments. |
|
116 * Excludes message parts that are multipart and parts that are considered |
|
117 * plain text or html body. |
|
118 * |
|
119 * @param aParts contains flat list of attachments |
|
120 */ |
|
121 void DoAttachmentListL(RPointerArray<CFSMailMessagePart>& aParts); |
|
122 |
|
123 protected: |
|
124 |
|
125 private: |
|
126 |
|
127 /** |
|
128 * C++ default constructor. |
|
129 */ |
|
130 CFSMailMessage(); |
|
131 |
|
132 /** |
|
133 * Two-phased constructor |
|
134 */ |
|
135 void ConstructL( TFSMailMsgId aMessageId ); |
|
136 |
|
137 /** |
|
138 * Returns content-type parameters and their associated values. |
|
139 * This function is made private to prevent usage from CFSMailMessage |
|
140 * |
|
141 * @return content type parameters |
|
142 */ |
|
143 CDesCArray& ContentTypeParameters(); |
|
144 |
|
145 private: // data |
|
146 |
|
147 }; |
|
148 |
|
149 |
|
150 #endif // __CFSMAILMESSAGE_H |