|
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 //<qmail> |
|
27 class NmMessage; |
|
28 //</qmail> |
|
29 |
|
30 /** |
|
31 * email data handling |
|
32 * |
|
33 * @lib FSFWCommonLib |
|
34 * @since S60 v3.1 |
|
35 */ |
|
36 NONSHARABLE_CLASS ( CFSMailMessage ) : public CFSMailMessagePart |
|
37 { |
|
38 public: |
|
39 |
|
40 /** |
|
41 * Two-phased constructor. |
|
42 * |
|
43 * @param aMessageId message id in plugin containing email |
|
44 */ |
|
45 IMPORT_C static CFSMailMessage* NewL( TFSMailMsgId aMessageId ); |
|
46 |
|
47 /** |
|
48 * Two-phased constructor. |
|
49 * |
|
50 * @param aMessageId message id in plugin containing email |
|
51 */ |
|
52 IMPORT_C static CFSMailMessage* NewLC( TFSMailMsgId aMessageId ); |
|
53 |
|
54 /** |
|
55 * Two-phased constructor. |
|
56 * |
|
57 * @param aMessageId message id in plugin containing email |
|
58 */ |
|
59 IMPORT_C static CFSMailMessage* NewL( const NmMessage &aMessage ); |
|
60 |
|
61 /** |
|
62 * saves this message |
|
63 */ |
|
64 IMPORT_C void SaveMessageL(); |
|
65 |
|
66 //<qmail> |
|
67 /** |
|
68 * saves this message asynchronously |
|
69 */ |
|
70 IMPORT_C TInt SaveMessageL(MFSMailRequestObserver& aOperationObserver); |
|
71 |
|
72 /** |
|
73 * saves message parts asynchronously |
|
74 */ |
|
75 IMPORT_C TInt SaveMessagePartsL( |
|
76 MFSMailRequestObserver& aOperationObserver); |
|
77 //</qmail> |
|
78 |
|
79 /** |
|
80 * destructor |
|
81 */ |
|
82 IMPORT_C ~CFSMailMessage(); |
|
83 |
|
84 /** |
|
85 * Adds new attachment to this email. |
|
86 * |
|
87 * @param aFilePath contains full path to new attachment file. |
|
88 * @param aInsertBefore specifies position where new attachment is created. |
|
89 * If NullId then new attachment is created as last. |
|
90 * |
|
91 * @return new email part object, ownership is transferred to user |
|
92 */ |
|
93 IMPORT_C CFSMailMessagePart* AddNewAttachmentL( const TDesC& aFilePath, |
|
94 const TFSMailMsgId aInsertBefore); |
|
95 |
|
96 // <qmail> |
|
97 /** |
|
98 * Adds new attachment to this email asynchronously |
|
99 */ |
|
100 IMPORT_C TInt AddNewAttachmentL( const TDesC& aFilePath, |
|
101 MFSMailRequestObserver& aOperationObserver); |
|
102 // </qmail> |
|
103 |
|
104 /** |
|
105 * Adds new attachment to this email. |
|
106 * |
|
107 * @param aFile contains access to new attachment file. |
|
108 * @param aMimeType user can give content type of the new part, |
|
109 * otherwise content type is tried to recognized by method |
|
110 * |
|
111 * @return new email part object, ownership is transferred to user |
|
112 */ |
|
113 IMPORT_C CFSMailMessagePart* AddNewAttachmentL( RFile& aFile, |
|
114 const TDesC8& aMimeType ); |
|
115 |
|
116 /** |
|
117 * Returns a flat list of message parts that can be handled as attachments. |
|
118 * Excludes message parts that are multipart and parts that are considered |
|
119 * plain text or html body. |
|
120 * |
|
121 * @param aParts contains flat list of attachments |
|
122 */ |
|
123 IMPORT_C void AttachmentListL(RPointerArray<CFSMailMessagePart>& aParts); |
|
124 |
|
125 //<qmail> |
|
126 /** |
|
127 * Returns plain text body part for this email or NULL if not found. |
|
128 * |
|
129 * @return plain text email body part, ownership is transferred to user |
|
130 */ |
|
131 IMPORT_C CFSMailMessagePart* PlainTextBodyPartL( |
|
132 TFSMailMessagePartDataSource aDataSource = |
|
133 EDataSourceMessageStore); |
|
134 |
|
135 /** |
|
136 * Returns html body part for this message or NULL if not found. |
|
137 * |
|
138 * @return html email body part, ownership is transferred to user |
|
139 */ |
|
140 IMPORT_C CFSMailMessagePart* HtmlBodyPartL( |
|
141 TFSMailMessagePartDataSource aDataSource = |
|
142 EDataSourceMessageStore); |
|
143 //</qmail> |
|
144 |
|
145 /** |
|
146 * Returns ETrue if this part is actually a message. |
|
147 * In that case it shoud safe to cast this part to CFSMailMessage |
|
148 * |
|
149 * @return true if this message part is a message |
|
150 */ |
|
151 IMPORT_C TBool IsMessageL() const; |
|
152 |
|
153 /** |
|
154 * Returns a flat list of message parts that can be handled as attachments. |
|
155 * Excludes message parts that are multipart and parts that are considered |
|
156 * plain text or html body. |
|
157 * |
|
158 * @param aParts contains flat list of attachments |
|
159 */ |
|
160 void DoAttachmentListL(RPointerArray<CFSMailMessagePart>& aParts); |
|
161 |
|
162 //<qmail> |
|
163 /** |
|
164 * gets the new NmMessage object |
|
165 * |
|
166 * @return NmMessage object based on iNmPrivateMessagePart and iNmPrivateMessageEnvelope |
|
167 */ |
|
168 IMPORT_C NmMessage* GetNmMessage(); |
|
169 //</qmail> |
|
170 |
|
171 protected: |
|
172 |
|
173 private: |
|
174 |
|
175 /** |
|
176 * C++ default constructor. |
|
177 */ |
|
178 CFSMailMessage(); |
|
179 |
|
180 /** |
|
181 * Two-phased constructor |
|
182 */ |
|
183 void ConstructL( TFSMailMsgId aMessageId ); |
|
184 |
|
185 /** |
|
186 * Two-phased constructor |
|
187 */ |
|
188 void ConstructL( const NmMessage &aMessage ); |
|
189 |
|
190 /** |
|
191 * Returns content-type parameters and their associated values. |
|
192 * This function is made private to prevent usage from CFSMailMessage |
|
193 * |
|
194 * @return content type parameters |
|
195 */ |
|
196 CDesCArray& ContentTypeParameters(); |
|
197 |
|
198 private: // data |
|
199 //<qmail> |
|
200 // Array is used to pass self pointer as RPointerArray reference to plugin funstion |
|
201 // Do not destroy its content (just Reset)! |
|
202 RPointerArray<CFSMailMessage> iMessageBufferForAsyncOp; |
|
203 //</qmail> |
|
204 }; |
|
205 |
|
206 |
|
207 #endif // __CFSMAILMESSAGE_H |