emailuis/emailui/src/FreestyleMessageHeaderHTML.cpp
branchRCL_3
changeset 24 b5fbb9b25d57
parent 19 b13141f05c3d
child 60 d620048b4810
equal deleted inserted replaced
19:b13141f05c3d 24:b5fbb9b25d57
    31 #include "FreestyleEmailUiUtilities.h"
    31 #include "FreestyleEmailUiUtilities.h"
    32 #include "ncsconstants.h"
    32 #include "ncsconstants.h"
    33 
    33 
    34 
    34 
    35 
    35 
    36 _LIT8( KShowDetailIconFileName, "plus.gif");
    36 _LIT8( KExpandHeaderIconFileName, "plus.gif");
       
    37 _LIT8( KCollapseHeaderIconFileName, "minus.gif");
    37 _LIT8( KAttachementIconGeneral, "attachment.gif");
    38 _LIT8( KAttachementIconGeneral, "attachment.gif");
    38 _LIT8( KFollowUpIconFileName, "follow_up.png");
    39 _LIT8( KFollowUpIconFileName, "follow_up.png");
    39 _LIT8( KFollowUpCompleteIconFileName, "follow_up_complete.png");
    40 _LIT8( KFollowUpCompleteIconFileName, "follow_up_complete.png");
    40 _LIT8( KPriorityHighIconFileName, "todo_high_add.png");
    41 _LIT8( KPriorityHighIconFileName, "todo_high_add.png");
    41 _LIT8( KPriorityLowIconFileName, "todo_low_add.png");
    42 _LIT8( KPriorityLowIconFileName, "todo_low_add.png");
    42 
    43 
    43 _LIT8( KHeaderTableName, "header_table");
    44 _LIT8( KCollapsedHeaderTableName, "collapsed_header" );
       
    45 _LIT8( KExpandedHeaderTableName, "expanded_header" );
    44 _LIT8( KToTableName, "to_table");
    46 _LIT8( KToTableName, "to_table");
    45 _LIT8( KCcTableName, "cc_table");
    47 _LIT8( KCcTableName, "cc_table");
    46 _LIT8( KBccTableName, "bcc_table");
    48 _LIT8( KBccTableName, "bcc_table");
    47 _LIT8( KAttachmentTableName, "attachment_table");
    49 _LIT8( KAttachmentTableName, "attachment_table");
    48 _LIT8( KFromTableName,"from_table");
    50 _LIT8( KFromTableName,"from_table");
    56 
    58 
    57 _LIT8( KToImageName, "to_img");
    59 _LIT8( KToImageName, "to_img");
    58 _LIT8( KCcImageName, "cc_img");
    60 _LIT8( KCcImageName, "cc_img");
    59 _LIT8( KBccImageName, "bcc_img");
    61 _LIT8( KBccImageName, "bcc_img");
    60 _LIT8( KAttachmentImageName, "attachment_img");
    62 _LIT8( KAttachmentImageName, "attachment_img");
    61 _LIT8( KDetailImageName, "detail_img");
       
    62 _LIT8( KFollowUpImageName, "follow_up_img");
    63 _LIT8( KFollowUpImageName, "follow_up_img");
    63 _LIT8( KFollowUpCompleteImageName, "follow_up_complete_img");
    64 _LIT8( KFollowUpCompleteImageName, "follow_up_complete_img");
    64 _LIT8( KPriorityHighImageName, "todo_high_add_img");
    65 _LIT8( KPriorityHighImageName, "todo_high_add_img");
    65 _LIT8( KPriorityLowImageName, "todo_low_add_img");
    66 _LIT8( KPriorityLowImageName, "todo_low_add_img");
    66 
    67 
    71 _LIT8( KHTMLImgTagSrcAfter, "\">" );
    72 _LIT8( KHTMLImgTagSrcAfter, "\">" );
    72 
    73 
    73 _LIT8( KMetaHeader, "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n" );
    74 _LIT8( KMetaHeader, "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n" );
    74 
    75 
    75 _LIT8( KDisplayImagesLeftToRight,
    76 _LIT8( KDisplayImagesLeftToRight,
    76         "<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\"><input type=\"submit\" class=\"button\" value=\"%S\" onClick=\"displayImagesButtonPressed()\"/></td></tr></table>" );
    77         "<script language=\"javascript\">var g_autoLoadImages = %d;</script>\n<table style=\"display: none;\" id=\"displayImagesTable\" width=\"%dpx\"><tr><td align=\"left\">%S</td><td align=\"right\"><input type=\"submit\" class=\"button\" value=\"%S\" onClick=\"displayImagesButtonPressed()\"/></td></tr></table>" );
    77 
    78 
    78 _LIT8( KDisplayImagesRightToLeft,
    79 _LIT8( KDisplayImagesRightToLeft,
    79         "<script language=\"javascript\">var g_autoLoadImages = %d;</script><table style=\"display: none;\" id=\"displayImagesTable\" width=\"%dpx\"><tr><td align=\"left\"><input type=\"submit\" class=\"button\" value=\"%S\" onClick=\"displayImagesButtonPressed()\"/></td><td align=\"right\">%S</td></tr></table>" );
    80         "<script language=\"javascript\">var g_autoLoadImages = %d;</script>\n<table style=\"display: none;\" id=\"displayImagesTable\" width=\"%dpx\"><tr><td align=\"left\"><input type=\"submit\" class=\"button\" value=\"%S\" onClick=\"displayImagesButtonPressed()\"/></td><td align=\"right\">%S</td></tr></table>" );
    80 _LIT8 ( KProtocolIdentifier, "://" );
    81 _LIT8 ( KProtocolIdentifier, "://" );
    81 const TInt KMaxEventLength( 256 );
    82 const TInt KMaxEventLength( 256 );
    82 const TInt KFreestyleMessageHeaderHTMLRightMarginInPx( 10 );
    83 const TInt KFreestyleMessageHeaderHTMLRightMarginInPx( 10 );
    83 const TInt KFreestyleMessageHeaderHTMLMaxBufferSizeForWidth( 5 );
    84 const TInt KFreestyleMessageHeaderHTMLMaxBufferSizeForWidth( 5 );
    84 
    85 
   237     }
   238     }
   238 
   239 
   239 void CFreestyleMessageHeaderHTML::ExportHTMLBodyL() const
   240 void CFreestyleMessageHeaderHTML::ExportHTMLBodyL() const
   240     {
   241     {
   241     HTMLBodyStartL();
   242     HTMLBodyStartL();
   242     ExportInitialTableL();
   243     ExportCollapsedHeaderTableL();
   243     StartHeaderTableL( KHeaderTableName );
   244     ExportExpandedHeaderTableL();
   244     ExportFromL();
       
   245     ExportToL();
       
   246     ExportCcL();
       
   247     ExportBccL();
       
   248     ExportSentTimeL();
       
   249     ExportSubjectL();
       
   250     EndHeaderTableL();
       
   251     ExportAttachmentsL();
   245     ExportAttachmentsL();
   252     ExportDisplayImagesTableL();
   246     ExportDisplayImagesTableL();
   253     HTMLBodyEndL();
   247     HTMLBodyEndL();
   254     }
   248     }
   255 
   249 
   296     iWriteStream.WriteL(scrollPos);
   290     iWriteStream.WriteL(scrollPos);
   297     iWriteStream.WriteL(_L8(")\">\n"));
   291     iWriteStream.WriteL(_L8(")\">\n"));
   298     iWriteStream.CommitL();
   292     iWriteStream.CommitL();
   299     }
   293     }
   300 
   294 
   301 void CFreestyleMessageHeaderHTML::ExportInitialTableL() const
   295 void CFreestyleMessageHeaderHTML::ExportCollapsedHeaderTableL() const
   302     {
   296     {
   303     // set the width, using the visible screen width
   297     StartHeaderTableL( KCollapsedHeaderTableName, !iExpanded );
   304     TBuf8<KFreestyleMessageHeaderHTMLMaxBufferSizeForWidth> tableWidth;
   298     ExportTimeAndExpandButtonL();
   305     tableWidth.AppendNum( iVisibleWidth );
   299     ExportSubjectCollapsedL();
   306     
   300     EndHeaderTableL();
   307     if (iExpanded)
   301     }
   308         {
   302 
   309         iWriteStream.WriteL(_L8("<table id=\"table_initial\" border=\"0\" width=\""));
   303 void CFreestyleMessageHeaderHTML::ExportExpandedHeaderTableL() const
   310         iWriteStream.WriteL( tableWidth );
   304     {
   311         iWriteStream.WriteL( _L8("px\" style=\"display: none\">\n"));    
   305     StartHeaderTableL( KExpandedHeaderTableName, iExpanded );
   312         }
   306     ExportCollapseButtonL();
   313     else
   307     ExportFromL();
   314         {
   308     ExportToL();
   315         iWriteStream.WriteL(_L8("<table id=\"table_initial\" border=\"0\" width=\""));
   309     ExportCcL();
   316         iWriteStream.WriteL( tableWidth );
   310     ExportBccL();
   317         iWriteStream.WriteL( _L8("px\">\n"));    
   311     ExportSentTimeL();
   318         }
   312     ExportSubjectL();
   319     
   313     EndHeaderTableL();
   320 
   314     }
   321     // start first row: table with the sent info and the '+' icon
   315 
   322     iWriteStream.WriteL(_L8("<tr><td><table id=\"table_sent_and_plus\" border=\"0\" width=\""));
       
   323     iWriteStream.WriteL( tableWidth );
       
   324     iWriteStream.WriteL( _L8("px\">\n"));
       
   325     
       
   326     iWriteStream.WriteL(_L8("<tr>\n"));
       
   327     
       
   328     // add Sent time and date
       
   329     iWriteStream.WriteL(_L8("<td id=\"sent_initial\""));
       
   330 
       
   331     if ( !iMirrorLayout )
       
   332         {
       
   333         iWriteStream.WriteL(_L8(" align=\"left\""));
       
   334         }
       
   335     else
       
   336         {
       
   337         iWriteStream.WriteL(_L8(" align=\"right\""));
       
   338         }
       
   339     iWriteStream.WriteL(_L8(" valign=\"bottom\">"));
       
   340     
       
   341     HBufC* dateText = TFsEmailUiUtility::DateTextFromMsgLC( &iMailMessage );
       
   342     HBufC* timeText = TFsEmailUiUtility::TimeTextFromMsgLC( &iMailMessage );
       
   343 
       
   344     TInt len = dateText->Length() + KSentLineDateAndTimeSeparatorText().Length() + timeText->Length();
       
   345     HBufC* sentTimeText = HBufC::NewLC( len );
       
   346     TPtr sentTimeTextPtr = sentTimeText->Des();
       
   347     sentTimeTextPtr.Append( *dateText );
       
   348     sentTimeTextPtr.Append( KSentLineDateAndTimeSeparatorText );
       
   349     sentTimeTextPtr.Append( *timeText );
       
   350     HBufC8* sentTimeText8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( sentTimeTextPtr );
       
   351     CleanupStack::PushL( sentTimeText8 );
       
   352     iWriteStream.WriteL( *sentTimeText8 );
       
   353     CleanupStack::PopAndDestroy( sentTimeText8 );
       
   354     CleanupStack::PopAndDestroy( sentTimeText );
       
   355     CleanupStack::PopAndDestroy( timeText );
       
   356     CleanupStack::PopAndDestroy( dateText );
       
   357     
       
   358     iWriteStream.WriteL(_L8("</td>\n"));
       
   359     
       
   360     // add "show details" image on the same line as Sent time and date
       
   361     iWriteStream.WriteL(_L8("<td width=\"1\" valign=\"top\""));
       
   362     if ( !iMirrorLayout )
       
   363         {
       
   364         iWriteStream.WriteL(_L8(" align=\"right\""));
       
   365         }
       
   366     else
       
   367         {
       
   368         iWriteStream.WriteL(_L8(" align=\"left\""));
       
   369         }
       
   370     iWriteStream.WriteL(_L8(" style=\"padding: 0px 10px 0px 0px;\"><image width=\"55\" height=\"36\" id=\"detail_img\" border=\"0\" src=\"plus.gif\" onClick=\"expandHeader(true)\" ></td>\n"));
       
   371 
       
   372     
       
   373     // finish first row
       
   374     iWriteStream.WriteL(_L8("</tr>\n"));  
       
   375     iWriteStream.WriteL(_L8("</table></td></tr>\n"));
       
   376 
       
   377     //=============================
       
   378     // start second row which contains subject
       
   379     iWriteStream.WriteL(_L8("<tr>\n"));
       
   380     iWriteStream.WriteL(_L8("<td id=\"subject_initial\""));
       
   381     if ( !iMirrorLayout )
       
   382         {
       
   383         iWriteStream.WriteL(_L8(" align=\"left\""));
       
   384         }
       
   385     else
       
   386         {
       
   387         iWriteStream.WriteL(_L8(" align=\"right\""));
       
   388         }
       
   389     iWriteStream.WriteL(_L8("><b>"));
       
   390 
       
   391 	HBufC* subject = iMailMessage.GetSubject().Alloc();
       
   392 	/*
       
   393      * Writes the subject to iWriteStream and also
       
   394      * takes care of the urls and marks them as hotspots
       
   395      */
       
   396     WriteSubjectL(*subject);
       
   397 
       
   398     iWriteStream.WriteL(_L8("</b>"));
       
   399         
       
   400     // Write icons (if necessary).
       
   401     HBufC8* followUp = HTMLHeaderFollowUpIconLC( EFalse );
       
   402     HBufC8* priority = HTMLHeaderPriorityIconLC( EFalse );
       
   403         
       
   404     if ( priority )
       
   405         {
       
   406         iWriteStream.WriteL( *priority );
       
   407         CleanupStack::PopAndDestroy( priority);
       
   408         }
       
   409     
       
   410     if ( followUp )
       
   411         {
       
   412         iWriteStream.WriteL( *followUp );
       
   413         CleanupStack::PopAndDestroy( followUp );
       
   414         }
       
   415     
       
   416     iWriteStream.WriteL(_L8("</td></tr>\n"));  // finish subject row
       
   417     
       
   418     // end table_initial
       
   419     iWriteStream.WriteL(_L8("</table>\n"));
       
   420         
       
   421     iWriteStream.CommitL();
       
   422     }
       
   423 // -----------------------------------------------------------------------------
   316 // -----------------------------------------------------------------------------
   424 // CFreestyleMessageHeaderHTML::WriteSubjectL
   317 // CFreestyleMessageHeaderHTML::WriteSubjectL
   425 // Writes the subject to iWriteStream and also
   318 // Writes the subject to iWriteStream and also
   426 // takes care of the urls and marks them as hotspots
   319 // takes care of the urls and marks them as hotspots
   427 // -----------------------------------------------------------------------------
   320 // -----------------------------------------------------------------------------
   701     }
   594     }
   702 
   595 
   703 void CFreestyleMessageHeaderHTML::HTMLBodyEndL() const
   596 void CFreestyleMessageHeaderHTML::HTMLBodyEndL() const
   704     {
   597     {
   705     iWriteStream.WriteL(_L8("</body>\n"));
   598     iWriteStream.WriteL(_L8("</body>\n"));
       
   599     iWriteStream.CommitL();
       
   600     }
       
   601 
       
   602 void CFreestyleMessageHeaderHTML::ExportCollapseButtonL() const
       
   603     {
       
   604     TBuf8<KFreestyleMessageHeaderHTMLMaxBufferSizeForWidth> tableWidth;
       
   605     tableWidth.AppendNum( iVisibleWidth );
       
   606 
       
   607     // Add "Collapse" button as its own table with its own width
       
   608     iWriteStream.WriteL( _L8("<tr><td>\n") );
       
   609     iWriteStream.WriteL( _L8("<table id =\"table_minus_icon\" border=\"0\" width=\"") );
       
   610     iWriteStream.WriteL( tableWidth );
       
   611     iWriteStream.WriteL( _L8("px\">\n") );
       
   612     iWriteStream.WriteL( _L8("<tr>\n") );
       
   613 
       
   614     iWriteStream.WriteL( _L8("<td valign=\"top\"") );
       
   615     if ( !iMirrorLayout )
       
   616         {
       
   617         iWriteStream.WriteL( _L8(" align=\"right\"") );
       
   618         iWriteStream.WriteL( _L8(" style=\"padding-right: 10px;\">\n") );
       
   619         }
       
   620     else
       
   621         {
       
   622         iWriteStream.WriteL( _L8(" align=\"left\"") );
       
   623         iWriteStream.WriteL( _L8(" style=\"padding-left: 10px;\">\n") );
       
   624         }
       
   625     iWriteStream.WriteL( _L8("<input type=\"submit\" id=\"collapse\" value=\"\" class=\"collapse\"") );
       
   626     iWriteStream.WriteL( _L8(" onClick=\"collapseHeader(true)\"/>") );
       
   627     iWriteStream.WriteL( _L8("</td>\n") );
       
   628 
       
   629     iWriteStream.WriteL( _L8("</tr>\n"));
       
   630     iWriteStream.WriteL( _L8("</table></td></tr>\n"));
       
   631     iWriteStream.CommitL();
       
   632     }
       
   633 
       
   634 void CFreestyleMessageHeaderHTML::ExportTimeAndExpandButtonL() const
       
   635     {
       
   636     // set the width, using the visible screen width
       
   637     TBuf8<KFreestyleMessageHeaderHTMLMaxBufferSizeForWidth> tableWidth;
       
   638     tableWidth.AppendNum( iVisibleWidth );
       
   639 
       
   640     // start first row: table with the sent info and the '+' icon
       
   641     iWriteStream.WriteL(_L8("<tr><td><table id=\"table_sent_and_plus\" border=\"0\" width=\""));
       
   642     iWriteStream.WriteL( tableWidth );
       
   643     iWriteStream.WriteL( _L8("px\">\n"));
       
   644     
       
   645     iWriteStream.WriteL(_L8("<tr>\n"));
       
   646     
       
   647     // add Sent time and date
       
   648     iWriteStream.WriteL(_L8("<td id=\"sent_initial\""));
       
   649 
       
   650     if ( !iMirrorLayout )
       
   651         {
       
   652         iWriteStream.WriteL(_L8(" align=\"left\""));
       
   653         }
       
   654     else
       
   655         {
       
   656         iWriteStream.WriteL(_L8(" align=\"right\""));
       
   657         }
       
   658     iWriteStream.WriteL(_L8(" valign=\"bottom\">"));
       
   659     
       
   660     HBufC* dateText = TFsEmailUiUtility::DateTextFromMsgLC( &iMailMessage );
       
   661     HBufC* timeText = TFsEmailUiUtility::TimeTextFromMsgLC( &iMailMessage );
       
   662 
       
   663     TInt len = dateText->Length() + KSentLineDateAndTimeSeparatorText().Length() + timeText->Length();
       
   664     HBufC* sentTimeText = HBufC::NewLC( len );
       
   665     TPtr sentTimeTextPtr = sentTimeText->Des();
       
   666     sentTimeTextPtr.Append( *dateText );
       
   667     sentTimeTextPtr.Append( KSentLineDateAndTimeSeparatorText );
       
   668     sentTimeTextPtr.Append( *timeText );
       
   669     HBufC8* sentTimeText8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( sentTimeTextPtr );
       
   670     CleanupStack::PushL( sentTimeText8 );
       
   671     iWriteStream.WriteL( *sentTimeText8 );
       
   672     CleanupStack::PopAndDestroy( sentTimeText8 );
       
   673     CleanupStack::PopAndDestroy( sentTimeText );
       
   674     CleanupStack::PopAndDestroy( timeText );
       
   675     CleanupStack::PopAndDestroy( dateText );
       
   676     
       
   677     iWriteStream.WriteL(_L8("</td>\n"));
       
   678 
       
   679     // Add "expand" button on the same line as Sent time and date
       
   680     iWriteStream.WriteL(_L8("<td valign=\"top\""));
       
   681     if ( !iMirrorLayout )
       
   682         {
       
   683         iWriteStream.WriteL(_L8(" align=\"right\""));
       
   684         iWriteStream.WriteL(_L8(" style=\"padding-right: 10px;\">\n"));
       
   685         }
       
   686     else
       
   687         {
       
   688         iWriteStream.WriteL(_L8(" align=\"left\""));
       
   689         iWriteStream.WriteL(_L8(" style=\"padding-left: 10px;\">\n"));
       
   690         }
       
   691     iWriteStream.WriteL(_L8("<input type=\"submit\" id=\"expand\" value=\"\" class=\"expand\""));
       
   692     iWriteStream.WriteL(_L8(" onClick=\"expandHeader(true)\"/>"));
       
   693     iWriteStream.WriteL(_L8("</td>\n"));
       
   694 
       
   695     // finish first row
       
   696     iWriteStream.WriteL(_L8("</tr>\n"));  
       
   697     iWriteStream.WriteL(_L8("</table></td></tr>\n"));
   706     iWriteStream.CommitL();
   698     iWriteStream.CommitL();
   707     }
   699     }
   708 
   700 
   709 void CFreestyleMessageHeaderHTML::ExportSubjectL() const
   701 void CFreestyleMessageHeaderHTML::ExportSubjectL() const
   710     {
   702     {
   755        }
   747        }
   756 
   748 
   757     iWriteStream.CommitL();
   749     iWriteStream.CommitL();
   758     }
   750     }
   759 
   751 
       
   752 void CFreestyleMessageHeaderHTML::ExportSubjectCollapsedL() const
       
   753     {
       
   754     iWriteStream.WriteL(_L8("<tr>\n"));
       
   755     iWriteStream.WriteL(_L8("<td id=\"subject_initial\""));
       
   756     if ( !iMirrorLayout )
       
   757         {
       
   758         iWriteStream.WriteL(_L8(" align=\"left\""));
       
   759         }
       
   760     else
       
   761         {
       
   762         iWriteStream.WriteL(_L8(" align=\"right\""));
       
   763         }
       
   764     iWriteStream.WriteL(_L8("><b>"));
       
   765 
       
   766     HBufC* subject = iMailMessage.GetSubject().Alloc();
       
   767     /*
       
   768      * Writes the subject to iWriteStream and also
       
   769      * takes care of the urls and marks them as hotspots
       
   770      */
       
   771     WriteSubjectL(*subject);
       
   772 
       
   773     iWriteStream.WriteL(_L8("</b>"));
       
   774 
       
   775     // Write icons (if necessary).
       
   776     HBufC8* followUp = HTMLHeaderFollowUpIconLC( EFalse );
       
   777     HBufC8* priority = HTMLHeaderPriorityIconLC( EFalse );
       
   778 
       
   779     if ( priority )
       
   780         {
       
   781         iWriteStream.WriteL( *priority );
       
   782         CleanupStack::PopAndDestroy( priority);
       
   783         }
       
   784 
       
   785     if ( followUp )
       
   786         {
       
   787         iWriteStream.WriteL( *followUp );
       
   788         CleanupStack::PopAndDestroy( followUp );
       
   789         }
       
   790 
       
   791     iWriteStream.WriteL(_L8("</td></tr>\n"));  // finish subject row
       
   792     iWriteStream.CommitL();
       
   793     }
       
   794 
   760 void CFreestyleMessageHeaderHTML::ExportFromL() const
   795 void CFreestyleMessageHeaderHTML::ExportFromL() const
   761     {
   796     {
   762     RPointerArray<CFSMailAddress> froms;
   797     RPointerArray<CFSMailAddress> froms;
   763     CleanupClosePushL( froms );
   798     CleanupClosePushL( froms );
   764     CFSMailAddress* from = iMailMessage.GetSender();  // ownership not transferred
   799     CFSMailAddress* from = iMailMessage.GetSender();  // ownership not transferred
  1051     {
  1086     {
  1052     iWriteStream.WriteL( _L8("<script language=\"javascript\" src=\"header.js\"></script>\n"));
  1087     iWriteStream.WriteL( _L8("<script language=\"javascript\" src=\"header.js\"></script>\n"));
  1053     iWriteStream.CommitL();
  1088     iWriteStream.CommitL();
  1054     }
  1089     }
  1055 
  1090 
  1056 void CFreestyleMessageHeaderHTML::StartHeaderTableL( const TDesC8& aTableId ) const
  1091 void CFreestyleMessageHeaderHTML::StartHeaderTableL( const TDesC8& aTableId,
       
  1092     TBool /*aVisible*/ ) const
  1057     {
  1093     {
  1058     iWriteStream.WriteL( _L8("<table id=\"") );
  1094     iWriteStream.WriteL( _L8("<table id=\"") );
  1059     iWriteStream.WriteL( aTableId );    
  1095     iWriteStream.WriteL( aTableId );
  1060     if (iExpanded)
  1096     iWriteStream.WriteL( _L8("\" border=\"0\" width=\"100%\"") );
  1061         {
  1097     iWriteStream.WriteL( _L8(">\n") );
  1062         iWriteStream.WriteL( _L8("\" border=\"0\" width=\"100%\">\n") );    
       
  1063         }
       
  1064     else
       
  1065         {
       
  1066         iWriteStream.WriteL( _L8("\" border=\"0\" width=\"100%\" style=\"display: none\">\n") );    
       
  1067         }   
       
  1068     
       
  1069     TBuf8<KFreestyleMessageHeaderHTMLMaxBufferSizeForWidth> tableWidth;
       
  1070     tableWidth.AppendNum( iVisibleWidth );
       
  1071 
       
  1072     // Add "hide details" image as its own table with its own width
       
  1073     iWriteStream.WriteL( _L8("<tr><td>\n"));
       
  1074     iWriteStream.WriteL(_L8("<table id =\"table_minus_icon\" border=\"0\" width=\""));
       
  1075     iWriteStream.WriteL( tableWidth );
       
  1076     iWriteStream.WriteL( _L8("px\">\n"));
       
  1077     iWriteStream.WriteL( _L8("<tr>\n"));
       
  1078     
       
  1079     iWriteStream.WriteL( _L8("<td valign=\"top\""));
       
  1080     if ( !iMirrorLayout )
       
  1081         {
       
  1082         iWriteStream.WriteL(_L8(" align=\"right\""));
       
  1083         }
       
  1084     else
       
  1085         {
       
  1086         iWriteStream.WriteL(_L8(" align=\"left\""));
       
  1087         }
       
  1088     iWriteStream.WriteL( _L8(" style=\"padding: 0px 10px 0px 0px;\"><image width=\"55\" height=\"36\" id=\"hideDetails_img\" border=\"0\" src=\"minus.gif\" onClick=\"collapseHeader(true)\"></td>\n"));
       
  1089 
       
  1090     iWriteStream.WriteL( _L8("</tr>\n"));
       
  1091     iWriteStream.WriteL( _L8("</table></td></tr>\n"));
       
  1092     iWriteStream.CommitL();
  1098     iWriteStream.CommitL();
  1093     }
  1099     }
  1094 
  1100 
  1095 void CFreestyleMessageHeaderHTML::EndHeaderTableL() const
  1101 void CFreestyleMessageHeaderHTML::EndHeaderTableL() const
  1096     {
  1102     {
  1106     }
  1112     }
  1107 
  1113 
  1108 void CFreestyleMessageHeaderHTML::EndTableL() const
  1114 void CFreestyleMessageHeaderHTML::EndTableL() const
  1109     {
  1115     {
  1110     iWriteStream.WriteL( _L8("</table>\n") );
  1116     iWriteStream.WriteL( _L8("</table>\n") );
  1111     iWriteStream.CommitL();
       
  1112     }
       
  1113 
       
  1114 void CFreestyleMessageHeaderHTML::AddShowDetailL() const
       
  1115     {
       
  1116     HBufC8* event = ClickImageEventL( KDetailImageName );
       
  1117     CleanupStack::PushL( event );
       
  1118     AddImageL( KDetailImageName, KShowDetailIconFileName, *event );
       
  1119     CleanupStack::PopAndDestroy( event );
       
  1120     iWriteStream.CommitL();
  1117     iWriteStream.CommitL();
  1121     }
  1118     }
  1122 
  1119 
  1123 HBufC8* CFreestyleMessageHeaderHTML::ClickImageEventL( const TDesC8& aImageName ) const
  1120 HBufC8* CFreestyleMessageHeaderHTML::ClickImageEventL( const TDesC8& aImageName ) const
  1124     {
  1121     {
  1143         {
  1140         {
  1144         event.Append( _L8("onClick=\"toggleField('") );
  1141         event.Append( _L8("onClick=\"toggleField('") );
  1145         event.Append( KBccTableName );
  1142         event.Append( KBccTableName );
  1146         event.Append( _L8("', '") );
  1143         event.Append( _L8("', '") );
  1147         event.Append( KBccImageName );
  1144         event.Append( KBccImageName );
  1148         event.Append( _L8("')\"") );
       
  1149         }
       
  1150     else if ( aImageName.Compare( KDetailImageName ) == 0 )
       
  1151         {
       
  1152         event.Append( _L8("onClick=\"toggleHeader('") );
       
  1153         event.Append( KHeaderTableName );
       
  1154         event.Append( _L8("', '") );
       
  1155         event.Append( KDetailImageName );
       
  1156         event.Append( _L8("')\"") );
  1145         event.Append( _L8("')\"") );
  1157         }
  1146         }
  1158     else if ( aImageName.Compare( KAttachmentImageName ) == 0 )
  1147     else if ( aImageName.Compare( KAttachmentImageName ) == 0 )
  1159         {
  1148         {
  1160         event.Append( _L8("onClick=\"toggleField('") );
  1149         event.Append( _L8("onClick=\"toggleField('") );
  1226     // set font size to 75% of the default size
  1215     // set font size to 75% of the default size
  1227     // because, at the default size, the header text is too big relative to the text in the email body
  1216     // because, at the default size, the header text is too big relative to the text in the email body
  1228     // Note: since the text in the body is too small at "normal" level, 
  1217     // Note: since the text in the body is too small at "normal" level, 
  1229     // we have the text size level in the browser set to "Larger" which is 20% larger than the specified size
  1218     // we have the text size level in the browser set to "Larger" which is 20% larger than the specified size
  1230     // the "larger" size affects all text which includes the header.
  1219     // the "larger" size affects all text which includes the header.
  1231     iWriteStream.WriteL( _L8("td { font-family:arial,sans-serif ; font-size:75% }\n"));
  1220     iWriteStream.WriteL( _L8("td { font-family:arial,sans-serif ; font-size:75% }\n") );
  1232     iWriteStream.WriteL( _L8(".button { background: url('btn_middle.png') repeat-x top left; border: 1px solid #546284; height: 32px; font-size:19px; font-weight: bold; color: #344a6c; font-family:arial,sans-serif; }\n") );
  1221     iWriteStream.WriteL( _L8(".button { background: url('btn_middle.png') repeat-x top left; border: 1px solid #546284; height: 32px; font-size:19px; font-weight: bold; color: #344a6c; font-family:arial,sans-serif; }\n") );
       
  1222     iWriteStream.WriteL( _L8("input { color: black; position: relative; border: 0; cursor: pointer; overflow: visible; }\n") );
       
  1223     iWriteStream.WriteL( _L8("input.expand { width: 55px; height: 36px; background: transparent url('"));
       
  1224     iWriteStream.WriteL( KExpandHeaderIconFileName );
       
  1225     iWriteStream.WriteL( _L8("') no-repeat top left; }\n") );
       
  1226     iWriteStream.WriteL( _L8("input.collapse { width: 55px; height: 36px; background: transparent url('"));
       
  1227     iWriteStream.WriteL( KCollapseHeaderIconFileName );
       
  1228     iWriteStream.WriteL( _L8("') no-repeat top left; }\n") );
  1233     iWriteStream.WriteL( _L8("</style>\n") );
  1229     iWriteStream.WriteL( _L8("</style>\n") );
  1234     iWriteStream.CommitL();
  1230     iWriteStream.CommitL();
  1235     }
  1231     }
  1236 
  1232 
  1237 void CFreestyleMessageHeaderHTML::StartDivL() const
  1233 void CFreestyleMessageHeaderHTML::StartDivL() const
  1246     iWriteStream.WriteL( _L8("</div>\n") );
  1242     iWriteStream.WriteL( _L8("</div>\n") );
  1247     iWriteStream.CommitL();
  1243     iWriteStream.CommitL();
  1248     }
  1244     }
  1249 
  1245 
  1250 
  1246 
  1251