Revision: 201015 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 27 Apr 2010 17:31:13 +0300
branchRCL_3
changeset 15 007508d6e57b
parent 14 504e41245867
child 16 915074efc433
Revision: 201015 Kit: 201017
fotaapplication/fotaserver/FotaServer/src/fotaSrvSession.cpp
omaprovisioning/pnputil/tsrc/ModuleTest/group/TestPnpUtil.mmp
syncmlfw/dm/settings/conf/factorydmprofiles.confml
syncmlfw/ds/dsutils/dbcaps/src/NSmldbcapsSerializer.cpp
terminalsecurity/SCP/SCPClient/inc/SCPLockObserver.h
terminalsecurity/SCP/SCPClient/inc/SCPQueryDialog.h
terminalsecurity/SCP/SCPClient/src/SCPClient.cpp
terminalsecurity/SCP/SCPClient/src/SCPLockObserver.cpp
terminalsecurity/SCP/SCPClient/src/SCPQueryDialog.cpp
--- a/fotaapplication/fotaserver/FotaServer/src/fotaSrvSession.cpp	Wed Apr 14 16:50:34 2010 +0300
+++ b/fotaapplication/fotaserver/FotaServer/src/fotaSrvSession.cpp	Tue Apr 27 17:31:13 2010 +0300
@@ -283,7 +283,7 @@
 
 	case EFotaTryResumeDownload:
 		{
-		if (client == EOMADMAppUi )
+		if ( (client == EOMADMAppUi) || (client == ESoftwareChecker) )
 			{
 			FotaServer()->TryResumeDownloadL(ETrue); // user initiated
 			aMessage.Complete( KErrNone );				
@@ -339,7 +339,7 @@
 		state = FotaServer()->GetStateL(pkgid);
 		//Protecting state 25. If any client other than DM UI queries for state, 25 should not be sent and 
 		//20 will be sent instead.
-		if (client != EOMADMAppUi && state.iState == RFotaEngineSession::EDownloadProgressingWithResume)
+		if ( (client != EOMADMAppUi && client != ESoftwareChecker) && state.iState == RFotaEngineSession::EDownloadProgressingWithResume)
 			state.iState = RFotaEngineSession::EDownloadProgressing;
 		FLOG(_L( "CFotaSrvSession::ServiceL GETSTATE << %d" )
 				,state.iState);
--- a/omaprovisioning/pnputil/tsrc/ModuleTest/group/TestPnpUtil.mmp	Wed Apr 14 16:50:34 2010 +0300
+++ b/omaprovisioning/pnputil/tsrc/ModuleTest/group/TestPnpUtil.mmp	Tue Apr 27 17:31:13 2010 +0300
@@ -18,7 +18,7 @@
 
 #if defined(__S60_)
         // To get the OSEXT_LAYER_SYSTEMINCLUDE-definition
-        #include <domain/osextensions/platform_paths.hrh>
+        #include <platform_paths.hrh>
 #endif
 #include <data_caging_paths.hrh>
 
Binary file syncmlfw/dm/settings/conf/factorydmprofiles.confml has changed
--- a/syncmlfw/ds/dsutils/dbcaps/src/NSmldbcapsSerializer.cpp	Wed Apr 14 16:50:34 2010 +0300
+++ b/syncmlfw/ds/dsutils/dbcaps/src/NSmldbcapsSerializer.cpp	Tue Apr 27 17:31:13 2010 +0300
@@ -407,31 +407,34 @@
 		{
 		synctype.SetNotSupported( ESmlRefreshFromClient );
 		}
-	
-	if ( dds->dsmem )
-		{
-		//max size
-		if ( dds->dsmem->maxmem )
-			{
-			TLex8 lex( dds->dsmem->maxmem->Data() );
-			User::LeaveIfError( lex.Val( self->iMaxSize, EDecimal ) );
-			self->iFlags |= KSmlDataStore_HasMaxSize;
-			}
-		
-		//max items
-		if ( dds->dsmem->maxid )
-			{
-			TLex8 lex( dds->dsmem->maxid->Data() );
-			User::LeaveIfError( lex.Val( self->iMaxItems, EDecimal ) );
-			self->iFlags |= KSmlDataStore_HasMaxItems;
-			}
-		}
-	
-	//options
-	if ( dds->supportHierarchicalSync )
-		{
-		self->iFlags |= KSmlDataStore_Hierarchical;
-		}
+	if (dds)
+        {
+        if ( dds->dsmem )
+            {
+            //max size
+            if ( dds->dsmem->maxmem )
+                {
+                TLex8 lex( dds->dsmem->maxmem->Data() );
+                User::LeaveIfError( lex.Val( self->iMaxSize, EDecimal ) );
+                self->iFlags |= KSmlDataStore_HasMaxSize;
+                }
+            
+            //max items
+            if ( dds->dsmem->maxid )
+                {
+                TLex8 lex( dds->dsmem->maxid->Data() );
+                User::LeaveIfError( lex.Val( self->iMaxItems, EDecimal ) );
+                self->iFlags |= KSmlDataStore_HasMaxItems;
+                }
+            }
+        
+        
+        //options
+        if ( dds->supportHierarchicalSync )
+            {
+            self->iFlags |= KSmlDataStore_Hierarchical;
+            }
+        }
 	
 	//filter caps
 	const sml_devinf_filtercaplist_s* filterList = aDbCaps.FilterCapsList();
@@ -453,90 +456,93 @@
 	// First search all mime types that server supports at receiving
 	// RX-pref
 	CSmlMimeFormat* tempFormatRX = CSmlMimeFormat::NewLC();
-	const TPtrC8& ctTypeRX = TNSmlDbCapsSerializer::SafePtr( dds->rxpref->cttype );
-	const TPtrC8& verCtRX = TNSmlDbCapsSerializer::SafePtr( dds->rxpref->verct );
-	if ( ctTypeRX.Compare( KNullDesC8 ) != 0 && verCtRX.Compare( KNullDesC8 ) != 0 )
-		{
-		RStringF mimeFormatRX = aStringPool.OpenFStringL( ctTypeRX );
-		RStringF mimeVersionRX = aStringPool.OpenFStringL( verCtRX );
-		tempFormatRX->SetMimeTypeL( mimeFormatRX );
-		tempFormatRX->SetMimeVersionL( mimeVersionRX );
-		mimeFormatArray.AppendL( tempFormatRX );
-		CleanupStack::Pop(); // tempFormatRX
-		}
-	else
-		{
-		CleanupStack::PopAndDestroy(); // tempFormatRX
-		}
-	// RXs
-	if ( dds )
-		{
-		SmlDevInfXmitListPtr_t rx = dds->rx;
-		for ( ; rx ; rx = rx->next )
-			{
-			CSmlMimeFormat* tempFormat = CSmlMimeFormat::NewLC();
-			const TPtrC8& ctType = TNSmlDbCapsSerializer::SafePtr( rx->data->cttype );
-			const TPtrC8& verCt = TNSmlDbCapsSerializer::SafePtr( rx->data->verct );
-			if ( ctType.Compare( KNullDesC8 ) != 0 && verCt.Compare( KNullDesC8 ) != 0 )
-				{
-				RStringF mimeFormat = aStringPool.OpenFStringL( ctType );
-				RStringF mimeVersion = aStringPool.OpenFStringL( verCt );
-				tempFormat->SetMimeTypeL( mimeFormat );
-				tempFormat->SetMimeVersionL( mimeVersion );
-				mimeFormatArray.AppendL( tempFormat );
-				CleanupStack::Pop(); // tempFormat
-				}
-			else
-				{
-				CleanupStack::PopAndDestroy(); // tempFormat
-				}
-			}
-		}
-	
-	const sml_devinf_ctcaplist_s*  ctCapList = dds->ctcap;
-	if ( ctCapList == 0 )
-		{
-		ctCapList = aDbCaps.CtCaps();
-		}
-	// Then add CTCaps to correct mime types
-	if ( ctCapList != 0 )
-	    {    
-        for (; ctCapList; ctCapList = ctCapList->next )
-    		{
-    		const SmlDevInfCtCapPtr_t ctCap = ctCapList->data;
-    		if ( ctCap->cttype->Data() == KNSmlFolderType )
-    			{
-    			SmlDevInfPropertyListPtr_t dipl = ctCap->property;
-    			for ( ; dipl; dipl = dipl->next )
-    				{
-    				const SmlDevInfPropertyPtr_t dip = dipl->data;
-    				if ( dip )
-    					{
-    					CSmlDataProperty *temppoint = CNSmlDataPropertyFromDbCaps::NewLC( aStringPool, dip );
-    					self->iFolderProperties.AppendL( temppoint );
-    					CleanupStack::Pop(); //  temppoint
-    					}
-    				}
-    			}
-    		else
-    			{
-    			for ( TInt j(0); j < mimeFormatArray.Count(); j++ )
-    			    {
-    			    if ( mimeFormatArray[j]->MimeType().DesC().Compare( ctCap->cttype->Data() ) == 0 )
-    			        {
-    			        // Mime version is only in rx-pref or in rx so it must be copied to new mime format
-    			        CSmlMimeFormat* temppoint = CNSmlMimeFormatFromDbCaps::NewLC( aStringPool, *ctCap );
-    			        RStringF newMimeVersion = aStringPool.OpenFStringL( mimeFormatArray[j]->MimeVersion().DesC() );
-    			        temppoint->SetMimeVersionL( newMimeVersion );
-    			        delete mimeFormatArray[j];
-    			        mimeFormatArray[j] = NULL;
-    			        mimeFormatArray[j] = temppoint;
-    			        CleanupStack::Pop(); //  temppoint
-    			        }
-    			    }
-    			}
-    		}
-	    }
+    if( dds )
+        {
+        const TPtrC8& ctTypeRX = TNSmlDbCapsSerializer::SafePtr( dds->rxpref->cttype );
+        const TPtrC8& verCtRX = TNSmlDbCapsSerializer::SafePtr( dds->rxpref->verct );
+                    
+        if ( ctTypeRX.Compare( KNullDesC8 ) != 0 && verCtRX.Compare( KNullDesC8 ) != 0 )
+            {
+            RStringF mimeFormatRX = aStringPool.OpenFStringL( ctTypeRX );
+            RStringF mimeVersionRX = aStringPool.OpenFStringL( verCtRX );
+            tempFormatRX->SetMimeTypeL( mimeFormatRX );
+            tempFormatRX->SetMimeVersionL( mimeVersionRX );
+            mimeFormatArray.AppendL( tempFormatRX );
+            CleanupStack::Pop(); // tempFormatRX
+            }
+        else
+            {
+            CleanupStack::PopAndDestroy(); // tempFormatRX
+            }
+        // RXs
+        
+            SmlDevInfXmitListPtr_t rx = dds->rx;
+            for ( ; rx ; rx = rx->next )
+                {
+                CSmlMimeFormat* tempFormat = CSmlMimeFormat::NewLC();
+                const TPtrC8& ctType = TNSmlDbCapsSerializer::SafePtr( rx->data->cttype );
+                const TPtrC8& verCt = TNSmlDbCapsSerializer::SafePtr( rx->data->verct );
+                if ( ctType.Compare( KNullDesC8 ) != 0 && verCt.Compare( KNullDesC8 ) != 0 )
+                    {
+                    RStringF mimeFormat = aStringPool.OpenFStringL( ctType );
+                    RStringF mimeVersion = aStringPool.OpenFStringL( verCt );
+                    tempFormat->SetMimeTypeL( mimeFormat );
+                    tempFormat->SetMimeVersionL( mimeVersion );
+                    mimeFormatArray.AppendL( tempFormat );
+                    CleanupStack::Pop(); // tempFormat
+                    }
+                else
+                    {
+                    CleanupStack::PopAndDestroy(); // tempFormat
+                    }
+                }
+            
+        
+        const sml_devinf_ctcaplist_s*  ctCapList = dds->ctcap;
+        if ( ctCapList == 0 )
+            {
+            ctCapList = aDbCaps.CtCaps();
+            }
+        // Then add CTCaps to correct mime types
+        if ( ctCapList != 0 )
+            {    
+            for (; ctCapList; ctCapList = ctCapList->next )
+                {
+                const SmlDevInfCtCapPtr_t ctCap = ctCapList->data;
+                if ( ctCap->cttype->Data() == KNSmlFolderType )
+                    {
+                    SmlDevInfPropertyListPtr_t dipl = ctCap->property;
+                    for ( ; dipl; dipl = dipl->next )
+                        {
+                        const SmlDevInfPropertyPtr_t dip = dipl->data;
+                        if ( dip )
+                            {
+                            CSmlDataProperty *temppoint = CNSmlDataPropertyFromDbCaps::NewLC( aStringPool, dip );
+                            self->iFolderProperties.AppendL( temppoint );
+                            CleanupStack::Pop(); //  temppoint
+                            }
+                        }
+                    }
+                else
+                    {
+                    for ( TInt j(0); j < mimeFormatArray.Count(); j++ )
+                        {
+                        if ( mimeFormatArray[j]->MimeType().DesC().Compare( ctCap->cttype->Data() ) == 0 )
+                            {
+                            // Mime version is only in rx-pref or in rx so it must be copied to new mime format
+                            CSmlMimeFormat* temppoint = CNSmlMimeFormatFromDbCaps::NewLC( aStringPool, *ctCap );
+                            RStringF newMimeVersion = aStringPool.OpenFStringL( mimeFormatArray[j]->MimeVersion().DesC() );
+                            temppoint->SetMimeVersionL( newMimeVersion );
+                            delete mimeFormatArray[j];
+                            mimeFormatArray[j] = NULL;
+                            mimeFormatArray[j] = temppoint;
+                            CleanupStack::Pop(); //  temppoint
+                            }
+                        }
+                    }
+                }
+            }
+        }
 	self->SetMimeFormatsL( mimeFormatArray );
 	mimeFormatArray.ResetAndDestroy();
 	CleanupStack::PopAndDestroy(); // mimeFormatArray
--- a/terminalsecurity/SCP/SCPClient/inc/SCPLockObserver.h	Wed Apr 14 16:50:34 2010 +0300
+++ b/terminalsecurity/SCP/SCPClient/inc/SCPLockObserver.h	Tue Apr 27 17:31:13 2010 +0300
@@ -27,6 +27,11 @@
 NONSHARABLE_CLASS(CSCPLockObserver): public CActive
     {
     public:
+        enum TCurrCallStatus {
+            EInProgress = 34221,
+            EEnded
+        };
+        
 		/**
         * Creates instance of the CLockObserver class.
         *
@@ -77,8 +82,10 @@
     private: // data
         CSCPQueryDialog*      iDialog; //not owned!
         RProperty            iProperty;
-        TBool				 iSubscribedToEvent;
         TInt                 iType; //Type of the observer
+        TBool                iInformCallEnding;
+        TInt                 iSubscribedToEvent;
+        TInt                 iPrevCallState;
     };
 
 #endif 
--- a/terminalsecurity/SCP/SCPClient/inc/SCPQueryDialog.h	Wed Apr 14 16:50:34 2010 +0300
+++ b/terminalsecurity/SCP/SCPClient/inc/SCPQueryDialog.h	Tue Apr 27 17:31:13 2010 +0300
@@ -34,6 +34,13 @@
 */
 class CSCPQueryDialog : public CAknTextQueryDialog, public MAknEcsObserver
 	{
+    public:
+        enum TKeypadContext {
+            ENumeric = 0,
+            EAlphaNumeric,
+            EContextSensitive
+        };
+    
 	public: // Construction and destruction
 	
 		/**
@@ -47,12 +54,14 @@
                          RSCPClient::TSCPButtonConfig aButtonsShown, 
                          TInt aMinLength,
                          TInt aMaxLength,
-                         TBool aECSSupport
+                         TBool aECSSupport,
+                         TKeypadContext aContext = EContextSensitive
                          );
 		/**
         * Destructor.
         */
 		~CSCPQueryDialog();
+		
 	public:
 		/**
 		* Allows dismissing of code queries. Only mandatory requirement is that PIN
@@ -91,6 +100,8 @@
 		
 		void HandleEcsEvent(CAknEcsDetector* aDetector, CAknEcsDetector::TState aUpdatedState);
 		void ShowWarningNoteL();
+		
+		void PostLayoutDynInitL();
 
 	private:
 		
@@ -120,6 +131,7 @@
         TBool                           iPrioritySet;
         TBool                           iPriorityDropped;
         TBool							isCallSoftkeyAdded;
+        TKeypadContext                  iContextSensitive;
         /** An integer variable to define the input mode of the lock code query */
         TInt def_mode;
         TInt iKeyUsed;
--- a/terminalsecurity/SCP/SCPClient/src/SCPClient.cpp	Wed Apr 14 16:50:34 2010 +0300
+++ b/terminalsecurity/SCP/SCPClient/src/SCPClient.cpp	Tue Apr 27 17:31:13 2010 +0300
@@ -186,10 +186,13 @@
                 TInt aMaxLen,
                 TUint aResId = 0,
                 TDesC* aPrompt = NULL,
-                TBool aECSSupport = EFalse         
+                TBool aECSSupport = EFalse,
+                CSCPQueryDialog :: TKeypadContext aContext = CSCPQueryDialog :: EContextSensitive
               )
     {
     Dprint(_L("[RSCPClient]-> RunDialogL() >>> "));
+    Dprint(_L("[RSCPClient]-> RunDialogL() aContext = %d "), aContext);
+    
     FeatureManager::InitializeLibL();
     if(!FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements))
 	{
@@ -207,7 +210,8 @@
         aButtonsShown,
         aMinLen,
         aMaxLen,
-        aECSSupport
+        aECSSupport,
+        aContext
         ); 
         
     CleanupStack::PushL( dialog );            
@@ -820,6 +824,7 @@
                                       HBufC** aNewCodePptr/* = NULL*/)
     {
     
+    Dprint(_L("[RSCPClient]-> GetNewCodeAndChange() >>>"));
     
     if(!isFlagEnabled)
 	{
@@ -893,19 +898,25 @@
                                  maxLen,
                                  R_SECUI_TEXT_ENTER_NEW_SEC_CODE,
                                  NULL,
-                                 ecSupport ) );
+                                 ecSupport,
+                                 CSCPQueryDialog :: EAlphaNumeric) );
     
         if ( ( ret ) && ( ret != ESecUiEmergencyCall ) && ( err == KErrNone ) )
