# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1272882016 -10800 # Node ID 8957df7b007285a8f044e6d7443e8f8c25f12a4e # Parent 318c4eab243953b85b9bb108d31fb973fdff1950 Revision: 201015 Kit: 201018 diff -r 318c4eab2439 -r 8957df7b0072 devencdiskutils/DevEncStarter/rom/DevEncStarter.iby --- a/devencdiskutils/DevEncStarter/rom/DevEncStarter.iby Fri Apr 16 15:53:24 2010 +0300 +++ b/devencdiskutils/DevEncStarter/rom/DevEncStarter.iby Mon May 03 13:20:16 2010 +0300 @@ -24,7 +24,6 @@ //S60_APP_BITMAP( DevEncStarter ) S60_APP_AIF_ICONS( DevEncStarter ) S60_APP_AIF_RSC( DevEncStarter ) -data=DATAZ_\private\10003a3f\apps\DevEncStarter_reg.rsc private\10003a3f\import\apps\DevEncStarter_reg.rsc #endif // __DEVENCSTARTER_IBY__ diff -r 318c4eab2439 -r 8957df7b0072 devencdiskutils/rom/DevEncDiskUtils.iby --- a/devencdiskutils/rom/DevEncDiskUtils.iby Fri Apr 16 15:53:24 2010 +0300 +++ b/devencdiskutils/rom/DevEncDiskUtils.iby Mon May 03 13:20:16 2010 +0300 @@ -41,7 +41,6 @@ //--------------------------------------------------------------------------- S60_APP_EXE( DevEncStarter ) //S60_APP_AIF_RSC( DevEncStarter ) -data=DATAZ_\private\10003a3f\apps\DevEncStarter_reg.rsc private\10003a3f\import\apps\DevEncStarter_reg.rsc data=DATAZ_\resource\apps\DevEncStarter.rsc resource\apps\DevEncStarter.rsc #endif // FF_DEVICE_ENCRYPTION_FEATURE diff -r 318c4eab2439 -r 8957df7b0072 pkiutilities/DeviceToken/Src/Certstore/server/DevandTruSrvCertStoreServer.cpp --- a/pkiutilities/DeviceToken/Src/Certstore/server/DevandTruSrvCertStoreServer.cpp Fri Apr 16 15:53:24 2010 +0300 +++ b/pkiutilities/DeviceToken/Src/Certstore/server/DevandTruSrvCertStoreServer.cpp Mon May 03 13:20:16 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -331,12 +331,6 @@ const TDesC8& aCert, const RMessage2& aMessage, TBool aFromTruSiteSrv ) { - // Check if a certificate with this name already exists - if (iEntryList->LabelExists(aInfo.iLabel)) - { - User::Leave(KErrBadName); - } - // Check subject key id and cert data are supplied, issuer key id is optional if (aInfo.iSubjectKeyId == KNullDesC8 || aCert == KNullDesC8) { @@ -403,16 +397,19 @@ { CX509Certificate* cert = CX509Certificate::NewLC( aCertData ); TBuf8 certHash; - certHash.Copy(cert->Fingerprint()); - - + certHash.Copy(cert->Fingerprint()); + const CX500DistinguishedName& dName = cert->SubjectName(); // Retrieve CN - HBufC* cn = dName.ExtractFieldL( KX520CommonName ); - CleanupStack::PushL(cn); - iTrustedSitesServer->AddL( certHash, *cn ); + HBufC* cn = dName.ExtractFieldL( KX520CommonName ); + if( cn ) + { + CleanupStack::PushL( cn ); + iTrustedSitesServer->AddL( certHash, *cn ); + CleanupStack::PopAndDestroy( cn ); + } - CleanupStack::PopAndDestroy( 2 );//cert, cn + CleanupStack::PopAndDestroy( cert ); } if (err != KErrNone) { diff -r 318c4eab2439 -r 8957df7b0072 pkiutilities/StubSIS/c32exe.sis Binary file pkiutilities/StubSIS/c32exe.sis has changed diff -r 318c4eab2439 -r 8957df7b0072 pkiutilities/group/bld.inf --- a/pkiutilities/group/bld.inf Fri Apr 16 15:53:24 2010 +0300 +++ b/pkiutilities/group/bld.inf Mon May 03 13:20:16 2010 +0300 @@ -25,7 +25,7 @@ //Stub SIS PRJ_EXPORTS ../StubSIS/CenRepStub.sis /epoc32/data/z/system/install/CenRepStub.sis -../StubSIS/c32exe.sis /epoc32/data/z/system/install/c32exe.sis + //SWI and TLSProvider config files ../StubSIS/swipolicy.ini /epoc32/release/winscw/udeb/z/system/data/swipolicy.ini diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/Autolock/group/Autolock.mmp --- a/securitydialogs/Autolock/group/Autolock.mmp Fri Apr 16 15:53:24 2010 +0300 +++ b/securitydialogs/Autolock/group/Autolock.mmp Mon May 03 13:20:16 2010 +0300 @@ -74,7 +74,7 @@ LIBRARY eikcoctl.lib avkon.lib LIBRARY activitymanager.lib LIBRARY apgrfx.lib -LIBRARY ws32.lib secui.lib commonengine.lib +LIBRARY ws32.lib commonengine.lib LIBRARY etel.lib etelmm.lib eikdlg.lib LIBRARY sysutil.lib LIBRARY aknlayout.lib @@ -90,6 +90,7 @@ LIBRARY gdi.lib LIBRARY aknnotify.lib LIBRARY customapi.lib +// LIBRARY secui.lib SMPSAFE diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/Autolock/src/AutolockApp.cpp --- a/securitydialogs/Autolock/src/AutolockApp.cpp Fri Apr 16 15:53:24 2010 +0300 +++ b/securitydialogs/Autolock/src/AutolockApp.cpp Mon May 03 13:20:16 2010 +0300 @@ -20,7 +20,10 @@ #include "AutolockApp.h" #include "AutolockDocument.h" #include - +#include +#include +#include +#include // ================= MEMBER FUNCTIONS ======================= @@ -41,6 +44,7 @@ // CApaDocument* CAutolockApp::CreateDocumentL() { + RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); return CAutolockDocument::NewL( *this ); } @@ -49,11 +53,45 @@ LOCAL_C CApaApplication* NewApplication() { + RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + + TInt use_old_autolock=1; + if(use_old_autolock) + { + // start autolocksrv instead of autolock . This is a backup solution to use in case that not all SysAp and Avkon changes are implemented + RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0x1 ); + CCoeEnv *env = CCoeEnv::Static(); + TApaTaskList taskList( env->WsSession() ); + RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + const TUid KAutolockSrvAppUid = { 0xE0022E73 }; + TApaTask task( taskList.FindApp( KAutolockSrvAppUid ) ); + RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + if ( !task.Exists() ) + { + RDebug::Printf( "%s %s (%u) no KAutolockSrvAppUid found. Creating=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + RApaLsSession ls; + User::LeaveIfError(ls.Connect()); + CleanupClosePushL(ls); + + CApaCommandLine* commandLine = CApaCommandLine::NewLC(); + commandLine->SetExecutableNameL( _L("autolocksrv.exe" ) ); + commandLine->SetCommandL( EApaCommandRun ); + + // Try to launch the application. + User::LeaveIfError(ls.StartApp(*commandLine)); + RDebug::Printf( "%s %s (%u) autolocksrv.exe created=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0x7 ); + + CleanupStack::PopAndDestroy(2); // commandLine, ls + } + } + RDebug::Printf( "%s %s (%u) exiting=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0x1 ); return new CAutolockApp; } GLDEF_C TInt E32Main() { + RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + return EikStart::RunApplication(NewApplication); } diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/Autolock/src/AutolockAppUi.cpp --- a/securitydialogs/Autolock/src/AutolockAppUi.cpp Fri Apr 16 15:53:24 2010 +0300 +++ b/securitydialogs/Autolock/src/AutolockAppUi.cpp Mon May 03 13:20:16 2010 +0300 @@ -71,363 +71,17 @@ // void CAutolockAppUi::ConstructL() { + RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + #if defined(_DEBUG) RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL")); #endif + RDebug::Printf( "%s %s (%u) EAutolockOff=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, EAutolockOff ); + RProperty::Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EAutolockOff); + BaseConstructL( EAknEnableSkin | EAknEnableMSK ); - //Disable priority control so that Autolock process priority isn't set to "background" by - //window server when it is not active. - iEikonEnv->WsSession().ComputeMode( RWsSession::EPriorityControlDisabled ); - RThread().SetProcessPriority( EPriorityHigh ); - - FeatureManager::InitializeLibL(); - - RTelServer::TPhoneInfo PhoneInfo; - // prevent autolock shutdown - iEikonEnv->SetSystem( ETrue ); - - iSideKey1 = 0; - iSideKey2 = 0; - iAppKey = 0; - - aCallButtonRect = TRect (0,0,0,0); - //connect to ETel - - TInt err( KErrGeneral ); - TInt thisTry( 0 ); - - /*All server connections are tried to be made KTiesToConnectServer times because occasional - fails on connections are possible at least on some servers*/ - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() connect to etel server")); - #endif - // connect etel server - while ( ( err = iServer.Connect() ) != KErrNone && ( thisTry++ ) <= KTriesToConnectServer ) - { - User::After( KTimeBeforeRetryingServerConnection ); - } - User::LeaveIfError( err ); - - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() load tsy")); - #endif - // load tsy - err = iServer.LoadPhoneModule( KMmTsyModuleName ); - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() load tsy ERROR: %d"), err); - #endif - if ( err != KErrAlreadyExists ) - { - // may return also KErrAlreadyExists if some other - // is already loaded the tsy module. And that is - // not an error. - User::LeaveIfError( err ); - } - - thisTry = 0; - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() open phone")); - #endif - //open phone - User::LeaveIfError(iServer.SetExtendedErrorGranularity(RTelServer::EErrorExtended)); - User::LeaveIfError(iServer.GetPhoneInfo(PhoneIndex, PhoneInfo)); - User::LeaveIfError(iPhone.Open(iServer,PhoneInfo.iName)); - User::LeaveIfError(iCustomPhone.Open(iPhone)); - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() phone opened")); - #endif - - TBool systemLocked = EFalse; - TBool autolockValue = EAutolockStatusUninitialized; - - iWait = NULL; - iWait = CWait::NewL(); - - #ifndef __WINS__ - - - /***************************************************** - * Series 60 Customer / ETEL - * Series 60 ETEL API - *****************************************************/ - - // set autolock period to 0, if lock is disabled in DOS side - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() set autolock period to 0")); - #endif - RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; - RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; - RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); - - iWait->SetRequestType(EMobilePhoneGetLockInfo); - iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); - TInt res = iWait->WaitForRequestL(); - User::LeaveIfError(res); - TInt lockValue = 0; - CRepository* repository = CRepository::NewL(KCRUidSecuritySettings); - TInt cRresult = repository->Get(KSettingsAutolockStatus, lockValue); - TBool hiddenReset = HiddenReset(); - #if defined(_DEBUG) - if(hiddenReset) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() Hidden reset")); - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() CR get result: %d"), cRresult); - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() CR lock value: %d"), lockValue); - #endif - if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) - { - repository->Set(KSettingsAutoLockTime, 0); - if ( FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) ) - { - repository->Set(KSettingsLockOnPowerUp, 0); - } - } - // In CDMA, the system can stay locked on after the boot-up sequence. - else if ( FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) || (hiddenReset && (lockValue == 1))) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() Hidden reset when locked")); - #endif - systemLocked = ETrue; - } - - - if ( lockInfo.iSetting == RMobilePhone::ELockSetEnabled && lockValue != EAutolockOff && !hiddenReset) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() EAutolockStatusUninitialized %d"),EAutolockStatusUninitialized); - #endif - autolockValue = EAutolockStatusUninitialized; - } - else if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled || (hiddenReset && (lockValue == 0)) ) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() EAutolockOff %d"),EAutolockOff); - #endif - autolockValue = EAutolockOff; - } - - delete repository; - #endif //__WINS__ - - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() Enable emergency call support")); - #endif - - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() Autolock view")); - #endif - - - - // ------------------------------------------------------------------------------------------------------------- - // part of emergency call handling when telephony+devicelock is active - // this solution is meant only for 3.1 and 3.2 - - iEcsNote = new (ELeave) CEcsNote(); - iEcsNote->ConstructSleepingNoteL(R_AVKON_EMERGENCY_CALL_NOTE); - iEcsNote->ButtonGroupContainer().ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition(0,2); - - if (AknLayoutUtils::PenEnabled()) // on touch devices, if Autolock is activated from IdleScreen in landscape, the buttons need to be drawn. - { - iEcsNote->ButtonGroupContainer().SetCommandL( 0, _L("") ); // as keyboard is locked, these buttons do nothing. Better to hide their labels. - iEcsNote->ButtonGroupContainer().SetCommandL( EAknSoftkeyCancel, _L("") ); - iEcsNote->ButtonGroupContainer().ButtonGroup()->AsControl()->MakeVisible(ETrue); - } - - // Emergency call support - iEcsDetector = CAknEcsDetector::NewL(); - iEcsDetector->SetObserver( this ); - iEmergencySupportReady = ETrue; - // ------------------------------------------------------------------------------------------------------------- - - - // Autolock view - CAutolockView* lockView = new(ELeave) CAutolockView; - CleanupStack::PushL(lockView); - lockView->ConstructL(); - CleanupStack::Pop(); // lockView - AddViewL(lockView); // transfer ownership to CAknViewAppUi - SetDefaultViewL(*lockView); - - // start autolock timer - iModel = CAutoLockModel::NewL(this, autolockValue); - - // phone event observer - iPhoneObserver = CValueObserver::NewL(this); - //call bubble - iIncallBubble = CAknIncallBubble::NewL(); - - //Autokeyguard Period observer - #ifdef RD_AUTO_KEYGUARD - iKeyguardObserver = CAutoKeyguardObserver::NewL(); - #else //!RD_AUTO_KEYGUARD - iKeyguardObserver = NULL; - #endif //RD_AUTO_KEYGUARD - // Create the write policy. Also processes with write device data can write the value. - TSecurityPolicy writePolicy( ECapabilityWriteDeviceData ); - // Create the read policy. Also processes with read device data can read the value. - TSecurityPolicy readPolicy( ECapabilityReadDeviceData ); - - TInt tRet = RProperty::Define( KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, RProperty::EInt, readPolicy, writePolicy ); - - if ( tRet != KErrNone ) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL():\ - FAILED to define the SECUI query Flag: %d"), tRet); - #endif - } - - tRet = RProperty::Define( KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, RProperty::EInt, readPolicy, writePolicy ); - if ( tRet != KErrNone ) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL():\ - FAILED to define the SECUI query request state Flag: %d"), tRet); - #endif - } - -if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw )) -{ - - // Define the TARM admin flag. - - tRet = RProperty::Define( KSCPSIDAutolock, SCP_TARM_ADMIN_FLAG_UID, RProperty::EInt, - readPolicy, writePolicy ); - if ( tRet != KErrNone ) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL():\ - FAILED to define the TARM Admin Flag")); - #endif - } - - // The following sequence is used to validate the configuration on SCP server. - // This is needed on the first boot (initial or RFS) or if the C-drive has been formatted - // (3-button format) and Autolock is not active. - - RSCPClient scpClient; - if ( scpClient.Connect() == KErrNone ) - { - TInt confStatus = scpClient.CheckConfiguration( KSCPInitial ); - - if ( confStatus == KErrAccessDenied ) - { - #ifndef __WINS__ - if ( ( lockInfo.iSetting == RMobilePhone::ELockSetDisabled ) ) - #else // __WINS__ - if ( 1 ) // DOS lock is never active in WINS - #endif // __WINS__ - { - // DOS lock is not active. Note that if DOS is locked, checking the code here will - // mess up the query sequence. On initial startup DOS is not locked. - - TInt finalConfStatus = scpClient.CheckConfiguration( KSCPComplete ); - - if ( finalConfStatus == KErrAccessDenied ) - { - #ifdef __WINS__ - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL():\ - DOS validation FAILED in WINS, something wrong!")); - #endif - #else // !__WINS__ - - // The SCP server is out of sync and Autolock is not active. (c-drive formatted) - // We must ask the security code. ( Note that it is very rare that this is executed ) - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL():\ - Lock setting disabled, calling setlocksetting")); - #endif - - // Wait here until the startup is complete - - TInt tarmErr = KErrNone; - while ( tarmErr == KErrNone ) - { - TInt sysState=0; - tarmErr = RProperty::Get(KPSUidStartup, KPSGlobalSystemState, sysState); - - if ((sysState == ESwStateNormalRfOn) || (sysState == ESwStateNormalRfOff) - || (sysState == ESwStateNormalBTSap)) - { - break; - } - User::After(500000); - } - - // Just change the lock setting again to disabled to request the security code. - // Set the TARM flag so SecUi knows it should display the "login" query. - TInt tarmFlag=0; - tRet = RProperty::Get( KSCPSIDAutolock, SCP_TARM_ADMIN_FLAG_UID, tarmFlag ); - if ( tRet == KErrNone ) - { - tarmFlag |= KSCPFlagResyncQuery; - tRet = RProperty::Set( KSCPSIDAutolock, SCP_TARM_ADMIN_FLAG_UID, tarmFlag ); - } - - if ( tRet != KErrNone ) - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL():\ - FAILED to set TARM Admin Flag")); - #endif - } - - RMobilePhone::TMobilePhoneLockSetting lockChange; - lockChange = RMobilePhone::ELockSetDisabled; - iWait->SetRequestType(EMobilePhoneSetLockSetting); - iPhone.SetLockSetting(iWait->iStatus, lockType, lockChange); - - res = iWait->WaitForRequestL(); - #endif // __WINS__ - } - } - - } // if ( confStatus == KErrAccessDenied ) - - scpClient.Close(); - } - -} - - // Eventhough we might lock the device on boot-up (systemLocked == ETrue), we - // want to hide the app until the handshake is done. StartUp application will - // active the app when it is finished. - if( !systemLocked ) - {// app to background - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() app to background")); - #endif - TApaTask self(iCoeEnv->WsSession()); - self.SetWgId(iCoeEnv->RootWin().Identifier()); - self.SendToBackground(); - // flush - iCoeEnv->WsSession().Flush(); - } - else - { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() LOCK SYSTEM")); - #endif - TInt lockState = 0; - - #ifdef RD_REMOTELOCK - lockState = EManualLocked; - #else //!RD_REMOTELOCK - lockState = EAutolockOn; - #endif//RD_REMOTELOCK - iModel->LockSystemL(lockState); - } - - iGripStatusObserver = CAutolockGripStatusObserver::NewL( this, iEikonEnv->WsSession() ); - iFpsStatusObserver = CAutolockFpsStatusObserver::NewL( this, iEikonEnv->WsSession() ); - iDeviceLockQueryStatus = EFalse; - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() END")); - #endif } // ---------------------------------------------------- // CAutolockAppUi::~CAutolockAppUi() @@ -437,6 +91,7 @@ // CAutolockAppUi::~CAutolockAppUi() { + RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); #if defined(_DEBUG) RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::~CAutolockAppUi() BEGIN")); #endif @@ -464,23 +119,27 @@ iServer.UnloadPhoneModule(KMmTsyModuleName); iServer.Close(); } + RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); delete iModel; delete iPhoneObserver; delete iIncallBubble; -#ifdef RD_AUTO_KEYGUARD +RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + #ifdef RD_AUTO_KEYGUARD delete iKeyguardObserver; #endif delete iEcsDetector; delete iEcsNote; // Ecs change - delete iWait; + RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + delete iWait; FeatureManager::UnInitializeLib(); delete iGripStatusObserver; delete iFpsStatusObserver; #if defined(_DEBUG) RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::~CAutolockAppUi() END")); #endif - } +RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + } // ---------------------------------------------------- // CAutolockAppUi::HandleForegroundEventL() // Handles foreground event. @@ -721,74 +380,7 @@ } case ESecUiCmdUnlock: { - #if defined(_DEBUG) - RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::HandleCommandL() ESecUiCmdUnlock")); - #endif - // stop observing emergency call event - iEmergencySupportReady = EFalse; - iEcsDetector->Reset(); // Ecs queue is cleared; keys up til here are forgotten - // ask secuity code - CSecurityHandler* handler = new (ELeave) CSecurityHandler(iPhone); - CleanupStack::PushL(handler); - TSecUi::InitializeLibL(); - - // Put the lights on when security query is shown - SendMessageToSysAp( EEikSecurityQueryLights ); - HideSoftNotification(); // dismiss all the pending notes just before asking the unlocking code - - TRAPD(err, - { - iDeviceLockQueryStatus = ETrue; - if(handler->AskSecCodeInAutoLockL()) - { - iLocked = EFalse; - DisableWGListChangeEventListening(); - iDeviceLockQueryStatus = EFalse; - UnLockKeys(); - iModel->SetLockedL(EFalse); - SwitchToPreviousAppL(); - } - else - { // make sure that we will be topmost still - iDeviceLockQueryStatus = EFalse; - TInt callState; - RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallState, callState ); - if ( callState == EPSCTsyCallStateNone && - !FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) ) - { - TApaTask self(CCoeEnv::Static()->WsSession()); - self.SetWgId(CCoeEnv::Static()->RootWin().Identifier()); - self.BringToForeground(); - TBool featureNoPowerkey = FeatureManager::FeatureSupported( KFeatureIdNoPowerkey ); - if ( featureNoPowerkey ) - {//set lights on in case user pressed "red button". If he pressed cancel the lights are on anyway so it doesn't matter. - SendMessageToSysAp(EEikKeyLockLightsOnRequest); - } - // we don't want enable lock if call in progress - RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallState, callState ); - TInt keyguardDisableState(ECoreAppUIsDisableKeyguardUninitialized); - //If there is alarm on the keyguard status is set to disabled. In that case don't enable keyguard as it will be done by SysAp - //after the alarm has been disabled/snoozed. Otherwise the alarm CBA is left under keyguard CBA. - RProperty::Get( KPSUidCoreApplicationUIs, KCoreAppUIsDisableKeyguard, keyguardDisableState ); - if ((callState == EPSCTsyCallStateNone) && (keyguardDisableState != ECoreAppUIsDisableKeyguard)) - { - RAknKeyLock keylock; - if ( keylock.Connect() == KErrNone ) - { - keylock.EnableAutoLockEmulation(); - keylock.Close(); - } - } - } - } - };) - - // start observing emergency call event - iEmergencySupportReady = ETrue; - CleanupStack::PopAndDestroy(handler); // handler - TSecUi::UnInitializeLib(); // secui - - User::LeaveIfError(err); + RDebug::Printf( "%s %s (%u) ESecUiCmdUnlock is not longer handled by Autolock=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, ESecUiCmdUnlock ); break; } diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/AutolockSrv.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/AutolockSrv.loc Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,13 @@ +// ============================================================================ +// * Generated by qmake (2.01a) (Qt 4.6.2) on: 2010-03-17T08:18:14 +// * This file is generated by qmake and should not be modified by the +// * user. +// ============================================================================ + +#ifdef LANGUAGE_SC +#define STRING_r_short_caption "AutolockSrv" +#define STRING_r_caption "AutolockSrv" +#else +#define STRING_r_short_caption "AutolockSrv" +#define STRING_r_caption "AutolockSrv" +#endif diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/AutolockSrv.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/AutolockSrv.pro Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,68 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, version 2.1 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, +# see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". +# +# Description: +# + +TEMPLATE=app +TARGET=AutolockSrv + +CONFIG += service + +CONFIG += Hb + +CONFIG += mobility +MOBILITY = publishsubscribe + +symbian:TARGET.UID3 = 0xE0022E73 + +XQSERVICE_ROOT=../.. +include(../../xqservicebase.pri) +include(src/AutolockSrv.pri) + +symbian: TARGET.CAPABILITY = CAP_APPLICATION + +LIBS+=-lxqservice -lxqserviceutil -lflogger +LIBS += -L../../../../../bin/release -lautolockuseractivityservice + +LIBS+=-lsecui -letelmm -letel -lcustomapi -lcentralrepository + +SERVICE.FILE = service_conf.xml +SERVICE.OPTIONS = embeddable +SERVICE.OPTIONS += hidden + +libFiles.sources = AutolockSrv.exe +libFiles.path = "!:\sys\bin" +DEPLOYMENT += libFiles + +RESOURCES += AutolockSrv.qrc + +RSS_RULES += \ + "datatype_list = " \ + " {" \ + " DATATYPE" \ + " {" \ + " priority = EDataTypePriorityNormal;" \ + " type = \"text/plain\";" \ + " }" \ + " };" \ + +symbian:crml.sources = autolocksrv.qcrml +symbian:crml.path = c:/resource/qt/crml +symbian:DEPLOYMENT += crml + +symbian:BLD_INF_RULES.prj_exports += "./rom/AutolockSrv.iby CORE_APP_LAYER_IBY_EXPORT_PATH(AutolockSrv.iby)" diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/AutolockSrv.qrc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/AutolockSrv.qrc Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,6 @@ + + + iconnotifier.svg + qtg_large_device_lock.svg + + diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/Keyguard_enabled.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/Keyguard_enabled.svg Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,1949 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/autolocksrv.qcrml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/autolocksrv.qcrml Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/autolockuseractivityservice.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/autolockuseractivityservice.pro Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,19 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: autolockuseractivityservice.pro +# + +TEMPLATE = subdirs + +SUBDIRS += autolockuseractivityservice/autolockuseractivityservice.pro diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/autolockuseractivityservice/autolockuseractivityservice.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/autolockuseractivityservice/autolockuseractivityservice.pri Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,26 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: autolockuseractivityservice.pri +# + +HEADERS += ./inc/*.h + +SOURCES += ./src/*.cpp + +INCLUDEPATH += . \ + inc + +DEPENDPATH += . \ + inc \ + src diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/autolockuseractivityservice/autolockuseractivityservice.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/autolockuseractivityservice/autolockuseractivityservice.pro Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,32 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: autolockuseractivityservice.pro +# + +TEMPLATE = lib + +include(common.pri) + +DEFINES += AUTOLOCKUSERACTIVITYSERVICE_LIB + +symbian: { +TARGET.UID3 = 0x2002704D +LIBS += -lactivitymanager + +include(autolockuseractivityservice_s60.pri) +} else { +include(autolockuseractivityservice_stub.pri) +} + +include(autolockuseractivityservice.pri) diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/autolockuseractivityservice/autolockuseractivityservice_s60.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/autolockuseractivityservice/autolockuseractivityservice_s60.pri Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,24 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: autolockuseractivityservice_s60.pri +# + +HEADERS += ./s60/inc/*.h + +SOURCES += ./s60/src/*.cpp + +INCLUDEPATH += ./s60/inc + +DEPENDPATH += ./s60/inc \ + ./s60/src diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/autolockuseractivityservice/autolockuseractivityservice_stub.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/autolockuseractivityservice/autolockuseractivityservice_stub.pri Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,24 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: autolockuseractivityservice_stub.pri +# + +HEADERS += ./stub/inc/*.h + +SOURCES += ./stub/src/*.cpp + +INCLUDEPATH += ./stub/inc + +DEPENDPATH += ./stub/inc \ + ./stub/src diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/autolockuseractivityservice/common.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/autolockuseractivityservice/common.pri Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,66 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: screensaverapp project - common QMake settings +# + +CONFIG += debug_and_release + +# On win32 and mac, debug and release libraries are named differently. +# We must follow the debug and release settings Qt was compiled with: +# build debug iff Qt built debug, build release iff Qt built release. +win32|mac { + !contains(QT_CONFIG,debug)|!contains(QT_CONFIG,release) { + CONFIG -= debug_and_release debug release + contains(QT_CONFIG,debug): CONFIG+=debug + contains(QT_CONFIG,release):CONFIG+=release + } +} + +CONFIG(debug, debug|release) { + SUBDIRPART = debug +} else { + SUBDIRPART = release +} + +SOURCE_DIR = $$PWD/inc + +DESTDIR = $$OUTPUT_DIR + +# Add the output dirs to the link path too +LIBS += -L$$DESTDIR + +DEPENDPATH += . $$SOURCE_DIR +INCLUDEPATH += . $$SOURCE_DIR +#For some reason the default include path doesn't include MOC_DIR on symbian +symbian { + INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE + TARGET.CAPABILITY = ALL -TCB + TARGET.EPOCALLOWDLLDATA=1 +} + + +plugin: !isEmpty(PLUGIN_SUBDIR): DESTDIR = $$OUTPUT_DIR/$$PLUGIN_SUBDIR + +symbian: plugin { # copy qtstub and manifest + pluginstub.sources = $${TARGET}.dll + pluginstub.path = $$PLUGIN_SUBDIR + + DEPLOYMENT += pluginstub + + qtplugins.path = $$PLUGIN_SUBDIR + qtplugins.sources += qmakepluginstubs/$${TARGET}.qtplugin + qtplugins.sources += resource/$${TARGET}.manifest + + for(qtplugin, qtplugins.sources):BLD_INF_RULES.prj_exports += "./$$qtplugin z:$$qtplugins.path/$$basename(qtplugin)" +} diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/autolockuseractivityservice/inc/autolockuseractivityservice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/autolockuseractivityservice/inc/autolockuseractivityservice.h Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: autolockuseractivityservice.h +* +*/ + +#ifndef AUTOLOCKAUTOLOCKUSERACTIVITYSERVICE_H +#define AUTOLOCKAUTOLOCKUSERACTIVITYSERVICE_H + +#include "autolockuseractivityserviceinterface.h" +#include "autolockuseractivityservice_global.h" + +class AutolockUserActivityServicePrivate; + +class AUTOLOCKUSERACTIVITYSERVICE_EXPORT AutolockUserActivityService : public AutolockUserActivityServiceInterface +{ + Q_OBJECT + +public: + + explicit AutolockUserActivityService(/*QObject *parent = 0*/); + ~AutolockUserActivityService(); + + virtual void setInactivityPeriod(int seconds); + virtual int inactivityPeriod() const; + +private: + + //virtual void connectNotify(const char *signal); + //virtual void disconnectNotify(const char *signal); + + //bool receiversConnected(); + + Q_DISABLE_COPY(AutolockUserActivityService) + +private: + + AutolockUserActivityServicePrivate *m_d; + friend class AutolockUserActivityServicePrivate; + +}; + +#endif // AUTOLOCKAUTOLOCKUSERACTIVITYSERVICE_H diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/autolockuseractivityservice/inc/autolockuseractivityservice_global.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/autolockuseractivityservice/inc/autolockuseractivityservice_global.h Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: autolockuseractivityservice_global.h +* +*/ + + +#ifndef AUTOLOCKAUTOLOCKUSERACTIVITYSERVICE_GLOBAL_H +#define AUTOLOCKAUTOLOCKUSERACTIVITYSERVICE_GLOBAL_H + +#include + +#ifdef AUTOLOCKUSERACTIVITYSERVICE_LIB + #define AUTOLOCKUSERACTIVITYSERVICE_EXPORT Q_DECL_EXPORT +#else + #ifdef AUTOLOCKUSERACTIVITYSERVICE_TEST + #define AUTOLOCKUSERACTIVITYSERVICE_EXPORT + #else + #define AUTOLOCKUSERACTIVITYSERVICE_EXPORT Q_DECL_IMPORT + #endif +#endif + +#endif // AUTOLOCKAUTOLOCKUSERACTIVITYSERVICE_GLOBAL_H diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/autolockuseractivityservice/inc/autolockuseractivityserviceinterface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/autolockuseractivityservice/inc/autolockuseractivityserviceinterface.h Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: autolockuseractivityserviceinterface.h +* +*/ + +#ifndef AUTOLOCKUSERACTIVITYSERVICEINTERFACE_H +#define AUTOLOCKUSERACTIVITYSERVICEINTERFACE_H + +#include + +class AutolockUserActivityServiceInterface : public QObject +{ + Q_OBJECT + +public: + + virtual void setInactivityPeriod(int seconds) = 0; + virtual int inactivityPeriod() const = 0; + +signals: + + void notActive(); + void active(); + +}; + +#endif // AUTOLOCKUSERACTIVITYSERVICEINTERFACE_H diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/autolockuseractivityservice/s60/inc/autolockuseractivityservice_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/autolockuseractivityservice/s60/inc/autolockuseractivityservice_p.h Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: autolockuseractivityservice_p.h +* +*/ + +#ifndef AUTOLOCKUSERACTIVITYSERVICEPRIVATE_H +#define AUTOLOCKUSERACTIVITYSERVICEPRIVATE_H + +class CUserActivityManager; + +class AutolockUserActivityService; + +class AutolockUserActivityServicePrivate +{ + +public: + + explicit AutolockUserActivityServicePrivate(AutolockUserActivityService *servicePublic); + ~AutolockUserActivityServicePrivate(); + + void setInactivityPeriod(int seconds); + int inactivityPeriod() const; + + void watch(bool shouldWatch); + + void emitActive() const; + void emitNotActive() const; + +private: + + bool isWatching() const; + +private: + + AutolockUserActivityService *m_q; + + CUserActivityManager *mActivityManager; + int mInactivityPeriod; + +}; + +#endif // AUTOLOCKUSERACTIVITYSERVICEPRIVATE_H diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/autolockuseractivityservice/s60/src/autolockuseractivityservice_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/autolockuseractivityservice/s60/src/autolockuseractivityservice_p.cpp Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,143 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: autolockuseractivityservice_p.cpp +* +*/ + +#include "autolockuseractivityservice.h" +#include "autolockuseractivityservice_p.h" +#include + +#include + +const int lDefaultInactivityPeriod(5); + +// ======== LOCAL FUNCTIONS ======== + +/*! + Called as callback to activity event. + \param pointer to activity callback object. + \retval error code. +*/ +TInt activityCallback(TAny *ptr) +{ + RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + + static_cast(ptr)->emitActive(); + // activity manager doesn't care about the return value, + // we return a value indicating 'true' to be elegant (see CIdle) + return 1; +} + +/*! + Called as callback to inactivity event. + \param pointer to inactivity callback object. + \retval error code. +*/ +TInt inactivityCallback(TAny *ptr) +{ + RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + + static_cast(ptr)->emitNotActive(); + // activity manager doesn't care about the return value, + // we return a value indicating 'true' to be elegant (see CIdle) + return 1; +} + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor. + \param servicePublic public implementation. +*/ +AutolockUserActivityServicePrivate::AutolockUserActivityServicePrivate(AutolockUserActivityService *servicePublic) : + m_q(servicePublic), mActivityManager(0), mInactivityPeriod(lDefaultInactivityPeriod) +{ + mActivityManager = CUserActivityManager::NewL(CActive::EPriorityStandard); +} + +/*! + Destructor. +*/ +AutolockUserActivityServicePrivate::~AutolockUserActivityServicePrivate() +{ + delete mActivityManager; +} + +/*! + Sets the inactivity period after which to emit signal of inactivity. + \param seconds after which inactivity is detected. +*/ +void AutolockUserActivityServicePrivate::setInactivityPeriod(int seconds) +{ + RDebug::Printf( "%s %s (%u) seconds=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, seconds ); + + mInactivityPeriod = seconds; + // activity manager panics if timeout set before start + if (isWatching()) + { + mActivityManager->SetInactivityTimeout(TTimeIntervalSeconds(mInactivityPeriod)); + } +} + +/*! + Retrives the current inactivity period setting. + \retval inactivity period set. +*/ +int AutolockUserActivityServicePrivate::inactivityPeriod() const +{ + return mInactivityPeriod; +} + +/*! + Starts or stops activity manager user activity watching. + \param shouldWatch determines if we shoul start watching or stop watching. +*/ +void AutolockUserActivityServicePrivate::watch(bool shouldWatch) +{ + RDebug::Printf( "%s %s (%u) shouldWatch=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, shouldWatch ); + if (shouldWatch && !isWatching()) { + mActivityManager->Start( + TTimeIntervalSeconds(mInactivityPeriod), + TCallBack(inactivityCallback, this), + TCallBack(activityCallback, this)); + } else if (!shouldWatch && isWatching()) { + mActivityManager->Cancel(); + } +} + +/*! + Checks if activity service is currently watching for user activity. + \retval true if user acitivity service is active. +*/ +bool AutolockUserActivityServicePrivate::isWatching() const +{ + return mActivityManager && mActivityManager->IsActive(); +} + +/*! + Emits signal that user is active. +*/ +void AutolockUserActivityServicePrivate::emitActive() const +{ + emit m_q->active(); +} + +/*! + Emits signal that user is not active. +*/ +void AutolockUserActivityServicePrivate::emitNotActive() const +{ + emit m_q->notActive(); +} diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/autolockuseractivityservice/src/autolockuseractivityservice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/autolockuseractivityservice/src/autolockuseractivityservice.cpp Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: autolockuseractivityservice.cpp +* +*/ + +#include "autolockuseractivityservice.h" +#include "autolockuseractivityservice_p.h" + +/*! + \class AutolockUserActivityService + \brief ?brier_description + + ?Qt_style_documentation +*/ + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor. +*/ +AutolockUserActivityService::AutolockUserActivityService() : + m_d(new AutolockUserActivityServicePrivate(this)) +{ + m_d->watch(true); +} + +/*! + Destructor. +*/ +AutolockUserActivityService::~AutolockUserActivityService() +{ + delete m_d; +} + +/*! + Sets the inactivity period after which to emit signal of inactivity. + \param seconds after which inactivity is detected. +*/ +void AutolockUserActivityService::setInactivityPeriod(int seconds) +{ + m_d->setInactivityPeriod(seconds); +} + +/*! + Retrives the current inactivity period setting. + \retval inactivity period set. +*/ +int AutolockUserActivityService::inactivityPeriod() const +{ + return m_d->inactivityPeriod(); +} diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/autolockuseractivityservice/stub/inc/autolockuseractivityservice_p.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/autolockuseractivityservice/stub/inc/autolockuseractivityservice_p.h Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: autolockuseractivityservice_p.h +* +*/ + +#ifndef AUTOLOCKUSERACTIVITYSERVICEPRIVATE_H +#define AUTOLOCKUSERACTIVITYSERVICEPRIVATE_H + +#include "autolocktest_global.h" + +class QTimer; + +class AutolockUserActivityService; + +class AutolockUserActivityServicePrivate +{ + +public: + + explicit AutolockUserActivityServicePrivate(AutolockUserActivityService *servicePublic); + ~AutolockUserActivityServicePrivate(); + + void setInactivityPeriod(int seconds); + int inactivityPeriod() const; + + void watch(bool shouldWatch); + +private: + + bool isWatching() const; + +private: + + AutolockUserActivityService *m_q; + + QTimer *mActivityTimer; + QTimer *mInactivityTimer; + + int mInactivityPeriod; + SCREENSAVER_TEST_FRIEND_CLASS(T_AutolockUserActivityService) +}; + +#endif // AUTOLOCKUSERACTIVITYSERVICEPRIVATE_H diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/autolockuseractivityservice/stub/src/autolockuseractivityservice_p.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/autolockuseractivityservice/stub/src/autolockuseractivityservice_p.cpp Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: autolockuseractivityservice_p.cpp +* +*/ + +#include "autolockuseractivityservice.h" +#include "autolockuseractivityservice_p.h" + +#include +#include + +// ======== MEMBER FUNCTIONS ======== + +/*! + Constructor. + \param servicePublic public implementation. +*/ +AutolockUserActivityServicePrivate::AutolockUserActivityServicePrivate(AutolockUserActivityService *servicePublic) : + m_q(servicePublic), mInactivityPeriod(9) +{ + mActivityTimer = new QTimer(); + QObject::connect(mActivityTimer, SIGNAL(timeout()), m_q, SIGNAL(active())); + + mInactivityTimer = new QTimer(); + QObject::connect(mInactivityTimer, SIGNAL(timeout()), m_q, SIGNAL(notActive())); +} + +/*! + Destructor. +*/ +AutolockUserActivityServicePrivate::~AutolockUserActivityServicePrivate() +{ + delete mActivityTimer; + delete mInactivityTimer; +} + +/*! + Sets the inactivity period after which to emit signal of inactivity. + \param seconds after which inactivity is detected. +*/ +void AutolockUserActivityServicePrivate::setInactivityPeriod(int seconds) +{ + mInactivityPeriod = seconds; + if (isWatching()) { + mInactivityTimer->start(seconds * 1000); + } +} + +/*! + Retrives the current inactivity period setting. + \retval inactivity period set. +*/ +int AutolockUserActivityServicePrivate::inactivityPeriod() const +{ + return mInactivityPeriod; +} + +/*! + Starts or stops activity manager user activity watching. + \param shouldWatch determines if we shoul start watching or stop watching. +*/ +void AutolockUserActivityServicePrivate::watch(bool shouldWatch) +{ + if (shouldWatch && !isWatching()) { + mActivityTimer->start(5000); + mInactivityTimer->start(mInactivityPeriod * 1000); + } else if (!shouldWatch && isWatching()) { + mActivityTimer->stop(); + mInactivityTimer->stop(); + } +} + +/*! + Checks if activity service is currently watching for user activity. + \retval true if user acitivity service is active. +*/ +bool AutolockUserActivityServicePrivate::isWatching() const +{ + return (mActivityTimer->isActive() || mInactivityTimer->isActive()); +} + + diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/bwins/autolockuseractivityserviceu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/bwins/autolockuseractivityserviceu.def Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,16 @@ +EXPORTS + ?trUtf8@AutolockUserActivityService@@SA?AVQString@@PBD0H@Z @ 1 NONAME ; class QString AutolockUserActivityService::trUtf8(char const *, char const *, int) + ?tr@AutolockUserActivityService@@SA?AVQString@@PBD0@Z @ 2 NONAME ; class QString AutolockUserActivityService::tr(char const *, char const *) + ?trUtf8@AutolockUserActivityService@@SA?AVQString@@PBD0@Z @ 3 NONAME ; class QString AutolockUserActivityService::trUtf8(char const *, char const *) + ?getStaticMetaObject@AutolockUserActivityService@@SAABUQMetaObject@@XZ @ 4 NONAME ; struct QMetaObject const & AutolockUserActivityService::getStaticMetaObject(void) + ?setInactivityPeriod@AutolockUserActivityService@@UAEXH@Z @ 5 NONAME ; void AutolockUserActivityService::setInactivityPeriod(int) + ?tr@AutolockUserActivityService@@SA?AVQString@@PBD0H@Z @ 6 NONAME ; class QString AutolockUserActivityService::tr(char const *, char const *, int) + ?qt_metacast@AutolockUserActivityService@@UAEPAXPBD@Z @ 7 NONAME ; void * AutolockUserActivityService::qt_metacast(char const *) + ??1AutolockUserActivityService@@UAE@XZ @ 8 NONAME ; AutolockUserActivityService::~AutolockUserActivityService(void) + ?qt_metacall@AutolockUserActivityService@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 9 NONAME ; int AutolockUserActivityService::qt_metacall(enum QMetaObject::Call, int, void * *) + ?inactivityPeriod@AutolockUserActivityService@@UBEHXZ @ 10 NONAME ; int AutolockUserActivityService::inactivityPeriod(void) const + ??0AutolockUserActivityService@@QAE@XZ @ 11 NONAME ; AutolockUserActivityService::AutolockUserActivityService(void) + ??_EAutolockUserActivityService@@UAE@I@Z @ 12 NONAME ; AutolockUserActivityService::~AutolockUserActivityService(unsigned int) + ?staticMetaObject@AutolockUserActivityService@@2UQMetaObject@@B @ 13 NONAME ; struct QMetaObject const AutolockUserActivityService::staticMetaObject + ?metaObject@AutolockUserActivityService@@UBEPBUQMetaObject@@XZ @ 14 NONAME ; struct QMetaObject const * AutolockUserActivityService::metaObject(void) const + diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/eabi/autolockuseractivityserviceu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/eabi/autolockuseractivityserviceu.def Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,16 @@ +EXPORTS + _ZN27AutolockUserActivityService11qt_metacallEN11QMetaObject4CallEiPPv @ 1 NONAME + _ZN27AutolockUserActivityService11qt_metacastEPKc @ 2 NONAME + _ZN27AutolockUserActivityService16staticMetaObjectE @ 3 NONAME DATA 16 + _ZN27AutolockUserActivityService19getStaticMetaObjectEv @ 4 NONAME + _ZN27AutolockUserActivityService19setInactivityPeriodEi @ 5 NONAME + _ZN27AutolockUserActivityServiceC1Ev @ 6 NONAME + _ZN27AutolockUserActivityServiceC2Ev @ 7 NONAME + _ZN27AutolockUserActivityServiceD0Ev @ 8 NONAME + _ZN27AutolockUserActivityServiceD1Ev @ 9 NONAME + _ZN27AutolockUserActivityServiceD2Ev @ 10 NONAME + _ZNK27AutolockUserActivityService10metaObjectEv @ 11 NONAME + _ZNK27AutolockUserActivityService16inactivityPeriodEv @ 12 NONAME + _ZTI27AutolockUserActivityService @ 13 NONAME + _ZTV27AutolockUserActivityService @ 14 NONAME + diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/iconnotifier.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/iconnotifier.svg Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,260 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/indicatorplugin/qmakepluginstubs/indicatortestplugin.qtplugin --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/indicatorplugin/qmakepluginstubs/indicatortestplugin.qtplugin Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,1 @@ +This file is a Qt plugin stub file. The real Qt plugin is located in /sys/bin. Created:2010-03-19T16:43:28 diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/indicatortestplugin.zip Binary file securitydialogs/AutolockSrv/indicatortestplugin.zip has changed diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/qtg_large_device_lock.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/qtg_large_device_lock.svg Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/resources/Keyguard_enabled_test.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/resources/Keyguard_enabled_test.svg Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,1949 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/resources/iconnotifier.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/resources/iconnotifier.svg Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,260 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/resources/qtg_large_device_lock.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/resources/qtg_large_device_lock.svg Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/rom/AutolockSrv.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/rom/AutolockSrv.iby Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef __AUTOLOCKSRV_IBY__ +#define __AUTOLOCKSRV_IBY__ + +/* +#include +*/ + +S60_APP_EXE(AutolockSrv) +S60_APP_BITMAP(AutolockSrv) +S60_APP_AIF_RSC(AutolockSrv) +S60_APP_RESOURCE(AutolockSrv) + +file=ABI_DIR\BUILD_DIR\autolockuseractivityservice.dll SHARED_LIB_DIR\autolockuseractivityservice.dll +file=ABI_DIR\BUILD_DIR\IndicatorAutolockPlugin.dll SHARED_LIB_DIR\IndicatorAutolockPlugin.dll + +data=\epoc32\data\z\private\10003a3f\import\apps\AutolockSrv_reg.rsc \epoc32\data\z\private\10003a3f\apps\AutolockSrv_reg.rsc + +file=\epoc32\data\z\private\10003a3f\import\apps\AutolockSrv_reg.rsc \epoc32\data\z\private\10003a3f\apps\AutolockSrv_reg.rsc +data=ZPRIVATE\10003a3f\import\apps\AutolockSrv_reg.rsc private\10003a3f\apps\AutolockSrv_reg.rsc + +#endif // __AUTOLOCKSRV_IBY__ diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/service_conf.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/service_conf.xml Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,11 @@ + + + com.nokia.services.AutolockSrv + No path really + AutolockSrv + + AutolockSrv + 2.0 + Interface to AutolockSrv + + \ No newline at end of file diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/service_conf_new.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/service_conf_new.xml Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,12 @@ + + + com.nokia.services.AutolockSrv + No path + AutolockSrv service + + AutolockSrv + 2.0 + Interface to AutolockSrv + Dial now + + \ No newline at end of file diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/service_conf_old_format.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/service_conf_old_format.xml Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,7 @@ + + + AutolockSrv + + Dial interface + + \ No newline at end of file diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/src/AutolockSrv.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/src/AutolockSrv.cpp Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,1295 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published by +* the Free Software Foundation, version 2.1 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this program. If not, +* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". +* +* Description: +* +*/ + +// #include "xqservicelog.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +QTM_USE_NAMESPACE + +#include +#include + +#include "../../SecUi/inc/SecQueryUi.h" + +#include + +#include + +#include + +#include + +#include "AutolockSrv.h" +#include + +#include "autolockuseractivityservice.h" + +#include // CenRep keys + +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include "../../../inc/securityuisprivatepskeys.h" +#include + +#include + +const TInt KPhoneIndex( 0 ); +const TInt KTriesToConnectServer( 2 ); +const TInt KTimeBeforeRetryingServerConnection( 50000 ); + +#define ESecUiTypeLock 0x00100000 + +_LIT( KMmTsyModuleName, "PhoneTsy"); + + +#define XQSERVICE_DEBUG_PRINT(a) qDebug() << (a) + +AutolockSrv::AutolockSrv(QWidget *parent, Qt::WFlags f) + : QWidget(parent, f), + mService(NULL) +{ + XQSERVICE_DEBUG_PRINT("AutolockSrv::AutolockSrv"); + RDEBUG( "start", 0 ); + mService = new AutolockSrvService(this); + + /* Adjust the palette */ +#if defined(Q_WS_S60) + RDEBUG( "Q_WS_S60", 1 ); + QPalette p = qApp->palette(); + QColor color(192,192,192); + QColor bg(201,250,250); + p.setColor(QPalette::Highlight, color.lighter(200)); + p.setColor(QPalette::Text, Qt::black); + p.setColor(QPalette::Base, bg); + p.setColor(QPalette::WindowText, Qt::black); + p.setColor(QPalette::Window, bg); + p.setColor(QPalette::ButtonText, Qt::black); + p.setColor(QPalette::Button, color.lighter(150)); + p.setColor(QPalette::Link, QColor(240,40,40)); + + qApp->setPalette(p); +#endif + + QPushButton *unlockButton = new QPushButton(tr("Unlock")); + QPushButton *unguardButton = new QPushButton(tr("Unguard")); + QPushButton *lockButton = new QPushButton(tr("Lock")); + QPushButton *quitButton = new QPushButton(tr("Quit")); + QPushButton *test1Button = new QPushButton(tr("Autolock 10 seconds")); + QPushButton *test2Button = new QPushButton(tr("Autolock never")); + connect(quitButton, SIGNAL(clicked()), this, SLOT(quit())); + connect(lockButton, SIGNAL(clicked()), this, SLOT(lockAction())); + connect(unlockButton, SIGNAL(clicked()), this, SLOT(unlockAction())); + connect(unguardButton, SIGNAL(clicked()), this, SLOT(unguardAction())); + connect(test1Button, SIGNAL(clicked()), this, SLOT(test1Action())); + connect(test2Button, SIGNAL(clicked()), this, SLOT(test2Action())); + RDEBUG( "connect", 1 ); + + /* there's no use for this */ + /* + bool isService = XQServiceUtil::isService(); + + QString t = "SERVICEAPP:\n"; + t = t + (isService ? " LAUNCHED AS SERVICE\n" : " LAUNCHED NORMALLY\n"); + t = t + (XQServiceUtil::isEmbedded() ? " EMBEDDED\n" : " NOT EMBEDDED\n"); + + QStringList args = QApplication::arguments(); + foreach (QString arg, args) + { + t += "cmdline arg=" + arg + "\n"; + } + + QLabel *title = new QLabel(t); + */ + + mLabel = new QLabel(""); + mNumberEdit = new QLineEdit(""); + + QVBoxLayout *vl = new QVBoxLayout; + + vl->setMargin(0); + vl->setSpacing(0); + + vl->addWidget(lockButton); + vl->addWidget(unlockButton); + vl->addWidget(unguardButton); + vl->addWidget(quitButton); + vl->addWidget(test1Button); + vl->addWidget(test2Button); + RDEBUG( "added test2Button", 1 ); + + mLabelIcon = new QToolButton; + mLabelIcon->setIcon(QIcon(":/AutolockSrv_hbicon/qtg_large_device_lock.svg")); + mLabelIcon->setIconSize(QSize(300,300)); + + vl->addWidget(mLabelIcon); + RDEBUG( "added mLabelIcon", 1 ); + +/* vl->addItem(title); + vl->addWidget(mLabel); + vl->addWidget(mNumberEdit); +*/ + setLayout(vl); + +#if defined(Q_WS_X11) || defined(Q_WS_WIN) + setFixedSize(QSize(360,640)); // nHD +#elif defined(Q_WS_S60) + // showMaximized(); + showFullScreen(); +#endif + mLabelIcon_visible=1; + serviceKeyguard = new AutolockUserActivityService(); + serviceDevicelock = new AutolockUserActivityService(); + + TInt lockValue = 0; + TInt lightsTimeout = 0; + CRepository* repository; + TInt cRresult=0; + + iLockStatusPrev=ELockNotActive; + iLockStatus=ELockNotActive; + repository = CRepository::NewL(KCRUidSecuritySettings); + cRresult = repository->Get(KSettingsAutolockStatus, lockValue); + RDEBUG( "KSettingsAutolockStatus", KSettingsAutolockStatus ); + RDEBUG( "cRresult", cRresult ); + RDEBUG( "lockValue", lockValue ); + iLockStatus = lockValue; + // the settings says to lock + delete repository; + + adjustInactivityTimers(0); + + repository = CRepository::NewL(KCRUidProfileEngine); + cRresult = repository->Get(KProEngActiveProfile, lightsTimeout); + delete repository; + + repository = CRepository::NewL(KCRUidLightSettings); + cRresult = repository->Get(KDisplayLightsTimeout, lightsTimeout); + delete repository; + + // TODO flip + + subscriberKSettingsAutolockStatus = new QValueSpaceSubscriber("/KCRUidSecuritySettings/KSettingsAutolockStatus", this); + connect(subscriberKSettingsAutolockStatus, SIGNAL(contentsChanged()), this, SLOT(subscriberKSettingsAutolockStatusChanged())); + subscriberKSettingsAutoLockTime = new QValueSpaceSubscriber("/KCRUidSecuritySettings/KSettingsAutoLockTime", this); + connect(subscriberKSettingsAutoLockTime, SIGNAL(contentsChanged()), this, SLOT(subscriberKSettingsAutoLockTimeChanged())); + subscriberKSettingsAutomaticKeyguardTime = new QValueSpaceSubscriber("/KCRUidSecuritySettings/KSettingsAutomaticKeyguardTime", this); + connect(subscriberKSettingsAutomaticKeyguardTime, SIGNAL(contentsChanged()), this, SLOT(subscriberKSettingsAutomaticKeyguardTimeChanged())); + subscriberKDisplayLightsTimeout = new QValueSpaceSubscriber("/KCRUidLightSettings/KDisplayLightsTimeout", this); + connect(subscriberKDisplayLightsTimeout, SIGNAL(contentsChanged()), this, SLOT(subscriberKDisplayLightsTimeoutChanged())); + subscriberKProEngActiveProfile = new QValueSpaceSubscriber("/KCRUidProfileEngine/KProEngActiveProfile", this); + connect(subscriberKProEngActiveProfile, SIGNAL(contentsChanged()), this, SLOT(subscriberKProEngActiveProfileChanged())); + + + TSecurityPolicy readPolicy( ECapabilityReadDeviceData ); + TSecurityPolicy writePolicy( ECapabilityWriteDeviceData ); + TInt ret = RProperty::Define( KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, RProperty::EInt, readPolicy, writePolicy ); + RDEBUG( "defined KSecurityUIsSecUIOriginatedQuery", ret ); + ret = RProperty::Define( KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, RProperty::EInt, readPolicy, writePolicy ); + RDEBUG( "defined KSecurityUIsQueryRequestCancel", ret ); + + _LIT_SECURITY_POLICY_PASS(KReadPolicy); + _LIT_SECURITY_POLICY_C1(KWritePolicy, ECapabilityWriteDeviceData); + ret = RProperty::Define( KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, RProperty::EInt, KReadPolicy, KWritePolicy); + RDEBUG( "defined KCoreAppUIsAutolockStatus", ret ); + + ret = RProperty::Define(KPSUidAvkonDomain, KAknKeyguardStatus, RProperty::EInt, TSecurityPolicy(TSecurityPolicy::EAlwaysPass), KWritePolicy); + RDEBUG( "defined KAknKeyguardStatus", ret ); + + // inactivity + connect(serviceKeyguard, SIGNAL(active()), this, SLOT(activeKeyguard()) ); + connect(serviceKeyguard, SIGNAL(notActive()), this, SLOT(notActiveKeyguard()) ); + connect(serviceDevicelock, SIGNAL(active()), this, SLOT(activeDevicelock()) ); + connect(serviceDevicelock, SIGNAL(notActive()), this, SLOT(notActiveDevicelock()) ); + + RWindowGroup& groupWin=CEikonEnv::Static()->RootWin(); + RDEBUG( "got groupWin", 1 ); + // TODO if I want to release, I should do: mKeyCaptureHandle = env->RootWin().CaptureKey(EKeyBackspace, 0, 0); + groupWin.CaptureKey(EKeyBackspace,0,0); + groupWin.CaptureKey(EKeyDeviceF,0,0); + groupWin.CaptureKey(EKeyBell,0,0); + groupWin.CaptureKey(EKeyTab,0,0); + groupWin.CaptureKey(EKeyInsert,0,0); + RDEBUG( "got mKeyCaptureHandle", 1 ); + + iSecQueryUiCreated=-1; + iDeviceDialogCreated = -1; + // TODO for now, always starts unlocked + // TryChangeStatus(iLockStatus); + TryChangeStatus(ELockNotActive); + lower(); + hide(); + // not needed: new AutolockSrvService(this); +} + + +AutolockSrv::~AutolockSrv() +{ + RDEBUG( "0", 0 ); + delete mService; +} + +void AutolockSrv::adjustInactivityTimers(int aReason) +{ + RDEBUG( "aReason", aReason ); + TInt keyguardTime = 0; + TInt lockTime = 0; + CRepository* repository; + TInt cRresult = 0; + + repository = CRepository::NewL(KCRUidSecuritySettings); + cRresult = repository->Get(KSettingsAutoLockTime, lockTime); + RDEBUG( "KSettingsAutoLockTime", KSettingsAutoLockTime ); + RDEBUG( "cRresult", cRresult ); + RDEBUG( "lockTime", lockTime ); + if(lockTime>0 && lockTime<1000) + { + serviceDevicelock->setInactivityPeriod(lockTime); + } + else + { + serviceDevicelock->setInactivityPeriod(12*31*24*60*60); + } + + cRresult = repository->Get(KSettingsAutomaticKeyguardTime, keyguardTime); + RDEBUG( "KSettingsAutomaticKeyguardTime", KSettingsAutomaticKeyguardTime ); + RDEBUG( "cRresult", cRresult ); + RDEBUG( "keyguardTime", keyguardTime ); + if(keyguardTime>0 && keyguardTime<1000) + { + serviceKeyguard->setInactivityPeriod(keyguardTime); + } + else + { + serviceKeyguard->setInactivityPeriod(12*31*24*60*60); + } + delete repository; +} +void AutolockSrv::quit() +{ + RDEBUG( "0", 0 ); + qApp->quit(); +} + +// from the button +void AutolockSrv::unlockAction() +{ + RDEBUG( "0", 0 ); + TryChangeStatus(ELockAppDisableDevicelock); +} + +void AutolockSrv::unguardAction() +{ + RDEBUG( "0", 0 ); + TryChangeStatus(ELockAppDisableKeyguard); +} + +void AutolockSrv::test1Action() +{ + RDEBUG( "Set(KSettingsAutoLockTime, 30000)", 30000 ); + + CRepository* repositorySet = CRepository::NewL(KCRUidSecuritySettings); + repositorySet->Set(KSettingsAutoLockTime, 10); + delete repositorySet; +} + +void AutolockSrv::test2Action() +{ + RDEBUG( "Set(KSettingsAutoLockTime, 20000)", 20000 ); + + CRepository* repositorySet = CRepository::NewL(KCRUidSecuritySettings); + repositorySet->Set(KSettingsAutoLockTime, 0); + delete repositorySet; +} + +int AutolockSrv::AskValidSecCode(int aReason) +{ + RDEBUG( "aReason", aReason ); +RMobilePhone iPhone; // NULL in emulator + +#ifdef __WINS__1 +return KErrNone; +#endif + +TInt err( KErrGeneral); +TBool validCode(EFalse); +TInt thisTry( 0); +RTelServer iTelServer; + +RMmCustomAPI iCustomPhone; +while ( ( err = iTelServer.Connect() ) != KErrNone && ( thisTry++ ) <= KTriesToConnectServer ) + { + User::After( KTimeBeforeRetryingServerConnection ); + } +err = iTelServer.LoadPhoneModule( KMmTsyModuleName ); +RTelServer::TPhoneInfo PhoneInfo; + RDEBUG( "err", err ); +err = iTelServer.SetExtendedErrorGranularity( RTelServer::EErrorExtended ) ; + RDEBUG( "err", err ); +err = iTelServer.GetPhoneInfo( KPhoneIndex, PhoneInfo ) ; + RDEBUG( "err", err ); +err = iPhone.Open( iTelServer, PhoneInfo.iName ) ; + RDEBUG( "err", err ); +err = iCustomPhone.Open( iPhone ) ; + RDEBUG( "err", err ); + + RDEBUG( "CSecurityHandler", 0 ); +CSecurityHandler* handler = new(ELeave) CSecurityHandler(iPhone); +if(aReason==ELockAppDisableDevicelock) + { + RDEBUG( "calling AskSecCodeInAutoLockL", 0 ); + validCode = handler->AskSecCodeInAutoLockL(); // this returns true/false + // TODO should this also do iPhone.SetLockSetting(status, lockType, lockChange); ??? + } +else if(aReason==ELockAppEnableDevicelock) + { + // check whether code is really needed + RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; + RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; + RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); + RMobilePhone::TMobilePhoneLockSetting lockChange(RMobilePhone::ELockSetDisabled); + TRequestStatus status = KRequestPending; + TInt ret=KErrNone; + RDEBUG( "GetLockInfo", 0 ); + iPhone.GetLockInfo(status, lockType, lockInfoPkg); + RDEBUG( "WaitForRequest", 0 ); + User::WaitForRequest( status ); + ret = status.Int(); + RDEBUG( "WaitForRequest ret", ret ); + #ifdef __WINS__ + if(ret==KErrTimedOut) + { + ret = KErrNone; + lockInfo.iSetting = RMobilePhone::ELockSetDisabled; // ask password only if there's no timeout. + } + #endif + if(ret==KErrNone) + { + RDEBUG( "lockInfo.iSetting", lockInfo.iSetting ); + RDEBUG( "RMobilePhone::ELockSetDisabled", RMobilePhone::ELockSetDisabled ); + if(lockInfo.iSetting == RMobilePhone::ELockSetDisabled) // ask password only if there's no timeout + { + lockChange = RMobilePhone::ELockSetEnabled; + RDEBUG( "SetLockSetting lockChange", lockChange ); + #define OLD_METHODx + #ifdef OLD_METHOD + status = KRequestPending; + RDEBUG( "SetLockSetting", 0 ); + iPhone.SetLockSetting(status, lockType, lockChange); // ask for PassPhraseRequiredL + RDEBUG( "WaitForRequestL", 0 ); + User::WaitForRequest( status ); // TODO this waits 33 seconds in WINS and returns ffffffdf = KErrTimedOut + ret = status.Int(); + RDEBUG( "WaitForRequestL ret", ret ); + #else + RDEBUG( "! OLD_METHOD", 0 ); + CWait *iWait = NULL; + iWait = CWait::NewL(); + iWait->SetRequestType(EMobilePhoneSetLockSetting); + iPhone.SetLockSetting(iWait->iStatus, lockType, lockChange); // ask for PassPhraseRequiredL + RDEBUG( "WaitForRequestL", 0 ); + ret = iWait->WaitForRequestL(); + RDEBUG( "WaitForRequestL ret", ret ); + if(iWait) + { + RDEBUG( "IsActive", 0 ); + if(iWait->IsActive()) + { + RDEBUG( "CancelAsyncRequest", 0 ); + iPhone.CancelAsyncRequest(iWait->GetRequestType()); + RDEBUG( "cancelled", 0 ); + } + } + delete iWait; + #endif + + RDEBUG( "WaitForRequestL ret", ret ); + #ifdef __WINS__ + if(ret==KErrTimedOut) + ret = KErrNone; + #endif + if(ret==KErrNone) + validCode = 1; + else + validCode = 0; + } + else + validCode = 0x20; + } + else + validCode = 0x21; + + /* Alternative way to ask for password + RMobilePhone::TMobilePhoneSecurityEvent iEvent; + TInt result = KErrNone; + iEvent = RMobilePhone::EPhonePasswordRequired; + RDEBUG( "calling HandleEventL", 0 ); + handler->HandleEventL(iEvent, result); // this is supposed to wait + validCode = false; + if(result) + validCode = true; + RDEBUG( "result", result ); + */ + } +// TODO this doesn't wait on WINS , so how do I get the Acceptation? + RDEBUG( "validCode (true/false)", validCode ); +if(validCode) + return KErrNone; +return KErrCancel; +} + +void AutolockSrv::lockAction() +{ + RDEBUG( "0", 0 ); + + XQSERVICE_DEBUG_PRINT("AutolockSrv::lockAction"); + TryChangeStatus(ELockAppOfferDevicelock); + +} + +void AutolockSrv::handleAnswerDelivered() +{ + RDEBUG( "This should never be called", 0 ); + // quit(); + +} + + +void AutolockSrv::endCall() +{ + RDEBUG( "This should never be called", 0 ); + //QVBoxLayout *vl = qobject_cast(layout()) ; + //vl->removeWidget(mEndCallButton); + + //XQServiceUtil::toBackground(true); +} + +void AutolockSrv::setLabelNumber(QString label,QString number) +{ + RDEBUG( "0", 0 ); + mLabel->setText("mLabel=" + label); + mNumberEdit->setText("mNumberEdit=" + number); +} + +void AutolockSrv::DebugRequest(int aReason) +{ + switch(aReason) + { + case ELockAppEnableKeyguard: + RDEBUG( "ELockAppEnableKeyguard", aReason ); + break; + case ELockAppDisableKeyguard: + RDEBUG( "ELockAppDisableKeyguard", aReason ); + break; + case ELockAppEnableDevicelock: + RDEBUG( "ELockAppEnableDevicelock", aReason ); + break; + case ELockAppDisableDevicelock: + RDEBUG( "ELockAppDisableDevicelock", aReason ); + break; + case ELockAppOfferKeyguard: + RDEBUG( "ELockAppOfferKeyguard", aReason ); + break; + case ELockAppOfferDevicelock: + RDEBUG( "ELockAppOfferDevicelock", aReason ); + break; + case ELockAppShowKeysLockedNote: + RDEBUG( "ELockAppShowKeysLockedNote", aReason ); + break; + default: + RDEBUG( "default", aReason ); + break; + } +} +void AutolockSrv::DebugStatus(int aReason) +{ + switch(aReason) + { + case ELockNotActive: + RDEBUG( "ELockNotActive", aReason ); + break; + case EKeyguardActive: + RDEBUG( "EKeyguardActive", aReason ); + break; + case EDevicelockActive: + RDEBUG( "EDevicelockActive", aReason ); + break; + default: + RDEBUG( "default", aReason ); + break; + } +} +void AutolockSrv::DebugError(int aReason) +{ + switch(aReason) + { + case KErrPermissionDenied: + RDEBUG( "KErrPermissionDenied", aReason ); + break; + case KErrNone: + RDEBUG( "KErrNone", aReason ); + break; + case KErrAlreadyExists: + RDEBUG( "KErrAlreadyExists", aReason ); + break; + default: + RDEBUG( "default", aReason ); + break; + } +} + +int AutolockSrv::CheckIfLegal(int aReason) +{ + RDEBUG( "aReason", aReason ); + switch ( aReason ) + { + case ELockAppEnableKeyguard: + { + RDEBUG( "ELockAppEnableKeyguard iLockStatus", iLockStatus ); + switch ( iLockStatus ) + { + case ELockNotActive: + if ( 1==0 ) // !CKeyLockPolicyApi::KeyguardAllowed() ) + return KErrPermissionDenied; + else + return KErrNone; + case EKeyguardActive: + return KErrAlreadyExists; + case EDevicelockActive: + return KErrPermissionDenied; + } + } + break; + case ELockAppDisableKeyguard: + { + RDEBUG( "ELockAppDisableKeyguard iLockStatus", iLockStatus ); + switch ( iLockStatus ) + { + case ELockNotActive: + return KErrAlreadyExists; + case EKeyguardActive: + return KErrNone; + case EDevicelockActive: + return KErrPermissionDenied; + } + } + break; + case ELockAppEnableDevicelock: + { + RDEBUG( "ELockAppEnableDevicelock iLockStatus", iLockStatus ); + switch ( iLockStatus ) + { + case ELockNotActive: + return KErrNone; + case EKeyguardActive: + return KErrNone; + case EDevicelockActive: + return KErrAlreadyExists; + } + } + break; + case ELockAppDisableDevicelock: + { + RDEBUG( "ELockAppDisableDevicelock iLockStatus", iLockStatus ); + switch ( iLockStatus ) + { + case ELockNotActive: + return KErrAlreadyExists; + case EKeyguardActive: + return KErrPermissionDenied; + case EDevicelockActive: + return KErrNone; + } + } + break; + case ELockAppOfferKeyguard: + { + RDEBUG( "ELockAppOfferKeyguard iLockStatus", iLockStatus ); + switch ( iLockStatus ) + { + case ELockNotActive: + return KErrNone; + case EKeyguardActive: + return KErrPermissionDenied; + case EDevicelockActive: + return KErrPermissionDenied; + } + } + break; + case ELockAppOfferDevicelock: + { + RDEBUG( "ELockAppOfferDevicelock iLockStatus", iLockStatus ); + switch ( iLockStatus ) + { + case ELockNotActive: + return KErrNone; + case EKeyguardActive: + return KErrNone; + case EDevicelockActive: + return KErrAlreadyExists; + } + } + break; + case ELockAppShowKeysLockedNote: + { + RDEBUG( "ELockAppShowKeysLockedNote iLockStatus", iLockStatus ); + switch ( iLockStatus ) + { + case ELockNotActive: + return KErrPermissionDenied; + case EKeyguardActive: + return KErrNone; + case EDevicelockActive: + return KErrPermissionDenied; + } + } + break; + default: + { + RDEBUG( "default iLockStatus", iLockStatus ); + return KErrPermissionDenied; + } + // break; + } // switch + return KErrPermissionDenied; +} + +int AutolockSrv::publishStatus(int aReason) +{ + RDEBUG( "aReason", aReason ); +const TUid KCRUidCoreApplicationUIsSysAp = { 0x101F8765 }; +const TUint32 KSysApKeyguardActive = 0x00000001; +CRepository* repositoryDevicelock; +CRepository* repositoryKeyguard; +repositoryDevicelock = CRepository::NewL(KCRUidSecuritySettings); +repositoryKeyguard = CRepository::NewL(KCRUidSecuritySettings); +TInt cRresult; + + if(1==1) + { + RDEBUG( "publishing", aReason ); + if(aReason==ELockNotActive) + { + RProperty::Set(KPSUidAvkonDomain, KAknKeyguardStatus, EKeyguardNotActive); + RProperty::Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EAutolockOff); + // cRresult = repositoryDevicelock->Set(KSettingsAutolockStatus, 0); // the settings remains. Only ISA changes, as well as the P&S + cRresult = repositoryKeyguard->Set(KSysApKeyguardActive, 0); + } + if(1==0) + { + if(aReason==EKeyguardActive) + { + RProperty::Set(KPSUidAvkonDomain, KAknKeyguardStatus, EKeyguardLocked); + RProperty::Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EAutolockOff); + // cRresult = repositoryDevicelock->Set(KSettingsAutolockStatus, 0); + cRresult = repositoryKeyguard->Set(KSysApKeyguardActive, 1); + } + else if(aReason>=EDevicelockActive) + { + RProperty::Set(KPSUidAvkonDomain, KAknKeyguardStatus, EKeyguardNotActive); // EKeyguardLocked sure? maybe EKeyguardNotActive ? + RProperty::Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EManualLocked); + // cRresult = repositoryDevicelock->Set(KSettingsAutolockStatus, 1); + cRresult = repositoryKeyguard->Set(KSysApKeyguardActive, 0); // keyguard disabled, so that user can type and DeviceF can be captured + } + } + } +delete repositoryDevicelock; +delete repositoryKeyguard; +// this is the real point where everything is done. +iLockStatusPrev = iLockStatus; +iLockStatus = aReason; + RDEBUG( "setting iLockStatus", iLockStatus ); +return KErrNone; +} +/********************/ +int AutolockSrv::showNoteIfRequested(int aReason) +{ + RDEBUG( "aReason", aReason ); + + if(aReason==ELockNotActive) + { + if(iShowKeyguardNote==1) + { + HbDeviceMessageBox::information ("Keyguard deactivated"); + } + } + else if(aReason==EKeyguardActive) + { + if(iShowKeyguardNote==1) + { + HbDeviceMessageBox::information ("Keyguard activated"); + } + } + else if(aReason>=EDevicelockActive) // this doesn't happen, but we are prepared nevertheless + { + if(iShowKeyguardNote==1) + { + HbDeviceMessageBox::information ("Devicelock activated"); + } + } +return KErrNone; +} +/***********************/ +int AutolockSrv::TryChangeStatus(int aReason) +{ + RDEBUG( "aReason", aReason ); + int ret = aReason; + int errorInProcess = KErrNone; + DebugRequest(ret); + + switch(ret) + { + case ELockAppEnableKeyguard: // 1 + { + errorInProcess = CheckIfLegal(ret); + DebugError(errorInProcess); + if(errorInProcess==KErrNone) + { + setLabelIcon(EKeyguardActive); + updateIndicator(EKeyguardActive); + publishStatus(EKeyguardActive); + showNoteIfRequested(EKeyguardActive); + } + } + break; + case ELockAppDisableKeyguard: // 2 + { + errorInProcess = CheckIfLegal(ret); + DebugError(errorInProcess); + if(errorInProcess==KErrNone) + { + setLabelIcon(ELockNotActive); + updateIndicator(ELockNotActive); + publishStatus(ELockNotActive); + showNoteIfRequested(ELockNotActive); + } + } + break; + case ELockAppEnableDevicelock: // 3 + { + errorInProcess = CheckIfLegal(ret); + DebugError(errorInProcess); + if(errorInProcess==KErrNone) + { + if(!callerHasECapabilityWriteDeviceData) // check permissions for calling process, because doesn't AskValidSecCode + errorInProcess=KErrPermissionDenied; + DebugError(errorInProcess); + } + if(errorInProcess==KErrNone) + { + updateIndicator(EDevicelockActive); + publishStatus(EDevicelockActive); + setLabelIcon(EDevicelockActive); + setLockDialog(aReason, 1); + } + // aParam1 is aReason : EDevicelockManual, EDevicelockRemote + // this never shows a note + } + break; + case ELockAppDisableDevicelock: // 4 + { + errorInProcess = CheckIfLegal(ret); + DebugError(errorInProcess); + if(errorInProcess==KErrNone) + { + if(!callerHasECapabilityWriteDeviceData) // check permissions for calling process, because doesn't AskValidSecCode + errorInProcess=KErrPermissionDenied; + DebugError(errorInProcess); + } + if(errorInProcess==KErrNone) + { + RDEBUG( " calling HbDeviceMessageBox::question", 0 ); + bool value = HbDeviceMessageBox::question("Disable Lock?"); + RDEBUG( "value", value ); + if(!value) + errorInProcess = KErrCancel; + } + if(errorInProcess==KErrNone) + { + setLockDialog(aReason, 0); // hide temporarilly because AskValidSecCode doesn't get in top of the Lock-icon. Thus, dismiss it. + RDEBUG( "calling AskValidSecCode", 0 ); + errorInProcess=AskValidSecCode(ELockAppDisableDevicelock); + RDEBUG( "errorInProcess", errorInProcess ); + } + if(errorInProcess==KErrNone) + { + setLabelIcon(ELockNotActive); + updateIndicator(ELockNotActive); + publishStatus(ELockNotActive); + } + if(errorInProcess!=KErrNone) + { // re-lock. For example, if password is wrong + setLockDialog(aReason, 1); + } + // this never shows a note + } + break; + case ELockAppOfferKeyguard: // 5 + { + errorInProcess = CheckIfLegal(ret); + DebugError(errorInProcess); + if(errorInProcess==KErrNone) + { + bool value = HbDeviceMessageBox::question("Enable Keyguard?"); + // TODO what about a nice icon? + RDEBUG( "value", value ); + if(!value) + errorInProcess = KErrCancel; + } + if(errorInProcess==KErrNone) + { + errorInProcess = TryChangeStatus(ELockAppEnableKeyguard); + } + // this never shows a note + } + break; + case ELockAppOfferDevicelock: // 6 + { + errorInProcess = CheckIfLegal(ret); + DebugError(errorInProcess); + setLockDialog(aReason, 0); // hide temporarilly because AskValidSecCode doesn't get in top of the Lock-icon. Thus, dismiss it. + errorInProcess=AskValidSecCode(ELockAppEnableDevicelock); + if(errorInProcess==KErrNone) + { + errorInProcess = TryChangeStatus(ELockAppEnableDevicelock); + } + // this never shows a note. Perhaps ELockAppEnableDevicelock does. + } + break; + case ELockAppShowKeysLockedNote: + { + iShowKeyguardNote=1; // this is not sent as parameter, so we need to fake it: ON + showNoteIfRequested(EKeyguardActive); + } + break; + default: + RDEBUG( "default", ret ); + errorInProcess = KErrNotSupported; + break; + + } + return errorInProcess; +} +/**************************/ +int AutolockSrv::setLockDialog(int aReason, int status) +{ + RDEBUG( "aReason", aReason ); + RDEBUG( "status", status ); + RDEBUG( "iDeviceDialogCreated", iDeviceDialogCreated ); + if(status==0) // hide + { + if(iDeviceDialogCreated>0) + { + iDeviceDialogCreated = 0; + iDeviceDialog->cancel(); + } + } + else if(status==1) // show + { + QVariantMap params; + TBool err; + #define ESecUiTypeDeviceLock 0x00100000 + #define ESecUiTypeKeyguard 0x00200000 + + if(aReason==EKeyguardActive) + params.insert("type", ESecUiTypeKeyguard); + else if(aReason>=EDevicelockActive) + params.insert("type", ESecUiTypeDeviceLock); + else + { + RDEBUG( "error. status=1 but aReason", aReason ); + } + // no need for title. Icon should be explicit enough + // params.insert("title", "Locked"); + if(iDeviceDialogCreated<=0) + { + RDEBUG( "creating iDeviceDialog", 0 ); + iDeviceDialog = new HbDeviceDialog(HbDeviceDialog::NoFlags, this); + iDeviceDialogCreated = 1; + } + else + { + RDEBUG( "raising iDeviceDialog", 0 ); + // confirm that dialog is present + err = iDeviceDialog->error(); + RDEBUG( "err", err ); + iDeviceDialogCreated = 2; + } + const QString KSecQueryUiDeviceDialog("com.nokia.secuinotificationdialog/1.0"); + RDEBUG( "pre show", aReason ); + err = iDeviceDialog->show( KSecQueryUiDeviceDialog, params ); + RDEBUG( "post show. err", err ); + err = iDeviceDialog->error(); + RDEBUG( "err", err ); + } + else + { + RDEBUG( "unknown status", status ); + return KErrNotSupported; + } +return KErrNone; +} +void AutolockSrv::setLabelIcon(int aReason) +{ + RDEBUG( "aReason", aReason ); + + if(aReason==ELockNotActive) + { + mLabelIcon->setVisible(false); + setLockDialog(aReason, 0); // TODO isn't this done already at TryChangeStatus ??? + lower(); + hide(); + } + else if(aReason==EKeyguardActive) + { + mLabelIcon->setVisible(true); + setLockDialog(aReason, 1); + raise(); // not repaint(), not show() , not setVisible(true), not showFullScreen() , not ??? + show(); + } + else if(aReason==EDevicelockActive) + { + mLabelIcon->setVisible(true); + raise(); + show(); + } + else + { + RDEBUG( "error: aReason", aReason ); + } +} + +int AutolockSrv::updateIndicator(int aReason) +{ + RDEBUG( "aReason", aReason ); + QList list; + list.insert(0, 1); + list.insert(1, "aaa"); + list.insert(2, 2); + + HbIndicator indicator; + bool success; + if(aReason==ELockNotActive) + success = indicator.deactivate("com.nokia.hb.indicator.autolocksrv.autolocksrv_8/1.0"); // maybe it's already deactivated. Not a problem + else if(aReason==EKeyguardActive) + success = indicator.activate("com.nokia.hb.indicator.autolocksrv.autolocksrv_8/1.0"); + else if(aReason==EDevicelockActive) + success = indicator.activate("com.nokia.hb.indicator.autolocksrv.autolocksrv_8/1.0"); // same. We have just 1 indicator + else + success = 0; + RDEBUG( "success", success ); + return success; +} + +void AutolockSrv::activeKeyguard() +{ + // activity while keyguarded. Nothing to do + RDEBUG( "0", 0 ); +} + +void AutolockSrv::notActiveKeyguard() +{ + // inactivity. Keyguard should be activated + RDEBUG( "0", 0 ); + int ret = 0; + DebugStatus(iLockStatus); + if(iLockStatus==ELockNotActive) // not possible if it's keyguarded, or locked + { + ret = TryChangeStatus(ELockAppEnableKeyguard); + } +} + +void AutolockSrv::activeDevicelock() +{ + RDEBUG( "0", 0 ); +} + +void AutolockSrv::notActiveDevicelock() +{ + // inactivity. Devicelock should be activated + RDEBUG( "0", 0 ); + int ret = 0; + DebugStatus(iLockStatus); + if(iLockStatus==ELockNotActive || iLockStatus==EKeyguardActive ) // not possible if it's locked + { + ret = TryChangeStatus(ELockAppEnableDevicelock); + } +} + +// some key is pressed +bool AutolockSrv::event(QEvent *ev) +{ + if (ev) + { + int isSwitchKey=0; + // on device, this doesn't seem to get the EKeyDeviceF key: only 1ffffff + if (ev->type() == QEvent::KeyPress){ + QKeyEvent *keyEvent = static_cast(ev); + qDebug() << QString("KeyPress:%1\n").arg(keyEvent->key(), 0, 16) ; + qDebug() << keyEvent->key(); + qDebug() << EKeyInsert; + qDebug() << (keyEvent->key()&0xFF); + qDebug() << (EKeyInsert&0xFF); + if((keyEvent->key()&0xFF) == (EKeyInsert&0xFF)) + { + qDebug() << "pressed EKeyInsert"; + // only reacts on release, not on press + isSwitchKey=1; + } + if((keyEvent->key()&0xFF) == (EKeyTab&0xFF)) + { + qDebug() << "pressed EKeyTab"; + } + if((keyEvent->key()&0xFF) == (EKeyDeviceF&0xFF)) + { + qDebug() << "pressed EKeyDeviceF"; + } + if( keyEvent->key() ==0x1ffffff ) + { + qDebug() << "pressed EKeyDeviceF-1ffffff"; + isSwitchKey=1; + } + } + else if (ev->type() == QEvent::KeyRelease) + { + QKeyEvent *keyEvent = static_cast(ev); + qDebug() << QString("KeyRelease:%1\n").arg(keyEvent->key(), 0, 16) ; + if( keyEvent->key() ==0x1ffffff ) + { + RDEBUG( "released EKeyDeviceF-1ffffff", 1 ); + // isSwitchKey=1; this should happen is pressed was not processed (hint: if it is/was in background) + } + } + RDEBUG( "isSwitchKey", isSwitchKey ); + if(isSwitchKey) + { + int ret; + DebugStatus(iLockStatus); + if(iLockStatus==ELockNotActive) + { + iShowKeyguardNote = 1; // note on enable keyguard + ret = TryChangeStatus(ELockAppEnableKeyguard); // this should not ask confirmation + } + else if(iLockStatus==EKeyguardActive) + { + iShowKeyguardNote = 1; // note on disable keyguard + ret = TryChangeStatus(ELockAppDisableKeyguard); + } + else if(iLockStatus==EDevicelockActive) + { + ret = TryChangeStatus(ELockAppDisableDevicelock); + } + } // isSwitchKey + } // ev + // Process if not done before. For example, redraw or quit + return QWidget::event(ev); +} + +bool AutolockSrv::eventFilter(QObject *o, QEvent *ev) +{ + // this never happens + RDEBUG( "0", 0 ); + return QWidget::eventFilter(o, ev); + +} + +void AutolockSrv::subscriberKSettingsAutolockStatusChanged() + { + RDEBUG( "0", 0 ); + QVariant v = subscriberKSettingsAutolockStatus->value("/KCRUidSecuritySettings/KSettingsAutolockStatus"); + adjustInactivityTimers(KSettingsAutolockStatus); + qDebug() << "AutolockSrv::subscriberKSettingsAutolockStatusChanged" << v; + } +void AutolockSrv::subscriberKSettingsAutoLockTimeChanged() + { + RDEBUG( "0", 0 ); + QVariant v = subscriberKSettingsAutoLockTime->value("/KCRUidSecuritySettings/KSettingsAutoLockTime"); + adjustInactivityTimers(KSettingsAutoLockTime); + qDebug() << "AutolockSrv::subscriberKSettingsAutoLockTimeChanged" << v; + } +void AutolockSrv::subscriberKSettingsAutomaticKeyguardTimeChanged() + { + RDEBUG( "0", 0 ); + QVariant v = subscriberKSettingsAutomaticKeyguardTime->value("/KCRUidSecuritySettings/KSettingsAutomaticKeyguardTime"); + adjustInactivityTimers(KSettingsAutoLockTime); + qDebug() << "AutolockSrv::subscriberKSettingsAutomaticKeyguardTimeChanged" << v; + } +void AutolockSrv::subscriberKDisplayLightsTimeoutChanged() + { + RDEBUG( "0", 0 ); + QVariant v = subscriberKDisplayLightsTimeout->value("/KCRUidLightSettings/KDisplayLightsTimeout"); + // nothing to do + qDebug() << "AutolockSrv::subscriberKDisplayLightsTimeoutChanged" << v; + } +void AutolockSrv::subscriberKProEngActiveProfileChanged() + { + RDEBUG( "0", 0 ); + QVariant v = subscriberKProEngActiveProfile->value("/KCRUidProfileEngine/KProEngActiveProfile"); + // nothing to do + qDebug() << "AutolockSrv::subscriberKProEngActiveProfileChanged" << v; + } + +// ----------AutolockSrvService--------------- + +AutolockSrvService::AutolockSrvService(AutolockSrv* parent) +: XQServiceProvider(QLatin1String("com.nokia.services.AutolockSrv.AutolockSrv"),parent), + mAutolockSrv(parent), + mAsyncReqId(-1), + mAsyncAnswer(false) +{ + RDEBUG( "0", 0 ); + publishAll(); + connect(this, SIGNAL(returnValueDelivered()), parent, SLOT(handleAnswerDelivered())); +} + +AutolockSrvService::~AutolockSrvService() +{ + RDEBUG( "0", 0 ); +} + +void AutolockSrvService::complete(QString number) +{ + RDEBUG( "0", 0 ); + if (mAsyncReqId == -1) + return; + XQSERVICE_DEBUG_PRINT("AutolockSrvService::complete"); + completeRequest(mAsyncReqId,number.toInt()); +} + +// gor API request +int AutolockSrvService::service(const QString& number, const QString& aParam1, const QString& aParam2 ) +{ + RDEBUG( "0", 0 ); + qDebug() << "number=" << number; + qDebug() << "aParam1=" << aParam1; + qDebug() << "aParam2=" << aParam2; + mAsyncAnswer = false; + XQRequestInfo info = requestInfo(); + QSet caps = info.clientCapabilities(); + + mAutolockSrv->callerHasECapabilityWriteDeviceData=0; + if(caps.contains(ECapabilityWriteDeviceData)) + { + RDEBUG( "callerHasECapabilityWriteDeviceData", ECapabilityWriteDeviceData ); + mAutolockSrv->callerHasECapabilityWriteDeviceData=1; + } + + QString label = "AutolockSrv::service:\n"; + label += QString("number=%1\n").arg(number); + + mNumber = number ; + mAutolockSrv->setLabelNumber(label, number); + int ret = 0; + ret = number.toInt(); + + mAutolockSrv->mParam1 = aParam1.toInt(); + mAutolockSrv->iShowKeyguardNote = aParam1.toInt(); + mAutolockSrv->mParam2 = aParam2.toInt(); + ret = mAutolockSrv->TryChangeStatus(ret); + RDEBUG( "ret", ret ); + return ret; +} + +void AutolockSrvService::handleClientDisconnect() +{ + RDEBUG( "0", 0 ); + // Just quit service application if client ends + mAsyncAnswer = false; + RDEBUG( "0", 0 ); + // mAutolockSrv->quit(); +} + +/****************/ +CWait* CWait::NewL() + { + CWait* self = new(ELeave) CWait(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } +void CWait::ConstructL() + { + CActiveScheduler::Add(this); + } +CWait::CWait() : CActive(0) + { + } +CWait::~CWait() + { + Cancel(); + } +TInt CWait::WaitForRequestL() + { + SetActive(); + iWait.Start(); + return iStatus.Int(); + } +void CWait::RunL() + { + if(iWait.IsStarted()) + iWait.AsyncStop(); + } +void CWait::DoCancel() + { + if(iWait.IsStarted()) + iWait.AsyncStop(); + } +void CWait::SetRequestType(TInt aRequestType) +{ + iRequestType = aRequestType; +} +TInt CWait::GetRequestType() +{ + return iRequestType; +} + diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/src/AutolockSrv.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/src/AutolockSrv.h Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,222 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published by +* the Free Software Foundation, version 2.1 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this program. If not, +* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". +* +* Description: +* +*/ + +#ifndef AUTOLOCKSRV_H +#define AUTOLOCKSRV_H + +#define RDEBUG( x, y ) RDebug::Printf( "%s %s (%u) %s=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, x, y ); +// #define RDEBUG( x, y ) + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "autolockuseractivityservice.h" +#include "../../SecUi/inc/SecQueryUi.h" + +QTM_BEGIN_NAMESPACE + class QValueSpacePublisher; + class QValueSpaceSubscriber; +QTM_END_NAMESPACE +QTM_USE_NAMESPACE + +#include +#include +#include + +enum TLockStatus + { + ELockNotActive = 0, + EKeyguardActive, + EDevicelockActive + }; + +enum TDevicelockReason + { + EDevicelockManual = 1, + EDevicelockRemote, + EDevicelockTimer + }; + + +class QLineEdit; +class QPushButton; +class AutolockSrvService; +class QLabel; +class HbLabel; +class XQSharableFile; + +class AutolockSrv : public QWidget +{ + Q_OBJECT + +public: + AutolockSrv( QWidget *parent = 0, Qt::WFlags f = 0 ); + ~AutolockSrv(); + + void setLabelNumber(QString label,QString number); + void setLabelIcon(int value); + int CheckIfLegal(int value); + void DebugRequest(int value); + void DebugError(int value); + void DebugStatus(int value); + void adjustInactivityTimers(int aReason); + int updateIndicator(int aReason); + int AskValidSecCode(int aReason); + int publishStatus(int aReason); + int TryChangeStatus(int aReason); + int setLockDialog(int aReason, int status); + int showNoteIfRequested(int aReason); + + bool event(QEvent *event); + bool eventFilter(QObject *, QEvent *); + + int callerHasECapabilityWriteDeviceData; + int iShowKeyguardNote; + int mParam1; + int mParam2; + +public slots: + void endCall(); + void quit(); + void unlockAction(); + void unguardAction(); + void lockAction(); + void test1Action(); + void test2Action(); + void handleAnswerDelivered(); + void subscriberKSettingsAutolockStatusChanged(); + void subscriberKSettingsAutoLockTimeChanged(); + void subscriberKSettingsAutomaticKeyguardTimeChanged(); + void subscriberKDisplayLightsTimeoutChanged(); + void subscriberKProEngActiveProfileChanged(); + +private slots: + void activeKeyguard(); + void notActiveKeyguard(); + void activeDevicelock(); + void notActiveDevicelock(); + +private: + QLabel *mLabel; + QLineEdit *mNumberEdit; + QToolButton *mLabelIcon; + int mLabelIcon_visible; + //QPushButton *mEndCallButton; + AutolockSrvService* mService; + // int mKeyCode; + // int mKeyCaptureHandle; + QValueSpaceSubscriber *subscriberKSettingsAutolockStatus; + QValueSpaceSubscriber *subscriberKSettingsAutoLockTime; + QValueSpaceSubscriber *subscriberKSettingsAutomaticKeyguardTime; + QValueSpaceSubscriber *subscriberKDisplayLightsTimeout; + QValueSpaceSubscriber *subscriberKProEngActiveProfile; + + AutolockUserActivityService* serviceKeyguard; + AutolockUserActivityService* serviceDevicelock; + + int iLockStatus; + int iLockStatusPrev; + CSecQueryUi *iSecQueryUi; + int iSecQueryUiCreated; + HbDeviceDialog *iDeviceDialog; + int iDeviceDialogCreated; +}; + +class AutolockSrvService : public XQServiceProvider +{ + Q_OBJECT +public: + AutolockSrvService( AutolockSrv *parent = 0 ); + ~AutolockSrvService(); + + void complete(QString number); + bool asyncAnswer() {return mAsyncAnswer;} +public slots: + int service(const QString& number, const QString& aParam1, const QString& aParam2 ); + +private slots: + void handleClientDisconnect(); + +private: + AutolockSrv* mAutolockSrv; + QString mNumber; + bool mAsyncAnswer; + int mAsyncReqId; +}; + +class CWait : public CActive + { + public: + /** + * Creates instance of the CWait class. + * + * @return Returns the instance just created. + */ + static CWait* NewL(); + /** + * Destructor. + */ + ~CWait(); + public: + /** + * Starts waiting for aReqStatus. + */ + TInt WaitForRequestL(); + public: + /** + * Sets active request type. + */ + void SetRequestType(TInt aRequestType); + /** + * Gets active request type. + */ + TInt GetRequestType(); + private: + /** + * C++ default constructor. + */ + CWait(); + /** + * Symbian OS constructor. + */ + void ConstructL(); + private: // from CActive + /** @see CActive::RunL() */ + void RunL(); + /** @see CActive::DoCancel() */ + void DoCancel(); + RTimer iTimer; + CActiveSchedulerWait iWait; + // Used if there is a need to cancel an active request; + // namely in situations where destructor is called when Wait + // is active. + TInt iRequestType; + }; + + +#endif // AUTOLOCKSRV_H diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/src/AutolockSrv.pri --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/src/AutolockSrv.pri Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,32 @@ +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, version 2.1 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, +# see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". +# +# Description: +# + +INCLUDEPATH += . \ + inc \ + autolockuseractivityservice \ + autolockuseractivityservice/inc + +SOURCES=\ + src/main.cpp\ + src/AutolockSrv.cpp + +HEADERS=\ + src/AutolockSrv.h + diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/src/keycapturingapplication.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/src/keycapturingapplication.cpp Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,62 @@ +#include +#include +#include +#include + +#include +#include + +#include "keycapturingapplication.h" + +/*! + + */ +void writeDebug(const QString &message) +{ + QFile file("c:/keycapturingapplication.log"); + if (!file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) { + qDebug() << "DialogLauncherView::writeDebug - file open failed"; + return; + } + + QTextStream out(&file); + out << message << "\n"; + + file.close(); +} + +/*! + + */ +KeyCapturingApplication::KeyCapturingApplication(int &argc, char *argv[], int keyCode) : + HbApplication(argc, argv), mKeyCode(keyCode), mKeyCaptureHandle(-1) +{ + CEikonEnv *env = CEikonEnv::Static(); + mKeyCaptureHandle = env->RootWin().CaptureKey(keyCode, 0, 0); +} + +/*! + + */ +KeyCapturingApplication::~KeyCapturingApplication() +{ + CEikonEnv *env = CEikonEnv::Static(); + env->RootWin().CancelCaptureKey(mKeyCaptureHandle); +} + +bool KeyCapturingApplication::symbianEventFilter(const QSymbianEvent *event) +{ + if (event->type() == QSymbianEvent::WindowServerEvent) { + const TWsEvent* wsEvent = event->windowServerEvent(); + if (wsEvent->Type() == EEventKey) { + writeDebug(QString("Key Event:")); + writeDebug(QString("\tkey code: %1").arg(wsEvent->Key()->iCode)); + writeDebug(QString("\tscan code: %1").arg(wsEvent->Key()->iScanCode)); + if (wsEvent->Key()->iCode == mKeyCode) + { + emit capturedKeyEvent(); + } + } + } + return HbApplication::symbianEventFilter(event); +} diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/src/keycapturingapplication.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/src/keycapturingapplication.h Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,28 @@ +#ifndef KEYCAPTURINGAPPLICATION_H +#define KEYCAPTURINGAPPLICATION_H + +#include + +class KeyCapturingApplication : public HbApplication +{ + + Q_OBJECT + +signals: + + void capturedKeyEvent(); + +public: + + KeyCapturingApplication(int &argc, char *argv[], int keyCode); + ~KeyCapturingApplication(); + virtual bool symbianEventFilter(const QSymbianEvent *event); + +private: + + int mKeyCode; + int mKeyCaptureHandle; + +}; + +#endif // KEYCAPTURINGAPPLICATION_H diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/src/lockapp.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/src/lockapp.hrh Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,96 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: General application spesific enumeration values + * +*/ + + +#ifndef __LOCKAPP_HRH__ +#define __LOCKAPP_HRH__ + +/** + * LockApp panic codes + * + * @lib lockapp + * @since 5.0 + * @author Joona Petrell + * @author Tamas Koteles + */ +enum TLockAppPanic + { + ELockPanicGeneral, + ELockPanicIllegalMessage, + ELockUnknownValue, + ELockIllegalState, + ELockPanicOutOfRange, + ELockPanicObserverAlreadyExists, + ELockPanicObserverNotFound, + }; + +/** + * Three possible states of LockApp: unlocked, keyguard active, devicelock active + * + * @lib lockapp + * @since 5.0 + * @author Joona Petrell + * @author Tamas Koteles + */ +enum TLockStatus + { + ELockNotActive = 0, + EKeyguardActive, + EDevicelockActive + }; + +/** + * Three possible reason for devicelock: manual, remote, timer + * + * @lib lockapp + * @since 5.0 + * @author Joona Petrell + * @author Tamas Koteles + */ +enum TDevicelockReason + { + EDevicelockManual = 1, + EDevicelockRemote, + EDevicelockTimer + }; + +/** + * Bit-field representing screen saver status + */ +const TUint KLockAppEnvScreenSaverOn = 1; + +/** + * Bit-field representing phonecall status + */ +const TUint KLockAppEnvPhonecallOngoing = 2; + +/** + * Bit-field representing idle status + */ +const TUint KLockAppEnvIdleOnForeground = 4; + +/** + * Bit-field representing grip status + */ +const TUint KLockAppEnvGrip = 8; + +/** + * Bit-field representing FPS status + */ +const TUint KLockAppEnvFPS = 0x10; + +#endif // __LOCKAPP_HRH__ diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/AutolockSrv/src/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/AutolockSrv/src/main.cpp Mon May 03 13:20:16 2010 +0300 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published by +* the Free Software Foundation, version 2.1 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this program. If not, +* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". +* +* Description: +* +*/ + +// #include "xqservicelog.h" +#include + +#include +#include "AutolockSrv.h" + +#include +#include + +int main(int argc, char **argv) +{ + // qInstallMsgHandler(XQSERVICEMESSAGEHANDLER); + // XQSERVICE_DEBUG_PRINT(" ================== xxxx AutolockSrv::main"); + qDebug() << "================== xxxx AutolockSrv::main"; + QApplication a( argc, argv ); + AutolockSrv *cl = new AutolockSrv(); + qDebug() << " ================== xxxx cl->show"; + // cl->show(); + qDebug() << " ================== xxxx cl->hide"; + cl->hide(); + qDebug() << " ================== xxxx cl->lower"; + cl->lower(); + int rv = a.exec(); + delete cl; + return rv; +} + diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/SecUi/Inc/SecQueryUi.h --- a/securitydialogs/SecUi/Inc/SecQueryUi.h Fri Apr 16 15:53:24 2010 +0300 +++ b/securitydialogs/SecUi/Inc/SecQueryUi.h Mon May 03 13:20:16 2010 +0300 @@ -23,12 +23,17 @@ #include // MHbDeviceDialogObserver #include +#define ESecUiTypeMask 0x0FFFFFF + #define ESecUiCancelSupported 0x1000000 #define ESecUiCancelNotSupported 0x0000000 #define ESecUiEmergencySupported 0x2000000 #define ESecUiEmergencyNotSupported 0x0000000 +#define ESecUiAlphaSupported 0x4000000 +#define ESecUiAlphaNotSupported 0x0000000 + class MSecQueryUiCertificateDetailsProvider; class MSecQueryUiDrmDetailsProvider; class CHbDeviceDialog; diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/SecUi/Inc/SecUiWait.h --- a/securitydialogs/SecUi/Inc/SecUiWait.h Fri Apr 16 15:53:24 2010 +0300 +++ b/securitydialogs/SecUi/Inc/SecUiWait.h Mon May 03 13:20:16 2010 +0300 @@ -20,6 +20,12 @@ #ifndef __SECUIWAIT_H #define __SECUIWAIT_H +#if defined(_DEBUG) +#define RDEBUG( x, y ) RDebug::Printf( "%s %s (%u) %s=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, x, y ); +#else +#define RDEBUG( x, y ) +#endif + // INCLUDES #include diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/SecUi/Src/SecQueryUi.cpp --- a/securitydialogs/SecUi/Src/SecQueryUi.cpp Fri Apr 16 15:53:24 2010 +0300 +++ b/securitydialogs/SecUi/Src/SecQueryUi.cpp Mon May 03 13:20:16 2010 +0300 @@ -21,6 +21,9 @@ #include // CHbSymbianVariantMap #include // CApaMaskedBitmap +#include +#include +#include "SecUiWait.h" // Variant map keys for notification device dialog _LIT( KNotifDeviceDialogLiteral, "com.nokia.hb.devicenotificationdialog/1.0" ); @@ -87,32 +90,9 @@ const TDesC& aIconFile, const TDesC& aAppVersion, TInt aAppSize, const TDesC& aAppDetails ) */ { - RDebug::Printf( "%s %s (%u) aType=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aType ); - RDebug::Printf( "%s %s (%u) password=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - TInt ESecQueryUiInstallConfirmationQueryType=0x101; - ClearParamsAndSetNoteTypeL( ESecQueryUiInstallConfirmationQueryType ); - AddParamL( _L("KSecQueryUiApplicationName"), _L("SecUi") ); - - _LIT(KTitle, "title"); - _LIT(KTitleValue1, "Enter PIN"); - _LIT(KTitleValue2, "Enter PIN with care"); - _LIT(KTitleValue3, "Enter PIN last"); - if(aType==KMaxNumberOfPINAttempts) - AddParamL( KTitle, KTitleValue1 ); - else if(aType> KLastRemainingInputAttempt) - AddParamL( KTitle, KTitleValue2 ); - else - AddParamL( KTitle, KTitleValue3 ); - - _LIT( KCodeTop, "codeTop" ); _LIT( KCodeTopValue, "codeTop" ); - AddParamL( KCodeTop, KCodeTopValue ); - - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - DisplayDeviceDialogL(); - User::LeaveIfError( WaitUntilDeviceDialogClosed() ); - password.Copy(iPassword); - return( iReturnValue == KErrNone ); + RDEBUG( "This should never be called. Obsolete", 0 ); + return KErrAbort ; } // --------------------------------------------------------------------------- @@ -121,9 +101,9 @@ // EXPORT_C TInt CSecQueryUi::SecQueryDialog(const TDesC& aCaption, TDes& aDataText, TInt aMinLength,TInt aMaxLength,TInt aMode) { - RDebug::Printf( "%s %s (%u) aCaption=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); + RDEBUG( "aCaption", 0 ); RDebug::Print( aCaption ); - RDebug::Printf( "%s %s (%u) aMode=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aMode ); + RDEBUG( "aMode", aMode ); ClearParamsAndSetNoteTypeL( aMode ); AddParamL( _L("KSecQueryUiApplicationName"), aCaption ); @@ -131,15 +111,28 @@ _LIT(KTitle, "title"); // _LIT(KTitleValue1, "Enter PIN"); AddParamL( KTitle, aCaption ); + AddParamL( _L("MinLength"), aMinLength ); + AddParamL( _L("MaxLength"), aMaxLength ); _LIT( KCodeTop, "codeTop" ); _LIT( KCodeTopValue, "codeTop" ); AddParamL( KCodeTop, KCodeTopValue ); - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + if( aCaption.Find(_L("|"))>0 ) + { + RDEBUG( "codeBottom aMode", aMode ); + _LIT( KCodeBottom, "codeBottom" ); _LIT( KCodeBottomValue, "codeBottom" ); + AddParamL( KCodeBottom, KCodeBottomValue ); + } + + RDEBUG( "0", 0 ); DisplayDeviceDialogL(); - User::LeaveIfError( WaitUntilDeviceDialogClosed() ); + TInt error = WaitUntilDeviceDialogClosed(); + RDEBUG( "error", error ); + User::LeaveIfError( error ); + aDataText.Copy(iPassword); - return( iReturnValue == KErrNone ); + RDEBUG( "iReturnValue", iReturnValue ); + return iReturnValue; } // --------------------------------------------------------------------------- @@ -262,12 +255,13 @@ // void CSecQueryUi::DoCancel() { - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + RDEBUG( "0", 0 ); if( iWait && iWait->IsStarted() && iWait->CanStopNow() ) { iCompletionCode = KErrCancel; iWait->AsyncStop(); } + RDEBUG( "0", 0 ); } // --------------------------------------------------------------------------- @@ -276,11 +270,12 @@ // void CSecQueryUi::RunL() { - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + RDEBUG( "0", 0 ); if( iWait ) { iWait->AsyncStop(); } + RDEBUG( "0", 0 ); } // --------------------------------------------------------------------------- @@ -289,28 +284,123 @@ // void CSecQueryUi::DataReceived( CHbSymbianVariantMap& aData ) { - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + RDEBUG( "0", 0 ); const CHbSymbianVariant* acceptedVariant = aData.Get( _L("accepted") ); // KSecQueryUiQueryAccepted + RDEBUG( "0", 0 ); if( acceptedVariant ) { - TBool* acceptedValue = acceptedVariant->Value(); - if( acceptedValue && *acceptedValue ) + RDEBUG( "0", 0 ); + TInt* acceptedValue = acceptedVariant->Value(); + RDEBUG( "acceptedValue", acceptedValue ); + RDEBUG( "*acceptedValue", *acceptedValue ); + if( acceptedValue ) { - iReturnValue = KErrNone; - } - else - { - iReturnValue = KErrCancel; + iReturnValue = *acceptedValue; } } const CHbSymbianVariant* acceptedVariantTop = aData.Get( _L("codeTop") ); // KSecQueryUiQueryAccepted + RDEBUG( "0", 0 ); if( acceptedVariantTop ) { TPtrC acceptedValueTop = *acceptedVariantTop->Value(); - RDebug::Printf( "%s %s (%u) acceptedValueTop=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + RDEBUG( "acceptedValueTop", 0 ); RDebug::Print( acceptedValueTop ); iPassword.Copy(acceptedValueTop); - } + + if(iReturnValue == KErrCompletion ) // the user didn't OK. It was send automatically because validating new lock code + { + _LIT( KInvalidNewLockCode, "invalidNewLockCode" ); + _LIT( KInvalidNewLockCode0, "invalidNewLockCode#0" ); + _LIT( KInvalidNewLockCode1, "invalidNewLockCode#1" ); + _LIT( KInvalidNewLockCode2, "invalidNewLockCode#2" ); + AddParamL( KInvalidNewLockCode, KInvalidNewLockCode0 ); // for starter + RSCPClient scpClient; + TSCPSecCode newCode; + newCode.Copy( acceptedValueTop ); + RDEBUG( "scpClient.Connect", 0 ); + if ( scpClient.Connect() == KErrNone ) + { + /* + RArray aFailedPolicies; + TDevicelockPolicies failedPolicy; + TInt retLockcode = KErrNone; + RDEBUG( "scpClient.VerifyNewLockcodeAgainstPolicies", 0 ); + retLockcode = scpClient.VerifyNewLockcodeAgainstPolicies( newCode, aFailedPolicies ); + RDEBUG( "retLockcode", retLockcode ); + RDEBUG( "aFailedPolicies.Count()", aFailedPolicies.Count() ); + for(TInt i=0; i KInvalidNewLockCodeX; KInvalidNewLockCodeX.Zero(); KInvalidNewLockCodeX.Append(_L("invalidNewLockCode")); KInvalidNewLockCodeX.Append(_L("#")); + KInvalidNewLockCodeX.AppendNum(failedPolicy); + AddParamL( KInvalidNewLockCode, KInvalidNewLockCodeX ); + } + */ + scpClient.Close(); + } + RDEBUG( "iDeviceDialog->Update", 0 ); + iDeviceDialog->Update( *iVariantMap ); + } // KErrCompletion + + if(acceptedValueTop.Length()<=4) // TODO store aMinLenght and check it here, instead of "4" + { + RDEBUG( "CPhCltEmergencyCall", 0 ); + CPhCltEmergencyCall* emergencyCall = CPhCltEmergencyCall::NewL( NULL ); + RDEBUG( "PushL", 0 ); + CleanupStack::PushL( emergencyCall ); + TPhCltEmergencyNumber emNumber; + + // this relies on the fact that emergency has 3 digits, and password needs at least 4 + TBool isEmergency( EFalse ); + RDEBUG( "calling IsEmergencyPhoneNumber", 0 ); + TInt error = emergencyCall->IsEmergencyPhoneNumber( acceptedValueTop, isEmergency ); + RDEBUG( "error", error ); + RDEBUG( "emNumber", 0 ); + + RDEBUG( "isEmergency", isEmergency ); + #ifdef __WINS__ + RDEBUG( "__WINS__ checking", 0 ); + if(!acceptedValueTop.CompareF(_L("112")) || !acceptedValueTop.CompareF(_L("911")) || !acceptedValueTop.CompareF(_L("555")) ) + { + isEmergency = ETrue; + error = KErrNone; + RDEBUG( "__WINS__ isEmergency", isEmergency ); + } + #endif + + if ( !error ) // oddly enough, missing capabilities also gives KErrNone + { + if(iReturnValue == KErrAbort ) // the user didn't OK. It was send automatically because short code + { + _LIT( KEmergency, "emergency" ); _LIT( KEmergencyValueYes, "emergencyYes" ); _LIT( KEmergencyValueNo, "emergencyNo" ); + if(isEmergency) + { + RDEBUG( "KEmergencyValueYes", 1 ); + AddParamL( KEmergency, KEmergencyValueYes ); + } + else + { + RDEBUG( "KEmergencyValueNo", 0 ); + AddParamL( KEmergency, KEmergencyValueNo ); + } + iDeviceDialog->Update( *iVariantMap ); + } + else if(iReturnValue == KErrNone ) + { // user pressed Call and number is valid + if(isEmergency) + { + RDEBUG( "DialEmergencyCallL", isEmergency ); + emergencyCall->DialEmergencyCallL( emNumber ); + iReturnValue = KErrAbort; // this means emergency call + } + } + } // if !error + RDEBUG( "0", 0 ); + CleanupStack::PopAndDestroy( emergencyCall ); + } // lenght<3 + } // acceptedVariantTop + RDEBUG( "iReturnValue", iReturnValue ); } // --------------------------------------------------------------------------- @@ -319,12 +409,14 @@ // void CSecQueryUi::DeviceDialogClosed( TInt aCompletionCode ) { - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + RDEBUG( "aCompletionCode", aCompletionCode ); iCompletionCode = aCompletionCode; iIsDisplayingDialog = EFalse; TRequestStatus* status( &iStatus ); + RDEBUG( "0", 0 ); User::RequestComplete( status, KErrNone ); + RDEBUG( "0", 0 ); } // --------------------------------------------------------------------------- @@ -333,7 +425,7 @@ // CSecQueryUi::CSecQueryUi() : CActive( CActive::EPriorityStandard ) { - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + RDEBUG( "0", 0 ); CActiveScheduler::Add( this ); } @@ -343,7 +435,7 @@ // void CSecQueryUi::ConstructL() { - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + RDEBUG( "0", 0 ); iWait = new( ELeave ) CActiveSchedulerWait; // iDeviceDialog is allocated later, first call of DisplayDeviceDialogL() } @@ -354,6 +446,7 @@ // void CSecQueryUi::ClearParamsL() { + RDEBUG( "0", 0 ); if( iVariantMap ) { delete iVariantMap; @@ -368,7 +461,7 @@ // void CSecQueryUi::ClearParamsAndSetNoteTypeL( TInt aType ) { - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + RDEBUG( "aType", aType ); ClearParamsL(); AddParamL( _L("type"), aType ); } @@ -379,7 +472,7 @@ // void CSecQueryUi::AddParamL( const TDesC& aKey, TInt aValue ) { - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + RDEBUG( "aValue", aValue ); CHbSymbianVariant* variant = NULL; variant = CHbSymbianVariant::NewL( &aValue, CHbSymbianVariant::EInt ); iVariantMap->Add( aKey, variant ); @@ -391,7 +484,7 @@ // void CSecQueryUi::AddParamL( const TDesC& aKey, const TDesC& aValue ) { - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + RDEBUG( "0", 0 ); CHbSymbianVariant* variant = NULL; variant = CHbSymbianVariant::NewL( &aValue, CHbSymbianVariant::EDes ); iVariantMap->Add( aKey, variant ); @@ -411,7 +504,7 @@ // void CSecQueryUi::DisplayDeviceDialogL() { - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + RDEBUG( "0", 0 ); if( iDeviceDialog && iIsDisplayingDialog ) { iDeviceDialog->Update( *iVariantMap ); @@ -423,11 +516,13 @@ iDeviceDialog = CHbDeviceDialog::NewL(); } _LIT( KSecQueryUiDeviceDialog, "com.nokia.secuinotificationdialog/1.0" ); - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + RDEBUG( "Show", 0 ); iDeviceDialog->Show( KSecQueryUiDeviceDialog, *iVariantMap, this ); - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + RDEBUG( "iIsDisplayingDialog", iIsDisplayingDialog ); iIsDisplayingDialog = ETrue; + RDEBUG( "iIsDisplayingDialog", iIsDisplayingDialog ); } + RDEBUG( "0", 0 ); } // --------------------------------------------------------------------------- @@ -436,15 +531,18 @@ // TInt CSecQueryUi::WaitUntilDeviceDialogClosed() { - RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + RDEBUG( "0", 0 ); iCompletionCode = KErrInUse; iReturnValue = KErrUnknown; if( !IsActive() && iWait && !iWait->IsStarted() ) { iStatus = KRequestPending; SetActive(); + RDEBUG( "Start", 0 ); iWait->Start(); + RDEBUG( "Started", 1 ); } + RDEBUG( "iCompletionCode", iCompletionCode ); return iCompletionCode; } diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/SecUi/Src/SecUiSecurityHandler.cpp --- a/securitydialogs/SecUi/Src/SecUiSecurityHandler.cpp Fri Apr 16 15:53:24 2010 +0300 +++ b/securitydialogs/SecUi/Src/SecUiSecurityHandler.cpp Mon May 03 13:20:16 2010 +0300 @@ -25,7 +25,7 @@ #ifdef __COVER_DISPLAY #include -#include +// #include #endif //__COVER_DISPLAY #include @@ -70,11 +70,11 @@ // CSecurityHandler::CSecurityHandler() // C++ constructor // ---------------------------------------------------------- -// +// qtdone EXPORT_C CSecurityHandler::CSecurityHandler(RMobilePhone& aPhone): iPhone(aPhone), iQueryCanceled(ETrue), iSecurityDlg(NULL), iNoteDlg(NULL) { - RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + RDEBUG( "0", 0 ); TInt result = iCustomPhone.Open(aPhone); TRAP_IGNORE( FeatureManager::InitializeLibL() ); //Shouldn't this panic if FM does not initialise?? @@ -85,14 +85,11 @@ // CSecurityHandler::~CSecurityHandler() // Destructor // ---------------------------------------------------------- -// +// qtdone EXPORT_C CSecurityHandler::~CSecurityHandler() { - RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + RDEBUG( "0", 0 ); - #if defined(_DEBUG) - RDebug::Print(_L("CSecurityHandler::~CSecurityHandler()")); - #endif if ( iDestroyedPtr ) { *iDestroyedPtr = ETrue; @@ -107,11 +104,11 @@ // CSecurityHandler::HandleEventL() // Handles different security events // ---------------------------------------------------------- -// +// qtdone EXPORT_C void CSecurityHandler::HandleEventL( RMobilePhone::TMobilePhoneSecurityEvent aEvent ) { - RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + RDEBUG( "0", 0 ); TInt result = KErrNone; HandleEventL( aEvent, result ); @@ -122,12 +119,12 @@ // CSecurityHandler::HandleEventL() // Handles different security events // ---------------------------------------------------------- -// +// qtdone EXPORT_C void CSecurityHandler::HandleEventL( RMobilePhone::TMobilePhoneSecurityEvent aEvent, TBool aStartup, TInt& aResult ) { - RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + RDEBUG( "0", 0 ); iStartup = aStartup; HandleEventL( aEvent, aResult ); @@ -138,23 +135,19 @@ // CSecurityHandler::HandleEventL() // Handles different security events // ---------------------------------------------------------- -// +// qtdone EXPORT_C void CSecurityHandler::HandleEventL( RMobilePhone::TMobilePhoneSecurityEvent aEvent, TInt& aResult ) { - RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + RDEBUG( "0", 0 ); /***************************************************** * Series 60 Customer / ETel * Series 60 ETel API *****************************************************/ - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::HandleEventL()")); - RDebug::Print(_L("(SECUI)CSecurityHandler::HandleEventL() EVENT: %d"), aEvent); - #endif TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); - RDebug::Printf( "%s %s (%u) aEvent=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aEvent ); + RDEBUG( "aEvent", aEvent ); switch(aEvent) { @@ -168,10 +161,7 @@ #if defined(_DEBUG) RDebug::Print(_L("(SECUI)CSecurityHandler::HandleEventL() PUK1Required")); #endif - ((CAknNotifierAppServerAppUi*)(CEikonEnv::Static())->EikAppUi())->SuppressAppSwitching(ETrue); - TRAPD(err,aResult = Puk1RequiredL()); - ((CAknNotifierAppServerAppUi*)(CEikonEnv::Static())->EikAppUi())->SuppressAppSwitching(EFalse); - User::LeaveIfError(err); + Puk1RequiredL(); break; case RMobilePhone::EPin2Required: Pin2RequiredL(); @@ -204,16 +194,14 @@ default: break; } - #if defined(_DEBUG) - RDebug::Print( _L( "CSecurityHandler::HandleEventL() returning %d." ), aResult ); - #endif + RDEBUG( "aResult", aResult ); } // // ---------------------------------------------------------- // CSecurityHandler::AskSecCodeL() // For asking security code e.g in settings // ---------------------------------------------------------- -// +// qtdone EXPORT_C TBool CSecurityHandler::AskSecCodeL() { /***************************************************** @@ -231,12 +219,12 @@ CRepository* repository = CRepository::NewL(KCRUidSCPLockCode); TInt currentLockStatus = -1; TInt res=-1; + TInt lAlphaSupported=0; + TInt lCancelSupported=0; res = repository->Get(KSCPLockCodeDefaultLockCode , currentLockStatus); - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) res=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, res ); - RDebug::Printf( "%s %s (%u) currentLockStatus=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, currentLockStatus ); - #endif + RDEBUG( "res", res ); + RDEBUG( "currentLockStatus", currentLockStatus ); delete repository; if(res==0 && currentLockStatus==1) { @@ -250,46 +238,53 @@ RMobilePhone::TMobilePassword required_fourth; TInt ret = KErrNone; - TInt err = KErrNone; TInt status = KErrNone; RMobilePhone::TMobilePassword iSecUi_password; - TBool queryAccepted = EFalse; + TInt queryAccepted = KErrCancel; - - while (!queryAccepted) + while (queryAccepted!=KErrNone) { RMobilePhone::TMobilePhoneSecurityCode secCodeType; secCodeType = RMobilePhone::ESecurityCodePhonePassword; /* request PIN using QT */ CSecQueryUi *iSecQueryUi; - RDebug::Printf( "%s %s (%u) CSecQueryUi=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + RDEBUG( "CSecQueryUi", 0 ); iSecQueryUi = CSecQueryUi::NewL(); - RDebug::Printf( "%s %s (%u) Copy=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - iSecUi_password.Copy(_L("666")); - RDebug::Printf( "%s %s (%u) InstallConfirmationQueryL=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - queryAccepted = iSecQueryUi->SecQueryDialog( _L("AskSecCodeL"), iSecUi_password, 4, 8, secCodeType /*aMode*/ ); - RDebug::Printf( "%s %s (%u) iSecUi_password=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + lAlphaSupported = ESecUiAlphaSupported; + lCancelSupported = ESecUiCancelSupported; + TBuf<0x100> title; title.Zero(); title.Append(_L("AskSecCodeL")); title.Append(_L("#")); title.AppendNum(-1); + queryAccepted = iSecQueryUi->SecQueryDialog( title, iSecUi_password, SEC_C_SECURITY_CODE_MIN_LENGTH,SEC_C_SECURITY_CODE_MAX_LENGTH, lAlphaSupported | lCancelSupported | secCodeType /*aMode*/ ); + RDEBUG( "iSecUi_password", 0 ); RDebug::Print( iSecUi_password ); - RDebug::Printf( "%s %s (%u) delete=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + RDEBUG( "delete", 0 ); delete iSecQueryUi; - RDebug::Printf( "%s %s (%u) done=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - if(queryAccepted) res=0xFFFFFFFE; // this is the value returned from iSecurityDlg + RDEBUG( "queryAccepted", queryAccepted ); /* end request PIN using QT */ - - CWait* wait = CWait::NewL(); - iPhone.VerifySecurityCode(wait->iStatus,secCodeType, iSecUi_password, required_fourth); - status = wait->WaitForRequestL(); - delete wait; - - ret = ETrue; - if (!queryAccepted) + if (queryAccepted!=KErrNone) { ret = EFalse; return ret; } - queryAccepted = EFalse; // because it's not yet validated + + CWait* wait = CWait::NewL(); + RDEBUG( "VerifySecurityCode", 0 ); + iPhone.VerifySecurityCode(wait->iStatus,secCodeType, iSecUi_password, required_fourth); + RDEBUG( "WaitForRequestL", 0 ); + status = wait->WaitForRequestL(); + RDEBUG( "status", status ); + delete wait; + #ifdef __WINS__ + if(status==KErrNotSupported ) + { + RDEBUG( "status", status ); + status=KErrNone; + } + #endif + + ret = ETrue; + queryAccepted = KErrCancel; // because it's not yet validated switch(status) { case KErrNone: @@ -297,6 +292,7 @@ if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw ) && !(FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements))) { + RDEBUG( "calling RSCPClient", 0 ); RSCPClient scpClient; User::LeaveIfError( scpClient.Connect() ); CleanupClosePushL( scpClient ); @@ -304,9 +300,10 @@ TSCPSecCode newCode; newCode.Copy( iSecUi_password ); scpClient.StoreCode( newCode ); + RDEBUG( "called StoreCode", 1 ); CleanupStack::PopAndDestroy(); //scpClient - queryAccepted = ETrue; + queryAccepted = KErrNone; } iQueryCanceled = ETrue; // TODO @@ -316,18 +313,18 @@ case KErrLocked: { // security code blocked! - CSecuritySettings::ShowResultNoteL(R_SEC_BLOCKED, CAknNoteDialog::EErrorTone); // TODO + CSecuritySettings::ShowResultNoteL(R_SEC_BLOCKED, CAknNoteDialog::EErrorTone); break; } case KErrGsm0707IncorrectPassword: case KErrAccessDenied: { // code was entered erroneusly - CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); // TODO + CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); } default: { - CSecuritySettings::ShowResultNoteL(status, CAknNoteDialog::EErrorTone); // TODO + CSecuritySettings::ShowResultNoteL(status, CAknNoteDialog::EErrorTone); } } } // while @@ -339,8 +336,9 @@ // ---------------------------------------------------------- // CSecurityHandler::CancelSecCodeQuery() // Cancels PIN2 and security code queries +// TODO is this used? // ---------------------------------------------------------- -// +// qtdone EXPORT_C void CSecurityHandler::CancelSecCodeQuery() { #if defined(_DEBUG) @@ -366,7 +364,7 @@ // CSecurityHandler::AskSecCodeInAutoLock() // for asking security code in autolock // ---------------------------------------------------------- -// +// qtdone EXPORT_C TBool CSecurityHandler::AskSecCodeInAutoLockL() { /***************************************************** @@ -374,9 +372,9 @@ * Series 60 ETel API *****************************************************/ - #ifdef __WINS__ - return ETrue; - #else + RDEBUG( "0", 0 ); + + #if defined(_DEBUG) RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL()")); #endif @@ -396,12 +394,15 @@ res = repository->Get(KSettingsAutoLockTime, period); delete repository; + RDEBUG( "res", res ); + #if defined(_DEBUG) RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() autolock period:%d"), res); #endif if (res == KErrNone) { // disable autolock in Domestic OS side too if autolock period is 0. + RDEBUG( "period", period ); if (period == 0 ) { #if defined(_DEBUG) @@ -419,6 +420,7 @@ if ( remoteLockSettings->GetEnabled( remoteLockStatus ) ) { + RDEBUG( "0", 0 ); if ( remoteLockStatus ) { // Remote lock is enabled @@ -455,49 +457,57 @@ #endif // RD_REMOTELOCK + RDEBUG( "lockChange", lockChange ); wait = CWait::NewL(); + RDEBUG( "0", 0 ); + // this also calls PassPhraseRequiredL ??? + RDEBUG( "SetLockSetting", 1 ); iPhone.SetLockSetting(wait->iStatus,lockType,lockChange); + res = KErrNone; + RDEBUG( "WaitForRequestL", 0 ); res = wait->WaitForRequestL(); + RDEBUG( "res", res ); delete wait; #if defined(_DEBUG) RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() SetLockSetting RESULT:%d"), res); #endif - } + } // from period == 0 else { // ask security code #if defined(_DEBUG) RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() Ask sec code via notifier")); #endif + RDEBUG( "0", 0 ); RNotifier codeQueryNotifier; User::LeaveIfError(codeQueryNotifier.Connect()); CWait* wait = CWait::NewL(); CleanupStack::PushL(wait); TInt queryResponse = 0; TPckg response(queryResponse); + RDEBUG( "0", 0 ); TSecurityNotificationPckg params; params().iEvent = static_cast(RMobilePhone::EPhonePasswordRequired); params().iStartup = EFalse; #if defined(_DEBUG) RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() Start Notifier")); #endif + RDEBUG( "0", 0 ); + RDEBUG( "StartNotifierAndGetResponse", 0 ); codeQueryNotifier.StartNotifierAndGetResponse(wait->iStatus, KSecurityNotifierUid,params, response); // this will eventually call PassPhraseRequiredL + RDEBUG( "WaitForRequestL", 0 ); res = wait->WaitForRequestL(); + RDEBUG( "WaitForRequestL", 1 ); + RDEBUG( "res", res ); CleanupStack::PopAndDestroy(); // wait - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() results:")); - RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() res:%d"), res); - RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() queryResponse:%d"), queryResponse); - #endif if(res == KErrNone) res = queryResponse; - } + } // from else period == 0 + RDEBUG( "0", 0 ); } else - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() KERRSOMETHING:Call SetLockSetting")); - #endif + { // can't read repository for KSettingsAutoLockTime + RDEBUG( "KERRSOMETHING:Call SetLockSetting", 0 ); #ifdef RD_REMOTELOCK @@ -547,29 +557,34 @@ lockChange = RMobilePhone::ELockSetDisabled; #endif // RD_REMOTELOCK + RDEBUG( "0", 0 ); wait = CWait::NewL(); + RDEBUG( "SetLockSetting", 0 ); iPhone.SetLockSetting(wait->iStatus,lockType,lockChange); + RDEBUG( "WaitForRequestL", 0 ); res = wait->WaitForRequestL(); + RDEBUG( "WaitForRequestL", 1 ); delete wait; #if defined(_DEBUG) RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() KES: SetLockSetting RESULT:%d"), res); #endif } + RDEBUG( "res", res ); switch (res) { case KErrNone: { return ETrue; } - case KErrGsmSSPasswordAttemptsViolation: case KErrLocked: case KErrGsm0707IncorrectPassword: case KErrAccessDenied: { - return AskSecCodeInAutoLockL(); + RDEBUG( "KErrAccessDenied", KErrAccessDenied ); + return AskSecCodeInAutoLockL(); } case KErrAbort: case KErrCancel: @@ -577,42 +592,39 @@ return EFalse; default: { + RDEBUG( "default", res ); return AskSecCodeInAutoLockL(); } } -#endif // WINS } // // ---------------------------------------------------------- // CSecurityHandler::PassPhraseRequired() // Handles PassPhraseRequired event // ---------------------------------------------------------- -// +// qtdone TInt CSecurityHandler::PassPhraseRequiredL() { /***************************************************** * Series 60 Customer / ETel * Series 60 ETel API *****************************************************/ - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL()")); - #endif + RDEBUG( "0", 0 ); TBool StartUp = iStartup; RMobilePhone::TMobilePassword iSecUi_password; RMobilePhone::TMobilePassword required_fourth; - TBool queryAccepted = EFalse; + TInt queryAccepted = KErrCancel; - TInt status=0; TInt autolockState=0; TInt lCancelSupported=0; TInt lEmergencySupported=0; + TInt lAlphaSupported=0; TInt err( KErrGeneral ); err = RProperty::Get(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, autolockState); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() Autolock Status result: %d"), err); - #endif + RDEBUG( "StartUp", StartUp ); + RDEBUG( "err", err ); if(!StartUp) User::LeaveIfError( err ); TBool isConditionSatisfied = EFalse; @@ -648,12 +660,12 @@ #endif // Security code at bootup: No "cancel" softkey; Emergency calls enabled. RMobilePhone::TMobilePhoneSecurityCode secCodeTypeToAsk = RMobilePhone::ESecurityCodePhonePassword; // for starters - + RDEBUG( "isConditionSatisfied", isConditionSatisfied ); if (isConditionSatisfied) { // starter or special TARM. NoCancel+Emergency lCancelSupported = ESecUiCancelNotSupported; - lEmergencySupported = ESecUiEmergencyNotSupported; + lEmergencySupported = ESecUiEmergencySupported; } else if (autolockState > EAutolockOff) { @@ -667,45 +679,26 @@ lCancelSupported = ESecUiCancelSupported; lEmergencySupported = ESecUiEmergencyNotSupported; } - + lAlphaSupported = ESecUiAlphaSupported; + /* request PIN using QT */ - status = KErrNone; CSecQueryUi *iSecQueryUi; - RDebug::Printf( "%s %s (%u) CSecQueryUi=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); iSecQueryUi = CSecQueryUi::NewL(); - RDebug::Printf( "%s %s (%u) Copy=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - iSecUi_password.Copy(_L("666")); - RDebug::Printf( "%s %s (%u) SecQueryDialog aType=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, lCancelSupported | lEmergencySupported | secCodeTypeToAsk ); - queryAccepted = iSecQueryUi->SecQueryDialog( _L("PassPhraseRequiredL"), iSecUi_password, 4, 8, lCancelSupported | lEmergencySupported | secCodeTypeToAsk ); - RDebug::Printf( "%s %s (%u) iSecUi_password=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + TInt lType = lAlphaSupported | lCancelSupported | lEmergencySupported | secCodeTypeToAsk; + RDEBUG( "lType", lType ); + queryAccepted = iSecQueryUi->SecQueryDialog( _L("PassPhraseRequiredL"), iSecUi_password, SEC_C_SECURITY_CODE_MIN_LENGTH,SEC_C_SECURITY_CODE_MAX_LENGTH, lType ); + RDEBUG( "iSecUi_password", 0 ); RDebug::Print( iSecUi_password ); - RDebug::Printf( "%s %s (%u) delete=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + RDEBUG( "queryAccepted", queryAccepted ); delete iSecQueryUi; - RDebug::Printf( "%s %s (%u) done=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - if(queryAccepted) status=0xFFFFFFFE; // this is the value returned from iSecurityDlg /* end request PIN using QT */ - // TODO if Emergency was possible, then consider status == ESecUiEmergencyCall - /* I don't think I need this - TInt secUiOriginatedQuery(ESecurityUIsETelAPIOriginated); - RProperty::Get(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, secUiOriginatedQuery); - CSecUiLockObserver* deviceLockStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg); - */ TBool wasCancelledOrEmergency = EFalse; -if(!FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) -{ - if (!status || (status == ESecUiEmergencyCall) - || (status == EAknSoftkeyEmergencyCall) || (status == ESecUiDeviceLocked)) + RDEBUG( "KFeatureIdSapDeviceLockEnhancements", KFeatureIdSapDeviceLockEnhancements ); +if ( (queryAccepted==KErrAbort /* =emergency */) || (queryAccepted == KErrCancel)) wasCancelledOrEmergency = ETrue; -} -else -{ - if ( ( status == KErrCancel ) || (status == ESecUiEmergencyCall) || - (status == EAknSoftkeyEmergencyCall) || (status == ESecUiDeviceLocked)) - wasCancelledOrEmergency = ETrue; -} -RDebug::Printf( "%s %s (%u) wasCancelledOrEmergency=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, wasCancelledOrEmergency ); + RDEBUG( "wasCancelledOrEmergency", wasCancelledOrEmergency ); if (wasCancelledOrEmergency) { #if defined(_DEBUG) @@ -713,28 +706,38 @@ #endif if (!StartUp) { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() ABORT CALLED!!!!!!")); - #endif + RDEBUG( "AbortSecurityCode", 0 ); iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePhonePassword); + RDEBUG( "AbortSecurityCode", 1 ); } return KErrCancel; } - RMobilePhone::TMobilePhoneSecurityCode secCodeType = RMobilePhone::ESecurityCodePhonePassword; - CWait* wait = NULL; - - RDebug::Printf( "%s %s (%u) VerifySecurityCode=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); + RMobilePhone::TMobilePhoneSecurityCode secCodeType = RMobilePhone::ESecurityCodePhonePassword; + CWait* wait = NULL; + TInt status = KErrNone;; wait = CWait::NewL(); + RDEBUG( "VerifySecurityCode", 0 ); + #ifndef __WINS__ iPhone.VerifySecurityCode(wait->iStatus,secCodeType, iSecUi_password, required_fourth); + RDEBUG( "WaitForRequestL", 0 ); status = wait->WaitForRequestL(); - RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() VerifySecurityCode STATUS: %d"), status); + #else + status = KErrTimedOut; + RDEBUG( "WaitForRequestL not waint WINS", 0 ); + #endif + RDEBUG( "WaitForRequestL status", status ); + #ifdef __WINS__ + if (status == KErrTimedOut) + { + status = KErrNone; + } + #endif delete wait; TInt returnValue = status; - RDebug::Printf( "%s %s (%u) status=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, status ); - RDebug::Printf( "%s %s (%u) tarmFlag=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, tarmFlag ); - RDebug::Printf( "%s %s (%u) StartUp=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, StartUp ); + RDEBUG( "tarmFlag", tarmFlag ); + RDEBUG( "StartUp", StartUp ); switch(status) { case KErrNone: @@ -743,8 +746,10 @@ #endif // code approved CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, CAknNoteDialog::EConfirmationTone); + RDEBUG( "R_CONFIRMATION_NOTE", R_CONFIRMATION_NOTE ); if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw)) { + RDEBUG( "KFeatureIdSapTerminalControlFw", KFeatureIdSapTerminalControlFw ); // Unset the admin flag if set if ( tarmFlag & KSCPFlagResyncQuery ) { @@ -763,20 +768,24 @@ FAILED to unset TARM Admin Flag")); #endif } - } + } if(!FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) - { + { + RDEBUG( "KFeatureIdSapDeviceLockEnhancements", KFeatureIdSapDeviceLockEnhancements ); RSCPClient scpClient; + RDEBUG( "scpClient.Connect", 0 ); User::LeaveIfError( scpClient.Connect() ); + RDEBUG( "scpClient.Connect", 1 ); CleanupClosePushL( scpClient ); TSCPSecCode newCode; newCode.Copy( iSecUi_password ); scpClient.StoreCode( newCode ); + RDEBUG( "scpClient.StoreCode", 1 ); CleanupStack::PopAndDestroy(); //scpClient } } - + RDEBUG( "StartUp", StartUp ); if (StartUp) { #if defined(_DEBUG) @@ -819,9 +828,11 @@ #endif // _DEBUG // Disable DOS device lock setting + RDEBUG( "iCustomPhone.DisablePhoneLock", 0 ); wait = CWait::NewL(); iCustomPhone.DisablePhoneLock(wait->iStatus,iSecUi_password); wait->WaitForRequestL(); + RDEBUG( "iCustomPhone.DisablePhoneLock", 1 ); delete wait; } } @@ -838,22 +849,18 @@ #else // not defined RD_REMOTELOCK - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL()KErrNone: Startup; DisablePhoneLock.")); - #endif + RDEBUG( "iCustomPhone.DisablePhoneLock", 0 ); wait = CWait::NewL(); iCustomPhone.DisablePhoneLock(wait->iStatus,iSecUi_password); wait->WaitForRequestL(); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL()KErrNone: Startup; DisablePhoneLock completed.")); - #endif + RDEBUG( "iCustomPhone.DisablePhoneLock", 1 ); delete wait; #endif // RD_REMOTELOCK } } else // error getting repository { - RDebug::Printf( "%s %s (%u) error getting repository=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); + RDEBUG( "error getting repository", 0 ); #ifdef RD_REMOTELOCK // If remote lock is enabled, don't disable the domestic OS device lock // since that would render the RemoteLock useless. @@ -866,13 +873,11 @@ if ( !remoteLockStatus ) { // Remote lock is disabled - #ifdef _DEBUG - RDebug::Print( _L( "(SecUi)CSecurityHandler::PassPhraseRequiredL() - Failed to get Autolock period and RemoteLock is disabled -> disable DOS device lock" ) ); - #endif // _DEBUG - + RDEBUG( "iCustomPhone.DisablePhoneLock", 0 ); wait = CWait::NewL(); iCustomPhone.DisablePhoneLock(wait->iStatus,iSecUi_password); wait->WaitForRequestL(); + RDEBUG( "iCustomPhone.DisablePhoneLock", 1 ); delete wait; } } @@ -889,22 +894,18 @@ #else // not defined RD_REMOTELOCK - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL()KErrNone: Startup; Could not get autolock period.")); - #endif - // could not get the current autolock time... disable autolock in Domestic OS side. + // could not get the current autolock time... disable autolock in Domestic OS side. + RDEBUG( "iCustomPhone.DisablePhoneLock", 0 ); wait = CWait::NewL(); iCustomPhone.DisablePhoneLock(wait->iStatus,iSecUi_password); wait->WaitForRequestL(); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL()KErrNone: Startup; NO AUTOLOCK PERIOD; DisablePhoneLock completed.")); - #endif + RDEBUG( "iCustomPhone.DisablePhoneLock", 1 ); delete wait; #endif // RD_REMOTELOCK } - } + } // no Startup break; case KErrGsmSSPasswordAttemptsViolation: @@ -917,6 +918,7 @@ break; case KErrGsm0707IncorrectPassword: case KErrAccessDenied: + RDEBUG( "KErrAccessDenied", KErrAccessDenied ); // TODO should this try again? It seems that it's not asked again. #if defined(_DEBUG) RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() KErrGsm0707IncorrectPassword")); @@ -924,34 +926,32 @@ CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); break; default: - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() DEFAULT")); - #endif + RDEBUG( "default", status ); CSecuritySettings::ShowErrorNoteL(status); // TODO should this try again? It seems that it's not asked again. break; } - - return returnValue; + RDEBUG( "returnValue", returnValue ); + return returnValue; } // // ---------------------------------------------------------- // CSecurityHandler::Pin1Required() // Handles Pin1Required event // ---------------------------------------------------------- -// +// qtdone TInt CSecurityHandler::Pin1RequiredL() { /***************************************************** * Series 60 Customer / ETel * Series 60 ETel API *****************************************************/ -RDebug::Printf( "%s %s (%u) 11=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + RDEBUG( "0", 0 ); -RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); RMobilePhone::TMobilePassword iSecUi_password; TInt lCancelSupported = ESecUiCancelNotSupported; - TBool queryAccepted = EFalse; + TInt queryAccepted = KErrCancel; + TInt lAlphaSupported=0; RMobilePhone::TMobilePassword required_fourth; RMobilePhone::TMobilePhoneSecurityCode secCodeType = RMobilePhone::ESecurityCodePin1; RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; @@ -962,16 +962,11 @@ TInt res = KErrGeneral; CWait* wait = CWait::NewL(); CleanupStack::PushL(wait); -RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); - + RDEBUG( "0", 0 ); StartUp = iStartup; - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Pin1RequiredL()")); - #endif - -RDebug::Printf( "%s %s (%u) StartUp=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, StartUp ); + RDEBUG( "StartUp", StartUp ); if(!StartUp) { // read a flag to see whether the query is SecUi originated. For example, from CSecuritySettings::ChangePinRequestParamsL @@ -996,39 +991,31 @@ RDebug::Print(_L("CSecurityHandler::Pin1RequiredL() Execute dlg")); #endif -RDebug::Printf( "%s %s (%u) StartUp=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, StartUp ); -RDebug::Printf( "%s %s (%u) secUiOriginatedQuery=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, secUiOriginatedQuery ); -RDebug::Printf( "%s %s (%u) ESecurityUIsSecUIOriginated=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, ESecurityUIsSecUIOriginated ); -RDebug::Printf( "%s %s (%u) err=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, err ); + RDEBUG( "StartUp", StartUp ); + RDEBUG( "secUiOriginatedQuery", secUiOriginatedQuery ); + RDEBUG( "ESecurityUIsSecUIOriginated", ESecurityUIsSecUIOriginated ); + RDEBUG( "err", err ); if(StartUp || (secUiOriginatedQuery != ESecurityUIsSecUIOriginated) || (err != KErrNone)) { - RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); - lCancelSupported = ESecUiCancelSupported; + RDEBUG( "0", 0 ); + lCancelSupported = ESecUiCancelNotSupported; } else { - /* TODO do I need this ? */ - /* - CSecUiLockObserver* deviceLockStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg); - CleanupStack::PushL(deviceLockStatusObserver); - CSecUiLockObserver* queryStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg, ESecUiRequestStateObserver); - CleanupStack::PushL(queryStatusObserver); - ... - CleanupStack::PopAndDestroy(2); //deviceLockStatusObserver, queryStatusObserver - */ + lCancelSupported = ESecUiCancelSupported; // it will be RMobilePhone::ESecurityCodePin1 , equivalent to ESecUiNone } wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); + RDEBUG( "GetSecurityCodeInfo", 0 ); iPhone.GetSecurityCodeInfo(wait->iStatus, secCodeType, codeInfoPkg); res = wait->WaitForRequestL(); - #if defined(_DEBUG) + TInt attempts(codeInfo.iRemainingEntryAttempts); - RDebug::Print(_L("CSecurityHandler::Pin1RequiredL() Remaining Attempts query status: %d"), res); - RDebug::Print(_L("CSecurityHandler::Pin1RequiredL() Remaining Attempts: %d"), attempts); - #endif - RDebug::Printf( "%s %s (%u) res=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, res ); + RDEBUG( "attempts", attempts ); + + RDEBUG( "res", res ); #ifdef __WINS__ - RDebug::Printf( "%s %s (%u) emulator can't read PIN attempts=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, res ); + RDEBUG( "emulator can't read PIN attempts", res ); res=KErrNone; codeInfo.iRemainingEntryAttempts=3; #endif @@ -1036,54 +1023,50 @@ User::LeaveIfError(res); /* request PIN using QT */ CSecQueryUi *iSecQueryUi; - RDebug::Printf( "%s %s (%u) CSecQueryUi=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + RDEBUG( "CSecQueryUi", 0 ); iSecQueryUi = CSecQueryUi::NewL(); - RDebug::Printf( "%s %s (%u) Copy=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - iSecUi_password.Copy(_L("666")); - RDebug::Printf( "%s %s (%u) SecQueryDialog=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - // TODO use codeInfo.iRemainingEntryAttempts for setting the Caption + RDEBUG( "SecQueryDialog", 1 ); // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful // TODO also support Emergency - queryAccepted = iSecQueryUi->SecQueryDialog( _L("Pin1RequiredL"), iSecUi_password, 4, 8, lCancelSupported | secCodeType /*aMode*/ ); - RDebug::Printf( "%s %s (%u) iSecUi_password=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + lAlphaSupported = ESecUiAlphaNotSupported; + TBuf<0x100> title; title.Zero(); title.Append(_L("Pin1RequiredL")); title.Append(_L("#")); title.AppendNum(codeInfo.iRemainingEntryAttempts); + TInt amode = lAlphaSupported | lCancelSupported | ESecUiEmergencySupported | secCodeType; + RDEBUG( "amode", amode ); + queryAccepted = iSecQueryUi->SecQueryDialog( title, iSecUi_password, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, amode ); + RDEBUG( "iSecUi_password", 0 ); RDebug::Print( iSecUi_password ); - RDebug::Printf( "%s %s (%u) delete=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); delete iSecQueryUi; - RDebug::Printf( "%s %s (%u) done=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - if(queryAccepted) res=0xFFFFFFFE; // this is the value returned from iSecurityDlg + RDEBUG( "queryAccepted", queryAccepted ); // TODO handle emergency /* end request PIN using QT */ - RDebug::Printf( "%s %s (%u) res=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, res ); - if ((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) + if ( queryAccepted == KErrAbort ) // emergency call { #if defined(_DEBUG) RDebug::Print(_L("CSecurityHandler::Pin1RequiredL() R_PIN_REQUEST_QUERY CANCEL!")); #endif - CleanupStack::PopAndDestroy(wait); // TODO this is needed ??? + CleanupStack::PopAndDestroy(wait); // this is needed return KErrCancel; } - if( lCancelSupported && (!res || (res == ESecUiDeviceLocked))) + if( lCancelSupported && (queryAccepted == KErrCancel) ) { // cancel code request + RDEBUG( "AbortSecurityCode", 0 ); iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePin1); - CleanupStack::PopAndDestroy(wait); // TODO this is needed ??? + RDEBUG( "AbortSecurityCode", 1 ); + CleanupStack::PopAndDestroy(wait); // this is needed return KErrCancel; } - #if defined(_DEBUG) - RDebug::Print(_L("CSecurityNotifier::Pin1RequiredL()VerifySecurityCode")); - #endif - - RDebug::Printf( "%s %s (%u) iSecUi_password=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + RDEBUG( "iSecUi_password", iSecUi_password ); RDebug::Print( iSecUi_password ); + RDEBUG( "VerifySecurityCode", 0 ); iPhone.VerifySecurityCode(wait->iStatus,secCodeType, iSecUi_password, required_fourth); - + RDEBUG( "WaitForRequestL", 0 ); res = wait->WaitForRequestL(); + RDEBUG( "WaitForRequestL res", res ); CleanupStack::PopAndDestroy(wait); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Pin1RequiredL() VerifySecurityCode STATUS: %d"), res); - #endif + TInt returnValue = res; switch(res) { @@ -1129,7 +1112,7 @@ // CSecurityHandler::Puk1Required() // Handles Puk1Required event // ---------------------------------------------------------- -// +// qtdone TInt CSecurityHandler::Puk1RequiredL() { /***************************************************** @@ -1139,7 +1122,8 @@ #if defined(_DEBUG) RDebug::Print(_L("(SECUI)CSecurityHandler::Puk1RequiredL()")); #endif - RMobilePhone::TMobilePassword aPassword; + TInt queryAccepted = KErrCancel; + RMobilePhone::TMobilePassword iSecUi_password; RMobilePhone::TMobilePassword aNewPassword; RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); @@ -1153,20 +1137,19 @@ TInt res(KErrNone); wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Puk1RequiredL(): Get Code info")); - #endif - iPhone.GetSecurityCodeInfo(wait->iStatus, blockCodeType, codeInfoPkg); - res = wait->WaitForRequestL(); TInt thisTry = 0; // If there was a problem (as there might be in case we're dropping off SIM Access Profile); try again a couple of times. while ( res != KErrNone && ( thisTry++ ) <= KTriesToConnectServer ) { - User::After( KTimeBeforeRetryingRequest ); + if(thisTry>0) + User::After( KTimeBeforeRetryingRequest ); + RDEBUG( "GetSecurityCodeInfo", 0 ); iPhone.GetSecurityCodeInfo(wait->iStatus, blockCodeType, codeInfoPkg); - res = wait->WaitForRequestL(); + RDEBUG( "WaitForRequestL", 0 ); + res = wait->WaitForRequestL(); + RDEBUG( "WaitForRequestL res", res ); } #if defined(_DEBUG) RDebug::Print(_L("(SECUI)CSecurityHandler::Puk1RequiredL(): Get Code info result: %d"), res); @@ -1177,119 +1160,62 @@ #if defined(_DEBUG) RDebug::Print(_L("(SECUI)CSecurityHandler::Puk1RequiredL(): Show last note")); #endif + + RDEBUG( "StartUp", StartUp ); + RDEBUG( "codeInfo.iRemainingEntryAttempts", codeInfo.iRemainingEntryAttempts ); //show the last "Code Error" note of PIN verify result here so it won't be left under the PUK1 dialog if(!StartUp && (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPUKAttempts)) CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); // ask PUK code - iSecurityDlg = new (ELeave) CCodeQueryDialog (aPassword,SEC_C_PUK_CODE_MIN_LENGTH,SEC_C_PUK_CODE_MAX_LENGTH,ESecUiPukRequired); - if(AknLayoutUtils::PenEnabled()) - iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); - else - iSecurityDlg->SetEmergencyCallSupport(ETrue); - #ifdef __COVER_DISPLAY - iSecurityDlg->PublishDialogL(SecondaryDisplay::ECmdShowSecurityQuery, SecondaryDisplay::KCatStartup); - CAknMediatorFacade* covercl = AknMediatorFacade(iSecurityDlg); // uses MOP, so control provided - if (covercl) // returns null if __COVER_DISPLAY is not defined - { - // … - add data that cover ui is interested in - covercl->BufStream().WriteInt32L(SecondaryDisplay::EShowPUK1); // adds int to additional data to be posted to cover ui - covercl->BufStream().CommitL(); // no more data to send so commit buf - } - #endif //__COVER_DISPLAY + /* request PIN using QT */ + CSecQueryUi *iSecQueryUi; + RDEBUG( "CSecQueryUi", 0 ); + iSecQueryUi = CSecQueryUi::NewL(); + RDEBUG( "SecQueryDialog", 1 ); + // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful + // TODO also support Emergency + TBuf<0x100> title; title.Zero(); title.Append(_L("Puk1RequiredL")); title.Append(_L("#")); title.AppendNum(codeInfo.iRemainingEntryAttempts); + queryAccepted = iSecQueryUi->SecQueryDialog( title, iSecUi_password, SEC_C_PUK_CODE_MIN_LENGTH,SEC_C_PUK_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported | ESecUiPukRequired ); + RDEBUG( "iSecUi_password", 0 ); + RDebug::Print( iSecUi_password ); + delete iSecQueryUi; + RDEBUG( "queryAccepted", queryAccepted ); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Puk1RequiredL(): Show dialog")); - #endif - if(codeInfo.iRemainingEntryAttempts == KMaxNumberOfPUKAttempts) - res = iSecurityDlg->ExecuteLD(R_PUK_REQUEST_QUERY); - else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_PUK_ATTEMPTS, codeInfo.iRemainingEntryAttempts); - res = iSecurityDlg->ExecuteLD(R_PUK_REQUEST_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - else - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_PUK_ATTEMPT); - res = iSecurityDlg->ExecuteLD(R_PUK_REQUEST_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - - if((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) + if( (queryAccepted == KErrAbort) || (queryAccepted==KErrCancel) ) { - CleanupStack::PopAndDestroy(wait); + CleanupStack::PopAndDestroy(wait); // TODO this is needed ??? return KErrCancel; } - - RMobilePhone::TMobilePassword verifcationPassword; - // new pin code query - iSecurityDlg = new (ELeave) CCodeQueryDialog (aNewPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiPukRequired); - if(AknLayoutUtils::PenEnabled()) - iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); - else - iSecurityDlg->SetEmergencyCallSupport(ETrue); - res = iSecurityDlg->ExecuteLD(R_NEW_PIN_CODE_REQUEST_QUERY); - if((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) + + { + // new pin code query + CSecQueryUi *iSecQueryUi; + RDEBUG( "CSecQueryUi", 0 ); + iSecQueryUi = CSecQueryUi::NewL(); + RDEBUG( "SecQueryDialog", 1 ); + // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful + // TODO also support Emergency + + queryAccepted = iSecQueryUi->SecQueryDialog( _L("Puk1-New|Puk1-Verif"), aNewPassword, SEC_C_PUK_CODE_MIN_LENGTH,SEC_C_PUK_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported | ESecUiPukRequired ); + RDEBUG( "aNewPassword", 0 ); + RDebug::Print( aNewPassword ); + delete iSecQueryUi; + RDEBUG( "queryAccepted", queryAccepted ); + } + + if( (queryAccepted == KErrAbort) || (queryAccepted==KErrCancel) ) { CleanupStack::PopAndDestroy(wait); return KErrCancel; } - - // verification code query - iSecurityDlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiPukRequired); - if(AknLayoutUtils::PenEnabled()) - iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); - else - iSecurityDlg->SetEmergencyCallSupport(ETrue); - res = iSecurityDlg->ExecuteLD(R_VERIFY_NEW_PIN_CODE_REQUEST_QUERY); - if((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) - { - CleanupStack::PopAndDestroy(wait); - return KErrCancel; - } - - while (aNewPassword.CompareF(verifcationPassword) != 0) - { - // codes do not match -> note -> ask new pin and verification codes again - CSecuritySettings::ShowResultNoteL(R_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone); - - verifcationPassword = _L(""); - aNewPassword = _L(""); - - // new pin code query - iSecurityDlg = new (ELeave) CCodeQueryDialog (aNewPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiPukRequired); - if(AknLayoutUtils::PenEnabled()) - iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); - else - iSecurityDlg->SetEmergencyCallSupport(ETrue); - res = iSecurityDlg->ExecuteLD(R_NEW_PIN_CODE_REQUEST_QUERY); - if ((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) - { - CleanupStack::PopAndDestroy(wait); - return KErrCancel; - } - - // verification code query - iSecurityDlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiPukRequired); - if(AknLayoutUtils::PenEnabled()) - iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); - else - iSecurityDlg->SetEmergencyCallSupport(ETrue); - res = iSecurityDlg->ExecuteLD(R_VERIFY_NEW_PIN_CODE_REQUEST_QUERY); - if((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) - { - CleanupStack::PopAndDestroy(wait); - return KErrCancel; - } - } // send code - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Puk1RequiredL(): Verify Code")); - #endif - iPhone.VerifySecurityCode(wait->iStatus,blockCodeType,aNewPassword,aPassword); + RDEBUG( "VerifySecurityCode", 0 ); + iPhone.VerifySecurityCode(wait->iStatus,blockCodeType,aNewPassword,iSecUi_password); + RDEBUG( "WaitForRequestL", 0 ); res = wait->WaitForRequestL(); + RDEBUG( "WaitForRequestL res", res ); CleanupStack::PopAndDestroy(wait); TInt returnValue = res; @@ -1307,6 +1233,7 @@ break; case KErrGsm0707SimWrong: // sim lock active + // TODO no message ? break; case KErrGsmSSPasswordAttemptsViolation: case KErrLocked: @@ -1325,36 +1252,19 @@ // CSecurityHandler::Pin2Required() // Handles Pin2Required event // ---------------------------------------------------------- -// +// qtdone void CSecurityHandler::Pin2RequiredL() { /***************************************************** * Series 60 Customer / ETel * Series 60 ETel API *****************************************************/ - /* request PIN using QT */ - TBool queryAccepted = EFalse; - RMobilePhone::TMobilePassword iSecUi_password; - CSecQueryUi *iSecQueryUi; - RDebug::Printf( "%s %s (%u) CSecQueryUi=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - iSecQueryUi = CSecQueryUi::NewL(); - RDebug::Printf( "%s %s (%u) Copy=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - iSecUi_password.Copy(_L("666")); - RDebug::Printf( "%s %s (%u) SecQueryDialog=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - queryAccepted = iSecQueryUi->SecQueryDialog( _L("Pin2RequiredL"), iSecUi_password, 4, 8, RMobilePhone::ESecurityCodePin2 /*aMode*/ ); - RDebug::Printf( "%s %s (%u) iSecUi_password=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - RDebug::Print( iSecUi_password ); - RDebug::Printf( "%s %s (%u) delete=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - delete iSecQueryUi; - RDebug::Printf( "%s %s (%u) done=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - // if(queryAccepted) res=0xFFFFFFFE; // this is the value returned from iSecurityDlg - /* end request PIN using QT */ - #if defined(_DEBUG) RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL() BEGIN")); #endif - RMobilePhone::TMobilePassword password; + TInt queryAccepted = KErrCancel; + RMobilePhone::TMobilePassword iSecUi_password; RMobilePhone::TMobilePassword required_fourth; RMobilePhone::TMobilePhoneSecurityCode secCodeType(RMobilePhone::ESecurityCodePin2); RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; @@ -1362,75 +1272,48 @@ CWait* wait = CWait::NewL(); CleanupStack::PushL(wait); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): create dialog")); - #endif - iSecurityDlg = new (ELeave) CCodeQueryDialog (password,SEC_C_PIN2_CODE_MIN_LENGTH,SEC_C_PIN2_CODE_MAX_LENGTH,ESecUiNone); - #ifdef __COVER_DISPLAY - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): publish dialog")); - #endif - iSecurityDlg->PublishDialogL(SecondaryDisplay::ECmdShowSecurityQuery, SecondaryDisplay::KCatStartup); - CAknMediatorFacade* covercl = AknMediatorFacade(iSecurityDlg); // uses MOP, so control provided - if (covercl) // returns null if __COVER_DISPLAY is not defined - { - // … - add data that cover ui is interested in - covercl->BufStream().WriteInt32L(SecondaryDisplay::EShowPIN2); // adds int to additional data to be posted to cover ui - covercl->BufStream().CommitL(); // no more data to send so commit buf - } - #endif //__COVER_DISPLAY - - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): get PIN2 info")); - #endif - - wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); + wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); + RDEBUG( "GetSecurityCodeInfo", 0 ); iPhone.GetSecurityCodeInfo(wait->iStatus, secCodeType, codeInfoPkg); + RDEBUG( "WaitForRequestL", 0 ); TInt ret = wait->WaitForRequestL(); - - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): get PIN2 info result: %d"), ret); + RDEBUG( "WaitForRequestL ret", ret ); + + User::LeaveIfError(ret); + TInt attempts(codeInfo.iRemainingEntryAttempts); - RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): attempts remaining: %d"), attempts); - #endif - User::LeaveIfError(ret); - - CSecUiLockObserver* deviceLockStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg); - CleanupStack::PushL(deviceLockStatusObserver); - CSecUiLockObserver* queryStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg, ESecUiRequestStateObserver); - CleanupStack::PushL(queryStatusObserver); - - if(codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) - ret = iSecurityDlg->ExecuteLD(R_PIN2_QUERY); - else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_PIN2_ATTEMPTS, codeInfo.iRemainingEntryAttempts ); - ret = iSecurityDlg->ExecuteLD(R_PIN2_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - else - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_PIN2_ATTEMPT); - ret = iSecurityDlg->ExecuteLD(R_PIN2_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - CleanupStack::PopAndDestroy(2); //deviceLockStatusObserver, queryStatusObserver - iSecurityDlg = NULL; - if (!ret || (ret == ESecUiDeviceLocked)) + RDEBUG( "attempts", attempts ); + + /* request PIN using QT */ + CSecQueryUi *iSecQueryUi; + RDEBUG( "CSecQueryUi", 0 ); + iSecQueryUi = CSecQueryUi::NewL(); + RDEBUG( "SecQueryDialog", 1 ); + // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful against KLastRemainingInputAttempt + // TODO also support Emergency + + TBuf<0x100> title; title.Zero(); title.Append(_L("Pin2RequiredL")); title.Append(_L("#")); title.AppendNum(codeInfo.iRemainingEntryAttempts); + queryAccepted = iSecQueryUi->SecQueryDialog( title, iSecUi_password, SEC_C_PIN2_CODE_MIN_LENGTH, SEC_C_PIN2_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported | secCodeType ); + RDEBUG( "iSecUi_password", 0 ); + RDebug::Print( iSecUi_password ); + RDEBUG( "queryAccepted", queryAccepted ); + delete iSecQueryUi; + + // If failed or device became locked, any pending request should be cancelled. + if ( queryAccepted!=KErrNone ) { - iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePin2); + RDEBUG( "AbortSecurityCode", 0 ); + iPhone.AbortSecurityCode(secCodeType); + RDEBUG( "AbortSecurityCode", 1 ); CleanupStack::PopAndDestroy(wait); return; } - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): Verify Code")); - #endif - iPhone.VerifySecurityCode(wait->iStatus,secCodeType,password,required_fourth); + RDEBUG( "VerifySecurityCode", 0 ); + iPhone.VerifySecurityCode(wait->iStatus,secCodeType,iSecUi_password,required_fourth); + RDEBUG( "WaitForRequestL", 0 ); TInt status = wait->WaitForRequestL(); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): destroy wait")); - #endif + RDEBUG( "WaitForRequestL status", status ); CleanupStack::PopAndDestroy(wait); switch(status) @@ -1460,21 +1343,21 @@ // CSecurityHandler::Puk2Required() // Handles Puk2Required event // ---------------------------------------------------------- -// +// qtdone void CSecurityHandler::Puk2RequiredL() { /***************************************************** * Series 60 Customer / ETel * Series 60 ETel API *****************************************************/ - RMobilePhone::TMobilePassword aPassword; + TInt queryAccepted = KErrCancel; + RMobilePhone::TMobilePassword iSecUi_password; RMobilePhone::TMobilePassword aNewPassword; RMobilePhone::TMobilePassword verifcationPassword; RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); - RMobilePhone::TMobilePhoneSecurityCode blockCodeType; - blockCodeType = RMobilePhone::ESecurityCodePuk2; + RMobilePhone::TMobilePhoneSecurityCode secCodeType = RMobilePhone::ESecurityCodePuk2; CWait* wait = CWait::NewL(); CleanupStack::PushL(wait); @@ -1482,127 +1365,71 @@ RDebug::Print(_L("(SECUI)CSecurityHandler::Puk2RequiredL()")); #endif // ask PUK2 - iSecurityDlg = new (ELeave) CCodeQueryDialog (aPassword,SEC_C_PUK2_CODE_MIN_LENGTH,SEC_C_PUK2_CODE_MAX_LENGTH,ESecUiNone); - #ifdef __COVER_DISPLAY - iSecurityDlg->PublishDialogL(SecondaryDisplay::ECmdShowSecurityQuery, SecondaryDisplay::KCatStartup); - CAknMediatorFacade* covercl = AknMediatorFacade(iSecurityDlg); // uses MOP, so control provided - if (covercl) // returns null if __COVER_DISPLAY is not defined - { - // … - add data that cover ui is interested in - covercl->BufStream().WriteInt32L(SecondaryDisplay::EShowPUK2); // adds int to additional data to be posted to cover ui - covercl->BufStream().CommitL(); // no more data to send so commit buf - } - #endif //__COVER_DISPLAY - CSecUiLockObserver* deviceLockStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg); - CleanupStack::PushL(deviceLockStatusObserver); TInt ret(KErrNone); wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); - iPhone.GetSecurityCodeInfo(wait->iStatus, blockCodeType, codeInfoPkg); + RDEBUG( "GetSecurityCodeInfo", 0 ); + iPhone.GetSecurityCodeInfo(wait->iStatus, secCodeType, codeInfoPkg); + RDEBUG( "WaitForRequestL", 0 ); ret = wait->WaitForRequestL(); + RDEBUG( "WaitForRequestL ret", ret ); User::LeaveIfError(ret); - if(codeInfo.iRemainingEntryAttempts == KMaxNumberOfPUKAttempts) - ret = iSecurityDlg->ExecuteLD(R_PUK2_REQUEST_QUERY); - else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_PUK2_ATTEMPTS, codeInfo.iRemainingEntryAttempts); - ret = iSecurityDlg->ExecuteLD(R_PUK2_REQUEST_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - else - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_PUK2_ATTEMPT); - ret = iSecurityDlg->ExecuteLD(R_PUK2_REQUEST_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - - iSecurityDlg = NULL; - if(!ret || (ret == ESecUiDeviceLocked)) + /* request PIN using QT */ + CSecQueryUi *iSecQueryUi; + RDEBUG( "CSecQueryUi", 0 ); + iSecQueryUi = CSecQueryUi::NewL(); + RDEBUG( "SecQueryDialog", 1 ); + // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful + // TODO also support Emergency + + TBuf<0x100> title; title.Zero(); title.Append(_L("Puk2RequiredL")); title.Append(_L("#")); title.AppendNum(codeInfo.iRemainingEntryAttempts); + queryAccepted = iSecQueryUi->SecQueryDialog( title, iSecUi_password, SEC_C_PUK2_CODE_MIN_LENGTH,SEC_C_PUK2_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported | secCodeType /*aMode*/ ); + RDEBUG( "iSecUi_password", 0 ); + RDebug::Print( iSecUi_password ); + delete iSecQueryUi; + RDEBUG( "queryAccepted", queryAccepted ); + + if( queryAccepted!=KErrNone ) { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Puk2RequiredL() PUK QUERY CANCEL")); - #endif // cancel "get security unblock code" request - iPhone.AbortSecurityCode(blockCodeType); - CleanupStack::PopAndDestroy(2); //wait, deviceLockStatusObserver - return; - } - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Puk2RequiredL() NEW QUERY")); - #endif - // new pin2 code query - iSecurityDlg = new (ELeave) CCodeQueryDialog (aNewPassword,SEC_C_PIN2_CODE_MIN_LENGTH,SEC_C_PIN2_CODE_MAX_LENGTH,ESecUiNone); - deviceLockStatusObserver->SetAddress(iSecurityDlg); - ret = iSecurityDlg->ExecuteLD(R_NEW_PIN2_CODE_QUERY); - if(!ret || (ret == ESecUiDeviceLocked)) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Puk2RequiredL() NEW QUERY CANCEL")); - #endif - // cancel "get security unblock code" request - iPhone.AbortSecurityCode(blockCodeType); - CleanupStack::PopAndDestroy(2); //wait, deviceLockStatusObserver + RDEBUG( "AbortSecurityCode", 0 ); + iPhone.AbortSecurityCode(secCodeType); + RDEBUG( "AbortSecurityCode", 1 ); + CleanupStack::PopAndDestroy(1); //wait return; } - // verification code query - iSecurityDlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); - deviceLockStatusObserver->SetAddress(iSecurityDlg); - ret = iSecurityDlg->ExecuteLD(R_VERIFY_NEW_PIN2_CODE_QUERY); - if (!ret || (ret == ESecUiDeviceLocked)) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Puk2RequiredL() VERIFY QUERY CANCEL")); - #endif - // cancel "get security unblock code" request - iPhone.AbortSecurityCode(blockCodeType); - CleanupStack::PopAndDestroy(2); //wait, deviceLockStatusObserver - return; - } - - while (aNewPassword.CompareF(verifcationPassword) != 0) - { - // codes do not match -> note -> ask new pin and verification codes again - CSecuritySettings::ShowResultNoteL(R_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone); - - verifcationPassword = _L(""); - aNewPassword = _L(""); + { + // new pin code query + CSecQueryUi *iSecQueryUi; + RDEBUG( "CSecQueryUi", 0 ); + iSecQueryUi = CSecQueryUi::NewL(); + // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful + // TODO also support Emergency - // new pin2 code query - iSecurityDlg = new (ELeave) CCodeQueryDialog (aNewPassword,SEC_C_PIN2_CODE_MIN_LENGTH,SEC_C_PIN2_CODE_MAX_LENGTH,ESecUiNone); - deviceLockStatusObserver->SetAddress(iSecurityDlg); - deviceLockStatusObserver->StartObserver(); - - ret = iSecurityDlg->ExecuteLD(R_NEW_PIN2_CODE_QUERY); - - if(!ret || (ret == ESecUiDeviceLocked)) - { - // cancel "get security unblock code" request - iPhone.AbortSecurityCode(blockCodeType); - CleanupStack::PopAndDestroy(2); //wait, deviceLockStatusObserver - return; - } - - // verification code query - iSecurityDlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); - deviceLockStatusObserver->SetAddress(iSecurityDlg); - deviceLockStatusObserver->StartObserver(); - ret = iSecurityDlg->ExecuteLD(R_VERIFY_NEW_PIN2_CODE_QUERY); - - if (!ret || (ret == ESecUiDeviceLocked)) - { - // cancel "get security unblock code" request - iPhone.AbortSecurityCode(blockCodeType); - CleanupStack::PopAndDestroy(2); //wait, deviceLockStatusObserver - return; - } - } - CleanupStack::PopAndDestroy(deviceLockStatusObserver); + queryAccepted = iSecQueryUi->SecQueryDialog( _L("Puk2-New|Puk2-Verif"), aNewPassword, SEC_C_PUK2_CODE_MIN_LENGTH,SEC_C_PUK2_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported | secCodeType ); + RDEBUG( "aNewPassword", 0 ); + RDebug::Print( aNewPassword ); + delete iSecQueryUi; + RDEBUG( "queryAccepted", queryAccepted ); + if( queryAccepted!=KErrNone ) + { + // cancel "get security unblock code" request + RDEBUG( "AbortSecurityCode", 0 ); + iPhone.AbortSecurityCode(secCodeType); + RDEBUG( "AbortSecurityCode", 1 ); + CleanupStack::PopAndDestroy(1); //wait + return; + } + } // send code - - iPhone.VerifySecurityCode(wait->iStatus,blockCodeType,aNewPassword,aPassword); + // TODO the current code should be verified before + RDEBUG( "VerifySecurityCode", 0 ); + iPhone.VerifySecurityCode(wait->iStatus,secCodeType,aNewPassword,iSecUi_password); + RDEBUG( "WaitForRequestL", 0 ); TInt res = wait->WaitForRequestL(); + RDEBUG( "WaitForRequestL res", res ); CleanupStack::PopAndDestroy(wait); switch(res) @@ -1634,7 +1461,7 @@ // CSecurityHandler::UPinRequiredL() // Hendles UniversalPinRequired event // ---------------------------------------------------------- -// +// qtdone TInt CSecurityHandler::UPinRequiredL() { /***************************************************** @@ -1645,7 +1472,9 @@ TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); if(wcdmaSupported || upinSupported) { - RMobilePhone::TMobilePassword password; + TInt queryAccepted = KErrCancel; + TInt lCancelSupported = ESecUiCancelNotSupported; + RMobilePhone::TMobilePassword iSecUi_password; RMobilePhone::TMobilePassword required_fourth; RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); @@ -1658,124 +1487,56 @@ TInt res = KErrGeneral; StartUp = iStartup; + RDEBUG( "StartUp", StartUp ); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::UPinRequiredL()")); - #endif - + + wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); + RDEBUG( "GetSecurityCodeInfo", 0 ); + iPhone.GetSecurityCodeInfo(wait->iStatus, secCodeType, codeInfoPkg); + RDEBUG( "WaitForRequestL", 0 ); + res = wait->WaitForRequestL(); + RDEBUG( "WaitForRequestL res", res ); + User::LeaveIfError(res); + if(!StartUp) { // read a flag to see whether the query is SecUi originated. err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, secUiOriginatedQuery); } - - #if defined(_DEBUG) - RDebug::Print(_L("CSecurityHandler::UPinRequiredL() Execute dlg")); - #endif - if(StartUp || (secUiOriginatedQuery != ESecurityUIsSecUIOriginated) || (err != KErrNone)) - { - iSecurityDlg = new (ELeave) CCodeQueryDialog (password,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiCodeEtelReqest); - if(AknLayoutUtils::PenEnabled()) - iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); - else - iSecurityDlg->SetEmergencyCallSupport(ETrue); - #ifdef __COVER_DISPLAY - iSecurityDlg->PublishDialogL(SecondaryDisplay::ECmdShowSecurityQuery, SecondaryDisplay::KCatStartup); - CAknMediatorFacade* covercl = AknMediatorFacade(iSecurityDlg); // uses MOP, so control provided - if (covercl) // returns null if __COVER_DISPLAY is not defined - { - // … - add data that cover ui is interested in - covercl->BufStream().WriteInt32L(SecondaryDisplay::EShowUPIN); // adds int to additional data to be posted to cover ui - covercl->BufStream().CommitL(); // no more data to send so commit buf - } - #endif //__COVER_DISPLAY - - wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); - iPhone.GetSecurityCodeInfo(wait->iStatus, secCodeType, codeInfoPkg); - res = wait->WaitForRequestL(); - User::LeaveIfError(res); - - if(codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) - res = iSecurityDlg->ExecuteLD(R_UPIN_REQUEST_QUERY); - else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_UPIN_ATTEMPTS, codeInfo.iRemainingEntryAttempts); - res = iSecurityDlg->ExecuteLD(R_UPIN_REQUEST_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - else - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_UPIN_ATTEMPT); - res = iSecurityDlg->ExecuteLD(R_UPIN_REQUEST_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - - - if ((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) - { - CleanupStack::PopAndDestroy(wait); - return KErrCancel; - } - } - else - { - iSecurityDlg = new (ELeave) CCodeQueryDialog (password,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); - #ifdef __COVER_DISPLAY - iSecurityDlg->PublishDialogL(SecondaryDisplay::ECmdShowSecurityQuery, SecondaryDisplay::KCatStartup); - CAknMediatorFacade* covercl = AknMediatorFacade(iSecurityDlg); // uses MOP, so control provided - if (covercl) // returns null if __COVER_DISPLAY is not defined - { - // … - add data that cover ui is interested in - covercl->BufStream().WriteInt32L(SecondaryDisplay::EShowUPIN); // adds int to additional data to be posted to cover ui - covercl->BufStream().CommitL(); // no more data to send so commit buf - } - #endif //__COVER_DISPLAY - - wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); - iPhone.GetSecurityCodeInfo(wait->iStatus, secCodeType, codeInfoPkg); - res = wait->WaitForRequestL(); - User::LeaveIfError(res); - - CSecUiLockObserver* deviceLockStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg); - CleanupStack::PushL(deviceLockStatusObserver); - CSecUiLockObserver* queryStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg, ESecUiRequestStateObserver); - CleanupStack::PushL(queryStatusObserver); - - if(codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) - res = iSecurityDlg->ExecuteLD(R_UPIN_QUERY); - else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_UPIN_ATTEMPTS, codeInfo.iRemainingEntryAttempts); - res = iSecurityDlg->ExecuteLD(R_UPIN_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - else - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_UPIN_ATTEMPT); - res = iSecurityDlg->ExecuteLD(R_UPIN_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - - CleanupStack::PopAndDestroy(2); //deviceLockStatusObserver, queryStatusObserver - iSecurityDlg = NULL; - if( !res || (res == ESecUiDeviceLocked)) - { - // cancel code request - CleanupStack::PopAndDestroy(wait); - iPhone.AbortSecurityCode(RMobilePhone::ESecurityUniversalPin); - return KErrCancel; - } - } - - #if defined(_DEBUG) - RDebug::Print(_L("CSecurityNotifier::UPinRequiredL()VerifySecurityCode")); - #endif - iPhone.VerifySecurityCode(wait->iStatus,secCodeType, password, required_fourth); + + /* request PIN using QT */ + CSecQueryUi *iSecQueryUi; + RDEBUG( "CSecQueryUi", 0 ); + iSecQueryUi = CSecQueryUi::NewL(); + // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful + // TODO also support Emergency + if(StartUp || (secUiOriginatedQuery != ESecurityUIsSecUIOriginated) || (err != KErrNone)) + lCancelSupported = ESecUiCancelNotSupported; + else + lCancelSupported = ESecUiCancelSupported; + + TBuf<0x100> title; title.Zero(); title.Append(_L("UPin1RequiredL")); title.Append(_L("#")); title.AppendNum(codeInfo.iRemainingEntryAttempts); + queryAccepted = iSecQueryUi->SecQueryDialog( title, iSecUi_password, SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | lCancelSupported | ESecUiCodeEtelReqest ); + RDEBUG( "iSecUi_password", 0 ); + RDebug::Print( iSecUi_password ); + delete iSecQueryUi; + RDEBUG( "queryAccepted", queryAccepted ); + if ( queryAccepted!=KErrNone ) + { + CleanupStack::PopAndDestroy(wait); + RDEBUG( "AbortSecurityCode", 0 ); + iPhone.AbortSecurityCode(RMobilePhone::ESecurityUniversalPin); + RDEBUG( "AbortSecurityCode", 1 ); + + return KErrCancel; + } + RDEBUG( "VerifySecurityCode", 0 ); + iPhone.VerifySecurityCode(wait->iStatus,secCodeType, iSecUi_password, required_fourth); + RDEBUG( "WaitForRequestL", 0 ); res = wait->WaitForRequestL(); + RDEBUG( "WaitForRequestL res", res ); CleanupStack::PopAndDestroy(wait); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::UPinRequiredL() VerifySecurityCode STATUS: %d"), res); - #endif + TInt returnValue = res; switch(res) { @@ -1823,17 +1584,16 @@ // CSecurityHandler::UPukRequiredL() // Handles UPukRequired event // ---------------------------------------------------------- -// +// qtdone TInt CSecurityHandler::UPukRequiredL() { TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); if(wcdmaSupported || upinSupported) { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::UPukRequiredL()")); - #endif - RMobilePhone::TMobilePassword aPassword; + RDEBUG( "0", 0 ); + TInt queryAccepted = KErrCancel; + RMobilePhone::TMobilePassword iSecUi_password; RMobilePhone::TMobilePassword aNewPassword; RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); @@ -1848,117 +1608,65 @@ TInt res(KErrNone); wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); + RDEBUG( "GetSecurityCodeInfo", 0 ); iPhone.GetSecurityCodeInfo(wait->iStatus, blockCodeType, codeInfoPkg); + RDEBUG( "WaitForRequestL", 0 ); res = wait->WaitForRequestL(); + RDEBUG( "WaitForRequestL res", res ); User::LeaveIfError(res); //show last "Code Error" note for UPIN verify result so it won't be left under the PUK1 dialog if(!StartUp && (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPUKAttempts)) CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); // ask UPUK code - iSecurityDlg = new (ELeave) CCodeQueryDialog (aPassword,SEC_C_PUK_CODE_MIN_LENGTH,SEC_C_PUK_CODE_MAX_LENGTH,ESecUiPukRequired); - if(AknLayoutUtils::PenEnabled()) - iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); - else - iSecurityDlg->SetEmergencyCallSupport(ETrue); - #ifdef __COVER_DISPLAY - iSecurityDlg->PublishDialogL(SecondaryDisplay::ECmdShowSecurityQuery, SecondaryDisplay::KCatStartup); - CAknMediatorFacade* covercl = AknMediatorFacade(iSecurityDlg); // uses MOP, so control provided - if (covercl) // returns null if __COVER_DISPLAY is not defined - { - // … - add data that cover ui is interested in - covercl->BufStream().WriteInt32L(SecondaryDisplay::EShowUPUK);// adds int to additional data to be posted to cover ui - covercl->BufStream().CommitL(); // no more data to send so commit buf - } - #endif //__COVER_DISPLAY + /* request PIN using QT */ + { + CSecQueryUi *iSecQueryUi; + RDEBUG( "CSecQueryUi", 0 ); + iSecQueryUi = CSecQueryUi::NewL(); + // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful + // TODO also support Emergency + + TBuf<0x100> title; title.Zero(); title.Append(_L("Pin1RequiredL")); title.Append(_L("#")); title.AppendNum(codeInfo.iRemainingEntryAttempts); + queryAccepted = iSecQueryUi->SecQueryDialog( title, iSecUi_password, SEC_C_PUK_CODE_MIN_LENGTH,SEC_C_PUK_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported | ESecUiPukRequired ); + RDEBUG( "iSecUi_password", 0 ); + RDebug::Print( iSecUi_password ); + delete iSecQueryUi; + RDEBUG( "queryAccepted", queryAccepted ); - - if(codeInfo.iRemainingEntryAttempts == KMaxNumberOfPUKAttempts) - res = iSecurityDlg->ExecuteLD(R_UPUK_REQUEST_QUERY); - else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_UPUK_ATTEMPTS, codeInfo.iRemainingEntryAttempts); - res = iSecurityDlg->ExecuteLD(R_UPUK_REQUEST_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - else - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_UPUK_ATTEMPT); - res = iSecurityDlg->ExecuteLD(R_UPUK_REQUEST_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - - if((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) + if( queryAccepted!=KErrNone ) { CleanupStack::PopAndDestroy(wait); return KErrCancel; } - - RMobilePhone::TMobilePassword verifcationPassword; - // new upin code query - iSecurityDlg = new (ELeave) CCodeQueryDialog (aNewPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiPukRequired); - if(AknLayoutUtils::PenEnabled()) - iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); - else - iSecurityDlg->SetEmergencyCallSupport(ETrue); - res = iSecurityDlg->ExecuteLD(R_NEW_UPIN_CODE_REQUEST_QUERY); - if((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) + } + + { + /* request PIN using QT */ + CSecQueryUi *iSecQueryUi; + RDEBUG( "CSecQueryUi", 0 ); + iSecQueryUi = CSecQueryUi::NewL(); + // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful + // TODO also support Emergency + + queryAccepted = iSecQueryUi->SecQueryDialog( _L("UPuk-New|UPuk-Verif"), aNewPassword, SEC_C_PUK_CODE_MIN_LENGTH,SEC_C_PUK_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported | ESecUiPukRequired ); + RDEBUG( "aNewPassword", 0 ); + RDebug::Print( aNewPassword ); + delete iSecQueryUi; + RDEBUG( "queryAccepted", queryAccepted ); + if( queryAccepted!=KErrNone ) { CleanupStack::PopAndDestroy(wait); return KErrCancel; } - - // verification code query - iSecurityDlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiPukRequired); - if(AknLayoutUtils::PenEnabled()) - iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); - else - iSecurityDlg->SetEmergencyCallSupport(ETrue); - res = iSecurityDlg->ExecuteLD(R_VERIFY_NEW_UPIN_CODE_REQUEST_QUERY); - if((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) - { - CleanupStack::PopAndDestroy(wait); - return KErrCancel; - } - - while (aNewPassword.CompareF(verifcationPassword) != 0) - { - // codes do not match -> note -> ask new upin and verification codes again - CSecuritySettings::ShowResultNoteL(R_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone); - - verifcationPassword = _L(""); - aNewPassword = _L(""); - - // new upin code query - iSecurityDlg = new (ELeave) CCodeQueryDialog (aNewPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiPukRequired); - if(AknLayoutUtils::PenEnabled()) - iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); - else - iSecurityDlg->SetEmergencyCallSupport(ETrue); - res = iSecurityDlg->ExecuteLD(R_NEW_UPIN_CODE_REQUEST_QUERY); - if((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) - { - CleanupStack::PopAndDestroy(wait); - return KErrCancel; - } - - // verification code query - iSecurityDlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiPukRequired); - if(AknLayoutUtils::PenEnabled()) - iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); - else - iSecurityDlg->SetEmergencyCallSupport(ETrue); - res = iSecurityDlg->ExecuteLD(R_VERIFY_NEW_UPIN_CODE_REQUEST_QUERY); - if((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) - { - CleanupStack::PopAndDestroy(wait); - return KErrCancel; - } - } - + } + // send code - iPhone.VerifySecurityCode(wait->iStatus,blockCodeType,aNewPassword,aPassword); + RDEBUG( "VerifySecurityCode", 0 ); + iPhone.VerifySecurityCode(wait->iStatus,blockCodeType,aNewPassword,iSecUi_password); + RDEBUG( "WaitForRequestL", 0 ); res = wait->WaitForRequestL(); + RDEBUG( "WaitForRequestL res", res ); CleanupStack::PopAndDestroy(wait); TInt returnValue = res; @@ -1989,7 +1697,7 @@ return returnValue; } - else + else // not wcdmaSupported || upinSupported return KErrNone; } @@ -1998,12 +1706,10 @@ // CSecurityHandler::SimLockEventL() // Shows "SIM restriction on" note // ---------------------------------------------------------- -// +// qtdone void CSecurityHandler::SimLockEventL() { - #if defined(_DEBUG) - RDebug::Print(_L("CSecurityHandler::SimLockEventL()")); - #endif + RDEBUG( "0", 0 ); CSecuritySettings::ShowResultNoteL(R_SIM_ON, CAknNoteDialog::EConfirmationTone); } // --------------------------------------------------------- @@ -2019,10 +1725,13 @@ // CSecurityHandler::ShowGenericErrorNoteL(TInt aStatus) // Shows a generic error note // --------------------------------------------------------- - +// qtdone void CSecurityHandler::ShowGenericErrorNoteL(TInt aStatus) { // Let's create TextResolver instance for error resolving... + RDEBUG( "aStatus", aStatus ); + RDEBUG( "!!!!! this should never be called !!!!", 0 ); + CTextResolver* textresolver = CTextResolver::NewLC(); // Resolve the error TPtrC errorstring; diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/SecUi/Src/SecUiSecuritySettings.cpp --- a/securitydialogs/SecUi/Src/SecUiSecuritySettings.cpp Fri Apr 16 15:53:24 2010 +0300 +++ b/securitydialogs/SecUi/Src/SecUiSecuritySettings.cpp Mon May 03 13:20:16 2010 +0300 @@ -62,12 +62,14 @@ const TInt KMaxNumberOfPINAttempts(3); const TInt KLastRemainingInputAttempt(1); +#define ESecUiTypeLock 0x00100000 + // ================= MEMBER FUNCTIONS ======================= // // ---------------------------------------------------------- // CSecuritySettings::NewL() // ---------------------------------------------------------- -// +// qtdone EXPORT_C CSecuritySettings* CSecuritySettings::NewL() { CSecuritySettings* self = new (ELeave) CSecuritySettings(); @@ -81,7 +83,7 @@ // CSecuritySettings::CSecuritySettings() // constructor // ---------------------------------------------------------- -// +// qtdone EXPORT_C CSecuritySettings::CSecuritySettings() { } @@ -90,7 +92,7 @@ // CSecuritySettings::ConstructL() // Symbian OS constructor. // ---------------------------------------------------------- -// +// qtdone EXPORT_C void CSecuritySettings::ConstructL() { /***************************************************** @@ -143,7 +145,7 @@ // CSecuritySettings::~CSecuritySettings() // Destructor // ---------------------------------------------------------- -// +// qtdone EXPORT_C CSecuritySettings::~CSecuritySettings() { /***************************************************** @@ -195,27 +197,21 @@ // CSecuritySettings::ChangePinL() // Changes PIN1 // ---------------------------------------------------------- -// +// qtdone EXPORT_C void CSecuritySettings::ChangePinL() { - RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); + RDEBUG( "0", 0 ); RMobilePhone::TMobilePassword iOldPassword; RMobilePhone::TMobilePassword iNewPassword; - TInt iFlags=0; - RDebug::Printf( "%s %s (%u) iOldPassword=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); + TInt iFlags=ESecUiTypeLock; iOldPassword.Copy(_L("")); - RDebug::Printf( "%s %s (%u) iNewPassword=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); iNewPassword.Copy(_L("")); - RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); TBuf<0x80> iCaption; - RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); iCaption.Copy(_L("ChangePinL")); - RDebug::Printf( "%s %s (%u) iCaption=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); - RDebug::Print(iCaption); TInt iShowError=1; ChangePinParamsL(iOldPassword, iNewPassword, iFlags, iCaption, iShowError); - RDebug::Printf( "%s %s (%u) iCaption=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); + RDEBUG( "0", 0 ); } // @@ -223,174 +219,21 @@ // CSecuritySettings::ChangeUPinL() // Changes Universal PIN // ---------------------------------------------------------- -// +// qtdone EXPORT_C void CSecuritySettings::ChangeUPinL() { - TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); - TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); - if(wcdmaSupported || upinSupported) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeUPinL()")); - #endif - TInt simState; - TInt err( KErrGeneral ); - err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); - User::LeaveIfError( err ); - TBool simRemoved(simState == ESimNotPresent); - - if ( simRemoved ) - { - ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); - return; - } - - RMobilePhone::TMobilePhoneSecurityCode secCodeType; - secCodeType = RMobilePhone::ESecurityUniversalPin; - - RMobilePhone::TMobilePassword oldPassword; - RMobilePhone::TMobilePassword newPassword; - RMobilePhone::TMobilePassword verifcationPassword; - RMobilePhone::TMobilePhonePasswordChangeV1 passwords; - RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; - RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); - - CCodeQueryDialog* verdlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); - CleanupStack::PushL(verdlg); - - CCodeQueryDialog* newdlg = new (ELeave) CCodeQueryDialog(newPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); - CleanupStack::PushL(newdlg); - - CCodeQueryDialog* dlg = new (ELeave) CCodeQueryDialog (oldPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); - CleanupStack::PushL(dlg); - - RMobilePhone::TMobilePhoneLock lockType; - RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; - - lockType = RMobilePhone::ELockUniversalPin; - - RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); - iWait->SetRequestType(EMobilePhoneGetLockInfo); - iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); - TInt res = iWait->WaitForRequestL(); - User::LeaveIfError(res); - - if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) - { - CleanupStack::PopAndDestroy(3,verdlg); - ShowResultNoteL(R_UPIN_NOT_ALLOWED, CAknNoteDialog::EErrorTone); - return; - } - - CleanupStack::Pop(); // dlg - // ask pin - iWait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); - iPhone.GetSecurityCodeInfo(iWait->iStatus, secCodeType, codeInfoPkg); - res = iWait->WaitForRequestL(); - User::LeaveIfError(res); - - if(codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) - res = dlg->ExecuteLD(R_UPIN_QUERY); - else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_UPIN_ATTEMPTS, codeInfo.iRemainingEntryAttempts); - res = dlg->ExecuteLD(R_UPIN_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - else - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_UPIN_ATTEMPT); - res = dlg->ExecuteLD(R_UPIN_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - - - - if( !res ) - { - CleanupStack::PopAndDestroy(2,verdlg); - return; - } - CleanupStack::Pop(); // newdlg - // new pin code query - if (!(newdlg->ExecuteLD(R_NEW_UPIN_CODE_QUERY))) - { - CleanupStack::PopAndDestroy(verdlg); - return; - } - - CleanupStack::Pop(); // verdlg - // verification code query - if (!(verdlg->ExecuteLD(R_VERIFY_NEW_UPIN_CODE_QUERY))) - return; - - while (newPassword.CompareF(verifcationPassword) != 0) - { - // codes do not match -> note -> ask new pin and verification codes again - ShowResultNoteL(R_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone); - - newPassword = _L(""); - verifcationPassword = _L(""); - - // new pin code query - CCodeQueryDialog* newdlg = new (ELeave) CCodeQueryDialog (newPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); - if (!(newdlg->ExecuteLD(R_NEW_UPIN_CODE_QUERY))) - return; - - // verification code query - CCodeQueryDialog* verdlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); - if (!(verdlg->ExecuteLD(R_VERIFY_NEW_UPIN_CODE_QUERY))) - return; - } - - // send code - passwords.iOldPassword = oldPassword; - passwords.iNewPassword = newPassword; - iWait->SetRequestType(EMobilePhoneChangeSecurityCode); - iPhone.ChangeSecurityCode(iWait->iStatus, secCodeType, passwords); - res = iWait->WaitForRequestL(); - #if defined(_DEBUG) - RDebug::Print( _L("(SECUI)CSecuritySettings::ChangePinL(): RETURN CODE: %d"), res); - #endif - switch(res) - { - case KErrNone: - { - // code changed - ShowResultNoteL(R_UPIN_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); - break; - } - case KErrGsm0707IncorrectPassword: - case KErrAccessDenied: - { - // code was entered erroneously - ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); - ChangeUPinL(); - break; - } - case KErrGsmSSPasswordAttemptsViolation: - case KErrLocked: - { - return; - } - case KErrGsm0707OperationNotAllowed: - { - // not allowed with this sim - ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); - return; - } - case KErrAbort: - { - break; - } - default: - { - ShowErrorNoteL(res); - ChangeUPinL(); - break; - } - } - } + RDEBUG( "0", 0 ); + RMobilePhone::TMobilePassword iOldPassword; + RMobilePhone::TMobilePassword iNewPassword; + TInt iFlags=ESecUiTypeLock; + iOldPassword.Copy(_L("")); + iNewPassword.Copy(_L("")); + + TBuf<0x80> iCaption; + iCaption.Copy(_L("ChangeUPinL")); + TInt iShowError=1; + ChangeUPinParamsL(iOldPassword, iNewPassword, iFlags, iCaption, iShowError); + RDEBUG( "0", 0 ); } @@ -399,452 +242,63 @@ // CSecuritySettings::ChangePin2L() // Changes PIN2 // ---------------------------------------------------------- -// +// qtdone EXPORT_C void CSecuritySettings::ChangePin2L() { - /***************************************************** - * Series 60 Customer / ETel - * Series 60 ETel API - *****************************************************/ - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePin2L()")); - #endif - TInt simState; - TInt err( KErrGeneral ); - err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); - User::LeaveIfError( err ); - TBool simRemoved(simState == ESimNotPresent); - - if ( simRemoved ) - { - ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); - return; - } - - RMmCustomAPI::TSecurityCodeType secCodeType; - RMobilePhone::TMobilePhoneSecurityCode EtelsecCodeType; - secCodeType = RMmCustomAPI::ESecurityCodePin2; - RMobilePhone::TMobilePassword oldPassword; - RMobilePhone::TMobilePassword newPassword; - RMobilePhone::TMobilePassword verifcationPassword; - RMobilePhone::TMobilePhonePasswordChangeV1 passwords; - RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; - RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); - - // check if pin2 is blocked... - TBool isBlocked = EFalse; - - TInt ret = iCustomPhone.IsBlocked(secCodeType,isBlocked); - - if(isBlocked) - return; - - if (ret != KErrNone) - { - switch (ret) - { - // PIN2 Blocked. - case KErrGsm0707SIMPuk2Required: - break; - case KErrGsmSSPasswordAttemptsViolation: - case KErrLocked: - // Pin2 features blocked permanently! - ShowResultNoteL(R_PIN2_REJECTED, CAknNoteDialog::EConfirmationTone); - break; - case KErrGsm0707SimNotInserted: - // not allowed with this sim - ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); - break; - default: - ShowErrorNoteL(ret); - break; - } - return; - } - - CCodeQueryDialog* verdlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN2_CODE_MIN_LENGTH,SEC_C_PIN2_CODE_MAX_LENGTH,ESecUiNone); - CleanupStack::PushL(verdlg); - - CCodeQueryDialog* newdlg = new (ELeave) CCodeQueryDialog(newPassword,SEC_C_PIN2_CODE_MIN_LENGTH,SEC_C_PIN2_CODE_MAX_LENGTH,ESecUiNone); - CleanupStack::PushL(newdlg); - - CCodeQueryDialog* dlg = new (ELeave) CCodeQueryDialog (oldPassword,SEC_C_PIN2_CODE_MIN_LENGTH,SEC_C_PIN2_CODE_MAX_LENGTH,ESecUiNone); - CleanupStack::PushL(dlg); - - - // Security code must be changed to Etel API format - // Custom API Pin1 and Pin2 have the same enum values as the Etel ones - EtelsecCodeType = (RMobilePhone::TMobilePhoneSecurityCode)secCodeType; - #ifndef __WINS__ - iWait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); - iPhone.GetSecurityCodeInfo(iWait->iStatus, EtelsecCodeType, codeInfoPkg); - ret = iWait->WaitForRequestL(); - User::LeaveIfError(ret); - #else - codeInfo.iRemainingEntryAttempts = 1; - #endif //__WINS__ + RDEBUG( "0", 0 ); + RMobilePhone::TMobilePassword iOldPassword; + RMobilePhone::TMobilePassword iNewPassword; + TInt iFlags=ESecUiTypeLock; + iOldPassword.Copy(_L("")); + iNewPassword.Copy(_L("")); - if(codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) - ret = dlg->ExecuteLD(R_PIN2_QUERY); - else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_PIN2_ATTEMPTS, codeInfo.iRemainingEntryAttempts ); - ret = dlg->ExecuteLD(R_PIN2_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - else - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_PIN2_ATTEMPT); - ret = dlg->ExecuteLD(R_PIN2_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - - CleanupStack::Pop(); // dlg - if(!ret) - { - CleanupStack::PopAndDestroy(2,verdlg); - return; - } - - // new pin code query - CleanupStack::Pop(); // newdlg - if(!(newdlg->ExecuteLD(R_NEW_PIN2_CODE_QUERY))) - { - CleanupStack::PopAndDestroy(verdlg); - return; - } - - // verification code query - CleanupStack::Pop(); // verdlg - if(!(verdlg->ExecuteLD(R_VERIFY_NEW_PIN2_CODE_QUERY))) - { - return; - } - - while (newPassword.CompareF(verifcationPassword) != 0) - { - // codes do not match -> note -> ask new pin and verification codes again - ShowResultNoteL(R_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone); + TBuf<0x80> iCaption; + iCaption.Copy(_L("ChangePin2L")); + TInt iShowError=1; + ChangePin2ParamsL(iOldPassword, iNewPassword, iFlags, iCaption, iShowError); + RDEBUG( "0", 0 ); - newPassword = _L(""); - verifcationPassword = _L(""); - - // new pin code query - CCodeQueryDialog* dlg = new (ELeave) CCodeQueryDialog (newPassword,SEC_C_PIN2_CODE_MIN_LENGTH,SEC_C_PIN2_CODE_MAX_LENGTH,ESecUiNone); - if(!(dlg->ExecuteLD(R_NEW_PIN2_CODE_QUERY))) - return; - - // verification code query - CCodeQueryDialog* dlg2 = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN2_CODE_MIN_LENGTH,SEC_C_PIN2_CODE_MAX_LENGTH,ESecUiNone); - if(!(dlg2->ExecuteLD(R_VERIFY_NEW_PIN2_CODE_QUERY))) - return; - } - - - passwords.iOldPassword = oldPassword; - passwords.iNewPassword = newPassword; - iWait->SetRequestType(EMobilePhoneChangeSecurityCode); - iPhone.ChangeSecurityCode(iWait->iStatus,EtelsecCodeType,passwords); - TInt res = iWait->WaitForRequestL(); - #if defined(_DEBUG) - RDebug::Print( _L("(SECUI)CSecuritySettings::ChangePin2L(): RETURN CODE: %d"), res); - #endif - switch(res) - { - case KErrNone: - { - // code changed - ShowResultNoteL(R_PIN2_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); - break; - } - case KErrGsm0707IncorrectPassword: - case KErrAccessDenied: - { - ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); - ChangePin2L(); - break; - } - case KErrGsmSSPasswordAttemptsViolation: - case KErrLocked: - { - // Pin2 blocked! - ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); - CSecurityHandler* handler = new(ELeave) CSecurityHandler(iPhone); - CleanupStack::PushL(handler); - handler->HandleEventL(RMobilePhone::EPuk2Required); - CleanupStack::PopAndDestroy(handler); // handler - return; - } - case KErrGsm0707OperationNotAllowed: - { - // not allowed with this sim - ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); - return; - } - case KErrAbort: - { - break; - } - default: - { - ShowErrorNoteL(res); - ChangePin2L(); - break; - } - } } // // ---------------------------------------------------------- // CSecuritySettings::ChangeSecCodeL() // Changes security code // ---------------------------------------------------------- -// +// qtdone EXPORT_C void CSecuritySettings::ChangeSecCodeL() { - RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); + RDEBUG( "0", 0 ); RMobilePhone::TMobilePassword iOldPassword; RMobilePhone::TMobilePassword iNewPassword; TInt iFlags=0; - RDebug::Printf( "%s %s (%u) iOldPassword=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); iOldPassword.Copy(_L("")); - RDebug::Printf( "%s %s (%u) iNewPassword=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); iNewPassword.Copy(_L("")); - RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); TBuf<0x80> iCaption; - RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); iCaption.Copy(_L("ChangeSecCodeL")); - RDebug::Printf( "%s %s (%u) iCaption=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); - RDebug::Print(iCaption); TInt iShowError=1; ChangeSecCodeParamsL(iOldPassword, iNewPassword, iFlags, iCaption, iShowError); - RDebug::Printf( "%s %s (%u) iCaption=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); + RDEBUG( "0", 0 ); } // // ---------------------------------------------------------- // CSecuritySettings::ChangeAutoLockPeriodL() // Changes autolock period // ---------------------------------------------------------- -// +// qtdone EXPORT_C TInt CSecuritySettings::ChangeAutoLockPeriodL(TInt aPeriod) - { - /***************************************************** - * Series 60 Customer / ETel - * Series 60 ETel API - *****************************************************/ - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodLXXXX()")); - #endif - RMobilePhone::TMobilePhoneLockSetting lockChange(RMobilePhone::ELockSetDisabled); - RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; - TInt currentItem = 0; - TInt oldPeriod = aPeriod; - - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() ReadDesC16ArrayResourceL")); - #endif - - - CCoeEnv* coeEnv = CCoeEnv::Static(); - CDesCArrayFlat* items = coeEnv->ReadDesC16ArrayResourceL(R_AUTOLOCK_LBX); - CleanupStack::PushL(items); - - if (aPeriod == 0) - { - currentItem = 0; // autolock off - } - else - { - currentItem = 1; // user defined - } - - - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() New autolocksettingpage")); - #endif - - CAutoLockSettingPage* dlg = new (ELeave)CAutoLockSettingPage(R_AUTOLOCK_SETTING_PAGE, currentItem, items, aPeriod); - CleanupStack::PushL(dlg); - dlg->ConstructL(); - TInt maxPeriod; - if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw )) - { - // Retrieve the current autolock period max. value from the SCP server, - // and check that the value the user - // selected is ok from the Corporate Policy point of view. - RSCPClient scpClient; - TInt ret = scpClient.Connect(); - if ( ret == KErrNone ) - { - CleanupClosePushL( scpClient ); - TBuf maxPeriodBuf; - if ( scpClient.GetParamValue( ESCPMaxAutolockPeriod, maxPeriodBuf ) == KErrNone ) - { - TLex lex( maxPeriodBuf ); - if ( ( lex.Val( maxPeriod ) == KErrNone ) && ( maxPeriod > 0 ) ) - { - dlg->SetPeriodMaximumValue(maxPeriod); - } - else - { - maxPeriod = 0; - dlg->SetPeriodMaximumValue(maxPeriod); - } - - } - else - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL():\ - ERROR: Failed to retrieve max period")); - #endif - } - } - else - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL():\ - ERROR: Failed to connect to SCP.")); - #endif - } - CleanupStack::PopAndDestroy(); // scpClient -} - CleanupStack::Pop(); //dlg - if (!dlg->ExecuteLD(CAknSettingPage::EUpdateWhenChanged)) - { - CleanupStack::PopAndDestroy(items); - return oldPeriod; - } - - CleanupStack::PopAndDestroy(); // items - - if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw )) - { - TBool allow = ETrue; - - if ((aPeriod == 0) && (maxPeriod > 0)) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() \ - The period: %d is not allowed by TARM; max: %d"),aPeriod, maxPeriod ); - #endif - allow = EFalse; - HBufC* prompt; - prompt = StringLoader::LoadLC( R_SECUI_TEXT_AUTOLOCK_MUST_BE_ACTIVE ); - CAknNoteDialog* noteDlg = new (ELeave) CAknNoteDialog( REINTERPRET_CAST(CEikDialog**,¬eDlg) ); - noteDlg->PrepareLC( R_CODE_ERROR ); - noteDlg->SetTextL( *prompt ); - noteDlg->SetTimeout( CAknNoteDialog::ELongTimeout ); - noteDlg->SetTone( CAknNoteDialog::EErrorTone ); - noteDlg->RunLD(); - - CleanupStack::PopAndDestroy( prompt ); - } - - if ( !allow ) - { - return ChangeAutoLockPeriodL( oldPeriod ); - } - } - - if (aPeriod == 0) - { - - #ifdef RD_REMOTELOCK - - // If remote lock is enabled, don't disable the domestic OS device lock - // since that would render the RemoteLock useless. - // Instead just re-set the DOS lock to enabled which as a side effect - // requests the security code from the user. - - TBool remoteLockStatus( EFalse ); - CRemoteLockSettings* remoteLockSettings = CRemoteLockSettings::NewL(); - - if ( remoteLockSettings->GetEnabled( remoteLockStatus ) ) - { - if ( remoteLockStatus ) - { - // Remote lock is enabled - #ifdef _DEBUG - RDebug::Print( _L( "(SecUi)CSecuritySettings::ChangeAutoLockPeriodL() - RemoteLock is enabled: lockChange = RMobilePhone::ELockSetEnabled" ) ); - #endif // _DEBUG - - lockChange = RMobilePhone::ELockSetEnabled; - } - else - { - // Remote lock is disabled - #ifdef _DEBUG - RDebug::Print( _L( "(SecUi)CSecuritySettings::ChangeAutoLockPeriodL() - RemoteLock is disabled: lockChange = RMobilePhone::ELockSetDisabled" ) ); - #endif // _DEBUG - - lockChange = RMobilePhone::ELockSetDisabled; - } - } - else - { - // Failed to get remote lock status - #ifdef _DEBUG - RDebug::Print( _L( "(SecUi)CSecuritySettings::ChangeAutoLockPeriodL() - Failed to get RemoteLock status" ) ); - #endif // _DEBUG - } - - delete remoteLockSettings; - remoteLockSettings = NULL; - - #else // not defined RD_REMOTELOCK - - lockChange = RMobilePhone::ELockSetDisabled; - - #endif // RD_REMOTELOCK - } - else - { - lockChange = RMobilePhone::ELockSetEnabled; - } - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() SetLockSetting")); - #endif - iWait->SetRequestType(EMobilePhoneSetLockSetting); - RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); - iPhone.SetLockSetting(iWait->iStatus,lockType,lockChange); - TInt status = iWait->WaitForRequestL(); - #if defined(_DEBUG) - RDebug::Print( _L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL(): RETURN CODE: %d"), status); - #endif - switch(status) - { - case KErrNone: - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() KErrNone")); - #endif - break; - case KErrGsmSSPasswordAttemptsViolation: - case KErrLocked: - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() PasswordAttemptsViolation")); - #endif - return ChangeAutoLockPeriodL(oldPeriod); - case KErrGsm0707IncorrectPassword: - case KErrAccessDenied: - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() IncorrectPassword")); - #endif - // code was entered erroneously - return ChangeAutoLockPeriodL(oldPeriod); - case KErrAbort: - // User pressed "cancel" in the code query dialog. - return oldPeriod; - default: - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() default")); - #endif - return ChangeAutoLockPeriodL(oldPeriod); - } - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() END")); - #endif - return aPeriod; + { + TInt ret=0; + RDEBUG( "aPeriod", aPeriod ); + RMobilePhone::TMobilePassword iOldPassword; + TInt iFlags=0; + TInt iShowError=1; + TBuf<0x80> iCaption; + iCaption.Copy(_L("ChangeAutoLockPeriodL")); + iOldPassword.Copy(_L("")); + ret = ChangeAutoLockPeriodParamsL(aPeriod, iOldPassword, iFlags, iCaption, iShowError); + RDEBUG( "ret", ret ); + return ret; } @@ -854,7 +308,7 @@ // CSecuritySettings::ChangeRemoteLockStatusL() // Changes remote lock status (on/off) // ---------------------------------------------------------- -// +// no qtdone EXPORT_C TInt CSecuritySettings::ChangeRemoteLockStatusL( TBool& aRemoteLockStatus, TDes& aRemoteLockCode, TInt aAutoLockPeriod ) { #ifdef RD_REMOTELOCK @@ -974,7 +428,7 @@ // code twice and if they match enables the domestic OS device lock (which as // a side effect pops up security code query). // ---------------------------------------------------------- -// +// no qtdone TInt CSecuritySettings::RemoteLockCodeQueryL( TDes& aRemoteLockCode ) { #ifdef RD_REMOTELOCK @@ -1084,8 +538,15 @@ { securityCode = aRemoteLockCode; iWait->SetRequestType( EMobilePhoneVerifySecurityCode ); + RDEBUG( "VerifySecurityCode", 0 ); iPhone.VerifySecurityCode( iWait->iStatus, secCodeType, securityCode, unblockCode ); + RDEBUG( "WaitForRequestL", 0 ); TInt res = iWait->WaitForRequestL(); + RDEBUG( "WaitForRequestL res", res ); + #ifdef __WINS__ + if (res == KErrNotSupported) + res = KErrNone; + #endif // The remote lock code matches the security code // and that is not allowed while ( (res == KErrNone) && (buttonId == EEikBidOk)) @@ -1138,8 +599,15 @@ { securityCode = aRemoteLockCode; iWait->SetRequestType( EMobilePhoneVerifySecurityCode ); + RDEBUG( "VerifySecurityCode", 0 ); iPhone.VerifySecurityCode( iWait->iStatus, secCodeType, securityCode, unblockCode ); + RDEBUG( "WaitForRequestL", 0 ); res = iWait->WaitForRequestL(); + #ifdef __WINS__ + if (res == KErrNotSupported) + res = KErrNone; + #endif + RDEBUG( "WaitForRequestL res", res ); } } @@ -1189,7 +657,7 @@ // Changes lock setting in domestic OS. Changing the domestic OS lock setting // requires user to enter the security code. // ---------------------------------------------------------- -// +// no qtdone TInt CSecuritySettings::RemoteLockSetLockSettingL( TBool aLockSetting ) { #ifdef RD_REMOTELOCK @@ -1213,10 +681,17 @@ iWait->SetRequestType( EMobilePhoneSetLockSetting ); RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); + RDEBUG( "SetLockSetting", 0 ); iPhone.SetLockSetting( iWait->iStatus, lockType, lockSetting ); // Wait for code verify to complete + RDEBUG( "WaitForRequestL", 0 ); retValue = iWait->WaitForRequestL(); + RDEBUG( "WaitForRequestL retValue", retValue ); + #ifdef __WINS__ + if (retValue == KErrNotSupported) + retValue = KErrNone; + #endif switch( retValue ) { @@ -1273,7 +748,7 @@ // CSecuritySettings::ChangeSimSecurityL() // Changes SIM security // ---------------------------------------------------------- -// +// qtdone EXPORT_C TBool CSecuritySettings::ChangeSimSecurityL() { /***************************************************** @@ -1288,14 +763,22 @@ RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneToICC; RMobilePhone::TMobilePhoneLockSetting lockChangeSetting; - CCoeEnv* coeEnv = CCoeEnv::Static(); - CDesCArrayFlat* items = coeEnv->ReadDesC16ArrayResourceL(R_SECURITY_LBX); - CleanupStack::PushL(items); //get lock info iWait->SetRequestType(EMobilePhoneGetLockInfo); + RDEBUG( "GetLockInfo", 0 ); iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); + RDEBUG( "WaitForRequestL", 0 ); TInt status = iWait->WaitForRequestL(); + RDEBUG( "WaitForRequestL status", status ); + + #ifdef __WINS__ + if (status == KErrTimedOut) + { + lockInfo.iSetting = RMobilePhone::ELockSetDisabled; + status = KErrNone; + } + #endif User::LeaveIfError(status); TInt currentItem = 0; @@ -1307,10 +790,7 @@ currentItem = 1; // off } - TInt oldItem = currentItem; - - - if (currentItem == 1) + if (currentItem == 0) // switch the flag { lockChangeSetting = RMobilePhone::ELockSetDisabled; } @@ -1318,13 +798,21 @@ { lockChangeSetting = RMobilePhone::ELockSetEnabled; } - RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); + RDEBUG( "lockChangeSetting", lockChangeSetting ); iWait->SetRequestType(EMobilePhoneSetLockSetting); RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); - iPhone.SetLockSetting(iWait->iStatus,lockType,lockChangeSetting); + RDEBUG( "SetLockSetting", 0 ); + iPhone.SetLockSetting(iWait->iStatus,lockType,lockChangeSetting); // this invokes the handler + RDEBUG( "WaitForRequestL", 0 ); status = iWait->WaitForRequestL(); + RDEBUG( "WaitForRequestL status", status ); + #ifdef __WINS__ + if (status == KErrNotSupported) + status = KErrNone; + #endif + // the error was displayed in the handler #if defined(_DEBUG) RDebug::Print( _L("(SECUI)CSecuritySettings::ChangeSimSecurityL(): RETURN CODE: %d"), status); #endif @@ -1363,24 +851,20 @@ // CSecuritySettings::ChangePinRequestL() // Changes PIN1 request // ---------------------------------------------------------- -// +// qtdone EXPORT_C TBool CSecuritySettings::ChangePinRequestL() { - RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); + RDEBUG( "0", 0 ); + RMobilePhone::TMobilePassword iOldPassword; TInt iFlags=0; - RDebug::Printf( "%s %s (%u) iOldPassword=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); iOldPassword.Copy(_L("")); - RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); TBuf<0x80> iCaption; - RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); iCaption.Copy(_L("ChangePinRequestL")); - RDebug::Printf( "%s %s (%u) iCaption=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); - RDebug::Print(iCaption); TInt iShowError=1; ChangePinRequestParamsL(1/* TODO it's imposible to know if we want to set or clear*/, iOldPassword, iFlags, iCaption, iShowError); - RDebug::Printf( "%s %s (%u) iCaption=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); + RDEBUG( "0", 0 ); return ETrue; } @@ -1390,7 +874,7 @@ // CSecuritySettings::ChangeUPinRequestL() // Changes UPIN request on/off // ---------------------------------------------------------- -// +// qtdone EXPORT_C TBool CSecuritySettings::ChangeUPinRequestL() { TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); @@ -1418,15 +902,18 @@ RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockUniversalPin; RMobilePhone::TMobilePhoneLockSetting lockChangeSetting = RMobilePhone::ELockSetDisabled; - - CCoeEnv* coeEnv = CCoeEnv::Static(); - CDesCArrayFlat* items = coeEnv->ReadDesC16ArrayResourceL(R_UPIN_LBX); - CleanupStack::PushL(items); - + //get lock info iWait->SetRequestType(EMobilePhoneGetLockInfo); + RDEBUG( "GetLockInfo", 0 ); iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); + RDEBUG( "WaitForRequestL", 0 ); TInt status = iWait->WaitForRequestL(); + RDEBUG( "WaitForRequestL status", status ); + #ifdef __WINS__ + if (status == KErrNotSupported) + status = KErrNone; + #endif User::LeaveIfError(status); TInt currentItem = 0; @@ -1442,21 +929,8 @@ currentItem = 1; // off } - TInt oldItem = currentItem; - - CAknRadioButtonSettingPage* dlg = new (ELeave)CAknRadioButtonSettingPage(R_UPIN_SETTING_PAGE, currentItem, items); - CleanupStack::PushL(dlg); - - - CleanupStack::Pop(); // dlg - if ( !(dlg->ExecuteLD(CAknSettingPage::EUpdateWhenChanged)) || oldItem==currentItem ) - { - CleanupStack::PopAndDestroy(); // items - return EFalse; - } - - - if (currentItem == 1) + + if (currentItem == 0) // switch the flag { #if defined(_DEBUG) RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeUPinRequestL() currentItem: ELockSetDisabled")); @@ -1471,23 +945,25 @@ lockChangeSetting = RMobilePhone::ELockSetEnabled; } - CleanupStack::PopAndDestroy(); // items - // Raise a flag to indicate that the UPIN // request coming from ETEL has originated from SecUi and not from Engine. RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSecUIOriginated); // Change the lock setting iWait->SetRequestType(EMobilePhoneSetLockSetting); RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); - iPhone.SetLockSetting(iWait->iStatus,lockType,lockChangeSetting); + RDEBUG( "SetLockSetting", 0 ); + iPhone.SetLockSetting(iWait->iStatus,lockType,lockChangeSetting); // this calls something in the handler + RDEBUG( "WaitForRequestL", 0 ); status = iWait->WaitForRequestL(); - #if defined(_DEBUG) - RDebug::Print( _L("(SECUI)CSecuritySettings::ChangeUPinRequestL(): RETURN CODE: %d"), status); - #endif - + RDEBUG( "WaitForRequestL status", status ); // Lower the flag RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsETelAPIOriginated); - + #ifdef __WINS__ + if (status == KErrNotSupported) + status = KErrNone; + #endif + + // no need to show errors because they were displayed in the Handler switch(status) { case KErrNone: @@ -1534,7 +1010,7 @@ // CSecuritySettings::SwitchPinCodesL() // Changes the pin code currently in use (PIN/UPIN) // ---------------------------------------------------------- -// +// qtdone EXPORT_C TBool CSecuritySettings::SwitchPinCodesL() { TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); @@ -1576,21 +1052,27 @@ { lockType = RMobilePhone::ELockUniversalPin; iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); + RDEBUG( "WaitForRequestL", 0 ); TInt res = iWait->WaitForRequestL(); + RDEBUG( "WaitForRequestL res", res ); + #ifdef __WINS__ + if (res == KErrNotSupported) + res = KErrNone; + #endif User::LeaveIfError(res); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() Lock Info got: UPIN")); - #endif } else { lockType = RMobilePhone::ELockICC; iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); + RDEBUG( "WaitForRequestL", 0 ); TInt res = iWait->WaitForRequestL(); + RDEBUG( "WaitForRequestL res", res ); + #ifdef __WINS__ + if (res == KErrNotSupported) + res = KErrNone; + #endif User::LeaveIfError(res); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() Lock Info got: PIN")); - #endif } // code request must be ON to change active code. @@ -1599,7 +1081,7 @@ #if defined(_DEBUG) RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() CODE REQ NOT ON.")); #endif - if (activeCode == RMobilePhone::ESecurityUniversalPin) + if (activeCode != RMobilePhone::ESecurityUniversalPin) { ShowResultNoteL(R_UPIN_NOT_ALLOWED, CAknNoteDialog::EErrorTone); } @@ -1613,12 +1095,6 @@ return EFalse; } - - - CCoeEnv* coeEnv = CCoeEnv::Static(); - CDesCArrayFlat* items = coeEnv->ReadDesC16ArrayResourceL(R_CODE_LBX); - CleanupStack::PushL(items); - iCustomPhone.GetActivePin(activeCode); TInt currentItem = 0; @@ -1633,22 +1109,8 @@ #endif currentItem = 1; // UPIN } - - TInt oldItem = currentItem; - - CAknRadioButtonSettingPage* dlg = new (ELeave)CAknRadioButtonSettingPage(R_CODE_IN_USE_SETTING_PAGE, currentItem, items); - CleanupStack::PushL(dlg); - - - CleanupStack::Pop(); // dlg - if ( !(dlg->ExecuteLD(CAknSettingPage::EUpdateWhenChanged)) || oldItem==currentItem ) - { - CleanupStack::PopAndDestroy(); // items - return EFalse; - } - - - if (currentItem == 1) + + if (currentItem == 0) // switch the flag { #if defined(_DEBUG) RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() currentItem: UPIN")); @@ -1663,22 +1125,26 @@ lockType = RMobilePhone::ELockICC; } - CleanupStack::PopAndDestroy(); // items - // Raise a flag to indicate that the code // request coming from ETEL has originated from SecUi and not from Engine. RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSecUIOriginated); // Change the lock setting iWait->SetRequestType(EMobilePhoneSetLockSetting); RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); - iPhone.SetLockSetting(iWait->iStatus,lockType,lockChangeSetting); + RDEBUG( "SetLockSetting", 0 ); + iPhone.SetLockSetting(iWait->iStatus,lockType,lockChangeSetting); // request from handler + RDEBUG( "WaitForRequestL", 0 ); TInt status = iWait->WaitForRequestL(); - #if defined(_DEBUG) - RDebug::Print( _L("(SECUI)CSecuritySettings::SwitchPinCodesL(): RETURN CODE: %d"), status); - #endif + RDEBUG( "WaitForRequestL status", status ); // Lower the flag RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsETelAPIOriginated); + #ifdef __WINS__ + if (status == KErrNotSupported) + status = KErrNone; + #endif + + // errors are shown in the handler switch(status) { case KErrNone: @@ -1724,51 +1190,36 @@ // CSecuritySettings::IsLockEnabledL() // Return is lock enabled/disabled // ---------------------------------------------------------- -// +// qtdone EXPORT_C TBool CSecuritySettings::IsLockEnabledL(RMobilePhone::TMobilePhoneLock aLockType) { - /***************************************************** - * Series 60 Customer / ETel - * Series 60 ETel API - *****************************************************/ - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::IsLockEnabledL()")); - #endif - #ifdef __WINS__ - - return EFalse; - - #else //WINS - + TBool ret=EFalse; RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; - //get lock info RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); iWait->SetRequestType(EMobilePhoneGetLockInfo); + RDEBUG( "GetLockInfo", 0 ); iPhone.GetLockInfo(iWait->iStatus, aLockType, lockInfoPkg); + RDEBUG( "WaitForRequestL", 0 ); TInt res = iWait->WaitForRequestL(); + RDEBUG( "WaitForRequestL res", res ); if (res != KErrNone) - return ETrue; - + ret = ETrue; //lock is enabled return true - if (lockInfo.iSetting == RMobilePhone::ELockSetEnabled) + else if (lockInfo.iSetting == RMobilePhone::ELockSetEnabled) { - return ETrue; + ret = ETrue; } - - // lock is disabled return false - return EFalse; - - #endif - + RDEBUG( "ret", ret ); + return ret; } // // ---------------------------------------------------------- // CSecuritySettings::AskSecCodeL() // For asking security code e.g in settings // ---------------------------------------------------------- -// +// qtdone EXPORT_C TBool CSecuritySettings::AskSecCodeL() { return iSecurityHandler->AskSecCodeL(); @@ -1778,35 +1229,38 @@ // CSecuritySettings::AskPin2L() // Asks PIN2 // ---------------------------------------------------------- -// +// qtdone EXPORT_C TBool CSecuritySettings::AskPin2L() { /***************************************************** * Series 60 Customer / ETel * Series 60 ETel API *****************************************************/ - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::AskPin2L()")); - #endif - TInt ret = 0; + RDEBUG( "0", 0 ); + TInt retPhone = 0; // check if pin2 is blocked... RMmCustomAPI::TSecurityCodeType secCodeType = RMmCustomAPI::ESecurityCodePin2; RMobilePhone::TMobilePhoneSecurityCode etelsecCodeType(RMobilePhone::ESecurityCodePin2); RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); + RMobilePhone::TMobilePassword password; TBool isBlocked = EFalse; + TInt queryAccepted = KErrCancel; //Check whether PIN2 is blocked - ret = iCustomPhone.IsBlocked(secCodeType,isBlocked); + retPhone = iCustomPhone.IsBlocked(secCodeType,isBlocked); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::AskPin2L() IsBlocked return value: %d"), ret); - #endif + RDEBUG( "retPhone", retPhone ); + RDEBUG( "isBlocked", isBlocked ); + #ifdef __WINS__ + if (retPhone == KErrNotSupported) + retPhone = KErrNone; + #endif if(isBlocked) return EFalse; - if (ret != KErrNone) + if (retPhone != KErrNone) { - switch (ret) + switch (retPhone) { // PIN2 Blocked. case KErrGsm0707SIMPuk2Required: @@ -1821,59 +1275,57 @@ ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); break; default: - ShowErrorNoteL(ret); + ShowErrorNoteL(retPhone); break; } return EFalse; } iWait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); + RDEBUG( "GetSecurityCodeInfo", 0 ); iPhone.GetSecurityCodeInfo(iWait->iStatus, etelsecCodeType, codeInfoPkg); - ret = iWait->WaitForRequestL(); + RDEBUG( "WaitForRequestL", 0 ); + retPhone = iWait->WaitForRequestL(); + RDEBUG( "WaitForRequestL retPhone", retPhone ); + #ifdef __WINS__ + if (retPhone == KErrNotSupported || retPhone == KErrTimedOut) + { + retPhone = KErrNone; + codeInfo.iRemainingEntryAttempts = 3; + } + #endif + User::LeaveIfError(retPhone); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): get PIN2 info result: %d"), ret); TInt attempts(codeInfo.iRemainingEntryAttempts); - RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): attempts remaining: %d"), attempts); - #endif - User::LeaveIfError(ret); + RDEBUG( "attempts", attempts ); // ask pin2 code - RMobilePhone::TMobilePassword password; - CCodeQueryDialog* dlg = new (ELeave) CCodeQueryDialog (password,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); - if(codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) - ret = dlg->ExecuteLD(R_PIN2_QUERY); - else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_PIN2_ATTEMPTS, codeInfo.iRemainingEntryAttempts ); - ret = dlg->ExecuteLD(R_PIN2_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - else - { - HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_PIN2_ATTEMPT); - ret = dlg->ExecuteLD(R_PIN2_QUERY, *queryPrompt); - CleanupStack::PopAndDestroy(queryPrompt); - } - - if (!ret) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::AskPin2L(): Cancel pressed")); - #endif - return EFalse; - } + /* request PIN using QT */ + queryAccepted = KErrCancel; + CSecQueryUi *iSecQueryUi; + iSecQueryUi = CSecQueryUi::NewL(); + TBuf<0x100> title; title.Zero(); title.Append(_L("PIN2")); title.Append(_L("#")); title.AppendNum(codeInfo.iRemainingEntryAttempts); + queryAccepted = iSecQueryUi->SecQueryDialog( title, password, SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported | ESecUiEmergencyNotSupported | secCodeType ); + RDEBUG( "password", 0 ); + RDebug::Print( password ); + RDEBUG( "queryAccepted", queryAccepted ); + delete iSecQueryUi; + if(queryAccepted!=KErrNone) + return EFalse; // verify code RMobilePhone::TMobilePassword required_fourth; iWait->SetRequestType(EMobilePhoneVerifySecurityCode); + RDEBUG( "VerifySecurityCode", 0 ); iPhone.VerifySecurityCode(iWait->iStatus,etelsecCodeType, password, required_fourth); - TInt res = iWait->WaitForRequestL(); + RDEBUG( "WaitForRequestL", 0 ); + retPhone = iWait->WaitForRequestL(); + RDEBUG( "WaitForRequestL retPhone", retPhone ); + #ifdef __WINS__ + if (retPhone == KErrNotSupported) + retPhone = KErrNone; + #endif - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::AskPin2L() VerifySecurityCode return value: %d"), res); - #endif - - switch(res) + switch(retPhone) { case KErrNone: break; @@ -1892,7 +1344,7 @@ ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); return EFalse; default: - ShowErrorNoteL(res); + ShowErrorNoteL(retPhone); return AskPin2L(); } @@ -1903,7 +1355,7 @@ // CSecuritySettings::SetFdnModeL() // Activates or deactivates Fixed Dialling Numbers (FDN) mode. // ---------------------------------------------------------- -// +// not qtdone EXPORT_C void CSecuritySettings::SetFdnModeL() { /***************************************************** @@ -1917,7 +1369,8 @@ TBool isBlocked = EFalse; TInt ret = iCustomPhone.IsBlocked(secCodeType,isBlocked); - + RDEBUG( "isBlocked", isBlocked ); + RDEBUG( "ret", ret ); if(isBlocked) return; @@ -1960,12 +1413,20 @@ { fdnSet = RMobilePhone::EFdnSetOn; } - + RDEBUG( "fdnSet", fdnSet ); // Change the FDN setting iWait->SetRequestType(EMobilePhoneSetFdnSetting); RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); + RDEBUG( "SetFdnSetting", 0 ); iPhone.SetFdnSetting(iWait->iStatus, fdnSet); + RDEBUG( "WaitForRequestL", 0 ); status = iWait->WaitForRequestL(); + RDEBUG( "WaitForRequestL status", status ); + #ifdef __WINS__ + if (status == KErrNotSupported) + status = KErrNone; + #endif + #if defined(_DEBUG) RDebug::Print( _L("(SECUI)CSecuritySettings::SetFdnModeL(): RETURN CODE: %d"), status); @@ -1998,7 +1459,7 @@ // CSecuritySettings::GetFndMode() // Retrieves the current Fixed Dialling Numbers mode // ---------------------------------------------------------- -// +// qtdone EXPORT_C TInt CSecuritySettings::GetFdnMode (RMobilePhone::TMobilePhoneFdnStatus& aFdnMode) { /***************************************************** @@ -2016,13 +1477,10 @@ // CSecuritySettings::ShowErrorNoteL() // Shows error note // ---------------------------------------------------------- -// +// qtdone void CSecuritySettings::ShowErrorNoteL(TInt aError) { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ShowErrorNoteL()")); - #endif - RDebug::Printf( "%s %s (%u) aError=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aError ); + RDEBUG( "aError", aError ); ShowResultNoteL(aError, CAknNoteDialog::EErrorTone); } @@ -2032,14 +1490,10 @@ // CSecuritySettings::ShowResultNoteL() // Shows result note // ---------------------------------------------------------- -// +// qtdone void CSecuritySettings::ShowResultNoteL(TInt aResourceID, CAknNoteDialog::TTone aTone) { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ShowResultNoteL()")); - RDebug::Print(_L("(SECUI)CSecuritySettings::ShowResultNoteL() Resource ID: %d"), aResourceID); - #endif - RDebug::Printf( "%s %s (%u) aResourceID=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aResourceID ); + RDEBUG( "aResourceID", aResourceID ); /* CAknNoteDialog* noteDlg = new (ELeave) CAknNoteDialog(REINTERPRET_CAST(CEikDialog**,¬eDlg)); @@ -2051,7 +1505,9 @@ CleanupStack::PushL(messageBox); _LIT(KText, "ShowResultNoteL: "); TBuf<0x200> title; + TBuf<0x200> titleTr; title.Zero(); + titleTr.Zero(); title.Append(KText); title.AppendNum(aResourceID); _LIT(KSeparator, " "); @@ -2059,61 +1515,129 @@ switch(aResourceID) { case 0: + titleTr.Append(_L("OK")); title.Append(_L("OK")); break; case KErrGsm0707IncorrectPassword: - title.Append(_L("KErrGsm0707IncorrectPassword")); + titleTr.Append(_L("KErrGsm0707IncorrectPassword")); + title.Append(_L("Incorrect Password")); break; case KErrAccessDenied: - title.Append(_L("KErrAccessDenied")); + titleTr.Append(_L("KErrAccessDenied")); + title.Append(_L("Access Denied")); break; case KErrGsmSSPasswordAttemptsViolation: - title.Append(_L("KErrGsmSSPasswordAttemptsViolation")); + titleTr.Append(_L("KErrGsmSSPasswordAttemptsViolation")); + title.Append(_L("Password Attempts Violation")); break; case KErrLocked: - title.Append(_L("KErrLocked")); + titleTr.Append(_L("KErrLocked")); + title.Append(_L("Locked")); break; case KErrGsm0707OperationNotAllowed: - title.Append(_L("KErrGsm0707OperationNotAllowed")); + titleTr.Append(_L("KErrGsm0707OperationNotAllowed")); + title.Append(_L("Operation Not Allowed")); break; case KErrAbort: - title.Append(_L("KErrAbort")); + titleTr.Append(_L("KErrAbort")); + title.Append(_L("Abort")); break; case KErrNotSupported: - title.Append(_L("KErrNotSupported")); + titleTr.Append(_L("KErrNotSupported")); + title.Append(_L("Not Supported")); break; case R_SEC_BLOCKED: - title.Append(_L("R_SEC_BLOCKED")); + titleTr.Append(_L("R_SEC_BLOCKED")); + title.Append(_L("BLOCKED")); break; case R_CODE_ERROR: - title.Append(_L("R_CODE_ERROR")); + titleTr.Append(_L("R_CODE_ERROR")); + title.Append(_L("ERROR")); break; case KErrGsmInvalidParameter: - title.Append(_L("KErrGsmInvalidParameter")); + titleTr.Append(_L("KErrGsmInvalidParameter")); + title.Append(_L("Invalid Parameter")); break; case R_CONFIRMATION_NOTE: - title.Append(_L("R_CONFIRMATION_NOTE")); + titleTr.Append(_L("R_CONFIRMATION_NOTE")); + title.Append(_L("CONFIRMED")); break; case R_CODES_DONT_MATCH: - title.Append(_L("R_CODES_DONT_MATCH")); + titleTr.Append(_L("R_CODES_DONT_MATCH")); + title.Append(_L("CODES DONT MATCH")); break; case R_PIN_CODE_CHANGED_NOTE: - title.Append(_L("R_PIN_CODE_CHANGED_NOTE")); + titleTr.Append(_L("R_PIN_CODE_CHANGED_NOTE")); + title.Append(_L("PIN CODE CHANGED")); break; case R_SECURITY_CODE_CHANGED_NOTE: - title.Append(_L("R_SECURITY_CODE_CHANGED_NOTE")); + titleTr.Append(_L("R_SECURITY_CODE_CHANGED_NOTE")); + title.Append(_L("SECURITY CODE CHANGED")); + break; + case R_SECUI_TEXT_AUTOLOCK_MUST_BE_ACTIVE: + titleTr.Append(_L("R_SECUI_TEXT_AUTOLOCK_MUST_BE_ACTIVE")); + title.Append(_L("AUTOLOCK MUST BE ACTIVE")); + break; + case KErrServerTerminated: + titleTr.Append(_L("KErrServerTerminated")); + title.Append(_L("Server Terminated")); + break; + case KErrServerBusy: + titleTr.Append(_L("KErrServerBusy")); + title.Append(_L("Server Busy")); + break; + case R_PIN2_REJECTED: + titleTr.Append(_L("R_PIN2_REJECTED")); + title.Append(_L("PIN2 REJECTED")); + break; + case R_OPERATION_NOT_ALLOWED: + titleTr.Append(_L("R_OPERATION_NOT_ALLOWED")); + title.Append(_L("OPERATION NOT ALLOWED")); + break; + case R_UPIN_NOT_ALLOWED: + titleTr.Append(_L("R_UPIN_NOT_ALLOWED")); + title.Append(_L("UPIN NOT ALLOWED")); break; - default: + case R_PIN_NOT_ALLOWED: + titleTr.Append(_L("R_PIN_NOT_ALLOWED")); + title.Append(_L("PIN NOT ALLOWED")); + break; + case R_INSERT_SIM: + titleTr.Append(_L("R_INSERT_SIM")); + title.Append(_L("INSERT SIM")); + break; + case R_SIM_ON: + titleTr.Append(_L("R_SIM_ON")); + title.Append(_L("SIM ON")); + break; + case KErrTimedOut: + titleTr.Append(_L("KErrTimedOut")); + title.Append(_L("Timed Out")); + break; + case R_PIN2_CODE_CHANGED_NOTE: + titleTr.Append(_L("R_PIN2_CODE_CHANGED_NOTE")); + title.Append(_L("PIN2 CODE CHANGED")); + break; + case KErrArgument: + titleTr.Append(_L("KErrArgument")); + title.Append(_L("Error Argument")); + break; + + default: // " " + titleTr.Append(_L("Specific Error")); title.Append(_L("Specific Error")); break; } messageBox->SetTextL(title); - RDebug::Printf( "%s %s (%u) aResourceID=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aResourceID ); + RDEBUG( "aResourceID", aResourceID ); + RDebug::Print( titleTr ); _LIT(KIconName, "qtg_small_smiley_wondering"); messageBox->SetIconNameL(KIconName); + // TODO use aTone for sound - messageBox->ExecL(); + // use default timeout + messageBox->ShowL(); CleanupStack::PopAndDestroy(); // messageBox } @@ -2123,152 +1647,110 @@ // CSecuritySettings::IsUpinSupportedL() // Return is UPIN supported // ---------------------------------------------------------- -// +// qtdone EXPORT_C TBool CSecuritySettings::IsUpinSupportedL() { TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); + TBool isSupported = EFalse; if(wcdmaSupported || upinSupported) { #if defined(_DEBUG) RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinSupported() BEGIN")); #endif - #ifdef __WINS__ - - return EFalse; - - #else //WINS RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; //get lock info RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); iWait->SetRequestType(EMobilePhoneGetLockInfo); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinSupported() GetLockInfo")); - #endif + RDEBUG( "GetLockInfo", 0 ); iPhone.GetLockInfo(iWait->iStatus, RMobilePhone::ELockUniversalPin, lockInfoPkg); + RDEBUG( "WaitForRequestL", 0 ); TInt res = iWait->WaitForRequestL(); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinSupported() GetLockInfo DONE")); - #endif + RDEBUG( "WaitForRequestL res", res ); if ((res == KErrNotSupported) || (res == KErrGsmInvalidParameter)) { #if defined(_DEBUG) RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinSupported(): NOT SUPPORTED")); #endif - return EFalse; + isSupported = EFalse; } - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinSupported(): SUPPORTED: %d"), res); - #endif - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinSupported() END")); - #endif - return ETrue; - - #endif //WINS + else + { + RDEBUG( "0", 0 ); + + isSupported = ETrue; + } } else - return EFalse; + isSupported = EFalse; + RDEBUG( "isSupported", isSupported ); + return isSupported; } // // ---------------------------------------------------------- -// CSecuritySettings::IsCodeBlocked() +// CSecuritySettings::IsUpinBlocked() // Return is a code blocked // ---------------------------------------------------------- -// +// qtdone EXPORT_C TBool CSecuritySettings::IsUpinBlocked() { TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); if(wcdmaSupported || upinSupported) { - #ifdef __WINS__ - return EFalse; - #else//__WINS__ - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinBlocked() BEGIN")); - #endif RMmCustomAPI::TSecurityCodeType secCodeType; secCodeType = RMmCustomAPI::ESecurityUniversalPin; TBool isBlocked = EFalse; - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinBlocked() IsBlocked")); - #endif + RDEBUG( "IsBlocked", 0 ); TInt ret = iCustomPhone.IsBlocked(secCodeType,isBlocked); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinBlocked() DONE.RETURN: %d"), ret); - #endif - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinBlocked():isblocked: %d"), isBlocked); - #endif - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinBlocked() END")); - #endif + RDEBUG( "ret", ret ); + RDEBUG( "isBlocked", isBlocked ); return isBlocked; - #endif //__WINS__ } else return EFalse; } // // ---------------------------------------------------------- -// CSecuritySettings::GetActivePinCode() +// CSecuritySettings::IsUpinActive() // Return the code active in current application (PIN/UPIN) // ---------------------------------------------------------- -// +// qtdone EXPORT_C TBool CSecuritySettings::IsUpinActive() { TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); if(wcdmaSupported || upinSupported) { - #ifdef __WINS__ - return EFalse; - #else//__WINS__ - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinActive() BEGIN")); - #endif RMobilePhone::TMobilePhoneSecurityCode activePin; - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinActive() GetActivePin")); - #endif - iCustomPhone.GetActivePin(activePin); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinActive() GetActivePin DONE")); - #endif + RDEBUG( "GetActivePin", 0 ); + iCustomPhone.GetActivePin(activePin); + RDEBUG( "activePin", activePin ); + RDEBUG( "RMobilePhone::ESecurityUniversalPin", RMobilePhone::ESecurityUniversalPin ); if(activePin == RMobilePhone::ESecurityUniversalPin) { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinActive(): UPIN ACTIVE")); - #endif return ETrue; } - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinActive(): UPIN NOT ACTIVE")); - #endif - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinActive(): END")); - #endif return EFalse; - #endif //__WINS__ } else return EFalse; } +/**************************/ +// qtdone EXPORT_C TInt CSecuritySettings::ChangePinParamsL(RMobilePhone::TMobilePassword aOldPassword, RMobilePhone::TMobilePassword aNewPassword, TInt aFlags, TDes& aCaption, TInt aShowError) { - TInt ret = KErrNone; - RDebug::Printf( "%s %s (%u) aFlags=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aFlags ); - RDebug::Printf( "%s %s (%u) aOldPassword=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); + RDEBUG( "aFlags", aFlags ); + RDEBUG( "aOldPassword", 0 ); RDebug::Print(aOldPassword); - RDebug::Printf( "%s %s (%u) aOldPassword=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); + RDEBUG( "aNewPassword", 0 ); RDebug::Print(aNewPassword); - RDebug::Printf( "%s %s (%u) aCaption=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); + RDEBUG( "aCaption", 0 ); RDebug::Print(aCaption); - RDebug::Printf( "%s %s (%u) aShowError=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aShowError ); + RDEBUG( "aShowError", aShowError ); /***************************************************** @@ -2285,7 +1767,7 @@ if ( simRemoved ) { ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); - return; + return KErrAccessDenied; } #if defined(_DEBUG) RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinParamsL()")); @@ -2299,9 +1781,9 @@ RMobilePhone::TMobilePhonePasswordChangeV1 passwords; RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); - TBool queryAccepted = EFalse; + TInt queryAccepted = KErrCancel; - RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); + RDEBUG( "0", 0 ); RMobilePhone::TMobilePhoneLock lockType; RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; @@ -2309,54 +1791,63 @@ lockType = RMobilePhone::ELockICC; RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); - RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); + RDEBUG( "0", 0 ); iWait->SetRequestType(EMobilePhoneGetLockInfo); - #ifndef __WINS__ + TInt res = KErrNone; + RDEBUG( "GetLockInfo", 0 ); iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); - RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); - TInt res = iWait->WaitForRequestL(); - #else - RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); - TInt res = KErrNone; + RDEBUG( "WaitForRequestL", 0 ); + res = iWait->WaitForRequestL(); + RDEBUG( "WaitForRequestL res", res ); + #ifdef __WINS__ + if (res == KErrTimedOut) + { + lockInfo.iSetting = RMobilePhone::ELockSetEnabled; + res = KErrNone; + } #endif + User::LeaveIfError(res); - RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) { - RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); - // CleanupStack::PopAndDestroy(1,dlg); // TODO sure about dlg ? + RDEBUG( "RMobilePhone::ELockSetDisabled", RMobilePhone::ELockSetDisabled ); ShowResultNoteL(R_PIN_NOT_ALLOWED, CAknNoteDialog::EErrorTone); - return; + return KErrAccessDenied; } - - RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); + + RDEBUG( "0", 0 ); iWait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); - #ifndef __WINS__ + RDEBUG( "GetSecurityCodeInfo", 0 ); iPhone.GetSecurityCodeInfo(iWait->iStatus, secCodeType, codeInfoPkg); + RDEBUG( "WaitForRequestL", 0 ); res = iWait->WaitForRequestL(); - #else - res = KErrNone; - #endif + RDEBUG( "WaitForRequestL res", res ); + #ifdef __WINS__ + if (res == KErrNotSupported || res == KErrTimedOut) + { + res = KErrNone; + codeInfo.iRemainingEntryAttempts=KMaxNumberOfPINAttempts; + } + #endif User::LeaveIfError(res); - RDebug::Printf( "%s %s (%u) codeInfo.iRemainingEntryAttempts=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, codeInfo.iRemainingEntryAttempts ); - codeInfo.iRemainingEntryAttempts=KMaxNumberOfPINAttempts; - - RDebug::Printf( "%s %s (%u) checking aOldPassword=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); + RDEBUG( "codeInfo.iRemainingEntryAttempts", codeInfo.iRemainingEntryAttempts ); + RDEBUG( "checking aOldPassword", 0 ); if(aOldPassword.Length()==0) { - RDebug::Printf( "%s %s (%u) asking aOldPassword=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); + RDEBUG( "asking aOldPassword", 0 ); /* request PIN using QT */ - queryAccepted = EFalse; + queryAccepted = KErrCancel; CSecQueryUi *iSecQueryUi; iSecQueryUi = CSecQueryUi::NewL(); - queryAccepted = iSecQueryUi->SecQueryDialog( _L("PIN1-Old"), oldPassword, 4, 8, ESecUiCancelSupported | ESecUiEmergencyNotSupported | secCodeType ); - RDebug::Printf( "%s %s (%u) oldPassword=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + TBuf<0x100> title; title.Zero(); title.Append(_L("PIN1-Old")); title.Append(_L("#")); title.AppendNum(codeInfo.iRemainingEntryAttempts); + queryAccepted = iSecQueryUi->SecQueryDialog( title, oldPassword, 4, 8, ESecUiAlphaNotSupported | ESecUiCancelSupported | ESecUiEmergencyNotSupported | secCodeType ); + RDEBUG( "oldPassword", 0 ); RDebug::Print( oldPassword ); - RDebug::Printf( "%s %s (%u) queryAccepted=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); + RDEBUG( "queryAccepted", queryAccepted ); delete iSecQueryUi; - if(!queryAccepted) - return; + if( queryAccepted!=KErrNone ) + return KErrAbort; res=1; // indicate that everything is ok /* end request PIN using QT */ newPassword = _L(""); @@ -2369,9 +1860,7 @@ verifcationPassword.Copy(aNewPassword); } - RDebug::Printf( "%s %s (%u) res=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, res ); - - RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); + RDEBUG( "res", res ); while (newPassword.Length()==0 || newPassword.CompareF(verifcationPassword) != 0) { // codes do not match -> note -> ask new pin and verification codes again @@ -2386,54 +1875,42 @@ { /* request PIN using QT */ { - queryAccepted = EFalse; + queryAccepted = KErrCancel; CSecQueryUi *iSecQueryUi; iSecQueryUi = CSecQueryUi::NewL(); - queryAccepted = iSecQueryUi->SecQueryDialog( _L("PIN1-New"), newPassword, 4, 8, ESecUiCancelSupported | ESecUiEmergencyNotSupported | secCodeType ); - RDebug::Printf( "%s %s (%u) newPassword=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + // this queries both, and verifies itself + queryAccepted = iSecQueryUi->SecQueryDialog( _L("PIN1-New|PIN1-Ver"), newPassword, 4, 8, ESecUiAlphaNotSupported | ESecUiCancelSupported | ESecUiEmergencyNotSupported | secCodeType ); + RDEBUG( "newPassword", 1 ); RDebug::Print( newPassword ); - RDebug::Printf( "%s %s (%u) queryAccepted=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); + RDEBUG( "queryAccepted", queryAccepted ); delete iSecQueryUi; - if(!queryAccepted) - return; + if( queryAccepted!=KErrNone ) + return KErrAbort; } /* end request PIN using QT */ - - RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); - /* request PIN using QT */ - { - queryAccepted = EFalse; - CSecQueryUi *iSecQueryUi; - iSecQueryUi = CSecQueryUi::NewL(); - queryAccepted = iSecQueryUi->SecQueryDialog( _L("PIN1-Ver"), verifcationPassword, 4, 8, ESecUiCancelSupported | ESecUiEmergencyNotSupported | secCodeType ); - RDebug::Printf( "%s %s (%u) verifcationPassword=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - RDebug::Print( verifcationPassword ); - RDebug::Printf( "%s %s (%u) queryAccepted=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); - delete iSecQueryUi; - if(!queryAccepted) - return; - } - /* end request PIN using QT */ + verifcationPassword.Copy(newPassword); // just to break the while + RDEBUG( "0", 0 ); } } // send code passwords.iOldPassword = oldPassword; passwords.iNewPassword = newPassword; - RDebug::Printf( "%s %s (%u) SetRequestType=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); + RDEBUG( "passwords", 0 ); RDebug::Print( passwords.iOldPassword ); RDebug::Print( passwords.iNewPassword ); + RDEBUG( "SetRequestType", 0 ); iWait->SetRequestType(EMobilePhoneChangeSecurityCode); - #ifndef __WINS__ + RDEBUG( "ChangeSecurityCode", 0 ); iPhone.ChangeSecurityCode(iWait->iStatus, secCodeType, passwords); + RDEBUG( "WaitForRequestL", 0 ); res = iWait->WaitForRequestL(); - #else - res = KErrNone; - #endif - RDebug::Printf( "%s %s (%u) res=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, res ); - #if defined(_DEBUG) - RDebug::Print( _L("(SECUI)CSecuritySettings::ChangePinParamsL(): RETURN CODE: %d"), res); - #endif + RDEBUG( "WaitForRequestL res", res ); + #ifdef __WINS__ + if (res == KErrNotSupported) + res = KErrNone; + #endif + switch(res) { case KErrNone: @@ -2454,13 +1931,13 @@ case KErrLocked: { // Pin1 blocked! - return; + return KErrLocked; } case KErrGsm0707OperationNotAllowed: { // not allowed with this sim ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); - return; + return KErrGsm0707OperationNotAllowed; } case KErrAbort: { @@ -2475,26 +1952,349 @@ } return res; } +/*********************************************/ +// qtdone EXPORT_C TInt CSecuritySettings::ChangeUPinParamsL(RMobilePhone::TMobilePassword aOldPassword, RMobilePhone::TMobilePassword aNewPassword, TInt aFlags, TDes& aCaption, TInt aShowError) { - TInt ret = KErrNone; - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) aFlags=%x aShowError=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aFlags, aShowError ); - #endif + RDEBUG( "aFlags", aFlags ); + + RDebug::Print(aOldPassword); + RDebug::Print(aNewPassword); + RDebug::Print(aCaption); + + TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); + TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); + if(! (wcdmaSupported || upinSupported)) + { + RDEBUG( "! upinSupported", upinSupported ); + return KErrAccessDenied; + } + + RDEBUG( "upinSupported", upinSupported ); + TInt simState; + TInt err( KErrGeneral ); + err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); + User::LeaveIfError( err ); + TBool simRemoved(simState == ESimNotPresent); + + if ( simRemoved ) + { + ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); + return KErrAccessDenied; + } + + RMobilePhone::TMobilePhoneSecurityCode secCodeType; + secCodeType = RMobilePhone::ESecurityUniversalPin; + + RMobilePhone::TMobilePassword oldPassword; + RMobilePhone::TMobilePassword newPassword; + RMobilePhone::TMobilePassword verifcationPassword; + RMobilePhone::TMobilePhonePasswordChangeV1 passwords; + RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; + RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); + RMobilePhone::TMobilePhoneLock lockType; + RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; + TInt queryAccepted = KErrCancel; + + lockType = RMobilePhone::ELockUniversalPin; + + RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); + iWait->SetRequestType(EMobilePhoneGetLockInfo); + RDEBUG( "GetLockInfo", 0 ); + iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); + RDEBUG( "WaitForRequestL", 0 ); + TInt res = iWait->WaitForRequestL(); + RDEBUG( "WaitForRequestL res", res ); + #ifdef __WINS__ + if (res == KErrNotSupported) + { + res = KErrNone; + lockInfo.iSetting = RMobilePhone::ELockSetEnabled; + } + #endif + User::LeaveIfError(res); + + RDEBUG( "lockInfo.iSetting", lockInfo.iSetting ); + RDEBUG( "RMobilePhone::ELockSetDisabled", RMobilePhone::ELockSetDisabled ); + if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) + { + ShowResultNoteL(R_UPIN_NOT_ALLOWED, CAknNoteDialog::EErrorTone); + return KErrAccessDenied; + } + + iWait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); + RDEBUG( "GetSecurityCodeInfo", 0 ); + iPhone.GetSecurityCodeInfo(iWait->iStatus, secCodeType, codeInfoPkg); + RDEBUG( "WaitForRequestL", 0 ); + res = iWait->WaitForRequestL(); + RDEBUG( "WaitForRequestL res", res ); + #ifdef __WINS__ + if (res == KErrNotSupported || res == KErrTimedOut) + { + res = KErrNone; + codeInfo.iRemainingEntryAttempts=KMaxNumberOfPINAttempts; + } + #endif + User::LeaveIfError(res); + + /* request PIN using QT */ + queryAccepted = KErrCancel; + CSecQueryUi *iSecQueryUi; + iSecQueryUi = CSecQueryUi::NewL(); + TBuf<0x100> title; title.Zero(); title.Append(_L("UPIN-Old")); title.Append(_L("#")); title.AppendNum(codeInfo.iRemainingEntryAttempts); + queryAccepted = iSecQueryUi->SecQueryDialog( title, oldPassword, 4, 8, ESecUiAlphaNotSupported | ESecUiCancelSupported | ESecUiEmergencyNotSupported | secCodeType ); + RDEBUG( "oldPassword", 0 ); + RDebug::Print( oldPassword ); + RDEBUG( "queryAccepted", queryAccepted ); + delete iSecQueryUi; + if( queryAccepted!=KErrNone ) + return KErrAbort; + res=1; // indicate that everything is ok + + { + queryAccepted = KErrCancel; + CSecQueryUi *iSecQueryUi; + iSecQueryUi = CSecQueryUi::NewL(); + // this queries both, and verifies itself + queryAccepted = iSecQueryUi->SecQueryDialog( _L("PIN1-New|PIN1-Ver"), newPassword, 4, 8, ESecUiAlphaNotSupported | ESecUiCancelSupported | ESecUiEmergencyNotSupported | secCodeType ); + RDEBUG( "newPassword", 0 ); + RDebug::Print( newPassword ); + RDEBUG( "queryAccepted", queryAccepted ); + delete iSecQueryUi; + if( queryAccepted!=KErrNone ) + return KErrAbort; + } + // send code + passwords.iOldPassword = oldPassword; + passwords.iNewPassword = newPassword; + iWait->SetRequestType(EMobilePhoneChangeSecurityCode); + RDEBUG( "ChangeSecurityCode", 0 ); + iPhone.ChangeSecurityCode(iWait->iStatus, secCodeType, passwords); + RDEBUG( "WaitForRequestL", 0 ); + res = iWait->WaitForRequestL(); + RDEBUG( "WaitForRequestL res", res ); + #ifdef __WINS__ + if (res == KErrNotSupported) + res = KErrNone; + #endif + switch(res) + { + case KErrNone: + { + // code changed + ShowResultNoteL(R_UPIN_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); + break; + } + case KErrGsm0707IncorrectPassword: + case KErrAccessDenied: + { + // code was entered erroneously + ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + ChangeUPinParamsL(_L(""), _L(""), aFlags, aCaption, aShowError); + break; + } + case KErrGsmSSPasswordAttemptsViolation: + case KErrLocked: + { + return KErrLocked; + } + case KErrGsm0707OperationNotAllowed: + { + // not allowed with this sim + ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); + return KErrGsm0707OperationNotAllowed; + } + case KErrAbort: + { + break; + } + default: + { + ShowErrorNoteL(res); + ChangeUPinParamsL(_L(""), _L(""), aFlags, aCaption, aShowError); + break; + } + } + return res; } +/***************************************/ +// qtdone EXPORT_C TInt CSecuritySettings::ChangePin2ParamsL(RMobilePhone::TMobilePassword aOldPassword, RMobilePhone::TMobilePassword aNewPassword, TInt aFlags, TDes& aCaption, TInt aShowError) { - TInt ret = KErrNone; - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) aFlags=%x aShowError=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aFlags, aShowError ); - #endif + #if defined(_DEBUG) + RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePin2ParamsL()")); + #endif + TInt simState; + TInt err( KErrGeneral ); + err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); + User::LeaveIfError( err ); + TBool simRemoved(simState == ESimNotPresent); + + if ( simRemoved ) + { + ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); + return KErrAccessDenied; + } + + RMmCustomAPI::TSecurityCodeType secCodeType; + RMobilePhone::TMobilePhoneSecurityCode EtelsecCodeType; + secCodeType = RMmCustomAPI::ESecurityCodePin2; + RMobilePhone::TMobilePassword oldPassword; + RMobilePhone::TMobilePassword newPassword; + RMobilePhone::TMobilePassword verifcationPassword; + RMobilePhone::TMobilePhonePasswordChangeV1 passwords; + RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; + RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); + TInt queryAccepted = KErrCancel; + + // check if pin2 is blocked... + TBool isBlocked = EFalse; + + TInt ret = iCustomPhone.IsBlocked(secCodeType,isBlocked); + RDEBUG( "isBlocked", isBlocked ); + if(isBlocked) + return KErrAccessDenied; + RDEBUG( "ret", ret ); + #ifdef __WINS__ + if (ret == KErrNotSupported) + ret = KErrNone; + #endif + + if (ret != KErrNone) + { + switch (ret) + { + // PIN2 Blocked. + case KErrGsm0707SIMPuk2Required: + break; + case KErrGsmSSPasswordAttemptsViolation: + case KErrLocked: + // Pin2 features blocked permanently! + ShowResultNoteL(R_PIN2_REJECTED, CAknNoteDialog::EConfirmationTone); + break; + case KErrGsm0707SimNotInserted: + // not allowed with this sim + ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); + break; + default: + ShowErrorNoteL(ret); + break; + } + return KErrAccessDenied; + } + + + // Security code must be changed to Etel API format + // Custom API Pin1 and Pin2 have the same enum values as the Etel ones + EtelsecCodeType = (RMobilePhone::TMobilePhoneSecurityCode)secCodeType; + iWait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); + RDEBUG( "GetSecurityCodeInfo", 0 ); + iPhone.GetSecurityCodeInfo(iWait->iStatus, EtelsecCodeType, codeInfoPkg); + RDEBUG( "WaitForRequestL", 0 ); + ret = iWait->WaitForRequestL(); + RDEBUG( "WaitForRequestL ret", ret ); + #ifdef __WINS__ + if ( ret == KErrNotSupported || ret == KErrTimedOut) + { + codeInfo.iRemainingEntryAttempts = 1; + ret = KErrNone; + } + #endif + User::LeaveIfError(ret); + + /* request PIN using QT */ + queryAccepted = KErrCancel; + CSecQueryUi *iSecQueryUi; + iSecQueryUi = CSecQueryUi::NewL(); + TBuf<0x100> title; title.Zero(); title.Append(_L("PIN2-Old")); title.Append(_L("#")); title.AppendNum(codeInfo.iRemainingEntryAttempts); + queryAccepted = iSecQueryUi->SecQueryDialog( title, oldPassword, SEC_C_PIN2_CODE_MIN_LENGTH, SEC_C_PIN2_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported | ESecUiEmergencyNotSupported | secCodeType ); + RDEBUG( "oldPassword", 0 ); + RDebug::Print( oldPassword ); + RDEBUG( "queryAccepted", queryAccepted ); + delete iSecQueryUi; + if( queryAccepted!=KErrNone ) + return KErrAbort; + /* end request PIN using QT */ + + /* request PIN using QT */ + { + queryAccepted = KErrCancel; + CSecQueryUi *iSecQueryUi; + iSecQueryUi = CSecQueryUi::NewL(); + // this queries both, and verifies itself + queryAccepted = iSecQueryUi->SecQueryDialog( _L("PIN2-New|PIN2-Ver"), newPassword, SEC_C_PIN2_CODE_MIN_LENGTH, SEC_C_PIN2_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported | ESecUiEmergencyNotSupported | secCodeType ); + RDEBUG( "newPassword", 0 ); + RDebug::Print( newPassword ); + RDEBUG( "queryAccepted", queryAccepted ); + delete iSecQueryUi; + if( queryAccepted!=KErrNone ) + return KErrAbort; + } + /* end request PIN using QT */ + + passwords.iOldPassword = oldPassword; + passwords.iNewPassword = newPassword; + iWait->SetRequestType(EMobilePhoneChangeSecurityCode); + RDEBUG( "ChangeSecurityCode", 0 ); + iPhone.ChangeSecurityCode(iWait->iStatus,EtelsecCodeType,passwords); + RDEBUG( "WaitForRequestL", 0 ); + TInt res = iWait->WaitForRequestL(); + RDEBUG( "WaitForRequestL res", res ); + #ifdef __WINS__ + if (res == KErrNotSupported) + res = KErrNone; + #endif + switch(res) + { + case KErrNone: + { + // code changed + ShowResultNoteL(R_PIN2_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); + break; + } + case KErrGsm0707IncorrectPassword: + case KErrAccessDenied: + { + ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + ChangePin2ParamsL(_L(""), _L(""), aFlags, aCaption, aShowError); + break; + } + case KErrGsmSSPasswordAttemptsViolation: + case KErrLocked: + { + // Pin2 blocked! + ShowResultNoteL(KErrLocked, CAknNoteDialog::EErrorTone); + CSecurityHandler* handler = new(ELeave) CSecurityHandler(iPhone); + CleanupStack::PushL(handler); + handler->HandleEventL(RMobilePhone::EPuk2Required); + CleanupStack::PopAndDestroy(handler); // handler + return KErrLocked; + } + case KErrGsm0707OperationNotAllowed: + { + // not allowed with this sim + ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); + return KErrGsm0707OperationNotAllowed; + } + case KErrAbort: + { + break; + } + default: + { + ShowErrorNoteL(res); + ChangePin2ParamsL(_L(""), _L(""), aFlags, aCaption, aShowError); + break; + } + } + return res; } +/************************************************/ +// qtdone EXPORT_C TInt CSecuritySettings::ChangeSecCodeParamsL(RMobilePhone::TMobilePassword aOldPassword, RMobilePhone::TMobilePassword aNewPassword, TInt aFlags, TDes& aCaption, TInt aShowError) { - TInt ret = KErrNone; - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) aFlags=%x aShowError=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aFlags, aShowError ); - #endif + RDEBUG( "aFlags", aFlags ); + RDEBUG( "aShowError", aShowError ); /***************************************************** * Series 60 Customer / ETel * Series 60 ETel API @@ -2503,7 +2303,7 @@ RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeSecCodeParamsL()")); #endif TInt res=0; - TBool queryAccepted = EFalse; + TInt queryAccepted = KErrCancel; RMobilePhone::TMobilePassword newPassword; RMobilePhone::TMobilePhoneSecurityCode secCodeType; @@ -2515,16 +2315,15 @@ if(aOldPassword.Length()==0) { /* request PIN using QT */ - queryAccepted = EFalse; + queryAccepted = KErrCancel; CSecQueryUi *iSecQueryUi; iSecQueryUi = CSecQueryUi::NewL(); - // TODO allow and handle Cancel - queryAccepted = iSecQueryUi->SecQueryDialog( _L("Lock-Old"), oldPassword, 4, 8, ESecUiCancelSupported | ESecUiEmergencyNotSupported | secCodeType ); - RDebug::Printf( "%s %s (%u) oldPassword=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + queryAccepted = iSecQueryUi->SecQueryDialog( _L("Lock-Old"), oldPassword, 4, 8, ESecUiAlphaSupported | ESecUiCancelSupported | ESecUiEmergencyNotSupported | secCodeType ); + RDEBUG( "oldPassword", 0 ); RDebug::Print( oldPassword ); - RDebug::Printf( "%s %s (%u) queryAccepted=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); + RDEBUG( "queryAccepted", queryAccepted ); delete iSecQueryUi; - if(!queryAccepted) + if( queryAccepted!=KErrNone ) return KErrAbort; res=1; // indicate that everything is ok /* end request PIN using QT */ @@ -2538,13 +2337,19 @@ verifcationPassword.Copy(aNewPassword); } - RDebug::Printf( "%s %s (%u) EMobilePhoneVerifySecurityCode=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, EMobilePhoneVerifySecurityCode ); + RDEBUG( "EMobilePhoneVerifySecurityCode", EMobilePhoneVerifySecurityCode ); iWait->SetRequestType(EMobilePhoneVerifySecurityCode); // check code + RDEBUG( "VerifySecurityCode", 0 ); iPhone.VerifySecurityCode(iWait->iStatus,secCodeType, oldPassword, required_fourth); + RDEBUG( "WaitForRequestL", 0 ); res = iWait->WaitForRequestL(); - RDebug::Printf( "%s %s (%u) VerifySecurityCode res=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, res ); - + RDEBUG( "WaitForRequestL res", res ); + #ifdef __WINS__ + if (res == KErrNotSupported) + res = KErrNone; + #endif + if(res!=KErrNone) { ShowResultNoteL(res, CAknNoteDialog::EErrorTone); @@ -2558,45 +2363,41 @@ ShowResultNoteL(R_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone); { - queryAccepted = EFalse; + queryAccepted = KErrCancel; CSecQueryUi *iSecQueryUi; iSecQueryUi = CSecQueryUi::NewL(); - queryAccepted = iSecQueryUi->SecQueryDialog( _L("Lock-New"), newPassword, 4, 8, ESecUiCancelSupported | ESecUiEmergencyNotSupported | secCodeType ); - RDebug::Printf( "%s %s (%u) newPassword=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + // will ask both codes and compare itself + // mix, max , is handled using TARM params, in the dialog itself + TInt lType = ESecUiAlphaNotSupported | ESecUiCancelSupported | ESecUiEmergencyNotSupported | secCodeType; + RDEBUG( "lType", lType ); + queryAccepted = iSecQueryUi->SecQueryDialog( _L("Lock-New|Lock-Verif"), newPassword, 4, 8, lType ); + RDEBUG( "newPassword", 0 ); RDebug::Print( newPassword ); - RDebug::Printf( "%s %s (%u) queryAccepted=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); + RDEBUG( "queryAccepted", queryAccepted ); delete iSecQueryUi; - if(!queryAccepted) + if( queryAccepted!=KErrNone ) return KErrAbort; } - - { - queryAccepted = EFalse; - CSecQueryUi *iSecQueryUi; - iSecQueryUi = CSecQueryUi::NewL(); - queryAccepted = iSecQueryUi->SecQueryDialog( _L("Lock-Verif"), verifcationPassword, 4, 8, ESecUiCancelSupported | ESecUiEmergencyNotSupported | secCodeType ); - RDebug::Printf( "%s %s (%u) verifcationPassword=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - RDebug::Print( verifcationPassword ); - RDebug::Printf( "%s %s (%u) queryAccepted=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); - delete iSecQueryUi; - if(!queryAccepted) - return KErrAbort; - // TODO allow and handle Cancel - } + verifcationPassword.Copy(newPassword); // break the while } // while // change code - RDebug::Printf( "%s %s (%u) res=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, res ); + RDEBUG( "res", res ); if (res == KErrNone) { passwords.iOldPassword = oldPassword; passwords.iNewPassword = newPassword; iWait->SetRequestType(EMobilePhoneChangeSecurityCode); - RDebug::Printf( "%s %s (%u) ChangeSecurityCode=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); + RDEBUG( "ChangeSecurityCode", 0 ); iPhone.ChangeSecurityCode(iWait->iStatus,secCodeType,passwords); + RDEBUG( "WaitForRequestL", 0 ); res = iWait->WaitForRequestL(); - RDebug::Printf( "%s %s (%u) res=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, res ); + RDEBUG( "WaitForRequestL res", res ); + #ifdef __WINS__ + if (res == KErrNotSupported) + res = KErrNone; + #endif if(res==KErrNone && 1==0 ) // TODO not possible to enable because it asks code again { @@ -2605,38 +2406,52 @@ if(oldPassword.Length()==6) { lockChangeSetting = RMobilePhone::ELockSetDisabled; - RDebug::Printf( "%s %s (%u) RMobilePhone::ELockSetDisabled=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, RMobilePhone::ELockSetDisabled ); + RDEBUG( "RMobilePhone::ELockSetDisabled", RMobilePhone::ELockSetDisabled ); } iWait->SetRequestType(EMobilePhoneSetLockSetting); - RDebug::Printf( "%s %s (%u) SetLockSetting=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); + RDEBUG( "SetLockSetting", 0 ); iPhone.SetLockSetting(iWait->iStatus, lockType, lockChangeSetting ); + RDEBUG( "WaitForRequestL", 0 ); res = iWait->WaitForRequestL(); - RDebug::Printf( "%s %s (%u) res=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, res ); + RDEBUG( "WaitForRequestL res", res ); + #ifdef __WINS__ + if (res == KErrNotSupported) + res = KErrNone; + #endif } } - RDebug::Printf( "%s %s (%u) res=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, res ); - #if defined(_DEBUG) - RDebug::Print( _L("(SECUI)CSecuritySettings::ChangeSecCodeParamsL(): RETURN CODE: %d"), res); - #endif + RDEBUG( "res", res ); switch(res) { case KErrNone: { // code changed ShowResultNoteL(R_SECURITY_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); - if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw ) && - !(FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements ))) - { - // Send the changed code to the SCP server. Not used with device lock enhancements. - RDebug::Printf( "%s %s (%u) scpClient.Connect=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); + { + // Send the changed code to the SCP server, even with device lock enhancements. + RDEBUG( "scpClient.Connect", 0 ); RSCPClient scpClient; TSCPSecCode newCode; + TSCPSecCode oldPassword; newCode.Copy( newPassword ); if ( scpClient.Connect() == KErrNone ) { - RDebug::Printf( "%s %s (%u) scpClient.StoreCode=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); - scpClient.StoreCode( newCode ); + RDEBUG( "scpClient.StoreCode", 0 ); + /* + // scpClient.StoreCode( newCode ); + RArray aFailedPolicies; + TDevicelockPolicies failedPolicy; + TInt retLockcode = KErrNone; + retLockcode = scpClient.StoreLockcode( newCode, oldPassword, aFailedPolicies ); + RDEBUG( "retLockcode", retLockcode ); + RDEBUG( "aFailedPolicies.Count()", aFailedPolicies.Count() ); + for(TInt i=0; i maxPeriodBuf; + if ( scpClient.GetParamValue( ESCPMaxAutolockPeriod, maxPeriodBuf ) == KErrNone ) + { + TLex lex( maxPeriodBuf ); + if ( ( lex.Val( maxPeriod ) == KErrNone ) && ( maxPeriod > 0 ) ) + { + RDEBUG( "from SCP maxPeriod", maxPeriod ); + // nothing to do + } + else + { + maxPeriod = 0; + RDEBUG( "not from SCP maxPeriod", maxPeriod ); + } + } + else + { + RDEBUG( "Failed to retrieve max period", maxPeriod ); + } + } + else + { + RDEBUG( "Failed to connect to SCP", 0 ); + } + CleanupStack::PopAndDestroy(); // scpClient } + RDEBUG( "maxPeriod", maxPeriod ); + if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw )) + { + TBool allow = ETrue; + + if ((aPeriod == 0) && (maxPeriod > 0)) + { + #if defined(_DEBUG) + RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() \ + The period: %d is not allowed by TARM; max: %d"),aPeriod, maxPeriod ); + #endif + allow = EFalse; + ShowResultNoteL(R_SECUI_TEXT_AUTOLOCK_MUST_BE_ACTIVE, CAknNoteDialog::EErrorTone); + } + if ( !allow ) + { + return ChangeAutoLockPeriodParamsL(aPeriod, aOldPassword, aFlags, aCaption, aShowError); // ask again + } + } + + if (aPeriod == 0) + { + #ifdef RD_REMOTELOCK + + // If remote lock is enabled, don't disable the domestic OS device lock + // since that would render the RemoteLock useless. + // Instead just re-set the DOS lock to enabled which as a side effect + // requests the security code from the user. + + TBool remoteLockStatus( EFalse ); + CRemoteLockSettings* remoteLockSettings = CRemoteLockSettings::NewL(); + + if ( remoteLockSettings->GetEnabled( remoteLockStatus ) ) + { + if ( remoteLockStatus ) + { + // Remote lock is enabled + lockChange = RMobilePhone::ELockSetEnabled; + RDEBUG( "RemoteLock is enabled lockChange", lockChange ); + } + else + { + // Remote lock is disabled + lockChange = RMobilePhone::ELockSetDisabled; + RDEBUG( "RemoteLock is disabled lockChange", lockChange ); + } + } + else + { + // Failed to get remote lock status + RDEBUG( "Failed to get remote lock status lockChange", lockChange ); + } + + delete remoteLockSettings; + remoteLockSettings = NULL; + + #else // not defined RD_REMOTELOCK + + lockChange = RMobilePhone::ELockSetDisabled; + + #endif // RD_REMOTELOCK + } + else + { + lockChange = RMobilePhone::ELockSetEnabled; + RDEBUG( "aPeriod != 0 lockChange", lockChange ); + } + + iWait->SetRequestType(EMobilePhoneSetLockSetting); + RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); + RDEBUG( "SetLockSetting", 0 ); + iPhone.SetLockSetting(iWait->iStatus,lockType,lockChange); // this eventually calls PassPhraseRequiredL + RDEBUG( "WaitForRequestL", 0 ); + TInt status = KErrNone; + status = iWait->WaitForRequestL(); + RDEBUG( "WaitForRequestL status", status ); + #ifdef __WINS__ + if (status == KErrNotSupported) + status = KErrNone; + #endif + switch(status) + { + case KErrNone: + #if defined(_DEBUG) + RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() KErrNone")); + #endif + break; + case KErrGsmSSPasswordAttemptsViolation: + case KErrLocked: + #if defined(_DEBUG) + RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() PasswordAttemptsViolation")); + #endif + ShowResultNoteL(KErrLocked, CAknNoteDialog::EErrorTone); // the old code didn't show messages + return ChangeAutoLockPeriodParamsL(oldPeriod, aOldPassword, aFlags, aCaption, aShowError); // ask again + case KErrGsm0707IncorrectPassword: + case KErrAccessDenied: + #if defined(_DEBUG) + RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() IncorrectPassword")); + #endif + // code was entered erroneously + ShowResultNoteL(KErrAccessDenied, CAknNoteDialog::EErrorTone); // the old code didn't show messages + return ChangeAutoLockPeriodParamsL(oldPeriod, aOldPassword, aFlags, aCaption, aShowError); // ask again + case KErrAbort: + // User pressed "cancel" in the code query dialog. + return oldPeriod; + default: + #if defined(_DEBUG) + RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() default")); + #endif + ShowResultNoteL(status, CAknNoteDialog::EErrorTone); // the old code didn't show messages + return ChangeAutoLockPeriodParamsL(oldPeriod, aOldPassword, aFlags, aCaption, aShowError); // ask again + } + #if defined(_DEBUG) + RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() END")); + #endif + return aPeriod; + } +/*****************************/ +// qtdone EXPORT_C TInt CSecuritySettings::ChangePinRequestParamsL(TInt aEnable, RMobilePhone::TMobilePassword aOldPassword, TInt aFlags, TDes& aCaption, TInt aShowError) { - TInt ret = KErrNone; - #if defined(_DEBUG) - RDebug::Printf( "%s %s (%u) aFlags=%x aShowError=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aFlags, aShowError ); - #endif + RDEBUG( "aEnable", aEnable ); + RDEBUG( "aFlags", aFlags ); /***************************************************** * Series 60 Customer / ETel * Series 60 ETel API *****************************************************/ #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestL()")); + RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestParamsL()")); #endif TInt simState=0; TInt lEnable=aEnable; @@ -2699,7 +2678,7 @@ if ( simRemoved ) { ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); - return EFalse;; + return EFalse; } RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; @@ -2712,12 +2691,20 @@ //get lock info iWait->SetRequestType(EMobilePhoneGetLockInfo); iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); + RDEBUG( "WaitForRequestL", 0 ); TInt status = iWait->WaitForRequestL(); + RDEBUG( "WaitForRequestL status", status ); + #ifdef __WINS__ + if (status == KErrNotSupported) + { + lockInfo.iSetting = RMobilePhone::ELockSetDisabled; + status = KErrNone; + } + #endif User::LeaveIfError(status); - TInt currentItem = 0; #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestL() GetLockInfo")); + RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestParamsL() GetLockInfo")); #endif if(aOldPassword.Length()==0) // only if input parameters are empty @@ -2732,14 +2719,14 @@ if (lEnable == 0) { #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestL() currentItem: ELockSetDisabled")); + RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestParamsL() currentItem: ELockSetDisabled")); #endif lockChangeSetting = RMobilePhone::ELockSetDisabled; } else { #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestL() currentItem: ELockSetEnabled")); + RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestParamsL() currentItem: ELockSetEnabled")); #endif lockChangeSetting = RMobilePhone::ELockSetEnabled; } @@ -2750,33 +2737,23 @@ if ( tRet != KErrNone ) { #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestL():\ + RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestParamsL():\ FAILED to set the SECUI query Flag: %d"), tRet); #endif } - /* TODO do I really need this? wouldn't it just generate RMobilePhone::EPin1Required and then continue ? */ - /* - RMobilePhone::TMobilePhoneSecurityCode secCodeType = RMobilePhone::ESecurityCodePin1; - RMobilePhone::TMobilePassword oldPassword; - TBool queryAccepted = EFalse; - CSecQueryUi *iSecQueryUi; - iSecQueryUi = CSecQueryUi::NewL(); - queryAccepted = iSecQueryUi->SecQueryDialog( _L("PIN1-Curr"), oldPassword, 4, 8, secCodeType ); - RDebug::Printf( "%s %s (%u) oldPassword=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); - RDebug::Print( oldPassword ); - RDebug::Printf( "%s %s (%u) queryAccepted=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); - delete iSecQueryUi; - */ - // Change the lock setting iWait->SetRequestType(EMobilePhoneSetLockSetting); RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); + RDEBUG( "SetLockSetting", 0 ); iPhone.SetLockSetting(iWait->iStatus,lockType,lockChangeSetting); // this will trigger Pin1RequiredL + RDEBUG( "WaitForRequestL", 0 ); status = iWait->WaitForRequestL(); - #if defined(_DEBUG) - RDebug::Print( _L("(SECUI)CSecuritySettings::ChangePinRequestL(): RETURN CODE: %d"), status); - #endif + RDEBUG( "WaitForRequestL status", status ); + #ifdef __WINS__ + if (status == KErrNotSupported) + status = KErrNone; + #endif // Lower the flag RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsETelAPIOriginated); @@ -2813,6 +2790,22 @@ return ChangePinRequestParamsL(aEnable, aOldPassword, aFlags, aCaption, aShowError); } } - } +return ETrue; +} + +// +// ---------------------------------------------------------- +// CSecuritySettings::AskSecCodeParamsL() +// For asking security code e.g in settings +// not used +// ---------------------------------------------------------- +// qtdone +EXPORT_C TBool CSecuritySettings::AskSecCodeParamsL(RMobilePhone::TMobilePassword &aOldPassword, TInt aFlags, TDes& aCaption, TInt aShowError) + { + RDEBUG( "aFlags", aFlags ); + RDEBUG( "aShowError", aShowError ); + RDEBUG( "This doesn't do anything", 0 ); + return EFalse; + } // End of file diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/SecUi/Src/SecUiSystemLock.cpp --- a/securitydialogs/SecUi/Src/SecUiSystemLock.cpp Fri Apr 16 15:53:24 2010 +0300 +++ b/securitydialogs/SecUi/Src/SecUiSystemLock.cpp Mon May 03 13:20:16 2010 +0300 @@ -30,6 +30,8 @@ #include #include #include +#include + /***************************************************** * Series 60 Customer / TSY * Needs customer TSY implementation @@ -154,84 +156,12 @@ RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL()")); #endif // close fast-swap window - CEikonEnv::Static()->DismissTaskList(); - -#ifdef __WINS__ - // can not verify security code in emulator ---> lock system -#ifdef RD_REMOTELOCK - iProperty.Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EManualLocked); -#else// !RD_REMOTELOCK - iProperty.Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EAutolockOn); -#endif//RD_REMOTELOCK -#else //__WINS__ - - if(IsActive()) - return; - - - RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; - RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; - RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); - RMobilePhone::TMobilePhoneLockSetting lockChange(RMobilePhone::ELockSetDisabled); - CWait* wait = CWait::NewL(); - CleanupStack::PushL( wait ); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL() GetLockInfo")); - #endif - iPhone.GetLockInfo(wait->iStatus, lockType, lockInfoPkg); - if (wait->WaitForRequestL() == KErrNone) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL() KErrNone")); - #endif - if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL() ELockSetDisabled")); - #endif - // ask code - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL() SetLockSetting")); - #endif - //iCustomPhone.CheckSecurityCode(iStatus, RMmCustomAPI::ESecurityCodePassPhrase); - lockChange = RMobilePhone::ELockSetEnabled; - RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSystemLockOriginated); - iPhone.SetLockSetting(iStatus, lockType, lockChange); - SetActive(); - } - else - { - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL() Lock System")); - #endif - // lock system -#ifdef RD_REMOTELOCK - iProperty.Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EManualLocked); -#else// !RD_REMOTELOCK - iProperty.Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EAutolockOn); -#endif //RD_REMOTELOCK - - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL() Lock System OK")); - #endif - } - } - else - { - // ask code - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL() ask code (SLS) ")); - #endif - lockChange = RMobilePhone::ELockSetEnabled; - RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSystemLockOriginated); - iPhone.SetLockSetting(iStatus, lockType, lockChange); - SetActive(); - } - CleanupStack::PopAndDestroy(); - #if defined(_DEBUG) - RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL() END")); - #endif // DEBUG - #endif // WINS + RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + CDevicelockAccessApi* iDevicelockAccess = CDevicelockAccessApi::NewL( ); + RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + iDevicelockAccess->OfferDevicelock(); + // EnableDevicelock( EDevicelockManual ); + RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); } // // ---------------------------------------------------------- diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/SecUi/group/SecUi.mmp --- a/securitydialogs/SecUi/group/SecUi.mmp Fri Apr 16 15:53:24 2010 +0300 +++ b/securitydialogs/SecUi/group/SecUi.mmp Mon May 03 13:20:16 2010 +0300 @@ -130,6 +130,8 @@ LIBRARY HbCore.lib LIBRARY HbWidgets.lib +LIBRARY lockclient.lib +LIBRARY phoneclient.lib SMPSAFE diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/SecUi/rom/GSSimSecPlugin.iby --- a/securitydialogs/SecUi/rom/GSSimSecPlugin.iby Fri Apr 16 15:53:24 2010 +0300 +++ b/securitydialogs/SecUi/rom/GSSimSecPlugin.iby Mon May 03 13:20:16 2010 +0300 @@ -19,8 +19,8 @@ #define GSSIMSECPLUGIN_IBY #ifdef RD_GS_RENOVATION - - ECOM_PLUGIN( GSSimSecPlugin.dll, 10207438.rsc ) + // Now replaced by a QT plugin + // ECOM_PLUGIN( GSSimSecPlugin.dll, 10207438.rsc ) #endif // RD_GS_RENOVATION diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/SecUi/rom/GSSimSecPluginResources.iby --- a/securitydialogs/SecUi/rom/GSSimSecPluginResources.iby Fri Apr 16 15:53:24 2010 +0300 +++ b/securitydialogs/SecUi/rom/GSSimSecPluginResources.iby Mon May 03 13:20:16 2010 +0300 @@ -20,7 +20,8 @@ #ifdef RD_GS_RENOVATION - data=DATAZ_\RESOURCE_FILES_DIR\GSSimSecPluginRsc.rsc RESOURCE_FILES_DIR\GSSimSecPluginRsc.rsc + // Now replaced by a QT plugin + // data=DATAZ_\RESOURCE_FILES_DIR\GSSimSecPluginRsc.rsc RESOURCE_FILES_DIR\GSSimSecPluginRsc.rsc #endif // RD_GS_RENOVATION diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/lockclient/src/lockaccessextension.cpp --- a/securitydialogs/lockclient/src/lockaccessextension.cpp Fri Apr 16 15:53:24 2010 +0300 +++ b/securitydialogs/lockclient/src/lockaccessextension.cpp Mon May 03 13:20:16 2010 +0300 @@ -26,6 +26,8 @@ #include #include #include +#include +#include // Constants const TInt KTimesToConnectServer( 2); @@ -146,30 +148,70 @@ if ( ret == KErrNone ) { // assign parameters to IPC argument - TIpcArgs args( aParam1, aParam2); + // TIpcArgs args( aParam1, aParam2); // this is the old methd. Now we use QtHighway // ret = SendReceive( aMessage, args ); - qDebug() << "============= RLockAccessExtension::SendMessage 123.1"; + qDebug() << "============= RLockAccessExtension::SendMessage 123.2"; qDebug() << aMessage; qDebug() << aParam1; qDebug() << aParam2; - XQServiceRequest* mServiceRequest; - qDebug() << "============= RLockAccessExtension::SendMessage 2"; - mServiceRequest = new XQServiceRequest("com.nokia.services.AutolockSrv.AutolockSrv","dial(QString,bool)");// use , false to make async - qDebug() << "============= RLockAccessExtension::SendMessage 2.1"; - qDebug() << mServiceRequest; - QString label = ""; - label += QString("%1").arg(aMessage); - *mServiceRequest << QString(label); - qDebug() << "============= RLockAccessExtension::SendMessage 2.2"; - bool isSync = false; - *mServiceRequest << isSync; - qDebug() << "============= RLockAccessExtension::SendMessage 3"; - int returnvalue; - bool ret = mServiceRequest->send(returnvalue); - qDebug() << "============= RLockAccessExtension::SendMessage 4"; - qDebug() << ret; - + + if(1==0) + { // old method. Not used any more + XQServiceRequest* mServiceRequest; + qDebug() << "============= RLockAccessExtension::SendMessage 2"; + mServiceRequest = new XQServiceRequest("com.nokia.services.AutolockSrv.AutolockSrv","service(QString,QString,QString)");// use , false to make async + qDebug() << "============= RLockAccessExtension::SendMessage 2.1"; + qDebug() << mServiceRequest; + QString label; + label = "" + QString("%1").arg(aMessage); + *mServiceRequest << QString(label); + qDebug() << "============= RLockAccessExtension::SendMessage aParam1"; + label = "" + QString("%1").arg(aParam1); + *mServiceRequest << QString(label); + qDebug() << "============= RLockAccessExtension::SendMessage aParam2"; + label = "" + QString("%1").arg(aParam2); + *mServiceRequest << QString(label); + qDebug() << "============= RLockAccessExtension::SendMessage 3"; + int returnvalue; + bool ret = mServiceRequest->send(returnvalue); + qDebug() << "============= RLockAccessExtension::SendMessage ret=" << ret; + qDebug() << "============= RLockAccessExtension::SendMessage returnvalue=" << returnvalue; + } + else + { + // TODO this always seems to fail because request is NULL + XQApplicationManager mAppManager; + XQAiwRequest *request; + request = mAppManager.create("com.nokia.services.AutolockSrv", "AutolockSrv", "service(QString,QString,QString)", false); + // also works with create("AutolockSrv", "service(QString,QString,QString)", false); + if(request) + qDebug() << "============= RLockAccessExtension::SendMessage got request"; + else + { + qDebug() << "============= RLockAccessExtension::SendMessage not got request"; + } + + qDebug() << "============= RLockAccessExtension::SendMessage 121.3"; + QList args; + QString label ; + label = "" + QString("%1").arg(aMessage); + args << QVariant(QString(label)); + qDebug() << "============= RLockAccessExtension::SendMessage 123.4"; + label = "" + QString("%1").arg(aParam1); + args << QVariant(QString(label)); + label = "" + QString("%1").arg(aParam2); + args << QVariant(QString(label)); + qDebug() << "============= RLockAccessExtension::SendMessage 123.4"; + request->setArguments(args); + qDebug() << "============= RLockAccessExtension::SendMessage 123.5"; + bool ret = request->send(); + qDebug() << "============= RLockAccessExtension::SendMessage ret=" << ret; + int error = request->lastError(); + qDebug() << "============= RLockAccessExtension::SendMessage error=" << error; + + delete request; + } } return ret; } diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/secuinotifications/secuinotificationdialogplugin/inc/secuinotificationcontentwidget.h --- a/securitydialogs/secuinotifications/secuinotificationdialogplugin/inc/secuinotificationcontentwidget.h Fri Apr 16 15:53:24 2010 +0300 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/inc/secuinotificationcontentwidget.h Mon May 03 13:20:16 2010 +0300 @@ -37,6 +37,7 @@ signals: void memorySelectionChanged(const QString &text); void codeTopChanged(const QString &text); + void codeBottomChanged(const QString &text); void but1Changed(); void but2Changed(); void but3Changed(); @@ -47,7 +48,13 @@ private: // data public: HbLineEdit *codeTop; + HbLineEdit *codeBottom; int queryType; + int lMinLength; + int lMaxLength; + int queryDual; + int lEmergencySupported; + int isEmergency; }; #endif // SECUINOTIFICATIONCONTENTWIDGET_H diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/secuinotifications/secuinotificationdialogplugin/inc/secuinotificationdialog.h --- a/securitydialogs/secuinotifications/secuinotificationdialogplugin/inc/secuinotificationdialog.h Fri Apr 16 15:53:24 2010 +0300 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/inc/secuinotificationdialog.h Mon May 03 13:20:16 2010 +0300 @@ -22,7 +22,7 @@ #include // HbDeviceDialogInterface #include // HbWidget #include // HbWidget - +#include /** * SW Install notification widget class. @@ -51,13 +51,14 @@ private: // new functions bool constructDialog(const QVariantMap ¶meters); - void sendResult(bool accepted); + void sendResult(int accepted); private slots: void handleAccepted(); void handleCancelled(); void handleMemorySelectionChanged(const QString &text); void handleCodeTopChanged(const QString &text); + void handleCodeBottomChanged(const QString &text); void saveFocusWidget(QWidget*,QWidget*); void handlebut1Changed(); void handlebut2Changed(); @@ -70,9 +71,16 @@ bool mShowEventReceived; QVariantMap mResultMap; HbLineEdit *codeTop; + HbLineEdit *codeBottom; HbAction *okAction; HbAction *cancelAction; + HbLabel *title; int queryType; + int lMinLength; + int lMaxLength; + int queryDual; + int lEmergencySupported; + int isEmergency; }; #endif // SECUINOTIFICATIONDIALOG_H diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/secuinotifications/secuinotificationdialogplugin/inc/secuinotificationdialogpluginkeys.h --- a/securitydialogs/secuinotifications/secuinotificationdialogplugin/inc/secuinotificationdialogpluginkeys.h Fri Apr 16 15:53:24 2010 +0300 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/inc/secuinotificationdialogpluginkeys.h Mon May 03 13:20:16 2010 +0300 @@ -28,17 +28,23 @@ const QString KDialogTitle = "title"; const QString KApplicationName = "application"; const QString KQueryType = "type"; +const QString KQueryMinLength = "MinLength"; +const QString KQueryMaxLength = "MaxLength"; const QString KApplicationIcon = "icon"; const QString KSupplier = "supplier"; const QString KMemorySelection = "memory"; const QString KCertificates = "certificates"; const QString KDrmDetails = "drmDetails"; const QString KCodeTop = "codeTop"; +const QString KCodeBottom = "codeBottom"; // not really needed because is never sent back +const QString KEmergency = "emergency"; +const QString KInvalidNewLockCode = "invalidNewLockCode"; // Keys for the return values passed back to calling application -const QString KResultAccepted = "accepted"; // bool +const QString KResultAccepted = "accepted"; // int const QString KSelectedMemoryIndex = "memory"; // int const QString KCodeTopIndex = "codeTop"; // int +const QString KCodeBottomIndex = "codeBottom"; // int // not really needed because is never sent back // Error values const int KNoError = 0; diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/secuinotifications/secuinotificationdialogplugin/secuinotificationdialogplugin.pro --- a/securitydialogs/secuinotifications/secuinotificationdialogplugin/secuinotificationdialogplugin.pro Fri Apr 16 15:53:24 2010 +0300 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/secuinotificationdialogplugin.pro Mon May 03 13:20:16 2010 +0300 @@ -38,7 +38,8 @@ symbian: { TARGET.EPOCALLOWDLLDATA = 1 - TARGET.CAPABILITY = CAP_GENERAL_DLL + # NetworkControl NetworkServices needed for emergency calls + TARGET.CAPABILITY = CAP_GENERAL_DLL NetworkControl NetworkServices TARGET.UID3 = 0x2102432C # TODO: allocate UID pluginstub.sources = secuinotificationdialogplugin.dll @@ -51,6 +52,7 @@ "rom/secuinotificationdialogplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(secuinotificationdialogplugin.iby)" LIBS += -lxqservice +LIBS += -lphoneclient tests { test.depends = sub-src diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationcontentwidget.cpp --- a/securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationcontentwidget.cpp Fri Apr 16 15:53:24 2010 +0300 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationcontentwidget.cpp Mon May 03 13:20:16 2010 +0300 @@ -19,13 +19,36 @@ #include "secuinotificationcontentwidget.h" #include "secuinotificationdialogpluginkeys.h" #include +#include #include #include +#include #include #include #include #include +#include + +#define ESecUiCancelSupported 0x1000000 +#define ESecUiCancelNotSupported 0x0000000 + +#define ESecUiEmergencySupported 0x2000000 +#define ESecUiEmergencyNotSupported 0x0000000 + +#define ESecUiAlphaSupported 0x4000000 +#define ESecUiAlphaNotSupported 0x0000000 + +#define ESecUiMaskFlags 0xFF000000 +#define ESecUiMaskType 0x00FFFFFF + +#define ESecUiTypeDeviceLock 0x00100000 +#define ESecUiTypeKeyguard 0x00200000 +#define ESecUiTypeClock 0x00300000 +#define ESecUiTypeScreensaver 0x00400000 + +#define ESecUiTypeMaskLock 0x00F00000 + // ---------------------------------------------------------------------------- // SecUiNotificationContentWidget::SecUiNotificationContentWidget() @@ -51,50 +74,149 @@ // void SecUiNotificationContentWidget::constructFromParameters(const QVariantMap ¶meters) { - qDebug() << "SecUiNotificationContentWidget::constructFromParameters"; + qDebug() << "SecUiNotificationContentWidget::constructFromParameters 1"; qDebug() << parameters; QGraphicsLinearLayout *mainLayout = new QGraphicsLinearLayout(Qt::Vertical); - // TODO: add another layout for icon + text_block, and yet other for text_block - - // KApplicationIcon - if (1==0 && parameters.contains(KApplicationIcon)) { - qDebug() << "SecUiNotificationContentWidget::KApplicationIcon"; - QString iconName = parameters.value(KApplicationIcon).toString(); - HbLabel *iconLabel = new HbLabel; - iconLabel->setIcon(HbIcon(iconName)); - mainLayout->addItem(iconLabel); - } - - // KApplicationName + KApplicationVersion - if (1==0 && parameters.contains(KApplicationName)) { - qDebug() << "SecUiNotificationContentWidget::KApplicationName"; - QString appName = ""; - QString nameStr = parameters.value(KApplicationName).toString(); - appName = nameStr; - HbLabel *appLabel = new HbLabel(appName); - mainLayout->addItem(appLabel); - } + lMinLength = 4; // might be replaced later + lMaxLength = 8; // might be replaced later + queryDual=0; + isEmergency=0; // KApplicationSize if (parameters.contains(KQueryType)) { qDebug() << "SecUiNotificationContentWidget::KQueryType"; queryType = parameters.value(KQueryType).toUInt(); qDebug() << queryType; + if( (queryType & ESecUiTypeMaskLock) ) + { + qDebug() << "SecUiNotificationContentWidget::KQueryType=ESecUiTypeLock"; + // showing "Lock" icon. All other params are irrelevant. codeTop is not even created + + + HbLabel *iconLabel = new HbLabel("Locked"); + HbIcon *icon = new HbIcon("qtg_large_device_lock"); + // iconLabel->setAspectRatioMode(Qt::IgnoreAspectRatio); + // iconLabel->setGeometry(QRectF(QPointF(10,10),QSizeF(300,300))); + iconLabel->setIcon(*icon); + if( (queryType & ESecUiTypeMaskLock)==ESecUiTypeDeviceLock ) + { // really big icon for the devicelock + iconLabel->setPreferredHeight(500); + iconLabel->setPreferredWidth(500); + } + else if( (queryType & ESecUiTypeMaskLock)==ESecUiTypeKeyguard ) + { // smaller icon for the keyguard + iconLabel->setPreferredHeight(100); + iconLabel->setPreferredWidth(100); + } + + // icon->setWidth(300); + // icon->setHeight(350); + // icon->setGeometry(QRectF(QPointF(10,10),QSizeF(500,300))); + // icon->setSize(QSizeF(300,300)); + + mainLayout->addItem(iconLabel); + mainLayout->setAlignment(iconLabel, Qt::AlignCenter ); + // mainLayout->setGeometry(QRectF(QPointF(10,10),QSizeF(300,300))); + + /* + QToolButton* mLabelIcon = new QToolButton; + mLabelIcon->setIcon(QIcon(":/AutolockSrv_hbicon/qtg_large_device_lock.svg")); + mLabelIcon->setIconSize(QSize(300,300)); + HbLabel *iconLabel = new HbLabel("Locked"); + iconLabel->setIcon(*mLabelIcon); + mainLayout->addItem(iconLabel); + */ + + // mainLayout->setContentsMargins(10,10,300,500); // this makes the dialog really big + setLayout(mainLayout); // same as at the end + return; + } + // not ESecUiTypeMaskLock + lEmergencySupported = ESecUiEmergencyNotSupported; + if((queryType & ESecUiEmergencySupported)==ESecUiEmergencySupported) + { + lEmergencySupported = ESecUiEmergencySupported; + } + qDebug() << "SecUiNotificationContentWidget::lEmergencySupported =" << lEmergencySupported; } + if (parameters.contains(KQueryMinLength)) { + qDebug() << "SecUiNotificationContentWidget::KQueryMinLength"; + lMinLength = parameters.value(KQueryMinLength).toUInt(); + qDebug() << lMinLength; + } + if (parameters.contains(KQueryMaxLength)) { + qDebug() << "SecUiNotificationContentWidget::KQueryMaxLength"; + lMaxLength = parameters.value(KQueryMaxLength).toUInt(); + qDebug() << lMaxLength; + } + + if (parameters.contains(KEmergency)) { + qDebug() << "SecUiNotificationContentWidget::KEmergency"; + QString emergencyText = parameters.value(KEmergency).toString(); + qDebug() << emergencyText; + if(!emergencyText.compare("emergencyYes")) + { + qDebug() << "SecUiNotificationContentWidget::KEmergency emergencyYes"; + isEmergency = 1; + } + if(!emergencyText.compare("emergencyNo")) + { + qDebug() << "SecUiNotificationContentWidget::KEmergency emergencyNo"; + isEmergency = 0; + } + } + + // KCodeTop if (parameters.contains(KCodeTop)) { qDebug() << "SecUiNotificationContentWidget::KCodeTop 1"; codeTop = new HbLineEdit(""); // no default value + qDebug() << "SecUiNotificationContentWidget::KCodeTop lMaxLength="; + qDebug() << lMaxLength; + if(lMaxLength>2) + codeTop->setMaxLength(lMaxLength); // HbLineEdit *codeTop2 = new HbLineEdit; qDebug() << "SecUiNotificationContentWidget::KCodeTop 2"; - HbEditorInterface editorInterface(codeTop); - editorInterface.setUpAsPhoneNumberEditor(); + qDebug() << "SecUiNotificationContentWidget::KCodeTop queryType="; + qDebug() << queryType; + codeTop->setInputMethodHints(Qt::ImhDigitsOnly); // default + if (queryType & ESecUiAlphaSupported) + { + qDebug() << "SecUiNotificationContentWidget::KCodeTop setUpAsLatinAlphabetOnlyEditor"; + codeTop->setInputMethodHints(Qt::ImhNone); + // what about this: editorInterface.setEditorClass(HbInputEditorClassPassword); + } qDebug() << "SecUiNotificationContentWidget::KCodeTop 3"; connect(codeTop, SIGNAL(textChanged(const QString &)), this, SIGNAL(codeTopChanged(const QString &))); + connect(codeTop, SIGNAL(contentsChanged(const QString &)), this, SIGNAL(codeTopChanged(const QString &))); mainLayout->addItem(codeTop); - // mainLayout->addItem(codeTop2); + if (parameters.contains(KCodeBottom)) + { + queryDual=1; + QString titleText = parameters.value(KDialogTitle).toString(); + if(titleText.indexOf('|')>0) + { // if no separator, don't create label + QString titleBottomStr = titleText.right(titleText.length()-titleText.indexOf('|')-1); + HbLabel *titleBottom = new HbLabel(titleBottomStr); + mainLayout->addItem(titleBottom); + } + + codeBottom = new HbLineEdit(""); // no default value + if(lMaxLength>2) + codeBottom->setMaxLength(lMaxLength); + codeBottom->setInputMethodHints(Qt::ImhDigitsOnly); // default + if (queryType & ESecUiAlphaSupported) + { + qDebug() << "SecUiNotificationContentWidget::KCodeBottom setUpAsLatinAlphabetOnlyEditor"; + codeTop->setInputMethodHints(Qt::ImhNone); + } + qDebug() << "SecUiNotificationContentWidget::KCodeBottom 3"; + connect(codeBottom, SIGNAL(textChanged(const QString &)), this, SIGNAL(codeBottomChanged(const QString &))); + connect(codeBottom, SIGNAL(contentsChanged(const QString &)), this, SIGNAL(codeBottomChanged(const QString &))); + mainLayout->addItem(codeBottom); + } QGraphicsLinearLayout *mainLayoutButtons = new QGraphicsLinearLayout(Qt::Horizontal); HbPushButton *but1 = new HbPushButton("1234"); @@ -113,9 +235,6 @@ } - // KCertificates - // KDrmDetails - setLayout(mainLayout); } diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationdialog.cpp --- a/securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationdialog.cpp Fri Apr 16 15:53:24 2010 +0300 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationdialog.cpp Mon May 03 13:20:16 2010 +0300 @@ -22,6 +22,11 @@ #include #include #include +#include +#include +#include // for TARM error codes while validating new lock code +#include +#include #define ESecUiCancelSupported 0x1000000 #define ESecUiCancelNotSupported 0x0000000 @@ -29,6 +34,19 @@ #define ESecUiEmergencySupported 0x2000000 #define ESecUiEmergencyNotSupported 0x0000000 +#define ESecUiAlphaSupported 0x4000000 +#define ESecUiAlphaNotSupported 0x0000000 + +#define ESecUiMaskFlags 0xFF000000 +#define ESecUiMaskType 0x00FFFFFF + +#define ESecUiTypeDeviceLock 0x00100000 +#define ESecUiTypeKeyguard 0x00200000 +#define ESecUiTypeClock 0x00300000 +#define ESecUiTypeScreensaver 0x00400000 + +#define ESecUiTypeMaskLock 0x00F00000 + // ---------------------------------------------------------------------------- // SecUiNotificationDialog::SecUiNotificationDialog() // ---------------------------------------------------------------------------- @@ -131,32 +149,198 @@ // Title if (parameters.contains(KDialogTitle)) { QString titleText = parameters.value(KDialogTitle).toString(); - HbLabel *title = new HbLabel(titleText); + QString titleAttempts = ""; + if(titleText.indexOf('|')>0) + { // if separator, take only first part + titleText = titleText.left(titleText.indexOf('|')); + } + if(titleText.indexOf('#')>0) + { // if separator, take only first part + titleAttempts = titleText.right(titleText.length()-titleText.indexOf('#')-1); + qDebug() << "SecUiNotificationDialog::titleAttempts=" << titleAttempts; + int nAttempts = titleAttempts.toInt(); + qDebug() << "SecUiNotificationDialog::nAttempts=" << nAttempts; + titleText = titleText.left(titleText.indexOf('#')); + if(nAttempts>0) + titleText = titleText + " attempts=" + QString::number(nAttempts); + } + title = new HbLabel(titleText); setHeadingWidget(title); } + if (parameters.contains(KEmergency)) { + qDebug() << "SecUiNotificationDialog::KEmergency"; + QString emergencyText = parameters.value(KEmergency).toString(); + qDebug() << emergencyText; + if(!emergencyText.compare("emergencyYes")) + { + qDebug() << "SecUiNotificationDialog::KEmergency emergencyYes"; + isEmergency = 1; + okAction->setEnabled(true); + okAction->setText("Call"); + return true; + } + if(!emergencyText.compare("emergencyNo")) + { + qDebug() << "SecUiNotificationDialog::KEmergency emergencyNo"; + isEmergency = 0; + okAction->setEnabled(false); // 112 -> 1122 (=password) . This is handled by < lMinLength + okAction->setText("Ok"); + return true; + } + } + + if (parameters.contains(KInvalidNewLockCode)) { + qDebug() << "SecUiNotificationDialog::KInvalidNewLockCode"; + QString invalidText = parameters.value(KInvalidNewLockCode).toString(); + qDebug() << invalidText; + + title->setPlainText("Lock Code"); // TODO take from the original one + QString invalidStr = invalidText.right(invalidText.length()-invalidText.indexOf('#')-1); + int invalidNumber = invalidStr.toInt(); + qDebug() << "SecUiNotificationDialog::KInvalidNewLockCode invalidNumber" << invalidNumber; + if(invalidNumber<0) + { + qDebug() << "SecUiNotificationDialog::KInvalidNewLockCode ???"; + // nothing to do + } +/* + if(invalidNumber==EDeviceLockAutolockperiod) + { + qDebug() << "SecUiNotificationDialog::KInvalidNewLockCode EDeviceLockAutolockperiod"; + title->setPlainText("EDeviceLockAutolockperiod"); + } + if(invalidNumber==EDeviceLockMaxAutolockPeriod) + { + qDebug() << "SecUiNotificationDialog::KInvalidNewLockCode EDeviceLockMaxAutolockPeriod"; + title->setPlainText("EDeviceLockMaxAutolockPeriod"); + } + if(invalidNumber==EDeviceLockMinlength) + { + qDebug() << "SecUiNotificationDialog::KInvalidNewLockCode EDeviceLockMinlength"; + title->setPlainText("EDeviceLockMinlength"); + } + if(invalidNumber==EDeviceLockMaxlength) + { + qDebug() << "SecUiNotificationDialog::KInvalidNewLockCode EDeviceLockMaxlength"; + title->setPlainText("EDeviceLockMaxlength"); + } + if(invalidNumber==EDeviceLockRequireUpperAndLower) + { + qDebug() << "SecUiNotificationDialog::KInvalidNewLockCode EDeviceLockRequireUpperAndLower"; + title->setPlainText("EDeviceLockRequireUpperAndLower"); + } + if(invalidNumber==EDeviceLockRequireCharsAndNumbers) + { + qDebug() << "SecUiNotificationDialog::KInvalidNewLockCode EDeviceLockRequireCharsAndNumbers"; + title->setPlainText("EDeviceLockMaxlength"); + } + if(invalidNumber==EDeviceLockAllowedMaxRepeatedChars) + { + qDebug() << "SecUiNotificationDialog::KInvalidNewLockCode EDeviceLockAllowedMaxRepeatedChars"; + title->setPlainText("EDeviceLockAllowedMaxRepeatedChars"); + } + if(invalidNumber==EDeviceLockHistoryBuffer) + { + qDebug() << "SecUiNotificationDialog::KInvalidNewLockCode EDeviceLockHistoryBuffer"; + title->setPlainText("EDeviceLockHistoryBuffer"); + } + if(invalidNumber==EDeviceLockPasscodeExpiration) + { + qDebug() << "SecUiNotificationDialog::KInvalidNewLockCode EDeviceLockPasscodeExpiration"; + title->setPlainText("EDeviceLockPasscodeExpiration"); + } + if(invalidNumber==EDeviceLockMinChangeTolerance) + { + qDebug() << "SecUiNotificationDialog::KInvalidNewLockCode EDeviceLockMinChangeTolerance"; + title->setPlainText("EDeviceLockMinChangeTolerance"); + } + if(invalidNumber==EDeviceLockMinChangeInterval) + { + qDebug() << "SecUiNotificationDialog::KInvalidNewLockCode EDeviceLockMinChangeInterval"; + title->setPlainText("EDeviceLockMinChangeInterval"); + } + if(invalidNumber==EDeviceLockDisallowSpecificStrings) + { + qDebug() << "SecUiNotificationDialog::KInvalidNewLockCode EDeviceLockDisallowSpecificStrings"; + title->setPlainText("EDeviceLockDisallowSpecificStrings"); + } + if(invalidNumber==EDeviceLockAllowedMaxAtempts) + { + qDebug() << "SecUiNotificationDialog::KInvalidNewLockCode EDeviceLockAllowedMaxAtempts"; + title->setPlainText("EDeviceLockAllowedMaxAtempts"); + } + if(invalidNumber==EDeviceLockConsecutiveNumbers) + { + qDebug() << "SecUiNotificationDialog::KInvalidNewLockCode EDeviceLockConsecutiveNumbers"; + title->setPlainText("EDeviceLockConsecutiveNumbers"); + } + if(invalidNumber==EDeviceLockMinSpecialCharacters) + { + qDebug() << "SecUiNotificationDialog::KInvalidNewLockCode EDeviceLockMinSpecialCharacters"; + title->setPlainText("EDeviceLockMinSpecialCharacters"); + } + if(invalidNumber==EDeviceLockSingleCharRepeatNotAllowed) + { + qDebug() << "SecUiNotificationDialog::KInvalidNewLockCode EDeviceLockSingleCharRepeatNotAllowed"; + title->setPlainText("EDeviceLockSingleCharRepeatNotAllowed"); + } + if(invalidNumber==EDevicelockConsecutiveCharsNotAllowed) + { + qDebug() << "SecUiNotificationDialog::KInvalidNewLockCode EDevicelockConsecutiveCharsNotAllowed"; + title->setPlainText("EDevicelockConsecutiveCharsNotAllowed"); + } + if(invalidNumber>=EDevicelockTotalPolicies) + { + qDebug() << "SecUiNotificationDialog::KInvalidNewLockCode EDevicelockTotalPolicies"; + title->setPlainText("EDevicelockTotalPolicies"); + } + */ + // always keep OK valid. + return true; + } + // Content SecUiNotificationContentWidget *content = new SecUiNotificationContentWidget(); content->constructFromParameters(parameters); setContentWidget(content); + + queryType = content->queryType; + queryDual = content->queryDual; + isEmergency = content->isEmergency; + codeTop = content->codeTop; + codeBottom = content->codeBottom; + lMinLength = content->lMinLength; + lMaxLength = content->lMaxLength; + lEmergencySupported = content->lEmergencySupported; + connect(content, SIGNAL(codeTopChanged(const QString &)), this, SLOT(handleCodeTopChanged(const QString &))); + connect(content, SIGNAL(codeBottomChanged(const QString &)), this, SLOT(handleCodeBottomChanged(const QString &))); connect(content, SIGNAL(but1Changed()), this, SLOT(handlebut1Changed())); connect(content, SIGNAL(but2Changed()), this, SLOT(handlebut2Changed())); connect(content, SIGNAL(but3Changed()), this, SLOT(handlebut3Changed())); - codeTop = content->codeTop; - queryType = content->queryType; qDebug() << "SecUiNotificationDialog::queryType="; qDebug() << queryType; // Buttons - okAction = new HbAction(tr("Ok")); // qtTrId("txt_common_button_ok") + if( (queryType & ESecUiTypeMaskLock)) + { + // no need to create OK or Cancel + return true; + } + + okAction = new HbAction(tr("Ok")); + okAction->setEnabled(false); // initially the OK is disabled because codeTop is empty + // setAction(okAction, QDialogButtonBox::AcceptRole); // it's supposed to use this, when deprecated setPrimaryAction(okAction); connect(okAction, SIGNAL(triggered()), this, SLOT(handleAccepted())); + cancelAction = new HbAction(tr("Cancel")); // qtTrId("txt_common_button_cancel") connect(cancelAction, SIGNAL(triggered()), this, SLOT(handleCancelled())); + // setAction(cancelAction, QDialogButtonBox::RejectRole); // it's supposed to use this, when deprecated setSecondaryAction(cancelAction); qDebug() << "SecUiNotificationDialog check Cancel"; - if (queryType & ESecUiCancelSupported) + if ((queryType & ESecUiCancelSupported)==ESecUiCancelSupported) { // nothing to do. Cancel is enabled by default } @@ -173,7 +357,7 @@ // SecUiNotificationDialog::sendResult() // ---------------------------------------------------------------------------- // -void SecUiNotificationDialog::sendResult(bool accepted) +void SecUiNotificationDialog::sendResult(int accepted) { qDebug() << "SecUiNotificationDialog::sendResult 1.2"; QVariant acceptedValue(accepted); @@ -193,15 +377,19 @@ { qDebug() << "SecUiNotificationDialog::handleAccepted"; // okAction - QString codeTopText = codeTop->text(); - qDebug() << "codeTopText"; - qDebug() << codeTopText; - if(!codeTopText.compare("1234111")) - { - qDebug() << "codeTopText is 1234111. Not exit"; - return; - } - sendResult(true); + QString codeTopText; + + if( (queryType & ESecUiTypeMaskLock)) + { + codeTopText = "Unlock-Request"; + } + else + { + codeTopText = codeTop->text(); + } + // TODO check last time for codeBottom + qDebug() << "codeTopText=" << codeTopText; + sendResult(KErrNone); } // ---------------------------------------------------------------------------- @@ -211,7 +399,7 @@ void SecUiNotificationDialog::handleCancelled() { qDebug() << "SecUiNotificationDialog::handleCancelled"; - sendResult(false); + sendResult(KErrCancel); } // ---------------------------------------------------------------------------- @@ -235,11 +423,73 @@ void SecUiNotificationDialog::handleCodeTopChanged(const QString &text) { qDebug() << "SecUiNotificationDialog::handleCodeTopChanged"; - qDebug() << "SecUiNotificationDialog::handleCodeTopChanged" << text ; + qDebug() << "SecUiNotificationDialog::handleCodeTopChanged=" << text ; + if(queryDual) + { + codeBottom->setText(""); // any change resets the verification. + } + if( queryType == 0x1000004 ) + { // ChangeSecCodeParamsL change RMobilePhone::ESecurityCodePhonePassword + QVariant codeTop(text); + mResultMap.insert(KCodeTopIndex, codeTop); + sendResult(KErrCompletion); // send the current password back to the client for further TARM validation + } + if(text.length() < lMinLength ) + { + qDebug() << "SecUiNotificationDialog::handleCodeTopChanged too short:" << text ; + okAction->setEnabled(false); + + if( lEmergencySupported && text.length() > 2 ) // emergency numbers need at least 3 digits + { // check whether it's a emergency number + QVariant codeTop(text); + mResultMap.insert(KCodeTopIndex, codeTop); + sendResult(KErrAbort); // send the current password back to the client. Perhaps it's an emergency number and decides to Ok->Call + } + } + else if (text.length() >= lMinLength) + { + // TODO might use a flag to avoid re-setting + qDebug() << "SecUiNotificationDialog::handleCodeTopChanged long enough:" << text ; + okAction->setText("Ok"); + if(queryDual==0) // only if Bottom is not used + okAction->setEnabled(true); + } QVariant codeTop(text); mResultMap.insert(KCodeTopIndex, codeTop); } // ---------------------------------------------------------------------------- +// SecUiNotificationDialog::handleCodeBottomChanged() +// ---------------------------------------------------------------------------- +// +void SecUiNotificationDialog::handleCodeBottomChanged(const QString &text) + { + qDebug() << "SecUiNotificationDialog::handleCodeBottomChanged"; + qDebug() << "SecUiNotificationDialog::handleCodeBottomChanged" << text ; + qDebug() << "SecUiNotificationDialog::handleCodeBottomChanged. codeTop=" << codeTop->text() ; + // TODO compare + if(text.length() < lMinLength ) + { + qDebug() << "SecUiNotificationDialog::handleCodeBottomChanged too short:" << text ; + okAction->setEnabled(false); + } + else + { + // TODO might use a flag to avoid re-setting + qDebug() << "SecUiNotificationDialog::handleCodeBottomChanged long enough:" << text ; + if(codeTop->text()==text) + { + qDebug() << "SecUiNotificationDialog::handleCodeBottomChanged codes match:" << text ; + okAction->setEnabled(true); + } + else + { + qDebug() << "SecUiNotificationDialog::handleCodeBottomChanged codes not match:" << text ; + okAction->setEnabled(false); + } + } + // verification is not sent + } +// ---------------------------------------------------------------------------- // SecUiNotificationDialog::handlebut1Changed() // ---------------------------------------------------------------------------- // diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationdialogplugin.cpp --- a/securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationdialogplugin.cpp Fri Apr 16 15:53:24 2010 +0300 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationdialogplugin.cpp Mon May 03 13:20:16 2010 +0300 @@ -90,7 +90,7 @@ Q_UNUSED(deviceDialogType); Q_UNUSED(parameters); - info->group = DeviceNotificationDialogGroup; + info->group = DeviceNotificationDialogGroup; // TODO this should be SecurityGroup , but it's still not available info->flags = NoDeviceDialogFlags; info->priority = DefaultPriority; diff -r 318c4eab2439 -r 8957df7b0072 securitydialogs/securitydialogs.pro --- a/securitydialogs/securitydialogs.pro Fri Apr 16 15:53:24 2010 +0300 +++ b/securitydialogs/securitydialogs.pro Mon May 03 13:20:16 2010 +0300 @@ -17,5 +17,8 @@ TEMPLATE = subdirs SUBDIRS += secuinotifications/secuinotifications.pro -SUBDIRS += lockclient/lockclient.pro +SUBDIRS += lockclient/group/lockclient.pro +SUBDIRS += AutolockSrv/indicatorplugin/indicatorautolockplugin.pro +SUBDIRS += AutolockSrv/autolockuseractivityservice.pro +SUBDIRS += AutolockSrv/AutolockSrv.pro diff -r 318c4eab2439 -r 8957df7b0072 wim/WimServer/src/WimAuthObjHandler.cpp --- a/wim/WimServer/src/WimAuthObjHandler.cpp Fri Apr 16 15:53:24 2010 +0300 +++ b/wim/WimServer/src/WimAuthObjHandler.cpp Mon May 03 13:20:16 2010 +0300 @@ -407,7 +407,6 @@ void CWimAuthObjHandler::VerifyDisabledPINRequestL( const RMessage2& aMessage ) { - __ASSERT_DEBUG( iResponseID == NULL, User::Panic( KWimAuthObjPanic, KErrGeneral ) ); iResponseID = new ( ELeave )CWimResponse( aMessage ); iResponseID->iOpcode = EVerifyDisabledPinReq; @@ -436,11 +435,9 @@ { _WIMTRACE(_L("WIM|WIMServer|CWimAuthObjHandler::VerifyPINRequestL|Begin")); - __ASSERT_DEBUG( iResponseID == NULL, User::Panic( KWimAuthObjPanic, KErrGeneral ) ); iResponseID = new ( ELeave )CWimResponse( aMessage ); iResponseID->iOpcode = EVerifyPinReq; - __ASSERT_DEBUG( iTrId == NULL, User::Panic( KWimAuthObjPanic, KErrGeneral ) ); iTrId = iWimUtilFuncs->TrIdLC( iResponseID, EWimMgmtReq ); CleanupStack::Pop( iTrId ); @@ -568,11 +565,9 @@ { _WIMTRACE(_L("WIM|WIMServer|CWimAuthObjHandler::EnablePINReqL|Begin")); - __ASSERT_DEBUG( iResponseID == NULL, User::Panic( KWimAuthObjPanic, KErrGeneral ) ); iResponseID = new( ELeave )CWimResponse( aMessage ); iResponseID->iOpcode =EEnablePINReq; - __ASSERT_DEBUG( iTrId == NULL, User::Panic( KWimAuthObjPanic, KErrGeneral ) ); iTrId = iWimUtilFuncs->TrIdLC( iResponseID, EWimMgmtReq ); CleanupStack::Pop( iTrId ); @@ -681,11 +676,9 @@ { _WIMTRACE(_L("WIM | WIMServer | CWimAuthObjHandler::ChangePINRequestL | Begin")); - __ASSERT_DEBUG( iResponseID == NULL, User::Panic( KWimAuthObjPanic, KErrGeneral ) ); iResponseID = new ( ELeave ) CWimResponse( aMessage ); iResponseID->iOpcode = EChangePINReq; - __ASSERT_DEBUG( iTrId == NULL, User::Panic( KWimAuthObjPanic, KErrGeneral ) ); iTrId = iWimUtilFuncs->TrIdLC( iResponseID, EWimMgmtReq ); CleanupStack::Pop( iTrId ); @@ -781,11 +774,9 @@ { _WIMTRACE(_L("WIM | WIMServer | CWimAuthObjHandler::UnblockPinReqL | Begin")); - __ASSERT_DEBUG( iResponseID == NULL, User::Panic( KWimAuthObjPanic, KErrGeneral ) ); iResponseID = new ( ELeave ) CWimResponse( aMessage ); iResponseID->iOpcode = EUnblockPinReq; - __ASSERT_DEBUG( iTrId == NULL, User::Panic( KWimAuthObjPanic, KErrGeneral ) ); iTrId = iWimUtilFuncs->TrIdLC( iResponseID, EWimMgmtReq ); CleanupStack::Pop( iTrId ); diff -r 318c4eab2439 -r 8957df7b0072 wim/WimServer/src/WimBTSapObserver.cpp --- a/wim/WimServer/src/WimBTSapObserver.cpp Fri Apr 16 15:53:24 2010 +0300 +++ b/wim/WimServer/src/WimBTSapObserver.cpp Mon May 03 13:20:16 2010 +0300 @@ -175,6 +175,8 @@ WIMI_CloseDownReq(); _WIMTRACE(_L("WIM | CWimSatRefreshObserver::Refresh | WIMI closed.")); } + + sessions.Close(); } else { diff -r 318c4eab2439 -r 8957df7b0072 wim/WimServer/src/WimSession.cpp --- a/wim/WimServer/src/WimSession.cpp Fri Apr 16 15:53:24 2010 +0300 +++ b/wim/WimServer/src/WimSession.cpp Mon May 03 13:20:16 2010 +0300 @@ -629,6 +629,8 @@ { _WIMTRACE(_L("WIM | CWimSession::RefreshWimi: FAILED to get sessions.")); } + + sessions.Close(); } // End of File