|
1 /* |
|
2 * Copyright (c) 2007-2008 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: ES Protocol Framework brand container class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CFSMAILBRAND_H |
|
20 #define CFSMAILBRAND_H |
|
21 |
|
22 // INCLUDES |
|
23 #include "MailBrandManager.hrh" // TFSBrandElement |
|
24 #include <gdi.h> |
|
25 #include <badesca.h> |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class TResourceReader; |
|
29 class CGulIcon; |
|
30 |
|
31 /** |
|
32 * email framework brand container class |
|
33 * |
|
34 * @lib FSFWCommonLib |
|
35 * @since S60 v3.1 |
|
36 */ |
|
37 class CFSMailBrand : public CBase |
|
38 { |
|
39 |
|
40 public: |
|
41 |
|
42 /** |
|
43 * Class to represent branded graphic elements |
|
44 * when stored to an instance of CFSMailBrand. |
|
45 */ |
|
46 class TBrandedGraphic |
|
47 { |
|
48 public: |
|
49 /** |
|
50 * Id to identify type of graphics branded. |
|
51 */ |
|
52 TFSBrandElement iElementId; |
|
53 |
|
54 TInt iIconId; |
|
55 TInt iMaskId; |
|
56 }; |
|
57 |
|
58 /** |
|
59 * Class to represent branded text elements |
|
60 * when stored to an instance of CFSMailBrand. |
|
61 */ |
|
62 class TBrandedText |
|
63 { |
|
64 public: |
|
65 /** |
|
66 * Id to identify type of text branded. |
|
67 */ |
|
68 TFSBrandElement iElementId; |
|
69 |
|
70 /** |
|
71 * Pointer to the text. Actual ownership of the text element |
|
72 * is held elsewhere. |
|
73 */ |
|
74 TPtrC iText; |
|
75 }; |
|
76 |
|
77 /** |
|
78 * Class to represent branded color elements |
|
79 * when stored to an instance of CFSMailBrand. |
|
80 */ |
|
81 class TBrandedColor |
|
82 { |
|
83 public: |
|
84 /** |
|
85 * Id to identify type of color branded. |
|
86 */ |
|
87 TFSBrandElement iElementId; |
|
88 |
|
89 TRgb iColor; |
|
90 }; |
|
91 |
|
92 public: |
|
93 |
|
94 /** |
|
95 * Two-phased constructor. |
|
96 */ |
|
97 static CFSMailBrand* NewLC( TResourceReader& aReader, TBool aIsWhiteLabel ); |
|
98 |
|
99 /** |
|
100 * Two-phased constructor. |
|
101 */ |
|
102 static CFSMailBrand* NewL( TResourceReader& aReader, TBool aIsWhiteLabel ); |
|
103 |
|
104 /** |
|
105 * destructor. |
|
106 */ |
|
107 virtual ~CFSMailBrand(); |
|
108 |
|
109 /** |
|
110 * Function to check whether the given brand id string |
|
111 * matches the brand id of this brand or not. |
|
112 * |
|
113 * @since S60 ?S60_version |
|
114 * @param aBrandingIdMatchString Brand id. |
|
115 * @return Boolean value. ETrue meaning that the ids match and |
|
116 * EFalse that they don't. |
|
117 */ |
|
118 TBool IsMatching( const TDesC& aBrandingIdMatchString ); |
|
119 |
|
120 /** |
|
121 * Returns branded text element of given type. |
|
122 * |
|
123 * @param aElementId Id of the branded element. This identifies which |
|
124 * text user wishes to retrieve. |
|
125 * @return A TPtrC object. Returns TPtrC to a null descriptor if the |
|
126 * brand doesn't contain the requested branding element. |
|
127 */ |
|
128 TDesC& GetText( TFSBrandElement aElementId ); |
|
129 |
|
130 /** |
|
131 * Returns branded color element of given type. |
|
132 * |
|
133 * @param aElement The id of the branded element. This identifies which |
|
134 * color user wishes to retrieve. |
|
135 * @param aColor A reference to a TRgb object. The color is returned |
|
136 * using this reference. |
|
137 * |
|
138 * @return Error code. KErrNotFound if the brand doesn't contain the |
|
139 * requested branding element. |
|
140 */ |
|
141 TInt GetColor( TFSBrandElement aElementId, TRgb& aColor ); |
|
142 |
|
143 /** |
|
144 * Returns branded graphic element of given type. |
|
145 * |
|
146 * @param aBrandingIdMatchString Matching string. Can contain |
|
147 * wildcard characters. |
|
148 * @param aMailBoxId mailbox whose branded element is retrieved. |
|
149 * |
|
150 * @return A pointer to a CGulIcon object. The caller of this method is |
|
151 * responsible of destroying the object. Returns NULL if the |
|
152 * brand doesn't contain the requested branding element. |
|
153 */ |
|
154 CGulIcon* GetGraphicL( TFSBrandElement aElementId ); |
|
155 |
|
156 /** |
|
157 * Returns branded graphic element of given type. |
|
158 * |
|
159 * @param aElementId brand element |
|
160 * @param aIconIds Icon path and ids |
|
161 * |
|
162 * @return Error code |
|
163 */ |
|
164 TInt GetGraphicIdsL( TFSBrandElement aElementId, |
|
165 TDes& aIconIds ); |
|
166 |
|
167 private: |
|
168 |
|
169 /** |
|
170 * constructor |
|
171 */ |
|
172 CFSMailBrand(); |
|
173 |
|
174 /** |
|
175 * Function which constructs instance of this class by reading necessary |
|
176 * brand data from the given resource file. |
|
177 * |
|
178 * @param aReader Resource reader that can be used to read branding data. |
|
179 */ |
|
180 void ConstructFromResourceL( TResourceReader& aReader ); |
|
181 |
|
182 /** |
|
183 * |
|
184 */ |
|
185 void ConstructFromCenrepL( ); |
|
186 |
|
187 private: // data |
|
188 |
|
189 /** |
|
190 * Brand id matching string read from the resource file. When match |
|
191 * for user given brand id is checked, this variable contains the |
|
192 * match string. This can contain wild card characters. |
|
193 * Own. |
|
194 */ |
|
195 RPointerArray<HBufC> iBrandMatchStrings; |
|
196 |
|
197 /** |
|
198 * Filepath for icon found from this brand. |
|
199 * Own. |
|
200 */ |
|
201 HBufC* iIconFilePath; |
|
202 |
|
203 /** |
|
204 * Graphic elements found from this brand. |
|
205 * Own. |
|
206 */ |
|
207 CArrayFixSeg< TBrandedGraphic >* iGraphicElements; |
|
208 /** |
|
209 * Text elements found from this brand. |
|
210 * Own. |
|
211 */ |
|
212 CArrayFixSeg< TBrandedText >* iTextElements; |
|
213 /** |
|
214 * Color elements found from this brand. |
|
215 * Own. |
|
216 */ |
|
217 CArrayFixSeg< TBrandedColor >* iColorElements; |
|
218 /** |
|
219 * Actual branded text contents for text elements stored in |
|
220 * iTextElements is held here. |
|
221 * Own. |
|
222 */ |
|
223 CDesCArraySeg* iTexts; |
|
224 |
|
225 HBufC* iEmpty; |
|
226 |
|
227 }; |
|
228 |
|
229 #endif CFSMAILBAND_H |