-            {        
+            {
             verifyCodeBuffer.Zero();
+            TChar ch = static_cast<TChar>(newCodeBuffer[0]);
             
+            CSCPQueryDialog :: TKeypadContext lKPContext = 
+                    (ch.IsDigit() ? CSCPQueryDialog :: ENumeric : CSCPQueryDialog :: EAlphaNumeric);
+                    
             TRAP( err, ret = RunDialogL( verifyCodeBuffer, 
                                  bConfig, 
                                  minLen,
                                  maxLen,
                                  R_SECUI_TEXT_VERIFY_NEW_SEC_CODE,
                                  NULL,
-                                 ecSupport ) );                             
+                                 ecSupport,
+                                 lKPContext));                             
             }
 
         if ( ( !ret ) || ( err != KErrNone ) || ( ret == ESecUiEmergencyCall ) )
@@ -995,6 +1006,7 @@
     delete verifyCodeHBuf;
     delete newCodeHBuf;
         
+    Dprint(_L("[RSCPClient]-> GetNewCodeAndChange() <<<"));
     return err;        
     }
        
--- a/terminalsecurity/SCP/SCPClient/src/SCPLockObserver.cpp	Wed Apr 14 16:50:34 2010 +0300
+++ b/terminalsecurity/SCP/SCPClient/src/SCPLockObserver.cpp	Tue Apr 27 17:31:13 2010 +0300
@@ -24,7 +24,6 @@
 #include "SCPQueryDialog.h"
 #include "SCPDebug.h"
 
