diff -r b13141f05c3d -r b5fbb9b25d57 emailuis/emailui/src/FreestyleMessageHeaderHTML.cpp --- a/emailuis/emailui/src/FreestyleMessageHeaderHTML.cpp Tue Apr 27 16:20:14 2010 +0300 +++ b/emailuis/emailui/src/FreestyleMessageHeaderHTML.cpp Tue May 11 15:57:15 2010 +0300 @@ -33,14 +33,16 @@ -_LIT8( KShowDetailIconFileName, "plus.gif"); +_LIT8( KExpandHeaderIconFileName, "plus.gif"); +_LIT8( KCollapseHeaderIconFileName, "minus.gif"); _LIT8( KAttachementIconGeneral, "attachment.gif"); _LIT8( KFollowUpIconFileName, "follow_up.png"); _LIT8( KFollowUpCompleteIconFileName, "follow_up_complete.png"); _LIT8( KPriorityHighIconFileName, "todo_high_add.png"); _LIT8( KPriorityLowIconFileName, "todo_low_add.png"); -_LIT8( KHeaderTableName, "header_table"); +_LIT8( KCollapsedHeaderTableName, "collapsed_header" ); +_LIT8( KExpandedHeaderTableName, "expanded_header" ); _LIT8( KToTableName, "to_table"); _LIT8( KCcTableName, "cc_table"); _LIT8( KBccTableName, "bcc_table"); @@ -58,7 +60,6 @@ _LIT8( KCcImageName, "cc_img"); _LIT8( KBccImageName, "bcc_img"); _LIT8( KAttachmentImageName, "attachment_img"); -_LIT8( KDetailImageName, "detail_img"); _LIT8( KFollowUpImageName, "follow_up_img"); _LIT8( KFollowUpCompleteImageName, "follow_up_complete_img"); _LIT8( KPriorityHighImageName, "todo_high_add_img"); @@ -73,10 +74,10 @@ _LIT8( KMetaHeader, "\n" ); _LIT8( KDisplayImagesLeftToRight, - "
%S
" ); + "\n
%S
" ); _LIT8( KDisplayImagesRightToLeft, - "
%S
" ); + "\n
%S
" ); _LIT8 ( KProtocolIdentifier, "://" ); const TInt KMaxEventLength( 256 ); const TInt KFreestyleMessageHeaderHTMLRightMarginInPx( 10 ); @@ -239,15 +240,8 @@ void CFreestyleMessageHeaderHTML::ExportHTMLBodyL() const { HTMLBodyStartL(); - ExportInitialTableL(); - StartHeaderTableL( KHeaderTableName ); - ExportFromL(); - ExportToL(); - ExportCcL(); - ExportBccL(); - ExportSentTimeL(); - ExportSubjectL(); - EndHeaderTableL(); + ExportCollapsedHeaderTableL(); + ExportExpandedHeaderTableL(); ExportAttachmentsL(); ExportDisplayImagesTableL(); HTMLBodyEndL(); @@ -298,128 +292,27 @@ iWriteStream.CommitL(); } -void CFreestyleMessageHeaderHTML::ExportInitialTableL() const +void CFreestyleMessageHeaderHTML::ExportCollapsedHeaderTableL() const { - // set the width, using the visible screen width - TBuf8 tableWidth; - tableWidth.AppendNum( iVisibleWidth ); - - if (iExpanded) - { - iWriteStream.WriteL(_L8("\n")); - } - else - { - iWriteStream.WriteL(_L8("
\n")); - } - - - // start first row: table with the sent info and the '+' icon - iWriteStream.WriteL(_L8("\n")); +void CFreestyleMessageHeaderHTML::ExportExpandedHeaderTableL() const + { + StartHeaderTableL( KExpandedHeaderTableName, iExpanded ); + ExportCollapseButtonL(); + ExportFromL(); + ExportToL(); + ExportCcL(); + ExportBccL(); + ExportSentTimeL(); + ExportSubjectL(); + EndHeaderTableL(); + } - //============================= - // start second row which contains subject - iWriteStream.WriteL(_L8("\n")); - iWriteStream.WriteL(_L8("\n")); // finish subject row - - // end table_initial - iWriteStream.WriteL(_L8("
\n")); - - iWriteStream.WriteL(_L8("\n")); - - // add Sent time and date - iWriteStream.WriteL(_L8("\n")); - - // add "show details" image on the same line as Sent time and date - iWriteStream.WriteL(_L8("\n")); - - - // finish first row - iWriteStream.WriteL(_L8("\n")); - iWriteStream.WriteL(_L8("
")); - - HBufC* dateText = TFsEmailUiUtility::DateTextFromMsgLC( &iMailMessage ); - HBufC* timeText = TFsEmailUiUtility::TimeTextFromMsgLC( &iMailMessage ); + StartHeaderTableL( KCollapsedHeaderTableName, !iExpanded ); + ExportTimeAndExpandButtonL(); + ExportSubjectCollapsedL(); + EndHeaderTableL(); + } - TInt len = dateText->Length() + KSentLineDateAndTimeSeparatorText().Length() + timeText->Length(); - HBufC* sentTimeText = HBufC::NewLC( len ); - TPtr sentTimeTextPtr = sentTimeText->Des(); - sentTimeTextPtr.Append( *dateText ); - sentTimeTextPtr.Append( KSentLineDateAndTimeSeparatorText ); - sentTimeTextPtr.Append( *timeText ); - HBufC8* sentTimeText8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( sentTimeTextPtr ); - CleanupStack::PushL( sentTimeText8 ); - iWriteStream.WriteL( *sentTimeText8 ); - CleanupStack::PopAndDestroy( sentTimeText8 ); - CleanupStack::PopAndDestroy( sentTimeText ); - CleanupStack::PopAndDestroy( timeText ); - CleanupStack::PopAndDestroy( dateText ); - - iWriteStream.WriteL(_L8("
")); - - HBufC* subject = iMailMessage.GetSubject().Alloc(); - /* - * Writes the subject to iWriteStream and also - * takes care of the urls and marks them as hotspots - */ - WriteSubjectL(*subject); - - iWriteStream.WriteL(_L8("")); - - // Write icons (if necessary). - HBufC8* followUp = HTMLHeaderFollowUpIconLC( EFalse ); - HBufC8* priority = HTMLHeaderPriorityIconLC( EFalse ); - - if ( priority ) - { - iWriteStream.WriteL( *priority ); - CleanupStack::PopAndDestroy( priority); - } - - if ( followUp ) - { - iWriteStream.WriteL( *followUp ); - CleanupStack::PopAndDestroy( followUp ); - } - - iWriteStream.WriteL(_L8("
\n")); - - iWriteStream.CommitL(); - } // ----------------------------------------------------------------------------- // CFreestyleMessageHeaderHTML::WriteSubjectL // Writes the subject to iWriteStream and also @@ -706,6 +599,105 @@ iWriteStream.CommitL(); } +void CFreestyleMessageHeaderHTML::ExportCollapseButtonL() const + { + TBuf8 tableWidth; + tableWidth.AppendNum( iVisibleWidth ); + + // Add "Collapse" button as its own table with its own width + iWriteStream.WriteL( _L8("\n") ); + iWriteStream.WriteL( _L8("\n") ); + iWriteStream.WriteL( _L8("\n") ); + + iWriteStream.WriteL( _L8("\n") ); + + iWriteStream.WriteL( _L8("\n")); + iWriteStream.WriteL( _L8("
\n") ); + } + else + { + iWriteStream.WriteL( _L8(" align=\"left\"") ); + iWriteStream.WriteL( _L8(" style=\"padding-left: 10px;\">\n") ); + } + iWriteStream.WriteL( _L8("") ); + iWriteStream.WriteL( _L8("
\n")); + iWriteStream.CommitL(); + } + +void CFreestyleMessageHeaderHTML::ExportTimeAndExpandButtonL() const + { + // set the width, using the visible screen width + TBuf8 tableWidth; + tableWidth.AppendNum( iVisibleWidth ); + + // start first row: table with the sent info and the '+' icon + iWriteStream.WriteL(_L8("\n")); + + iWriteStream.WriteL(_L8("\n")); + + // add Sent time and date + iWriteStream.WriteL(_L8("\n")); + + // Add "expand" button on the same line as Sent time and date + iWriteStream.WriteL(_L8("\n")); + + // finish first row + iWriteStream.WriteL(_L8("\n")); + iWriteStream.WriteL(_L8("
")); + + HBufC* dateText = TFsEmailUiUtility::DateTextFromMsgLC( &iMailMessage ); + HBufC* timeText = TFsEmailUiUtility::TimeTextFromMsgLC( &iMailMessage ); + + TInt len = dateText->Length() + KSentLineDateAndTimeSeparatorText().Length() + timeText->Length(); + HBufC* sentTimeText = HBufC::NewLC( len ); + TPtr sentTimeTextPtr = sentTimeText->Des(); + sentTimeTextPtr.Append( *dateText ); + sentTimeTextPtr.Append( KSentLineDateAndTimeSeparatorText ); + sentTimeTextPtr.Append( *timeText ); + HBufC8* sentTimeText8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( sentTimeTextPtr ); + CleanupStack::PushL( sentTimeText8 ); + iWriteStream.WriteL( *sentTimeText8 ); + CleanupStack::PopAndDestroy( sentTimeText8 ); + CleanupStack::PopAndDestroy( sentTimeText ); + CleanupStack::PopAndDestroy( timeText ); + CleanupStack::PopAndDestroy( dateText ); + + iWriteStream.WriteL(_L8("\n")); + } + else + { + iWriteStream.WriteL(_L8(" align=\"left\"")); + iWriteStream.WriteL(_L8(" style=\"padding-left: 10px;\">\n")); + } + iWriteStream.WriteL(_L8("")); + iWriteStream.WriteL(_L8("
\n")); + iWriteStream.CommitL(); + } + void CFreestyleMessageHeaderHTML::ExportSubjectL() const { iWriteStream.WriteL( _L8("\n")); + iWriteStream.WriteL(_L8("")); + + HBufC* subject = iMailMessage.GetSubject().Alloc(); + /* + * Writes the subject to iWriteStream and also + * takes care of the urls and marks them as hotspots + */ + WriteSubjectL(*subject); + + iWriteStream.WriteL(_L8("")); + + // Write icons (if necessary). + HBufC8* followUp = HTMLHeaderFollowUpIconLC( EFalse ); + HBufC8* priority = HTMLHeaderPriorityIconLC( EFalse ); + + if ( priority ) + { + iWriteStream.WriteL( *priority ); + CleanupStack::PopAndDestroy( priority); + } + + if ( followUp ) + { + iWriteStream.WriteL( *followUp ); + CleanupStack::PopAndDestroy( followUp ); + } + + iWriteStream.WriteL(_L8("\n")); // finish subject row + iWriteStream.CommitL(); + } + void CFreestyleMessageHeaderHTML::ExportFromL() const { RPointerArray froms; @@ -1053,42 +1088,13 @@ iWriteStream.CommitL(); } -void CFreestyleMessageHeaderHTML::StartHeaderTableL( const TDesC8& aTableId ) const +void CFreestyleMessageHeaderHTML::StartHeaderTableL( const TDesC8& aTableId, + TBool /*aVisible*/ ) const { iWriteStream.WriteL( _L8("\n") ); - } - else - { - iWriteStream.WriteL( _L8("\" border=\"0\" width=\"100%\" style=\"display: none\">\n") ); - } - - TBuf8 tableWidth; - tableWidth.AppendNum( iVisibleWidth ); - - // Add "hide details" image as its own table with its own width - iWriteStream.WriteL( _L8("\n")); + iWriteStream.WriteL( aTableId ); + iWriteStream.WriteL( _L8("\" border=\"0\" width=\"100%\"") ); + iWriteStream.WriteL( _L8(">\n") ); iWriteStream.CommitL(); } @@ -1111,15 +1117,6 @@ iWriteStream.CommitL(); } -void CFreestyleMessageHeaderHTML::AddShowDetailL() const - { - HBufC8* event = ClickImageEventL( KDetailImageName ); - CleanupStack::PushL( event ); - AddImageL( KDetailImageName, KShowDetailIconFileName, *event ); - CleanupStack::PopAndDestroy( event ); - iWriteStream.CommitL(); - } - HBufC8* CFreestyleMessageHeaderHTML::ClickImageEventL( const TDesC8& aImageName ) const { TBuf8 event; @@ -1147,14 +1144,6 @@ event.Append( KBccImageName ); event.Append( _L8("')\"") ); } - else if ( aImageName.Compare( KDetailImageName ) == 0 ) - { - event.Append( _L8("onClick=\"toggleHeader('") ); - event.Append( KHeaderTableName ); - event.Append( _L8("', '") ); - event.Append( KDetailImageName ); - event.Append( _L8("')\"") ); - } else if ( aImageName.Compare( KAttachmentImageName ) == 0 ) { event.Append( _L8("onClick=\"toggleField('") ); @@ -1228,8 +1217,15 @@ // Note: since the text in the body is too small at "normal" level, // we have the text size level in the browser set to "Larger" which is 20% larger than the specified size // the "larger" size affects all text which includes the header. - iWriteStream.WriteL( _L8("td { font-family:arial,sans-serif ; font-size:75% }\n")); + iWriteStream.WriteL( _L8("td { font-family:arial,sans-serif ; font-size:75% }\n") ); 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") ); + iWriteStream.WriteL( _L8("input { color: black; position: relative; border: 0; cursor: pointer; overflow: visible; }\n") ); + iWriteStream.WriteL( _L8("input.expand { width: 55px; height: 36px; background: transparent url('")); + iWriteStream.WriteL( KExpandHeaderIconFileName ); + iWriteStream.WriteL( _L8("') no-repeat top left; }\n") ); + iWriteStream.WriteL( _L8("input.collapse { width: 55px; height: 36px; background: transparent url('")); + iWriteStream.WriteL( KCollapseHeaderIconFileName ); + iWriteStream.WriteL( _L8("') no-repeat top left; }\n") ); iWriteStream.WriteL( _L8("\n") ); iWriteStream.CommitL(); } @@ -1248,4 +1244,3 @@ } -
\n")); - iWriteStream.WriteL(_L8("\n")); - iWriteStream.WriteL( _L8("\n")); - - iWriteStream.WriteL( _L8("\n")); - - iWriteStream.WriteL( _L8("\n")); - iWriteStream.WriteL( _L8("