192 // |
189 // |
193 // ---------------------------------------------------------- |
190 // ---------------------------------------------------------- |
194 // CSecuritySettings::ChangePinL() |
191 // CSecuritySettings::ChangePinL() |
195 // Changes PIN1 |
192 // Changes PIN1 |
196 // ---------------------------------------------------------- |
193 // ---------------------------------------------------------- |
197 // qtdone |
194 // |
198 EXPORT_C void CSecuritySettings::ChangePinL() |
195 EXPORT_C void CSecuritySettings::ChangePinL() |
199 { |
196 { |
200 RDEBUG("0", 0); |
197 /***************************************************** |
201 RMobilePhone::TMobilePassword iOldPassword; |
198 * Series 60 Customer / ETel |
202 RMobilePhone::TMobilePassword iNewPassword; |
199 * Series 60 ETel API |
203 TInt iFlags = ESecUiTypeLock; |
200 *****************************************************/ |
204 iOldPassword.Copy(_L("")); |
201 |
205 iNewPassword.Copy(_L("")); |
202 TInt simState; |
206 |
203 TInt err( KErrGeneral ); |
207 TBuf<0x80> iCaption; |
204 err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); |
208 iCaption.Copy(_L("ChangePinL")); // no need to translate. Not used |
205 User::LeaveIfError( err ); |
209 TInt iShowError = 1; |
206 TBool simRemoved(simState == ESimNotPresent); |
210 TInt err = ChangePinParamsL(iOldPassword, iNewPassword, iFlags, iCaption, iShowError); |
207 |
211 RDEBUG("err", err); |
208 if ( simRemoved ) |
|
209 { |
|
210 ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); |
|
211 return; |
|
212 } |
|
213 |
|
214 #if defined(_DEBUG) |
|
215 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinL()")); |
|
216 #endif |
|
217 RMobilePhone::TMobilePhoneSecurityCode secCodeType; |
|
218 secCodeType = RMobilePhone::ESecurityCodePin1; |
|
219 |
|
220 RMobilePhone::TMobilePassword oldPassword; |
|
221 RMobilePhone::TMobilePassword newPassword; |
|
222 RMobilePhone::TMobilePassword verifcationPassword; |
|
223 RMobilePhone::TMobilePhonePasswordChangeV1 passwords; |
|
224 RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; |
|
225 RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); |
|
226 |
|
227 CCodeQueryDialog* verdlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); |
|
228 CleanupStack::PushL(verdlg); |
|
229 |
|
230 CCodeQueryDialog* newdlg = new (ELeave) CCodeQueryDialog(newPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); |
|
231 CleanupStack::PushL(newdlg); |
|
232 |
|
233 CCodeQueryDialog* dlg = new (ELeave) CCodeQueryDialog (oldPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); |
|
234 CleanupStack::PushL(dlg); |
|
235 |
|
236 RMobilePhone::TMobilePhoneLock lockType; |
|
237 RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
|
238 |
|
239 lockType = RMobilePhone::ELockICC; |
|
240 |
|
241 RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
|
242 iWait->SetRequestType(EMobilePhoneGetLockInfo); |
|
243 iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); |
|
244 TInt res = iWait->WaitForRequestL(); |
|
245 User::LeaveIfError(res); |
|
246 |
|
247 if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) |
|
248 { |
|
249 CleanupStack::PopAndDestroy(3,verdlg); |
|
250 ShowResultNoteL(R_PIN_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
|
251 return; |
|
252 } |
|
253 |
|
254 CleanupStack::Pop(); // dlg |
|
255 iWait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
|
256 iPhone.GetSecurityCodeInfo(iWait->iStatus, secCodeType, codeInfoPkg); |
|
257 res = iWait->WaitForRequestL(); |
|
258 User::LeaveIfError(res); |
|
259 // ask pin |
|
260 if( codeInfo.iRemainingEntryAttempts >= KMaxNumberOfPINAttempts ) |
|
261 res = dlg->ExecuteLD(R_PIN_QUERY); |
|
262 else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) |
|
263 { |
|
264 HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_PIN_ATTEMPTS, codeInfo.iRemainingEntryAttempts); |
|
265 res = dlg->ExecuteLD(R_PIN_QUERY, *queryPrompt); |
|
266 CleanupStack::PopAndDestroy(queryPrompt); |
|
267 } |
|
268 else |
|
269 { |
|
270 HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_PIN_ATTEMPT); |
|
271 res = dlg->ExecuteLD(R_PIN_QUERY, *queryPrompt); |
|
272 CleanupStack::PopAndDestroy(queryPrompt); |
|
273 } |
|
274 |
|
275 if( !res ) |
|
276 { |
|
277 CleanupStack::PopAndDestroy(2,verdlg); |
|
278 return; |
|
279 } |
|
280 CleanupStack::Pop(); // newdlg |
|
281 // new pin code query |
|
282 if (!(newdlg->ExecuteLD(R_NEW_PIN_CODE_QUERY))) |
|
283 { |
|
284 CleanupStack::PopAndDestroy(verdlg); |
|
285 return; |
|
286 } |
|
287 |
|
288 CleanupStack::Pop(); // verdlg |
|
289 // verification code query |
|
290 if (!(verdlg->ExecuteLD(R_VERIFY_NEW_PIN_CODE_QUERY))) |
|
291 return; |
|
292 |
|
293 while (newPassword.CompareF(verifcationPassword) != 0) |
|
294 { |
|
295 // codes do not match -> note -> ask new pin and verification codes again |
|
296 ShowResultNoteL(R_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone); |
|
297 |
|
298 newPassword = _L(""); |
|
299 verifcationPassword = _L(""); |
|
300 |
|
301 // new pin code query |
|
302 CCodeQueryDialog* newdlg = new (ELeave) CCodeQueryDialog (newPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); |
|
303 if (!(newdlg->ExecuteLD(R_NEW_PIN_CODE_QUERY))) |
|
304 return; |
|
305 |
|
306 // verification code query |
|
307 CCodeQueryDialog* verdlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); |
|
308 if (!(verdlg->ExecuteLD(R_VERIFY_NEW_PIN_CODE_QUERY))) |
|
309 return; |
|
310 } |
|
311 |
|
312 // send code |
|
313 passwords.iOldPassword = oldPassword; |
|
314 passwords.iNewPassword = newPassword; |
|
315 iWait->SetRequestType(EMobilePhoneChangeSecurityCode); |
|
316 iPhone.ChangeSecurityCode(iWait->iStatus, secCodeType, passwords); |
|
317 res = iWait->WaitForRequestL(); |
|
318 #if defined(_DEBUG) |
|
319 RDebug::Print( _L("(SECUI)CSecuritySettings::ChangePinL(): RETURN CODE: %d"), res); |
|
320 #endif |
|
321 switch(res) |
|
322 { |
|
323 case KErrNone: |
|
324 { |
|
325 // code changed |
|
326 ShowResultNoteL(R_PIN_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); |
|
327 break; |
|
328 } |
|
329 case KErrGsm0707IncorrectPassword: |
|
330 case KErrAccessDenied: |
|
331 { |
|
332 // code was entered erroneously |
|
333 ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
|
334 ChangePinL(); |
|
335 break; |
|
336 } |
|
337 case KErrGsmSSPasswordAttemptsViolation: |
|
338 case KErrLocked: |
|
339 { |
|
340 // Pin1 blocked! |
|
341 return; |
|
342 } |
|
343 case KErrGsm0707OperationNotAllowed: |
|
344 { |
|
345 // not allowed with this sim |
|
346 ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
|
347 return; |
|
348 } |
|
349 case KErrAbort: |
|
350 { |
|
351 break; |
|
352 } |
|
353 default: |
|
354 { |
|
355 ShowErrorNoteL(res); |
|
356 ChangePinL(); |
|
357 break; |
|
358 } |
|
359 } |
|
360 |
212 } |
361 } |
213 |
362 |
214 // |
363 // |
215 // ---------------------------------------------------------- |
364 // ---------------------------------------------------------- |
216 // CSecuritySettings::ChangeUPinL() |
365 // CSecuritySettings::ChangeUPinL() |
217 // Changes Universal PIN |
366 // Changes Universal PIN |
218 // ---------------------------------------------------------- |
367 // ---------------------------------------------------------- |
219 // qtdone |
368 // |
220 EXPORT_C void CSecuritySettings::ChangeUPinL() |
369 EXPORT_C void CSecuritySettings::ChangeUPinL() |
221 { |
370 { |
222 RDEBUG("0", 0); |
371 TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); |
223 RMobilePhone::TMobilePassword iOldPassword; |
372 TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); |
224 RMobilePhone::TMobilePassword iNewPassword; |
373 if(wcdmaSupported || upinSupported) |
225 TInt iFlags = ESecUiTypeLock; |
374 { |
226 iOldPassword.Copy(_L("")); |
375 #if defined(_DEBUG) |
227 iNewPassword.Copy(_L("")); |
376 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeUPinL()")); |
228 |
377 #endif |
229 TBuf<0x80> iCaption; |
378 TInt simState; |
230 iCaption.Copy(_L("ChangeUPinL")); // no need to translate. Not used |
379 TInt err( KErrGeneral ); |
231 TInt iShowError = 1; |
380 err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); |
232 TInt err = ChangeUPinParamsL(iOldPassword, iNewPassword, iFlags, iCaption, iShowError); |
381 User::LeaveIfError( err ); |
233 RDEBUG("err", err); |
382 TBool simRemoved(simState == ESimNotPresent); |
234 |
383 |
235 } |
384 if ( simRemoved ) |
236 |
385 { |
237 // |
386 ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); |
238 // ---------------------------------------------------------- |
387 return; |
239 // CSecuritySettings::ChangePin2L() |
388 } |
240 // Changes PIN2 |
389 |
241 // ---------------------------------------------------------- |
390 RMobilePhone::TMobilePhoneSecurityCode secCodeType; |
242 // qtdone |
391 secCodeType = RMobilePhone::ESecurityUniversalPin; |
243 EXPORT_C void CSecuritySettings::ChangePin2L() |
392 |
244 { |
393 RMobilePhone::TMobilePassword oldPassword; |
245 RDEBUG("0", 0); |
394 RMobilePhone::TMobilePassword newPassword; |
246 RMobilePhone::TMobilePassword iOldPassword; |
395 RMobilePhone::TMobilePassword verifcationPassword; |
247 RMobilePhone::TMobilePassword iNewPassword; |
396 RMobilePhone::TMobilePhonePasswordChangeV1 passwords; |
248 TInt iFlags = ESecUiTypeLock; |
397 RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; |
249 iOldPassword.Copy(_L("")); |
398 RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); |
250 iNewPassword.Copy(_L("")); |
399 |
251 |
400 CCodeQueryDialog* verdlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); |
252 TBuf<0x80> iCaption; |
401 CleanupStack::PushL(verdlg); |
253 iCaption.Copy(_L("ChangePin2L")); // no need to translate. Not used |
402 |
254 TInt iShowError = 1; |
403 CCodeQueryDialog* newdlg = new (ELeave) CCodeQueryDialog(newPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); |
255 TInt err = ChangePin2ParamsL(iOldPassword, iNewPassword, iFlags, iCaption, iShowError); |
404 CleanupStack::PushL(newdlg); |
256 RDEBUG("err", err); |
405 |
257 } |
406 CCodeQueryDialog* dlg = new (ELeave) CCodeQueryDialog (oldPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); |
258 // |
407 CleanupStack::PushL(dlg); |
259 // ---------------------------------------------------------- |
408 |
260 // CSecuritySettings::ChangeSecCodeL() |
409 RMobilePhone::TMobilePhoneLock lockType; |
261 // Changes security code |
410 RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
262 // ---------------------------------------------------------- |
411 |
263 // qtdone |
412 lockType = RMobilePhone::ELockUniversalPin; |
264 EXPORT_C void CSecuritySettings::ChangeSecCodeL() |
413 |
265 { |
414 RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
266 RDEBUG("0", 0); |
415 iWait->SetRequestType(EMobilePhoneGetLockInfo); |
267 RMobilePhone::TMobilePassword iOldPassword; |
416 iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); |
268 RMobilePhone::TMobilePassword iNewPassword; |
417 TInt res = iWait->WaitForRequestL(); |
269 TInt iFlags = 0; |
418 User::LeaveIfError(res); |
270 iOldPassword.Copy(_L("")); |
419 |
271 iNewPassword.Copy(_L("")); |
420 if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) |
272 |
421 { |
273 TBuf<0x80> iCaption; |
422 CleanupStack::PopAndDestroy(3,verdlg); |
274 iCaption.Copy(_L("ChangeSecCodeL")); // no need to translate. Not used |
423 ShowResultNoteL(R_UPIN_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
275 TInt iShowError = 1; |
424 return; |
276 TInt err = ChangeSecCodeParamsL(iOldPassword, iNewPassword, iFlags, iCaption, iShowError); |
425 } |
277 RDEBUG("err", err); |
426 |
278 } |
427 CleanupStack::Pop(); // dlg |
279 // |
428 // ask pin |
280 // ---------------------------------------------------------- |
429 iWait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
281 // CSecuritySettings::ChangeAutoLockPeriodL() |
430 iPhone.GetSecurityCodeInfo(iWait->iStatus, secCodeType, codeInfoPkg); |
282 // Changes autolock period |
431 res = iWait->WaitForRequestL(); |
283 // ---------------------------------------------------------- |
432 User::LeaveIfError(res); |
284 // qtdone |
433 |
285 EXPORT_C TInt CSecuritySettings::ChangeAutoLockPeriodL(TInt aPeriod) |
434 if( codeInfo.iRemainingEntryAttempts >= KMaxNumberOfPINAttempts ) |
286 { |
435 res = dlg->ExecuteLD(R_UPIN_QUERY); |
287 TInt ret = 0; |
436 else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) |
288 RDEBUG("aPeriod", aPeriod); |
437 { |
289 RMobilePhone::TMobilePassword iOldPassword; |
438 HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_UPIN_ATTEMPTS, codeInfo.iRemainingEntryAttempts); |
290 TInt iFlags = 0; |
439 res = dlg->ExecuteLD(R_UPIN_QUERY, *queryPrompt); |
291 TInt iShowError = 1; |
440 CleanupStack::PopAndDestroy(queryPrompt); |
292 TBuf<0x80> iCaption; |
|
293 iCaption.Copy(_L("ChangeAutoLockPeriodL")); // no need to translate. Not used |
|
294 iOldPassword.Copy(_L("")); |
|
295 ret = ChangeAutoLockPeriodParamsL(aPeriod, iOldPassword, iFlags, iCaption, iShowError); |
|
296 RDEBUG("ret", ret); |
|
297 return ret; |
|
298 } |
|
299 |
|
300 // |
|
301 // ---------------------------------------------------------- |
|
302 // CSecuritySettings::ChangeRemoteLockStatusL() |
|
303 // Changes remote lock status (on/off) |
|
304 // ---------------------------------------------------------- |
|
305 // no qtdone |
|
306 EXPORT_C TInt CSecuritySettings::ChangeRemoteLockStatusL(TBool& aRemoteLockStatus, TDes& aRemoteLockCode, TInt aAutoLockPeriod) |
|
307 { |
|
308 TInt retValue(KErrNone); |
|
309 RDEBUG("aRemoteLockStatus", aRemoteLockStatus); |
|
310 RDEBUG("aAutoLockPeriod", aAutoLockPeriod); |
|
311 |
|
312 if (aRemoteLockStatus) |
|
313 { |
|
314 aRemoteLockStatus = ETrue; |
|
315 |
|
316 // If user wishes to enable remote lock |
|
317 // a new remote lock code is required. |
|
318 // RemoteLockCodeQueryL also |
|
319 retValue = RemoteLockCodeQueryL(aRemoteLockCode); |
|
320 } |
|
321 else |
|
322 { |
|
323 aRemoteLockStatus = EFalse; |
|
324 retValue = KErrNone; |
|
325 // TODO this should calculate aAutoLockPeriod itself, and not trust the input |
|
326 |
|
327 // Check whether AutoLock is enabled (timeout value greater |
|
328 // than zero) or not. If AutoLock is enabled the domestic OS |
|
329 // device lock should be left enabled. |
|
330 if (aAutoLockPeriod == 0) |
|
331 { |
|
332 // Disable lock setting from domestic OS |
|
333 retValue = RemoteLockSetLockSettingL(EFalse); |
|
334 } |
441 } |
335 else |
442 else |
336 { |
443 { |
337 // If AutoLock is enabled, don't disable the DOS device lock |
444 HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_UPIN_ATTEMPT); |
338 // Re-set (enable) the domestic OS device lock because as a |
445 res = dlg->ExecuteLD(R_UPIN_QUERY, *queryPrompt); |
339 // side effect it requires the security code from the user |
446 CleanupStack::PopAndDestroy(queryPrompt); |
340 retValue = RemoteLockSetLockSettingL(ETrue); |
447 } |
341 } |
448 |
342 } |
449 |
343 RDEBUG( "retValue", retValue ); |
450 |
344 return retValue; |
451 if( !res ) |
345 } |
452 { |
346 // |
453 CleanupStack::PopAndDestroy(2,verdlg); |
347 // ---------------------------------------------------------- |
454 return; |
348 // CSecuritySettings::RemoteLockCodeQueryL() |
455 } |
349 // Pops up remote lock code query. Requires user to enter a new remote lock |
456 CleanupStack::Pop(); // newdlg |
350 // code (RemoteMsg) twice and if they match enables the domestic OS device lock (which as |
457 // new pin code query |
351 // a side effect pops up security code query). |
458 if (!(newdlg->ExecuteLD(R_NEW_UPIN_CODE_QUERY))) |
352 // Note: if the RemoteMsg is cancelled, nevertheless the lock is activated. This is done because the code is askedirst, and the only way to do so is by enabling the lock. |
459 { |
353 // This is not a problem, because: |
460 CleanupStack::PopAndDestroy(verdlg); |
354 // a) first the RemoteMsg is enable, and this function is used to change it |
461 return; |
355 // b) if lock was disabled, the "change RemoteMsg" menu is not available. |
462 } |
356 // ---------------------------------------------------------- |
463 |
357 // qtdone |
464 CleanupStack::Pop(); // verdlg |
358 TInt CSecuritySettings::RemoteLockCodeQueryL(TDes& aRemoteLockCode) |
465 // verification code query |
359 { |
466 if (!(verdlg->ExecuteLD(R_VERIFY_NEW_UPIN_CODE_QUERY))) |
360 |
467 return; |
361 TInt retValue(KErrNone); |
468 |
362 |
469 while (newPassword.CompareF(verifcationPassword) != 0) |
363 // This is done because lock-code needs to be asked first. |
470 { |
364 // Enable lock setting in domestic OS. It is safe to enable the |
471 // codes do not match -> note -> ask new pin and verification codes again |
365 // lock setting since RemoteLock API requires remote locking to |
472 ShowResultNoteL(R_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone); |
366 // be enabled when changing or setting the remote lock message. |
473 |
367 retValue = RemoteLockSetLockSettingL(ETrue); |
474 newPassword = _L(""); |
368 RDEBUG( "retValue", retValue ); |
475 verifcationPassword = _L(""); |
369 if (retValue != KErrNone) |
476 |
370 return retValue; |
477 // new pin code query |
371 aRemoteLockCode.Zero(); |
478 CCodeQueryDialog* newdlg = new (ELeave) CCodeQueryDialog (newPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); |
372 |
479 if (!(newdlg->ExecuteLD(R_NEW_UPIN_CODE_QUERY))) |
373 TInt queryAccepted = KErrCancel; |
480 return; |
374 queryAccepted = KErrCancel; |
481 |
375 CSecQueryUi * iSecQueryUi; |
482 // verification code query |
376 iSecQueryUi = CSecQueryUi::NewL(); |
483 CCodeQueryDialog* verdlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); |
377 // this queries both, and verifies itself |
484 if (!(verdlg->ExecuteLD(R_VERIFY_NEW_UPIN_CODE_QUERY))) |
378 TBuf<0x100> title; |
485 return; |
379 title.Zero(); |
486 } |
380 HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_rem_code")); |
487 |
381 title.Append(stringHolder->Des()); |
488 // send code |
382 CleanupStack::PopAndDestroy(stringHolder); |
489 passwords.iOldPassword = oldPassword; |
383 title.Append(_L("|")); |
490 passwords.iNewPassword = newPassword; |
384 HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("Verify")); |
491 iWait->SetRequestType(EMobilePhoneChangeSecurityCode); |
385 title.Append(stringHolder2->Des()); |
492 iPhone.ChangeSecurityCode(iWait->iStatus, secCodeType, passwords); |
386 CleanupStack::PopAndDestroy(stringHolder2); |
493 res = iWait->WaitForRequestL(); |
387 queryAccepted = iSecQueryUi->SecQueryDialog(title, aRemoteLockCode, SEC_REMOTELOCK_CODE_MIN_LENGTH, SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiAlphaSupported |
494 #if defined(_DEBUG) |
388 | ESecUiCancelSupported | ESecUiEmergencyNotSupported | ESecUiNone); |
495 RDebug::Print( _L("(SECUI)CSecuritySettings::ChangePinL(): RETURN CODE: %d"), res); |
389 RDEBUG("aRemoteLockCode", 0); |
496 #endif |
390 RDEBUGSTR(aRemoteLockCode); |
497 switch(res) |
391 RDEBUG("queryAccepted", queryAccepted); |
|
392 delete iSecQueryUi; |
|
393 if (queryAccepted != KErrNone) |
|
394 return KErrAbort; |
|
395 |
|
396 // Check that the new remote lock code doesn't match the security code of the device. |
|
397 RMobilePhone::TMobilePhoneSecurityCode secCodeType = RMobilePhone::ESecurityCodePhonePassword; |
|
398 RMobilePhone::TMobilePassword securityCode; |
|
399 RMobilePhone::TMobilePassword unblockCode; // Required here only as a dummy parameter |
|
400 |
|
401 |
|
402 securityCode = aRemoteLockCode; |
|
403 RDEBUG( "EMobilePhoneVerifySecurityCode", EMobilePhoneVerifySecurityCode ); |
|
404 iWait->SetRequestType(EMobilePhoneVerifySecurityCode); |
|
405 RDEBUG( "VerifySecurityCode", 0 ); |
|
406 iPhone.VerifySecurityCode(iWait->iStatus, secCodeType, securityCode, unblockCode); |
|
407 RDEBUG( "WaitForRequestL", 0 ); |
|
408 TInt res = iWait->WaitForRequestL(); |
|
409 RDEBUG( "WaitForRequestL res", res ); |
|
410 #ifdef __WINS__ |
|
411 if (res == KErrNotSupported || res == KErrTimedOut) |
|
412 res = KErrGsm0707IncorrectPassword; // KErrGsm0707IncorrectPassword = incorrect code |
|
413 #endif |
|
414 RDEBUG( "KErrGsm0707IncorrectPassword", KErrGsm0707IncorrectPassword ); |
|
415 if (res == KErrNone) |
|
416 { |
|
417 // The message is also valid as a lock-code, this means that |
|
418 // remote lock code matches the security code |
|
419 // and that is not allowed |
|
420 RDEBUG( "return KErrCancel because msg matches code", KErrCancel ); |
|
421 ShowResultNoteL(R_REMOTELOCK_INVALID_CODE, CAknNoteDialog::EErrorTone); |
|
422 return KErrCancel; |
|
423 } |
|
424 |
|
425 RDEBUG( "retValue", retValue ); |
|
426 return retValue; |
|
427 } |
|
428 // |
|
429 // ---------------------------------------------------------- |
|
430 // CSecuritySettings::RemoteLockSetLockSettingL() |
|
431 // Changes lock setting in domestic OS. Changing the domestic OS lock setting |
|
432 // requires user to enter the security code. |
|
433 // ---------------------------------------------------------- |
|
434 // qtdone |
|
435 TInt CSecuritySettings::RemoteLockSetLockSettingL(TBool aLockSetting) |
|
436 { |
|
437 TInt retValue(KErrNone); |
|
438 RDEBUG( "aLockSetting", aLockSetting ); |
|
439 |
|
440 RMobilePhone::TMobilePhoneLockSetting lockSetting = RMobilePhone::ELockSetEnabled; |
|
441 RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; |
|
442 |
|
443 RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
|
444 RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
|
445 |
|
446 //get lock info |
|
447 iWait->SetRequestType(EMobilePhoneGetLockInfo); |
|
448 RDEBUG("GetLockInfo", 0); |
|
449 iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); |
|
450 RDEBUG("WaitForRequestL", 0); |
|
451 TInt status = iWait->WaitForRequestL(); |
|
452 RDEBUG("WaitForRequestL status", status); |
|
453 |
|
454 #ifdef __WINS__ |
|
455 if (status == KErrNotSupported || status == KErrTimedOut) |
|
456 { |
|
457 lockInfo.iSetting = RMobilePhone::ELockSetDisabled; |
|
458 status = KErrNone; |
|
459 } |
|
460 #endif |
|
461 User::LeaveIfError(status); |
|
462 RDEBUG("current lockInfo.iSetting", lockInfo.iSetting); |
|
463 |
|
464 // disabled->disabled should not happen |
|
465 // enabled->enabled happens because a change of message also forces a code re-validation |
|
466 if (aLockSetting) |
|
467 { |
|
468 lockSetting = RMobilePhone::ELockSetEnabled; |
|
469 } |
|
470 else |
|
471 { |
|
472 lockSetting = RMobilePhone::ELockSetDisabled; |
|
473 } |
|
474 RDEBUG("future lockSetting", lockSetting); |
|
475 |
|
476 iWait->SetRequestType(EMobilePhoneSetLockSetting); |
|
477 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); |
|
478 RDEBUG( "SetLockSetting", 0 ); |
|
479 iPhone.SetLockSetting(iWait->iStatus, lockType, lockSetting); // this will PassPhraseRequiredL |
|
480 RDEBUG( "WaitForRequestL", 0 ); |
|
481 retValue = iWait->WaitForRequestL(); |
|
482 RDEBUG( "WaitForRequestL retValue", retValue ); |
|
483 #ifdef __WINS__ |
|
484 if (retValue == KErrNotSupported || retValue == KErrTimedOut) |
|
485 retValue = KErrNone; |
|
486 #endif |
|
487 |
|
488 switch (retValue) |
|
489 { |
|
490 case KErrNone: |
|
491 break; |
|
492 |
|
493 case KErrGsmSSPasswordAttemptsViolation: |
|
494 case KErrLocked: |
|
495 case KErrGsm0707IncorrectPassword: |
|
496 case KErrAccessDenied: |
|
497 // Security code was entered erroneously |
|
498 //Error note is shown in CSecurityHandler::PassPhraseRequired() |
|
499 break; |
|
500 |
|
501 case KErrAbort: |
|
502 break; |
|
503 |
|
504 default: |
|
505 break; |
|
506 } |
|
507 |
|
508 RDEBUG( "retValue", retValue ); |
|
509 return retValue; |
|
510 } |
|
511 |
|
512 // |
|
513 // ---------------------------------------------------------- |
|
514 // CSecuritySettings::ChangeSimSecurityL() |
|
515 // Changes SIM security |
|
516 // ---------------------------------------------------------- |
|
517 // qtdone |
|
518 EXPORT_C TBool CSecuritySettings::ChangeSimSecurityL() |
|
519 { |
|
520 /***************************************************** |
|
521 * Series 60 Customer / ETel |
|
522 * Series 60 ETel API |
|
523 *****************************************************/ |
|
524 RDEBUG("0", 0); |
|
525 RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
|
526 RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
|
527 RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneToICC; |
|
528 RMobilePhone::TMobilePhoneLockSetting lockChangeSetting; |
|
529 |
|
530 //get lock info |
|
531 iWait->SetRequestType(EMobilePhoneGetLockInfo); |
|
532 RDEBUG("GetLockInfo", 0); |
|
533 iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); |
|
534 RDEBUG("WaitForRequestL", 0); |
|
535 TInt status = iWait->WaitForRequestL(); |
|
536 RDEBUG("WaitForRequestL status", status); |
|
537 |
|
538 #ifdef __WINS__ |
|
539 if (status == KErrNotSupported || status == KErrTimedOut) |
|
540 { |
|
541 lockInfo.iSetting = RMobilePhone::ELockSetDisabled; |
|
542 status = KErrNone; |
|
543 } |
|
544 #endif |
|
545 User::LeaveIfError(status); |
|
546 TInt currentItem = 0; |
|
547 RDEBUG("lockInfo.iSetting", lockInfo.iSetting); |
|
548 if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) |
|
549 { |
|
550 currentItem = 1; // off |
|
551 } |
|
552 |
|
553 if (currentItem == 0) // switch the flag |
|
554 { |
|
555 lockChangeSetting = RMobilePhone::ELockSetDisabled; |
|
556 } |
|
557 else |
|
558 { |
|
559 lockChangeSetting = RMobilePhone::ELockSetEnabled; |
|
560 } |
|
561 RDEBUG("lockChangeSetting", lockChangeSetting); |
|
562 |
|
563 iWait->SetRequestType(EMobilePhoneSetLockSetting); |
|
564 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); |
|
565 RDEBUG("SetLockSetting", 0); |
|
566 iPhone.SetLockSetting(iWait->iStatus, lockType, lockChangeSetting); // this invokes the handler |
|
567 RDEBUG("WaitForRequestL", 0); |
|
568 status = iWait->WaitForRequestL(); |
|
569 RDEBUG("WaitForRequestL status", status); |
|
570 #ifdef __WINS__ |
|
571 if (status == KErrNotSupported || status == KErrTimedOut) |
|
572 status = KErrNone; |
|
573 #endif |
|
574 |
|
575 // the error was displayed in the handler |
|
576 RDEBUG("status", status); |
|
577 switch (status) |
|
578 { |
|
579 case KErrNone: |
|
580 { |
|
581 break; |
|
582 } |
|
583 case KErrGsm0707IncorrectPassword: |
|
584 case KErrAccessDenied: |
|
585 { |
|
586 // code was entered erroneously |
|
587 return ChangeSimSecurityL(); |
|
588 } |
|
589 case KErrGsmSSPasswordAttemptsViolation: |
|
590 case KErrLocked: |
|
591 { |
|
592 return ChangeSimSecurityL(); |
|
593 } |
|
594 case KErrAbort: |
|
595 { |
|
596 return EFalse; |
|
597 } |
|
598 default: |
|
599 { |
|
600 ShowErrorNoteL(status); |
|
601 return ChangeSimSecurityL(); |
|
602 } |
|
603 } |
|
604 |
|
605 return ETrue; |
|
606 } |
|
607 // |
|
608 // ---------------------------------------------------------- |
|
609 // CSecuritySettings::ChangePinRequestL() |
|
610 // Changes PIN1 request |
|
611 // ---------------------------------------------------------- |
|
612 // qtdone |
|
613 EXPORT_C TBool CSecuritySettings::ChangePinRequestL() |
|
614 { |
|
615 RDEBUG("0", 0); |
|
616 |
|
617 RMobilePhone::TMobilePassword iOldPassword; |
|
618 TInt iFlags = 0; |
|
619 iOldPassword.Copy(_L("")); |
|
620 |
|
621 TBuf<0x80> iCaption; |
|
622 iCaption.Copy(_L("ChangePinRequestL")); // no need to translate. Not used |
|
623 TInt iShowError = 1; |
|
624 TInt err = ChangePinRequestParamsL(1/* it's imposible to know if we want to set or clear*/, iOldPassword, iFlags, iCaption, iShowError); |
|
625 RDEBUG("err", err); |
|
626 if (err == KErrNone) |
|
627 return ETrue; |
|
628 else |
|
629 return EFalse; |
|
630 } |
|
631 |
|
632 // |
|
633 // ---------------------------------------------------------- |
|
634 // CSecuritySettings::ChangeUPinRequestL() |
|
635 // Changes UPIN request on/off |
|
636 // ---------------------------------------------------------- |
|
637 // qtdone |
|
638 EXPORT_C TBool CSecuritySettings::ChangeUPinRequestL() |
|
639 { |
|
640 TBool wcdmaSupported(FeatureManager::FeatureSupported(KFeatureIdProtocolWcdma)); |
|
641 TBool upinSupported(FeatureManager::FeatureSupported(KFeatureIdUpin)); |
|
642 RDEBUG("wcdmaSupported", wcdmaSupported); |
|
643 RDEBUG("upinSupported", upinSupported); |
|
644 if (wcdmaSupported || upinSupported) |
|
645 { |
|
646 TInt simState; |
|
647 TInt err(KErrGeneral); |
|
648 err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); |
|
649 User::LeaveIfError(err); |
|
650 TBool simRemoved(simState == ESimNotPresent); |
|
651 |
|
652 if (simRemoved) |
|
653 { |
|
654 ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); |
|
655 return EFalse; |
|
656 } |
|
657 |
|
658 RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
|
659 RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
|
660 RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockUniversalPin; |
|
661 |
|
662 RMobilePhone::TMobilePhoneLockSetting lockChangeSetting = RMobilePhone::ELockSetDisabled; |
|
663 |
|
664 //get lock info |
|
665 iWait->SetRequestType(EMobilePhoneGetLockInfo); |
|
666 RDEBUG("GetLockInfo", 0); |
|
667 iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); |
|
668 RDEBUG("WaitForRequestL", 0); |
|
669 TInt status = iWait->WaitForRequestL(); |
|
670 RDEBUG("WaitForRequestL status", status); |
|
671 #ifdef __WINS__ |
|
672 if (status == KErrNotSupported || status == KErrTimedOut) |
|
673 status = KErrNone; |
|
674 #endif |
|
675 User::LeaveIfError(status); |
|
676 TInt currentItem = 0; |
|
677 |
|
678 RDEBUG("lockInfo.iSetting", lockInfo.iSetting); |
|
679 if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) |
|
680 { |
|
681 currentItem = 1; // off |
|
682 } |
|
683 |
|
684 if (currentItem == 0) // switch the flag |
|
685 { |
|
686 lockChangeSetting = RMobilePhone::ELockSetDisabled; |
|
687 } |
|
688 else |
|
689 { |
|
690 lockChangeSetting = RMobilePhone::ELockSetEnabled; |
|
691 } |
|
692 RDEBUG("lockChangeSetting", lockChangeSetting); |
|
693 // Raise a flag to indicate that the UPIN |
|
694 // request coming from ETEL has originated from SecUi and not from Engine. |
|
695 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSecUIOriginated); |
|
696 // Change the lock setting |
|
697 iWait->SetRequestType(EMobilePhoneSetLockSetting); |
|
698 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); |
|
699 RDEBUG("SetLockSetting", 0); |
|
700 iPhone.SetLockSetting(iWait->iStatus, lockType, lockChangeSetting); // this calls something in the handler |
|
701 RDEBUG("WaitForRequestL", 0); |
|
702 status = iWait->WaitForRequestL(); |
|
703 RDEBUG("WaitForRequestL status", status); |
|
704 // Lower the flag |
|
705 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSecUIOriginatedUninitialized); |
|
706 #ifdef __WINS__ |
|
707 if (status == KErrNotSupported || status == KErrTimedOut) |
|
708 status = KErrNone; |
|
709 #endif |
|
710 |
|
711 // no need to show errors because they were displayed in the Handler |
|
712 switch (status) |
|
713 { |
498 { |
714 case KErrNone: |
499 case KErrNone: |
715 { |
500 { |
|
501 // code changed |
|
502 ShowResultNoteL(R_UPIN_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); |
716 break; |
503 break; |
|
504 } |
|
505 case KErrGsm0707IncorrectPassword: |
|
506 case KErrAccessDenied: |
|
507 { |
|
508 // code was entered erroneously |
|
509 ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
|
510 ChangeUPinL(); |
|
511 break; |
|
512 } |
|
513 case KErrGsmSSPasswordAttemptsViolation: |
|
514 case KErrLocked: |
|
515 { |
|
516 return; |
717 } |
517 } |
718 case KErrGsm0707OperationNotAllowed: |
518 case KErrGsm0707OperationNotAllowed: |
719 { |
519 { |
720 // not allowed with this sim |
520 // not allowed with this sim |
721 ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
521 ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
722 return EFalse; |
522 return; |
723 } |
|
724 case KErrGsm0707IncorrectPassword: |
|
725 case KErrAccessDenied: |
|
726 { |
|
727 // code was entered erroneously |
|
728 return ChangeUPinRequestL(); |
|
729 } |
|
730 case KErrGsmSSPasswordAttemptsViolation: |
|
731 case KErrLocked: |
|
732 { |
|
733 return EFalse; |
|
734 } |
523 } |
735 case KErrAbort: |
524 case KErrAbort: |
736 { |
525 { |
737 return EFalse; |
526 break; |
738 } |
527 } |
739 default: |
528 default: |
740 { |
529 { |
741 ShowErrorNoteL(status); |
530 ShowErrorNoteL(res); |
742 return ChangeUPinRequestL(); |
531 ChangeUPinL(); |
743 } |
|
744 } |
|
745 |
|
746 return ETrue; |
|
747 } |
|
748 else |
|
749 return EFalse; |
|
750 |
|
751 } |
|
752 |
|
753 // |
|
754 // ---------------------------------------------------------- |
|
755 // CSecuritySettings::SwitchPinCodesL() |
|
756 // Changes the pin code currently in use (PIN/UPIN) |
|
757 // ---------------------------------------------------------- |
|
758 // qtdone |
|
759 EXPORT_C TBool CSecuritySettings::SwitchPinCodesL() |
|
760 { |
|
761 TBool wcdmaSupported(FeatureManager::FeatureSupported(KFeatureIdProtocolWcdma)); |
|
762 TBool upinSupported(FeatureManager::FeatureSupported(KFeatureIdUpin)); |
|
763 RDEBUG("wcdmaSupported", wcdmaSupported); |
|
764 RDEBUG("upinSupported", upinSupported); |
|
765 if (wcdmaSupported || upinSupported) |
|
766 { |
|
767 // If we are in simless offline mode the PIN codes can't obviously be switched |
|
768 TInt simState; |
|
769 TInt err(KErrGeneral); |
|
770 err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); |
|
771 User::LeaveIfError(err); |
|
772 TBool simRemoved(simState == ESimNotPresent); |
|
773 |
|
774 if (simRemoved) |
|
775 { |
|
776 ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); |
|
777 return EFalse; |
|
778 } |
|
779 |
|
780 RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockUniversalPin; |
|
781 RMobilePhone::TMobilePhoneLockSetting lockChangeSetting = RMobilePhone::ELockReplaced; |
|
782 RMobilePhone::TMobilePhoneSecurityCode activeCode; |
|
783 |
|
784 iCustomPhone.GetActivePin(activeCode); |
|
785 |
|
786 RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
|
787 RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
|
788 RDEBUG("EMobilePhoneGetLockInfo", EMobilePhoneGetLockInfo); |
|
789 iWait->SetRequestType(EMobilePhoneGetLockInfo); |
|
790 |
|
791 if (activeCode == RMobilePhone::ESecurityUniversalPin) |
|
792 { |
|
793 lockType = RMobilePhone::ELockUniversalPin; |
|
794 iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); |
|
795 RDEBUG("WaitForRequestL", 0); |
|
796 TInt res = iWait->WaitForRequestL(); |
|
797 RDEBUG("WaitForRequestL res", res); |
|
798 #ifdef __WINS__ |
|
799 if (res == KErrNotSupported || res == KErrTimedOut) |
|
800 res = KErrNone; |
|
801 #endif |
|
802 User::LeaveIfError(res); |
|
803 } |
|
804 else |
|
805 { |
|
806 lockType = RMobilePhone::ELockICC; |
|
807 iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); |
|
808 RDEBUG("WaitForRequestL", 0); |
|
809 TInt res = iWait->WaitForRequestL(); |
|
810 RDEBUG("WaitForRequestL res", res); |
|
811 #ifdef __WINS__ |
|
812 if (res == KErrNotSupported || res == KErrTimedOut) |
|
813 res = KErrNone; |
|
814 #endif |
|
815 User::LeaveIfError(res); |
|
816 } |
|
817 |
|
818 // code request must be ON to change active code. |
|
819 RDEBUG("lockInfo.iSetting", lockInfo.iSetting); |
|
820 if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) |
|
821 { |
|
822 |
|
823 if (activeCode != RMobilePhone::ESecurityUniversalPin) |
|
824 { |
|
825 ShowResultNoteL(R_UPIN_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
|
826 } |
|
827 else |
|
828 { |
|
829 ShowResultNoteL(R_PIN_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
|
830 } |
|
831 return EFalse; |
|
832 } |
|
833 |
|
834 iCustomPhone.GetActivePin(activeCode); |
|
835 TInt currentItem = 0; |
|
836 |
|
837 RDEBUG("activeCode", activeCode); |
|
838 if (activeCode == RMobilePhone::ESecurityUniversalPin) |
|
839 { |
|
840 currentItem = 1; // UPIN |
|
841 } |
|
842 if (currentItem == 0) // switch the flag |
|
843 { |
|
844 lockType = RMobilePhone::ELockUniversalPin; |
|
845 } |
|
846 else |
|
847 { |
|
848 lockType = RMobilePhone::ELockICC; |
|
849 } |
|
850 RDEBUG("lockType", lockType); |
|
851 |
|
852 // Raise a flag to indicate that the code |
|
853 // request coming from ETEL has originated from SecUi and not from Engine. |
|
854 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSecUIOriginated); |
|
855 // Change the lock setting |
|
856 iWait->SetRequestType(EMobilePhoneSetLockSetting); |
|
857 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); |
|
858 RDEBUG("SetLockSetting", 0); |
|
859 iPhone.SetLockSetting(iWait->iStatus, lockType, lockChangeSetting); // request from handler |
|
860 RDEBUG("WaitForRequestL", 0); |
|
861 TInt status = iWait->WaitForRequestL(); |
|
862 RDEBUG("WaitForRequestL status", status); |
|
863 // Lower the flag |
|
864 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSecUIOriginatedUninitialized); |
|
865 #ifdef __WINS__ |
|
866 if (status == KErrNotSupported || status == KErrTimedOut) |
|
867 status = KErrNone; |
|
868 #endif |
|
869 |
|
870 // errors are shown in the handler |
|
871 switch (status) |
|
872 { |
|
873 case KErrNone: |
|
874 { |
|
875 break; |
532 break; |
876 } |
533 } |
877 case KErrGsm0707OperationNotAllowed: |
534 } |
878 { |
535 } |
879 // not allowed with this sim |
536 |
880 ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
|
881 return EFalse; |
|
882 } |
|
883 case KErrGsm0707IncorrectPassword: |
|
884 case KErrAccessDenied: |
|
885 { |
|
886 // code was entered erroneously |
|
887 return SwitchPinCodesL(); |
|
888 } |
|
889 case KErrGsmSSPasswordAttemptsViolation: |
|
890 case KErrLocked: |
|
891 { |
|
892 return EFalse; |
|
893 } |
|
894 case KErrAbort: |
|
895 { |
|
896 return EFalse; |
|
897 } |
|
898 default: |
|
899 { |
|
900 ShowErrorNoteL(status); |
|
901 return SwitchPinCodesL(); |
|
902 } |
|
903 } |
|
904 |
|
905 return ETrue; |
|
906 } |
|
907 else |
|
908 return EFalse; |
|
909 } |
537 } |
910 |
538 |
911 // |
539 // |
912 // ---------------------------------------------------------- |
540 // ---------------------------------------------------------- |
913 // CSecuritySettings::IsLockEnabledL() |
541 // CSecuritySettings::ChangePin2L() |
914 // Return is lock enabled/disabled |
542 // Changes PIN2 |
915 // ---------------------------------------------------------- |
543 // ---------------------------------------------------------- |
916 // qtdone |
544 // |
917 EXPORT_C TBool CSecuritySettings::IsLockEnabledL(RMobilePhone::TMobilePhoneLock aLockType) |
545 EXPORT_C void CSecuritySettings::ChangePin2L() |
918 { |
|
919 TBool ret = EFalse; |
|
920 RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
|
921 //get lock info |
|
922 RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
|
923 iWait->SetRequestType(EMobilePhoneGetLockInfo); |
|
924 RDEBUG("GetLockInfo", 0); |
|
925 iPhone.GetLockInfo(iWait->iStatus, aLockType, lockInfoPkg); |
|
926 RDEBUG("WaitForRequestL", 0); |
|
927 TInt res = iWait->WaitForRequestL(); |
|
928 RDEBUG("WaitForRequestL res", res); |
|
929 |
|
930 if (res != KErrNone) |
|
931 ret = ETrue; |
|
932 //lock is enabled return true |
|
933 else if (lockInfo.iSetting == RMobilePhone::ELockSetEnabled) |
|
934 { |
|
935 ret = ETrue; |
|
936 } |
|
937 RDEBUG("ret", ret); |
|
938 return ret; |
|
939 } |
|
940 // |
|
941 // ---------------------------------------------------------- |
|
942 // CSecuritySettings::AskSecCodeL() |
|
943 // For asking security code e.g in settings |
|
944 // ---------------------------------------------------------- |
|
945 // qtdone |
|
946 EXPORT_C TBool CSecuritySettings::AskSecCodeL() |
|
947 { |
|
948 return iSecurityHandler->AskSecCodeL(); |
|
949 } |
|
950 // |
|
951 // ---------------------------------------------------------- |
|
952 // CSecuritySettings::AskPin2L() |
|
953 // Asks PIN2 |
|
954 // ---------------------------------------------------------- |
|
955 // qtdone |
|
956 EXPORT_C TBool CSecuritySettings::AskPin2L() |
|
957 { |
546 { |
958 /***************************************************** |
547 /***************************************************** |
959 * Series 60 Customer / ETel |
548 * Series 60 Customer / ETel |
960 * Series 60 ETel API |
549 * Series 60 ETel API |
961 *****************************************************/ |
550 *****************************************************/ |
962 RDEBUG("0", 0); |
551 #if defined(_DEBUG) |
963 TInt retPhone = 0; |
552 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePin2L()")); |
964 // check if pin2 is blocked... |
553 #endif |
965 RMmCustomAPI::TSecurityCodeType secCodeType = RMmCustomAPI::ESecurityCodePin2; |
554 TInt simState; |
966 RMobilePhone::TMobilePhoneSecurityCode etelsecCodeType(RMobilePhone::ESecurityCodePin2); |
555 TInt err( KErrGeneral ); |
|
556 err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); |
|
557 User::LeaveIfError( err ); |
|
558 TBool simRemoved(simState == ESimNotPresent); |
|
559 |
|
560 if ( simRemoved ) |
|
561 { |
|
562 ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); |
|
563 return; |
|
564 } |
|
565 |
|
566 RMmCustomAPI::TSecurityCodeType secCodeType; |
|
567 RMobilePhone::TMobilePhoneSecurityCode EtelsecCodeType; |
|
568 secCodeType = RMmCustomAPI::ESecurityCodePin2; |
|
569 RMobilePhone::TMobilePassword oldPassword; |
|
570 RMobilePhone::TMobilePassword newPassword; |
|
571 RMobilePhone::TMobilePassword verifcationPassword; |
|
572 RMobilePhone::TMobilePhonePasswordChangeV1 passwords; |
967 RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; |
573 RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; |
968 RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); |
574 RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); |
969 RMobilePhone::TMobilePassword password; |
575 |
|
576 // check if pin2 is blocked... |
970 TBool isBlocked = EFalse; |
577 TBool isBlocked = EFalse; |
971 TInt queryAccepted = KErrCancel; |
578 |
972 //Check whether PIN2 is blocked |
579 TInt ret = iCustomPhone.IsBlocked(secCodeType,isBlocked); |
973 retPhone = iCustomPhone.IsBlocked(secCodeType, isBlocked); |
580 |
974 |
581 if(isBlocked) |
975 RDEBUG("retPhone", retPhone); |
|
976 RDEBUG("isBlocked", isBlocked); |
|
977 #ifdef __WINS__ |
|
978 if (retPhone == KErrNotSupported || retPhone == KErrTimedOut) |
|
979 retPhone = KErrNone; |
|
980 #endif |
|
981 if (isBlocked) |
|
982 return EFalse; |
|
983 |
|
984 if (retPhone != KErrNone) |
|
985 { |
|
986 switch (retPhone) |
|
987 { |
|
988 // PIN2 Blocked. |
|
989 case KErrGsm0707SIMPuk2Required: |
|
990 break; |
|
991 case KErrGsmSSPasswordAttemptsViolation: |
|
992 case KErrLocked: |
|
993 // Pin2 features blocked permanently! |
|
994 ShowResultNoteL(R_PIN2_REJECTED, CAknNoteDialog::EConfirmationTone); |
|
995 break; |
|
996 case KErrGsm0707SimNotInserted: |
|
997 // not allowed with this sim |
|
998 ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
|
999 break; |
|
1000 default: |
|
1001 ShowErrorNoteL(retPhone); |
|
1002 break; |
|
1003 } |
|
1004 return EFalse; |
|
1005 } |
|
1006 iWait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
|
1007 RDEBUG("GetSecurityCodeInfo", 0); |
|
1008 iPhone.GetSecurityCodeInfo(iWait->iStatus, etelsecCodeType, codeInfoPkg); |
|
1009 RDEBUG("WaitForRequestL", 0); |
|
1010 retPhone = iWait->WaitForRequestL(); |
|
1011 RDEBUG("WaitForRequestL retPhone", retPhone); |
|
1012 #ifdef __WINS__ |
|
1013 if (retPhone == KErrNotSupported || retPhone == KErrTimedOut) |
|
1014 { |
|
1015 retPhone = KErrNone; |
|
1016 codeInfo.iRemainingEntryAttempts = 3; |
|
1017 } |
|
1018 #endif |
|
1019 User::LeaveIfError(retPhone); |
|
1020 |
|
1021 RDEBUG("codeInfo.iRemainingEntryAttempts", |
|
1022 codeInfo.iRemainingEntryAttempts); |
|
1023 if (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) |
|
1024 codeInfo.iRemainingEntryAttempts = -1; |
|
1025 |
|
1026 // ask pin2 code |
|
1027 /* request PIN using QT */ |
|
1028 queryAccepted = KErrCancel; |
|
1029 CSecQueryUi *iSecQueryUi; |
|
1030 iSecQueryUi = CSecQueryUi::NewL(); |
|
1031 TBuf<0x100> title; |
|
1032 title.Zero(); |
|
1033 HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_pin2_code")); |
|
1034 title.Append(stringHolder->Des()); |
|
1035 CleanupStack::PopAndDestroy(stringHolder); |
|
1036 title.Append(_L("$")); |
|
1037 title.AppendNum(codeInfo.iRemainingEntryAttempts); |
|
1038 queryAccepted = iSecQueryUi->SecQueryDialog(title, password, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported |
|
1039 | ESecUiEmergencyNotSupported | secCodeType); |
|
1040 RDEBUG("password", 0); |
|
1041 RDEBUGSTR(password); |
|
1042 RDEBUG("queryAccepted", queryAccepted); |
|
1043 delete iSecQueryUi; |
|
1044 if (queryAccepted != KErrNone) |
|
1045 return EFalse; |
|
1046 |
|
1047 // verify code |
|
1048 RMobilePhone::TMobilePassword required_fourth; |
|
1049 iWait->SetRequestType(EMobilePhoneVerifySecurityCode); |
|
1050 RDEBUG("VerifySecurityCode", 0); |
|
1051 iPhone.VerifySecurityCode(iWait->iStatus, etelsecCodeType, password, required_fourth); |
|
1052 RDEBUG("WaitForRequestL", 0); |
|
1053 retPhone = iWait->WaitForRequestL(); |
|
1054 RDEBUG("WaitForRequestL retPhone", retPhone); |
|
1055 #ifdef __WINS__ |
|
1056 if (retPhone == KErrNotSupported) |
|
1057 retPhone = KErrNone; |
|
1058 #endif |
|
1059 |
|
1060 switch (retPhone) |
|
1061 { |
|
1062 case KErrNone: |
|
1063 break; |
|
1064 case KErrGsm0707IncorrectPassword: |
|
1065 case KErrAccessDenied: |
|
1066 // code was entered erroneously |
|
1067 ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
|
1068 return AskPin2L(); |
|
1069 case KErrGsm0707OperationNotAllowed: |
|
1070 // not allowed with this sim |
|
1071 ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
|
1072 return EFalse; |
|
1073 case KErrGsmSSPasswordAttemptsViolation: |
|
1074 case KErrLocked: |
|
1075 // code was blocked |
|
1076 ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
|
1077 return EFalse; |
|
1078 default: |
|
1079 ShowErrorNoteL(retPhone); |
|
1080 return AskPin2L(); |
|
1081 } |
|
1082 |
|
1083 return ETrue; |
|
1084 } |
|
1085 // |
|
1086 // ---------------------------------------------------------- |
|
1087 // CSecuritySettings::SetFdnModeL() |
|
1088 // Activates or deactivates Fixed Dialling Numbers (FDN) mode. |
|
1089 // ---------------------------------------------------------- |
|
1090 // not qtdone |
|
1091 EXPORT_C void CSecuritySettings::SetFdnModeL() |
|
1092 { |
|
1093 /***************************************************** |
|
1094 * Series 60 Customer / ETel |
|
1095 * Series 60 ETel API |
|
1096 *****************************************************/ |
|
1097 RDEBUG("0", 0); |
|
1098 RMmCustomAPI::TSecurityCodeType secCodeType = RMmCustomAPI::ESecurityCodePin2; |
|
1099 |
|
1100 TBool isBlocked = EFalse; |
|
1101 TInt ret = iCustomPhone.IsBlocked(secCodeType, isBlocked); |
|
1102 RDEBUG("isBlocked", isBlocked); |
|
1103 RDEBUG("ret", ret); |
|
1104 if (isBlocked) |
|
1105 return; |
582 return; |
1106 |
583 |
1107 if (ret != KErrNone) |
584 if (ret != KErrNone) |
1108 { |
585 { |
1109 switch (ret) |
586 switch (ret) |
1110 { |
587 { |
1111 // PIN2 Blocked. |
588 // PIN2 Blocked. |
1112 case KErrGsm0707SIMPuk2Required: |
589 case KErrGsm0707SIMPuk2Required: |
1113 break; |
590 break; |
1124 ShowErrorNoteL(ret); |
601 ShowErrorNoteL(ret); |
1125 break; |
602 break; |
1126 } |
603 } |
1127 return; |
604 return; |
1128 } |
605 } |
1129 |
606 |
1130 TInt status = KErrNone; |
607 CCodeQueryDialog* verdlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN2_CODE_MIN_LENGTH,SEC_C_PIN2_CODE_MAX_LENGTH,ESecUiNone); |
1131 |
608 CleanupStack::PushL(verdlg); |
1132 RMobilePhone::TMobilePhoneFdnStatus fdnMode; |
609 |
1133 RMobilePhone::TMobilePhoneFdnSetting fdnSet; |
610 CCodeQueryDialog* newdlg = new (ELeave) CCodeQueryDialog(newPassword,SEC_C_PIN2_CODE_MIN_LENGTH,SEC_C_PIN2_CODE_MAX_LENGTH,ESecUiNone); |
1134 |
611 CleanupStack::PushL(newdlg); |
1135 iPhone.GetFdnStatus(fdnMode); |
612 |
1136 |
613 CCodeQueryDialog* dlg = new (ELeave) CCodeQueryDialog (oldPassword,SEC_C_PIN2_CODE_MIN_LENGTH,SEC_C_PIN2_CODE_MAX_LENGTH,ESecUiNone); |
1137 if (fdnMode == RMobilePhone::EFdnActive) |
614 CleanupStack::PushL(dlg); |
1138 { |
615 |
1139 fdnSet = RMobilePhone::EFdnSetOff; |
616 |
1140 } |
617 // Security code must be changed to Etel API format |
|
618 // Custom API Pin1 and Pin2 have the same enum values as the Etel ones |
|
619 EtelsecCodeType = (RMobilePhone::TMobilePhoneSecurityCode)secCodeType; |
|
620 #ifndef __WINS__ |
|
621 iWait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
|
622 iPhone.GetSecurityCodeInfo(iWait->iStatus, EtelsecCodeType, codeInfoPkg); |
|
623 ret = iWait->WaitForRequestL(); |
|
624 User::LeaveIfError(ret); |
|
625 #else |
|
626 codeInfo.iRemainingEntryAttempts = 1; |
|
627 #endif //__WINS__ |
|
628 |
|
629 if(codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) |
|
630 ret = dlg->ExecuteLD(R_PIN2_QUERY); |
|
631 else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) |
|
632 { |
|
633 HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_PIN2_ATTEMPTS, codeInfo.iRemainingEntryAttempts ); |
|
634 ret = dlg->ExecuteLD(R_PIN2_QUERY, *queryPrompt); |
|
635 CleanupStack::PopAndDestroy(queryPrompt); |
|
636 } |
1141 else |
637 else |
1142 { |
638 { |
1143 fdnSet = RMobilePhone::EFdnSetOn; |
639 HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_PIN2_ATTEMPT); |
1144 } |
640 ret = dlg->ExecuteLD(R_PIN2_QUERY, *queryPrompt); |
1145 RDEBUG("fdnSet", fdnSet); |
641 CleanupStack::PopAndDestroy(queryPrompt); |
1146 // Change the FDN setting |
642 } |
1147 iWait->SetRequestType(EMobilePhoneSetFdnSetting); |
643 |
1148 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); |
644 CleanupStack::Pop(); // dlg |
1149 RDEBUG("SetFdnSetting", 0); |
645 if(!ret) |
1150 iPhone.SetFdnSetting(iWait->iStatus, fdnSet); |
646 { |
1151 RDEBUG("WaitForRequestL", 0); |
647 CleanupStack::PopAndDestroy(2,verdlg); |
1152 status = iWait->WaitForRequestL(); |
648 return; |
1153 RDEBUG("WaitForRequestL status", status); |
649 } |
1154 #ifdef __WINS__ |
650 |
1155 if (status == KErrNotSupported) |
651 // new pin code query |
1156 status = KErrNone; |
652 CleanupStack::Pop(); // newdlg |
1157 #endif |
653 if(!(newdlg->ExecuteLD(R_NEW_PIN2_CODE_QUERY))) |
1158 |
654 { |
1159 RDEBUG("status", status); |
655 CleanupStack::PopAndDestroy(verdlg); |
1160 switch (status) |
656 return; |
|
657 } |
|
658 |
|
659 // verification code query |
|
660 CleanupStack::Pop(); // verdlg |
|
661 if(!(verdlg->ExecuteLD(R_VERIFY_NEW_PIN2_CODE_QUERY))) |
|
662 { |
|
663 return; |
|
664 } |
|
665 |
|
666 while (newPassword.CompareF(verifcationPassword) != 0) |
|
667 { |
|
668 // codes do not match -> note -> ask new pin and verification codes again |
|
669 ShowResultNoteL(R_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone); |
|
670 |
|
671 newPassword = _L(""); |
|
672 verifcationPassword = _L(""); |
|
673 |
|
674 // new pin code query |
|
675 CCodeQueryDialog* dlg = new (ELeave) CCodeQueryDialog (newPassword,SEC_C_PIN2_CODE_MIN_LENGTH,SEC_C_PIN2_CODE_MAX_LENGTH,ESecUiNone); |
|
676 if(!(dlg->ExecuteLD(R_NEW_PIN2_CODE_QUERY))) |
|
677 return; |
|
678 |
|
679 // verification code query |
|
680 CCodeQueryDialog* dlg2 = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN2_CODE_MIN_LENGTH,SEC_C_PIN2_CODE_MAX_LENGTH,ESecUiNone); |
|
681 if(!(dlg2->ExecuteLD(R_VERIFY_NEW_PIN2_CODE_QUERY))) |
|
682 return; |
|
683 } |
|
684 |
|
685 |
|
686 passwords.iOldPassword = oldPassword; |
|
687 passwords.iNewPassword = newPassword; |
|
688 iWait->SetRequestType(EMobilePhoneChangeSecurityCode); |
|
689 iPhone.ChangeSecurityCode(iWait->iStatus,EtelsecCodeType,passwords); |
|
690 TInt res = iWait->WaitForRequestL(); |
|
691 #if defined(_DEBUG) |
|
692 RDebug::Print( _L("(SECUI)CSecuritySettings::ChangePin2L(): RETURN CODE: %d"), res); |
|
693 #endif |
|
694 switch(res) |
1161 { |
695 { |
1162 case KErrNone: |
696 case KErrNone: |
1163 break; |
697 { |
|
698 // code changed |
|
699 ShowResultNoteL(R_PIN2_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); |
|
700 break; |
|
701 } |
1164 case KErrGsm0707IncorrectPassword: |
702 case KErrGsm0707IncorrectPassword: |
1165 case KErrAccessDenied: |
703 case KErrAccessDenied: |
1166 // code was entered erroneously |
704 { |
1167 SetFdnModeL(); |
705 ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
1168 break; |
706 ChangePin2L(); |
|
707 break; |
|
708 } |
1169 case KErrGsmSSPasswordAttemptsViolation: |
709 case KErrGsmSSPasswordAttemptsViolation: |
1170 case KErrLocked: |
710 case KErrLocked: |
1171 break; |
711 { |
1172 case KErrAbort: |
712 // Pin2 blocked! |
1173 break; |
713 ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
|
714 CSecurityHandler* handler = new(ELeave) CSecurityHandler(iPhone); |
|
715 CleanupStack::PushL(handler); |
|
716 handler->HandleEventL(RMobilePhone::EPuk2Required); |
|
717 CleanupStack::PopAndDestroy(handler); // handler |
|
718 return; |
|
719 } |
1174 case KErrGsm0707OperationNotAllowed: |
720 case KErrGsm0707OperationNotAllowed: |
|
721 { |
1175 // not allowed with this sim |
722 // not allowed with this sim |
1176 ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
723 ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
1177 break; |
724 return; |
|
725 } |
|
726 case KErrAbort: |
|
727 { |
|
728 break; |
|
729 } |
1178 default: |
730 default: |
|
731 { |
|
732 ShowErrorNoteL(res); |
|
733 ChangePin2L(); |
|
734 break; |
|
735 } |
|
736 } |
|
737 } |
|
738 // |
|
739 // ---------------------------------------------------------- |
|
740 // CSecuritySettings::ChangeSecCodeL() |
|
741 // Changes security code |
|
742 // ---------------------------------------------------------- |
|
743 // |
|
744 EXPORT_C void CSecuritySettings::ChangeSecCodeL() |
|
745 { |
|
746 /***************************************************** |
|
747 * Series 60 Customer / ETel |
|
748 * Series 60 ETel API |
|
749 *****************************************************/ |
|
750 #if defined(_DEBUG) |
|
751 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeSecCodeL()")); |
|
752 #endif |
|
753 TInt res; |
|
754 RMobilePhone::TMobilePassword newPassword; |
|
755 if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw ) && |
|
756 (FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements ))) |
|
757 { |
|
758 |
|
759 // Connect to the SCP server, and request the code change |
|
760 RSCPClient scpClient; |
|
761 User::LeaveIfError( scpClient.Connect() ); |
|
762 CleanupClosePushL( scpClient ); |
|
763 res = scpClient.ChangeCodeRequest(); |
|
764 CleanupStack::PopAndDestroy(); // scpClient |
|
765 |
|
766 } |
|
767 else |
|
768 { |
|
769 |
|
770 RMobilePhone::TMobilePhoneSecurityCode secCodeType; |
|
771 secCodeType = RMobilePhone::ESecurityCodePhonePassword; |
|
772 RMobilePhone::TMobilePassword oldPassword; |
|
773 RMobilePhone::TMobilePassword verifcationPassword; |
|
774 RMobilePhone::TMobilePassword required_fourth; |
|
775 RMobilePhone::TMobilePhonePasswordChangeV1 passwords; |
|
776 |
|
777 CCodeQueryDialog* verdlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_SECURITY_CODE_MIN_LENGTH,SEC_C_SECURITY_CODE_CHANGE_MAX_LENGTH,ESecUiNone); |
|
778 CleanupStack::PushL(verdlg); |
|
779 |
|
780 CCodeQueryDialog* newdlg = new (ELeave) CCodeQueryDialog(newPassword,SEC_C_SECURITY_CODE_MIN_LENGTH,SEC_C_SECURITY_CODE_CHANGE_MAX_LENGTH,ESecUiNone); |
|
781 CleanupStack::PushL(newdlg); |
|
782 |
|
783 CCodeQueryDialog* dlg = new (ELeave) CCodeQueryDialog (oldPassword,SEC_C_SECURITY_CODE_MIN_LENGTH,SEC_C_SECURITY_CODE_MAX_LENGTH,ESecUiNone); |
|
784 CleanupStack::PushL(dlg); |
|
785 |
|
786 // ask security code |
|
787 CleanupStack::Pop(); // dlg |
|
788 if (!(dlg->ExecuteLD(R_SECURITY_QUERY))) |
|
789 { |
|
790 CleanupStack::PopAndDestroy(2,verdlg); |
|
791 return; |
|
792 } |
|
793 // new security code query |
|
794 CleanupStack::Pop(); // newdlg |
|
795 if(!(newdlg->ExecuteLD(R_NEW_SECURITY_CODE_QUERY))) |
|
796 { |
|
797 CleanupStack::PopAndDestroy(verdlg); |
|
798 return; |
|
799 } |
|
800 |
|
801 // verification code query |
|
802 CleanupStack::Pop(); // verdlg |
|
803 if(!(verdlg->ExecuteLD(R_VERIFY_NEW_SECURITY_CODE_QUERY))) |
|
804 { |
|
805 return; |
|
806 } |
|
807 |
|
808 while (newPassword.CompareF(verifcationPassword) != 0) |
|
809 { |
|
810 // codes do not match -> note -> ask new pin and verification codes again |
|
811 ShowResultNoteL(R_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone); |
|
812 |
|
813 newPassword = _L(""); |
|
814 verifcationPassword = _L(""); |
|
815 |
|
816 // new pin code query |
|
817 CCodeQueryDialog* dlg = new (ELeave) CCodeQueryDialog (newPassword,SEC_C_SECURITY_CODE_MIN_LENGTH,SEC_C_SECURITY_CODE_CHANGE_MAX_LENGTH,ESecUiNone); |
|
818 if(!(dlg->ExecuteLD(R_NEW_SECURITY_CODE_QUERY))) |
|
819 return; |
|
820 |
|
821 // verification code query |
|
822 CCodeQueryDialog* dlg2 = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_SECURITY_CODE_MIN_LENGTH,SEC_C_SECURITY_CODE_CHANGE_MAX_LENGTH,ESecUiNone); |
|
823 if(!(dlg2->ExecuteLD(R_VERIFY_NEW_SECURITY_CODE_QUERY))) |
|
824 return; |
|
825 } |
|
826 iWait->SetRequestType(EMobilePhoneVerifySecurityCode); |
|
827 // check code |
|
828 iPhone.VerifySecurityCode(iWait->iStatus,secCodeType, oldPassword, required_fourth); |
|
829 res = iWait->WaitForRequestL(); |
|
830 #if defined(_DEBUG) |
|
831 RDebug::Print( _L("(SECUI)CSecuritySettings::ChangeSecCode(): CODE VERIFY RESP: %d"), res); |
|
832 #endif |
|
833 // change code |
|
834 if (res == KErrNone) |
|
835 { |
|
836 passwords.iOldPassword = oldPassword; |
|
837 passwords.iNewPassword = newPassword; |
|
838 iWait->SetRequestType(EMobilePhoneChangeSecurityCode); |
|
839 iPhone.ChangeSecurityCode(iWait->iStatus,secCodeType,passwords); |
|
840 res = iWait->WaitForRequestL(); |
|
841 } |
|
842 |
|
843 } |
|
844 |
|
845 #if defined(_DEBUG) |
|
846 RDebug::Print( _L("(SECUI)CSecuritySettings::ChangeSecCode(): RETURN CODE: %d"), res); |
|
847 #endif |
|
848 switch(res) |
|
849 { |
|
850 case KErrNone: |
|
851 { |
|
852 // code changed |
|
853 ShowResultNoteL(R_SECURITY_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); |
|
854 if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw ) && |
|
855 !(FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements ))) |
|
856 { |
|
857 // Send the changed code to the SCP server. Not used with device lock enhancements. |
|
858 |
|
859 RSCPClient scpClient; |
|
860 TSCPSecCode newCode; |
|
861 newCode.Copy( newPassword ); |
|
862 if ( scpClient.Connect() == KErrNone ) |
|
863 { |
|
864 scpClient.StoreCode( newCode ); |
|
865 scpClient.Close(); |
|
866 } |
|
867 } |
|
868 |
|
869 break; |
|
870 } |
|
871 case KErrGsmSSPasswordAttemptsViolation: |
|
872 case KErrLocked: |
|
873 { |
|
874 ShowResultNoteL(R_SEC_BLOCKED, CAknNoteDialog::EErrorTone); |
|
875 ChangeSecCodeL(); |
|
876 break; |
|
877 } |
|
878 case KErrGsm0707IncorrectPassword: |
|
879 case KErrAccessDenied: |
|
880 { |
|
881 // code was entered erroneously |
|
882 ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
|
883 ChangeSecCodeL(); |
|
884 break; |
|
885 } |
|
886 case KErrAbort: |
|
887 { |
|
888 break; |
|
889 } |
|
890 default: |
|
891 { |
|
892 ShowErrorNoteL(res); |
|
893 ChangeSecCodeL(); |
|
894 break; |
|
895 } |
|
896 } |
|
897 } |
|
898 // |
|
899 // ---------------------------------------------------------- |
|
900 // CSecuritySettings::ChangeAutoLockPeriodL() |
|
901 // Changes autolock period |
|
902 // ---------------------------------------------------------- |
|
903 // |
|
904 EXPORT_C TInt CSecuritySettings::ChangeAutoLockPeriodL(TInt aPeriod) |
|
905 { |
|
906 /***************************************************** |
|
907 * Series 60 Customer / ETel |
|
908 * Series 60 ETel API |
|
909 *****************************************************/ |
|
910 #if defined(_DEBUG) |
|
911 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodLXXXX()")); |
|
912 #endif |
|
913 RMobilePhone::TMobilePhoneLockSetting lockChange(RMobilePhone::ELockSetDisabled); |
|
914 RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; |
|
915 TInt currentItem = 0; |
|
916 TInt oldPeriod = aPeriod; |
|
917 |
|
918 #if defined(_DEBUG) |
|
919 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() ReadDesC16ArrayResourceL")); |
|
920 #endif |
|
921 |
|
922 |
|
923 CCoeEnv* coeEnv = CCoeEnv::Static(); |
|
924 CDesCArrayFlat* items = coeEnv->ReadDesC16ArrayResourceL(R_AUTOLOCK_LBX); |
|
925 CleanupStack::PushL(items); |
|
926 |
|
927 if (aPeriod == 0) |
|
928 { |
|
929 currentItem = 0; // autolock off |
|
930 } |
|
931 else |
|
932 { |
|
933 currentItem = 1; // user defined |
|
934 } |
|
935 |
|
936 |
|
937 #if defined(_DEBUG) |
|
938 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() New autolocksettingpage")); |
|
939 #endif |
|
940 |
|
941 CAutoLockSettingPage* dlg = new (ELeave)CAutoLockSettingPage(R_AUTOLOCK_SETTING_PAGE, currentItem, items, aPeriod); |
|
942 CleanupStack::PushL(dlg); |
|
943 dlg->ConstructL(); |
|
944 TInt maxPeriod; |
|
945 if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw )) |
|
946 { |
|
947 // Retrieve the current autolock period max. value from the SCP server, |
|
948 // and check that the value the user |
|
949 // selected is ok from the Corporate Policy point of view. |
|
950 RSCPClient scpClient; |
|
951 TInt ret = scpClient.Connect(); |
|
952 if ( ret == KErrNone ) |
|
953 { |
|
954 CleanupClosePushL( scpClient ); |
|
955 TBuf<KSCPMaxIntLength> maxPeriodBuf; |
|
956 if ( scpClient.GetParamValue( ESCPMaxAutolockPeriod, maxPeriodBuf ) == KErrNone ) |
|
957 { |
|
958 TLex lex( maxPeriodBuf ); |
|
959 if ( ( lex.Val( maxPeriod ) == KErrNone ) && ( maxPeriod > 0 ) ) |
|
960 { |
|
961 dlg->SetPeriodMaximumValue(maxPeriod); |
|
962 } |
|
963 else |
|
964 { |
|
965 maxPeriod = 0; |
|
966 dlg->SetPeriodMaximumValue(maxPeriod); |
|
967 } |
|
968 |
|
969 } |
|
970 else |
|
971 { |
|
972 #if defined(_DEBUG) |
|
973 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL():\ |
|
974 ERROR: Failed to retrieve max period")); |
|
975 #endif |
|
976 } |
|
977 } |
|
978 else |
|
979 { |
|
980 #if defined(_DEBUG) |
|
981 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL():\ |
|
982 ERROR: Failed to connect to SCP.")); |
|
983 #endif |
|
984 } |
|
985 CleanupStack::PopAndDestroy(); // scpClient |
|
986 } |
|
987 CleanupStack::Pop(); //dlg |
|
988 if (!dlg->ExecuteLD(CAknSettingPage::EUpdateWhenChanged)) |
|
989 { |
|
990 CleanupStack::PopAndDestroy(items); |
|
991 return oldPeriod; |
|
992 } |
|
993 |
|
994 CleanupStack::PopAndDestroy(); // items |
|
995 |
|
996 if ( FeatureManager::FeatureSupported( KFeatureIdSapTerminalControlFw ) ) |
|
997 { |
|
998 // define a flag indicating whether disable autolock is allowed. |
|
999 TBool allowDisableAL = ETrue; |
|
1000 |
|
1001 if ( ( aPeriod == 0 ) && ( maxPeriod > 0 ) ) |
|
1002 { |
|
1003 #if defined( _DEBUG ) |
|
1004 RDebug::Print( |
|
1005 _L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() \ |
|
1006 The period: %d is not allowed by TARM; max: %d" ), |
|
1007 aPeriod, maxPeriod ); |
|
1008 #endif |
|
1009 allowDisableAL = EFalse; |
|
1010 HBufC* prompt = NULL; |
|
1011 prompt = StringLoader::LoadLC( |
|
1012 R_SECUI_TEXT_AUTOLOCK_MUST_BE_ACTIVE ); |
|
1013 CAknNoteDialog* noteDlg = new ( ELeave ) CAknNoteDialog( |
|
1014 REINTERPRET_CAST( CEikDialog**,¬eDlg ) ); |
|
1015 noteDlg->PrepareLC( R_CODE_ERROR ); |
|
1016 noteDlg->SetTextL( *prompt ); |
|
1017 noteDlg->SetTimeout( CAknNoteDialog::ELongTimeout ); |
|
1018 noteDlg->SetTone( CAknNoteDialog::EErrorTone ); |
|
1019 noteDlg->RunLD(); |
|
1020 CleanupStack::PopAndDestroy( prompt ); |
|
1021 } |
|
1022 |
|
1023 if ( !allowDisableAL ) |
|
1024 { |
|
1025 return ChangeAutoLockPeriodL( oldPeriod ); |
|
1026 } |
|
1027 } |
|
1028 |
|
1029 if (aPeriod == 0) |
|
1030 { |
|
1031 |
|
1032 #ifdef RD_REMOTELOCK |
|
1033 |
|
1034 // If remote lock is enabled, don't disable the domestic OS device lock |
|
1035 // since that would render the RemoteLock useless. |
|
1036 // Instead just re-set the DOS lock to enabled which as a side effect |
|
1037 // requests the security code from the user. |
|
1038 |
|
1039 TBool remoteLockStatus( EFalse ); |
|
1040 CRemoteLockSettings* remoteLockSettings = CRemoteLockSettings::NewL(); |
|
1041 |
|
1042 if ( remoteLockSettings->GetEnabled( remoteLockStatus ) ) |
|
1043 { |
|
1044 if ( remoteLockStatus ) |
|
1045 { |
|
1046 // Remote lock is enabled |
|
1047 #ifdef _DEBUG |
|
1048 RDebug::Print( _L( "(SecUi)CSecuritySettings::ChangeAutoLockPeriodL() - RemoteLock is enabled: lockChange = RMobilePhone::ELockSetEnabled" ) ); |
|
1049 #endif // _DEBUG |
|
1050 |
|
1051 lockChange = RMobilePhone::ELockSetEnabled; |
|
1052 } |
|
1053 else |
|
1054 { |
|
1055 // Remote lock is disabled |
|
1056 #ifdef _DEBUG |
|
1057 RDebug::Print( _L( "(SecUi)CSecuritySettings::ChangeAutoLockPeriodL() - RemoteLock is disabled: lockChange = RMobilePhone::ELockSetDisabled" ) ); |
|
1058 #endif // _DEBUG |
|
1059 |
|
1060 lockChange = RMobilePhone::ELockSetDisabled; |
|
1061 } |
|
1062 } |
|
1063 else |
|
1064 { |
|
1065 // Failed to get remote lock status |
|
1066 #ifdef _DEBUG |
|
1067 RDebug::Print( _L( "(SecUi)CSecuritySettings::ChangeAutoLockPeriodL() - Failed to get RemoteLock status" ) ); |
|
1068 #endif // _DEBUG |
|
1069 } |
|
1070 |
|
1071 delete remoteLockSettings; |
|
1072 remoteLockSettings = NULL; |
|
1073 |
|
1074 #else // not defined RD_REMOTELOCK |
|
1075 |
|
1076 lockChange = RMobilePhone::ELockSetDisabled; |
|
1077 |
|
1078 #endif // RD_REMOTELOCK |
|
1079 } |
|
1080 else |
|
1081 { |
|
1082 lockChange = RMobilePhone::ELockSetEnabled; |
|
1083 } |
|
1084 #if defined(_DEBUG) |
|
1085 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() SetLockSetting")); |
|
1086 #endif |
|
1087 iWait->SetRequestType(EMobilePhoneSetLockSetting); |
|
1088 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); |
|
1089 iPhone.SetLockSetting(iWait->iStatus,lockType,lockChange); |
|
1090 TInt status = iWait->WaitForRequestL(); |
|
1091 #if defined(_DEBUG) |
|
1092 RDebug::Print( _L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL(): RETURN CODE: %d"), status); |
|
1093 #endif |
|
1094 switch(status) |
|
1095 { |
|
1096 case KErrNone: |
|
1097 #if defined(_DEBUG) |
|
1098 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() KErrNone")); |
|
1099 #endif |
|
1100 break; |
|
1101 case KErrGsmSSPasswordAttemptsViolation: |
|
1102 case KErrLocked: |
|
1103 #if defined(_DEBUG) |
|
1104 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() PasswordAttemptsViolation")); |
|
1105 #endif |
|
1106 return ChangeAutoLockPeriodL(oldPeriod); |
|
1107 case KErrGsm0707IncorrectPassword: |
|
1108 case KErrAccessDenied: |
|
1109 #if defined(_DEBUG) |
|
1110 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() IncorrectPassword")); |
|
1111 #endif |
|
1112 // code was entered erroneously |
|
1113 return ChangeAutoLockPeriodL(oldPeriod); |
|
1114 case KErrAbort: |
|
1115 // User pressed "cancel" in the code query dialog. |
|
1116 return oldPeriod; |
|
1117 default: |
|
1118 #if defined(_DEBUG) |
|
1119 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() default")); |
|
1120 #endif |
|
1121 return ChangeAutoLockPeriodL(oldPeriod); |
|
1122 } |
|
1123 #if defined(_DEBUG) |
|
1124 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() END")); |
|
1125 #endif |
|
1126 return aPeriod; |
|
1127 } |
|
1128 |
|
1129 |
|
1130 |
|
1131 // |
|
1132 // ---------------------------------------------------------- |
|
1133 // CSecuritySettings::ChangeRemoteLockStatusL() |
|
1134 // Changes remote lock status (on/off) |
|
1135 // ---------------------------------------------------------- |
|
1136 // |
|
1137 EXPORT_C TInt CSecuritySettings::ChangeRemoteLockStatusL( TBool& aRemoteLockStatus, TDes& aRemoteLockCode, TInt aAutoLockPeriod ) |
|
1138 { |
|
1139 #ifdef RD_REMOTELOCK |
|
1140 TInt retValue( KErrNone ); |
|
1141 |
|
1142 #ifdef _DEBUG |
|
1143 RDebug::Print(_L("(SecUi)CSecuritySettings::ChangeRemoteLockStatusL() - Enter, aRemoteLockStatus == %d, aAutoLockPeriod == %d" ), aRemoteLockStatus, aAutoLockPeriod ); |
|
1144 #endif // _DEBUG |
|
1145 |
|
1146 CCoeEnv* coeEnv = CCoeEnv::Static(); |
|
1147 CDesCArrayFlat* items = coeEnv->ReadDesC16ArrayResourceL( R_REMOTELOCK_LBX ); |
|
1148 CleanupStack::PushL( items ); |
|
1149 |
|
1150 // Store the current remote lock setting |
|
1151 TInt previousItem( 0 ); |
|
1152 TInt currentItem( 0 ); |
|
1153 |
|
1154 if ( aRemoteLockStatus ) |
|
1155 { |
|
1156 previousItem = KRemoteLockSettingItemOn; |
|
1157 currentItem = KRemoteLockSettingItemOn; |
|
1158 } |
|
1159 else |
|
1160 { |
|
1161 previousItem = KRemoteLockSettingItemOff; |
|
1162 currentItem = KRemoteLockSettingItemOff; |
|
1163 } |
|
1164 |
|
1165 // Create Remote Lock setting page for user to enable or disable remote locking |
|
1166 CRemoteLockSettingPage* remoteLockSettingPage = new( ELeave ) CRemoteLockSettingPage( R_REMOTELOCK_SETTING_PAGE, currentItem, items ); |
|
1167 |
|
1168 #ifdef _DEBUG |
|
1169 RDebug::Print( _L( "(SecUi)CSecuritySettings::ChangeRemoteLockStatusL() - Executing CRemoteLockSettingPage dialog" ) ); |
|
1170 #endif // _DEBUG |
|
1171 |
|
1172 // Execute the remote lock enable/disable dialog |
|
1173 TBool ret = remoteLockSettingPage->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ); |
|
1174 |
|
1175 // Setting page list box items (texts) no longer needed |
|
1176 CleanupStack::PopAndDestroy( items ); |
|
1177 |
|
1178 if ( ret ) |
|
1179 { |
|
1180 if ( currentItem == KRemoteLockSettingItemOn ) |
|
1181 { |
|
1182 #ifdef _DEBUG |
|
1183 RDebug::Print( _L( "(SecUi)CSecuritySettings::ChangeRemoteLockStatusL() - Remote lock status set to ON" ) ); |
|
1184 #endif // _DEBUG |
|
1185 |
|
1186 aRemoteLockStatus = ETrue; |
|
1187 |
|
1188 // If user wishes to enable remote lock |
|
1189 // a new remote lock code is required. |
|
1190 // RemoteLockCodeQueryL also |
|
1191 retValue = RemoteLockCodeQueryL( aRemoteLockCode ); |
|
1192 } |
|
1193 else if ( currentItem == KRemoteLockSettingItemOff ) |
|
1194 { |
|
1195 #ifdef _DEBUG |
|
1196 RDebug::Print( _L( "(SecUi)CSecuritySettings::ChangeRemoteLockStatusL() - Remote lock status set to OFF" ) ); |
|
1197 #endif // _DEBUG |
|
1198 |
|
1199 aRemoteLockStatus = EFalse; |
|
1200 retValue = KErrNone; |
|
1201 |
|
1202 // Check whether the status was already off |
|
1203 // If not don't make the user enter the security code |
|
1204 // (which occurs when setting the DOS lock setting) for no reason. |
|
1205 if ( currentItem != previousItem ) |
|
1206 { |
|
1207 // Check whether AutoLock is enabled (timeout value greater |
|
1208 // than zero) or not. If AutoLock is enabled the domestic OS |
|
1209 // device lock should be left enabled. |
|
1210 if ( aAutoLockPeriod == 0 ) |
|
1211 { |
|
1212 // Disable lock setting from domestic OS |
|
1213 retValue = RemoteLockSetLockSettingL( EFalse ); |
|
1214 } |
|
1215 else |
|
1216 { |
|
1217 // If AutoLock is enabled, don't disable the DOS device lock |
|
1218 // Re-set (enable) the domestic OS device lock because as a |
|
1219 // side effect it requires the security code from the user |
|
1220 retValue = RemoteLockSetLockSettingL( ETrue ); |
|
1221 } |
|
1222 } |
|
1223 } |
|
1224 else |
|
1225 { |
|
1226 // This should never happen. But if it does don't change anything |
|
1227 retValue = KErrUnknown; |
|
1228 } |
|
1229 } |
|
1230 else |
|
1231 { |
|
1232 // Something went wrong with the RemoteLockSettingPage dialog |
|
1233 retValue = KErrGeneral; |
|
1234 |
|
1235 #ifdef _DEBUG |
|
1236 RDebug::Print( _L( "(SecUi)CSecuritySettings::ChangeRemoteLockStatusL() - CRemoteLockSettingPage::ExecuteLD() failed" ) ); |
|
1237 #endif // _DEBUG |
|
1238 } |
|
1239 |
|
1240 #ifdef _DEBUG |
|
1241 RDebug::Print(_L("(SecUi)CSecuritySettings::ChangeRemoteLockStatusL() - Exit" ) ); |
|
1242 #endif |
|
1243 |
|
1244 return retValue; |
|
1245 #else //! RD_REMOTELOCK |
|
1246 return KErrNotSupported; |
|
1247 #endif //RD_REMOTELOCK |
|
1248 } |
|
1249 // |
|
1250 // ---------------------------------------------------------- |
|
1251 // CSecuritySettings::RemoteLockCodeQueryL() |
|
1252 // Pops up remote lock code query. Requires user to enter a new remote lock |
|
1253 // code twice and if they match enables the domestic OS device lock (which as |
|
1254 // a side effect pops up security code query). |
|
1255 // ---------------------------------------------------------- |
|
1256 // |
|
1257 TInt CSecuritySettings::RemoteLockCodeQueryL( TDes& aRemoteLockCode ) |
|
1258 { |
|
1259 #ifdef RD_REMOTELOCK |
|
1260 TInt retValue( KErrNone ); |
|
1261 |
|
1262 #ifdef _DEBUG |
|
1263 RDebug::Print(_L("(SecUi)CSecuritySettings::ChangeRemoteLockCodeL() - Enter" ) ); |
|
1264 #endif // _DEBUG |
|
1265 |
|
1266 // Clear the remote lock code buffer |
|
1267 aRemoteLockCode.Zero(); |
|
1268 |
|
1269 // ----- Remote lock code query ------------------------------------------- |
|
1270 |
|
1271 // Execute Remote Lock code query |
|
1272 #ifdef _DEBUG |
|
1273 RDebug::Print( _L( "(SecUi)CSecuritySettings::ChangeRemoteLockCodeL() - Executing remote lock code query" ) ); |
|
1274 #endif // _DEBUG |
|
1275 |
|
1276 // Load the query prompt from resources |
|
1277 CCodeQueryDialog* codeQuery = new( ELeave ) CCodeQueryDialog( aRemoteLockCode, SEC_REMOTELOCK_CODE_MIN_LENGTH,SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiNone, ETrue ); |
|
1278 TInt buttonId = codeQuery->ExecuteLD( R_REMOTELOCK_CODE_QUERY ); |
|
1279 if ( buttonId == EEikBidOk ) |
|
1280 { |
|
1281 // Ok was pressed and the remote lock code seems fine |
|
1282 retValue = KErrNone; |
|
1283 } |
|
1284 else |
|
1285 { |
|
1286 // User pressed Cancel |
|
1287 // Set the code length to zero leaving no trash for possible retry |
|
1288 aRemoteLockCode.Zero(); |
|
1289 retValue = KErrAbort; |
|
1290 } |
|
1291 |
|
1292 if ( retValue != KErrNone ) |
|
1293 { |
|
1294 #ifdef _DEBUG |
|
1295 RDebug::Print(_L("(SecUi)CSecuritySettings::ChangeRemoteLockCodeL() - Exit, Remote lock code error" ) ); |
|
1296 #endif // _DEBUG |
|
1297 |
|
1298 // Can't continue beyond this |
|
1299 return retValue; |
|
1300 } |
|
1301 |
|
1302 // ----- Remote lock code confirm query ----------------------------------- |
|
1303 |
|
1304 // Confirm the code by asking it again |
|
1305 #ifdef _DEBUG |
|
1306 RDebug::Print( _L( "(SecUi)CSecuritySettings::ChangeRemoteLockCodeL() - Executing remote lock code verify query" ) ); |
|
1307 #endif // _DEBUG |
|
1308 |
|
1309 // Buffer for the confirmation code |
|
1310 TBuf<KRLockMaxLockCodeLength> confirmCode; |
|
1311 |
|
1312 // Load the confirmation query prompt from resources |
|
1313 CCodeQueryDialog* codeConfirmQuery = new( ELeave ) CCodeQueryDialog( confirmCode, SEC_REMOTELOCK_CODE_MIN_LENGTH, SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiNone, ETrue ); |
|
1314 buttonId = codeConfirmQuery->ExecuteLD( R_VERIFY_REMOTELOCK_CODE_QUERY); |
|
1315 |
|
1316 |
|
1317 if ( buttonId == EEikBidOk ) |
|
1318 { |
|
1319 // Compare codes. Compare returns zero if descriptors have |
|
1320 // the same length and the same content |
|
1321 while ( (aRemoteLockCode.CompareF( confirmCode ) != 0) && (buttonId == EEikBidOk)) |
|
1322 { |
|
1323 //Codes didn't match; zero the bufffers and show the dialog again |
|
1324 aRemoteLockCode.Zero(); |
|
1325 confirmCode.Zero(); |
|
1326 // Codes don't match. Notify user |
|
1327 ShowResultNoteL( R_REMOTELOCK_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone ); |
|
1328 codeQuery = new( ELeave ) CCodeQueryDialog( aRemoteLockCode, SEC_REMOTELOCK_CODE_MIN_LENGTH,SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiNone, ETrue ); |
|
1329 buttonId = codeQuery->ExecuteLD( R_REMOTELOCK_CODE_QUERY ); |
|
1330 //Unless user pressed Cancel show the verification query |
|
1331 if(buttonId == EEikBidOk) |
|
1332 { |
|
1333 codeConfirmQuery = new( ELeave ) CCodeQueryDialog( confirmCode, SEC_REMOTELOCK_CODE_MIN_LENGTH, SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiNone, ETrue ); |
|
1334 buttonId = codeConfirmQuery->ExecuteLD( R_VERIFY_REMOTELOCK_CODE_QUERY); |
|
1335 } |
|
1336 |
|
1337 } |
|
1338 //User pressed cancel |
|
1339 if(buttonId != EEikBidOk) |
|
1340 { |
|
1341 // Set the code length to zero leaving no trash for possible retry |
|
1342 // Report error and let the user try again |
|
1343 aRemoteLockCode.Zero(); |
|
1344 confirmCode.Zero(); |
|
1345 retValue = KErrAbort; |
|
1346 } |
|
1347 else |
|
1348 { |
|
1349 // Codes match |
|
1350 confirmCode.Zero(); |
|
1351 |
|
1352 // ----- Check against security code ------------------------------ |
|
1353 |
|
1354 // Check that the new remote lock code doesn't match the security |
|
1355 // code of the device. |
|
1356 |
|
1357 RMobilePhone::TMobilePhoneSecurityCode secCodeType; |
|
1358 secCodeType = RMobilePhone::ESecurityCodePhonePassword; |
|
1359 RMobilePhone::TMobilePassword securityCode; |
|
1360 RMobilePhone::TMobilePassword unblockCode; // Required here only as a dummy parameter |
|
1361 |
|
1362 if ( aRemoteLockCode.Length() <= RMobilePhone::KMaxMobilePasswordSize ) |
|
1363 { |
|
1364 securityCode = aRemoteLockCode; |
|
1365 iWait->SetRequestType( EMobilePhoneVerifySecurityCode ); |
|
1366 iPhone.VerifySecurityCode( iWait->iStatus, secCodeType, securityCode, unblockCode ); |
|
1367 TInt res = iWait->WaitForRequestL(); |
|
1368 // The remote lock code matches the security code |
|
1369 // and that is not allowed |
|
1370 while ( (res == KErrNone) && (buttonId == EEikBidOk)) |
|
1371 { |
|
1372 #ifdef _DEBUG |
|
1373 RDebug::Print(_L("(SecUi)CSecuritySettings::ChangeRemoteLockCodeL() - Unacceptable remote lock code" ) ); |
|
1374 #endif // _DEBUG |
|
1375 aRemoteLockCode.Zero(); |
|
1376 confirmCode.Zero(); |
|
1377 |
|
1378 ShowResultNoteL( R_REMOTELOCK_INVALID_CODE, CAknNoteDialog::EErrorTone ); |
|
1379 |
|
1380 codeQuery = new( ELeave ) CCodeQueryDialog( aRemoteLockCode, SEC_REMOTELOCK_CODE_MIN_LENGTH,SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiNone, ETrue ); |
|
1381 buttonId = codeQuery->ExecuteLD( R_REMOTELOCK_CODE_QUERY ); |
|
1382 //Unless user pressed Cancel show the verification query |
|
1383 if(buttonId == EEikBidOk) |
|
1384 { |
|
1385 codeConfirmQuery = new( ELeave ) CCodeQueryDialog( confirmCode, SEC_REMOTELOCK_CODE_MIN_LENGTH, SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiNone, ETrue ); |
|
1386 buttonId = codeConfirmQuery->ExecuteLD( R_VERIFY_REMOTELOCK_CODE_QUERY); |
|
1387 |
|
1388 // Compare codes. Compare returns zero if descriptors have |
|
1389 // the same length and the same content |
|
1390 while ( (aRemoteLockCode.CompareF( confirmCode ) != 0) && (buttonId == EEikBidOk)) |
|
1391 { |
|
1392 //Codes didn't match; zero the bufffers and show the dialog again |
|
1393 aRemoteLockCode.Zero(); |
|
1394 confirmCode.Zero(); |
|
1395 // Codes don't match. Notify user |
|
1396 ShowResultNoteL( R_REMOTELOCK_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone ); |
|
1397 codeQuery = new( ELeave ) CCodeQueryDialog( aRemoteLockCode, SEC_REMOTELOCK_CODE_MIN_LENGTH,SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiNone, ETrue ); |
|
1398 buttonId = codeQuery->ExecuteLD( R_REMOTELOCK_CODE_QUERY ); |
|
1399 //Unless user pressed Cancel show the verification query |
|
1400 if(buttonId == EEikBidOk) |
|
1401 { |
|
1402 codeConfirmQuery = new( ELeave ) CCodeQueryDialog( confirmCode, SEC_REMOTELOCK_CODE_MIN_LENGTH, SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiNone, ETrue ); |
|
1403 buttonId = codeConfirmQuery->ExecuteLD( R_VERIFY_REMOTELOCK_CODE_QUERY); |
|
1404 } |
|
1405 |
|
1406 } |
|
1407 //User pressed cancel |
|
1408 if(buttonId != EEikBidOk) |
|
1409 { |
|
1410 // Set the code length to zero leaving no trash for possible retry |
|
1411 // Report error and let the user try again |
|
1412 aRemoteLockCode.Zero(); |
|
1413 confirmCode.Zero(); |
|
1414 retValue = KErrAbort; |
|
1415 } |
|
1416 else //Check against security code |
|
1417 { |
|
1418 securityCode = aRemoteLockCode; |
|
1419 iWait->SetRequestType( EMobilePhoneVerifySecurityCode ); |
|
1420 iPhone.VerifySecurityCode( iWait->iStatus, secCodeType, securityCode, unblockCode ); |
|
1421 res = iWait->WaitForRequestL(); |
|
1422 } |
|
1423 } |
|
1424 |
|
1425 } |
|
1426 //User pressed cancel |
|
1427 if(buttonId != EEikBidOk) |
|
1428 { |
|
1429 // Set the code length to zero leaving no trash for possible retry |
|
1430 // Report error and let the user try again |
|
1431 aRemoteLockCode.Zero(); |
|
1432 confirmCode.Zero(); |
|
1433 retValue = KErrAbort; |
|
1434 } |
|
1435 } |
|
1436 |
|
1437 // ----- Enable DOS device lock (Security code query) ------------- |
|
1438 |
|
1439 if ( retValue == KErrNone ) |
|
1440 { |
|
1441 // Enable lock setting in domestic OS. It is safe to enable the |
|
1442 // lock setting since RemoteLock API requires remote locking to |
|
1443 // be enabled when changing or setting the remote lock message. |
|
1444 retValue = RemoteLockSetLockSettingL( ETrue ); |
|
1445 } |
|
1446 } |
|
1447 } |
|
1448 else //User pressed Cancel |
|
1449 { |
|
1450 // Set the code length to zero leaving no trash for possible retry |
|
1451 aRemoteLockCode.Zero(); |
|
1452 confirmCode.Zero(); |
|
1453 retValue = KErrAbort; |
|
1454 } |
|
1455 |
|
1456 #ifdef _DEBUG |
|
1457 RDebug::Print(_L("(SecUi)CSecuritySettings::ChangeRemoteLockCodeL() - Exit" ) ); |
|
1458 #endif // _DEBUG |
|
1459 |
|
1460 return retValue; |
|
1461 #else //! RD_REMOTELOCK |
|
1462 return KErrNotSupported; |
|
1463 #endif //RD_REMOTELOCK |
|
1464 } |
|
1465 // |
|
1466 // ---------------------------------------------------------- |
|
1467 // CSecuritySettings::RemoteLockSetLockSettingL() |
|
1468 // Changes lock setting in domestic OS. Changing the domestic OS lock setting |
|
1469 // requires user to enter the security code. |
|
1470 // ---------------------------------------------------------- |
|
1471 // |
|
1472 TInt CSecuritySettings::RemoteLockSetLockSettingL( TBool aLockSetting ) |
|
1473 { |
|
1474 #ifdef RD_REMOTELOCK |
|
1475 TInt retValue( KErrNone ); |
|
1476 |
|
1477 #ifdef _DEBUG |
|
1478 RDebug::Print(_L("(SecUi)CSecuritySettings::RemoteLockSetLockSettingL( %d ) - Enter" ), aLockSetting ); |
|
1479 #endif // _DEBUG |
|
1480 |
|
1481 RMobilePhone::TMobilePhoneLockSetting lockSetting = RMobilePhone::ELockSetEnabled; |
|
1482 RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; |
|
1483 |
|
1484 if ( aLockSetting ) |
|
1485 { |
|
1486 lockSetting = RMobilePhone::ELockSetEnabled; |
|
1487 } |
|
1488 else |
|
1489 { |
|
1490 lockSetting = RMobilePhone::ELockSetDisabled; |
|
1491 } |
|
1492 |
|
1493 iWait->SetRequestType( EMobilePhoneSetLockSetting ); |
|
1494 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); |
|
1495 iPhone.SetLockSetting( iWait->iStatus, lockType, lockSetting ); |
|
1496 |
|
1497 // Wait for code verify to complete |
|
1498 retValue = iWait->WaitForRequestL(); |
|
1499 |
|
1500 switch( retValue ) |
|
1501 { |
|
1502 case KErrNone: |
|
1503 #ifdef _DEBUG |
|
1504 RDebug::Print( _L( "(SecUi)CSecuritySettings::RemoteLockSetLockSettingL() - EMobilePhoneSetLockSetting request returned KErrNone" ) ); |
|
1505 #endif // _DEBUG |
|
1506 break; |
|
1507 |
|
1508 case KErrGsmSSPasswordAttemptsViolation: |
|
1509 case KErrLocked: |
|
1510 #ifdef _DEBUG |
|
1511 RDebug::Print( _L( "(SecUi)CSecuritySettings::RemoteLockSetLockSettingL() - EMobilePhoneSetLockSetting request returned KErrLocked" ) ); |
|
1512 #endif // _DEBUG |
|
1513 //Error note is shown in CSecurityHandler::PassPhraseRequired() |
|
1514 break; |
|
1515 |
|
1516 case KErrGsm0707IncorrectPassword: |
|
1517 case KErrAccessDenied: |
|
1518 #ifdef _DEBUG |
|
1519 RDebug::Print( _L( "(SecUi)CSecuritySettings::RemoteLockSetLockSettingL() - EMobilePhoneSetLockSetting request returned KErrAccessDenied" ) ); |
|
1520 #endif // _DEBUG |
|
1521 // Security code was entered erroneously |
|
1522 //Error note is shown in CSecurityHandler::PassPhraseRequired() |
|
1523 break; |
|
1524 |
|
1525 case KErrAbort: |
|
1526 #ifdef _DEBUG |
|
1527 RDebug::Print( _L( "(SecUi)CSecuritySettings::RemoteLockSetLockSettingL() - EMobilePhoneSetLockSetting request returned KErrAbort" ) ); |
|
1528 #endif // _DEBUG |
|
1529 break; |
|
1530 |
|
1531 default: |
|
1532 #ifdef _DEBUG |
|
1533 RDebug::Print( _L( "(SecUi)CSecuritySettings::RemoteLockSetLockSettingL() - EMobilePhoneSetLockSetting request returned: %d"), retValue ); |
|
1534 #endif // _DEBUG |
|
1535 break; |
|
1536 } |
|
1537 |
|
1538 #ifdef _DEBUG |
|
1539 RDebug::Print(_L("(SecUi)CSecuritySettings::RemoteLockSetLockSettingL() - Exit" ) ); |
|
1540 #endif // _DEBUG |
|
1541 |
|
1542 return retValue; |
|
1543 #else //! RD_REMOTELOCK |
|
1544 return KErrNotSupported; |
|
1545 #endif //RD_REMOTELOCK |
|
1546 } |
|
1547 |
|
1548 |
|
1549 |
|
1550 // |
|
1551 // ---------------------------------------------------------- |
|
1552 // CSecuritySettings::ChangeSimSecurityL() |
|
1553 // Changes SIM security |
|
1554 // ---------------------------------------------------------- |
|
1555 // |
|
1556 EXPORT_C TBool CSecuritySettings::ChangeSimSecurityL() |
|
1557 { |
|
1558 /***************************************************** |
|
1559 * Series 60 Customer / ETel |
|
1560 * Series 60 ETel API |
|
1561 *****************************************************/ |
|
1562 #if defined(_DEBUG) |
|
1563 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeSimSecurityL()")); |
|
1564 #endif |
|
1565 |
|
1566 RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
|
1567 RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
|
1568 RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneToICC; |
|
1569 RMobilePhone::TMobilePhoneLockSetting lockChangeSetting; |
|
1570 CCoeEnv* coeEnv = CCoeEnv::Static(); |
|
1571 CDesCArrayFlat* items = coeEnv->ReadDesC16ArrayResourceL(R_SECURITY_LBX); |
|
1572 CleanupStack::PushL(items); |
|
1573 |
|
1574 //get lock info |
|
1575 iWait->SetRequestType(EMobilePhoneGetLockInfo); |
|
1576 iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); |
|
1577 TInt status = iWait->WaitForRequestL(); |
|
1578 User::LeaveIfError(status); |
|
1579 TInt currentItem = 0; |
|
1580 |
|
1581 if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) |
|
1582 { |
|
1583 #if defined(_DEBUG) |
|
1584 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeSimSecurityL()lockInfo: ELockSetDisabled")); |
|
1585 #endif |
|
1586 currentItem = 1; // off |
|
1587 } |
|
1588 |
|
1589 TInt oldItem = currentItem; |
|
1590 |
|
1591 CAknRadioButtonSettingPage* dlg = new (ELeave)CAknRadioButtonSettingPage(R_SECURITY_SETTING_PAGE, currentItem, items); |
|
1592 CleanupStack::PushL(dlg); |
|
1593 |
|
1594 |
|
1595 CleanupStack::Pop(); // dlg |
|
1596 if ( !(dlg->ExecuteLD(CAknSettingPage::EUpdateWhenChanged)) || oldItem==currentItem ) |
|
1597 { |
|
1598 CleanupStack::PopAndDestroy(); // items |
|
1599 return EFalse; |
|
1600 } |
|
1601 |
|
1602 |
|
1603 |
|
1604 if (currentItem == 1) |
|
1605 { |
|
1606 lockChangeSetting = RMobilePhone::ELockSetDisabled; |
|
1607 } |
|
1608 else |
|
1609 { |
|
1610 lockChangeSetting = RMobilePhone::ELockSetEnabled; |
|
1611 } |
|
1612 |
|
1613 CleanupStack::PopAndDestroy(); // items |
|
1614 |
|
1615 iWait->SetRequestType(EMobilePhoneSetLockSetting); |
|
1616 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); |
|
1617 iPhone.SetLockSetting(iWait->iStatus,lockType,lockChangeSetting); |
|
1618 status = iWait->WaitForRequestL(); |
|
1619 |
|
1620 #if defined(_DEBUG) |
|
1621 RDebug::Print( _L("(SECUI)CSecuritySettings::ChangeSimSecurityL(): RETURN CODE: %d"), status); |
|
1622 #endif |
|
1623 switch(status) |
|
1624 { |
|
1625 case KErrNone: |
|
1626 { |
|
1627 break; |
|
1628 } |
|
1629 case KErrGsm0707IncorrectPassword: |
|
1630 case KErrAccessDenied: |
|
1631 { |
|
1632 // code was entered erroneously |
|
1633 return ChangeSimSecurityL(); |
|
1634 } |
|
1635 case KErrGsmSSPasswordAttemptsViolation: |
|
1636 case KErrLocked: |
|
1637 { |
|
1638 return ChangeSimSecurityL(); |
|
1639 } |
|
1640 case KErrAbort: |
|
1641 { |
|
1642 return EFalse; |
|
1643 } |
|
1644 default: |
|
1645 { |
1179 ShowErrorNoteL(status); |
1646 ShowErrorNoteL(status); |
1180 break; |
1647 return ChangeSimSecurityL(); |
1181 } |
1648 } |
|
1649 } |
|
1650 |
|
1651 return ETrue; |
1182 } |
1652 } |
1183 // |
1653 // |
1184 // ---------------------------------------------------------- |
1654 // ---------------------------------------------------------- |
1185 // CSecuritySettings::GetFndMode() |
1655 // CSecuritySettings::ChangePinRequestL() |
1186 // Retrieves the current Fixed Dialling Numbers mode |
1656 // Changes PIN1 request |
1187 // ---------------------------------------------------------- |
1657 // ---------------------------------------------------------- |
1188 // qtdone |
1658 // |
1189 EXPORT_C TInt CSecuritySettings::GetFdnMode(RMobilePhone::TMobilePhoneFdnStatus& aFdnMode) |
1659 EXPORT_C TBool CSecuritySettings::ChangePinRequestL() |
|
1660 { |
|
1661 /***************************************************** |
|
1662 * Series 60 Customer / ETel |
|
1663 * Series 60 ETel API |
|
1664 *****************************************************/ |
|
1665 #if defined(_DEBUG) |
|
1666 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestL()")); |
|
1667 #endif |
|
1668 TInt simState; |
|
1669 TInt err( KErrGeneral ); |
|
1670 err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); |
|
1671 User::LeaveIfError( err ); |
|
1672 TBool simRemoved(simState == ESimNotPresent); |
|
1673 |
|
1674 if ( simRemoved ) |
|
1675 { |
|
1676 ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); |
|
1677 return EFalse;; |
|
1678 } |
|
1679 |
|
1680 RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
|
1681 RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
|
1682 RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockICC; |
|
1683 |
|
1684 RMobilePhone::TMobilePhoneLockSetting lockChangeSetting; |
|
1685 |
|
1686 CCoeEnv* coeEnv = CCoeEnv::Static(); |
|
1687 CDesCArrayFlat* items = coeEnv->ReadDesC16ArrayResourceL(R_PIN_LBX); |
|
1688 CleanupStack::PushL(items); |
|
1689 |
|
1690 //get lock info |
|
1691 iWait->SetRequestType(EMobilePhoneGetLockInfo); |
|
1692 iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); |
|
1693 TInt status = iWait->WaitForRequestL(); |
|
1694 User::LeaveIfError(status); |
|
1695 TInt currentItem = 0; |
|
1696 |
|
1697 #if defined(_DEBUG) |
|
1698 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestL() GetLockInfo")); |
|
1699 #endif |
|
1700 |
|
1701 if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) |
|
1702 { |
|
1703 #if defined(_DEBUG) |
|
1704 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestL() lockInfo: ELockSetDisabled")); |
|
1705 #endif |
|
1706 currentItem = 1; // off |
|
1707 } |
|
1708 |
|
1709 TInt oldItem = currentItem; |
|
1710 |
|
1711 CAknRadioButtonSettingPage* dlg = new (ELeave)CAknRadioButtonSettingPage(R_PIN_SETTING_PAGE, currentItem, items); |
|
1712 CleanupStack::PushL(dlg); |
|
1713 |
|
1714 |
|
1715 CleanupStack::Pop(); // dlg |
|
1716 if ( !(dlg->ExecuteLD(CAknSettingPage::EUpdateWhenChanged)) || oldItem==currentItem ) |
|
1717 { |
|
1718 CleanupStack::PopAndDestroy(); // items |
|
1719 return EFalse; |
|
1720 } |
|
1721 |
|
1722 |
|
1723 if (currentItem == 1) |
|
1724 { |
|
1725 #if defined(_DEBUG) |
|
1726 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestL() currentItem: ELockSetDisabled")); |
|
1727 #endif |
|
1728 lockChangeSetting = RMobilePhone::ELockSetDisabled; |
|
1729 } |
|
1730 else |
|
1731 { |
|
1732 #if defined(_DEBUG) |
|
1733 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestL() currentItem: ELockSetEnabled")); |
|
1734 #endif |
|
1735 lockChangeSetting = RMobilePhone::ELockSetEnabled; |
|
1736 } |
|
1737 |
|
1738 CleanupStack::PopAndDestroy(); // items |
|
1739 |
|
1740 // Raise a flag to indicate that the PIN |
|
1741 // request coming from ETEL has originated from SecUi and not from Engine. |
|
1742 TInt tRet = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSecUIOriginated); |
|
1743 if ( tRet != KErrNone ) |
|
1744 { |
|
1745 #if defined(_DEBUG) |
|
1746 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestL():\ |
|
1747 FAILED to set the SECUI query Flag: %d"), tRet); |
|
1748 #endif |
|
1749 } |
|
1750 // Change the lock setting |
|
1751 iWait->SetRequestType(EMobilePhoneSetLockSetting); |
|
1752 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); |
|
1753 iPhone.SetLockSetting(iWait->iStatus,lockType,lockChangeSetting); |
|
1754 status = iWait->WaitForRequestL(); |
|
1755 #if defined(_DEBUG) |
|
1756 RDebug::Print( _L("(SECUI)CSecuritySettings::ChangePinRequestL(): RETURN CODE: %d"), status); |
|
1757 #endif |
|
1758 |
|
1759 // Lower the flag |
|
1760 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsETelAPIOriginated); |
|
1761 |
|
1762 switch(status) |
|
1763 { |
|
1764 case KErrNone: |
|
1765 { |
|
1766 break; |
|
1767 } |
|
1768 case KErrGsm0707OperationNotAllowed: |
|
1769 { |
|
1770 // not allowed with this sim |
|
1771 ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
|
1772 return EFalse; |
|
1773 } |
|
1774 case KErrGsm0707IncorrectPassword: |
|
1775 case KErrAccessDenied: |
|
1776 { |
|
1777 // code was entered erroneously |
|
1778 return ChangePinRequestL(); |
|
1779 } |
|
1780 case KErrGsmSSPasswordAttemptsViolation: |
|
1781 case KErrLocked: |
|
1782 { |
|
1783 return ETrue; |
|
1784 } |
|
1785 case KErrAbort: |
|
1786 { |
|
1787 return EFalse; |
|
1788 } |
|
1789 default: |
|
1790 { |
|
1791 return ChangePinRequestL(); |
|
1792 } |
|
1793 } |
|
1794 |
|
1795 return ETrue; |
|
1796 } |
|
1797 |
|
1798 // |
|
1799 // ---------------------------------------------------------- |
|
1800 // CSecuritySettings::ChangeUPinRequestL() |
|
1801 // Changes UPIN request on/off |
|
1802 // ---------------------------------------------------------- |
|
1803 // |
|
1804 EXPORT_C TBool CSecuritySettings::ChangeUPinRequestL() |
1190 { |
1805 { |
1191 /***************************************************** |
1806 TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); |
1192 * Series 60 Customer / ETel |
1807 TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); |
1193 * Series 60 ETel API |
1808 if(wcdmaSupported || upinSupported) |
1194 *****************************************************/ |
1809 { |
1195 RDEBUG("0", 0); |
1810 #if defined(_DEBUG) |
1196 return iPhone.GetFdnStatus(aFdnMode); |
1811 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeUPinRequestL()")); |
|
1812 #endif |
|
1813 |
|
1814 TInt simState; |
|
1815 TInt err( KErrGeneral ); |
|
1816 err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); |
|
1817 User::LeaveIfError( err ); |
|
1818 TBool simRemoved(simState == ESimNotPresent); |
|
1819 |
|
1820 if ( simRemoved ) |
|
1821 { |
|
1822 ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); |
|
1823 return EFalse; |
|
1824 } |
|
1825 |
|
1826 RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
|
1827 RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
|
1828 RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockUniversalPin; |
|
1829 |
|
1830 RMobilePhone::TMobilePhoneLockSetting lockChangeSetting = RMobilePhone::ELockSetDisabled; |
|
1831 |
|
1832 CCoeEnv* coeEnv = CCoeEnv::Static(); |
|
1833 CDesCArrayFlat* items = coeEnv->ReadDesC16ArrayResourceL(R_UPIN_LBX); |
|
1834 CleanupStack::PushL(items); |
|
1835 |
|
1836 //get lock info |
|
1837 iWait->SetRequestType(EMobilePhoneGetLockInfo); |
|
1838 iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); |
|
1839 TInt status = iWait->WaitForRequestL(); |
|
1840 User::LeaveIfError(status); |
|
1841 TInt currentItem = 0; |
|
1842 |
|
1843 #if defined(_DEBUG) |
|
1844 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeUPinRequestL() GetLockInfo")); |
|
1845 #endif |
|
1846 |
|
1847 if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) |
|
1848 { |
|
1849 #if defined(_DEBUG) |
|
1850 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeUPinRequestL() lockInfo: ELockSetDisabled")); |
|
1851 #endif |
|
1852 currentItem = 1; // off |
|
1853 } |
|
1854 |
|
1855 TInt oldItem = currentItem; |
|
1856 |
|
1857 CAknRadioButtonSettingPage* dlg = new (ELeave)CAknRadioButtonSettingPage(R_UPIN_SETTING_PAGE, currentItem, items); |
|
1858 CleanupStack::PushL(dlg); |
|
1859 |
|
1860 |
|
1861 CleanupStack::Pop(); // dlg |
|
1862 if ( !(dlg->ExecuteLD(CAknSettingPage::EUpdateWhenChanged)) || oldItem==currentItem ) |
|
1863 { |
|
1864 CleanupStack::PopAndDestroy(); // items |
|
1865 return EFalse; |
|
1866 } |
|
1867 |
|
1868 |
|
1869 if (currentItem == 1) |
|
1870 { |
|
1871 #if defined(_DEBUG) |
|
1872 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestL() currentItem: ELockSetDisabled")); |
|
1873 #endif |
|
1874 lockChangeSetting = RMobilePhone::ELockSetDisabled; |
|
1875 } |
|
1876 else |
|
1877 { |
|
1878 #if defined(_DEBUG) |
|
1879 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestL() currentItem: ELockSetEnabled")); |
|
1880 #endif |
|
1881 lockChangeSetting = RMobilePhone::ELockSetEnabled; |
|
1882 } |
|
1883 |
|
1884 CleanupStack::PopAndDestroy(); // items |
|
1885 |
|
1886 // Raise a flag to indicate that the UPIN |
|
1887 // request coming from ETEL has originated from SecUi and not from Engine. |
|
1888 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSecUIOriginated); |
|
1889 // Change the lock setting |
|
1890 iWait->SetRequestType(EMobilePhoneSetLockSetting); |
|
1891 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); |
|
1892 iPhone.SetLockSetting(iWait->iStatus,lockType,lockChangeSetting); |
|
1893 status = iWait->WaitForRequestL(); |
|
1894 #if defined(_DEBUG) |
|
1895 RDebug::Print( _L("(SECUI)CSecuritySettings::ChangeUPinRequestL(): RETURN CODE: %d"), status); |
|
1896 #endif |
|
1897 |
|
1898 // Lower the flag |
|
1899 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsETelAPIOriginated); |
|
1900 |
|
1901 switch(status) |
|
1902 { |
|
1903 case KErrNone: |
|
1904 { |
|
1905 break; |
|
1906 } |
|
1907 case KErrGsm0707OperationNotAllowed: |
|
1908 { |
|
1909 // not allowed with this sim |
|
1910 ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
|
1911 return EFalse; |
|
1912 } |
|
1913 case KErrGsm0707IncorrectPassword: |
|
1914 case KErrAccessDenied: |
|
1915 { |
|
1916 // code was entered erroneously |
|
1917 return ChangeUPinRequestL(); |
|
1918 } |
|
1919 case KErrGsmSSPasswordAttemptsViolation: |
|
1920 case KErrLocked: |
|
1921 { |
|
1922 return EFalse; |
|
1923 } |
|
1924 case KErrAbort: |
|
1925 { |
|
1926 return EFalse; |
|
1927 } |
|
1928 default: |
|
1929 { |
|
1930 ShowErrorNoteL(status); |
|
1931 return ChangeUPinRequestL(); |
|
1932 } |
|
1933 } |
|
1934 |
|
1935 return ETrue; |
|
1936 } |
|
1937 else |
|
1938 return EFalse; |
|
1939 |
1197 } |
1940 } |
1198 |
1941 |
1199 // |
1942 // |
1200 // ---------------------------------------------------------- |
1943 // ---------------------------------------------------------- |
1201 // CSecuritySettings::ShowErrorNoteL() |
1944 // CSecuritySettings::SwitchPinCodesL() |
1202 // Shows error note |
1945 // Changes the pin code currently in use (PIN/UPIN) |
1203 // ---------------------------------------------------------- |
1946 // ---------------------------------------------------------- |
1204 // qtdone |
1947 // |
1205 void CSecuritySettings::ShowErrorNoteL(TInt aError) |
1948 EXPORT_C TBool CSecuritySettings::SwitchPinCodesL() |
1206 { |
1949 { |
1207 RDEBUG("aError", aError); |
1950 TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); |
1208 |
1951 TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); |
1209 ShowResultNoteL(aError, CAknNoteDialog::EErrorTone); |
1952 if(wcdmaSupported || upinSupported) |
1210 } |
1953 { |
1211 |
1954 #if defined(_DEBUG) |
1212 // |
1955 RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL()")); |
1213 // ---------------------------------------------------------- |
1956 #endif |
1214 // CSecuritySettings::ShowResultNoteL() |
1957 |
1215 // Shows result note |
1958 // If we are in simless offline mode the PIN codes can't obviously be switched |
1216 // ---------------------------------------------------------- |
1959 TInt simState; |
1217 // qtdone |
1960 TInt err( KErrGeneral ); |
1218 void CSecuritySettings::ShowResultNoteL(TInt aResourceID, CAknNoteDialog::TTone aTone) |
1961 err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); |
1219 { |
1962 User::LeaveIfError( err ); |
1220 RDEBUG("aResourceID", aResourceID); |
1963 TBool simRemoved(simState == ESimNotPresent); |
1221 |
1964 |
1222 CHbDeviceMessageBoxSymbian* messageBox = CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EWarning); |
1965 if ( simRemoved ) |
1223 CleanupStack::PushL(messageBox); |
1966 { |
1224 TInt satisfactoryIcon = 0; // might change later, in some scenarios |
1967 ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); |
1225 _LIT(KText, "ShowResultNoteL: "); |
1968 return EFalse; |
1226 TBuf<0x200> title; |
1969 } |
1227 TBuf<0x200> titleTr; |
1970 |
1228 title.Zero(); |
1971 |
1229 titleTr.Zero(); |
1972 RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockUniversalPin; |
1230 title.Append(KText); |
1973 RMobilePhone::TMobilePhoneLockSetting lockChangeSetting = RMobilePhone::ELockReplaced; |
1231 title.AppendNum(aResourceID); |
1974 RMobilePhone::TMobilePhoneSecurityCode activeCode; |
1232 _LIT(KSeparator, " "); |
1975 |
1233 title.Append(KSeparator); |
1976 iCustomPhone.GetActivePin(activeCode); |
1234 switch (aResourceID) |
1977 |
1235 { |
1978 RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
1236 case 0: |
|
1237 titleTr.Append(_L("OK")); |
|
1238 title.Append(_L("OK")); |
|
1239 satisfactoryIcon = 1; |
|
1240 break; |
|
1241 case KErrGsm0707IncorrectPassword: |
|
1242 titleTr.Append(_L("txt_pin_code_dpophead_wrong_pin_code")); // TODO this also happens for lock-code |
|
1243 title.Append(_L("Incorrect Password")); |
|
1244 break; |
|
1245 case KErrAccessDenied: |
|
1246 titleTr.Append(_L("txt_pin_code_dpopinfo_access_denied")); |
|
1247 title.Append(_L("Access Denied")); |
|
1248 break; |
|
1249 case KErrGsmSSPasswordAttemptsViolation: |
|
1250 titleTr.Append(_L("KErrGsmSSPasswordAttemptsViolation")); |
|
1251 title.Append(_L("Password Attempts Violation")); |
|
1252 break; |
|
1253 case KErrLocked: |
|
1254 titleTr.Append(_L("KErrLocked")); |
|
1255 title.Append(_L("Locked")); |
|
1256 break; |
|
1257 case KErrGsm0707OperationNotAllowed: |
|
1258 titleTr.Append(_L("KErrGsm0707OperationNotAllowed")); |
|
1259 title.Append(_L("Operation Not Allowed")); |
|
1260 break; |
|
1261 case KErrAbort: |
|
1262 titleTr.Append(_L("KErrAbort")); |
|
1263 title.Append(_L("Abort")); |
|
1264 break; |
|
1265 case KErrNotSupported: |
|
1266 titleTr.Append(_L("txt_pin_code_dpopinfo_operation_not_supported")); |
|
1267 title.Append(_L("Not Supported")); |
|
1268 break; |
|
1269 case R_SEC_BLOCKED: |
|
1270 titleTr.Append(_L("txt_pin_code_dpopinfo_security_blocked")); |
|
1271 title.Append(_L("BLOCKED")); |
|
1272 break; |
|
1273 case R_CODE_ERROR: |
|
1274 titleTr.Append(_L("R_CODE_ERROR")); |
|
1275 title.Append(_L("ERROR")); |
|
1276 break; |
|
1277 case KErrGsmInvalidParameter: |
|
1278 titleTr.Append(_L("txt_pin_code_dpopinfo_gsm_invalid_parameter")); |
|
1279 title.Append(_L("Invalid Parameter")); |
|
1280 break; |
|
1281 case R_CONFIRMATION_NOTE: |
|
1282 titleTr.Append(_L("R_CONFIRMATION_NOTE")); |
|
1283 title.Append(_L("CONFIRMED")); |
|
1284 satisfactoryIcon = 1; |
|
1285 break; |
|
1286 case R_CODES_DONT_MATCH: |
|
1287 titleTr.Append(_L("R_CODES_DONT_MATCH")); |
|
1288 title.Append(_L("CODES DONT MATCH")); |
|
1289 break; |
|
1290 case R_PIN_CODE_CHANGED_NOTE: |
|
1291 titleTr.Append(_L("txt_pin_code_dpopinfo_code_chaged")); // note the spelling mistake "chaged" |
|
1292 title.Append(_L("PIN CODE CHANGED")); |
|
1293 satisfactoryIcon = 1; |
|
1294 break; |
|
1295 case R_SECURITY_CODE_CHANGED_NOTE: |
|
1296 titleTr.Append(_L("R_SECURITY_CODE_CHANGED_NOTE")); |
|
1297 title.Append(_L("SECURITY CODE CHANGED")); |
|
1298 satisfactoryIcon = 1; |
|
1299 break; |
|
1300 case R_SECUI_TEXT_AUTOLOCK_MUST_BE_ACTIVE: |
|
1301 titleTr.Append(_L("txt_pin_code_dpopinfo_autolock_must_be_active")); |
|
1302 title.Append(_L("AUTOLOCK MUST BE ACTIVE")); |
|
1303 break; |
|
1304 case KErrServerTerminated: |
|
1305 titleTr.Append(_L("KErrServerTerminated")); |
|
1306 title.Append(_L("Server Terminated")); |
|
1307 break; |
|
1308 case KErrServerBusy: |
|
1309 titleTr.Append(_L("KErrServerBusy")); |
|
1310 title.Append(_L("Server Busy")); |
|
1311 break; |
|
1312 case R_PIN2_REJECTED: |
|
1313 titleTr.Append(_L("txt_pin_code_dpopinfo_pin2_rejected")); |
|
1314 title.Append(_L("PIN2 REJECTED")); |
|
1315 break; |
|
1316 case R_OPERATION_NOT_ALLOWED: |
|
1317 titleTr.Append(_L("R_OPERATION_NOT_ALLOWED")); |
|
1318 title.Append(_L("OPERATION NOT ALLOWED")); |
|
1319 break; |
|
1320 case R_UPIN_NOT_ALLOWED: |
|
1321 titleTr.Append(_L("txt_pin_code_dpopinfo_upin_not_allowed")); |
|
1322 title.Append(_L("UPIN NOT ALLOWED")); |
|
1323 break; |
|
1324 case R_PIN_NOT_ALLOWED: |
|
1325 titleTr.Append(_L("R_PIN_NOT_ALLOWED")); |
|
1326 title.Append(_L("PIN NOT ALLOWED")); |
|
1327 break; |
|
1328 case R_INSERT_SIM: |
|
1329 titleTr.Append(_L("txt_pin_code_dpopinfo_insert_sim")); |
|
1330 title.Append(_L("INSERT SIM")); |
|
1331 break; |
|
1332 case R_SIM_ON: |
|
1333 titleTr.Append(_L("R_SIM_ON")); |
|
1334 title.Append(_L("SIM ON")); |
|
1335 break; |
|
1336 case KErrTimedOut: |
|
1337 titleTr.Append(_L("KErrTimedOut")); |
|
1338 title.Append(_L("Timed Out")); |
|
1339 break; |
|
1340 case R_PIN2_CODE_CHANGED_NOTE: |
|
1341 titleTr.Append(_L("R_PIN2_CODE_CHANGED_NOTE")); |
|
1342 title.Append(_L("PIN2 CODE CHANGED")); |
|
1343 break; |
|
1344 case KErrArgument: |
|
1345 titleTr.Append(_L("KErrArgument")); |
|
1346 title.Append(_L("Error Argument")); |
|
1347 break; |
|
1348 case R_SIM_OFF: |
|
1349 titleTr.Append(_L("R_SIM_OFF")); |
|
1350 title.Append(_L("SIM OFF")); |
|
1351 break; |
|
1352 case R_SIM_ALLREADY_OFF: |
|
1353 titleTr.Append(_L("R_SIM_ALLREADY_OFF")); |
|
1354 title.Append(_L("SIM ALLREADY OFF")); |
|
1355 break; |
|
1356 case R_SIM_NOT_ALLOWED: |
|
1357 titleTr.Append(_L("R_SIM_NOT_ALLOWED")); |
|
1358 title.Append(_L("SIM NOT ALLOWED")); |
|
1359 break; |
|
1360 case R_REMOTELOCK_INVALID_CODE: |
|
1361 titleTr.Append(_L("R_REMOTELOCK_INVALID_CODE")); |
|
1362 title.Append(_L("REMOTELOCK INVALID CODE")); |
|
1363 break; |
|
1364 |
|
1365 case KErrTDevicelockPolicies+EDeviceLockAutolockperiod: |
|
1366 titleTr.Append(_L("EDeviceLockAutolockperiod")); |
|
1367 title.Append(_L("EDeviceLockAutolockperiod")); |
|
1368 break; |
|
1369 case KErrTDevicelockPolicies+EDeviceLockMaxAutolockPeriod: |
|
1370 titleTr.Append(_L("EDeviceLockMaxAutolockPeriod")); |
|
1371 title.Append(_L("EDeviceLockMaxAutolockPeriod")); |
|
1372 break; |
|
1373 case KErrTDevicelockPolicies+EDeviceLockMinlength: |
|
1374 titleTr.Append(_L("EDeviceLockMinlength")); |
|
1375 title.Append(_L("EDeviceLockMinlength")); |
|
1376 break; |
|
1377 case KErrTDevicelockPolicies+EDeviceLockMaxlength: |
|
1378 titleTr.Append(_L("EDeviceLockMaxlength")); |
|
1379 title.Append(_L("EDeviceLockMaxlength")); |
|
1380 break; |
|
1381 case KErrTDevicelockPolicies+EDeviceLockRequireUpperAndLower: |
|
1382 titleTr.Append(_L("EDeviceLockRequireUpperAndLower")); |
|
1383 title.Append(_L("EDeviceLockRequireUpperAndLower")); |
|
1384 break; |
|
1385 case KErrTDevicelockPolicies+EDeviceLockRequireCharsAndNumbers: |
|
1386 titleTr.Append(_L("EDeviceLockRequireCharsAndNumbers")); |
|
1387 title.Append(_L("EDeviceLockRequireCharsAndNumbers")); |
|
1388 break; |
|
1389 case KErrTDevicelockPolicies+EDeviceLockAllowedMaxRepeatedChars: |
|
1390 titleTr.Append(_L("EDeviceLockAllowedMaxRepeatedChars")); |
|
1391 title.Append(_L("EDeviceLockAllowedMaxRepeatedChars")); |
|
1392 break; |
|
1393 case KErrTDevicelockPolicies+EDeviceLockHistoryBuffer: |
|
1394 titleTr.Append(_L("EDeviceLockHistoryBuffer")); |
|
1395 title.Append(_L("EDeviceLockHistoryBuffer")); |
|
1396 break; |
|
1397 case KErrTDevicelockPolicies+EDeviceLockPasscodeExpiration: |
|
1398 titleTr.Append(_L("EDeviceLockPasscodeExpiration")); |
|
1399 title.Append(_L("EDeviceLockPasscodeExpiration")); |
|
1400 break; |
|
1401 case KErrTDevicelockPolicies+EDeviceLockMinChangeTolerance: |
|
1402 titleTr.Append(_L("EDeviceLockMinChangeTolerance")); |
|
1403 title.Append(_L("EDeviceLockMinChangeTolerance")); |
|
1404 break; |
|
1405 case KErrTDevicelockPolicies+EDeviceLockMinChangeInterval: |
|
1406 titleTr.Append(_L("EDeviceLockMinChangeInterval")); |
|
1407 title.Append(_L("EDeviceLockMinChangeInterval")); |
|
1408 break; |
|
1409 case KErrTDevicelockPolicies+EDeviceLockDisallowSpecificStrings: |
|
1410 titleTr.Append(_L("EDeviceLockDisallowSpecificStrings")); |
|
1411 title.Append(_L("EDeviceLockDisallowSpecificStrings")); |
|
1412 break; |
|
1413 case KErrTDevicelockPolicies+EDeviceLockAllowedMaxAtempts: |
|
1414 titleTr.Append(_L("EDeviceLockAllowedMaxAtempts")); |
|
1415 title.Append(_L("EDeviceLockAllowedMaxAtempts")); |
|
1416 break; |
|
1417 case KErrTDevicelockPolicies+EDeviceLockConsecutiveNumbers: |
|
1418 titleTr.Append(_L("EDeviceLockConsecutiveNumbers")); |
|
1419 title.Append(_L("EDeviceLockConsecutiveNumbers")); |
|
1420 break; |
|
1421 case KErrTDevicelockPolicies+EDeviceLockMinSpecialCharacters: |
|
1422 titleTr.Append(_L("EDeviceLockMinSpecialCharacters")); |
|
1423 title.Append(_L("EDeviceLockMinSpecialCharacters")); |
|
1424 break; |
|
1425 case KErrTDevicelockPolicies+EDeviceLockSingleCharRepeatNotAllowed: |
|
1426 titleTr.Append(_L("EDeviceLockSingleCharRepeatNotAllowed")); |
|
1427 title.Append(_L("EDeviceLockSingleCharRepeatNotAllowed")); |
|
1428 break; |
|
1429 case KErrTDevicelockPolicies+EDevicelockTotalPolicies: |
|
1430 titleTr.Append(_L("EDevicelockTotalPolicies")); |
|
1431 title.Append(_L("EDevicelockTotalPolicies")); |
|
1432 break; |
|
1433 |
|
1434 default: // " " |
|
1435 titleTr.Append(_L("Specific Error")); |
|
1436 title.Append(_L("Specific Error")); |
|
1437 break; |
|
1438 /* These ones are still unused */ |
|
1439 // txt_pin_code_dpopinfo_ln_attempts_remaining |
|
1440 // txt_pin_code_dpopinfo_emergency_calls_only |
|
1441 // txt_pin_code_dpopinfo_if_failed_be_ready_with_puk |
|
1442 } |
|
1443 |
|
1444 HBufC* stringHolder; |
|
1445 RDEBUG("titleTr", 1); |
|
1446 stringHolder = HbTextResolverSymbian::LoadLC(titleTr); // titleTr should I TRAP( err, ? |
|
1447 RDEBUG("got stringHolder", 1); |
|
1448 messageBox->SetTextL(stringHolder->Des()); // title |
|
1449 RDEBUG("aResourceID", aResourceID); |
|
1450 RDEBUGSTR(titleTr); |
|
1451 _LIT(KIconNameWondering, "qtg_small_smiley_wondering"); |
|
1452 _LIT(KIconNameSmile, "qtg_small_smiley_smile"); |
|
1453 if (satisfactoryIcon==1) |
|
1454 messageBox->SetIconNameL(KIconNameSmile); |
|
1455 else |
|
1456 messageBox->SetIconNameL(KIconNameWondering); |
|
1457 |
|
1458 if (aTone == CAknNoteDialog::EErrorTone) // another case is EConfirmationTone |
|
1459 { |
|
1460 messageBox->SetTimeout(messageBox->Timeout() * 2); // errors are displayed double time |
|
1461 } |
|
1462 // messageBox->ShowL(); |
|
1463 RDEBUG("calling ExecL", 0); |
|
1464 CHbDeviceMessageBoxSymbian::TButtonId selection = messageBox->ExecL(); // this guarantees that it waits for the dismiss/timeout |
|
1465 RDEBUG("called ExecL.selection", selection); |
|
1466 CleanupStack::PopAndDestroy(stringHolder); |
|
1467 CleanupStack::PopAndDestroy(); // messageBox |
|
1468 |
|
1469 } |
|
1470 |
|
1471 // |
|
1472 // ---------------------------------------------------------- |
|
1473 // CSecuritySettings::IsUpinSupportedL() |
|
1474 // Return is UPIN supported |
|
1475 // ---------------------------------------------------------- |
|
1476 // qtdone |
|
1477 EXPORT_C TBool CSecuritySettings::IsUpinSupportedL() |
|
1478 { |
|
1479 TBool wcdmaSupported(FeatureManager::FeatureSupported(KFeatureIdProtocolWcdma)); |
|
1480 TBool upinSupported(FeatureManager::FeatureSupported(KFeatureIdUpin)); |
|
1481 TBool isSupported = EFalse; |
|
1482 RDEBUG("wcdmaSupported", wcdmaSupported); |
|
1483 RDEBUG("upinSupported", upinSupported); |
|
1484 if (wcdmaSupported || upinSupported) |
|
1485 { |
|
1486 RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
|
1487 |
|
1488 //get lock info |
|
1489 RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
1979 RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
|
1980 #if defined(_DEBUG) |
|
1981 RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() GetLockInfo")); |
|
1982 #endif |
1490 iWait->SetRequestType(EMobilePhoneGetLockInfo); |
1983 iWait->SetRequestType(EMobilePhoneGetLockInfo); |
1491 RDEBUG("GetLockInfo", 0); |
1984 |
1492 iPhone.GetLockInfo(iWait->iStatus, RMobilePhone::ELockUniversalPin, lockInfoPkg); |
1985 if (activeCode == RMobilePhone::ESecurityUniversalPin) |
1493 RDEBUG("WaitForRequestL", 0); |
1986 { |
1494 TInt res = iWait->WaitForRequestL(); |
1987 lockType = RMobilePhone::ELockUniversalPin; |
1495 RDEBUG("WaitForRequestL res", res); |
1988 iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); |
1496 if ((res == KErrNotSupported) || (res == KErrGsmInvalidParameter)) |
1989 TInt res = iWait->WaitForRequestL(); |
1497 { |
1990 User::LeaveIfError(res); |
1498 RDEBUG("0", 0); |
1991 #if defined(_DEBUG) |
1499 isSupported = EFalse; |
1992 RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() Lock Info got: UPIN")); |
|
1993 #endif |
1500 } |
1994 } |
1501 else |
1995 else |
1502 { |
1996 { |
1503 RDEBUG("1", 1); |
1997 lockType = RMobilePhone::ELockICC; |
1504 isSupported = ETrue; |
1998 iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); |
1505 } |
1999 TInt res = iWait->WaitForRequestL(); |
1506 } |
2000 User::LeaveIfError(res); |
1507 else |
2001 #if defined(_DEBUG) |
1508 isSupported = EFalse; |
2002 RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() Lock Info got: PIN")); |
1509 RDEBUG("isSupported", isSupported); |
2003 #endif |
1510 return isSupported; |
2004 } |
1511 } |
2005 |
1512 // |
2006 // code request must be ON to change active code. |
1513 // ---------------------------------------------------------- |
2007 if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) |
1514 // CSecuritySettings::IsUpinBlocked() |
2008 { |
1515 // Return is a code blocked |
2009 #if defined(_DEBUG) |
1516 // ---------------------------------------------------------- |
2010 RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() CODE REQ NOT ON.")); |
1517 // qtdone |
2011 #endif |
1518 EXPORT_C TBool CSecuritySettings::IsUpinBlocked() |
2012 if (activeCode == RMobilePhone::ESecurityUniversalPin) |
1519 { |
2013 { |
1520 TBool wcdmaSupported(FeatureManager::FeatureSupported(KFeatureIdProtocolWcdma)); |
2014 ShowResultNoteL(R_UPIN_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
1521 TBool upinSupported(FeatureManager::FeatureSupported(KFeatureIdUpin)); |
2015 } |
1522 if (wcdmaSupported || upinSupported) |
2016 else |
1523 { |
2017 { |
1524 RMmCustomAPI::TSecurityCodeType secCodeType; |
2018 ShowResultNoteL(R_PIN_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
1525 secCodeType = RMmCustomAPI::ESecurityUniversalPin; |
2019 } |
1526 TBool isBlocked = EFalse; |
2020 #if defined(_DEBUG) |
1527 RDEBUG("IsBlocked", 0); |
2021 RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() CODE REQ NOT ON NOTE END.")); |
1528 TInt ret = iCustomPhone.IsBlocked(secCodeType, isBlocked); |
2022 #endif |
1529 RDEBUG("ret", ret); |
2023 return EFalse; |
1530 RDEBUG("isBlocked", isBlocked); |
2024 } |
1531 return isBlocked; |
2025 |
1532 } |
2026 |
|
2027 |
|
2028 CCoeEnv* coeEnv = CCoeEnv::Static(); |
|
2029 CDesCArrayFlat* items = coeEnv->ReadDesC16ArrayResourceL(R_CODE_LBX); |
|
2030 CleanupStack::PushL(items); |
|
2031 |
|
2032 iCustomPhone.GetActivePin(activeCode); |
|
2033 TInt currentItem = 0; |
|
2034 |
|
2035 #if defined(_DEBUG) |
|
2036 RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() GetLockInfo")); |
|
2037 #endif |
|
2038 |
|
2039 if (activeCode == RMobilePhone::ESecurityUniversalPin) |
|
2040 { |
|
2041 #if defined(_DEBUG) |
|
2042 RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() active code: UPIN")); |
|
2043 #endif |
|
2044 currentItem = 1; // UPIN |
|
2045 } |
|
2046 |
|
2047 TInt oldItem = currentItem; |
|
2048 |
|
2049 CAknRadioButtonSettingPage* dlg = new (ELeave)CAknRadioButtonSettingPage(R_CODE_IN_USE_SETTING_PAGE, currentItem, items); |
|
2050 CleanupStack::PushL(dlg); |
|
2051 |
|
2052 |
|
2053 CleanupStack::Pop(); // dlg |
|
2054 if ( !(dlg->ExecuteLD(CAknSettingPage::EUpdateWhenChanged)) || oldItem==currentItem ) |
|
2055 { |
|
2056 CleanupStack::PopAndDestroy(); // items |
|
2057 return EFalse; |
|
2058 } |
|
2059 |
|
2060 |
|
2061 if (currentItem == 1) |
|
2062 { |
|
2063 #if defined(_DEBUG) |
|
2064 RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() currentItem: UPIN")); |
|
2065 #endif |
|
2066 lockType = RMobilePhone::ELockUniversalPin; |
|
2067 } |
|
2068 else |
|
2069 { |
|
2070 #if defined(_DEBUG) |
|
2071 RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() currentItem: PIN1")); |
|
2072 #endif |
|
2073 lockType = RMobilePhone::ELockICC; |
|
2074 } |
|
2075 |
|
2076 CleanupStack::PopAndDestroy(); // items |
|
2077 |
|
2078 // Raise a flag to indicate that the code |
|
2079 // request coming from ETEL has originated from SecUi and not from Engine. |
|
2080 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSecUIOriginated); |
|
2081 // Change the lock setting |
|
2082 iWait->SetRequestType(EMobilePhoneSetLockSetting); |
|
2083 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); |
|
2084 iPhone.SetLockSetting(iWait->iStatus,lockType,lockChangeSetting); |
|
2085 TInt status = iWait->WaitForRequestL(); |
|
2086 #if defined(_DEBUG) |
|
2087 RDebug::Print( _L("(SECUI)CSecuritySettings::SwitchPinCodesL(): RETURN CODE: %d"), status); |
|
2088 #endif |
|
2089 // Lower the flag |
|
2090 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsETelAPIOriginated); |
|
2091 |
|
2092 switch(status) |
|
2093 { |
|
2094 case KErrNone: |
|
2095 { |
|
2096 break; |
|
2097 } |
|
2098 case KErrGsm0707OperationNotAllowed: |
|
2099 { |
|
2100 // not allowed with this sim |
|
2101 ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
|
2102 return EFalse; |
|
2103 } |
|
2104 case KErrGsm0707IncorrectPassword: |
|
2105 case KErrAccessDenied: |
|
2106 { |
|
2107 // code was entered erroneously |
|
2108 return SwitchPinCodesL(); |
|
2109 } |
|
2110 case KErrGsmSSPasswordAttemptsViolation: |
|
2111 case KErrLocked: |
|
2112 { |
|
2113 return EFalse; |
|
2114 } |
|
2115 case KErrAbort: |
|
2116 { |
|
2117 return EFalse; |
|
2118 } |
|
2119 default: |
|
2120 { |
|
2121 ShowErrorNoteL(status); |
|
2122 return SwitchPinCodesL(); |
|
2123 } |
|
2124 } |
|
2125 |
|
2126 return ETrue; |
|
2127 } |
1533 else |
2128 else |
1534 return EFalse; |
2129 return EFalse; |
1535 } |
2130 } |
1536 // |
2131 |
1537 // ---------------------------------------------------------- |
2132 // |
1538 // CSecuritySettings::IsUpinActive() |
2133 // ---------------------------------------------------------- |
1539 // Return the code active in current application (PIN/UPIN) |
2134 // CSecuritySettings::IsLockEnabledL() |
1540 // ---------------------------------------------------------- |
2135 // Return is lock enabled/disabled |
1541 // qtdone |
2136 // ---------------------------------------------------------- |
1542 EXPORT_C TBool CSecuritySettings::IsUpinActive() |
2137 // |
|
2138 EXPORT_C TBool CSecuritySettings::IsLockEnabledL(RMobilePhone::TMobilePhoneLock aLockType) |
1543 { |
2139 { |
1544 TBool wcdmaSupported(FeatureManager::FeatureSupported(KFeatureIdProtocolWcdma)); |
2140 /***************************************************** |
1545 TBool upinSupported(FeatureManager::FeatureSupported(KFeatureIdUpin)); |
2141 * Series 60 Customer / ETel |
1546 if (wcdmaSupported || upinSupported) |
2142 * Series 60 ETel API |
1547 { |
2143 *****************************************************/ |
1548 RMobilePhone::TMobilePhoneSecurityCode activePin; |
2144 #if defined(_DEBUG) |
1549 RDEBUG("GetActivePin", 0); |
2145 RDebug::Print(_L("(SECUI)CSecuritySettings::IsLockEnabledL()")); |
1550 iCustomPhone.GetActivePin(activePin); |
2146 #endif |
1551 RDEBUG("activePin", activePin); |
2147 #ifdef __WINS__ |
1552 RDEBUG("RMobilePhone::ESecurityUniversalPin", |
2148 |
1553 RMobilePhone::ESecurityUniversalPin); |
2149 return EFalse; |
1554 if (activePin == RMobilePhone::ESecurityUniversalPin) |
2150 |
1555 { |
2151 #else //WINS |
1556 return ETrue; |
2152 |
1557 } |
2153 RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
1558 return EFalse; |
2154 |
1559 } |
2155 //get lock info |
1560 else |
2156 RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
1561 return EFalse; |
2157 iWait->SetRequestType(EMobilePhoneGetLockInfo); |
|
2158 iPhone.GetLockInfo(iWait->iStatus, aLockType, lockInfoPkg); |
|
2159 TInt res = iWait->WaitForRequestL(); |
|
2160 |
|
2161 if (res != KErrNone) |
|
2162 return ETrue; |
|
2163 |
|
2164 //lock is enabled return true |
|
2165 if (lockInfo.iSetting == RMobilePhone::ELockSetEnabled) |
|
2166 { |
|
2167 return ETrue; |
|
2168 } |
|
2169 |
|
2170 // lock is disabled return false |
|
2171 return EFalse; |
|
2172 |
|
2173 #endif |
|
2174 |
1562 } |
2175 } |
1563 |
2176 // |
1564 /**************************/ |
2177 // ---------------------------------------------------------- |
1565 // qtdone |
2178 // CSecuritySettings::AskSecCodeL() |
1566 EXPORT_C TInt CSecuritySettings::ChangePinParamsL(RMobilePhone::TMobilePassword aOldPassword, RMobilePhone::TMobilePassword aNewPassword, TInt aFlags, TDes& aCaption, |
2179 // For asking security code e.g in settings |
1567 TInt aShowError) |
2180 // ---------------------------------------------------------- |
|
2181 // |
|
2182 EXPORT_C TBool CSecuritySettings::AskSecCodeL() |
1568 { |
2183 { |
1569 RDEBUG("aFlags", aFlags); |
2184 return iSecurityHandler->AskSecCodeL(); |
1570 RDEBUG("aOldPassword", 0); |
2185 } |
1571 RDEBUGSTR(aOldPassword); |
2186 // |
1572 RDEBUG("aNewPassword", 0); |
2187 // ---------------------------------------------------------- |
1573 RDEBUGSTR(aNewPassword); |
2188 // CSecuritySettings::AskPin2L() |
1574 RDEBUG("aCaption", 0); |
2189 // Asks PIN2 |
1575 RDEBUGSTR(aCaption); |
2190 // ---------------------------------------------------------- |
1576 RDEBUG("aShowError", aShowError); |
2191 // |
1577 |
2192 EXPORT_C TBool CSecuritySettings::AskPin2L() |
|
2193 { |
1578 /***************************************************** |
2194 /***************************************************** |
1579 * Series 60 Customer / ETel |
2195 * Series 60 Customer / ETel |
1580 * Series 60 ETel API |
2196 * Series 60 ETel API |
1581 *****************************************************/ |
2197 *****************************************************/ |
1582 |
2198 #if defined(_DEBUG) |
1583 TInt simState; |
2199 RDebug::Print(_L("(SECUI)CSecuritySettings::AskPin2L()")); |
1584 TInt err(KErrGeneral); |
2200 #endif |
1585 err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); |
2201 TInt ret = 0; |
1586 User::LeaveIfError(err); |
2202 // check if pin2 is blocked... |
1587 TBool simRemoved(simState == ESimNotPresent); |
2203 RMmCustomAPI::TSecurityCodeType secCodeType = RMmCustomAPI::ESecurityCodePin2; |
1588 |
2204 RMobilePhone::TMobilePhoneSecurityCode etelsecCodeType(RMobilePhone::ESecurityCodePin2); |
1589 RDEBUG("simRemoved", simRemoved); |
|
1590 if (simRemoved) |
|
1591 { |
|
1592 ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); |
|
1593 return KErrAccessDenied; |
|
1594 } |
|
1595 RMobilePhone::TMobilePhoneSecurityCode secCodeType; |
|
1596 secCodeType = RMobilePhone::ESecurityCodePin1; |
|
1597 |
|
1598 RMobilePhone::TMobilePassword oldPassword; |
|
1599 RMobilePhone::TMobilePassword newPassword; |
|
1600 RMobilePhone::TMobilePhonePasswordChangeV1 passwords; |
|
1601 RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; |
2205 RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; |
1602 RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); |
2206 RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); |
1603 RMobilePhone::TMobilePassword required_fourth; |
|
1604 TInt queryAccepted = KErrCancel; |
|
1605 |
|
1606 RDEBUG("0", 0); |
|
1607 |
|
1608 RMobilePhone::TMobilePhoneLock lockType; |
|
1609 RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
|
1610 |
|
1611 lockType = RMobilePhone::ELockICC; |
|
1612 |
|
1613 RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
|
1614 RDEBUG("0", 0); |
|
1615 iWait->SetRequestType(EMobilePhoneGetLockInfo); |
|
1616 TInt res = KErrNone; |
|
1617 RDEBUG("GetLockInfo", 0); |
|
1618 iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); |
|
1619 RDEBUG("WaitForRequestL", 0); |
|
1620 res = iWait->WaitForRequestL(); |
|
1621 RDEBUG("WaitForRequestL res", res); |
|
1622 #ifdef __WINS__ |
|
1623 if (res == KErrTimedOut) |
|
1624 { |
|
1625 lockInfo.iSetting = RMobilePhone::ELockSetEnabled; |
|
1626 res = KErrNone; |
|
1627 } |
|
1628 #endif |
|
1629 |
|
1630 User::LeaveIfError(res); |
|
1631 |
|
1632 if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) |
|
1633 { |
|
1634 RDEBUG("RMobilePhone::ELockSetDisabled", |
|
1635 RMobilePhone::ELockSetDisabled); |
|
1636 ShowResultNoteL(R_PIN_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
|
1637 return KErrAccessDenied; |
|
1638 } |
|
1639 |
|
1640 RDEBUG("0", 0); |
|
1641 iWait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
|
1642 RDEBUG("GetSecurityCodeInfo", 0); |
|
1643 iPhone.GetSecurityCodeInfo(iWait->iStatus, secCodeType, codeInfoPkg); |
|
1644 RDEBUG("WaitForRequestL", 0); |
|
1645 res = iWait->WaitForRequestL(); |
|
1646 RDEBUG("WaitForRequestL res", res); |
|
1647 #ifdef __WINS__ |
|
1648 if (res == KErrNotSupported || res == KErrTimedOut) |
|
1649 { |
|
1650 res = KErrNone; |
|
1651 codeInfo.iRemainingEntryAttempts = KMaxNumberOfPINAttempts; |
|
1652 } |
|
1653 #endif |
|
1654 User::LeaveIfError(res); |
|
1655 |
|
1656 RDEBUG("codeInfo.iRemainingEntryAttempts", |
|
1657 codeInfo.iRemainingEntryAttempts); |
|
1658 if (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) |
|
1659 codeInfo.iRemainingEntryAttempts = -1; |
|
1660 |
|
1661 RDEBUG("checking aOldPassword", 0); |
|
1662 if (aOldPassword.Length() == 0) |
|
1663 { |
|
1664 RDEBUG("asking aOldPassword", 0); |
|
1665 /* request PIN using QT */ |
|
1666 queryAccepted = KErrCancel; |
|
1667 CSecQueryUi *iSecQueryUi; |
|
1668 iSecQueryUi = CSecQueryUi::NewL(); |
|
1669 TBuf<0x100> title; |
|
1670 title.Zero(); |
|
1671 HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_pin_code")); |
|
1672 title.Append(stringHolder->Des()); |
|
1673 CleanupStack::PopAndDestroy(stringHolder); |
|
1674 title.Append(_L("$")); |
|
1675 title.AppendNum(codeInfo.iRemainingEntryAttempts); |
|
1676 queryAccepted = iSecQueryUi->SecQueryDialog(title, oldPassword, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported |
|
1677 | ESecUiEmergencyNotSupported | secCodeType); |
|
1678 RDEBUG("oldPassword", 0); |
|
1679 RDEBUGSTR(oldPassword); |
|
1680 RDEBUG("queryAccepted", queryAccepted); |
|
1681 delete iSecQueryUi; |
|
1682 if (queryAccepted != KErrNone) |
|
1683 return KErrAbort; |
|
1684 /* end request PIN using QT */ |
|
1685 |
|
1686 // verify it now, so that the user doesn't need to see the error _after_ typing the new ones |
|
1687 RDEBUG("VerifySecurityCode", 0); |
|
1688 iPhone.VerifySecurityCode(iWait->iStatus, secCodeType, oldPassword, required_fourth); |
|
1689 RDEBUG("WaitForRequestL", 0); |
|
1690 res = iWait->WaitForRequestL(); |
|
1691 RDEBUG("WaitForRequestL res", res); |
|
1692 #ifdef __WINS__ |
|
1693 if (res == KErrNotSupported) |
|
1694 res = KErrNone; |
|
1695 #endif |
|
1696 if (res != KErrNone) |
|
1697 { |
|
1698 ShowResultNoteL(res, CAknNoteDialog::EErrorTone); |
|
1699 return res; // not sure if it's wise to exit now. |
|
1700 } |
|
1701 |
|
1702 newPassword = _L(""); |
|
1703 } |
|
1704 else |
|
1705 { |
|
1706 oldPassword.Copy(aOldPassword); |
|
1707 newPassword.Copy(aNewPassword); |
|
1708 } |
|
1709 |
|
1710 RDEBUG("res", res); |
|
1711 while (newPassword.Length() == 0) |
|
1712 { |
|
1713 // this is not needed because the dialog won't allow to close, unless codes match |
|
1714 // codes do not match -> note -> ask new pin and verification codes again |
|
1715 // if(newPassword.Length()>0) |
|
1716 // ShowResultNoteL(R_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone); |
|
1717 |
|
1718 newPassword = _L(""); |
|
1719 |
|
1720 // new pin code query |
|
1721 if (aOldPassword.Length() == 0) // only if input parameters are empty |
|
1722 { |
|
1723 queryAccepted = KErrCancel; |
|
1724 CSecQueryUi *iSecQueryUi; |
|
1725 iSecQueryUi = CSecQueryUi::NewL(); |
|
1726 // this queries both, and verifies itself |
|
1727 TBuf<0x100> title; |
|
1728 title.Zero(); |
|
1729 HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_pin_code")); |
|
1730 title.Append(stringHolder->Des()); |
|
1731 CleanupStack::PopAndDestroy(stringHolder); |
|
1732 title.Append(_L("|")); |
|
1733 HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_verify_new_pin_code")); |
|
1734 title.Append(stringHolder2->Des()); |
|
1735 CleanupStack::PopAndDestroy(stringHolder2); |
|
1736 queryAccepted = iSecQueryUi->SecQueryDialog(title, newPassword, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported |
|
1737 | ESecUiEmergencyNotSupported | secCodeType); |
|
1738 RDEBUG("newPassword", 1); |
|
1739 RDEBUGSTR(newPassword); |
|
1740 RDEBUG("queryAccepted", queryAccepted); |
|
1741 delete iSecQueryUi; |
|
1742 if (queryAccepted != KErrNone) |
|
1743 return KErrAbort; |
|
1744 RDEBUG("0", 0); |
|
1745 } |
|
1746 } |
|
1747 |
|
1748 // send code |
|
1749 passwords.iOldPassword = oldPassword; |
|
1750 passwords.iNewPassword = newPassword; |
|
1751 RDEBUG("passwords", 0); |
|
1752 RDEBUGSTR(passwords.iOldPassword); |
|
1753 RDEBUGSTR(passwords.iNewPassword); |
|
1754 RDEBUG("SetRequestType", 0); |
|
1755 iWait->SetRequestType(EMobilePhoneChangeSecurityCode); |
|
1756 RDEBUG("ChangeSecurityCode", 0); |
|
1757 iPhone.ChangeSecurityCode(iWait->iStatus, secCodeType, passwords); |
|
1758 RDEBUG("WaitForRequestL", 0); |
|
1759 res = iWait->WaitForRequestL(); |
|
1760 RDEBUG("WaitForRequestL res", res); |
|
1761 #ifdef __WINS__ |
|
1762 if (res == KErrNotSupported) |
|
1763 res = KErrNone; |
|
1764 #endif |
|
1765 |
|
1766 switch (res) |
|
1767 { |
|
1768 case KErrNone: |
|
1769 { |
|
1770 // code changed |
|
1771 ShowResultNoteL(R_PIN_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); |
|
1772 break; |
|
1773 } |
|
1774 case KErrGsm0707IncorrectPassword: |
|
1775 case KErrAccessDenied: |
|
1776 { |
|
1777 // code was entered erroneously. This is strange, because it was verified before |
|
1778 ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
|
1779 ChangePinParamsL(_L(""), _L(""), aFlags, aCaption, aShowError); |
|
1780 break; |
|
1781 } |
|
1782 case KErrGsmSSPasswordAttemptsViolation: |
|
1783 case KErrLocked: |
|
1784 { |
|
1785 // Pin1 blocked! |
|
1786 return KErrLocked; |
|
1787 } |
|
1788 case KErrGsm0707OperationNotAllowed: |
|
1789 { |
|
1790 // not allowed with this sim |
|
1791 ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
|
1792 return KErrGsm0707OperationNotAllowed; |
|
1793 } |
|
1794 case KErrAbort: |
|
1795 { |
|
1796 break; |
|
1797 } |
|
1798 default: |
|
1799 { |
|
1800 ShowErrorNoteL(res); |
|
1801 ChangePinParamsL(_L(""), _L(""), aFlags, aCaption, aShowError); |
|
1802 break; |
|
1803 } |
|
1804 } |
|
1805 return res; |
|
1806 } |
|
1807 /*********************************************/ |
|
1808 // qtdone |
|
1809 EXPORT_C TInt CSecuritySettings::ChangeUPinParamsL(RMobilePhone::TMobilePassword aOldPassword, RMobilePhone::TMobilePassword aNewPassword, TInt aFlags, TDes& aCaption, |
|
1810 TInt aShowError) |
|
1811 { |
|
1812 RDEBUG("aFlags", aFlags); |
|
1813 // the password parameters are not used |
|
1814 if (aOldPassword.Length() > 0) |
|
1815 RDEBUGSTR(aOldPassword); |
|
1816 if (aNewPassword.Length() > 0) |
|
1817 RDEBUGSTR(aNewPassword); |
|
1818 |
|
1819 if (aCaption.Length() > 0) |
|
1820 RDEBUGSTR(aCaption); |
|
1821 |
|
1822 TBool wcdmaSupported(FeatureManager::FeatureSupported(KFeatureIdProtocolWcdma)); |
|
1823 TBool upinSupported(FeatureManager::FeatureSupported(KFeatureIdUpin)); |
|
1824 if (!(wcdmaSupported || upinSupported)) |
|
1825 { |
|
1826 RDEBUG("! upinSupported", upinSupported); |
|
1827 return KErrAccessDenied; |
|
1828 } |
|
1829 |
|
1830 RDEBUG("upinSupported", upinSupported); |
|
1831 TInt simState; |
|
1832 TInt err(KErrGeneral); |
|
1833 err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); |
|
1834 User::LeaveIfError(err); |
|
1835 TBool simRemoved(simState == ESimNotPresent); |
|
1836 |
|
1837 if (simRemoved) |
|
1838 { |
|
1839 ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); |
|
1840 return KErrAccessDenied; |
|
1841 } |
|
1842 |
|
1843 RMobilePhone::TMobilePhoneSecurityCode secCodeType; |
|
1844 secCodeType = RMobilePhone::ESecurityUniversalPin; |
|
1845 |
|
1846 RMobilePhone::TMobilePassword oldPassword; |
|
1847 RMobilePhone::TMobilePassword newPassword; |
|
1848 RMobilePhone::TMobilePassword verifcationPassword; |
|
1849 RMobilePhone::TMobilePhonePasswordChangeV1 passwords; |
|
1850 RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; |
|
1851 RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); |
|
1852 RMobilePhone::TMobilePhoneLock lockType; |
|
1853 RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
|
1854 TInt queryAccepted = KErrCancel; |
|
1855 |
|
1856 lockType = RMobilePhone::ELockUniversalPin; |
|
1857 |
|
1858 RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
|
1859 iWait->SetRequestType(EMobilePhoneGetLockInfo); |
|
1860 RDEBUG("GetLockInfo", 0); |
|
1861 iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); |
|
1862 RDEBUG("WaitForRequestL", 0); |
|
1863 TInt res = iWait->WaitForRequestL(); |
|
1864 RDEBUG("WaitForRequestL res", res); |
|
1865 #ifdef __WINS__ |
|
1866 if (res == KErrNotSupported) |
|
1867 { |
|
1868 res = KErrNone; |
|
1869 lockInfo.iSetting = RMobilePhone::ELockSetEnabled; |
|
1870 } |
|
1871 #endif |
|
1872 User::LeaveIfError(res); |
|
1873 |
|
1874 RDEBUG("lockInfo.iSetting", lockInfo.iSetting); |
|
1875 RDEBUG("RMobilePhone::ELockSetDisabled", RMobilePhone::ELockSetDisabled); |
|
1876 if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) |
|
1877 { |
|
1878 ShowResultNoteL(R_UPIN_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
|
1879 return KErrAccessDenied; |
|
1880 } |
|
1881 |
|
1882 iWait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
|
1883 RDEBUG("GetSecurityCodeInfo", 0); |
|
1884 iPhone.GetSecurityCodeInfo(iWait->iStatus, secCodeType, codeInfoPkg); |
|
1885 RDEBUG("WaitForRequestL", 0); |
|
1886 res = iWait->WaitForRequestL(); |
|
1887 RDEBUG("WaitForRequestL res", res); |
|
1888 #ifdef __WINS__ |
|
1889 if (res == KErrNotSupported || res == KErrTimedOut) |
|
1890 { |
|
1891 res = KErrNone; |
|
1892 codeInfo.iRemainingEntryAttempts = KMaxNumberOfPINAttempts; |
|
1893 } |
|
1894 #endif |
|
1895 User::LeaveIfError(res); |
|
1896 |
|
1897 RDEBUG("codeInfo.iRemainingEntryAttempts", |
|
1898 codeInfo.iRemainingEntryAttempts); |
|
1899 if (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) |
|
1900 codeInfo.iRemainingEntryAttempts = -1; |
|
1901 |
|
1902 queryAccepted = KErrCancel; |
|
1903 CSecQueryUi *iSecQueryUi; |
|
1904 iSecQueryUi = CSecQueryUi::NewL(); |
|
1905 TBuf<0x100> title; |
|
1906 title.Zero(); |
|
1907 HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_upin_code")); |
|
1908 title.Append(stringHolder->Des()); |
|
1909 CleanupStack::PopAndDestroy(stringHolder); |
|
1910 title.Append(_L("$")); |
|
1911 title.AppendNum(codeInfo.iRemainingEntryAttempts); |
|
1912 queryAccepted = iSecQueryUi->SecQueryDialog(title, oldPassword, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported |
|
1913 | ESecUiEmergencyNotSupported | secCodeType); |
|
1914 RDEBUG("oldPassword", 0); |
|
1915 RDEBUGSTR(oldPassword); |
|
1916 RDEBUG("queryAccepted", queryAccepted); |
|
1917 delete iSecQueryUi; |
|
1918 if (queryAccepted != KErrNone) |
|
1919 return KErrAbort; |
|
1920 res = KErrNone; // indicate that everything is ok |
|
1921 |
|
1922 { |
|
1923 queryAccepted = KErrCancel; |
|
1924 CSecQueryUi * iSecQueryUi; |
|
1925 iSecQueryUi = CSecQueryUi::NewL(); |
|
1926 // this queries both, and verifies itself |
|
1927 TBuf<0x100> title; |
|
1928 title.Zero(); |
|
1929 |
|
1930 HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_upin_code")); |
|
1931 title.Append(stringHolder->Des()); |
|
1932 CleanupStack::PopAndDestroy(stringHolder); |
|
1933 title.Append(_L("|")); |
|
1934 HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_retype_upin_code")); |
|
1935 title.Append(stringHolder2->Des()); |
|
1936 CleanupStack::PopAndDestroy(stringHolder2); |
|
1937 queryAccepted = iSecQueryUi->SecQueryDialog(title, newPassword, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported |
|
1938 | ESecUiEmergencyNotSupported | secCodeType); |
|
1939 RDEBUG("newPassword", 0); |
|
1940 RDEBUGSTR(newPassword); |
|
1941 RDEBUG("queryAccepted", queryAccepted); |
|
1942 delete iSecQueryUi; |
|
1943 if (queryAccepted != KErrNone) |
|
1944 return KErrAbort; |
|
1945 } |
|
1946 // send code |
|
1947 passwords.iOldPassword = oldPassword; |
|
1948 passwords.iNewPassword = newPassword; |
|
1949 iWait->SetRequestType(EMobilePhoneChangeSecurityCode); |
|
1950 RDEBUG("ChangeSecurityCode", 0); |
|
1951 iPhone.ChangeSecurityCode(iWait->iStatus, secCodeType, passwords); |
|
1952 RDEBUG("WaitForRequestL", 0); |
|
1953 res = iWait->WaitForRequestL(); |
|
1954 RDEBUG("WaitForRequestL res", res); |
|
1955 #ifdef __WINS__ |
|
1956 if (res == KErrNotSupported) |
|
1957 res = KErrNone; |
|
1958 #endif |
|
1959 switch (res) |
|
1960 { |
|
1961 case KErrNone: |
|
1962 { |
|
1963 // code changed |
|
1964 ShowResultNoteL(R_UPIN_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); |
|
1965 break; |
|
1966 } |
|
1967 case KErrGsm0707IncorrectPassword: |
|
1968 case KErrAccessDenied: |
|
1969 { |
|
1970 // code was entered erroneously |
|
1971 ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
|
1972 ChangeUPinParamsL(_L(""), _L(""), aFlags, aCaption, aShowError); |
|
1973 break; |
|
1974 } |
|
1975 case KErrGsmSSPasswordAttemptsViolation: |
|
1976 case KErrLocked: |
|
1977 { |
|
1978 return KErrLocked; |
|
1979 } |
|
1980 case KErrGsm0707OperationNotAllowed: |
|
1981 { |
|
1982 // not allowed with this sim |
|
1983 ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
|
1984 return KErrGsm0707OperationNotAllowed; |
|
1985 } |
|
1986 case KErrAbort: |
|
1987 { |
|
1988 break; |
|
1989 } |
|
1990 default: |
|
1991 { |
|
1992 ShowErrorNoteL(res); |
|
1993 ChangeUPinParamsL(_L(""), _L(""), aFlags, aCaption, aShowError); |
|
1994 break; |
|
1995 } |
|
1996 } |
|
1997 return res; |
|
1998 } |
|
1999 /***************************************/ |
|
2000 // qtdone |
|
2001 EXPORT_C TInt CSecuritySettings::ChangePin2ParamsL(RMobilePhone::TMobilePassword aOldPassword, RMobilePhone::TMobilePassword aNewPassword, TInt aFlags, TDes& aCaption, |
|
2002 TInt aShowError) |
|
2003 { |
|
2004 RDEBUG("aFlags", aFlags); |
|
2005 // the password parameters are not used |
|
2006 if (aOldPassword.Length() > 0) |
|
2007 RDEBUGSTR(aOldPassword); |
|
2008 if (aNewPassword.Length() > 0) |
|
2009 RDEBUGSTR(aNewPassword); |
|
2010 |
|
2011 if (aCaption.Length() > 0) |
|
2012 RDEBUGSTR(aCaption); |
|
2013 |
|
2014 TInt simState; |
|
2015 TInt err(KErrGeneral); |
|
2016 err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); |
|
2017 User::LeaveIfError(err); |
|
2018 TBool simRemoved(simState == ESimNotPresent); |
|
2019 |
|
2020 if (simRemoved) |
|
2021 { |
|
2022 ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); |
|
2023 return KErrAccessDenied; |
|
2024 } |
|
2025 |
|
2026 RMmCustomAPI::TSecurityCodeType secCodeType; |
|
2027 RMobilePhone::TMobilePhoneSecurityCode EtelsecCodeType; |
|
2028 secCodeType = RMmCustomAPI::ESecurityCodePin2; |
|
2029 RMobilePhone::TMobilePassword oldPassword; |
|
2030 RMobilePhone::TMobilePassword newPassword; |
|
2031 RMobilePhone::TMobilePassword verifcationPassword; |
|
2032 RMobilePhone::TMobilePhonePasswordChangeV1 passwords; |
|
2033 RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; |
|
2034 RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); |
|
2035 TInt queryAccepted = KErrCancel; |
|
2036 |
|
2037 // check if pin2 is blocked... |
|
2038 TBool isBlocked = EFalse; |
2207 TBool isBlocked = EFalse; |
2039 |
2208 //Check whether PIN2 is blocked |
2040 TInt ret = iCustomPhone.IsBlocked(secCodeType, isBlocked); |
2209 ret = iCustomPhone.IsBlocked(secCodeType,isBlocked); |
2041 RDEBUG("isBlocked", isBlocked); |
2210 |
2042 if (isBlocked) |
2211 #if defined(_DEBUG) |
2043 return KErrAccessDenied; |
2212 RDebug::Print(_L("(SECUI)CSecuritySettings::AskPin2L() IsBlocked return value: %d"), ret); |
2044 RDEBUG("ret", ret); |
2213 #endif |
2045 #ifdef __WINS__ |
2214 if(isBlocked) |
2046 if (ret == KErrNotSupported) |
2215 return EFalse; |
2047 ret = KErrNone; |
2216 |
2048 #endif |
|
2049 |
|
2050 if (ret != KErrNone) |
2217 if (ret != KErrNone) |
2051 { |
2218 { |
2052 switch (ret) |
2219 switch (ret) |
2053 { |
2220 { |
2054 // PIN2 Blocked. |
2221 // PIN2 Blocked. |
2055 case KErrGsm0707SIMPuk2Required: |
2222 case KErrGsm0707SIMPuk2Required: |
2056 break; |
2223 break; |
2057 case KErrGsmSSPasswordAttemptsViolation: |
2224 case KErrGsmSSPasswordAttemptsViolation: |
2058 case KErrLocked: |
2225 case KErrLocked: |
2059 // Pin2 features blocked permanently! |
2226 // Pin2 features blocked permanently! |
2065 break; |
2232 break; |
2066 default: |
2233 default: |
2067 ShowErrorNoteL(ret); |
2234 ShowErrorNoteL(ret); |
2068 break; |
2235 break; |
2069 } |
2236 } |
2070 return KErrAccessDenied; |
2237 return EFalse; |
2071 } |
2238 } |
2072 |
|
2073 // Security code must be changed to Etel API format |
|
2074 // Custom API Pin1 and Pin2 have the same enum values as the Etel ones |
|
2075 EtelsecCodeType = (RMobilePhone::TMobilePhoneSecurityCode) secCodeType; |
|
2076 iWait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
2239 iWait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
2077 RDEBUG("GetSecurityCodeInfo", 0); |
2240 iPhone.GetSecurityCodeInfo(iWait->iStatus, etelsecCodeType, codeInfoPkg); |
2078 iPhone.GetSecurityCodeInfo(iWait->iStatus, EtelsecCodeType, codeInfoPkg); |
|
2079 RDEBUG("WaitForRequestL", 0); |
|
2080 ret = iWait->WaitForRequestL(); |
2241 ret = iWait->WaitForRequestL(); |
2081 RDEBUG("WaitForRequestL ret", ret); |
2242 |
2082 #ifdef __WINS__ |
2243 #if defined(_DEBUG) |
2083 if (ret == KErrNotSupported || ret == KErrTimedOut) |
2244 RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): get PIN2 info result: %d"), ret); |
2084 { |
2245 TInt attempts(codeInfo.iRemainingEntryAttempts); |
2085 codeInfo.iRemainingEntryAttempts = 1; |
2246 RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): attempts remaining: %d"), attempts); |
2086 ret = KErrNone; |
2247 #endif |
2087 } |
|
2088 #endif |
|
2089 User::LeaveIfError(ret); |
2248 User::LeaveIfError(ret); |
2090 |
2249 |
2091 RDEBUG("codeInfo.iRemainingEntryAttempts", |
2250 // ask pin2 code |
2092 codeInfo.iRemainingEntryAttempts); |
2251 RMobilePhone::TMobilePassword password; |
2093 if (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) |
2252 CCodeQueryDialog* dlg = new (ELeave) CCodeQueryDialog (password,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); |
2094 codeInfo.iRemainingEntryAttempts = -1; |
2253 if(codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) |
2095 |
2254 ret = dlg->ExecuteLD(R_PIN2_QUERY); |
2096 /* request PIN using QT */ |
2255 else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) |
2097 queryAccepted = KErrCancel; |
2256 { |
2098 CSecQueryUi *iSecQueryUi; |
2257 HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_PIN2_ATTEMPTS, codeInfo.iRemainingEntryAttempts ); |
2099 iSecQueryUi = CSecQueryUi::NewL(); |
2258 ret = dlg->ExecuteLD(R_PIN2_QUERY, *queryPrompt); |
2100 TBuf<0x100> title; |
2259 CleanupStack::PopAndDestroy(queryPrompt); |
2101 title.Zero(); |
2260 } |
2102 HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_pin2_code")); |
2261 else |
2103 title.Append(stringHolder->Des()); |
2262 { |
2104 CleanupStack::PopAndDestroy(stringHolder); |
2263 HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_PIN2_ATTEMPT); |
2105 title.Append(_L("$")); |
2264 ret = dlg->ExecuteLD(R_PIN2_QUERY, *queryPrompt); |
2106 title.AppendNum(codeInfo.iRemainingEntryAttempts); |
2265 CleanupStack::PopAndDestroy(queryPrompt); |
2107 queryAccepted = iSecQueryUi->SecQueryDialog(title, oldPassword, SEC_C_PIN2_CODE_MIN_LENGTH, SEC_C_PIN2_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported |
2266 } |
2108 | ESecUiEmergencyNotSupported | secCodeType); |
2267 |
2109 RDEBUG("oldPassword", 0); |
2268 if (!ret) |
2110 RDEBUGSTR(oldPassword); |
2269 { |
2111 RDEBUG("queryAccepted", queryAccepted); |
2270 #if defined(_DEBUG) |
2112 delete iSecQueryUi; |
2271 RDebug::Print(_L("(SECUI)CSecuritySettings::AskPin2L(): Cancel pressed")); |
2113 if (queryAccepted != KErrNone) |
2272 #endif |
2114 return KErrAbort; |
2273 return EFalse; |
2115 /* end request PIN using QT */ |
2274 } |
2116 |
2275 |
2117 /* request PIN using QT */ |
2276 // verify code |
2118 { |
2277 RMobilePhone::TMobilePassword required_fourth; |
2119 queryAccepted = KErrCancel; |
2278 iWait->SetRequestType(EMobilePhoneVerifySecurityCode); |
2120 CSecQueryUi * iSecQueryUi; |
2279 iPhone.VerifySecurityCode(iWait->iStatus,etelsecCodeType, password, required_fourth); |
2121 iSecQueryUi = CSecQueryUi::NewL(); |
|
2122 // this queries both, and verifies itself |
|
2123 TBuf<0x100> title; |
|
2124 title.Zero(); |
|
2125 HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_pin2_code")); |
|
2126 title.Append(stringHolder->Des()); |
|
2127 CleanupStack::PopAndDestroy(stringHolder); |
|
2128 title.Append(_L("|")); |
|
2129 HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("Verify")); |
|
2130 title.Append(stringHolder2->Des()); |
|
2131 CleanupStack::PopAndDestroy(stringHolder2); |
|
2132 queryAccepted = iSecQueryUi->SecQueryDialog(title, newPassword, SEC_C_PIN2_CODE_MIN_LENGTH, SEC_C_PIN2_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported |
|
2133 | ESecUiEmergencyNotSupported | secCodeType); |
|
2134 RDEBUG("newPassword", 0); |
|
2135 RDEBUGSTR(newPassword); |
|
2136 RDEBUG("queryAccepted", queryAccepted); |
|
2137 delete iSecQueryUi; |
|
2138 if (queryAccepted != KErrNone) |
|
2139 return KErrAbort; |
|
2140 } |
|
2141 /* end request PIN using QT */ |
|
2142 |
|
2143 passwords.iOldPassword = oldPassword; |
|
2144 passwords.iNewPassword = newPassword; |
|
2145 iWait->SetRequestType(EMobilePhoneChangeSecurityCode); |
|
2146 RDEBUG("ChangeSecurityCode", 0); |
|
2147 iPhone.ChangeSecurityCode(iWait->iStatus, EtelsecCodeType, passwords); |
|
2148 RDEBUG("WaitForRequestL", 0); |
|
2149 TInt res = iWait->WaitForRequestL(); |
2280 TInt res = iWait->WaitForRequestL(); |
2150 RDEBUG("WaitForRequestL res", res); |
2281 |
2151 #ifdef __WINS__ |
2282 #if defined(_DEBUG) |
2152 if (res == KErrNotSupported) |
2283 RDebug::Print(_L("(SECUI)CSecuritySettings::AskPin2L() VerifySecurityCode return value: %d"), res); |
2153 res = KErrNone; |
2284 #endif |
2154 #endif |
2285 |
2155 switch (res) |
2286 switch(res) |
2156 { |
2287 { |
2157 case KErrNone: |
2288 case KErrNone: |
2158 { |
2289 break; |
2159 // code changed |
|
2160 ShowResultNoteL(R_PIN2_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); |
|
2161 break; |
|
2162 } |
|
2163 case KErrGsm0707IncorrectPassword: |
2290 case KErrGsm0707IncorrectPassword: |
2164 case KErrAccessDenied: |
2291 case KErrAccessDenied: |
2165 { |
2292 // code was entered erroneously |
2166 ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
2293 ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
2167 ChangePin2ParamsL(_L(""), _L(""), aFlags, aCaption, aShowError); |
2294 return AskPin2L(); |
2168 break; |
2295 case KErrGsm0707OperationNotAllowed: |
2169 } |
2296 // not allowed with this sim |
|
2297 ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
|
2298 return EFalse; |
2170 case KErrGsmSSPasswordAttemptsViolation: |
2299 case KErrGsmSSPasswordAttemptsViolation: |
2171 case KErrLocked: |
2300 case KErrLocked: |
2172 { |
2301 // code was blocked |
2173 // Pin2 blocked! |
2302 ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
2174 ShowResultNoteL(KErrLocked, CAknNoteDialog::EErrorTone); |
2303 return EFalse; |
2175 CSecurityHandler* handler = new (ELeave) CSecurityHandler(iPhone); |
2304 default: |
2176 CleanupStack::PushL(handler); |
2305 ShowErrorNoteL(res); |
2177 handler->HandleEventL(RMobilePhone::EPuk2Required); |
2306 return AskPin2L(); |
2178 CleanupStack::PopAndDestroy(handler); // handler |
2307 } |
2179 return KErrLocked; |
2308 |
2180 } |
2309 return ETrue; |
|
2310 } |
|
2311 // |
|
2312 // ---------------------------------------------------------- |
|
2313 // CSecuritySettings::SetFdnModeL() |
|
2314 // Activates or deactivates Fixed Dialling Numbers (FDN) mode. |
|
2315 // ---------------------------------------------------------- |
|
2316 // |
|
2317 EXPORT_C void CSecuritySettings::SetFdnModeL() |
|
2318 { |
|
2319 /***************************************************** |
|
2320 * Series 60 Customer / ETel |
|
2321 * Series 60 ETel API |
|
2322 *****************************************************/ |
|
2323 #if defined(_DEBUG) |
|
2324 RDebug::Print(_L("(SECUI)CSecuritySettings::SetFdnModeL()")); |
|
2325 #endif |
|
2326 RMmCustomAPI::TSecurityCodeType secCodeType = RMmCustomAPI::ESecurityCodePin2; |
|
2327 |
|
2328 TBool isBlocked = EFalse; |
|
2329 TInt ret = iCustomPhone.IsBlocked(secCodeType,isBlocked); |
|
2330 |
|
2331 if(isBlocked) |
|
2332 return; |
|
2333 |
|
2334 if (ret != KErrNone) |
|
2335 { |
|
2336 switch (ret) |
|
2337 { |
|
2338 // PIN2 Blocked. |
|
2339 case KErrGsm0707SIMPuk2Required: |
|
2340 break; |
|
2341 case KErrGsmSSPasswordAttemptsViolation: |
|
2342 case KErrLocked: |
|
2343 // Pin2 features blocked permanently! |
|
2344 ShowResultNoteL(R_PIN2_REJECTED, CAknNoteDialog::EConfirmationTone); |
|
2345 break; |
|
2346 case KErrGsm0707SimNotInserted: |
|
2347 // not allowed with this sim |
|
2348 ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
|
2349 break; |
|
2350 default: |
|
2351 ShowErrorNoteL(ret); |
|
2352 break; |
|
2353 } |
|
2354 return; |
|
2355 } |
|
2356 |
|
2357 |
|
2358 TInt status = KErrNone; |
|
2359 |
|
2360 RMobilePhone::TMobilePhoneFdnStatus fdnMode; |
|
2361 RMobilePhone::TMobilePhoneFdnSetting fdnSet; |
|
2362 |
|
2363 iPhone.GetFdnStatus(fdnMode); |
|
2364 |
|
2365 if (fdnMode == RMobilePhone::EFdnActive) |
|
2366 { |
|
2367 fdnSet = RMobilePhone::EFdnSetOff; |
|
2368 } |
|
2369 else |
|
2370 { |
|
2371 fdnSet = RMobilePhone::EFdnSetOn; |
|
2372 } |
|
2373 |
|
2374 // Change the FDN setting |
|
2375 iWait->SetRequestType(EMobilePhoneSetFdnSetting); |
|
2376 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); |
|
2377 iPhone.SetFdnSetting(iWait->iStatus, fdnSet); |
|
2378 status = iWait->WaitForRequestL(); |
|
2379 |
|
2380 #if defined(_DEBUG) |
|
2381 RDebug::Print( _L("(SECUI)CSecuritySettings::SetFdnModeL(): RETURN CODE: %d"), status); |
|
2382 #endif |
|
2383 switch(status) |
|
2384 { |
|
2385 case KErrNone: |
|
2386 break; |
|
2387 case KErrGsm0707IncorrectPassword: |
|
2388 case KErrAccessDenied: |
|
2389 // code was entered erroneously |
|
2390 SetFdnModeL(); |
|
2391 break; |
|
2392 case KErrGsmSSPasswordAttemptsViolation: |
|
2393 case KErrLocked: |
|
2394 break; |
|
2395 case KErrAbort: |
|
2396 break; |
2181 case KErrGsm0707OperationNotAllowed: |
2397 case KErrGsm0707OperationNotAllowed: |
2182 { |
|
2183 // not allowed with this sim |
2398 // not allowed with this sim |
2184 ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
2399 ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
2185 return KErrGsm0707OperationNotAllowed; |
2400 break; |
2186 } |
|
2187 case KErrAbort: |
|
2188 { |
|
2189 break; |
|
2190 } |
|
2191 default: |
2401 default: |
2192 { |
2402 ShowErrorNoteL(status); |
2193 ShowErrorNoteL(res); |
2403 break; |
2194 ChangePin2ParamsL(_L(""), _L(""), aFlags, aCaption, aShowError); |
2404 } |
2195 break; |
2405 } |
2196 } |
2406 // |
2197 } |
2407 // ---------------------------------------------------------- |
2198 return res; |
2408 // CSecuritySettings::GetFndMode() |
|
2409 // Retrieves the current Fixed Dialling Numbers mode |
|
2410 // ---------------------------------------------------------- |
|
2411 // |
|
2412 EXPORT_C TInt CSecuritySettings::GetFdnMode (RMobilePhone::TMobilePhoneFdnStatus& aFdnMode) |
|
2413 { |
|
2414 /***************************************************** |
|
2415 * Series 60 Customer / ETel |
|
2416 * Series 60 ETel API |
|
2417 *****************************************************/ |
|
2418 #if defined(_DEBUG) |
|
2419 RDebug::Print(_L("(SECUI)CSecuritySettings::GetFdnMode()")); |
|
2420 #endif |
|
2421 return iPhone.GetFdnStatus(aFdnMode); |
2199 } |
2422 } |
2200 /************************************************/ |
2423 |
2201 // qtdone |
2424 // |
2202 EXPORT_C TInt CSecuritySettings::ChangeSecCodeParamsL(RMobilePhone::TMobilePassword aOldPassword, RMobilePhone::TMobilePassword aNewPassword, TInt aFlags, TDes& aCaption, |
2425 // ---------------------------------------------------------- |
2203 TInt aShowError) |
2426 // CSecuritySettings::ShowErrorNoteL() |
|
2427 // Shows error note |
|
2428 // ---------------------------------------------------------- |
|
2429 // |
|
2430 void CSecuritySettings::ShowErrorNoteL(TInt aError) |
2204 { |
2431 { |
2205 RDEBUG("aFlags", aFlags); |
2432 #if defined(_DEBUG) |
2206 RDEBUG("aShowError", aShowError); |
2433 RDebug::Print(_L("(SECUI)CSecuritySettings::ShowErrorNoteL()")); |
2207 /***************************************************** |
2434 #endif |
2208 * Series 60 Customer / ETel |
2435 // Let's create TextResolver instance for error resolving... |
2209 * Series 60 ETel API |
2436 CTextResolver* textresolver = CTextResolver::NewLC(); |
2210 *****************************************************/ |
2437 // Resolve the error |
2211 TInt res = KErrNone; |
2438 TPtrC errorstring; |
2212 TInt queryAccepted = KErrCancel; |
2439 errorstring.Set( textresolver->ResolveErrorString( aError ) ); |
2213 RMobilePhone::TMobilePassword newPassword; |
2440 CAknNoteDialog* noteDlg = new (ELeave) CAknNoteDialog(REINTERPRET_CAST(CEikDialog**,¬eDlg)); |
2214 |
2441 noteDlg->PrepareLC(R_CODE_ERROR); |
2215 RMobilePhone::TMobilePhoneSecurityCode secCodeType; |
2442 noteDlg->SetTextL((TDesC&)errorstring); |
2216 secCodeType = RMobilePhone::ESecurityCodePhonePassword; |
2443 noteDlg->SetTimeout(CAknNoteDialog::ELongTimeout); |
2217 RMobilePhone::TMobilePassword oldPassword; |
2444 noteDlg->SetTone(CAknNoteDialog::EErrorTone); |
2218 RMobilePhone::TMobilePassword required_fourth; |
2445 noteDlg->RunLD(); |
2219 RMobilePhone::TMobilePhonePasswordChangeV1 passwords; |
2446 CleanupStack::PopAndDestroy(); // resolver |
2220 |
2447 } |
2221 // confirm that it can be changed now |
2448 |
2222 { |
2449 // |
2223 RArray<TDevicelockPolicies> aFailedPolicies; |
2450 // ---------------------------------------------------------- |
2224 TDevicelockPolicies failedPolicy; |
2451 // CSecuritySettings::ShowResultNoteL() |
2225 TInt retLockcode = KErrNone; |
2452 // Shows result note |
2226 RSCPClient scpClient; |
2453 // ---------------------------------------------------------- |
2227 retLockcode = scpClient.Connect(); |
2454 // |
2228 RDEBUG( "retLockcode", retLockcode ); |
2455 void CSecuritySettings::ShowResultNoteL(TInt aResourceID, CAknNoteDialog::TTone aTone) |
2229 if(retLockcode == KErrNone ) |
2456 { |
2230 { |
2457 #if defined(_DEBUG) |
2231 RDEBUG( "scpClient.VerifyNewLockcodeAgainstPolicies", 0 ); |
2458 RDebug::Print(_L("(SECUI)CSecuritySettings::ShowResultNoteL()")); |
2232 retLockcode = scpClient.IsLockcodeChangeAllowedNow( aFailedPolicies ); |
2459 RDebug::Print(_L("(SECUI)CSecuritySettings::ShowResultNoteL() Resource ID: %d"), aResourceID); |
2233 RDEBUG( "retLockcode", retLockcode ); |
2460 #endif |
2234 RDEBUG( "aFailedPolicies.Count()", aFailedPolicies.Count() ); |
2461 CAknNoteDialog* noteDlg = new (ELeave) CAknNoteDialog(REINTERPRET_CAST(CEikDialog**,¬eDlg)); |
2235 res = retLockcode; |
2462 noteDlg->SetTimeout(CAknNoteDialog::ELongTimeout); |
2236 for(TInt i=0; i<aFailedPolicies.Count(); i++) |
2463 noteDlg->SetTone(aTone); |
2237 { |
2464 noteDlg->ExecuteLD(aResourceID); |
2238 failedPolicy = aFailedPolicies[i]; |
2465 } |
2239 RDEBUG( "failedPolicy", failedPolicy ); |
2466 |
2240 // it could also be res = KErrGsm0707IncorrectPassword; |
2467 // |
2241 res = KErrTDevicelockPolicies + failedPolicy; |
2468 // ---------------------------------------------------------- |
2242 } |
2469 // CSecuritySettings::IsUpinSupportedL() |
2243 scpClient.Close(); |
2470 // Return is UPIN supported |
2244 if(retLockcode!=KErrNone) |
2471 // ---------------------------------------------------------- |
2245 { |
2472 // |
2246 ShowResultNoteL(res, CAknNoteDialog::EErrorTone); |
2473 EXPORT_C TBool CSecuritySettings::IsUpinSupportedL() |
2247 return res; |
2474 { |
2248 } |
2475 TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); |
2249 } |
2476 TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); |
2250 else |
2477 if(wcdmaSupported || upinSupported) |
2251 { |
2478 { |
2252 RDEBUG( "failed connecting to SCP", retLockcode ); |
2479 #if defined(_DEBUG) |
2253 // what to do? let's assume that we don't need special policies. |
2480 RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinSupported() BEGIN")); |
2254 } |
2481 #endif |
2255 } |
2482 #ifdef __WINS__ |
2256 |
2483 |
2257 RDEBUG("aOldPassword.Length()", aOldPassword.Length()); |
2484 return EFalse; |
2258 if (aOldPassword.Length() == 0) |
2485 |
2259 { |
2486 #else //WINS |
2260 // aOldPassword was not given as a parameter |
2487 |
2261 queryAccepted = KErrCancel; |
2488 RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
2262 CSecQueryUi *iSecQueryUi; |
2489 |
2263 iSecQueryUi = CSecQueryUi::NewL(); |
2490 //get lock info |
2264 TBuf<0x100> title; |
2491 RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
2265 title.Zero(); |
2492 iWait->SetRequestType(EMobilePhoneGetLockInfo); |
2266 HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_sec_code")); |
2493 #if defined(_DEBUG) |
2267 title.Append(stringHolder->Des()); |
2494 RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinSupported() GetLockInfo")); |
2268 CleanupStack::PopAndDestroy(stringHolder); |
2495 #endif |
2269 queryAccepted = iSecQueryUi->SecQueryDialog(title, oldPassword, SEC_C_SECURITY_CODE_MIN_LENGTH, SEC_C_SECURITY_CODE_MAX_LENGTH, ESecUiAlphaSupported |
2496 iPhone.GetLockInfo(iWait->iStatus, RMobilePhone::ELockUniversalPin, lockInfoPkg); |
2270 | ESecUiCancelSupported | ESecUiEmergencyNotSupported | secCodeType); |
2497 TInt res = iWait->WaitForRequestL(); |
2271 RDEBUG("oldPassword", 0); |
2498 #if defined(_DEBUG) |
2272 RDEBUGSTR(oldPassword); |
2499 RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinSupported() GetLockInfo DONE")); |
2273 RDEBUG("queryAccepted", queryAccepted); |
2500 #endif |
2274 delete iSecQueryUi; |
2501 if ((res == KErrNotSupported) || (res == KErrGsmInvalidParameter)) |
2275 if (queryAccepted != KErrNone) |
2502 { |
2276 return KErrAbort; |
2503 #if defined(_DEBUG) |
2277 newPassword = _L(""); |
2504 RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinSupported(): NOT SUPPORTED")); |
2278 } |
2505 #endif |
|
2506 return EFalse; |
|
2507 } |
|
2508 #if defined(_DEBUG) |
|
2509 RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinSupported(): SUPPORTED: %d"), res); |
|
2510 #endif |
|
2511 #if defined(_DEBUG) |
|
2512 RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinSupported() END")); |
|
2513 #endif |
|
2514 return ETrue; |
|
2515 |
|
2516 #endif //WINS |
|
2517 } |
2279 else |
2518 else |
2280 { |
2519 return EFalse; |
2281 RDEBUG("parameter includes oldPassword", 1); |
2520 } |
2282 oldPassword.Copy(aOldPassword); |
2521 // |
2283 newPassword.Copy(aNewPassword); |
2522 // ---------------------------------------------------------- |
2284 } |
2523 // CSecuritySettings::IsCodeBlocked() |
2285 |
2524 // Return is a code blocked |
2286 // check current code before proceeding |
2525 // ---------------------------------------------------------- |
2287 RDEBUG("EMobilePhoneVerifySecurityCode", EMobilePhoneVerifySecurityCode); |
2526 // |
2288 iWait->SetRequestType(EMobilePhoneVerifySecurityCode); // 0x59F1 |
2527 EXPORT_C TBool CSecuritySettings::IsUpinBlocked() |
2289 RDEBUG("VerifySecurityCode", 0); |
2528 { |
2290 iPhone.VerifySecurityCode(iWait->iStatus, secCodeType, oldPassword, required_fourth); |
2529 TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); |
2291 RDEBUG("WaitForRequestL", 0); |
2530 TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); |
2292 res = iWait->WaitForRequestL(); |
2531 if(wcdmaSupported || upinSupported) |
2293 RDEBUG("WaitForRequestL res", res); |
2532 { |
2294 #ifdef __WINS__ |
2533 #ifdef __WINS__ |
2295 if (res == KErrNotSupported) |
2534 return EFalse; |
2296 res = KErrNone; |
2535 #else//__WINS__ |
2297 #endif |
2536 #if defined(_DEBUG) |
2298 |
2537 RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinBlocked() BEGIN")); |
2299 if (res != KErrNone) |
2538 #endif |
2300 { |
2539 RMmCustomAPI::TSecurityCodeType secCodeType; |
2301 ShowResultNoteL(res, CAknNoteDialog::EErrorTone); |
2540 secCodeType = RMmCustomAPI::ESecurityUniversalPin; |
2302 return res; |
2541 TBool isBlocked = EFalse; |
2303 } |
2542 #if defined(_DEBUG) |
2304 |
2543 RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinBlocked() IsBlocked")); |
2305 while (newPassword.Length() == 0) |
2544 #endif |
2306 { |
2545 TInt ret = iCustomPhone.IsBlocked(secCodeType,isBlocked); |
2307 // codes do not match -> note -> ask new pin and verification codes again |
2546 #if defined(_DEBUG) |
2308 // note that this never happens because the dialog doesn't dismiss until both codes match |
2547 RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinBlocked() DONE.RETURN: %d"), ret); |
2309 if (newPassword.Length() > 0) |
2548 #endif |
2310 ShowResultNoteL(R_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone); |
2549 #if defined(_DEBUG) |
2311 |
2550 RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinBlocked():isblocked: %d"), isBlocked); |
2312 { |
2551 #endif |
2313 queryAccepted = KErrCancel; |
2552 #if defined(_DEBUG) |
2314 CSecQueryUi *iSecQueryUi; |
2553 RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinBlocked() END")); |
2315 iSecQueryUi = CSecQueryUi::NewL(); |
2554 #endif |
2316 // will ask both codes and compare itself |
2555 return isBlocked; |
2317 // mix, max , alpha is handled using TARM params, in the dialog itself |
2556 #endif //__WINS__ |
2318 TInt lType = ESecUiAlphaSupported | ESecUiCancelSupported | ESecUiEmergencyNotSupported | secCodeType; |
2557 } |
2319 RDEBUG("lType", lType); |
|
2320 TBuf<0x100> title; |
|
2321 title.Zero(); |
|
2322 HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_sec_code")); |
|
2323 title.Append(stringHolder->Des()); |
|
2324 CleanupStack::PopAndDestroy(stringHolder); |
|
2325 title.Append(_L("|")); |
|
2326 HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("Verify")); |
|
2327 title.Append(stringHolder2->Des()); |
|
2328 CleanupStack::PopAndDestroy(stringHolder2); |
|
2329 queryAccepted = iSecQueryUi->SecQueryDialog(title, newPassword, SEC_C_SECURITY_CODE_MIN_LENGTH, SEC_C_SECURITY_CODE_MAX_LENGTH, lType); |
|
2330 RDEBUG("newPassword", 0); |
|
2331 RDEBUGSTR(newPassword); |
|
2332 RDEBUG("queryAccepted", queryAccepted); |
|
2333 delete iSecQueryUi; |
|
2334 if (queryAccepted != KErrNone) |
|
2335 return KErrAbort; |
|
2336 } |
|
2337 |
|
2338 } // while |
|
2339 |
|
2340 // Confirm that the new code is nice. |
|
2341 // This is also done on every key-press in the dialog, but it doesn't harm to repeat. |
|
2342 // In fact this is needed for the case when newPassword is provided. |
|
2343 RArray<TDevicelockPolicies> aFailedPolicies; |
|
2344 TDevicelockPolicies failedPolicy; |
|
2345 TInt retLockcode = KErrNone; |
|
2346 RSCPClient scpClient; |
|
2347 retLockcode = scpClient.Connect(); |
|
2348 RDEBUG( "retLockcode", retLockcode ); |
|
2349 if(retLockcode == KErrNone ) |
|
2350 { |
|
2351 RDEBUG( "scpClient.VerifyNewLockcodeAgainstPolicies", 0 ); |
|
2352 retLockcode = scpClient.VerifyNewLockcodeAgainstPolicies( newPassword, aFailedPolicies ); |
|
2353 RDEBUG( "retLockcode", retLockcode ); |
|
2354 RDEBUG( "aFailedPolicies.Count()", aFailedPolicies.Count() ); |
|
2355 for(TInt i=0; i<aFailedPolicies.Count(); i++) |
|
2356 { |
|
2357 failedPolicy = aFailedPolicies[i]; |
|
2358 RDEBUG( "failedPolicy", failedPolicy ); |
|
2359 // it could also be res = KErrGsm0707IncorrectPassword; |
|
2360 res = KErrTDevicelockPolicies + failedPolicy; |
|
2361 } |
|
2362 scpClient.Close(); |
|
2363 } |
|
2364 else |
|
2365 { |
|
2366 RDEBUG( "failed connecting to SCP", retLockcode ); |
|
2367 // what to do? let's assume that we don't need special policies. |
|
2368 } |
|
2369 |
|
2370 // change code |
|
2371 RDEBUG("res", res); |
|
2372 if (res == KErrNone) |
|
2373 { |
|
2374 passwords.iOldPassword = oldPassword; |
|
2375 passwords.iNewPassword = newPassword; |
|
2376 iWait->SetRequestType(EMobilePhoneChangeSecurityCode); |
|
2377 RDEBUG("ChangeSecurityCode", 0); |
|
2378 iPhone.ChangeSecurityCode(iWait->iStatus, secCodeType, passwords); |
|
2379 RDEBUG("WaitForRequestL", 0); |
|
2380 res = iWait->WaitForRequestL(); |
|
2381 RDEBUG("WaitForRequestL res", res); |
|
2382 #ifdef __WINS__ |
|
2383 if (res == KErrNotSupported) |
|
2384 res = KErrNone; |
|
2385 #endif |
|
2386 |
|
2387 if (res == KErrNone && 1 == 0) // TODO not possible to enable because it asks code again |
|
2388 { |
|
2389 RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; |
|
2390 RMobilePhone::TMobilePhoneLockSetting lockChangeSetting = RMobilePhone::ELockSetEnabled; |
|
2391 iWait->SetRequestType(EMobilePhoneSetLockSetting); |
|
2392 RDEBUG("SetLockSetting", 0); |
|
2393 iPhone.SetLockSetting(iWait->iStatus, lockType, lockChangeSetting); |
|
2394 RDEBUG("WaitForRequestL", 0); |
|
2395 res = iWait->WaitForRequestL(); |
|
2396 RDEBUG("WaitForRequestL res", res); |
|
2397 #ifdef __WINS__ |
|
2398 if (res == KErrNotSupported || res == KErrTimedOut) |
|
2399 res = KErrNone; |
|
2400 #endif |
|
2401 } |
|
2402 } |
|
2403 |
|
2404 RDEBUG("res", res); |
|
2405 switch (res) |
|
2406 { |
|
2407 case KErrNone: |
|
2408 { |
|
2409 // code changed ... unless TARM rejects it |
|
2410 { |
|
2411 // Send the changed code to the SCP server, even with device lock enhancements. |
|
2412 RDEBUG("scpClient.Connect", 0); |
|
2413 RSCPClient scpClient; |
|
2414 TSCPSecCode newScpCode; |
|
2415 TSCPSecCode oldScpCode; |
|
2416 newScpCode.Copy(newPassword); |
|
2417 oldScpCode.Copy(oldPassword); |
|
2418 if (scpClient.Connect() == KErrNone) |
|
2419 { |
|
2420 RDEBUG("scpClient.StoreLockcode", 0); |
|
2421 // this is the old method. Obsolete now |
|
2422 // scpClient.StoreCode( newCode ); |
|
2423 RArray<TDevicelockPolicies> aFailedPolicies; |
|
2424 TDevicelockPolicies failedPolicy; |
|
2425 TInt retLockcode = KErrNone; |
|
2426 retLockcode = scpClient.StoreLockcode(newScpCode, oldScpCode, aFailedPolicies); |
|
2427 RDEBUG( "retLockcode", retLockcode ); |
|
2428 RDEBUG( "KErrAccessDenied", KErrAccessDenied ); |
|
2429 RDEBUG( "aFailedPolicies.Count()", aFailedPolicies.Count() ); |
|
2430 for (TInt i = 0; i < aFailedPolicies.Count(); i++) |
|
2431 { |
|
2432 failedPolicy = aFailedPolicies[i]; |
|
2433 RDEBUG( "failedPolicy", failedPolicy ); |
|
2434 } |
|
2435 // Don't know what to do if TARM fails. Hopefully it was stopped at typing, as well as VerifyNewLockcodeAgainstPolicies |
|
2436 // The code is already changed in iPhone ! |
|
2437 // For now, just undo the changed password |
|
2438 if(retLockcode!=KErrNone) |
|
2439 { |
|
2440 RDEBUG("Undo password change because retLockcode", retLockcode); |
|
2441 ShowResultNoteL(retLockcode, CAknNoteDialog::EConfirmationTone); |
|
2442 |
|
2443 // go back to previous password. |
|
2444 passwords.iOldPassword = newPassword; |
|
2445 passwords.iNewPassword = oldPassword; |
|
2446 iWait->SetRequestType(EMobilePhoneChangeSecurityCode); |
|
2447 RDEBUG("ChangeSecurityCode", 0); |
|
2448 iPhone.ChangeSecurityCode(iWait->iStatus, secCodeType, passwords); |
|
2449 RDEBUG("WaitForRequestL", 0); |
|
2450 res = iWait->WaitForRequestL(); // this can't fail. ISA is always allowing to undo the password change. |
|
2451 RDEBUG("WaitForRequestL res", res); |
|
2452 #ifdef __WINS__ |
|
2453 if (res == KErrNotSupported) |
|
2454 res = KErrNone; |
|
2455 #endif |
|
2456 res = retLockcode; |
|
2457 } |
|
2458 scpClient.Close(); |
|
2459 } |
|
2460 if(res==KErrNone) |
|
2461 { |
|
2462 RDEBUG( "showing R_SECURITY_CODE_CHANGED_NOTE", R_SECURITY_CODE_CHANGED_NOTE ); |
|
2463 ShowResultNoteL(R_SECURITY_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); |
|
2464 } |
|
2465 } |
|
2466 break; |
|
2467 } |
|
2468 case KErrGsmSSPasswordAttemptsViolation: |
|
2469 case KErrLocked: |
|
2470 { |
|
2471 ShowResultNoteL(R_SEC_BLOCKED, CAknNoteDialog::EErrorTone); |
|
2472 ChangeSecCodeParamsL(aOldPassword, aNewPassword, aFlags, aCaption, aShowError); |
|
2473 break; |
|
2474 } |
|
2475 case KErrGsm0707IncorrectPassword: |
|
2476 case KErrAccessDenied: |
|
2477 { |
|
2478 // code was entered erroneously |
|
2479 ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
|
2480 ChangeSecCodeParamsL(aOldPassword, aNewPassword, aFlags, aCaption, aShowError); |
|
2481 break; |
|
2482 } |
|
2483 case KErrAbort: |
|
2484 { |
|
2485 break; |
|
2486 } |
|
2487 default: |
|
2488 { |
|
2489 ShowErrorNoteL(res); |
|
2490 ChangeSecCodeParamsL(aOldPassword, aNewPassword, aFlags, aCaption, aShowError); |
|
2491 break; |
|
2492 } |
|
2493 } // switch |
|
2494 RDEBUG("return res", res); |
|
2495 return res; |
|
2496 } |
|
2497 |
|
2498 /**************************************/ |
|
2499 // qtdone |
|
2500 // the params are changed in the settings,. This only asks for password. |
|
2501 EXPORT_C TInt CSecuritySettings::ChangeAutoLockPeriodParamsL(TInt aPeriod, RMobilePhone::TMobilePassword aOldPassword, TInt aFlags, TDes& aCaption, TInt aShowError) |
|
2502 { |
|
2503 RDEBUG("aPeriod", aPeriod); |
|
2504 RDEBUG("aFlags", aFlags); |
|
2505 /***************************************************** |
|
2506 * Series 60 Customer / ETel |
|
2507 * Series 60 ETel API |
|
2508 *****************************************************/ |
|
2509 |
|
2510 RMobilePhone::TMobilePhoneLockSetting lockChange(RMobilePhone::ELockSetDisabled); |
|
2511 RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; |
|
2512 TInt oldPeriod = aPeriod; |
|
2513 |
|
2514 TInt maxPeriod = 0; |
|
2515 if (FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw)) |
|
2516 { |
|
2517 // Retrieve the current autolock period max. value from the SCP server, |
|
2518 // and check that the value the user |
|
2519 // selected is ok from the Corporate Policy point of view. |
|
2520 RSCPClient scpClient; |
|
2521 TInt ret = scpClient.Connect(); |
|
2522 if (ret == KErrNone) |
|
2523 { |
|
2524 CleanupClosePushL(scpClient); |
|
2525 TBuf<KSCPMaxIntLength> maxPeriodBuf; |
|
2526 if (scpClient.GetParamValue(ESCPMaxAutolockPeriod, maxPeriodBuf) == KErrNone) |
|
2527 { |
|
2528 TLex lex(maxPeriodBuf); |
|
2529 if ((lex.Val(maxPeriod) == KErrNone) && (maxPeriod > 0)) |
|
2530 { |
|
2531 RDEBUG("from SCP maxPeriod", maxPeriod); |
|
2532 } |
|
2533 else |
|
2534 { |
|
2535 maxPeriod = 0; |
|
2536 RDEBUG("not from SCP maxPeriod", maxPeriod); |
|
2537 } |
|
2538 } |
|
2539 else |
|
2540 { |
|
2541 RDEBUG("Failed to retrieve max period", maxPeriod); |
|
2542 } |
|
2543 } |
|
2544 else |
|
2545 { |
|
2546 RDEBUG("Failed to connect to SCP", 0); |
|
2547 } |
|
2548 CleanupStack::PopAndDestroy(); // scpClient |
|
2549 } |
|
2550 RDEBUG("maxPeriod", maxPeriod); |
|
2551 if (FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw)) |
|
2552 { |
|
2553 TBool allow = ETrue; |
|
2554 |
|
2555 if ((aPeriod == 0) && (maxPeriod > 0)) |
|
2556 { |
|
2557 RDEBUG("The period is not allowed by TARM", aPeriod); |
|
2558 RDEBUG( "maxPeriod", maxPeriod ); |
|
2559 allow = EFalse; |
|
2560 ShowResultNoteL(R_SECUI_TEXT_AUTOLOCK_MUST_BE_ACTIVE, CAknNoteDialog::EErrorTone); |
|
2561 } |
|
2562 if (!allow) |
|
2563 { |
|
2564 return ChangeAutoLockPeriodParamsL(aPeriod, aOldPassword, aFlags, aCaption, aShowError); // ask again |
|
2565 } |
|
2566 } |
|
2567 |
|
2568 if (aPeriod == 0) |
|
2569 { |
|
2570 // If remote lock is enabled, don't disable the domestic OS device lock |
|
2571 // since that would render the RemoteLock useless. |
|
2572 // Instead just re-set the DOS lock to enabled which as a side effect |
|
2573 // requests the security code from the user. |
|
2574 |
|
2575 TBool remoteLockStatus(EFalse); |
|
2576 CRemoteLockSettings* remoteLockSettings = CRemoteLockSettings::NewL(); |
|
2577 |
|
2578 if (remoteLockSettings->GetEnabled(remoteLockStatus)) |
|
2579 { |
|
2580 if (remoteLockStatus) |
|
2581 { |
|
2582 // Remote lock is enabled |
|
2583 lockChange = RMobilePhone::ELockSetEnabled; |
|
2584 RDEBUG( "RemoteLock is enabled lockChange", lockChange ); |
|
2585 } |
|
2586 else |
|
2587 { |
|
2588 // Remote lock is disabled |
|
2589 lockChange = RMobilePhone::ELockSetDisabled; |
|
2590 RDEBUG( "RemoteLock is disabled lockChange", lockChange ); |
|
2591 } |
|
2592 } |
|
2593 else |
|
2594 { |
|
2595 // Failed to get remote lock status |
|
2596 RDEBUG( "Failed to get remote lock status lockChange", lockChange ); |
|
2597 } |
|
2598 |
|
2599 delete remoteLockSettings; |
|
2600 remoteLockSettings = NULL; |
|
2601 |
|
2602 } |
|
2603 else |
2558 else |
2604 { |
2559 return EFalse; |
2605 lockChange = RMobilePhone::ELockSetEnabled; |
2560 } |
2606 RDEBUG("aPeriod != 0 lockChange", lockChange); |
2561 // |
2607 } |
2562 // ---------------------------------------------------------- |
2608 |
2563 // CSecuritySettings::GetActivePinCode() |
2609 iWait->SetRequestType(EMobilePhoneSetLockSetting); |
2564 // Return the code active in current application (PIN/UPIN) |
2610 RDEBUG("lockChange", lockChange); |
2565 // ---------------------------------------------------------- |
2611 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); |
2566 // |
2612 RDEBUG("SetLockSetting", 0); |
2567 EXPORT_C TBool CSecuritySettings::IsUpinActive() |
2613 iPhone.SetLockSetting(iWait->iStatus, lockType, lockChange); // this eventually calls PassPhraseRequiredL |
2568 { |
2614 RDEBUG("WaitForRequestL", 0); |
2569 TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); |
2615 TInt status = KErrNone; |
2570 TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); |
2616 status = iWait->WaitForRequestL(); |
2571 if(wcdmaSupported || upinSupported) |
2617 RDEBUG("WaitForRequestL status", status); |
2572 { |
2618 #ifdef __WINS__ |
2573 #ifdef __WINS__ |
2619 if (status == KErrNotSupported || status == KErrTimedOut) |
2574 return EFalse; |
2620 status = KErrNone; |
2575 #else//__WINS__ |
2621 #endif |
2576 #if defined(_DEBUG) |
2622 switch (status) |
2577 RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinActive() BEGIN")); |
2623 { |
2578 #endif |
2624 case KErrNone: |
2579 RMobilePhone::TMobilePhoneSecurityCode activePin; |
2625 break; |
2580 #if defined(_DEBUG) |
2626 case KErrGsmSSPasswordAttemptsViolation: |
2581 RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinActive() GetActivePin")); |
2627 case KErrLocked: |
2582 #endif |
2628 RDEBUG("KErrLocked", KErrLocked) |
2583 iCustomPhone.GetActivePin(activePin); |
2629 ; |
2584 #if defined(_DEBUG) |
2630 ShowResultNoteL(KErrLocked, CAknNoteDialog::EErrorTone); // the old code didn't show messages |
2585 RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinActive() GetActivePin DONE")); |
2631 return ChangeAutoLockPeriodParamsL(oldPeriod, aOldPassword, aFlags, aCaption, aShowError); // ask again |
2586 #endif |
2632 case KErrGsm0707IncorrectPassword: |
2587 if(activePin == RMobilePhone::ESecurityUniversalPin) |
2633 case KErrAccessDenied: |
2588 { |
2634 RDEBUG("KErrAccessDenied", KErrAccessDenied) |
2589 #if defined(_DEBUG) |
2635 ; |
2590 RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinActive(): UPIN ACTIVE")); |
2636 // code was entered erroneously |
2591 #endif |
2637 ShowResultNoteL(KErrAccessDenied, CAknNoteDialog::EErrorTone); // the old code didn't show messages |
2592 return ETrue; |
2638 return ChangeAutoLockPeriodParamsL(oldPeriod, aOldPassword, aFlags, aCaption, aShowError); // ask again |
2593 } |
2639 case KErrAbort: |
2594 #if defined(_DEBUG) |
2640 // User pressed "cancel" in the code query dialog. |
2595 RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinActive(): UPIN NOT ACTIVE")); |
2641 return oldPeriod; |
2596 #endif |
2642 default: |
2597 #if defined(_DEBUG) |
2643 RDEBUG("default", status) |
2598 RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinActive(): END")); |
2644 ; |
2599 #endif |
2645 ShowResultNoteL(status, CAknNoteDialog::EErrorTone); // the old code didn't show messages |
2600 return EFalse; |
2646 return ChangeAutoLockPeriodParamsL(oldPeriod, aOldPassword, aFlags, aCaption, aShowError); // ask again |
2601 #endif //__WINS__ |
2647 } |
2602 } |
2648 RDEBUG("aPeriod", aPeriod); |
|
2649 return aPeriod; |
|
2650 } |
|
2651 /*****************************/ |
|
2652 // qtdone |
|
2653 EXPORT_C TInt CSecuritySettings::ChangePinRequestParamsL(TInt aEnable, RMobilePhone::TMobilePassword aOldPassword, TInt aFlags, TDes& aCaption, TInt aShowError) |
|
2654 { |
|
2655 RDEBUG("aEnable", aEnable); |
|
2656 RDEBUG("aFlags", aFlags); |
|
2657 TInt simState = 0; |
|
2658 TInt lEnable = aEnable; |
|
2659 TInt err(KErrGeneral); |
|
2660 err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); |
|
2661 User::LeaveIfError(err); |
|
2662 TBool simRemoved(simState == ESimNotPresent); |
|
2663 |
|
2664 if (simRemoved) |
|
2665 { |
|
2666 ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); |
|
2667 return KErrAccessDenied; |
|
2668 } |
|
2669 |
|
2670 RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
|
2671 RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
|
2672 RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockICC; |
|
2673 |
|
2674 RMobilePhone::TMobilePhoneLockSetting lockChangeSetting; |
|
2675 |
|
2676 //get lock info |
|
2677 iWait->SetRequestType(EMobilePhoneGetLockInfo); |
|
2678 iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); |
|
2679 RDEBUG("WaitForRequestL", 0); |
|
2680 TInt status = iWait->WaitForRequestL(); |
|
2681 RDEBUG("WaitForRequestL status", status); |
|
2682 #ifdef __WINS__ |
|
2683 if (status == KErrNotSupported || status == KErrTimedOut) |
|
2684 { |
|
2685 lockInfo.iSetting = RMobilePhone::ELockSetDisabled; |
|
2686 status = KErrNone; |
|
2687 } |
|
2688 #endif |
|
2689 User::LeaveIfError(status); |
|
2690 |
|
2691 if (aOldPassword.Length() == 0) // only if input parameters are empty |
|
2692 { |
|
2693 // switch the value. |
|
2694 if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) |
|
2695 lEnable = 1; // on |
|
2696 else |
|
2697 lEnable = 0; // off |
|
2698 } |
|
2699 |
|
2700 RDEBUG("lEnable", lEnable); |
|
2701 if (lEnable == 0) |
|
2702 { |
|
2703 lockChangeSetting = RMobilePhone::ELockSetDisabled; |
|
2704 } |
|
2705 else |
2603 else |
2706 { |
2604 return EFalse; |
2707 lockChangeSetting = RMobilePhone::ELockSetEnabled; |
2605 } |
2708 } |
|
2709 |
|
2710 RDEBUG("lockChangeSetting", lockChangeSetting); |
|
2711 // Raise a flag to indicate that the PIN |
|
2712 // request coming from ETEL has originated from SecUi and not from Engine. |
|
2713 TInt tRet = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSecUIOriginated); |
|
2714 RDEBUG("tRet", tRet); |
|
2715 |
|
2716 // Change the lock setting |
|
2717 iWait->SetRequestType(EMobilePhoneSetLockSetting); |
|
2718 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); |
|
2719 RDEBUG("SetLockSetting", 0); |
|
2720 iPhone.SetLockSetting(iWait->iStatus, lockType, lockChangeSetting); // this will trigger Pin1RequiredL |
|
2721 RDEBUG("WaitForRequestL", 0); |
|
2722 status = iWait->WaitForRequestL(); |
|
2723 RDEBUG("WaitForRequestL status", status); |
|
2724 #ifdef __WINS__ |
|
2725 if (status == KErrNotSupported || status == KErrTimedOut) |
|
2726 status = KErrNone; |
|
2727 #endif |
|
2728 |
|
2729 // Lower the flag |
|
2730 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSecUIOriginatedUninitialized); |
|
2731 |
|
2732 switch (status) |
|
2733 { |
|
2734 case KErrNone: |
|
2735 { |
|
2736 break; |
|
2737 } |
|
2738 case KErrGsm0707OperationNotAllowed: |
|
2739 { |
|
2740 // not allowed with this sim |
|
2741 ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
|
2742 return KErrGsm0707OperationNotAllowed; |
|
2743 } |
|
2744 case KErrGsm0707IncorrectPassword: |
|
2745 case KErrAccessDenied: |
|
2746 { |
|
2747 // code was entered erroneously |
|
2748 return ChangePinRequestParamsL(aEnable, aOldPassword, aFlags, aCaption, aShowError); |
|
2749 } |
|
2750 case KErrGsmSSPasswordAttemptsViolation: |
|
2751 case KErrLocked: |
|
2752 { |
|
2753 return KErrLocked; |
|
2754 } |
|
2755 case KErrAbort: |
|
2756 { |
|
2757 return KErrAbort; |
|
2758 } |
|
2759 default: |
|
2760 { |
|
2761 return ChangePinRequestParamsL(aEnable, aOldPassword, aFlags, aCaption, aShowError); |
|
2762 } |
|
2763 } |
|
2764 return KErrNone; |
|
2765 } |
|
2766 |
|
2767 // |
|
2768 // ---------------------------------------------------------- |
|
2769 // CSecuritySettings::AskSecCodeParamsL() |
|
2770 // For asking security code e.g in settings |
|
2771 // not used |
|
2772 // ---------------------------------------------------------- |
|
2773 // qtdone |
|
2774 EXPORT_C TBool CSecuritySettings::AskSecCodeParamsL(RMobilePhone::TMobilePassword &aOldPassword, TInt aFlags, TDes& aCaption, TInt aShowError) |
|
2775 { |
|
2776 RDEBUG("aFlags", aFlags); |
|
2777 RDEBUG("aShowError", aShowError); |
|
2778 RDEBUG("This doesn't do anything", 0); |
|
2779 RDEBUG("aFlags", aFlags); |
|
2780 |
|
2781 // the password parameters are not used |
|
2782 if (aOldPassword.Length() > 0) |
|
2783 RDEBUGSTR(aOldPassword); |
|
2784 |
|
2785 return EFalse; |
|
2786 } |
|
2787 |
2606 |
2788 // End of file |
2607 // End of file |