on xenial help sign in
implement the Lock Security front page according to the visuals
976db4bLukáš Tinkl
qml/Wizard/Page.qml+2−1
@@ -40,6 +40,7 @@ Item {
40 property bool desktopOnly: false
40 property bool desktopOnly: false
41
41
42 property bool hasBackButton: true
42 property bool hasBackButton: true
43+ property string backButtonText: i18n.ctr("Button: Go back one page in the Wizard", "Back")
43 property bool customBack: false
44 property bool customBack: false
44 property bool customTitle: false
45 property bool customTitle: false
45 property alias forwardButtonSourceComponent: forwardButton.sourceComponent
46 property alias forwardButtonSourceComponent: forwardButton.sourceComponent
@@ -143,7 +144,7 @@ Item {
143 verticalCenter: parent.verticalCenter
144 verticalCenter: parent.verticalCenter
144 }
145 }
145 z: 1
146 z: 1
146− text: i18n.ctr("Button: Go back one page in the Wizard", "Back")
147+ text: backButtonText
147 visible: pageStack.depth > 1 && hasBackButton
148 visible: pageStack.depth > 1 && hasBackButton
148 backArrow: true
149 backArrow: true
149
150
qml/Wizard/Pages.qml+1−1
@@ -29,7 +29,7 @@ Item {
29
29
30 // These should be set by a security page and we apply the settings when
30 // These should be set by a security page and we apply the settings when
31 // the user exits the wizard.
31 // the user exits the wizard.
32− property int passwordMethod: UbuntuSecurityPrivacyPanel.Passcode
32+ property int passwordMethod: UbuntuSecurityPrivacyPanel.Passphrase
33 property string password: ""
33 property string password: ""
34 property string language: ""
34 property string language: ""
35
35
qml/Wizard/Pages/10-language.qml+2−4
@@ -26,7 +26,7 @@ LocalComponents.Page {
26 title: i18n.tr("Language")
26 title: i18n.tr("Language")
27 forwardButtonSourceComponent: forwardButton
27 forwardButtonSourceComponent: forwardButton
28
28
29− property var detectedLangs: ["en"]
29+ property var detectedLangs: ["en"] // default language
30
30
31 UbuntuLanguagePlugin {
31 UbuntuLanguagePlugin {
32 id: plugin
32 id: plugin
@@ -174,9 +174,7 @@ LocalComponents.Page {
174 enabled: root.language !== ""
174 enabled: root.language !== ""
175 onClicked: {
175 onClicked: {
176 if (root.language !== plugin.languageCodes[plugin.currentLanguage]) {
176 if (root.language !== plugin.languageCodes[plugin.currentLanguage]) {
177− //plugin.currentLanguage = listview.currentIndex; // setting system language by some magic index? wtf
178− //System.updateSessionLanguage(selectedLanguage); // TODO
179− i18n.language = i18n.language; // re-notify of change after above call (for qlocale change)
177+ i18n.language = i18n.language // re-notify of change after above call (for qlocale change)
180 }
178 }
181 pageStack.next()
179 pageStack.next()
182 }
180 }
qml/Wizard/Pages/15-country.qml+9−6
@@ -16,6 +16,7 @@
16
16
17import QtQuick 2.3
17import QtQuick 2.3
18import Ubuntu.Components 1.2
18import Ubuntu.Components 1.2
19+import Ubuntu.SystemSettings.LanguagePlugin 1.0
19import Wizard 0.1
20import Wizard 0.1
20import ".." as LocalComponents
21import ".." as LocalComponents
21
22
@@ -66,6 +67,10 @@ LocalComponents.Page {
66 regionsListView.currentIndex = index
67 regionsListView.currentIndex = index
67 }
68 }
68
69
70+ UbuntuLanguagePlugin {
71+ id: plugin
72+ }
73+
69 ActivityIndicator {
74 ActivityIndicator {
70 id: busyIndicator;
75 id: busyIndicator;
71
76
@@ -152,12 +157,10 @@ LocalComponents.Page {
152 text: i18n.tr("Next")
157 text: i18n.tr("Next")
153 enabled: selectedCountry !== ""
158 enabled: selectedCountry !== ""
154 onClicked: {
159 onClicked: {
155− // if (selectedLanguage !== plugin.languageCodes[plugin.currentLanguage]) {
160+ if (root.language !== plugin.languageCodes[plugin.currentLanguage]) {
156− // //plugin.currentLanguage = listview.currentIndex; // setting system language by some magic index? wtf
161+ plugin.currentLanguage = plugin.languageCodes.indexOf(root.language)
157− // //System.updateSessionLanguage(selectedLanguage); // TODO
162+ System.updateSessionLanguage(root.language + "_" + selectedCountry); // also updates the locale
158− // i18n.language = i18n.language; // re-notify of change after above call (for qlocale change)
163+ }
159− // }
160− // FIXME export the selected locale to the system
161 pageStack.next()
164 pageStack.next()
162 }
165 }
163 }
166 }
qml/Wizard/Pages/60-passwd-type.qml+88−19
@@ -35,44 +35,39 @@ 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 Security")
39 forwardButtonSourceComponent: forwardButton
39 forwardButtonSourceComponent: forwardButton
40− skip: false
41
40
42 function indexToMethod(index) {
41 function indexToMethod(index) {
43− if (index === 0)
42+ if (index === 1)
44 return UbuntuSecurityPrivacyPanel.Passcode
43 return UbuntuSecurityPrivacyPanel.Passcode
45− else if (index === 1)
44+ else if (index === 0)
46 return UbuntuSecurityPrivacyPanel.Passphrase
45 return UbuntuSecurityPrivacyPanel.Passphrase
47− else
48− return UbuntuSecurityPrivacyPanel.Swipe
49 }
46 }
50
47
51 function methodToIndex(method) {
48 function methodToIndex(method) {
52− if (method === UbuntuSecurityPrivacyPanel.Swipe)
49+ if (method === UbuntuSecurityPrivacyPanel.Passcode)
53− return 2
54− else if (method === UbuntuSecurityPrivacyPanel.Passcode)
55− return 0
56− else
57 return 1
50 return 1
51+ else if (method === UbuntuSecurityPrivacyPanel.Passphrase)
52+ return 0
58 }
53 }
59
54
60 Component.onCompleted: {
55 Component.onCompleted: {
61 selector.currentIndex = methodToIndex(root.passwordMethod)
56 selector.currentIndex = methodToIndex(root.passwordMethod)
62 }
57 }
63
58
64− Column {
59+ Item {
65 id: column
60 id: column
66 anchors.fill: content
61 anchors.fill: content
67− spacing: units.gu(4)
68 anchors.topMargin: units.gu(4)
62 anchors.topMargin: units.gu(4)
69
63
70 Label {
64 Label {
65+ id: infoLabel
71 anchors.left: parent.left
66 anchors.left: parent.left
72 anchors.right: parent.right
67 anchors.right: parent.right
73 wrapMode: Text.Wrap
68 wrapMode: Text.Wrap
74 text: i18n.tr("Choose how to secure your device to protect your personal information.")
69 text: i18n.tr("Choose how to secure your device to protect your personal information.")
75− color: "black"
70+ color: "#525252"
76 fontSize: "small"
71 fontSize: "small"
77 font.weight: Font.Light
72 font.weight: Font.Light
78 }
73 }
@@ -81,13 +76,15 @@ LocalComponents.Page {
81 id: selector
76 id: selector
82 anchors.left: parent.left
77 anchors.left: parent.left
83 anchors.right: parent.right
78 anchors.right: parent.right
79+ anchors.top: infoLabel.bottom
80+ anchors.topMargin: units.gu(3)
84
81
85 boundsBehavior: Flickable.StopAtBounds;
82 boundsBehavior: Flickable.StopAtBounds;
86 clip: true;
83 clip: true;
87− height: column.height
84+ height: childrenRect.height
88
85
89 // this is the order we want to display it; cf indexToMethod()
86 // this is the order we want to display it; cf indexToMethod()
90− model: [UbuntuSecurityPrivacyPanel.Passcode, UbuntuSecurityPrivacyPanel.Passphrase, UbuntuSecurityPrivacyPanel.Swipe]
87+ model: [UbuntuSecurityPrivacyPanel.Passphrase, UbuntuSecurityPrivacyPanel.Passcode]
91
88
92 delegate: ListItem {
89 delegate: ListItem {
93 id: itemDelegate
90 id: itemDelegate
@@ -97,7 +94,7 @@ LocalComponents.Page {
97 objectName: "passwdDelegate" + index
94 objectName: "passwdDelegate" + index
98 anchors.verticalCenter: parent.verticalCenter;
95 anchors.verticalCenter: parent.verticalCenter;
99 fontSize: "medium"
96 fontSize: "medium"
100− color: "black"
97+ color: "#525252"
101 font.weight: itemDelegate.isCurrent ? Font.Normal : Font.Light
98 font.weight: itemDelegate.isCurrent ? Font.Normal : Font.Light
102 text: {
99 text: {
103 var method = modelData
100 var method = modelData
@@ -134,6 +131,74 @@ LocalComponents.Page {
134 }
131 }
135 }
132 }
136 }
133 }
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+ }
137 }
202 }
138
203
139 Component {
204 Component {
@@ -141,8 +206,12 @@ LocalComponents.Page {
141 LocalComponents.StackButton {
206 LocalComponents.StackButton {
142 text: i18n.tr("Next")
207 text: i18n.tr("Next")
143 onClicked: {
208 onClicked: {
144− print("Clicked next")
209+ if (!requiredSwitch.checked) { // == swipe method
210+ root.passwordMethod = UbuntuSecurityPrivacyPanel.Swipe
211+ } else {
145− root.passwordMethod = indexToMethod(selector.currentIndex)
212+ root.passwordMethod = indexToMethod(selector.currentIndex)
213+ }
214+
146 print("Current method: " + root.passwordMethod)
215 print("Current method: " + root.passwordMethod)
147 pageStack.load(Qt.resolvedUrl("passwd-set.qml"))
216 pageStack.load(Qt.resolvedUrl("passwd-set.qml"))
148 }
217 }
qml/Wizard/Pages/passwd-confirm.qml+6−2
@@ -29,6 +29,8 @@ LocalComponents.Page {
29 id: passwdConfirmPage
29 id: passwdConfirmPage
30 objectName: "passwdConfirmPage"
30 objectName: "passwdConfirmPage"
31 forwardButtonSourceComponent: forwardButton
31 forwardButtonSourceComponent: forwardButton
32+ customTitle: true
33+ backButtonText: i18n.tr("Cancel")
32
34
33 skip: root.passwordMethod === UbuntuSecurityPrivacyPanel.Swipe
35 skip: root.passwordMethod === UbuntuSecurityPrivacyPanel.Swipe
34
36
@@ -39,7 +41,7 @@ LocalComponents.Page {
39 id: lockscreen
41 id: lockscreen
40 anchors {
42 anchors {
41 fill: parent
43 fill: parent
42− topMargin: topMargin
44+ topMargin: customMargin
43 leftMargin: leftMargin
45 leftMargin: leftMargin
44 rightMargin: rightMargin
46 rightMargin: rightMargin
45 bottomMargin: buttonMargin
47 bottomMargin: buttonMargin
@@ -53,6 +55,8 @@ LocalComponents.Page {
53 i18n.tr("Incorrect password.") + "\n" + i18n.tr("Please re-enter.") :
55 i18n.tr("Incorrect password.") + "\n" + i18n.tr("Please re-enter.") :
54 i18n.tr("Incorrect passcode.") + "\n" + i18n.tr("Please re-enter.")
56 i18n.tr("Incorrect passcode.") + "\n" + i18n.tr("Please re-enter.")
55
57
58+ foregroundColor: "#525252"
59+
56 showEmergencyCallButton: false
60 showEmergencyCallButton: false
57 showCancelButton: false
61 showCancelButton: false
58 alphaNumeric: root.passwordMethod === UbuntuSecurityPrivacyPanel.Passphrase
62 alphaNumeric: root.passwordMethod === UbuntuSecurityPrivacyPanel.Passphrase
@@ -79,7 +83,7 @@ LocalComponents.Page {
79 LocalComponents.StackButton {
83 LocalComponents.StackButton {
80 visible: root.passwordMethod === UbuntuSecurityPrivacyPanel.Passphrase
84 visible: root.passwordMethod === UbuntuSecurityPrivacyPanel.Passphrase
81 enabled: root.password === lockscreen.passphrase
85 enabled: root.password === lockscreen.passphrase
82− text: i18n.tr("Continue")
86+ text: i18n.tr("OK")
83 onClicked: pageStack.next()
87 onClicked: pageStack.next()
84 }
88 }
85 }
89 }
qml/Wizard/Pages/passwd-set.qml+7−8
@@ -29,8 +29,8 @@ LocalComponents.Page {
29 id: passwdSetPage
29 id: passwdSetPage
30 objectName: "passwdSetPage"
30 objectName: "passwdSetPage"
31 forwardButtonSourceComponent: forwardButton
31 forwardButtonSourceComponent: forwardButton
32−
32+ customTitle: true
33− skip: root.passwordMethod === UbuntuSecurityPrivacyPanel.Swipe
33+ backButtonText: i18n.tr("Cancel")
34
34
35 // If we are entering this page, clear any saved password and get focus
35 // If we are entering this page, clear any saved password and get focus
36 onEnabledChanged: if (enabled) lockscreen.clear(false)
36 onEnabledChanged: if (enabled) lockscreen.clear(false)
@@ -50,22 +50,21 @@ LocalComponents.Page {
50 id: lockscreen
50 id: lockscreen
51 anchors {
51 anchors {
52 fill: parent
52 fill: parent
53− topMargin: topMargin
53+ topMargin: customMargin
54 leftMargin: leftMargin
54 leftMargin: leftMargin
55 rightMargin: rightMargin
55 rightMargin: rightMargin
56 bottomMargin: buttonMargin
56 bottomMargin: buttonMargin
57 }
57 }
58
58
59− infoText: root.passwordMethod === UbuntuSecurityPrivacyPanel.Passphrase ?
60− i18n.tr("Enter password") :
61− i18n.tr("Choose passcode")
59+ infoText: alphaNumeric ? i18n.tr("Enter password") : i18n.tr("Choose passcode")
60+ foregroundColor: "#525252"
62
61
63 // Note that the number four comes from PAM settings,
62 // Note that the number four comes from PAM settings,
64 // which we don't have a good way to interrogate. We
63 // which we don't have a good way to interrogate. We
65 // only do this matching instead of PAM because we want
64 // only do this matching instead of PAM because we want
66 // to set the password via PAM in a different place
65 // to set the password via PAM in a different place
67 // than this page. See comments at top of passwd-type file.
66 // than this page. See comments at top of passwd-type file.
68− errorText: i18n.tr("Passphrase must be 4 characters long")
67+ errorText: i18n.tr("Password must be 4 characters long")
69
68
70 showEmergencyCallButton: false
69 showEmergencyCallButton: false
71 showCancelButton: false
70 showCancelButton: false
@@ -87,7 +86,7 @@ LocalComponents.Page {
87 LocalComponents.StackButton {
86 LocalComponents.StackButton {
88 visible: root.passwordMethod === UbuntuSecurityPrivacyPanel.Passphrase
87 visible: root.passwordMethod === UbuntuSecurityPrivacyPanel.Passphrase
89 enabled: lockscreen.passphrase.length >= 4
88 enabled: lockscreen.passphrase.length >= 4
90− text: i18n.tr("Next")
89+ text: i18n.tr("OK")
91 onClicked: passwdSetPage.confirm()
90 onClicked: passwdSetPage.confirm()
92 }
91 }
93 }
92 }