-
 // ================= MEMBER FUNCTIONS =======================
 //
 // ----------------------------------------------------------
@@ -55,9 +54,9 @@
 CSCPLockObserver::~CSCPLockObserver()
     {
     
-    Dprint(_L("CSCPLockObserver::~CSCPLockObserver"));
-    
+    Dprint(_L("CSCPLockObserver::~CSCPLockObserver >>>"));
     Cancel();
+    Dprint(_L("CSCPLockObserver::~CSCPLockObserver <<<"));
     }
 //
 // ----------------------------------------------------------
@@ -80,39 +79,27 @@
         
     iStatus = KRequestPending;
     
-    switch(iType)
-        {
-            case ESecUiDeviceLockObserver:
-                
-                Dprint(_L("CSCPLockObserver::Start() Device Lock Observer"));
-                
-                iProperty.Attach(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus); 
-                break;
-#if 0          
-            case ESecUiRequestStateObserver:
-                    
-                    Dprint(_L("CSCPLockObserver::Start() Request State Observer"));
-                    
-                    iProperty.Attach(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel); 
-                break;
-#endif
-            case ESecUiCallStateObserver:
-                
-                Dprint(_L("CSCPLockObserver::Start() Call State Observer"));
-                
-                iProperty.Attach(KPSUidCtsyCallInformation, KCTsyCallState); 
-                break;
+    switch(iType) {
+        case ESecUiDeviceLockObserver:
+            
+            Dprint(_L("CSCPLockObserver::Start() Device Lock Observer"));
+            
+            iProperty.Attach(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus); 
+            break;
+        case ESecUiCallStateObserver: {
+            Dprint(_L("CSCPLockObserver::Start() Call State Observer"));                
+            iProperty.Attach(KPSUidCtsyCallInformation, KCTsyCallState);
+        }
+        break;
 
-            default:
-                break;
-        }
+        default:
+            break;
+    }
     
     iProperty.Subscribe(iStatus);
