|
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: Message header HTML |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <s32strm.h> |
|
19 #include <f32file.h> |
|
20 #include <s32file.h> |
|
21 #include <e32cmn.h> |
|
22 #include <utf.h> |
|
23 #include <StringLoader.h> |
|
24 #include <AknsUtils.h> |
|
25 #include <AknsSkinInstance.h> |
|
26 #include <AknsConstants.h> |
|
27 |
|
28 #include <FreestyleEmailUi.rsg> |
|
29 #include <finditemengine.h> |
|
30 #include "FreestyleMessageHeaderHTML.h" |
|
31 #include "FreestyleEmailUiUtilities.h" |
|
32 #include "ncsconstants.h" |
|
33 |
|
34 _LIT( KAlignRight, "right" ); |
|
35 _LIT( KAlignLeft, "left" ); |
|
36 _LIT( KRtl, "rtl" ); |
|
37 _LIT( KLtr, "ltr" ); |
|
38 |
|
39 const TInt KMaxRecipientsShown( 10 ); |
|
40 const TInt KFreestyleMessageHeaderHTMLRightMarginInPx( 10 ); |
|
41 |
|
42 _LIT8( KTableRowBegin, "<tr>" ); |
|
43 _LIT8( KTableRowEnd, "</tr>\n" ); |
|
44 _LIT8( KTableCellEnd, "</td>" ); |
|
45 |
|
46 _LIT( KSchemeSeparator, "://" ); |
|
47 _LIT( KUrlFormat, "<a href=\"%S\">%S</a>" ); |
|
48 _LIT( KUrlFormatWithHttp, "<a href=\"http://%S\">%S</a>" ); |
|
49 |
|
50 _LIT( KEmpty, "" ); |
|
51 |
|
52 // Define this to allow theme colorin for the header |
|
53 #define __USE_THEME_COLOR_FOR_HEADER |
|
54 |
|
55 EXPORT_C CFreestyleMessageHeaderHTML* CFreestyleMessageHeaderHTML::NewL( CFSMailMessage& aMailMessage, |
|
56 RWriteStream& aWriteStream, |
|
57 TInt aVisibleWidth, |
|
58 TInt aScrollPosition, |
|
59 const TBool aAutoLoadImages, |
|
60 const TBitFlags& aFlags |
|
61 ) |
|
62 { |
|
63 CFreestyleMessageHeaderHTML* self = new (ELeave) CFreestyleMessageHeaderHTML( aMailMessage, aWriteStream, aVisibleWidth, aScrollPosition, aAutoLoadImages, aFlags); |
|
64 self->ConstructL(); |
|
65 return self; |
|
66 } |
|
67 |
|
68 EXPORT_C void CFreestyleMessageHeaderHTML::ExportL( CFSMailMessage& aMailMessage, |
|
69 RWriteStream& aWriteStream, |
|
70 TInt aVisibleWidth, |
|
71 TInt aScrollPosition, |
|
72 const TBool aAutoLoadImages, |
|
73 const TBitFlags& aFlags ) |
|
74 { |
|
75 CFreestyleMessageHeaderHTML* headerHtml = CFreestyleMessageHeaderHTML::NewL( aMailMessage, aWriteStream, aVisibleWidth, aScrollPosition, aAutoLoadImages, aFlags); |
|
76 CleanupStack::PushL( headerHtml ); |
|
77 headerHtml->ExportL(); |
|
78 CleanupStack::PopAndDestroy( headerHtml ); |
|
79 } |
|
80 |
|
81 EXPORT_C void CFreestyleMessageHeaderHTML::ExportL( CFSMailMessage& aMailMessage, |
|
82 RFile& aFile, |
|
83 TInt aVisibleWidth, |
|
84 TInt aScrollPosition, |
|
85 const TBool aAutoLoadImages, |
|
86 const TBitFlags& aFlags ) |
|
87 { |
|
88 RFileWriteStream fwstream; |
|
89 fwstream.Attach( aFile, 0 ); |
|
90 CleanupClosePushL( fwstream ); |
|
91 |
|
92 CFreestyleMessageHeaderHTML* headerHtml = CFreestyleMessageHeaderHTML::NewL( aMailMessage, fwstream, aVisibleWidth, aScrollPosition, aAutoLoadImages, aFlags ); |
|
93 CleanupStack::PushL( headerHtml ); |
|
94 headerHtml->ExportL(); |
|
95 CleanupStack::PopAndDestroy( headerHtml ); |
|
96 |
|
97 CleanupStack::PopAndDestroy( &fwstream ); |
|
98 } |
|
99 |
|
100 EXPORT_C void CFreestyleMessageHeaderHTML::ExportL( CFSMailMessage& aMailMessage, |
|
101 RFs& aFs, |
|
102 const TPath& aFilePath, |
|
103 TInt aVisibleWidth, |
|
104 TInt aScrollPosition, |
|
105 const TBool aAutoLoadImages, |
|
106 const TBitFlags& aFlags ) |
|
107 { |
|
108 RFileWriteStream fwstream; |
|
109 User::LeaveIfError( fwstream.Replace( aFs, aFilePath, EFileStreamText | EFileWrite) ); |
|
110 CleanupClosePushL( fwstream ); |
|
111 |
|
112 CFreestyleMessageHeaderHTML* headerHtml = CFreestyleMessageHeaderHTML::NewL( aMailMessage, fwstream, aVisibleWidth, aScrollPosition, aAutoLoadImages, aFlags); |
|
113 CleanupStack::PushL( headerHtml ); |
|
114 headerHtml->ExportL(); |
|
115 CleanupStack::PopAndDestroy( headerHtml ); |
|
116 |
|
117 CleanupStack::PopAndDestroy( &fwstream ); |
|
118 } |
|
119 |
|
120 CFreestyleMessageHeaderHTML::~CFreestyleMessageHeaderHTML() |
|
121 { |
|
122 iAttachments.ResetAndDestroy(); |
|
123 } |
|
124 |
|
125 CFreestyleMessageHeaderHTML::CFreestyleMessageHeaderHTML( CFSMailMessage& aMailMessage, |
|
126 RWriteStream& aWriteStream, |
|
127 TInt aVisibleWidth, |
|
128 TInt aScrollPosition, |
|
129 const TBool aAutoLoadImages, |
|
130 const TBitFlags& aFlags ) |
|
131 : iMailMessage( aMailMessage ), |
|
132 iWriteStream( aWriteStream ), |
|
133 iVisibleWidth( aVisibleWidth - KFreestyleMessageHeaderHTMLRightMarginInPx ), |
|
134 iScrollPosition( aScrollPosition ), |
|
135 iExportFlags( aFlags ) |
|
136 { |
|
137 iExportFlags.Assign( EAutoLoadImages, aAutoLoadImages ); |
|
138 iExportFlags.Assign( EMirroredLayout, AknLayoutUtils::LayoutMirrored() ); |
|
139 } |
|
140 |
|
141 void CFreestyleMessageHeaderHTML::ConstructL() |
|
142 { |
|
143 iMailMessage.AttachmentListL( iAttachments ); |
|
144 } |
|
145 |
|
146 EXPORT_C void CFreestyleMessageHeaderHTML::ExportL() const |
|
147 { |
|
148 ExportBodyStyleL(); |
|
149 ExportHTMLBodyStartL(); |
|
150 ExportHeaderTablesL(); |
|
151 ExportHTMLBodyEndL(); |
|
152 } |
|
153 |
|
154 void CFreestyleMessageHeaderHTML::ExportHTMLBodyStartL() const |
|
155 { |
|
156 _LIT( KHtmlBodyStart, "<html dir=\"%S\" xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n<title>Email Header</title>\n<script language=\"javascript\" src=\"header.js\"></script>\n<link rel=\"stylesheet\" type=\"text/css\" href=\"header.css\"/>\n</head>\n<body onLoad = \"init(%d)\">\n" ); |
|
157 //_LIT( KHtmlBodyStart, "<html dir=\"%S\" xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n<title>Email Header</title>\n<script language=\"javascript\" src=\"header.js\"></script>\n<link rel=\"stylesheet\" type=\"text/css\" href=\"header%d.css\"/>\n</head>\n<body onLoad = \"init(%d)\">\n" ); |
|
158 const TPtrC direction( iExportFlags.IsSet( EMirroredLayout ) ? KRtl() : KLtr() ); |
|
159 HBufC* formatBuffer = HBufC::NewLC( KHtmlBodyStart().Length() + direction.Length() + 16 ); |
|
160 formatBuffer->Des().Format( KHtmlBodyStart(), &direction, iScrollPosition ); |
|
161 //formatBuffer->Des().Format( KHtmlBodyStart(), &direction, Math::Random() % 2, iScrollPosition ); |
|
162 HBufC8* utf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *formatBuffer ); |
|
163 CleanupStack::PushL( utf ); |
|
164 iWriteStream.WriteL( *utf ); |
|
165 CleanupStack::PopAndDestroy( 2 ); // formatBuffer, utf |
|
166 iWriteStream.CommitL(); |
|
167 } |
|
168 |
|
169 void CFreestyleMessageHeaderHTML::ExportInnerTableBeginWithRowBeginL( const TDesC& aTableName, const TInt aColSpan, |
|
170 const TBool aVisible, const TBitFlags& aFlags ) const |
|
171 { |
|
172 iWriteStream.WriteL( KTableRowBegin() ); |
|
173 ExportTableVisibilityParameterL( aTableName, aVisible ); |
|
174 ExportInnerTableBeginL( aTableName, aColSpan, aFlags ); |
|
175 } |
|
176 |
|
177 |
|
178 void CFreestyleMessageHeaderHTML::ExportInnerTableBeginL( const TDesC& aTableName, const TInt aColSpan, |
|
179 const TBitFlags& aFlags ) const |
|
180 { |
|
181 _LIT( KHidden, " style=\"display: none;\""); |
|
182 _LIT( KFixed, " class=\"fixed\""); |
|
183 _LIT( KTableHeader, "<td colspan=\"%d\"><table id=\"%S\" width=\"100%%\"%S%S>\n" ); |
|
184 const TPtrC style( aFlags.IsClear( EHidden ) ? KNullDesC() : KHidden() ); |
|
185 const TPtrC fixed( aFlags.IsClear( EFixed ) ? KNullDesC() : KFixed() ); |
|
186 HBufC* formatBuffer = HBufC::NewLC( KTableHeader().Length() + aTableName.Length() + 16 + style.Length() + fixed.Length() ); |
|
187 formatBuffer->Des().Format( KTableHeader(), aColSpan, &aTableName, &style, &fixed ); |
|
188 HBufC8* utf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *formatBuffer ); |
|
189 CleanupStack::PushL( utf ); |
|
190 iWriteStream.WriteL( *utf ); |
|
191 CleanupStack::PopAndDestroy( 2 ); // formatBuffer, utf |
|
192 } |
|
193 |
|
194 void CFreestyleMessageHeaderHTML::ExportTableVisibilityParameterL( const TDesC& aTableName, const TBitFlags& aFlags ) const |
|
195 { |
|
196 ExportTableVisibilityParameterL( aTableName, aFlags.IsClear( EHidden ) ); |
|
197 } |
|
198 |
|
199 void CFreestyleMessageHeaderHTML::ExportTableVisibilityParameterL( const TDesC& aTableName, const TBool aVisible ) const |
|
200 { |
|
201 _LIT( KTrue, "true" ); |
|
202 _LIT( KFalse, "false" ); |
|
203 _LIT( KVisibilityParameter, "<script type=\"text/javascript\">var is_%S_visible=%S;</script>" ); |
|
204 const TPtrC visible( aVisible ? KTrue() : KFalse() ); |
|
205 HBufC* formatBuffer = HBufC::NewLC( KVisibilityParameter().Length() + aTableName.Length() + visible.Length() ); |
|
206 formatBuffer->Des().Format( KVisibilityParameter(), &aTableName, &visible ); |
|
207 HBufC8* utf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *formatBuffer ); |
|
208 CleanupStack::PushL( utf ); |
|
209 iWriteStream.WriteL( *utf ); |
|
210 CleanupStack::PopAndDestroy( 2 ); // formatBuffer, utf |
|
211 } |
|
212 |
|
213 void CFreestyleMessageHeaderHTML::ExportTableBeginL( const TDesC& aTableName, const TBitFlags& aFlags ) const |
|
214 { |
|
215 _LIT( KFixed, " class=\"fixed\""); |
|
216 _LIT( KTableHeader, "<table id=\"%S\" width=\"%dpx\"%S%S>\n" ); |
|
217 const TPtrC style( aFlags.IsClear( EHidden ) ? KNullDesC() : KNullDesC() ); |
|
218 const TPtrC fixed( aFlags.IsClear( EFixed ) ? KNullDesC() : KFixed() ); |
|
219 ExportTableVisibilityParameterL( aTableName, aFlags ); |
|
220 HBufC* formatBuffer = HBufC::NewLC( KTableHeader().Length() + aTableName.Length() + 16 + style.Length() + fixed.Length() ); |
|
221 formatBuffer->Des().Format( KTableHeader(), &aTableName, iVisibleWidth, &style, &fixed ); |
|
222 HBufC8* utf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *formatBuffer ); |
|
223 CleanupStack::PushL( utf ); |
|
224 iWriteStream.WriteL( *utf ); |
|
225 CleanupStack::PopAndDestroy( 2 ); // formatBuffer, utf |
|
226 } |
|
227 |
|
228 void CFreestyleMessageHeaderHTML::ExportInnerTableEndL() const |
|
229 { |
|
230 ExportTableEndL(); |
|
231 iWriteStream.WriteL( KTableCellEnd() ); |
|
232 } |
|
233 |
|
234 void CFreestyleMessageHeaderHTML::ExportInnerTableEndWithRowEndL() const |
|
235 { |
|
236 ExportInnerTableEndL(); |
|
237 iWriteStream.WriteL( KTableRowEnd() ); |
|
238 } |
|
239 |
|
240 void CFreestyleMessageHeaderHTML::ExportTableEndL() const |
|
241 { |
|
242 HBufC8* utf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( _L("</table>\n") ); |
|
243 CleanupStack::PushL( utf ); |
|
244 iWriteStream.WriteL( *utf ); |
|
245 CleanupStack::PopAndDestroy(); // utf |
|
246 } |
|
247 |
|
248 void CFreestyleMessageHeaderHTML::ExportSenderTableRowL( const TBool aCollapsed ) const |
|
249 { |
|
250 _LIT( KStyleExpand, "expand" ); |
|
251 _LIT( KStyleCollapse, "collapse" ); |
|
252 _LIT( KExpandFunction, "expandHeader(true)" ); |
|
253 _LIT( KCollapseFunction, "collapseHeader(true)" ); |
|
254 _LIT( KSenderFormat, "<tr><td align=\"%S\" class=\"sender_name\"><div class=\"truncate\">%S</div></td><td valign=\"top\" rowSpan=\"2\" class=\"button_cell\"><button value=\"submit\" onClick=\"%S\" class=\"%S\"></button></td></tr>\n" ); |
|
255 const CFSMailAddress* sender( iMailMessage.GetSender() ); |
|
256 |
|
257 TPtrC displayName; |
|
258 if ( sender ) |
|
259 { |
|
260 displayName.Set( sender->GetDisplayName() ); |
|
261 if ( !displayName.Length() ) |
|
262 { |
|
263 displayName.Set( sender->GetEmailAddress() ); |
|
264 } |
|
265 } |
|
266 else |
|
267 { |
|
268 displayName.Set( KEmpty ); |
|
269 } |
|
270 |
|
271 const TPtrC function( aCollapsed ? KExpandFunction() : KCollapseFunction() ); |
|
272 const TPtrC style( aCollapsed ? KStyleExpand() : KStyleCollapse() ); |
|
273 const TPtrC align( iExportFlags.IsSet( EMirroredLayout ) ? KAlignRight() : KAlignLeft() ); |
|
274 HBufC* formatBuffer = HBufC::NewLC( KSenderFormat().Length() + displayName.Length() + align.Length() + function.Length() + style.Length() ); |
|
275 formatBuffer->Des().Format( KSenderFormat(), &align, &displayName, &function, &style ); |
|
276 HBufC8* utf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *formatBuffer ); |
|
277 CleanupStack::PushL( utf ); |
|
278 iWriteStream.WriteL( *utf ); |
|
279 CleanupStack::PopAndDestroy( 2 ); // formatBuffer, utf |
|
280 } |
|
281 |
|
282 void CFreestyleMessageHeaderHTML::ExportSenderAddressTableRowL() const |
|
283 { |
|
284 _LIT( KSenderAddressFormat, "<tr><td colspan=\"2\" align=\"%S\"><div class=\"truncate\"><a class=\"sender_address\" href=\"cmail://from/%S\">%S</a></div></td></tr>\n" ); |
|
285 const CFSMailAddress* sender( iMailMessage.GetSender() ); |
|
286 |
|
287 TPtrC emailAddress; |
|
288 if ( sender ) |
|
289 { |
|
290 emailAddress.Set( sender->GetEmailAddress() ); |
|
291 } |
|
292 else |
|
293 { |
|
294 emailAddress.Set( KEmpty ); |
|
295 } |
|
296 |
|
297 const TPtrC align( iExportFlags.IsSet( EMirroredLayout ) ? KAlignRight() : KAlignLeft() ); |
|
298 HBufC* formatBuffer = HBufC::NewLC( KSenderAddressFormat().Length() + emailAddress.Length() * 2 + align.Length() ); |
|
299 formatBuffer->Des().Format( KSenderAddressFormat(), &align, &emailAddress, &emailAddress ); |
|
300 HBufC8* utf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *formatBuffer ); |
|
301 CleanupStack::PushL( utf ); |
|
302 iWriteStream.WriteL( *utf ); |
|
303 CleanupStack::PopAndDestroy( 2 ); // formatBuffer, utf |
|
304 } |
|
305 |
|
306 void CFreestyleMessageHeaderHTML::ExportLabelTableRowL( const TInt aResourceId, const TInt aColSpan ) const |
|
307 { |
|
308 _LIT( KLabelFormat, "<tr><td align=\"%S\" colspan=\"%d\" class=\"label\">%S</td></tr>\n" ); |
|
309 HBufC* labelText = StringLoader::LoadLC( aResourceId ); |
|
310 const TPtrC align( iExportFlags.IsSet( EMirroredLayout ) ? KAlignRight() : KAlignLeft() ); |
|
311 HBufC* formatBuffer = HBufC::NewLC( KLabelFormat().Length() + labelText->Length() + align.Length() + 8 ); |
|
312 formatBuffer->Des().Format( KLabelFormat(), &align, aColSpan, labelText ); |
|
313 HBufC8* utf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *formatBuffer ); |
|
314 CleanupStack::PushL( utf ); |
|
315 iWriteStream.WriteL( *utf ); |
|
316 CleanupStack::PopAndDestroy( 3 ); // labelText, formatBuffer, utf |
|
317 } |
|
318 |
|
319 void CFreestyleMessageHeaderHTML::ExportFromTableRowL() const |
|
320 { |
|
321 ExportLabelTableRowL( R_FREESTYLE_EMAIL_UI_VIEWER_FROM ); |
|
322 ExportSenderAddressTableRowL(); |
|
323 } |
|
324 |
|
325 void CFreestyleMessageHeaderHTML::ExportExpandRecipientsL( const TDesC& aType, const TInt aCount ) const |
|
326 { |
|
327 _LIT( KExpandRecipientsFormat, "<tr><td align=\"%S\"><a class=\"recipient\" href=\"cmail://expand_%S/\" onclick=\"handleHeaderDisplay('%S_collapsed','%S_expanded')\">%S</a></td></tr>\n" ); |
|
328 HBufC* text = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_VIEWER_N_MORE_RECIPIENTS, aCount ); |
|
329 const TPtrC align( iExportFlags.IsSet( EMirroredLayout ) ? KAlignRight() : KAlignLeft() ); |
|
330 HBufC* formatBuffer = HBufC::NewLC( KExpandRecipientsFormat().Length() + text->Length() + align.Length() + aType.Length() * 3 ); |
|
331 formatBuffer->Des().Format( KExpandRecipientsFormat(), &align, &aType, &aType, &aType, text ); |
|
332 HBufC8* utf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *formatBuffer ); |
|
333 CleanupStack::PushL( utf ); |
|
334 iWriteStream.WriteL( *utf ); |
|
335 CleanupStack::PopAndDestroy( 3 ); // text, formatBuffer, utf |
|
336 } |
|
337 |
|
338 void CFreestyleMessageHeaderHTML::ExportExpandAttachmentsL( const TDesC& aType, const TInt aCount ) const |
|
339 { |
|
340 _LIT( KExpandRecipientsFormat, "<td align=\"%S\" class=\"attachment\"><a href=\"cmail://expand_%S/\" onclick=\"handleHeaderDisplay('%S_collapsed','%S_expanded')\">%S</a></td>" ); |
|
341 HBufC* text = StringLoader::LoadLC( R_FSE_VIEWER_ATTACHMENTS_TEXT, aCount ); |
|
342 const TPtrC align( iExportFlags.IsSet( EMirroredLayout ) ? KAlignRight() : KAlignLeft() ); |
|
343 HBufC* formatBuffer = HBufC::NewLC( KExpandRecipientsFormat().Length() + text->Length() + align.Length() + aType.Length() * 3 ); |
|
344 formatBuffer->Des().Format( KExpandRecipientsFormat(), &align, &aType, &aType, &aType, text ); |
|
345 HBufC8* utf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *formatBuffer ); |
|
346 CleanupStack::PushL( utf ); |
|
347 iWriteStream.WriteL( *utf ); |
|
348 CleanupStack::PopAndDestroy( 3 ); // text, formatBuffer, utf |
|
349 } |
|
350 |
|
351 void CFreestyleMessageHeaderHTML::ExportRecipientsTableL( const TDesC& aType, const TInt aLabelResourceId, |
|
352 const RPointerArray<CFSMailAddress>& aRecipients, const TBool aExpanded ) const |
|
353 { |
|
354 if ( aRecipients.Count() > 0 ) |
|
355 { |
|
356 TBool innerTableExpanded( aExpanded ); |
|
357 TBitFlags flags; |
|
358 flags.Assign( EHidden, iExportFlags.IsClear( EHeaderExpanded ) ); |
|
359 _LIT( KTableNameFormat, "%S_table" ); |
|
360 HBufC* outerTableName = HBufC::NewLC( KTableNameFormat().Length() + aType.Length() ); |
|
361 outerTableName->Des().Format( KTableNameFormat(), &aType ); |
|
362 ExportTableBeginL( *outerTableName, flags ); |
|
363 CleanupStack::PopAndDestroy(); // outerTableName |
|
364 |
|
365 ExportLabelTableRowL( aLabelResourceId, 2 ); |
|
366 const TBool showCollapsed( aRecipients.Count() > KMaxRecipientsShown ); |
|
367 TBitFlags tableFlags; |
|
368 tableFlags.Set( EFixed ); |
|
369 if ( showCollapsed ) |
|
370 { |
|
371 _LIT( KFormatCollapsed, "%S_collapsed" ); |
|
372 HBufC* tableName = HBufC::NewLC( KFormatCollapsed().Length() + 8 ); |
|
373 tableName->Des().Format( KFormatCollapsed(), &aType ); |
|
374 ExportInnerTableBeginWithRowBeginL( *tableName, 2, !innerTableExpanded, tableFlags ); |
|
375 CleanupStack::PopAndDestroy(); // tableName |
|
376 ExportExpandRecipientsL( aType, aRecipients.Count() ); |
|
377 ExportInnerTableEndWithRowEndL(); |
|
378 tableFlags.Set( EHidden ); |
|
379 } |
|
380 else |
|
381 { |
|
382 innerTableExpanded = ETrue; |
|
383 } |
|
384 _LIT( KFormatExpanded, "%S_expanded" ); |
|
385 HBufC* tableName = HBufC::NewLC( KFormatExpanded().Length() + 8 ); |
|
386 tableName->Des().Format( KFormatExpanded(), &aType ); |
|
387 ExportInnerTableBeginWithRowBeginL( *tableName, 2, innerTableExpanded, tableFlags ); |
|
388 CleanupStack::PopAndDestroy(); // tableName |
|
389 ExportRecipientsL( aType, aRecipients ); |
|
390 ExportInnerTableEndWithRowEndL(); |
|
391 ExportTableEndL(); |
|
392 } |
|
393 } |
|
394 |
|
395 void CFreestyleMessageHeaderHTML::ExportRecipientsL( const TDesC& aType, |
|
396 const RPointerArray<CFSMailAddress>& aRecipients) const |
|
397 { |
|
398 _LIT( KRecipientFormat, "<tr><td align=\"%S\"><div class=\"truncate\"><a class=\"recipient\" href=\"cmail://%S/%S\">%S</a></div></td></tr>" ); |
|
399 const TPtrC align( iExportFlags.IsSet( EMirroredLayout ) ? KAlignRight() : KAlignLeft() ); |
|
400 for ( TInt i = 0; i < aRecipients.Count(); i++ ) |
|
401 { |
|
402 const CFSMailAddress* sender( aRecipients[ i ] ); |
|
403 TPtrC displayName( sender->GetDisplayName() ); |
|
404 const TPtrC emailAddress( sender->GetEmailAddress() ); |
|
405 if ( !displayName.Length() ) |
|
406 { |
|
407 displayName.Set( emailAddress ); |
|
408 } |
|
409 HBufC* formatBuffer = HBufC::NewLC( KRecipientFormat().Length() + align.Length() + aType.Length() + emailAddress.Length() + displayName.Length() ); |
|
410 formatBuffer->Des().Format( KRecipientFormat(), &align, &aType, &emailAddress, &displayName ); |
|
411 HBufC8* utf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *formatBuffer ); |
|
412 CleanupStack::PushL( utf ); |
|
413 iWriteStream.WriteL( *utf ); |
|
414 CleanupStack::PopAndDestroy( 2 ); // formatBuffer, utf |
|
415 } |
|
416 } |
|
417 |
|
418 void CFreestyleMessageHeaderHTML::ExportToTableL() const |
|
419 { |
|
420 ExportRecipientsTableL( _L("to"), R_FREESTYLE_EMAIL_UI_VIEWER_TO, iMailMessage.GetToRecipients(), iExportFlags.IsSet( EToExpanded ) ); |
|
421 } |
|
422 |
|
423 void CFreestyleMessageHeaderHTML::ExportCcTableL() const |
|
424 { |
|
425 ExportRecipientsTableL( _L("cc"), R_FREESTYLE_EMAIL_UI_VIEWER_CC, iMailMessage.GetCCRecipients(), iExportFlags.IsSet( ECcExpanded ) ); |
|
426 } |
|
427 |
|
428 void CFreestyleMessageHeaderHTML::ExportBccTableL() const |
|
429 { |
|
430 ExportRecipientsTableL( _L("bcc"), R_FREESTYLE_EMAIL_UI_VIEWER_BCC, iMailMessage.GetBCCRecipients(), iExportFlags.IsSet( EBccExpanded ) ); |
|
431 } |
|
432 |
|
433 void CFreestyleMessageHeaderHTML::ExportDateTimeTableRowL( const TInt aColSpan ) const |
|
434 { |
|
435 _LIT( KDateTimeFormat, "<tr><td colspan=\"%d\" align=\"%S\" class=\"datetime\">%S%S%S</td></tr>\n" ); |
|
436 HBufC* dateText = TFsEmailUiUtility::DateTextFromMsgLC( &iMailMessage ); |
|
437 HBufC* timeText = TFsEmailUiUtility::TimeTextFromMsgLC( &iMailMessage ); |
|
438 const TPtrC align( iExportFlags.IsSet( EMirroredLayout ) ? KAlignRight() : KAlignLeft() ); |
|
439 HBufC* formatBuffer = HBufC::NewLC( KDateTimeFormat().Length() + dateText->Length() + timeText->Length() + KSentLineDateAndTimeSeparatorText().Length() + align.Length() + 3 ); |
|
440 formatBuffer->Des().Format( KDateTimeFormat(), aColSpan, &align, dateText, &KSentLineDateAndTimeSeparatorText(), timeText ); |
|
441 HBufC8* utf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *formatBuffer ); |
|
442 CleanupStack::PushL( utf ); |
|
443 iWriteStream.WriteL( *utf ); |
|
444 CleanupStack::PopAndDestroy( 4 ); // dateText, timeText, formatBuffer, utf |
|
445 } |
|
446 |
|
447 void CFreestyleMessageHeaderHTML::ExportSubjectTableRowL( const TBool aShowLabel ) const |
|
448 { |
|
449 _LIT( KClassSubject, "subject" ); |
|
450 TPtrC subjectClass( KClassSubject() ); |
|
451 if ( aShowLabel ) |
|
452 { |
|
453 _LIT( KClassSubjectIntended, "subject_intended"); |
|
454 ExportLabelTableRowL( R_FREESTYLE_EMAIL_UI_VIEWER_SUBJECT, 2 ); |
|
455 subjectClass.Set( KClassSubjectIntended() ); |
|
456 } |
|
457 _LIT( KSubjectFormat, "<tr><td align=\"%S\" class=\"%S\">%S</td><td align=\"center\" valign=\"bottom\" width=\"1\">"); |
|
458 const TPtrC align( iExportFlags.IsSet( EMirroredLayout ) ? KAlignRight() : KAlignLeft() ); |
|
459 HBufC* subject = SubjectLC(); |
|
460 HBufC* formatBuffer = HBufC::NewLC( KSubjectFormat().Length() + align.Length() + subject->Length() + subjectClass.Length() ); |
|
461 formatBuffer->Des().Format( KSubjectFormat(), &align, &subjectClass, subject ); |
|
462 HBufC8* utf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *formatBuffer ); |
|
463 CleanupStack::PushL( utf ); |
|
464 iWriteStream.WriteL( *utf ); |
|
465 CleanupStack::PopAndDestroy( 3 ); // subject, formatBuffer, utf |
|
466 ExportMessageIconsL(); |
|
467 iWriteStream.WriteL( KTableCellEnd() ); |
|
468 iWriteStream.WriteL( KTableRowEnd() ); |
|
469 } |
|
470 |
|
471 void CFreestyleMessageHeaderHTML::ExportMessageIconsL() const |
|
472 { |
|
473 _LIT( KPriorityLow, "priority_low" ); |
|
474 _LIT( KPriorityHigh, "priority_high" ); |
|
475 _LIT( KFollowUp, "follow_up" ); |
|
476 _LIT( KFollowUpComplete, "follow_up_complete" ); |
|
477 |
|
478 TBool iconShown( EFalse ); |
|
479 |
|
480 if ( iMailMessage.IsFlagSet( EFSMsgFlag_Low ) ) |
|
481 { |
|
482 ExportIconL( KPriorityLow() ); |
|
483 iconShown = ETrue; |
|
484 } |
|
485 else if ( iMailMessage.IsFlagSet( EFSMsgFlag_Important ) ) |
|
486 { |
|
487 ExportIconL( KPriorityHigh() ); |
|
488 iconShown = ETrue; |
|
489 } |
|
490 |
|
491 if ( iMailMessage.IsFlagSet( EFSMsgFlag_FollowUp ) ) |
|
492 { |
|
493 ExportIconL( KFollowUp() ); |
|
494 iconShown = ETrue; |
|
495 } |
|
496 else if ( iMailMessage.IsFlagSet( EFSMsgFlag_FollowUpComplete ) ) |
|
497 { |
|
498 ExportIconL( KFollowUpComplete() ); |
|
499 iconShown = ETrue; |
|
500 } |
|
501 if ( iconShown ) |
|
502 { |
|
503 iWriteStream.WriteL( _L8("<div class=\"icon_cell\"></div>") ); |
|
504 } |
|
505 } |
|
506 |
|
507 void CFreestyleMessageHeaderHTML::ExportHeaderTablesL() const |
|
508 { |
|
509 ExportCollapsedHeaderTableL(); |
|
510 ExportExpandedHeaderTablesL(); |
|
511 ExportAttachmentTablesL(); |
|
512 ExportDisplayImagesTableL(); |
|
513 } |
|
514 |
|
515 void CFreestyleMessageHeaderHTML::ExportCollapsedHeaderTableL() const |
|
516 { |
|
517 TBitFlags flags; |
|
518 flags.Set( EFixed ); |
|
519 flags.Assign( EHidden, iExportFlags.IsSet( EHeaderExpanded ) ); |
|
520 ExportTableBeginL( _L("header_collapsed"), flags ); |
|
521 ExportSenderTableRowL( ETrue ); |
|
522 ExportDateTimeTableRowL(); |
|
523 ExportTableEndL(); |
|
524 flags.Clear( EFixed ); |
|
525 ExportTableBeginL( _L("header_collapsed_2"), flags ); |
|
526 ExportSubjectTableRowL(); |
|
527 ExportTableEndL(); |
|
528 iWriteStream.CommitL(); |
|
529 } |
|
530 |
|
531 void CFreestyleMessageHeaderHTML::ExportExpandedHeaderTablesL() const |
|
532 { |
|
533 TBitFlags flags; |
|
534 flags.Set( EFixed ); |
|
535 flags.Assign( EHidden, iExportFlags.IsClear( EHeaderExpanded ) ); |
|
536 ExportTableBeginL( _L("header_expanded"), flags ); |
|
537 ExportSenderTableRowL( EFalse ); |
|
538 ExportFromTableRowL(); |
|
539 ExportTableEndL(); |
|
540 ExportToTableL(); |
|
541 ExportCcTableL(); |
|
542 ExportBccTableL(); |
|
543 flags.Clear( EFixed ); |
|
544 ExportTableBeginL( _L("header_expanded_2"), flags ); |
|
545 ExportDateTimeTableRowL( 2 ); |
|
546 ExportSubjectTableRowL(); |
|
547 ExportTableEndL(); |
|
548 iWriteStream.CommitL(); |
|
549 } |
|
550 |
|
551 void CFreestyleMessageHeaderHTML::ExportAttachmentTablesL() const |
|
552 { |
|
553 const TInt attachmentCount( iAttachments.Count() ); |
|
554 if ( attachmentCount ) |
|
555 { |
|
556 if ( attachmentCount > 1 ) |
|
557 { |
|
558 ExportCollapsedAttachmentTableL( iExportFlags.IsSet( EAttachmentExpanded ) ); |
|
559 ExportExpandedAttachmentTableL( iExportFlags.IsClear( EAttachmentExpanded ) ); |
|
560 } |
|
561 else |
|
562 { |
|
563 ExportExpandedAttachmentTableL( EFalse ); |
|
564 } |
|
565 } |
|
566 } |
|
567 |
|
568 void CFreestyleMessageHeaderHTML::ExportAttachmentIconL() const |
|
569 { |
|
570 _LIT8( KCellBegin, "<td width=\"1\" valign=\"top\" class=\"attachment\">" ); |
|
571 iWriteStream.WriteL( KCellBegin() ); |
|
572 _LIT( KAttachment, "attachment" ); |
|
573 ExportIconL( KAttachment() ); |
|
574 iWriteStream.WriteL( KTableCellEnd() ); |
|
575 } |
|
576 |
|
577 void CFreestyleMessageHeaderHTML::ExportCollapsedAttachmentTableL( const TBool aHide ) const |
|
578 { |
|
579 TBitFlags flags; |
|
580 flags.Assign( EHidden, aHide ); |
|
581 ExportTableBeginL( _L("attachments_collapsed"), flags ); |
|
582 ExportCollapsedAttachmentsTableRowL(); |
|
583 ExportTableEndL(); |
|
584 } |
|
585 |
|
586 void CFreestyleMessageHeaderHTML::ExportCollapsedAttachmentsTableRowL() const |
|
587 { |
|
588 iWriteStream.WriteL( KTableRowBegin() ); |
|
589 ExportAttachmentIconL(); |
|
590 ExportExpandAttachmentsL( _L("attachments"), iAttachments.Count() ); |
|
591 iWriteStream.WriteL( KTableRowEnd() ); |
|
592 } |
|
593 |
|
594 void CFreestyleMessageHeaderHTML::ExportExpandedAttachmentTableL( const TBool aHide ) const |
|
595 { |
|
596 TBitFlags flags; |
|
597 flags.Assign( EHidden, aHide ); |
|
598 ExportTableBeginL( _L("attachments_expanded"), flags ); |
|
599 ExportExpandedAttachmentsTableRowsL(); |
|
600 ExportTableEndL(); |
|
601 } |
|
602 |
|
603 void CFreestyleMessageHeaderHTML::ExportExpandedAttachmentsTableRowsL() const |
|
604 { |
|
605 iWriteStream.WriteL( KTableRowBegin() ); |
|
606 ExportAttachmentIconL(); |
|
607 ExportAttachmentsL(); |
|
608 iWriteStream.WriteL( KTableRowEnd() ); |
|
609 } |
|
610 |
|
611 void CFreestyleMessageHeaderHTML::ExportAttachmentsL() const |
|
612 { |
|
613 ExportInnerTableBeginL( _L("_attachments_expanded"), 1 ); |
|
614 for ( TInt i = 0; i < iAttachments.Count(); i++ ) |
|
615 { |
|
616 ExportAttachmentL( *iAttachments[ i ] ); |
|
617 } |
|
618 ExportInnerTableEndL(); |
|
619 } |
|
620 |
|
621 void CFreestyleMessageHeaderHTML::ExportAttachmentL( CFSMailMessagePart& aAttachment ) const |
|
622 { |
|
623 _LIT( KAttachmentFormat, "<tr><td align=\"%S\" class=\"attachment\"><a href=\"cmail://attachment/%d\">%S (%S)</a></td></tr>\n" ); |
|
624 const TPtrC align( iExportFlags.IsSet( EMirroredLayout ) ? KAlignRight() : KAlignLeft() ); |
|
625 HBufC* size = TFsEmailUiUtility::CreateSizeDescLC( aAttachment.ContentSize(), EFalse ); |
|
626 const TPtrC attachmentName( aAttachment.AttachmentNameL() ); |
|
627 HBufC* formatBuffer = HBufC::NewLC( KAttachmentFormat().Length() + align.Length() + size->Length() + attachmentName.Length() + 16 ); |
|
628 formatBuffer->Des().Format( KAttachmentFormat(), &align, aAttachment.GetPartId().Id(), &attachmentName, size ); |
|
629 HBufC8* utf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *formatBuffer ); |
|
630 CleanupStack::PushL( utf ); |
|
631 iWriteStream.WriteL( *utf ); |
|
632 CleanupStack::PopAndDestroy( 3 ); // size, formatBuffer, utf |
|
633 } |
|
634 |
|
635 void CFreestyleMessageHeaderHTML::ExportIconL( const TDesC& aIconName ) const |
|
636 { |
|
637 _LIT( KMessageIconFormat, "<img src=\"%S.png\" class=\"icon\"/>" ); |
|
638 HBufC* formatBuffer = HBufC::NewLC( KMessageIconFormat().Length() + aIconName.Length() ); |
|
639 formatBuffer->Des().Format( KMessageIconFormat(), &aIconName ); |
|
640 HBufC8* utf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *formatBuffer ); |
|
641 CleanupStack::PushL( utf ); |
|
642 iWriteStream.WriteL( *utf ); |
|
643 CleanupStack::PopAndDestroy( 2 ); // formatBuffer, utf |
|
644 } |
|
645 |
|
646 HBufC* CFreestyleMessageHeaderHTML::SubjectLC() const |
|
647 { |
|
648 return CreateLinksLC( iMailMessage.GetSubject(), CFindItemEngine::EFindItemSearchURLBin ); |
|
649 } |
|
650 |
|
651 TInt CFreestyleMessageHeaderHTML::CalculateTotalSpaceRequired( const TDesC& aText, |
|
652 CFindItemEngine& aItemEngine, TInt& aMaxLength ) const |
|
653 { |
|
654 TInt totalLength( 0 ); |
|
655 aMaxLength = KMinTInt; |
|
656 CFindItemEngine::SFoundItem item; |
|
657 aItemEngine.ResetPosition(); |
|
658 for ( TBool available( aItemEngine.Item( item ) ); available; available = aItemEngine.NextItem( item ) ) |
|
659 { |
|
660 totalLength += item.iLength; |
|
661 if ( item.iItemType == CFindItemEngine::EFindItemSearchURLBin ) |
|
662 { |
|
663 const TPtrC url( aText.Mid( item.iStartPos, item.iLength ) ); |
|
664 if ( url.FindF( KSchemeSeparator() ) == KErrNotFound ) |
|
665 { |
|
666 totalLength += KUrlFormatWithHttp().Length(); |
|
667 } |
|
668 else |
|
669 { |
|
670 totalLength += KUrlFormat().Length(); |
|
671 } |
|
672 aMaxLength = ( aMaxLength < item.iLength ) ? item.iLength : aMaxLength; |
|
673 } |
|
674 } |
|
675 aItemEngine.ResetPosition(); |
|
676 return totalLength; |
|
677 } |
|
678 |
|
679 HBufC* CFreestyleMessageHeaderHTML::CreateLinksLC( const TDesC& aText, const TInt aSearchCases ) const |
|
680 { |
|
681 HBufC* result = NULL; |
|
682 CFindItemEngine* itemEngine = CFindItemEngine::NewL( aText, |
|
683 CFindItemEngine::TFindItemSearchCase( aSearchCases ) ); |
|
684 CleanupStack::PushL ( itemEngine ); |
|
685 if ( itemEngine->ItemCount() > 0 ) |
|
686 { |
|
687 RBuf buf; |
|
688 TInt maxLength; |
|
689 buf.CreateL( CalculateTotalSpaceRequired( aText, *itemEngine, maxLength ) + aText.Length() ); |
|
690 buf.CleanupClosePushL(); |
|
691 TInt currentReadPosition( 0 ); |
|
692 CFindItemEngine::SFoundItem item; |
|
693 HBufC* urlBuffer = HBufC::NewLC( KUrlFormatWithHttp().Length() + maxLength * 2 ); |
|
694 for ( TBool available( itemEngine->Item( item ) ); available; available = itemEngine->NextItem( item ) ) |
|
695 { |
|
696 // Append characters from currentReadPosition to iStartPos |
|
697 buf.Append( aText.Mid( currentReadPosition, item.iStartPos - currentReadPosition ) ); |
|
698 const TPtrC url( aText.Mid( item.iStartPos, item.iLength ) ); |
|
699 TPtrC format( KUrlFormat() ); |
|
700 if ( url.FindF( KSchemeSeparator() ) == KErrNotFound ) |
|
701 { |
|
702 format.Set( KUrlFormatWithHttp() ); |
|
703 } |
|
704 urlBuffer->Des().Format( format, &url, &url ); |
|
705 buf.Append( *urlBuffer ); |
|
706 currentReadPosition = item.iStartPos + item.iLength; |
|
707 } |
|
708 CleanupStack::PopAndDestroy(); // urlBuffer |
|
709 // Append characters that are left in buffer |
|
710 buf.Append( aText.Mid( currentReadPosition ) ); |
|
711 result = buf.AllocL(); |
|
712 CleanupStack::PopAndDestroy(); // buf.Close() |
|
713 } |
|
714 else |
|
715 { |
|
716 result = aText.AllocL(); |
|
717 } |
|
718 CleanupStack::PopAndDestroy( itemEngine ); |
|
719 CleanupStack::PushL( result ); |
|
720 return result; |
|
721 } |
|
722 |
|
723 void CFreestyleMessageHeaderHTML::ExportHTMLBodyEndL() const |
|
724 { |
|
725 iWriteStream.WriteL( _L8("</body>\n</html>\n") ); |
|
726 iWriteStream.CommitL(); |
|
727 } |
|
728 |
|
729 void CFreestyleMessageHeaderHTML::ExportDisplayImagesTableL() const |
|
730 { |
|
731 _LIT( KDisplayImagesLeftToRight, |
|
732 "<script language=\"javascript\">var g_autoLoadImages = %d;</script><table style=\"display: none\" id=\"displayImagesTable\" width=\"%dpx\"><tr><td align=\"left\">%S</td><td align=\"right\"><button value=\"submit\" class=\"submitBtn\" onClick=\"displayImagesButtonPressed()\"><span><span class=\"buttonText\">%S</span></span></button></td></tr></table>" ); |
|
733 |
|
734 _LIT( KDisplayImagesRightToLeft, |
|
735 "<script language=\"javascript\">var g_autoLoadImages = %d;</script><table style=\"display: none\" id=\"displayImagesTable\" width=\"%dpx\"><tr><td align=\"left\"><button value=\"submit\" class=\"submitBtn\" onClick=\"displayImagesButtonPressed()\"><span><span class=\"buttonText\">%S</span></span></button></td><td align=\"right\">%S</td></tr></table>" ); |
|
736 |
|
737 if ( iExportFlags.IsClear( EAutoLoadImages ) ) |
|
738 { |
|
739 _LIT(KDescription, ""); |
|
740 HBufC* description = KDescription().AllocLC(); //StringLoader::LoadLC(R_FREESTYLE_EMAIL_UI_IMAGES_ARE_NOT_DISPLAYED); |
|
741 HBufC* button = StringLoader::LoadLC(R_FREESTYLE_EMAIL_UI_DISPLAY_IMAGES); |
|
742 HBufC* formatBuffer = NULL; |
|
743 if ( iExportFlags.IsSet( EMirroredLayout ) ) |
|
744 { |
|
745 formatBuffer = HBufC::NewLC(KDisplayImagesRightToLeft().Length() + description->Length() + button->Length() + 8); |
|
746 formatBuffer->Des().Format( |
|
747 KDisplayImagesRightToLeft(), |
|
748 EFalse, |
|
749 iVisibleWidth, |
|
750 button, |
|
751 description); |
|
752 } |
|
753 else |
|
754 { |
|
755 formatBuffer = HBufC::NewLC(KDisplayImagesLeftToRight().Length() + description->Length() + button->Length() + 8); |
|
756 formatBuffer->Des().Format( |
|
757 KDisplayImagesLeftToRight(), |
|
758 EFalse, |
|
759 iVisibleWidth, |
|
760 description, |
|
761 button); |
|
762 } |
|
763 HBufC8* utf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *formatBuffer ); |
|
764 CleanupStack::PushL( utf ); |
|
765 iWriteStream.WriteL( *utf ); |
|
766 CleanupStack::PopAndDestroy( 4 ); // description, button, formatBuffer, utf |
|
767 iWriteStream.CommitL(); |
|
768 } |
|
769 } |
|
770 |
|
771 void CFreestyleMessageHeaderHTML::ExportBodyStyleL() const |
|
772 { |
|
773 iWriteStream.WriteL( _L8("<style type=\"text/css\">\n") ); |
|
774 #ifdef __USE_THEME_COLOR_FOR_HEADER |
|
775 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
776 TRgb textColor; |
|
777 TRgb bgColor; |
|
778 // Should use EAknsCIFsTextColorsCG3 if background is white |
|
779 if ( AknsUtils::GetCachedColor( skin, textColor, |
|
780 KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG81 ) != KErrNone || |
|
781 AknsUtils::GetCachedColor( skin, bgColor, |
|
782 KAknsIIDQsnOtherColors, EAknsCIQsnOtherColorsCG22 ) != KErrNone ) |
|
783 { |
|
784 iWriteStream.WriteL( _L8("body { color: black; background-color: lightblue; }\n") ); |
|
785 } |
|
786 else |
|
787 { |
|
788 // In future, query for which background color to use |
|
789 _LIT8( KBodyWithColor, "body { color: #%06x; background-color: #%06x; }\n" ); |
|
790 HBufC8* formatBuffer = HBufC8::NewLC(KBodyWithColor().Length() + 16); |
|
791 formatBuffer->Des().Format(KBodyWithColor(), textColor.Internal() & 0xFFFFFF, bgColor.Internal() & 0xFFFFFF); |
|
792 iWriteStream.WriteL( *formatBuffer ); |
|
793 CleanupStack::PopAndDestroy(); // formatBuffer |
|
794 } |
|
795 #else |
|
796 //iWriteStream.WriteL( _L8("body { color: black; background-color: lightblue; }\n") ); |
|
797 iWriteStream.WriteL( _L8("body { color: black; background-color: #c5c5c5; }\n") ); |
|
798 #endif // __USE_THEME_COLOR_FOR_HEADER |
|
799 iWriteStream.WriteL( _L8("</style>\n") ); |
|
800 iWriteStream.CommitL(); |
|
801 } |
|
802 |
|
803 |