|
1 /* |
|
2 * Copyright (c) 2002-2006 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: MsgAddressControl declaration |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CMSGADDRESSCONTROL_H |
|
21 #define CMSGADDRESSCONTROL_H |
|
22 |
|
23 // ========== INCLUDE FILES ================================ |
|
24 #include <cntdef.h> // for TContactItemId |
|
25 |
|
26 #include "MsgExpandableControl.h" |
|
27 #include "MsgRecipientItem.h" // for CMsgRecipientItem |
|
28 |
|
29 // ========== CONSTANTS ==================================== |
|
30 |
|
31 // ========== MACROS ======================================= |
|
32 |
|
33 #define iAddressControlEditor ( static_cast<CMsgAddressControlEditor*>( iEditor ) ) |
|
34 |
|
35 // ========== FUNCTION PROTOTYPES ========================== |
|
36 |
|
37 // ========== FORWARD DECLARATIONS ========================= |
|
38 class MVPbkContactLink; |
|
39 class CAknButton; |
|
40 |
|
41 // ========== DATA TYPES =================================== |
|
42 |
|
43 // ========== CLASS DECLARATION ============================ |
|
44 |
|
45 /** |
|
46 * Defines a parsing info class that is used for storing information about a |
|
47 * found entry string. |
|
48 */ |
|
49 class TParsingInfo |
|
50 { |
|
51 public: |
|
52 |
|
53 /** |
|
54 * Constructor. |
|
55 */ |
|
56 inline TParsingInfo(); |
|
57 |
|
58 /** |
|
59 * Constructor. |
|
60 * @param aEntryNum |
|
61 * @param aStartPos |
|
62 * @param aEndPos |
|
63 */ |
|
64 inline TParsingInfo( TInt aEntryNum, TInt aStartPos, TInt aEndPos ); |
|
65 |
|
66 /** |
|
67 * |
|
68 * @param aEntryNum |
|
69 * @param aStartPos |
|
70 * @param aEndPos |
|
71 */ |
|
72 inline void SetInfo( TInt aEntryNum, TInt aStartPos, TInt aEndPos ); |
|
73 |
|
74 private: |
|
75 |
|
76 /** |
|
77 * Constructor (not available). |
|
78 */ |
|
79 TParsingInfo( const TParsingInfo& aSource ); |
|
80 |
|
81 /** |
|
82 * Assignment operator (not available). |
|
83 */ |
|
84 const TParsingInfo& operator=( const TParsingInfo& aSource ); |
|
85 |
|
86 public: |
|
87 |
|
88 TInt iEntryNum; |
|
89 TInt iStartPos; |
|
90 TInt iEndPos; |
|
91 }; |
|
92 |
|
93 /** |
|
94 * Defines an address control for message editors/viewers. |
|
95 */ |
|
96 class CMsgAddressControl : public CMsgExpandableControl |
|
97 { |
|
98 public: |
|
99 |
|
100 enum TMsgAddressControlEditPermissionFlags |
|
101 { |
|
102 EMsgEditCharInsert = EMsgFirstReservedFlag << 1, // Inserting a character is possible |
|
103 EMsgEditParagraphDelimiter = EMsgFirstReservedFlag << 2, // Enter key press is possible |
|
104 EMsgEditBackspace = EMsgFirstReservedFlag << 3, // Pressing Backspace is possible |
|
105 EMsgEditDelete = EMsgFirstReservedFlag << 4, // Pressing Delete is possible |
|
106 EMsgEditBackspaceMove = EMsgFirstReservedFlag << 5, // Pressing Backspace is possible but it does not remove a char |
|
107 EMsgEditRemoveEntry = EMsgFirstReservedFlag << 6 // Removing entry is possible |
|
108 }; |
|
109 |
|
110 public: |
|
111 |
|
112 /** |
|
113 * Constructor. |
|
114 * @param aBaseControlObserver |
|
115 */ |
|
116 CMsgAddressControl( MMsgBaseControlObserver& aBaseControlObserver ); |
|
117 |
|
118 /** |
|
119 * Destructor. |
|
120 */ |
|
121 virtual ~CMsgAddressControl(); |
|
122 |
|
123 public: |
|
124 |
|
125 /** |
|
126 * Adds one recipient to the address control. |
|
127 * @param aName |
|
128 * @param aAddress |
|
129 * @param aId |
|
130 * @param aVerified |
|
131 */ |
|
132 IMPORT_C void AddRecipientL( const TDesC& aName, |
|
133 const TDesC& aAddress, |
|
134 TBool aVerified, |
|
135 MVPbkContactLink* aContactLink ); |
|
136 |
|
137 /** |
|
138 * Adds list of recipients to the address control. |
|
139 * @param aRecipients |
|
140 */ |
|
141 IMPORT_C void AddRecipientsL( const CMsgRecipientList& aRecipients ); |
|
142 |
|
143 /** |
|
144 * Returns recipients from the address control. |
|
145 * @return |
|
146 */ |
|
147 IMPORT_C CMsgRecipientArray* GetRecipientsL(); |
|
148 |
|
149 /** |
|
150 * Clears content of the address control. |
|
151 * @return |
|
152 */ |
|
153 IMPORT_C TInt ResetL(); |
|
154 |
|
155 /** |
|
156 * Clears content of the address control (non-leaving version; from CMsgBaseControl). |
|
157 */ |
|
158 IMPORT_C void Reset(); |
|
159 |
|
160 /** |
|
161 * Finds the first unverified string and updates also the iParserInfo |
|
162 * correspondingly. |
|
163 * @param aString |
|
164 * @return |
|
165 */ |
|
166 IMPORT_C TInt GetFirstUnverifiedStringL( HBufC*& aString ); |
|
167 |
|
168 /** |
|
169 * Finds the next unverified string. |
|
170 * @param aString |
|
171 * @return |
|
172 */ |
|
173 IMPORT_C TInt GetNextUnverifiedStringL( HBufC*& aString ); |
|
174 |
|
175 /** |
|
176 * Refreshes the contents of address control. |
|
177 * OBSOLETE! User RefreshL instead. |
|
178 * |
|
179 * @param aArray |
|
180 * @return |
|
181 */ |
|
182 IMPORT_C TInt ReplaceUnverifiedStringL( CMsgRecipientArray& aArray ); |
|
183 |
|
184 /** |
|
185 * Refreshes the contents of address control. |
|
186 * |
|
187 * @param aArray |
|
188 * @return |
|
189 */ |
|
190 IMPORT_C TInt RefreshL( const CMsgRecipientArray& aArray ); |
|
191 |
|
192 /** |
|
193 * Highlights the found unverified entry. |
|
194 * @return |
|
195 */ |
|
196 IMPORT_C TInt HighlightUnverifiedStringL(); |
|
197 |
|
198 /** |
|
199 * Returns size of addresses. |
|
200 * @param aEntryCount entry count |
|
201 * @param aSizeOfAddresses total size of addresses. |
|
202 * @return |
|
203 */ |
|
204 IMPORT_C void GetSizeOfAddresses( TInt& aEntryCount, TInt& aSizeOfAddresses ); |
|
205 |
|
206 /** |
|
207 * Highlight unvalidated entry. |
|
208 */ |
|
209 IMPORT_C TInt HighlightUnvalidatedStringL(); |
|
210 |
|
211 /** |
|
212 * Checks whether prior character is semicolon. Needed to variable |
|
213 * selection key functionality in editors. |
|
214 * @param none |
|
215 * @return ETrue if it is, otherwise EFalse. |
|
216 */ |
|
217 IMPORT_C TBool IsPriorCharSemicolonL() const; |
|
218 |
|
219 /** |
|
220 * Sets address highlighting for automatic find function on/off. |
|
221 * |
|
222 * @param aValidHighlightable ETrue for on / EFalse for off. |
|
223 * @return none |
|
224 */ |
|
225 IMPORT_C void SetAddressFieldAutoHighlight( TBool aValidHighlightable = EFalse ); |
|
226 |
|
227 /** |
|
228 * Returns address highlighting value for automatic find function. |
|
229 * |
|
230 * @param |
|
231 * @return aValidHighlightable ETrue for on / EFalse for off. |
|
232 */ |
|
233 IMPORT_C TBool AddressFieldAutoHighlight(); |
|
234 |
|
235 public: // from CMsgExpandableControl |
|
236 |
|
237 /** |
|
238 * Creates this control from resource. |
|
239 * @param aResourceId |
|
240 */ |
|
241 void ConstructFromResourceL( TInt aResourceId ); |
|
242 |
|
243 /** |
|
244 * Prepares control for viewing. |
|
245 * @param aEvent |
|
246 * @param aParam |
|
247 */ |
|
248 void NotifyViewEvent( TMsgViewEvent aEvent, TInt aParam ); |
|
249 |
|
250 /** |
|
251 * Reads control properties from resource. |
|
252 * @param aReader |
|
253 */ |
|
254 void ReadControlPropertiesFromResourceL( TResourceReader& aReader ); |
|
255 |
|
256 /** |
|
257 * Creates editor (CEikRichTextEditor) for the control from resource and returns |
|
258 * pointer to it. |
|
259 * @param aReader |
|
260 * @return |
|
261 */ |
|
262 CMsgExpandableControlEditor* CreateEditorFromResourceL( TResourceReader& aReader ); |
|
263 |
|
264 /** |
|
265 * Checks and returns control's edit permissions. Edit permissions are needed |
|
266 * to check in order to know whether some key press is allowed to pass |
|
267 * to the control or not. |
|
268 * @return |
|
269 */ |
|
270 TUint32 EditPermission() const; |
|
271 |
|
272 public: // from CCoeControl |
|
273 |
|
274 /** |
|
275 * Handles key events. |
|
276 * @param aKeyEvent |
|
277 * @param aType |
|
278 * @return |
|
279 */ |
|
280 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); |
|
281 |
|
282 /** |
|
283 * For handling dynamic layout switch. |
|
284 */ |
|
285 void HandleResourceChange( TInt aType ); |
|
286 |
|
287 public: // from MEikEdwinObserver |
|
288 |
|
289 /** |
|
290 * Handle edwin events. |
|
291 * @param aEdwin |
|
292 * @param aEventType |
|
293 */ |
|
294 void HandleEdwinEventL( CEikEdwin* aEdwin, TEdwinEvent aEventType ); |
|
295 |
|
296 protected: // from CMsgExpandableControl |
|
297 |
|
298 /** |
|
299 * Sets the correct layout for button. |
|
300 */ |
|
301 void LayoutButton(); |
|
302 |
|
303 protected: // from CMsgBaseControl |
|
304 |
|
305 /** |
|
306 * Prepares for read only or non read only state. |
|
307 * @param aReadOnly |
|
308 */ |
|
309 void PrepareForReadOnly( TBool aReadOnly ); |
|
310 |
|
311 protected: // from CCoeControl |
|
312 |
|
313 /** |
|
314 * This is called when the focus of the control is changed. |
|
315 * @param aDrawNow |
|
316 */ |
|
317 void FocusChanged( TDrawNow aDrawNow ); |
|
318 |
|
319 private: |
|
320 |
|
321 /** |
|
322 * Finds the next unverified string on entry and updates parsing info |
|
323 * correspondingly. Returns ETrue if found. |
|
324 * @param aEntryBuf |
|
325 * @return |
|
326 */ |
|
327 TInt GetNextItemOnEntry( TDes& aEntryBuf ); |
|
328 |
|
329 /** |
|
330 * Finds and returns an unverified string aEntryItem from aString starting at |
|
331 * position aStartPos. Returns a start position aStartPos and an end position |
|
332 * aEndPos of the searched range. Returns KErrNotFound if a string cannot be found. |
|
333 * @param aEntryItem |
|
334 * @param aEntryItem |
|
335 * @param aStartPos |
|
336 * @param aEndPos |
|
337 * @return |
|
338 */ |
|
339 TInt ParseString( TDes& aEntryItem, const TPtrC& aString, TInt& aStartPos, TInt& aEndPos ); |
|
340 |
|
341 /** |
|
342 * Formats and sets the cursor to the beginning of the formatted band. |
|
343 */ |
|
344 void FormatAndSetCursorPosL( TInt aPos ); |
|
345 |
|
346 /** |
|
347 * |
|
348 */ |
|
349 inline void ResetParsingInfo(); |
|
350 |
|
351 /** |
|
352 * |
|
353 * @param aEntryNum |
|
354 * @param aStartPos |
|
355 * @param aStartPos |
|
356 */ |
|
357 inline void SetParsingInfo( TInt aEntryNum, TInt aStartPos, TInt aEndPos ); |
|
358 |
|
359 /** |
|
360 * Removes highlighted entry. |
|
361 */ |
|
362 void RemoveHighlightedEntryL(); |
|
363 |
|
364 /** |
|
365 * Creates button with label text. |
|
366 */ |
|
367 void CreateButtonL(); |
|
368 |
|
369 private: |
|
370 |
|
371 TParsingInfo iParsingInfo; |
|
372 TBool iDuplicateEvent; |
|
373 |
|
374 CMsgRecipientArray* iRecipientArray; |
|
375 }; |
|
376 |
|
377 #include <MsgAddressControl.inl> |
|
378 |
|
379 #endif // CMSGADDRESSCONTROL_H |
|
380 |
|
381 // End of File |