+    iSubscribedToEvent = ETrue;
     SetActive();
-    iSubscribedToEvent = ETrue;
-    
-    Dprint(_L("CSCPLockObserver::Start() END"));
-    
+    Dprint(_L("CSCPLockObserver::Start() END"));    
     return KErrNone;
     }
 //
@@ -121,9 +108,30 @@
 // C++ constructor
 // ----------------------------------------------------------
 // 
-CSCPLockObserver::CSCPLockObserver(CSCPQueryDialog* aDialog, TInt aType) : CActive(0), iDialog(aDialog), iSubscribedToEvent(EFalse), iType(aType)
-	{                            
-    }
+CSCPLockObserver :: CSCPLockObserver(CSCPQueryDialog* aDialog, TInt aType) : CActive(0),
+        iDialog(aDialog), iType(aType), 
+        iInformCallEnding(EFalse), iSubscribedToEvent(EFalse) {
+    
+    TInt lStatus;
+    RProperty :: Get(KPSUidCtsyCallInformation, KCTsyCallState, lStatus);
+    
+    switch(lStatus) {
+        default:
+        case EPSCTsyCallStateUninitialized:
+        case EPSCTsyCallStateNone:
+            iInformCallEnding = EFalse;
+            break;
+        case EPSCTsyCallStateDisconnecting:
+        case EPSCTsyCallStateAlerting:
+        case EPSCTsyCallStateHold:
+        case EPSCTsyCallStateRinging:
+        case EPSCTsyCallStateDialling:
+        case EPSCTsyCallStateAnswering:
+        case EPSCTsyCallStateConnected:
+            iInformCallEnding = ETrue;
+            break;
+    };
+}
 //
 // ----------------------------------------------------------
 // CSCPLockObserver::ConstructL()
