on xenial help sign in
bring back the flat, simple Lock screen type selection
5f8fcb7Lukáš Tinkl
qml/Wizard/Pages/70-passwd-type.qml+11−79
@@ -25,7 +25,7 @@ import ".." as LocalComponents
25 * answer. We don't run as root, so if we did set the password immediately,
25 * answer. We don't run as root, so if we did set the password immediately,
26 * we'd need to prompt for their previous password when they came back and
26 * we'd need to prompt for their previous password when they came back and
27 * changed their answer. Which is silly UX. So instead, we just keep track
27 * changed their answer. Which is silly UX. So instead, we just keep track
28− * of their choice and set the password at the end (see main.qml).
28+ * of their choice and set the password at the end (see Pages.qml).
29 * Setting the password shouldn't fail, since Ubuntu Touch has loose password
29 * Setting the password shouldn't fail, since Ubuntu Touch has loose password
30 * requirements, but we'll check what we can here. Ideally we'd be able to ask
30 * requirements, but we'll check what we can here. Ideally we'd be able to ask
31 * the system if a password is legal without actually setting that password.
31 * the system if a password is legal without actually setting that password.
@@ -35,7 +35,7 @@ LocalComponents.Page {
35 id: passwdPage
35 id: passwdPage
36 objectName: "passwdPage"
36 objectName: "passwdPage"
37
37
38− title: i18n.tr("Lock Security")
38+ title: i18n.tr("Lock Screen")
39 forwardButtonSourceComponent: forwardButton
39 forwardButtonSourceComponent: forwardButton
40
40
41 function indexToMethod(index) {
41 function indexToMethod(index) {
@@ -43,6 +43,8 @@ LocalComponents.Page {
43 return UbuntuSecurityPrivacyPanel.Passcode
43 return UbuntuSecurityPrivacyPanel.Passcode
44 else if (index === 0)
44 else if (index === 0)
45 return UbuntuSecurityPrivacyPanel.Passphrase
45 return UbuntuSecurityPrivacyPanel.Passphrase
46+ else
47+ return UbuntuSecurityPrivacyPanel.Swipe
46 }
48 }
47
49
48 function methodToIndex(method) {
50 function methodToIndex(method) {
@@ -50,6 +52,8 @@ LocalComponents.Page {
50 return 1
52 return 1
51 else if (method === UbuntuSecurityPrivacyPanel.Passphrase)
53 else if (method === UbuntuSecurityPrivacyPanel.Passphrase)
52 return 0
54 return 0
55+ else
56+ return 2
53 }
57 }
54
58
55 Component.onCompleted: {
59 Component.onCompleted: {
@@ -66,7 +70,7 @@ LocalComponents.Page {
66 anchors.left: parent.left
70 anchors.left: parent.left
67 anchors.right: parent.right
71 anchors.right: parent.right
68 wrapMode: Text.Wrap
72 wrapMode: Text.Wrap
69− text: i18n.tr("Choose how to secure your device to protect your personal information.")
73+ text: i18n.tr("Choose lock screen security")
70 color: "#525252"
74 color: "#525252"
71 fontSize: "small"
75 fontSize: "small"
72 font.weight: Font.Light
76 font.weight: Font.Light
@@ -84,7 +88,7 @@ LocalComponents.Page {
84 height: childrenRect.height
88 height: childrenRect.height
85
89
86 // this is the order we want to display it; cf indexToMethod()
90 // this is the order we want to display it; cf indexToMethod()
87− model: [UbuntuSecurityPrivacyPanel.Passphrase, UbuntuSecurityPrivacyPanel.Passcode]
91+ model: [UbuntuSecurityPrivacyPanel.Passphrase, UbuntuSecurityPrivacyPanel.Passcode, UbuntuSecurityPrivacyPanel.Swipe]
88
92
89 delegate: ListItem {
93 delegate: ListItem {
90 id: itemDelegate
94 id: itemDelegate
@@ -131,74 +135,6 @@ LocalComponents.Page {
131 }
135 }
132 }
136 }
133 }
137 }
134−
135− Switch {
136− id: requiredSwitch
137− anchors.left: parent.left
138− anchors.top: selector.bottom
139− anchors.topMargin: units.gu(1)
140− checked: true
141− }
142−
143− Label {
144− id: requiredLabel
145− anchors.left: requiredSwitch.right
146− anchors.right: parent.right
147− anchors.top: selector.bottom
148− anchors.topMargin: units.gu(1)
149− anchors.leftMargin: units.gu(1)
150− wrapMode: Text.Wrap
151− text: i18n.tr("Require my password or passcode to access my device")
152− color: "#525252"
153− opacity: requiredSwitch.checked ? 1 : 0.5
154− fontSize: "small"
155− font.weight: Font.Light
156− MouseArea {
157− anchors.fill: parent
158− onClicked: requiredSwitch.trigger()
159− }
160− }
161−
162− Label {
163− id: requiredInfo
164− anchors.left: requiredSwitch.right
165− anchors.right: parent.right
166− anchors.top: requiredLabel.bottom
167− anchors.topMargin: units.gu(1)
168− anchors.leftMargin: units.gu(1)
169− wrapMode: Text.Wrap
170− text: i18n.tr("You will still be required to enter password or passcode to gain admin privileges")
171− color: "#888888"
172− opacity: requiredSwitch.checked ? 1 : 0.5
173− fontSize: "x-small"
174− font.weight: Font.Light
175− }
176−
177− CheckBox {
178− id: encryptCheck
179− anchors.left: requiredLabel.left
180− anchors.top: requiredInfo.bottom
181− anchors.topMargin: units.gu(1)
182− visible: requiredSwitch.checked
183− }
184−
185− Label {
186− id: encryptLabel
187− anchors.left: encryptCheck.right
188− anchors.right: parent.right
189− anchors.verticalCenter: encryptCheck.verticalCenter
190− anchors.leftMargin: units.gu(.5)
191− wrapMode: Text.Wrap
192− text: i18n.tr("Encrypt my content")
193− color: "#525252"
194− font.weight: Font.Light
195− fontSize: "small"
196− visible: requiredSwitch.checked
197− MouseArea {
198− anchors.fill: parent
199− onClicked: encryptCheck.trigger()
200− }
201− }
202 }
138 }
203
139
204 Component {
140 Component {
@@ -207,19 +143,15 @@ LocalComponents.Page {
207 text: i18n.tr("Next")
143 text: i18n.tr("Next")
208 onClicked: {
144 onClicked: {
209 var method = indexToMethod(selector.currentIndex)
145 var method = indexToMethod(selector.currentIndex)
210−
211− if (!requiredSwitch.checked) {
212− root.passwordMethod = UbuntuSecurityPrivacyPanel.Swipe
213− } else {
214− root.passwordMethod = method
146+ root.passwordMethod = method
215− }
216−
217 print("Current method: " + root.passwordMethod)
147 print("Current method: " + root.passwordMethod)
218
148
219 if (method === UbuntuSecurityPrivacyPanel.Passphrase) {
149 if (method === UbuntuSecurityPrivacyPanel.Passphrase) {
220 pageStack.load(Qt.resolvedUrl("password-set.qml"))
150 pageStack.load(Qt.resolvedUrl("password-set.qml"))
221 } else if (method === UbuntuSecurityPrivacyPanel.Passcode) {
151 } else if (method === UbuntuSecurityPrivacyPanel.Passcode) {
222 pageStack.load(Qt.resolvedUrl("passcode-set.qml"))
152 pageStack.load(Qt.resolvedUrl("passcode-set.qml"))
153+ } else {
154+ pageStack.next()
223 }
155 }
224 }
156 }
225 }
157 }