212 { |
225 { |
213 RDEBUG("check default.3", 0); |
226 RDEBUG("check default.3", 0); |
214 handleCodeTopChanged(codeTop->text()); |
227 handleCodeTopChanged(codeTop->text()); |
215 } |
228 } |
216 RDEBUG("setFocus", 0); |
229 RDEBUG("setFocus", 0); |
217 codeTop->setFocus(); // this should open the VKB . Doesn't seem to work when it's done on the widget, so it's done here. |
230 // remove setFocus from PIN query because Orbit can't handle it |
218 |
231 // codeTop->setFocus(); // this should open the VKB . Doesn't seem to work when it's done on the widget, so it's done here. |
219 } // codeTop!=NULL |
232 } // codeTop!=NULL |
220 |
233 |
221 const TUint32 KSecurityUIsTestCode = 0x00000307; |
234 const TUint32 KSecurityUIsTestCode = 0x00000307; |
222 TInt value = 0; |
235 TInt value = 0; |
223 TInt err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsTestCode, value ); |
236 TInt err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsTestCode, value ); |
224 RDEBUG("KSecurityUIsTestCode err", err); |
237 RDEBUG("KSecurityUIsTestCode err", err); |
225 RDEBUG("faking value", value); |
238 RDEBUG("faking value", value); |
226 RDEBUG("mShowEventReceived", mShowEventReceived); |
239 RDEBUG("mShowEventReceived", mShowEventReceived); |
227 if(value>0 && mShowEventReceived==true) // show happens 2 times. Dialog can be closed only the second. |
240 if(value>0 && value<1000000 && mShowEventReceived==true) // show happens 2 times. Dialog can be closed only the second. |
228 { |
241 { |
229 QString myString = ""; |
242 QString myString = ""; |
230 myString += QString("%1").arg(value); |
243 myString += QString("%1").arg(value); |
231 qDebug() << "SecUiNotificationDialog::faking myString=" << myString; |
244 RDEBUGQT("myString", myString); |
232 codeTop->setText( myString ); |
245 codeTop->setText( myString ); |
233 TInt err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsTestCode, 0 ); // clear after using it |
246 TInt err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsTestCode, 0 ); // clear after using it |
234 qDebug() << "SecUiNotificationDialog::calling handleAccepted=" << myString; |
247 RDEBUGQT("calling handleAccepted myString", myString); |
235 emit handleAccepted(); |
248 emit handleAccepted(); |
236 // handleAccepted already emit closeDeviceDialog(false); // false means "not by client", although it's not really used |
249 // handleAccepted already emit closeDeviceDialog(false); // false means "not by client", although it's not really used |
237 } |
250 } |
238 } |
251 } |
239 mShowEventReceived = true; |
252 mShowEventReceived = true; |
276 QString titleAttempts = ""; |
289 QString titleAttempts = ""; |
277 if(titleText.indexOf('|')>0) |
290 if(titleText.indexOf('|')>0) |
278 { // if separator, take only first part |
291 { // if separator, take only first part |
279 titleText = titleText.left(titleText.indexOf('|')); |
292 titleText = titleText.left(titleText.indexOf('|')); |
280 } |
293 } |
281 if(titleText.indexOf('#')>0) |
294 if(titleText.indexOf('$')>0) |
282 { // if separator, take only first part |
295 { // if separator, take only first part |
283 titleAttempts = titleText.right(titleText.length()-titleText.indexOf('#')-1); |
296 titleAttempts = titleText.right(titleText.length()-titleText.indexOf('$')-1); |
284 qDebug() << "SecUiNotificationDialog::titleAttempts=" << titleAttempts; |
297 RDEBUGQT("titleAttempts", titleAttempts); |
285 int nAttempts = titleAttempts.toInt(); |
298 int nAttempts = titleAttempts.toInt(); |
286 RDEBUG("nAttempts", nAttempts); |
299 RDEBUG("nAttempts", nAttempts); |
287 titleText = titleText.left(titleText.indexOf('#')); |
300 titleText = titleText.left(titleText.indexOf('$')); |
288 if(nAttempts>0) |
301 if(nAttempts>0) |
289 titleText = titleText + " attempts=" + QString::number(nAttempts); |
302 titleText = titleText + " attempts=" + QString::number(nAttempts); |
290 } |
303 } |
291 titleText = "Security Query"; // this is the header, for any potential later error which needs to be displayed |
304 titleText = hbTrId("Security Query"); // this is the header, for any potential later error which needs to be displayed |
292 // This is created only if needed (i.e. errors for NewLockCode) |
305 // This is created only if needed (i.e. errors for NewLockCode) |
293 // titleWidget = new HbLabel(titleText); |
306 // titleWidget = new HbLabel(titleText); |
294 // setHeadingWidget(titleWidget); |
307 // setHeadingWidget(titleWidget); |
295 } |
308 } |
296 |
309 |
297 if (parameters.contains(KEmergency)) { |
310 if (parameters.contains(KEmergency)) { |
298 RDEBUG("KEmergency", 1); |
311 RDEBUG("KEmergency", 1); |
299 QString emergencyText = parameters.value(KEmergency).toString(); |
312 QString emergencyText = parameters.value(KEmergency).toString(); |
300 qDebug() << emergencyText; |
313 RDEBUGQT("emergencyText", emergencyText); |
301 if(!emergencyText.compare("emergencyYes")) |
314 if(!emergencyText.compare("emergencyYes")) |
302 { |
315 { |
303 RDEBUG("emergencyYes", 1); |
316 RDEBUG("emergencyYes", 1); |
304 isEmergency = 1; |
317 isEmergency = 1; |
305 okAction->setEnabled(true); |
318 okAction->setEnabled(true); |
306 okAction->setText("Call"); |
319 okAction->setText(hbTrId("Call")); |
307 return true; |
320 return true; |
308 } |
321 } |
309 if(!emergencyText.compare("emergencyNo")) |
322 if(!emergencyText.compare("emergencyNo")) |
310 { |
323 { |
311 RDEBUG("emergencyNo", 1); |
324 RDEBUG("emergencyNo", 1); |
312 isEmergency = 0; |
325 isEmergency = 0; |
313 okAction->setEnabled(false); // 112 -> 1122 (=password) . This is handled by < lMinLength |
326 okAction->setEnabled(false); // 112 -> 1122 (=password) . This is handled by < lMinLength |
314 okAction->setText("Ok"); |
327 okAction->setText(hbTrId("Ok")); |
315 return true; |
328 return true; |
316 } |
329 } |
317 } |
330 } |
318 // after TARM validation. |
331 // after TARM validation. |
319 if (parameters.contains(KInvalidNewLockCode)) { |
332 if (parameters.contains(KInvalidNewLockCode)) { |
320 RDEBUG("KInvalidNewLockCode", 0); |
333 RDEBUG("KInvalidNewLockCode", 0); |
321 QString invalidText = parameters.value(KInvalidNewLockCode).toString(); |
334 QString invalidText = parameters.value(KInvalidNewLockCode).toString(); |
322 qDebug() << invalidText; |
335 RDEBUGQT("invalidText", invalidText); |
323 QString newTitleText = "Lock Code"; // TODO take from the original one |
336 QString newTitleText = "Lock Code"; // TODO take from the original one |
324 |
337 |
325 QString invalidStr = invalidText.right(invalidText.length()-invalidText.indexOf('#')-1); |
338 QString invalidStr = invalidText.right(invalidText.length()-invalidText.indexOf('$')-1); |
326 int invalidNumber = invalidStr.toInt(); |
339 int invalidNumber = invalidStr.toInt(); |
327 RDEBUG("invalidNumber", invalidNumber); |
340 RDEBUG("invalidNumber", invalidNumber); |
328 if(invalidNumber<0) |
341 if(invalidNumber<0) // that is, -1 |
329 { |
342 { |
330 RDEBUG("invalidNumber<0", invalidNumber ); |
343 RDEBUG("invalidNumber<0", invalidNumber ); |
331 // nothing to do |
344 // nothing to do |
332 } |
345 } |
333 if(invalidNumber==EDeviceLockAutolockperiod) |
346 if(invalidNumber==EDeviceLockAutolockperiod) |
334 { |
347 { |
335 RDEBUG("EDeviceLockAutolockperiod", invalidNumber ); |
348 RDEBUG("EDeviceLockAutolockperiod", invalidNumber ); |
336 newTitleText+="EDeviceLockAutolockperiod"; |
349 newTitleText+=hbTrId("EDeviceLockAutolockperiod"); |
337 } |
350 } |
338 if(invalidNumber==EDeviceLockMaxAutolockPeriod) |
351 if(invalidNumber==EDeviceLockMaxAutolockPeriod) |
339 { |
352 { |
340 RDEBUG("EDeviceLockAutolockperiod", invalidNumber ); |
353 RDEBUG("EDeviceLockAutolockperiod", invalidNumber ); |
341 newTitleText+="EDeviceLockMaxAutolockPeriod"; |
354 newTitleText+=hbTrId("EDeviceLockMaxAutolockPeriod"); |
342 } |
355 } |
343 if(invalidNumber==EDeviceLockMinlength) |
356 if(invalidNumber==EDeviceLockMinlength) |
344 { |
357 { |
345 RDEBUG("EDeviceLockMinlength", invalidNumber ); |
358 RDEBUG("EDeviceLockMinlength", invalidNumber ); |
346 newTitleText+="EDeviceLockMinlength"; |
359 newTitleText+=hbTrId("EDeviceLockMinlength"); |
347 } |
360 } |
348 if(invalidNumber==EDeviceLockMaxlength) |
361 if(invalidNumber==EDeviceLockMaxlength) |
349 { |
362 { |
350 RDEBUG("EDeviceLockMaxlength", invalidNumber ); |
363 RDEBUG("EDeviceLockMaxlength", invalidNumber ); |
351 newTitleText+="EDeviceLockMaxlength"; |
364 newTitleText+=hbTrId("EDeviceLockMaxlength"); |
352 } |
365 } |
353 if(invalidNumber==EDeviceLockRequireUpperAndLower) |
366 if(invalidNumber==EDeviceLockRequireUpperAndLower) |
354 { |
367 { |
355 RDEBUG("EDeviceLockRequireUpperAndLower", invalidNumber ); |
368 RDEBUG("EDeviceLockRequireUpperAndLower", invalidNumber ); |
356 newTitleText+="EDeviceLockRequireUpperAndLower"; |
369 newTitleText+=hbTrId("EDeviceLockRequireUpperAndLower"); |
357 } |
370 } |
358 if(invalidNumber==EDeviceLockRequireCharsAndNumbers) |
371 if(invalidNumber==EDeviceLockRequireCharsAndNumbers) |
359 { |
372 { |
360 RDEBUG("EDeviceLockMaxlength", invalidNumber ); |
373 RDEBUG("EDeviceLockMaxlength", invalidNumber ); |
361 newTitleText+="EDeviceLockMaxlength"; |
374 newTitleText+=hbTrId("EDeviceLockMaxlength"); |
362 } |
375 } |
363 if(invalidNumber==EDeviceLockAllowedMaxRepeatedChars) |
376 if(invalidNumber==EDeviceLockAllowedMaxRepeatedChars) |
364 { |
377 { |
365 RDEBUG("EDeviceLockAllowedMaxRepeatedChars", invalidNumber ); |
378 RDEBUG("EDeviceLockAllowedMaxRepeatedChars", invalidNumber ); |
366 newTitleText+="EDeviceLockAllowedMaxRepeatedChars"; |
379 newTitleText+=hbTrId("EDeviceLockAllowedMaxRepeatedChars"); |
367 } |
380 } |
368 if(invalidNumber==EDeviceLockHistoryBuffer) |
381 if(invalidNumber==EDeviceLockHistoryBuffer) |
369 { |
382 { |
370 RDEBUG("EDeviceLockHistoryBuffer", invalidNumber ); |
383 RDEBUG("EDeviceLockHistoryBuffer", invalidNumber ); |
371 newTitleText+="EDeviceLockHistoryBuffer"; |
384 newTitleText+=hbTrId("EDeviceLockHistoryBuffer"); |
372 } |
385 } |
373 if(invalidNumber==EDeviceLockPasscodeExpiration) |
386 if(invalidNumber==EDeviceLockPasscodeExpiration) |
374 { |
387 { |
375 RDEBUG("EDeviceLockPasscodeExpiration", invalidNumber ); |
388 RDEBUG("EDeviceLockPasscodeExpiration", invalidNumber ); |
376 newTitleText+="EDeviceLockPasscodeExpiration"; |
389 newTitleText+=hbTrId("EDeviceLockPasscodeExpiration"); |
377 } |
390 } |
378 if(invalidNumber==EDeviceLockMinChangeTolerance) |
391 if(invalidNumber==EDeviceLockMinChangeTolerance) |
379 { |
392 { |
380 RDEBUG("EDeviceLockMinChangeTolerance", invalidNumber ); |
393 RDEBUG("EDeviceLockMinChangeTolerance", invalidNumber ); |
381 newTitleText+="EDeviceLockMinChangeTolerance"; |
394 newTitleText+=hbTrId("EDeviceLockMinChangeTolerance"); |
382 } |
395 } |
383 if(invalidNumber==EDeviceLockMinChangeInterval) |
396 if(invalidNumber==EDeviceLockMinChangeInterval) |
384 { |
397 { |
385 RDEBUG("EDeviceLockMinChangeInterval", invalidNumber ); |
398 RDEBUG("EDeviceLockMinChangeInterval", invalidNumber ); |
386 newTitleText+="EDeviceLockMinChangeInterval"; |
399 newTitleText+=hbTrId("EDeviceLockMinChangeInterval"); |
387 } |
400 } |
388 if(invalidNumber==EDeviceLockDisallowSpecificStrings) |
401 if(invalidNumber==EDeviceLockDisallowSpecificStrings) |
389 { |
402 { |
390 RDEBUG("EDeviceLockDisallowSpecificStrings", invalidNumber ); |
403 RDEBUG("EDeviceLockDisallowSpecificStrings", invalidNumber ); |
391 newTitleText+="EDeviceLockDisallowSpecificStrings"; |
404 newTitleText+=hbTrId("EDeviceLockDisallowSpecificStrings"); |
392 } |
405 } |
393 if(invalidNumber==EDeviceLockAllowedMaxAtempts) |
406 if(invalidNumber==EDeviceLockAllowedMaxAtempts) |
394 { |
407 { |
395 RDEBUG("EDeviceLockAllowedMaxAtempts", invalidNumber ); |
408 RDEBUG("EDeviceLockAllowedMaxAtempts", invalidNumber ); |
396 newTitleText+="EDeviceLockAllowedMaxAtempts"; |
409 newTitleText+=hbTrId("EDeviceLockAllowedMaxAtempts"); |
397 } |
410 } |
398 if(invalidNumber==EDeviceLockConsecutiveNumbers) |
411 if(invalidNumber==EDeviceLockConsecutiveNumbers) |
399 { |
412 { |
400 RDEBUG("EDeviceLockConsecutiveNumbers", invalidNumber ); |
413 RDEBUG("EDeviceLockConsecutiveNumbers", invalidNumber ); |
401 newTitleText+="EDeviceLockConsecutiveNumbers"; |
414 newTitleText+=hbTrId("EDeviceLockConsecutiveNumbers"); |
402 } |
415 } |
403 if(invalidNumber==EDeviceLockMinSpecialCharacters) |
416 if(invalidNumber==EDeviceLockMinSpecialCharacters) |
404 { |
417 { |
405 RDEBUG("EDeviceLockMinSpecialCharacters", invalidNumber ); |
418 RDEBUG("EDeviceLockMinSpecialCharacters", invalidNumber ); |
406 newTitleText+="EDeviceLockMinSpecialCharacters"; |
419 newTitleText+=hbTrId("EDeviceLockMinSpecialCharacters"); |
407 } |
420 } |
408 if(invalidNumber==EDeviceLockSingleCharRepeatNotAllowed) |
421 if(invalidNumber==EDeviceLockSingleCharRepeatNotAllowed) |
409 { |
422 { |
410 RDEBUG("EDeviceLockSingleCharRepeatNotAllowed", invalidNumber ); |
423 RDEBUG("EDeviceLockSingleCharRepeatNotAllowed", invalidNumber ); |
411 newTitleText+="EDeviceLockSingleCharRepeatNotAllowed"; |
424 newTitleText+=hbTrId("EDeviceLockSingleCharRepeatNotAllowed"); |
412 } |
425 } |
413 if(invalidNumber==EDevicelockConsecutiveCharsNotAllowed) |
426 if(invalidNumber==EDevicelockConsecutiveCharsNotAllowed) |
414 { |
427 { |
415 RDEBUG("EDevicelockConsecutiveCharsNotAllowed", invalidNumber ); |
428 RDEBUG("EDevicelockConsecutiveCharsNotAllowed", invalidNumber ); |
416 newTitleText+="EDevicelockConsecutiveCharsNotAllowed"; |
429 newTitleText+=hbTrId("EDevicelockConsecutiveCharsNotAllowed"); |
417 } |
430 } |
418 if(invalidNumber>=EDevicelockTotalPolicies) |
431 if(invalidNumber>=EDevicelockTotalPolicies) |
419 { |
432 { |
420 RDEBUG("EDevicelockTotalPolicies", invalidNumber ); |
433 RDEBUG("EDevicelockTotalPolicies", invalidNumber ); |
421 newTitleText+="EDevicelockTotalPolicies"; |
434 newTitleText+=hbTrId("EDevicelockTotalPolicies"); |
422 } |
435 } |
423 if( !titleWidget ) |
436 if( !titleWidget ) |
424 { |
437 { |
425 RDEBUG("creating titleWidget", 0 ); |
438 RDEBUG("creating titleWidget", 0 ); |
426 titleWidget = new HbLabel("New lock code"); // it will be changed later |
439 titleWidget = new HbLabel(hbTrId("New lock code")); // it will be changed later |
427 setHeadingWidget(titleWidget); |
440 setHeadingWidget(titleWidget); |
428 } |
441 } |
429 RDEBUG("setPlainText", 0 ); |
442 RDEBUG("setPlainText", 0 ); |
430 titleWidget->setPlainText(newTitleText); |
443 titleWidget->setPlainText(newTitleText); |
431 |
444 |
432 if(invalidNumber<0) // everything is ok |
445 if(invalidNumber<0) // everything is ok |
433 { |
446 { |
434 okAction->setEnabled(true); // this might fail in the scenario: check this : invalid -> valid. This allows verif ? |
447 okAction->setEnabled(true); // this might fail in the scenario: check this : invalid -> valid. This allows verif ? |
435 okAction->setText("Ok"); |
448 okAction->setText(hbTrId("Ok")); |
436 codeBottom->setEnabled(true); |
449 codeBottom->setEnabled(true); |
437 } |
450 } |
438 else |
451 else |
439 { |
452 { |
440 okAction->setEnabled(false); |
453 okAction->setEnabled(false); |
441 codeBottom->setEnabled(false); |
454 codeBottom->setEnabled(false); |
442 codeBottom->setText(""); |
455 codeBottom->setText(""); |
443 okAction->setText("Ok"); |
456 okAction->setText(hbTrId("Ok")); |
444 } |
457 } |
445 // need to return because all objects are already created |
458 // need to return because all objects are already created |
446 return true; |
459 return true; |
447 } |
460 } |
448 |
461 |
618 // |
631 // |
619 void SecUiNotificationDialog::handleMemorySelectionChanged(const QString &text) |
632 void SecUiNotificationDialog::handleMemorySelectionChanged(const QString &text) |
620 { |
633 { |
621 RDEBUG("0", 0); |
634 RDEBUG("0", 0); |
622 RDEBUG("mMyId", mMyId); |
635 RDEBUG("mMyId", mMyId); |
623 qDebug() << text; |
636 RDEBUGQT("text", text); |
624 QVariant memorySelection(text); |
637 QVariant memorySelection(text); |
625 mResultMap.insert(KSelectedMemoryIndex, memorySelection); |
638 mResultMap.insert(KSelectedMemoryIndex, memorySelection); |
626 } |
639 } |
627 |
640 |
628 void SecUiNotificationDialog::handleCodeTopContentChanged() |
641 void SecUiNotificationDialog::handleCodeTopContentChanged() |
629 { |
642 { |
630 RDEBUG("0", 0); |
643 RDEBUG("0", 0); |
631 RDEBUG("mMyId", mMyId); |
644 RDEBUG("mMyId", mMyId); |
632 qDebug() << codeTop->text(); |
645 RDEBUGQT("codeTop->text()", codeTop->text()); |
633 handleCodeTopChanged(codeTop->text()); |
646 handleCodeTopChanged(codeTop->text()); |
634 } |
647 } |
635 |
648 |
636 // ---------------------------------------------------------------------------- |
649 // ---------------------------------------------------------------------------- |
637 // SecUiNotificationDialog::handleCodeTopChanged() |
650 // SecUiNotificationDialog::handleCodeTopChanged() |
638 // ---------------------------------------------------------------------------- |
651 // ---------------------------------------------------------------------------- |
639 // |
652 // |
640 void SecUiNotificationDialog::handleCodeTopChanged(const QString &text) |
653 void SecUiNotificationDialog::handleCodeTopChanged(const QString &text) |
641 { |
654 { |
642 RDEBUG("0", 0); |
655 RDEBUG("0", 0); |
643 qDebug() << "SecUiNotificationDialog::handleCodeTopChanged=" << text ; |
656 RDEBUGQT("text", text); |
644 if(queryDual) |
657 if(queryDual) |
645 { |
658 { |
646 codeBottom->setText(""); // any change resets the verification. |
659 codeBottom->setText(""); // any change resets the verification. |
|
660 if( (queryType & ESecUiMaskType) == 0x000004 ) // new codeLock |
|
661 { // ChangeSecCodeParamsL change RMobilePhone::ESecurityCodePhonePassword |
|
662 QVariant codeTopVar(text); |
|
663 mResultMap.insert(KCodeTopIndex, codeTopVar); |
|
664 sendResult(KErrCompletion); // send the current password back to the client for further TARM validation. This is done on any key-press, not in the OK |
|
665 } |
647 } |
666 } |
648 if( queryType == 0x1000004 ) // new codeLock |
667 else if(text.length() < lMinLength ) |
649 { // ChangeSecCodeParamsL change RMobilePhone::ESecurityCodePhonePassword |
|
650 QVariant codeTopVar(text); |
|
651 mResultMap.insert(KCodeTopIndex, codeTopVar); |
|
652 sendResult(KErrCompletion); // send the current password back to the client for further TARM validation. This is done on any key-press, not in the OK |
|
653 } |
|
654 if(text.length() < lMinLength ) |
|
655 { |
668 { |
656 qDebug() << "SecUiNotificationDialog::handleCodeTopChanged too short:" << text ; |
669 RDEBUGQT("too short text", text); |
657 okAction->setEnabled(false); |
670 okAction->setEnabled(false); |
658 RDEBUG("lEmergencySupported", lEmergencySupported); |
671 RDEBUG("lEmergencySupported", lEmergencySupported); |
659 if( lEmergencySupported && text.length() > 2 ) // emergency numbers need at least 3 digits |
672 if( lEmergencySupported && text.length() > 2 ) // emergency numbers need at least 3 digits |
660 { // check whether it's a emergency number |
673 { // check whether it's a emergency number |
661 QVariant codeTopVar(text); |
674 QVariant codeTopVar(text); |