@@ -149,64 +157,57 @@
 // Called by Active Scheduler
 // ----------------------------------------------------------
 // 
-void CSCPLockObserver::RunL()
-	{
-	
-    Dprint(_L("CSCPLockObserver::RunL() BEGIN"));
-    
+void CSCPLockObserver :: RunL() {
+    Dprint(_L("[CSCPLockObserver]-> RunL() >>>"));
     
-    switch(iType)
-        {
-            case ESecUiDeviceLockObserver:
-                 TInt autolockState;
-                 iProperty.Get( autolockState );
-                 if (autolockState > EAutolockOff)
-                    {
-                    
-                    Dprint(_L("CSCPLockObserver::RunL() TryCancelQueryL Device Lock"));
-                    
-                	iDialog->TryCancelQueryL(ESecUiDeviceLocked);
-                	iSubscribedToEvent = EFalse;
+    switch(iType) {
+        case ESecUiDeviceLockObserver:
+        TInt autolockState;
+        iProperty.Get(autolockState);
+        
+        if(autolockState > EAutolockOff) {            
+            Dprint(_L("CSCPLockObserver::RunL() TryCancelQueryL Device Lock"));
+            iDialog->TryCancelQueryL(ESecUiDeviceLocked);
+            iSubscribedToEvent = EFalse;
+        }
+        break;
+        case ESecUiCallStateObserver: {
+            TInt callState;
+            iProperty.Get(callState);
+            Dprint( (_L("CSCPLockObserver::RunL() callState before Start() : %d"), callState ));
+            Start();
+            
+            switch(callState) {
+                default:
+                    break;
+                case EPSCTsyCallStateNone:
+                    if(iInformCallEnding) {
+                        Dprint( (_L("CSCPLockObserver::RunL() Branched to EPSCTsyCallStateNone")));
+                        iDialog->TryCancelQueryL(EEnded);                    
+                        iInformCallEnding = EFalse;
                     }
+                    break;
+                case EPSCTsyCallStateAlerting:
+                case EPSCTsyCallStateHold:
+                case EPSCTsyCallStateRinging:
+                case EPSCTsyCallStateDialling:
+                case EPSCTsyCallStateAnswering:
+                case EPSCTsyCallStateConnected: {
+                        Dprint(_L("CSCPLockObserver::RunL() TryCancelQueryL Active Call"));                
+                        TRAPD(lErr, iDialog->TryCancelQueryL(EInProgress));
+                        Dprint( (_L("CSCPLockObserver::RunL() lErr : %d"), lErr ));                        
+                        iInformCallEnding = ETrue;
+                }
                 break;
-#if 0         
-            case ESecUiRequestStateObserver:
-                 TInt requestState;
-                 iProperty.Get( requestState );
-                 if(requestState == ESecurityUIsQueryRequestCanceled)
-                    {
-                     
-                    Dprint(_L("CSCPLockObserver::RunL() TryCancelQueryL Req Canceled"));
-                    
-                	iDialog->TryCancelQueryL(EEikBidCancel);
-                	iSubscribedToEvent = EFalse;   
-                    }
-                break;
-#endif
-            case ESecUiCallStateObserver:
-                TInt callState;
-                iProperty.Get( callState );
-				 
-				 Dprint( (_L("CSCPLockObserver::RunL() callState : %d"),callState ));
-                if(callState == EPSCTsyCallStateDisconnecting)
-                    {
-                     
-                    Dprint(_L("CSCPLockObserver::RunL() TryCancelQueryL Active Call"));
-                    
-                	iDialog->TryCancelQueryL(EPSCTsyCallStateDisconnecting);
-                	iSubscribedToEvent = EFalse;   
-                    }
-                break;
-
-            default:
-                break;
+            };
         }
-
-   
-	
-    Dprint(_L("CSCPLockObserver::RunL() END"));
+        break;
+        default:
+            break;
+    }
     
-	}
+    Dprint(_L("[CSCPLockObserver]-> RunL() <<<"));    
+}
 //
 // ----------------------------------------------------------
 // CSCPLockObserver::DoCancel()
@@ -219,7 +220,8 @@
     Dprint(_L("CSCPLockObserver::DoCancel() BEGIN"));
     
     if(iSubscribedToEvent)
-    	iProperty.Cancel();
+        iProperty.Cancel();
+    
     iStatus = KErrNone;
     
     Dprint(_L("CSCPLockObserver::DoCancel() END"));
--- a/terminalsecurity/SCP/SCPClient/src/SCPQueryDialog.cpp	Wed Apr 14 16:50:34 2010 +0300
+++ b/terminalsecurity/SCP/SCPClient/src/SCPQueryDialog.cpp	Tue Apr 27 17:31:13 2010 +0300
@@ -62,7 +62,8 @@
                                     RSCPClient::TSCPButtonConfig aButtonsShown, 
                                     TInt aMinLength,
                                     TInt aMaxLength,
-                                    TBool aECSSupport
+                                    TBool aECSSupport,
+                                    TKeypadContext aContextSensitive /*= EContextSensitive*/
                                     )
             : CAknTextQueryDialog(aDataText, ENoTone),
 			  iMinLength(aMinLength),
@@ -76,8 +77,9 @@
 			  iPreviousCharacterWasInvalid( EFalse ),
 			  iPrioritySet( EFalse ),
 			  iPriorityDropped( EFalse ),
-			  iKeyUsed ( NULL )
-	{		 
+			  iKeyUsed ( NULL ),
+			  iContextSensitive(aContextSensitive)
+	{
         def_mode = 0;
         iAppKey = 0;
         iMode = KSCPModeNormal;
@@ -93,12 +95,12 @@
 	{
 	Dprint( (_L("CSCPQueryDialog::~CSCPQueryDialog()")) );
 	
-	    if ( AknLayoutUtils::PenEnabled() )
-        {
-        TRAP_IGNORE ( SetIncallBubbleAllowedInUsualL( ETrue ) );
-        }
-
-	
+   if (iDeviceLockStatusObserver)
+        delete iDeviceLockStatusObserver;
+    
+    if (iCallStatusObserver)
+        delete iCallStatusObserver;
+	    
 	if (iFront)
 		{
 		// Uncapture keys, if they were captured
@@ -107,14 +109,14 @@
 			RWindowGroup& groupWin=iCoeEnv->RootWin();
 			groupWin.CancelCaptureKeyUpAndDowns(iAppKey);
 			groupWin.CancelCaptureKeyUpAndDowns(iVoiceKey2);
-			groupWin.CancelCaptureKey(iVoiceKey1);						
+			groupWin.CancelCaptureKey(iVoiceKey1);
 			}
 
 		if ( iPrioritySet )
 		    {
     		// Return normal high-priority in case there are other notifiers active 
 	    	// and were are not going to lose foregroung right after following call	
-		    iEikonEnv->RootWin().SetOrdinalPosition(0,ECoeWinPriorityAlwaysAtFront);
+		    iEikonEnv->RootWin().SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront);
 		    }
 		 						
 		iEikonEnv->BringForwards(EFalse);	
@@ -132,28 +134,25 @@
 		
 		iFront = EFalse;
 		}
-	
-	if (iDeviceLockStatusObserver)
-		delete iDeviceLockStatusObserver;
-		if (iCallStatusObserver)
-		delete iCallStatusObserver;
-	}
+}
+
+void CSCPQueryDialog :: PostLayoutDynInitL() {
+    Dprint( (_L("[CSCPQueryDialog]-> PostLayoutDynInitL() >>>") ));    
+    iDeviceLockStatusObserver = CSCPLockObserver::NewL(this);
+    iCallStatusObserver = CSCPLockObserver::NewL(this, ESecUiCallStateObserver);
+    Dprint( (_L("[CSCPQueryDialog]-> PostLayoutDynInitL() <<<") ));
+}
+
 //
 // ----------------------------------------------------------
 // CSCPQueryDialog::PreLayoutDynInitL()
 // Called by framework before dialog is shown 
 // ----------------------------------------------------------
 //
