branch | RCL_3 |
changeset 19 | aecbbf00d063 |
parent 15 | c52421ed5f07 |
child 20 | d48ab3b357f1 |
18:fcdfafb36fe7 | 19:aecbbf00d063 |
---|---|
1 /* |
1 /* |
2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
31 #include <AknUtils.h> |
31 #include <AknUtils.h> |
32 #include <eikcba.h> |
32 #include <eikcba.h> |
33 #include <aknnotecontrol.h> |
33 #include <aknnotecontrol.h> |
34 #include <aknlayoutscalable_avkon.cdl.h> |
34 #include <aknlayoutscalable_avkon.cdl.h> |
35 |
35 |
36 #include <secondarydisplay/AknSecondaryDisplayDefs.h> |
36 #include <SecondaryDisplay/AknSecondaryDisplayDefs.h> |
37 #include <avkondomainpskeys.h> // KPSUidAvkonDomain, KAknKeyguardStatus, TAknKeyguardStatus |
37 #include <avkondomainpskeys.h> // KPSUidAvkonDomain, KAknKeyguardStatus, TAknKeyguardStatus |
38 #include <startupdomainpskeys.h> // KStartupSecurityCodeQueryStatus |
38 #include <startupdomainpskeys.h> // KStartupSecurityCodeQueryStatus |
39 #include <coreapplicationuisdomainpskeys.h> // KCoreAppUIsAutolockStatus |
39 #include <coreapplicationuisdomainpskeys.h> // KCoreAppUIsAutolockStatus |
40 #include <AknNotifySignature.h> |
40 #include <AknNotifySignature.h> |
41 #include "AknCapServerEntry.h" |
41 #include "AknCapServerEntry.h" |
42 #include <aknglobalpopupprioritycontroller.h> |
42 #include <aknglobalpopupprioritycontroller.h> |
43 #include "GlobalWindowPriorities.h" |
43 #include "GlobalWindowPriorities.h" |
44 #include <keylockpolicyapi.h> |
44 #include <keylockpolicyapi.h> |
45 #include <ScreensaverInternalPSKeys.h> |
|
46 |
45 |
47 #include <PSVariables.h> // Property values |
46 #include <PSVariables.h> // Property values |
48 #include <coreapplicationuisdomainpskeys.h> |
47 #include <coreapplicationuisdomainpskeys.h> |
49 #include <startupdomainpskeys.h> |
48 #include <startupdomainpskeys.h> |
50 #include <ctsydomainpskeys.h> |
49 #include <ctsydomainpskeys.h> |
51 #include <bafindf.h> |
50 #include <bafindf.h> |
52 #include "AknNotifyPlugin.hrh" |
51 #include "AknNotifyPlugin.hrh" |
53 #include "akntrace.h" |
52 |
54 |
53 |
55 |
54 |
56 #ifdef _DEBUG |
55 #ifdef _DEBUG |
57 #define TRACES(x) x |
56 #define TRACES(x) x |
58 #else |
57 #else |
87 |
86 |
88 _LIT( KRESOURCEFILE, "\\resource\\aknnotpi.rsc" ); |
87 _LIT( KRESOURCEFILE, "\\resource\\aknnotpi.rsc" ); |
89 _LIT_SECURITY_POLICY_C1( KWritePolicy, ECapabilityWriteDeviceData ); |
88 _LIT_SECURITY_POLICY_C1( KWritePolicy, ECapabilityWriteDeviceData ); |
90 |
89 |
91 |
90 |
92 /** |
91 |
93 * CAknKeylockScreenSaverObserver captures primary keys |
92 |
94 * from screensaver when screen saver is active. |
93 |
95 * |
|
96 * @lib aknoldstylenotif.lib |
|
97 * @since 3.2 |
|
98 */ |
|
99 NONSHARABLE_CLASS( CAknKeylockScreenSaverObserver ): public CActive |
|
100 { |
|
101 public: |
|
102 |
|
103 /** |
|
104 * Creates instance of the CAknKeylockScreenSaverObserver class. |
|
105 * |
|
106 * @param aWindowGroup application window group used to capture primary keys |
|
107 * @return Returns the instance just created. |
|
108 */ |
|
109 static CAknKeylockScreenSaverObserver* NewL( RWindowGroup& aWindowGroup ); |
|
110 |
|
111 /** |
|
112 * Destructor. |
|
113 */ |
|
114 ~CAknKeylockScreenSaverObserver(); |
|
115 |
|
116 public: |
|
117 |
|
118 /** |
|
119 * Starts asynchronic listening KUidCurrentCall event |
|
120 * |
|
121 * @return KErrNone: if no errors |
|
122 * @return KErrInUse: if already listening |
|
123 */ |
|
124 TInt Start(); |
|
125 |
|
126 /** |
|
127 * Stops asynchronic listening KUidAutolockStatus event |
|
128 */ |
|
129 void Stop(); |
|
130 |
|
131 public: |
|
132 |
|
133 /** |
|
134 * Method handles the lock state changes. |
|
135 * |
|
136 * @param aStatus The new lock state |
|
137 */ |
|
138 void SetLockStatus( TBool aKeylockEnabled, TBool aAutolockEnabled ); |
|
139 |
|
140 private: // constructors |
|
141 |
|
142 /** |
|
143 * C++ default constructor. |
|
144 * |
|
145 * @param aAppUi (pointer to autolock appui) |
|
146 */ |
|
147 CAknKeylockScreenSaverObserver( RWindowGroup& aWindowGroup ); |
|
148 |
|
149 /** |
|
150 * Symbian OS constructor. |
|
151 */ |
|
152 void ConstructL(); |
|
153 |
|
154 private: // from CActive |
|
155 |
|
156 /** @see CActive::RunL() */ |
|
157 void RunL(); |
|
158 |
|
159 /** @see CActive::DoCancel() */ |
|
160 void DoCancel(); |
|
161 |
|
162 private: |
|
163 |
|
164 /** |
|
165 * Used to capture primary keys defined in keylocking policies |
|
166 */ |
|
167 void CapturePrimaryKeys( TBool aCapture ); |
|
168 |
|
169 private: // data |
|
170 |
|
171 // screen saver on property |
|
172 RProperty iScreenSaverActiveProperty; |
|
173 |
|
174 // if screensaver is active or not |
|
175 TBool iScreenSaverActive; |
|
176 |
|
177 // if primary keys have been captured |
|
178 TBool iCaptured; |
|
179 |
|
180 // locking states |
|
181 TBool iKeylockEnabled; |
|
182 TBool iAutolockEnabled; |
|
183 |
|
184 // left softkey capture |
|
185 TInt iLeftSoftKey; |
|
186 |
|
187 // a reference to application window group |
|
188 RWindowGroup& iWindowGroup; |
|
189 |
|
190 // keylockpolicy support (not owned) |
|
191 CKeyLockPolicyApi* iUnlockPolicyApi; |
|
192 |
|
193 // keylockpolicy support (not owned) |
|
194 CKeyLockPolicyApi* iDevicelockPolicyApi; |
|
195 |
|
196 // primary key captures |
|
197 RArray<TUint> iPrimaryKeyCaptures; |
|
198 }; |
|
199 |
|
200 // =========================================================================== |
|
201 // class CAknKeylockScreenSaverObserver |
|
202 // =========================================================================== |
|
203 |
|
204 // --------------------------------------------------------------------------- |
|
205 // Constructs a new entry with given values. |
|
206 // --------------------------------------------------------------------------- |
|
207 // |
|
208 CAknKeylockScreenSaverObserver* CAknKeylockScreenSaverObserver::NewL( |
|
209 RWindowGroup& aWindowGroup ) |
|
210 { |
|
211 CAknKeylockScreenSaverObserver* self = |
|
212 new (ELeave) CAknKeylockScreenSaverObserver( aWindowGroup ); |
|
213 CleanupStack::PushL( self ); |
|
214 self->ConstructL(); |
|
215 CleanupStack::Pop( self ); |
|
216 return self; |
|
217 } |
|
218 |
|
219 |
|
220 // --------------------------------------------------------------------------- |
|
221 // Destructor |
|
222 // --------------------------------------------------------------------------- |
|
223 // |
|
224 CAknKeylockScreenSaverObserver::~CAknKeylockScreenSaverObserver() |
|
225 { |
|
226 Cancel(); |
|
227 |
|
228 // Close the property handle. |
|
229 iScreenSaverActiveProperty.Close(); |
|
230 |
|
231 // Release key captures. |
|
232 CapturePrimaryKeys( EFalse ); |
|
233 |
|
234 // Delete policies. |
|
235 delete iUnlockPolicyApi; |
|
236 delete iDevicelockPolicyApi; |
|
237 } |
|
238 |
|
239 |
|
240 // --------------------------------------------------------------------------- |
|
241 // Starts listening to the KScreenSaverOn event. |
|
242 // --------------------------------------------------------------------------- |
|
243 // |
|
244 TInt CAknKeylockScreenSaverObserver::Start() |
|
245 { |
|
246 _AKNTRACE_FUNC_ENTER; |
|
247 |
|
248 if ( IsActive() ) |
|
249 { |
|
250 return KErrInUse; |
|
251 } |
|
252 iStatus = KRequestPending; |
|
253 iScreenSaverActiveProperty.Subscribe( iStatus ); |
|
254 SetActive(); |
|
255 |
|
256 _AKNTRACE_FUNC_EXIT; |
|
257 |
|
258 return KErrNone; |
|
259 } |
|
260 |
|
261 |
|
262 // --------------------------------------------------------------------------- |
|
263 // Stops listening to the KScreenSaverOn event. |
|
264 // --------------------------------------------------------------------------- |
|
265 // |
|
266 void CAknKeylockScreenSaverObserver::Stop() |
|
267 { |
|
268 _AKNTRACE_FUNC_ENTER; |
|
269 |
|
270 if ( !IsActive() ) |
|
271 { |
|
272 return; |
|
273 } |
|
274 Cancel(); |
|
275 iScreenSaverActiveProperty.Cancel(); |
|
276 |
|
277 _AKNTRACE_FUNC_EXIT; |
|
278 } |
|
279 |
|
280 |
|
281 // --------------------------------------------------------------------------- |
|
282 // C++ constructor |
|
283 // --------------------------------------------------------------------------- |
|
284 // |
|
285 CAknKeylockScreenSaverObserver::CAknKeylockScreenSaverObserver( |
|
286 RWindowGroup& aWindowGroup ) |
|
287 : CActive( 0 ), |
|
288 iScreenSaverActive( EFalse ), |
|
289 iCaptured( EFalse ), |
|
290 iKeylockEnabled( EFalse ), |
|
291 iAutolockEnabled( EFalse ), |
|
292 iLeftSoftKey( NULL ), |
|
293 iWindowGroup( aWindowGroup ) |
|
294 { |
|
295 } |
|
296 |
|
297 |
|
298 // --------------------------------------------------------------------------- |
|
299 // Second phase constructor. |
|
300 // --------------------------------------------------------------------------- |
|
301 // |
|
302 void CAknKeylockScreenSaverObserver::ConstructL() |
|
303 { |
|
304 _AKNTRACE_FUNC_ENTER; |
|
305 |
|
306 // Add this active object to the scheduler. |
|
307 CActiveScheduler::Add( this ); |
|
308 User::LeaveIfError( iScreenSaverActiveProperty.Attach( KPSUidScreenSaver, |
|
309 KScreenSaverOn ) ); |
|
310 |
|
311 // We need policies to poll primary keys. |
|
312 iUnlockPolicyApi = CKeyLockPolicyApi::NewL( EPolicyDeactivateKeyguard ); |
|
313 if ( !iUnlockPolicyApi->HasConfiguration() ) |
|
314 { |
|
315 delete iUnlockPolicyApi; |
|
316 iUnlockPolicyApi = NULL; |
|
317 } |
|
318 |
|
319 // we need policies to poll primary keys |
|
320 iDevicelockPolicyApi = CKeyLockPolicyApi::NewL( EPolicyDevicelockQuery ); |
|
321 if ( !iDevicelockPolicyApi->HasConfiguration() ) |
|
322 { |
|
323 delete iDevicelockPolicyApi; |
|
324 iDevicelockPolicyApi = NULL; |
|
325 } |
|
326 |
|
327 _AKNTRACE_FUNC_EXIT; |
|
328 } |
|
329 |
|
330 |
|
331 // --------------------------------------------------------------------------- |
|
332 // From base class CActive. |
|
333 // Handles change in the screen saver state. |
|
334 // --------------------------------------------------------------------------- |
|
335 // |
|
336 void CAknKeylockScreenSaverObserver::RunL() |
|
337 { |
|
338 _AKNTRACE_FUNC_ENTER; |
|
339 |
|
340 if ( iKeylockEnabled || iAutolockEnabled ) |
|
341 { |
|
342 // Resubscribe before processing new value to prevent missing updates. |
|
343 Start(); |
|
344 } |
|
345 |
|
346 TInt screenSaverState; |
|
347 iScreenSaverActiveProperty.Get( screenSaverState ); |
|
348 // Primary keys are captured from screensaver when screensaver |
|
349 // is the top most application. |
|
350 if ( screenSaverState > NULL ) |
|
351 { |
|
352 __ASSERT_DEBUG( !iCaptured, |
|
353 Panic( EAknPanicKeyLockObserverAlreadyExists ) ); |
|
354 iScreenSaverActive = ETrue; |
|
355 CapturePrimaryKeys( ETrue ); |
|
356 } |
|
357 else |
|
358 { |
|
359 // If screensaver is disabled, stop capturing primary key events. |
|
360 if ( iScreenSaverActive ) |
|
361 { |
|
362 CapturePrimaryKeys( EFalse ); |
|
363 } |
|
364 iScreenSaverActive = EFalse; |
|
365 } |
|
366 |
|
367 _AKNTRACE_FUNC_EXIT; |
|
368 } |
|
369 |
|
370 |
|
371 // --------------------------------------------------------------------------- |
|
372 // Set the lock status. |
|
373 // --------------------------------------------------------------------------- |
|
374 // |
|
375 void CAknKeylockScreenSaverObserver::SetLockStatus( TBool aKeylockEnabled, |
|
376 TBool aAutolockEnabled ) |
|
377 { |
|
378 _AKNTRACE_FUNC_ENTER; |
|
379 |
|
380 iKeylockEnabled = aKeylockEnabled; |
|
381 iAutolockEnabled = aAutolockEnabled; |
|
382 |
|
383 if ( iKeylockEnabled || iAutolockEnabled ) |
|
384 { |
|
385 // Start observing screensaver activation. |
|
386 Start(); |
|
387 } |
|
388 else |
|
389 { |
|
390 if ( iScreenSaverActive ) |
|
391 { |
|
392 CapturePrimaryKeys( EFalse ); |
|
393 } |
|
394 // Screensaver is only observed when keylock is enabled. |
|
395 Stop(); |
|
396 } |
|
397 |
|
398 _AKNTRACE_FUNC_EXIT; |
|
399 } |
|
400 |
|
401 |
|
402 // --------------------------------------------------------------------------- |
|
403 // Capture or uncapture primary keys. |
|
404 // --------------------------------------------------------------------------- |
|
405 // |
|
406 void CAknKeylockScreenSaverObserver::CapturePrimaryKeys( TBool aCapture ) |
|
407 { |
|
408 _AKNTRACE_FUNC_ENTER; |
|
409 |
|
410 if ( aCapture ) |
|
411 { |
|
412 if ( iScreenSaverActive && !iCaptured ) |
|
413 { |
|
414 if ( iKeylockEnabled && !iAutolockEnabled ) |
|
415 { |
|
416 iCaptured = ETrue; |
|
417 // If no unlocking policy has been defined, |
|
418 // the default primary key is the left soft key. |
|
419 if ( !iUnlockPolicyApi ) |
|
420 { |
|
421 // Capture LSK (starts unlock prosess, capturing |
|
422 // bypasses screensaver) |
|
423 iLeftSoftKey = iWindowGroup.CaptureKey( EKeyDevice0, 0, 0 ); |
|
424 } |
|
425 else |
|
426 { |
|
427 iPrimaryKeyCaptures.Reset(); |
|
428 TUint32 index( 0 ); |
|
429 TUint32 primaryKey( 0 ); |
|
430 TUint32 secondaryKey( 0 ); |
|
431 while ( iUnlockPolicyApi->GetKeyCombination( index, |
|
432 primaryKey, |
|
433 secondaryKey ) == KErrNone ) |
|
434 { |
|
435 if (KErrNone != iPrimaryKeyCaptures.Append(iWindowGroup.CaptureKeyUpAndDowns(primaryKey, 0, 0))) |
|
436 { |
|
437 return; |
|
438 } |
|
439 index++; |
|
440 } |
|
441 } |
|
442 } |
|
443 else |
|
444 { |
|
445 if ( iKeylockEnabled && iAutolockEnabled ) |
|
446 { |
|
447 iCaptured = ETrue; |
|
448 // If no devicelock query policy has been defined, |
|
449 // the default primary key is the left soft key. |
|
450 if ( !iDevicelockPolicyApi ) |
|
451 { |
|
452 // Capture LSK (starts unlock prosess, |
|
453 // capturing bypasses screensaver). |
|
454 iLeftSoftKey = iWindowGroup.CaptureKey( EKeyDevice0, 0, 0 ); |
|
455 } |
|
456 else |
|
457 { |
|
458 iPrimaryKeyCaptures.Reset(); |
|
459 TUint32 index( 0 ); |
|
460 TUint32 primaryKey( 0 ); |
|
461 TUint32 secondaryKey( 0 ); |
|
462 while ( iDevicelockPolicyApi->GetKeyCombination( index, primaryKey, secondaryKey ) == KErrNone ) |
|
463 { |
|
464 if (KErrNone != iPrimaryKeyCaptures.Append(iWindowGroup.CaptureKeyUpAndDowns(primaryKey, 0, 0))) |
|
465 { |
|
466 return; |
|
467 } |
|
468 index++; |
|
469 } |
|
470 } |
|
471 } |
|
472 } |
|
473 } |
|
474 } |
|
475 else |
|
476 { |
|
477 if (iCaptured) |
|
478 { |
|
479 if (iLeftSoftKey > 0) |
|
480 { |
|
481 iWindowGroup.CancelCaptureKey(iLeftSoftKey); |
|
482 } |
|
483 iLeftSoftKey = 0; |
|
484 |
|
485 if (iPrimaryKeyCaptures.Count() > 0) |
|
486 { |
|
487 for (TInt x = 0; x < iPrimaryKeyCaptures.Count(); x++) |
|
488 { |
|
489 iWindowGroup.CancelCaptureKeyUpAndDowns(iPrimaryKeyCaptures[x]); |
|
490 } |
|
491 iPrimaryKeyCaptures.Reset(); |
|
492 } |
|
493 |
|
494 iCaptured = EFalse; |
|
495 } |
|
496 } |
|
497 |
|
498 _AKNTRACE_FUNC_EXIT; |
|
499 } |
|
500 |
|
501 |
|
502 // --------------------------------------------------------------------------- |
|
503 // From base class CActive. |
|
504 // Cancels event listening. |
|
505 // --------------------------------------------------------------------------- |
|
506 // |
|
507 void CAknKeylockScreenSaverObserver::DoCancel() |
|
508 { |
|
509 _AKNTRACE_FUNC_ENTER; |
|
510 |
|
511 iScreenSaverActiveProperty.Cancel(); |
|
512 |
|
513 _AKNTRACE_FUNC_EXIT; |
|
514 } |
|
515 |
94 |
516 |
95 |
517 // =========================================================================== |
96 // =========================================================================== |
518 // class CAknLockedNote. |
97 // class CAknLockedNote. |
519 // =========================================================================== |
98 // =========================================================================== |
536 // Handles a dialog button press for the button with ID aCommand. |
115 // Handles a dialog button press for the button with ID aCommand. |
537 // --------------------------------------------------------------------------- |
116 // --------------------------------------------------------------------------- |
538 // |
117 // |
539 TBool CAknLockedNote::OkToExitL( TInt aCommand ) |
118 TBool CAknLockedNote::OkToExitL( TInt aCommand ) |
540 { |
119 { |
541 _AKNTRACE_FUNC_ENTER; |
|
542 |
|
543 iLocked = EFalse; |
120 iLocked = EFalse; |
544 if ( iCommandObserver ) |
121 if ( iCommandObserver ) |
545 { |
122 { |
546 iCommandObserver->ProcessCommandL( aCommand ); |
123 iCommandObserver->ProcessCommandL( aCommand ); |
547 } |
124 } |
548 |
|
549 _AKNTRACE_FUNC_EXIT; |
|
550 |
|
551 return ETrue; |
125 return ETrue; |
552 } |
126 } |
553 |
127 |
554 |
128 |
555 // --------------------------------------------------------------------------- |
129 // --------------------------------------------------------------------------- |
567 // Cancels the note. |
141 // Cancels the note. |
568 // --------------------------------------------------------------------------- |
142 // --------------------------------------------------------------------------- |
569 // |
143 // |
570 void CAknLockedNote::CancelNote() |
144 void CAknLockedNote::CancelNote() |
571 { |
145 { |
572 _AKNTRACE_FUNC_ENTER; |
|
573 |
|
574 if ( iTimer ) |
146 if ( iTimer ) |
575 { |
147 { |
576 iTimer->Cancel(); |
148 iTimer->Cancel(); |
577 } |
149 } |
578 ExitSleepingDialog(); |
150 ExitSleepingDialog(); |
579 iLocked = EFalse; |
151 iLocked = EFalse; |
580 |
|
581 _AKNTRACE_FUNC_EXIT; |
|
582 } |
152 } |
583 |
153 |
584 |
154 |
585 // --------------------------------------------------------------------------- |
155 // --------------------------------------------------------------------------- |
586 // From base class CEikDialog. |
156 // From base class CEikDialog. |
587 // Handles focus change event. |
157 // Handles focus change event. |
588 // --------------------------------------------------------------------------- |
158 // --------------------------------------------------------------------------- |
589 // |
159 // |
590 void CAknLockedNote::FocusChanged( TDrawNow /*aDrawNow*/ ) |
160 void CAknLockedNote::FocusChanged( TDrawNow /*aDrawNow*/ ) |
591 { |
161 { |
592 _AKNTRACE_FUNC_ENTER; |
|
593 |
|
594 if ( !IsFocused() && iCommandObserver ) |
162 if ( !IsFocused() && iCommandObserver ) |
595 { |
163 { |
596 TRAP_IGNORE( iCommandObserver->ProcessCommandL( KNoteCmdFocusLost ) ) |
164 TRAP_IGNORE( iCommandObserver->ProcessCommandL( KNoteCmdFocusLost ) ) |
597 } |
165 } |
598 |
|
599 _AKNTRACE_FUNC_EXIT; |
|
600 } |
166 } |
601 |
167 |
602 |
168 |
603 // --------------------------------------------------------------------------- |
169 // --------------------------------------------------------------------------- |
604 // From base class CEikDialog. |
170 // From base class CEikDialog. |
675 // Displays the note. |
241 // Displays the note. |
676 // --------------------------------------------------------------------------- |
242 // --------------------------------------------------------------------------- |
677 // |
243 // |
678 TInt CAknSleepingNote::ShowNote( const TInt aTimeout, const TTone aTone ) |
244 TInt CAknSleepingNote::ShowNote( const TInt aTimeout, const TTone aTone ) |
679 { |
245 { |
680 _AKNTRACE_FUNC_ENTER; |
|
681 |
|
682 TRAP_IGNORE(AknGlobalPopupPriorityController::SetPopupPriorityL( *this, KGlobalWindowPriority_KeyLock )); |
246 TRAP_IGNORE(AknGlobalPopupPriorityController::SetPopupPriorityL( *this, KGlobalWindowPriority_KeyLock )); |
683 iTimeoutInMicroseconds = aTimeout; |
247 iTimeoutInMicroseconds = aTimeout; |
684 iTone = aTone; |
248 iTone = aTone; |
685 |
|
686 _AKNTRACE_FUNC_EXIT; |
|
687 |
|
688 return RouseSleepingDialog(); |
249 return RouseSleepingDialog(); |
689 } |
250 } |
690 |
251 |
691 |
252 |
692 // --------------------------------------------------------------------------- |
253 // --------------------------------------------------------------------------- |
694 // Handles a dialog button press for the button with ID aCommand. |
255 // Handles a dialog button press for the button with ID aCommand. |
695 // --------------------------------------------------------------------------- |
256 // --------------------------------------------------------------------------- |
696 // |
257 // |
697 TBool CAknSleepingNote::OkToExitL( TInt aCommand ) |
258 TBool CAknSleepingNote::OkToExitL( TInt aCommand ) |
698 { |
259 { |
699 _AKNTRACE_FUNC_ENTER; |
|
700 |
|
701 if ( iCommandObserver ) |
260 if ( iCommandObserver ) |
702 { |
261 { |
703 iCommandObserver->ProcessCommandL( aCommand ); |
262 iCommandObserver->ProcessCommandL( aCommand ); |
704 } |
263 } |
705 |
|
706 _AKNTRACE_FUNC_EXIT; |
|
707 |
|
708 return ETrue; |
264 return ETrue; |
709 } |
265 } |
710 |
266 |
711 |
267 |
712 // --------------------------------------------------------------------------- |
268 // --------------------------------------------------------------------------- |
714 // Updates the note animation on skin change event. |
270 // Updates the note animation on skin change event. |
715 // --------------------------------------------------------------------------- |
271 // --------------------------------------------------------------------------- |
716 // |
272 // |
717 void CAknSleepingNote::HandleResourceChange( TInt aType ) |
273 void CAknSleepingNote::HandleResourceChange( TInt aType ) |
718 { |
274 { |
719 _AKNTRACE_FUNC_ENTER; |
|
720 |
|
721 if ( aType == KAknsMessageSkinChange ) |
275 if ( aType == KAknsMessageSkinChange ) |
722 { |
276 { |
723 TInt animationRes( 0 ); |
277 TInt animationRes( 0 ); |
724 switch ( iResourceId ) |
278 switch ( iResourceId ) |
725 { |
279 { |
769 } |
323 } |
770 } |
324 } |
771 } |
325 } |
772 |
326 |
773 CAknNoteDialog::HandleResourceChange( aType ); |
327 CAknNoteDialog::HandleResourceChange( aType ); |
774 |
|
775 _AKNTRACE_FUNC_EXIT; |
|
776 } |
328 } |
777 |
329 |
778 |
330 |
779 // --------------------------------------------------------------------------- |
331 // --------------------------------------------------------------------------- |
780 // From base class CEikDialog. |
332 // From base class CEikDialog. |
863 // Sets the emergency number to be displayed. |
415 // Sets the emergency number to be displayed. |
864 // --------------------------------------------------------------------------- |
416 // --------------------------------------------------------------------------- |
865 // |
417 // |
866 void CAknEcsNote::SetEmergencyNumber( const TDesC& aMatchedNumber ) |
418 void CAknEcsNote::SetEmergencyNumber( const TDesC& aMatchedNumber ) |
867 { |
419 { |
868 _AKNTRACE_FUNC_ENTER; |
|
869 |
|
870 TRect mainPane; |
420 TRect mainPane; |
871 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EPopupParent, |
421 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EPopupParent, |
872 mainPane ); |
422 mainPane ); |
873 |
423 |
874 TAknLayoutRect popupNoteWindow; |
424 TAknLayoutRect popupNoteWindow; |
928 number.Append( ' ' ); |
478 number.Append( ' ' ); |
929 } |
479 } |
930 |
480 |
931 number.Append( aMatchedNumber ); |
481 number.Append( aMatchedNumber ); |
932 TRAP_IGNORE( SetTextL( number ) ); |
482 TRAP_IGNORE( SetTextL( number ) ); |
933 |
|
934 _AKNTRACE_FUNC_EXIT; |
|
935 } |
483 } |
936 |
484 |
937 |
485 |
938 // --------------------------------------------------------------------------- |
486 // --------------------------------------------------------------------------- |
939 // Makes the note go to sleep. |
487 // Makes the note go to sleep. |
940 // --------------------------------------------------------------------------- |
488 // --------------------------------------------------------------------------- |
941 // |
489 // |
942 void CAknEcsNote::SleepNote() |
490 void CAknEcsNote::SleepNote() |
943 { |
491 { |
944 _AKNTRACE_FUNC_ENTER; |
|
945 |
|
946 if ( iNoteOnScreen ) |
492 if ( iNoteOnScreen ) |
947 { |
493 { |
948 // Causes flicker to other notes if called when note is not on screen. |
494 // Causes flicker to other notes if called when note is not on screen. |
949 ExitSleepingDialog(); |
495 ExitSleepingDialog(); |
950 } |
496 } |
951 iNoteOnScreen = EFalse; |
497 iNoteOnScreen = EFalse; |
952 |
|
953 _AKNTRACE_FUNC_EXIT; |
|
954 } |
498 } |
955 |
499 |
956 |
500 |
957 // =========================================================================== |
501 // =========================================================================== |
958 // class CAknKeyLockControl |
502 // class CAknKeyLockControl |
975 // --------------------------------------------------------------------------- |
519 // --------------------------------------------------------------------------- |
976 // |
520 // |
977 CAknKeyLockControl::CAknKeyLockControl( CAknKeyLockNotifierSubject* aNotif ) : |
521 CAknKeyLockControl::CAknKeyLockControl( CAknKeyLockNotifierSubject* aNotif ) : |
978 iNotif( aNotif ) |
522 iNotif( aNotif ) |
979 { |
523 { |
980 _AKNTRACE_FUNC_ENTER; |
|
981 |
|
982 AKNTASHOOK_ADD( this, "CAknKeyLockControl" ); |
524 AKNTASHOOK_ADD( this, "CAknKeyLockControl" ); |
983 |
|
984 _AKNTRACE_FUNC_EXIT; |
|
985 } |
525 } |
986 |
526 |
987 |
527 |
988 // --------------------------------------------------------------------------- |
528 // --------------------------------------------------------------------------- |
989 // Destructor |
529 // Destructor |
990 // --------------------------------------------------------------------------- |
530 // --------------------------------------------------------------------------- |
991 // |
531 // |
992 CAknKeyLockControl::~CAknKeyLockControl() |
532 CAknKeyLockControl::~CAknKeyLockControl() |
993 { |
533 { |
994 _AKNTRACE_FUNC_ENTER; |
|
995 |
|
996 AKNTASHOOK_REMOVE(); |
534 AKNTASHOOK_REMOVE(); |
997 // We implicitely trust that Eikon env exists |
535 // We implicitely trust that Eikon env exists |
998 // (though in practice it does not make the |
536 // (though in practice it does not make the |
999 // difference as this destructor is really never called...) |
537 // difference as this destructor is really never called...) |
1000 RWindowGroup& groupWin = iEikonEnv->RootWin(); |
538 RWindowGroup& groupWin = iEikonEnv->RootWin(); |
1015 delete iEcsDetector; |
553 delete iEcsDetector; |
1016 delete iKeyLockCba; |
554 delete iKeyLockCba; |
1017 delete iOfferLockNote; |
555 delete iOfferLockNote; |
1018 delete iEcsNote; // Ecs change |
556 delete iEcsNote; // Ecs change |
1019 delete iKeylockApi; |
557 delete iKeylockApi; |
1020 delete iKeylockScreenSaverObserver; |
|
1021 |
|
1022 _AKNTRACE_FUNC_EXIT; |
|
1023 } |
558 } |
1024 |
559 |
1025 |
560 |
1026 // --------------------------------------------------------------------------- |
561 // --------------------------------------------------------------------------- |
1027 // Second phase construction. |
562 // Second phase construction. |
1028 // --------------------------------------------------------------------------- |
563 // --------------------------------------------------------------------------- |
1029 // |
564 // |
1030 void CAknKeyLockControl::ConstructL() |
565 void CAknKeyLockControl::ConstructL() |
1031 { |
566 { |
1032 _AKNTRACE_FUNC_ENTER; |
567 TRACES( RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::ConstructL ")); ) |
1033 |
568 |
1034 FeatureManager::InitializeLibL(); |
569 FeatureManager::InitializeLibL(); |
1035 iFeatureKeypadNoSlider = |
570 iFeatureKeypadNoSlider = |
1036 FeatureManager::FeatureSupported( KFeatureIdKeypadNoSlider ); |
571 FeatureManager::FeatureSupported( KFeatureIdKeypadNoSlider ); |
1037 iFeatureNoPowerkey = |
572 iFeatureNoPowerkey = |
1064 iOfferLockNote->ConstructSleepingNoteL( R_KEYLOCK_OFFER_LOCK_NOTE ); |
599 iOfferLockNote->ConstructSleepingNoteL( R_KEYLOCK_OFFER_LOCK_NOTE ); |
1065 iOfferLockNote->ButtonGroupContainer().ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition( 0, 2 ); |
600 iOfferLockNote->ButtonGroupContainer().ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition( 0, 2 ); |
1066 |
601 |
1067 TBool touchEnabled( AknLayoutUtils::PenEnabled() ); |
602 TBool touchEnabled( AknLayoutUtils::PenEnabled() ); |
1068 |
603 |
1069 TBool hasSlider = HasSliderKey(); |
604 TBool hasSlider(iHardwareSupport != EKeyguardDefaultHardware); |
605 |
|
1070 iKeyLockCba = CEikButtonGroupContainer::NewL( |
606 iKeyLockCba = CEikButtonGroupContainer::NewL( |
1071 CEikButtonGroupContainer::ECba, |
607 CEikButtonGroupContainer::ECba, |
1072 CEikButtonGroupContainer::EHorizontal, |
608 CEikButtonGroupContainer::EHorizontal, |
1073 this, |
609 this, |
1074 (touchEnabled&&hasSlider) ? R_AVKON_SOFTKEYS_EMPTY : |
610 (touchEnabled&&hasSlider) ? R_AVKON_SOFTKEYS_EMPTY : |
1181 // Keylock API not initialized. |
717 // Keylock API not initialized. |
1182 delete iKeylockApi; |
718 delete iKeylockApi; |
1183 iKeylockApi = NULL; |
719 iKeylockApi = NULL; |
1184 } |
720 } |
1185 |
721 |
1186 iKeylockScreenSaverObserver = |
|
1187 CAknKeylockScreenSaverObserver::NewL( groupWin ); |
|
1188 |
|
1189 // Define P&S key that is used to publish the keyguard status. |
722 // Define P&S key that is used to publish the keyguard status. |
1190 RProperty::Define( KPSUidAvkonDomain, |
723 RProperty::Define( KPSUidAvkonDomain, |
1191 KAknKeyguardStatus, |
724 KAknKeyguardStatus, |
1192 RProperty::EInt, |
725 RProperty::EInt, |
1193 TSecurityPolicy( TSecurityPolicy::EAlwaysPass ), |
726 TSecurityPolicy( TSecurityPolicy::EAlwaysPass ), |
1194 KWritePolicy ); |
727 KWritePolicy ); |
1195 |
728 |
1196 iStatusProperty.Attach( KPSUidAvkonDomain, KAknKeyguardStatus ); |
729 iStatusProperty.Attach( KPSUidAvkonDomain, KAknKeyguardStatus ); |
1197 iStatusProperty.Set( EKeyguardNotActive ); |
730 iStatusProperty.Set( EKeyguardNotActive ); |
1198 |
|
1199 _AKNTRACE_FUNC_EXIT; |
|
1200 } |
731 } |
1201 |
732 |
1202 |
733 |
1203 // --------------------------------------------------------------------------- |
734 // --------------------------------------------------------------------------- |
1204 // Enable key lock. |
735 // Enable key lock. |
1205 // --------------------------------------------------------------------------- |
736 // --------------------------------------------------------------------------- |
1206 // |
737 // |
1207 void CAknKeyLockControl::EnableKeylock( TBool aShowNote, TBool aNotifySysApp ) |
738 void CAknKeyLockControl::EnableKeylock( TBool aShowNote ) |
1208 { |
739 { |
1209 _AKNTRACE_FUNC_ENTER; |
740 TRACES( RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::EnableKeylock %d"), aShowNote); ) |
1210 _AKNTRACE("aShowNote:%d",aShowNote); |
741 |
1211 _AKNTRACE("aNotifySysApp:%d",aNotifySysApp); |
|
1212 |
|
1213 // Policy can be used to disable support for keyguard. |
742 // Policy can be used to disable support for keyguard. |
1214 if ( !iAutolockEnabled && !CKeyLockPolicyApi::KeyguardAllowed() ) |
743 if ( !iAutolockEnabled && !CKeyLockPolicyApi::KeyguardAllowed() ) |
1215 { |
744 { |
1216 // Keylock Disabled |
745 // Keylock Disabled |
1217 return; |
746 return; |
1218 } |
747 } |
1219 // Keylock Enabled |
748 |
1220 iKeylockScreenSaverObserver->SetLockStatus( ETrue, iAutolockEnabled ); |
|
1221 if ( iOfferLockEnabled ) |
749 if ( iOfferLockEnabled ) |
1222 { |
750 { |
1223 iOfferLockNote->CancelNote(); |
751 iOfferLockNote->CancelNote(); |
1224 } |
752 } |
1225 |
753 |
1226 // Update keyguard status to P&S system. |
754 // Update keyguard status to P&S system. |
1227 iStatusProperty.Set( iAutolockEnabled ? EKeyguardAutolockEmulation : |
755 iStatusProperty.Set( iAutolockEnabled ? EKeyguardAutolockEmulation : |
1228 EKeyguardLocked ); |
756 EKeyguardLocked ); |
1229 iKeyLockEnabled = ETrue; |
757 iKeyLockEnabled = ETrue; |
1230 |
758 |
1231 if ( !iAutolockEnabled && aNotifySysApp ) |
759 if ( !iAutolockEnabled ) |
1232 { |
760 { |
1233 SendMessageToSysAp( EEikKeyLockEnabled ); |
761 SendMessageToSysAp( EEikKeyLockEnabled ); |
1234 } |
762 } |
1235 TBool hasSliderKey = HasSliderKey(); |
763 |
1236 if ( !AknLayoutUtils::PenEnabled() || !hasSliderKey) |
764 if ( !AknLayoutUtils::PenEnabled() || iHardwareSupport == EKeyguardDefaultHardware) |
1237 { |
765 { |
1238 iKeyLockCba->MakeVisible( ETrue ); |
766 iKeyLockCba->MakeVisible( ETrue ); |
1239 } |
767 } |
1240 else |
768 else |
1241 { |
769 { |
1263 if ( aShowNote ) |
791 if ( aShowNote ) |
1264 { |
792 { |
1265 DisplayLockedNote(); |
793 DisplayLockedNote(); |
1266 } |
794 } |
1267 |
795 |
1268 if ( !AknLayoutUtils::PenEnabled() || !hasSliderKey) |
796 if ( !AknLayoutUtils::PenEnabled() || iHardwareSupport == EKeyguardDefaultHardware) |
1269 { |
797 { |
1270 ShowKeylockCba(); |
798 ShowKeylockCba(); |
1271 } |
799 } |
1272 else |
800 else |
1273 { |
801 { |
1281 { |
809 { |
1282 Window().SetBackgroundColor( ~0 ); |
810 Window().SetBackgroundColor( ~0 ); |
1283 } |
811 } |
1284 } |
812 } |
1285 |
813 |
1286 // in case Telephone-app is topmost, then the user is confused because he sees but can't use it. |
814 // in case Telephone-app is topmost, then the user is confused because he sees but can't use it. |
1287 // therefore it's required to hide it, by sending to background. ETMA-7M8A2Y 20090105 |
815 // therefore it's required to hide it, by sending to background. ETMA-7M8A2Y 20090105 |
1288 if ( AknLayoutUtils::PenEnabled() ) |
816 if ( AknLayoutUtils::PenEnabled() ) |
1289 { |
817 { |
1290 TApaTaskList apaTaskList(CCoeEnv::Static()->WsSession()); |
818 TApaTaskList apaTaskList(CCoeEnv::Static()->WsSession()); |
1291 #define KPhoneAppUid TUid::Uid(0x100058B3) |
819 #define KPhoneAppUid TUid::Uid(0x100058B3) |
1292 |
820 |
1293 TApaTask apaTask = apaTaskList.FindApp(KPhoneAppUid); |
821 TApaTask apaTask = apaTaskList.FindApp(KPhoneAppUid); |
1294 if (apaTask.Exists()) |
822 if (apaTask.Exists()) |
1295 { |
823 { |
1296 #if defined(_DEBUG) |
824 #if defined(_DEBUG) |
1297 RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::EnableKeylock() Bring phone to background")); |
825 RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::EnableKeylock() Bring phone to background")); |
1298 #endif |
826 #endif |
1299 // Bring phone to background |
827 // Bring phone to background |
1300 apaTask.SendToBackground(); |
828 apaTask.SendToBackground(); |
1301 } |
829 } |
1302 } |
830 } |
1303 |
831 |
1304 // Start capturing system keys. |
832 // Start capturing system keys. |
1305 CaptureSystemKeys(); |
833 CaptureSystemKeys(); |
1306 |
834 |
1307 // Capture all pointer events. |
835 // Capture all pointer events. |
1332 |
860 |
1333 // Method HandleResourceChangeL with parameter KAknInternalFSWClose cannot |
861 // Method HandleResourceChangeL with parameter KAknInternalFSWClose cannot |
1334 // leave, but we trap it in just in case. |
862 // leave, but we trap it in just in case. |
1335 TRAP_IGNORE( static_cast<CAknCapAppServerAppUi*>( iEikonEnv->EikAppUi() )->HandleResourceChangeL( |
863 TRAP_IGNORE( static_cast<CAknCapAppServerAppUi*>( iEikonEnv->EikAppUi() )->HandleResourceChangeL( |
1336 KAknInternalFSWClose ); ); |
864 KAknInternalFSWClose ); ); |
1337 |
|
1338 _AKNTRACE_FUNC_EXIT; |
|
1339 } |
865 } |
1340 |
866 |
1341 |
867 |
1342 // --------------------------------------------------------------------------- |
868 // --------------------------------------------------------------------------- |
1343 // Disable key lock. |
869 // Disable key lock. |
1344 // --------------------------------------------------------------------------- |
870 // --------------------------------------------------------------------------- |
1345 // |
871 // |
1346 void CAknKeyLockControl::DisableKeylock(TBool aNotifySysApp) |
872 void CAknKeyLockControl::DisableKeylock() |
1347 { |
873 { |
1348 _AKNTRACE_FUNC_ENTER; |
874 TRACES( RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::DisableKeylock")); ) |
1349 _AKNTRACE("aShowNote:%d",aNotifySysApp); |
875 |
1350 |
|
1351 // Keep locking status in sync. |
|
1352 iKeylockScreenSaverObserver->SetLockStatus( EFalse, iAutolockEnabled ); |
|
1353 if ( iSoundsMuted ) |
876 if ( iSoundsMuted ) |
1354 { |
877 { |
1355 CAknAppUiBase* appUi= iAvkonAppUiBase; |
878 CAknAppUiBase* appUi= iAvkonAppUiBase; |
1356 appUi->KeySounds()->ReleaseContext(); |
879 appUi->KeySounds()->ReleaseContext(); |
1357 appUi->KeySounds()->PopContext(); |
880 appUi->KeySounds()->PopContext(); |
1377 |
900 |
1378 // Update keyguard status to P&S system. |
901 // Update keyguard status to P&S system. |
1379 iStatusProperty.Set( EKeyguardNotActive ); |
902 iStatusProperty.Set( EKeyguardNotActive ); |
1380 iKeyLockEnabled = EFalse; |
903 iKeyLockEnabled = EFalse; |
1381 |
904 |
1382 if ( !iAutolockEnabled ) // only when Autolock was user-activated |
905 if ( !iAutolockEnabled ) // only when Autolock was user-activated |
1383 { |
906 { |
1384 // in case Telephone-app was topmost and sent to background, then the user is confused because he expects to see it again. |
907 // in case Telephone-app was topmost and sent to background, then the user is confused because he expects to see it again. |
1385 // therefore it's required to show it, by sending to foreground. |
908 // therefore it's required to show it, by sending to foreground. |
1386 if ( AknLayoutUtils::PenEnabled() ) |
909 if ( AknLayoutUtils::PenEnabled() ) |
1387 { |
910 { |
1388 TInt callState; |
911 TInt callState; |
1389 RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallState, callState ); |
912 RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallState, callState ); |
1390 #if defined(_DEBUG) |
913 #if defined(_DEBUG) |
1391 RDebug::Printf( "%s %s (%u) callState=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, callState ); |
914 RDebug::Printf( "%s %s (%u) callState=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, callState ); |
1392 RDebug::Printf( "%s %s (%u) EPSCTsyCallStateNone=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, EPSCTsyCallStateNone ); |
915 RDebug::Printf( "%s %s (%u) EPSCTsyCallStateNone=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, EPSCTsyCallStateNone ); |
1393 #endif |
916 #endif |
1394 if (callState != EPSCTsyCallStateNone ) |
917 if (callState != EPSCTsyCallStateNone ) |
1395 { |
918 { |
1396 TApaTaskList apaTaskList(CCoeEnv::Static()->WsSession()); |
919 |
1397 #define KPhoneAppUid TUid::Uid(0x100058B3) |
920 TApaTaskList apaTaskList(CCoeEnv::Static()->WsSession()); |
1398 TApaTask apaTask = apaTaskList.FindApp(KPhoneAppUid); |
921 #define KPhoneAppUid TUid::Uid(0x100058B3) |
1399 if (apaTask.Exists()) |
922 |
1400 { |
923 TApaTask apaTask = apaTaskList.FindApp(KPhoneAppUid); |
1401 RDebug::Printf( "%s %s (%u) foreground=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); |
924 if (apaTask.Exists()) |
1402 #if defined(_DEBUG) |
925 { |
1403 RDebug::Print(_L("(AUTOLOCK)CAknKeyLockControl::EnableKeylock() Send phone to foreground")); |
926 RDebug::Printf( "%s %s (%u) foreground=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); |
1404 #endif |
927 #if defined(_DEBUG) |
1405 // Bring phone to foreground |
928 RDebug::Print(_L("(AUTOLOCK)CAknKeyLockControl::EnableKeylock() Send phone to foreground")); |
1406 apaTask.BringToForeground(); |
929 #endif |
1407 } |
930 // Bring phone to foreground |
1408 } |
931 apaTask.BringToForeground(); |
1409 } // PenEnabled() |
932 } |
1410 } |
933 } |
1411 |
934 } // PenEnabled() |
1412 if (aNotifySysApp) |
935 |
1413 { |
936 SendMessageToSysAp( EEikKeyLockDisabled ); |
1414 SendMessageToSysAp( EEikKeyLockDisabled ); |
937 } |
1415 } |
938 if ( iNotif ) |
1416 |
|
1417 if ( iNotif ) |
|
1418 { |
939 { |
1419 iNotif->NotifyStatusChange( EKeyLockDisabled ); |
940 iNotif->NotifyStatusChange( EKeyLockDisabled ); |
1420 } |
941 } |
1421 |
942 |
1422 // Basically this cannot fail so we ignore return code. |
943 // Basically this cannot fail so we ignore return code. |
1423 static_cast<CAknNotifierAppServerAppUi*>( |
944 static_cast<CAknNotifierAppServerAppUi*>( |
1424 iEikonEnv->EikAppUi() )->SuppressAppSwitching( EFalse ); |
945 iEikonEnv->EikAppUi() )->SuppressAppSwitching( EFalse ); |
1425 |
946 |
1426 iAutolockEnabled = EFalse; |
947 iAutolockEnabled = EFalse; |
1427 |
|
1428 _AKNTRACE_FUNC_EXIT; |
|
1429 } |
948 } |
1430 |
949 |
1431 |
950 |
1432 // --------------------------------------------------------------------------- |
951 // --------------------------------------------------------------------------- |
1433 // Sends a message to the SysAp window group. |
952 // Sends a message to the SysAp window group. |
1434 // --------------------------------------------------------------------------- |
953 // --------------------------------------------------------------------------- |
1435 // |
954 // |
1436 void CAknKeyLockControl::SendMessageToSysAp( TInt aMessage ) |
955 void CAknKeyLockControl::SendMessageToSysAp( TInt aMessage ) |
1437 { |
956 { |
1438 _AKNTRACE_FUNC_ENTER; |
|
1439 |
|
1440 RWsSession& ws = iEikonEnv->WsSession(); |
957 RWsSession& ws = iEikonEnv->WsSession(); |
1441 TInt wgId = 0; |
958 TInt wgId = 0; |
1442 CApaWindowGroupName::FindByAppUid( KSysApUid, ws, wgId ); |
959 CApaWindowGroupName::FindByAppUid( KSysApUid, ws, wgId ); |
1443 if ( wgId ) |
960 if ( wgId ) |
1444 { |
961 { |
1445 TWsEvent event; |
962 TWsEvent event; |
1446 event.SetType( aMessage ); |
963 event.SetType( aMessage ); |
1447 event.SetTimeNow(); |
964 event.SetTimeNow(); |
1448 ws.SendEventToWindowGroup( wgId, event ); |
965 ws.SendEventToWindowGroup( wgId, event ); |
1449 } |
966 } |
1450 |
|
1451 _AKNTRACE_FUNC_EXIT; |
|
1452 } |
967 } |
1453 |
968 |
1454 |
969 |
1455 // --------------------------------------------------------------------------- |
970 // --------------------------------------------------------------------------- |
1456 // Displays the "offer keylock" note. |
971 // Displays the "offer keylock" note. |
1457 // --------------------------------------------------------------------------- |
972 // --------------------------------------------------------------------------- |
1458 // |
973 // |
1459 void CAknKeyLockControl::OfferKeylock() |
974 void CAknKeyLockControl::OfferKeylock() |
1460 { |
975 { |
1461 _AKNTRACE_FUNC_ENTER; |
|
1462 |
|
1463 iOfferLockNote->ShowNote( (CAknNoteDialog::TTimeout)KAknOfferKeyLockTimeout, |
976 iOfferLockNote->ShowNote( (CAknNoteDialog::TTimeout)KAknOfferKeyLockTimeout, |
1464 CAknNoteDialog::ENoTone ); |
977 CAknNoteDialog::ENoTone ); |
1465 iOfferLockEnabled = ETrue; |
978 iOfferLockEnabled = ETrue; |
1466 |
|
1467 _AKNTRACE_FUNC_EXIT; |
|
1468 } |
979 } |
1469 |
980 |
1470 |
981 |
1471 // --------------------------------------------------------------------------- |
982 // --------------------------------------------------------------------------- |
1472 // Displays the "locked" note. |
983 // Displays the "locked" note. |
1474 // |
985 // |
1475 void CAknKeyLockControl::DisplayLockedNote() |
986 void CAknKeyLockControl::DisplayLockedNote() |
1476 { |
987 { |
1477 if ( !iAutolockEnabled ) |
988 if ( !iAutolockEnabled ) |
1478 { |
989 { |
990 iKeypadLockedNote->ShowNote( KKeyLockCustomShortTimeout, |
|
991 CAknNoteDialog::ENoTone ); |
|
1479 } |
992 } |
1480 } |
993 } |
1481 |
994 |
1482 |
995 |
1483 // --------------------------------------------------------------------------- |
996 // --------------------------------------------------------------------------- |
1486 // |
999 // |
1487 void CAknKeyLockControl::DisplayKeyActiveNote() |
1000 void CAknKeyLockControl::DisplayKeyActiveNote() |
1488 { |
1001 { |
1489 if ( !iAutolockEnabled ) |
1002 if ( !iAutolockEnabled ) |
1490 { |
1003 { |
1004 iKeypadUnlockedNote->ShowNote( KKeyLockCustomShortTimeout, |
|
1005 CAknNoteDialog::ENoTone ); |
|
1491 } |
1006 } |
1492 } |
1007 } |
1493 |
1008 |
1494 |
1009 |
1495 // --------------------------------------------------------------------------- |
1010 // --------------------------------------------------------------------------- |
1496 // Unlocks the keypad and displays the "keys active" note. |
1011 // Unlocks the keypad and displays the "keys active" note. |
1497 // --------------------------------------------------------------------------- |
1012 // --------------------------------------------------------------------------- |
1498 // |
1013 // |
1499 void CAknKeyLockControl::DoUnlock() |
1014 void CAknKeyLockControl::DoUnlock() |
1500 { |
1015 { |
1501 _AKNTRACE_FUNC_ENTER; |
|
1502 |
|
1503 DisableKeylock(); |
1016 DisableKeylock(); |
1504 DisplayKeyActiveNote(); |
1017 DisplayKeyActiveNote(); |
1505 |
|
1506 _AKNTRACE_FUNC_EXIT; |
|
1507 } |
1018 } |
1508 |
1019 |
1509 |
1020 |
1510 // --------------------------------------------------------------------------- |
1021 // --------------------------------------------------------------------------- |
1511 // From base class CCoeControl. |
1022 // From base class CCoeControl. |
1512 // Handles resource change events. |
1023 // Handles resource change events. |
1513 // --------------------------------------------------------------------------- |
1024 // --------------------------------------------------------------------------- |
1514 // |
1025 // |
1515 void CAknKeyLockControl::HandleResourceChange( TInt aType ) |
1026 void CAknKeyLockControl::HandleResourceChange( TInt aType ) |
1516 { |
1027 { |
1517 _AKNTRACE_FUNC_ENTER; |
|
1518 _AKNTRACE("aType:%d",aType); |
|
1519 |
|
1520 if ( aType == KEikDynamicLayoutVariantSwitch ) |
1028 if ( aType == KEikDynamicLayoutVariantSwitch ) |
1521 { |
1029 { |
1522 TRect screenRect; |
1030 TRect screenRect; |
1523 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect ); |
1031 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect ); |
1524 if ( !AknLayoutUtils::PenEnabled() ) |
1032 if ( !AknLayoutUtils::PenEnabled() ) |
1537 { |
1045 { |
1538 Window().SetBackgroundColor( ~0 ); |
1046 Window().SetBackgroundColor( ~0 ); |
1539 } |
1047 } |
1540 } |
1048 } |
1541 } |
1049 } |
1542 |
|
1543 _AKNTRACE_FUNC_EXIT; |
|
1544 } |
1050 } |
1545 |
1051 |
1546 |
1052 |
1547 // --------------------------------------------------------------------------- |
1053 // --------------------------------------------------------------------------- |
1548 // From base class MEikCommandObserver. |
1054 // From base class MEikCommandObserver. |
1549 // Process commands. |
1055 // Process commands. |
1550 // --------------------------------------------------------------------------- |
1056 // --------------------------------------------------------------------------- |
1551 // |
1057 // |
1552 void CAknKeyLockControl::ProcessCommandL( TInt aCommandId ) |
1058 void CAknKeyLockControl::ProcessCommandL( TInt aCommandId ) |
1553 { |
1059 { |
1554 _AKNTRACE_FUNC_ENTER; |
1060 TRACES( RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::ProcessCommandL %d"), aCommandId); ) |
1555 _AKNTRACE("aCommandId:%d",aCommandId); |
|
1556 |
1061 |
1557 switch ( aCommandId ) |
1062 switch ( aCommandId ) |
1558 { |
1063 { |
1559 case EAknSoftkeyUnlock: |
1064 case EAknSoftkeyUnlock: |
1560 { |
1065 { |
1611 default: |
1116 default: |
1612 { |
1117 { |
1613 break; |
1118 break; |
1614 } |
1119 } |
1615 } |
1120 } |
1616 |
|
1617 _AKNTRACE_FUNC_EXIT; |
|
1618 } |
1121 } |
1619 |
1122 |
1620 |
1123 |
1621 // --------------------------------------------------------------------------- |
1124 // --------------------------------------------------------------------------- |
1622 // From base class CCoeControl. |
1125 // From base class CCoeControl. |
1658 // Handles LSK keypress. |
1161 // Handles LSK keypress. |
1659 // --------------------------------------------------------------------------- |
1162 // --------------------------------------------------------------------------- |
1660 // |
1163 // |
1661 void CAknKeyLockControl::LeftSoftKeyPressed() |
1164 void CAknKeyLockControl::LeftSoftKeyPressed() |
1662 { |
1165 { |
1663 _AKNTRACE_FUNC_ENTER; |
1166 TRACES( RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::LeftSoftKeyPressed")); ) |
1664 |
1167 |
1665 // Check that the confirmation note exists, as it's not created on |
1168 // Check that the confirmation note exists, as it's not created on |
1666 // startup if touch layout is in use. In emulator this might cause |
1169 // startup if touch layout is in use. In emulator this might cause |
1667 // a problem, as layout can be changed to a non-touch one, and |
1170 // a problem, as layout can be changed to a non-touch one, and |
1668 // the confirmation notes do not exist. |
1171 // the confirmation notes do not exist. |
1669 if ( iConfirmationNote ) |
1172 if ( iConfirmationNote ) |
1682 CAknNoteDialog::EConfirmationTone ); |
1185 CAknNoteDialog::EConfirmationTone ); |
1683 } |
1186 } |
1684 SendMessageToSysAp( EEikKeyLockLightsOnRequest ); |
1187 SendMessageToSysAp( EEikKeyLockLightsOnRequest ); |
1685 iUnlockConfirmation = ETrue; |
1188 iUnlockConfirmation = ETrue; |
1686 } |
1189 } |
1687 |
|
1688 _AKNTRACE_FUNC_EXIT; |
|
1689 } |
1190 } |
1690 |
1191 |
1691 |
1192 |
1692 // --------------------------------------------------------------------------- |
1193 // --------------------------------------------------------------------------- |
1693 // From base class CCoeControl. |
1194 // From base class CCoeControl. |
1695 // --------------------------------------------------------------------------- |
1196 // --------------------------------------------------------------------------- |
1696 // |
1197 // |
1697 TKeyResponse CAknKeyLockControl::OfferKeyEventL( const TKeyEvent& aKeyEvent, |
1198 TKeyResponse CAknKeyLockControl::OfferKeyEventL( const TKeyEvent& aKeyEvent, |
1698 TEventCode aType ) |
1199 TEventCode aType ) |
1699 { |
1200 { |
1700 _AKNTRACE_FUNC_ENTER; |
|
1701 |
|
1702 if ( AknLayoutUtils::PenEnabled() ) |
1201 if ( AknLayoutUtils::PenEnabled() ) |
1703 { |
1202 { |
1704 _AKNTRACE("(KeyGuard)CAknKeyLockControl::OfferKeyEventL: PenEnabled"); |
1203 TRACES( RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::OfferKeyEventL: PenEnabled"));) |
1705 if ( iAutolockEnabled ) |
1204 if ( iAutolockEnabled ) |
1706 { // The case when touch device is locked and so must be unlocked by hold switch. |
1205 { // The case when touch device is locked and so must be unlocked by hold switch. |
1707 _AKNTRACE("(KeyGuard)CAknKeyLockControl::OfferKeyEventL: Autolock Enabled"); |
1206 TRACES( RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::OfferKeyEventL: Autolock Enabled"));) |
1708 if ( aType == EEventKey && aKeyEvent.iCode == EKeyDeviceF ) |
1207 if ( aType == EEventKey && aKeyEvent.iCode == EKeyDeviceF ) |
1709 { |
1208 { |
1710 _AKNTRACE("(KeyGuard)CAknKeyLockControl::OfferKeyEventL: SysAp message"); |
1209 TRACES( RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::OfferKeyEventL: SysAp message"));) |
1711 SendMessageToSysAp( EEikKeyLockLightsOnRequest ); |
1210 SendMessageToSysAp( EEikKeyLockLightsOnRequest ); |
1712 if ( iAutolockEnabled && !iKeylockApi ) |
1211 if ( iAutolockEnabled && !iKeylockApi ) |
1713 { |
1212 { |
1714 TApaTaskList tasklist( iCoeEnv->WsSession() ); |
1213 TApaTaskList tasklist( iCoeEnv->WsSession() ); |
1715 TApaTask autolocktask = tasklist.FindApp( KAutolockUid ); |
1214 TApaTask autolocktask = tasklist.FindApp( KAutolockUid ); |
1721 TKeyEvent keyEvent; |
1220 TKeyEvent keyEvent; |
1722 keyEvent.iCode = EKeyBell; |
1221 keyEvent.iCode = EKeyBell; |
1723 autolocktask.SendKey( keyEvent ); |
1222 autolocktask.SendKey( keyEvent ); |
1724 } |
1223 } |
1725 } |
1224 } |
1726 _AKNTRACE_FUNC_EXIT; |
1225 TRACES( RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::OfferKeyEventL: return EKeyWasConsumed"));) |
1727 return EKeyWasConsumed; |
1226 return EKeyWasConsumed; |
1728 } |
1227 } |
1729 } |
1228 } |
1730 } |
1229 } |
1731 |
1230 |
1926 aKeyEvent.iScanCode == EStdKeyRightShift ) ) |
1425 aKeyEvent.iScanCode == EStdKeyRightShift ) ) |
1927 { |
1426 { |
1928 ShowLockedNote(); |
1427 ShowLockedNote(); |
1929 } |
1428 } |
1930 } |
1429 } |
1931 _AKNTRACE_FUNC_EXIT; |
1430 |
1932 return EKeyWasConsumed; |
1431 return EKeyWasConsumed; |
1933 } |
1432 } |
1934 |
1433 |
1935 |
1434 |
1936 // --------------------------------------------------------------------------- |
1435 // --------------------------------------------------------------------------- |
1937 // Shows the "locked" note. |
1436 // Shows the "locked" note. |
1938 // --------------------------------------------------------------------------- |
1437 // --------------------------------------------------------------------------- |
1939 // |
1438 // |
1940 void CAknKeyLockControl::ShowLockedNote() |
1439 void CAknKeyLockControl::ShowLockedNote() |
1941 { |
1440 { |
1942 _AKNTRACE_FUNC_ENTER; |
|
1943 |
|
1944 if ( !iLockedNoteDisplayed ) |
1441 if ( !iLockedNoteDisplayed ) |
1945 { |
1442 { |
1946 DoShowLockedNote(); |
1443 DoShowLockedNote(); |
1947 } |
1444 } |
1948 |
|
1949 _AKNTRACE_FUNC_EXIT; |
|
1950 } |
1445 } |
1951 |
1446 |
1952 |
1447 |
1953 // --------------------------------------------------------------------------- |
1448 // --------------------------------------------------------------------------- |
1954 // Shows the "locked" note. |
1449 // Shows the "locked" note. |
1956 // |
1451 // |
1957 void CAknKeyLockControl::DoShowLockedNote() |
1452 void CAknKeyLockControl::DoShowLockedNote() |
1958 { |
1453 { |
1959 if ( !iAutolockEnabled ) |
1454 if ( !iAutolockEnabled ) |
1960 { |
1455 { |
1456 iLockedNote->ShowNote( KKeyLockDisplayLockedTimeout, |
|
1457 CAknNoteDialog::ENoTone ); |
|
1458 iLockedNoteDisplayed = ETrue; |
|
1961 } |
1459 } |
1962 } |
1460 } |
1963 |
1461 |
1964 |
1462 |
1965 // --------------------------------------------------------------------------- |
1463 // --------------------------------------------------------------------------- |
1966 // Brings the keylock notifier's CBA visible. |
1464 // Brings the keylock notifier's CBA visible. |
1967 // --------------------------------------------------------------------------- |
1465 // --------------------------------------------------------------------------- |
1968 // |
1466 // |
1969 void CAknKeyLockControl::ShowKeylockCba() |
1467 void CAknKeyLockControl::ShowKeylockCba() |
1970 { |
1468 { |
1971 _AKNTRACE_FUNC_ENTER; |
|
1972 |
|
1973 RDrawableWindow* cbaWindow = |
1469 RDrawableWindow* cbaWindow = |
1974 iKeyLockCba->ButtonGroup()->AsControl()->DrawableWindow(); |
1470 iKeyLockCba->ButtonGroup()->AsControl()->DrawableWindow(); |
1975 cbaWindow->SetFaded( EFalse, RWindowTreeNode::EFadeWindowOnly ); |
1471 cbaWindow->SetFaded( EFalse, RWindowTreeNode::EFadeWindowOnly ); |
1976 cbaWindow->SetOrdinalPosition( 0, 1 ); |
1472 cbaWindow->SetOrdinalPosition( 0, 1 ); |
1977 cbaWindow->SetNonFading( ETrue ); |
1473 cbaWindow->SetNonFading( ETrue ); |
1978 |
|
1979 _AKNTRACE_FUNC_EXIT; |
|
1980 } |
1474 } |
1981 |
1475 |
1982 |
1476 |
1983 // --------------------------------------------------------------------------- |
1477 // --------------------------------------------------------------------------- |
1984 // Sets the necessary HW keys captured. |
1478 // Sets the necessary HW keys captured. |
1985 // --------------------------------------------------------------------------- |
1479 // --------------------------------------------------------------------------- |
1986 // |
1480 // |
1987 void CAknKeyLockControl::CaptureSystemKeys() |
1481 void CAknKeyLockControl::CaptureSystemKeys() |
1988 { |
1482 { |
1989 _AKNTRACE_FUNC_ENTER; |
|
1990 |
|
1991 if ( !iKeysCaptured ) |
1483 if ( !iKeysCaptured ) |
1992 { |
1484 { |
1993 RWindowGroup& groupWin = iCoeEnv->RootWin(); |
1485 RWindowGroup& groupWin = iCoeEnv->RootWin(); |
1994 |
1486 |
1995 // Capture app key (disable application switching). |
1487 // Capture app key (disable application switching). |
2013 |
1505 |
2014 iHoldSwitch = 0; |
1506 iHoldSwitch = 0; |
2015 |
1507 |
2016 if ( AknLayoutUtils::PenEnabled() ) |
1508 if ( AknLayoutUtils::PenEnabled() ) |
2017 { |
1509 { |
2018 _AKNTRACE("(KeyGuard)CAknKeyLockControl::CaptureSystemKeys PenEnabled"); |
1510 TRACES( RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::CaptureSystemKeys PenEnabled"));) |
2019 if ( iAutolockEnabled ) |
1511 if ( iAutolockEnabled ) |
2020 { //Capture Hold Switch |
1512 { //Capture Hold Switch |
2021 _AKNTRACE("(KeyGuard)CAknKeyLockControl::CaptureSystemKeys iAutolockEnabled"); |
1513 TRACES( RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::CaptureSystemKeys iAutolockEnabled"));) |
2022 iHoldSwitch = groupWin.CaptureKey( EKeyDeviceF, 0, 0 ); |
1514 iHoldSwitch = groupWin.CaptureKey( EKeyDeviceF, 0, 0 ); |
2023 } |
1515 } |
2024 } |
1516 } |
2025 iKeysCaptured = ETrue; |
1517 iKeysCaptured = ETrue; |
2026 } |
1518 } |
2027 |
|
2028 _AKNTRACE_FUNC_EXIT; |
|
2029 } |
1519 } |
2030 |
1520 |
2031 |
1521 |
2032 // --------------------------------------------------------------------------- |
1522 // --------------------------------------------------------------------------- |
2033 // Releases captured HW keys. |
1523 // Releases captured HW keys. |
2034 // --------------------------------------------------------------------------- |
1524 // --------------------------------------------------------------------------- |
2035 // |
1525 // |
2036 void CAknKeyLockControl::UnCaptureSystemKeys() |
1526 void CAknKeyLockControl::UnCaptureSystemKeys() |
2037 { |
1527 { |
2038 _AKNTRACE_FUNC_ENTER; |
|
2039 |
|
2040 if ( iKeysCaptured ) |
1528 if ( iKeysCaptured ) |
2041 { |
1529 { |
2042 RWindowGroup& groupWin = iCoeEnv->RootWin(); |
1530 RWindowGroup& groupWin = iCoeEnv->RootWin(); |
2043 groupWin.CancelCaptureKeyUpAndDowns( iAppKey ); |
1531 groupWin.CancelCaptureKeyUpAndDowns( iAppKey ); |
2044 groupWin.CancelCaptureKeyUpAndDowns( iPowerKey ); |
1532 groupWin.CancelCaptureKeyUpAndDowns( iPowerKey ); |
2055 groupWin.CancelCaptureKey( iHoldSwitch ); |
1543 groupWin.CancelCaptureKey( iHoldSwitch ); |
2056 } |
1544 } |
2057 |
1545 |
2058 iKeysCaptured = EFalse; |
1546 iKeysCaptured = EFalse; |
2059 } |
1547 } |
2060 |
|
2061 _AKNTRACE_FUNC_EXIT; |
|
2062 } |
1548 } |
2063 |
1549 |
2064 |
1550 |
2065 // --------------------------------------------------------------------------- |
1551 // --------------------------------------------------------------------------- |
2066 // From base class MAknEcsObserver. |
1552 // From base class MAknEcsObserver. |
2068 // --------------------------------------------------------------------------- |
1554 // --------------------------------------------------------------------------- |
2069 // |
1555 // |
2070 void CAknKeyLockControl::HandleEcsEvent( CAknEcsDetector* aEcsDetector, |
1556 void CAknKeyLockControl::HandleEcsEvent( CAknEcsDetector* aEcsDetector, |
2071 CAknEcsDetector::TState aState ) |
1557 CAknEcsDetector::TState aState ) |
2072 { |
1558 { |
2073 _AKNTRACE_FUNC_ENTER; |
|
2074 |
|
2075 switch ( aState ) |
1559 switch ( aState ) |
2076 { |
1560 { |
2077 case CAknEcsDetector::ECompleteMatchThenSendKey: |
1561 case CAknEcsDetector::ECompleteMatchThenSendKey: |
2078 { |
1562 { |
2079 // Do nothing since note will be removed on ECallAttempted event. |
1563 // Do nothing since note will be removed on ECallAttempted event. |
2080 break; |
1564 break; |
2081 } |
1565 } |
2082 case CAknEcsDetector::ECompleteMatch: |
1566 case CAknEcsDetector::ECompleteMatch: |
2083 case CAknEcsDetector::EServiceNumMatch: |
|
2084 { |
1567 { |
2085 iEcsNote->SetEmergencyNumber( aEcsDetector->CurrentMatch() ); |
1568 iEcsNote->SetEmergencyNumber( aEcsDetector->CurrentMatch() ); |
2086 iEcsNote->ShowNote( CAknNoteDialog::ENoTimeout, |
1569 iEcsNote->ShowNote( CAknNoteDialog::ENoTimeout, |
2087 CAknNoteDialog::ENoTone ); |
1570 CAknNoteDialog::ENoTone ); |
2088 |
1571 |
2114 default: |
1597 default: |
2115 { |
1598 { |
2116 break; |
1599 break; |
2117 } |
1600 } |
2118 } |
1601 } |
2119 |
|
2120 _AKNTRACE_FUNC_EXIT; |
|
2121 } |
1602 } |
2122 |
1603 |
2123 |
1604 |
2124 // --------------------------------------------------------------------------- |
1605 // --------------------------------------------------------------------------- |
2125 // Cancels the offer keylock note. |
1606 // Cancels the offer keylock note. |
2126 // --------------------------------------------------------------------------- |
1607 // --------------------------------------------------------------------------- |
2127 // |
1608 // |
2128 void CAknKeyLockControl::DoExitOfferKeylock() |
1609 void CAknKeyLockControl::DoExitOfferKeylock() |
2129 { |
1610 { |
2130 _AKNTRACE_FUNC_ENTER; |
|
2131 |
|
2132 iOfferLockNote->CancelNote(); |
1611 iOfferLockNote->CancelNote(); |
2133 |
|
2134 _AKNTRACE_FUNC_EXIT; |
|
2135 } |
1612 } |
2136 |
1613 |
2137 |
1614 |
2138 // --------------------------------------------------------------------------- |
1615 // --------------------------------------------------------------------------- |
2139 // Cancels the offer keylock note. |
1616 // Cancels the offer keylock note. |
2140 // --------------------------------------------------------------------------- |
1617 // --------------------------------------------------------------------------- |
2141 // |
1618 // |
2142 void CAknKeyLockControl::OfferTimerExpired() |
1619 void CAknKeyLockControl::OfferTimerExpired() |
2143 { |
1620 { |
2144 _AKNTRACE_FUNC_ENTER; |
|
2145 |
|
2146 DoExitOfferKeylock(); |
1621 DoExitOfferKeylock(); |
2147 |
|
2148 _AKNTRACE_FUNC_EXIT; |
|
2149 } |
1622 } |
2150 |
1623 |
2151 |
1624 |
2152 // --------------------------------------------------------------------------- |
1625 // --------------------------------------------------------------------------- |
2153 // Sets the autolock state. |
1626 // Sets the autolock state. |
2154 // --------------------------------------------------------------------------- |
1627 // --------------------------------------------------------------------------- |
2155 // |
1628 // |
2156 void CAknKeyLockControl::AutolockEnabled( TBool aAutoLockOn ) |
1629 void CAknKeyLockControl::AutolockEnabled( TBool aAutoLockOn ) |
2157 { |
1630 { |
2158 _AKNTRACE_FUNC_ENTER; |
|
2159 |
|
2160 iAutolockEnabled = aAutoLockOn; |
1631 iAutolockEnabled = aAutoLockOn; |
2161 |
|
2162 _AKNTRACE_FUNC_EXIT; |
|
2163 } |
1632 } |
2164 |
1633 |
2165 |
1634 |
2166 // --------------------------------------------------------------------------- |
1635 // --------------------------------------------------------------------------- |
2167 // For CDMA implementation. |
1636 // For CDMA implementation. |
2185 // For capturing pointer events when key lock is enabled. |
1654 // For capturing pointer events when key lock is enabled. |
2186 // --------------------------------------------------------------------------- |
1655 // --------------------------------------------------------------------------- |
2187 // |
1656 // |
2188 void CAknKeyLockControl::CapturePointerEvents() |
1657 void CAknKeyLockControl::CapturePointerEvents() |
2189 { |
1658 { |
2190 _AKNTRACE_FUNC_ENTER; |
|
2191 |
|
2192 if ( AknLayoutUtils::PenEnabled() ) |
1659 if ( AknLayoutUtils::PenEnabled() ) |
2193 { |
1660 { |
2194 Window().SetPointerCapture( RWindowBase::TCaptureDragDrop ); |
1661 Window().SetPointerCapture( RWindowBase::TCaptureDragDrop ); |
2195 Window().ClaimPointerGrab( ETrue ); |
1662 Window().ClaimPointerGrab( ETrue ); |
2196 } |
1663 } |
2197 |
|
2198 _AKNTRACE_FUNC_EXIT; |
|
2199 } |
1664 } |
2200 |
1665 |
2201 |
1666 |
2202 // --------------------------------------------------------------------------- |
1667 // --------------------------------------------------------------------------- |
2203 // For releasing pointer events when key lock is disabled. |
1668 // For releasing pointer events when key lock is disabled. |
2204 // --------------------------------------------------------------------------- |
1669 // --------------------------------------------------------------------------- |
2205 // |
1670 // |
2206 void CAknKeyLockControl::UnCapturePointerEvents() |
1671 void CAknKeyLockControl::UnCapturePointerEvents() |
2207 { |
1672 { |
2208 _AKNTRACE_FUNC_ENTER; |
|
2209 |
|
2210 if ( AknLayoutUtils::PenEnabled() ) |
1673 if ( AknLayoutUtils::PenEnabled() ) |
2211 { |
1674 { |
2212 Window().SetPointerCapture( RWindowBase::TCaptureDisabled ); |
1675 Window().SetPointerCapture( RWindowBase::TCaptureDisabled ); |
2213 Window().ClaimPointerGrab( EFalse ); |
1676 Window().ClaimPointerGrab( EFalse ); |
2214 } |
1677 } |
2215 |
|
2216 _AKNTRACE_FUNC_EXIT; |
|
2217 } |
|
2218 |
|
2219 TBool CAknKeyLockControl::HasSliderKey() |
|
2220 { |
|
2221 _AKNTRACE_FUNC_ENTER; |
|
2222 |
|
2223 TBool hasSlider(iHardwareSupport != EKeyguardDefaultHardware); |
|
2224 if( FeatureManager::FeatureSupported( KFeatureIdFfPowerKeyAsKeyguard ) ) |
|
2225 { |
|
2226 hasSlider = ETrue; // the only purpose is to display empty sotkeys |
|
2227 } |
|
2228 |
|
2229 _AKNTRACE( "hasSlider:%d",hasSlider); |
|
2230 _AKNTRACE_FUNC_EXIT; |
|
2231 |
|
2232 return hasSlider; |
|
2233 } |
1678 } |
2234 |
1679 |
2235 |
1680 |
2236 // =========================================================================== |
1681 // =========================================================================== |
2237 // class CAknKeyLockNotifierSubject |
1682 // class CAknKeyLockNotifierSubject |
2341 // Starts the keylock notifier synchronously. |
1786 // Starts the keylock notifier synchronously. |
2342 // --------------------------------------------------------------------------- |
1787 // --------------------------------------------------------------------------- |
2343 // |
1788 // |
2344 TPtrC8 CAknKeyLockNotifierSubject::StartL( const TDesC8& aBuffer ) |
1789 TPtrC8 CAknKeyLockNotifierSubject::StartL( const TDesC8& aBuffer ) |
2345 { |
1790 { |
2346 _AKNTRACE_FUNC_ENTER; |
|
2347 |
|
2348 SAknNotifierPackage<SAknKeyLockNotifierParams>* params = |
1791 SAknNotifierPackage<SAknKeyLockNotifierParams>* params = |
2349 ( SAknNotifierPackage<SAknKeyLockNotifierParams>*)aBuffer.Ptr(); |
1792 ( SAknNotifierPackage<SAknKeyLockNotifierParams>*)aBuffer.Ptr(); |
2350 |
1793 |
2351 if ( aBuffer.Length() < 0 || |
1794 if ( aBuffer.Length() < 0 || |
2352 (TUint)aBuffer.Length() < sizeof(SAknNotifierPackage<SAknKeyLockNotifierParams>) || |
1795 (TUint)aBuffer.Length() < sizeof(SAknNotifierPackage<SAknKeyLockNotifierParams>) || |
2353 params->iSignature != KAKNNOTIFIERSIGNATURE ) |
1796 params->iSignature != KAKNNOTIFIERSIGNATURE ) |
2354 { |
1797 { |
2355 User::Leave( KErrArgument ); |
1798 User::Leave( KErrArgument ); |
2356 } |
1799 } |
2357 |
1800 |
2358 _AKNTRACE( "params->iParamData.iReason:%d",params->iParamData.iReason); |
|
2359 |
|
2360 switch ( params->iParamData.iReason ) |
1801 switch ( params->iParamData.iReason ) |
2361 { |
1802 { |
2362 case ELockEnabled: |
1803 case ELockEnabled: |
2363 case ELockDisabled: |
1804 case ELockDisabled: |
2364 case EAllowNotifications: |
1805 case EAllowNotifications: |
2380 { |
1821 { |
2381 break; |
1822 break; |
2382 } |
1823 } |
2383 } |
1824 } |
2384 |
1825 |
2385 _AKNTRACE_FUNC_EXIT; |
|
2386 |
|
2387 return iRetPckg; |
1826 return iRetPckg; |
2388 } |
1827 } |
2389 |
1828 |
2390 |
1829 |
2391 // --------------------------------------------------------------------------- |
1830 // --------------------------------------------------------------------------- |
2395 // |
1834 // |
2396 void CAknKeyLockNotifierSubject::StartL( const TDesC8& aBuffer, |
1835 void CAknKeyLockNotifierSubject::StartL( const TDesC8& aBuffer, |
2397 TInt /*aReplySlot*/, |
1836 TInt /*aReplySlot*/, |
2398 const RMessagePtr2& aMessage ) |
1837 const RMessagePtr2& aMessage ) |
2399 { |
1838 { |
2400 _AKNTRACE_FUNC_ENTER; |
|
2401 |
|
2402 SAknNotifierPackage<SAknKeyLockNotifierParams>* params = |
1839 SAknNotifierPackage<SAknKeyLockNotifierParams>* params = |
2403 ( SAknNotifierPackage<SAknKeyLockNotifierParams>*)aBuffer.Ptr(); |
1840 ( SAknNotifierPackage<SAknKeyLockNotifierParams>*)aBuffer.Ptr(); |
2404 |
1841 |
2405 if ( aBuffer.Length() < 0 || |
1842 if ( aBuffer.Length() < 0 || |
2406 (TUint)aBuffer.Length() < sizeof(SAknNotifierPackage<SAknKeyLockNotifierParams>) || |
1843 (TUint)aBuffer.Length() < sizeof(SAknNotifierPackage<SAknKeyLockNotifierParams>) || |
2407 params->iSignature != KAKNNOTIFIERSIGNATURE ) |
1844 params->iSignature != KAKNNOTIFIERSIGNATURE ) |
2408 { |
1845 { |
2409 User::Leave( KErrArgument ); |
1846 User::Leave( KErrArgument ); |
2410 } |
1847 } |
2411 |
1848 |
2412 _AKNTRACE( "params->iParamData.iReason:%d",params->iParamData.iReason); |
|
2413 |
|
2414 switch ( params->iParamData.iReason ) |
1849 switch ( params->iParamData.iReason ) |
2415 { |
1850 { |
2416 case ELockEnabled: |
1851 case ELockEnabled: |
2417 { |
1852 { |
2418 if ( !iKeyLockControl->iAutolockEnabled ) |
1853 if ( !iKeyLockControl->iAutolockEnabled ) |
2492 { |
1927 { |
2493 break; |
1928 break; |
2494 } |
1929 } |
2495 }; |
1930 }; |
2496 |
1931 |
2497 _AKNTRACE_FUNC_EXIT; |
|
2498 |
|
2499 aMessage.Complete( KErrNone ); |
1932 aMessage.Complete( KErrNone ); |
2500 } |
1933 } |
2501 |
1934 |
2502 |
1935 |
2503 // --------------------------------------------------------------------------- |
1936 // --------------------------------------------------------------------------- |
2548 // Disables the keylock. |
1981 // Disables the keylock. |
2549 // --------------------------------------------------------------------------- |
1982 // --------------------------------------------------------------------------- |
2550 // |
1983 // |
2551 void CAknKeyLockNotifierSubject::UnlockKeys() |
1984 void CAknKeyLockNotifierSubject::UnlockKeys() |
2552 { |
1985 { |
2553 _AKNTRACE_FUNC_ENTER; |
|
2554 |
|
2555 if ( IsKeyLockEnabled() ) |
1986 if ( IsKeyLockEnabled() ) |
2556 { |
1987 { |
2557 iKeyLockControl->DisableKeylock(); |
1988 iKeyLockControl->DisableKeylock(); |
2558 } |
1989 } |
2559 |
|
2560 _AKNTRACE_FUNC_EXIT; |
|
2561 } |
1990 } |
2562 |
1991 |
2563 |
1992 |
2564 // --------------------------------------------------------------------------- |
1993 // --------------------------------------------------------------------------- |
2565 // From base class MAknKeyLockController. |
1994 // From base class MAknKeyLockController. |
2566 // Enables the keylock. |
1995 // Enables the keylock. |
2567 // --------------------------------------------------------------------------- |
1996 // --------------------------------------------------------------------------- |
2568 // |
1997 // |
2569 void CAknKeyLockNotifierSubject::LockKeys( TBool aAutoLockOn ) |
1998 void CAknKeyLockNotifierSubject::LockKeys( TBool aAutoLockOn ) |
2570 { |
1999 { |
2571 _AKNTRACE_FUNC_ENTER; |
|
2572 _AKNTRACE( "aAutoLockOn:%d",aAutoLockOn); |
|
2573 |
|
2574 // We'll have to disable keylock if we are changing autolock status. |
2000 // We'll have to disable keylock if we are changing autolock status. |
2575 if ( IsKeyLockEnabled() && aAutoLockOn != iKeyLockControl->iAutolockEnabled ) |
2001 if ( IsKeyLockEnabled() && aAutoLockOn != iKeyLockControl->iAutolockEnabled ) |
2576 { |
2002 { |
2577 iKeyLockControl->DisableKeylock(EFalse); |
2003 iKeyLockControl->DisableKeylock(); |
2578 } |
2004 } |
2579 |
2005 |
2580 if ( !IsKeyLockEnabled() ) |
2006 if ( !IsKeyLockEnabled() ) |
2581 { |
2007 { |
2582 iKeyLockControl->AutolockEnabled( aAutoLockOn ); |
2008 iKeyLockControl->AutolockEnabled( aAutoLockOn ); |
2583 iKeyLockControl->EnableKeylock(ETrue, EFalse); |
2009 iKeyLockControl->EnableKeylock(); |
2584 } |
2010 } |
2585 |
|
2586 _AKNTRACE_FUNC_EXIT; |
|
2587 } |
2011 } |
2588 |
2012 |
2589 |
2013 |
2590 // --------------------------------------------------------------------------- |
2014 // --------------------------------------------------------------------------- |
2591 // From base class MAknKeyLockController. |
2015 // From base class MAknKeyLockController. |
2592 // Adds a keylock status change observer. |
2016 // Adds a keylock status change observer. |
2593 // --------------------------------------------------------------------------- |
2017 // --------------------------------------------------------------------------- |
2594 // |
2018 // |
2595 void CAknKeyLockNotifierSubject::AddObserverL( MAknKeyLockObserver* aObserver ) |
2019 void CAknKeyLockNotifierSubject::AddObserverL( MAknKeyLockObserver* aObserver ) |
2596 { |
2020 { |
2597 _AKNTRACE_FUNC_ENTER; |
|
2598 |
|
2599 #if defined(_DEBUG) |
2021 #if defined(_DEBUG) |
2600 TInt count = iObserverList->Count(); |
2022 TInt count = iObserverList->Count(); |
2601 for ( TInt index = 0; index < count; index++ ) |
2023 for ( TInt index = 0; index < count; index++ ) |
2602 { |
2024 { |
2603 if ( ((*iObserverList)[index]) == aObserver ) |
2025 if ( ((*iObserverList)[index]) == aObserver ) |
2608 #endif |
2030 #endif |
2609 iObserverList->AppendL( aObserver ); |
2031 iObserverList->AppendL( aObserver ); |
2610 |
2032 |
2611 // Make sure that the observer isn't obscuring the keylock CBA |
2033 // Make sure that the observer isn't obscuring the keylock CBA |
2612 ShowKeylockCba(); |
2034 ShowKeylockCba(); |
2613 |
|
2614 _AKNTRACE_FUNC_EXIT; |
|
2615 } |
2035 } |
2616 |
2036 |
2617 |
2037 |
2618 // --------------------------------------------------------------------------- |
2038 // --------------------------------------------------------------------------- |
2619 // From base class MAknKeyLockController. |
2039 // From base class MAknKeyLockController. |
2620 // Removes a keylock status change observer. |
2040 // Removes a keylock status change observer. |
2621 // --------------------------------------------------------------------------- |
2041 // --------------------------------------------------------------------------- |
2622 // |
2042 // |
2623 void CAknKeyLockNotifierSubject::RemoveObserver( MAknKeyLockObserver* aObserver ) |
2043 void CAknKeyLockNotifierSubject::RemoveObserver( MAknKeyLockObserver* aObserver ) |
2624 { |
2044 { |
2625 _AKNTRACE_FUNC_ENTER; |
|
2626 |
|
2627 TInt count = iObserverList->Count(); |
2045 TInt count = iObserverList->Count(); |
2628 for ( TInt index = 0; index < count; index++ ) |
2046 for ( TInt index = 0; index < count; index++ ) |
2629 { |
2047 { |
2630 if ( ((*iObserverList)[index]) == aObserver ) |
2048 if ( ((*iObserverList)[index]) == aObserver ) |
2631 { |
2049 { |
2634 } |
2052 } |
2635 } |
2053 } |
2636 #if defined(_DEBUG) |
2054 #if defined(_DEBUG) |
2637 Panic( EAknPanicKeyLockObserverNotFound ); |
2055 Panic( EAknPanicKeyLockObserverNotFound ); |
2638 #endif |
2056 #endif |
2639 |
|
2640 _AKNTRACE_FUNC_EXIT; |
|
2641 } |
2057 } |
2642 |
2058 |
2643 |
2059 |
2644 // --------------------------------------------------------------------------- |
2060 // --------------------------------------------------------------------------- |
2645 // Notifies the observers of a keylock status change. |
2061 // Notifies the observers of a keylock status change. |
2646 // --------------------------------------------------------------------------- |
2062 // --------------------------------------------------------------------------- |
2647 // |
2063 // |
2648 void CAknKeyLockNotifierSubject::NotifyStatusChange( TKeyLockStatus aStatus ) |
2064 void CAknKeyLockNotifierSubject::NotifyStatusChange( TKeyLockStatus aStatus ) |
2649 { |
2065 { |
2650 _AKNTRACE_FUNC_ENTER; |
|
2651 _AKNTRACE( "aStatus:%d",aStatus); |
|
2652 |
|
2653 TInt count = iObserverList->Count(); |
2066 TInt count = iObserverList->Count(); |
2654 for ( TInt index = count - 1; index >= 0; index-- ) |
2067 for ( TInt index = count - 1; index >= 0; index-- ) |
2655 { |
2068 { |
2656 ((*iObserverList)[index])->KeyLockStatusChange( aStatus ); |
2069 ((*iObserverList)[index])->KeyLockStatusChange( aStatus ); |
2657 } |
2070 } |
2658 |
|
2659 _AKNTRACE_FUNC_EXIT; |
|
2660 } |
2071 } |
2661 |
2072 |
2662 |
2073 |
2663 // --------------------------------------------------------------------------- |
2074 // --------------------------------------------------------------------------- |
2664 // Brings the keylock notifier's CBA visible. |
2075 // Brings the keylock notifier's CBA visible. |
2665 // --------------------------------------------------------------------------- |
2076 // --------------------------------------------------------------------------- |
2666 // |
2077 // |
2667 void CAknKeyLockNotifierSubject::ShowKeylockCba() |
2078 void CAknKeyLockNotifierSubject::ShowKeylockCba() |
2668 { |
2079 { |
2669 _AKNTRACE_FUNC_ENTER; |
|
2670 |
|
2671 if ( IsKeyLockEnabled() ) |
2080 if ( IsKeyLockEnabled() ) |
2672 { |
2081 { |
2673 iKeyLockControl->ShowKeylockCba(); |
2082 iKeyLockControl->ShowKeylockCba(); |
2674 } |
2083 } |
2675 |
|
2676 _AKNTRACE_FUNC_EXIT; |
|
2677 } |
2084 } |
2678 |
2085 |
2679 |
2086 |
2680 // --------------------------------------------------------------------------- |
2087 // --------------------------------------------------------------------------- |
2681 // Enables the keylock. |
2088 // Enables the keylock. |
2682 // --------------------------------------------------------------------------- |
2089 // --------------------------------------------------------------------------- |
2683 // |
2090 // |
2684 void CAknKeyLockNotifierSubject::DoEnableKeyLock() |
2091 void CAknKeyLockNotifierSubject::DoEnableKeyLock() |
2685 { |
2092 { |
2686 _AKNTRACE_FUNC_ENTER; |
|
2687 |
|
2688 if ( !IsKeyLockEnabled() ) |
2093 if ( !IsKeyLockEnabled() ) |
2689 { |
2094 { |
2690 iKeyLockControl->EnableKeylock(); |
2095 iKeyLockControl->EnableKeylock(); |
2691 } |
2096 } |
2692 |
|
2693 _AKNTRACE_FUNC_EXIT; |
|
2694 } |
2097 } |
2695 |
2098 |
2696 |
2099 |
2697 // --------------------------------------------------------------------------- |
2100 // --------------------------------------------------------------------------- |
2698 // Disables the keylock if active. |
2101 // Disables the keylock if active. |
2699 // --------------------------------------------------------------------------- |
2102 // --------------------------------------------------------------------------- |
2700 // |
2103 // |
2701 void CAknKeyLockNotifierSubject::DoDisableKeyLock() |
2104 void CAknKeyLockNotifierSubject::DoDisableKeyLock() |
2702 { |
2105 { |
2703 _AKNTRACE_FUNC_ENTER; |
|
2704 |
|
2705 if ( IsKeyLockEnabled() ) |
2106 if ( IsKeyLockEnabled() ) |
2706 { |
2107 { |
2707 iKeyLockControl->DisableKeylock(); |
2108 iKeyLockControl->DisableKeylock(); |
2708 // Attempt to display KeyActive note. |
2109 // Attempt to display KeyActive note. |
2709 iKeyLockControl->DisplayKeyActiveNote(); |
2110 iKeyLockControl->DisplayKeyActiveNote(); |
2711 else if ( iKeyLockControl->iOfferLockEnabled ) |
2112 else if ( iKeyLockControl->iOfferLockEnabled ) |
2712 { |
2113 { |
2713 // Remove the offer key lock CBA. |
2114 // Remove the offer key lock CBA. |
2714 iKeyLockControl->OfferTimerExpired(); |
2115 iKeyLockControl->OfferTimerExpired(); |
2715 } |
2116 } |
2716 |
|
2717 _AKNTRACE_FUNC_EXIT; |
|
2718 } |
2117 } |
2719 |
2118 |
2720 |
2119 |
2721 // --------------------------------------------------------------------------- |
2120 // --------------------------------------------------------------------------- |
2722 // Displays the offer keylock note. |
2121 // Displays the offer keylock note. |
2723 // --------------------------------------------------------------------------- |
2122 // --------------------------------------------------------------------------- |
2724 // |
2123 // |
2725 void CAknKeyLockNotifierSubject::DoOfferKeyLock() |
2124 void CAknKeyLockNotifierSubject::DoOfferKeyLock() |
2726 { |
2125 { |
2727 _AKNTRACE_FUNC_ENTER; |
|
2728 |
|
2729 if ( !IsKeyLockEnabled() ) |
2126 if ( !IsKeyLockEnabled() ) |
2730 { |
2127 { |
2731 NotifyStatusChange( EKeyLockOffered ); |
2128 NotifyStatusChange( EKeyLockOffered ); |
2732 iKeyLockControl->OfferKeylock(); |
2129 iKeyLockControl->OfferKeylock(); |
2733 } |
2130 } |
2734 |
2131 } |
2735 _AKNTRACE_FUNC_EXIT; |
|
2736 } |