|
1 /* |
|
2 * Copyright (c) 2007-2009 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: Class encapsulating FS email sending |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_ESMRFSEMAILMANAGER_H |
|
20 #define C_ESMRFSEMAILMANAGER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 //<cmail> |
|
24 #include "CFSMailCommon.h" |
|
25 #include "mmrinfoprocessor.h" |
|
26 #include "esmrdef.h" |
|
27 //</cmail> |
|
28 |
|
29 class CFSMailBox; |
|
30 class CFSMailMessage; |
|
31 class CFSMailMessagePart; |
|
32 class CFSMailClient; |
|
33 class CMRMailboxUtils; |
|
34 class TESMRInputParams; |
|
35 class RFile; |
|
36 |
|
37 /** |
|
38 * Class definition for FS Email manager class. This class encapsulates |
|
39 * all mail sending acitivities with FS EMail framework. |
|
40 * |
|
41 * @lib esmrtasks.lib |
|
42 */ |
|
43 NONSHARABLE_CLASS( CESMRFSEMailManager ) : public CBase |
|
44 { |
|
45 public: |
|
46 /** Enumeration for text/calendar part */ |
|
47 enum TESMRMethod |
|
48 { |
|
49 EESMRMethodRequest, // Request |
|
50 EESMRMethodResponse, // response |
|
51 EESMRMethodCancel // cancellation |
|
52 }; |
|
53 |
|
54 public: // Construction and destruction |
|
55 /** |
|
56 * Creates and initializes new CESMRSendMRRespFSEmailTask object. |
|
57 * Ownership is transferred to caller. |
|
58 * @param aMRMailboxUtils Reference to mailbox utilities |
|
59 */ |
|
60 static CESMRFSEMailManager* NewL( |
|
61 CMRMailboxUtils& aMRMailboxUtils ); |
|
62 |
|
63 /** |
|
64 * C++ destructor. |
|
65 */ |
|
66 ~CESMRFSEMailManager(); |
|
67 |
|
68 /** |
|
69 * Prepares email manager to be used for sending meeting |
|
70 * request. |
|
71 * |
|
72 * @param aMailboxOwnerAddr mailbox owner's email address |
|
73 */ |
|
74 void PrepareForSendingL( |
|
75 const TDesC& aMailboxOwnerAddr ); |
|
76 |
|
77 /** |
|
78 * Prepares email manager to be used for sending reply |
|
79 * message. |
|
80 * |
|
81 * @param aMailboxOwnerAddr mailbox owner's email address |
|
82 * @param aMsgId original message's id |
|
83 * @param aReplyAll is this reply for all participants |
|
84 */ |
|
85 void PrepareForSendingReplyL( |
|
86 const TDesC& aMailboxOwnerAddr, |
|
87 const TFSMailMsgId& aMsgId, |
|
88 TBool aReplyAll ); |
|
89 |
|
90 /** |
|
91 * Sets sender to email message |
|
92 * @param aAddress Sender's email address |
|
93 * @param aCommonName Sender's common name |
|
94 */ |
|
95 void SetSenderL( |
|
96 const TDesC& aAddress, |
|
97 const TDesC& aCommonName ); |
|
98 |
|
99 /** |
|
100 * Sets reply to address to email message |
|
101 * @param aAddress Email address |
|
102 * @param aCommonName Common name |
|
103 */ |
|
104 void SetReplyToAddressL( |
|
105 const TDesC& aAddress, |
|
106 const TDesC& aCommonName ); |
|
107 |
|
108 /** |
|
109 * Sets recipient to <to> field |
|
110 * @param aAddress Recipient's email address |
|
111 * @param aCommonName Recipient's common name |
|
112 */ |
|
113 void AppendToRecipientL( |
|
114 const TDesC& aAddress, |
|
115 const TDesC& aCommonName ); |
|
116 |
|
117 /** |
|
118 * Sets recipient to <cc> field |
|
119 * @param aAddress Recipient's email address |
|
120 * @param aCommonName Recipient's common name |
|
121 */ |
|
122 void AppendCCRecipientL( |
|
123 const TDesC& aAddress, |
|
124 const TDesC& aCommonName ); |
|
125 |
|
126 /** |
|
127 * Sets subject to email message |
|
128 * @param aSubject Email message's subject. |
|
129 */ |
|
130 void SetSubjectL( |
|
131 const TDesC& aSubject); |
|
132 |
|
133 /** |
|
134 * Sets plain text part to email message. |
|
135 * @param aPlainText Plain text context |
|
136 */ |
|
137 void CreateTextPlainPartL( |
|
138 const TDesC& aPlainText); |
|
139 |
|
140 /** |
|
141 * Sets calendar part to email message. |
|
142 * @param aCalendarMethod Calendar entry method. |
|
143 */ |
|
144 void CreateTextCalendarPartL( |
|
145 TESMRMethod aCalendarMethod ); |
|
146 |
|
147 /** |
|
148 * Sets calendar part to email message. |
|
149 * @param aCalendarMethod Calendar entry method. |
|
150 * @param aFilename File containing calendar part |
|
151 */ |
|
152 void CreateTextCalendarPartL( |
|
153 TESMRMethod aCalendarMethod, |
|
154 const TDesC& aFilename ); |
|
155 |
|
156 /** |
|
157 * Adds attachment to email message. |
|
158 * @param aAttachmentFile attachment filename. |
|
159 */ |
|
160 void SetAttachmentL( |
|
161 const TDesC& aAttachmentFile ); |
|
162 |
|
163 /** |
|
164 * Adds attachment to email message. |
|
165 * @param aFile Reference to attachment file |
|
166 * @param aMimeType attachment mimetype |
|
167 */ |
|
168 void SetAttachmentL( |
|
169 RFile& aFile, |
|
170 const TDesC8& aMimeType ); |
|
171 |
|
172 /** |
|
173 * Stores message to drafts folder. |
|
174 */ |
|
175 TInt StoreMessageToDraftsFolderL(); |
|
176 |
|
177 /** |
|
178 * Sends message. |
|
179 */ |
|
180 TInt SendMessageL(); |
|
181 |
|
182 /** |
|
183 * Fetches mailbox id. |
|
184 * @return Mailbox id |
|
185 */ |
|
186 TFSMailMsgId MailboxId() const; |
|
187 |
|
188 /** |
|
189 * Send MRINFO object via mail framework |
|
190 * @param aParam Reference to ESMR input parameters |
|
191 * @param aInfoObject Reference to MRINFO object |
|
192 * @param aResponseMode Response mode definition. |
|
193 * @param aFreeResponseText Free response text |
|
194 */ |
|
195 void SendMailViaSyncL( |
|
196 TESMRInputParams& aParams, |
|
197 MMRInfoObject& aInfoObject, |
|
198 MMRInfoProcessor::TMRInfoResponseMode aResponseMode, |
|
199 const TDesC& aFreeResponseText ); |
|
200 |
|
201 /** |
|
202 * Fetches message id. |
|
203 * @return Message id |
|
204 */ |
|
205 TFSMailMsgId MessageId() const; |
|
206 |
|
207 /** |
|
208 * Fetches message folder id. |
|
209 * @return Message folder id |
|
210 */ |
|
211 TFSMailMsgId MessageFolderId() const; |
|
212 |
|
213 private: |
|
214 CESMRFSEMailManager( |
|
215 CMRMailboxUtils& aMRMailboxUtils ); |
|
216 |
|
217 void ConstructL(); |
|
218 |
|
219 CFSMailBox* SelectMailBoxL( |
|
220 const TDesC& aMailboxOwnerAddr ); |
|
221 |
|
222 CFSMailMessage* CreateMessageL(); |
|
223 |
|
224 |
|
225 |
|
226 CFSMailMessagePart* CreateParentPartL(); |
|
227 |
|
228 void AddPlainTextPartL( |
|
229 const TDesC& aContent ); |
|
230 |
|
231 void AddMessagePartFromFileL( |
|
232 const TDesC& aContentType, |
|
233 const TDesC& aContentClass, |
|
234 const TDesC& aContentDescription, |
|
235 const TDesC& aContentDisposition, |
|
236 const TDesC& aFileAndPath ); |
|
237 |
|
238 private: // Data |
|
239 /** |
|
240 * Reference to mailbox utilites |
|
241 * Not own. |
|
242 */ |
|
243 CMRMailboxUtils& iMRMailboxUtils; |
|
244 |
|
245 /** |
|
246 * FS EMail client |
|
247 * Own. |
|
248 */ |
|
249 CFSMailClient* iMailClient; |
|
250 |
|
251 /** |
|
252 * FS EMailBox |
|
253 * Own. |
|
254 */ |
|
255 CFSMailBox* iMailBox; |
|
256 |
|
257 /** |
|
258 * FS Mail message |
|
259 * Own. |
|
260 */ |
|
261 CFSMailMessage* iMessage; |
|
262 |
|
263 /** |
|
264 * Parent message part |
|
265 * Own. |
|
266 */ |
|
267 CFSMailMessagePart* iParentPart; |
|
268 }; |
|
269 |
|
270 #endif // C_ESMRFSEMAILMANAGER_H |