37
|
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: Key event forwarder.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
#include <eikenv.h>
|
|
21 |
#include <eikappui.h>
|
|
22 |
#include <bldvariant.hrh>
|
|
23 |
#include <featmgr.h>
|
|
24 |
#include <PtiDefs.h>
|
|
25 |
|
|
26 |
#include "mphonestatemachine.h"
|
|
27 |
#include "mphonekeyeventhandler.h"
|
|
28 |
#include "cphonekeys.h"
|
|
29 |
#include "cphonekeyeventforwarder.h"
|
|
30 |
#include "cphonepubsubproxy.h"
|
|
31 |
#include "cphonetimer.h"
|
|
32 |
#include "phonelogger.h"
|
|
33 |
#include "phoneui.pan"
|
|
34 |
|
|
35 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
36 |
|
|
37 |
// -----------------------------------------------------------------------------
|
|
38 |
// CPhoneKeyEventForwarder::NewL
|
|
39 |
// -----------------------------------------------------------------------------
|
|
40 |
//
|
|
41 |
CPhoneKeyEventForwarder* CPhoneKeyEventForwarder::NewL(
|
|
42 |
const TRect& aRect,
|
|
43 |
MPhoneStateMachine* aStateMachine,
|
|
44 |
MPhoneViewCommandHandle* aViewCommandHandle )
|
|
45 |
{
|
|
46 |
CPhoneKeyEventForwarder* self =
|
|
47 |
new (ELeave) CPhoneKeyEventForwarder( aStateMachine, aViewCommandHandle );
|
|
48 |
|
|
49 |
CleanupStack::PushL( self );
|
|
50 |
self->ConstructL( aRect );
|
|
51 |
CleanupStack::Pop( self );
|
|
52 |
|
|
53 |
return self;
|
|
54 |
}
|
|
55 |
|
|
56 |
// -----------------------------------------------------------------------------
|
|
57 |
// CPhoneKeyEventForwarder::~CPhoneKeyEventForwarder
|
|
58 |
// -----------------------------------------------------------------------------
|
|
59 |
//
|
|
60 |
CPhoneKeyEventForwarder::~CPhoneKeyEventForwarder()
|
|
61 |
{
|
|
62 |
__LOGMETHODSTARTEND( EPhoneControl, "CPhoneKeyEventForwarder::~CPhoneKeyEventForwarder");
|
|
63 |
|
|
64 |
CEikonEnv* env = static_cast<CEikonEnv*>(ControlEnv());
|
|
65 |
if( env )
|
|
66 |
{
|
|
67 |
env->EikAppUi()->RemoveFromStack( this );
|
|
68 |
}
|
|
69 |
delete iLongPressKeyEventTimer;
|
|
70 |
}
|
|
71 |
|
|
72 |
// -----------------------------------------------------------------------------
|
|
73 |
// CPhoneKeyEventForwarder::CountComponentControls
|
|
74 |
// -----------------------------------------------------------------------------
|
|
75 |
//
|
|
76 |
TInt CPhoneKeyEventForwarder::CountComponentControls() const
|
|
77 |
{
|
|
78 |
__LOGMETHODSTARTEND( EPhoneControl, "CPhoneKeyEventForwarder::CountComponentControls");
|
|
79 |
return 0;
|
|
80 |
}
|
|
81 |
|
|
82 |
// -----------------------------------------------------------------------------
|
|
83 |
// CPhoneKeyEventForwarder::ComponentControl
|
|
84 |
// -----------------------------------------------------------------------------
|
|
85 |
//
|
|
86 |
CCoeControl* CPhoneKeyEventForwarder::ComponentControl(
|
|
87 |
TInt /*aIndex*/ ) const
|
|
88 |
{
|
|
89 |
__LOGMETHODSTARTEND( EPhoneControl, "CPhoneKeyEventForwarder::ComponentControl");
|
|
90 |
return NULL;
|
|
91 |
}
|
|
92 |
|
|
93 |
// -----------------------------------------------------------------------------
|
|
94 |
// CPhoneKeyEventForwarder::SizeChanged
|
|
95 |
// -----------------------------------------------------------------------------
|
|
96 |
//
|
|
97 |
void CPhoneKeyEventForwarder::SizeChanged()
|
|
98 |
{
|
|
99 |
__LOGMETHODSTARTEND( EPhoneControl, "CPhoneKeyEventForwarder::SizeChanged");
|
|
100 |
}
|
|
101 |
|
|
102 |
// -----------------------------------------------------------------------------
|
|
103 |
// CPhoneKeyEventForwarder::Draw
|
|
104 |
// -----------------------------------------------------------------------------
|
|
105 |
//
|
|
106 |
void CPhoneKeyEventForwarder::Draw(
|
|
107 |
const TRect& /*aRect*/ ) const
|
|
108 |
{
|
|
109 |
__LOGMETHODSTARTEND( EPhoneControl, "CPhoneKeyEventForwarder::Draw");
|
|
110 |
}
|
|
111 |
|
|
112 |
// -----------------------------------------------------------------------------
|
|
113 |
// CPhoneKeyEventForwarder::OfferKeyEventL
|
|
114 |
// Checks is hte keyevent such that the number entry can be opened
|
|
115 |
// -----------------------------------------------------------------------------
|
|
116 |
//
|
|
117 |
TKeyResponse CPhoneKeyEventForwarder::OfferKeyEventL(
|
|
118 |
const TKeyEvent& aKeyEvent,
|
|
119 |
TEventCode aType )
|
|
120 |
{
|
|
121 |
__LOGMETHODSTARTEND( EPhoneControl,
|
|
122 |
"CPhoneKeyEventForwarder::OfferKeyEventL");
|
|
123 |
|
|
124 |
TKeyResponse ret( EKeyWasNotConsumed );
|
|
125 |
TKeyEvent keyEvent = aKeyEvent;
|
|
126 |
|
|
127 |
ret = OfferKeyEventBeforeControlStackL( aKeyEvent, aType );
|
|
128 |
|
|
129 |
// Convert event. Use already converted iKeyPressedDown.
|
|
130 |
// Do not convert other than DTMF tones
|
|
131 |
if( CPhoneKeys::IsDtmfTone( aKeyEvent, aType ) )
|
|
132 |
{
|
|
133 |
keyEvent.iCode = iKeyPressedDown;
|
|
134 |
}
|
|
135 |
|
|
136 |
if ( !keyEvent.iRepeats )
|
|
137 |
{
|
|
138 |
// Start and stop dtmf
|
|
139 |
iStateMachine->State()->HandleDtmfKeyToneL( keyEvent, aType );
|
|
140 |
if( aType != EEventKeyUp &&
|
|
141 |
( CPhoneKeys::IsNumericKey( keyEvent, aType ) ||
|
|
142 |
IsAlphaNumericKey( keyEvent ) )
|
|
143 |
)
|
|
144 |
{
|
|
145 |
// Do not open number entry with up key
|
|
146 |
iStateMachine->State()->HandleCreateNumberEntryL( keyEvent, aType );
|
|
147 |
}
|
|
148 |
}
|
|
149 |
|
|
150 |
return ret;
|
|
151 |
}
|
|
152 |
|
|
153 |
// -----------------------------------------------------------------------------
|
|
154 |
// CPhoneKeyEventForwarder::CPhoneKeyEventForwarder
|
|
155 |
// -----------------------------------------------------------------------------
|
|
156 |
//
|
|
157 |
CPhoneKeyEventForwarder::CPhoneKeyEventForwarder(
|
|
158 |
MPhoneStateMachine* aStateMachine,
|
|
159 |
MPhoneViewCommandHandle* aViewCommandHandle )
|
|
160 |
: iStateMachine( aStateMachine ),
|
|
161 |
iViewCommandHandle( aViewCommandHandle )
|
|
162 |
{
|
|
163 |
__LOGMETHODSTARTEND( EPhoneControl,
|
|
164 |
"CPhoneKeyEventForwarder::CPhoneKeyEventForwarder");
|
|
165 |
}
|
|
166 |
|
|
167 |
// -----------------------------------------------------------------------------
|
|
168 |
// CPhoneKeyEventForwarder::ConstructL
|
|
169 |
// -----------------------------------------------------------------------------
|
|
170 |
//
|
|
171 |
void CPhoneKeyEventForwarder::ConstructL( const TRect& aRect )
|
|
172 |
{
|
|
173 |
__LOGMETHODSTARTEND( EPhoneControl,
|
|
174 |
"CPhoneKeyEventForwarder::ConstructL");
|
|
175 |
|
|
176 |
if ( FeatureManager::FeatureSupported( KFeatureIdKeypadNoSlider ) )
|
|
177 |
{
|
|
178 |
RWindowGroup& groupWin = iCoeEnv->RootWin();
|
|
179 |
}
|
|
180 |
// Create invisible control.
|
|
181 |
CreateWindowL();
|
|
182 |
MakeVisible( EFalse );
|
|
183 |
SetRect( aRect );
|
|
184 |
|
|
185 |
CEikonEnv* env = static_cast<CEikonEnv*>(ControlEnv());
|
|
186 |
if( env )
|
|
187 |
{
|
|
188 |
env->EikAppUi()->AddToStackL(
|
|
189 |
this,
|
|
190 |
ECoeStackPriorityEnvironmentFilter,
|
|
191 |
ECoeStackFlagRefusesFocus );
|
|
192 |
}
|
|
193 |
|
|
194 |
// Create the long press key event timer
|
|
195 |
iLongPressKeyEventTimer = CPhoneTimer::NewL();
|
|
196 |
}
|
|
197 |
|
|
198 |
// -----------------------------------------------------------------------------
|
|
199 |
// CPhoneKeyEventForwarder::IsAlphaNumericKey
|
|
200 |
// -----------------------------------------------------------------------------
|
|
201 |
//
|
|
202 |
TBool CPhoneKeyEventForwarder::IsAlphaNumericKey( const TKeyEvent& aKeyEvent )
|
|
203 |
{
|
|
204 |
__LOGMETHODSTARTEND( EPhoneControl,
|
|
205 |
"CPhoneKeyEventForwarder::IsAlphaNumericKey");
|
|
206 |
|
|
207 |
TBool alphaNumeric =
|
|
208 |
iStateMachine->State()->IsAlphanumericSupportedAndCharInput( aKeyEvent );
|
|
209 |
|
|
210 |
return alphaNumeric;
|
|
211 |
}
|
|
212 |
|
|
213 |
// -----------------------------------------------------------------------------
|
|
214 |
// CPhoneKeyEventForwarder::ConvertHalfQwertySpecialChar
|
|
215 |
// -----------------------------------------------------------------------------
|
|
216 |
//
|
|
217 |
TBool CPhoneKeyEventForwarder::ConvertHalfQwertySpecialChar( TUint& aCode,
|
|
218 |
const TKeyEvent& aKeyEvent )
|
|
219 |
{
|
|
220 |
__LOGMETHODSTARTEND( EPhoneControl,
|
|
221 |
"CPhoneKeyEventForwarder::ConvertHalfQwertySpecialChar");
|
|
222 |
|
|
223 |
TBool ret( EFalse );
|
|
224 |
TInt keyboard(KErrNotFound);
|
|
225 |
|
|
226 |
if( keyboard == EPtiKeyboardHalfQwerty )
|
|
227 |
{
|
|
228 |
switch ( aKeyEvent.iScanCode )
|
|
229 |
{
|
|
230 |
case EStdKeyLeftShift:
|
|
231 |
ret = ETrue;
|
|
232 |
aCode = KPhoneDtmfHashCharacter;
|
|
233 |
break;
|
|
234 |
case EStdKeyLeftFunc:
|
|
235 |
ret = ETrue;
|
|
236 |
aCode = KPhoneDtmfStarCharacter;
|
|
237 |
break;
|
|
238 |
case EStdKeySpace:
|
|
239 |
ret = ETrue;
|
|
240 |
aCode = KPhoneDtmf0Character;
|
|
241 |
break;
|
|
242 |
default:
|
|
243 |
break;
|
|
244 |
}
|
|
245 |
}
|
|
246 |
|
|
247 |
__PHONELOG1( EBasic, EPhoneControl,
|
|
248 |
"CPhoneKeyEventForwarder::ConvertHalfQwertySpecialChar =%d ",
|
|
249 |
ret );
|
|
250 |
|
|
251 |
return ret;
|
|
252 |
}
|
|
253 |
|
|
254 |
// -----------------------------------------------------------------------------
|
|
255 |
// CPhoneKeyEventForwarder::OfferKeyEventBeforeControlStackL
|
|
256 |
// Let phone handle before other components in control stack
|
|
257 |
// -----------------------------------------------------------------------------
|
|
258 |
//
|
|
259 |
TKeyResponse CPhoneKeyEventForwarder::OfferKeyEventBeforeControlStackL(
|
|
260 |
const TKeyEvent& aKeyEvent,
|
|
261 |
TEventCode aType )
|
|
262 |
{
|
|
263 |
__LOGMETHODSTARTEND( EPhoneControl,
|
|
264 |
"CPhoneKeyEventForwarder::OfferKeyEventBeforeControlStackL");
|
|
265 |
|
|
266 |
TKeyResponse response( EKeyWasNotConsumed );
|
|
267 |
if( !IsKeyBlocked( aKeyEvent ) )
|
|
268 |
{
|
|
269 |
// Handle key events before FEP
|
|
270 |
// This is must becouse FEP consumes * key and when
|
|
271 |
// editor is in alphanumeric mode FEP consumes all alphanumeric
|
|
272 |
// keys
|
|
273 |
switch( aType )
|
|
274 |
{
|
|
275 |
// EEventKeyDown
|
|
276 |
case EEventKeyDown:
|
|
277 |
response = HandleEventKeyDownBeforeControlStackL( aKeyEvent );
|
|
278 |
break;
|
|
279 |
// EEventKey
|
|
280 |
case EEventKey:
|
|
281 |
response = HandleEventKeyBeforeControlStackL( aKeyEvent );
|
|
282 |
break;
|
|
283 |
// EEventKeyUp
|
|
284 |
case EEventKeyUp:
|
|
285 |
response = HandleEventKeyUpBeforeControlStackL( aKeyEvent );
|
|
286 |
break;
|
|
287 |
default:
|
|
288 |
break;
|
|
289 |
}
|
|
290 |
|
|
291 |
}
|
|
292 |
return response;
|
|
293 |
}
|
|
294 |
|
|
295 |
|
|
296 |
// -----------------------------------------------------------------------------
|
|
297 |
// CPhoneKeyEventForwarder::OfferKeyEventAfterControlStackL
|
|
298 |
// Let phone handle keys if no one has done it already
|
|
299 |
// -----------------------------------------------------------------------------
|
|
300 |
//
|
|
301 |
TKeyResponse CPhoneKeyEventForwarder::OfferKeyEventAfterControlStackL(
|
|
302 |
const TKeyEvent& aKeyEvent,
|
|
303 |
TEventCode aType )
|
|
304 |
{
|
|
305 |
__LOGMETHODSTARTEND( EPhoneControl,
|
|
306 |
"CPhoneKeyEventForwarder::OfferKeyEventAfterControlStackL");
|
|
307 |
|
|
308 |
if( !IsKeyBlocked( aKeyEvent ) )
|
|
309 |
{
|
|
310 |
// Send key to editor
|
|
311 |
iStateMachine->State()->HandleKeyEventL( aKeyEvent, aType );
|
|
312 |
|
|
313 |
if( EEventKeyUp == aType
|
|
314 |
&& EKeyNull != iKeyPressedDown )
|
|
315 |
{
|
|
316 |
// Handle short key press
|
|
317 |
iStateMachine->State()->HandleKeyMessageL(
|
|
318 |
MPhoneKeyEvents::EPhoneKeyShortPress,
|
|
319 |
TKeyCode( iKeyPressedDown ) );
|
|
320 |
|
|
321 |
// Reset key code
|
|
322 |
iScanCode = EStdKeyNull;
|
|
323 |
iKeyPressedDown = EKeyNull;
|
|
324 |
}
|
|
325 |
}
|
|
326 |
|
|
327 |
return EKeyWasNotConsumed;
|
|
328 |
}
|
|
329 |
|
|
330 |
// -----------------------------------------------------------
|
|
331 |
// CPhoneKeyEventForwarder::HandleEventKeyDownBeforeControlStackL
|
|
332 |
// -----------------------------------------------------------
|
|
333 |
//
|
|
334 |
TKeyResponse CPhoneKeyEventForwarder::HandleEventKeyDownBeforeControlStackL(
|
|
335 |
const TKeyEvent& aKeyEvent )
|
|
336 |
{
|
|
337 |
__LOGMETHODSTARTEND( EPhoneControl,
|
|
338 |
"CPhoneKeyEventForwarder::HandleEventKeyDownBeforeControlStackL");
|
|
339 |
|
|
340 |
// Convert key code
|
|
341 |
ConvertKeyCode( iKeyPressedDown, aKeyEvent );
|
|
342 |
// Save key scan code
|
|
343 |
iScanCode = aKeyEvent.iScanCode;
|
|
344 |
|
|
345 |
// Start the key press timer
|
|
346 |
iKeyPressTime.UniversalTime();
|
|
347 |
|
|
348 |
// Cancel the long press key event timer, if it is active
|
|
349 |
if ( iLongPressKeyEventTimer->IsActive() )
|
|
350 |
{
|
|
351 |
iLongPressKeyEventTimer->CancelTimer();
|
|
352 |
}
|
|
353 |
|
|
354 |
// Re-start the timer
|
|
355 |
iLongPressKeyEventTimer->After(
|
|
356 |
KPhoneLongPressKeyEventDuration,
|
|
357 |
TCallBack( DoHandleLongPressKeyEventCallbackL,
|
|
358 |
this ) );
|
|
359 |
|
|
360 |
return ( EKeyWasNotConsumed );
|
|
361 |
}
|
|
362 |
|
|
363 |
// -----------------------------------------------------------
|
|
364 |
// CPhoneKeyEventForwarder::HandleEventKeyBeforeControlStackL
|
|
365 |
// Both short key press event (iRepeats == 0) and
|
|
366 |
// long key press event (iRepeats == 1) are handled here
|
|
367 |
// -----------------------------------------------------------
|
|
368 |
//
|
|
369 |
TKeyResponse CPhoneKeyEventForwarder::HandleEventKeyBeforeControlStackL(
|
|
370 |
const TKeyEvent& aKeyEvent )
|
|
371 |
{
|
|
372 |
__LOGMETHODSTARTEND( EPhoneControl,
|
|
373 |
"CPhoneKeyEventForwarder::HandleEventKeyBeforeControlStackL");
|
|
374 |
|
|
375 |
TKeyResponse response( EKeyWasNotConsumed );
|
|
376 |
|
|
377 |
// Convert event.
|
|
378 |
TKeyEvent keyEvent = aKeyEvent;
|
|
379 |
keyEvent.iCode = iKeyPressedDown;
|
|
380 |
|
|
381 |
if( aKeyEvent.iRepeats > 0 &&
|
|
382 |
CPhoneKeys::IsDtmfTone( keyEvent, EEventKey ) )
|
|
383 |
{
|
|
384 |
// Do not repeat dtmf characters
|
|
385 |
response = EKeyWasConsumed;
|
|
386 |
}
|
|
387 |
|
|
388 |
return response;
|
|
389 |
}
|
|
390 |
|
|
391 |
// -----------------------------------------------------------
|
|
392 |
// CPhoneKeyEventForwarder::HandleEventKeyUpBeforeControlStackL
|
|
393 |
// -----------------------------------------------------------
|
|
394 |
//
|
|
395 |
TKeyResponse CPhoneKeyEventForwarder::HandleEventKeyUpBeforeControlStackL(
|
|
396 |
const TKeyEvent& aKeyEvent )
|
|
397 |
{
|
|
398 |
__LOGMETHODSTARTEND( EPhoneControl,
|
|
399 |
"CPhoneKeyEventForwarder::HandleEventKeyUpBeforeControlStackL");
|
|
400 |
|
|
401 |
// Send a long press key event to the current state provided
|
|
402 |
// that the key scan code is the same as the key that was pressed
|
|
403 |
if ( iScanCode == aKeyEvent.iScanCode )
|
|
404 |
{
|
|
405 |
// Pass the key press duration to the current state
|
|
406 |
TTime now;
|
|
407 |
now.UniversalTime();
|
|
408 |
TTimeIntervalMicroSeconds keyPressDuration = now.MicroSecondsFrom(
|
|
409 |
iKeyPressTime );
|
|
410 |
iStateMachine->State()->HandleKeyPressDurationL(
|
|
411 |
TKeyCode( iKeyPressedDown ),
|
|
412 |
keyPressDuration );
|
|
413 |
|
|
414 |
// Cancel the long press timer, if it is active. Otherwise
|
|
415 |
// ignore the key event since it was already handled as a long press
|
|
416 |
// key event.
|
|
417 |
if ( iLongPressKeyEventTimer->IsActive() )
|
|
418 |
{
|
|
419 |
iLongPressKeyEventTimer->CancelTimer();
|
|
420 |
}
|
|
421 |
}
|
|
422 |
|
|
423 |
return EKeyWasNotConsumed;
|
|
424 |
}
|
|
425 |
|
|
426 |
// ---------------------------------------------------------
|
|
427 |
// CPhoneKeyEventForwarder::DoHandleLongPressKeyEventCallback
|
|
428 |
//
|
|
429 |
// This routine is called when the long press key event timer expires
|
|
430 |
// after KPhoneLongPressKeyEventDuration.
|
|
431 |
// ---------------------------------------------------------
|
|
432 |
//
|
|
433 |
TInt CPhoneKeyEventForwarder::DoHandleLongPressKeyEventCallbackL( TAny* aAny )
|
|
434 |
{
|
|
435 |
__LOGMETHODSTARTEND( EPhoneControl,
|
|
436 |
"CPhoneKeyEventForwarder::DoHandleLongPressKeyEventCallbackL");
|
|
437 |
|
|
438 |
__ASSERT_DEBUG( aAny,
|
|
439 |
Panic( EPhoneCtrlUnknownPanic ) );
|
|
440 |
|
|
441 |
reinterpret_cast< CPhoneKeyEventForwarder* >( aAny )->
|
|
442 |
HandleLongPressKeyEventL();
|
|
443 |
|
|
444 |
return KErrNone;
|
|
445 |
}
|
|
446 |
|
|
447 |
// ---------------------------------------------------------
|
|
448 |
// CPhoneKeyEventForwarder::HandleLongPressKeyEventL
|
|
449 |
// Handle long press key event
|
|
450 |
// ---------------------------------------------------------
|
|
451 |
//
|
|
452 |
void CPhoneKeyEventForwarder::HandleLongPressKeyEventL()
|
|
453 |
{
|
|
454 |
__LOGMETHODSTARTEND( EPhoneControl,
|
|
455 |
"CPhoneKeyEventForwarder::HandleLongPressKeyEventL");
|
|
456 |
|
|
457 |
// In alphanumeric mode EEventKey-event is not received so we must
|
|
458 |
// compare also with scan code.
|
|
459 |
if ( KPhoneDtmfHashCharacter == iKeyPressedDown )
|
|
460 |
{
|
|
461 |
// Separate handling for long hash key because there is so much
|
|
462 |
// different functionality under it and it works differently
|
|
463 |
// in different protocols.
|
|
464 |
iStateMachine->State()->HandleLongHashL();
|
|
465 |
}
|
|
466 |
else if ( KPhoneDtmfStarCharacter == iKeyPressedDown )
|
|
467 |
{
|
|
468 |
// KPhoneDtmfStarCharacter value used in configuration file for
|
|
469 |
// long key press application launching
|
|
470 |
iStateMachine->State()->HandleKeyMessageL(
|
|
471 |
MPhoneKeyEvents::EPhoneKeyLongPress,
|
|
472 |
TKeyCode( KPhoneDtmfStarCharacter ) );
|
|
473 |
}
|
|
474 |
else
|
|
475 |
{
|
|
476 |
__PHONELOG1(
|
|
477 |
EBasic, EPhoneControl,
|
|
478 |
"CPhoneKeyEventHandler::HandleLongPressKeyEventL iCode(%d)",
|
|
479 |
iKeyPressedDown );
|
|
480 |
iStateMachine->State()->HandleKeyMessageL(
|
|
481 |
MPhoneKeyEvents::EPhoneKeyLongPress,
|
|
482 |
TKeyCode( iKeyPressedDown ) );
|
|
483 |
}
|
|
484 |
|
|
485 |
// Reset key code
|
|
486 |
iScanCode = EStdKeyNull;
|
|
487 |
iKeyPressedDown = EKeyNull;
|
|
488 |
}
|
|
489 |
|
|
490 |
// -----------------------------------------------------------
|
|
491 |
// CPhoneKeyEventForwarder::ConvertKeyCode
|
|
492 |
// -----------------------------------------------------------
|
|
493 |
//
|
|
494 |
void CPhoneKeyEventForwarder::ConvertKeyCode( TUint& aCode,
|
|
495 |
const TKeyEvent& aKeyEvent )
|
|
496 |
{
|
|
497 |
__LOGMETHODSTARTEND( EPhoneControl,
|
|
498 |
"CPhoneKeyEventForwarder::ConvertKeyCode");
|
|
499 |
|
|
500 |
// Handler for special device key mapping in case iScanCode
|
|
501 |
// to iCode conversion hasn't been handled by CAknAppUi::GetAliasKeyCodeL
|
|
502 |
__PHONELOG1( EBasic, EPhoneControl,
|
|
503 |
"CPhoneKeyEventHandler::ConvertKeyCode scan code (%d)",
|
|
504 |
aKeyEvent.iScanCode );
|
|
505 |
|
|
506 |
if( !ConvertHalfQwertySpecialChar( aCode, aKeyEvent ) )
|
|
507 |
{
|
|
508 |
switch ( aKeyEvent.iScanCode )
|
|
509 |
{
|
|
510 |
case EStdKeyEnter:
|
|
511 |
aCode = EKeyEnter;
|
|
512 |
break;
|
|
513 |
case EStdKeyYes:
|
|
514 |
aCode = EKeyYes;
|
|
515 |
break;
|
|
516 |
case EStdKeyNo:
|
|
517 |
aCode = EKeyNo;
|
|
518 |
break;
|
|
519 |
case EStdKeyDeviceF:
|
|
520 |
aCode = EKeyDeviceF; // EStdKeyDeviceF mapping for unlock switch.
|
|
521 |
break;
|
|
522 |
case EStdKeyHash:
|
|
523 |
aCode = KPhoneDtmfHashCharacter;
|
|
524 |
break;
|
|
525 |
case EStdKeyNkpAsterisk:
|
|
526 |
aCode = KPhoneDtmfStarCharacter;
|
|
527 |
break;
|
|
528 |
case EStdKeyApplication0:
|
|
529 |
aCode = EKeyApplication0;
|
|
530 |
break;
|
|
531 |
|
|
532 |
default:
|
|
533 |
aCode = aKeyEvent.iScanCode; // Use default code
|
|
534 |
break;
|
|
535 |
}
|
|
536 |
}
|
|
537 |
|
|
538 |
__PHONELOG1( EBasic, EPhoneControl,
|
|
539 |
"CPhoneKeyEventHandler::ConvertKeyCode aCode (%d)", aCode );
|
|
540 |
}
|
|
541 |
|
|
542 |
// -----------------------------------------------------------------------------
|
|
543 |
// CPhoneKeyEventForwarder::IsKeyBlocked
|
|
544 |
// -----------------------------------------------------------------------------
|
|
545 |
//
|
|
546 |
TBool CPhoneKeyEventForwarder::IsKeyBlocked( const TKeyEvent& aKeyEvent ) const
|
|
547 |
{
|
|
548 |
TBool ret = EFalse;
|
|
549 |
|
|
550 |
// Check blocked keys
|
|
551 |
const RArray<TInt>& keyScanCodeList = iStateMachine->State()->GetBlockedKeyList();
|
|
552 |
TInt count = keyScanCodeList.Count();
|
|
553 |
if( count )
|
|
554 |
{
|
|
555 |
for( TInt i = 0; i < count; i++ )
|
|
556 |
{
|
|
557 |
if( keyScanCodeList[i] == aKeyEvent.iScanCode )
|
|
558 |
{
|
|
559 |
ret = ETrue;
|
|
560 |
}
|
|
561 |
}
|
|
562 |
}
|
|
563 |
__PHONELOG1( EBasic, EPhoneControl,
|
|
564 |
"CPhoneKeyEventHandler::IsKeyBlocked return (%d)", ret );
|
|
565 |
|
|
566 |
return ret;
|
|
567 |
}
|
|
568 |
|
|
569 |
// End of File
|
|
570 |
|