241 // Starts listening to the KScreenSaverOn event. |
241 // Starts listening to the KScreenSaverOn event. |
242 // --------------------------------------------------------------------------- |
242 // --------------------------------------------------------------------------- |
243 // |
243 // |
244 TInt CAknKeylockScreenSaverObserver::Start() |
244 TInt CAknKeylockScreenSaverObserver::Start() |
245 { |
245 { |
|
246 _AKNTRACE_FUNC_ENTER; |
|
247 |
246 if ( IsActive() ) |
248 if ( IsActive() ) |
247 { |
249 { |
248 return KErrInUse; |
250 return KErrInUse; |
249 } |
251 } |
250 iStatus = KRequestPending; |
252 iStatus = KRequestPending; |
251 iScreenSaverActiveProperty.Subscribe( iStatus ); |
253 iScreenSaverActiveProperty.Subscribe( iStatus ); |
252 SetActive(); |
254 SetActive(); |
253 |
255 |
|
256 _AKNTRACE_FUNC_EXIT; |
|
257 |
254 return KErrNone; |
258 return KErrNone; |
255 } |
259 } |
256 |
260 |
257 |
261 |
258 // --------------------------------------------------------------------------- |
262 // --------------------------------------------------------------------------- |
259 // Stops listening to the KScreenSaverOn event. |
263 // Stops listening to the KScreenSaverOn event. |
260 // --------------------------------------------------------------------------- |
264 // --------------------------------------------------------------------------- |
261 // |
265 // |
262 void CAknKeylockScreenSaverObserver::Stop() |
266 void CAknKeylockScreenSaverObserver::Stop() |
263 { |
267 { |
|
268 _AKNTRACE_FUNC_ENTER; |
|
269 |
264 if ( !IsActive() ) |
270 if ( !IsActive() ) |
265 { |
271 { |
266 return; |
272 return; |
267 } |
273 } |
268 Cancel(); |
274 Cancel(); |
269 iScreenSaverActiveProperty.Cancel(); |
275 iScreenSaverActiveProperty.Cancel(); |
|
276 |
|
277 _AKNTRACE_FUNC_EXIT; |
270 } |
278 } |
271 |
279 |
272 |
280 |
273 // --------------------------------------------------------------------------- |
281 // --------------------------------------------------------------------------- |
274 // C++ constructor |
282 // C++ constructor |
291 // Second phase constructor. |
299 // Second phase constructor. |
292 // --------------------------------------------------------------------------- |
300 // --------------------------------------------------------------------------- |
293 // |
301 // |
294 void CAknKeylockScreenSaverObserver::ConstructL() |
302 void CAknKeylockScreenSaverObserver::ConstructL() |
295 { |
303 { |
|
304 _AKNTRACE_FUNC_ENTER; |
|
305 |
296 // Add this active object to the scheduler. |
306 // Add this active object to the scheduler. |
297 CActiveScheduler::Add( this ); |
307 CActiveScheduler::Add( this ); |
298 User::LeaveIfError( iScreenSaverActiveProperty.Attach( KPSUidScreenSaver, |
308 User::LeaveIfError( iScreenSaverActiveProperty.Attach( KPSUidScreenSaver, |
299 KScreenSaverOn ) ); |
309 KScreenSaverOn ) ); |
300 |
310 |
311 if ( !iDevicelockPolicyApi->HasConfiguration() ) |
321 if ( !iDevicelockPolicyApi->HasConfiguration() ) |
312 { |
322 { |
313 delete iDevicelockPolicyApi; |
323 delete iDevicelockPolicyApi; |
314 iDevicelockPolicyApi = NULL; |
324 iDevicelockPolicyApi = NULL; |
315 } |
325 } |
|
326 |
|
327 _AKNTRACE_FUNC_EXIT; |
316 } |
328 } |
317 |
329 |
318 |
330 |
319 // --------------------------------------------------------------------------- |
331 // --------------------------------------------------------------------------- |
320 // From base class CActive. |
332 // From base class CActive. |
321 // Handles change in the screen saver state. |
333 // Handles change in the screen saver state. |
322 // --------------------------------------------------------------------------- |
334 // --------------------------------------------------------------------------- |
323 // |
335 // |
324 void CAknKeylockScreenSaverObserver::RunL() |
336 void CAknKeylockScreenSaverObserver::RunL() |
325 { |
337 { |
|
338 _AKNTRACE_FUNC_ENTER; |
|
339 |
326 if ( iKeylockEnabled || iAutolockEnabled ) |
340 if ( iKeylockEnabled || iAutolockEnabled ) |
327 { |
341 { |
328 // Resubscribe before processing new value to prevent missing updates. |
342 // Resubscribe before processing new value to prevent missing updates. |
329 Start(); |
343 Start(); |
330 } |
344 } |
347 { |
361 { |
348 CapturePrimaryKeys( EFalse ); |
362 CapturePrimaryKeys( EFalse ); |
349 } |
363 } |
350 iScreenSaverActive = EFalse; |
364 iScreenSaverActive = EFalse; |
351 } |
365 } |
|
366 |
|
367 _AKNTRACE_FUNC_EXIT; |
352 } |
368 } |
353 |
369 |
354 |
370 |
355 // --------------------------------------------------------------------------- |
371 // --------------------------------------------------------------------------- |
356 // Set the lock status. |
372 // Set the lock status. |
357 // --------------------------------------------------------------------------- |
373 // --------------------------------------------------------------------------- |
358 // |
374 // |
359 void CAknKeylockScreenSaverObserver::SetLockStatus( TBool aKeylockEnabled, |
375 void CAknKeylockScreenSaverObserver::SetLockStatus( TBool aKeylockEnabled, |
360 TBool aAutolockEnabled ) |
376 TBool aAutolockEnabled ) |
361 { |
377 { |
|
378 _AKNTRACE_FUNC_ENTER; |
|
379 |
362 iKeylockEnabled = aKeylockEnabled; |
380 iKeylockEnabled = aKeylockEnabled; |
363 iAutolockEnabled = aAutolockEnabled; |
381 iAutolockEnabled = aAutolockEnabled; |
364 |
382 |
365 if ( iKeylockEnabled || iAutolockEnabled ) |
383 if ( iKeylockEnabled || iAutolockEnabled ) |
366 { |
384 { |
374 CapturePrimaryKeys( EFalse ); |
392 CapturePrimaryKeys( EFalse ); |
375 } |
393 } |
376 // Screensaver is only observed when keylock is enabled. |
394 // Screensaver is only observed when keylock is enabled. |
377 Stop(); |
395 Stop(); |
378 } |
396 } |
|
397 |
|
398 _AKNTRACE_FUNC_EXIT; |
379 } |
399 } |
380 |
400 |
381 |
401 |
382 // --------------------------------------------------------------------------- |
402 // --------------------------------------------------------------------------- |
383 // Capture or uncapture primary keys. |
403 // Capture or uncapture primary keys. |
384 // --------------------------------------------------------------------------- |
404 // --------------------------------------------------------------------------- |
385 // |
405 // |
386 void CAknKeylockScreenSaverObserver::CapturePrimaryKeys( TBool aCapture ) |
406 void CAknKeylockScreenSaverObserver::CapturePrimaryKeys( TBool aCapture ) |
387 { |
407 { |
|
408 _AKNTRACE_FUNC_ENTER; |
|
409 |
388 if ( aCapture ) |
410 if ( aCapture ) |
389 { |
411 { |
390 if ( iScreenSaverActive && !iCaptured ) |
412 if ( iScreenSaverActive && !iCaptured ) |
391 { |
413 { |
392 if ( iKeylockEnabled && !iAutolockEnabled ) |
414 if ( iKeylockEnabled && !iAutolockEnabled ) |
466 } |
492 } |
467 |
493 |
468 iCaptured = EFalse; |
494 iCaptured = EFalse; |
469 } |
495 } |
470 } |
496 } |
|
497 |
|
498 _AKNTRACE_FUNC_EXIT; |
471 } |
499 } |
472 |
500 |
473 |
501 |
474 // --------------------------------------------------------------------------- |
502 // --------------------------------------------------------------------------- |
475 // From base class CActive. |
503 // From base class CActive. |
476 // Cancels event listening. |
504 // Cancels event listening. |
477 // --------------------------------------------------------------------------- |
505 // --------------------------------------------------------------------------- |
478 // |
506 // |
479 void CAknKeylockScreenSaverObserver::DoCancel() |
507 void CAknKeylockScreenSaverObserver::DoCancel() |
480 { |
508 { |
|
509 _AKNTRACE_FUNC_ENTER; |
|
510 |
481 iScreenSaverActiveProperty.Cancel(); |
511 iScreenSaverActiveProperty.Cancel(); |
|
512 |
|
513 _AKNTRACE_FUNC_EXIT; |
482 } |
514 } |
483 |
515 |
484 |
516 |
485 // =========================================================================== |
517 // =========================================================================== |
486 // class CAknLockedNote. |
518 // class CAknLockedNote. |
504 // Handles a dialog button press for the button with ID aCommand. |
536 // Handles a dialog button press for the button with ID aCommand. |
505 // --------------------------------------------------------------------------- |
537 // --------------------------------------------------------------------------- |
506 // |
538 // |
507 TBool CAknLockedNote::OkToExitL( TInt aCommand ) |
539 TBool CAknLockedNote::OkToExitL( TInt aCommand ) |
508 { |
540 { |
|
541 _AKNTRACE_FUNC_ENTER; |
|
542 |
509 iLocked = EFalse; |
543 iLocked = EFalse; |
510 if ( iCommandObserver ) |
544 if ( iCommandObserver ) |
511 { |
545 { |
512 iCommandObserver->ProcessCommandL( aCommand ); |
546 iCommandObserver->ProcessCommandL( aCommand ); |
513 } |
547 } |
|
548 |
|
549 _AKNTRACE_FUNC_EXIT; |
|
550 |
514 return ETrue; |
551 return ETrue; |
515 } |
552 } |
516 |
553 |
517 |
554 |
518 // --------------------------------------------------------------------------- |
555 // --------------------------------------------------------------------------- |
530 // Cancels the note. |
567 // Cancels the note. |
531 // --------------------------------------------------------------------------- |
568 // --------------------------------------------------------------------------- |
532 // |
569 // |
533 void CAknLockedNote::CancelNote() |
570 void CAknLockedNote::CancelNote() |
534 { |
571 { |
|
572 _AKNTRACE_FUNC_ENTER; |
|
573 |
535 if ( iTimer ) |
574 if ( iTimer ) |
536 { |
575 { |
537 iTimer->Cancel(); |
576 iTimer->Cancel(); |
538 } |
577 } |
539 ExitSleepingDialog(); |
578 ExitSleepingDialog(); |
540 iLocked = EFalse; |
579 iLocked = EFalse; |
|
580 |
|
581 _AKNTRACE_FUNC_EXIT; |
541 } |
582 } |
542 |
583 |
543 |
584 |
544 // --------------------------------------------------------------------------- |
585 // --------------------------------------------------------------------------- |
545 // From base class CEikDialog. |
586 // From base class CEikDialog. |
546 // Handles focus change event. |
587 // Handles focus change event. |
547 // --------------------------------------------------------------------------- |
588 // --------------------------------------------------------------------------- |
548 // |
589 // |
549 void CAknLockedNote::FocusChanged( TDrawNow /*aDrawNow*/ ) |
590 void CAknLockedNote::FocusChanged( TDrawNow /*aDrawNow*/ ) |
550 { |
591 { |
|
592 _AKNTRACE_FUNC_ENTER; |
|
593 |
551 if ( !IsFocused() && iCommandObserver ) |
594 if ( !IsFocused() && iCommandObserver ) |
552 { |
595 { |
553 TRAP_IGNORE( iCommandObserver->ProcessCommandL( KNoteCmdFocusLost ) ) |
596 TRAP_IGNORE( iCommandObserver->ProcessCommandL( KNoteCmdFocusLost ) ) |
554 } |
597 } |
|
598 |
|
599 _AKNTRACE_FUNC_EXIT; |
555 } |
600 } |
556 |
601 |
557 |
602 |
558 // --------------------------------------------------------------------------- |
603 // --------------------------------------------------------------------------- |
559 // From base class CEikDialog. |
604 // From base class CEikDialog. |
630 // Displays the note. |
675 // Displays the note. |
631 // --------------------------------------------------------------------------- |
676 // --------------------------------------------------------------------------- |
632 // |
677 // |
633 TInt CAknSleepingNote::ShowNote( const TInt aTimeout, const TTone aTone ) |
678 TInt CAknSleepingNote::ShowNote( const TInt aTimeout, const TTone aTone ) |
634 { |
679 { |
|
680 _AKNTRACE_FUNC_ENTER; |
|
681 |
635 TRAP_IGNORE(AknGlobalPopupPriorityController::SetPopupPriorityL( *this, KGlobalWindowPriority_KeyLock )); |
682 TRAP_IGNORE(AknGlobalPopupPriorityController::SetPopupPriorityL( *this, KGlobalWindowPriority_KeyLock )); |
636 iTimeoutInMicroseconds = aTimeout; |
683 iTimeoutInMicroseconds = aTimeout; |
637 iTone = aTone; |
684 iTone = aTone; |
|
685 |
|
686 _AKNTRACE_FUNC_EXIT; |
|
687 |
638 return RouseSleepingDialog(); |
688 return RouseSleepingDialog(); |
639 } |
689 } |
640 |
690 |
641 |
691 |
642 // --------------------------------------------------------------------------- |
692 // --------------------------------------------------------------------------- |
644 // Handles a dialog button press for the button with ID aCommand. |
694 // Handles a dialog button press for the button with ID aCommand. |
645 // --------------------------------------------------------------------------- |
695 // --------------------------------------------------------------------------- |
646 // |
696 // |
647 TBool CAknSleepingNote::OkToExitL( TInt aCommand ) |
697 TBool CAknSleepingNote::OkToExitL( TInt aCommand ) |
648 { |
698 { |
|
699 _AKNTRACE_FUNC_ENTER; |
|
700 |
649 if ( iCommandObserver ) |
701 if ( iCommandObserver ) |
650 { |
702 { |
651 iCommandObserver->ProcessCommandL( aCommand ); |
703 iCommandObserver->ProcessCommandL( aCommand ); |
652 } |
704 } |
|
705 |
|
706 _AKNTRACE_FUNC_EXIT; |
|
707 |
653 return ETrue; |
708 return ETrue; |
654 } |
709 } |
655 |
710 |
656 |
711 |
657 // --------------------------------------------------------------------------- |
712 // --------------------------------------------------------------------------- |
659 // Updates the note animation on skin change event. |
714 // Updates the note animation on skin change event. |
660 // --------------------------------------------------------------------------- |
715 // --------------------------------------------------------------------------- |
661 // |
716 // |
662 void CAknSleepingNote::HandleResourceChange( TInt aType ) |
717 void CAknSleepingNote::HandleResourceChange( TInt aType ) |
663 { |
718 { |
|
719 _AKNTRACE_FUNC_ENTER; |
|
720 |
664 if ( aType == KAknsMessageSkinChange ) |
721 if ( aType == KAknsMessageSkinChange ) |
665 { |
722 { |
666 TInt animationRes( 0 ); |
723 TInt animationRes( 0 ); |
667 switch ( iResourceId ) |
724 switch ( iResourceId ) |
668 { |
725 { |
867 number.Append( ' ' ); |
928 number.Append( ' ' ); |
868 } |
929 } |
869 |
930 |
870 number.Append( aMatchedNumber ); |
931 number.Append( aMatchedNumber ); |
871 TRAP_IGNORE( SetTextL( number ) ); |
932 TRAP_IGNORE( SetTextL( number ) ); |
|
933 |
|
934 _AKNTRACE_FUNC_EXIT; |
872 } |
935 } |
873 |
936 |
874 |
937 |
875 // --------------------------------------------------------------------------- |
938 // --------------------------------------------------------------------------- |
876 // Makes the note go to sleep. |
939 // Makes the note go to sleep. |
877 // --------------------------------------------------------------------------- |
940 // --------------------------------------------------------------------------- |
878 // |
941 // |
879 void CAknEcsNote::SleepNote() |
942 void CAknEcsNote::SleepNote() |
880 { |
943 { |
|
944 _AKNTRACE_FUNC_ENTER; |
|
945 |
881 if ( iNoteOnScreen ) |
946 if ( iNoteOnScreen ) |
882 { |
947 { |
883 // Causes flicker to other notes if called when note is not on screen. |
948 // Causes flicker to other notes if called when note is not on screen. |
884 ExitSleepingDialog(); |
949 ExitSleepingDialog(); |
885 } |
950 } |
886 iNoteOnScreen = EFalse; |
951 iNoteOnScreen = EFalse; |
|
952 |
|
953 _AKNTRACE_FUNC_EXIT; |
887 } |
954 } |
888 |
955 |
889 |
956 |
890 // =========================================================================== |
957 // =========================================================================== |
891 // class CAknKeyLockControl |
958 // class CAknKeyLockControl |
908 // --------------------------------------------------------------------------- |
975 // --------------------------------------------------------------------------- |
909 // |
976 // |
910 CAknKeyLockControl::CAknKeyLockControl( CAknKeyLockNotifierSubject* aNotif ) : |
977 CAknKeyLockControl::CAknKeyLockControl( CAknKeyLockNotifierSubject* aNotif ) : |
911 iNotif( aNotif ) |
978 iNotif( aNotif ) |
912 { |
979 { |
|
980 _AKNTRACE_FUNC_ENTER; |
|
981 |
913 AKNTASHOOK_ADD( this, "CAknKeyLockControl" ); |
982 AKNTASHOOK_ADD( this, "CAknKeyLockControl" ); |
|
983 |
|
984 _AKNTRACE_FUNC_EXIT; |
914 } |
985 } |
915 |
986 |
916 |
987 |
917 // --------------------------------------------------------------------------- |
988 // --------------------------------------------------------------------------- |
918 // Destructor |
989 // Destructor |
919 // --------------------------------------------------------------------------- |
990 // --------------------------------------------------------------------------- |
920 // |
991 // |
921 CAknKeyLockControl::~CAknKeyLockControl() |
992 CAknKeyLockControl::~CAknKeyLockControl() |
922 { |
993 { |
|
994 _AKNTRACE_FUNC_ENTER; |
|
995 |
923 AKNTASHOOK_REMOVE(); |
996 AKNTASHOOK_REMOVE(); |
924 // We implicitely trust that Eikon env exists |
997 // We implicitely trust that Eikon env exists |
925 // (though in practice it does not make the |
998 // (though in practice it does not make the |
926 // difference as this destructor is really never called...) |
999 // difference as this destructor is really never called...) |
927 RWindowGroup& groupWin = iEikonEnv->RootWin(); |
1000 RWindowGroup& groupWin = iEikonEnv->RootWin(); |
943 delete iKeyLockCba; |
1016 delete iKeyLockCba; |
944 delete iOfferLockNote; |
1017 delete iOfferLockNote; |
945 delete iEcsNote; // Ecs change |
1018 delete iEcsNote; // Ecs change |
946 delete iKeylockApi; |
1019 delete iKeylockApi; |
947 delete iKeylockScreenSaverObserver; |
1020 delete iKeylockScreenSaverObserver; |
|
1021 |
|
1022 _AKNTRACE_FUNC_EXIT; |
948 } |
1023 } |
949 |
1024 |
950 |
1025 |
951 // --------------------------------------------------------------------------- |
1026 // --------------------------------------------------------------------------- |
952 // Second phase construction. |
1027 // Second phase construction. |
953 // --------------------------------------------------------------------------- |
1028 // --------------------------------------------------------------------------- |
954 // |
1029 // |
955 void CAknKeyLockControl::ConstructL() |
1030 void CAknKeyLockControl::ConstructL() |
956 { |
1031 { |
957 TRACES( RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::ConstructL ")); ) |
1032 _AKNTRACE_FUNC_ENTER; |
958 |
1033 |
959 FeatureManager::InitializeLibL(); |
1034 FeatureManager::InitializeLibL(); |
960 iFeatureKeypadNoSlider = |
1035 iFeatureKeypadNoSlider = |
961 FeatureManager::FeatureSupported( KFeatureIdKeypadNoSlider ); |
1036 FeatureManager::FeatureSupported( KFeatureIdKeypadNoSlider ); |
962 iFeatureNoPowerkey = |
1037 iFeatureNoPowerkey = |
1118 TSecurityPolicy( TSecurityPolicy::EAlwaysPass ), |
1193 TSecurityPolicy( TSecurityPolicy::EAlwaysPass ), |
1119 KWritePolicy ); |
1194 KWritePolicy ); |
1120 |
1195 |
1121 iStatusProperty.Attach( KPSUidAvkonDomain, KAknKeyguardStatus ); |
1196 iStatusProperty.Attach( KPSUidAvkonDomain, KAknKeyguardStatus ); |
1122 iStatusProperty.Set( EKeyguardNotActive ); |
1197 iStatusProperty.Set( EKeyguardNotActive ); |
|
1198 |
|
1199 _AKNTRACE_FUNC_EXIT; |
1123 } |
1200 } |
1124 |
1201 |
1125 |
1202 |
1126 // --------------------------------------------------------------------------- |
1203 // --------------------------------------------------------------------------- |
1127 // Enable key lock. |
1204 // Enable key lock. |
1128 // --------------------------------------------------------------------------- |
1205 // --------------------------------------------------------------------------- |
1129 // |
1206 // |
1130 void CAknKeyLockControl::EnableKeylock( TBool aShowNote, TBool aNotifySysApp ) |
1207 void CAknKeyLockControl::EnableKeylock( TBool aShowNote, TBool aNotifySysApp ) |
1131 { |
1208 { |
1132 TRACES( RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::EnableKeylock %d"), aShowNote); ) |
1209 _AKNTRACE_FUNC_ENTER; |
1133 |
1210 _AKNTRACE("aShowNote:%d",aShowNote); |
|
1211 _AKNTRACE("aNotifySysApp:%d",aNotifySysApp); |
|
1212 |
1134 // Policy can be used to disable support for keyguard. |
1213 // Policy can be used to disable support for keyguard. |
1135 if ( !iAutolockEnabled && !CKeyLockPolicyApi::KeyguardAllowed() ) |
1214 if ( !iAutolockEnabled && !CKeyLockPolicyApi::KeyguardAllowed() ) |
1136 { |
1215 { |
1137 // Keylock Disabled |
1216 // Keylock Disabled |
1138 return; |
1217 return; |
1253 |
1332 |
1254 // Method HandleResourceChangeL with parameter KAknInternalFSWClose cannot |
1333 // Method HandleResourceChangeL with parameter KAknInternalFSWClose cannot |
1255 // leave, but we trap it in just in case. |
1334 // leave, but we trap it in just in case. |
1256 TRAP_IGNORE( static_cast<CAknCapAppServerAppUi*>( iEikonEnv->EikAppUi() )->HandleResourceChangeL( |
1335 TRAP_IGNORE( static_cast<CAknCapAppServerAppUi*>( iEikonEnv->EikAppUi() )->HandleResourceChangeL( |
1257 KAknInternalFSWClose ); ); |
1336 KAknInternalFSWClose ); ); |
|
1337 |
|
1338 _AKNTRACE_FUNC_EXIT; |
1258 } |
1339 } |
1259 |
1340 |
1260 |
1341 |
1261 // --------------------------------------------------------------------------- |
1342 // --------------------------------------------------------------------------- |
1262 // Disable key lock. |
1343 // Disable key lock. |
1263 // --------------------------------------------------------------------------- |
1344 // --------------------------------------------------------------------------- |
1264 // |
1345 // |
1265 void CAknKeyLockControl::DisableKeylock(TBool aNotifySysApp) |
1346 void CAknKeyLockControl::DisableKeylock(TBool aNotifySysApp) |
1266 { |
1347 { |
1267 TRACES( RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::DisableKeylock")); ) |
1348 _AKNTRACE_FUNC_ENTER; |
|
1349 _AKNTRACE("aShowNote:%d",aNotifySysApp); |
1268 |
1350 |
1269 // Keep locking status in sync. |
1351 // Keep locking status in sync. |
1270 iKeylockScreenSaverObserver->SetLockStatus( EFalse, iAutolockEnabled ); |
1352 iKeylockScreenSaverObserver->SetLockStatus( EFalse, iAutolockEnabled ); |
1271 if ( iSoundsMuted ) |
1353 if ( iSoundsMuted ) |
1272 { |
1354 { |
1340 // Basically this cannot fail so we ignore return code. |
1422 // Basically this cannot fail so we ignore return code. |
1341 static_cast<CAknNotifierAppServerAppUi*>( |
1423 static_cast<CAknNotifierAppServerAppUi*>( |
1342 iEikonEnv->EikAppUi() )->SuppressAppSwitching( EFalse ); |
1424 iEikonEnv->EikAppUi() )->SuppressAppSwitching( EFalse ); |
1343 |
1425 |
1344 iAutolockEnabled = EFalse; |
1426 iAutolockEnabled = EFalse; |
|
1427 |
|
1428 _AKNTRACE_FUNC_EXIT; |
1345 } |
1429 } |
1346 |
1430 |
1347 |
1431 |
1348 // --------------------------------------------------------------------------- |
1432 // --------------------------------------------------------------------------- |
1349 // Sends a message to the SysAp window group. |
1433 // Sends a message to the SysAp window group. |
1350 // --------------------------------------------------------------------------- |
1434 // --------------------------------------------------------------------------- |
1351 // |
1435 // |
1352 void CAknKeyLockControl::SendMessageToSysAp( TInt aMessage ) |
1436 void CAknKeyLockControl::SendMessageToSysAp( TInt aMessage ) |
1353 { |
1437 { |
|
1438 _AKNTRACE_FUNC_ENTER; |
|
1439 |
1354 RWsSession& ws = iEikonEnv->WsSession(); |
1440 RWsSession& ws = iEikonEnv->WsSession(); |
1355 TInt wgId = 0; |
1441 TInt wgId = 0; |
1356 CApaWindowGroupName::FindByAppUid( KSysApUid, ws, wgId ); |
1442 CApaWindowGroupName::FindByAppUid( KSysApUid, ws, wgId ); |
1357 if ( wgId ) |
1443 if ( wgId ) |
1358 { |
1444 { |
1359 TWsEvent event; |
1445 TWsEvent event; |
1360 event.SetType( aMessage ); |
1446 event.SetType( aMessage ); |
1361 event.SetTimeNow(); |
1447 event.SetTimeNow(); |
1362 ws.SendEventToWindowGroup( wgId, event ); |
1448 ws.SendEventToWindowGroup( wgId, event ); |
1363 } |
1449 } |
|
1450 |
|
1451 _AKNTRACE_FUNC_EXIT; |
1364 } |
1452 } |
1365 |
1453 |
1366 |
1454 |
1367 // --------------------------------------------------------------------------- |
1455 // --------------------------------------------------------------------------- |
1368 // Displays the "offer keylock" note. |
1456 // Displays the "offer keylock" note. |
1369 // --------------------------------------------------------------------------- |
1457 // --------------------------------------------------------------------------- |
1370 // |
1458 // |
1371 void CAknKeyLockControl::OfferKeylock() |
1459 void CAknKeyLockControl::OfferKeylock() |
1372 { |
1460 { |
|
1461 _AKNTRACE_FUNC_ENTER; |
|
1462 |
1373 iOfferLockNote->ShowNote( (CAknNoteDialog::TTimeout)KAknOfferKeyLockTimeout, |
1463 iOfferLockNote->ShowNote( (CAknNoteDialog::TTimeout)KAknOfferKeyLockTimeout, |
1374 CAknNoteDialog::ENoTone ); |
1464 CAknNoteDialog::ENoTone ); |
1375 iOfferLockEnabled = ETrue; |
1465 iOfferLockEnabled = ETrue; |
|
1466 |
|
1467 _AKNTRACE_FUNC_EXIT; |
1376 } |
1468 } |
1377 |
1469 |
1378 |
1470 |
1379 // --------------------------------------------------------------------------- |
1471 // --------------------------------------------------------------------------- |
1380 // Displays the "locked" note. |
1472 // Displays the "locked" note. |
1404 // Unlocks the keypad and displays the "keys active" note. |
1496 // Unlocks the keypad and displays the "keys active" note. |
1405 // --------------------------------------------------------------------------- |
1497 // --------------------------------------------------------------------------- |
1406 // |
1498 // |
1407 void CAknKeyLockControl::DoUnlock() |
1499 void CAknKeyLockControl::DoUnlock() |
1408 { |
1500 { |
|
1501 _AKNTRACE_FUNC_ENTER; |
|
1502 |
1409 DisableKeylock(); |
1503 DisableKeylock(); |
1410 DisplayKeyActiveNote(); |
1504 DisplayKeyActiveNote(); |
|
1505 |
|
1506 _AKNTRACE_FUNC_EXIT; |
1411 } |
1507 } |
1412 |
1508 |
1413 |
1509 |
1414 // --------------------------------------------------------------------------- |
1510 // --------------------------------------------------------------------------- |
1415 // From base class CCoeControl. |
1511 // From base class CCoeControl. |
1416 // Handles resource change events. |
1512 // Handles resource change events. |
1417 // --------------------------------------------------------------------------- |
1513 // --------------------------------------------------------------------------- |
1418 // |
1514 // |
1419 void CAknKeyLockControl::HandleResourceChange( TInt aType ) |
1515 void CAknKeyLockControl::HandleResourceChange( TInt aType ) |
1420 { |
1516 { |
|
1517 _AKNTRACE_FUNC_ENTER; |
|
1518 _AKNTRACE("aType:%d",aType); |
|
1519 |
1421 if ( aType == KEikDynamicLayoutVariantSwitch ) |
1520 if ( aType == KEikDynamicLayoutVariantSwitch ) |
1422 { |
1521 { |
1423 TRect screenRect; |
1522 TRect screenRect; |
1424 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect ); |
1523 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect ); |
1425 if ( !AknLayoutUtils::PenEnabled() ) |
1524 if ( !AknLayoutUtils::PenEnabled() ) |
1438 { |
1537 { |
1439 Window().SetBackgroundColor( ~0 ); |
1538 Window().SetBackgroundColor( ~0 ); |
1440 } |
1539 } |
1441 } |
1540 } |
1442 } |
1541 } |
|
1542 |
|
1543 _AKNTRACE_FUNC_EXIT; |
1443 } |
1544 } |
1444 |
1545 |
1445 |
1546 |
1446 // --------------------------------------------------------------------------- |
1547 // --------------------------------------------------------------------------- |
1447 // From base class MEikCommandObserver. |
1548 // From base class MEikCommandObserver. |
1448 // Process commands. |
1549 // Process commands. |
1449 // --------------------------------------------------------------------------- |
1550 // --------------------------------------------------------------------------- |
1450 // |
1551 // |
1451 void CAknKeyLockControl::ProcessCommandL( TInt aCommandId ) |
1552 void CAknKeyLockControl::ProcessCommandL( TInt aCommandId ) |
1452 { |
1553 { |
1453 TRACES( RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::ProcessCommandL %d"), aCommandId); ) |
1554 _AKNTRACE_FUNC_ENTER; |
|
1555 _AKNTRACE("aCommandId:%d",aCommandId); |
1454 |
1556 |
1455 switch ( aCommandId ) |
1557 switch ( aCommandId ) |
1456 { |
1558 { |
1457 case EAknSoftkeyUnlock: |
1559 case EAknSoftkeyUnlock: |
1458 { |
1560 { |
1554 // Handles LSK keypress. |
1658 // Handles LSK keypress. |
1555 // --------------------------------------------------------------------------- |
1659 // --------------------------------------------------------------------------- |
1556 // |
1660 // |
1557 void CAknKeyLockControl::LeftSoftKeyPressed() |
1661 void CAknKeyLockControl::LeftSoftKeyPressed() |
1558 { |
1662 { |
1559 TRACES( RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::LeftSoftKeyPressed")); ) |
1663 _AKNTRACE_FUNC_ENTER; |
1560 |
1664 |
1561 // Check that the confirmation note exists, as it's not created on |
1665 // Check that the confirmation note exists, as it's not created on |
1562 // startup if touch layout is in use. In emulator this might cause |
1666 // startup if touch layout is in use. In emulator this might cause |
1563 // a problem, as layout can be changed to a non-touch one, and |
1667 // a problem, as layout can be changed to a non-touch one, and |
1564 // the confirmation notes do not exist. |
1668 // the confirmation notes do not exist. |
1565 if ( iConfirmationNote ) |
1669 if ( iConfirmationNote ) |
1589 // --------------------------------------------------------------------------- |
1695 // --------------------------------------------------------------------------- |
1590 // |
1696 // |
1591 TKeyResponse CAknKeyLockControl::OfferKeyEventL( const TKeyEvent& aKeyEvent, |
1697 TKeyResponse CAknKeyLockControl::OfferKeyEventL( const TKeyEvent& aKeyEvent, |
1592 TEventCode aType ) |
1698 TEventCode aType ) |
1593 { |
1699 { |
|
1700 _AKNTRACE_FUNC_ENTER; |
|
1701 |
1594 if ( AknLayoutUtils::PenEnabled() ) |
1702 if ( AknLayoutUtils::PenEnabled() ) |
1595 { |
1703 { |
1596 TRACES( RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::OfferKeyEventL: PenEnabled"));) |
1704 _AKNTRACE("(KeyGuard)CAknKeyLockControl::OfferKeyEventL: PenEnabled"); |
1597 if ( iAutolockEnabled ) |
1705 if ( iAutolockEnabled ) |
1598 { // The case when touch device is locked and so must be unlocked by hold switch. |
1706 { // The case when touch device is locked and so must be unlocked by hold switch. |
1599 TRACES( RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::OfferKeyEventL: Autolock Enabled"));) |
1707 _AKNTRACE("(KeyGuard)CAknKeyLockControl::OfferKeyEventL: Autolock Enabled"); |
1600 if ( aType == EEventKey && aKeyEvent.iCode == EKeyDeviceF ) |
1708 if ( aType == EEventKey && aKeyEvent.iCode == EKeyDeviceF ) |
1601 { |
1709 { |
1602 TRACES( RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::OfferKeyEventL: SysAp message"));) |
1710 _AKNTRACE("(KeyGuard)CAknKeyLockControl::OfferKeyEventL: SysAp message"); |
1603 SendMessageToSysAp( EEikKeyLockLightsOnRequest ); |
1711 SendMessageToSysAp( EEikKeyLockLightsOnRequest ); |
1604 if ( iAutolockEnabled && !iKeylockApi ) |
1712 if ( iAutolockEnabled && !iKeylockApi ) |
1605 { |
1713 { |
1606 TApaTaskList tasklist( iCoeEnv->WsSession() ); |
1714 TApaTaskList tasklist( iCoeEnv->WsSession() ); |
1607 TApaTask autolocktask = tasklist.FindApp( KAutolockUid ); |
1715 TApaTask autolocktask = tasklist.FindApp( KAutolockUid ); |
1818 aKeyEvent.iScanCode == EStdKeyRightShift ) ) |
1926 aKeyEvent.iScanCode == EStdKeyRightShift ) ) |
1819 { |
1927 { |
1820 ShowLockedNote(); |
1928 ShowLockedNote(); |
1821 } |
1929 } |
1822 } |
1930 } |
1823 |
1931 _AKNTRACE_FUNC_EXIT; |
1824 return EKeyWasConsumed; |
1932 return EKeyWasConsumed; |
1825 } |
1933 } |
1826 |
1934 |
1827 |
1935 |
1828 // --------------------------------------------------------------------------- |
1936 // --------------------------------------------------------------------------- |
1829 // Shows the "locked" note. |
1937 // Shows the "locked" note. |
1830 // --------------------------------------------------------------------------- |
1938 // --------------------------------------------------------------------------- |
1831 // |
1939 // |
1832 void CAknKeyLockControl::ShowLockedNote() |
1940 void CAknKeyLockControl::ShowLockedNote() |
1833 { |
1941 { |
|
1942 _AKNTRACE_FUNC_ENTER; |
|
1943 |
1834 if ( !iLockedNoteDisplayed ) |
1944 if ( !iLockedNoteDisplayed ) |
1835 { |
1945 { |
1836 DoShowLockedNote(); |
1946 DoShowLockedNote(); |
1837 } |
1947 } |
|
1948 |
|
1949 _AKNTRACE_FUNC_EXIT; |
1838 } |
1950 } |
1839 |
1951 |
1840 |
1952 |
1841 // --------------------------------------------------------------------------- |
1953 // --------------------------------------------------------------------------- |
1842 // Shows the "locked" note. |
1954 // Shows the "locked" note. |
1854 // Brings the keylock notifier's CBA visible. |
1966 // Brings the keylock notifier's CBA visible. |
1855 // --------------------------------------------------------------------------- |
1967 // --------------------------------------------------------------------------- |
1856 // |
1968 // |
1857 void CAknKeyLockControl::ShowKeylockCba() |
1969 void CAknKeyLockControl::ShowKeylockCba() |
1858 { |
1970 { |
|
1971 _AKNTRACE_FUNC_ENTER; |
|
1972 |
1859 RDrawableWindow* cbaWindow = |
1973 RDrawableWindow* cbaWindow = |
1860 iKeyLockCba->ButtonGroup()->AsControl()->DrawableWindow(); |
1974 iKeyLockCba->ButtonGroup()->AsControl()->DrawableWindow(); |
1861 cbaWindow->SetFaded( EFalse, RWindowTreeNode::EFadeWindowOnly ); |
1975 cbaWindow->SetFaded( EFalse, RWindowTreeNode::EFadeWindowOnly ); |
1862 cbaWindow->SetOrdinalPosition( 0, 1 ); |
1976 cbaWindow->SetOrdinalPosition( 0, 1 ); |
1863 cbaWindow->SetNonFading( ETrue ); |
1977 cbaWindow->SetNonFading( ETrue ); |
|
1978 |
|
1979 _AKNTRACE_FUNC_EXIT; |
1864 } |
1980 } |
1865 |
1981 |
1866 |
1982 |
1867 // --------------------------------------------------------------------------- |
1983 // --------------------------------------------------------------------------- |
1868 // Sets the necessary HW keys captured. |
1984 // Sets the necessary HW keys captured. |
1869 // --------------------------------------------------------------------------- |
1985 // --------------------------------------------------------------------------- |
1870 // |
1986 // |
1871 void CAknKeyLockControl::CaptureSystemKeys() |
1987 void CAknKeyLockControl::CaptureSystemKeys() |
1872 { |
1988 { |
|
1989 _AKNTRACE_FUNC_ENTER; |
|
1990 |
1873 if ( !iKeysCaptured ) |
1991 if ( !iKeysCaptured ) |
1874 { |
1992 { |
1875 RWindowGroup& groupWin = iCoeEnv->RootWin(); |
1993 RWindowGroup& groupWin = iCoeEnv->RootWin(); |
1876 |
1994 |
1877 // Capture app key (disable application switching). |
1995 // Capture app key (disable application switching). |
1895 |
2013 |
1896 iHoldSwitch = 0; |
2014 iHoldSwitch = 0; |
1897 |
2015 |
1898 if ( AknLayoutUtils::PenEnabled() ) |
2016 if ( AknLayoutUtils::PenEnabled() ) |
1899 { |
2017 { |
1900 TRACES( RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::CaptureSystemKeys PenEnabled"));) |
2018 _AKNTRACE("(KeyGuard)CAknKeyLockControl::CaptureSystemKeys PenEnabled"); |
1901 if ( iAutolockEnabled ) |
2019 if ( iAutolockEnabled ) |
1902 { //Capture Hold Switch |
2020 { //Capture Hold Switch |
1903 TRACES( RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::CaptureSystemKeys iAutolockEnabled"));) |
2021 _AKNTRACE("(KeyGuard)CAknKeyLockControl::CaptureSystemKeys iAutolockEnabled"); |
1904 iHoldSwitch = groupWin.CaptureKey( EKeyDeviceF, 0, 0 ); |
2022 iHoldSwitch = groupWin.CaptureKey( EKeyDeviceF, 0, 0 ); |
1905 } |
2023 } |
1906 } |
2024 } |
1907 iKeysCaptured = ETrue; |
2025 iKeysCaptured = ETrue; |
1908 } |
2026 } |
|
2027 |
|
2028 _AKNTRACE_FUNC_EXIT; |
1909 } |
2029 } |
1910 |
2030 |
1911 |
2031 |
1912 // --------------------------------------------------------------------------- |
2032 // --------------------------------------------------------------------------- |
1913 // Releases captured HW keys. |
2033 // Releases captured HW keys. |
1914 // --------------------------------------------------------------------------- |
2034 // --------------------------------------------------------------------------- |
1915 // |
2035 // |
1916 void CAknKeyLockControl::UnCaptureSystemKeys() |
2036 void CAknKeyLockControl::UnCaptureSystemKeys() |
1917 { |
2037 { |
|
2038 _AKNTRACE_FUNC_ENTER; |
|
2039 |
1918 if ( iKeysCaptured ) |
2040 if ( iKeysCaptured ) |
1919 { |
2041 { |
1920 RWindowGroup& groupWin = iCoeEnv->RootWin(); |
2042 RWindowGroup& groupWin = iCoeEnv->RootWin(); |
1921 groupWin.CancelCaptureKeyUpAndDowns( iAppKey ); |
2043 groupWin.CancelCaptureKeyUpAndDowns( iAppKey ); |
1922 groupWin.CancelCaptureKeyUpAndDowns( iPowerKey ); |
2044 groupWin.CancelCaptureKeyUpAndDowns( iPowerKey ); |
1988 default: |
2114 default: |
1989 { |
2115 { |
1990 break; |
2116 break; |
1991 } |
2117 } |
1992 } |
2118 } |
|
2119 |
|
2120 _AKNTRACE_FUNC_EXIT; |
1993 } |
2121 } |
1994 |
2122 |
1995 |
2123 |
1996 // --------------------------------------------------------------------------- |
2124 // --------------------------------------------------------------------------- |
1997 // Cancels the offer keylock note. |
2125 // Cancels the offer keylock note. |
1998 // --------------------------------------------------------------------------- |
2126 // --------------------------------------------------------------------------- |
1999 // |
2127 // |
2000 void CAknKeyLockControl::DoExitOfferKeylock() |
2128 void CAknKeyLockControl::DoExitOfferKeylock() |
2001 { |
2129 { |
|
2130 _AKNTRACE_FUNC_ENTER; |
|
2131 |
2002 iOfferLockNote->CancelNote(); |
2132 iOfferLockNote->CancelNote(); |
|
2133 |
|
2134 _AKNTRACE_FUNC_EXIT; |
2003 } |
2135 } |
2004 |
2136 |
2005 |
2137 |
2006 // --------------------------------------------------------------------------- |
2138 // --------------------------------------------------------------------------- |
2007 // Cancels the offer keylock note. |
2139 // Cancels the offer keylock note. |
2008 // --------------------------------------------------------------------------- |
2140 // --------------------------------------------------------------------------- |
2009 // |
2141 // |
2010 void CAknKeyLockControl::OfferTimerExpired() |
2142 void CAknKeyLockControl::OfferTimerExpired() |
2011 { |
2143 { |
|
2144 _AKNTRACE_FUNC_ENTER; |
|
2145 |
2012 DoExitOfferKeylock(); |
2146 DoExitOfferKeylock(); |
|
2147 |
|
2148 _AKNTRACE_FUNC_EXIT; |
2013 } |
2149 } |
2014 |
2150 |
2015 |
2151 |
2016 // --------------------------------------------------------------------------- |
2152 // --------------------------------------------------------------------------- |
2017 // Sets the autolock state. |
2153 // Sets the autolock state. |
2018 // --------------------------------------------------------------------------- |
2154 // --------------------------------------------------------------------------- |
2019 // |
2155 // |
2020 void CAknKeyLockControl::AutolockEnabled( TBool aAutoLockOn ) |
2156 void CAknKeyLockControl::AutolockEnabled( TBool aAutoLockOn ) |
2021 { |
2157 { |
|
2158 _AKNTRACE_FUNC_ENTER; |
|
2159 |
2022 iAutolockEnabled = aAutoLockOn; |
2160 iAutolockEnabled = aAutoLockOn; |
|
2161 |
|
2162 _AKNTRACE_FUNC_EXIT; |
2023 } |
2163 } |
2024 |
2164 |
2025 |
2165 |
2026 // --------------------------------------------------------------------------- |
2166 // --------------------------------------------------------------------------- |
2027 // For CDMA implementation. |
2167 // For CDMA implementation. |
2045 // For capturing pointer events when key lock is enabled. |
2185 // For capturing pointer events when key lock is enabled. |
2046 // --------------------------------------------------------------------------- |
2186 // --------------------------------------------------------------------------- |
2047 // |
2187 // |
2048 void CAknKeyLockControl::CapturePointerEvents() |
2188 void CAknKeyLockControl::CapturePointerEvents() |
2049 { |
2189 { |
|
2190 _AKNTRACE_FUNC_ENTER; |
|
2191 |
2050 if ( AknLayoutUtils::PenEnabled() ) |
2192 if ( AknLayoutUtils::PenEnabled() ) |
2051 { |
2193 { |
2052 Window().SetPointerCapture( RWindowBase::TCaptureDragDrop ); |
2194 Window().SetPointerCapture( RWindowBase::TCaptureDragDrop ); |
2053 Window().ClaimPointerGrab( ETrue ); |
2195 Window().ClaimPointerGrab( ETrue ); |
2054 } |
2196 } |
|
2197 |
|
2198 _AKNTRACE_FUNC_EXIT; |
2055 } |
2199 } |
2056 |
2200 |
2057 |
2201 |
2058 // --------------------------------------------------------------------------- |
2202 // --------------------------------------------------------------------------- |
2059 // For releasing pointer events when key lock is disabled. |
2203 // For releasing pointer events when key lock is disabled. |
2060 // --------------------------------------------------------------------------- |
2204 // --------------------------------------------------------------------------- |
2061 // |
2205 // |
2062 void CAknKeyLockControl::UnCapturePointerEvents() |
2206 void CAknKeyLockControl::UnCapturePointerEvents() |
2063 { |
2207 { |
|
2208 _AKNTRACE_FUNC_ENTER; |
|
2209 |
2064 if ( AknLayoutUtils::PenEnabled() ) |
2210 if ( AknLayoutUtils::PenEnabled() ) |
2065 { |
2211 { |
2066 Window().SetPointerCapture( RWindowBase::TCaptureDisabled ); |
2212 Window().SetPointerCapture( RWindowBase::TCaptureDisabled ); |
2067 Window().ClaimPointerGrab( EFalse ); |
2213 Window().ClaimPointerGrab( EFalse ); |
2068 } |
2214 } |
|
2215 |
|
2216 _AKNTRACE_FUNC_EXIT; |
2069 } |
2217 } |
2070 |
2218 |
2071 TBool CAknKeyLockControl::HasSliderKey() |
2219 TBool CAknKeyLockControl::HasSliderKey() |
2072 { |
2220 { |
|
2221 _AKNTRACE_FUNC_ENTER; |
|
2222 |
2073 TBool hasSlider(iHardwareSupport != EKeyguardDefaultHardware); |
2223 TBool hasSlider(iHardwareSupport != EKeyguardDefaultHardware); |
2074 if( FeatureManager::FeatureSupported( KFeatureIdFfPowerKeyAsKeyguard ) ) |
2224 if( FeatureManager::FeatureSupported( KFeatureIdFfPowerKeyAsKeyguard ) ) |
2075 { |
2225 { |
2076 hasSlider = ETrue; // the only purpose is to display empty sotkeys |
2226 hasSlider = ETrue; // the only purpose is to display empty sotkeys |
2077 } |
2227 } |
|
2228 |
|
2229 _AKNTRACE( "hasSlider:%d",hasSlider); |
|
2230 _AKNTRACE_FUNC_EXIT; |
|
2231 |
2078 return hasSlider; |
2232 return hasSlider; |
2079 } |
2233 } |
2080 |
2234 |
2081 |
2235 |
2082 // =========================================================================== |
2236 // =========================================================================== |
2187 // Starts the keylock notifier synchronously. |
2341 // Starts the keylock notifier synchronously. |
2188 // --------------------------------------------------------------------------- |
2342 // --------------------------------------------------------------------------- |
2189 // |
2343 // |
2190 TPtrC8 CAknKeyLockNotifierSubject::StartL( const TDesC8& aBuffer ) |
2344 TPtrC8 CAknKeyLockNotifierSubject::StartL( const TDesC8& aBuffer ) |
2191 { |
2345 { |
|
2346 _AKNTRACE_FUNC_ENTER; |
|
2347 |
2192 SAknNotifierPackage<SAknKeyLockNotifierParams>* params = |
2348 SAknNotifierPackage<SAknKeyLockNotifierParams>* params = |
2193 ( SAknNotifierPackage<SAknKeyLockNotifierParams>*)aBuffer.Ptr(); |
2349 ( SAknNotifierPackage<SAknKeyLockNotifierParams>*)aBuffer.Ptr(); |
2194 |
2350 |
2195 if ( aBuffer.Length() < 0 || |
2351 if ( aBuffer.Length() < 0 || |
2196 (TUint)aBuffer.Length() < sizeof(SAknNotifierPackage<SAknKeyLockNotifierParams>) || |
2352 (TUint)aBuffer.Length() < sizeof(SAknNotifierPackage<SAknKeyLockNotifierParams>) || |
2197 params->iSignature != KAKNNOTIFIERSIGNATURE ) |
2353 params->iSignature != KAKNNOTIFIERSIGNATURE ) |
2198 { |
2354 { |
2199 User::Leave( KErrArgument ); |
2355 User::Leave( KErrArgument ); |
2200 } |
2356 } |
2201 |
2357 |
|
2358 _AKNTRACE( "params->iParamData.iReason:%d",params->iParamData.iReason); |
|
2359 |
2202 switch ( params->iParamData.iReason ) |
2360 switch ( params->iParamData.iReason ) |
2203 { |
2361 { |
2204 case ELockEnabled: |
2362 case ELockEnabled: |
2205 case ELockDisabled: |
2363 case ELockDisabled: |
2206 case EAllowNotifications: |
2364 case EAllowNotifications: |
2235 // |
2395 // |
2236 void CAknKeyLockNotifierSubject::StartL( const TDesC8& aBuffer, |
2396 void CAknKeyLockNotifierSubject::StartL( const TDesC8& aBuffer, |
2237 TInt /*aReplySlot*/, |
2397 TInt /*aReplySlot*/, |
2238 const RMessagePtr2& aMessage ) |
2398 const RMessagePtr2& aMessage ) |
2239 { |
2399 { |
|
2400 _AKNTRACE_FUNC_ENTER; |
|
2401 |
2240 SAknNotifierPackage<SAknKeyLockNotifierParams>* params = |
2402 SAknNotifierPackage<SAknKeyLockNotifierParams>* params = |
2241 ( SAknNotifierPackage<SAknKeyLockNotifierParams>*)aBuffer.Ptr(); |
2403 ( SAknNotifierPackage<SAknKeyLockNotifierParams>*)aBuffer.Ptr(); |
2242 |
2404 |
2243 if ( aBuffer.Length() < 0 || |
2405 if ( aBuffer.Length() < 0 || |
2244 (TUint)aBuffer.Length() < sizeof(SAknNotifierPackage<SAknKeyLockNotifierParams>) || |
2406 (TUint)aBuffer.Length() < sizeof(SAknNotifierPackage<SAknKeyLockNotifierParams>) || |
2245 params->iSignature != KAKNNOTIFIERSIGNATURE ) |
2407 params->iSignature != KAKNNOTIFIERSIGNATURE ) |
2246 { |
2408 { |
2247 User::Leave( KErrArgument ); |
2409 User::Leave( KErrArgument ); |
2248 } |
2410 } |
2249 |
2411 |
|
2412 _AKNTRACE( "params->iParamData.iReason:%d",params->iParamData.iReason); |
|
2413 |
2250 switch ( params->iParamData.iReason ) |
2414 switch ( params->iParamData.iReason ) |
2251 { |
2415 { |
2252 case ELockEnabled: |
2416 case ELockEnabled: |
2253 { |
2417 { |
2254 if ( !iKeyLockControl->iAutolockEnabled ) |
2418 if ( !iKeyLockControl->iAutolockEnabled ) |
2382 // Disables the keylock. |
2548 // Disables the keylock. |
2383 // --------------------------------------------------------------------------- |
2549 // --------------------------------------------------------------------------- |
2384 // |
2550 // |
2385 void CAknKeyLockNotifierSubject::UnlockKeys() |
2551 void CAknKeyLockNotifierSubject::UnlockKeys() |
2386 { |
2552 { |
|
2553 _AKNTRACE_FUNC_ENTER; |
|
2554 |
2387 if ( IsKeyLockEnabled() ) |
2555 if ( IsKeyLockEnabled() ) |
2388 { |
2556 { |
2389 iKeyLockControl->DisableKeylock(); |
2557 iKeyLockControl->DisableKeylock(); |
2390 } |
2558 } |
|
2559 |
|
2560 _AKNTRACE_FUNC_EXIT; |
2391 } |
2561 } |
2392 |
2562 |
2393 |
2563 |
2394 // --------------------------------------------------------------------------- |
2564 // --------------------------------------------------------------------------- |
2395 // From base class MAknKeyLockController. |
2565 // From base class MAknKeyLockController. |
2396 // Enables the keylock. |
2566 // Enables the keylock. |
2397 // --------------------------------------------------------------------------- |
2567 // --------------------------------------------------------------------------- |
2398 // |
2568 // |
2399 void CAknKeyLockNotifierSubject::LockKeys( TBool aAutoLockOn ) |
2569 void CAknKeyLockNotifierSubject::LockKeys( TBool aAutoLockOn ) |
2400 { |
2570 { |
|
2571 _AKNTRACE_FUNC_ENTER; |
|
2572 _AKNTRACE( "aAutoLockOn:%d",aAutoLockOn); |
|
2573 |
2401 // We'll have to disable keylock if we are changing autolock status. |
2574 // We'll have to disable keylock if we are changing autolock status. |
2402 if ( IsKeyLockEnabled() && aAutoLockOn != iKeyLockControl->iAutolockEnabled ) |
2575 if ( IsKeyLockEnabled() && aAutoLockOn != iKeyLockControl->iAutolockEnabled ) |
2403 { |
2576 { |
2404 iKeyLockControl->DisableKeylock(EFalse); |
2577 iKeyLockControl->DisableKeylock(EFalse); |
2405 } |
2578 } |
2407 if ( !IsKeyLockEnabled() ) |
2580 if ( !IsKeyLockEnabled() ) |
2408 { |
2581 { |
2409 iKeyLockControl->AutolockEnabled( aAutoLockOn ); |
2582 iKeyLockControl->AutolockEnabled( aAutoLockOn ); |
2410 iKeyLockControl->EnableKeylock(ETrue, EFalse); |
2583 iKeyLockControl->EnableKeylock(ETrue, EFalse); |
2411 } |
2584 } |
|
2585 |
|
2586 _AKNTRACE_FUNC_EXIT; |
2412 } |
2587 } |
2413 |
2588 |
2414 |
2589 |
2415 // --------------------------------------------------------------------------- |
2590 // --------------------------------------------------------------------------- |
2416 // From base class MAknKeyLockController. |
2591 // From base class MAknKeyLockController. |
2417 // Adds a keylock status change observer. |
2592 // Adds a keylock status change observer. |
2418 // --------------------------------------------------------------------------- |
2593 // --------------------------------------------------------------------------- |
2419 // |
2594 // |
2420 void CAknKeyLockNotifierSubject::AddObserverL( MAknKeyLockObserver* aObserver ) |
2595 void CAknKeyLockNotifierSubject::AddObserverL( MAknKeyLockObserver* aObserver ) |
2421 { |
2596 { |
|
2597 _AKNTRACE_FUNC_ENTER; |
|
2598 |
2422 #if defined(_DEBUG) |
2599 #if defined(_DEBUG) |
2423 TInt count = iObserverList->Count(); |
2600 TInt count = iObserverList->Count(); |
2424 for ( TInt index = 0; index < count; index++ ) |
2601 for ( TInt index = 0; index < count; index++ ) |
2425 { |
2602 { |
2426 if ( ((*iObserverList)[index]) == aObserver ) |
2603 if ( ((*iObserverList)[index]) == aObserver ) |
2431 #endif |
2608 #endif |
2432 iObserverList->AppendL( aObserver ); |
2609 iObserverList->AppendL( aObserver ); |
2433 |
2610 |
2434 // Make sure that the observer isn't obscuring the keylock CBA |
2611 // Make sure that the observer isn't obscuring the keylock CBA |
2435 ShowKeylockCba(); |
2612 ShowKeylockCba(); |
|
2613 |
|
2614 _AKNTRACE_FUNC_EXIT; |
2436 } |
2615 } |
2437 |
2616 |
2438 |
2617 |
2439 // --------------------------------------------------------------------------- |
2618 // --------------------------------------------------------------------------- |
2440 // From base class MAknKeyLockController. |
2619 // From base class MAknKeyLockController. |
2441 // Removes a keylock status change observer. |
2620 // Removes a keylock status change observer. |
2442 // --------------------------------------------------------------------------- |
2621 // --------------------------------------------------------------------------- |
2443 // |
2622 // |
2444 void CAknKeyLockNotifierSubject::RemoveObserver( MAknKeyLockObserver* aObserver ) |
2623 void CAknKeyLockNotifierSubject::RemoveObserver( MAknKeyLockObserver* aObserver ) |
2445 { |
2624 { |
|
2625 _AKNTRACE_FUNC_ENTER; |
|
2626 |
2446 TInt count = iObserverList->Count(); |
2627 TInt count = iObserverList->Count(); |
2447 for ( TInt index = 0; index < count; index++ ) |
2628 for ( TInt index = 0; index < count; index++ ) |
2448 { |
2629 { |
2449 if ( ((*iObserverList)[index]) == aObserver ) |
2630 if ( ((*iObserverList)[index]) == aObserver ) |
2450 { |
2631 { |
2453 } |
2634 } |
2454 } |
2635 } |
2455 #if defined(_DEBUG) |
2636 #if defined(_DEBUG) |
2456 Panic( EAknPanicKeyLockObserverNotFound ); |
2637 Panic( EAknPanicKeyLockObserverNotFound ); |
2457 #endif |
2638 #endif |
|
2639 |
|
2640 _AKNTRACE_FUNC_EXIT; |
2458 } |
2641 } |
2459 |
2642 |
2460 |
2643 |
2461 // --------------------------------------------------------------------------- |
2644 // --------------------------------------------------------------------------- |
2462 // Notifies the observers of a keylock status change. |
2645 // Notifies the observers of a keylock status change. |
2463 // --------------------------------------------------------------------------- |
2646 // --------------------------------------------------------------------------- |
2464 // |
2647 // |
2465 void CAknKeyLockNotifierSubject::NotifyStatusChange( TKeyLockStatus aStatus ) |
2648 void CAknKeyLockNotifierSubject::NotifyStatusChange( TKeyLockStatus aStatus ) |
2466 { |
2649 { |
|
2650 _AKNTRACE_FUNC_ENTER; |
|
2651 _AKNTRACE( "aStatus:%d",aStatus); |
|
2652 |
2467 TInt count = iObserverList->Count(); |
2653 TInt count = iObserverList->Count(); |
2468 for ( TInt index = count - 1; index >= 0; index-- ) |
2654 for ( TInt index = count - 1; index >= 0; index-- ) |
2469 { |
2655 { |
2470 ((*iObserverList)[index])->KeyLockStatusChange( aStatus ); |
2656 ((*iObserverList)[index])->KeyLockStatusChange( aStatus ); |
2471 } |
2657 } |
|
2658 |
|
2659 _AKNTRACE_FUNC_EXIT; |
2472 } |
2660 } |
2473 |
2661 |
2474 |
2662 |
2475 // --------------------------------------------------------------------------- |
2663 // --------------------------------------------------------------------------- |
2476 // Brings the keylock notifier's CBA visible. |
2664 // Brings the keylock notifier's CBA visible. |
2477 // --------------------------------------------------------------------------- |
2665 // --------------------------------------------------------------------------- |
2478 // |
2666 // |
2479 void CAknKeyLockNotifierSubject::ShowKeylockCba() |
2667 void CAknKeyLockNotifierSubject::ShowKeylockCba() |
2480 { |
2668 { |
|
2669 _AKNTRACE_FUNC_ENTER; |
|
2670 |
2481 if ( IsKeyLockEnabled() ) |
2671 if ( IsKeyLockEnabled() ) |
2482 { |
2672 { |
2483 iKeyLockControl->ShowKeylockCba(); |
2673 iKeyLockControl->ShowKeylockCba(); |
2484 } |
2674 } |
|
2675 |
|
2676 _AKNTRACE_FUNC_EXIT; |
2485 } |
2677 } |
2486 |
2678 |
2487 |
2679 |
2488 // --------------------------------------------------------------------------- |
2680 // --------------------------------------------------------------------------- |
2489 // Enables the keylock. |
2681 // Enables the keylock. |
2490 // --------------------------------------------------------------------------- |
2682 // --------------------------------------------------------------------------- |
2491 // |
2683 // |
2492 void CAknKeyLockNotifierSubject::DoEnableKeyLock() |
2684 void CAknKeyLockNotifierSubject::DoEnableKeyLock() |
2493 { |
2685 { |
|
2686 _AKNTRACE_FUNC_ENTER; |
|
2687 |
2494 if ( !IsKeyLockEnabled() ) |
2688 if ( !IsKeyLockEnabled() ) |
2495 { |
2689 { |
2496 iKeyLockControl->EnableKeylock(); |
2690 iKeyLockControl->EnableKeylock(); |
2497 } |
2691 } |
|
2692 |
|
2693 _AKNTRACE_FUNC_EXIT; |
2498 } |
2694 } |
2499 |
2695 |
2500 |
2696 |
2501 // --------------------------------------------------------------------------- |
2697 // --------------------------------------------------------------------------- |
2502 // Disables the keylock if active. |
2698 // Disables the keylock if active. |
2503 // --------------------------------------------------------------------------- |
2699 // --------------------------------------------------------------------------- |
2504 // |
2700 // |
2505 void CAknKeyLockNotifierSubject::DoDisableKeyLock() |
2701 void CAknKeyLockNotifierSubject::DoDisableKeyLock() |
2506 { |
2702 { |
|
2703 _AKNTRACE_FUNC_ENTER; |
|
2704 |
2507 if ( IsKeyLockEnabled() ) |
2705 if ( IsKeyLockEnabled() ) |
2508 { |
2706 { |
2509 iKeyLockControl->DisableKeylock(); |
2707 iKeyLockControl->DisableKeylock(); |
2510 // Attempt to display KeyActive note. |
2708 // Attempt to display KeyActive note. |
2511 iKeyLockControl->DisplayKeyActiveNote(); |
2709 iKeyLockControl->DisplayKeyActiveNote(); |
2513 else if ( iKeyLockControl->iOfferLockEnabled ) |
2711 else if ( iKeyLockControl->iOfferLockEnabled ) |
2514 { |
2712 { |
2515 // Remove the offer key lock CBA. |
2713 // Remove the offer key lock CBA. |
2516 iKeyLockControl->OfferTimerExpired(); |
2714 iKeyLockControl->OfferTimerExpired(); |
2517 } |
2715 } |
|
2716 |
|
2717 _AKNTRACE_FUNC_EXIT; |
2518 } |
2718 } |
2519 |
2719 |
2520 |
2720 |
2521 // --------------------------------------------------------------------------- |
2721 // --------------------------------------------------------------------------- |
2522 // Displays the offer keylock note. |
2722 // Displays the offer keylock note. |
2523 // --------------------------------------------------------------------------- |
2723 // --------------------------------------------------------------------------- |
2524 // |
2724 // |
2525 void CAknKeyLockNotifierSubject::DoOfferKeyLock() |
2725 void CAknKeyLockNotifierSubject::DoOfferKeyLock() |
2526 { |
2726 { |
|
2727 _AKNTRACE_FUNC_ENTER; |
|
2728 |
2527 if ( !IsKeyLockEnabled() ) |
2729 if ( !IsKeyLockEnabled() ) |
2528 { |
2730 { |
2529 NotifyStatusChange( EKeyLockOffered ); |
2731 NotifyStatusChange( EKeyLockOffered ); |
2530 iKeyLockControl->OfferKeylock(); |
2732 iKeyLockControl->OfferKeylock(); |
2531 } |
2733 } |
2532 } |
2734 |
|
2735 _AKNTRACE_FUNC_EXIT; |
|
2736 } |