|
1 /* |
|
2 * Copyright (c) 2005-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: Unified Message Editor base header. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef C_UNIBASEHEADER_H |
|
21 #define C_UNIBASEHEADER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <MsgEditorView.h> |
|
25 #include <MsgEditor.hrh> // TMsgControlId |
|
26 #include <MsgAddressControl.h> |
|
27 #include <MsgAttachmentControl.h> |
|
28 #include <cmsvrecipientlist.h> |
|
29 #include <unimodelconst.h> |
|
30 |
|
31 // CONSTANTS |
|
32 |
|
33 // MACROS |
|
34 |
|
35 // DATA TYPES |
|
36 |
|
37 // FUNCTION PROTOTYPES |
|
38 |
|
39 // FORWARD DECLARATIONS |
|
40 |
|
41 class CMsgExpandableControl; |
|
42 class CUniAddressHandler; |
|
43 class CMsgBaseControl; |
|
44 class CMsgEditorAppUi; |
|
45 class CBaseMtm; |
|
46 |
|
47 // CLASS DECLARATION |
|
48 |
|
49 // ========================================================== |
|
50 |
|
51 /** |
|
52 * Unified Editor Base Header class declaration. |
|
53 * Class provides common services for editor and viewer header classes. |
|
54 * |
|
55 * @lib UniUtils.lib |
|
56 * |
|
57 * @since S60 3.2 |
|
58 */ |
|
59 class CUniBaseHeader : public CBase |
|
60 { |
|
61 public: // Constructor and destructor |
|
62 |
|
63 enum THeaderFields |
|
64 { |
|
65 EHeaderAddressFrom = 0, |
|
66 EHeaderAddressTo, |
|
67 EHeaderAddressCc, |
|
68 EHeaderAddressBcc, |
|
69 EHeaderSubject, |
|
70 EHeaderAttachment |
|
71 }; |
|
72 |
|
73 /** |
|
74 * Destructor. |
|
75 */ |
|
76 IMPORT_C virtual ~CUniBaseHeader(); |
|
77 |
|
78 /** |
|
79 * Adds correct header fields to the view. |
|
80 * |
|
81 * @since S60 3.2 |
|
82 */ |
|
83 IMPORT_C void AddToViewL(); |
|
84 |
|
85 /* Removes headers from |
|
86 * |
|
87 * @since S60 3.2 |
|
88 * |
|
89 * @param aFlag Selected additional headers. |
|
90 * Combination of EUniFeatureSubject, EUniFeatureCc |
|
91 * and EUniFeatureBcc of enum TUniFeatures. |
|
92 * Note! Do not edit initial value unless you know |
|
93 * what you do. EUniFeatureTo and EUniFeatureFrom must be included. |
|
94 */ |
|
95 IMPORT_C void RemoveFromViewL( TInt aFlags = 0x7fffffff ); |
|
96 |
|
97 /** |
|
98 * Currently focused address field |
|
99 * |
|
100 * @since S60 3.2 |
|
101 * |
|
102 * @param aFocusedControl currently focused control |
|
103 * |
|
104 * @return KErrNotFound, or HeaderAddressTo, EHeaderAddressCc, |
|
105 * EHeaderAddressBcc, |
|
106 */ |
|
107 IMPORT_C TInt FocusedAddressField ( CMsgBaseControl* aFocusedControl ); |
|
108 |
|
109 /** |
|
110 * Returns specified header address control. |
|
111 * |
|
112 * @since S60 3.2 |
|
113 * |
|
114 * @param aType Header control type. |
|
115 * |
|
116 * @return NULL if control was not found. |
|
117 * Otherwise pointer to correct header object. |
|
118 */ |
|
119 inline CMsgAddressControl* AddressControl( THeaderFields aType ) const; |
|
120 |
|
121 /** |
|
122 * Returns specified header address control's ID. |
|
123 * |
|
124 * @since S60 3.2 |
|
125 * |
|
126 * @param aType Header control type. |
|
127 * |
|
128 * @return TMsgControlId of the specified control |
|
129 */ |
|
130 inline TMsgControlId AddressControlId( THeaderFields aType ) const; |
|
131 |
|
132 /** |
|
133 * Returns subject control. |
|
134 * |
|
135 * @since S60 3.2 |
|
136 * |
|
137 * @return NULL if control was not found. |
|
138 * Otherwise pointer to CMsgExpandableControl object. |
|
139 */ |
|
140 inline CMsgExpandableControl* SubjectControl() const; |
|
141 |
|
142 /** |
|
143 * Returns attachment control. |
|
144 * |
|
145 * @since S60 3.2 |
|
146 * |
|
147 * @return NULL if control was not found. |
|
148 * Otherwise pointer to CMsgAttachmentControl object. |
|
149 */ |
|
150 inline CMsgAttachmentControl* AttachmentControl() const; |
|
151 |
|
152 /** |
|
153 * Returns header variation bit mask. |
|
154 * |
|
155 * @since S60 3.2 |
|
156 * |
|
157 * @return Combination of bit flags of variation of EUniFeatureSubject, |
|
158 * EUniFeatureCc, EUniFeatureBcc. |
|
159 * Note that the flags must be read first using AddHeadersVariationL() |
|
160 */ |
|
161 inline TInt AddHeadersVariation() const; |
|
162 |
|
163 /** |
|
164 * Reads additional headers variation of bit flags of configuration of KMmsuiHeaderSubject, |
|
165 * KMmsuiHeaderCc, KMmsuiHeaderBcc |
|
166 * |
|
167 * @since S60 3.2 |
|
168 * |
|
169 * @return Combination of bit flags of variation of EUniFeatureSubject, |
|
170 * EUniFeatureCc, EUniFeatureBcc. |
|
171 */ |
|
172 IMPORT_C TInt AddHeadersConfigL(); |
|
173 |
|
174 /** |
|
175 * Saves new additional headers selection |
|
176 * Currently this function can be called either before updating |
|
177 * controls on the UI or afterwards |
|
178 * |
|
179 * @since S60 3.2 |
|
180 * |
|
181 * @param aFlag Selected additional headers. |
|
182 * Combination of EUniFeatureSubject, EUniFeatureCc |
|
183 * and EUniFeatureBcc of enum TUniFeatures |
|
184 */ |
|
185 IMPORT_C void SaveAddHeadersConfigL( TInt aAddHeaders ); |
|
186 |
|
187 /** |
|
188 * Returns whether message has recipients. |
|
189 * |
|
190 * @since S60 3.2 |
|
191 * |
|
192 * @return ETrue, header contains recipients |
|
193 * EFalse, header does not include any recipient |
|
194 */ |
|
195 IMPORT_C TBool HasRecipients(); |
|
196 |
|
197 /** |
|
198 * Function checks whether component id represents an address control |
|
199 * visible on the first slide of the editor. |
|
200 * This is to avoid following code: |
|
201 * if ( id == EMsgComponentIdTo |
|
202 * || id == EMsgComponentIdCc |
|
203 * || id == EMsgComponentIdBcc )... |
|
204 * |
|
205 * @since S60 3.2 |
|
206 * |
|
207 * @return ETrue, is an address field |
|
208 * EFalse, is not an address field. If the address field would not be |
|
209 * visible on the first slide, return EFalse. |
|
210 */ |
|
211 IMPORT_C TBool IsAddressControl( TInt aId ); |
|
212 |
|
213 /** |
|
214 * Handles notifying the resource change event to the controls that are owned by the header. |
|
215 * |
|
216 * @param aType Resource change type the same way as in corresponding CCoeControl function call. |
|
217 */ |
|
218 IMPORT_C void HandleResourceChange( TInt aType ); |
|
219 |
|
220 protected: // Constructors |
|
221 |
|
222 enum |
|
223 { |
|
224 // For internal use of header class hierarchy |
|
225 // This can be whatever bit excluding |
|
226 // EUniFeatureCc, EUniFeatureBcc and EUniFeatureSubject |
|
227 EUniFeatureTo = 0x4000000, |
|
228 EUniFeatureFrom = 0x8000000, |
|
229 EUniFeatureAttachment = 0x10000000 |
|
230 }; |
|
231 |
|
232 struct TAddressData |
|
233 { |
|
234 CMsgExpandableControl* iControl; |
|
235 TBool iOwned; |
|
236 CUniAddressHandler* iAddressHandler; // no address handler for subject |
|
237 TMsgControlId iControlType; |
|
238 TMsvRecipientTypeValues iRecipientTypeValue; // from msv api |
|
239 }; |
|
240 |
|
241 /** |
|
242 * Hidden C++ default constructor. |
|
243 */ |
|
244 IMPORT_C CUniBaseHeader( CBaseMtm& aMtm, |
|
245 CMsgEditorView& aView, |
|
246 RFs& aFs ); |
|
247 |
|
248 /** |
|
249 * Implements adding controls into view |
|
250 * |
|
251 * @since S60 3.2 |
|
252 * |
|
253 * @param aReadContent determines whether content is read to the |
|
254 * UI control from MTM. |
|
255 * Reading is not needed, if control is added by user selection |
|
256 */ |
|
257 IMPORT_C void DoAddToViewL( TBool aReadContent ); |
|
258 |
|
259 /** |
|
260 * Checks recipient address types, which the message contains |
|
261 * |
|
262 * @since S60 3.2 |
|
263 * |
|
264 * @return combination of EUniFeatureCc and EUniFeatureBcc of enum TUniFeatures |
|
265 */ |
|
266 IMPORT_C TInt MtmAddressTypes(); |
|
267 |
|
268 /** |
|
269 * Add header variation. |
|
270 * |
|
271 * @since S60 3.2 |
|
272 * |
|
273 * @return Sets combination of bit flags of variation of EUniFeatureSubject, |
|
274 * EUniFeatureCc, EUniFeatureBcc to iAddHeadersVariation |
|
275 */ |
|
276 IMPORT_C void AddHeadersVariationL( TBool aIsUpload ); |
|
277 |
|
278 /** |
|
279 * Create UI control for recipient. |
|
280 * |
|
281 * @since S60 3.2 |
|
282 * |
|
283 * @param aData data area for this recipient type |
|
284 * @param aRecipientType recipient type |
|
285 * @param aReadContent determines whether recipient data is read from |
|
286 * MTM |
|
287 */ |
|
288 virtual void InsertRecipientL( TAddressData& aData, |
|
289 THeaderFields aRecipientType, |
|
290 TBool aReadContent) = 0; |
|
291 /** |
|
292 * Create UI control for from field. Base implementation is empty |
|
293 * |
|
294 * @since S60 3.2 |
|
295 * |
|
296 * @param aReadContent determines whether recipient data is read from |
|
297 * MTM |
|
298 */ |
|
299 virtual void InsertFromL( TBool aReadContent ); |
|
300 |
|
301 /** |
|
302 * Creates UI control for subject |
|
303 * |
|
304 * @since S60 3.2 |
|
305 * |
|
306 * @param aReadContent determines whether content is read to the |
|
307 * UI control from MTM. |
|
308 * Reading is not needed, if control is added by user selection |
|
309 */ |
|
310 virtual void InsertSubjectL( TBool aReadContent ) = 0; |
|
311 |
|
312 /** |
|
313 * Creates UI control for attachment field |
|
314 * |
|
315 * @since S60 3.2 |
|
316 * |
|
317 * @param aReadContent Determines whether content is read to the UI control. |
|
318 */ |
|
319 virtual void InsertAttachmentL( TBool aReadContent ) = 0; |
|
320 |
|
321 protected: //Data |
|
322 |
|
323 CBaseMtm& iMtm; |
|
324 CMsgEditorView& iView; |
|
325 RFs& iFs; |
|
326 TInt iAddHeadersVariation; |
|
327 TInt iAddHeadersConfig; |
|
328 TAddressData iHeaders[6]; |
|
329 |
|
330 /// Derived class must remember to use flags EUniFeatureTo, EUniFeatureFrom, too |
|
331 TInt iAddDelayed; |
|
332 }; |
|
333 |
|
334 #include <unibaseheader.inl> |
|
335 |
|
336 #endif // C_UNIBASEHEADER_H |