16 */ |
16 */ |
17 |
17 |
18 #include "cesmrfield.h" |
18 #include "cesmrfield.h" |
19 |
19 |
20 #include "esmrcommands.h" |
20 #include "esmrcommands.h" |
21 #include "cesmrborderlayer.h" |
|
22 #include "cesmrlayoutmgr.h" |
|
23 #include "nmrlayoutmanager.h" |
21 #include "nmrlayoutmanager.h" |
24 #include "mesmrfieldeventqueue.h" |
22 #include "mesmrfieldeventqueue.h" |
25 #include "cesmrfieldcommandevent.h" |
23 #include "cesmrfieldcommandevent.h" |
26 #include "cmrbackground.h" |
24 #include "cmrbackground.h" |
|
25 #include "esmrcommands.h" |
27 |
26 |
28 #include "emailtrace.h" |
27 #include "emailtrace.h" |
29 |
28 |
30 #include <txtrich.h> |
29 #include <txtrich.h> |
31 #include <eikenv.h> |
30 #include <eikenv.h> |
32 #include <baclipb.h> |
31 #include <baclipb.h> |
33 #include <eikbtgpc.h> |
32 #include <eikbtgpc.h> |
34 #include <StringLoader.h> |
33 #include <stringloader.h> |
35 #include <AknUtils.h> |
34 #include <aknutils.h> |
|
35 #include <touchfeedback.h> |
36 |
36 |
37 // ======== MEMBER FUNCTIONS ======== |
37 // ======== MEMBER FUNCTIONS ======== |
38 |
38 |
39 // --------------------------------------------------------------------------- |
39 // --------------------------------------------------------------------------- |
40 // CESMRField::CESMRField() |
40 // CESMRField::CESMRField |
41 // --------------------------------------------------------------------------- |
41 // --------------------------------------------------------------------------- |
42 // |
42 // |
43 EXPORT_C CESMRField::CESMRField() |
43 EXPORT_C CESMRField::CESMRField() |
44 : iCustomMsk( EFalse ), |
44 : iCustomMsk( EFalse ), |
45 iDisableRedraw( EFalse ), |
45 iDisableRedraw( EFalse ), |
46 iDefaultMskVisible( EFalse ), |
46 iDefaultMskVisible( EFalse ), |
47 iMskVisible( EFalse ) |
47 iMskVisible( EFalse ), |
|
48 iLocked( EFalse ) |
48 { |
49 { |
49 FUNC_LOG; |
50 FUNC_LOG; |
50 // do nothing |
51 // do nothing |
51 } |
52 } |
52 |
53 |
53 |
54 |
54 // --------------------------------------------------------------------------- |
55 // --------------------------------------------------------------------------- |
55 // CESMRField::~CESMRField() |
56 // CESMRField::~CESMRField |
56 // --------------------------------------------------------------------------- |
57 // --------------------------------------------------------------------------- |
57 // |
58 // |
58 EXPORT_C CESMRField::~CESMRField() |
59 EXPORT_C CESMRField::~CESMRField() |
59 { |
60 { |
60 FUNC_LOG; |
61 FUNC_LOG; |
61 delete iBorder; |
62 delete iExtControl; |
62 if ( iEventQueue ) |
63 if ( iEventQueue ) |
63 { |
64 { |
64 iEventQueue->RemoveObserver( this ); |
65 iEventQueue->RemoveObserver( this ); |
65 } |
66 } |
66 delete iBackground; |
67 delete iBackground; |
67 } |
68 } |
68 |
69 |
69 // --------------------------------------------------------------------------- |
70 // --------------------------------------------------------------------------- |
70 // CESMRField::SetExpandable() |
71 // CESMRField::ConstructL |
71 // --------------------------------------------------------------------------- |
72 // --------------------------------------------------------------------------- |
72 // |
73 // |
73 EXPORT_C void CESMRField::SetExpandable() |
74 EXPORT_C void CESMRField::ConstructL( |
74 { |
75 CCoeControl* aControl ) |
75 FUNC_LOG; |
76 { |
76 iExpandable = ETrue; |
77 FUNC_LOG; |
77 } |
78 iExtControl = aControl; |
78 |
79 |
79 // --------------------------------------------------------------------------- |
80 // TODO: This should be made in ConstructL instead as soon we |
80 // CESMRField::IsExpandable() |
81 // get rid of old CESMRLayoutManager. |
81 // --------------------------------------------------------------------------- |
82 iBackground = CMRBackground::NewL(); |
82 // |
83 this->SetBackground( iBackground ); |
83 EXPORT_C TBool CESMRField::IsExpandable() const |
84 } |
84 { |
85 |
85 FUNC_LOG; |
86 // --------------------------------------------------------------------------- |
86 return iExpandable; |
87 // CESMRField::InitializeL |
87 } |
|
88 |
|
89 // --------------------------------------------------------------------------- |
|
90 // CESMRField::ExpandedHeight() |
|
91 // --------------------------------------------------------------------------- |
|
92 // |
|
93 EXPORT_C TInt CESMRField::ExpandedHeight() const |
|
94 { |
|
95 FUNC_LOG; |
|
96 return 0; |
|
97 } |
|
98 |
|
99 // --------------------------------------------------------------------------- |
|
100 // CESMRField::InitializeL() |
|
101 // --------------------------------------------------------------------------- |
88 // --------------------------------------------------------------------------- |
102 // |
89 // |
103 EXPORT_C void CESMRField::InitializeL() |
90 EXPORT_C void CESMRField::InitializeL() |
104 { |
91 { |
105 FUNC_LOG; |
92 FUNC_LOG; |
106 /* Empty implementation, subclasses should overwrite */ |
93 /* Empty implementation, subclasses should overwrite */ |
107 } |
94 } |
108 |
95 |
109 // --------------------------------------------------------------------------- |
96 // --------------------------------------------------------------------------- |
110 // CESMRField::FontChangedL() |
97 // CESMRField::FontChangedL |
111 // --------------------------------------------------------------------------- |
98 // --------------------------------------------------------------------------- |
112 // |
99 // |
113 EXPORT_C void CESMRField::FontChangedL() |
100 EXPORT_C void CESMRField::FontChangedL() |
114 { |
101 { |
115 FUNC_LOG; |
102 FUNC_LOG; |
116 // This method re-initializes field |
103 // This method re-initializes field |
117 InitializeL(); |
104 InitializeL(); |
118 } |
105 } |
119 |
106 |
120 // --------------------------------------------------------------------------- |
107 // --------------------------------------------------------------------------- |
121 // CESMRField::SetFieldId() |
108 // CESMRField::SetFieldId |
122 // --------------------------------------------------------------------------- |
109 // --------------------------------------------------------------------------- |
123 // |
110 // |
124 EXPORT_C void CESMRField::SetFieldId( TESMREntryFieldId aFieldId ) |
111 EXPORT_C void CESMRField::SetFieldId( TESMREntryFieldId aFieldId ) |
125 { |
112 { |
126 FUNC_LOG; |
113 FUNC_LOG; |
127 iFieldId = aFieldId; |
114 iFieldId = aFieldId; |
128 } |
115 } |
129 |
116 |
130 // --------------------------------------------------------------------------- |
117 |
131 // CESMRField::FieldId() |
118 // --------------------------------------------------------------------------- |
|
119 // CESMRField::SetPreItemIndex |
|
120 // --------------------------------------------------------------------------- |
|
121 // |
|
122 EXPORT_C void CESMRField::SetPreItemIndex( TInt aPreItemIndex ) |
|
123 { |
|
124 FUNC_LOG; |
|
125 iPreItemIndex = aPreItemIndex; |
|
126 } |
|
127 |
|
128 |
|
129 // --------------------------------------------------------------------------- |
|
130 // CESMRField::SetCurrentItemIndex |
|
131 // --------------------------------------------------------------------------- |
|
132 // |
|
133 EXPORT_C void CESMRField::SetCurrentItemIndex( TInt aCurrentItemIndex ) |
|
134 { |
|
135 FUNC_LOG; |
|
136 iCurrentItemIndex = aCurrentItemIndex; |
|
137 } |
|
138 |
|
139 // --------------------------------------------------------------------------- |
|
140 // CESMRField::FieldId |
132 // --------------------------------------------------------------------------- |
141 // --------------------------------------------------------------------------- |
133 // |
142 // |
134 EXPORT_C TESMREntryFieldId CESMRField::FieldId() const |
143 EXPORT_C TESMREntryFieldId CESMRField::FieldId() const |
135 { |
144 { |
136 FUNC_LOG; |
145 FUNC_LOG; |
137 return iFieldId; |
146 return iFieldId; |
138 } |
147 } |
139 |
148 |
140 // --------------------------------------------------------------------------- |
149 // --------------------------------------------------------------------------- |
141 // CESMRField::ConstructL() |
150 // CESMRField::PreItemIndex |
142 // --------------------------------------------------------------------------- |
151 // --------------------------------------------------------------------------- |
143 // |
152 // |
144 EXPORT_C void CESMRField::ConstructL( |
153 EXPORT_C TInt CESMRField::PreItemIndex() const |
145 CCoeControl* aControl, TESMRFieldFocusType aFocusType ) |
154 { |
146 { |
155 FUNC_LOG; |
147 FUNC_LOG; |
156 return iPreItemIndex; |
148 iBorder = CESMRBorderLayer::NewL( aControl, aFocusType ); |
157 } |
149 iBorder->SetParent( this ); |
158 |
|
159 // --------------------------------------------------------------------------- |
|
160 // CESMRField::CurrentItemIndex |
|
161 // --------------------------------------------------------------------------- |
|
162 // |
|
163 EXPORT_C TInt CESMRField::CurrentItemIndex() const |
|
164 { |
|
165 FUNC_LOG; |
|
166 return iCurrentItemIndex; |
150 } |
167 } |
151 |
168 |
152 // --------------------------------------------------------------------------- |
169 // --------------------------------------------------------------------------- |
153 // CESMRField::SizeChanged |
170 // CESMRField::SizeChanged |
154 // --------------------------------------------------------------------------- |
171 // --------------------------------------------------------------------------- |
155 // |
172 // |
156 EXPORT_C void CESMRField::SizeChanged() |
173 EXPORT_C void CESMRField::SizeChanged() |
157 { |
174 { |
158 FUNC_LOG; |
175 FUNC_LOG; |
159 TRect rect( Rect() ); |
176 TRect rect( Rect() ); |
160 if ( iBorder ) |
177 if ( iExtControl ) |
161 { |
178 { |
162 iBorder->SetRect( rect ); |
179 iExtControl->SetRect( rect ); |
163 } |
180 } |
164 } |
181 } |
165 |
182 |
166 // --------------------------------------------------------------------------- |
183 // --------------------------------------------------------------------------- |
167 // CESMRField::CountComponentControls |
184 // CESMRField::CountComponentControls |
202 NMRLayoutManager::GetFieldLayoutRect( listareaLayoutRect.Rect(), 1 ); |
219 NMRLayoutManager::GetFieldLayoutRect( listareaLayoutRect.Rect(), 1 ); |
203 return TSize( Parent()->Size().iWidth, fieldLayoutRect.Rect().Height() ); |
220 return TSize( Parent()->Size().iWidth, fieldLayoutRect.Rect().Height() ); |
204 } |
221 } |
205 |
222 |
206 // --------------------------------------------------------------------------- |
223 // --------------------------------------------------------------------------- |
207 // CESMRField::SetContainerWindowL() |
224 // CESMRField::HandlePointerEventL |
|
225 // --------------------------------------------------------------------------- |
|
226 // |
|
227 EXPORT_C void CESMRField::HandlePointerEventL( |
|
228 const TPointerEvent& aPointerEvent ) |
|
229 { |
|
230 FUNC_LOG; |
|
231 // Sanity check that pointer event occurs in field area |
|
232 if ( Rect().Contains( aPointerEvent.iPosition ) ) |
|
233 { |
|
234 if ( aPointerEvent.iType == TPointerEvent::EButton1Up ) |
|
235 { |
|
236 if ( !HandleSingletapEventL( aPointerEvent.iPosition ) ) |
|
237 { |
|
238 // Provide raw pointer event to field |
|
239 HandleRawPointerEventL( aPointerEvent ); |
|
240 } |
|
241 } |
|
242 else // Provide other pointer events to fields |
|
243 { |
|
244 if ( !HandleRawPointerEventL( aPointerEvent ) ) |
|
245 { |
|
246 // Provide pointer events to child components if field |
|
247 // did not already consume the event |
|
248 CCoeControl::HandlePointerEventL( aPointerEvent ); |
|
249 } |
|
250 } |
|
251 } |
|
252 } |
|
253 |
|
254 // --------------------------------------------------------------------------- |
|
255 // CESMRField::SetContainerWindowL |
208 // --------------------------------------------------------------------------- |
256 // --------------------------------------------------------------------------- |
209 // |
257 // |
210 EXPORT_C void CESMRField::SetContainerWindowL(const CCoeControl& aContainer) |
258 EXPORT_C void CESMRField::SetContainerWindowL(const CCoeControl& aContainer) |
211 { |
259 { |
212 FUNC_LOG; |
260 FUNC_LOG; |
213 CCoeControl::SetContainerWindowL( aContainer ); |
261 CCoeControl::SetContainerWindowL( aContainer ); |
214 if ( iBorder ) |
262 if ( iExtControl ) |
215 { |
263 { |
216 iBorder->SetContainerWindowL( aContainer ); |
264 iExtControl->SetContainerWindowL( aContainer ); |
217 } |
265 iExtControl->SetParent( this ); |
218 } |
266 } |
219 |
267 } |
220 // --------------------------------------------------------------------------- |
268 |
221 // CESMRField::SetListObserver() |
269 // --------------------------------------------------------------------------- |
|
270 // CESMRField::SetListObserver |
222 // --------------------------------------------------------------------------- |
271 // --------------------------------------------------------------------------- |
223 // |
272 // |
224 EXPORT_C void CESMRField::SetListObserver( MESMRListObserver* aObserver ) |
273 EXPORT_C void CESMRField::SetListObserver( MESMRListObserver* aObserver ) |
225 { |
274 { |
226 FUNC_LOG; |
275 FUNC_LOG; |
227 iObserver = aObserver; |
276 iObserver = aObserver; |
228 ListObserverSet(); |
277 ListObserverSet(); |
229 } |
278 } |
230 |
279 |
231 // --------------------------------------------------------------------------- |
280 // --------------------------------------------------------------------------- |
232 // CESMRField::SetListObserver() |
281 // CESMRField::ListObserverSet |
233 // --------------------------------------------------------------------------- |
282 // --------------------------------------------------------------------------- |
234 // |
283 // |
235 EXPORT_C void CESMRField::ListObserverSet() |
284 EXPORT_C void CESMRField::ListObserverSet() |
236 { |
285 { |
237 FUNC_LOG; |
286 FUNC_LOG; |
238 // default implementation. |
287 // default implementation. |
239 } |
288 } |
240 |
289 |
241 // --------------------------------------------------------------------------- |
290 // --------------------------------------------------------------------------- |
242 // CESMRField::SetLayoutManager() |
291 // CESMRField::OfferKeyEventL |
243 // --------------------------------------------------------------------------- |
292 // --------------------------------------------------------------------------- |
244 // |
293 // |
245 EXPORT_C void CESMRField::SetLayoutManager( CESMRLayoutManager* aLayout ) |
294 EXPORT_C TKeyResponse CESMRField::OfferKeyEventL( |
246 { |
|
247 FUNC_LOG; |
|
248 iLayout = aLayout; |
|
249 if ( iBorder ) |
|
250 { |
|
251 iBorder->SetLayoutManager( iLayout ); |
|
252 } |
|
253 TRAP_IGNORE( |
|
254 iBackground = CMRBackground::NewL( *aLayout ); |
|
255 this->SetBackground( iBackground ); |
|
256 ); |
|
257 } |
|
258 |
|
259 // --------------------------------------------------------------------------- |
|
260 // CESMRField::OfferKeyEventL() |
|
261 // --------------------------------------------------------------------------- |
|
262 // |
|
263 EXPORT_C TKeyResponse CESMRField::OfferKeyEventL( |
|
264 const TKeyEvent& aEvent, TEventCode aType ) |
295 const TKeyEvent& aEvent, TEventCode aType ) |
265 { |
296 { |
266 FUNC_LOG; |
297 FUNC_LOG; |
267 if ( iBorder ) |
298 if ( iExtControl ) |
268 { |
299 { |
269 return iBorder->OfferKeyEventL( aEvent, aType ); |
300 return iExtControl->OfferKeyEventL( aEvent, aType ); |
270 } |
301 } |
271 return EKeyWasNotConsumed; |
302 return EKeyWasNotConsumed; |
272 } |
303 } |
273 |
304 |
274 // --------------------------------------------------------------------------- |
305 // --------------------------------------------------------------------------- |
275 // CESMRField::SetOutlineFocusL() |
306 // CESMRField::SetOutlineFocusL |
276 // --------------------------------------------------------------------------- |
307 // --------------------------------------------------------------------------- |
277 // |
308 // |
278 EXPORT_C void CESMRField::SetOutlineFocusL( TBool aFocus ) |
309 EXPORT_C void CESMRField::SetOutlineFocusL( TBool aFocus ) |
279 { |
310 { |
280 FUNC_LOG; |
311 FUNC_LOG; |
281 iOutlineFocus = aFocus; |
312 iOutlineFocus = aFocus; |
282 if ( iBorder ) |
313 if ( iExtControl ) |
283 { |
314 { |
284 iBorder->SetOutlineFocusL( aFocus ); |
315 iExtControl->SetFocus( aFocus ); |
285 } |
316 } |
286 if ( aFocus ) |
317 if ( aFocus ) |
287 { |
318 { |
288 CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); |
319 CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); |
289 if ( cba ) |
320 if ( cba ) |
321 aUpper = 0; |
352 aUpper = 0; |
322 aLower = Rect().iBr.iY - Rect().iTl.iY; |
353 aLower = Rect().iBr.iY - Rect().iTl.iY; |
323 } |
354 } |
324 |
355 |
325 // --------------------------------------------------------------------------- |
356 // --------------------------------------------------------------------------- |
326 // CESMRField::InternalizeL() |
357 // CESMRField::GetCursorLineVerticalPos |
|
358 // --------------------------------------------------------------------------- |
|
359 // |
|
360 EXPORT_C void CESMRField::GetCursorLineVerticalPos(TInt& aUpper, TInt& aLower) |
|
361 { |
|
362 FUNC_LOG; |
|
363 aUpper = 0; |
|
364 aLower = Rect().iBr.iY - Rect().iTl.iY; |
|
365 } |
|
366 |
|
367 // --------------------------------------------------------------------------- |
|
368 // CESMRField::InternalizeL |
327 // --------------------------------------------------------------------------- |
369 // --------------------------------------------------------------------------- |
328 // |
370 // |
329 EXPORT_C void CESMRField::InternalizeL( // codescanner::LFunctionCantLeave |
371 EXPORT_C void CESMRField::InternalizeL( // codescanner::LFunctionCantLeave |
330 MESMRCalEntry& /*aEntry*/ ) |
372 MESMRCalEntry& /*aEntry*/ ) |
331 { |
373 { |
332 FUNC_LOG; |
374 FUNC_LOG; |
333 /* Empty implementation, subclasses should overwrite */ |
375 /* Empty implementation, subclasses should overwrite */ |
334 } |
376 } |
335 |
377 |
336 // --------------------------------------------------------------------------- |
378 // --------------------------------------------------------------------------- |
337 // CESMRField::ExternalizeL() |
379 // CESMRField::ExternalizeL |
338 // --------------------------------------------------------------------------- |
380 // --------------------------------------------------------------------------- |
339 // |
381 // |
340 EXPORT_C void CESMRField::ExternalizeL( // codescanner::LFunctionCantLeave |
382 EXPORT_C void CESMRField::ExternalizeL( // codescanner::LFunctionCantLeave |
341 MESMRCalEntry& /*aEntry*/ ) |
383 MESMRCalEntry& /*aEntry*/ ) |
342 { |
384 { |
343 FUNC_LOG; |
385 FUNC_LOG; |
344 /* Empty implementation, subclasses should overwrite */ |
386 /* Empty implementation, subclasses should overwrite */ |
345 } |
387 } |
346 |
388 |
347 // --------------------------------------------------------------------------- |
389 // --------------------------------------------------------------------------- |
348 // CESMRField::ExecuteGenericCommandL() |
390 // CESMRField::ExecuteGenericCommandL |
349 // --------------------------------------------------------------------------- |
391 // --------------------------------------------------------------------------- |
350 // |
392 // |
351 EXPORT_C void CESMRField::ExecuteGenericCommandL( // codescanner::LFunctionCantLeave |
393 EXPORT_C TBool CESMRField::ExecuteGenericCommandL( TInt /*aCommand*/ ) |
352 TInt /*aCommand*/ ) |
394 { |
|
395 FUNC_LOG; |
|
396 return EFalse; |
|
397 /* Subclasses should overwrite */ |
|
398 } |
|
399 |
|
400 // --------------------------------------------------------------------------- |
|
401 // CESMRField::LongtapDetectedL |
|
402 // --------------------------------------------------------------------------- |
|
403 // |
|
404 EXPORT_C void CESMRField::LongtapDetectedL( const TPoint& aPosition ) |
|
405 { |
|
406 FUNC_LOG; |
|
407 |
|
408 HandleLongtapEventL( aPosition ); |
|
409 } |
|
410 |
|
411 // --------------------------------------------------------------------------- |
|
412 // CESMRField::SetTitlePaneObserver |
|
413 // --------------------------------------------------------------------------- |
|
414 // |
|
415 EXPORT_C void CESMRField::SetTitlePaneObserver( |
|
416 MESMRTitlePaneObserver* /*aObserver*/ ) |
353 { |
417 { |
354 FUNC_LOG; |
418 FUNC_LOG; |
355 /* Empty implementation, subclasses should overwrite */ |
419 /* Empty implementation, subclasses should overwrite */ |
356 } |
420 } |
357 |
421 |
358 // --------------------------------------------------------------------------- |
422 // --------------------------------------------------------------------------- |
359 // CESMRField::SetTitlePaneObserver() |
423 // CESMRField::ChangeMiddleSoftKeyL |
360 // --------------------------------------------------------------------------- |
424 // --------------------------------------------------------------------------- |
361 // |
425 // |
362 EXPORT_C void CESMRField::SetTitlePaneObserver( |
426 EXPORT_C void CESMRField::ChangeMiddleSoftKeyL( |
363 MESMRTitlePaneObserver* /*aObserver*/ ) |
427 TInt aCommandId, |
364 { |
428 TInt aResourceId ) |
365 FUNC_LOG; |
429 { |
366 /* Empty implementation, subclasses should overwrite */ |
430 FUNC_LOG; |
367 } |
431 |
368 |
432 if ( AknLayoutUtils::MSKEnabled() ) |
369 // --------------------------------------------------------------------------- |
433 { |
370 // CESMRField::ChangeMiddleSoftKeyL() |
434 CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); |
371 // --------------------------------------------------------------------------- |
435 if ( cba ) |
372 // |
436 { |
373 EXPORT_C void CESMRField::ChangeMiddleSoftKeyL( TInt aCommandId, |
437 HBufC* middleSKText = StringLoader::LoadLC( aResourceId, |
374 TInt aResourceId ) |
438 iCoeEnv ); |
375 { |
439 cba->SetCommandL( |
376 FUNC_LOG; |
|
377 CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); |
|
378 if ( cba ) |
|
379 { |
|
380 HBufC* middleSKText = StringLoader::LoadLC( aResourceId, |
|
381 iCoeEnv ); |
|
382 cba->SetCommandL( |
|
383 CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
|
384 aCommandId, *middleSKText ); |
|
385 CleanupStack::PopAndDestroy( middleSKText ); |
|
386 if ( !iMskVisible ) |
|
387 { |
|
388 cba->MakeCommandVisibleByPosition( |
|
389 CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
440 CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
390 ETrue ); |
441 aCommandId, *middleSKText ); |
391 iMskVisible = ETrue; |
442 CleanupStack::PopAndDestroy( middleSKText ); |
392 } |
443 if ( !iMskVisible ) |
393 cba->DrawDeferred(); |
444 { |
394 iCustomMsk = ETrue; |
445 cba->MakeCommandVisibleByPosition( |
395 } |
446 CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
396 } |
447 ETrue ); |
397 |
448 iMskVisible = ETrue; |
398 // --------------------------------------------------------------------------- |
449 } |
399 // CESMRField::ChangeMiddleSoftKeyL() |
450 cba->DrawDeferred(); |
|
451 iCustomMsk = ETrue; |
|
452 } |
|
453 } |
|
454 } |
|
455 |
|
456 // --------------------------------------------------------------------------- |
|
457 // CESMRField::SetValidatorL |
|
458 // --------------------------------------------------------------------------- |
|
459 // |
|
460 EXPORT_C void CESMRField::SetValidatorL( MESMRFieldValidator* aValidator ) |
|
461 { |
|
462 FUNC_LOG; |
|
463 |
|
464 iValidator = aValidator; |
|
465 } |
|
466 |
|
467 // --------------------------------------------------------------------------- |
|
468 // CESMRField::IsFieldActivated |
|
469 // --------------------------------------------------------------------------- |
|
470 // |
|
471 EXPORT_C TBool CESMRField::IsFieldActivated() const |
|
472 { |
|
473 FUNC_LOG; |
|
474 |
|
475 return IsActivated(); |
|
476 } |
|
477 |
|
478 // --------------------------------------------------------------------------- |
|
479 // CESMRField::DynInitMenuPaneL |
|
480 // --------------------------------------------------------------------------- |
|
481 // |
|
482 EXPORT_C void CESMRField::DynInitMenuPaneL( |
|
483 TInt /*aResourceId*/, |
|
484 CEikMenuPane* /*aMenuPane*/ ) |
|
485 { |
|
486 FUNC_LOG; |
|
487 } |
|
488 |
|
489 // --------------------------------------------------------------------------- |
|
490 // CESMRField::ChangeMiddleSoftKeyL |
400 // --------------------------------------------------------------------------- |
491 // --------------------------------------------------------------------------- |
401 // |
492 // |
402 EXPORT_C void CESMRField::ChangeMiddleSoftKeyL( TInt aResourceId ) |
493 EXPORT_C void CESMRField::ChangeMiddleSoftKeyL( TInt aResourceId ) |
403 { |
494 { |
404 FUNC_LOG; |
495 FUNC_LOG; |
405 CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); |
496 |
406 if ( cba ) |
497 if ( AknLayoutUtils::MSKEnabled() ) |
407 { |
498 { |
408 cba->SetCommandL( |
499 CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); |
409 CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
500 if ( cba ) |
410 aResourceId ); |
501 { |
411 if ( !iMskVisible ) |
502 cba->SetCommandL( |
412 { |
|
413 cba->MakeCommandVisibleByPosition( |
|
414 CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
503 CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
415 ETrue ); |
504 aResourceId ); |
416 iMskVisible = ETrue; |
505 if ( !iMskVisible ) |
417 } |
506 { |
418 cba->DrawDeferred(); |
507 cba->MakeCommandVisibleByPosition( |
419 iCustomMsk = ETrue; |
508 CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
420 } |
509 ETrue ); |
421 } |
510 iMskVisible = ETrue; |
422 |
511 } |
423 // --------------------------------------------------------------------------- |
512 cba->DrawDeferred(); |
424 // CESMRField::CalculateVisibleRect() |
513 iCustomMsk = ETrue; |
425 // --------------------------------------------------------------------------- |
514 } |
426 // |
515 } |
427 EXPORT_C TRect CESMRField::CalculateVisibleRect( TRect aRect ) |
516 } |
428 { |
517 |
429 FUNC_LOG; |
518 // --------------------------------------------------------------------------- |
430 TRect targetRect(aRect); |
519 // CESMRField::SetEventQueueL |
431 // highlight bitmap target size: |
|
432 TSize targetSize( Rect().Size() ); |
|
433 |
|
434 // fetch the size of main pane |
|
435 TRect mainPaneRect; |
|
436 AknLayoutUtils::LayoutMetricsRect( |
|
437 AknLayoutUtils::EMainPane, mainPaneRect ); |
|
438 |
|
439 // the list drawable height: |
|
440 TInt listAreaHeight = mainPaneRect.Height() - iLayout->TitlePaneHeight(); |
|
441 |
|
442 // if the size of field is larger than drawable height |
|
443 // let's downsize it: |
|
444 if ( Rect().Size().iHeight > listAreaHeight ) |
|
445 { |
|
446 TInt shownHeight = Rect().Size().iHeight + Rect().iTl.iY; |
|
447 // check should the highlight be smaller than |
|
448 // whole screen: |
|
449 if ( shownHeight < listAreaHeight ) |
|
450 { |
|
451 targetSize.iHeight = shownHeight; |
|
452 } |
|
453 else |
|
454 { |
|
455 targetSize.iHeight = listAreaHeight; |
|
456 } |
|
457 } |
|
458 |
|
459 // If part of the rect is not visible: |
|
460 if ( targetRect.iTl.iY < 0 ) |
|
461 { |
|
462 targetRect.iTl.iY = 0; |
|
463 } |
|
464 |
|
465 // visible height: |
|
466 targetRect.SetHeight(listAreaHeight); |
|
467 |
|
468 return targetRect; |
|
469 } |
|
470 |
|
471 // --------------------------------------------------------------------------- |
|
472 // CESMRField::SetEventQueueL() |
|
473 // --------------------------------------------------------------------------- |
520 // --------------------------------------------------------------------------- |
474 // |
521 // |
475 EXPORT_C void CESMRField::SetEventQueueL( MESMRFieldEventQueue* aEventQueue ) |
522 EXPORT_C void CESMRField::SetEventQueueL( MESMRFieldEventQueue* aEventQueue ) |
476 { |
523 { |
477 FUNC_LOG; |
524 FUNC_LOG; |
478 if ( aEventQueue != iEventQueue ) |
525 if ( aEventQueue != iEventQueue ) |
479 { |
526 { |
480 if ( aEventQueue ) |
527 if ( aEventQueue ) |
481 { |
528 { |
482 // Add self to new queue |
529 // Add self to new queue |
483 aEventQueue->AddObserverL( this ); |
530 aEventQueue->AddObserverL( this ); |
484 } |
531 } |
485 |
532 |
486 if ( iEventQueue ) |
533 if ( iEventQueue ) |
487 { |
534 { |
488 // Remove self from old queue |
535 // Remove self from old queue |
489 iEventQueue->RemoveObserver( this ); |
536 iEventQueue->RemoveObserver( this ); |
490 } |
537 } |
491 |
538 |
492 iEventQueue = aEventQueue; |
539 iEventQueue = aEventQueue; |
493 } |
540 } |
494 } |
541 } |
495 |
542 |
496 // --------------------------------------------------------------------------- |
543 // --------------------------------------------------------------------------- |
497 // CESMRField::HasOutlineFocus() |
544 // CESMRField::HasOutlineFocus |
498 // --------------------------------------------------------------------------- |
545 // --------------------------------------------------------------------------- |
499 // |
546 // |
500 EXPORT_C TBool CESMRField::HasOutlineFocus() const |
547 EXPORT_C TBool CESMRField::HasOutlineFocus() const |
501 { |
548 { |
|
549 FUNC_LOG; |
502 return iOutlineFocus; |
550 return iOutlineFocus; |
503 } |
551 } |
504 |
552 |
505 // --------------------------------------------------------------------------- |
553 // --------------------------------------------------------------------------- |
506 // CESMRField::GetFocusRect() |
554 // CESMRField::GetFocusRect |
507 // --------------------------------------------------------------------------- |
555 // --------------------------------------------------------------------------- |
508 // |
556 // |
509 EXPORT_C TRect CESMRField::GetFocusRect() const |
557 EXPORT_C TRect CESMRField::GetFocusRect() const |
510 { |
558 { |
|
559 FUNC_LOG; |
511 return iFocusRect; |
560 return iFocusRect; |
512 } |
561 } |
513 |
562 |
514 // --------------------------------------------------------------------------- |
563 // --------------------------------------------------------------------------- |
515 // CESMRField::SetFocusRect() |
564 // CESMRField::SetFocusRect |
516 // --------------------------------------------------------------------------- |
565 // --------------------------------------------------------------------------- |
517 // |
566 // |
518 EXPORT_C void CESMRField::SetFocusRect( const TRect& aFocusRect ) |
567 EXPORT_C void CESMRField::SetFocusRect( const TRect& aFocusRect ) |
519 { |
568 { |
|
569 FUNC_LOG; |
520 iFocusRect = aFocusRect; |
570 iFocusRect = aFocusRect; |
521 } |
571 } |
522 |
572 |
523 // --------------------------------------------------------------------------- |
573 // --------------------------------------------------------------------------- |
524 // CESMRField::GetFocusType() |
574 // CESMRField::GetFocusType |
525 // --------------------------------------------------------------------------- |
575 // --------------------------------------------------------------------------- |
526 // |
576 // |
527 EXPORT_C TESMRFieldFocusType CESMRField::GetFocusType() const |
577 EXPORT_C TESMRFieldFocusType CESMRField::GetFocusType() const |
528 { |
578 { |
|
579 FUNC_LOG; |
529 return iFocusType; |
580 return iFocusType; |
530 } |
581 } |
531 |
582 |
532 // --------------------------------------------------------------------------- |
583 // --------------------------------------------------------------------------- |
533 // CESMRField::SetFocusType() |
584 // CESMRField::SetFocusType |
534 // --------------------------------------------------------------------------- |
585 // --------------------------------------------------------------------------- |
535 // |
586 // |
536 EXPORT_C void CESMRField::SetFocusType( TESMRFieldFocusType aFocusType ) |
587 EXPORT_C void CESMRField::SetFocusType( TESMRFieldFocusType aFocusType ) |
537 { |
588 { |
|
589 FUNC_LOG; |
538 iFocusType = aFocusType; |
590 iFocusType = aFocusType; |
539 } |
591 } |
540 |
592 |
541 // --------------------------------------------------------------------------- |
593 // --------------------------------------------------------------------------- |
542 // CESMRField::NotifyEventL() |
594 // CESMRField::NotifyEventL |
543 // --------------------------------------------------------------------------- |
595 // --------------------------------------------------------------------------- |
544 // |
596 // |
545 EXPORT_C void CESMRField::NotifyEventL( const MESMRFieldEvent& aEvent ) |
597 EXPORT_C void CESMRField::NotifyEventL( const MESMRFieldEvent& aEvent ) |
546 { |
598 { |
547 FUNC_LOG; |
599 FUNC_LOG; |
589 NotifyEventAsyncL( event ); |
641 NotifyEventAsyncL( event ); |
590 CleanupStack::Pop( event ); |
642 CleanupStack::Pop( event ); |
591 } |
643 } |
592 |
644 |
593 // --------------------------------------------------------------------------- |
645 // --------------------------------------------------------------------------- |
594 // CESMRField::RestoreMiddleSoftKeyL() |
646 // CESMRField::RestoreMiddleSoftKeyL |
595 // --------------------------------------------------------------------------- |
647 // --------------------------------------------------------------------------- |
596 // |
648 // |
597 EXPORT_C void CESMRField::RestoreMiddleSoftKeyL() |
649 EXPORT_C void CESMRField::RestoreMiddleSoftKeyL() |
598 { |
650 { |
599 FUNC_LOG; |
651 FUNC_LOG; |
600 if ( iMskVisible != iDefaultMskVisible ) |
652 if ( AknLayoutUtils::MSKEnabled() ) |
601 { |
653 { |
602 SetMiddleSoftKeyVisible( iDefaultMskVisible ); |
654 if ( iMskVisible != iDefaultMskVisible ) |
603 } |
655 { |
604 |
656 SetMiddleSoftKeyVisible( iDefaultMskVisible ); |
605 if ( iCustomMsk ) |
657 } |
606 { |
658 |
607 NotifyEventL( EESMRCmdRestoreMiddleSoftKey ); |
659 if ( iCustomMsk ) |
608 iCustomMsk = EFalse; |
660 { |
609 } |
661 NotifyEventL( EESMRCmdRestoreMiddleSoftKey ); |
610 } |
662 iCustomMsk = EFalse; |
611 |
663 } |
|
664 } |
|
665 } |
|
666 |
|
667 // --------------------------------------------------------------------------- |
|
668 // CESMRField::SetMiddleSoftKeyVisible |
|
669 // --------------------------------------------------------------------------- |
|
670 // |
612 EXPORT_C void CESMRField::SetMiddleSoftKeyVisible( TBool aVisible ) |
671 EXPORT_C void CESMRField::SetMiddleSoftKeyVisible( TBool aVisible ) |
613 { |
672 { |
614 FUNC_LOG; |
673 FUNC_LOG; |
615 if ( iMskVisible != aVisible ) |
674 if ( AknLayoutUtils::MSKEnabled() ) |
616 { |
675 { |
617 CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); |
676 if ( iMskVisible != aVisible ) |
618 if ( cba ) |
677 { |
619 { |
678 CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current(); |
620 cba->MakeCommandVisibleByPosition( |
679 if ( cba ) |
621 CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
680 { |
622 aVisible ); |
681 cba->MakeCommandVisibleByPosition( |
623 iMskVisible = aVisible; // Visibility has been changed |
682 CEikButtonGroupContainer::EMiddleSoftkeyPosition, |
624 } |
683 aVisible ); |
625 } |
684 iMskVisible = aVisible; // Visibility has been changed |
626 |
685 } |
627 iCustomMsk = ETrue; // Field has modified editor default MSK |
686 } |
628 } |
687 |
629 |
688 iCustomMsk = ETrue; // Field has modified editor default MSK |
630 // --------------------------------------------------------------------------- |
689 } |
631 // CESMRField::HandleFieldEventL() |
690 } |
|
691 |
|
692 // --------------------------------------------------------------------------- |
|
693 // CESMRField::HandleLongtapEventL |
|
694 // --------------------------------------------------------------------------- |
|
695 // |
|
696 EXPORT_C void CESMRField::HandleLongtapEventL( const TPoint& /*aPosition*/ ) |
|
697 { |
|
698 FUNC_LOG; |
|
699 // Default action for long tap event. |
|
700 ExecuteGenericCommandL( EESMRCmdLongtapDetected ); |
|
701 } |
|
702 |
|
703 // --------------------------------------------------------------------------- |
|
704 // CESMRField::HandleSingletapEventL |
|
705 // --------------------------------------------------------------------------- |
|
706 // |
|
707 EXPORT_C TBool CESMRField::HandleSingletapEventL( const TPoint& /*aPosition*/ ) |
|
708 { |
|
709 FUNC_LOG; |
|
710 // Subclasses may override for field specific actions |
|
711 return EFalse; |
|
712 } |
|
713 |
|
714 // --------------------------------------------------------------------------- |
|
715 // CESMRField::HandleRawPointerEventL |
|
716 // Default implementation for pointer event handling in field |
|
717 // --------------------------------------------------------------------------- |
|
718 // |
|
719 EXPORT_C TBool CESMRField::HandleRawPointerEventL( |
|
720 const TPointerEvent& aPointerEvent ) |
|
721 { |
|
722 FUNC_LOG; |
|
723 |
|
724 if ( aPointerEvent.iType == TPointerEvent::EButton1Up ) |
|
725 { |
|
726 // Default action for touch release |
|
727 if ( !ExecuteGenericCommandL( EAknCmdOpen ) ) |
|
728 { |
|
729 // If the base class implementation does not use the command |
|
730 // then the pointer event is propagated to children. |
|
731 CCoeControl::HandlePointerEventL( aPointerEvent ); |
|
732 } |
|
733 } |
|
734 else |
|
735 { |
|
736 // Propagate the pointer event to child components |
|
737 CCoeControl::HandlePointerEventL( aPointerEvent ); |
|
738 } |
|
739 |
|
740 return ETrue; |
|
741 } |
|
742 |
|
743 // --------------------------------------------------------------------------- |
|
744 // CESMRField::HandleFieldEventL |
632 // --------------------------------------------------------------------------- |
745 // --------------------------------------------------------------------------- |
633 // |
746 // |
634 EXPORT_C void CESMRField::HandleFieldEventL( const MESMRFieldEvent& aEvent ) |
747 EXPORT_C void CESMRField::HandleFieldEventL( const MESMRFieldEvent& aEvent ) |
635 { |
748 { |
636 FUNC_LOG; |
749 FUNC_LOG; |
643 } |
756 } |
644 } |
757 } |
645 } |
758 } |
646 |
759 |
647 // --------------------------------------------------------------------------- |
760 // --------------------------------------------------------------------------- |
648 // CESMRField::EventObserver() |
761 // CESMRField::EventObserver |
649 // --------------------------------------------------------------------------- |
762 // --------------------------------------------------------------------------- |
650 // |
763 // |
651 EXPORT_C MESMRFieldEventObserver* CESMRField::EventObserver() const |
764 EXPORT_C MESMRFieldEventObserver* CESMRField::EventObserver() const |
652 { |
765 { |
653 FUNC_LOG; |
766 FUNC_LOG; |
654 return const_cast< CESMRField* >( this ); |
767 return const_cast< CESMRField* >( this ); |
655 } |
768 } |
656 |
769 |
657 // --------------------------------------------------------------------------- |
770 // --------------------------------------------------------------------------- |
658 // CESMRField::SetFieldMode() |
771 // CESMRField::SetFieldMode |
659 // --------------------------------------------------------------------------- |
772 // --------------------------------------------------------------------------- |
660 // |
773 // |
661 EXPORT_C void CESMRField::SetFieldMode( TESMRFieldMode aMode ) |
774 EXPORT_C void CESMRField::SetFieldMode( TESMRFieldMode aMode ) |
662 { |
775 { |
|
776 FUNC_LOG; |
663 iFieldMode = aMode; |
777 iFieldMode = aMode; |
664 } |
778 } |
665 |
779 |
666 // --------------------------------------------------------------------------- |
780 // --------------------------------------------------------------------------- |
667 // CESMRField::FieldMode() |
781 // CESMRField::FieldMode |
668 // --------------------------------------------------------------------------- |
782 // --------------------------------------------------------------------------- |
669 // |
783 // |
670 EXPORT_C TESMRFieldMode CESMRField::FieldMode() const |
784 EXPORT_C TESMRFieldMode CESMRField::FieldMode() const |
671 { |
785 { |
|
786 FUNC_LOG; |
672 return iFieldMode; |
787 return iFieldMode; |
673 } |
788 } |
|
789 |
|
790 // --------------------------------------------------------------------------- |
|
791 // CESMRField::SetFieldViewMode |
|
792 // --------------------------------------------------------------------------- |
|
793 // |
|
794 EXPORT_C void CESMRField::SetFieldViewMode( TESMRFieldType aViewMode ) |
|
795 { |
|
796 FUNC_LOG; |
|
797 iFieldViewMode = aViewMode; |
|
798 } |
|
799 |
|
800 // --------------------------------------------------------------------------- |
|
801 // CESMRField::FieldViewMode |
|
802 // --------------------------------------------------------------------------- |
|
803 // |
|
804 EXPORT_C TESMRFieldType CESMRField::FieldViewMode() const |
|
805 { |
|
806 FUNC_LOG; |
|
807 return iFieldViewMode; |
|
808 } |
|
809 |
|
810 // --------------------------------------------------------------------------- |
|
811 // CESMRField::UpdateExtControlL |
|
812 // --------------------------------------------------------------------------- |
|
813 // |
|
814 EXPORT_C void CESMRField::UpdateExtControlL( |
|
815 CCoeControl* aControl ) |
|
816 { |
|
817 FUNC_LOG; |
|
818 delete iExtControl; |
|
819 iExtControl = aControl; |
|
820 } |
|
821 |
|
822 // --------------------------------------------------------------------------- |
|
823 // CESMRField::Lock |
|
824 // --------------------------------------------------------------------------- |
|
825 // |
|
826 EXPORT_C void CESMRField::LockL() |
|
827 { |
|
828 iLocked = ETrue; |
|
829 } |
|
830 |
|
831 // --------------------------------------------------------------------------- |
|
832 // CESMRField::IsLocked |
|
833 // --------------------------------------------------------------------------- |
|
834 // |
|
835 EXPORT_C TBool CESMRField::IsLocked() |
|
836 { |
|
837 return iLocked; |
|
838 } |
|
839 |
|
840 |
|
841 // --------------------------------------------------------------------------- |
|
842 // CESMRField::HandleTactileFeedbackL |
|
843 // --------------------------------------------------------------------------- |
|
844 // |
|
845 EXPORT_C void CESMRField::HandleTactileFeedbackL() |
|
846 { |
|
847 FUNC_LOG; |
|
848 |
|
849 AquireTactileFeedback(); |
|
850 |
|
851 if ( iTactileFeedback && iTactileFeedback->FeedbackEnabledForThisApp() ) |
|
852 { |
|
853 iTactileFeedback->InstantFeedback( ETouchFeedbackBasic ); |
|
854 } |
|
855 } |
|
856 |
|
857 // --------------------------------------------------------------------------- |
|
858 // CESMRField::AquireTactileFeedback |
|
859 // --------------------------------------------------------------------------- |
|
860 // |
|
861 void CESMRField::AquireTactileFeedback() |
|
862 { |
|
863 if( !iTactileFeedback ) |
|
864 { |
|
865 // Aquire tactile feedback pointer from TLS |
|
866 iTactileFeedback = MTouchFeedback::Instance(); |
|
867 } |
|
868 } |
|
869 |
|
870 |
674 // EOF |
871 // EOF |
675 |
872 |