42 #include "FreestyleEmailUiHtmlViewerView.h" |
42 #include "FreestyleEmailUiHtmlViewerView.h" |
43 #include "FreestyleEmailUiShortcutBinding.h" |
43 #include "FreestyleEmailUiShortcutBinding.h" |
44 |
44 |
45 #include "FreestyleMessageHeaderHTML.h" |
45 #include "FreestyleMessageHeaderHTML.h" |
46 #include "FreestyleMessageHeaderURLEventHandler.h" |
46 #include "FreestyleMessageHeaderURLEventHandler.h" |
47 #include "FreestyleEmailUiAknStatusIndicator.h" |
|
48 #include "FreestyleEmailUiAttachmentsListModel.h" |
47 #include "FreestyleEmailUiAttachmentsListModel.h" |
49 |
48 |
50 _LIT( KContentIdPrefix, "cid:" ); |
49 _LIT( KContentIdPrefix, "cid:" ); |
51 _LIT( KCDrive, "c:" ); |
50 _LIT( KCDrive, "c:" ); |
52 _LIT( KHtmlPath, "HtmlFile\\" ); |
51 _LIT( KHtmlPath, "HtmlFile\\" ); |
83 _LIT8( KHtmlLinkTag, "<a href=\"%S\">" ); |
82 _LIT8( KHtmlLinkTag, "<a href=\"%S\">" ); |
84 _LIT8( KHtmlLinkTagWWW, "<a href=\"%S%S\">" ); |
83 _LIT8( KHtmlLinkTagWWW, "<a href=\"%S%S\">" ); |
85 _LIT8( KHtmlLinkEndTag, "</a>" ); |
84 _LIT8( KHtmlLinkEndTag, "</a>" ); |
86 _LIT( KURLTypeBody, "body"); |
85 _LIT( KURLTypeBody, "body"); |
87 |
86 |
|
87 _LIT( KURLDisplayImages, "cmail://displayImages/" ); |
|
88 _LIT( KURLLoadImages, "cmail://loadImages/" ); |
|
89 _LIT( KURLCollapseHeader, "cmail://collapseHeader/" ); |
|
90 _LIT( KURLExpandHeader, "cmail://expandHeader/" ); |
|
91 |
88 const TText8 KGreaterThan = 0x3e; |
92 const TText8 KGreaterThan = 0x3e; |
89 const TText8 KLessThan = 0x3c; |
93 const TText8 KLessThan = 0x3c; |
90 const TText8 KAmpersand = 0x26; |
94 const TText8 KAmpersand = 0x26; |
91 const TText8 KQuotation = 0x22; |
95 const TText8 KQuotation = 0x22; |
92 const TText8 KCharacterSpace = 0x20; |
96 const TText8 KCharacterSpace = 0x20; |
101 |
105 |
102 |
106 |
103 const TInt KStatusIndicatorHeight = 50; |
107 const TInt KStatusIndicatorHeight = 50; |
104 const TInt KStatusIndicatorXMargin = 50; |
108 const TInt KStatusIndicatorXMargin = 50; |
105 |
109 |
|
110 // CEUiHtmlViewerSettingsKeyListener |
|
111 |
|
112 // --------------------------------------------------------------------------- |
|
113 // |
|
114 // --------------------------------------------------------------------------- |
|
115 // |
|
116 CEUiHtmlViewerSettingsKeyListener::CEUiHtmlViewerSettingsKeyListener( MObserver& aObserver, TUint32 aKey ) |
|
117 : CActive( EPriorityStandard ), iObserver( aObserver ), iKey( aKey ) |
|
118 { |
|
119 CActiveScheduler::Add(this); |
|
120 StartListening(); |
|
121 } |
|
122 |
|
123 // --------------------------------------------------------------------------- |
|
124 // |
|
125 // --------------------------------------------------------------------------- |
|
126 // |
|
127 CEUiHtmlViewerSettingsKeyListener::~CEUiHtmlViewerSettingsKeyListener() |
|
128 { |
|
129 Cancel(); |
|
130 } |
|
131 |
|
132 // --------------------------------------------------------------------------- |
|
133 // |
|
134 // --------------------------------------------------------------------------- |
|
135 // |
|
136 void CEUiHtmlViewerSettingsKeyListener::StartListening() |
|
137 { |
|
138 SetActive(); |
|
139 iObserver.Repository().NotifyRequest(iKey, iStatus); |
|
140 } |
|
141 |
|
142 // --------------------------------------------------------------------------- |
|
143 // |
|
144 // --------------------------------------------------------------------------- |
|
145 // |
|
146 void CEUiHtmlViewerSettingsKeyListener::RunL() |
|
147 { |
|
148 iObserver.KeyValueChangedL(iKey); |
|
149 StartListening(); |
|
150 } |
|
151 |
|
152 // --------------------------------------------------------------------------- |
|
153 // |
|
154 // --------------------------------------------------------------------------- |
|
155 // |
|
156 void CEUiHtmlViewerSettingsKeyListener::DoCancel() |
|
157 { |
|
158 iObserver.Repository().NotifyCancel(iKey); |
|
159 } |
|
160 |
|
161 // CEUiHtmlViewerSettings |
|
162 |
|
163 // --------------------------------------------------------------------------- |
|
164 // |
|
165 // --------------------------------------------------------------------------- |
|
166 // |
|
167 CEUiHtmlViewerSettings* CEUiHtmlViewerSettings::NewL( MObserver& aObserver ) |
|
168 { |
|
169 CEUiHtmlViewerSettings* self = new (ELeave) CEUiHtmlViewerSettings(aObserver); |
|
170 CleanupStack::PushL(self); |
|
171 self->ConstructL(); |
|
172 CleanupStack::Pop(); // self |
|
173 return self; |
|
174 } |
|
175 |
|
176 // --------------------------------------------------------------------------- |
|
177 // |
|
178 // --------------------------------------------------------------------------- |
|
179 // |
|
180 CEUiHtmlViewerSettings::~CEUiHtmlViewerSettings() |
|
181 { |
|
182 iKeyListeners.ResetAndDestroy(); |
|
183 delete iRepository; |
|
184 } |
|
185 |
|
186 // --------------------------------------------------------------------------- |
|
187 // |
|
188 // --------------------------------------------------------------------------- |
|
189 // |
|
190 CEUiHtmlViewerSettings::CEUiHtmlViewerSettings( MObserver& aObserver ) : iObserver( aObserver ) |
|
191 { |
|
192 } |
|
193 |
|
194 // --------------------------------------------------------------------------- |
|
195 // |
|
196 // --------------------------------------------------------------------------- |
|
197 // |
|
198 void CEUiHtmlViewerSettings::ConstructL() |
|
199 { |
|
200 iRepository = CRepository::NewL(KFreestyleEmailCenRep); |
|
201 AddKeyListenerL(KFreestyleEmailDownloadHTMLImages); |
|
202 } |
|
203 |
|
204 // --------------------------------------------------------------------------- |
|
205 // |
|
206 // --------------------------------------------------------------------------- |
|
207 // |
|
208 void CEUiHtmlViewerSettings::AddKeyListenerL( TUint32 aKey ) |
|
209 { |
|
210 CEUiHtmlViewerSettingsKeyListener* listener = new (ELeave) CEUiHtmlViewerSettingsKeyListener(*this, aKey); |
|
211 CleanupStack::PushL(listener); |
|
212 iKeyListeners.AppendL(listener); |
|
213 CleanupStack::Pop(); // listener |
|
214 UpdateValue(aKey); |
|
215 } |
|
216 |
|
217 // --------------------------------------------------------------------------- |
|
218 // |
|
219 // --------------------------------------------------------------------------- |
|
220 // |
|
221 void CEUiHtmlViewerSettings::UpdateValue( TUint32 aKey ) |
|
222 { |
|
223 TInt value; |
|
224 iRepository->Get(aKey, value); |
|
225 switch (aKey) |
|
226 { |
|
227 case KFreestyleEmailDownloadHTMLImages: |
|
228 // 0 = automatic, 1 = ask always |
|
229 iFlags.Assign(aKey, value == 0); |
|
230 break; |
|
231 default: |
|
232 iFlags.Assign(aKey, value); |
|
233 break; |
|
234 } |
|
235 } |
|
236 |
|
237 // --------------------------------------------------------------------------- |
|
238 // |
|
239 // --------------------------------------------------------------------------- |
|
240 // |
|
241 void CEUiHtmlViewerSettings::KeyValueChangedL( TUint32 aKey ) |
|
242 { |
|
243 UpdateValue(aKey); |
|
244 iObserver.ViewerSettingsChangedL(aKey); |
|
245 } |
|
246 |
|
247 // --------------------------------------------------------------------------- |
|
248 // |
|
249 // --------------------------------------------------------------------------- |
|
250 // |
|
251 CRepository& CEUiHtmlViewerSettings::Repository() |
|
252 { |
|
253 return *iRepository; |
|
254 } |
|
255 |
|
256 // --------------------------------------------------------------------------- |
|
257 // |
|
258 // --------------------------------------------------------------------------- |
|
259 // |
|
260 TBool CEUiHtmlViewerSettings::AutoLoadImages() const |
|
261 { |
|
262 return iFlags.IsSet(EAutoLoadImages); |
|
263 } |
|
264 |
106 // --------------------------------------------------------------------------- |
265 // --------------------------------------------------------------------------- |
107 // Two-phased constructor. |
266 // Two-phased constructor. |
108 // --------------------------------------------------------------------------- |
267 // --------------------------------------------------------------------------- |
109 // |
268 // |
110 CFsEmailUiHtmlViewerContainer* CFsEmailUiHtmlViewerContainer::NewL( |
269 CFsEmailUiHtmlViewerContainer* CFsEmailUiHtmlViewerContainer::NewL( |
155 delete iStatusIndicator; |
315 delete iStatusIndicator; |
156 delete iOverlayControlNext; |
316 delete iOverlayControlNext; |
157 delete iOverlayControlPrev; |
317 delete iOverlayControlPrev; |
158 } |
318 } |
159 |
319 |
160 // <cmail> Because of browser changes, followings must be performed before iAppUi.exit() |
|
161 void CFsEmailUiHtmlViewerContainer::PrepareForExit() |
320 void CFsEmailUiHtmlViewerContainer::PrepareForExit() |
162 { |
321 { |
163 FUNC_LOG; |
322 FUNC_LOG; |
|
323 HideDownloadStatus(); |
164 if ( iObservingDownload && iAppUi.DownloadInfoMediator() ) |
324 if ( iObservingDownload && iAppUi.DownloadInfoMediator() ) |
165 { |
325 { |
166 iAppUi.DownloadInfoMediator()->StopObserving( this ); |
326 iAppUi.DownloadInfoMediator()->StopObserving( this ); |
167 iObservingDownload = EFalse; |
327 iObservingDownload = EFalse; |
168 } |
328 } |
169 delete iBrCtlInterface; |
329 delete iBrCtlInterface; |
170 iBrCtlInterface = NULL; |
330 iBrCtlInterface = NULL; |
171 iConnection.Close(); |
331 iConnection.Close(); |
172 iSocketServer.Close(); |
332 iSocketServer.Close(); |
173 } |
333 } |
174 // </cmail> |
334 |
|
335 void CFsEmailUiHtmlViewerContainer::PrepareForMessageNavigation() |
|
336 { |
|
337 FUNC_LOG; |
|
338 ResetContent(); |
|
339 } |
175 |
340 |
176 void CFsEmailUiHtmlViewerContainer::ConstructL() |
341 void CFsEmailUiHtmlViewerContainer::ConstructL() |
177 { |
342 { |
178 FUNC_LOG; |
343 FUNC_LOG; |
179 |
344 iViewerSettings = CEUiHtmlViewerSettings::NewL(*this); |
|
345 |
180 SetHtmlFolderPathL(); |
346 SetHtmlFolderPathL(); |
181 BaflUtils::EnsurePathExistsL( iFs, iHtmlFolderPath ); |
347 BaflUtils::EnsurePathExistsL( iFs, iHtmlFolderPath ); |
182 SetTempHtmlFolderPath(); |
348 SetTempHtmlFolderPath(); |
183 BaflUtils::EnsurePathExistsL( iFs, iTempHtmlFolderPath ); |
349 BaflUtils::EnsurePathExistsL( iFs, iTempHtmlFolderPath ); |
184 SetHTMLResourceFlagFullName(); |
350 SetHTMLResourceFlagFullName(); |
193 TBrCtlDefs::ECapabilityLoadHttpFw | |
359 TBrCtlDefs::ECapabilityLoadHttpFw | |
194 TBrCtlDefs::ECapabilityCursorNavigation; |
360 TBrCtlDefs::ECapabilityCursorNavigation; |
195 |
361 |
196 // Set browsercontrol to whole screen |
362 // Set browsercontrol to whole screen |
197 TRect rect( TPoint(), Size() ); |
363 TRect rect( TPoint(), Size() ); |
198 |
364 |
199 iBrCtlInterface = CreateBrowserControlL( this, rect, brCtlCapabilities, |
365 iBrCtlInterface = CreateBrowserControlL( |
200 TBrCtlDefs::ECommandIdBase, NULL, this, this, NULL, NULL, this, NULL ); |
366 this, // aParent |
|
367 rect, // aRect |
|
368 brCtlCapabilities, // aBrCtlCapabilities |
|
369 TBrCtlDefs::ECommandIdBase, // aCommandIdBase |
|
370 NULL, // aBrCtlSoftkeysObserver |
|
371 this, // aBrCtlLinkResolver |
|
372 this, // aBrCtlSpecialLoadObserver |
|
373 NULL, // aBrCtlLayoutObserver |
|
374 NULL, // aBrCtlDialogsProvider |
|
375 this, // aBrCtlWindowObserver |
|
376 NULL // aBrCtlDownloadObserver |
|
377 ); |
201 |
378 |
202 iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsEmbedded, ETrue ); |
379 iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsEmbedded, ETrue ); |
203 iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsAutoLoadImages, ETrue ); |
380 iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsAutoLoadImages, iViewerSettings->AutoLoadImages() ); |
204 iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsPageOverview, EFalse ); |
381 iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsPageOverview, EFalse ); |
205 iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsTextWrapEnabled, ETrue ); |
382 iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsTextWrapEnabled, ETrue ); |
206 iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsFontSize, TBrCtlDefs::EFontSizeLevelLarger ); |
383 iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsFontSize, TBrCtlDefs::EFontSizeLevelLarger ); |
207 |
384 |
208 iEventHandler = CFreestyleMessageHeaderURLEventHandler::NewL( iAppUi, iView ); |
385 iEventHandler = CFreestyleMessageHeaderURLEventHandler::NewL( iAppUi, iView ); |
209 |
386 |
210 TRect nextButtonRect = OverlayButtonRect( EFalse ); |
387 TRect nextButtonRect = OverlayButtonRect( EFalse ); |
211 iOverlayControlNext = COverlayControl::NewL( this, this, nextButtonRect, |
388 iOverlayControlNext = COverlayControl::NewL( this, this, nextButtonRect, |
212 EMbmFreestyleemailuiQgn_indi_cmail_arrow_next, |
389 EMbmFreestyleemailuiQgn_indi_cmail_arrow_next, |
347 headerHtmlFile.Append( KHeaderHtmlFile ); |
528 headerHtmlFile.Append( KHeaderHtmlFile ); |
348 |
529 |
349 // insert email header into email.html file |
530 // insert email header into email.html file |
350 // CFreestyleMessageHeaderHTML will replace contents of email.html |
531 // CFreestyleMessageHeaderHTML will replace contents of email.html |
351 // So, no need to clear the contents |
532 // So, no need to clear the contents |
352 TLanguage language = User::Language(); |
|
353 TBidiText::TDirectionality direction = TBidiText::ScriptDirectionality( language ); |
|
354 if(aResetScrollPos) |
533 if(aResetScrollPos) |
355 { |
534 { |
356 iScrollPosition = 0; |
535 iScrollPosition = 0; |
357 } |
536 } |
358 if ( AknLayoutUtils::LayoutMirrored() ) |
537 const TInt visibleWidth(iAppUi.ClientRect().Width()); |
359 { |
538 CFreestyleMessageHeaderHTML::ExportL( *iMessage, iFs, headerHtmlFile, visibleWidth, iScrollPosition, |
360 direction = TBidiText::ERightToLeft; |
539 iViewerSettings->AutoLoadImages() || iAppUi.DisplayImagesCache().Contains(*iMessage), |
361 } |
540 iHeaderExpanded ); |
362 else |
|
363 { |
|
364 direction = TBidiText::ELeftToRight; |
|
365 } |
|
366 CFreestyleMessageHeaderHTML::ExportL( *iMessage, iFs, headerHtmlFile, iAppUi.ClientRect().Width(), |
|
367 iScrollPosition, |
|
368 direction); |
|
369 |
541 |
370 // Remove all previously created files from temporary HTML folder |
542 // Remove all previously created files from temporary HTML folder |
371 EmptyTempHtmlFolderL(); |
543 EmptyTempHtmlFolderL(); |
372 |
544 |
373 TRAPD( error, PrepareBodyHtmlL( KBodyHtmlFile ) ); |
545 TRAPD( error, PrepareBodyHtmlL( KBodyHtmlFile ) ); |
394 |
566 |
395 // --------------------------------------------------------------------------- |
567 // --------------------------------------------------------------------------- |
396 // Reset content |
568 // Reset content |
397 // --------------------------------------------------------------------------- |
569 // --------------------------------------------------------------------------- |
398 // |
570 // |
399 void CFsEmailUiHtmlViewerContainer::ResetContent() |
571 void CFsEmailUiHtmlViewerContainer::ResetContent(const TBool aDisconnect) |
400 { |
572 { |
401 FUNC_LOG; |
573 FUNC_LOG; |
402 if ( iBrCtlInterface ) |
574 if ( iBrCtlInterface ) |
403 { |
575 { |
404 TRAP_IGNORE( iBrCtlInterface->HandleCommandL( ( TInt )TBrCtlDefs::ECommandIdBase + |
576 TRAP_IGNORE( |
405 ( TInt )TBrCtlDefs::ECommandFreeMemory ) ); |
577 iBrCtlInterface->HandleCommandL( ( TInt )TBrCtlDefs::ECommandIdBase + |
|
578 ( TInt )TBrCtlDefs::ECommandFreeMemory ) ); |
|
579 if (aDisconnect) |
|
580 { |
|
581 TRAP_IGNORE( |
|
582 iBrCtlInterface->HandleCommandL( ( TInt )TBrCtlDefs::ECommandIdBase + |
|
583 ( TInt )TBrCtlDefs::ECommandDisconnect ) ); |
|
584 } |
406 } |
585 } |
407 iFile.Close(); |
586 iFile.Close(); |
408 iLinkContents.Reset(); |
587 iLinkContents.Reset(); |
409 iMessageParts.Reset(); |
588 iMessageParts.Reset(); |
410 iMessage = NULL; |
589 iMessage = NULL; |
|
590 iHeaderExpanded = EFalse; |
|
591 iScrollPosition = 0; |
411 } |
592 } |
412 |
593 |
413 // --------------------------------------------------------------------------- |
594 // --------------------------------------------------------------------------- |
414 // From CCoeControl. |
595 // From CCoeControl. |
415 // --------------------------------------------------------------------------- |
596 // --------------------------------------------------------------------------- |
490 |
671 |
491 TRect rect = Rect(); |
672 TRect rect = Rect(); |
492 if ( iBrCtlInterface ) |
673 if ( iBrCtlInterface ) |
493 { |
674 { |
494 iBrCtlInterface->SetRect( rect ); |
675 iBrCtlInterface->SetRect( rect ); |
495 } |
|
496 |
|
497 if ( iMessage ) |
|
498 { |
|
499 // update the width in header part and reload |
|
500 TPath headerHtmlFile; |
|
501 headerHtmlFile.Copy( iHtmlFolderPath ); |
|
502 headerHtmlFile.Append( KHeaderHtmlFile ); |
|
503 |
|
504 TLanguage language = User::Language(); |
|
505 TBidiText::TDirectionality direction = TBidiText::ScriptDirectionality( language ); |
|
506 |
|
507 if ( AknLayoutUtils::LayoutMirrored() ) |
|
508 { |
|
509 direction = TBidiText::ERightToLeft; |
|
510 } |
|
511 else |
|
512 { |
|
513 direction = TBidiText::ELeftToRight; |
|
514 } |
|
515 TRAP_IGNORE( CFreestyleMessageHeaderHTML::ExportL( *iMessage, iFs, headerHtmlFile, |
|
516 rect.Width(), iScrollPosition, direction ) ) |
|
517 |
|
518 TPath emailHtmlFile; |
|
519 emailHtmlFile.Copy( iHtmlFolderPath ); |
|
520 if ( AknLayoutUtils::LayoutMirrored() ) |
|
521 { |
|
522 emailHtmlFile.Append( KMessageHtmlRTLFile ); |
|
523 } |
|
524 else |
|
525 { |
|
526 emailHtmlFile.Append( KMessageHtmlFile ); |
|
527 } |
|
528 } |
676 } |
529 |
677 |
530 UpdateOverlayButtons( IsVisible() ); |
678 UpdateOverlayButtons( IsVisible() ); |
531 |
679 |
532 if ( iStatusIndicator ) |
680 if ( iStatusIndicator ) |
1662 // Update the width in header part and reload |
1818 // Update the width in header part and reload |
1663 TPath headerHtmlFile; |
1819 TPath headerHtmlFile; |
1664 headerHtmlFile.Copy( iHtmlFolderPath ); |
1820 headerHtmlFile.Copy( iHtmlFolderPath ); |
1665 headerHtmlFile.Append( KHeaderHtmlFile ); |
1821 headerHtmlFile.Append( KHeaderHtmlFile ); |
1666 |
1822 |
1667 TLanguage language = User::Language(); |
1823 TRAP_IGNORE( CFreestyleMessageHeaderHTML::ExportL( *iMessage, iFs, |
1668 TBidiText::TDirectionality direction = TBidiText::ScriptDirectionality( language ); |
1824 headerHtmlFile, iAppUi.ClientRect().Width(), iScrollPosition, |
1669 TRAP_IGNORE( CFreestyleMessageHeaderHTML::ExportL( *iMessage, iFs, headerHtmlFile, iAppUi.ClientRect().Width(), direction ) ) |
1825 iViewerSettings->AutoLoadImages() || iAppUi.DisplayImagesCache().Contains(*iMessage), |
|
1826 iHeaderExpanded ) ) |
1670 |
1827 |
1671 TPath emailHtmlFile; |
|
1672 emailHtmlFile.Copy( iHtmlFolderPath ); |
|
1673 emailHtmlFile.Append( KMessageHtmlFile ); |
|
1674 |
1828 |
1675 if ( direction == TBidiText::ELeftToRight ) |
1829 if(!iEventHandler->IsMenuVisible()) |
1676 { |
1830 { |
1677 emailHtmlFile.Append( KMessageHtmlFile ); |
1831 TRAP_IGNORE( ReloadPageL() ); |
1678 } |
1832 } |
1679 else |
1833 else |
1680 { |
1834 { |
1681 emailHtmlFile.Append( KMessageHtmlRTLFile ); |
1835 //Load page asynchronously after dismissing menu |
1682 } |
|
1683 |
|
1684 //Load page synchronously if menu invisible |
|
1685 if(!iEventHandler->IsMenuVisible()) |
|
1686 { |
|
1687 TRAP_IGNORE( LoadContentFromFileL( emailHtmlFile ) ); |
|
1688 SetRect( iAppUi.ClientRect() ); |
|
1689 } |
|
1690 //Load page asynchronously after dismissing menu |
|
1691 else |
|
1692 { |
|
1693 iEventHandler->DismissMenuAndReload(); |
1836 iEventHandler->DismissMenuAndReload(); |
1694 } |
1837 } |
1695 } |
1838 } |
1696 } |
1839 } |
1697 |
1840 |
1698 void CFsEmailUiHtmlViewerContainer::ReloadPageL() |
1841 void CFsEmailUiHtmlViewerContainer::ReloadPageL() |
1699 { |
1842 { |
1700 TLanguage language = User::Language(); |
1843 TRAP_IGNORE( iBrCtlInterface->HandleCommandL( ( TInt )TBrCtlDefs::ECommandIdBase + |
1701 TBidiText::TDirectionality direction = TBidiText::ScriptDirectionality( language ); |
1844 ( TInt )TBrCtlDefs::ECommandReload ) ); |
1702 TPath emailHtmlFile; |
|
1703 emailHtmlFile.Copy( iHtmlFolderPath ); |
|
1704 if( !AknLayoutUtils::LayoutMirrored() ) |
|
1705 { |
|
1706 emailHtmlFile.Append( KMessageHtmlFile ); |
|
1707 } |
|
1708 else |
|
1709 { |
|
1710 emailHtmlFile.Append( KMessageHtmlRTLFile ); |
|
1711 } |
|
1712 TRAP_IGNORE( LoadContentFromFileL( emailHtmlFile ) ); |
|
1713 SetRect( iAppUi.ClientRect() ); |
|
1714 } |
1845 } |
1715 |
1846 |
1716 void CFsEmailUiHtmlViewerContainer::ShowAttachmentDownloadStatusL( |
1847 void CFsEmailUiHtmlViewerContainer::ShowAttachmentDownloadStatusL( |
1717 TFSProgress::TFSProgressStatus aProgressStatus, |
1848 TFSProgress::TFSProgressStatus aProgressStatus, |
1718 const TAttachmentData& aAttachmentData ) |
1849 const TAttachmentData& aAttachmentData ) |
1845 TPoint bottomRight = rect.iBr; |
1993 TPoint bottomRight = rect.iBr; |
1846 |
1994 |
1847 TPoint statusTopLeft( topLeft.iX + KStatusIndicatorXMargin, bottomRight.iY - KStatusIndicatorHeight + 1 ); |
1995 TPoint statusTopLeft( topLeft.iX + KStatusIndicatorXMargin, bottomRight.iY - KStatusIndicatorHeight + 1 ); |
1848 TPoint statusBottomRight( bottomRight.iX - KStatusIndicatorXMargin, bottomRight.iY ); |
1996 TPoint statusBottomRight( bottomRight.iX - KStatusIndicatorXMargin, bottomRight.iY ); |
1849 return TRect( statusTopLeft, statusBottomRight ); |
1997 return TRect( statusTopLeft, statusBottomRight ); |
|
1998 } |
|
1999 |
|
2000 void CFsEmailUiHtmlViewerContainer::TouchFeedback() |
|
2001 { |
|
2002 iTouchFeedBack->InstantFeedback(this, ETouchFeedbackBasic); |
1850 } |
2003 } |
1851 |
2004 |
1852 /** |
2005 /** |
1853 * The body fetch link is cmail://body/fetch. Look for the URL separator |
2006 * The body fetch link is cmail://body/fetch. Look for the URL separator |
1854 * and the presence of cmail and body on the url. |
2007 * and the presence of cmail and body on the url. |
1855 * @param aUrl |
2008 * @param aUrl |
1856 * return ETrue for a valid body URL |
2009 * return ETrue for a valid body URL |
1857 */ |
2010 */ |
1858 TBool CFsEmailUiHtmlViewerContainer::IsMessageBodyURL(const TDesC& aUrl) |
2011 TBool CFsEmailUiHtmlViewerContainer::IsMessageBodyURLL(const TDesC& aUrl) |
1859 { |
2012 { |
1860 TInt index = aUrl.Find(KURLSchemeSeparator); |
2013 TInt index = aUrl.Find(KURLSchemeSeparator); |
1861 if (index == KErrNotFound) |
2014 if (index == KErrNotFound) |
1862 { |
2015 { |
1863 return EFalse; |
2016 return EFalse; |
1864 } |
2017 } |
1865 else |
2018 else |
1866 { |
2019 { |
1867 if (aUrl.Left(index).CompareF(KURLSchemeCmail) == 0) |
2020 if (aUrl.Compare(KURLLoadImages()) == 0) |
|
2021 { |
|
2022 iBrCtlInterface->HandleCommandL(TBrCtlDefs::ECommandLoadImages + TBrCtlDefs::ECommandIdBase); |
|
2023 return ETrue; |
|
2024 } |
|
2025 else if (aUrl.Compare(KURLDisplayImages()) == 0) |
|
2026 { |
|
2027 DisplayStatusIndicatorL(KStatusIndicatorAutomaticHidingDuration); |
|
2028 iAppUi.DisplayImagesCache().AddMessageL(*iMessage); |
|
2029 iBrCtlInterface->HandleCommandL(TBrCtlDefs::ECommandLoadImages + TBrCtlDefs::ECommandIdBase); |
|
2030 return ETrue; |
|
2031 } |
|
2032 else if (aUrl.Compare(KURLCollapseHeader()) == 0) |
|
2033 { |
|
2034 TouchFeedback(); |
|
2035 iHeaderExpanded = EFalse; |
|
2036 return ETrue; |
|
2037 } |
|
2038 else if (aUrl.Compare(KURLExpandHeader()) == 0) |
|
2039 { |
|
2040 TouchFeedback(); |
|
2041 iHeaderExpanded = ETrue; |
|
2042 return ETrue; |
|
2043 } |
|
2044 else if (aUrl.Left(index).CompareF(KURLSchemeCmail) == 0) |
1868 { |
2045 { |
1869 TInt bodyIndex = aUrl.Find(KURLTypeBody); |
2046 TInt bodyIndex = aUrl.Find(KURLTypeBody); |
1870 if (bodyIndex == KErrNotFound) |
2047 if (bodyIndex == KErrNotFound) |
1871 { |
2048 { |
1872 return EFalse; |
2049 return EFalse; |
2016 User::LeaveIfError( targetFile.Replace( iFs, targetFileName, EFileWrite ) ); |
2201 User::LeaveIfError( targetFile.Replace( iFs, targetFileName, EFileWrite ) ); |
2017 User::LeaveIfError( targetFile.Write( KHTMLEmptyContent ) ); |
2202 User::LeaveIfError( targetFile.Write( KHTMLEmptyContent ) ); |
2018 CleanupStack::PopAndDestroy( &targetFile ); |
2203 CleanupStack::PopAndDestroy( &targetFile ); |
2019 } |
2204 } |
2020 |
2205 |
2021 void CFsEmailUiHtmlViewerContainer::DisplayStatusIndicatorL() |
2206 void CFsEmailUiHtmlViewerContainer::DisplayStatusIndicatorL(TInt aDuration) |
2022 { |
2207 { |
2023 TRect rect = CalcAttachmentStatusRect(); |
2208 FUNC_LOG; |
|
2209 TRect rect = CalcAttachmentStatusRect(); |
2024 if(!iStatusIndicator) |
2210 if(!iStatusIndicator) |
2025 { |
2211 { |
2026 iStatusIndicator = CFreestyleEmailUiAknStatusIndicator::NewL( rect, this ); |
2212 iStatusIndicator = CFreestyleEmailUiAknStatusIndicator::NewL( rect, this ); |
2027 } |
2213 } |
2028 CFbsBitmap* image = NULL; |
2214 CFbsBitmap* image = NULL; |
2029 CFbsBitmap* imageMask = NULL; |
2215 CFbsBitmap* imageMask = NULL; |
2030 TInt duration = KStatusIndicatorDefaultDuration; |
|
2031 HBufC* statusText = NULL; |
2216 HBufC* statusText = NULL; |
2032 statusText = StringLoader::LoadL(R_FREESTYLE_EMAIL_UI_VIEWER_FETCHING_CONTENT_TEXT); |
2217 statusText = StringLoader::LoadL(R_FREESTYLE_EMAIL_UI_VIEWER_FETCHING_CONTENT_TEXT); |
2033 iAppUi.FsTextureManager()->ProvideBitmapL(EStatusTextureSynchronising, image, imageMask ); |
2218 iAppUi.FsTextureManager()->ProvideBitmapL(EStatusTextureSynchronising, image, imageMask ); |
2034 iStatusIndicator->ShowIndicatorL( image, imageMask, statusText, duration ); |
2219 iStatusIndicator->ShowIndicatorL( image, imageMask, statusText, aDuration ); |
2035 } |
2220 } |
|
2221 |