|
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: Container class for email header |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __NCSEMAILHEADERUI_H__ |
|
21 #define __NCSEMAILHEADERUI_H__ |
|
22 |
|
23 //<cmail> |
|
24 #include <aknlongtapdetector.h> |
|
25 //</cmail> |
|
26 |
|
27 //<cmail> |
|
28 #include "cpbkxremotecontactlookupenv.h" |
|
29 #include "cpbkxremotecontactlookupserviceuicontext.h" |
|
30 //</cmail> |
|
31 |
|
32 #include "FreestyleEmailUi.hrh" |
|
33 #include "ncsaddressinputfield.h" |
|
34 #include "ncsfieldsizeobserver.h" |
|
35 #include "ncsconstants.h" |
|
36 |
|
37 |
|
38 class CFSMailBox; |
|
39 class CNcsAttachmentField; |
|
40 class CNcsEmailAddressObject; |
|
41 class CNcsPopupListBox; |
|
42 class CNcsSubjectField; |
|
43 |
|
44 /** |
|
45 * CNcsHeaderContainer |
|
46 */ |
|
47 class CNcsHeaderContainer : public CCoeControl, public MNcsAddressPopupList |
|
48 { |
|
49 |
|
50 public: |
|
51 |
|
52 /** Initialisation flags. */ |
|
53 enum TInitFlags |
|
54 { |
|
55 ECcFieldVisible = 0x01, |
|
56 EBccFieldVisible = 0x02 |
|
57 }; |
|
58 |
|
59 /** |
|
60 * Two-phased constructor. |
|
61 * Create a CNcsHeaderContainer object, which will draw itself to aRect |
|
62 * @param aRect The rectangle this view will be drawn to. |
|
63 * @param aMailBox reference to current mailbox item |
|
64 * @param aFlags Initialisation flags. |
|
65 * @return a pointer to the created instance of CNcsHeaderContainer. |
|
66 */ |
|
67 static CNcsHeaderContainer* NewL( CCoeControl& aParent, |
|
68 CFSMailBox& aMailBox, TInt aFlags = NULL ); |
|
69 |
|
70 /** |
|
71 * ~CNcsHeaderContainer |
|
72 * Destructor |
|
73 */ |
|
74 virtual ~CNcsHeaderContainer(); |
|
75 |
|
76 private: // constructor/destructor |
|
77 |
|
78 /** |
|
79 * CNcsHeaderContainer |
|
80 * C++ constructor. |
|
81 * @param aParent Parent control. |
|
82 * @param aMailBox reference to current mailbox item |
|
83 */ |
|
84 CNcsHeaderContainer( CCoeControl& aParent, CFSMailBox& aMailBox ); |
|
85 |
|
86 /** |
|
87 * ConstructL |
|
88 * 2nd phase constructor. |
|
89 */ |
|
90 void ConstructL( TInt aFlags ); |
|
91 |
|
92 public: // function members |
|
93 |
|
94 /** |
|
95 * GetToFieldAddressesL |
|
96 * Get addresses in TO-field. |
|
97 * @return Array of addresses. |
|
98 */ |
|
99 const RPointerArray<CNcsEmailAddressObject>& GetToFieldAddressesL( |
|
100 TBool aParseNow = ETrue ); |
|
101 |
|
102 /** |
|
103 * GetCcFieldAddressesL |
|
104 * Get addresses in CC-field. |
|
105 * @return Array of addresses. |
|
106 */ |
|
107 const RPointerArray<CNcsEmailAddressObject>& GetCcFieldAddressesL( |
|
108 TBool aParseNow = ETrue ); |
|
109 |
|
110 /** |
|
111 * GetBccFieldAddressesL |
|
112 * Get addresses in BCC-field. |
|
113 * @return Array of addresses. |
|
114 */ |
|
115 const RPointerArray<CNcsEmailAddressObject>& GetBccFieldAddressesL( |
|
116 TBool aParseNow = ETrue ); |
|
117 |
|
118 /** |
|
119 * GetSubjectLC |
|
120 * Get text in SUBJECT-field. |
|
121 * @return Subject text. |
|
122 */ |
|
123 HBufC* GetSubjectLC() const; |
|
124 |
|
125 /** |
|
126 * GetToFieldLength |
|
127 * Get TO-field text length. |
|
128 * @return Text length. |
|
129 */ |
|
130 TInt GetToFieldLength() const; |
|
131 |
|
132 /** |
|
133 * GetCcFieldLength |
|
134 * Get CC-field text length. |
|
135 * @return Text length. |
|
136 */ |
|
137 TInt GetCcFieldLength() const; |
|
138 |
|
139 /** |
|
140 * GetBccFieldLength |
|
141 * Get BCC-field text length. |
|
142 * @return Text length. |
|
143 */ |
|
144 TInt GetBccFieldLength() const; |
|
145 |
|
146 /** |
|
147 * GetSubjectFieldLength |
|
148 * Get SUBJECT-field text length. |
|
149 * @return Text length. |
|
150 */ |
|
151 TInt GetSubjectFieldLength() const; |
|
152 |
|
153 /** |
|
154 * GetAttachmentCount |
|
155 * Get number of attachments. |
|
156 * @return Attachment count. |
|
157 */ |
|
158 TInt GetAttachmentCount() const; |
|
159 |
|
160 /** |
|
161 * HasRemoteAttachments |
|
162 * Tells if the message has one or more remote attachments |
|
163 * @return ETrue if the message has at least one remote attachment. |
|
164 */ |
|
165 TBool HasRemoteAttachments() const; |
|
166 |
|
167 /** |
|
168 * GetToFieldSelectionLength |
|
169 * Get selected text length in TO-field. |
|
170 * @return Text length. |
|
171 */ |
|
172 TInt GetToFieldSelectionLength() const; |
|
173 |
|
174 /** |
|
175 * GetCcFieldSelectionLength |
|
176 * Get selected text length in CC-field. |
|
177 * @return Text length. |
|
178 */ |
|
179 TInt GetCcFieldSelectionLength() const; |
|
180 |
|
181 /** |
|
182 * GetBccFieldSelectionLength |
|
183 * Get selected text length in BCC-field. |
|
184 * @return Text length. |
|
185 */ |
|
186 TInt GetBccFieldSelectionLength() const; |
|
187 |
|
188 /** |
|
189 * GetLookupTextLC |
|
190 * Get lookup text in focused AIF. |
|
191 * @return Lookup text. |
|
192 */ |
|
193 HBufC* GetLookupTextLC() const; |
|
194 |
|
195 /** |
|
196 * SetToFieldAddressesL |
|
197 * Set addresses in TO-field. |
|
198 * @param aAddress Address array. |
|
199 */ |
|
200 void SetToFieldAddressesL( |
|
201 const RPointerArray<CNcsEmailAddressObject>& aAddress ); |
|
202 |
|
203 /** |
|
204 * SetCcFieldAddressesL |
|
205 * Set addresses in CC-field. |
|
206 * @param aAddress Address array. |
|
207 */ |
|
208 void SetCcFieldAddressesL( |
|
209 const RPointerArray<CNcsEmailAddressObject>& aAddress ); |
|
210 |
|
211 void SetBccFieldAddressesL( |
|
212 const RPointerArray<CNcsEmailAddressObject>& aAddress ); |
|
213 |
|
214 void AppendToFieldAddressesL( |
|
215 const RPointerArray<CNcsEmailAddressObject>& aAddress ); |
|
216 |
|
217 void AppendCcFieldAddressesL( |
|
218 const RPointerArray<CNcsEmailAddressObject>& aAddress ); |
|
219 |
|
220 void AppendBccFieldAddressesL( |
|
221 const RPointerArray<CNcsEmailAddressObject>& aAddress ); |
|
222 |
|
223 void SetSubjectL( const TDesC& aSubject ); |
|
224 |
|
225 void SetMenuBar( CEikButtonGroupContainer* aMenuBar ); |
|
226 |
|
227 void SetAttachmentLabelTextL( const TDesC& aText ); |
|
228 void SetAttachmentLabelTextL( const TDesC& aAttachmentName, const TDesC& aAttachmentSizeDesc ); |
|
229 |
|
230 void ShowAttachmentLabelL(); |
|
231 void HideAttachmentLabel(); |
|
232 |
|
233 void SetCcFieldVisibleL( |
|
234 TBool aVisible, |
|
235 TDrawNow aDrawNow = EDrawNow, |
|
236 TBool aFocus = ETrue ); |
|
237 |
|
238 void SetBccFieldVisibleL( |
|
239 TBool aVisible, |
|
240 TDrawNow aDrawNow = EDrawNow, |
|
241 TBool aFocus = ETrue ); |
|
242 |
|
243 void FixSemicolonInAddressFieldsL(); |
|
244 |
|
245 TBool IsBccFieldVisible() const; |
|
246 |
|
247 TBool IsCcFieldVisible() const; |
|
248 |
|
249 // <cmail> Removed unneeded IsFocusAif |
|
250 // </cmail> |
|
251 |
|
252 TBool IsFocusAttachments() const; |
|
253 |
|
254 TBool IsFocusTo() const; |
|
255 |
|
256 TBool IsFocusCc() const; |
|
257 |
|
258 TBool IsFocusBcc() const; |
|
259 |
|
260 void IncludeAddressL(); |
|
261 |
|
262 void IncludeAddressL( const CNcsEmailAddressObject& eml ); |
|
263 |
|
264 // Update the field positions arround the anchor |
|
265 void UpdateFieldPosition( CCoeControl* aAnchor ); |
|
266 |
|
267 // Check if the AIF menu should be displayed |
|
268 TBool NeedsAifMenu() const; |
|
269 |
|
270 // Get the total number of scrollable lines to update the scroll bar |
|
271 TInt ScrollableLines() const; |
|
272 |
|
273 // Get the total line count of all the controls in this container. |
|
274 TInt LineCount() const; |
|
275 |
|
276 // Get the current cursor position relative to the top of the container. |
|
277 TInt CursorPosition() const; |
|
278 |
|
279 // Get the cursor line number. |
|
280 TInt CursorLineNumber() const; |
|
281 |
|
282 void HandleControlArrayEventL( |
|
283 CCoeControlArray::TEvent aEvent, |
|
284 const CCoeControlArray *aArray, |
|
285 CCoeControl *aControl, |
|
286 TInt aControlId ); |
|
287 |
|
288 //Set Middlesoftkey |
|
289 //void CNcsHeaderContainer::SetMsk(); |
|
290 void SetMskL(); |
|
291 |
|
292 //<cmail> |
|
293 void HandlePointerEventL( const TPointerEvent& aPointerEvent ); |
|
294 |
|
295 void OpenPhonebookL(); |
|
296 |
|
297 void HandleLongTapL( const TPoint& aPenEventLocation ); |
|
298 |
|
299 TBool NeedsLongTapL( const TPoint& aPenEventLocation ); |
|
300 //</cmail> |
|
301 |
|
302 // Process a key event |
|
303 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
304 |
|
305 // Delete the selected address from the current AIF |
|
306 void DeleteSelectionL(); |
|
307 |
|
308 TInt GetNumChars() const; |
|
309 |
|
310 void SelectAllToFieldTextL(); |
|
311 |
|
312 void SelectAllCcFieldTextL(); |
|
313 |
|
314 void SelectAllBccFieldTextL(); |
|
315 |
|
316 void SelectAllSubjectFieldTextL(); |
|
317 |
|
318 void FocusToField(); |
|
319 |
|
320 void FocusAttachmentField(); |
|
321 |
|
322 void SetPriority( TMsgPriority aPriority ); |
|
323 |
|
324 void SetFollowUp( TBool aFollowUp ); |
|
325 |
|
326 TBool AreAddressFieldsEmpty() const; |
|
327 |
|
328 void DoPopupSelectL(); |
|
329 |
|
330 TBool IsPopupActive() const; |
|
331 |
|
332 void ClosePopupContactListL(); |
|
333 |
|
334 void ShowPopupMenuBarL( TBool aShow ); |
|
335 |
|
336 TBool IsToFieldEmpty() const; |
|
337 |
|
338 TBool IsCcFieldEmpty() const; |
|
339 |
|
340 TBool IsBccFieldEmpty() const; |
|
341 |
|
342 TBool IsSubjectFieldEmpty() const; |
|
343 |
|
344 void HandleDynamicVariantSwitchL(); |
|
345 |
|
346 //<cmail> |
|
347 // sets up iSwitchChangeMskOff falg |
|
348 void SwitchChangeMskOff(TBool aTag); |
|
349 // </cmail> |
|
350 |
|
351 // <cmail> Platform layout change |
|
352 virtual TInt LayoutLineCount() const; |
|
353 // </cmail> Platform layout change |
|
354 |
|
355 // <cmail> |
|
356 TBool IsAddressInputField( const CCoeControl* aControl ) const; |
|
357 // </cmail> |
|
358 |
|
359 TBool IsRemoteSearchInprogress() const; |
|
360 private: // Function members |
|
361 |
|
362 void FocusChanged(TDrawNow aDrawNow); |
|
363 |
|
364 void UpdatePopupContactListL( const TDesC& aMatchString, TBool aListAll ); |
|
365 |
|
366 CCoeControl* FindFocused() const; |
|
367 |
|
368 void Draw( const TRect& aRect ) const; |
|
369 |
|
370 void DrawAttachmentFocusNow(); |
|
371 |
|
372 TKeyResponse ChangeFocusL( const TKeyEvent& aKeyEvent ); |
|
373 |
|
374 void SizeChanged(); |
|
375 |
|
376 void PositionChanged(); |
|
377 |
|
378 TInt GetTotalHeight() const; |
|
379 |
|
380 void ChangePositions(); |
|
381 |
|
382 TTypeUid::Ptr MopSupplyObject( TTypeUid aId ); |
|
383 |
|
384 TRect CalculatePopupRect(); |
|
385 |
|
386 void HandleAttachmentsOpenCommand(); |
|
387 |
|
388 /** |
|
389 * Execute Remote Lookup Search. |
|
390 * |
|
391 * @param aExitReason RCL exit reason. |
|
392 * @param aSearchText Search text. |
|
393 * @return Selected email address object. |
|
394 */ |
|
395 CNcsEmailAddressObject* ExecuteRemoteSearchL( |
|
396 CPbkxRemoteContactLookupServiceUiContext::TResult::TExitReason& aExitReason, |
|
397 const TDesC& aSearchText ); |
|
398 |
|
399 void ChangeMskCommandL( TInt aLabelResourceId ); |
|
400 |
|
401 void CommitFieldL( CCoeControl* aField ); |
|
402 |
|
403 //<cmail> |
|
404 private: //From MAknLongTapDetectorCallBack |
|
405 |
|
406 void HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& aPenEventScreenLocation ); |
|
407 |
|
408 //</cmail> |
|
409 |
|
410 private: // Data members |
|
411 |
|
412 /* |
|
413 * Parent window |
|
414 * Not Own |
|
415 */ |
|
416 CCoeControl& iParent; |
|
417 |
|
418 // <cmail> Platform layout change |
|
419 MNcsFieldSizeObserver& iFieldSizeObserver; |
|
420 // </cmail> Platform layout change |
|
421 |
|
422 //<cmail> |
|
423 CAknLongTapDetector* iLongTapDetector; |
|
424 //</cmail> |
|
425 |
|
426 CEikButtonGroupContainer* iMenuBar; |
|
427 |
|
428 CNcsAddressInputField* iToField; |
|
429 |
|
430 CNcsAddressInputField* iCcField; |
|
431 |
|
432 CNcsAddressInputField* iBccField; |
|
433 |
|
434 CNcsSubjectField* iSubjectField; |
|
435 |
|
436 CNcsAttachmentField* iAttachmentField; |
|
437 |
|
438 // The attachments count |
|
439 TInt iAttachmentCount; |
|
440 |
|
441 // Address popup data members |
|
442 CNcsPopupListBox* iAacListBox; |
|
443 |
|
444 CFSMailBox& iMailBox; |
|
445 |
|
446 // <cmail> |
|
447 //flag which disables changes of MSK label if any popup dialog is open |
|
448 TBool iSwitchChangeMskOff; |
|
449 // </cmail> |
|
450 |
|
451 // <cmail> |
|
452 //CFbsBitmap* iBackgroundBitmap; |
|
453 //CFbsBitmap* iBackgroundMask; |
|
454 CAknsBasicBackgroundControlContext* iBgContext; |
|
455 // </cmail> |
|
456 |
|
457 TBool iLongTapEventConsumed; |
|
458 TBool iRALInProgress; |
|
459 }; |
|
460 |
|
461 |
|
462 #endif |