24 #include <avkon.rsg> |
24 #include <avkon.rsg> |
25 #include <SecUi.rsg> |
25 #include <SecUi.rsg> |
26 // Include the SecUi definitions |
26 // Include the SecUi definitions |
27 #include <secui.hrh> |
27 #include <secui.hrh> |
28 #include "SCPDebug.h" |
28 #include "SCPDebug.h" |
29 #include <scpnotifier.rsg> |
29 #include <SCPNotifier.rsg> |
30 // For Central Repository |
30 // For Central Repository |
31 #include <centralrepository.h> |
31 #include <centralrepository.h> |
32 #include <AknIncallBubbleNotify.h> |
32 #include <AknIncallBubbleNotify.h> |
33 #include <e32property.h> |
33 #include <e32property.h> |
34 #include <ctsydomainpskeys.h> |
34 #include <ctsydomainpskeys.h> |
35 #include "SCPCodePrivateCRKeys.h" |
35 #include "SCPCodePrivateCRKeys.h" |
|
36 #include <DevManInternalCRKeys.h> |
|
37 #include <featmgr.h> |
|
38 |
36 /*#ifdef _DEBUG |
39 /*#ifdef _DEBUG |
37 #define __SCP_DEBUG |
40 #define __SCP_DEBUG |
38 #endif // _DEBUG |
41 #endif // _DEBUG |
39 |
42 |
40 // Define this so the precompiler in CW 3.1 won't complain about token pasting, |
43 // Define this so the precompiler in CW 3.1 won't complain about token pasting, |
58 // |
61 // |
59 CSCPQueryDialog::CSCPQueryDialog( TDes& aDataText, |
62 CSCPQueryDialog::CSCPQueryDialog( TDes& aDataText, |
60 RSCPClient::TSCPButtonConfig aButtonsShown, |
63 RSCPClient::TSCPButtonConfig aButtonsShown, |
61 TInt aMinLength, |
64 TInt aMinLength, |
62 TInt aMaxLength, |
65 TInt aMaxLength, |
63 TBool aECSSupport |
66 TBool aECSSupport, |
|
67 TKeypadContext aContextSensitive /*= EContextSensitive*/ |
64 ) |
68 ) |
65 : CAknTextQueryDialog(aDataText, ENoTone), |
69 : CAknTextQueryDialog(aDataText, ENoTone), |
66 iMinLength(aMinLength), |
70 iMinLength(aMinLength), |
67 iMaxLength(aMaxLength), |
71 iMaxLength(aMaxLength), |
68 iValidTextLen( 0 ), |
72 iValidTextLen( 0 ), |
72 iEMCallActivated( EFalse ), |
76 iEMCallActivated( EFalse ), |
73 iShowingEMNumber( EFalse ), |
77 iShowingEMNumber( EFalse ), |
74 iPreviousCharacterWasInvalid( EFalse ), |
78 iPreviousCharacterWasInvalid( EFalse ), |
75 iPrioritySet( EFalse ), |
79 iPrioritySet( EFalse ), |
76 iPriorityDropped( EFalse ), |
80 iPriorityDropped( EFalse ), |
77 iKeyUsed ( NULL ) |
81 iLockedByLawMo( EFalse ), |
78 { |
82 iKeyUsed ( NULL ), |
|
83 iContextSensitive(aContextSensitive) |
|
84 { |
79 def_mode = 0; |
85 def_mode = 0; |
80 iAppKey = 0; |
86 iAppKey = 0; |
81 iMode = KSCPModeNormal; |
87 iMode = KSCPModeNormal; |
82 } |
88 } |
83 |
89 |
89 // |
95 // |
90 CSCPQueryDialog::~CSCPQueryDialog() |
96 CSCPQueryDialog::~CSCPQueryDialog() |
91 { |
97 { |
92 Dprint( (_L("CSCPQueryDialog::~CSCPQueryDialog()")) ); |
98 Dprint( (_L("CSCPQueryDialog::~CSCPQueryDialog()")) ); |
93 |
99 |
94 if ( AknLayoutUtils::PenEnabled() ) |
100 if (iDeviceLockStatusObserver) |
95 { |
101 delete iDeviceLockStatusObserver; |
96 TRAP_IGNORE ( SetIncallBubbleAllowedInUsualL( ETrue ) ); |
102 |
97 } |
103 if (iCallStatusObserver) |
98 |
104 delete iCallStatusObserver; |
99 |
105 |
100 if (iFront) |
106 if (iFront) |
101 { |
107 { |
102 // Uncapture keys, if they were captured |
108 // Uncapture keys, if they were captured |
103 if ( iMode == KSCPModeRestricted ) |
109 if ( iMode == KSCPModeRestricted ) |
104 { |
110 { |
105 RWindowGroup& groupWin=iCoeEnv->RootWin(); |
111 RWindowGroup& groupWin=iCoeEnv->RootWin(); |
106 groupWin.CancelCaptureKeyUpAndDowns(iAppKey); |
112 groupWin.CancelCaptureKeyUpAndDowns(iAppKey); |
107 groupWin.CancelCaptureKeyUpAndDowns(iVoiceKey2); |
113 groupWin.CancelCaptureKeyUpAndDowns(iVoiceKey2); |
108 groupWin.CancelCaptureKey(iVoiceKey1); |
114 groupWin.CancelCaptureKey(iVoiceKey1); |
109 } |
115 } |
110 |
116 |
111 if ( iPrioritySet ) |
117 if ( iPrioritySet ) |
112 { |
118 { |
113 // Return normal high-priority in case there are other notifiers active |
119 // Return normal high-priority in case there are other notifiers active |
114 // and were are not going to lose foregroung right after following call |
120 // and were are not going to lose foregroung right after following call |
115 iEikonEnv->RootWin().SetOrdinalPosition(0,ECoeWinPriorityAlwaysAtFront); |
121 iEikonEnv->RootWin().SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront); |
116 } |
122 } |
117 |
123 |
118 iEikonEnv->BringForwards(EFalse); |
124 iEikonEnv->BringForwards(EFalse); |
119 iEikonEnv->EikAppUi()->RemoveFromStack(this); |
125 iEikonEnv->EikAppUi()->RemoveFromStack(this); |
120 |
126 |
128 delete iEcsDetector; |
134 delete iEcsDetector; |
129 } |
135 } |
130 |
136 |
131 iFront = EFalse; |
137 iFront = EFalse; |
132 } |
138 } |
133 |
139 } |
134 if (iDeviceLockStatusObserver) |
140 |
135 delete iDeviceLockStatusObserver; |
141 void CSCPQueryDialog :: PostLayoutDynInitL() { |
136 if (iCallStatusObserver) |
142 Dprint( (_L("[CSCPQueryDialog]-> PostLayoutDynInitL() >>>") )); |
137 delete iCallStatusObserver; |
143 iDeviceLockStatusObserver = CSCPLockObserver::NewL(this); |
138 } |
144 iCallStatusObserver = CSCPLockObserver::NewL(this, ESecUiCallStateObserver); |
|
145 Dprint( (_L("[CSCPQueryDialog]-> PostLayoutDynInitL() <<<") )); |
|
146 } |
|
147 |
139 // |
148 // |
140 // ---------------------------------------------------------- |
149 // ---------------------------------------------------------- |
141 // CSCPQueryDialog::PreLayoutDynInitL() |
150 // CSCPQueryDialog::PreLayoutDynInitL() |
142 // Called by framework before dialog is shown |
151 // Called by framework before dialog is shown |
143 // ---------------------------------------------------------- |
152 // ---------------------------------------------------------- |
144 // |
153 // |
145 void CSCPQueryDialog::PreLayoutDynInitL() |
154 void CSCPQueryDialog :: PreLayoutDynInitL() |
146 { |
155 { |
147 Dprint( (_L("CSCPQueryDialog::PreLayoutDynInitL()") )); |
156 Dprint( (_L("CSCPQueryDialog::PreLayoutDynInitL()") )); |
148 |
157 |
149 /* CEikSecretEditor* queryControl = |
|
150 static_cast<CEikSecretEditor*>( |
|
151 QueryControl()->ControlByLayoutOrNull( QueryControl()->QueryType() ) |
|
152 ); |
|
153 queryControl->EnableSCT(EFalse); */ |
|
154 |
|
155 CAknTextQueryDialog::PreLayoutDynInitL(); |
158 CAknTextQueryDialog::PreLayoutDynInitL(); |
156 |
159 |
|
160 CEikSecretEditor* queryControl = static_cast<CEikSecretEditor*>( |
|
161 QueryControl()->ControlByLayoutOrNull( QueryControl()->QueryType() ) ); |
|
162 |
|
163 queryControl->SetFeature(CEikSecretEditor::ELockQuerySCT, ETrue); |
|
164 |
157 //disable in call bubble. |
165 //disable in call bubble. |
158 if ( AknLayoutUtils::PenEnabled() ) |
166 if ( AknLayoutUtils::PenEnabled() ) |
159 { |
167 { |
160 SetIncallBubbleAllowedInUsualL( EFalse ); |
168 SetIncallBubbleAllowedInUsualL( EFalse ); |
161 } |
169 } |
162 |
|
163 |
170 |
164 // Create the ECS detector object if required |
171 // Create the ECS detector object if required |
165 if ( iECSSupport ) |
172 if ( iECSSupport ) |
166 { |
173 { |
167 Dprint( (_L(" Creating ECS detector") )); |
174 Dprint( (_L(" Creating ECS detector") )); |
169 iEcsDetector->SetObserver( this ); |
176 iEcsDetector->SetObserver( this ); |
170 } |
177 } |
171 |
178 |
172 Dprint( (_L("CSCPQueryDialog::PreLayoutDynInitL(): Set input mode") )); |
179 Dprint( (_L("CSCPQueryDialog::PreLayoutDynInitL(): Set input mode") )); |
173 |
180 |
174 /* The default input mode of the lock code query must be set on the basis of the |
181 switch(iContextSensitive) { |
175 very first character of the current lock code. If the first character of the current |
182 case EContextSensitive: { |
176 lock code is numeric, the default input mode will also be numeric. Otherwise, the |
183 Dprint(_L("[CSCPQueryDialog]-> iContextSensitive = EContextSensitive")); |
177 default input mode will be alphabetic */ |
184 /* The default input mode of the lock code query must be set on the basis of the |
178 |
185 very first character of the current lock code. If the first character of the current |
179 CRepository* repository; |
186 lock code is numeric, the default input mode will also be numeric. Otherwise, the |
180 repository = CRepository::NewL( KCRUidSCPParameters ); |
187 default input mode will be alphabetic */ |
181 CleanupStack::PushL( repository ); |
188 |
182 |
189 CRepository* repository = CRepository :: NewL(KCRUidSCPParameters); |
183 User::LeaveIfError(repository->Get( KSCPLockCodeDefaultInputMode , def_mode) ); |
190 CleanupStack :: PushL(repository); |
184 |
191 User :: LeaveIfError(repository->Get(KSCPLockCodeDefaultInputMode, def_mode)); |
185 CleanupStack::PopAndDestroy( repository ); |
192 CleanupStack :: PopAndDestroy(repository); |
186 repository = NULL; |
193 |
187 |
194 if (def_mode == 0) { |
188 if (def_mode == 0) |
195 Dprint(_L("[CSCPQueryDialog]-> Context determined as Numeric")); |
189 SetDefaultInputMode( EAknEditorNumericInputMode ); |
196 SetDefaultInputMode(EAknEditorNumericInputMode); |
190 else |
197 } |
191 SetDefaultInputMode( EAknEditorSecretAlphaInputMode ); |
198 else { |
|
199 Dprint(_L("[CSCPQueryDialog]-> Context determined as Alphanumeric")); |
|
200 SetDefaultInputMode(EAknEditorSecretAlphaInputMode); |
|
201 } |
|
202 } |
|
203 break; |
|
204 case ENumeric: |
|
205 Dprint(_L("[CSCPQueryDialog]-> iContextSensitive = ENumeric")); |
|
206 SetDefaultInputMode( EAknEditorNumericInputMode ); |
|
207 break; |
|
208 case EAlphaNumeric: |
|
209 Dprint(_L("[CSCPQueryDialog]-> iContextSensitive = EAlphaNumeric")); |
|
210 SetDefaultInputMode( EAknEditorSecretAlphaInputMode ); |
|
211 break; |
|
212 }; |
192 |
213 |
193 // Set the mode, we use this to determine the functionality for special keys |
214 // Set the mode, we use this to determine the functionality for special keys |
194 if ( ( iButtons == RSCPClient::SCP_OK ) || ( iButtons == RSCPClient::SCP_OK_CANCEL ) ) |
215 if ( ( iButtons == RSCPClient::SCP_OK ) || ( iButtons == RSCPClient::SCP_OK_CANCEL ) ) |
195 { |
216 { |
196 // Normal mode |
217 // Normal mode |
255 TInt myWgId = iEikonEnv->RootWin().Identifier(); |
276 TInt myWgId = iEikonEnv->RootWin().Identifier(); |
256 |
277 |
257 TInt wgPrio = wsSession.GetWindowGroupOrdinalPriority(myWgId); |
278 TInt wgPrio = wsSession.GetWindowGroupOrdinalPriority(myWgId); |
258 Dprint( (_L("CSCPQueryDialog::PreLayoutDynInitL(): wgPrio %d"),wgPrio )); |
279 Dprint( (_L("CSCPQueryDialog::PreLayoutDynInitL(): wgPrio %d"),wgPrio )); |
259 TInt var; |
280 TInt var; |
260 RProperty::Get(KPSUidCtsyCallInformation, KCTsyCallState,var); |
281 RProperty::Get(KPSUidCtsyCallInformation, KCTsyCallState, var); |
261 Dprint( (_L("CSCPQueryDialog::PreLayoutDynInitL(): EPSCTsyCallStateNone %d"),var )); |
282 Dprint((_L("CSCPQueryDialog::PreLayoutDynInitL(): EPSCTsyCallStateNone %d"), var)); |
262 // we are already on forgeround, need to update priority differently |
283 |
263 if (var != EPSCTsyCallStateNone) |
284 // If the call is made during device startup have the priority as normal |
264 { |
285 if (iECSSupport) |
265 // If the call is made during device startup have the priority as normal |
286 { |
266 if (iECSSupport && (iButtons == RSCPClient::SCP_OK)) |
287 switch(var) { |
267 { |
288 default: |
268 iEikonEnv->RootWin().SetOrdinalPosition(1,ECoeWinPriorityNormal); |
289 case EPSCTsyCallStateNone: |
269 } |
290 Dprint( (_L("CSCPQueryDialog::PreLayoutDynInitL(): Started Maximized..."))); |
270 |
291 iEikonEnv->RootWin().SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront + 1); |
271 } |
292 iPrioritySet = ETrue; |
272 else if ((wgPrio == ECoeWinPriorityAlwaysAtFront)&&(iECSSupport)) |
293 break; |
273 { |
294 case EPSCTsyCallStateAlerting: |
274 Dprint( (_L("CSCPQueryDialog::PreLayoutDynInitL(): ECoeWinPriorityAlwaysAtFront+1") )); |
295 case EPSCTsyCallStateHold: |
275 iEikonEnv->RootWin().SetOrdinalPosition(0,ECoeWinPriorityAlwaysAtFront+1); |
296 case EPSCTsyCallStateRinging: |
276 iPrioritySet = ETrue; |
297 case EPSCTsyCallStateDialling: |
277 } |
298 case EPSCTsyCallStateAnswering: |
278 |
299 case EPSCTsyCallStateConnected: { |
|
300 switch(iButtons) { |
|
301 case RSCPClient::SCP_OK: |
|
302 case RSCPClient::SCP_OK_ETEL: { |
|
303 Dprint( (_L("CSCPQueryDialog::PreLayoutDynInitL(): Started Minimized..."))); |
|
304 iEikonEnv->RootWin().SetOrdinalPosition(0, ECoeWinPriorityLow); |
|
305 break; |
|
306 } |
|
307 default: |
|
308 break; |
|
309 } |
|
310 } |
|
311 } |
|
312 } |
|
313 |
279 // this must be done always to keep the reference count in synch |
314 // this must be done always to keep the reference count in synch |
280 // this does not have any effect if autoforwarding has not been set true (normal application.) |
315 // this does not have any effect if autoforwarding has not been set true (normal application.) |
281 iEikonEnv->BringForwards(ETrue, ECoeWinPriorityAlwaysAtFront+1); |
316 iEikonEnv->BringForwards(ETrue, ECoeWinPriorityAlwaysAtFront+1); |
282 |
317 |
283 /// -- Change Window Priority for dialog and CBA |
318 /// -- Change Window Priority for dialog and CBA |
284 if (iECSSupport) |
319 if (iECSSupport) |
285 { |
320 { |
286 Dprint( (_L("CSCPQueryDialog::PreLayoutDynInitL(): Changing Window Priority") )); |
321 Dprint( (_L("CSCPQueryDialog::PreLayoutDynInitL(): Changing Window Priority") )); |
287 DrawableWindow()->SetOrdinalPosition(0,ECoeWinPriorityAlwaysAtFront); |
322 DrawableWindow()->SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront); |
288 ButtonGroupContainer().ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront); |
323 ButtonGroupContainer().ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront); |
289 } |
324 } |
290 else |
325 else |
291 { |
326 { |
292 DrawableWindow()->SetOrdinalPosition(0,ECoeWinPriorityNormal); // |
327 DrawableWindow()->SetOrdinalPosition(0,ECoeWinPriorityNormal + 1); // |
293 ButtonGroupContainer().ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition(0,ECoeWinPriorityNormal); |
328 ButtonGroupContainer().ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition(0,ECoeWinPriorityNormal + 1); |
294 } |
329 } |
295 |
330 |
296 Dprint( (_L("CSCPQueryDialog::PreLayoutDynInitL(): Key sounds") )); |
331 Dprint( (_L("CSCPQueryDialog::PreLayoutDynInitL(): Key sounds") )); |
297 // Key sounds |
332 // Key sounds |
298 |
333 |
301 |
336 |
302 static_cast<CAknAppUi*>(iEikonEnv->EikAppUi())->KeySounds()->BringToForeground(); |
337 static_cast<CAknAppUi*>(iEikonEnv->EikAppUi())->KeySounds()->BringToForeground(); |
303 static_cast<CAknAppUi*>(iEikonEnv->EikAppUi())->KeySounds()->LockContext(); |
338 static_cast<CAknAppUi*>(iEikonEnv->EikAppUi())->KeySounds()->LockContext(); |
304 |
339 |
305 iFront = ETrue; |
340 iFront = ETrue; |
306 |
341 TInt currentLawmoState(0); |
307 Dprint( (_L("CSCPQueryDialog::CSCPLockObserver") )); |
342 Dprint( (_L("CSCPQueryDialog::lawmo cenrep") )); |
308 iDeviceLockStatusObserver = CSCPLockObserver::NewL(this); |
343 CRepository* crep = CRepository::NewLC( KCRUidDeviceManagementInternalKeys ); |
309 iCallStatusObserver = CSCPLockObserver::NewL(this,ESecUiCallStateObserver); |
344 TInt reterr = crep->Get( KLAWMOPhoneLock, currentLawmoState ); |
310 |
345 Dprint( (_L("CSCPQueryDialog::lawmo cenrep done") )); |
311 } |
346 |
|
347 if(reterr != KErrNone) |
|
348 { |
|
349 Dprint(_L("[RSCPClient]-> ERROR: Unable to perform get on CenRep lawmo, lErr=%d"), reterr); |
|
350 CleanupStack :: PopAndDestroy(crep); |
|
351 return; |
|
352 } |
|
353 |
|
354 if(currentLawmoState!=KLockedbyLawmo) |
|
355 { |
|
356 // Hide the OK key |
|
357 Dprint( (_L("CSCPQueryDialog::lawmo state !=30, dim key") )); |
|
358 iLockedByLawMo = ETrue; |
|
359 ButtonGroupContainer().MakeCommandVisible( EAknSoftkeyOk, ETrue ); |
|
360 ButtonGroupContainer().DimCommand(EAknSoftkeyOk, ETrue); |
|
361 } |
|
362 CleanupStack::PopAndDestroy(); |
|
363 } |
312 // |
364 // |
313 // --------------------------------------------------------- |
365 // --------------------------------------------------------- |
314 // CSCPQueryDialog::OfferKeyEventL |
366 // CSCPQueryDialog::OfferKeyEventL |
315 // called by framework when any key is pressed |
367 // called by framework when any key is pressed |
316 // --------------------------------------------------------- |
368 // --------------------------------------------------------- |
415 { |
471 { |
416 //if (AknLayoutUtils::PenEnabled()) |
472 //if (AknLayoutUtils::PenEnabled()) |
417 { |
473 { |
418 if (iECSSupport) |
474 if (iECSSupport) |
419 { |
475 { |
420 if (iEcsDetector->State()== CAknEcsDetector::ECompleteMatch) |
476 if ( iEcsDetector->State() == CAknEcsDetector::ECompleteMatch || |
|
477 iEcsDetector->State() == CAknEcsDetector::EServiceNumMatch ) |
421 { |
478 { |
422 iEcsDetector->AddChar( (TText)(EKeyPhoneSend) ); |
479 Dprint( (_L("CSCPQueryDialog::OfferKeyEventL(): adding EKeyPhoneSend to detector"))); |
423 |
480 |
|
481 switch(iButtons) { |
|
482 case RSCPClient::SCP_OK: |
|
483 case RSCPClient::SCP_OK_ETEL: |
|
484 //Required only during device startup |
|
485 iEikonEnv->RootWin().SetOrdinalPosition(0, ECoeWinPriorityLow); |
|
486 break; |
|
487 default: |
|
488 break; |
|
489 } |
|
490 |
|
491 iEcsDetector->AddChar( (TText)(EKeyPhoneSend ) ); |
424 } |
492 } |
425 else |
493 else |
426 { |
494 { |
427 Dprint( (_L("CSCPQueryDialog::OfferKeyEventL(): ShowWarningNoteL") )); |
495 Dprint( (_L("CSCPQueryDialog::OfferKeyEventL(): ShowWarningNoteL") )); |
428 ShowWarningNoteL(); |
496 ShowWarningNoteL(); |
498 // Character removed, make sure we're back on track, |
566 // Character removed, make sure we're back on track, |
499 // though likely only backspace was pressed |
567 // though likely only backspace was pressed |
500 iValidTextLen = QueryControl()->GetTextLength(); |
568 iValidTextLen = QueryControl()->GetTextLength(); |
501 } |
569 } |
502 |
570 |
503 //Additional modifier set by query dialog, while simulating event |
571 //Additional modifier set by query dialog, while simulating event |
504 // As raw key events are used to simulate, modifiers and scan codes cannot be set at a time |
572 // As raw key events are used to simulate, modifiers and scan codes cannot be set at a time |
505 // In the 1st event, modifiers are set and in subsequent event, scan codes will be set. |
573 // In the 1st event, modifiers are set and in subsequent event, scan codes will be set. |
506 if(aKeyEvent.iModifiers & EModifierNumLock && |
574 if( aKeyEvent.iModifiers & EModifierNumLock && |
507 aKeyEvent.iModifiers & EModifierKeypad && aKeyEvent.iModifiers & EModifierSpecial |
575 aKeyEvent.iModifiers & EModifierKeypad && |
508 ) |
576 aKeyEvent.iModifiers & EModifierSpecial) { |
509 { |
577 |
510 |
578 return EKeyWasConsumed; |
511 return EKeyWasConsumed; |
|
512 } |
579 } |
|
580 |
513 if ( iECSSupport ) |
581 if ( iECSSupport ) |
514 { |
582 { |
515 // Save the text |
583 // Save the text |
516 if ( aType == EEventKey ) |
584 if ( aType == EEventKey ) |
517 { |
585 { |
519 } |
587 } |
520 if ( aType == EEventKey ) |
588 if ( aType == EEventKey ) |
521 { |
589 { |
522 iEcsDetector->SetBuffer(iTextBuffer.Left(KAknEcsMaxMatchingLength)); |
590 iEcsDetector->SetBuffer(iTextBuffer.Left(KAknEcsMaxMatchingLength)); |
523 } |
591 } |
524 if ( aType == EEventKey ) |
592 /*if ( aType == EEventKey ) |
525 { |
593 { |
526 if ( iEMCallActivated ) |
594 if ( iEMCallActivated ) |
527 { |
595 { |
528 TryExitL( ESecUiEmergencyCall ); |
596 TryExitL( ESecUiEmergencyCall ); |
529 return EKeyWasConsumed; |
597 return EKeyWasConsumed; |
530 } |
598 } |
531 } |
599 }*/ |
532 // Retrieve the editor control ptr, we know it is a secret editor.. |
600 // Retrieve the editor control ptr, we know it is a secret editor.. |
533 CEikSecretEditor* queryControl = static_cast<CEikSecretEditor*>( |
601 CEikSecretEditor* queryControl = static_cast<CEikSecretEditor*>( |
534 QueryControl()->ControlByLayoutOrNull( QueryControl()->QueryType() ) ); |
602 QueryControl()->ControlByLayoutOrNull( QueryControl()->QueryType() ) ); |
535 |
603 |
536 // Further check to ensure that the matched number is the entire buffer |
604 // Further check to ensure that the matched number is the entire buffer |
566 { |
634 { |
567 // The input doesn't match a Em-number |
635 // The input doesn't match a Em-number |
568 if ( queryControl != NULL ) |
636 if ( queryControl != NULL ) |
569 { |
637 { |
570 queryControl->RevealSecretText( EFalse ); |
638 queryControl->RevealSecretText( EFalse ); |
571 if(aType == EEventKey) |
639 |
572 { |
640 if(aType == EEventKey) |
573 HBufC* cbaLabel = NULL; |
641 { |
574 TRAPD ( err , cbaLabel= StringLoader::LoadL(R_SCPDIALOG_OK_TEXT) ); |
642 HBufC* cbaLabel = NULL; |
575 if ( err == KErrNone ) |
643 Dprint( (_L("CSCPQueryDialog::OfferKeyEventL(): R_SCPDIALOG_OK_TEXT") )); |
576 { |
644 TRAPD ( err , cbaLabel= StringLoader::LoadL(R_SCPDIALOG_OK_TEXT) ); |
577 if (isCallSoftkeyAdded) |
645 if ( err == KErrNone ) |
578 { |
646 { |
579 isCallSoftkeyAdded = EFalse; |
647 if (isCallSoftkeyAdded) |
580 ButtonGroupContainer().RemoveCommandFromStack(0,EAknSoftkeyEmergencyCall); |
648 { |
581 } |
649 isCallSoftkeyAdded = EFalse; |
582 else |
650 ButtonGroupContainer().RemoveCommandFromStack(0,EAknSoftkeyEmergencyCall); |
583 { |
651 } |
584 ButtonGroupContainer().RemoveCommandFromStack(0,EAknSoftkeyOk); |
652 else |
585 } |
653 { |
586 TRAP ( err , ButtonGroupContainer().AddCommandToStackL(0,EAknSoftkeyOk,*cbaLabel) ); |
654 ButtonGroupContainer().RemoveCommandFromStack(0,EAknSoftkeyOk); |
587 ButtonGroupContainer().DrawDeferred(); |
655 } |
588 delete cbaLabel; |
656 TRAP ( err , ButtonGroupContainer().AddCommandToStackL(0,EAknSoftkeyOk,*cbaLabel) ); |
589 } |
657 if(iLockedByLawMo) |
590 } |
658 { |
|
659 ButtonGroupContainer().MakeCommandVisible( EAknSoftkeyOk, ETrue ); |
|
660 ButtonGroupContainer().DimCommand(EAknSoftkeyOk, ETrue); |
|
661 } |
|
662 ButtonGroupContainer().DrawDeferred(); |
|
663 delete cbaLabel; |
|
664 } |
591 } |
665 } |
592 } |
666 } |
593 } |
667 } |
|
668 } |
594 |
669 |
595 Dprint( (_L("CSCPQueryDialog::OfferKeyEventL() exiting") )); |
670 Dprint( (_L("CSCPQueryDialog::OfferKeyEventL() exiting") )); |
596 |
671 |
597 if ( ret == EKeyWasConsumed ) // The editor control used up this keyevent |
672 if ( ret == EKeyWasConsumed ) // The editor control used up this keyevent |
598 { |
673 { |
599 return ret; |
674 return ret; |
600 } |
675 } |
601 else |
676 else |
602 { |
677 { |
603 return CAknTextQueryDialog::OfferKeyEventL(aKeyEvent,aType); |
678 return CAknTextQueryDialog::OfferKeyEventL(aKeyEvent,aType); |
|
679 } |
|
680 |
|
681 if(iLockedByLawMo) |
|
682 { |
|
683 Dprint( (_L("dim key hit 2") )); |
|
684 ButtonGroupContainer().MakeCommandVisible( EAknSoftkeyOk, ETrue ); |
|
685 ButtonGroupContainer().DimCommand(EAknSoftkeyOk, ETrue); |
604 } |
686 } |
605 } |
687 } |
606 // |
688 // |
607 // --------------------------------------------------------- |
689 // --------------------------------------------------------- |
608 // CSCPQueryDialog::NeedToDismissQueryL() |
690 // CSCPQueryDialog::NeedToDismissQueryL() |
623 { |
705 { |
624 |
706 |
625 Dprint( (_L("CSCPQueryDialog::OkToExitL ( aButtonId :%d, "), aButtonId )); |
707 Dprint( (_L("CSCPQueryDialog::OkToExitL ( aButtonId :%d, "), aButtonId )); |
626 TInt ret = EFalse; |
708 TInt ret = EFalse; |
627 |
709 |
628 if ( aButtonId == EAknSoftkeyOk ) |
710 switch(aButtonId) { |
629 { |
711 case EAknSoftkeyOk: |
630 Dprint( (_L("CSCPQueryDialog::OkToExitL - EAknSoftkeyOk") )); |
712 case EAknSoftkeyCancel: |
631 TInt textLength = QueryControl()->GetTextLength(); |
713 ret = CAknTextQueryDialog::OkToExitL(aButtonId); |
632 if ( textLength < iMinLength ) |
714 break; |
633 { |
715 case ESecUiEmergencyCall: |
634 // The code was too short -> play error tone & clear editor |
716 case EAknSoftkeyEmergencyCall: { |
635 if ( textLength != 0 ) |
717 Dprint( (_L("CSCPQueryDialog::OkToExitL(): adding EKeyPhoneSend to detector") )); |
636 { |
718 |
637 CAknKeySoundSystem* soundSystem; |
719 switch(iButtons) { |
638 if ( iEikonEnv->AppUi() ) |
720 case RSCPClient::SCP_OK: |
639 { |
721 case RSCPClient::SCP_OK_ETEL: |
640 soundSystem = static_cast<CAknAppUi*>(iEikonEnv->EikAppUi())->KeySounds(); |
722 //Required only during device startup |
641 soundSystem->PlaySound( EAvkonSIDErrorTone ); |
723 iEikonEnv->RootWin().SetOrdinalPosition(0, ECoeWinPriorityLow); |
642 } |
724 break; |
643 QueryControl()->SetTextL( KNullDesC ); |
725 default: |
644 iTextBuffer.Zero(); |
726 break; |
645 iValidTextLen = 0; |
727 } |
646 |
728 |
647 // Hide the OK key |
729 iEMCallActivated = ETrue; |
648 //ButtonGroupContainer().MakeCommandVisible( EAknSoftkeyOk, EFalse ); |
730 iEcsDetector->AddChar( (TText)(EKeyPhoneSend ) ); |
649 // ButtonGroupContainer().DimCommand(EAknSoftkeyOk, ETrue); |
731 } |
650 |
732 break; |
651 if (AknLayoutUtils::PenEnabled()) |
733 default: |
652 { |
734 break; |
653 ButtonGroupContainer().DimCommand(EAknSoftkeyOk, ETrue); |
735 } |
654 } |
736 |
655 else |
|
656 { |
|
657 ButtonGroupContainer().MakeCommandVisible(EAknSoftkeyOk, EFalse); |
|
658 } |
|
659 } |
|
660 ret = EFalse; |
|
661 } |
|
662 else |
|
663 { |
|
664 ret = CAknTextQueryDialog::OkToExitL(aButtonId); |
|
665 } |
|
666 } |
|
667 |
|
668 // Cancel is allowed, if the key is active |
|
669 if ( aButtonId == EAknSoftkeyCancel ) |
|
670 { |
|
671 Dprint( (_L("CSCPQueryDialog::OkToExitL EAknSoftkeyCancel ")) ); |
|
672 ret = CAknTextQueryDialog::OkToExitL(aButtonId); |
|
673 } |
|
674 |
|
675 // Emergency call, exit |
|
676 if ( aButtonId == ESecUiEmergencyCall ) |
|
677 { |
|
678 Dprint( (_L("CSCPQueryDialog::OkToExitL(): ESecUiEmergencyCall") )); |
|
679 ret = ETrue; |
|
680 } |
|
681 if (aButtonId == EAknSoftkeyEmergencyCall) |
|
682 { |
|
683 //add EKeyPhonesend to ecs detector. |
|
684 ret = ETrue; |
|
685 Dprint( (_L("CSCPQueryDialog::OkToExitL(): adding EKeyPhoneSend to detector") )); |
|
686 iEcsDetector->AddChar( (TText)(EKeyPhoneSend ) ); |
|
687 CAknTextQueryDialog::OkToExitL(aButtonId); |
|
688 } |
|
689 |
|
690 Dprint( (_L("CSCPQueryDialog::OkToExitL() done") )); |
737 Dprint( (_L("CSCPQueryDialog::OkToExitL() done") )); |
691 return ret; |
738 return ret; |
692 } |
739 } |
693 |
740 |
694 |
741 |
697 // |
744 // |
698 // --------------------------------------------------------- |
745 // --------------------------------------------------------- |
699 // |
746 // |
700 void CSCPQueryDialog::HandleEcsEvent(CAknEcsDetector* aDetector, |
747 void CSCPQueryDialog::HandleEcsEvent(CAknEcsDetector* aDetector, |
701 CAknEcsDetector::TState aUpdatedState) |
748 CAknEcsDetector::TState aUpdatedState) |
702 { |
749 { |
703 (void)aDetector; // Not used |
750 (void)aDetector; // Not used |
704 |
|
705 TInt err; |
751 TInt err; |
706 if ( ( aUpdatedState == CAknEcsDetector::ECompleteMatchThenSendKey ) || |
752 |
707 ( aUpdatedState == CAknEcsDetector::ECallAttempted ) ) |
753 // Check if service calling feature is enabled |
708 { |
754 TBool serviceCallEnabled( EFalse ); |
709 // Call attempted, cancel the query |
755 TRAP( err, FeatureManager::InitializeLibL() ); |
710 iEMCallActivated = ETrue; // OfferKeyEventL will close the dialog |
756 if ( err == KErrNone ) |
711 } |
757 { |
712 else if ( aUpdatedState == CAknEcsDetector::ECompleteMatch ) |
758 serviceCallEnabled = FeatureManager::FeatureSupported( |
713 { |
759 KFeatureIdFfServiceCallWhilePhoneLocked ); |
|
760 FeatureManager::UnInitializeLib(); |
|
761 } |
|
762 |
|
763 if ( aUpdatedState == CAknEcsDetector::ECompleteMatch || |
|
764 ( serviceCallEnabled && aUpdatedState == CAknEcsDetector::EServiceNumMatch ) ) |
|
765 { |
714 iShowingEMNumber = ETrue; |
766 iShowingEMNumber = ETrue; |
715 } |
767 } |
716 else if ( iShowingEMNumber ) |
768 else if ( iShowingEMNumber ) |
717 { |
769 { |
718 // Cancel Em-number display |
770 // Cancel Em-number display |
747 else |
799 else |
748 { |
800 { |
749 ButtonGroupContainer().RemoveCommandFromStack(0,EAknSoftkeyOk); |
801 ButtonGroupContainer().RemoveCommandFromStack(0,EAknSoftkeyOk); |
750 } |
802 } |
751 TRAP ( err , ButtonGroupContainer().AddCommandToStackL(0, EAknSoftkeyOk, *cbaLabel) ); |
803 TRAP ( err , ButtonGroupContainer().AddCommandToStackL(0, EAknSoftkeyOk, *cbaLabel) ); |
|
804 if(iLockedByLawMo) |
|
805 { |
|
806 ButtonGroupContainer().MakeCommandVisible( EAknSoftkeyOk, ETrue ); |
|
807 ButtonGroupContainer().DimCommand(EAknSoftkeyOk, ETrue); |
|
808 } |
752 ButtonGroupContainer().DrawDeferred(); |
809 ButtonGroupContainer().DrawDeferred(); |
753 delete cbaLabel; |
810 delete cbaLabel; |
754 } |
811 } |
755 } |
812 } |
756 } |
813 } |
757 } |
814 } |
758 |
815 |
759 void CSCPQueryDialog::ShowWarningNoteL() |
816 void CSCPQueryDialog::ShowWarningNoteL() |
760 { |
817 { |
761 |
818 |
762 CAknNoteDialog* noteDlg = new (ELeave) CAknNoteDialog(); |
819 CAknNoteDialog* noteDlg = new (ELeave) CAknNoteDialog(); |
773 |
830 |
774 // ----------------------------------------------------------------------------- |
831 // ----------------------------------------------------------------------------- |
775 // CSCPQueryDialog::SetIncallBubbleAllowedInUsualL() |
832 // CSCPQueryDialog::SetIncallBubbleAllowedInUsualL() |
776 // ----------------------------------------------------------------------------- |
833 // ----------------------------------------------------------------------------- |
777 // |
834 // |
778 void CSCPQueryDialog::SetIncallBubbleAllowedInUsualL(TBool aAllowed) |
835 void CSCPQueryDialog :: SetIncallBubbleAllowedInUsualL(TBool aAllowed) { |
779 { |
|
780 CAknIncallBubble *incallBubble = CAknIncallBubble::NewL(); |
836 CAknIncallBubble *incallBubble = CAknIncallBubble::NewL(); |
781 CleanupStack::PushL(incallBubble); |
837 CleanupStack :: PushL(incallBubble); |
782 incallBubble->SetIncallBubbleAllowedInUsualL( aAllowed ); |
838 incallBubble->SetIncallBubbleAllowedInUsualL(aAllowed); |
783 CleanupStack::PopAndDestroy(); |
839 CleanupStack :: PopAndDestroy(); |
|
840 } |
|
841 |
|
842 void CSCPQueryDialog::TryCancelQueryL(TInt aReason) { |
|
843 Dprint( (_L("CSCPQueryDialog::TryCancelQueryL() >>>")) ); |
|
844 |
|
845 switch(aReason) { |
|
846 case CSCPLockObserver :: EEnded: |
|
847 Dprint( (_L("CSCPQueryDialog::TryCancelQueryL(): Call ended, raising priority..."))); |
|
848 |
|
849 switch(iButtons) { |
|
850 case RSCPClient :: SCP_OK: |
|
851 case RSCPClient :: SCP_OK_ETEL: |
|
852 if(iEMCallActivated) { |
|
853 TryExitL(EAknSoftkeyCancel); |
|
854 } |
|
855 else { |
|
856 iEikonEnv->RootWin().SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront + 1); |
|
857 iPrioritySet = ETrue; |
|
858 } |
|
859 break; |
|
860 default: |
|
861 break; |
|
862 } |
|
863 break; |
|
864 case CSCPLockObserver :: EInProgress: |
|
865 Dprint( (_L("CSCPQueryDialog::TryCancelQueryL(): received call in progress event..."))); |
|
866 TryExitL(EAknSoftkeyCancel); |
|
867 break; |
|
868 case ESecUiDeviceLocked: |
|
869 Dprint(_L("[CSCPQueryDialog]-> TryExitL 4")); |
|
870 TryExitL(EAknSoftkeyCancel); |
|
871 break; |
|
872 case ESecUiNone: |
|
873 Dprint(_L("[CSCPQueryDialog]-> TryExitL 5")); |
|
874 TryExitL(EAknSoftkeyOk); |
|
875 break; |
|
876 default: |
|
877 break; |
784 } |
878 } |
785 |
879 |
786 // Call from the SCPObserver |
880 Dprint( (_L("CSCPQueryDialog::TryCancelQueryL() <<<")) ); |
787 |
881 } |
788 void CSCPQueryDialog::TryCancelQueryL(TInt aReason) |
|
789 { |
|
790 Dprint( (_L("CSCPQueryDialog::TryCancelQueryL()")) ); |
|
791 |
|
792 if (EPSCTsyCallStateDisconnecting == aReason) |
|
793 { |
|
794 Dprint( (_L("CSCPQueryDialog::TryCancelQueryL() -SetOrdinalPosition ->0")) ); |
|
795 iEikonEnv->RootWin().SetOrdinalPosition(0,ECoeWinPriorityAlwaysAtFront+1); |
|
796 iPrioritySet = ETrue; |
|
797 } |
|
798 else |
|
799 { |
|
800 Dprint( (_L("CSCPQueryDialog::TryExitL(EAknSoftkeyCancel)")) ); |
|
801 TryExitL(EAknSoftkeyCancel); |
|
802 } |
|
803 } |
|
804 |
|
805 |
|
806 // End of file |
882 // End of file |
807 |
|