terminalsecurity/SCP/SCPClient/src/SCPQueryDialog.cpp
branchRCL_3
changeset 59 13d7c31c74e0
parent 42 490439ac0bd4
child 61 b183ec05bd8c
--- a/terminalsecurity/SCP/SCPClient/src/SCPQueryDialog.cpp	Thu Jul 15 19:36:11 2010 +0300
+++ b/terminalsecurity/SCP/SCPClient/src/SCPQueryDialog.cpp	Thu Aug 19 10:44:50 2010 +0300
@@ -33,6 +33,7 @@
 #include <e32property.h>
 #include <ctsydomainpskeys.h>
 #include "SCPCodePrivateCRKeys.h"
+#include <DevManInternalCRKeys.h>
 #include <featmgr.h>
 
 /*#ifdef _DEBUG
@@ -50,7 +51,7 @@
 #endif // _DEBUG*/
 
 const TInt KSCPSpecialDeleteEvent( 63529 );
-
+const TInt KLockedbyLawmo (30);
 // ================= MEMBER FUNCTIONS =======================
 //
 // ----------------------------------------------------------
@@ -77,6 +78,7 @@
 			  iPreviousCharacterWasInvalid( EFalse ),
 			  iPrioritySet( EFalse ),
 			  iPriorityDropped( EFalse ),
+			  iLockedByLawMo( EFalse ),
 			  iKeyUsed ( NULL ),
 			  iContextSensitive(aContextSensitive)
 	{
@@ -336,6 +338,28 @@
 	static_cast<CAknAppUi*>(iEikonEnv->EikAppUi())->KeySounds()->LockContext();
 
 	iFront = ETrue;
+    TInt currentLawmoState(0); 
+    Dprint( (_L("CSCPQueryDialog::lawmo cenrep") ));
+    CRepository* crep = CRepository::NewLC( KCRUidDeviceManagementInternalKeys );
+    TInt reterr = crep->Get( KLAWMOPhoneLock, currentLawmoState ); 
+    Dprint( (_L("CSCPQueryDialog::lawmo cenrep done") ));
+
+    if(reterr != KErrNone) 
+        {
+        Dprint(_L("[RSCPClient]-> ERROR: Unable to perform get on CenRep lawmo, lErr=%d"), reterr);
+        CleanupStack :: PopAndDestroy(crep);
+        return;
+        }
+    
+    if(currentLawmoState!=KLockedbyLawmo)
+        {
+        // Hide the OK key
+        Dprint( (_L("CSCPQueryDialog::lawmo state !=30, dim key") ));
+        iLockedByLawMo = ETrue;
+        ButtonGroupContainer().MakeCommandVisible( EAknSoftkeyOk, ETrue );
+        ButtonGroupContainer().DimCommand(EAknSoftkeyOk, ETrue);
+        }	
+	CleanupStack::PopAndDestroy();
 }
 //
 // ---------------------------------------------------------
@@ -630,6 +654,11 @@
                         ButtonGroupContainer().RemoveCommandFromStack(0,EAknSoftkeyOk);
                         }
                     TRAP ( err , ButtonGroupContainer().AddCommandToStackL(0,EAknSoftkeyOk,*cbaLabel) );
+	                if(iLockedByLawMo)
+	                {
+	                ButtonGroupContainer().MakeCommandVisible( EAknSoftkeyOk, ETrue );
+	                ButtonGroupContainer().DimCommand(EAknSoftkeyOk, ETrue);
+	                }
                     ButtonGroupContainer().DrawDeferred();
                     delete cbaLabel;
                     }
@@ -647,6 +676,13 @@
     else
         {
         return CAknTextQueryDialog::OfferKeyEventL(aKeyEvent,aType);
+        }  
+    
+    if(iLockedByLawMo)
+	    {
+	    Dprint( (_L("dim key hit 2") ));
+	    ButtonGroupContainer().MakeCommandVisible( EAknSoftkeyOk, ETrue );
+	    ButtonGroupContainer().DimCommand(EAknSoftkeyOk, ETrue);
         }    
 	}
 //
@@ -765,6 +801,11 @@
 							ButtonGroupContainer().RemoveCommandFromStack(0,EAknSoftkeyOk);
 						}
                 	TRAP ( err , ButtonGroupContainer().AddCommandToStackL(0, EAknSoftkeyOk, *cbaLabel) );
+                    if(iLockedByLawMo)
+                    {
+                    ButtonGroupContainer().MakeCommandVisible( EAknSoftkeyOk, ETrue );
+                    ButtonGroupContainer().DimCommand(EAknSoftkeyOk, ETrue);
+                    }
                 	ButtonGroupContainer().DrawDeferred();
                 	delete cbaLabel;
                 }
@@ -799,7 +840,7 @@
 }
 	
 void CSCPQueryDialog::TryCancelQueryL(TInt aReason) {
-    Dprint( (_L("CSCPQueryDialog::TryCancelQueryL()")) );
+    Dprint( (_L("CSCPQueryDialog::TryCancelQueryL() >>>")) );
     
     switch(aReason) {
         case CSCPLockObserver :: EEnded:
@@ -828,8 +869,14 @@
             Dprint(_L("[CSCPQueryDialog]-> TryExitL 4"));
             TryExitL(EAknSoftkeyCancel);
             break;
+        case ESecUiNone:
+            Dprint(_L("[CSCPQueryDialog]-> TryExitL 5"));
+            TryExitL(EAknSoftkeyOk);
+            break;
         default:
             break;
     }
+	
+    Dprint( (_L("CSCPQueryDialog::TryCancelQueryL() <<<")) );
 }
 // End of file