securitydialogs/Autolock/src/Autolock.cpp
changeset 51 f479c7dc25d6
parent 45 5d3e34b7618a
child 56 25a3fbb5e4d3
--- a/securitydialogs/Autolock/src/Autolock.cpp	Wed Aug 18 10:40:08 2010 +0300
+++ b/securitydialogs/Autolock/src/Autolock.cpp	Thu Sep 02 21:22:45 2010 +0300
@@ -19,8 +19,6 @@
  *
  */
 
-// #include "xqservicelog.h"
-
 #include <QCoreApplication>
 #include <QKeyEvent>
 #include <QEvent>
@@ -44,6 +42,7 @@
 #include <settingsinternalcrkeys.h>     // CenRep keys
 #include <w32std.h>
 #include <eikenv.h>
+#include <aknsoundsystem.h>
 
 #include <secuisecuritysettings.h>
 #include <secui.h>
@@ -169,6 +168,7 @@
     TInt lightsTimeout = 0;
     CRepository* repository = NULL;
     TInt cRresult = 0;
+    iLockCodeQueryInDisplay = EFalse;
     Q_UNUSED(cRresult);
 
 		iProcessingEvent = -1;
@@ -358,7 +358,9 @@
     if (aReason == ELockAppDisableDevicelock)
         {
         RDEBUG("calling AskSecCodeInAutoLockL", 0);
+        iLockCodeQueryInDisplay = ETrue;
         QT_TRAP_THROWING(validCode = handler->AskSecCodeInAutoLockL()); // this returns true/false
+        iLockCodeQueryInDisplay = EFalse;
         // TODO should this also do iPhone.SetLockSetting(status, lockType, lockChange); ???
         }
     else if (aReason == ELockAppEnableDevicelock)
@@ -995,6 +997,12 @@
     if (status == 0) // hide
         {
         // aReason is not important here, but let's check nevertheless
+        RDEBUG("ReleaseContext", R_AVKON_DEFAULT_SKEY_LIST);
+        static_cast<CAknAppUi*>(CEikonEnv::Static()->EikAppUi())->KeySounds()->ReleaseContext();
+        RDEBUG("PopContext", 0x90);
+        static_cast<CAknAppUi*>(CEikonEnv::Static()->EikAppUi())->KeySounds()->PopContext();
+        RDEBUG("ReleaseContext done", 0x92);
+
         if (aReason != ELockAppDisableKeyguard && aReason != ELockAppDisableDevicelock)
             {
             RDEBUG("!!!!****!!!!! error. status=0 but aReason", aReason);
@@ -1009,6 +1017,7 @@
             switchScreensaverMode( ESnsrViewTypeDisabled);
 
             disconnect(iDeviceDialog, SIGNAL(dataReceived(QVariantMap)), this, SLOT(handleMessageFromScreensaver(QVariantMap)));
+            disconnect(iDeviceDialog, SIGNAL(deviceDialogClosed()), this, SLOT(handleScreensaverClosed()));
             RDEBUG("signal disconnected", err);
             // TODO this crashes for EDeviceDialogScreenSaver
             err = iDeviceDialog->cancel();
@@ -1049,6 +1058,14 @@
         }
     else if (status == 1) // show
         {
+        RDEBUG("PushContextL", R_AVKON_DEFAULT_SKEY_LIST);
+        static_cast<CAknAppUi*>(CEikonEnv::Static()->EikAppUi())->KeySounds()->PushContextL(R_AVKON_SILENT_SKEY_LIST);
+        RDEBUG("BringToForeground", 0x90);
+        static_cast<CAknAppUi*>(CEikonEnv::Static()->EikAppUi())->KeySounds()->BringToForeground();
+        RDEBUG("LockContext", 0x91);
+        static_cast<CAknAppUi*>(CEikonEnv::Static()->EikAppUi())->KeySounds()->LockContext();
+        RDEBUG("PushContextL Done", 0x92);
+
         // secUiOriginatedQuery should be ESecurityUIsSecUIOriginatedUninitialized . If not, the validation is not correctly filtering it
         QVariantMap params;
         TBool err;
@@ -1075,6 +1092,7 @@
             iDeviceDialog = new HbDeviceDialog(HbDeviceDialog::NoFlags, this);
             // in theory this is needed only for screensaver, not for LockIcon. But it doesn't harm
             connect(iDeviceDialog, SIGNAL(dataReceived(QVariantMap)), SLOT(handleMessageFromScreensaver(QVariantMap)));
+            connect(iDeviceDialog, SIGNAL(deviceDialogClosed()), SLOT(handleScreensaverClosed()));
             iDeviceDialogCreated = EDeviceDialogCreated;
             RDEBUG("new iDeviceDialogCreated", iDeviceDialogCreated);
             }