-void CSCPQueryDialog::PreLayoutDynInitL()
+void CSCPQueryDialog :: PreLayoutDynInitL()
     {
     Dprint( (_L("CSCPQueryDialog::PreLayoutDynInitL()") ));
     
-    /* CEikSecretEditor* queryControl = 
-                    static_cast<CEikSecretEditor*>(
-                        QueryControl()->ControlByLayoutOrNull( QueryControl()->QueryType() ) 
-                       ); 
-    queryControl->EnableSCT(EFalse); */
-    
     CAknTextQueryDialog::PreLayoutDynInitL();
     
     //disable in call bubble.
@@ -161,7 +160,6 @@
         {
         SetIncallBubbleAllowedInUsualL( EFalse );
         }
-
     
     // Create the ECS detector object if required
     if ( iECSSupport )
@@ -173,24 +171,38 @@
     
     Dprint( (_L("CSCPQueryDialog::PreLayoutDynInitL(): Set input mode") ));
         
-    /* The default input mode of the lock code query must be set on the basis of the
-    very first character of the current lock code. If the first character of the current
-    lock code is numeric, the default input mode will also be numeric. Otherwise, the 
-    default input mode will be alphabetic */
-    
-    CRepository* repository;
-    repository = CRepository::NewL( KCRUidSCPParameters );
-    CleanupStack::PushL( repository );
-    
-    User::LeaveIfError(repository->Get( KSCPLockCodeDefaultInputMode , def_mode) );
-    
-    CleanupStack::PopAndDestroy( repository );
-    repository = NULL;   
-    
-    if (def_mode == 0)
-    	SetDefaultInputMode( EAknEditorNumericInputMode ); 
-    else
-    	SetDefaultInputMode( EAknEditorSecretAlphaInputMode );
+    switch(iContextSensitive) {
+        case EContextSensitive: {
+            Dprint(_L("[CSCPQueryDialog]-> iContextSensitive = EContextSensitive"));
+            /* The default input mode of the lock code query must be set on the basis of the
+            very first character of the current lock code. If the first character of the current
+            lock code is numeric, the default input mode will also be numeric. Otherwise, the 
+            default input mode will be alphabetic */
+            
+            CRepository* repository = CRepository :: NewL(KCRUidSCPParameters);
+            CleanupStack :: PushL(repository);
+            User :: LeaveIfError(repository->Get(KSCPLockCodeDefaultInputMode, def_mode));            
+            CleanupStack :: PopAndDestroy(repository);
+
+            if (def_mode == 0) {
+                Dprint(_L("[CSCPQueryDialog]-> Context determined as Numeric"));
+                SetDefaultInputMode(EAknEditorNumericInputMode);
+            }
+            else {
+                Dprint(_L("[CSCPQueryDialog]-> Context determined as Alphanumeric"));
+                SetDefaultInputMode(EAknEditorSecretAlphaInputMode);
+            }
+        }
+        break;
+        case ENumeric:
+            Dprint(_L("[CSCPQueryDialog]-> iContextSensitive = ENumeric"));
+            SetDefaultInputMode( EAknEditorNumericInputMode );
+            break;
+        case EAlphaNumeric:
+            Dprint(_L("[CSCPQueryDialog]-> iContextSensitive = EAlphaNumeric"));
+            SetDefaultInputMode( EAknEditorSecretAlphaInputMode );
+            break;
+    };
     
     // Set the mode, we use this to determine the functionality for special keys
     if ( ( iButtons == RSCPClient::SCP_OK ) || ( iButtons == RSCPClient::SCP_OK_CANCEL ) )
@@ -259,25 +271,39 @@
     TInt wgPrio = wsSession.GetWindowGroupOrdinalPriority(myWgId);
 	Dprint( (_L("CSCPQueryDialog::PreLayoutDynInitL(): wgPrio %d"),wgPrio ));
 	TInt var;
-	RProperty::Get(KPSUidCtsyCallInformation, KCTsyCallState,var);
-	Dprint( (_L("CSCPQueryDialog::PreLayoutDynInitL(): EPSCTsyCallStateNone %d"),var ));
-    // we are already on forgeround, need to update priority differently
-	if (var != EPSCTsyCallStateNone)
-	{
-		// If the call is made during device startup have the priority as normal
-		if (iECSSupport && (iButtons == RSCPClient::SCP_OK))
-		{
-		iEikonEnv->RootWin().SetOrdinalPosition(1,ECoeWinPriorityNormal);
-		}
+	RProperty::Get(KPSUidCtsyCallInformation, KCTsyCallState, var);
+	Dprint((_L("CSCPQueryDialog::PreLayoutDynInitL(): EPSCTsyCallStateNone %d"), var));
 	
-	}
-    else if ((wgPrio == ECoeWinPriorityAlwaysAtFront)&&(iECSSupport))
-        {
-        Dprint( (_L("CSCPQueryDialog::PreLayoutDynInitL(): ECoeWinPriorityAlwaysAtFront+1") ));	
-        iEikonEnv->RootWin().SetOrdinalPosition(0,ECoeWinPriorityAlwaysAtFront+1);
-        iPrioritySet = ETrue;
+    // If the call is made during device startup have the priority as normal
+    if (iECSSupport)
+    {
+        switch(var) {
+            default:
+            case EPSCTsyCallStateNone:
+                Dprint( (_L("CSCPQueryDialog::PreLayoutDynInitL(): Started Maximized...")));
+                iEikonEnv->RootWin().SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront + 1);
+                iPrioritySet = ETrue;
+                break;
+            case EPSCTsyCallStateAlerting:
+            case EPSCTsyCallStateHold:
+            case EPSCTsyCallStateRinging:
+            case EPSCTsyCallStateDialling:
+            case EPSCTsyCallStateAnswering:
+            case EPSCTsyCallStateConnected: {
+                switch(iButtons) {
+                    case RSCPClient::SCP_OK:
+                    case RSCPClient::SCP_OK_ETEL: {
+                        Dprint( (_L("CSCPQueryDialog::PreLayoutDynInitL(): Started Minimized...")));
+                        iEikonEnv->RootWin().SetOrdinalPosition(0, ECoeWinPriorityLow);
+                        break;
+                    }
+                    default:
+                        break;
+                }
+            }
         }
-        
+    }
+	        
    // this must be done always to keep the reference count in synch  
    // this does not have any effect if autoforwarding has not been set true (normal application.)
    iEikonEnv->BringForwards(ETrue, ECoeWinPriorityAlwaysAtFront+1);
@@ -286,7 +312,7 @@
 	if (iECSSupport)
 		{
 		Dprint( (_L("CSCPQueryDialog::PreLayoutDynInitL(): Changing Window Priority") ));			
-		DrawableWindow()->SetOrdinalPosition(0,ECoeWinPriorityAlwaysAtFront);
+		DrawableWindow()->SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront);
 		ButtonGroupContainer().ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront); 	
 		}
 	else
