# HG changeset patch # User hgs # Date 1278608676 -10800 # Node ID f1030a78d563546adf6df1a1e7adef5981ad8d9f # Parent 3aa774c655acd0ed7aab5d16463661429c896413 201027_01 diff -r 3aa774c655ac -r f1030a78d563 cpsecplugins/cpadvancedsecplugin/src/cpcerttrustview.cpp --- a/cpsecplugins/cpadvancedsecplugin/src/cpcerttrustview.cpp Tue Jun 29 10:29:16 2010 +0300 +++ b/cpsecplugins/cpadvancedsecplugin/src/cpcerttrustview.cpp Thu Jul 08 20:04:36 2010 +0300 @@ -110,6 +110,7 @@ // TCertificateAppInfo's Name() function. // --------------------------------------------------------------------------- // + void CpCertTrustView::updateListBoxL() { RDEBUG("0", 0); @@ -152,21 +153,16 @@ { mClientUids.Append( KCertManUIViewTrustJavaInstallingId ); } - - clientCount = mClientUids.Count(); - - QList itemArray; - for(int i=0;iCertificateFormat() ) { return; } TInt resIndex = KErrNotFound; - if ( mClientUids.Count() > 0 ) + QList itemArray; + QList trustValue; + clientCount = mClientUids.Count(); + if ( clientCount > 0 ) { for ( TInt k = 0; k < clientCount; k++ ) { @@ -180,9 +176,16 @@ TBool trustState = EFalse; QString item = mTrustedClients[ resIndex ]; trustState = checkCertificateClientTrustL( mClientUids[k], *entry ); + // insert the index which would be used to retrieve the value from mTrustedClients + itemArray.insert(k,resIndex); + if ( trustState ) { - itemArray.replace(resIndex,1); + trustValue.insert(k,1); + } + else + { + trustValue.insert(k,0); } } } @@ -198,15 +201,17 @@ certLabel->setText(QString( (QChar*)label.Ptr(),label.Length() ) ); mCertLabelList->addItem(certLabel.get()); certLabel.release(); + RDEBUG("0", 0); - int count = mTrustedClients.size(); + + int count = itemArray.size(); for( int index = 0 ;index < count; ++index) { std::auto_ptr item (q_check_ptr(new HbDataFormModelItem( HbDataFormModelItem::ToggleValueItem, - mTrustedClients[index] ) )); - - if( itemArray[index] == 1) + mTrustedClients[itemArray[index]] ) )); + + if( trustValue[index] == 1) { item->setContentWidgetData("text",mTrustValues[0]); item->setContentWidgetData("additionalText",mTrustValues[1]); @@ -226,6 +231,7 @@ form.release(); } + void CpCertTrustView::saveTrustSettings() { RDEBUG("0", 0); @@ -234,19 +240,25 @@ { TInt itemCount = mFormModel->rowCount(); RArray newUids; - QT_TRAP_THROWING( CleanupClosePushL( newUids )); - - for(int index = 0;indexitem(index); - QString trustValue = item->contentWidgetData("text").toString(); - if(trustValue == "On") + QT_TRAP_THROWING + ( + CleanupClosePushL( newUids ); + + for(int index = 0;indexitem(index); + QString trustValue = item->contentWidgetData("text").toString(); + if(trustValue == "On") + { + newUids.Append(trusterId(mTrustedClients[index])); + } } - } - QT_TRAP_THROWING( mCertDataContainer.iWrapper->SetApplicabilityL( mCertDataContainer.CertManager(), entry, newUids )); - CleanupStack::PopAndDestroy(&newUids); + if(newUids.Count() > 0 ) + { + mCertDataContainer.iWrapper->SetApplicabilityL( mCertDataContainer.CertManager(), entry, newUids ); + } + CleanupStack::PopAndDestroy(&newUids); + ) } } diff -r 3aa774c655ac -r f1030a78d563 remotelock/RemoteLockEngine/Src/RemoteLock.cpp --- a/remotelock/RemoteLockEngine/Src/RemoteLock.cpp Tue Jun 29 10:29:16 2010 +0300 +++ b/remotelock/RemoteLockEngine/Src/RemoteLock.cpp Thu Jul 08 20:04:36 2010 +0300 @@ -33,6 +33,7 @@ #include #endif //RD_MULTIPLE_DRIVE #include +#include #include #include #include @@ -625,7 +626,7 @@ if ( !iProfileSession ) { RL_TRACE_PRINT(" [ rl.exe ] CheckSettingsL() create session "); - iProfileSession = CRepository::NewL( KCRUidProfileEngine ); + iProfileSession = CRepository::NewL( KCRUidCoreApplicationUIs ); // previously it was KCRUidProfileEngine } if ( !iObserver ) { @@ -655,7 +656,7 @@ if ( !iProfileSession ) { RL_TRACE_PRINT(" [ rl.exe ] CheckSettingsL() create session "); - iProfileSession = CRepository::NewL( KCRUidProfileEngine ); + iProfileSession = CRepository::NewL( KCRUidCoreApplicationUIs ); // previously it was KCRUidProfileEngine } ProfileNotifyL( EFalse ); delete iProfileSession; @@ -1458,7 +1459,10 @@ if ( aNotifyEnable ) { - TInt err = iProfileSession->Get( KProEngActiveProfile, iCurrentProfile ); + TInt err = iProfileSession->Get( KCoreAppUIsNetworkConnectionAllowed , iCurrentProfile ); // previously was KProEngActiveProfile + RL_TRACE_PRINT_NUM("[rl.exe] HandleNotifyGeneric() err = %d", err ); + RL_TRACE_PRINT_NUM("[rl.exe] HandleNotifyGeneric() iCurrentProfile = %d", iCurrentProfile ); + User::LeaveIfError( err ); RL_TRACE_PRINT(" [ rl.exe ] ProfileNotifyL() startlisten"); iProfileNotifyHandler->StartListeningL(); @@ -1486,7 +1490,9 @@ { RL_TRACE_PRINT(" [ rl.exe ] GetProfile() "); TInt err; - err = iProfileSession->Get( KProEngActiveProfile, aProfile ); + err = iProfileSession->Get( KCoreAppUIsNetworkConnectionAllowed , aProfile ); // previously was KProEngActiveProfile + RL_TRACE_PRINT_NUM("[rl.exe] HandleNotifyGeneric() err = %d", err ); + RL_TRACE_PRINT(" [ rl.exe ] exit GetProfile() "); return ( err == KErrNone ); } @@ -1505,8 +1511,9 @@ TInt profile = 0; GetProfile( profile ); - - if ( ( profile == EProfileOffLineId ) && ( iIsEnabled ) && ( iCurrentProfile != EProfileOffLineId )) + RL_TRACE_PRINT_NUM("[rl.exe] HandleNotifyGeneric() profile = %d", profile ); + RL_TRACE_PRINT_NUM("[rl.exe] HandleNotifyGeneric() iCurrentProfile = %d", iCurrentProfile ); + if ( ( profile == ECoreAppUIsNetworkConnectionNotAllowed ) && ( iIsEnabled ) && ( iCurrentProfile != ECoreAppUIsNetworkConnectionNotAllowed )) { ActivateDeviceLock(); } diff -r 3aa774c655ac -r f1030a78d563 secsrv_plat/security_code_ui_api/inc/SecUi.h --- a/secsrv_plat/security_code_ui_api/inc/SecUi.h Tue Jun 29 10:29:16 2010 +0300 +++ b/secsrv_plat/security_code_ui_api/inc/SecUi.h Thu Jul 08 20:04:36 2010 +0300 @@ -21,10 +21,12 @@ #ifndef __SECUI_H #define __SECUI_H -#if defined(__SECUI_H) +#if defined(_DEBUG) #define RDEBUG( x, y ) RDebug::Printf( "%s %s (%u) %s=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, x, y ); +#define RDEBUGSTR( x ) RDebug::Print( x ); #else #define RDEBUG( x, y ) +#define RDEBUGSTR( x ) #endif class TSecUi diff -r 3aa774c655ac -r f1030a78d563 securitydialogs/Autolock/Autolock.pro --- a/securitydialogs/Autolock/Autolock.pro Tue Jun 29 10:29:16 2010 +0300 +++ b/securitydialogs/Autolock/Autolock.pro Thu Jul 08 20:04:36 2010 +0300 @@ -35,6 +35,7 @@ LIBS += -L../../../../../bin/release -lautolockuseractivityservice LIBS += -lsecui -letelmm -letel -lcustomapi -lcentralrepository LIBS += -lcone -lws32 -lkeylockpolicyapi +LIBS += -lpower_save_display_mode SERVICE.FILE = service_conf.xml SERVICE.OPTIONS = embeddable diff -r 3aa774c655ac -r f1030a78d563 securitydialogs/Autolock/autolock.qcrml --- a/securitydialogs/Autolock/autolock.qcrml Tue Jun 29 10:29:16 2010 +0300 +++ b/securitydialogs/Autolock/autolock.qcrml Thu Jul 08 20:04:36 2010 +0300 @@ -12,6 +12,9 @@ + + + @@ -24,3 +27,6 @@ + + + diff -r 3aa774c655ac -r f1030a78d563 securitydialogs/SecUi/Src/SecQueryUi.cpp --- a/securitydialogs/SecUi/Src/SecQueryUi.cpp Tue Jun 29 10:29:16 2010 +0300 +++ b/securitydialogs/SecUi/Src/SecQueryUi.cpp Thu Jul 08 20:04:36 2010 +0300 @@ -93,7 +93,7 @@ TDes& aDataText, TInt aMinLength, TInt aMaxLength, TInt aMode) { RDEBUG("aCaption", 0); - RDebug::Print(aCaption); + RDEBUGSTR(aCaption); RDEBUG("aMode", aMode); TInt secUiOriginatedQuery(ESecurityUIsSecUIOriginatedUninitialized); TInt err = RProperty::Get(KPSUidSecurityUIs, @@ -170,7 +170,7 @@ RDEBUG("error", error); User::LeaveIfError(error); RDEBUG("iPassword", 0); - RDebug::Print(iPassword); + RDEBUGSTR(iPassword); aDataText.Copy(iPassword); err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, @@ -355,13 +355,13 @@ { TPtrC acceptedValueTop = *acceptedVariantTop->Value (); RDEBUG("acceptedValueTop", 0); - RDebug::Print(acceptedValueTop); + RDEBUGSTR(acceptedValueTop); iPassword.Copy(acceptedValueTop); if (iReturnValue == KErrCompletion) // the user didn't OK. It was send automatically because validating new lock code through TARM { _LIT(KInvalidNewLockCode, "invalidNewLockCode"); - _LIT(KInvalidNewLockCode0, "invalidNewLockCode#0"); + _LIT(KInvalidNewLockCode0, "invalidNewLockCode$-1"); AddParamL(KInvalidNewLockCode, KInvalidNewLockCode0); // for starter RSCPClient scpClient; TSCPSecCode newCode; @@ -372,18 +372,20 @@ RArray aFailedPolicies; TDevicelockPolicies failedPolicy; TInt retLockcode = KErrNone; + TInt nPoliciesFailed = 0; 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 ); - } + nPoliciesFailed = aFailedPolicies.Count(); + RDEBUG( "nPoliciesFailed", nPoliciesFailed ); + for(TInt i=0; i KInvalidNewLockCodeX; KInvalidNewLockCodeX.Zero(); KInvalidNewLockCodeX.Append(_L("invalidNewLockCode")); KInvalidNewLockCodeX.Append(_L("$")); + KInvalidNewLockCodeX.AppendNum(failedPolicy); + AddParamL( KInvalidNewLockCode, KInvalidNewLockCodeX ); // it overwrites the previous one + } // TODO this should be able to modify MinLenght, MaxLenght scpClient.Close(); } diff -r 3aa774c655ac -r f1030a78d563 securitydialogs/SecUi/Src/SecUiSecurityHandler.cpp --- a/securitydialogs/SecUi/Src/SecUiSecurityHandler.cpp Tue Jun 29 10:29:16 2010 +0300 +++ b/securitydialogs/SecUi/Src/SecUiSecurityHandler.cpp Thu Jul 08 20:04:36 2010 +0300 @@ -1,20 +1,20 @@ /* -* Copyright (c) 2002 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: Provides api for handling security events. -* -* -*/ + * Copyright (c) 2002 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: Provides api for handling security events. + * + * + */ #include #include #include @@ -24,10 +24,8 @@ #ifdef __COVER_DISPLAY #include -// #include #endif //__COVER_DISPLAY #include -#include //used for RemoveSplashScreen #include #include // Property values @@ -50,6 +48,7 @@ #include #include #include +#include #include "SecQueryUi.h" @@ -75,7 +74,14 @@ RDEBUG("0", 0); TInt result = iCustomPhone.Open(aPhone); + RDEBUG("result", result); TRAP_IGNORE(FeatureManager::InitializeLibL()); //Shouldn't this panic if FM does not initialise?? + + _LIT(KFileName, "secui_"); + _LIT(KPath, "z:/resource/qt/translations/"); + RDEBUG("HbTextResolverSymbian", 0); + result = HbTextResolverSymbian::Init(KFileName, KPath); + RDEBUG("result", result); } // @@ -98,7 +104,7 @@ RDEBUG("err", err); iCustomPhone.Close(); FeatureManager::UnInitializeLib(); - RDEBUG("1", 1); + RDEBUG("1", 1); } // // ---------------------------------------------------------- @@ -106,8 +112,7 @@ // Handles different security events // ---------------------------------------------------------- // qtdone -EXPORT_C void CSecurityHandler::HandleEventL( - RMobilePhone::TMobilePhoneSecurityEvent aEvent) +EXPORT_C void CSecurityHandler::HandleEventL(RMobilePhone::TMobilePhoneSecurityEvent aEvent) { RDEBUG("0", 0); @@ -121,9 +126,7 @@ // Handles different security events // ---------------------------------------------------------- // qtdone -EXPORT_C void CSecurityHandler::HandleEventL( - RMobilePhone::TMobilePhoneSecurityEvent aEvent, TBool aStartup, - TInt& aResult) +EXPORT_C void CSecurityHandler::HandleEventL(RMobilePhone::TMobilePhoneSecurityEvent aEvent, TBool aStartup, TInt& aResult) { RDEBUG("0", 0); @@ -137,8 +140,7 @@ // Handles different security events // ---------------------------------------------------------- // qtdone -EXPORT_C void CSecurityHandler::HandleEventL( - RMobilePhone::TMobilePhoneSecurityEvent aEvent, TInt& aResult) +EXPORT_C void CSecurityHandler::HandleEventL(RMobilePhone::TMobilePhoneSecurityEvent aEvent, TInt& aResult) { RDEBUG("0", 0); @@ -146,19 +148,20 @@ * Series 60 Customer / ETel * Series 60 ETel API *****************************************************/ - TBool wcdmaSupported( - FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma)); - TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin)); + TBool wcdmaSupported(FeatureManager::FeatureSupported(KFeatureIdProtocolWcdma)); + TBool upinSupported(FeatureManager::FeatureSupported(KFeatureIdUpin)); RDEBUG("aEvent", aEvent); switch (aEvent) { case RMobilePhone::EPin1Required: - RDEBUG("RMobilePhone::EPin1Required", 0); + RDEBUG("RMobilePhone::EPin1Required", 0) + ; aResult = Pin1RequiredL(); break; case RMobilePhone::EPuk1Required: - RDEBUG("RMobilePhone::EPuk1Required", 0); + RDEBUG("RMobilePhone::EPuk1Required", 0) + ; Puk1RequiredL(); break; case RMobilePhone::EPin2Required: @@ -190,7 +193,8 @@ SimLockEventL(); break; default: - RDEBUG("default", aEvent); + RDEBUG("default", aEvent) + ; break; } RDEBUG("aResult", aResult); @@ -207,9 +211,8 @@ * Series 60 Customer / ETel * Series 60 ETel API *****************************************************/ - RDEBUG("0", 0); - - /* if code is still not initialized, then there's no need to ask it. This fixes the error when the RFS requests the code */ + RDEBUG("0", 0); + // if code is still not initialized, then there's no need to ask it. This fixes the error when the RFS requests the code. const TUid KCRUidSCPLockCode = { 0x2002677B @@ -221,24 +224,27 @@ TInt res = -1; TInt lAlphaSupported = 0; TInt lCancelSupported = 0; + RMobilePhone::TMobilePassword iSecUi_password; - res = repository->Get(KSCPLockCodeDefaultLockCode, currentLockStatus); + res = repository->Get(KSCPLockCodeDefaultLockCode, currentLockStatus); // 0x3039 = 12345 RDEBUG("res", res); RDEBUG("currentLockStatus", currentLockStatus); delete repository; - if (res == 0 && currentLockStatus == 1) + if (res == 0 && (currentLockStatus == 1 || currentLockStatus == 12345) ) { - // code is the default one; no need to request it. - return ETrue; + // code is the default one + RDEBUG("code is the default one; supply as default", 1); + iSecUi_password.Copy(_L("12345")); + // RDEBUG("code is the default one; no need to request it", 1); + // return ETrue; } - /* end check for default code */ + // end check for default code RMobilePhone::TMobilePassword required_fourth; TInt ret = KErrNone; TInt status = KErrNone; - RMobilePhone::TMobilePassword iSecUi_password; TInt queryAccepted = KErrCancel; while (queryAccepted != KErrNone) @@ -250,22 +256,20 @@ CSecQueryUi *iSecQueryUi; RDEBUG("CSecQueryUi", 0); iSecQueryUi = CSecQueryUi::NewL(); - iQueryCanceled = EFalse; + iQueryCanceled = EFalse; 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, ESecUiSecretSupported - | lAlphaSupported | lCancelSupported - | secCodeType ); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("AskSecCodeL")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + title.Append(_L("$")); + title.AppendNum(-1); // Don't know the number of remaining attempts + queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_SECURITY_CODE_MIN_LENGTH, SEC_C_SECURITY_CODE_MAX_LENGTH, ESecUiSecretSupported | lAlphaSupported + | lCancelSupported | secCodeType); RDEBUG("iSecUi_password", 0); - RDebug::Print(iSecUi_password); + RDEBUGSTR(iSecUi_password); RDEBUG("delete", 0); iQueryCanceled = ETrue; delete iSecQueryUi; @@ -279,17 +283,16 @@ CWait* wait = CWait::NewL(); RDEBUG("VerifySecurityCode", 0); - iPhone.VerifySecurityCode(wait->iStatus, secCodeType, - iSecUi_password, required_fourth); + 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 || status == KErrTimedOut) + if (status == KErrNotSupported || status == KErrTimedOut) { - RDEBUG( "status", status ); - status=KErrNone; + RDEBUG("status", status); + status = KErrNone; } #endif @@ -299,10 +302,7 @@ { case KErrNone: { - if (FeatureManager::FeatureSupported( - KFeatureIdSapTerminalControlFw) - && !(FeatureManager::FeatureSupported( - KFeatureIdSapDeviceLockEnhancements))) + if (FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw) && !(FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements))) { RDEBUG("calling RSCPClient", 0); RSCPClient scpClient; @@ -310,7 +310,12 @@ CleanupClosePushL(scpClient); TSCPSecCode newCode; + RDEBUG("iSecUi_password", 1); + RDEBUGSTR(iSecUi_password); newCode.Copy(iSecUi_password); + RDEBUG( + "!!!!!!! ***** deprecated **** !!!!! scpClient.StoreCode", + 0); scpClient.StoreCode(newCode); RDEBUG("called StoreCode", 1); @@ -325,21 +330,19 @@ case KErrLocked: { // security code blocked! - CSecuritySettings::ShowResultNoteL(R_SEC_BLOCKED, - CAknNoteDialog::EErrorTone); + CSecuritySettings::ShowResultNoteL(R_SEC_BLOCKED, CAknNoteDialog::EErrorTone); break; } case KErrGsm0707IncorrectPassword: case KErrAccessDenied: { // code was entered erroneusly - CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, - CAknNoteDialog::EErrorTone); + CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + break; } default: { - CSecuritySettings::ShowResultNoteL(status, - CAknNoteDialog::EErrorTone); + CSecuritySettings::ShowResultNoteL(status, CAknNoteDialog::EErrorTone); } } } // while @@ -350,49 +353,51 @@ // // ---------------------------------------------------------- // Cancels all security code queries -// aStatus = -1 from destructor -// aStatus = 1 from API. Will kill all dialogs through signal P&S +// aStatus = -1 from destructor +// aStatus = 1 from API. Will kill all dialogs through signal P&S // ---------------------------------------------------------- // qtdone TInt CSecurityHandler::CancelOpenQuery(TInt aStatus) { - RDEBUG("aStatus", aStatus); - RDEBUG("iQueryCanceled", iQueryCanceled); - TInt res = 0; - - if(aStatus==1) // also signal all other dialogs - { - RDEBUG("set KSecurityUIsDismissDialog to ESecurityUIsDismissDialogOn", ESecurityUIsDismissDialogOn); - TInt err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsDismissDialog, ESecurityUIsDismissDialogOn ); - RDEBUG("err", err); - res += 1; - } + RDEBUG("aStatus", aStatus); + RDEBUG("iQueryCanceled", iQueryCanceled); + TInt res = 0; + + if (aStatus == 1) // also signal all other dialogs + { + RDEBUG( + "set KSecurityUIsDismissDialog to ESecurityUIsDismissDialogOn", + ESecurityUIsDismissDialogOn); + TInt err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsDismissDialog, ESecurityUIsDismissDialogOn); + RDEBUG("err", err); + res += 1; + } if (!iQueryCanceled) { - // notify all dialogs, in particular SecUiNotificationDialog::subscriberKSecurityUIsDismissDialogChanged - // this will cancel only the dialog which was opened by same client. - res += 0x10; + // notify all dialogs, in particular SecUiNotificationDialog::subscriberKSecurityUIsDismissDialogChanged + // this will cancel only the dialog which was opened by same client. + res += 0x10; iQueryCanceled = ETrue; if (iSecurityDlg != NULL) { RDEBUG("deleting iSecurityDlg", 0); - res += 0x100; + res += 0x100; delete iSecurityDlg; } if (iNoteDlg != NULL) { RDEBUG("deleting iNoteDlg", 0); - res += 0x1000; + res += 0x1000; delete iNoteDlg; } iNoteDlg = NULL; iSecurityDlg = NULL; } - res += 0x10000; - RDEBUG("res", res); - return res; - } + res += 0x10000; + RDEBUG("res", res); + return res; + } // // ---------------------------------------------------------- @@ -403,11 +408,11 @@ // qtdone EXPORT_C void CSecurityHandler::CancelSecCodeQuery() { - RDEBUG("0", 0); + RDEBUG("0", 0); - TInt err = CancelOpenQuery(1); + TInt err = CancelOpenQuery(1); - RDEBUG("err", err); + RDEBUG("err", err); } // // ---------------------------------------------------------- @@ -426,8 +431,7 @@ TInt res; CWait* wait; - RMobilePhone::TMobilePhoneLockSetting lockChange( - RMobilePhone::ELockSetDisabled); + RMobilePhone::TMobilePhoneLockSetting lockChange(RMobilePhone::ELockSetDisabled); RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; // get autolock period from Central Repository. @@ -444,20 +448,20 @@ // disable autolock in Domestic OS side too if autolock period is 0. if (period == 0) { - RDEBUG("period", period); + RDEBUG("period", period); // 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 ); + TBool remoteLockStatus(EFalse); CRemoteLockSettings* remoteLockSettings = CRemoteLockSettings::NewL(); - if ( remoteLockSettings->GetEnabled( remoteLockStatus ) ) + if (remoteLockSettings->GetEnabled(remoteLockStatus)) { - RDEBUG( "0", 0 ); - if ( remoteLockStatus ) + RDEBUG("0", 0); + if (remoteLockStatus) { // Remote lock is enabled lockChange = RMobilePhone::ELockSetEnabled; @@ -473,7 +477,7 @@ else { // Failed to get remote lock status - RDEBUG("Failed", lockChange); + RDEBUG("Failed", lockChange); } delete remoteLockSettings; @@ -502,13 +506,11 @@ TPckg response(queryResponse); RDEBUG("0", 0); TSecurityNotificationPckg params; - params().iEvent - = static_cast (RMobilePhone::EPhonePasswordRequired); + params().iEvent = static_cast (RMobilePhone::EPhonePasswordRequired); params().iStartup = EFalse; RDEBUG("StartNotifierAndGetResponse", 0); - codeQueryNotifier.StartNotifierAndGetResponse(wait->iStatus, - KSecurityNotifierUid, params, response); + codeQueryNotifier.StartNotifierAndGetResponse(wait->iStatus, KSecurityNotifierUid, params, response); // this will eventually call PassPhraseRequiredL RDEBUG("WaitForRequestL", 0); res = wait->WaitForRequestL(); @@ -529,12 +531,12 @@ // Instead just re-set the DOS lock to enabled which as a side effect // requests the security code from the user. - TBool remoteLockStatus( EFalse ); + TBool remoteLockStatus(EFalse); CRemoteLockSettings* remoteLockSettings = CRemoteLockSettings::NewL(); - if ( remoteLockSettings->GetEnabled( remoteLockStatus ) ) + if (remoteLockSettings->GetEnabled(remoteLockStatus)) { - if ( remoteLockStatus ) + if (remoteLockStatus) { // Remote lock is enabled lockChange = RMobilePhone::ELockSetEnabled; @@ -583,32 +585,32 @@ } case KErrInUse: { - RDEBUG("KErrInUse", KErrInUse); - return EFalse; + RDEBUG("KErrInUse", KErrInUse); + return EFalse; } - case KErrDied : + case KErrDied: { - RDEBUG("KErrDied ", KErrDied ); - return EFalse; + RDEBUG("KErrDied ", KErrDied); + return EFalse; } - case KErrServerTerminated : + case KErrServerTerminated: { - RDEBUG("KErrServerTerminated ", KErrServerTerminated ); - return EFalse; + RDEBUG("KErrServerTerminated ", KErrServerTerminated); + return EFalse; } - case KErrServerBusy : + case KErrServerBusy: { - RDEBUG("KErrServerBusy ", KErrServerBusy ); - return EFalse; + RDEBUG("KErrServerBusy ", KErrServerBusy); + return EFalse; } case KErrAbort: { - RDEBUG("KErrAbort", KErrAbort); - return EFalse; + RDEBUG("KErrAbort", KErrAbort); + return EFalse; } case KErrCancel: { - RDEBUG("KErrCancel", KErrCancel); + RDEBUG("KErrCancel", KErrCancel); // user pressed "cancel" return EFalse; } @@ -643,21 +645,19 @@ TInt lEmergencySupported = 0; TInt err(KErrGeneral); - err = RProperty::Get(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, - autolockState); + err = RProperty::Get(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, autolockState); RDEBUG("StartUp", StartUp); RDEBUG("err", err); if (!StartUp) - { - RDebug::Printf( "%s %s (%u) might leave if StartUp=0 and err=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, err ); + { + RDebug::Printf("%s %s (%u) might leave if StartUp=0 and err=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, err); User::LeaveIfError(err); - } + } TBool isConditionSatisfied = EFalse; TInt tarmFlag = 0; - if (FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw )) + if (FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw)) { - TInt tRet = RProperty::Get(KSCPSIDAutolock, SCP_TARM_ADMIN_FLAG_UID, - tarmFlag); + TInt tRet = RProperty::Get(KSCPSIDAutolock, SCP_TARM_ADMIN_FLAG_UID, tarmFlag); if (tRet != KErrNone) { @@ -701,15 +701,17 @@ CSecQueryUi *iSecQueryUi; iSecQueryUi = CSecQueryUi::NewL(); - iQueryCanceled = EFalse; - TInt lType = ESecUiSecretSupported | ESecUiAlphaSupported - | lCancelSupported | lEmergencySupported | secCodeTypeToAsk; + iQueryCanceled = EFalse; + TInt lType = ESecUiSecretSupported | ESecUiAlphaSupported | 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); + TBuf<0x100> title; + title.Zero(); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("PassPhraseRequiredL")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_SECURITY_CODE_MIN_LENGTH, SEC_C_SECURITY_CODE_MAX_LENGTH, lType); RDEBUG("iSecUi_password", 0); - RDebug::Print(iSecUi_password); + RDEBUGSTR(iSecUi_password); RDEBUG("queryAccepted", queryAccepted); iQueryCanceled = ETrue; delete iSecQueryUi; @@ -717,13 +719,12 @@ TBool wasCancelledOrEmergency = EFalse; RDEBUG("KFeatureIdSapDeviceLockEnhancements", KFeatureIdSapDeviceLockEnhancements); - if ((queryAccepted == KErrAbort /* =emergency */) || (queryAccepted - == KErrCancel)) + if ((queryAccepted == KErrAbort /* =emergency */) || (queryAccepted == KErrCancel)) wasCancelledOrEmergency = ETrue; RDEBUG("wasCancelledOrEmergency", wasCancelledOrEmergency); if (wasCancelledOrEmergency) { - RDEBUG("StartUp", StartUp); + RDEBUG("StartUp", StartUp); if (!StartUp) { RDEBUG("AbortSecurityCode", 0); @@ -733,26 +734,98 @@ return KErrCancel; } - RMobilePhone::TMobilePhoneSecurityCode secCodeType = - RMobilePhone::ESecurityCodePhonePassword; + RMobilePhone::TMobilePhoneSecurityCode secCodeType = RMobilePhone::ESecurityCodePhonePassword; CWait* wait = NULL; TInt status = KErrNone; - - wait = CWait::NewL(); - RDEBUG("VerifySecurityCode", 0); - iPhone.VerifySecurityCode(wait->iStatus, secCodeType, iSecUi_password, - required_fourth); - RDEBUG("WaitForRequestL", 0); - status = wait->WaitForRequestL(); - RDEBUG("WaitForRequestL status", status); - delete wait; + + // Validate the code using SCP. This is needed to check expiration + RDEBUG("AbortSecurityCode", 0); + RSCPClient scpClient; + RDEBUG("scpClient.Connect", 0); + TInt tRet = scpClient.Connect(); + RDEBUG("tRet", tRet); + + CleanupClosePushL(scpClient); + + RArray aFailedPolicies; + TDevicelockPolicies failedPolicy; + TInt retLockcode = KErrNone; + RMobilePhone::TMobilePassword aISACode; + TInt aFlags = 0; + RDEBUG("scpClient.VerifyCurrentLockcode", 0); + // this validate on ISA . No need to do iPhone.VerifySecurityCode + retLockcode = scpClient.VerifyCurrentLockcode(iSecUi_password, aISACode, aFailedPolicies, aFlags); + RDEBUG("retLockcode", retLockcode); + + RDEBUG("aISACode", 0); + RDEBUGSTR(aISACode); + + RDEBUG("aFailedPolicies.Count()", aFailedPolicies.Count()); + RDEBUG("EDeviceLockPasscodeExpiration", EDeviceLockPasscodeExpiration); // 8 + TInt failedEDeviceLockPasscodeExpiration = 0; + for (TInt i = 0; i < aFailedPolicies.Count(); i++) + { + failedPolicy = aFailedPolicies[i]; + RDEBUG("failedPolicy", failedPolicy); + if (failedPolicy == EDeviceLockPasscodeExpiration) + failedEDeviceLockPasscodeExpiration = EDeviceLockPasscodeExpiration; + } + RDEBUG("Close", 0); + scpClient.Close(); + RDEBUG("PopAndDestroy", 0); + CleanupStack::PopAndDestroy(); //scpClient + + RDEBUG("failedEDeviceLockPasscodeExpiration", failedEDeviceLockPasscodeExpiration); + if (failedEDeviceLockPasscodeExpiration > 0) + { + // the password has expired. Note that it has NOT been validated. It will be revalidated inside ChangeSecCodeParamsL + RMobilePhone::TMobilePassword iNewPassword; + TInt iFlags = 0; + iNewPassword.Copy(_L("")); + TBuf<0x80> iCaption; + iCaption.Copy(_L("ChangeSecCodeL")); // no need to translate because it's not used + TInt iShowError = 1; + CSecuritySettings* iSecSettings; + iSecSettings = CSecuritySettings::NewL(); + TSecUi::InitializeLibL(); + RDEBUG("calling ChangeSecCodeParamsL", 0); + status = iSecSettings->ChangeSecCodeParamsL(iSecUi_password, iNewPassword, iFlags, iCaption, iShowError); + // note that it might have been aborted. The error KErrAbort is shown in this method, not inside ChangeSecCodeParamsL + if(status==KErrAccessDenied || status==KErrGsm0707IncorrectPassword) + { + // the password expired, but the user typed wrongly. The error was already displayed. + RDEBUG("SCP returned ", KErrAccessDenied); + status=R_CODES_DONT_MATCH; + RDEBUG("SCP changed to R_CODES_DONT_MATCH", R_CODES_DONT_MATCH); + } + RDEBUG("status", status); + RDEBUG("iNewPassword", 0); + RDEBUGSTR(iNewPassword); + TSecUi::UnInitializeLib(); + RDEBUG("deleting iSecSettings", 0); + delete iSecSettings; + RDEBUG("deleted iSecSettings", 1); + } + else + { + RDEBUG( "wait", 0 ); + wait = CWait::NewL(); + RDEBUG("VerifySecurityCode", 0); + iPhone.VerifySecurityCode(wait->iStatus, secCodeType, iSecUi_password, required_fourth); + RDEBUG("WaitForRequestL", + 0); + status = wait->WaitForRequestL(); + RDEBUG("WaitForRequestL status", + status); + delete wait; #ifdef __WINS__ - if(status==KErrNotSupported || status == KErrTimedOut) - { - RDEBUG( "status", status ); - status=KErrNone; + if (status == KErrNotSupported || status == KErrTimedOut) + { + RDEBUG( "status", status ); + status = KErrNone; + } +#endif } -#endif TInt returnValue = status; RDEBUG("tarmFlag", tarmFlag); @@ -762,9 +835,16 @@ { case KErrNone: // code approved - RDEBUG( "KErrNone", KErrNone ); - CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, - CAknNoteDialog::EConfirmationTone); + { + RDEBUG("KErrNone", KErrNone); + if( failedEDeviceLockPasscodeExpiration > 0) + { + RDEBUG("code has just been changed. No need to show Confirmation note. failedEDeviceLockPasscodeExpiration", failedEDeviceLockPasscodeExpiration); + } + else + { + CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, CAknNoteDialog::EConfirmationTone); + } RDEBUG("R_CONFIRMATION_NOTE", R_CONFIRMATION_NOTE); if (FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw)) { @@ -773,26 +853,24 @@ // Unset the admin flag if set if (tarmFlag & KSCPFlagResyncQuery) { - TInt tRet = RProperty::Get(KSCPSIDAutolock, - SCP_TARM_ADMIN_FLAG_UID, tarmFlag); + TInt 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); + tRet = RProperty::Set(KSCPSIDAutolock, SCP_TARM_ADMIN_FLAG_UID, tarmFlag); } if (tRet != KErrNone) { - RDEBUG( "FAILED to unset TARM Admin Flag tRet=", tRet ); + RDEBUG( + "FAILED to unset TARM Admin Flag tRet=", + tRet); } } - if (!FeatureManager::FeatureSupported( - KFeatureIdSapDeviceLockEnhancements)) + if (!FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) { - RDEBUG("KFeatureIdSapDeviceLockEnhancements", - KFeatureIdSapDeviceLockEnhancements); + RDEBUG("KFeatureIdSapDeviceLockEnhancements", KFeatureIdSapDeviceLockEnhancements); RSCPClient scpClient; RDEBUG("scpClient.Connect", 0); TInt tRet = scpClient.Connect(); @@ -802,8 +880,13 @@ CleanupClosePushL(scpClient); TSCPSecCode newCode; newCode.Copy(iSecUi_password); + RDEBUG( + "!!!!!!! ***** TODO deprecated **** !!!!! scpClient.StoreCode", + 0); scpClient.StoreCode(newCode); RDEBUG("scpClient.StoreCode", 1); + // TODO check whether code is expired. + // This should be done by TARM, and they should ask to change the code CleanupStack::PopAndDestroy(); //scpClient } @@ -812,23 +895,19 @@ if (StartUp) { // get autolock period from Central Repository. - CRepository* repository = CRepository::NewL( - KCRUidSecuritySettings); + CRepository* repository = CRepository::NewL(KCRUidSecuritySettings); TInt period = 0; TInt res = repository->Get(KSettingsAutoLockTime, period); delete repository; RDEBUG("res", res); RDEBUG("period", period); - _LIT_SECURITY_POLICY_PASS( KReadPolicy); _LIT_SECURITY_POLICY_C1(KWritePolicy, ECapabilityWriteDeviceData); - RProperty::Define(KPSUidCoreApplicationUIs, - KCoreAppUIsAutolockStatus, RProperty::EInt, - KReadPolicy, KWritePolicy); - RProperty::Set(KPSUidCoreApplicationUIs, - KCoreAppUIsAutolockStatus, EAutolockOff); - RDEBUG("KCoreAppUIsAutolockStatus", KCoreAppUIsAutolockStatus); + RProperty::Define(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, RProperty::EInt, KReadPolicy, KWritePolicy); + RProperty::Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EAutolockOff); + RDEBUG("KCoreAppUIsAutolockStatus", + KCoreAppUIsAutolockStatus); if (res == KErrNone) { @@ -838,29 +917,35 @@ // Don't disable the domestic OS device lock // since that would render the RemoteLock useless. - TBool remoteLockStatus( EFalse ); + TBool remoteLockStatus(EFalse); CRemoteLockSettings* remoteLockSettings = CRemoteLockSettings::NewL(); - if ( remoteLockSettings->GetEnabled( remoteLockStatus ) ) + if (remoteLockSettings->GetEnabled(remoteLockStatus)) { - if ( !remoteLockStatus ) + if (!remoteLockStatus) { // Remote lock is disabled - RDEBUG("Autolock and RemoteLock are disabled -> disable DOS device lock", 0); + RDEBUG( + "Autolock and RemoteLock are disabled -> disable DOS device lock", + 0); // Disable DOS device lock setting - RDEBUG( "iCustomPhone.DisablePhoneLock", 0 ); + RDEBUG( + "iCustomPhone.DisablePhoneLock", + 0); wait = CWait::NewL(); - iCustomPhone.DisablePhoneLock(wait->iStatus,iSecUi_password); - RDEBUG( "WaitForRequestL", 0 ); + iCustomPhone.DisablePhoneLock(wait->iStatus, iSecUi_password); + RDEBUG("WaitForRequestL", 0); status = wait->WaitForRequestL(); - RDEBUG( "WaitForRequestL", status ); + RDEBUG("WaitForRequestL", status); delete wait; } } else { // Failed to get remote lock status - RDEBUG( "Autolock is disabled, but failed to get RemoteLock status, so do nothing", 0 ); + RDEBUG( + "Autolock is disabled, but failed to get RemoteLock status, so do nothing", + 0); } delete remoteLockSettings; @@ -874,27 +959,29 @@ // Don't disable the domestic OS device lock // since that would render the RemoteLock useless. - TBool remoteLockStatus( EFalse ); + TBool remoteLockStatus(EFalse); CRemoteLockSettings* remoteLockSettings = CRemoteLockSettings::NewL(); - if ( remoteLockSettings->GetEnabled( remoteLockStatus ) ) + if (remoteLockSettings->GetEnabled(remoteLockStatus)) { - if ( !remoteLockStatus ) + if (!remoteLockStatus) { // Remote lock is disabled - RDEBUG( "iCustomPhone.DisablePhoneLock", 0 ); + RDEBUG("iCustomPhone.DisablePhoneLock", 0); wait = CWait::NewL(); - iCustomPhone.DisablePhoneLock(wait->iStatus,iSecUi_password); - RDEBUG( "WaitForRequestL", 0 ); - status = wait->WaitForRequestL(); - RDEBUG( "WaitForRequestL status", status ); + iCustomPhone.DisablePhoneLock(wait->iStatus, iSecUi_password); + RDEBUG("WaitForRequestL", 0); + status = wait->WaitForRequestL(); + RDEBUG("WaitForRequestL status", status); delete wait; } } else { // Failed to get remote lock status - RDEBUG( "Failed to get Autolock period and RemoteLock status, so do nothing", 0 ); + RDEBUG( + "Failed to get Autolock period and RemoteLock status, so do nothing", + 0); } delete remoteLockSettings; @@ -903,26 +990,38 @@ } } // no Startup - + } break; case KErrGsmSSPasswordAttemptsViolation: case KErrLocked: + { // security code blocked! - RDEBUG("KErrLocked", KErrLocked); - CSecuritySettings::ShowResultNoteL(R_SEC_BLOCKED, - CAknNoteDialog::EErrorTone); + RDEBUG("KErrLocked", KErrLocked) + ; + CSecuritySettings::ShowResultNoteL(R_SEC_BLOCKED, CAknNoteDialog::EErrorTone); + } break; case KErrGsm0707IncorrectPassword: case KErrAccessDenied: + { RDEBUG("KErrAccessDenied", KErrAccessDenied); // The Settings caller might retry - CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, - CAknNoteDialog::EErrorTone); + CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); + } + break; + case R_CODES_DONT_MATCH: // if password was supposed to be changed, but it failed (the initial verification) + { + RDEBUG("R_CODES_DONT_MATCH", R_CODES_DONT_MATCH); + // Error was already displayed + returnValue = KErrAccessDenied; + } break; default: + { RDEBUG("default", status); CSecuritySettings::ShowErrorNoteL(status); // The Settings caller might retry + } break; } RDEBUG("returnValue", returnValue); @@ -947,8 +1046,7 @@ TInt queryAccepted = KErrCancel; TInt lAlphaSupported = 0; RMobilePhone::TMobilePassword required_fourth; - RMobilePhone::TMobilePhoneSecurityCode secCodeType = - RMobilePhone::ESecurityCodePin1; + RMobilePhone::TMobilePhoneSecurityCode secCodeType = RMobilePhone::ESecurityCodePin1; RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); TBool StartUp = ETrue; @@ -965,18 +1063,16 @@ if (!StartUp) { // read a flag to see whether the query is SecUi originated. For example, from CSecuritySettings::ChangePinRequestParamsL - err = RProperty::Get(KPSUidSecurityUIs, - KSecurityUIsSecUIOriginatedQuery, secUiOriginatedQuery); + err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, secUiOriginatedQuery); if (err != KErrNone) { - RDEBUG("FAILED to get the SECUI query Flag err", err); + RDEBUG("FAILED to get the SECUI query Flag err", err); } } RDEBUG("err", err); RDEBUG("secUiOriginatedQuery", secUiOriginatedQuery); RDEBUG("ESecurityUIsSecUIOriginated", ESecurityUIsSecUIOriginated); - if (StartUp || (secUiOriginatedQuery != ESecurityUIsSecUIOriginated) - || (err != KErrNone)) + if (StartUp || (secUiOriginatedQuery != ESecurityUIsSecUIOriginated) || (err != KErrNone)) { RDEBUG("0", 0); lCancelSupported = ESecUiCancelNotSupported; @@ -993,9 +1089,9 @@ RDEBUG("res", res); #ifdef __WINS__ - RDEBUG( "emulator can't read PIN attempts", res ); - res=KErrNone; - codeInfo.iRemainingEntryAttempts=3; + RDEBUG("emulator can't read PIN attempts", res); + res = KErrNone; + codeInfo.iRemainingEntryAttempts = 3; #endif User::LeaveIfError(res); @@ -1008,22 +1104,22 @@ CSecQueryUi *iSecQueryUi; RDEBUG("CSecQueryUi", 0); iSecQueryUi = CSecQueryUi::NewL(); - iQueryCanceled = EFalse; + iQueryCanceled = EFalse; RDEBUG("SecQueryDialog", 1); // ESecUiCodeEtelReqest/ESecUiNone might be useful lAlphaSupported = ESecUiAlphaNotSupported; TBuf<0x100> title; title.Zero(); - title.Append(_L("Pin1RequiredL")); - title.Append(_L("#")); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_pin_code")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + title.Append(_L("$")); title.AppendNum(codeInfo.iRemainingEntryAttempts); - TInt amode = ESecUiSecretSupported | lAlphaSupported | lCancelSupported - | ESecUiEmergencySupported | secCodeType; + TInt amode = ESecUiSecretSupported | 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); + 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); + RDEBUGSTR(iSecUi_password); iQueryCanceled = ETrue; delete iSecQueryUi; RDEBUG("queryAccepted", queryAccepted); @@ -1031,7 +1127,7 @@ if (queryAccepted == KErrAbort) // emergency call { - RDEBUG("queryAccepted", queryAccepted); + RDEBUG("queryAccepted", queryAccepted); CleanupStack::PopAndDestroy(wait); // this is needed return KErrCancel; } @@ -1046,10 +1142,9 @@ } RDEBUG("iSecUi_password", 0); - RDebug::Print(iSecUi_password); + RDEBUGSTR(iSecUi_password); RDEBUG("VerifySecurityCode", 0); - iPhone.VerifySecurityCode(wait->iStatus, secCodeType, iSecUi_password, - required_fourth); + iPhone.VerifySecurityCode(wait->iStatus, secCodeType, iSecUi_password, required_fourth); RDEBUG("WaitForRequestL", 0); res = wait->WaitForRequestL(); RDEBUG("WaitForRequestL res", res); @@ -1060,18 +1155,17 @@ { case KErrNone: // code approved - RDEBUG("code approved", res); - if(lCancelSupported == ESecUiCancelNotSupported) - { // OK note is not displayed in boot-up, to make things faster - CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, - CAknNoteDialog::EConfirmationTone); - } + RDEBUG("code approved", res) + ; + if (lCancelSupported == ESecUiCancelNotSupported) + { // OK note is not displayed in boot-up, to make things faster + CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, CAknNoteDialog::EConfirmationTone); + } break; case KErrGsm0707IncorrectPassword: case KErrAccessDenied: // code was entered erroneously - CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, - CAknNoteDialog::EErrorTone); + CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); if (StartUp) { returnValue = Pin1RequiredL(); @@ -1082,19 +1176,20 @@ // code blocked; show error note and terminate. // what if not during Startup? Probably it's Ok since the SIM would had also failed at StartUp if (StartUp) - CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, - CAknNoteDialog::EErrorTone); + CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); break; case KErrGsm0707SimWrong: // sim lock active // no error? This is strange break; default: + { CSecuritySettings::ShowErrorNoteL(res); if (StartUp) { returnValue = Pin1RequiredL(); } + } break; } return returnValue; @@ -1113,7 +1208,7 @@ * Series 60 Customer / ETel * Series 60 ETel API *****************************************************/ - RDEBUG("0", 0); + RDEBUG("0", 0); TInt queryAccepted = KErrCancel; RMobilePhone::TMobilePassword puk1_password; RMobilePhone::TMobilePassword aNewPinPassword; @@ -1127,7 +1222,7 @@ TBool StartUp(ETrue); StartUp = iStartup; - TInt res(KErrCancel); // for the first try + TInt res(KErrCancel); // for the first try wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); TInt thisTry = 0; @@ -1136,27 +1231,25 @@ while (res != KErrNone && (thisTry++) <= KTriesToConnectServer) { if (thisTry > 0) - User::After( KTimeBeforeRetryingRequest); + User::After(KTimeBeforeRetryingRequest); RDEBUG("GetSecurityCodeInfo", 0); iPhone.GetSecurityCodeInfo(wait->iStatus, blockCodeType, codeInfoPkg); RDEBUG("WaitForRequestL", 0); res = wait->WaitForRequestL(); RDEBUG("WaitForRequestL res", res); } - RDEBUG("res", res); + RDEBUG("res", res); // If there's still an error we're doomed. Bail out. User::LeaveIfError(res); RDEBUG("StartUp", StartUp); RDEBUG("codeInfo.iRemainingEntryAttempts", codeInfo.iRemainingEntryAttempts); - TInt attempts(codeInfo.iRemainingEntryAttempts); - RDEBUG( "attempts", attempts ); + TInt attempts(codeInfo.iRemainingEntryAttempts); + RDEBUG("attempts", attempts); // show the last "Code Error" note of PIN verify result here so it won't be left under the PUK1 dialog - if (!StartUp && (attempts - == KMaxNumberOfPUKAttempts)) - CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, - CAknNoteDialog::EErrorTone); + if (!StartUp && (attempts == KMaxNumberOfPUKAttempts)) + CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); if (attempts == KMaxNumberOfPINAttempts) attempts = -1; @@ -1164,23 +1257,23 @@ CSecQueryUi *iSecQueryUi; RDEBUG("CSecQueryUi", 0); iSecQueryUi = CSecQueryUi::NewL(); - iQueryCanceled = EFalse; + iQueryCanceled = EFalse; RDEBUG("SecQueryDialog", 1); // ESecUiCodeEtelReqest/ESecUiNone might be useful TBuf<0x100> title; title.Zero(); - title.Append(_L("Puk1RequiredL")); - title.Append(_L("#")); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_puk_code")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + title.Append(_L("$")); title.AppendNum(attempts); TInt lSecUiCancelSupported = ESecUiCancelSupported | ESecUiEmergencyNotSupported; - if(StartUp) // how to know whether PUK comes from failing at Starter, or failing at any other PIN (i.e. changing PIN, or changing PIN-request) ??? - lSecUiCancelSupported = ESecUiCancelNotSupported | ESecUiEmergencySupported; - queryAccepted = iSecQueryUi->SecQueryDialog(title, puk1_password, - SEC_C_PUK_CODE_MIN_LENGTH, SEC_C_PUK_CODE_MAX_LENGTH, - ESecUiSecretNotSupported | ESecUiAlphaNotSupported - | lSecUiCancelSupported | ESecUiPukRequired); + if (StartUp) // how to know whether PUK comes from failing at Starter, or failing at any other PIN (i.e. changing PIN, or changing PIN-request) ??? + lSecUiCancelSupported = ESecUiCancelNotSupported | ESecUiEmergencySupported; + queryAccepted = iSecQueryUi->SecQueryDialog(title, puk1_password, SEC_C_PUK_CODE_MIN_LENGTH, SEC_C_PUK_CODE_MAX_LENGTH, ESecUiSecretNotSupported | ESecUiAlphaNotSupported + | lSecUiCancelSupported | ESecUiPukRequired); RDEBUG("puk1_password", 0); - RDebug::Print(puk1_password); + RDEBUGSTR(puk1_password); iQueryCanceled = ETrue; delete iSecQueryUi; RDEBUG("queryAccepted", queryAccepted); @@ -1199,21 +1292,19 @@ RDEBUG("WaitForRequestL", 0); res = wait->WaitForRequestL(); RDEBUG("WaitForRequestL res", res); - CleanupStack::PopAndDestroy(wait); - + CleanupStack::PopAndDestroy(wait); + TInt returnValue = res; switch (res) { case KErrNone: // code approved -> note . The process continue and new-pin is requested - CSecuritySettings::ShowResultNoteL(res, - CAknNoteDialog::EConfirmationTone); + CSecuritySettings::ShowResultNoteL(res, CAknNoteDialog::EConfirmationTone); break; case KErrGsm0707IncorrectPassword: case KErrAccessDenied: // wrong PUK code -> note -> ask PUK code again - CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, - CAknNoteDialog::EErrorTone); + CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); returnValue = Puk1RequiredL(); break; case KErrGsm0707SimWrong: @@ -1230,25 +1321,30 @@ break; } - // Now the PUK1 is validated. It's time for asking the new PIN1 - RDEBUG("new wait", 0); - wait = CWait::NewL(); - CleanupStack::PushL(wait); + // Now the PUK1 is validated. It's time for asking the new PIN1 + RDEBUG("new wait", 0); + wait = CWait::NewL(); + CleanupStack::PushL(wait); { // new-pin query CSecQueryUi * iSecQueryUi; RDEBUG("CSecQueryUi", 0); iSecQueryUi = CSecQueryUi::NewL(); - iQueryCanceled = EFalse; + iQueryCanceled = EFalse; RDEBUG("SecQueryDialog", 1); - - queryAccepted = iSecQueryUi->SecQueryDialog( - _L("PIN1-New|PIN1-Verif"), aNewPinPassword, - SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, - ESecUiAlphaNotSupported | ESecUiCancelSupported - | ESecUiPukRequired); + TBuf<0x100> title; + title.Zero(); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_pin_code")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + title.Append(_L("|")); + HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_verify_new_pin_code")); + title.Append(stringHolder2->Des()); + CleanupStack::PopAndDestroy(stringHolder2); + queryAccepted = iSecQueryUi->SecQueryDialog(title, aNewPinPassword, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported + | ESecUiPukRequired); RDEBUG("aNewPinPassword", 0); - RDebug::Print(aNewPinPassword); + RDEBUGSTR(aNewPinPassword); iQueryCanceled = ETrue; delete iSecQueryUi; RDEBUG("queryAccepted", queryAccepted); @@ -1262,8 +1358,7 @@ // send code again, now with the user pin RDEBUG("VerifySecurityCode", 0); - iPhone.VerifySecurityCode(wait->iStatus, blockCodeType, aNewPinPassword, - puk1_password); + iPhone.VerifySecurityCode(wait->iStatus, blockCodeType, aNewPinPassword, puk1_password); RDEBUG("WaitForRequestL", 0); res = wait->WaitForRequestL(); RDEBUG("WaitForRequestL res", res); @@ -1274,14 +1369,12 @@ { case KErrNone: // code approved -> note - CSecuritySettings::ShowResultNoteL(R_PIN_CODE_CHANGED_NOTE, - CAknNoteDialog::EConfirmationTone); + CSecuritySettings::ShowResultNoteL(R_PIN_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); break; case KErrGsm0707IncorrectPassword: case KErrAccessDenied: // wrong PUK code -> note -> ask PUK code again - CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, - CAknNoteDialog::EErrorTone); + CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); returnValue = Puk1RequiredL(); break; case KErrGsm0707SimWrong: @@ -1297,7 +1390,7 @@ returnValue = Puk1RequiredL(); break; } - RDEBUG("returnValue", returnValue); + RDEBUG("returnValue", returnValue); return returnValue; } // @@ -1313,12 +1406,11 @@ * Series 60 ETel API *****************************************************/ - RDEBUG("0", 0); + RDEBUG("0", 0); TInt queryAccepted = KErrCancel; RMobilePhone::TMobilePassword iSecUi_password; RMobilePhone::TMobilePassword required_fourth; - RMobilePhone::TMobilePhoneSecurityCode secCodeType( - RMobilePhone::ESecurityCodePin2); + RMobilePhone::TMobilePhoneSecurityCode secCodeType(RMobilePhone::ESecurityCodePin2); RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); CWait* wait = CWait::NewL(); @@ -1341,21 +1433,21 @@ CSecQueryUi *iSecQueryUi; RDEBUG("CSecQueryUi", 0); iSecQueryUi = CSecQueryUi::NewL(); - iQueryCanceled = EFalse; + iQueryCanceled = EFalse; RDEBUG("SecQueryDialog", 1); // ESecUiCodeEtelReqest/ESecUiNone might be useful against KLastRemainingInputAttempt TBuf<0x100> title; title.Zero(); - title.Append(_L("Pin2RequiredL")); - title.Append(_L("#")); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_pin2_code")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + 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, - ESecUiSecretNotSupported | ESecUiAlphaNotSupported - | ESecUiCancelSupported | secCodeType); + queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_PIN2_CODE_MIN_LENGTH, SEC_C_PIN2_CODE_MAX_LENGTH, ESecUiSecretNotSupported | ESecUiAlphaNotSupported + | ESecUiCancelSupported | secCodeType); RDEBUG("iSecUi_password", 0); - RDebug::Print(iSecUi_password); + RDEBUGSTR(iSecUi_password); RDEBUG("queryAccepted", queryAccepted); iQueryCanceled = ETrue; delete iSecQueryUi; @@ -1371,8 +1463,7 @@ } RDEBUG("VerifySecurityCode", 0); - iPhone.VerifySecurityCode(wait->iStatus, secCodeType, iSecUi_password, - required_fourth); + iPhone.VerifySecurityCode(wait->iStatus, secCodeType, iSecUi_password, required_fourth); RDEBUG("WaitForRequestL", 0); TInt status = wait->WaitForRequestL(); RDEBUG("WaitForRequestL status", status); @@ -1385,14 +1476,12 @@ case KErrGsm0707IncorrectPassword: case KErrAccessDenied: // code was entered erroneously - CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, - CAknNoteDialog::EErrorTone); + CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); break; case KErrGsmSSPasswordAttemptsViolation: case KErrLocked: // blocked - CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, - CAknNoteDialog::EErrorTone); + CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); break; default: CSecuritySettings::ShowErrorNoteL(status); @@ -1411,7 +1500,7 @@ * Series 60 Customer / ETel * Series 60 ETel API *****************************************************/ - RDEBUG("0", 0); + RDEBUG("0", 0); TInt queryAccepted = KErrCancel; RMobilePhone::TMobilePassword iSecUi_password; RMobilePhone::TMobilePassword aNewPassword; @@ -1419,8 +1508,7 @@ RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); - RMobilePhone::TMobilePhoneSecurityCode secCodeType = - RMobilePhone::ESecurityCodePuk2; + RMobilePhone::TMobilePhoneSecurityCode secCodeType = RMobilePhone::ESecurityCodePuk2; CWait* wait = CWait::NewL(); CleanupStack::PushL(wait); @@ -1439,7 +1527,7 @@ CSecQueryUi *iSecQueryUi; RDEBUG("CSecQueryUi", 0); iSecQueryUi = CSecQueryUi::NewL(); - iQueryCanceled = EFalse; + iQueryCanceled = EFalse; RDEBUG("SecQueryDialog", 1); // ESecUiCodeEtelReqest/ESecUiNone might be useful @@ -1450,15 +1538,15 @@ TBuf<0x100> title; title.Zero(); - title.Append(_L("Puk2RequiredL")); - title.Append(_L("#")); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("Puk2RequiredL")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + 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, - ESecUiSecretNotSupported | ESecUiAlphaNotSupported - | ESecUiCancelSupported | secCodeType ); + queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_PUK2_CODE_MIN_LENGTH, SEC_C_PUK2_CODE_MAX_LENGTH, ESecUiSecretNotSupported | ESecUiAlphaNotSupported + | ESecUiCancelSupported | secCodeType); RDEBUG("iSecUi_password", 0); - RDebug::Print(iSecUi_password); + RDEBUGSTR(iSecUi_password); iQueryCanceled = ETrue; delete iSecQueryUi; RDEBUG("queryAccepted", queryAccepted); @@ -1485,21 +1573,18 @@ { case KErrNone: // code approved -> note - CSecuritySettings::ShowResultNoteL(res, - CAknNoteDialog::EConfirmationTone); + CSecuritySettings::ShowResultNoteL(res, CAknNoteDialog::EConfirmationTone); break; case KErrGsm0707IncorrectPassword: case KErrAccessDenied: // wrong PUK2 code -> note -> ask PUK2 code again - CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, - CAknNoteDialog::EErrorTone); + CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); Puk2RequiredL(); break; case KErrGsmSSPasswordAttemptsViolation: case KErrLocked: // Pin2 features blocked permanently! - CSecuritySettings::ShowResultNoteL(R_PIN2_REJECTED, - CAknNoteDialog::EConfirmationTone); + CSecuritySettings::ShowResultNoteL(R_PIN2_REJECTED, CAknNoteDialog::EConfirmationTone); break; default: CSecuritySettings::ShowErrorNoteL(res); @@ -1507,23 +1592,25 @@ break; } - // now the PUK2 is valid. Time to get the new PIN2 - wait = CWait::NewL(); + // now the PUK2 is valid. Time to get the new PIN2 + wait = CWait::NewL(); CleanupStack::PushL(wait); - { + { // new pin2 code query CSecQueryUi * iSecQueryUi; RDEBUG("CSecQueryUi", 0); iSecQueryUi = CSecQueryUi::NewL(); - iQueryCanceled = EFalse; + iQueryCanceled = EFalse; + TBuf<0x100> title; + title.Zero(); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("PIN2-New|PIN2-Verif")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); // ESecUiCodeEtelReqest/ESecUiNone might be useful - queryAccepted - = iSecQueryUi->SecQueryDialog(_L("PIN2-New|PIN2-Verif"), - aNewPassword, SEC_C_PIN2_CODE_MIN_LENGTH, - SEC_C_PIN2_CODE_MAX_LENGTH, ESecUiAlphaNotSupported - | ESecUiCancelSupported | secCodeType); + queryAccepted = iSecQueryUi->SecQueryDialog(title, aNewPassword, SEC_C_PIN2_CODE_MIN_LENGTH, SEC_C_PIN2_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported + | secCodeType); RDEBUG("aNewPassword", 0); - RDebug::Print(aNewPassword); + RDEBUGSTR(aNewPassword); iQueryCanceled = ETrue; delete iSecQueryUi; RDEBUG("queryAccepted", queryAccepted); @@ -1539,8 +1626,7 @@ } // send code. The code was temporarilly changed before. Thus, this really done to set the new-new one RDEBUG("VerifySecurityCode", 0); - iPhone.VerifySecurityCode(wait->iStatus, secCodeType, aNewPassword, - iSecUi_password); + iPhone.VerifySecurityCode(wait->iStatus, secCodeType, aNewPassword, iSecUi_password); RDEBUG("WaitForRequestL", 0); res = wait->WaitForRequestL(); RDEBUG("WaitForRequestL res", res); @@ -1550,21 +1636,18 @@ { case KErrNone: // code approved -> note - CSecuritySettings::ShowResultNoteL(R_PIN2_CODE_CHANGED_NOTE, - CAknNoteDialog::EConfirmationTone); + CSecuritySettings::ShowResultNoteL(R_PIN2_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); break; case KErrGsm0707IncorrectPassword: case KErrAccessDenied: // wrong PUK2 code -> note -> ask PUK2 code again - CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, - CAknNoteDialog::EErrorTone); + CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); Puk2RequiredL(); break; case KErrGsmSSPasswordAttemptsViolation: case KErrLocked: // Pin2 features blocked permanently! - CSecuritySettings::ShowResultNoteL(R_PIN2_REJECTED, - CAknNoteDialog::EConfirmationTone); + CSecuritySettings::ShowResultNoteL(R_PIN2_REJECTED, CAknNoteDialog::EConfirmationTone); break; default: CSecuritySettings::ShowErrorNoteL(res); @@ -1585,11 +1668,10 @@ * Series 60 Customer / ETel * Series 60 ETel API *****************************************************/ - TBool wcdmaSupported( - FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma)); - TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin)); - RDEBUG("wcdmaSupported", wcdmaSupported); - RDEBUG("upinSupported", upinSupported); + TBool wcdmaSupported(FeatureManager::FeatureSupported(KFeatureIdProtocolWcdma)); + TBool upinSupported(FeatureManager::FeatureSupported(KFeatureIdUpin)); + RDEBUG("wcdmaSupported", wcdmaSupported); + RDEBUG("upinSupported", upinSupported); if (wcdmaSupported || upinSupported) { TInt queryAccepted = KErrCancel; @@ -1597,10 +1679,8 @@ RMobilePhone::TMobilePassword iSecUi_password; RMobilePhone::TMobilePassword required_fourth; RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; - RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg - codeInfoPkg(codeInfo); - RMobilePhone::TMobilePhoneSecurityCode secCodeType = - RMobilePhone::ESecurityUniversalPin; + RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); + RMobilePhone::TMobilePhoneSecurityCode secCodeType = RMobilePhone::ESecurityUniversalPin; CWait* wait = CWait::NewL(); CleanupStack::PushL(wait); TBool StartUp = ETrue; @@ -1622,34 +1702,32 @@ if (!StartUp) { // read a flag to see whether the query is SecUi originated. - err = RProperty::Get(KPSUidSecurityUIs, - KSecurityUIsSecUIOriginatedQuery, secUiOriginatedQuery); + err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, secUiOriginatedQuery); } /* request PIN using QT */ CSecQueryUi *iSecQueryUi; RDEBUG("CSecQueryUi", 0); iSecQueryUi = CSecQueryUi::NewL(); - iQueryCanceled = EFalse; + iQueryCanceled = EFalse; // ESecUiCodeEtelReqest/ESecUiNone might be useful // TODO also support Emergency - if (StartUp || (secUiOriginatedQuery != ESecurityUIsSecUIOriginated) - || (err != KErrNone)) + if (StartUp || (secUiOriginatedQuery != ESecurityUIsSecUIOriginated) || (err != KErrNone)) lCancelSupported = ESecUiCancelNotSupported; else lCancelSupported = ESecUiCancelSupported; TBuf<0x100> title; title.Zero(); - title.Append(_L("UPin1RequiredL")); - title.Append(_L("#")); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_upin_code")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + 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, - ESecUiSecretSupported | ESecUiAlphaNotSupported - | lCancelSupported | ESecUiCodeEtelReqest); + queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiSecretSupported | ESecUiAlphaNotSupported + | lCancelSupported | ESecUiCodeEtelReqest); RDEBUG("iSecUi_password", 0); - RDebug::Print(iSecUi_password); + RDEBUGSTR(iSecUi_password); iQueryCanceled = ETrue; delete iSecQueryUi; RDEBUG("queryAccepted", queryAccepted); @@ -1663,8 +1741,7 @@ return KErrCancel; } RDEBUG("VerifySecurityCode", 0); - iPhone.VerifySecurityCode(wait->iStatus, secCodeType, - iSecUi_password, required_fourth); + iPhone.VerifySecurityCode(wait->iStatus, secCodeType, iSecUi_password, required_fourth); RDEBUG("WaitForRequestL", 0); res = wait->WaitForRequestL(); RDEBUG("WaitForRequestL res", res); @@ -1675,15 +1752,14 @@ { case KErrNone: // code approved - RDEBUG("code approved ", 0); - CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, - CAknNoteDialog::EConfirmationTone); + RDEBUG("code approved ", 0) + ; + CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, CAknNoteDialog::EConfirmationTone); break; case KErrGsm0707IncorrectPassword: case KErrAccessDenied: // code was entered erroneously - CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, - CAknNoteDialog::EErrorTone); + CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); if (StartUp) { returnValue = UPinRequiredL(); @@ -1693,13 +1769,12 @@ case KErrLocked: // code blocked; show error note and terminate. if (StartUp) - CSecuritySettings::ShowResultNoteL(res, - CAknNoteDialog::EErrorTone); + CSecuritySettings::ShowResultNoteL(res, CAknNoteDialog::EErrorTone); break; case KErrGsm0707SimWrong: // sim lock active break; - default: // for example, KErrArgument + default: // for example, KErrArgument CSecuritySettings::ShowErrorNoteL(res); if (StartUp) { @@ -1721,9 +1796,8 @@ // qtdone TInt CSecurityHandler::UPukRequiredL() { - TBool wcdmaSupported( - FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma)); - TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin)); + TBool wcdmaSupported(FeatureManager::FeatureSupported(KFeatureIdProtocolWcdma)); + TBool upinSupported(FeatureManager::FeatureSupported(KFeatureIdUpin)); if (wcdmaSupported || upinSupported) { RDEBUG("0", 0); @@ -1731,8 +1805,7 @@ RMobilePhone::TMobilePassword iSecUi_password; RMobilePhone::TMobilePassword aNewPassword; RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; - RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg - codeInfoPkg(codeInfo); + RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); RMobilePhone::TMobilePhoneSecurityCode blockCodeType; blockCodeType = RMobilePhone::ESecurityUniversalPuk; @@ -1751,10 +1824,8 @@ 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); + if (!StartUp && (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPUKAttempts)) + CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); // ask UPUK code /* request PIN using QT */ @@ -1762,21 +1833,21 @@ CSecQueryUi *iSecQueryUi; RDEBUG("CSecQueryUi", 0); iSecQueryUi = CSecQueryUi::NewL(); - iQueryCanceled = EFalse; + iQueryCanceled = EFalse; // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful // TODO also support Emergency TBuf<0x100> title; title.Zero(); - title.Append(_L("Pin1RequiredL")); - title.Append(_L("#")); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("UPuk1RequiredL")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + 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); + 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); + RDEBUGSTR(iSecUi_password); iQueryCanceled = ETrue; delete iSecQueryUi; RDEBUG("queryAccepted", queryAccepted); @@ -1793,17 +1864,22 @@ CSecQueryUi *iSecQueryUi; RDEBUG("CSecQueryUi", 0); iSecQueryUi = CSecQueryUi::NewL(); - iQueryCanceled = EFalse; + iQueryCanceled = EFalse; // 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); + TBuf<0x100> title; + title.Zero(); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_upin_code")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + title.Append(_L("|")); + HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("Verify")); + title.Append(stringHolder2->Des()); + CleanupStack::PopAndDestroy(stringHolder2); + queryAccepted = iSecQueryUi->SecQueryDialog(title, aNewPassword, SEC_C_PUK_CODE_MIN_LENGTH, SEC_C_PUK_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported + | ESecUiPukRequired); RDEBUG("aNewPassword", 0); - RDebug::Print(aNewPassword); + RDEBUGSTR(aNewPassword); iQueryCanceled = ETrue; delete iSecQueryUi; RDEBUG("queryAccepted", queryAccepted); @@ -1816,8 +1892,7 @@ // send code RDEBUG("VerifySecurityCode", 0); - iPhone.VerifySecurityCode(wait->iStatus, blockCodeType, aNewPassword, - iSecUi_password); + iPhone.VerifySecurityCode(wait->iStatus, blockCodeType, aNewPassword, iSecUi_password); RDEBUG("WaitForRequestL", 0); res = wait->WaitForRequestL(); RDEBUG("WaitForRequestL res", res); @@ -1828,14 +1903,12 @@ { case KErrNone: // code approved -> note - CSecuritySettings::ShowResultNoteL(R_UPIN_CODE_CHANGED_NOTE, - CAknNoteDialog::EConfirmationTone); + CSecuritySettings::ShowResultNoteL(R_UPIN_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); break; case KErrGsm0707IncorrectPassword: case KErrAccessDenied: // wrong PUK code -> note -> ask UPUK code again - CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, - CAknNoteDialog::EErrorTone); + CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); returnValue = UPukRequiredL(); break; case KErrGsm0707SimWrong: @@ -1867,8 +1940,7 @@ void CSecurityHandler::SimLockEventL() { RDEBUG("0", 0); - CSecuritySettings::ShowResultNoteL(R_SIM_ON, - CAknNoteDialog::EConfirmationTone); + CSecuritySettings::ShowResultNoteL(R_SIM_ON, CAknNoteDialog::EConfirmationTone); } // --------------------------------------------------------- // CSecurityHandler::RemoveSplashScreenL() diff -r 3aa774c655ac -r f1030a78d563 securitydialogs/SecUi/Src/SecUiSecuritySettings.cpp --- a/securitydialogs/SecUi/Src/SecUiSecuritySettings.cpp Tue Jun 29 10:29:16 2010 +0300 +++ b/securitydialogs/SecUi/Src/SecUiSecuritySettings.cpp Thu Jul 08 20:04:36 2010 +0300 @@ -1,20 +1,20 @@ /* -* Copyright (c) 2002 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: Provides api for changing security settings. -* -* -*/ + * Copyright (c) 2002 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: Provides api for changing security settings. + * + * + */ #include #include @@ -35,7 +35,7 @@ #include "secuisecurityhandler.h" #include "secuicodequerydialog.h" #include "SecUiWait.h" - +#include #include #include #include @@ -57,6 +57,7 @@ const TInt KMaxNumberOfPINAttempts(3); // is this valid also for PIN2 ? #define ESecUiTypeLock 0x00100000 +#define KErrTDevicelockPolicies 0x10207837 // ================= MEMBER FUNCTIONS ======================= // @@ -98,7 +99,7 @@ * Needs customer TSY implementation *****************************************************/ - RDEBUG("0", 0); + RDEBUG("0", 0); TInt err(KErrGeneral); TInt thisTry(0); iWait = CWait::NewL(); @@ -108,8 +109,7 @@ FeatureManager::InitializeLibL(); // connect to ETel server - while ((err = iServer.Connect()) != KErrNone && (thisTry++) - <= KTriesToConnectServer) + while ((err = iServer.Connect()) != KErrNone && (thisTry++) <= KTriesToConnectServer) { User::After( KTimeBeforeRetryingServerConnection); } @@ -126,13 +126,18 @@ } // open phones - User::LeaveIfError(iServer.SetExtendedErrorGranularity( - RTelServer::EErrorExtended)); + User::LeaveIfError(iServer.SetExtendedErrorGranularity(RTelServer::EErrorExtended)); User::LeaveIfError(iServer.GetPhoneInfo(PhoneIndex, PhoneInfo)); User::LeaveIfError(iPhone.Open(iServer, PhoneInfo.iName)); User::LeaveIfError(iCustomPhone.Open(iPhone)); iSecurityHandler = new (ELeave) CSecurityHandler(iPhone); + _LIT(KFileName, "secui_"); + _LIT(KPath, "z:/resource/qt/translations/"); + RDEBUG("HbTextResolverSymbian", 0); + TBool result = HbTextResolverSymbian::Init(KFileName, KPath); + RDEBUG("result", result); + } // // ---------------------------------------------------------- @@ -155,16 +160,14 @@ // Cancel active requests if (iWait->IsActive()) { - RDEBUG("CancelAsyncRequest", 0); + RDEBUG("CancelAsyncRequest", 0); iPhone.CancelAsyncRequest(iWait->GetRequestType()); switch (iWait->GetRequestType()) { //inform query that it has beeen canceled case EMobilePhoneSetLockSetting: case EMobilePhoneSetFdnSetting: - RProperty::Set(KPSUidSecurityUIs, - KSecurityUIsQueryRequestCancel, - ESecurityUIsQueryRequestCanceled); + RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestCanceled); break; default: break; @@ -202,7 +205,7 @@ iNewPassword.Copy(_L("")); TBuf<0x80> iCaption; - iCaption.Copy(_L("ChangePinL")); + iCaption.Copy(_L("ChangePinL")); // no need to translate. Not used TInt iShowError = 1; TInt err = ChangePinParamsL(iOldPassword, iNewPassword, iFlags, iCaption, iShowError); RDEBUG("err", err); @@ -224,10 +227,9 @@ iNewPassword.Copy(_L("")); TBuf<0x80> iCaption; - iCaption.Copy(_L("ChangeUPinL")); + iCaption.Copy(_L("ChangeUPinL")); // no need to translate. Not used TInt iShowError = 1; - TInt err = ChangeUPinParamsL(iOldPassword, iNewPassword, iFlags, iCaption, - iShowError); + TInt err = ChangeUPinParamsL(iOldPassword, iNewPassword, iFlags, iCaption, iShowError); RDEBUG("err", err); } @@ -248,10 +250,9 @@ iNewPassword.Copy(_L("")); TBuf<0x80> iCaption; - iCaption.Copy(_L("ChangePin2L")); + iCaption.Copy(_L("ChangePin2L")); // no need to translate. Not used TInt iShowError = 1; - TInt err = ChangePin2ParamsL(iOldPassword, iNewPassword, iFlags, iCaption, - iShowError); + TInt err = ChangePin2ParamsL(iOldPassword, iNewPassword, iFlags, iCaption, iShowError); RDEBUG("err", err); } // @@ -270,10 +271,9 @@ iNewPassword.Copy(_L("")); TBuf<0x80> iCaption; - iCaption.Copy(_L("ChangeSecCodeL")); + iCaption.Copy(_L("ChangeSecCodeL")); // no need to translate. Not used TInt iShowError = 1; - TInt err = ChangeSecCodeParamsL(iOldPassword, iNewPassword, iFlags, iCaption, - iShowError); + TInt err = ChangeSecCodeParamsL(iOldPassword, iNewPassword, iFlags, iCaption, iShowError); RDEBUG("err", err); } // @@ -290,10 +290,9 @@ TInt iFlags = 0; TInt iShowError = 1; TBuf<0x80> iCaption; - iCaption.Copy(_L("ChangeAutoLockPeriodL")); + iCaption.Copy(_L("ChangeAutoLockPeriodL")); // no need to translate. Not used iOldPassword.Copy(_L("")); - ret = ChangeAutoLockPeriodParamsL(aPeriod, iOldPassword, iFlags, - iCaption, iShowError); + ret = ChangeAutoLockPeriodParamsL(aPeriod, iOldPassword, iFlags, iCaption, iShowError); RDEBUG("ret", ret); return ret; } @@ -304,45 +303,44 @@ // Changes remote lock status (on/off) // ---------------------------------------------------------- // no qtdone -EXPORT_C TInt CSecuritySettings::ChangeRemoteLockStatusL( - TBool& aRemoteLockStatus, TDes& aRemoteLockCode, TInt aAutoLockPeriod) +EXPORT_C TInt CSecuritySettings::ChangeRemoteLockStatusL(TBool& aRemoteLockStatus, TDes& aRemoteLockCode, TInt aAutoLockPeriod) { - TInt retValue( KErrNone ); - RDEBUG("aRemoteLockStatus", aRemoteLockStatus); - RDEBUG("aAutoLockPeriod", aAutoLockPeriod); + TInt retValue(KErrNone); + RDEBUG("aRemoteLockStatus", aRemoteLockStatus); + RDEBUG("aAutoLockPeriod", aAutoLockPeriod); - if ( aRemoteLockStatus ) + if (aRemoteLockStatus) { aRemoteLockStatus = ETrue; // If user wishes to enable remote lock // a new remote lock code is required. // RemoteLockCodeQueryL also - retValue = RemoteLockCodeQueryL( aRemoteLockCode ); + retValue = RemoteLockCodeQueryL(aRemoteLockCode); } else { aRemoteLockStatus = EFalse; retValue = KErrNone; - // TODO this should calculate aAutoLockPeriod itself, and not trust the input + // TODO this should calculate aAutoLockPeriod itself, and not trust the input // Check whether AutoLock is enabled (timeout value greater // than zero) or not. If AutoLock is enabled the domestic OS // device lock should be left enabled. - if ( aAutoLockPeriod == 0 ) + if (aAutoLockPeriod == 0) { // Disable lock setting from domestic OS - retValue = RemoteLockSetLockSettingL( EFalse ); + retValue = RemoteLockSetLockSettingL(EFalse); } else { // If AutoLock is enabled, don't disable the DOS device lock // Re-set (enable) the domestic OS device lock because as a // side effect it requires the security code from the user - retValue = RemoteLockSetLockSettingL( ETrue ); + retValue = RemoteLockSetLockSettingL(ETrue); } } - RDEBUG( "retValue", retValue ); + RDEBUG( "retValue", retValue ); return retValue; } // @@ -360,65 +358,71 @@ TInt CSecuritySettings::RemoteLockCodeQueryL(TDes& aRemoteLockCode) { - TInt retValue( KErrNone ); + TInt retValue(KErrNone); - // This is done because lock-code needs to be asked first. - // Enable lock setting in domestic OS. It is safe to enable the - // lock setting since RemoteLock API requires remote locking to - // be enabled when changing or setting the remote lock message. - retValue = RemoteLockSetLockSettingL( ETrue ); - RDEBUG( "retValue", retValue ); - if (retValue != KErrNone) - return retValue; + // This is done because lock-code needs to be asked first. + // Enable lock setting in domestic OS. It is safe to enable the + // lock setting since RemoteLock API requires remote locking to + // be enabled when changing or setting the remote lock message. + retValue = RemoteLockSetLockSettingL(ETrue); + RDEBUG( "retValue", retValue ); + if (retValue != KErrNone) + return retValue; aRemoteLockCode.Zero(); TInt queryAccepted = KErrCancel; - queryAccepted = KErrCancel; - CSecQueryUi * iSecQueryUi; - iSecQueryUi = CSecQueryUi::NewL(); - // this queries both, and verifies itself - queryAccepted = iSecQueryUi->SecQueryDialog( - _L("RemoteMsg-New|RemoteMsg-Ver"), aRemoteLockCode, - SEC_REMOTELOCK_CODE_MIN_LENGTH, SEC_REMOTELOCK_CODE_MAX_LENGTH, - ESecUiAlphaSupported | ESecUiCancelSupported - | ESecUiEmergencyNotSupported | ESecUiNone); - RDEBUG("aRemoteLockCode", 0); - RDebug::Print(aRemoteLockCode); - RDEBUG("queryAccepted", queryAccepted); - delete iSecQueryUi; - if (queryAccepted != KErrNone) - return KErrAbort; + queryAccepted = KErrCancel; + CSecQueryUi * iSecQueryUi; + iSecQueryUi = CSecQueryUi::NewL(); + // this queries both, and verifies itself + TBuf<0x100> title; + title.Zero(); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_rem_code")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + title.Append(_L("|")); + HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("Verify")); + title.Append(stringHolder2->Des()); + CleanupStack::PopAndDestroy(stringHolder2); + queryAccepted = iSecQueryUi->SecQueryDialog(title, aRemoteLockCode, SEC_REMOTELOCK_CODE_MIN_LENGTH, SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiAlphaSupported + | ESecUiCancelSupported | ESecUiEmergencyNotSupported | ESecUiNone); + RDEBUG("aRemoteLockCode", 0); + RDEBUGSTR(aRemoteLockCode); + RDEBUG("queryAccepted", queryAccepted); + delete iSecQueryUi; + if (queryAccepted != KErrNone) + return KErrAbort; - // Check that the new remote lock code doesn't match the security code of the device. - RMobilePhone::TMobilePhoneSecurityCode secCodeType = RMobilePhone::ESecurityCodePhonePassword; - RMobilePhone::TMobilePassword securityCode; - RMobilePhone::TMobilePassword unblockCode; // Required here only as a dummy parameter + // Check that the new remote lock code doesn't match the security code of the device. + RMobilePhone::TMobilePhoneSecurityCode secCodeType = RMobilePhone::ESecurityCodePhonePassword; + RMobilePhone::TMobilePassword securityCode; + RMobilePhone::TMobilePassword unblockCode; // Required here only as a dummy parameter - securityCode = aRemoteLockCode; - RDEBUG( "EMobilePhoneVerifySecurityCode", EMobilePhoneVerifySecurityCode ); - iWait->SetRequestType( EMobilePhoneVerifySecurityCode ); - RDEBUG( "VerifySecurityCode", 0 ); - iPhone.VerifySecurityCode( iWait->iStatus, secCodeType, securityCode, unblockCode ); - RDEBUG( "WaitForRequestL", 0 ); - TInt res = iWait->WaitForRequestL(); - RDEBUG( "WaitForRequestL res", res ); + securityCode = aRemoteLockCode; + RDEBUG( "EMobilePhoneVerifySecurityCode", EMobilePhoneVerifySecurityCode ); + 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 == KErrTimedOut) - res = KErrGsm0707IncorrectPassword; // KErrGsm0707IncorrectPassword = incorrect code + if (res == KErrNotSupported || res == KErrTimedOut) + res = KErrGsm0707IncorrectPassword; // KErrGsm0707IncorrectPassword = incorrect code #endif - RDEBUG( "KErrGsm0707IncorrectPassword", KErrGsm0707IncorrectPassword ); - if(res == KErrNone) - { - // The message is also valid as a lock-code, this means that - // remote lock code matches the security code - // and that is not allowed - RDEBUG( "return KErrCancel because msg matches code", KErrCancel ); - ShowResultNoteL(R_REMOTELOCK_INVALID_CODE, CAknNoteDialog::EErrorTone); - return KErrCancel; - } + RDEBUG( "KErrGsm0707IncorrectPassword", KErrGsm0707IncorrectPassword ); + if (res == KErrNone) + { + // The message is also valid as a lock-code, this means that + // remote lock code matches the security code + // and that is not allowed + RDEBUG( "return KErrCancel because msg matches code", KErrCancel ); + ShowResultNoteL(R_REMOTELOCK_INVALID_CODE, CAknNoteDialog::EErrorTone); + return KErrCancel; + } - RDEBUG( "retValue", retValue ); + RDEBUG( "retValue", retValue ); return retValue; } // @@ -430,14 +434,12 @@ // qtdone TInt CSecuritySettings::RemoteLockSetLockSettingL(TBool aLockSetting) { - TInt retValue( KErrNone ); - RDEBUG( "aLockSetting", aLockSetting ); - + TInt retValue(KErrNone); + RDEBUG( "aLockSetting", aLockSetting ); RMobilePhone::TMobilePhoneLockSetting lockSetting = RMobilePhone::ELockSetEnabled; RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; - RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); @@ -457,11 +459,11 @@ } #endif User::LeaveIfError(status); - RDEBUG("current lockInfo.iSetting", lockInfo.iSetting); + RDEBUG("current lockInfo.iSetting", lockInfo.iSetting); - // disabled->disabled should not happen - // enabled->enabled happens because a change of message also forces a code re-validation - if ( aLockSetting ) + // disabled->disabled should not happen + // enabled->enabled happens because a change of message also forces a code re-validation + if (aLockSetting) { lockSetting = RMobilePhone::ELockSetEnabled; } @@ -469,41 +471,41 @@ { lockSetting = RMobilePhone::ELockSetDisabled; } - RDEBUG("future lockSetting", lockSetting); + RDEBUG("future lockSetting", lockSetting); - iWait->SetRequestType( EMobilePhoneSetLockSetting ); + iWait->SetRequestType(EMobilePhoneSetLockSetting); RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); RDEBUG( "SetLockSetting", 0 ); - iPhone.SetLockSetting( iWait->iStatus, lockType, lockSetting ); // this will PassPhraseRequiredL + iPhone.SetLockSetting(iWait->iStatus, lockType, lockSetting); // this will PassPhraseRequiredL RDEBUG( "WaitForRequestL", 0 ); retValue = iWait->WaitForRequestL(); RDEBUG( "WaitForRequestL retValue", retValue ); #ifdef __WINS__ if (retValue == KErrNotSupported || retValue == KErrTimedOut) - retValue = KErrNone; + retValue = KErrNone; #endif - switch( retValue ) + switch (retValue) { case KErrNone: - break; + break; case KErrGsmSSPasswordAttemptsViolation: case KErrLocked: case KErrGsm0707IncorrectPassword: case KErrAccessDenied: - // Security code was entered erroneously - //Error note is shown in CSecurityHandler::PassPhraseRequired() - break; + // Security code was entered erroneously + //Error note is shown in CSecurityHandler::PassPhraseRequired() + break; case KErrAbort: - break; + break; default: - break; + break; } - RDEBUG( "retValue", retValue ); + RDEBUG( "retValue", retValue ); return retValue; } @@ -519,7 +521,7 @@ * Series 60 Customer / ETel * Series 60 ETel API *****************************************************/ - RDEBUG("0", 0); + RDEBUG("0", 0); RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneToICC; @@ -542,7 +544,7 @@ #endif User::LeaveIfError(status); TInt currentItem = 0; - RDEBUG("lockInfo.iSetting", lockInfo.iSetting); + RDEBUG("lockInfo.iSetting", lockInfo.iSetting); if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) { currentItem = 1; // off @@ -559,8 +561,7 @@ RDEBUG("lockChangeSetting", lockChangeSetting); iWait->SetRequestType(EMobilePhoneSetLockSetting); - RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, - ESecurityUIsQueryRequestOk); + RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); RDEBUG("SetLockSetting", 0); iPhone.SetLockSetting(iWait->iStatus, lockType, lockChangeSetting); // this invokes the handler RDEBUG("WaitForRequestL", 0); @@ -568,11 +569,11 @@ RDEBUG("WaitForRequestL status", status); #ifdef __WINS__ if (status == KErrNotSupported || status == KErrTimedOut) - status = KErrNone; + status = KErrNone; #endif // the error was displayed in the handler - RDEBUG("status", status); + RDEBUG("status", status); switch (status) { case KErrNone: @@ -618,16 +619,14 @@ iOldPassword.Copy(_L("")); TBuf<0x80> iCaption; - iCaption.Copy(_L("ChangePinRequestL")); + iCaption.Copy(_L("ChangePinRequestL")); // no need to translate. Not used TInt iShowError = 1; - TInt err = ChangePinRequestParamsL( - 1/* it's imposible to know if we want to set or clear*/, - iOldPassword, iFlags, iCaption, iShowError); + TInt err = ChangePinRequestParamsL(1/* it's imposible to know if we want to set or clear*/, iOldPassword, iFlags, iCaption, iShowError); RDEBUG("err", err); - if(err==KErrNone) - return ETrue; - else - return EFalse; + if (err == KErrNone) + return ETrue; + else + return EFalse; } // @@ -638,11 +637,10 @@ // qtdone EXPORT_C TBool CSecuritySettings::ChangeUPinRequestL() { - TBool wcdmaSupported( - FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma)); - TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin)); - RDEBUG("wcdmaSupported", wcdmaSupported); - RDEBUG("upinSupported", upinSupported); + TBool wcdmaSupported(FeatureManager::FeatureSupported(KFeatureIdProtocolWcdma)); + TBool upinSupported(FeatureManager::FeatureSupported(KFeatureIdUpin)); + RDEBUG("wcdmaSupported", wcdmaSupported); + RDEBUG("upinSupported", upinSupported); if (wcdmaSupported || upinSupported) { TInt simState; @@ -659,11 +657,9 @@ RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); - RMobilePhone::TMobilePhoneLock lockType = - RMobilePhone::ELockUniversalPin; + RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockUniversalPin; - RMobilePhone::TMobilePhoneLockSetting lockChangeSetting = - RMobilePhone::ELockSetDisabled; + RMobilePhone::TMobilePhoneLockSetting lockChangeSetting = RMobilePhone::ELockSetDisabled; //get lock info iWait->SetRequestType(EMobilePhoneGetLockInfo); @@ -674,12 +670,12 @@ RDEBUG("WaitForRequestL status", status); #ifdef __WINS__ if (status == KErrNotSupported || status == KErrTimedOut) - status = KErrNone; + status = KErrNone; #endif User::LeaveIfError(status); TInt currentItem = 0; - RDEBUG("lockInfo.iSetting", lockInfo.iSetting); + RDEBUG("lockInfo.iSetting", lockInfo.iSetting); if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) { currentItem = 1; // off @@ -693,26 +689,23 @@ { lockChangeSetting = RMobilePhone::ELockSetEnabled; } - RDEBUG("lockChangeSetting", lockChangeSetting); + RDEBUG("lockChangeSetting", lockChangeSetting); // 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); + RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSecUIOriginated); // Change the lock setting iWait->SetRequestType(EMobilePhoneSetLockSetting); - RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, - ESecurityUIsQueryRequestOk); + RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); RDEBUG("SetLockSetting", 0); iPhone.SetLockSetting(iWait->iStatus, lockType, lockChangeSetting); // this calls something in the handler RDEBUG("WaitForRequestL", 0); status = iWait->WaitForRequestL(); RDEBUG("WaitForRequestL status", status); // Lower the flag - RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, - ESecurityUIsSecUIOriginatedUninitialized); + RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSecUIOriginatedUninitialized); #ifdef __WINS__ if (status == KErrNotSupported || status == KErrTimedOut) - status = KErrNone; + status = KErrNone; #endif // no need to show errors because they were displayed in the Handler @@ -725,8 +718,7 @@ case KErrGsm0707OperationNotAllowed: { // not allowed with this sim - ShowResultNoteL(R_OPERATION_NOT_ALLOWED, - CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); return EFalse; } case KErrGsm0707IncorrectPassword: @@ -766,11 +758,10 @@ // qtdone EXPORT_C TBool CSecuritySettings::SwitchPinCodesL() { - TBool wcdmaSupported( - FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma)); - TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin)); - RDEBUG("wcdmaSupported", wcdmaSupported); - RDEBUG("upinSupported", upinSupported); + TBool wcdmaSupported(FeatureManager::FeatureSupported(KFeatureIdProtocolWcdma)); + TBool upinSupported(FeatureManager::FeatureSupported(KFeatureIdUpin)); + RDEBUG("wcdmaSupported", wcdmaSupported); + RDEBUG("upinSupported", upinSupported); if (wcdmaSupported || upinSupported) { // If we are in simless offline mode the PIN codes can't obviously be switched @@ -786,17 +777,15 @@ return EFalse; } - RMobilePhone::TMobilePhoneLock lockType = - RMobilePhone::ELockUniversalPin; - RMobilePhone::TMobilePhoneLockSetting lockChangeSetting = - RMobilePhone::ELockReplaced; + RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockUniversalPin; + RMobilePhone::TMobilePhoneLockSetting lockChangeSetting = RMobilePhone::ELockReplaced; RMobilePhone::TMobilePhoneSecurityCode activeCode; iCustomPhone.GetActivePin(activeCode); RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); - RDEBUG("EMobilePhoneGetLockInfo", EMobilePhoneGetLockInfo); + RDEBUG("EMobilePhoneGetLockInfo", EMobilePhoneGetLockInfo); iWait->SetRequestType(EMobilePhoneGetLockInfo); if (activeCode == RMobilePhone::ESecurityUniversalPin) @@ -808,7 +797,7 @@ RDEBUG("WaitForRequestL res", res); #ifdef __WINS__ if (res == KErrNotSupported || res == KErrTimedOut) - res = KErrNone; + res = KErrNone; #endif User::LeaveIfError(res); } @@ -821,20 +810,19 @@ RDEBUG("WaitForRequestL res", res); #ifdef __WINS__ if (res == KErrNotSupported || res == KErrTimedOut) - res = KErrNone; + res = KErrNone; #endif User::LeaveIfError(res); } // code request must be ON to change active code. - RDEBUG("lockInfo.iSetting", lockInfo.iSetting); + RDEBUG("lockInfo.iSetting", lockInfo.iSetting); if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) { if (activeCode != RMobilePhone::ESecurityUniversalPin) { - ShowResultNoteL(R_UPIN_NOT_ALLOWED, - CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_UPIN_NOT_ALLOWED, CAknNoteDialog::EErrorTone); } else { @@ -846,7 +834,7 @@ iCustomPhone.GetActivePin(activeCode); TInt currentItem = 0; - RDEBUG("activeCode", activeCode); + RDEBUG("activeCode", activeCode); if (activeCode == RMobilePhone::ESecurityUniversalPin) { currentItem = 1; // UPIN @@ -859,27 +847,24 @@ { lockType = RMobilePhone::ELockICC; } - RDEBUG("lockType", lockType); + RDEBUG("lockType", lockType); // 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); + RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSecUIOriginated); // Change the lock setting iWait->SetRequestType(EMobilePhoneSetLockSetting); - RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, - ESecurityUIsQueryRequestOk); + RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); RDEBUG("SetLockSetting", 0); iPhone.SetLockSetting(iWait->iStatus, lockType, lockChangeSetting); // request from handler RDEBUG("WaitForRequestL", 0); TInt status = iWait->WaitForRequestL(); RDEBUG("WaitForRequestL status", status); // Lower the flag - RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, - ESecurityUIsSecUIOriginatedUninitialized); + RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSecUIOriginatedUninitialized); #ifdef __WINS__ if (status == KErrNotSupported || status == KErrTimedOut) - status = KErrNone; + status = KErrNone; #endif // errors are shown in the handler @@ -892,8 +877,7 @@ case KErrGsm0707OperationNotAllowed: { // not allowed with this sim - ShowResultNoteL(R_OPERATION_NOT_ALLOWED, - CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); return EFalse; } case KErrGsm0707IncorrectPassword: @@ -930,8 +914,7 @@ // Return is lock enabled/disabled // ---------------------------------------------------------- // qtdone -EXPORT_C TBool CSecuritySettings::IsLockEnabledL( - RMobilePhone::TMobilePhoneLock aLockType) +EXPORT_C TBool CSecuritySettings::IsLockEnabledL(RMobilePhone::TMobilePhoneLock aLockType) { TBool ret = EFalse; RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; @@ -979,10 +962,8 @@ RDEBUG("0", 0); TInt retPhone = 0; // check if pin2 is blocked... - RMmCustomAPI::TSecurityCodeType secCodeType = - RMmCustomAPI::ESecurityCodePin2; - RMobilePhone::TMobilePhoneSecurityCode etelsecCodeType( - RMobilePhone::ESecurityCodePin2); + RMmCustomAPI::TSecurityCodeType secCodeType = RMmCustomAPI::ESecurityCodePin2; + RMobilePhone::TMobilePhoneSecurityCode etelsecCodeType(RMobilePhone::ESecurityCodePin2); RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); RMobilePhone::TMobilePassword password; @@ -995,7 +976,7 @@ RDEBUG("isBlocked", isBlocked); #ifdef __WINS__ if (retPhone == KErrNotSupported || retPhone == KErrTimedOut) - retPhone = KErrNone; + retPhone = KErrNone; #endif if (isBlocked) return EFalse; @@ -1010,13 +991,11 @@ case KErrGsmSSPasswordAttemptsViolation: case KErrLocked: // Pin2 features blocked permanently! - ShowResultNoteL(R_PIN2_REJECTED, - CAknNoteDialog::EConfirmationTone); + ShowResultNoteL(R_PIN2_REJECTED, CAknNoteDialog::EConfirmationTone); break; case KErrGsm0707SimNotInserted: // not allowed with this sim - ShowResultNoteL(R_OPERATION_NOT_ALLOWED, - CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); break; default: ShowErrorNoteL(retPhone); @@ -1051,15 +1030,15 @@ iSecQueryUi = CSecQueryUi::NewL(); TBuf<0x100> title; title.Zero(); - title.Append(_L("PIN2")); - title.Append(_L("#")); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_pin2_code")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + 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); + 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); + RDEBUGSTR(password); RDEBUG("queryAccepted", queryAccepted); delete iSecQueryUi; if (queryAccepted != KErrNone) @@ -1069,14 +1048,13 @@ RMobilePhone::TMobilePassword required_fourth; iWait->SetRequestType(EMobilePhoneVerifySecurityCode); RDEBUG("VerifySecurityCode", 0); - iPhone.VerifySecurityCode(iWait->iStatus, etelsecCodeType, password, - required_fourth); + iPhone.VerifySecurityCode(iWait->iStatus, etelsecCodeType, password, required_fourth); RDEBUG("WaitForRequestL", 0); retPhone = iWait->WaitForRequestL(); RDEBUG("WaitForRequestL retPhone", retPhone); #ifdef __WINS__ if (retPhone == KErrNotSupported) - retPhone = KErrNone; + retPhone = KErrNone; #endif switch (retPhone) @@ -1090,8 +1068,7 @@ return AskPin2L(); case KErrGsm0707OperationNotAllowed: // not allowed with this sim - ShowResultNoteL(R_OPERATION_NOT_ALLOWED, - CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); return EFalse; case KErrGsmSSPasswordAttemptsViolation: case KErrLocked: @@ -1117,9 +1094,8 @@ * Series 60 Customer / ETel * Series 60 ETel API *****************************************************/ - RDEBUG("0", 0); - RMmCustomAPI::TSecurityCodeType secCodeType = - RMmCustomAPI::ESecurityCodePin2; + RDEBUG("0", 0); + RMmCustomAPI::TSecurityCodeType secCodeType = RMmCustomAPI::ESecurityCodePin2; TBool isBlocked = EFalse; TInt ret = iCustomPhone.IsBlocked(secCodeType, isBlocked); @@ -1138,13 +1114,11 @@ case KErrGsmSSPasswordAttemptsViolation: case KErrLocked: // Pin2 features blocked permanently! - ShowResultNoteL(R_PIN2_REJECTED, - CAknNoteDialog::EConfirmationTone); + ShowResultNoteL(R_PIN2_REJECTED, CAknNoteDialog::EConfirmationTone); break; case KErrGsm0707SimNotInserted: // not allowed with this sim - ShowResultNoteL(R_OPERATION_NOT_ALLOWED, - CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); break; default: ShowErrorNoteL(ret); @@ -1171,8 +1145,7 @@ RDEBUG("fdnSet", fdnSet); // Change the FDN setting iWait->SetRequestType(EMobilePhoneSetFdnSetting); - RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, - ESecurityUIsQueryRequestOk); + RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); RDEBUG("SetFdnSetting", 0); iPhone.SetFdnSetting(iWait->iStatus, fdnSet); RDEBUG("WaitForRequestL", 0); @@ -1180,10 +1153,10 @@ RDEBUG("WaitForRequestL status", status); #ifdef __WINS__ if (status == KErrNotSupported) - status = KErrNone; + status = KErrNone; #endif - RDEBUG("status", status); + RDEBUG("status", status); switch (status) { case KErrNone: @@ -1200,8 +1173,7 @@ break; case KErrGsm0707OperationNotAllowed: // not allowed with this sim - ShowResultNoteL(R_OPERATION_NOT_ALLOWED, - CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); break; default: ShowErrorNoteL(status); @@ -1214,14 +1186,13 @@ // Retrieves the current Fixed Dialling Numbers mode // ---------------------------------------------------------- // qtdone -EXPORT_C TInt CSecuritySettings::GetFdnMode( - RMobilePhone::TMobilePhoneFdnStatus& aFdnMode) +EXPORT_C TInt CSecuritySettings::GetFdnMode(RMobilePhone::TMobilePhoneFdnStatus& aFdnMode) { /***************************************************** * Series 60 Customer / ETel * Series 60 ETel API *****************************************************/ - RDEBUG("0", 0); + RDEBUG("0", 0); return iPhone.GetFdnStatus(aFdnMode); } @@ -1244,15 +1215,13 @@ // Shows result note // ---------------------------------------------------------- // qtdone -void CSecuritySettings::ShowResultNoteL(TInt aResourceID, - CAknNoteDialog::TTone aTone) +void CSecuritySettings::ShowResultNoteL(TInt aResourceID, CAknNoteDialog::TTone aTone) { RDEBUG("aResourceID", aResourceID); - CHbDeviceMessageBoxSymbian* messageBox = - CHbDeviceMessageBoxSymbian::NewL( - CHbDeviceMessageBoxSymbian::EWarning); + CHbDeviceMessageBoxSymbian* messageBox = CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EWarning); CleanupStack::PushL(messageBox); + TInt satisfactoryIcon = 0; // might change later, in some scenarios _LIT(KText, "ShowResultNoteL: "); TBuf<0x200> title; TBuf<0x200> titleTr; @@ -1267,13 +1236,14 @@ case 0: titleTr.Append(_L("OK")); title.Append(_L("OK")); + satisfactoryIcon = 1; break; case KErrGsm0707IncorrectPassword: - titleTr.Append(_L("KErrGsm0707IncorrectPassword")); + titleTr.Append(_L("txt_pin_code_dpophead_wrong_pin_code")); // TODO this also happens for lock-code title.Append(_L("Incorrect Password")); break; case KErrAccessDenied: - titleTr.Append(_L("KErrAccessDenied")); + titleTr.Append(_L("txt_pin_code_dpopinfo_access_denied")); title.Append(_L("Access Denied")); break; case KErrGsmSSPasswordAttemptsViolation: @@ -1293,11 +1263,11 @@ title.Append(_L("Abort")); break; case KErrNotSupported: - titleTr.Append(_L("KErrNotSupported")); + titleTr.Append(_L("txt_pin_code_dpopinfo_operation_not_supported")); title.Append(_L("Not Supported")); break; case R_SEC_BLOCKED: - titleTr.Append(_L("R_SEC_BLOCKED")); + titleTr.Append(_L("txt_pin_code_dpopinfo_security_blocked")); title.Append(_L("BLOCKED")); break; case R_CODE_ERROR: @@ -1305,27 +1275,30 @@ title.Append(_L("ERROR")); break; case KErrGsmInvalidParameter: - titleTr.Append(_L("KErrGsmInvalidParameter")); + titleTr.Append(_L("txt_pin_code_dpopinfo_gsm_invalid_parameter")); title.Append(_L("Invalid Parameter")); break; case R_CONFIRMATION_NOTE: titleTr.Append(_L("R_CONFIRMATION_NOTE")); title.Append(_L("CONFIRMED")); + satisfactoryIcon = 1; break; case R_CODES_DONT_MATCH: titleTr.Append(_L("R_CODES_DONT_MATCH")); title.Append(_L("CODES DONT MATCH")); break; case R_PIN_CODE_CHANGED_NOTE: - titleTr.Append(_L("R_PIN_CODE_CHANGED_NOTE")); + titleTr.Append(_L("txt_pin_code_dpopinfo_code_chaged")); // note the spelling mistake "chaged" title.Append(_L("PIN CODE CHANGED")); + satisfactoryIcon = 1; break; case R_SECURITY_CODE_CHANGED_NOTE: titleTr.Append(_L("R_SECURITY_CODE_CHANGED_NOTE")); title.Append(_L("SECURITY CODE CHANGED")); + satisfactoryIcon = 1; break; case R_SECUI_TEXT_AUTOLOCK_MUST_BE_ACTIVE: - titleTr.Append(_L("R_SECUI_TEXT_AUTOLOCK_MUST_BE_ACTIVE")); + titleTr.Append(_L("txt_pin_code_dpopinfo_autolock_must_be_active")); title.Append(_L("AUTOLOCK MUST BE ACTIVE")); break; case KErrServerTerminated: @@ -1337,7 +1310,7 @@ title.Append(_L("Server Busy")); break; case R_PIN2_REJECTED: - titleTr.Append(_L("R_PIN2_REJECTED")); + titleTr.Append(_L("txt_pin_code_dpopinfo_pin2_rejected")); title.Append(_L("PIN2 REJECTED")); break; case R_OPERATION_NOT_ALLOWED: @@ -1345,7 +1318,7 @@ title.Append(_L("OPERATION NOT ALLOWED")); break; case R_UPIN_NOT_ALLOWED: - titleTr.Append(_L("R_UPIN_NOT_ALLOWED")); + titleTr.Append(_L("txt_pin_code_dpopinfo_upin_not_allowed")); title.Append(_L("UPIN NOT ALLOWED")); break; case R_PIN_NOT_ALLOWED: @@ -1353,7 +1326,7 @@ title.Append(_L("PIN NOT ALLOWED")); break; case R_INSERT_SIM: - titleTr.Append(_L("R_INSERT_SIM")); + titleTr.Append(_L("txt_pin_code_dpopinfo_insert_sim")); title.Append(_L("INSERT SIM")); break; case R_SIM_ON: @@ -1389,29 +1362,108 @@ title.Append(_L("REMOTELOCK INVALID CODE")); break; + case KErrTDevicelockPolicies+EDeviceLockAutolockperiod: + titleTr.Append(_L("EDeviceLockAutolockperiod")); + title.Append(_L("EDeviceLockAutolockperiod")); + break; + case KErrTDevicelockPolicies+EDeviceLockMaxAutolockPeriod: + titleTr.Append(_L("EDeviceLockMaxAutolockPeriod")); + title.Append(_L("EDeviceLockMaxAutolockPeriod")); + break; + case KErrTDevicelockPolicies+EDeviceLockMinlength: + titleTr.Append(_L("EDeviceLockMinlength")); + title.Append(_L("EDeviceLockMinlength")); + break; + case KErrTDevicelockPolicies+EDeviceLockMaxlength: + titleTr.Append(_L("EDeviceLockMaxlength")); + title.Append(_L("EDeviceLockMaxlength")); + break; + case KErrTDevicelockPolicies+EDeviceLockRequireUpperAndLower: + titleTr.Append(_L("EDeviceLockRequireUpperAndLower")); + title.Append(_L("EDeviceLockRequireUpperAndLower")); + break; + case KErrTDevicelockPolicies+EDeviceLockRequireCharsAndNumbers: + titleTr.Append(_L("EDeviceLockRequireCharsAndNumbers")); + title.Append(_L("EDeviceLockRequireCharsAndNumbers")); + break; + case KErrTDevicelockPolicies+EDeviceLockAllowedMaxRepeatedChars: + titleTr.Append(_L("EDeviceLockAllowedMaxRepeatedChars")); + title.Append(_L("EDeviceLockAllowedMaxRepeatedChars")); + break; + case KErrTDevicelockPolicies+EDeviceLockHistoryBuffer: + titleTr.Append(_L("EDeviceLockHistoryBuffer")); + title.Append(_L("EDeviceLockHistoryBuffer")); + break; + case KErrTDevicelockPolicies+EDeviceLockPasscodeExpiration: + titleTr.Append(_L("EDeviceLockPasscodeExpiration")); + title.Append(_L("EDeviceLockPasscodeExpiration")); + break; + case KErrTDevicelockPolicies+EDeviceLockMinChangeTolerance: + titleTr.Append(_L("EDeviceLockMinChangeTolerance")); + title.Append(_L("EDeviceLockMinChangeTolerance")); + break; + case KErrTDevicelockPolicies+EDeviceLockMinChangeInterval: + titleTr.Append(_L("EDeviceLockMinChangeInterval")); + title.Append(_L("EDeviceLockMinChangeInterval")); + break; + case KErrTDevicelockPolicies+EDeviceLockDisallowSpecificStrings: + titleTr.Append(_L("EDeviceLockDisallowSpecificStrings")); + title.Append(_L("EDeviceLockDisallowSpecificStrings")); + break; + case KErrTDevicelockPolicies+EDeviceLockAllowedMaxAtempts: + titleTr.Append(_L("EDeviceLockAllowedMaxAtempts")); + title.Append(_L("EDeviceLockAllowedMaxAtempts")); + break; + case KErrTDevicelockPolicies+EDeviceLockConsecutiveNumbers: + titleTr.Append(_L("EDeviceLockConsecutiveNumbers")); + title.Append(_L("EDeviceLockConsecutiveNumbers")); + break; + case KErrTDevicelockPolicies+EDeviceLockMinSpecialCharacters: + titleTr.Append(_L("EDeviceLockMinSpecialCharacters")); + title.Append(_L("EDeviceLockMinSpecialCharacters")); + break; + case KErrTDevicelockPolicies+EDeviceLockSingleCharRepeatNotAllowed: + titleTr.Append(_L("EDeviceLockSingleCharRepeatNotAllowed")); + title.Append(_L("EDeviceLockSingleCharRepeatNotAllowed")); + break; + case KErrTDevicelockPolicies+EDevicelockTotalPolicies: + titleTr.Append(_L("EDevicelockTotalPolicies")); + title.Append(_L("EDevicelockTotalPolicies")); + break; + default: // " " titleTr.Append(_L("Specific Error")); title.Append(_L("Specific Error")); break; + /* These ones are still unused */ + // txt_pin_code_dpopinfo_ln_attempts_remaining + // txt_pin_code_dpopinfo_emergency_calls_only + // txt_pin_code_dpopinfo_if_failed_be_ready_with_puk } - messageBox->SetTextL(title); + + HBufC* stringHolder; + RDEBUG("titleTr", 1); + stringHolder = HbTextResolverSymbian::LoadLC(titleTr); // titleTr should I TRAP( err, ? + RDEBUG("got stringHolder", 1); + messageBox->SetTextL(stringHolder->Des()); // title RDEBUG("aResourceID", aResourceID); - RDebug::Print(titleTr); - + RDEBUGSTR(titleTr); _LIT(KIconNameWondering, "qtg_small_smiley_wondering"); _LIT(KIconNameSmile, "qtg_small_smiley_smile"); - if(aResourceID==0 || aResourceID==R_CONFIRMATION_NOTE) - messageBox->SetIconNameL(KIconNameSmile); + if (satisfactoryIcon==1) + messageBox->SetIconNameL(KIconNameSmile); else - messageBox->SetIconNameL(KIconNameWondering); + messageBox->SetIconNameL(KIconNameWondering); if (aTone == CAknNoteDialog::EErrorTone) // another case is EConfirmationTone { messageBox->SetTimeout(messageBox->Timeout() * 2); // errors are displayed double time } - - // use default timeout - messageBox->ShowL(); + // messageBox->ShowL(); + RDEBUG("calling ExecL", 0); + CHbDeviceMessageBoxSymbian::TButtonId selection = messageBox->ExecL(); // this guarantees that it waits for the dismiss/timeout + RDEBUG("called ExecL.selection", selection); + CleanupStack::PopAndDestroy(stringHolder); CleanupStack::PopAndDestroy(); // messageBox } @@ -1424,12 +1476,11 @@ // qtdone EXPORT_C TBool CSecuritySettings::IsUpinSupportedL() { - TBool wcdmaSupported( - FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma)); - TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin)); + TBool wcdmaSupported(FeatureManager::FeatureSupported(KFeatureIdProtocolWcdma)); + TBool upinSupported(FeatureManager::FeatureSupported(KFeatureIdUpin)); TBool isSupported = EFalse; - RDEBUG("wcdmaSupported", wcdmaSupported); - RDEBUG("upinSupported", upinSupported); + RDEBUG("wcdmaSupported", wcdmaSupported); + RDEBUG("upinSupported", upinSupported); if (wcdmaSupported || upinSupported) { RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; @@ -1438,8 +1489,7 @@ RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); iWait->SetRequestType(EMobilePhoneGetLockInfo); RDEBUG("GetLockInfo", 0); - iPhone.GetLockInfo(iWait->iStatus, RMobilePhone::ELockUniversalPin, - lockInfoPkg); + iPhone.GetLockInfo(iWait->iStatus, RMobilePhone::ELockUniversalPin, lockInfoPkg); RDEBUG("WaitForRequestL", 0); TInt res = iWait->WaitForRequestL(); RDEBUG("WaitForRequestL res", res); @@ -1467,9 +1517,8 @@ // qtdone EXPORT_C TBool CSecuritySettings::IsUpinBlocked() { - TBool wcdmaSupported( - FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma)); - TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin)); + TBool wcdmaSupported(FeatureManager::FeatureSupported(KFeatureIdProtocolWcdma)); + TBool upinSupported(FeatureManager::FeatureSupported(KFeatureIdUpin)); if (wcdmaSupported || upinSupported) { RMmCustomAPI::TSecurityCodeType secCodeType; @@ -1492,9 +1541,8 @@ // qtdone EXPORT_C TBool CSecuritySettings::IsUpinActive() { - TBool wcdmaSupported( - FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma)); - TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin)); + TBool wcdmaSupported(FeatureManager::FeatureSupported(KFeatureIdProtocolWcdma)); + TBool upinSupported(FeatureManager::FeatureSupported(KFeatureIdUpin)); if (wcdmaSupported || upinSupported) { RMobilePhone::TMobilePhoneSecurityCode activePin; @@ -1515,18 +1563,16 @@ /**************************/ // qtdone -EXPORT_C TInt CSecuritySettings::ChangePinParamsL( - RMobilePhone::TMobilePassword aOldPassword, - RMobilePhone::TMobilePassword aNewPassword, TInt aFlags, - TDes& aCaption, TInt aShowError) +EXPORT_C TInt CSecuritySettings::ChangePinParamsL(RMobilePhone::TMobilePassword aOldPassword, RMobilePhone::TMobilePassword aNewPassword, TInt aFlags, TDes& aCaption, + TInt aShowError) { RDEBUG("aFlags", aFlags); RDEBUG("aOldPassword", 0); - RDebug::Print(aOldPassword); + RDEBUGSTR(aOldPassword); RDEBUG("aNewPassword", 0); - RDebug::Print(aNewPassword); + RDEBUGSTR(aNewPassword); RDEBUG("aCaption", 0); - RDebug::Print(aCaption); + RDEBUGSTR(aCaption); RDEBUG("aShowError", aShowError); /***************************************************** @@ -1540,7 +1586,7 @@ User::LeaveIfError(err); TBool simRemoved(simState == ESimNotPresent); - RDEBUG("simRemoved", simRemoved); + RDEBUG("simRemoved", simRemoved); if (simRemoved) { ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); @@ -1602,7 +1648,7 @@ if (res == KErrNotSupported || res == KErrTimedOut) { res = KErrNone; - codeInfo.iRemainingEntryAttempts=KMaxNumberOfPINAttempts; + codeInfo.iRemainingEntryAttempts = KMaxNumberOfPINAttempts; } #endif User::LeaveIfError(res); @@ -1622,15 +1668,15 @@ iSecQueryUi = CSecQueryUi::NewL(); TBuf<0x100> title; title.Zero(); - title.Append(_L("PIN1-Old")); - title.Append(_L("#")); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_pin_code")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + title.Append(_L("$")); title.AppendNum(codeInfo.iRemainingEntryAttempts); - queryAccepted = iSecQueryUi->SecQueryDialog(title, oldPassword, - SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, - ESecUiAlphaNotSupported | ESecUiCancelSupported - | ESecUiEmergencyNotSupported | secCodeType); + queryAccepted = iSecQueryUi->SecQueryDialog(title, oldPassword, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported + | ESecUiEmergencyNotSupported | secCodeType); RDEBUG("oldPassword", 0); - RDebug::Print(oldPassword); + RDEBUGSTR(oldPassword); RDEBUG("queryAccepted", queryAccepted); delete iSecQueryUi; if (queryAccepted != KErrNone) @@ -1639,14 +1685,13 @@ // verify it now, so that the user doesn't need to see the error _after_ typing the new ones RDEBUG("VerifySecurityCode", 0); - iPhone.VerifySecurityCode(iWait->iStatus, secCodeType, oldPassword, - required_fourth); + iPhone.VerifySecurityCode(iWait->iStatus, secCodeType, oldPassword, required_fourth); RDEBUG("WaitForRequestL", 0); res = iWait->WaitForRequestL(); RDEBUG("WaitForRequestL res", res); #ifdef __WINS__ if (res == KErrNotSupported) - res = KErrNone; + res = KErrNone; #endif if (res != KErrNone) { @@ -1679,13 +1724,19 @@ CSecQueryUi *iSecQueryUi; iSecQueryUi = CSecQueryUi::NewL(); // this queries both, and verifies itself - queryAccepted = iSecQueryUi->SecQueryDialog(_L( - "PIN1-New|PIN1-Ver"), newPassword, - SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, - ESecUiAlphaNotSupported | ESecUiCancelSupported - | ESecUiEmergencyNotSupported | secCodeType); + TBuf<0x100> title; + title.Zero(); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_pin_code|PIN1-Ver")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + title.Append(_L("|")); + HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_verify_new_pin_code")); + title.Append(stringHolder2->Des()); + CleanupStack::PopAndDestroy(stringHolder2); + queryAccepted = iSecQueryUi->SecQueryDialog(title, newPassword, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported + | ESecUiEmergencyNotSupported | secCodeType); RDEBUG("newPassword", 1); - RDebug::Print(newPassword); + RDEBUGSTR(newPassword); RDEBUG("queryAccepted", queryAccepted); delete iSecQueryUi; if (queryAccepted != KErrNone) @@ -1698,8 +1749,8 @@ passwords.iOldPassword = oldPassword; passwords.iNewPassword = newPassword; RDEBUG("passwords", 0); - RDebug::Print(passwords.iOldPassword); - RDebug::Print(passwords.iNewPassword); + RDEBUGSTR(passwords.iOldPassword); + RDEBUGSTR(passwords.iNewPassword); RDEBUG("SetRequestType", 0); iWait->SetRequestType(EMobilePhoneChangeSecurityCode); RDEBUG("ChangeSecurityCode", 0); @@ -1709,7 +1760,7 @@ RDEBUG("WaitForRequestL res", res); #ifdef __WINS__ if (res == KErrNotSupported) - res = KErrNone; + res = KErrNone; #endif switch (res) @@ -1717,8 +1768,7 @@ case KErrNone: { // code changed - ShowResultNoteL(R_PIN_CODE_CHANGED_NOTE, - CAknNoteDialog::EConfirmationTone); + ShowResultNoteL(R_PIN_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); break; } case KErrGsm0707IncorrectPassword: @@ -1738,8 +1788,7 @@ case KErrGsm0707OperationNotAllowed: { // not allowed with this sim - ShowResultNoteL(R_OPERATION_NOT_ALLOWED, - CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); return KErrGsm0707OperationNotAllowed; } case KErrAbort: @@ -1757,24 +1806,21 @@ } /*********************************************/ // qtdone -EXPORT_C TInt CSecuritySettings::ChangeUPinParamsL( - RMobilePhone::TMobilePassword aOldPassword, - RMobilePhone::TMobilePassword aNewPassword, TInt aFlags, - TDes& aCaption, TInt aShowError) +EXPORT_C TInt CSecuritySettings::ChangeUPinParamsL(RMobilePhone::TMobilePassword aOldPassword, RMobilePhone::TMobilePassword aNewPassword, TInt aFlags, TDes& aCaption, + TInt aShowError) { RDEBUG("aFlags", aFlags); // the password parameters are not used if (aOldPassword.Length() > 0) - RDebug::Print(aOldPassword); + RDEBUGSTR(aOldPassword); if (aNewPassword.Length() > 0) - RDebug::Print(aNewPassword); + RDEBUGSTR(aNewPassword); if (aCaption.Length() > 0) - RDebug::Print(aCaption); + RDEBUGSTR(aCaption); - TBool wcdmaSupported( - FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma)); - TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin)); + TBool wcdmaSupported(FeatureManager::FeatureSupported(KFeatureIdProtocolWcdma)); + TBool upinSupported(FeatureManager::FeatureSupported(KFeatureIdUpin)); if (!(wcdmaSupported || upinSupported)) { RDEBUG("! upinSupported", upinSupported); @@ -1843,7 +1889,7 @@ if (res == KErrNotSupported || res == KErrTimedOut) { res = KErrNone; - codeInfo.iRemainingEntryAttempts=KMaxNumberOfPINAttempts; + codeInfo.iRemainingEntryAttempts = KMaxNumberOfPINAttempts; } #endif User::LeaveIfError(res); @@ -1858,15 +1904,15 @@ iSecQueryUi = CSecQueryUi::NewL(); TBuf<0x100> title; title.Zero(); - title.Append(_L("UPIN-Old")); - title.Append(_L("#")); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_upin_code")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + title.Append(_L("$")); title.AppendNum(codeInfo.iRemainingEntryAttempts); - queryAccepted = iSecQueryUi->SecQueryDialog(title, oldPassword, - SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, - ESecUiAlphaNotSupported | ESecUiCancelSupported - | ESecUiEmergencyNotSupported | secCodeType); + queryAccepted = iSecQueryUi->SecQueryDialog(title, oldPassword, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported + | ESecUiEmergencyNotSupported | secCodeType); RDEBUG("oldPassword", 0); - RDebug::Print(oldPassword); + RDEBUGSTR(oldPassword); RDEBUG("queryAccepted", queryAccepted); delete iSecQueryUi; if (queryAccepted != KErrNone) @@ -1878,13 +1924,20 @@ CSecQueryUi * iSecQueryUi; iSecQueryUi = CSecQueryUi::NewL(); // this queries both, and verifies itself - queryAccepted = iSecQueryUi->SecQueryDialog( - _L("UPIN1-New|UPIN1-Ver"), newPassword, - SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, - ESecUiAlphaNotSupported | ESecUiCancelSupported - | ESecUiEmergencyNotSupported | secCodeType); + TBuf<0x100> title; + title.Zero(); + + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_upin_code")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + title.Append(_L("|")); + HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_retype_upin_code")); + title.Append(stringHolder2->Des()); + CleanupStack::PopAndDestroy(stringHolder2); + queryAccepted = iSecQueryUi->SecQueryDialog(title, newPassword, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported + | ESecUiEmergencyNotSupported | secCodeType); RDEBUG("newPassword", 0); - RDebug::Print(newPassword); + RDEBUGSTR(newPassword); RDEBUG("queryAccepted", queryAccepted); delete iSecQueryUi; if (queryAccepted != KErrNone) @@ -1901,15 +1954,14 @@ RDEBUG("WaitForRequestL res", res); #ifdef __WINS__ if (res == KErrNotSupported) - res = KErrNone; + res = KErrNone; #endif switch (res) { case KErrNone: { // code changed - ShowResultNoteL(R_UPIN_CODE_CHANGED_NOTE, - CAknNoteDialog::EConfirmationTone); + ShowResultNoteL(R_UPIN_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); break; } case KErrGsm0707IncorrectPassword: @@ -1928,8 +1980,7 @@ case KErrGsm0707OperationNotAllowed: { // not allowed with this sim - ShowResultNoteL(R_OPERATION_NOT_ALLOWED, - CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); return KErrGsm0707OperationNotAllowed; } case KErrAbort: @@ -1947,20 +1998,18 @@ } /***************************************/ // qtdone -EXPORT_C TInt CSecuritySettings::ChangePin2ParamsL( - RMobilePhone::TMobilePassword aOldPassword, - RMobilePhone::TMobilePassword aNewPassword, TInt aFlags, - TDes& aCaption, TInt aShowError) +EXPORT_C TInt CSecuritySettings::ChangePin2ParamsL(RMobilePhone::TMobilePassword aOldPassword, RMobilePhone::TMobilePassword aNewPassword, TInt aFlags, TDes& aCaption, + TInt aShowError) { RDEBUG("aFlags", aFlags); // the password parameters are not used if (aOldPassword.Length() > 0) - RDebug::Print(aOldPassword); + RDEBUGSTR(aOldPassword); if (aNewPassword.Length() > 0) - RDebug::Print(aNewPassword); + RDEBUGSTR(aNewPassword); if (aCaption.Length() > 0) - RDebug::Print(aCaption); + RDEBUGSTR(aCaption); TInt simState; TInt err(KErrGeneral); @@ -1995,7 +2044,7 @@ RDEBUG("ret", ret); #ifdef __WINS__ if (ret == KErrNotSupported) - ret = KErrNone; + ret = KErrNone; #endif if (ret != KErrNone) @@ -2008,13 +2057,11 @@ case KErrGsmSSPasswordAttemptsViolation: case KErrLocked: // Pin2 features blocked permanently! - ShowResultNoteL(R_PIN2_REJECTED, - CAknNoteDialog::EConfirmationTone); + ShowResultNoteL(R_PIN2_REJECTED, CAknNoteDialog::EConfirmationTone); break; case KErrGsm0707SimNotInserted: // not allowed with this sim - ShowResultNoteL(R_OPERATION_NOT_ALLOWED, - CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); break; default: ShowErrorNoteL(ret); @@ -2033,7 +2080,7 @@ ret = iWait->WaitForRequestL(); RDEBUG("WaitForRequestL ret", ret); #ifdef __WINS__ - if ( ret == KErrNotSupported || ret == KErrTimedOut) + if (ret == KErrNotSupported || ret == KErrTimedOut) { codeInfo.iRemainingEntryAttempts = 1; ret = KErrNone; @@ -2052,15 +2099,15 @@ iSecQueryUi = CSecQueryUi::NewL(); TBuf<0x100> title; title.Zero(); - title.Append(_L("PIN2-Old")); - title.Append(_L("#")); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_pin2_code")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + 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); + 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); + RDEBUGSTR(oldPassword); RDEBUG("queryAccepted", queryAccepted); delete iSecQueryUi; if (queryAccepted != KErrNone) @@ -2073,13 +2120,19 @@ 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); + TBuf<0x100> title; + title.Zero(); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_pin2_code PIN2-Ver")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + title.Append(_L("|")); + HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("Verify")); + title.Append(stringHolder2->Des()); + CleanupStack::PopAndDestroy(stringHolder2); + queryAccepted = iSecQueryUi->SecQueryDialog(title, newPassword, SEC_C_PIN2_CODE_MIN_LENGTH, SEC_C_PIN2_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported + | ESecUiEmergencyNotSupported | secCodeType); RDEBUG("newPassword", 0); - RDebug::Print(newPassword); + RDEBUGSTR(newPassword); RDEBUG("queryAccepted", queryAccepted); delete iSecQueryUi; if (queryAccepted != KErrNone) @@ -2097,15 +2150,14 @@ RDEBUG("WaitForRequestL res", res); #ifdef __WINS__ if (res == KErrNotSupported) - res = KErrNone; + res = KErrNone; #endif switch (res) { case KErrNone: { // code changed - ShowResultNoteL(R_PIN2_CODE_CHANGED_NOTE, - CAknNoteDialog::EConfirmationTone); + ShowResultNoteL(R_PIN2_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); break; } case KErrGsm0707IncorrectPassword: @@ -2129,8 +2181,7 @@ case KErrGsm0707OperationNotAllowed: { // not allowed with this sim - ShowResultNoteL(R_OPERATION_NOT_ALLOWED, - CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); return KErrGsm0707OperationNotAllowed; } case KErrAbort: @@ -2148,10 +2199,8 @@ } /************************************************/ // qtdone -EXPORT_C TInt CSecuritySettings::ChangeSecCodeParamsL( - RMobilePhone::TMobilePassword aOldPassword, - RMobilePhone::TMobilePassword aNewPassword, TInt aFlags, - TDes& aCaption, TInt aShowError) +EXPORT_C TInt CSecuritySettings::ChangeSecCodeParamsL(RMobilePhone::TMobilePassword aOldPassword, RMobilePhone::TMobilePassword aNewPassword, TInt aFlags, TDes& aCaption, + TInt aShowError) { RDEBUG("aFlags", aFlags); RDEBUG("aShowError", aShowError); @@ -2169,18 +2218,58 @@ RMobilePhone::TMobilePassword required_fourth; RMobilePhone::TMobilePhonePasswordChangeV1 passwords; + // confirm that it can be changed now + { + RArray aFailedPolicies; + TDevicelockPolicies failedPolicy; + TInt retLockcode = KErrNone; + RSCPClient scpClient; + retLockcode = scpClient.Connect(); + RDEBUG( "retLockcode", retLockcode ); + if(retLockcode == KErrNone ) + { + RDEBUG( "scpClient.VerifyNewLockcodeAgainstPolicies", 0 ); + retLockcode = scpClient.IsLockcodeChangeAllowedNow( aFailedPolicies ); + RDEBUG( "retLockcode", retLockcode ); + RDEBUG( "aFailedPolicies.Count()", aFailedPolicies.Count() ); + res = retLockcode; + for(TInt i=0; iSecQueryDialog(_L("Lock-Old"), - oldPassword, SEC_C_SECURITY_CODE_MIN_LENGTH, - SEC_C_SECURITY_CODE_MAX_LENGTH, ESecUiAlphaSupported - | ESecUiCancelSupported | ESecUiEmergencyNotSupported - | secCodeType); + TBuf<0x100> title; + title.Zero(); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_sec_code")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + queryAccepted = iSecQueryUi->SecQueryDialog(title, oldPassword, SEC_C_SECURITY_CODE_MIN_LENGTH, SEC_C_SECURITY_CODE_MAX_LENGTH, ESecUiAlphaSupported + | ESecUiCancelSupported | ESecUiEmergencyNotSupported | secCodeType); RDEBUG("oldPassword", 0); - RDebug::Print(oldPassword); + RDEBUGSTR(oldPassword); RDEBUG("queryAccepted", queryAccepted); delete iSecQueryUi; if (queryAccepted != KErrNone) @@ -2189,22 +2278,22 @@ } else { + RDEBUG("parameter includes oldPassword", 1); oldPassword.Copy(aOldPassword); newPassword.Copy(aNewPassword); } + // check current code before proceeding RDEBUG("EMobilePhoneVerifySecurityCode", EMobilePhoneVerifySecurityCode); - iWait->SetRequestType(EMobilePhoneVerifySecurityCode); - // check code before proceeding + iWait->SetRequestType(EMobilePhoneVerifySecurityCode); // 0x59F1 RDEBUG("VerifySecurityCode", 0); - iPhone.VerifySecurityCode(iWait->iStatus, secCodeType, oldPassword, - required_fourth); + iPhone.VerifySecurityCode(iWait->iStatus, secCodeType, oldPassword, required_fourth); RDEBUG("WaitForRequestL", 0); res = iWait->WaitForRequestL(); RDEBUG("WaitForRequestL res", res); #ifdef __WINS__ if (res == KErrNotSupported) - res = KErrNone; + res = KErrNone; #endif if (res != KErrNone) @@ -2226,15 +2315,20 @@ iSecQueryUi = CSecQueryUi::NewL(); // will ask both codes and compare itself // mix, max , alpha is handled using TARM params, in the dialog itself - TInt lType = ESecUiAlphaSupported | ESecUiCancelSupported - | ESecUiEmergencyNotSupported | secCodeType; + TInt lType = ESecUiAlphaSupported | ESecUiCancelSupported | ESecUiEmergencyNotSupported | secCodeType; RDEBUG("lType", lType); - queryAccepted = iSecQueryUi->SecQueryDialog(_L( - "Lock-New|Lock-Verif"), newPassword, - SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, - lType); + TBuf<0x100> title; + title.Zero(); + HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_sec_code")); + title.Append(stringHolder->Des()); + CleanupStack::PopAndDestroy(stringHolder); + title.Append(_L("|")); + HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("Verify")); + title.Append(stringHolder2->Des()); + CleanupStack::PopAndDestroy(stringHolder2); + queryAccepted = iSecQueryUi->SecQueryDialog(title, newPassword, SEC_C_SECURITY_CODE_MIN_LENGTH, SEC_C_SECURITY_CODE_MAX_LENGTH, lType); RDEBUG("newPassword", 0); - RDebug::Print(newPassword); + RDEBUGSTR(newPassword); RDEBUG("queryAccepted", queryAccepted); delete iSecQueryUi; if (queryAccepted != KErrNone) @@ -2243,6 +2337,36 @@ } // while + // Confirm that the new code is nice. + // This is also done on every key-press in the dialog, but it doesn't harm to repeat. + // In fact this is needed for the case when newPassword is provided. + RArray aFailedPolicies; + TDevicelockPolicies failedPolicy; + TInt retLockcode = KErrNone; + RSCPClient scpClient; + retLockcode = scpClient.Connect(); + RDEBUG( "retLockcode", retLockcode ); + if(retLockcode == KErrNone ) + { + RDEBUG( "scpClient.VerifyNewLockcodeAgainstPolicies", 0 ); + retLockcode = scpClient.VerifyNewLockcodeAgainstPolicies( newPassword, aFailedPolicies ); + RDEBUG( "retLockcode", retLockcode ); + RDEBUG( "aFailedPolicies.Count()", aFailedPolicies.Count() ); + for(TInt i=0; iSetRequestType(EMobilePhoneSetLockSetting); RDEBUG("SetLockSetting", 0); iPhone.SetLockSetting(iWait->iStatus, lockType, lockChangeSetting); @@ -2274,7 +2396,7 @@ RDEBUG("WaitForRequestL res", res); #ifdef __WINS__ if (res == KErrNotSupported || res == KErrTimedOut) - res = KErrNone; + res = KErrNone; #endif } } @@ -2284,34 +2406,62 @@ { case KErrNone: { - // code changed - ShowResultNoteL(R_SECURITY_CODE_CHANGED_NOTE, - CAknNoteDialog::EConfirmationTone); + // code changed ... unless TARM rejects it { // 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); + TSCPSecCode newScpCode; + TSCPSecCode oldScpCode; + newScpCode.Copy(newPassword); + oldScpCode.Copy(oldPassword); if (scpClient.Connect() == KErrNone) { - RDEBUG("scpClient.StoreCode", 0); - // this is the old method. Obsolete now - // 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 aFailedPolicies; + TDevicelockPolicies failedPolicy; + TInt retLockcode = KErrNone; + retLockcode = scpClient.StoreLockcode(newScpCode, oldScpCode, aFailedPolicies); + RDEBUG( "retLockcode", retLockcode ); + RDEBUG( "KErrAccessDenied", KErrAccessDenied ); + RDEBUG( "aFailedPolicies.Count()", aFailedPolicies.Count() ); + for (TInt i = 0; i < aFailedPolicies.Count(); i++) + { + failedPolicy = aFailedPolicies[i]; + RDEBUG( "failedPolicy", failedPolicy ); + } + // Don't know what to do if TARM fails. Hopefully it was stopped at typing, as well as VerifyNewLockcodeAgainstPolicies + // The code is already changed in iPhone ! + // For now, just undo the changed password + if(retLockcode!=KErrNone) + { + RDEBUG("Undo password change because retLockcode", retLockcode); + ShowResultNoteL(retLockcode, CAknNoteDialog::EConfirmationTone); + + // go back to previous password. + passwords.iOldPassword = newPassword; + passwords.iNewPassword = oldPassword; + iWait->SetRequestType(EMobilePhoneChangeSecurityCode); + RDEBUG("ChangeSecurityCode", 0); + iPhone.ChangeSecurityCode(iWait->iStatus, secCodeType, passwords); + RDEBUG("WaitForRequestL", 0); + res = iWait->WaitForRequestL(); // this can't fail. ISA is always allowing to undo the password change. + RDEBUG("WaitForRequestL res", res); + #ifdef __WINS__ + if (res == KErrNotSupported) + res = KErrNone; + #endif + res = retLockcode; + } scpClient.Close(); } + if(res==KErrNone) + { + RDEBUG( "showing R_SECURITY_CODE_CHANGED_NOTE", R_SECURITY_CODE_CHANGED_NOTE ); + ShowResultNoteL(R_SECURITY_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); + } } break; } @@ -2319,8 +2469,7 @@ case KErrLocked: { ShowResultNoteL(R_SEC_BLOCKED, CAknNoteDialog::EErrorTone); - ChangeSecCodeParamsL(aOldPassword, aNewPassword, aFlags, - aCaption, aShowError); + ChangeSecCodeParamsL(aOldPassword, aNewPassword, aFlags, aCaption, aShowError); break; } case KErrGsm0707IncorrectPassword: @@ -2328,8 +2477,7 @@ { // code was entered erroneously ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); - ChangeSecCodeParamsL(aOldPassword, aNewPassword, aFlags, - aCaption, aShowError); + ChangeSecCodeParamsL(aOldPassword, aNewPassword, aFlags, aCaption, aShowError); break; } case KErrAbort: @@ -2339,20 +2487,18 @@ default: { ShowErrorNoteL(res); - ChangeSecCodeParamsL(aOldPassword, aNewPassword, aFlags, - aCaption, aShowError); + ChangeSecCodeParamsL(aOldPassword, aNewPassword, aFlags, aCaption, aShowError); break; } } // switch + RDEBUG("return res", res); return res; } /**************************************/ // qtdone // the params are changed in the settings,. This only asks for password. -EXPORT_C TInt CSecuritySettings::ChangeAutoLockPeriodParamsL(TInt aPeriod, - RMobilePhone::TMobilePassword aOldPassword, TInt aFlags, - TDes& aCaption, TInt aShowError) +EXPORT_C TInt CSecuritySettings::ChangeAutoLockPeriodParamsL(TInt aPeriod, RMobilePhone::TMobilePassword aOldPassword, TInt aFlags, TDes& aCaption, TInt aShowError) { RDEBUG("aPeriod", aPeriod); RDEBUG("aFlags", aFlags); @@ -2361,13 +2507,12 @@ * Series 60 ETel API *****************************************************/ - RMobilePhone::TMobilePhoneLockSetting lockChange( - RMobilePhone::ELockSetDisabled); + RMobilePhone::TMobilePhoneLockSetting lockChange(RMobilePhone::ELockSetDisabled); RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; TInt oldPeriod = aPeriod; TInt maxPeriod = 0; - if (FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw )) + if (FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw)) { // Retrieve the current autolock period max. value from the SCP server, // and check that the value the user @@ -2378,8 +2523,7 @@ { CleanupClosePushL(scpClient); TBuf maxPeriodBuf; - if (scpClient.GetParamValue(ESCPMaxAutolockPeriod, maxPeriodBuf) - == KErrNone) + if (scpClient.GetParamValue(ESCPMaxAutolockPeriod, maxPeriodBuf) == KErrNone) { TLex lex(maxPeriodBuf); if ((lex.Val(maxPeriod) == KErrNone) && (maxPeriod > 0)) @@ -2404,22 +2548,20 @@ CleanupStack::PopAndDestroy(); // scpClient } RDEBUG("maxPeriod", maxPeriod); - if (FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw )) + if (FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw)) { TBool allow = ETrue; if ((aPeriod == 0) && (maxPeriod > 0)) { - RDEBUG("The period is not allowed by TARM", aPeriod); - RDEBUG( "maxPeriod", maxPeriod ); + RDEBUG("The period is not allowed by TARM", aPeriod); + RDEBUG( "maxPeriod", maxPeriod ); allow = EFalse; - ShowResultNoteL(R_SECUI_TEXT_AUTOLOCK_MUST_BE_ACTIVE, - CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_SECUI_TEXT_AUTOLOCK_MUST_BE_ACTIVE, CAknNoteDialog::EErrorTone); } if (!allow) { - return ChangeAutoLockPeriodParamsL(aPeriod, aOldPassword, aFlags, - aCaption, aShowError); // ask again + return ChangeAutoLockPeriodParamsL(aPeriod, aOldPassword, aFlags, aCaption, aShowError); // ask again } } @@ -2430,12 +2572,12 @@ // Instead just re-set the DOS lock to enabled which as a side effect // requests the security code from the user. - TBool remoteLockStatus( EFalse ); + TBool remoteLockStatus(EFalse); CRemoteLockSettings* remoteLockSettings = CRemoteLockSettings::NewL(); - if ( remoteLockSettings->GetEnabled( remoteLockStatus ) ) + if (remoteLockSettings->GetEnabled(remoteLockStatus)) { - if ( remoteLockStatus ) + if (remoteLockStatus) { // Remote lock is enabled lockChange = RMobilePhone::ELockSetEnabled; @@ -2466,8 +2608,7 @@ iWait->SetRequestType(EMobilePhoneSetLockSetting); RDEBUG("lockChange", lockChange); - RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, - ESecurityUIsQueryRequestOk); + RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); RDEBUG("SetLockSetting", 0); iPhone.SetLockSetting(iWait->iStatus, lockType, lockChange); // this eventually calls PassPhraseRequiredL RDEBUG("WaitForRequestL", 0); @@ -2476,7 +2617,7 @@ RDEBUG("WaitForRequestL status", status); #ifdef __WINS__ if (status == KErrNotSupported || status == KErrTimedOut) - status = KErrNone; + status = KErrNone; #endif switch (status) { @@ -2484,34 +2625,32 @@ break; case KErrGsmSSPasswordAttemptsViolation: case KErrLocked: - RDEBUG("KErrLocked", KErrLocked); + RDEBUG("KErrLocked", KErrLocked) + ; ShowResultNoteL(KErrLocked, CAknNoteDialog::EErrorTone); // the old code didn't show messages - return ChangeAutoLockPeriodParamsL(oldPeriod, aOldPassword, - aFlags, aCaption, aShowError); // ask again + return ChangeAutoLockPeriodParamsL(oldPeriod, aOldPassword, aFlags, aCaption, aShowError); // ask again case KErrGsm0707IncorrectPassword: case KErrAccessDenied: - RDEBUG("KErrAccessDenied", KErrAccessDenied); + RDEBUG("KErrAccessDenied", KErrAccessDenied) + ; // code was entered erroneously ShowResultNoteL(KErrAccessDenied, CAknNoteDialog::EErrorTone); // the old code didn't show messages - return ChangeAutoLockPeriodParamsL(oldPeriod, aOldPassword, - aFlags, aCaption, aShowError); // ask again + return ChangeAutoLockPeriodParamsL(oldPeriod, aOldPassword, aFlags, aCaption, aShowError); // ask again case KErrAbort: // User pressed "cancel" in the code query dialog. return oldPeriod; default: - RDEBUG("default", status); + RDEBUG("default", status) + ; ShowResultNoteL(status, CAknNoteDialog::EErrorTone); // the old code didn't show messages - return ChangeAutoLockPeriodParamsL(oldPeriod, aOldPassword, - aFlags, aCaption, aShowError); // ask again + return ChangeAutoLockPeriodParamsL(oldPeriod, aOldPassword, aFlags, aCaption, aShowError); // ask again } - RDEBUG("aPeriod", aPeriod); + RDEBUG("aPeriod", aPeriod); return aPeriod; } /*****************************/ // qtdone -EXPORT_C TInt CSecuritySettings::ChangePinRequestParamsL(TInt aEnable, - RMobilePhone::TMobilePassword aOldPassword, TInt aFlags, - TDes& aCaption, TInt aShowError) +EXPORT_C TInt CSecuritySettings::ChangePinRequestParamsL(TInt aEnable, RMobilePhone::TMobilePassword aOldPassword, TInt aFlags, TDes& aCaption, TInt aShowError) { RDEBUG("aEnable", aEnable); RDEBUG("aFlags", aFlags); @@ -2558,7 +2697,7 @@ lEnable = 0; // off } - RDEBUG("lEnable", lEnable); + RDEBUG("lEnable", lEnable); if (lEnable == 0) { lockChangeSetting = RMobilePhone::ELockSetDisabled; @@ -2568,17 +2707,15 @@ lockChangeSetting = RMobilePhone::ELockSetEnabled; } - RDEBUG("lockChangeSetting", lockChangeSetting); + RDEBUG("lockChangeSetting", lockChangeSetting); // Raise a flag to indicate that the PIN // request coming from ETEL has originated from SecUi and not from Engine. - TInt tRet = RProperty::Set(KPSUidSecurityUIs, - KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSecUIOriginated); - RDEBUG("tRet", tRet); + TInt tRet = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSecUIOriginated); + RDEBUG("tRet", tRet); // Change the lock setting iWait->SetRequestType(EMobilePhoneSetLockSetting); - RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, - ESecurityUIsQueryRequestOk); + RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); RDEBUG("SetLockSetting", 0); iPhone.SetLockSetting(iWait->iStatus, lockType, lockChangeSetting); // this will trigger Pin1RequiredL RDEBUG("WaitForRequestL", 0); @@ -2586,12 +2723,11 @@ RDEBUG("WaitForRequestL status", status); #ifdef __WINS__ if (status == KErrNotSupported || status == KErrTimedOut) - status = KErrNone; + status = KErrNone; #endif // Lower the flag - RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, - ESecurityUIsSecUIOriginatedUninitialized); + RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSecUIOriginatedUninitialized); switch (status) { @@ -2602,16 +2738,14 @@ case KErrGsm0707OperationNotAllowed: { // not allowed with this sim - ShowResultNoteL(R_OPERATION_NOT_ALLOWED, - CAknNoteDialog::EErrorTone); + ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); return KErrGsm0707OperationNotAllowed; } case KErrGsm0707IncorrectPassword: case KErrAccessDenied: { // code was entered erroneously - return ChangePinRequestParamsL(aEnable, aOldPassword, aFlags, - aCaption, aShowError); + return ChangePinRequestParamsL(aEnable, aOldPassword, aFlags, aCaption, aShowError); } case KErrGsmSSPasswordAttemptsViolation: case KErrLocked: @@ -2624,8 +2758,7 @@ } default: { - return ChangePinRequestParamsL(aEnable, aOldPassword, aFlags, - aCaption, aShowError); + return ChangePinRequestParamsL(aEnable, aOldPassword, aFlags, aCaption, aShowError); } } return KErrNone; @@ -2638,9 +2771,7 @@ // not used // ---------------------------------------------------------- // qtdone -EXPORT_C TBool CSecuritySettings::AskSecCodeParamsL( - RMobilePhone::TMobilePassword &aOldPassword, TInt aFlags, - TDes& aCaption, TInt aShowError) +EXPORT_C TBool CSecuritySettings::AskSecCodeParamsL(RMobilePhone::TMobilePassword &aOldPassword, TInt aFlags, TDes& aCaption, TInt aShowError) { RDEBUG("aFlags", aFlags); RDEBUG("aShowError", aShowError); @@ -2649,7 +2780,7 @@ // the password parameters are not used if (aOldPassword.Length() > 0) - RDebug::Print(aOldPassword); + RDEBUGSTR(aOldPassword); return EFalse; } diff -r 3aa774c655ac -r f1030a78d563 securitydialogs/secuinotifications/secuinotificationdialogplugin/inc/secuinotificationdebug.h --- a/securitydialogs/secuinotifications/secuinotificationdialogplugin/inc/secuinotificationdebug.h Tue Jun 29 10:29:16 2010 +0300 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/inc/secuinotificationdebug.h Thu Jul 08 20:04:36 2010 +0300 @@ -21,8 +21,10 @@ #include #ifdef _DEBUG #define RDEBUG( x, y ) RDebug::Printf( "%s %s (%u) %s=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, x, y ); +#define RDEBUGQT( x, y ) qDebug() << __FILE__ << " " << __PRETTY_FUNCTION__ << " (" << __LINE__ << ") " << x << "=" << y ; #else #define RDEBUG( x, y ) +#define RDEBUGQT( x, y ) #endif #endif // SECUINOTIFICATIONDEBUG_H diff -r 3aa774c655ac -r f1030a78d563 securitydialogs/secuinotifications/secuinotificationdialogplugin/inc/secuinotificationdialog.h --- a/securitydialogs/secuinotifications/secuinotificationdialogplugin/inc/secuinotificationdialog.h Tue Jun 29 10:29:16 2010 +0300 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/inc/secuinotificationdialog.h Thu Jul 08 20:04:36 2010 +0300 @@ -29,6 +29,8 @@ #include +class HbTranslator; + QTM_BEGIN_NAMESPACE class QValueSpacePublisher; class QValueSpaceSubscriber; @@ -81,6 +83,8 @@ private: Q_DISABLE_COPY(SecUiNotificationDialog) + HbTranslator *mCommonTranslator; + HbTranslator *mSecUiNotificationTranslator; int mMyId; int mLastError; bool mShowEventReceived; diff -r 3aa774c655ac -r f1030a78d563 securitydialogs/secuinotifications/secuinotificationdialogplugin/rom/secuinotificationdialogplugin_resources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/rom/secuinotificationdialogplugin_resources.iby Thu Jul 08 20:04:36 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: +* +*/ + +#ifndef __SECUINOTIFICATIONDIALOGPLUGIN_RESOURCES_IBY__ +#define __SECUINOTIFICATIONDIALOGPLUGIN_RESOURCES_IBY__ + +#include +#include + +data=DATAZ_\QT_TRANSLATIONS_DIR\secui.qm QT_TRANSLATIONS_DIR\secui.qm + +#endif // __SECUINOTIFICATIONDIALOGPLUGIN_RESOURCES_IBY__ diff -r 3aa774c655ac -r f1030a78d563 securitydialogs/secuinotifications/secuinotificationdialogplugin/secui.ts --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/secui.ts Thu Jul 08 20:04:36 2010 +0300 @@ -0,0 +1,102 @@ + + + + + nString + + Autolock must be active + en #Autolock must be active + + + PIN2 code: + en #PIN2 code: + + + Insert SIM + en #Insert SIM + + + Gsm Invalid Parameter + en #Gsm Invalid Parameter + + + New UPIN code: + en #New UPIN code: + + + New PIN code: + en #New PIN code: + + + PIN2 rejected + en #PIN2 rejected + + + %Ln attempts remaining + + en #MISSING + en #MISSING + + + + Operation not supported + en #Operation not supported + + + Security Blocked + en #Security Blocked + + + Operation not Allowed + en #Operation not Allowed + + + Emergency calls only + en #Emergency calls only + + + UPIN code: + en #UPIN code: + + + Wrong PIN code + en #Wrong PIN code + + + Retype PIN code: + en #Retype PIN code: + + + If failed call customer care to get PUK code + en #If failed call customer care to get PUK code + + + Code chaged + en #Code chaged + + + Access Denied + en #Access Denied + + + PUK code: + en #PUK code: + + + PIN code: + en #PIN code: + + + UPIN not Allowed + en #UPIN not Allowed + + + Last attempt + en #Last attempt + + + Retype UPIN code: + en #Retype UPIN code: + + + \ No newline at end of file diff -r 3aa774c655ac -r f1030a78d563 securitydialogs/secuinotifications/secuinotificationdialogplugin/secuinotificationdialogplugin.pro --- a/securitydialogs/secuinotifications/secuinotificationdialogplugin/secuinotificationdialogplugin.pro Tue Jun 29 10:29:16 2010 +0300 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/secuinotificationdialogplugin.pro Thu Jul 08 20:04:36 2010 +0300 @@ -17,6 +17,7 @@ TEMPLATE = lib TARGET = secuinotificationdialogplugin CONFIG += plugin +TRANSLATIONS = secui.ts CONFIG += hb CONFIG += mobility @@ -54,7 +55,8 @@ BLD_INF_RULES.prj_exports += \ "$${LITERAL_HASH}include " \ "qmakepluginstubs/secuinotificationdialogplugin.qtplugin /epoc32/data/z/pluginstub/secuinotificationdialogplugin.qtplugin"\ - "rom/secuinotificationdialogplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(secuinotificationdialogplugin.iby)" + "rom/secuinotificationdialogplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(secuinotificationdialogplugin.iby)"\ + "rom/secuinotificationdialogplugin_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(secuinotificationdialogplugin_resources.iby)" LIBS += -lxqservice LIBS += -lphoneclient diff -r 3aa774c655ac -r f1030a78d563 securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationcontentwidget.cpp --- a/securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationcontentwidget.cpp Tue Jun 29 10:29:16 2010 +0300 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationcontentwidget.cpp Thu Jul 08 20:04:36 2010 +0300 @@ -83,7 +83,7 @@ void SecUiNotificationContentWidget::constructFromParameters(const QVariantMap ¶meters) { RDEBUG("0", 0); - qDebug() << parameters; + RDEBUGQT("parameters", parameters); QGraphicsLinearLayout *mainLayout = new QGraphicsLinearLayout(Qt::Vertical); lMinLength = 4; // might be replaced later @@ -146,32 +146,32 @@ { lEmergencySupported = ESecUiEmergencySupported; } - qDebug() << "SecUiNotificationContentWidget::lEmergencySupported =" << lEmergencySupported; + RDEBUG("lEmergencySupported", lEmergencySupported); } if (parameters.contains(KQueryMinLength)) { - qDebug() << "SecUiNotificationContentWidget::KQueryMinLength"; + RDEBUG("KQueryMinLength", 0); lMinLength = parameters.value(KQueryMinLength).toUInt(); - qDebug() << lMinLength; + RDEBUG("lMinLength", lMinLength); } if (parameters.contains(KQueryMaxLength)) { - qDebug() << "SecUiNotificationContentWidget::KQueryMaxLength"; + RDEBUG("KQueryMaxLength", 0); lMaxLength = parameters.value(KQueryMaxLength).toUInt(); - qDebug() << lMaxLength; + RDEBUG("lMaxLength", lMaxLength); } if (parameters.contains(KEmergency)) { - qDebug() << "SecUiNotificationContentWidget::KEmergency"; + RDEBUG("KEmergency", 0); QString emergencyText = parameters.value(KEmergency).toString(); - qDebug() << emergencyText; + RDEBUGQT("emergencyText", emergencyText); if(!emergencyText.compare("emergencyYes")) { - qDebug() << "SecUiNotificationContentWidget::KEmergency emergencyYes"; + RDEBUG("emergencyYes", 1); isEmergency = 1; } if(!emergencyText.compare("emergencyNo")) { - qDebug() << "SecUiNotificationContentWidget::KEmergency emergencyNo"; + RDEBUG("emergencyNo", 0); isEmergency = 0; } } @@ -179,47 +179,42 @@ // KCodeTop if (parameters.contains(KCodeTop)) { - qDebug() << "SecUiNotificationContentWidget::KCodeTop 1"; + RDEBUG("KCodeTop", 0); codeTop = new HbLineEdit(""); // no default value - qDebug() << "SecUiNotificationContentWidget::KCodeTop lMaxLength="; - qDebug() << lMaxLength; - if(lMaxLength>2) - codeTop->setMaxLength(lMaxLength); - qDebug() << "SecUiNotificationContentWidget::KCodeTop queryType="; - qDebug() << queryType; + RDEBUG("queryType", queryType); codeTop->setInputMethodHints(Qt::ImhDigitsOnly); // default if (queryType & ESecUiAlphaSupported) { - qDebug() << "SecUiNotificationContentWidget::KCodeTop setUpAsLatinAlphabetOnlyEditor"; + RDEBUG("ESecUiAlphaSupported", ESecUiAlphaSupported); codeTop->setInputMethodHints(Qt::ImhNone); } if (queryType & ESecUiSecretSupported) { - qDebug() << "SecUiNotificationContentWidget::KCodeTop ESecUiSecretSupported"; + RDEBUG("ESecUiSecretSupported", ESecUiSecretSupported); codeTop->setEchoMode(HbLineEdit::PasswordEchoOnEdit); - // note that codeButtom is never in secret mode. This nevertheless is restricted by the caller. } - qDebug() << "SecUiNotificationContentWidget::KCodeTop 3"; - codeTop->setMaxLength(lMaxLength); + RDEBUG("lMaxLength", lMaxLength); + if(lMaxLength>2) + codeTop->setMaxLength(lMaxLength); if (parameters.contains(KDefaultCode)) { - qDebug() << "SecUiNotificationContentWidget::KDefaultCode"; + RDEBUG("KDefaultCode", 0); QString defaultCode = parameters.value(KDefaultCode).toString(); - qDebug() << defaultCode; + RDEBUGQT("defaultCode", defaultCode); codeTop->setText(defaultCode); } - qDebug() << "SecUiNotificationContentWidget::KCodeTop 4"; + RDEBUG("1", 1); connect(codeTop, SIGNAL(textChanged(const QString &)), this, SIGNAL(codeTopChanged(const QString &))); connect(codeTop, SIGNAL(contentsChanged()), this, SIGNAL(codeTopContentChanged())); if (parameters.contains(KDefaultCode)) { // this is done in this step so that the OK becomes valid (if rules are fulfilled) - qDebug() << "SecUiNotificationContentWidget::KDefaultCode"; + RDEBUG("KDefaultCode", 0); QString defaultCode = parameters.value(KDefaultCode).toString(); - qDebug() << defaultCode; + RDEBUGQT("defaultCode", defaultCode); codeTop->setText(defaultCode); } - qDebug() << "SecUiNotificationContentWidget::KCodeTop 4"; + RDEBUG("2", 2); if (parameters.contains(KDialogTitle)) { QString titleText = parameters.value(KDialogTitle).toString(); @@ -228,21 +223,43 @@ { // if separator, take only first part titleText = titleText.left(titleText.indexOf('|')); } - if(titleText.indexOf('#')>0) + if(titleText.indexOf('$')>0) { // if separator, take only first part - titleAttempts = titleText.right(titleText.length()-titleText.indexOf('#')-1); - qDebug() << "SecUiNotificationDialog::titleAttempts=" << titleAttempts; + // it comes translated alredy, from the client + titleAttempts = titleText.right(titleText.length()-titleText.indexOf('$')-1); + RDEBUGQT("titleAttempts", titleAttempts); int nAttempts = titleAttempts.toInt(); RDEBUG("nAttempts", nAttempts); - titleText = titleText.left(titleText.indexOf('#')); - if(nAttempts>0) - titleText = titleText + " attempts=" + QString::number(nAttempts); - } + titleText = titleText.left(titleText.indexOf('$')); // this comes translated already + if(nAttempts==1) // last attempt + { + // This must be in a new line, to avoid problems with left-to-right writing + titleAttempts = hbTrId("txt_pin_code_dpophead_last_attempt"); + } + else if(nAttempts>0) + { + titleAttempts = hbTrId("attempts") + "=" + QString::number(nAttempts); + // TODO this requires %L1 localization using txt_pin_code_dpopinfo_ln_attempts_remaining + } + else if(nAttempts==0) + { + titleAttempts = ""; // something special for the last attempt ? + } + else + { + titleAttempts = ""; + } + } HbLabel *titleTop = new HbLabel(titleText); mainLayout->addItem(titleTop); + if (titleAttempts.length()>0 ) + { + HbLabel *titleTopAttemps = new HbLabel(titleAttempts); + mainLayout->addItem(titleTopAttemps); + } // in the dialog, it was setHeadingWidget(title); } - + RDEBUG("3", 3); mainLayout->addItem(codeTop); // double-query if (parameters.contains(KCodeBottom)) @@ -252,6 +269,7 @@ if(titleText.indexOf('|')>0) { // if no separator, don't create label QString titleBottomStr = titleText.right(titleText.length()-titleText.indexOf('|')-1); + // no need to translate HbLabel *titleBottom = new HbLabel(titleBottomStr); mainLayout->addItem(titleBottom); } @@ -262,10 +280,15 @@ codeBottom->setInputMethodHints(Qt::ImhDigitsOnly); // default if (queryType & ESecUiAlphaSupported) { - qDebug() << "SecUiNotificationContentWidget::KCodeBottom setUpAsLatinAlphabetOnlyEditor"; + RDEBUG("setInputMethodHints", 0); codeBottom->setInputMethodHints(Qt::ImhNone); } - qDebug() << "SecUiNotificationContentWidget::KCodeBottom 3"; + if (queryType & ESecUiSecretSupported) + { + RDEBUG("ESecUiSecretSupported", 0); + codeBottom->setEchoMode(HbLineEdit::PasswordEchoOnEdit); // this will also remove predictive, which is what we want + } + RDEBUG("connecting", 0); 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); @@ -291,7 +314,7 @@ } if (parameters.contains(KChecboxType)) { - qDebug() << "SecUiNotificationContentWidget::KChecboxType"; + RDEBUG("KChecboxType", 0); if (parameters.contains(KDialogTitle)) { //TODO position of the label is not centered QString tmpText=parameters.value(KDialogTitle).toString(); @@ -304,20 +327,20 @@ checkbox = new HbCheckBox("Caption"); if (parameters.contains(KDefaultCode)) { - qDebug() << "SecUiNotificationContentWidget::KDefaultCode"; + RDEBUG("KDefaultCode", 0); QStringList list1 = parameters.value(KDefaultCode).toString().split("|"); if (!list1.isEmpty() && list1.count()==2) { if (!list1[0].isNull() && !list1[0].isEmpty()) checkbox->setText(list1[0]); if (!list1[1].isNull() && !list1[1].isEmpty()) checkbox->setChecked(list1[1].toInt()); } - + // TODO this needs localization } mainLayout->addItem(checkbox); } if (parameters.contains(KMultiChecboxType) && parameters.contains(KDefaultCode)) { - qDebug() << "SecUiNotificationContentWidget::KMultiChecboxType"; + RDEBUG("KMultiChecboxType", 0); QStringList list1 = parameters.value(KDefaultCode).toString().split("1\t"); if (!list1.isEmpty()) { listWidget = new HbListWidget(); @@ -325,6 +348,7 @@ if (!list1[i].isEmpty() && !list1[i].isNull()) { HbListWidgetItem* modelItem = new HbListWidgetItem(); modelItem->setData(QVariant(list1[i]), Qt::DisplayRole); + // TODO this needs localization listWidget->addItem(modelItem); } listWidget->setCurrentRow(0); diff -r 3aa774c655ac -r f1030a78d563 securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationdialog.cpp --- a/securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationdialog.cpp Tue Jun 29 10:29:16 2010 +0300 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationdialog.cpp Thu Jul 08 20:04:36 2010 +0300 @@ -24,6 +24,7 @@ #include #include #include +#include #include #include // for TARM error codes while validating new lock code #include @@ -33,6 +34,10 @@ QTM_USE_NAMESPACE +const QString KTranslationsPath = "/resource/qt/translations/"; +const QString KSecUiNotificationTranslationsFile = "secui"; +const QString KCommonTranslationsFile = "common"; + #include #include #define ESecUiBasicTypeText 0x0000000 @@ -79,12 +84,14 @@ // ---------------------------------------------------------------------------- // SecUiNotificationDialog::SecUiNotificationDialog( - const QVariantMap ¶meters) : HbDialog(), mLastError(KNoError) + const QVariantMap ¶meters) : HbDialog(), mCommonTranslator(0), mSecUiNotificationTranslator(0), mLastError(KNoError) { RDEBUG("0", 0); TTime myTime; myTime.HomeTime(); mMyId = I64LOW( myTime.Int64() ); + mCommonTranslator = new HbTranslator(KTranslationsPath, KCommonTranslationsFile); + mSecUiNotificationTranslator = new HbTranslator(KTranslationsPath, KSecUiNotificationTranslationsFile); constructDialog(parameters); } @@ -94,7 +101,13 @@ // SecUiNotificationDialog::~SecUiNotificationDialog() { - RDEBUG("0", 0); + RDEBUG("0", 0); + delete mSecUiNotificationTranslator; + delete mCommonTranslator; + RDEBUG("0", 0); + // TODO what about subscriberKSecurityUIsDismissDialog + // and codeTop + RDEBUG("1", 1); } // ---------------------------------------------------------------------------- @@ -215,7 +228,6 @@ } RDEBUG("setFocus", 0); codeTop->setFocus(); // this should open the VKB . Doesn't seem to work when it's done on the widget, so it's done here. - } // codeTop!=NULL const TUint32 KSecurityUIsTestCode = 0x00000307; @@ -224,14 +236,14 @@ RDEBUG("KSecurityUIsTestCode err", err); RDEBUG("faking value", value); RDEBUG("mShowEventReceived", mShowEventReceived); - if(value>0 && mShowEventReceived==true) // show happens 2 times. Dialog can be closed only the second. + if(value>0 && value<1000000 && mShowEventReceived==true) // show happens 2 times. Dialog can be closed only the second. { QString myString = ""; myString += QString("%1").arg(value); - qDebug() << "SecUiNotificationDialog::faking myString=" << myString; + RDEBUGQT("myString", myString); codeTop->setText( myString ); TInt err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsTestCode, 0 ); // clear after using it - qDebug() << "SecUiNotificationDialog::calling handleAccepted=" << myString; + RDEBUGQT("calling handleAccepted myString", myString); emit handleAccepted(); // handleAccepted already emit closeDeviceDialog(false); // false means "not by client", although it's not really used } @@ -278,17 +290,17 @@ { // if separator, take only first part titleText = titleText.left(titleText.indexOf('|')); } - if(titleText.indexOf('#')>0) + if(titleText.indexOf('$')>0) { // if separator, take only first part - titleAttempts = titleText.right(titleText.length()-titleText.indexOf('#')-1); - qDebug() << "SecUiNotificationDialog::titleAttempts=" << titleAttempts; + titleAttempts = titleText.right(titleText.length()-titleText.indexOf('$')-1); + RDEBUGQT("titleAttempts", titleAttempts); int nAttempts = titleAttempts.toInt(); RDEBUG("nAttempts", nAttempts); - titleText = titleText.left(titleText.indexOf('#')); + titleText = titleText.left(titleText.indexOf('$')); if(nAttempts>0) titleText = titleText + " attempts=" + QString::number(nAttempts); } - titleText = "Security Query"; // this is the header, for any potential later error which needs to be displayed + titleText = hbTrId("Security Query"); // this is the header, for any potential later error which needs to be displayed // This is created only if needed (i.e. errors for NewLockCode) // titleWidget = new HbLabel(titleText); // setHeadingWidget(titleWidget); @@ -297,13 +309,13 @@ if (parameters.contains(KEmergency)) { RDEBUG("KEmergency", 1); QString emergencyText = parameters.value(KEmergency).toString(); - qDebug() << emergencyText; + RDEBUGQT("emergencyText", emergencyText); if(!emergencyText.compare("emergencyYes")) { RDEBUG("emergencyYes", 1); isEmergency = 1; okAction->setEnabled(true); - okAction->setText("Call"); + okAction->setText(hbTrId("Call")); return true; } if(!emergencyText.compare("emergencyNo")) @@ -311,7 +323,7 @@ RDEBUG("emergencyNo", 1); isEmergency = 0; okAction->setEnabled(false); // 112 -> 1122 (=password) . This is handled by < lMinLength - okAction->setText("Ok"); + okAction->setText(hbTrId("Ok")); return true; } } @@ -319,13 +331,13 @@ if (parameters.contains(KInvalidNewLockCode)) { RDEBUG("KInvalidNewLockCode", 0); QString invalidText = parameters.value(KInvalidNewLockCode).toString(); - qDebug() << invalidText; + RDEBUGQT("invalidText", invalidText); QString newTitleText = "Lock Code"; // TODO take from the original one - QString invalidStr = invalidText.right(invalidText.length()-invalidText.indexOf('#')-1); + QString invalidStr = invalidText.right(invalidText.length()-invalidText.indexOf('$')-1); int invalidNumber = invalidStr.toInt(); RDEBUG("invalidNumber", invalidNumber); - if(invalidNumber<0) + if(invalidNumber<0) // that is, -1 { RDEBUG("invalidNumber<0", invalidNumber ); // nothing to do @@ -333,97 +345,97 @@ if(invalidNumber==EDeviceLockAutolockperiod) { RDEBUG("EDeviceLockAutolockperiod", invalidNumber ); - newTitleText+="EDeviceLockAutolockperiod"; + newTitleText+=hbTrId("EDeviceLockAutolockperiod"); } if(invalidNumber==EDeviceLockMaxAutolockPeriod) { RDEBUG("EDeviceLockAutolockperiod", invalidNumber ); - newTitleText+="EDeviceLockMaxAutolockPeriod"; + newTitleText+=hbTrId("EDeviceLockMaxAutolockPeriod"); } if(invalidNumber==EDeviceLockMinlength) { RDEBUG("EDeviceLockMinlength", invalidNumber ); - newTitleText+="EDeviceLockMinlength"; + newTitleText+=hbTrId("EDeviceLockMinlength"); } if(invalidNumber==EDeviceLockMaxlength) { RDEBUG("EDeviceLockMaxlength", invalidNumber ); - newTitleText+="EDeviceLockMaxlength"; + newTitleText+=hbTrId("EDeviceLockMaxlength"); } if(invalidNumber==EDeviceLockRequireUpperAndLower) { RDEBUG("EDeviceLockRequireUpperAndLower", invalidNumber ); - newTitleText+="EDeviceLockRequireUpperAndLower"; + newTitleText+=hbTrId("EDeviceLockRequireUpperAndLower"); } if(invalidNumber==EDeviceLockRequireCharsAndNumbers) { RDEBUG("EDeviceLockMaxlength", invalidNumber ); - newTitleText+="EDeviceLockMaxlength"; + newTitleText+=hbTrId("EDeviceLockMaxlength"); } if(invalidNumber==EDeviceLockAllowedMaxRepeatedChars) { RDEBUG("EDeviceLockAllowedMaxRepeatedChars", invalidNumber ); - newTitleText+="EDeviceLockAllowedMaxRepeatedChars"; + newTitleText+=hbTrId("EDeviceLockAllowedMaxRepeatedChars"); } if(invalidNumber==EDeviceLockHistoryBuffer) { RDEBUG("EDeviceLockHistoryBuffer", invalidNumber ); - newTitleText+="EDeviceLockHistoryBuffer"; + newTitleText+=hbTrId("EDeviceLockHistoryBuffer"); } if(invalidNumber==EDeviceLockPasscodeExpiration) { RDEBUG("EDeviceLockPasscodeExpiration", invalidNumber ); - newTitleText+="EDeviceLockPasscodeExpiration"; + newTitleText+=hbTrId("EDeviceLockPasscodeExpiration"); } if(invalidNumber==EDeviceLockMinChangeTolerance) { RDEBUG("EDeviceLockMinChangeTolerance", invalidNumber ); - newTitleText+="EDeviceLockMinChangeTolerance"; + newTitleText+=hbTrId("EDeviceLockMinChangeTolerance"); } if(invalidNumber==EDeviceLockMinChangeInterval) { RDEBUG("EDeviceLockMinChangeInterval", invalidNumber ); - newTitleText+="EDeviceLockMinChangeInterval"; + newTitleText+=hbTrId("EDeviceLockMinChangeInterval"); } if(invalidNumber==EDeviceLockDisallowSpecificStrings) { RDEBUG("EDeviceLockDisallowSpecificStrings", invalidNumber ); - newTitleText+="EDeviceLockDisallowSpecificStrings"; + newTitleText+=hbTrId("EDeviceLockDisallowSpecificStrings"); } if(invalidNumber==EDeviceLockAllowedMaxAtempts) { RDEBUG("EDeviceLockAllowedMaxAtempts", invalidNumber ); - newTitleText+="EDeviceLockAllowedMaxAtempts"; + newTitleText+=hbTrId("EDeviceLockAllowedMaxAtempts"); } if(invalidNumber==EDeviceLockConsecutiveNumbers) { RDEBUG("EDeviceLockConsecutiveNumbers", invalidNumber ); - newTitleText+="EDeviceLockConsecutiveNumbers"; + newTitleText+=hbTrId("EDeviceLockConsecutiveNumbers"); } if(invalidNumber==EDeviceLockMinSpecialCharacters) { RDEBUG("EDeviceLockMinSpecialCharacters", invalidNumber ); - newTitleText+="EDeviceLockMinSpecialCharacters"; + newTitleText+=hbTrId("EDeviceLockMinSpecialCharacters"); } if(invalidNumber==EDeviceLockSingleCharRepeatNotAllowed) { RDEBUG("EDeviceLockSingleCharRepeatNotAllowed", invalidNumber ); - newTitleText+="EDeviceLockSingleCharRepeatNotAllowed"; + newTitleText+=hbTrId("EDeviceLockSingleCharRepeatNotAllowed"); } if(invalidNumber==EDevicelockConsecutiveCharsNotAllowed) { RDEBUG("EDevicelockConsecutiveCharsNotAllowed", invalidNumber ); - newTitleText+="EDevicelockConsecutiveCharsNotAllowed"; + newTitleText+=hbTrId("EDevicelockConsecutiveCharsNotAllowed"); } if(invalidNumber>=EDevicelockTotalPolicies) { RDEBUG("EDevicelockTotalPolicies", invalidNumber ); - newTitleText+="EDevicelockTotalPolicies"; + newTitleText+=hbTrId("EDevicelockTotalPolicies"); } if( !titleWidget ) { RDEBUG("creating titleWidget", 0 ); - titleWidget = new HbLabel("New lock code"); // it will be changed later + titleWidget = new HbLabel(hbTrId("New lock code")); // it will be changed later setHeadingWidget(titleWidget); } RDEBUG("setPlainText", 0 ); @@ -432,7 +444,7 @@ if(invalidNumber<0) // everything is ok { okAction->setEnabled(true); // this might fail in the scenario: check this : invalid -> valid. This allows verif ? - okAction->setText("Ok"); + okAction->setText(hbTrId("Ok")); codeBottom->setEnabled(true); } else @@ -440,7 +452,7 @@ okAction->setEnabled(false); codeBottom->setEnabled(false); codeBottom->setText(""); - okAction->setText("Ok"); + okAction->setText(hbTrId("Ok")); } // need to return because all objects are already created return true; @@ -477,7 +489,7 @@ return true; } - okAction = new HbAction(tr("Ok")); + okAction = new HbAction(hbTrId("Ok")); RDEBUG("created HbAction okAction", 1); okAction->setEnabled(false); // initially the OK is disabled because codeTop is empty if((queryType & ESecUiBasicTypeMask) ==ESecUiBasicTypeCheck) { @@ -494,7 +506,7 @@ disconnect(okAction, SIGNAL(triggered()), this, SLOT(close())); // the close will be done in handleAccepted connect(okAction, SIGNAL(triggered()), this, SLOT(handleAccepted())); - cancelAction = new HbAction(tr("Cancel")); // qtTrId("txt_common_button_cancel") + cancelAction = new HbAction(hbTrId("Cancel")); // qtTrId("txt_common_button_cancel") addAction(cancelAction); disconnect(cancelAction, SIGNAL(triggered()), this, SLOT(close())); // the close will be done in handleCancelled connect(cancelAction, SIGNAL(triggered()), this, SLOT(handleCancelled())); @@ -543,7 +555,7 @@ RDEBUG("0", 0); mResultMap.insert(KResultAccepted, acceptedValue); RDEBUG("0", 0); - qDebug() << mResultMap; + RDEBUGQT("mResultMap", mResultMap); RDEBUG("queryType", queryType); if(!(queryType & ESecUiTypeMaskLock)) { // the lock-icon should not reply @@ -581,7 +593,7 @@ codeTopText=""; foreach(index, selectedItems) { codeTopText+=QString::number(index.row()); - //could also use if(index.row()!=selectedItems.count()-1) codeTopText+= "|"; + // could also use if(index.row()!=selectedItems.count()-1) codeTopText+= "|"; codeTopText+= "|"; } mResultMap.insert(KCodeTopIndex, codeTopText); @@ -589,7 +601,7 @@ else codeTopText = codeTop->text(); // no need to check last time for codeBottom - qDebug() << "codeTopText=" << codeTopText; + RDEBUGQT("codeTopText", codeTopText); sendResult(KErrNone); RDEBUG("calling close()", 0); close(); // this is needed because Cancel doesn't automatically closes the dialog @@ -620,7 +632,7 @@ { RDEBUG("0", 0); RDEBUG("mMyId", mMyId); - qDebug() << text; + RDEBUGQT("text", text); QVariant memorySelection(text); mResultMap.insert(KSelectedMemoryIndex, memorySelection); } @@ -629,7 +641,7 @@ { RDEBUG("0", 0); RDEBUG("mMyId", mMyId); - qDebug() << codeTop->text(); + RDEBUGQT("codeTop->text()", codeTop->text()); handleCodeTopChanged(codeTop->text()); } @@ -640,20 +652,20 @@ void SecUiNotificationDialog::handleCodeTopChanged(const QString &text) { RDEBUG("0", 0); - qDebug() << "SecUiNotificationDialog::handleCodeTopChanged=" << text ; + RDEBUGQT("text", text); if(queryDual) { codeBottom->setText(""); // any change resets the verification. + if( (queryType & ESecUiMaskType) == 0x000004 ) // new codeLock + { // ChangeSecCodeParamsL change RMobilePhone::ESecurityCodePhonePassword + QVariant codeTopVar(text); + mResultMap.insert(KCodeTopIndex, codeTopVar); + sendResult(KErrCompletion); // send the current password back to the client for further TARM validation. This is done on any key-press, not in the OK + } } - if( queryType == 0x1000004 ) // new codeLock - { // ChangeSecCodeParamsL change RMobilePhone::ESecurityCodePhonePassword - QVariant codeTopVar(text); - mResultMap.insert(KCodeTopIndex, codeTopVar); - sendResult(KErrCompletion); // send the current password back to the client for further TARM validation. This is done on any key-press, not in the OK - } - if(text.length() < lMinLength ) + else if(text.length() < lMinLength ) { - qDebug() << "SecUiNotificationDialog::handleCodeTopChanged too short:" << text ; + RDEBUGQT("too short text", text); okAction->setEnabled(false); RDEBUG("lEmergencySupported", lEmergencySupported); if( lEmergencySupported && text.length() > 2 ) // emergency numbers need at least 3 digits @@ -666,8 +678,8 @@ else if (text.length() >= lMinLength) { // might use a flag to avoid re-setting. But this complicates things if there's another initial verification - qDebug() << "SecUiNotificationDialog::handleCodeTopChanged long enough:" << text ; - okAction->setText("Ok"); + RDEBUGQT("long enough text", text); + okAction->setText(hbTrId("Ok")); if(queryDual==0) // only if Bottom is not used okAction->setEnabled(true); } @@ -681,26 +693,26 @@ void SecUiNotificationDialog::handleCodeBottomChanged(const QString &text) { RDEBUG("0", 0); - qDebug() << "SecUiNotificationDialog::handleCodeBottomChanged" << text ; - qDebug() << "SecUiNotificationDialog::handleCodeBottomChanged. codeTop=" << codeTop->text() ; + RDEBUGQT("text", text); + RDEBUGQT("codeTop->text()", codeTop->text()); if(text.length() < lMinLength ) { - qDebug() << "SecUiNotificationDialog::handleCodeBottomChanged too short:" << text ; + RDEBUGQT("too short text", text); okAction->setEnabled(false); } else { // might use a flag to avoid re-setting. But it just complicates things. - qDebug() << "SecUiNotificationDialog::handleCodeBottomChanged long enough:" << text ; + RDEBUGQT("long enough text", text); if(codeTop->text()==text) { // unless both codes match, don't allow OK. Note that the first field doesn't allow exit until the validations (i.e. NewLockCode) as succesfull - qDebug() << "SecUiNotificationDialog::handleCodeBottomChanged codes match:" << text ; + RDEBUGQT("codes match", text); okAction->setEnabled(true); } else { - qDebug() << "SecUiNotificationDialog::handleCodeBottomChanged codes not match:" << text ; + RDEBUGQT("codes don't match", text); okAction->setEnabled(false); } } @@ -723,11 +735,9 @@ { RDEBUG("0", 0); QString codeTopText = codeTop->text(); - qDebug() << "codeTopText"; - qDebug() << codeTopText; + RDEBUGQT("codeTopText", codeTopText); codeTopText = codeTopText + "1" ; - qDebug() << "codeTopText+1"; - qDebug() << codeTopText; + RDEBUGQT("codeTopText+1", codeTopText); codeTop->setText(codeTopText); RDEBUG("editorInterface", 0); @@ -770,15 +780,18 @@ // void SecUiNotificationDialog::handlebut3Changed() { - qDebug() << "SecUiNotificationDialog::handlebut3Changed"; + RDEBUG("0", 0); QString codeTopText = codeTop->text(); - qDebug() << "codeTopText"; - qDebug() << codeTopText; + RDEBUG("codeTopText", 0); + RDEBUGQT("codeTopText", codeTopText); codeTopText = codeTopText + "5" ; - qDebug() << "codeTopText+5"; + RDEBUGQT("codeTopText+5", codeTopText); codeTop->setEchoMode(HbLineEdit::PasswordEchoOnEdit); - qDebug() << codeTopText; + RDEBUGQT("codeTopText", codeTopText); codeTop->setText(codeTopText); + RDEBUG("setFocus", 0); + codeTop->setFocus(); + RDEBUG("1", 1); } // ---------------------------------------------------------------------------- diff -r 3aa774c655ac -r f1030a78d563 securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationdialogplugin.cpp --- a/securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationdialogplugin.cpp Tue Jun 29 10:29:16 2010 +0300 +++ b/securitydialogs/secuinotifications/secuinotificationdialogplugin/src/secuinotificationdialogplugin.cpp Thu Jul 08 20:04:36 2010 +0300 @@ -81,6 +81,7 @@ deviceDialog = 0; } + RDEBUG("1", 1); return deviceDialog; } @@ -124,6 +125,7 @@ } // Return device dialog flags + RDEBUG("1", 1); return true; }