77 _LIT( KHtmlLineBreakCRLF, "<br>\xD\xA" ); |
77 _LIT( KHtmlLineBreakCRLF, "<br>\xD\xA" ); |
78 _LIT( KHtmlLessThan, "<" ); |
78 _LIT( KHtmlLessThan, "<" ); |
79 _LIT( KHtmlGreaterThan, ">" ); |
79 _LIT( KHtmlGreaterThan, ">" ); |
80 _LIT( KHtmlAmpersand, "&" ); |
80 _LIT( KHtmlAmpersand, "&" ); |
81 _LIT( KHtmlQuotation, """ ); |
81 _LIT( KHtmlQuotation, """ ); |
82 _LIT( KHtmlLinkTag, "<a href=\"%S\">" ); |
82 // _LIT( KHtmlLinkTag, "<a href=\"%S\">" ); |
83 _LIT( KHtmlLinkTagWWW, "<a href=\"%S%S\">" ); |
83 // _LIT( KHtmlLinkTagWWW, "<a href=\"%S%S\">" ); |
84 _LIT( KHtmlLinkEndTag, "</a>" ); |
84 // _LIT( KHtmlLinkEndTag, "</a>" ); |
85 _LIT( KURLTypeBody, "body"); |
85 _LIT( KURLTypeBody, "body"); |
86 |
86 |
87 _LIT( KURLDisplayImages, "cmail://displayImages/" ); |
87 _LIT( KURLDisplayImages, "cmail://displayImages/" ); |
88 _LIT( KURLLoadImages, "cmail://loadImages/" ); |
88 _LIT( KURLLoadImages, "cmail://loadImages/" ); |
89 _LIT( KURLCollapseHeader, "cmail://collapseHeader/" ); |
89 _LIT( KURLCollapseHeader, "cmail://collapseHeader/" ); |
91 |
91 |
92 const TText KGreaterThan = 0x3e; |
92 const TText KGreaterThan = 0x3e; |
93 const TText KLessThan = 0x3c; |
93 const TText KLessThan = 0x3c; |
94 const TText KAmpersand = 0x26; |
94 const TText KAmpersand = 0x26; |
95 const TText KQuotation = 0x22; |
95 const TText KQuotation = 0x22; |
96 const TText KCharacterSpace = 0x20; |
96 // const TText KCharacterSpace = 0x20; |
97 const TText KSOH = 0x01; // Start Of Heading |
97 const TText KSOH = 0x01; // Start Of Heading |
98 const TText KCR = 0x0d; // Carriage Return |
98 // const TText KCR = 0x0d; // Carriage Return |
99 const TText KLF = 0x0a; // Line Feed |
99 const TText KLF = 0x0a; // Line Feed |
100 const TText KHT = 0x09; // Horizontal Tab |
100 // const TText KHT = 0x09; // Horizontal Tab |
101 const TText KUnicodeNewLineCharacter = 0x2028; |
101 const TText KUnicodeNewLineCharacter = 0x2028; |
102 const TText KUnicodeParagraphCharacter = 0x2029; |
102 const TText KUnicodeParagraphCharacter = 0x2029; |
103 const TReal KOverlayButtonMarginX = 0.01; // 1% |
103 const TReal KOverlayButtonMarginX = 0.01; // 1% |
104 const TReal KOverlayButtonMarginY = 0.01; // 1% |
104 const TReal KOverlayButtonMarginY = 0.01; // 1% |
105 const TReal KOverlayButtonSizeP = 0.15; // 15% |
105 const TReal KOverlayButtonSizeP = 0.15; // 15% |
1505 const TInt searhCases( CFindItemEngine::EFindItemSearchURLBin ); |
1505 const TInt searhCases( CFindItemEngine::EFindItemSearchURLBin ); |
1506 CFindItemEngine* itemEngine = CFindItemEngine::NewL( aSource, CFindItemEngine::TFindItemSearchCase( searhCases ) ); |
1506 CFindItemEngine* itemEngine = CFindItemEngine::NewL( aSource, CFindItemEngine::TFindItemSearchCase( searhCases ) ); |
1507 CleanupStack::PushL ( itemEngine ); |
1507 CleanupStack::PushL ( itemEngine ); |
1508 if ( itemEngine->ItemCount() > 0 ) |
1508 if ( itemEngine->ItemCount() > 0 ) |
1509 { |
1509 { |
1510 _LIT( KHttp, "http://" ); |
1510 _LIT( KSchemeDelimiter, "://" ); |
1511 _LIT( KUrlFormat, "<a href=\"%S\">%S</a>" ); |
1511 _LIT( KUrlFormat, "<a href=\"%S\">%S</a>" ); |
1512 _LIT( KUrlFormatWithHttp, "<a href=\"http://%S\">%S</a>" ); |
1512 _LIT( KUrlFormatWithHttp, "<a href=\"http://%S\">%S</a>" ); |
1513 |
1513 |
1514 const TInt sourceLength( aSource.Length() ); |
1514 const TInt sourceLength( aSource.Length() ); |
1515 // Allocate enough space for the final result |
1515 // Allocate enough space for the final result |
1529 for ( TBool available( itemEngine->Item( item ) ); available; available = itemEngine->NextItem( item ) ) |
1529 for ( TBool available( itemEngine->Item( item ) ); available; available = itemEngine->NextItem( item ) ) |
1530 { |
1530 { |
1531 target.Append( source.Mid( currentSourcePosition, item.iStartPos - currentSourcePosition ) ); |
1531 target.Append( source.Mid( currentSourcePosition, item.iStartPos - currentSourcePosition ) ); |
1532 const TPtrC url( source.Mid( item.iStartPos, item.iLength ) ); |
1532 const TPtrC url( source.Mid( item.iStartPos, item.iLength ) ); |
1533 TPtrC format( KUrlFormat() ); |
1533 TPtrC format( KUrlFormat() ); |
1534 if ( url.FindF( KHttp() ) == KErrNotFound ) |
1534 if ( url.FindF( KSchemeDelimiter() ) == KErrNotFound ) |
1535 { |
1535 { |
1536 format.Set( KUrlFormatWithHttp() ); |
1536 format.Set( KUrlFormatWithHttp() ); |
1537 } |
1537 } |
1538 HBufC* formatBuffer = HBufC::NewLC( format.Length() + url.Length() * 2 ); |
1538 HBufC* formatBuffer = HBufC::NewLC( format.Length() + url.Length() * 2 ); |
1539 formatBuffer->Des().Format( format, &url, &url ); |
1539 formatBuffer->Des().Format( format, &url, &url ); |