emailuis/emailui/src/ncsutility.cpp
changeset 2 5253a20d2a1e
parent 0 8466d47a6819
child 8 e1b6206813b4
equal deleted inserted replaced
1:12c456ceeff2 2:5253a20d2a1e
    18 
    18 
    19 
    19 
    20 // INCLUDE FILES
    20 // INCLUDE FILES
    21 #include "emailtrace.h"
    21 #include "emailtrace.h"
    22 #include <StringLoader.h>
    22 #include <StringLoader.h>
       
    23 #include <AknsUtils.h>
    23 #include <AknUtils.h>
    24 #include <AknUtils.h>
    24 //<cmail>
       
    25 #include <AknsUtils.h>
       
    26 #include <AknsSkinInstance.h>
    25 #include <AknsSkinInstance.h>
    27 #include <aknbutton.h>
    26 #include <aknbutton.h>
    28 #include <eikedwin.h>
    27 #include <eikedwin.h>
    29 //</cmail>
       
    30 #include <FreestyleEmailUi.rsg>
    28 #include <FreestyleEmailUi.rsg>
    31 #include <RPbkViewResourceFile.h>
    29 #include <RPbkViewResourceFile.h>
    32 #include <CPbkContactEngine.h>
    30 #include <CPbkContactEngine.h>
    33 #include <CPbkMultipleEntryFetchDlg.h>
    31 #include <CPbkMultipleEntryFetchDlg.h>
    34 #include <CPbkContactItem.h>
    32 #include <CPbkContactItem.h>
    35 #include <AknIconUtils.h>
    33 #include <AknIconUtils.h>
    36 #include <eikimage.h>
    34 #include <eikimage.h>
    37 #include <fbs.h>
    35 #include <fbs.h>
    38 #include <flogger.h>
    36 #include <flogger.h>
    39 #include <aknenv.h>	// CAknEnv
    37 #include <aknenv.h>	// CAknEnv
    40 //<cmail>
    38 
    41 #include "CFSMailBox.h"
    39 #include "CFSMailBox.h"
    42 #include "CFSMailClient.h"
    40 #include "CFSMailClient.h"
    43 #include "CFSMailAddress.h"
    41 #include "CFSMailAddress.h"
    44 //</cmail>
    42 
    45 
       
    46 //<cmail> Platform layout changes
       
    47 #include <aknlayoutscalable_apps.cdl.h>
    43 #include <aknlayoutscalable_apps.cdl.h>
    48 #include <layoutmetadata.cdl.h>
    44 #include <layoutmetadata.cdl.h>
    49 #include <AknLayoutFont.h>
    45 #include <AknLayoutFont.h>
    50 //</cmail> Platform layout changes
       
    51 
    46 
    52 #include "ncsutility.h"
    47 #include "ncsutility.h"
    53 #include "ncsemailaddressobject.h"
    48 #include "ncsemailaddressobject.h"
    54 #include "ncsconstants.h"
    49 #include "ncsconstants.h"
    55 #include "FSDelayedLoader.h"
    50 #include "FSDelayedLoader.h"
    56 #include "FreestyleEmailUiUtilities.h"
    51 #include "FreestyleEmailUiUtilities.h"
    57 #include "FreestyleEmailUiLayoutData.h"
    52 #include "FreestyleEmailUiLayoutData.h"
    58 
    53 
    59 //<cmail>
       
    60 // CONSTANTS
    54 // CONSTANTS
    61 const TInt KFSUtilityMinColorValue = 0;
    55 const TInt KFSUtilityMinColorValue = 0;
    62 const TInt KFSUtilityMaxColorValue = 255;
    56 const TInt KFSUtilityMaxColorValue = 255;
    63 const TInt KFSUtilityThresholdColorValue = 200;
    57 const TInt KFSUtilityThresholdColorValue = 200;
    64 const TInt KFSUtilityThresholdColorMiddleValue = 127;
    58 const TInt KFSUtilityThresholdColorMiddleValue = 127;
    65 //</cmail>
       
    66 
    59 
    67 // ========================= MEMBER FUNCTIONS ==================================
    60 // ========================= MEMBER FUNCTIONS ==================================
    68 
    61 
    69 
    62 
    70 // -----------------------------------------------------------------------------
    63 // -----------------------------------------------------------------------------
    71 // NcsUtility::CompleteRelativePathL()
    64 // NcsUtility::CompleteRelativePathL()
    72 // -----------------------------------------------------------------------------
    65 // -----------------------------------------------------------------------------
    73 //
    66 //
    74 void NcsUtility::CompleteRelativePathL( const TDesC& aRelativePath, TPtr& aAbsolutePath )
    67 void NcsUtility::CompleteRelativePathL( 
       
    68         const TDesC& aRelativePath, TPtr& aAbsolutePath )
    75 	{
    69 	{
    76     FUNC_LOG;
    70     FUNC_LOG;
    77 
    71 
    78 	// + 2 is for drive letter and ":"
    72 	// + 2 is for drive letter and ":"
    79 	if( aAbsolutePath.MaxLength() < aRelativePath.Length() + 2 )
    73 	if( aAbsolutePath.MaxLength() < aRelativePath.Length() + 2 )
    93 // -----------------------------------------------------------------------------
    87 // -----------------------------------------------------------------------------
    94 // NcsUtility::GenerateFromLineToMessageBodyL()
    88 // NcsUtility::GenerateFromLineToMessageBodyL()
    95 //
    89 //
    96 // -----------------------------------------------------------------------------
    90 // -----------------------------------------------------------------------------
    97 //
    91 //
    98 HBufC* NcsUtility::GenerateFromLineToMessageBodyL( const RPointerArray<CNcsEmailAddressObject>& aFromArray )
    92 HBufC* NcsUtility::GenerateFromLineToMessageBodyL( 
       
    93         const RPointerArray<CNcsEmailAddressObject>& aFromArray )
    99 	{
    94 	{
   100     FUNC_LOG;
    95     FUNC_LOG;
   101 
    96 
   102     HBufC* buf = DoGenerateAddressLineToMessageBodyL( R_NCS_ENGINE_EMAIL_FROM, aFromArray );
    97     HBufC* buf = DoGenerateAddressLineToMessageBodyL( 
       
    98             R_NCS_ENGINE_EMAIL_FROM, aFromArray );
   103 
    99 
   104 	return buf;
   100 	return buf;
   105 	}
   101 	}
   106 
   102 
   107 // -----------------------------------------------------------------------------
   103 // -----------------------------------------------------------------------------
   252 // -----------------------------------------------------------------------------
   248 // -----------------------------------------------------------------------------
   253 // NcsUtility::CreateNcsAddressL()
   249 // NcsUtility::CreateNcsAddressL()
   254 //
   250 //
   255 // -----------------------------------------------------------------------------
   251 // -----------------------------------------------------------------------------
   256 //
   252 //
   257 CNcsEmailAddressObject* NcsUtility::CreateNcsAddressL( const CFSMailAddress& aFsAddress )
   253 CNcsEmailAddressObject* NcsUtility::CreateNcsAddressL( 
       
   254         const CFSMailAddress& aFsAddress )
   258 	{
   255 	{
   259     FUNC_LOG;
   256     FUNC_LOG;
   260 
   257 
   261 	CNcsEmailAddressObject* address = CNcsEmailAddressObject::NewL( ETrue );
   258 	CNcsEmailAddressObject* address = CNcsEmailAddressObject::NewL( ETrue );
   262 	CleanupStack::PushL( address );
   259 	CleanupStack::PushL( address );
   280 // -----------------------------------------------------------------------------
   277 // -----------------------------------------------------------------------------
   281 // NcsUtility::CreateFsAddressL()
   278 // NcsUtility::CreateFsAddressL()
   282 // Caller takes the ownership of the returned address object
   279 // Caller takes the ownership of the returned address object
   283 // -----------------------------------------------------------------------------
   280 // -----------------------------------------------------------------------------
   284 //
   281 //
   285 CFSMailAddress* NcsUtility::CreateFsAddressL( const CNcsEmailAddressObject& aNcsAddress )
   282 CFSMailAddress* NcsUtility::CreateFsAddressL( 
       
   283         const CNcsEmailAddressObject& aNcsAddress )
   286 	{
   284 	{
   287     FUNC_LOG;
   285     FUNC_LOG;
   288 
   286 
   289 	CFSMailAddress* address = CFSMailAddress::NewL();
   287 	CFSMailAddress* address = CFSMailAddress::NewL();
   290 	address->SetEmailAddress( aNcsAddress.EmailAddress() );
   288 	address->SetEmailAddress( aNcsAddress.EmailAddress() );
   297 // -----------------------------------------------------------------------------
   295 // -----------------------------------------------------------------------------
   298 // NcsUtility::FormatSubjectLineL()
   296 // NcsUtility::FormatSubjectLineL()
   299 //
   297 //
   300 // -----------------------------------------------------------------------------
   298 // -----------------------------------------------------------------------------
   301 //
   299 //
   302 HBufC* NcsUtility::FormatSubjectLineL( const TDesC& aNewSubjectLine, const TDesC& aPrefix )
   300 HBufC* NcsUtility::FormatSubjectLineL( 
       
   301         const TDesC& aNewSubjectLine, const TDesC& aPrefix )
   303 	{
   302 	{
   304     FUNC_LOG;
   303     FUNC_LOG;
   305 
   304 
   306 	HBufC* formattedSubjectLine = aNewSubjectLine.AllocLC();
   305 	HBufC* formattedSubjectLine = aNewSubjectLine.AllocLC();
   307 	HBufC* prefix = aPrefix.AllocLC();
   306 	HBufC* prefix = aPrefix.AllocLC();
   323 		}
   322 		}
   324 	while( index != KErrNotFound );
   323 	while( index != KErrNotFound );
   325 
   324 
   326 	formattedSubjectLinePtr.Trim();
   325 	formattedSubjectLinePtr.Trim();
   327 
   326 
   328 	HBufC* finalSubject = HBufC::NewL( formattedSubjectLinePtr.Length() + prefixPtr.Length() + KSpace().Length() );
   327 	HBufC* finalSubject = HBufC::NewL( 
       
   328 	        formattedSubjectLinePtr.Length() + prefixPtr.Length() + 
       
   329 	        KSpace().Length() );
   329 	TPtr ptr = finalSubject->Des();
   330 	TPtr ptr = finalSubject->Des();
   330 	if ( AknLayoutUtils::LayoutMirrored() )
   331 	if ( AknLayoutUtils::LayoutMirrored() )
   331 		{
   332 		{
   332 		ptr.Append( formattedSubjectLinePtr );
   333 		ptr.Append( formattedSubjectLinePtr );
   333 		ptr.Append( KSpace );
   334 		ptr.Append( KSpace );
   349 // -----------------------------------------------------------------------------
   350 // -----------------------------------------------------------------------------
   350 // NcsUtility::ConvertAddressArrayL()
   351 // NcsUtility::ConvertAddressArrayL()
   351 //
   352 //
   352 // -----------------------------------------------------------------------------
   353 // -----------------------------------------------------------------------------
   353 //
   354 //
   354 void NcsUtility::ConvertAddressArrayL( const RPointerArray<CFSMailAddress>& aSrc, RPointerArray<CNcsEmailAddressObject>& aDst )
   355 void NcsUtility::ConvertAddressArrayL( 
       
   356         const RPointerArray<CFSMailAddress>& aSrc, 
       
   357         RPointerArray<CNcsEmailAddressObject>& aDst )
   355 	{
   358 	{
   356     FUNC_LOG;
   359     FUNC_LOG;
   357 
   360 
   358  	for ( TInt i=0; i<aSrc.Count(); i++ )
   361  	for ( TInt i=0; i<aSrc.Count(); i++ )
   359  		{
   362  		{
   360 		CNcsEmailAddressObject* ncsRecipient = NcsUtility::CreateNcsAddressL( *aSrc[i] );
   363 		CNcsEmailAddressObject* ncsRecipient = 
       
   364             NcsUtility::CreateNcsAddressL( *aSrc[i] );
   361 		CleanupStack::PushL( ncsRecipient );
   365 		CleanupStack::PushL( ncsRecipient );
   362 		aDst.AppendL( ncsRecipient );
   366 		aDst.AppendL( ncsRecipient );
   363 		CleanupStack::Pop( ncsRecipient );
   367 		CleanupStack::Pop( ncsRecipient );
   364  		}
   368  		}
   365 
   369 
   368 // -----------------------------------------------------------------------------
   372 // -----------------------------------------------------------------------------
   369 // NcsUtility::ConvertAddressArrayL()
   373 // NcsUtility::ConvertAddressArrayL()
   370 // Caller takes the ownership of address objects pointoed in the array aDst.
   374 // Caller takes the ownership of address objects pointoed in the array aDst.
   371 // -----------------------------------------------------------------------------
   375 // -----------------------------------------------------------------------------
   372 //
   376 //
   373 void NcsUtility::ConvertAddressArrayL( const RPointerArray<CNcsEmailAddressObject>& aSrc, RPointerArray<CFSMailAddress>& aDst )
   377 void NcsUtility::ConvertAddressArrayL( 
       
   378         const RPointerArray<CNcsEmailAddressObject>& aSrc, 
       
   379         RPointerArray<CFSMailAddress>& aDst )
   374 	{
   380 	{
   375     FUNC_LOG;
   381     FUNC_LOG;
   376 
   382 
   377  	for ( TInt i=0; i<aSrc.Count(); i++ )
   383  	for ( TInt i=0; i<aSrc.Count(); i++ )
   378  		{
   384  		{
   379 		CFSMailAddress* fsRecipient = NcsUtility::CreateFsAddressL( *aSrc[i] );
   385 		CFSMailAddress* fsRecipient = 
       
   386             NcsUtility::CreateFsAddressL( *aSrc[i] );
   380 		CleanupStack::PushL( fsRecipient );
   387 		CleanupStack::PushL( fsRecipient );
   381 		aDst.AppendL( fsRecipient );
   388 		aDst.AppendL( fsRecipient );
   382 		CleanupStack::Pop( fsRecipient );
   389 		CleanupStack::Pop( fsRecipient );
   383  		}
   390  		}
   384 
   391 
   389 // -----------------------------------------------------------------------------
   396 // -----------------------------------------------------------------------------
   390 // NcsUtility::LoadScalableIconL()
   397 // NcsUtility::LoadScalableIconL()
   391 //
   398 //
   392 // -----------------------------------------------------------------------------
   399 // -----------------------------------------------------------------------------
   393 //
   400 //
   394 void NcsUtility::LoadScalableIconL( const TDesC& aMifRelativeFileName, TInt aImgId, TInt aMaskId, CEikImage*& aIcon, CFbsBitmap*& aImage, CFbsBitmap*& aMask )
   401 void NcsUtility::LoadScalableIconL( 
       
   402         const TDesC& aMifRelativeFileName, TInt aImgId, 
       
   403         TInt aMaskId, CEikImage*& aIcon, 
       
   404         CFbsBitmap*& aImage, CFbsBitmap*& aMask )
   395     {
   405     {
   396     FUNC_LOG;
   406     FUNC_LOG;
   397 
   407 
   398 	HBufC* buf = HBufC::NewLC( KMaxFileName );
   408 	HBufC* buf = HBufC::NewLC( KMaxFileName );
   399 	TPtr ptr = buf->Des();
   409 	TPtr ptr = buf->Des();
   440 
   450 
   441 // -----------------------------------------------------------------------------
   451 // -----------------------------------------------------------------------------
   442 // NcsUtility::IsEqualAddressArray
   452 // NcsUtility::IsEqualAddressArray
   443 // -----------------------------------------------------------------------------
   453 // -----------------------------------------------------------------------------
   444 //
   454 //
   445 TBool NcsUtility::IsEqualAddressArray( const RPointerArray<CFSMailAddress>& aAddresses1,
   455 TBool NcsUtility::IsEqualAddressArray( 
   446                                         const RPointerArray<CFSMailAddress>& aAddresses2 )
   456         const RPointerArray<CFSMailAddress>& aAddresses1,
       
   457         const RPointerArray<CFSMailAddress>& aAddresses2 )
   447 	{
   458 	{
   448     FUNC_LOG;
   459     FUNC_LOG;
   449 
   460 
   450 	if ( aAddresses1.Count() != aAddresses2.Count() )
   461 	if ( aAddresses1.Count() != aAddresses2.Count() )
   451 		{
   462 		{
   452 		return EFalse;
   463 		return EFalse;
   453 		}
   464 		}
   454     for ( TInt i=0; i<aAddresses1.Count(); i++ )
   465     for ( TInt i=0; i<aAddresses1.Count(); i++ )
   455     	{
   466     	{
   456     	if ( aAddresses1[i]->GetEmailAddress().Compare( aAddresses2[i]->GetEmailAddress() ) != 0 )
   467     	if ( aAddresses1[i]->GetEmailAddress().Compare( 
       
   468     	        aAddresses2[i]->GetEmailAddress() ) != 0 )
   457     		{
   469     		{
   458     		return EFalse;
   470     		return EFalse;
   459     		}
   471     		}
   460     	if ( aAddresses1[i]->GetDisplayName().Compare( aAddresses2[i]->GetDisplayName() ) != 0 )
   472     	if ( aAddresses1[i]->GetDisplayName().Compare( 
       
   473     	        aAddresses2[i]->GetDisplayName() ) != 0 )
   461     		{
   474     		{
   462     		return EFalse;
   475     		return EFalse;
   463     		}
   476     		}
   464     	}
   477     	}
   465 
   478 
   501 			ms.iAifHeight = KAifHeightSmall;
   514 			ms.iAifHeight = KAifHeightSmall;
   502 			ms.iAifLabelMarginVertical = KAifLabelMarginVerticalSmall;
   515 			ms.iAifLabelMarginVertical = KAifLabelMarginVerticalSmall;
   503 			ms.iAifEditorMarginVertical = KAifEditorMarginVerticalSmall;
   516 			ms.iAifEditorMarginVertical = KAifEditorMarginVerticalSmall;
   504 			ms.iAifEditorHeight = KAifEditorHeightSmall;
   517 			ms.iAifEditorHeight = KAifEditorHeightSmall;
   505 			ms.iSubjectExtraHeightBottom = KSubjectExtraHeightBottomSmall;
   518 			ms.iSubjectExtraHeightBottom = KSubjectExtraHeightBottomSmall;
   506 			ms.iAttachmentExtraHeightBottom = KAttachmentExtraHeightBottomSmall;
   519 			ms.iAttachmentExtraHeightBottom = 
       
   520                 KAttachmentExtraHeightBottomSmall;
   507 			ms.iIconMarginPriorityVertical = KIconMarginPriorityVerticalSmall;
   521 			ms.iIconMarginPriorityVertical = KIconMarginPriorityVerticalSmall;
   508 			ms.iIconMarginFollowUpVertical = KIconMarginFollowUpVerticalSmall;
   522 			ms.iIconMarginFollowUpVertical = KIconMarginFollowUpVerticalSmall;
   509             ms.iIconMarginAttachmentVertical = KIconMarginAttachmentVerticalSmall;
   523             ms.iIconMarginAttachmentVertical = 
       
   524                 KIconMarginAttachmentVerticalSmall;
   510 			ms.iLabelFontHeightPx = KLabelFontHeightPxSmall;
   525 			ms.iLabelFontHeightPx = KLabelFontHeightPxSmall;
   511 			ms.iEditorFontHeightPx = KEditorFontHeightPxSmall;
   526 			ms.iEditorFontHeightPx = KEditorFontHeightPxSmall;
   512 			}
   527 			}
   513             break;
   528             break;
   514 		case EAknUiZoomLarge: case EAknUiZoomVeryLarge:
   529 		case EAknUiZoomLarge: case EAknUiZoomVeryLarge:
   516 			ms.iAifHeight = KAifHeightLarge;
   531 			ms.iAifHeight = KAifHeightLarge;
   517 			ms.iAifLabelMarginVertical = KAifLabelMarginVerticalLarge;
   532 			ms.iAifLabelMarginVertical = KAifLabelMarginVerticalLarge;
   518 			ms.iAifEditorMarginVertical = KAifEditorMarginVerticalLarge;
   533 			ms.iAifEditorMarginVertical = KAifEditorMarginVerticalLarge;
   519 			ms.iAifEditorHeight = KAifEditorHeightLarge;
   534 			ms.iAifEditorHeight = KAifEditorHeightLarge;
   520 			ms.iSubjectExtraHeightBottom = KSubjectExtraHeightBottomLarge;
   535 			ms.iSubjectExtraHeightBottom = KSubjectExtraHeightBottomLarge;
   521 			ms.iAttachmentExtraHeightBottom = KAttachmentExtraHeightBottomLarge;
   536 			ms.iAttachmentExtraHeightBottom = 
       
   537                 KAttachmentExtraHeightBottomLarge;
   522 			ms.iIconMarginPriorityVertical = KIconMarginPriorityVerticalLarge;
   538 			ms.iIconMarginPriorityVertical = KIconMarginPriorityVerticalLarge;
   523 			ms.iIconMarginFollowUpVertical = KIconMarginFollowUpVerticalLarge;
   539 			ms.iIconMarginFollowUpVertical = KIconMarginFollowUpVerticalLarge;
   524             ms.iIconMarginAttachmentVertical = KIconMarginAttachmentVerticalLarge;
   540             ms.iIconMarginAttachmentVertical = 
       
   541                 KIconMarginAttachmentVerticalLarge;
   525 			ms.iLabelFontHeightPx = KLabelFontHeightPxLarge;
   542 			ms.iLabelFontHeightPx = KLabelFontHeightPxLarge;
   526 			ms.iEditorFontHeightPx = KEditorFontHeightPxLarge;
   543 			ms.iEditorFontHeightPx = KEditorFontHeightPxLarge;
   527 			}
   544 			}
   528             break;
   545             break;
   529 		}
   546 		}
   539 	{
   556 	{
   540     FUNC_LOG;
   557     FUNC_LOG;
   541 
   558 
   542 	// Base the font on logical font passed to us
   559 	// Base the font on logical font passed to us
   543 	const CFont* logicalFont = AknLayoutUtils::FontFromId( aLogicalFontId );
   560 	const CFont* logicalFont = AknLayoutUtils::FontFromId( aLogicalFontId );
   544 	// Note: This font is owned by the application's system font array (where it
   561 	// Note: This font is owned by the application's system font array (where
   545 	// is likely already to have been created) and does not need to be
   562 	// it is likely already to have been created) and does not need to be
   546 	// released. It can just go out of scope.
   563 	// released. It can just go out of scope.
   547 
   564 
   548 	// Extract font information
   565 	// Extract font information
   549 	TFontSpec fontSpec = logicalFont->FontSpecInTwips();
   566 	TFontSpec fontSpec = logicalFont->FontSpecInTwips();
   550 
   567 
   568 // <cmail> Platform layout change
   585 // <cmail> Platform layout change
   569 // -----------------------------------------------------------------------------
   586 // -----------------------------------------------------------------------------
   570 // NcsUtility::GetLayoutFont
   587 // NcsUtility::GetLayoutFont
   571 // -----------------------------------------------------------------------------
   588 // -----------------------------------------------------------------------------
   572 //
   589 //
   573 const CFont* NcsUtility::GetLayoutFont(const TRect& aParent, TNcsLayoutFont aUsage )
   590 const CFont* NcsUtility::GetLayoutFont(
       
   591         const TRect& aParent, TNcsLayoutFont aUsage )
   574     {
   592     {
   575     FUNC_LOG;
   593     FUNC_LOG;
   576     TAknLayoutText layoutText;
   594     TAknLayoutText layoutText;
   577     switch (aUsage)
   595     switch (aUsage)
   578         {
   596         {
   727         }
   745         }
   728     msgIds.Close();
   746     msgIds.Close();
   729     return error;
   747     return error;
   730     }
   748     }
   731 
   749 
   732 // <cmail> Platform layout changes
       
   733 // -----------------------------------------------------------------------------
   750 // -----------------------------------------------------------------------------
   734 // NcsUtility::HeaderCaptionPaneRect
   751 // NcsUtility::HeaderCaptionPaneRect
   735 // -----------------------------------------------------------------------------
   752 // -----------------------------------------------------------------------------
   736 //
   753 //
   737 TRect NcsUtility::HeaderCaptionPaneRect( const TRect& aParent )
   754 TRect NcsUtility::HeaderCaptionPaneRect( const TRect& aParent )
   744 
   761 
   745 // -----------------------------------------------------------------------------
   762 // -----------------------------------------------------------------------------
   746 // NcsUtility::HeaderDetailPaneRect
   763 // NcsUtility::HeaderDetailPaneRect
   747 // -----------------------------------------------------------------------------
   764 // -----------------------------------------------------------------------------
   748 //
   765 //
   749 TRect NcsUtility::HeaderDetailPaneRect( const TRect& aParent, const TInt aRows, TBool aSameRow )
   766 TRect NcsUtility::HeaderDetailPaneRect( 
       
   767         const TRect& aParent, const TInt aRows, TBool aSameRow )
   750     {
   768     {
   751     FUNC_LOG;
   769     FUNC_LOG;
   752     const TInt variety( aRows == 1 ? 0 : 1 );
   770     const TInt variety( aRows == 1 ? 0 : 1 );
   753     TAknLayoutRect headerDetailPaneRect;
   771     TAknLayoutRect headerDetailPaneRect;
   754     headerDetailPaneRect.LayoutRect( aParent, AknLayoutScalable_Apps::list_single_cmail_header_detail_pane( variety ) );
   772     headerDetailPaneRect.LayoutRect( aParent, AknLayoutScalable_Apps::list_single_cmail_header_detail_pane( variety ) );
   762 
   780 
   763 // -----------------------------------------------------------------------------
   781 // -----------------------------------------------------------------------------
   764 // NcsUtility::HeaderDetailIconRect
   782 // NcsUtility::HeaderDetailIconRect
   765 // -----------------------------------------------------------------------------
   783 // -----------------------------------------------------------------------------
   766 //
   784 //
   767 TRect NcsUtility::HeaderDetailIconRect( const TRect& aParent, const TInt aRows, const THeaderDetailIcon aIcon )
   785 TRect NcsUtility::HeaderDetailIconRect( 
       
   786         const TRect& aParent, const TInt aRows, const THeaderDetailIcon aIcon )
   768     {
   787     {
   769     FUNC_LOG;
   788     FUNC_LOG;
   770     const TInt variety( aRows == 1 ? 0 : 1 );
   789     const TInt variety( aRows == 1 ? 0 : 1 );
   771     TAknLayoutRect headerIconRect;
   790     TAknLayoutRect headerIconRect;
   772     headerIconRect.LayoutRect( aParent,
   791     headerIconRect.LayoutRect( aParent,
   814     TAknLayoutRect listCmailPaneRect;
   833     TAknLayoutRect listCmailPaneRect;
   815     listCmailPaneRect.LayoutRect( aParent, AknLayoutScalable_Apps::sp_fs_scroll_pane_cp03() );
   834     listCmailPaneRect.LayoutRect( aParent, AknLayoutScalable_Apps::sp_fs_scroll_pane_cp03() );
   816     return listCmailPaneRect.Rect();
   835     return listCmailPaneRect.Rect();
   817     }
   836     }
   818 
   837 
   819 //<cmail>
       
   820 // -----------------------------------------------------------------------------
   838 // -----------------------------------------------------------------------------
   821 // NcsUtility::SeparatorSizeInThisResolution
   839 // NcsUtility::SeparatorSizeInThisResolution
   822 //
   840 //
   823 // Returns size of empty space between header and message body
   841 // Returns size of empty space between header and message body
   824 // -----------------------------------------------------------------------------
   842 // -----------------------------------------------------------------------------
   892     layoutRect.LayoutRect( cmailPaneRect, AknLayoutScalable_Apps::list_single_cmail_header_caption_pane() );
   910     layoutRect.LayoutRect( cmailPaneRect, AknLayoutScalable_Apps::list_single_cmail_header_caption_pane() );
   893     TAknLayoutText captionTextRect;
   911     TAknLayoutText captionTextRect;
   894     captionTextRect.LayoutText( layoutRect.Rect(), AknLayoutScalable_Apps::list_single_cmail_header_caption_pane_t1() );
   912     captionTextRect.LayoutText( layoutRect.Rect(), AknLayoutScalable_Apps::list_single_cmail_header_caption_pane_t1() );
   895     return Abs( cmailPaneRect.iBr.iX - captionTextRect.TextRect().iBr.iX );
   913     return Abs( cmailPaneRect.iBr.iX - captionTextRect.TextRect().iBr.iX );
   896     }
   914     }
   897 //</cmail>
       
   898 
   915 
   899 // -----------------------------------------------------------------------------
   916 // -----------------------------------------------------------------------------
   900 // NcsUtility::ListCmailBodyPaneRect
   917 // NcsUtility::ListCmailBodyPaneRect
   901 // -----------------------------------------------------------------------------
   918 // -----------------------------------------------------------------------------
   902 //
   919 //
   913 // -----------------------------------------------------------------------------
   930 // -----------------------------------------------------------------------------
   914 //
   931 //
   915 void NcsUtility::LayoutCaptionLabel( CEikLabel* aLabel, const TRect& aParentRect )
   932 void NcsUtility::LayoutCaptionLabel( CEikLabel* aLabel, const TRect& aParentRect )
   916     {
   933     {
   917     FUNC_LOG;
   934     FUNC_LOG;
   918     AknLayoutUtils::LayoutLabel( aLabel, NcsUtility::HeaderCaptionPaneRect( aParentRect ), AknLayoutScalable_Apps::list_single_cmail_header_caption_pane_t1().LayoutLine() );
   935     AknLayoutUtils::LayoutLabel( 
       
   936             aLabel, NcsUtility::HeaderCaptionPaneRect( aParentRect ), 
       
   937             AknLayoutScalable_Apps::list_single_cmail_header_caption_pane_t1().LayoutLine() );
   919     }
   938     }
   920 
   939 
   921 // -----------------------------------------------------------------------------
   940 // -----------------------------------------------------------------------------
   922 // NcsUtility::LayoutCaptionLabel
   941 // NcsUtility::LayoutCaptionLabel
   923 // -----------------------------------------------------------------------------
   942 // -----------------------------------------------------------------------------
   924 //
   943 //
   925 void NcsUtility::LayoutCaptionButton( CAknButton* aButton, const TRect& aParentRect)
   944 void NcsUtility::LayoutCaptionButton( 
       
   945         CAknButton* aButton, const TRect& aParentRect)
   926     {
   946     {
   927     FUNC_LOG;
   947     FUNC_LOG;
   928     TAknLayoutText layoutText;
   948     TAknLayoutText layoutText;
   929     
   949     
   930     const TInt labelVariety = 2;
   950     const TInt labelVariety = 2;
   935     TInt fontId;
   955     TInt fontId;
   936     TInt topMargin;
   956     TInt topMargin;
   937     TInt bottomMargin;
   957     TInt bottomMargin;
   938     
   958     
   939     // Getting editor's top and bottom margin from its layout
   959     // Getting editor's top and bottom margin from its layout
   940     textComponentLayout = AknLayoutScalable_Apps::list_single_cmail_header_detail_pane_t1(
   960     textComponentLayout = 
       
   961         AknLayoutScalable_Apps::list_single_cmail_header_detail_pane_t1(
   941             KHeaderDetailTextPaneVariety );
   962             KHeaderDetailTextPaneVariety );
   942     fontId = textComponentLayout.LayoutLine().FontId();
   963     fontId = textComponentLayout.LayoutLine().FontId();
   943     
   964     
   944     TAknTextDecorationMetrics metrics( fontId );
   965     TAknTextDecorationMetrics metrics( fontId );
   945     metrics.GetTopAndBottomMargins( topMargin, bottomMargin );
   966     metrics.GetTopAndBottomMargins( topMargin, bottomMargin );
   946     
   967     
   947     layoutRect.LayoutRect(
   968     layoutRect.LayoutRect(
   948         HeaderDetailPaneRect( aParentRect, 1, ETrue ),
   969         HeaderDetailPaneRect( aParentRect, 1, ETrue ),
   949         AknLayoutScalable_Apps::bg_button_pane_cp12() );
   970         AknLayoutScalable_Apps::bg_button_pane_cp12() );
   950     
   971     
   951     textComponentLayout = AknLayoutScalable_Apps::list_single_cmail_header_detail_pane_t2( labelVariety );
   972     textComponentLayout = 
       
   973         AknLayoutScalable_Apps::list_single_cmail_header_detail_pane_t2( 
       
   974                 labelVariety );
   952     layoutText.LayoutText(
   975     layoutText.LayoutText(
   953         HeaderDetailPaneRect( aParentRect, 1, ETrue ),
   976         HeaderDetailPaneRect( aParentRect, 1, ETrue ),
   954         textComponentLayout.LayoutLine() );
   977         textComponentLayout.LayoutLine() );
   955     
   978     
   956     rect = layoutRect.Rect();
   979     rect = layoutRect.Rect();
   965 
   988 
   966 // -----------------------------------------------------------------------------
   989 // -----------------------------------------------------------------------------
   967 // NcsUtility::LayoutDetailLabel
   990 // NcsUtility::LayoutDetailLabel
   968 // -----------------------------------------------------------------------------
   991 // -----------------------------------------------------------------------------
   969 //
   992 //
   970 void NcsUtility::LayoutDetailLabel( CEikLabel* aLabel, const TRect& aParentRect )
   993 void NcsUtility::LayoutDetailLabel( 
   971     {
   994         CEikLabel* aLabel, const TRect& aParentRect, TInt aRow)
   972     FUNC_LOG;
   995     {
   973     AknLayoutUtils::LayoutLabel( aLabel, NcsUtility::HeaderDetailPaneRect( aParentRect, 1, ETrue ), AknLayoutScalable_Apps::list_single_cmail_header_detail_pane_t1( 0 ).LayoutLine() );
   996     FUNC_LOG;
       
   997     TRect rect( NcsUtility::HeaderDetailPaneRect( aParentRect, 1, ETrue ) );
       
   998     rect.Move( 0, aRow*rect.Height() );
       
   999     AknLayoutUtils::LayoutLabel( aLabel, rect, AknLayoutScalable_Apps::list_single_cmail_header_detail_pane_t1( 0 ).LayoutLine() );
   974     }
  1000     }
   975 
  1001 
   976 // -----------------------------------------------------------------------------
  1002 // -----------------------------------------------------------------------------
   977 // NcsUtility::LayoutDetailEdwin
  1003 // NcsUtility::LayoutDetailEdwin
   978 // -----------------------------------------------------------------------------
  1004 // -----------------------------------------------------------------------------
   979 //
  1005 //
   980 void NcsUtility::LayoutDetailEdwin( CEikEdwin* aEdwin, const TRect& aParentRect, const TInt aLineCount, const TBool aBackIcon  )
  1006 void NcsUtility::LayoutDetailEdwin( 
       
  1007         CEikEdwin* aEdwin, const TRect& aParentRect, 
       
  1008         const TInt aLineCount, const TBool aBackIcon )
   981     {
  1009     {
   982     FUNC_LOG;
  1010     FUNC_LOG;
   983     TAknMultiLineTextLayout edwinLayout;
  1011     TAknMultiLineTextLayout edwinLayout;
   984     const TInt textPaneVariety( aBackIcon ? 1 : 3 );
  1012     const TInt textPaneVariety( aBackIcon ? 1 : 3 );
   985     TAknTextComponentLayout textLayout( AknLayoutScalable_Apps::list_single_cmail_header_detail_pane_t1( textPaneVariety ) );
  1013     TAknTextComponentLayout textLayout( AknLayoutScalable_Apps::list_single_cmail_header_detail_pane_t1( textPaneVariety ) );
   997 
  1025 
   998 // -----------------------------------------------------------------------------
  1026 // -----------------------------------------------------------------------------
   999 // NcsUtility::LayoutDetailEdwin
  1027 // NcsUtility::LayoutDetailEdwin
  1000 // -----------------------------------------------------------------------------
  1028 // -----------------------------------------------------------------------------
  1001 //
  1029 //
  1002 void NcsUtility::LayoutDetailEdwinTouch( CEikEdwin* aEdwin, const TRect& aParentRect,
  1030 void NcsUtility::LayoutDetailEdwinTouch( 
  1003                                          const TInt aLineCount, const TBool /*aBackIcon*/  )
  1031         CEikEdwin* aEdwin, const TRect& aParentRect,
       
  1032         const TInt aLineCount, const TBool /*aBackIcon*/  )
  1004     {
  1033     {
  1005     FUNC_LOG;
  1034     FUNC_LOG;
  1006     TAknMultiLineTextLayout edwinLayout;
  1035     TAknMultiLineTextLayout edwinLayout;
  1007     TAknTextComponentLayout textLayout( AknLayoutScalable_Apps::list_single_cmail_header_detail_pane_t1( KHeaderDetailTextPaneVariety ) );
  1036     TAknTextComponentLayout textLayout( AknLayoutScalable_Apps::list_single_cmail_header_detail_pane_t1( KHeaderDetailTextPaneVariety ) );
  1008     RArray< TAknTextComponentLayout > edwinLayoutLines;
  1037     RArray< TAknTextComponentLayout > edwinLayoutLines;
  1019 
  1048 
  1020 // -----------------------------------------------------------------------------
  1049 // -----------------------------------------------------------------------------
  1021 // NcsUtility::HeaderControlPosition
  1050 // NcsUtility::HeaderControlPosition
  1022 // -----------------------------------------------------------------------------
  1051 // -----------------------------------------------------------------------------
  1023 //
  1052 //
  1024 TPoint NcsUtility::HeaderControlPosition( const TRect& aParentRect, const TInt aCurrentLine )
  1053 TPoint NcsUtility::HeaderControlPosition( 
       
  1054         const TRect& aParentRect, const TInt aCurrentLine )
  1025     {
  1055     {
  1026     FUNC_LOG;
  1056     FUNC_LOG;
  1027     TAknLayoutRect detailPane;
  1057     TAknLayoutRect detailPane;
  1028     TAknWindowComponentLayout headerDetailPane( AknLayoutScalable_Apps::list_single_cmail_header_detail_pane( 0, 0, 0 ) );
  1058     TAknWindowComponentLayout headerDetailPane( AknLayoutScalable_Apps::list_single_cmail_header_detail_pane( 0, 0, 0 ) );
  1029     detailPane.LayoutRect( aParentRect, TAknWindowComponentLayout::MultiLineY( headerDetailPane, aCurrentLine, 0 ) );
  1059     detailPane.LayoutRect( aParentRect, TAknWindowComponentLayout::MultiLineY( headerDetailPane, aCurrentLine, 0 ) );
  1032 
  1062 
  1033 // -----------------------------------------------------------------------------
  1063 // -----------------------------------------------------------------------------
  1034 // NcsUtility::LayoutHeaderControl
  1064 // NcsUtility::LayoutHeaderControl
  1035 // -----------------------------------------------------------------------------
  1065 // -----------------------------------------------------------------------------
  1036 //
  1066 //
  1037 void NcsUtility::LayoutHeaderControl( CCoeControl* aControl, const TRect& aParentRect, const TInt aCurrentLine, const TInt aNumberOfLines )
  1067 void NcsUtility::LayoutHeaderControl( 
       
  1068         CCoeControl* aControl, const TRect& aParentRect, 
       
  1069         const TInt aCurrentLine, const TInt aNumberOfLines )
  1038     {
  1070     {
  1039     FUNC_LOG;
  1071     FUNC_LOG;
  1040     TAknLayoutRect detailPane;
  1072     TAknLayoutRect detailPane;
  1041     TAknWindowComponentLayout headerDetailPane( AknLayoutScalable_Apps::list_single_cmail_header_detail_pane( 0, 0, 0 ) );
  1073     TAknWindowComponentLayout headerDetailPane( AknLayoutScalable_Apps::list_single_cmail_header_detail_pane( 0, 0, 0 ) );
  1042     detailPane.LayoutRect( aParentRect, TAknWindowComponentLayout::MultiLineY( headerDetailPane, aCurrentLine, 0 ) );
  1074     detailPane.LayoutRect( aParentRect, TAknWindowComponentLayout::MultiLineY( headerDetailPane, aCurrentLine, 0 ) );
  1047 
  1079 
  1048 // -----------------------------------------------------------------------------
  1080 // -----------------------------------------------------------------------------
  1049 // NcsUtility::LayoutBodyEdwin
  1081 // NcsUtility::LayoutBodyEdwin
  1050 // -----------------------------------------------------------------------------
  1082 // -----------------------------------------------------------------------------
  1051 //
  1083 //
  1052 //<cmail>
  1084 void NcsUtility::LayoutBodyEdwin( 
  1053 void NcsUtility::LayoutBodyEdwin( CEikEdwin* aEdwin, const TRect& aParentRect, const TInt aCurrentLine, const TInt aNumberOfLines,
  1085         CEikEdwin* aEdwin, const TRect& aParentRect, const TInt aCurrentLine, 
  1054         TInt& aSeparatorYPosition )
  1086         const TInt aNumberOfLines, TInt& aSeparatorYPosition )
  1055 //</cmail>
       
  1056     {
  1087     {
  1057     FUNC_LOG;
  1088     FUNC_LOG;
  1058     TAknMultiLineTextLayout edwinLayout;
  1089     TAknMultiLineTextLayout edwinLayout;
  1059     TAknTextComponentLayout textLayout( AknLayoutScalable_Apps::list_cmail_body_pane_t1() );
  1090     TAknTextComponentLayout textLayout( AknLayoutScalable_Apps::list_cmail_body_pane_t1() );
  1060     RArray< TAknTextComponentLayout > edwinLayoutLines;
  1091     RArray< TAknTextComponentLayout > edwinLayoutLines;
  1071     TRect bodyRect( bodyPane.Rect() );
  1102     TRect bodyRect( bodyPane.Rect() );
  1072     TAknLayoutRect detailPane;
  1103     TAknLayoutRect detailPane;
  1073     TAknWindowComponentLayout headerDetailPane( AknLayoutScalable_Apps::list_single_cmail_header_detail_pane( 0, 0, 0 ) );
  1104     TAknWindowComponentLayout headerDetailPane( AknLayoutScalable_Apps::list_single_cmail_header_detail_pane( 0, 0, 0 ) );
  1074     detailPane.LayoutRect( aParentRect, TAknWindowComponentLayout::MultiLineY( headerDetailPane, aCurrentLine, 0 ) );
  1105     detailPane.LayoutRect( aParentRect, TAknWindowComponentLayout::MultiLineY( headerDetailPane, aCurrentLine, 0 ) );
  1075     bodyRect = TRect( detailPane.Rect().iTl, bodyRect.Size() );
  1106     bodyRect = TRect( detailPane.Rect().iTl, bodyRect.Size() );
  1076     //<cmail>
       
  1077     aSeparatorYPosition = bodyRect.iTl.iY;
  1107     aSeparatorYPosition = bodyRect.iTl.iY;
  1078     // Since layout doesn't specify enough space between separator line
  1108     // Since layout doesn't specify enough space between separator line
  1079     // and editor, we add some space manually
  1109     // and editor, we add some space manually
  1080     TInt deltaMove = NcsUtility::SeparatorSizeInThisResolution().iHeight;
  1110     TInt deltaMove = NcsUtility::SeparatorSizeInThisResolution().iHeight;
  1081     bodyRect.Move( 0, deltaMove );
  1111     bodyRect.Move( 0, deltaMove );
  1082     //</cmail>
       
  1083     AknLayoutUtils::LayoutEdwin( aEdwin, bodyRect, TAknTextComponentLayout::Multiline( edwinLayoutLines ), EAknsCIQsnTextColorsCG6 );
  1112     AknLayoutUtils::LayoutEdwin( aEdwin, bodyRect, TAknTextComponentLayout::Multiline( edwinLayoutLines ), EAknsCIQsnTextColorsCG6 );
  1084     edwinLayoutLines.Reset();
  1113     edwinLayoutLines.Reset();
  1085     }
  1114     }
  1086 
  1115 
  1087 //<cmail>
       
  1088 // -----------------------------------------------------------------------------
  1116 // -----------------------------------------------------------------------------
  1089 // NcsUtility::CalculateSeparatorLineSecondaryColor
  1117 // NcsUtility::CalculateSeparatorLineSecondaryColor
  1090 //
  1118 //
  1091 // Calculates secondary color value based on the start value. Useful for
  1119 // Calculates secondary color value based on the start value. Useful for
  1092 // gradient drawing.
  1120 // gradient drawing.
  1148         blueValue = KFSUtilityMaxColorValue;
  1176         blueValue = KFSUtilityMaxColorValue;
  1149         }
  1177         }
  1150     return TRgb( redValue , greenValue, blueValue );
  1178     return TRgb( redValue , greenValue, blueValue );
  1151     }
  1179     }
  1152 
  1180 
  1153 // </cmail> Platform layout changes
       
  1154 // -----------------------------------------------------------------------------
  1181 // -----------------------------------------------------------------------------
  1155 // NcsUtility::CalculateMsgBodyLineColor
  1182 // NcsUtility::CalculateMsgBodyLineColor
  1156 //
  1183 //
  1157 // Calculates line color to be used in message body. Calculated color is darker than
  1184 // Calculates line color to be used in message body. Calculated color is darker than
  1158 // given base color.
  1185 // given base color.