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