16 * |
16 * |
17 */ |
17 */ |
18 |
18 |
19 |
19 |
20 #include <rmmcustomapi.h> |
20 #include <rmmcustomapi.h> |
21 #include <SecUi.rsg> |
21 #include "SecQueryUi.h" |
22 #include "secuimanualsecuritysettings.h" |
22 #include "secuimanualsecuritysettings.h" |
|
23 #include "secuisecuritysettings.h" |
23 #include <exterror.h> |
24 #include <exterror.h> |
|
25 #include "SecUi.h" |
24 #include "SecUiWait.h" |
26 #include "SecUiWait.h" |
25 #include <mmtsy_names.h> |
27 #include <mmtsy_names.h> |
26 /***************************************************** |
28 /***************************************************** |
27 * Series 60 Customer / TSY |
29 * Series 60 Customer / TSY |
28 * Needs customer TSY implementation |
30 * Needs customer TSY implementation |
105 if ( err != KErrAlreadyExists ) |
107 if ( err != KErrAlreadyExists ) |
106 { |
108 { |
107 // May also return KErrAlreadyExists if something else |
109 // May also return KErrAlreadyExists if something else |
108 // has already loaded the TSY module. And that is |
110 // has already loaded the TSY module. And that is |
109 // not an error. |
111 // not an error. |
|
112 RDEBUG("err", err); |
110 User::LeaveIfError( err ); |
113 User::LeaveIfError( err ); |
111 } |
114 } |
112 |
115 |
113 // open phones |
116 // open phones |
114 User::LeaveIfError(iServer.SetExtendedErrorGranularity(RTelServer::EErrorExtended)); |
117 User::LeaveIfError(iServer.SetExtendedErrorGranularity(RTelServer::EErrorExtended)); |
130 *****************************************************/ |
133 *****************************************************/ |
131 /***************************************************** |
134 /***************************************************** |
132 * Series 60 Customer / TSY |
135 * Series 60 Customer / TSY |
133 * Needs customer TSY implementation |
136 * Needs customer TSY implementation |
134 *****************************************************/ |
137 *****************************************************/ |
135 #if defined(_DEBUG) |
138 RDEBUG("0", 0); |
136 RDebug::Print(_L("(SECUI)CManualSecuritySettings::~CManualSecuritySettings()")); |
|
137 #endif |
|
138 // Cancel active requests |
139 // Cancel active requests |
139 if(iWait->IsActive()) |
140 if(iWait->IsActive()) |
140 { |
141 { |
141 #if defined(_DEBUG) |
142 RDEBUG("CancelAsyncRequest", 0); |
142 RDebug::Print(_L("(SECUI)CManualSecuritySettings::~CManualSecuritySettings() CANCEL REQ")); |
|
143 #endif |
|
144 iPhone.CancelAsyncRequest(iWait->GetRequestType()); |
143 iPhone.CancelAsyncRequest(iWait->GetRequestType()); |
145 } |
144 } |
146 // close phone |
145 // close phone |
147 if (iPhone.SubSessionHandle()) |
146 if (iPhone.SubSessionHandle()) |
148 iPhone.Close(); |
147 iPhone.Close(); |
172 { |
169 { |
173 /***************************************************** |
170 /***************************************************** |
174 * Series 60 Customer / ETel |
171 * Series 60 Customer / ETel |
175 * Series 60 ETel API |
172 * Series 60 ETel API |
176 *****************************************************/ |
173 *****************************************************/ |
177 #if defined(_DEBUG) |
174 RDEBUG("aPin", aPin); |
178 RDebug::Print(_L("(SECUI)CManualSecuritySettings::ChangePinL()")); |
|
179 #endif |
|
180 if (aPin == EPin1) |
175 if (aPin == EPin1) |
181 { |
176 { |
182 #if defined(_DEBUG) |
177 RDEBUG("EPin1", EPin1); |
183 RDebug::Print(_L("(SECUI)CManualSecuritySettings::ChangePinL() PIN1")); |
|
184 #endif |
|
185 RMobilePhone::TMobilePhoneLock lockType; |
178 RMobilePhone::TMobilePhoneLock lockType; |
186 RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
179 RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
187 RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
180 RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
188 |
181 |
189 |
182 |
190 lockType = RMobilePhone::ELockICC; |
183 lockType = RMobilePhone::ELockICC; |
191 // check if pin code is enabled... |
184 // check if pin code is enabled... |
192 // The following is required, since the new multimode Etel is asynchronous |
185 // The following is required, since the new multimode Etel is asynchronous |
193 // rather than synchronous. |
186 // rather than synchronous. |
194 |
187 |
195 #if defined(_DEBUG) |
188 RDEBUG("SetRequestType", EMobilePhoneGetLockInfo); |
196 RDebug::Print(_L("(SECUI)CManualSecuritySettings::ChangePinL() GetLockInfo")); |
|
197 #endif |
|
198 |
|
199 iWait->SetRequestType(EMobilePhoneGetLockInfo); |
189 iWait->SetRequestType(EMobilePhoneGetLockInfo); |
200 iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); |
190 iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); |
|
191 RDEBUG("WaitForRequestL", 0); |
201 TInt res = iWait->WaitForRequestL(); |
192 TInt res = iWait->WaitForRequestL(); |
|
193 RDEBUG("WaitForRequestL res", res); |
202 |
194 |
203 if (res != KErrNone) |
195 if (res != KErrNone) |
204 return EFalse; |
196 return EFalse; |
205 // if pin is disabled -> pin code change is not allowed |
197 // if pin is disabled -> pin code change is not allowed |
206 if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) |
198 if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) |
208 ShowResultNoteL(CAknNoteDialog::EErrorTone,R_PIN_NOT_ALLOWED); |
200 ShowResultNoteL(CAknNoteDialog::EErrorTone,R_PIN_NOT_ALLOWED); |
209 return EFalse; |
201 return EFalse; |
210 } |
202 } |
211 } |
203 } |
212 |
204 |
213 #if defined(_DEBUG) |
205 RDEBUG("CompareF", 0); |
214 RDebug::Print(_L("(SECUI)CManualSecuritySettings::ChangePinL() CompareF")); |
|
215 #endif |
|
216 if (aNew.CompareF(aVerifyNew) != 0) |
206 if (aNew.CompareF(aVerifyNew) != 0) |
217 { |
207 { |
218 // codes do not match note |
208 // codes do not match note |
219 ShowResultNoteL(CAknNoteDialog::EErrorTone,R_CODES_DONT_MATCH); |
209 ShowResultNoteL(CAknNoteDialog::EErrorTone,R_CODES_DONT_MATCH); |
220 return EFalse; |
210 return EFalse; |
233 |
223 |
234 RMobilePhone::TMobilePhonePasswordChangeV1 aChange; |
224 RMobilePhone::TMobilePhonePasswordChangeV1 aChange; |
235 aChange.iOldPassword = aOld; |
225 aChange.iOldPassword = aOld; |
236 aChange.iNewPassword = aNew; |
226 aChange.iNewPassword = aNew; |
237 |
227 |
238 #if defined(_DEBUG) |
228 RDEBUG("EMobilePhoneChangeSecurityCode", EMobilePhoneChangeSecurityCode); |
239 RDebug::Print(_L("(SECUI)CManualSecuritySettings::ChangePinL() ChangeSecurityCode")); |
|
240 #endif |
|
241 iWait->SetRequestType(EMobilePhoneChangeSecurityCode); |
229 iWait->SetRequestType(EMobilePhoneChangeSecurityCode); |
242 iPhone.ChangeSecurityCode(iWait->iStatus,secCodeType,aChange); |
230 iPhone.ChangeSecurityCode(iWait->iStatus,secCodeType,aChange); |
|
231 RDEBUG("WaitForRequestL", 0); |
243 TInt res = iWait->WaitForRequestL(); |
232 TInt res = iWait->WaitForRequestL(); |
244 |
233 RDEBUG("WaitForRequestL res", res); |
245 #if defined(_DEBUG) |
234 |
246 RDebug::Print(_L("(SECUI)CManualSecuritySettings::ChangePinL() ChangeSecurityCode RES: %d"), res); |
|
247 #endif |
|
248 |
|
249 switch(res) |
235 switch(res) |
250 { |
236 { |
251 case KErrNone: |
237 case KErrNone: |
252 if (aPin == EPin1) |
238 if (aPin == EPin1) |
253 { |
239 { |
265 ShowResultNoteL(CAknNoteDialog::EErrorTone,R_PIN_BLOCKED_NOTE); |
251 ShowResultNoteL(CAknNoteDialog::EErrorTone,R_PIN_BLOCKED_NOTE); |
266 } |
252 } |
267 else |
253 else |
268 { |
254 { |
269 iCustomPhone.CheckSecurityCode(iWait->iStatus,RMmCustomAPI::ESecurityCodePuk2); |
255 iCustomPhone.CheckSecurityCode(iWait->iStatus,RMmCustomAPI::ESecurityCodePuk2); |
|
256 RDEBUG("WaitForRequestL", 0); |
270 TInt res = iWait->WaitForRequestL(); |
257 TInt res = iWait->WaitForRequestL(); |
|
258 RDEBUG("WaitForRequestL res", res); |
271 } |
259 } |
272 break; |
260 break; |
273 case KErrGsm0707OperationNotAllowed: |
261 case KErrGsm0707OperationNotAllowed: |
274 ShowResultNoteL(CAknNoteDialog::EErrorTone,R_OPERATION_NOT_ALLOWED); |
262 ShowResultNoteL(CAknNoteDialog::EErrorTone,R_OPERATION_NOT_ALLOWED); |
275 break; |
263 break; |
286 // Deletes pin operation note if necessary |
274 // Deletes pin operation note if necessary |
287 // ---------------------------------------------------------- |
275 // ---------------------------------------------------------- |
288 // |
276 // |
289 EXPORT_C void CManualSecuritySettings::CancelChangePin() |
277 EXPORT_C void CManualSecuritySettings::CancelChangePin() |
290 { |
278 { |
291 #if defined(_DEBUG) |
279 RDEBUG("0", 0); |
292 RDebug::Print(_L("(SECUI)CManualSecuritySettings::CancelChangePin()")); |
|
293 #endif |
|
294 delete iNote; |
280 delete iNote; |
295 iNote = NULL; |
281 iNote = NULL; |
296 } |
282 } |
297 // |
283 // |
298 // ---------------------------------------------------------- |
284 // ---------------------------------------------------------- |
304 { |
290 { |
305 /***************************************************** |
291 /***************************************************** |
306 * Series 60 Customer / ETel |
292 * Series 60 Customer / ETel |
307 * Series 60 ETel API |
293 * Series 60 ETel API |
308 *****************************************************/ |
294 *****************************************************/ |
309 #if defined(_DEBUG) |
295 RDEBUG("0", 0); |
310 RDebug::Print(_L("(SECUI)CManualSecuritySettings::UnblockPinL()")); |
|
311 #endif |
|
312 if (aNew.CompareF(aVerifyNew) != 0) |
296 if (aNew.CompareF(aVerifyNew) != 0) |
313 { |
297 { |
314 // codes do not match note |
298 // codes do not match note |
315 ShowResultNoteL(CAknNoteDialog::EErrorTone,R_CODES_DONT_MATCH); |
299 ShowResultNoteL(CAknNoteDialog::EErrorTone,R_CODES_DONT_MATCH); |
316 return EFalse; |
300 return EFalse; |
324 } |
308 } |
325 else |
309 else |
326 { |
310 { |
327 blockCodeType = RMobilePhone::ESecurityCodePuk2; |
311 blockCodeType = RMobilePhone::ESecurityCodePuk2; |
328 } |
312 } |
329 |
313 RDEBUG("blockCodeType", blockCodeType); |
330 iWait->SetRequestType(EMobilePhoneVerifySecurityCode); |
314 iWait->SetRequestType(EMobilePhoneVerifySecurityCode); |
331 iPhone.VerifySecurityCode(iWait->iStatus, blockCodeType, aNew, aPuk); |
315 iPhone.VerifySecurityCode(iWait->iStatus, blockCodeType, aNew, aPuk); |
|
316 RDEBUG("WaitForRequestL", 0); |
332 TInt res = iWait->WaitForRequestL(); |
317 TInt res = iWait->WaitForRequestL(); |
|
318 RDEBUG("WaitForRequestL res", res); |
333 |
319 |
334 switch(res) |
320 switch(res) |
335 { |
321 { |
336 case KErrNone: |
322 case KErrNone: |
337 if (aPin == EPin1) |
323 if (aPin == EPin1) |
366 // Deletes unblock pin operation note if necessary |
352 // Deletes unblock pin operation note if necessary |
367 // ---------------------------------------------------------- |
353 // ---------------------------------------------------------- |
368 // |
354 // |
369 EXPORT_C void CManualSecuritySettings::CancelUnblockPin() |
355 EXPORT_C void CManualSecuritySettings::CancelUnblockPin() |
370 { |
356 { |
371 #if defined(_DEBUG) |
357 RDEBUG("0", 0); |
372 RDebug::Print(_L("(SECUI)CManualSecuritySettings::CancelUnblockPinL()")); |
|
373 #endif |
|
374 delete iNote; |
358 delete iNote; |
375 iNote = NULL; |
359 iNote = NULL; |
376 } |
360 } |
377 // |
361 // |
378 // ---------------------------------------------------------- |
362 // ---------------------------------------------------------- |
384 { |
368 { |
385 /***************************************************** |
369 /***************************************************** |
386 * Series 60 Customer / ETel |
370 * Series 60 Customer / ETel |
387 * Series 60 ETel API |
371 * Series 60 ETel API |
388 *****************************************************/ |
372 *****************************************************/ |
389 #if defined(_DEBUG) |
373 RDEBUG("0", 0); |
390 RDebug::Print(_L("(SECUI)CManualSecuritySettings::LockSimL()")); |
|
391 #endif |
|
392 |
|
393 |
|
394 RMmCustomAPI::TLockNumber aLockType; |
374 RMmCustomAPI::TLockNumber aLockType; |
395 TInt ret = KErrGsm0707IncorrectPassword; |
375 TInt ret = KErrGsm0707IncorrectPassword; |
396 TInt length = aLockCode.Length(); |
376 TInt length = aLockCode.Length(); |
397 |
377 |
398 #if defined(_DEBUG) |
378 RDEBUG("length", length); |
399 RDebug::Print(_L("(SECUI)CManualSecuritySettings::LockSimL(): Param length: %d"), length); |
379 // from now on, it accepts all lenghts, because some locks are 20, others are 13 |
400 #endif |
380 // if(aLockCode.Length() <= KSimLockMaxPasswordSize) |
401 |
|
402 if(aLockCode.Length() <= KSimLockMaxPasswordSize) |
|
403 { |
381 { |
404 if (aType.CompareF(Operator) == 0) |
382 if (aType.CompareF(Operator) == 0) |
405 { |
383 { |
406 aLockType = RMmCustomAPI::EOperator; |
384 aLockType = RMmCustomAPI::EOperator; |
407 ret = iCustomPhone.ActivateSimLock( aLockCode,aLockType ); |
385 ret = iCustomPhone.ActivateSimLock( aLockCode,aLockType ); |
436 aLockType = RMmCustomAPI::EOperator_Gid2; |
414 aLockType = RMmCustomAPI::EOperator_Gid2; |
437 ret = iCustomPhone.ActivateSimLock( aLockCode,aLockType ); |
415 ret = iCustomPhone.ActivateSimLock( aLockCode,aLockType ); |
438 } |
416 } |
439 } |
417 } |
440 |
418 |
441 #if defined(_DEBUG) |
419 RDEBUG("ret", ret); |
442 RDebug::Print(_L("(SECUI)CManualSecuritySettings::LockSimL() RESULT: %d"), ret); |
|
443 #endif |
|
444 switch (ret) |
420 switch (ret) |
445 { |
421 { |
446 case KErrNone: |
422 case KErrNone: |
447 ShowResultNoteL(CAknNoteDialog::EConfirmationTone,R_SIM_ON); |
423 ShowResultNoteL(CAknNoteDialog::EConfirmationTone,R_SIM_ON); |
448 return ETrue; |
424 return ETrue; |
491 { |
465 { |
492 /***************************************************** |
466 /***************************************************** |
493 * Series 60 Customer / ETel |
467 * Series 60 Customer / ETel |
494 * Series 60 ETel API |
468 * Series 60 ETel API |
495 *****************************************************/ |
469 *****************************************************/ |
496 #if defined(_DEBUG) |
470 RDEBUG("0", 0); |
497 RDebug::Print(_L("(SECUI)CManualSecuritySettings::UnLockSimL()")); |
|
498 #endif |
|
499 RMmCustomAPI::TLockNumber aLockType; |
471 RMmCustomAPI::TLockNumber aLockType; |
500 TInt ret = KErrGsm0707IncorrectPassword; |
472 TInt ret = KErrGsm0707IncorrectPassword; |
501 TInt length = aUnlockCode.Length(); |
473 TInt length = aUnlockCode.Length(); |
502 |
474 |
503 #if defined(_DEBUG) |
475 RDEBUG("length", length); |
504 RDebug::Print(_L("(SECUI)CManualSecuritySettings::UnLockSimL(): Param length: %d"), length); |
476 // from now on, it accepts all lenghts, because some locks are 20, others are 13 |
505 #endif |
477 // if(aUnlockCode.Length() <= KSimLockMaxPasswordSize) |
506 if(aUnlockCode.Length() <= KSimLockMaxPasswordSize) |
|
507 { |
478 { |
508 if (aType.CompareF(Operator) == 0) |
479 if (aType.CompareF(Operator) == 0) |
509 { |
480 { |
510 aLockType = RMmCustomAPI::EOperator; |
481 aLockType = RMmCustomAPI::EOperator; |
511 ret = iCustomPhone.DeActivateSimLock( aUnlockCode,aLockType ); |
482 ret = iCustomPhone.DeActivateSimLock( aUnlockCode,aLockType ); |
545 aLockType = RMmCustomAPI::EGlobalUnlock; |
516 aLockType = RMmCustomAPI::EGlobalUnlock; |
546 ret = iCustomPhone.DeActivateSimLock( aUnlockCode,aLockType ); |
517 ret = iCustomPhone.DeActivateSimLock( aUnlockCode,aLockType ); |
547 } |
518 } |
548 |
519 |
549 } |
520 } |
550 #if defined(_DEBUG) |
521 RDEBUG("ret", ret); |
551 RDebug::Print(_L("(SECUI)CManualSecuritySettings::UnLockSimL() RESULT: %d"), ret); |
|
552 #endif |
|
553 switch (ret) |
522 switch (ret) |
554 { |
523 { |
555 case KErrNone: |
524 case KErrNone: |
556 ShowResultNoteL(CAknNoteDialog::EConfirmationTone,R_SIM_OFF); |
525 ShowResultNoteL(CAknNoteDialog::EConfirmationTone,R_SIM_OFF); |
557 return ETrue; |
526 return ETrue; |
595 // Shows settingchange results |
562 // Shows settingchange results |
596 // ---------------------------------------------------------- |
563 // ---------------------------------------------------------- |
597 // |
564 // |
598 void CManualSecuritySettings::ShowResultNoteL(CAknNoteDialog::TTone aTone, TInt aResourceID) |
565 void CManualSecuritySettings::ShowResultNoteL(CAknNoteDialog::TTone aTone, TInt aResourceID) |
599 { |
566 { |
600 #if defined(_DEBUG) |
567 RDEBUG("aResourceID", aResourceID); |
601 RDebug::Print(_L("(SECUI)CManualSecuritySettings::CancelUnLockSimL()")); |
568 CSecuritySettings::ShowResultNoteL(aResourceID, aTone); |
602 #endif |
|
603 iNote = new (ELeave) CAknNoteDialog(REINTERPRET_CAST(CEikDialog**,&iNote)); |
|
604 iNote->SetTimeout(CAknNoteDialog::ELongTimeout); |
|
605 iNote->SetTone(aTone); |
|
606 iNote->ExecuteLD(aResourceID); |
|
607 } |
569 } |
608 |
570 |
609 // End of file |
571 // End of file |