on xenial help sign in
implement the Lock Security front page according to the visuals
commit976db4b4e9d8fd8e8a57f92eeaf0d9fba6ef1090 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateWed 8 Jul 2015, 20:48 (11 years ago) parent52e73f4
7 files changed+115−41
qml/Wizard/Page.qml+2−1 qml/Wizard/Pages.qml+1−1 qml/Wizard/Pages/10-language.qml+2−4 qml/Wizard/Pages/15-country.qml+9−6 qml/Wizard/Pages/60-passwd-type.qml+88−19 qml/Wizard/Pages/passwd-confirm.qml+6−2 qml/Wizard/Pages/passwd-set.qml+7−8
qml/Wizard/Page.qml+2−1
@@ -40,6 +40,7 @@ Item {
4040 property bool desktopOnly: false
4141
4242 property bool hasBackButton: true
43+ property string backButtonText: i18n.ctr("Button: Go back one page in the Wizard", "Back")
4344 property bool customBack: false
4445 property bool customTitle: false
4546 property alias forwardButtonSourceComponent: forwardButton.sourceComponent
@@ -143,7 +144,7 @@ Item {
143144 verticalCenter: parent.verticalCenter
144145 }
145146 z: 1
146− text: i18n.ctr("Button: Go back one page in the Wizard", "Back")
147+ text: backButtonText
147148 visible: pageStack.depth > 1 && hasBackButton
148149 backArrow: true
149150
qml/Wizard/Pages.qml+1−1
@@ -29,7 +29,7 @@ Item {
2929
3030 // These should be set by a security page and we apply the settings when
3131 // the user exits the wizard.
32− property int passwordMethod: UbuntuSecurityPrivacyPanel.Passcode
32+ property int passwordMethod: UbuntuSecurityPrivacyPanel.Passphrase
3333 property string password: ""
3434 property string language: ""
3535
qml/Wizard/Pages/10-language.qml+2−4
@@ -26,7 +26,7 @@ LocalComponents.Page {
2626 title: i18n.tr("Language")
2727 forwardButtonSourceComponent: forwardButton
2828
29− property var detectedLangs: ["en"]
29+ property var detectedLangs: ["en"] // default language
3030
3131 UbuntuLanguagePlugin {
3232 id: plugin
@@ -174,9 +174,7 @@ LocalComponents.Page {
174174 enabled: root.language !== ""
175175 onClicked: {
176176 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)
180178 }
181179 pageStack.next()
182180 }
qml/Wizard/Pages/15-country.qml+9−6
@@ -16,6 +16,7 @@
1616
1717import QtQuick 2.3
1818import Ubuntu.Components 1.2
19+import Ubuntu.SystemSettings.LanguagePlugin 1.0
1920import Wizard 0.1
2021import ".." as LocalComponents
2122
@@ -66,6 +67,10 @@ LocalComponents.Page {
6667 regionsListView.currentIndex = index
6768 }
6869
70+ UbuntuLanguagePlugin {
71+ id: plugin
72+ }
73+
6974 ActivityIndicator {
7075 id: busyIndicator;
7176
@@ -152,12 +157,10 @@ LocalComponents.Page {
152157 text: i18n.tr("Next")
153158 enabled: selectedCountry !== ""
154159 onClicked: {
155− // if (selectedLanguage !== plugin.languageCodes[plugin.currentLanguage]) {
156− // //plugin.currentLanguage = listview.currentIndex; // setting system language by some magic index? wtf
157− // //System.updateSessionLanguage(selectedLanguage); // TODO
158− // i18n.language = i18n.language; // re-notify of change after above call (for qlocale change)
159− // }
160− // FIXME export the selected locale to the system
160+ if (root.language !== plugin.languageCodes[plugin.currentLanguage]) {
161+ plugin.currentLanguage = plugin.languageCodes.indexOf(root.language)
162+ System.updateSessionLanguage(root.language + "_" + selectedCountry); // also updates the locale
163+ }
161164 pageStack.next()
162165 }
163166 }
qml/Wizard/Pages/60-passwd-type.qml+88−19
@@ -35,44 +35,39 @@ LocalComponents.Page {
3535 id: passwdPage
3636 objectName: "passwdPage"
3737
38− title: i18n.tr("Lock security")
38+ title: i18n.tr("Lock Security")
3939 forwardButtonSourceComponent: forwardButton
40− skip: false
4140
4241 function indexToMethod(index) {
43− if (index === 0)
42+ if (index === 1)
4443 return UbuntuSecurityPrivacyPanel.Passcode
45− else if (index === 1)
44+ else if (index === 0)
4645 return UbuntuSecurityPrivacyPanel.Passphrase
47− else
48− return UbuntuSecurityPrivacyPanel.Swipe
4946 }
5047
5148 function methodToIndex(method) {
52− if (method === UbuntuSecurityPrivacyPanel.Swipe)
53− return 2
54− else if (method === UbuntuSecurityPrivacyPanel.Passcode)
55− return 0
56− else
49+ if (method === UbuntuSecurityPrivacyPanel.Passcode)
5750 return 1
51+ else if (method === UbuntuSecurityPrivacyPanel.Passphrase)
52+ return 0
5853 }
5954
6055 Component.onCompleted: {
6156 selector.currentIndex = methodToIndex(root.passwordMethod)
6257 }
6358
64− Column {
59+ Item {
6560 id: column
6661 anchors.fill: content
67− spacing: units.gu(4)
6862 anchors.topMargin: units.gu(4)
6963
7064 Label {
65+ id: infoLabel
7166 anchors.left: parent.left
7267 anchors.right: parent.right
7368 wrapMode: Text.Wrap
7469 text: i18n.tr("Choose how to secure your device to protect your personal information.")
75− color: "black"
70+ color: "#525252"
7671 fontSize: "small"
7772 font.weight: Font.Light
7873 }
@@ -81,13 +76,15 @@ LocalComponents.Page {
8176 id: selector
8277 anchors.left: parent.left
8378 anchors.right: parent.right
79+ anchors.top: infoLabel.bottom
80+ anchors.topMargin: units.gu(3)
8481
8582 boundsBehavior: Flickable.StopAtBounds;
8683 clip: true;
87− height: column.height
84+ height: childrenRect.height
8885
8986 // 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]
9188
9289 delegate: ListItem {
9390 id: itemDelegate
@@ -97,7 +94,7 @@ LocalComponents.Page {
9794 objectName: "passwdDelegate" + index
9895 anchors.verticalCenter: parent.verticalCenter;
9996 fontSize: "medium"
100− color: "black"
97+ color: "#525252"
10198 font.weight: itemDelegate.isCurrent ? Font.Normal : Font.Light
10299 text: {
103100 var method = modelData
@@ -134,6 +131,74 @@ LocalComponents.Page {
134131 }
135132 }
136133 }
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+ }
137202 }
138203
139204 Component {
@@ -141,8 +206,12 @@ LocalComponents.Page {
141206 LocalComponents.StackButton {
142207 text: i18n.tr("Next")
143208 onClicked: {
144− print("Clicked next")
145− root.passwordMethod = indexToMethod(selector.currentIndex)
209+ if (!requiredSwitch.checked) { // == swipe method
210+ root.passwordMethod = UbuntuSecurityPrivacyPanel.Swipe
211+ } else {
212+ root.passwordMethod = indexToMethod(selector.currentIndex)
213+ }
214+
146215 print("Current method: " + root.passwordMethod)
147216 pageStack.load(Qt.resolvedUrl("passwd-set.qml"))
148217 }
qml/Wizard/Pages/passwd-confirm.qml+6−2
@@ -29,6 +29,8 @@ LocalComponents.Page {
2929 id: passwdConfirmPage
3030 objectName: "passwdConfirmPage"
3131 forwardButtonSourceComponent: forwardButton
32+ customTitle: true
33+ backButtonText: i18n.tr("Cancel")
3234
3335 skip: root.passwordMethod === UbuntuSecurityPrivacyPanel.Swipe
3436
@@ -39,7 +41,7 @@ LocalComponents.Page {
3941 id: lockscreen
4042 anchors {
4143 fill: parent
42− topMargin: topMargin
44+ topMargin: customMargin
4345 leftMargin: leftMargin
4446 rightMargin: rightMargin
4547 bottomMargin: buttonMargin
@@ -53,6 +55,8 @@ LocalComponents.Page {
5355 i18n.tr("Incorrect password.") + "\n" + i18n.tr("Please re-enter.") :
5456 i18n.tr("Incorrect passcode.") + "\n" + i18n.tr("Please re-enter.")
5557
58+ foregroundColor: "#525252"
59+
5660 showEmergencyCallButton: false
5761 showCancelButton: false
5862 alphaNumeric: root.passwordMethod === UbuntuSecurityPrivacyPanel.Passphrase
@@ -79,7 +83,7 @@ LocalComponents.Page {
7983 LocalComponents.StackButton {
8084 visible: root.passwordMethod === UbuntuSecurityPrivacyPanel.Passphrase
8185 enabled: root.password === lockscreen.passphrase
82− text: i18n.tr("Continue")
86+ text: i18n.tr("OK")
8387 onClicked: pageStack.next()
8488 }
8589 }
qml/Wizard/Pages/passwd-set.qml+7−8
@@ -29,8 +29,8 @@ LocalComponents.Page {
2929 id: passwdSetPage
3030 objectName: "passwdSetPage"
3131 forwardButtonSourceComponent: forwardButton
32−
33− skip: root.passwordMethod === UbuntuSecurityPrivacyPanel.Swipe
32+ customTitle: true
33+ backButtonText: i18n.tr("Cancel")
3434
3535 // If we are entering this page, clear any saved password and get focus
3636 onEnabledChanged: if (enabled) lockscreen.clear(false)
@@ -50,22 +50,21 @@ LocalComponents.Page {
5050 id: lockscreen
5151 anchors {
5252 fill: parent
53− topMargin: topMargin
53+ topMargin: customMargin
5454 leftMargin: leftMargin
5555 rightMargin: rightMargin
5656 bottomMargin: buttonMargin
5757 }
5858
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"
6261
6362 // Note that the number four comes from PAM settings,
6463 // which we don't have a good way to interrogate. We
6564 // only do this matching instead of PAM because we want
6665 // to set the password via PAM in a different place
6766 // 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")
6968
7069 showEmergencyCallButton: false
7170 showCancelButton: false
@@ -87,7 +86,7 @@ LocalComponents.Page {
8786 LocalComponents.StackButton {
8887 visible: root.passwordMethod === UbuntuSecurityPrivacyPanel.Passphrase
8988 enabled: lockscreen.passphrase.length >= 4
90− text: i18n.tr("Next")
89+ text: i18n.tr("OK")
9190 onClicked: passwdSetPage.confirm()
9291 }
9392 }