@@ -305,12 +331,7 @@
 	static_cast<CAknAppUi*>(iEikonEnv->EikAppUi())->KeySounds()->LockContext();
 
 	iFront = ETrue;
-	
-	Dprint( (_L("CSCPQueryDialog::CSCPLockObserver") ));
-	iDeviceLockStatusObserver = CSCPLockObserver::NewL(this);
-	iCallStatusObserver = CSCPLockObserver::NewL(this,ESecUiCallStateObserver);
-
-	}
+}
 //
 // ---------------------------------------------------------
 // CSCPQueryDialog::OfferKeyEventL
@@ -422,8 +443,19 @@
                 if ( iEcsDetector->State() == CAknEcsDetector::ECompleteMatch ||
                      iEcsDetector->State() == CAknEcsDetector::EServiceNumMatch )
                     {
-                    iEcsDetector->AddChar( (TText)(EKeyPhoneSend) );
+                    Dprint( (_L("CSCPQueryDialog::OfferKeyEventL(): adding EKeyPhoneSend to detector")));
                     
+                    switch(iButtons) {
+                        case RSCPClient::SCP_OK:
+                        case RSCPClient::SCP_OK_ETEL:
+                            //Required only during device startup
+                            iEikonEnv->RootWin().SetOrdinalPosition(0, ECoeWinPriorityLow);
+                            break;
+                        default:
+                            break;
+                    }
+                    
+                    iEcsDetector->AddChar( (TText)(EKeyPhoneSend ) );
                     }   
                 else
                     {
@@ -524,14 +556,14 @@
             {
             iEcsDetector->SetBuffer(iTextBuffer.Left(KAknEcsMaxMatchingLength));
             }
-        if ( aType == EEventKey )
+        /*if ( aType == EEventKey )
             {
         if ( iEMCallActivated )
             {
             TryExitL( ESecUiEmergencyCall );
             return EKeyWasConsumed;
             }
-        }
+        }*/
         // Retrieve the editor control ptr, we know it is a secret editor..
         CEikSecretEditor* queryControl = static_cast<CEikSecretEditor*>( 
             QueryControl()->ControlByLayoutOrNull( QueryControl()->QueryType() ) );                
@@ -677,19 +709,26 @@
 		}
 		
     // Emergency call, exit
