|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: This file defines class NcsUtility. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef NCSUTILITY_H |
|
21 #define NCSUTILITY_H |
|
22 |
|
23 #include <cntitem.h> |
|
24 #include "CFSMailCommon.h" |
|
25 //<cmail> |
|
26 #include "ncsaddressinputfield.h" |
|
27 //</cmail> |
|
28 |
|
29 class CNcsEmailAddressObject; |
|
30 class CFSMailAddress; |
|
31 class CEikImage; |
|
32 class CFbsBitmap; |
|
33 class CFSMailMessage; |
|
34 class CFSMailBox; |
|
35 class CFSMailClient; |
|
36 // <cmail> Platform layout change |
|
37 class CEikLabel; |
|
38 class CEikEdwin; |
|
39 class CAknButton; |
|
40 class CCoeControl; |
|
41 // </cmail> Platform layout change |
|
42 |
|
43 struct TNcsMeasures |
|
44 { |
|
45 TInt iAifHeight; |
|
46 TInt iAifLabelMarginVertical; |
|
47 TInt iAifEditorMarginVertical; |
|
48 TInt iAifEditorHeight; |
|
49 TInt iSubjectExtraHeightBottom; |
|
50 TInt iAttachmentExtraHeightBottom; |
|
51 TInt iIconMarginPriorityVertical; |
|
52 TInt iIconMarginFollowUpVertical; |
|
53 TInt iIconMarginAttachmentVertical; |
|
54 TInt iLabelFontHeightPx; |
|
55 TInt iEditorFontHeightPx; |
|
56 }; |
|
57 |
|
58 |
|
59 /** |
|
60 * NcsUtility class. |
|
61 */ |
|
62 class NcsUtility |
|
63 { |
|
64 // <cmail> Platform layout changes |
|
65 public: |
|
66 enum THeaderDetailIcon |
|
67 { |
|
68 EIconFront, |
|
69 EIconBack |
|
70 }; |
|
71 // </cmail> Platform layout changes |
|
72 |
|
73 public: |
|
74 static void CompleteRelativePathL( const TDesC& aRelativePath, TPtr& aAbsolutePath ); |
|
75 |
|
76 static HBufC* GenerateFromLineToMessageBodyL( const RPointerArray<CNcsEmailAddressObject>& aFromArray ); |
|
77 |
|
78 static HBufC* GenerateSentLineToMessageBodyL( CFSMailMessage& aMessage ); |
|
79 |
|
80 enum TRecipientType { ERecipientTypeTo, ERecipientTypeCc /*, ERecipientTypeBcc*/ }; |
|
81 |
|
82 static HBufC* GenerateAddressLineToMessageBodyL( RPointerArray<CNcsEmailAddressObject>& aToArray, TRecipientType aType ); |
|
83 |
|
84 static HBufC* GenerateSubjectLineToMessageBodyL( const TDesC& aSubject ); |
|
85 |
|
86 static CNcsEmailAddressObject* CreateNcsAddressL( const CFSMailAddress& aFsAddress ); |
|
87 |
|
88 static CFSMailAddress* CreateFsAddressL( const CNcsEmailAddressObject& aNcsAddress ); |
|
89 |
|
90 static HBufC* FormatSubjectLineL( const TDesC& aNewSubjectLine, const TDesC& aPrefix ); |
|
91 |
|
92 static void ConvertAddressArrayL( const RPointerArray<CFSMailAddress>& aSrc, RPointerArray<CNcsEmailAddressObject>& aDst ); |
|
93 |
|
94 static void ConvertAddressArrayL( const RPointerArray<CNcsEmailAddressObject>& aSrc, RPointerArray<CFSMailAddress>& aDst ); |
|
95 |
|
96 static TBool GetAddressesFromPhonebookL( RPointerArray<CNcsEmailAddressObject>& aAddresses ); |
|
97 |
|
98 static void LoadScalableIconL( const TDesC& aMifRelativeFileName, TInt aImgId, TInt aMaskId, CEikImage*& aIcon, CFbsBitmap*& aImage, CFbsBitmap*& aMask ); |
|
99 |
|
100 |
|
101 static void DebugLog( TRefByValue<const TDesC> aFmt, ... ); |
|
102 |
|
103 static TBool IsEqualAddressArray( const RPointerArray<CFSMailAddress>& aAddresses1, |
|
104 const RPointerArray<CFSMailAddress>& aAddresses2 ); |
|
105 |
|
106 static TNcsMeasures Measures(); |
|
107 |
|
108 static CFont* GetNearestFontL( TInt aLogicalFontId, TInt aHeightPixels ); |
|
109 |
|
110 // <cmail> Platform layout changes |
|
111 enum TNcsLayoutFont |
|
112 { |
|
113 ENcsHeaderCaptionFont, |
|
114 ENcsHeaderDetailFont, |
|
115 ENcsBodytextFont |
|
116 }; |
|
117 |
|
118 static const CFont* GetLayoutFont( const TRect& aParent, TNcsLayoutFont aUsage ); |
|
119 // </cmail> Platform layout changes |
|
120 |
|
121 static TBool IsReplyForwardQuoteReadOnly( const CFSMailBox& aMailBox ); |
|
122 |
|
123 static TInt FindFirstPrintableCharIndex( const TDesC& aText ); |
|
124 |
|
125 static void ConvertCharacters( TDes& aBuffer, TUint16 aFrom, TUint16 aTo ); |
|
126 |
|
127 static void ConvertLineEndingsL( HBufC*& aBuffer ); |
|
128 |
|
129 static TInt DeleteMessage( CFSMailClient& aMailClient, |
|
130 const TFSMailMsgId& aMailBoxId, |
|
131 const TFSMailMsgId& aFolderId, |
|
132 const TFSMailMsgId& aMsgId ); |
|
133 |
|
134 // <cmail> Platform layout changes |
|
135 static TRect HeaderCaptionPaneRect( const TRect& aParent ); |
|
136 |
|
137 static TRect HeaderDetailPaneRect( const TRect& aParent, const TInt aRows, TBool aSameRow = EFalse ); |
|
138 |
|
139 static TRect HeaderDetailIconRect( const TRect& aParent, const TInt aRows , const THeaderDetailIcon aIcon ); |
|
140 |
|
141 static TRect ListscrollPaneRect(); |
|
142 |
|
143 static TRect ListCmailPaneRect( const TRect& aParent ); |
|
144 |
|
145 static TRect ListCmailScrollbarRect( const TRect& aParent ); |
|
146 //<cmail> |
|
147 static TSize SeparatorSizeInThisResolution(); |
|
148 static TInt ComposerLeftMarginInPixels( const TRect& aParent ); |
|
149 static TInt ComposerRightMarginInPixels( const TRect& aParent ); |
|
150 static TRect ListCmailBodyPaneRect( const TRect& aParent ); |
|
151 |
|
152 static void LayoutCaptionLabel( CEikLabel* aLabel, const TRect& aParentRect ); |
|
153 |
|
154 //<cmail> |
|
155 static void LayoutCaptionButton( CAknButton* aButton, const TRect& aParentRect); |
|
156 //</cmail> |
|
157 static void LayoutDetailLabel( CEikLabel* aLabel, const TRect& aParentRect ); |
|
158 |
|
159 static void LayoutDetailEdwin( CEikEdwin* aEdwin, const TRect& aParentRect, const TInt aLineCount, const TBool aBackIcon ); |
|
160 //<cmail> |
|
161 static void LayoutDetailEdwinTouch( CEikEdwin* aEdwin, const TRect& aParentRect, |
|
162 const TInt aLineCount, const TBool aBackIcon ); |
|
163 //</cmail> |
|
164 static TPoint HeaderControlPosition( const TRect& aParentRect, const TInt aCurrentLine ); |
|
165 |
|
166 static void LayoutHeaderControl( CCoeControl* aControl, const TRect& aParentRect, const TInt aCurrentLine, const TInt aNumberOfLines ); |
|
167 //<cmail> |
|
168 static void LayoutBodyEdwin( CEikEdwin* aEdwin, const TRect& aParentRect, const TInt aCurrentLine, const TInt aNumberOfLines, |
|
169 TInt& aSeparatorYPosition ); |
|
170 static TRgb CalculateSeparatorLineSecondaryColor( TInt aDegree, TRgb aStartColor ); |
|
171 static TRgb SeparatorLineColor(); |
|
172 static TRgb CalculateMsgBodyLineColor( TInt aDegree, TRgb aBaseColor ); |
|
173 |
|
174 private: |
|
175 static HBufC* DoGenerateAddressLineToMessageBodyL( TInt aLabelResourceId, |
|
176 const RPointerArray<CNcsEmailAddressObject>& aAddressArray ); |
|
177 }; |
|
178 |
|
179 #endif // TNCSUTILITY_H |
|
180 |
|
181 |
|
182 // End of File |