emailuis/emailui/src/FreestyleMessageHeaderHTML.cpp
branchRCL_3
changeset 61 dcf0eedfc1a3
parent 60 d620048b4810
equal deleted inserted replaced
60:d620048b4810 61:dcf0eedfc1a3
    45 
    45 
    46 _LIT( KSchemeSeparator, "://" );
    46 _LIT( KSchemeSeparator, "://" );
    47 _LIT( KUrlFormat, "<a href=\"%S\">%S</a>" );
    47 _LIT( KUrlFormat, "<a href=\"%S\">%S</a>" );
    48 _LIT( KUrlFormatWithHttp, "<a href=\"http://%S\">%S</a>" );
    48 _LIT( KUrlFormatWithHttp, "<a href=\"http://%S\">%S</a>" );
    49 
    49 
       
    50 _LIT( KEmpty, "" );
       
    51 
    50 // Define this to allow theme colorin for the header
    52 // Define this to allow theme colorin for the header
    51 #define __USE_THEME_COLOR_FOR_HEADER    
    53 #define __USE_THEME_COLOR_FOR_HEADER    
    52 
    54 
    53 EXPORT_C CFreestyleMessageHeaderHTML* CFreestyleMessageHeaderHTML::NewL( CFSMailMessage& aMailMessage, 
    55 EXPORT_C CFreestyleMessageHeaderHTML* CFreestyleMessageHeaderHTML::NewL( CFSMailMessage& aMailMessage, 
    54                                                                          RWriteStream& aWriteStream,
    56                                                                          RWriteStream& aWriteStream,
   249     _LIT( KStyleCollapse, "collapse" );
   251     _LIT( KStyleCollapse, "collapse" );
   250     _LIT( KExpandFunction, "expandHeader(true)" );
   252     _LIT( KExpandFunction, "expandHeader(true)" );
   251     _LIT( KCollapseFunction, "collapseHeader(true)" );
   253     _LIT( KCollapseFunction, "collapseHeader(true)" );
   252     _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" );
   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" );
   253     const CFSMailAddress* sender( iMailMessage.GetSender() );
   255     const CFSMailAddress* sender( iMailMessage.GetSender() );
   254     TPtrC displayName( sender->GetDisplayName() );
   256     
   255     if ( !displayName.Length() )
   257     TPtrC displayName;    
   256         {
   258     if ( sender )
   257         displayName.Set( sender->GetEmailAddress() );
   259         {
   258         }
   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     
   259     const TPtrC function( aCollapsed ? KExpandFunction() : KCollapseFunction() );
   271     const TPtrC function( aCollapsed ? KExpandFunction() : KCollapseFunction() );
   260     const TPtrC style( aCollapsed ? KStyleExpand() : KStyleCollapse() );
   272     const TPtrC style( aCollapsed ? KStyleExpand() : KStyleCollapse() );
   261     const TPtrC align(  iExportFlags.IsSet( EMirroredLayout ) ? KAlignRight() : KAlignLeft() );
   273     const TPtrC align(  iExportFlags.IsSet( EMirroredLayout ) ? KAlignRight() : KAlignLeft() );
   262     HBufC* formatBuffer = HBufC::NewLC( KSenderFormat().Length() + displayName.Length() + align.Length() + function.Length() + style.Length() );
   274     HBufC* formatBuffer = HBufC::NewLC( KSenderFormat().Length() + displayName.Length() + align.Length() + function.Length() + style.Length() );
   263     formatBuffer->Des().Format( KSenderFormat(), &align, &displayName, &function, &style );
   275     formatBuffer->Des().Format( KSenderFormat(), &align, &displayName, &function, &style );
   269 
   281 
   270 void CFreestyleMessageHeaderHTML::ExportSenderAddressTableRowL() const
   282 void CFreestyleMessageHeaderHTML::ExportSenderAddressTableRowL() const
   271     {
   283     {
   272     _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" );
   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" );
   273     const CFSMailAddress* sender( iMailMessage.GetSender() );
   285     const CFSMailAddress* sender( iMailMessage.GetSender() );
   274     const TPtrC emailAddress( sender->GetEmailAddress() );
   286 
       
   287     TPtrC emailAddress;
       
   288     if ( sender )
       
   289         {
       
   290         emailAddress.Set( sender->GetEmailAddress() );
       
   291         }
       
   292     else
       
   293         {
       
   294         emailAddress.Set( KEmpty );
       
   295         }
       
   296 
   275     const TPtrC align(  iExportFlags.IsSet( EMirroredLayout ) ? KAlignRight() : KAlignLeft() );
   297     const TPtrC align(  iExportFlags.IsSet( EMirroredLayout ) ? KAlignRight() : KAlignLeft() );
   276     HBufC* formatBuffer = HBufC::NewLC( KSenderAddressFormat().Length() + emailAddress.Length() * 2 + align.Length() );
   298     HBufC* formatBuffer = HBufC::NewLC( KSenderAddressFormat().Length() + emailAddress.Length() * 2 + align.Length() );
   277     formatBuffer->Des().Format( KSenderAddressFormat(), &align, &emailAddress, &emailAddress );
   299     formatBuffer->Des().Format( KSenderAddressFormat(), &align, &emailAddress, &emailAddress );
   278     HBufC8* utf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *formatBuffer );
   300     HBufC8* utf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *formatBuffer );
   279     CleanupStack::PushL( utf );
   301     CleanupStack::PushL( utf );