terminalsecurity/SCP/SCPClient/src/SCPQueryDialog.cpp
branchRCL_3
changeset 76 3cdbd92ee07b
parent 65 5cc2995847ea
equal deleted inserted replaced
69:a082c848c9a9 76:3cdbd92ee07b
    20 #include <eikseced.h>
    20 #include <eikseced.h>
    21 #include <aknsoundsystem.h>
    21 #include <aknsoundsystem.h>
    22 #include <StringLoader.h>
    22 #include <StringLoader.h>
    23 #include <aknappui.h> 
    23 #include <aknappui.h> 
    24 #include <avkon.rsg>
    24 #include <avkon.rsg>
    25 #include <secui.rsg>
    25 #include <SecUi.rsg>
    26 // Include the SecUi definitions
    26 // Include the SecUi definitions
    27 #include <secui.hrh>
    27 #include <secui.hrh>
    28 #include "SCPDebug.h"
    28 #include "SCPDebug.h"
    29 #include <scpnotifier.rsg>
    29 #include <SCPNotifier.rsg>
    30 // For Central Repository
    30 // For Central Repository
    31 #include <centralrepository.h>
    31 #include <centralrepository.h>
    32 #include <AknIncallBubbleNotify.h>
    32 #include <AknIncallBubbleNotify.h>
    33 #include <e32property.h>
    33 #include <e32property.h>
    34 #include <ctsydomainpskeys.h>
    34 #include <ctsydomainpskeys.h>
    35 #include "SCPCodePrivateCRKeys.h"
    35 #include "SCPCodePrivateCRKeys.h"
    36 #include <DevManInternalCRKeys.h>
       
    37 #include <featmgr.h>
    36 #include <featmgr.h>
    38 #include <aknglobalpopupprioritycontroller.h>
    37 #include <aknglobalpopupprioritycontroller.h>
    39 
    38 
    40 /*#ifdef _DEBUG
    39 /*#ifdef _DEBUG
    41 #define __SCP_DEBUG
    40 #define __SCP_DEBUG
    50 #else
    49 #else
    51 #define Dprint(a)
    50 #define Dprint(a)
    52 #endif // _DEBUG*/
    51 #endif // _DEBUG*/
    53 
    52 
    54 const TInt KSCPSpecialDeleteEvent( 63529 );
    53 const TInt KSCPSpecialDeleteEvent( 63529 );
    55 const TInt KLockedbyLawmo (30);
    54 
    56 // ================= MEMBER FUNCTIONS =======================
    55 // ================= MEMBER FUNCTIONS =======================
    57 //
    56 //
    58 // ----------------------------------------------------------
    57 // ----------------------------------------------------------
    59 // CSCPQueryDialog::CSCPQueryDialog()
    58 // CSCPQueryDialog::CSCPQueryDialog()
    60 // C++ constructor
    59 // C++ constructor
    77 			  iEMCallActivated( EFalse ),
    76 			  iEMCallActivated( EFalse ),
    78 			  iShowingEMNumber( EFalse ),
    77 			  iShowingEMNumber( EFalse ),
    79 			  iPreviousCharacterWasInvalid( EFalse ),
    78 			  iPreviousCharacterWasInvalid( EFalse ),
    80 			  iPrioritySet( EFalse ),
    79 			  iPrioritySet( EFalse ),
    81 			  iPriorityDropped( EFalse ),
    80 			  iPriorityDropped( EFalse ),
    82 			  iLockedByLawMo( EFalse ),
    81 			  iContextSensitive(aContextSensitive),
    83 			  iKeyUsed ( NULL ),
    82 			  iKeyUsed ( NULL )
    84 			  iContextSensitive(aContextSensitive)
       
    85 	{
    83 	{
    86         def_mode = 0;
    84         def_mode = 0;
    87         iAppKey = 0;
    85         iAppKey = 0;
    88         iMode = KSCPModeNormal;
    86         iMode = KSCPModeNormal;
    89 	}
    87 	}
   311                 }
   309                 }
   312             }
   310             }
   313         }
   311         }
   314 	        
   312 	        
   315         Dprint( (_L("CSCPQueryDialog::PreLayoutDynInitL(): Changing Window Priority") ));
   313         Dprint( (_L("CSCPQueryDialog::PreLayoutDynInitL(): Changing Window Priority") ));
   316         DrawableWindow()->SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront);
   314         DrawableWindow()->SetOrdinalPosition(0, ECoeWinPriorityNormal);
   317         ButtonGroupContainer().ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront);
       
   318     }
   315     }
   319     else {
   316     else {
   320         AknGlobalPopupPriorityController :: SetPopupPriorityL(*this, 0);
   317         AknGlobalPopupPriorityController :: SetPopupPriorityL(*this, 0);
   321         DrawableWindow()->SetOrdinalPosition(0, ECoeWinPriorityNormal);
   318         DrawableWindow()->SetOrdinalPosition(0, ECoeWinPriorityNormal);
   322         ButtonGroupContainer().ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition(0, ECoeWinPriorityNormal);
       
   323     }
   319     }
   324 
   320 
   325     // this must be done always to keep the reference count in synch  
   321     // this must be done always to keep the reference count in synch  
   326     // this does not have any effect if autoforwarding has not been set true (normal application.)
   322     // this does not have any effect if autoforwarding has not been set true (normal application.)
   327     iEikonEnv->BringForwards(ETrue, ECoeWinPriorityAlwaysAtFront+1);
   323     iEikonEnv->BringForwards(ETrue, ECoeWinPriorityAlwaysAtFront+1);
   328 
   324 	
   329     Dprint( (_L("CSCPQueryDialog::PreLayoutDynInitL(): Key sounds") ));
   325 	Dprint( (_L("CSCPQueryDialog::PreLayoutDynInitL(): Key sounds") ));
   330     // Key sounds
   326 	// Key sounds
   331     static_cast<CAknAppUi*>(iEikonEnv->EikAppUi())->KeySounds()->PushContextL(R_AVKON_DEFAULT_SKEY_LIST);
   327     static_cast<CAknAppUi*>(iEikonEnv->EikAppUi())->KeySounds()->PushContextL(R_AVKON_DEFAULT_SKEY_LIST);	    	                                                             
   332     static_cast<CAknAppUi*>(iEikonEnv->EikAppUi())->KeySounds()->BringToForeground();
   328 	static_cast<CAknAppUi*>(iEikonEnv->EikAppUi())->KeySounds()->BringToForeground();
   333     static_cast<CAknAppUi*>(iEikonEnv->EikAppUi())->KeySounds()->LockContext();
   329 	static_cast<CAknAppUi*>(iEikonEnv->EikAppUi())->KeySounds()->LockContext();
   334     iFront = ETrue;
   330 	iFront = ETrue;
   335 	
       
   336     TInt currentLawmoState(0); 
       
   337     Dprint( (_L("CSCPQueryDialog::lawmo cenrep") ));
       
   338     CRepository* crep = CRepository::NewLC( KCRUidDeviceManagementInternalKeys );
       
   339     TInt reterr = crep->Get( KLAWMOPhoneLock, currentLawmoState ); 
       
   340     Dprint( (_L("CSCPQueryDialog::lawmo cenrep done") ));
       
   341 
       
   342     if(reterr != KErrNone) 
       
   343         {
       
   344         Dprint(_L("[RSCPClient]-> ERROR: Unable to perform get on CenRep lawmo, lErr=%d"), reterr);
       
   345         CleanupStack :: PopAndDestroy(crep);
       
   346         return;
       
   347         }
       
   348     
       
   349     if(currentLawmoState!=KLockedbyLawmo)
       
   350         {
       
   351         // Hide the OK key
       
   352         Dprint( (_L("CSCPQueryDialog::lawmo state !=30, dim key") ));
       
   353         iLockedByLawMo = ETrue;
       
   354         ButtonGroupContainer().MakeCommandVisible( EAknSoftkeyOk, ETrue );
       
   355         ButtonGroupContainer().DimCommand(EAknSoftkeyOk, ETrue);
       
   356         }	
       
   357 	CleanupStack::PopAndDestroy();
       
   358 }
   331 }
   359 //
   332 //
   360 // ---------------------------------------------------------
   333 // ---------------------------------------------------------
   361 // CSCPQueryDialog::OfferKeyEventL
   334 // CSCPQueryDialog::OfferKeyEventL
   362 // called by framework when any key is pressed
   335 // called by framework when any key is pressed
   647                         else
   620                         else
   648                         {
   621                         {
   649                         ButtonGroupContainer().RemoveCommandFromStack(0,EAknSoftkeyOk);
   622                         ButtonGroupContainer().RemoveCommandFromStack(0,EAknSoftkeyOk);
   650                         }
   623                         }
   651                     TRAP ( err , ButtonGroupContainer().AddCommandToStackL(0,EAknSoftkeyOk,*cbaLabel) );
   624                     TRAP ( err , ButtonGroupContainer().AddCommandToStackL(0,EAknSoftkeyOk,*cbaLabel) );
   652 	                if(iLockedByLawMo)
       
   653 	                {
       
   654 	                ButtonGroupContainer().MakeCommandVisible( EAknSoftkeyOk, ETrue );
       
   655 	                ButtonGroupContainer().DimCommand(EAknSoftkeyOk, ETrue);
       
   656 	                }
       
   657                     ButtonGroupContainer().DrawDeferred();
   625                     ButtonGroupContainer().DrawDeferred();
   658                     delete cbaLabel;
   626                     delete cbaLabel;
   659                     }
   627                     }
   660                 }
   628                 }
   661             }
   629             }
   669         return ret;
   637         return ret;
   670         }         
   638         }         
   671     else
   639     else
   672         {
   640         {
   673         return CAknTextQueryDialog::OfferKeyEventL(aKeyEvent,aType);
   641         return CAknTextQueryDialog::OfferKeyEventL(aKeyEvent,aType);
   674         }  
       
   675     
       
   676     if(iLockedByLawMo)
       
   677 	    {
       
   678 	    Dprint( (_L("dim key hit 2") ));
       
   679 	    ButtonGroupContainer().MakeCommandVisible( EAknSoftkeyOk, ETrue );
       
   680 	    ButtonGroupContainer().DimCommand(EAknSoftkeyOk, ETrue);
       
   681         }    
   642         }    
   682 	}
   643 	}
   683 //
   644 //
   684 // ---------------------------------------------------------
   645 // ---------------------------------------------------------
   685 // CSCPQueryDialog::NeedToDismissQueryL()
   646 // CSCPQueryDialog::NeedToDismissQueryL()
   794 						else
   755 						else
   795 						{
   756 						{
   796 							ButtonGroupContainer().RemoveCommandFromStack(0,EAknSoftkeyOk);
   757 							ButtonGroupContainer().RemoveCommandFromStack(0,EAknSoftkeyOk);
   797 						}
   758 						}
   798                 	TRAP ( err , ButtonGroupContainer().AddCommandToStackL(0, EAknSoftkeyOk, *cbaLabel) );
   759                 	TRAP ( err , ButtonGroupContainer().AddCommandToStackL(0, EAknSoftkeyOk, *cbaLabel) );
   799                     if(iLockedByLawMo)
       
   800                     {
       
   801                     ButtonGroupContainer().MakeCommandVisible( EAknSoftkeyOk, ETrue );
       
   802                     ButtonGroupContainer().DimCommand(EAknSoftkeyOk, ETrue);
       
   803                     }
       
   804                 	ButtonGroupContainer().DrawDeferred();
   760                 	ButtonGroupContainer().DrawDeferred();
   805                 	delete cbaLabel;
   761                 	delete cbaLabel;
   806                 }
   762                 }
   807             }
   763             }
   808         }
   764         }
   863             break;
   819             break;
   864         case ESecUiDeviceLocked:
   820         case ESecUiDeviceLocked:
   865             Dprint(_L("[CSCPQueryDialog]-> TryExitL 4"));
   821             Dprint(_L("[CSCPQueryDialog]-> TryExitL 4"));
   866             TryExitL(EAknSoftkeyCancel);
   822             TryExitL(EAknSoftkeyCancel);
   867             break;
   823             break;
   868         case ESecUiNone:
       
   869             Dprint(_L("[CSCPQueryDialog]-> TryExitL 5"));
       
   870             TryExitL(EAknSoftkeyOk);
       
   871             break;
       
   872         default:
   824         default:
   873             break;
   825             break;
   874     }
   826     }
   875 	
   827 	
   876     Dprint( (_L("CSCPQueryDialog::TryCancelQueryL() <<<")) );
   828     Dprint( (_L("CSCPQueryDialog::TryCancelQueryL() <<<")) );