56 |
55 |
57 _LIT8( KAttachmentSizeUnit, "kb"); |
56 _LIT8( KAttachmentSizeUnit, "kb"); |
58 _LIT8( KSpace8, " "); |
57 _LIT8( KSpace8, " "); |
59 |
58 |
60 _LIT8( KMetaHeader, "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n" ); |
59 _LIT8( KMetaHeader, "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n" ); |
61 const TInt KMaxEventLength = 256; |
60 const TInt KMaxEventLength( 256 ); |
62 |
61 const TInt KFreestyleMessageHeaderHTMLRightMarginInPx( 10 ); |
63 EXPORT_C CFreestyleMessageHeaderHTML* CFreestyleMessageHeaderHTML::NewL( CFSMailMessage& aMailMessage ) |
62 const TInt KFreestyleMessageHeaderHTMLMaxBufferSizeForWidth( 5 ); |
64 { |
63 |
65 CFreestyleMessageHeaderHTML* self = new (ELeave) CFreestyleMessageHeaderHTML( aMailMessage ); |
64 EXPORT_C CFreestyleMessageHeaderHTML* CFreestyleMessageHeaderHTML::NewL( CFSMailMessage& aMailMessage, TInt aVisibleWidth ) |
|
65 { |
|
66 CFreestyleMessageHeaderHTML* self = new (ELeave) CFreestyleMessageHeaderHTML( aMailMessage, aVisibleWidth ); |
66 self->ConstructL(); |
67 self->ConstructL(); |
67 return self; |
68 return self; |
68 } |
69 } |
69 |
70 |
70 EXPORT_C void CFreestyleMessageHeaderHTML::ExportL( CFSMailMessage& aMailMessage, RWriteStream& aWriteStream ) |
71 EXPORT_C void CFreestyleMessageHeaderHTML::ExportL( CFSMailMessage& aMailMessage, RWriteStream& aWriteStream, TInt aVisibleWidth ) |
71 { |
72 { |
72 CFreestyleMessageHeaderHTML* headerHtml = CFreestyleMessageHeaderHTML::NewL( aMailMessage ); |
73 CFreestyleMessageHeaderHTML* headerHtml = CFreestyleMessageHeaderHTML::NewL( aMailMessage, aVisibleWidth ); |
73 CleanupStack::PushL( headerHtml ); |
74 CleanupStack::PushL( headerHtml ); |
74 headerHtml->ExportL( aWriteStream ); |
75 headerHtml->ExportL( aWriteStream ); |
75 CleanupStack::PopAndDestroy( headerHtml ); |
76 CleanupStack::PopAndDestroy( headerHtml ); |
76 } |
77 } |
77 |
78 |
78 EXPORT_C void CFreestyleMessageHeaderHTML::ExportL( CFSMailMessage& aMailMessage, RFile& aFile ) |
79 EXPORT_C void CFreestyleMessageHeaderHTML::ExportL( CFSMailMessage& aMailMessage, RFile& aFile, TInt aVisibleWidth ) |
79 { |
80 { |
80 CFreestyleMessageHeaderHTML* headerHtml = CFreestyleMessageHeaderHTML::NewL( aMailMessage ); |
81 CFreestyleMessageHeaderHTML* headerHtml = CFreestyleMessageHeaderHTML::NewL( aMailMessage, aVisibleWidth ); |
81 CleanupStack::PushL( headerHtml ); |
82 CleanupStack::PushL( headerHtml ); |
82 headerHtml->ExportL( aFile ); |
83 headerHtml->ExportL( aFile ); |
83 CleanupStack::PopAndDestroy( headerHtml ); |
84 CleanupStack::PopAndDestroy( headerHtml ); |
84 } |
85 } |
85 |
86 |
86 EXPORT_C void CFreestyleMessageHeaderHTML::ExportL( CFSMailMessage& aMailMessage, RFs& aFs, const TPath& aFilePath) |
87 EXPORT_C void CFreestyleMessageHeaderHTML::ExportL( CFSMailMessage& aMailMessage, RFs& aFs, const TPath& aFilePath, TInt aVisibleWidth ) |
87 { |
88 { |
88 CFreestyleMessageHeaderHTML* headerHtml = CFreestyleMessageHeaderHTML::NewL( aMailMessage ); |
89 CFreestyleMessageHeaderHTML* headerHtml = CFreestyleMessageHeaderHTML::NewL( aMailMessage, aVisibleWidth ); |
89 CleanupStack::PushL( headerHtml ); |
90 CleanupStack::PushL( headerHtml ); |
90 headerHtml->ExportL( aFs, aFilePath ); |
91 headerHtml->ExportL( aFs, aFilePath ); |
91 CleanupStack::PopAndDestroy( headerHtml ); |
92 CleanupStack::PopAndDestroy( headerHtml ); |
92 } |
93 } |
93 |
94 |
182 StartHeaderTableL( aWriteStream, KHeaderTableName ); |
184 StartHeaderTableL( aWriteStream, KHeaderTableName ); |
183 ExportFromL( aWriteStream ); |
185 ExportFromL( aWriteStream ); |
184 ExportToL( aWriteStream ); |
186 ExportToL( aWriteStream ); |
185 ExportCcL( aWriteStream ); |
187 ExportCcL( aWriteStream ); |
186 ExportBccL( aWriteStream ); |
188 ExportBccL( aWriteStream ); |
187 ExportAttachmentsL( aWriteStream ); |
|
188 ExportSentTimeL( aWriteStream ); |
189 ExportSentTimeL( aWriteStream ); |
189 ExportSubjectL( aWriteStream ); |
190 ExportSubjectL( aWriteStream ); |
190 EndHeaderTableL( aWriteStream ); |
191 EndHeaderTableL( aWriteStream ); |
|
192 ExportAttachmentsL( aWriteStream ); |
191 HTMLBodyEndL( aWriteStream ); |
193 HTMLBodyEndL( aWriteStream ); |
192 } |
194 } |
193 |
195 |
194 void CFreestyleMessageHeaderHTML::HTMLBodyStartL( RWriteStream& aWriteStream ) const |
196 void CFreestyleMessageHeaderHTML::HTMLBodyStartL( RWriteStream& aWriteStream ) const |
195 { |
197 { |
196 aWriteStream.WriteL(_L8("<body>\n")); |
198 aWriteStream.WriteL(_L8("<body>\n")); |
197 aWriteStream.CommitL(); |
199 aWriteStream.CommitL(); |
198 } |
200 } |
199 void CFreestyleMessageHeaderHTML::ExportInitialTableL( RWriteStream& aWriteStream ) const |
201 void CFreestyleMessageHeaderHTML::ExportInitialTableL( RWriteStream& aWriteStream ) const |
200 { |
202 { |
201 aWriteStream.WriteL(_L8("<table id=\"table_initial\" border=\"0\" width=\"50%\">\n")); |
203 |
|
204 // set the width, using the visible screen width |
|
205 TBuf8<KFreestyleMessageHeaderHTMLMaxBufferSizeForWidth> tableWidth; |
|
206 tableWidth.AppendNum( iVisibleWidth ); |
|
207 aWriteStream.WriteL(_L8("<table id=\"table_initial\" border=\"0\" width=\"")); |
|
208 aWriteStream.WriteL( tableWidth ); |
|
209 aWriteStream.WriteL( _L8("px\">\n")); |
|
210 |
|
211 |
|
212 // start first row: table with the sent info and the '+' icon |
|
213 aWriteStream.WriteL(_L8("<tr><td><table id=\"table_sent_and_plus\" border=\"0\" width=\"")); |
|
214 aWriteStream.WriteL( tableWidth ); |
|
215 aWriteStream.WriteL( _L8("px\">\n")); |
|
216 |
202 aWriteStream.WriteL(_L8("<tr>\n")); |
217 aWriteStream.WriteL(_L8("<tr>\n")); |
203 |
218 |
204 // Add "show details" image |
219 // add Sent time and date |
205 aWriteStream.WriteL(_L8("<td width=\"1\" valign=middle><image id=\"detail_img\" border=\"0\" src=\"plus.gif\" onClick=\"expandHeader()\" ></td>\n")); |
220 aWriteStream.WriteL(_L8("<td id=\"sent_initial\" align=\"left\" valign=\"bottom\">")); |
206 |
|
207 //Sent time |
|
208 aWriteStream.WriteL(_L8("<td id=\"sent_initial\" valign=bottom>")); |
|
209 |
221 |
210 HBufC* dateText = TFsEmailUiUtility::DateTextFromMsgLC( &iMailMessage ); |
222 HBufC* dateText = TFsEmailUiUtility::DateTextFromMsgLC( &iMailMessage ); |
211 HBufC* timeText = TFsEmailUiUtility::TimeTextFromMsgLC( &iMailMessage ); |
223 HBufC* timeText = TFsEmailUiUtility::TimeTextFromMsgLC( &iMailMessage ); |
212 |
224 |
213 TInt len = dateText->Length() + KSentLineDateAndTimeSeparatorText().Length() + timeText->Length(); |
225 TInt len = dateText->Length() + KSentLineDateAndTimeSeparatorText().Length() + timeText->Length(); |
221 aWriteStream.WriteL( *sentTimeText8 ); |
233 aWriteStream.WriteL( *sentTimeText8 ); |
222 CleanupStack::PopAndDestroy( sentTimeText8 ); |
234 CleanupStack::PopAndDestroy( sentTimeText8 ); |
223 CleanupStack::PopAndDestroy( sentTimeText ); |
235 CleanupStack::PopAndDestroy( sentTimeText ); |
224 CleanupStack::PopAndDestroy( timeText ); |
236 CleanupStack::PopAndDestroy( timeText ); |
225 CleanupStack::PopAndDestroy( dateText ); |
237 CleanupStack::PopAndDestroy( dateText ); |
226 |
238 |
227 aWriteStream.WriteL(_L8("</td>\n</tr>\n")); |
239 aWriteStream.WriteL(_L8("</td>\n")); |
228 aWriteStream.WriteL(_L8("<tr id=\"subject_initial\">\n")); |
240 |
229 |
241 // add "show details" image on the same line as Sent time and date |
230 if ( iAttachments.Count() > 0 ) |
242 aWriteStream.WriteL(_L8("<td width=\"1\" valign=\"top\" align=\"right\" style=\"padding: 0px 10px 0px 0px;\"><image id=\"detail_img\" border=\"0\" src=\"plus.gif\" onClick=\"expandHeader()\" ></td>\n")); |
231 { |
243 |
232 aWriteStream.WriteL(_L8("<td width=\"1\" align=left><image src=\"")); |
244 // finish first row |
233 aWriteStream.WriteL(KAttachementIconGeneral); |
245 aWriteStream.WriteL(_L8("</tr>\n")); |
234 aWriteStream.WriteL(_L8("\" ></td>\n")); |
246 aWriteStream.WriteL(_L8("</table></td></tr>\n")); |
235 } |
247 |
236 else |
248 //============================= |
237 { |
249 // start second row which contains subject |
238 aWriteStream.WriteL(_L8("<td></td>\n")); |
250 aWriteStream.WriteL(_L8("<tr>\n")); |
239 } |
251 aWriteStream.WriteL(_L8("<td id=\"subject_initial\" align=\"left\"><b>")); |
240 aWriteStream.WriteL(_L8("<td valign=middle><b>")); |
252 |
241 //Subject |
|
242 HBufC8* subject8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( iMailMessage.GetSubject() ); |
253 HBufC8* subject8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( iMailMessage.GetSubject() ); |
243 CleanupStack::PushL( subject8 ); |
254 CleanupStack::PushL( subject8 ); |
244 aWriteStream.WriteL( *subject8 ); |
255 aWriteStream.WriteL( *subject8 ); |
245 CleanupStack::PopAndDestroy( subject8 ); |
256 CleanupStack::PopAndDestroy( subject8 ); |
246 |
257 |
247 aWriteStream.WriteL(_L8("</b></td>\n</tr>\n</table>\n")); |
258 aWriteStream.WriteL(_L8("</b></td>\n")); |
248 |
259 aWriteStream.WriteL(_L8("</tr>\n")); // finish subject row |
|
260 |
|
261 // end table_initial |
|
262 aWriteStream.WriteL(_L8("</table>\n")); |
|
263 |
249 aWriteStream.CommitL(); |
264 aWriteStream.CommitL(); |
250 } |
265 } |
251 void CFreestyleMessageHeaderHTML::HTMLBodyEndL( RWriteStream& aWriteStream ) const |
266 void CFreestyleMessageHeaderHTML::HTMLBodyEndL( RWriteStream& aWriteStream ) const |
252 { |
267 { |
253 aWriteStream.WriteL(_L8("</body>\n")); |
268 aWriteStream.WriteL(_L8("</body>\n")); |
256 |
271 |
257 void CFreestyleMessageHeaderHTML::ExportSubjectL( RWriteStream& aWriteStream ) const |
272 void CFreestyleMessageHeaderHTML::ExportSubjectL( RWriteStream& aWriteStream ) const |
258 { |
273 { |
259 aWriteStream.WriteL( _L8("<tr id=\"") ); |
274 aWriteStream.WriteL( _L8("<tr id=\"") ); |
260 aWriteStream.WriteL( KSubjectFieldName ); |
275 aWriteStream.WriteL( KSubjectFieldName ); |
261 aWriteStream.WriteL( _L8("\">\n") ); |
276 aWriteStream.WriteL( _L8("\">") ); |
262 |
277 |
263 |
278 |
264 aWriteStream.WriteL( _L8("<td width=\"1\">") ); |
279 aWriteStream.WriteL( _L8("<td width=\"1\">") ); |
265 aWriteStream.WriteL( _L8("<b>") ); |
280 aWriteStream.WriteL( _L8("<b>") ); |
266 HBufC8* subjectHeadingText = HeadingTextLC( R_FREESTYLE_EMAIL_UI_VIEWER_SUBJECT ); |
281 HBufC8* subjectHeadingText = HeadingTextLC( R_FREESTYLE_EMAIL_UI_VIEWER_SUBJECT ); |
267 aWriteStream.WriteL( *subjectHeadingText ); |
282 aWriteStream.WriteL( *subjectHeadingText ); |
268 CleanupStack::PopAndDestroy( subjectHeadingText ); |
283 CleanupStack::PopAndDestroy( subjectHeadingText ); |
269 aWriteStream.WriteL( _L8("</b>") ); |
284 aWriteStream.WriteL( _L8("</b>") ); |
270 aWriteStream.WriteL( _L8("</td>\n") ); |
285 aWriteStream.WriteL( _L8("</td>") ); |
271 aWriteStream.WriteL( _L8("</tr>\n") ); |
286 aWriteStream.WriteL( _L8("</tr>\n") ); |
272 aWriteStream.WriteL( _L8("<tr>\n") ); |
287 |
|
288 // subject text |
|
289 aWriteStream.WriteL( _L8("<tr>") ); |
273 aWriteStream.WriteL( _L8("<td>") ); |
290 aWriteStream.WriteL( _L8("<td>") ); |
274 |
291 |
275 HBufC8* subject8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( iMailMessage.GetSubject() ); |
292 HBufC8* subject8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( iMailMessage.GetSubject() ); |
276 CleanupStack::PushL( subject8 ); |
293 CleanupStack::PushL( subject8 ); |
277 aWriteStream.WriteL( *subject8 ); |
294 aWriteStream.WriteL( *subject8 ); |
278 CleanupStack::PopAndDestroy( subject8 ); |
295 CleanupStack::PopAndDestroy( subject8 ); |
279 |
296 |
280 aWriteStream.WriteL( _L8("</td>\n") ); |
297 aWriteStream.WriteL( _L8("</td>") ); |
281 |
|
282 aWriteStream.WriteL( _L8("</tr>\n") ); |
298 aWriteStream.WriteL( _L8("</tr>\n") ); |
283 |
299 |
284 aWriteStream.CommitL(); |
300 aWriteStream.CommitL(); |
285 } |
301 } |
286 |
302 |
291 CFSMailAddress* from = iMailMessage.GetSender(); // ownership not transferred |
307 CFSMailAddress* from = iMailMessage.GetSender(); // ownership not transferred |
292 if ( from ) |
308 if ( from ) |
293 { |
309 { |
294 froms.AppendL( from ); |
310 froms.AppendL( from ); |
295 } |
311 } |
296 ExportEmailAddressesL(aWriteStream, FreestyleMessageHeaderURLFactory::EEmailAddressTypeFrom, froms ); |
312 ExportEmailAddressesL( aWriteStream, FreestyleMessageHeaderURLFactory::EEmailAddressTypeFrom, froms, |
|
313 KFromFieldName, KFromTableName, R_FREESTYLE_EMAIL_UI_VIEWER_FROM ); |
297 CleanupStack::PopAndDestroy( &froms ); |
314 CleanupStack::PopAndDestroy( &froms ); |
298 } |
315 } |
299 |
316 |
300 void CFreestyleMessageHeaderHTML::ExportToL( RWriteStream& aWriteStream ) const |
317 void CFreestyleMessageHeaderHTML::ExportToL( RWriteStream& aWriteStream ) const |
301 { |
318 { |
302 RPointerArray<CFSMailAddress>& recipients = iMailMessage.GetToRecipients(); |
319 RPointerArray<CFSMailAddress>& recipients = iMailMessage.GetToRecipients(); |
303 ExportEmailAddressesL( aWriteStream, FreestyleMessageHeaderURLFactory::EEmailAddressTypeTo, recipients ); |
320 ExportEmailAddressesL( aWriteStream, FreestyleMessageHeaderURLFactory::EEmailAddressTypeTo, recipients, |
|
321 KToFieldName, KToTableName, R_FREESTYLE_EMAIL_UI_VIEWER_TO ); |
304 } |
322 } |
305 |
323 |
306 void CFreestyleMessageHeaderHTML::ExportCcL( RWriteStream& aWriteStream ) const |
324 void CFreestyleMessageHeaderHTML::ExportCcL( RWriteStream& aWriteStream ) const |
307 { |
325 { |
308 RPointerArray<CFSMailAddress>& recipients = iMailMessage.GetCCRecipients(); |
326 RPointerArray<CFSMailAddress>& recipients = iMailMessage.GetCCRecipients(); |
309 ExportEmailAddressesL( aWriteStream, FreestyleMessageHeaderURLFactory::EEmailAddressTypeCc, recipients ); |
327 ExportEmailAddressesL( aWriteStream, FreestyleMessageHeaderURLFactory::EEmailAddressTypeCc, recipients, |
|
328 KCcFieldName, KCcTableName, R_FREESTYLE_EMAIL_UI_VIEWER_CC ); |
310 } |
329 } |
311 |
330 |
312 void CFreestyleMessageHeaderHTML::ExportBccL( RWriteStream& aWriteStream ) const |
331 void CFreestyleMessageHeaderHTML::ExportBccL( RWriteStream& aWriteStream ) const |
313 { |
332 { |
314 RPointerArray<CFSMailAddress>& recipients = iMailMessage.GetBCCRecipients(); |
333 RPointerArray<CFSMailAddress>& recipients = iMailMessage.GetBCCRecipients(); |
315 ExportEmailAddressesL( aWriteStream, FreestyleMessageHeaderURLFactory::EEmailAddressTypeBcc, recipients ); |
334 ExportEmailAddressesL( aWriteStream, FreestyleMessageHeaderURLFactory::EEmailAddressTypeBcc, recipients, |
|
335 KBccFieldName, KBccTableName, R_FREESTYLE_EMAIL_UI_VIEWER_BCC ); |
316 } |
336 } |
317 |
337 |
318 void CFreestyleMessageHeaderHTML::ExportSentTimeL( RWriteStream& aWriteStream ) const |
338 void CFreestyleMessageHeaderHTML::ExportSentTimeL( RWriteStream& aWriteStream ) const |
319 { |
339 { |
320 |
340 |
321 aWriteStream.WriteL( _L8("<tr id=\"") ); |
341 aWriteStream.WriteL( _L8("<tr id=\"") ); |
322 aWriteStream.WriteL( KSentFieldName ); |
342 aWriteStream.WriteL( KSentFieldName ); |
323 aWriteStream.WriteL( _L8("\">\n") ); |
343 aWriteStream.WriteL( _L8("\">") ); |
324 |
344 |
325 |
345 |
326 aWriteStream.WriteL( _L8("<td width=\"1\">") ); |
346 aWriteStream.WriteL( _L8("<td width=\"1\">") ); |
327 aWriteStream.WriteL( _L8("<b>") ); |
347 aWriteStream.WriteL( _L8("<b>") ); |
328 HBufC8* sentHeadingText = HeadingTextLC( R_FREESTYLE_EMAIL_UI_VIEWER_SENT ); |
348 HBufC8* sentHeadingText = HeadingTextLC( R_FREESTYLE_EMAIL_UI_VIEWER_SENT ); |
329 aWriteStream.WriteL( *sentHeadingText ); |
349 aWriteStream.WriteL( *sentHeadingText ); |
330 CleanupStack::PopAndDestroy( sentHeadingText ); |
350 CleanupStack::PopAndDestroy( sentHeadingText ); |
331 aWriteStream.WriteL( _L8("</b>") ); |
351 aWriteStream.WriteL( _L8("</b>") ); |
332 aWriteStream.WriteL( _L8("</td>\n") ); |
352 aWriteStream.WriteL( _L8("</td>") ); |
333 aWriteStream.WriteL( _L8("</tr>\n") ); |
353 aWriteStream.WriteL( _L8("</tr>\n") ); |
334 |
354 |
335 aWriteStream.WriteL( _L8("<tr>\n") ); |
355 aWriteStream.WriteL( _L8("<tr>") ); |
336 aWriteStream.WriteL( _L8("<td>") ); |
356 aWriteStream.WriteL( _L8("<td>") ); |
337 |
357 |
338 HBufC* dateText = TFsEmailUiUtility::DateTextFromMsgLC( &iMailMessage ); |
358 HBufC* dateText = TFsEmailUiUtility::DateTextFromMsgLC( &iMailMessage ); |
339 HBufC* timeText = TFsEmailUiUtility::TimeTextFromMsgLC( &iMailMessage ); |
359 HBufC* timeText = TFsEmailUiUtility::TimeTextFromMsgLC( &iMailMessage ); |
340 |
360 |
350 CleanupStack::PopAndDestroy( sentTimeText8 ); |
370 CleanupStack::PopAndDestroy( sentTimeText8 ); |
351 CleanupStack::PopAndDestroy( sentTimeText ); |
371 CleanupStack::PopAndDestroy( sentTimeText ); |
352 CleanupStack::PopAndDestroy( timeText ); |
372 CleanupStack::PopAndDestroy( timeText ); |
353 CleanupStack::PopAndDestroy( dateText ); |
373 CleanupStack::PopAndDestroy( dateText ); |
354 |
374 |
355 aWriteStream.WriteL( _L8("</td>\n") ); |
375 aWriteStream.WriteL( _L8("</td>") ); |
356 |
376 |
357 aWriteStream.WriteL( _L8("</tr>\n") ); |
377 aWriteStream.WriteL( _L8("</tr>\n") ); |
358 |
378 |
359 aWriteStream.CommitL(); |
379 aWriteStream.CommitL(); |
360 } |
380 } |
361 |
381 |
362 void CFreestyleMessageHeaderHTML::ExportAttachmentsL( RWriteStream& aWriteStream ) const |
382 void CFreestyleMessageHeaderHTML::ExportAttachmentsL( RWriteStream& aWriteStream ) const |
363 { |
383 { |
364 if ( iAttachments.Count() > 0 ) |
384 |
365 { |
385 TInt attachmentsCount( iAttachments.Count() ); |
366 aWriteStream.WriteL( _L8("<tr id=\"") ); |
386 if ( attachmentsCount ) |
367 aWriteStream.WriteL( KAttachmentFieldName ); |
387 { |
368 aWriteStream.WriteL( _L8("\">\n") ); |
388 // The attachments table consists of one row that contains 2 cells |
369 |
389 // first cell contains the attachment icon |
370 aWriteStream.WriteL( _L8("<td width=\"1\">") ); |
390 // second cell contains a table which contains the attachments list |
371 aWriteStream.WriteL( _L8("<b>") ); |
391 |
372 |
392 // start attachments table |
373 HBufC8* attachmentHeadingText = HeadingTextLC( R_FREESTYLE_EMAIL_UI_VIEWER_ATTACHMENT, iAttachments.Count()); |
393 aWriteStream.WriteL( _L8("<table id=\"") ); |
374 aWriteStream.WriteL( *attachmentHeadingText ); |
394 aWriteStream.WriteL( KAttachmentTableName ); |
375 CleanupStack::PopAndDestroy( attachmentHeadingText ); |
395 aWriteStream.WriteL( _L8("\" border=\"0\" width=\"100%\">\n") ); // width is set at 100% intentionally |
376 |
396 |
377 |
397 // start row |
378 aWriteStream.WriteL( _L8(":</b>") ); |
398 aWriteStream.WriteL( _L8("<tr>\n") ); |
379 aWriteStream.WriteL( _L8("</td>\n") ); |
399 |
380 aWriteStream.WriteL( _L8("</tr>\n") ); |
400 // add attachment icon |
381 |
401 aWriteStream.WriteL( _L8("<td width=\"1\" valign=\"top\" align=\"right\"><image src=\"") ); |
382 |
402 aWriteStream.WriteL( KAttachementIconGeneral ); |
|
403 aWriteStream.WriteL( _L8("\" ></td>\n") ); |
|
404 |
|
405 // start table of attachments as a table within a cell |
383 aWriteStream.WriteL( _L8("<td>\n") ); |
406 aWriteStream.WriteL( _L8("<td>\n") ); |
384 StartTableL( aWriteStream, KAttachmentTableName ); |
407 aWriteStream.WriteL(_L8("<table id=\"table_attachments_list\" border=\"0\" width=\"100%\">\n")); |
385 for (TInt i=0; i<iAttachments.Count(); i++) |
408 for (TInt i=0; i < attachmentsCount; i++) |
386 { |
409 { |
387 AddAttachmentL( aWriteStream, *iAttachments[i] ); |
410 AddAttachmentL( aWriteStream, *iAttachments[i] ); |
388 } |
411 } |
389 EndTableL( aWriteStream ); |
412 |
|
413 aWriteStream.WriteL(_L8("</table>\n")); // end table_attachments_list |
390 aWriteStream.WriteL( _L8("</td>\n") ); |
414 aWriteStream.WriteL( _L8("</td>\n") ); |
391 |
415 |
392 aWriteStream.WriteL( _L8("</tr>\n") ); |
416 aWriteStream.WriteL( _L8("</tr>\n") ); |
393 } |
417 aWriteStream.WriteL(_L8("</table>\n")); // end attachments table |
394 } |
418 } |
395 |
419 } |
396 void CFreestyleMessageHeaderHTML::ExportEmailAddressesL( RWriteStream& aWriteStream, |
420 |
397 FreestyleMessageHeaderURLFactory::TEmailAddressType aEmailAddressType, |
421 void CFreestyleMessageHeaderHTML::ExportEmailAddressesL( RWriteStream& aWriteStream, |
398 const RPointerArray<CFSMailAddress>& aEmailAddresses ) const |
422 FreestyleMessageHeaderURLFactory::TEmailAddressType aEmailAddressType, |
399 { |
423 const RPointerArray<CFSMailAddress>& aEmailAddresses, |
400 if (aEmailAddresses.Count() == 0) |
424 const TDesC8& aRowId, |
401 { |
425 const TDesC8& /*aTableId*/, |
402 return; |
426 TInt aHeaderTextResourceId ) const |
403 } |
427 { |
404 |
428 if ( aEmailAddresses.Count() ) |
405 aWriteStream.WriteL( _L8("<tr id=\"") ); |
429 { |
406 switch ( aEmailAddressType ) |
430 // begin table row |
407 { |
431 aWriteStream.WriteL( _L8("<tr id=\"")); |
408 case FreestyleMessageHeaderURLFactory::EEmailAddressTypeFrom: |
432 aWriteStream.WriteL( aRowId ); |
409 aWriteStream.WriteL( KFromFieldName ); |
433 aWriteStream.WriteL( _L8("\">") ); |
410 break; |
434 |
411 |
435 // heading text |
412 case FreestyleMessageHeaderURLFactory::EEmailAddressTypeTo: |
436 aWriteStream.WriteL( _L8("<td><b>")); |
413 aWriteStream.WriteL( KToFieldName ); |
437 HBufC8* headingText = HeadingTextLC( aHeaderTextResourceId ); |
414 break; |
438 aWriteStream.WriteL( *headingText ); |
415 |
439 CleanupStack::PopAndDestroy( headingText ); |
416 case FreestyleMessageHeaderURLFactory::EEmailAddressTypeCc: |
440 aWriteStream.WriteL( _L8("</b></td>")); |
417 aWriteStream.WriteL( KCcFieldName ); |
441 |
418 break; |
442 aWriteStream.WriteL( _L8("</tr>\n") ); // end table row |
419 |
443 |
420 case FreestyleMessageHeaderURLFactory::EEmailAddressTypeBcc: |
444 // add addresses, one address per row |
421 aWriteStream.WriteL( KBccFieldName ); |
445 TInt count( aEmailAddresses.Count() ); |
422 break; |
446 for (TInt i = 0; i < count; ++i ) |
423 |
|
424 default: |
|
425 User::Leave( KErrNotSupported ); |
|
426 } |
|
427 aWriteStream.WriteL( _L8("\">\n") ); |
|
428 |
|
429 |
|
430 aWriteStream.WriteL( _L8("<td width=\"1\">") ); |
|
431 aWriteStream.WriteL( _L8("<b>") ); |
|
432 |
|
433 switch ( aEmailAddressType ) |
|
434 { |
|
435 case FreestyleMessageHeaderURLFactory::EEmailAddressTypeFrom: |
|
436 { |
447 { |
437 HBufC8* fromHeadingText = HeadingTextLC( R_FREESTYLE_EMAIL_UI_VIEWER_FROM ); |
448 aWriteStream.WriteL( _L8("<tr><td style=\"padding: 0px 0px 7px 0px;\">") ); |
438 aWriteStream.WriteL( *fromHeadingText ); |
449 AddEmailAddressL (aWriteStream, aEmailAddressType, *aEmailAddresses[i] ); |
439 CleanupStack::PopAndDestroy( fromHeadingText ); |
450 aWriteStream.WriteL( _L8("</td></tr>\n") ); |
440 } |
451 } |
441 break; |
452 |
442 |
453 aWriteStream.CommitL(); |
443 case FreestyleMessageHeaderURLFactory::EEmailAddressTypeTo: |
454 } |
444 { |
|
445 HBufC8* toHeadingText = HeadingTextLC( R_FREESTYLE_EMAIL_UI_VIEWER_TO ); |
|
446 aWriteStream.WriteL( *toHeadingText ); |
|
447 CleanupStack::PopAndDestroy( toHeadingText ); |
|
448 } |
|
449 break; |
|
450 |
|
451 case FreestyleMessageHeaderURLFactory::EEmailAddressTypeCc: |
|
452 { |
|
453 HBufC8* ccHeadingText = HeadingTextLC( R_FREESTYLE_EMAIL_UI_VIEWER_CC ); |
|
454 aWriteStream.WriteL( *ccHeadingText ); |
|
455 CleanupStack::PopAndDestroy( ccHeadingText ); |
|
456 } |
|
457 break; |
|
458 |
|
459 case FreestyleMessageHeaderURLFactory::EEmailAddressTypeBcc: |
|
460 { |
|
461 HBufC8* bccHeadingText = HeadingTextLC( R_FREESTYLE_EMAIL_UI_VIEWER_BCC ); |
|
462 aWriteStream.WriteL( *bccHeadingText ); |
|
463 CleanupStack::PopAndDestroy( bccHeadingText ); |
|
464 } |
|
465 break; |
|
466 |
|
467 default: |
|
468 User::Leave( KErrNotSupported ); |
|
469 } |
|
470 aWriteStream.WriteL( _L8("</b>") ); |
|
471 aWriteStream.WriteL( _L8("</td>\n") ); |
|
472 aWriteStream.WriteL( _L8("</tr>\n") ); |
|
473 |
|
474 aWriteStream.WriteL( _L8("<tr>\n") ); |
|
475 aWriteStream.WriteL( _L8("<td>") ); |
|
476 |
|
477 switch ( aEmailAddressType ) |
|
478 { |
|
479 case FreestyleMessageHeaderURLFactory::EEmailAddressTypeTo: |
|
480 StartTableL( aWriteStream, KToTableName ); |
|
481 break; |
|
482 |
|
483 case FreestyleMessageHeaderURLFactory::EEmailAddressTypeCc: |
|
484 StartTableL( aWriteStream, KCcTableName ); |
|
485 break; |
|
486 |
|
487 case FreestyleMessageHeaderURLFactory::EEmailAddressTypeBcc: |
|
488 StartTableL( aWriteStream, KBccTableName ); |
|
489 break; |
|
490 case FreestyleMessageHeaderURLFactory::EEmailAddressTypeFrom: |
|
491 StartTableL( aWriteStream, KFromTableName ); |
|
492 break; |
|
493 |
|
494 default: |
|
495 User::Leave( KErrNotSupported ); |
|
496 } |
|
497 for ( TInt i=0; i<aEmailAddresses.Count(); i++ ) |
|
498 { |
|
499 aWriteStream.WriteL( _L8("<tr><td>") ); |
|
500 AddEmailAddressL (aWriteStream, aEmailAddressType, *aEmailAddresses[i] ); |
|
501 aWriteStream.WriteL( _L8("</td></tr>\n") ); |
|
502 } |
|
503 |
|
504 EndTableL( aWriteStream ); |
|
505 aWriteStream.WriteL( _L8("</td>\n") ); |
|
506 aWriteStream.WriteL( _L8("</tr>\n") ); |
|
507 aWriteStream.CommitL(); |
|
508 } |
455 } |
509 |
456 |
510 void CFreestyleMessageHeaderHTML::AddEmailAddressL( RWriteStream& aWriteStream, |
457 void CFreestyleMessageHeaderHTML::AddEmailAddressL( RWriteStream& aWriteStream, |
511 FreestyleMessageHeaderURLFactory::TEmailAddressType aEmailAddressType, |
458 FreestyleMessageHeaderURLFactory::TEmailAddressType aEmailAddressType, |
512 const CFSMailAddress& aEmailAddress ) const |
459 const CFSMailAddress& aEmailAddress ) const |