-    if ( aButtonId == ESecUiEmergencyCall )
-        {
-		Dprint( (_L("CSCPQueryDialog::OkToExitL(): ESecUiEmergencyCall") ));
-        ret = ETrue;
+    if (aButtonId == ESecUiEmergencyCall || aButtonId == EAknSoftkeyEmergencyCall)
+    {
+        //add EKeyPhonesend to ecs detector. 
+//        ret = ETrue;
+//        CAknTextQueryDialog::OkToExitL(aButtonId);
+        Dprint( (_L("CSCPQueryDialog::OkToExitL(): adding EKeyPhoneSend to detector") ));
+        
+        switch(iButtons) {
+            case RSCPClient::SCP_OK:
+            case RSCPClient::SCP_OK_ETEL:
+                //Required only during device startup
+                iEikonEnv->RootWin().SetOrdinalPosition(0, ECoeWinPriorityLow);
+                break;
+            default:
+                break;
         }
-    if (aButtonId == EAknSoftkeyEmergencyCall)
-        {
-        //add EKeyPhonesend to ecs detector. 
-        ret = ETrue;
-        Dprint( (_L("CSCPQueryDialog::OkToExitL(): adding EKeyPhoneSend to detector") ));
-         iEcsDetector->AddChar( (TText)(EKeyPhoneSend ) );
-        CAknTextQueryDialog::OkToExitL(aButtonId);
-        }
+        
+        iEMCallActivated = ETrue;
+        iEcsDetector->AddChar( (TText)(EKeyPhoneSend ) );
+    }
    
 	Dprint( (_L("CSCPQueryDialog::OkToExitL() done") ));   
 	return ret;
@@ -717,13 +756,13 @@
         FeatureManager::UnInitializeLib();
         }
 
-    if ( ( aUpdatedState == CAknEcsDetector::ECompleteMatchThenSendKey ) || 
+    /*if ( ( aUpdatedState == CAknEcsDetector::ECompleteMatchThenSendKey ) || 
          ( aUpdatedState == CAknEcsDetector::ECallAttempted ) )
         {
         // Call attempted, cancel the query
         iEMCallActivated = ETrue; // OfferKeyEventL will close the dialog         
         }
-    else if ( aUpdatedState == CAknEcsDetector::ECompleteMatch ||
+    else*/ if ( aUpdatedState == CAknEcsDetector::ECompleteMatch ||
               ( serviceCallEnabled && aUpdatedState == CAknEcsDetector::EServiceNumMatch ) )
         {
         iShowingEMNumber = ETrue;
@@ -800,22 +839,44 @@
 	
 // Call from the SCPObserver
 	
-void CSCPQueryDialog::TryCancelQueryL(TInt aReason)
-    {
+void CSCPQueryDialog::TryCancelQueryL(TInt aReason) {
     Dprint( (_L("CSCPQueryDialog::TryCancelQueryL()")) );
     
-	if (EPSCTsyCallStateDisconnecting == aReason)
-	{
-	Dprint( (_L("CSCPQueryDialog::TryCancelQueryL() -SetOrdinalPosition ->0")) );
-	iEikonEnv->RootWin().SetOrdinalPosition(0,ECoeWinPriorityAlwaysAtFront+1);
-	iPrioritySet = ETrue;
-	}
-	else
-	{
-	Dprint( (_L("CSCPQueryDialog::TryExitL(EAknSoftkeyCancel)")) );
-    TryExitL(EAknSoftkeyCancel);
-	}
+    switch(aReason) {
+        case CSCPLockObserver :: EEnded:
+            Dprint( (_L("CSCPQueryDialog::TryCancelQueryL(): Call ended, raising priority...")));
+            
+            switch(iButtons) {
+                case RSCPClient::SCP_OK:
+                case RSCPClient::SCP_OK_ETEL:
+                    if(iEMCallActivated) {
+                        TryExitL(EAknSoftkeyCancel);
+                    }
+                    else {
+                        iEikonEnv->RootWin().SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront + 1);
+                        iPrioritySet = ETrue;
+                    }
+                    break;
+                default:
+                    break;
+            }
+            break;
+        case CSCPLockObserver :: EInProgress:
+            Dprint( (_L("CSCPQueryDialog::TryCancelQueryL(): received call in progress event...")));
+            
+//            if(iEMCallActivated) {
+                Dprint( (_L("CSCPQueryDialog::TryCancelQueryL(): EM active, exiting...")));
+                TryExitL(EAknSoftkeyCancel);
+//            }
+            break;
+        case ESecUiDeviceLocked:
+            Dprint(_L("[CSCPQueryDialog]-> TryExitL 4"));
+            TryExitL(EAknSoftkeyCancel);
+            break;
+        default:
+            break;
     }
+}
 
     
 // End of file