Advertisement
Guest User

script

a guest
Dec 21st, 2014
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.71 KB | None | 0 0
  1. commit 0e4ea872723bb539425ae52ae16b2ef6095f7796
  2. Author: CODeRUS <coderusinbox@gmail.com>
  3. Date: Mon Dec 22 04:36:01 2014 +0500
  4.  
  5. Workaround for enabling alphanumeric devicelock in u10
  6.  
  7. diff --git a/usr/share/jolla-settings/pages/devicelock/devicelock.qml b/usr/share/jolla-settings/pages/devicelock/devicelock.qml
  8. index 4353a23..492c6c1 100644
  9. --- a/usr/share/jolla-settings/pages/devicelock/devicelock.qml
  10. +++ b/usr/share/jolla-settings/pages/devicelock/devicelock.qml
  11. @@ -16,9 +16,24 @@ Page {
  12. onMaximumAttemptsChanged: {
  13. attemptsSlider.value = lockSettings.maximumAttempts != -1 ? lockSettings.maximumAttempts : attemptsSlider.maximumValue
  14. }
  15. + property bool digitsOnly: lockSettings.codeCurrentIsDigitOnly
  16. + function setDigitsOnly(code, value) {
  17. + setCurrentIsDigitOnly(code, value)
  18. + digitsOnly = value
  19. + }
  20. + property bool keyboardInput: lockSettings.codeInputIsKeyboard
  21. + function setKeyboardInput(code, value) {
  22. + setInputIsKeyboard(code, value)
  23. + keyboardInput = value
  24. + }
  25. }
  26. onStatusChanged: {
  27. - if (status === PageStatus.Deactivating) devicelock.cachedPin = ""
  28. + if (status === PageStatus.Deactivating) {
  29. + if (devicelock.cachedPin) {
  30. + lockSettings.setCurrentIsDigitOnly(devicelock.cachedPin, lockSettings.digitsOnly)
  31. + devicelock.cachedPin = ""
  32. + }
  33. + }
  34. }
  35.  
  36. SilicaFlickable {
  37. @@ -188,22 +203,24 @@ Page {
  38. text: qsTrId("settings_devicelock-la-digit_only_keypad")
  39. // [TMP HOTFIX] do not permit alphanum code to new users until proper fix is in place. Contributes to jb#24201
  40. // Those who already have enabled alphanumeric code right after update10, and want to revert back to numpad, a cmdline tool can be provided
  41. - visible: false // devicelock.isSet
  42. + visible: devicelock.isSet
  43. automaticCheck: false
  44. - checked: !lockSettings.codeInputIsKeyboard
  45. + checked: !lockSettings.keyboardInput
  46. //: This description how to get digit only keypad back is showed when user has defined non-digit lockcode and he has qwerty enabled
  47. //% "You can only enable when your lock code is digit only"
  48. - description: !lockSettings.codeCurrentIsDigitOnly ? qsTrId("settings_devicelock-la-busy-description") : ""
  49. + description: !lockSettings.digitsOnly ? qsTrId("settings_devicelock-la-busy-description") : ""
  50. onClicked: {
  51. - if (devicelock.isSet && (lockSettings.codeCurrentIsDigitOnly || checked)) {
  52. + if (devicelock.isSet && (lockSettings.digitsOnly || checked)) {
  53. if (devicelock.cachedPin) {
  54. - lockSettings.setInputIsKeyboard(devicelock.cachedPin, checked)
  55. + lockSettings.setKeyboardInput(devicelock.cachedPin, checked)
  56. } else {
  57. var d = pageStack.push(pinInputComponent, {requestSignalOnly: true})
  58. d.lockCodeConfirmed.connect(function(enteredPin) {
  59. // break binding on purpose to avoid vkb open animation on settings switch
  60. d.showDigitPad = d.showDigitPad
  61. - lockSettings.setInputIsKeyboard(enteredPin, checked)
  62. + if (lockSettings.digitsOnly || checked) {
  63. + lockSettings.setKeyboardInput(enteredPin, checked)
  64. + }
  65. })
  66. }
  67. }
  68. @@ -236,10 +253,12 @@ Page {
  69. onClicked: {
  70. if (devicelock.isSet) {
  71. if (devicelock.cachedPin) {
  72. + lockSettings.setKeyboardInput(devicelock.cachedPin, false)
  73. devicelock.clearCode(devicelock.cachedPin)
  74. } else {
  75. var d = pageStack.push(pinInputComponent, {requestSignalOnly: true})
  76. d.lockCodeConfirmed.connect(function(enteredPin) {
  77. + lockSettings.setKeyboardInput(enteredPin, false)
  78. devicelock.clearCode(enteredPin)
  79. devicelock.cachedPin = ""
  80. })
  81. @@ -298,7 +317,11 @@ Page {
  82. devicelock.setCode(_confirmedPin, enteredPin)
  83. devicelock.cachedPin = enteredPin
  84. if (setup) lockSettings.setAutomaticLocking(enteredPin, "10")
  85. - lockSettings.setCurrentIsDigitOnly(enteredPin, /^\d+$/.test(enteredPin))
  86. + var digitsOnly = /^\d+$/.test(enteredPin)
  87. + if (!digitsOnly && !lockSettings.keyboardInput) {
  88. + lockSettings.setKeyboardInput(enteredPin, true)
  89. + }
  90. + lockSettings.setDigitsOnly(enteredPin, digitsOnly)
  91. pageStack.pop()
  92. } else if (devicelock.checkCode(enteredPin)) {
  93. // OK, open change code UI query
  94. @@ -307,6 +330,7 @@ Page {
  95. _badPinWarning = ""
  96.  
  97. if (requestSignalOnly) {
  98. + lockSettings.setDigitsOnly(enteredPin, /^\d+$/.test(enteredPin))
  99. lockCodeConfirmed(enteredPin)
  100. pageStack.pop()
  101. } else {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement