37 #include "phonerssbase.h" |
38 #include "phonerssbase.h" |
38 #include "phoneui.pan" |
39 #include "phoneui.pan" |
39 #include "phoneviewcommanddefinitions.h" |
40 #include "phoneviewcommanddefinitions.h" |
40 #include "phoneappcommands.hrh" |
41 #include "phoneappcommands.hrh" |
41 #include "phonelogger.h" |
42 #include "phonelogger.h" |
|
43 #include "mphonesecuritymodeobserver.h" |
42 |
44 |
43 const TInt KPhoneKeyStart = 33; |
45 const TInt KPhoneKeyStart = 33; |
44 const TInt KPhoneKeyEnd = 127; |
46 const TInt KPhoneKeyEnd = 127; |
|
47 |
|
48 const TInt KKeyCtrlA( 1 ); |
|
49 const TInt KKeyCtrlC( 3 ); |
|
50 const TInt KKeyCtrlV( 22 ); |
|
51 const TInt KKeyCtrlX( 24 ); |
45 |
52 |
46 // ======== MEMBER FUNCTIONS ======== |
53 // ======== MEMBER FUNCTIONS ======== |
47 |
54 |
48 // --------------------------------------------------------------------------- |
55 // --------------------------------------------------------------------------- |
49 // CPhoneNumberEntryManager::CPhoneNumberEntryManager |
56 // CPhoneNumberEntryManager::CPhoneNumberEntryManager |
58 : iState ( aState ), |
65 : iState ( aState ), |
59 iViewCommandHandle ( aViewCommandHandle ), |
66 iViewCommandHandle ( aViewCommandHandle ), |
60 iStateMachine ( aStateMachine ), |
67 iStateMachine ( aStateMachine ), |
61 iCustomization ( aCustomization ), |
68 iCustomization ( aCustomization ), |
62 iCbaManager ( aCbaManager ), |
69 iCbaManager ( aCbaManager ), |
63 iEnv( *CEikonEnv::Static() ) |
70 iEnv( *CEikonEnv::Static() ) // codescanner::eikonenvstatic |
64 { |
71 { |
65 __LOGMETHODSTARTEND( EPhoneControl, "CPhoneNumberEntryManager::CPhoneNumberEntryManager() "); |
72 __LOGMETHODSTARTEND( EPhoneControl, "CPhoneNumberEntryManager::CPhoneNumberEntryManager() "); |
66 } |
73 } |
67 |
74 |
68 // --------------------------------------------------------------------------- |
75 // --------------------------------------------------------------------------- |
142 &stringParam ); |
149 &stringParam ); |
143 } |
150 } |
144 } |
151 } |
145 |
152 |
146 // ----------------------------------------------------------- |
153 // ----------------------------------------------------------- |
|
154 // CPhoneNumberEntryManager::RestoreNumberEntryContentL |
|
155 // ----------------------------------------------------------- |
|
156 // |
|
157 void CPhoneNumberEntryManager::RestoreNumberEntryContentL() |
|
158 { |
|
159 __LOGMETHODSTARTEND( EPhoneControl, "CPhoneNumberEntryManager::RestoreNumberEntryContentL( ) "); |
|
160 if ( iNumberEntryContent ) |
|
161 { |
|
162 // Restore the number entry content from cache |
|
163 TPtr ptr( iNumberEntryContent->Des() ); |
|
164 iViewCommandHandle.ExecuteCommandL( EPhoneViewSetNumberEntryContent, 0, ptr ); |
|
165 delete iNumberEntryContent; |
|
166 iNumberEntryContent = NULL; |
|
167 } |
|
168 } |
|
169 |
|
170 // ----------------------------------------------------------- |
147 // CPhoneNumberEntryManager::IsNumberEntryContentStored |
171 // CPhoneNumberEntryManager::IsNumberEntryContentStored |
148 // ----------------------------------------------------------- |
172 // ----------------------------------------------------------- |
149 // |
173 // |
150 TBool CPhoneNumberEntryManager::IsNumberEntryContentStored() |
174 TBool CPhoneNumberEntryManager::IsNumberEntryContentStored() |
151 { |
175 { |
162 __LOGMETHODSTARTEND( EPhoneControl, "CPhoneNumberEntryManager::ClearNumberEntryContentCache( ) "); |
186 __LOGMETHODSTARTEND( EPhoneControl, "CPhoneNumberEntryManager::ClearNumberEntryContentCache( ) "); |
163 delete iNumberEntryContent; |
187 delete iNumberEntryContent; |
164 iNumberEntryContent = NULL; |
188 iNumberEntryContent = NULL; |
165 } |
189 } |
166 |
190 |
|
191 // ----------------------------------------------------------- |
|
192 // CPhoneNumberEntryManager::CreateNumberEntryL |
|
193 // ----------------------------------------------------------- |
|
194 void CPhoneNumberEntryManager::CreateNumberEntryL() |
|
195 { |
|
196 __LOGMETHODSTARTEND( EPhoneControl, "CPhoneNumberEntryManager::CreateNumberEntryL( ) "); |
|
197 iViewCommandHandle.ExecuteCommandL( EPhoneViewCreateNumberEntry ); |
|
198 } |
167 |
199 |
168 // ----------------------------------------------------------- |
200 // ----------------------------------------------------------- |
169 // CPhoneNumberEntryManager::SetNumberEntryVisibilityL |
201 // CPhoneNumberEntryManager::SetNumberEntryVisibilityL |
170 // ----------------------------------------------------------- |
202 // ----------------------------------------------------------- |
171 // |
203 // |
174 __LOGMETHODSTARTEND(EPhoneControl, "CPhoneNumberEntryManager::SetNumberEntryVisibilityL( ) "); |
206 __LOGMETHODSTARTEND(EPhoneControl, "CPhoneNumberEntryManager::SetNumberEntryVisibilityL( ) "); |
175 __PHONELOG1( EBasic, EPhoneControl, |
207 __PHONELOG1( EBasic, EPhoneControl, |
176 "CPhoneNumberEntryManager::SetNumberEntryVisibilityL : aVisible =%d", |
208 "CPhoneNumberEntryManager::SetNumberEntryVisibilityL : aVisible =%d", |
177 aVisible.Boolean() ); |
209 aVisible.Boolean() ); |
178 iViewCommandHandle.ExecuteCommandL( EPhoneViewSetNumberEntryVisible, &aVisible ); |
210 iViewCommandHandle.ExecuteCommandL( EPhoneViewSetNumberEntryVisible, &aVisible ); |
|
211 if ( aVisible.Boolean() ) |
|
212 { |
|
213 // Set Number Entry CBA |
|
214 iCbaManager.UpdateCbaL( EPhoneNumberAcqCBA ); |
|
215 } |
|
216 } |
|
217 |
|
218 // ----------------------------------------------------------- |
|
219 // CPhoneNumberEntryManager::HandleCreateNumberEntryL |
|
220 // add conditions here regarding when NE can be opened: |
|
221 // - activeidle is not the top most application |
|
222 // - any query is not visible |
|
223 // - dialog is not visible ("new call") |
|
224 // - information note is not visible ("IMEI code", "life timer") |
|
225 // - options menu bar is not visible |
|
226 // - "switch to ..." -operation is not ongoing |
|
227 // ----------------------------------------------------------- |
|
228 // |
|
229 void CPhoneNumberEntryManager::HandleCreateNumberEntryL() |
|
230 { |
|
231 __LOGMETHODSTARTEND( EPhoneControl, "CPhoneNumberEntryManager::HandleCreateNumberEntryL() "); |
|
232 |
|
233 const TBool autoLockOn = iStateMachine.SecurityMode()->IsSecurityMode(); |
|
234 const TBool idleVal = CPhonePubSubProxy::Instance()->Value( KPSUidAiInformation, KActiveIdleState ); |
|
235 const TBool queryActive = iState->IsAnyQueryActiveL(); |
|
236 const TBool menuBarVisible = iState->IsMenuBarVisibleL(); |
|
237 |
|
238 if( autoLockOn || |
|
239 ( idleVal == EPSAiForeground ) || |
|
240 ( menuBarVisible || queryActive ) ) |
|
241 { |
|
242 __PHONELOG( EBasic, EPhoneControl, |
|
243 "CPhoneNumberEntryManager::HandleCreateNumberEntryL() NE NOT CREATED" ); |
|
244 __PHONELOG2( EBasic, EPhoneControl, |
|
245 "CPhoneNumberEntryManager::HandleCreateNumberEntryL() autoLcokOn(%d) idleVal(%d)", |
|
246 autoLockOn, idleVal ); |
|
247 __PHONELOG2( EBasic, EPhoneControl, |
|
248 "CPhoneNumberEntryManager::HandleCreateNumberEntryL() queryActive(%d) menuBarVisible(%d)", |
|
249 queryActive, menuBarVisible ); |
|
250 } |
|
251 else |
|
252 { |
|
253 //creates NE |
|
254 if( ( !iStateMachine.PhoneEngineInfo()->IsSwitchToOperationOngoing () ) && |
|
255 ( !IsNumberEntryUsedL() ) && |
|
256 ( !queryActive || FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) ) ) |
|
257 { |
|
258 __PHONELOG( EBasic, EPhoneControl, |
|
259 "CPhoneNumberEntryManager::HandleCreateNumberEntryL() --create NE" ); |
|
260 |
|
261 if ( iState->IsNoteDismissableL() ) |
|
262 { |
|
263 iViewCommandHandle.ExecuteCommandL( EPhoneViewRemoveNote ); |
|
264 } |
|
265 |
|
266 if( iStateMachine.SecurityMode()->IsSecurityMode() ) |
|
267 { |
|
268 iState->HandleCommandL( EPhoneNumberAcqSecurityDialer ); |
|
269 } |
|
270 else |
|
271 { |
|
272 // Effect is shown when dialer is created. |
|
273 iState->BeginTransEffectLC( ENumberEntryCreate ); |
|
274 iViewCommandHandle.ExecuteCommandL( EPhoneViewCreateNumberEntry ); |
|
275 iState->EndTransEffect(); |
|
276 // Go to current state implementation |
|
277 iCbaManager.UpdateInCallCbaL(); |
|
278 iState->UpdateInCallContextMenuL(); |
|
279 iEnv.SyncNotifyFocusObserversOfChangeInFocus(); |
|
280 } |
|
281 } |
|
282 |
|
283 //shows existing NE |
|
284 if ( ( !iStateMachine.PhoneEngineInfo()->IsSwitchToOperationOngoing () ) && |
|
285 ( !IsNumberEntryVisibleL() ) && |
|
286 ( !queryActive || FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) ) ) |
|
287 { |
|
288 __PHONELOG( EBasic, EPhoneControl, |
|
289 "CPhoneNumberEntryManager::HandleCreateNumberEntryL() -- show NE" ); |
|
290 |
|
291 if ( iState->IsNoteDismissableL() ) |
|
292 { |
|
293 iViewCommandHandle.ExecuteCommandL( EPhoneViewRemoveNote ); |
|
294 } |
|
295 |
|
296 TPhoneCmdParamBoolean booleanParam; |
|
297 booleanParam.SetBoolean( ETrue ); |
|
298 // Show the number entry |
|
299 SetNumberEntryVisibilityL(booleanParam); |
|
300 } |
|
301 } |
|
302 |
179 } |
303 } |
180 |
304 |
181 // ----------------------------------------------------------- |
305 // ----------------------------------------------------------- |
182 // CPhoneNumberEntryManager::IsNumberEntryUsedL |
306 // CPhoneNumberEntryManager::IsNumberEntryUsedL |
183 // ----------------------------------------------------------- |
307 // ----------------------------------------------------------- |
217 EPhoneViewGetNumberFromEntry, |
341 EPhoneViewGetNumberFromEntry, |
218 &stringParam ); |
342 &stringParam ); |
219 return phoneNumber; |
343 return phoneNumber; |
220 } |
344 } |
221 |
345 |
|
346 // ----------------------------------------------------------- |
|
347 // CPhoneNumberEntryManager::HandleNumberEntryEdited |
|
348 // ----------------------------------------------------------- |
|
349 // |
|
350 void CPhoneNumberEntryManager::HandleNumberEntryEdited() |
|
351 { |
|
352 __LOGMETHODSTARTEND(EPhoneControl, "CPhoneNumberEntryManager::HandleNumberEntryEdited( ) "); |
|
353 TBool isNumberEntryVisible( EFalse ); |
|
354 TRAP_IGNORE( isNumberEntryVisible = IsNumberEntryVisibleL() ); |
|
355 |
|
356 if( isNumberEntryVisible ) |
|
357 { |
|
358 HBufC* phoneNumber( NULL ); |
|
359 TRAP_IGNORE( phoneNumber = HBufC::NewL( KPhoneNumberEntryBufferSize ) ); |
|
360 if( phoneNumber ) |
|
361 { |
|
362 phoneNumber->Des().Zero(); |
|
363 TPtr ptr( phoneNumber->Des() ); |
|
364 TPhoneCmdParamString stringParam; |
|
365 stringParam.SetString( &ptr ); |
|
366 TRAP_IGNORE( iViewCommandHandle.ExecuteCommandL( |
|
367 EPhoneViewGetNumberFromEntry, |
|
368 &stringParam ) ); |
|
369 // Save the phone number |
|
370 iStateMachine.PhoneEngineInfo()->SetPhoneNumber( ptr ); |
|
371 |
|
372 iStateMachine.SendPhoneEngineMessage( |
|
373 MPEPhoneModel::EPEMessagePhoneNumberEdited ); |
|
374 |
|
375 // remove the phone number |
|
376 delete phoneNumber; |
|
377 |
|
378 // Set service code flag to view |
|
379 TPhoneCmdParamBoolean serviceCodeParam; |
|
380 serviceCodeParam.SetBoolean( |
|
381 iStateMachine.PhoneEngineInfo()->PhoneNumberIsServiceCode() ); |
|
382 TRAP_IGNORE( iViewCommandHandle.ExecuteCommandL( |
|
383 EPhoneViewSetServiceCodeFlag, |
|
384 &serviceCodeParam ) ); |
|
385 } |
|
386 } |
|
387 } |
|
388 |
|
389 // ----------------------------------------------------------- |
|
390 // CPhoneNumberEntryManager::KeyEventForExistingNumberEntryL |
|
391 // ----------------------------------------------------------- |
|
392 // |
|
393 void CPhoneNumberEntryManager::KeyEventForExistingNumberEntryL( |
|
394 const TKeyEvent& aKeyEvent, |
|
395 TEventCode aEventCode ) |
|
396 { |
|
397 __LOGMETHODSTARTEND(EPhoneControl, "CPhoneNumberEntryManager::KeyEventForExistingNumberEntryL( ) "); |
|
398 |
|
399 TPhoneCmdParamKeyEvent keyEventParam; |
|
400 keyEventParam.SetKeyEvent( aKeyEvent ); |
|
401 keyEventParam.SetEventCode( aEventCode ); |
|
402 |
|
403 if ( IsValidAlphaNumericKey( aKeyEvent, aEventCode ) |
|
404 || aKeyEvent.iCode == KKeyCtrlA |
|
405 || aKeyEvent.iCode == KKeyCtrlC |
|
406 || aKeyEvent.iCode == KKeyCtrlV |
|
407 || aKeyEvent.iCode == KKeyCtrlX ) |
|
408 { |
|
409 iViewCommandHandle.HandleCommandL( |
|
410 EPhoneViewSendKeyEventToNumberEntry, &keyEventParam ); |
|
411 } |
|
412 else if ( aKeyEvent.iCode == EKeyBackspace ) |
|
413 { |
|
414 TPhoneViewResponseId resp = iViewCommandHandle.HandleCommandL( |
|
415 EPhoneViewSendKeyEventToNumberEntry, &keyEventParam ); |
|
416 |
|
417 if ( resp == EPhoneViewResponseNumberEntryCleared ) |
|
418 { |
|
419 // Remove number entry from screen |
|
420 iViewCommandHandle.ExecuteCommandL( |
|
421 EPhoneViewRemoveNumberEntry ); |
|
422 |
|
423 // Stop DTMF tone playing just in case (user might be holding down a number |
|
424 // key when pressed 'clear' key). |
|
425 iStateMachine.SendPhoneEngineMessage( MPEPhoneModel::EPEMessageEndDTMF ); |
|
426 |
|
427 // Handle state-specific behaviour when number entry is |
|
428 // cleared |
|
429 HandleNumberEntryClearedL(); |
|
430 } |
|
431 |
|
432 } |
|
433 else if( aKeyEvent.iCode == EKeyLeftArrow || |
|
434 aKeyEvent.iCode == EKeyRightArrow || |
|
435 aKeyEvent.iCode == EKeyUpArrow || |
|
436 aKeyEvent.iCode == EKeyDownArrow ) |
|
437 { |
|
438 iViewCommandHandle.HandleCommandL( |
|
439 EPhoneViewSendKeyEventToNumberEntry, &keyEventParam ); |
|
440 } |
|
441 } |
|
442 |
222 // ----------------------------------------------------------------------------- |
443 // ----------------------------------------------------------------------------- |
223 // CPhoneNumberEntryManager::IsValidAlphaNumericKey |
444 // CPhoneNumberEntryManager::IsValidAlphaNumericKey |
224 // Checks is the key event a number, a special character |
445 // Checks is the key event a number, a special character |
225 // or if VoIP is enabled some other character |
446 // or if VoIP is enabled some other character |
226 // ----------------------------------------------------------------------------- |
447 // ----------------------------------------------------------------------------- |
235 aKeyEvent, aEventCode ) ); |
456 aKeyEvent, aEventCode ) ); |
236 |
457 |
237 // a numeric key (1,2,3,4,6,7,8,9,0,+,*,p,w ) |
458 // a numeric key (1,2,3,4,6,7,8,9,0,+,*,p,w ) |
238 // or |
459 // or |
239 // a letter from fullscreen qwerty, miniqwerty or handwriting |
460 // a letter from fullscreen qwerty, miniqwerty or handwriting |
240 // when voip is enabled. |
461 // when voip or easydialing is enabled. |
241 if ( numericKeyEntered |
462 if ( numericKeyEntered |
242 || IsAlphanumericSupportedAndCharInput( aKeyEvent ) ) |
463 || IsAlphanumericSupportedAndCharInput( aKeyEvent ) ) |
243 { |
464 { |
244 ret= ETrue; |
465 ret= ETrue; |
245 } |
466 } |
247 return ret; |
468 return ret; |
248 } |
469 } |
249 |
470 |
250 // ----------------------------------------------------------------------------- |
471 // ----------------------------------------------------------------------------- |
251 // CPhoneNumberEntryManager::IsAlphanumericSupportedAndCharInput |
472 // CPhoneNumberEntryManager::IsAlphanumericSupportedAndCharInput |
|
473 // Check that number entry is in alphabetic mode and given key is an allowed |
|
474 // character key |
252 // ----------------------------------------------------------------------------- |
475 // ----------------------------------------------------------------------------- |
253 // |
476 // |
254 TBool CPhoneNumberEntryManager::IsAlphanumericSupportedAndCharInput( |
477 TBool CPhoneNumberEntryManager::IsAlphanumericSupportedAndCharInput( |
255 const TKeyEvent& aKeyEvent ) const |
478 const TKeyEvent& aKeyEvent ) const |
256 { |
479 { |
257 __LOGMETHODSTARTEND(EPhoneControl, "CPhoneNumberEntryManager::IsAlphanumericSupportedAndCharInput( ) "); |
480 __LOGMETHODSTARTEND(EPhoneControl, "CPhoneNumberEntryManager::IsAlphanumericSupportedAndCharInput( ) "); |
258 TBool ret = ( ( iCustomization && |
481 |
259 iCustomization->AllowAlphaNumericMode() ) && |
482 TBool numericMode = EFalse; |
260 ( ( aKeyEvent.iScanCode >= KPhoneKeyStart && |
483 TRAP_IGNORE( numericMode = ( iViewCommandHandle.HandleCommandL( EPhoneViewIsNumberEntryNumericMode ) |
261 aKeyEvent.iScanCode <= KPhoneKeyEnd ) || |
484 == EPhoneViewResponseSuccess ) ); |
262 aKeyEvent.iModifiers & EModifierSpecial ) ); |
485 |
|
486 TBool ret = !numericMode && |
|
487 ( ( aKeyEvent.iScanCode >= KPhoneKeyStart && |
|
488 aKeyEvent.iScanCode <= KPhoneKeyEnd ) || |
|
489 aKeyEvent.iModifiers & EModifierSpecial ); |
263 __PHONELOG1( EBasic, EPhoneControl, |
490 __PHONELOG1( EBasic, EPhoneControl, |
264 "CPhoneNumberEntryManager::IsAlphanumericSupportedAndCharInput: %d", ret ); |
491 "CPhoneNumberEntryManager::IsAlphanumericSupportedAndCharInput: %d", ret ); |
265 return ret; |
492 return ret; |
266 } |
493 } |
267 |
494 |
282 { |
509 { |
283 __LOGMETHODSTARTEND( EPhoneControl, "CPhoneNumberEntryManager::NumberEntryClearL( ) "); |
510 __LOGMETHODSTARTEND( EPhoneControl, "CPhoneNumberEntryManager::NumberEntryClearL( ) "); |
284 iViewCommandHandle.ExecuteCommandL( EPhoneViewClearNumberEntryContent ); |
511 iViewCommandHandle.ExecuteCommandL( EPhoneViewClearNumberEntryContent ); |
285 } |
512 } |
286 |
513 |
287 |
514 // ----------------------------------------------------------- |
288 |
515 // CPhoneNumberEntryManager::NumberEntryInNumericModeL |
289 |
516 // ----------------------------------------------------------- |
|
517 // |
|
518 TBool CPhoneNumberEntryManager::NumberEntryInNumericModeL() |
|
519 { |
|
520 __LOGMETHODSTARTEND( EPhoneControl, "CPhoneNumberEntryManager::NumberEntryInNumericModeL( ) "); |
|
521 return iViewCommandHandle.HandleCommandL( |
|
522 EPhoneViewIsNumberEntryNumericMode ) == EPhoneViewResponseSuccess; |
|
523 } |
|
524 |
|
525 // ----------------------------------------------------------- |
|
526 // CPhoneNumberEntryManager::NumberEntryToggleAlphaNumericModeL |
|
527 // ----------------------------------------------------------- |
|
528 // |
|
529 TBool CPhoneNumberEntryManager::NumberEntryToggleAlphaNumericModeL() |
|
530 { |
|
531 __LOGMETHODSTARTEND( EPhoneControl, "CPhoneNumberEntryManager::NumberEntryToggleAlphaNumericModeL( ) "); |
|
532 TPhoneCmdParamBoolean newModeAlpha; |
|
533 // Toggle number entry alpha/numeric mode |
|
534 iViewCommandHandle.ExecuteCommandL( |
|
535 EPhoneViewToggleNumberEntryAlphaNumericMode, &newModeAlpha ); |
|
536 return newModeAlpha.Boolean(); |
|
537 } |
|
538 |
|
539 |