on xenial help sign in
line up with the visuals, provide a custom title-less page

for the location terms and missing sim pages

commitb8f6fb197eadad6efa362e51cb7a7bd0735569bd authorLukáš Tinkl <lukas.tinkl@canonical.com> dateTue 30 Jun 2015, 17:43 (11 years ago) parent30deba0
7 files changed+101−72
qml/Wizard/CheckableSetting.qml+1 qml/Wizard/Page.qml+8−3 qml/Wizard/Pages.qml+1 qml/Wizard/Pages/20-sim.qml+1−1 qml/Wizard/Pages/50-location.qml+6−3 qml/Wizard/Pages/60-passwd-type.qml+1 qml/Wizard/Pages/here-terms.qml+83−65
qml/Wizard/CheckableSetting.qml+1
@@ -79,6 +79,7 @@ ListItem.Empty {
7979 wrapMode: Text.Wrap
8080 linkColor: Theme.palette.normal.foregroundText
8181 color: "black"
82+ font.weight: Font.Light
8283 onLinkActivated: listItem.linkActivated(link)
8384 }
8485 }
qml/Wizard/Page.qml+8−3
@@ -27,6 +27,7 @@ Item {
2727 readonly property real bottomMargin: units.gu(3)
2828 readonly property real leftMargin: units.gu(3)
2929 readonly property real rightMargin: units.gu(3)
30+ readonly property real customMargin: units.gu(4) // margin for the custom (w/o title bar) pages
3031
3132 // If you want to skip a page, mark skipValid false while you figure out
3233 // whether to skip, then set it to true once you've determined the value
@@ -34,8 +35,12 @@ Item {
3435 property bool skipValid: true
3536 property bool skip: false
3637
38+ property bool mobileOnly: true
39+ property bool desktopOnly: false
40+
3741 property bool hasBackButton: true
3842 property bool customBack: false
43+ property bool customTitle: false
3944 property alias forwardButtonSourceComponent: forwardButton.sourceComponent
4045 property alias content: contentHolder
4146
@@ -54,8 +59,8 @@ Item {
5459 left: parent.left
5560 right: parent.right
5661 }
57− height: topMargin + bottomMargin
58− color: "#650954"
62+ height: customTitle ? customMargin + titleLabel.height + customMargin : topMargin + bottomMargin
63+ color: customTitle ? "#fdfdfd" : "#650954"
5964
6065 Label {
6166 id: titleLabel
@@ -69,7 +74,7 @@ Item {
6974 }
7075 wrapMode: Text.Wrap
7176 text: title
72− color: "white"
77+ color: customTitle ? "black" : "white"
7378 fontSize: "x-large"
7479 }
7580 }
qml/Wizard/Pages.qml+1
@@ -91,6 +91,7 @@ Item {
9191 }
9292
9393 function load(path) {
94+ print("Loading: " + path)
9495 if (currentPage) {
9596 currentPage.enabled = false
9697 }
qml/Wizard/Pages/20-sim.qml+1−1
@@ -25,6 +25,7 @@ LocalComponents.Page {
2525
2626 title: i18n.tr("No SIM card installed")
2727 forwardButtonSourceComponent: forwardButton
28+ customTitle: true
2829
2930 skipValid: !manager.available ||
3031 (manager.ready && (manager.modems.length < 1 || simManager0.ready)
@@ -80,7 +81,6 @@ LocalComponents.Page {
8081 Column {
8182 anchors.fill: content
8283 spacing: units.gu(4)
83− anchors.topMargin: units.gu(4)
8484
8585 Label {
8686 anchors.left: parent.left
qml/Wizard/Pages/50-location.qml+6−3
@@ -66,7 +66,7 @@ LocalComponents.Page {
6666 id: hereCheck
6767 objectName: "hereCheck"
6868 showDivider: false
69− text: i18n.tr("Use GPS, Wi-FI hotspots nad mobile network anonymously to detect location (recommended)")
69+ text: i18n.tr("Use GPS, Wi-Fi hotspots and mobile network anonymously to detect location (recommended)")
7070 checked: true
7171 onTriggered: {
7272 gpsCheck.checked = false;
@@ -82,9 +82,10 @@ LocalComponents.Page {
8282 anchors.leftMargin: hereCheck.labelOffset
8383 anchors.right: parent.right
8484 wrapMode: Text.Wrap
85− linkColor: UbuntuColors.darkGrey
85+ linkColor: "#dd4814"
8686 color: "black"
8787 fontSize: "small"
88+ font.weight: Font.Light
8889 // TRANSLATORS: HERE is a trademark for Nokia's location service, you probably shouldn't translate it
8990 text: i18n.tr("By selecting this option you agree to the Nokia HERE <a href='#'>terms and conditions</a>.")
9091 onLinkActivated: pageStack.load(Qt.resolvedUrl("here-terms.qml"))
@@ -119,8 +120,10 @@ LocalComponents.Page {
119120 anchors.left: parent.left
120121 anchors.right: parent.right
121122 wrapMode: Text.Wrap
122− text: i18n.tr("You can change it later in <b>System Settings</b>.")
123+ text: i18n.tr("You can change it later in <em>System Settings</em>.")
123124 color: "black"
125+ fontSize: "small"
126+ font.weight: Font.Light
124127 }
125128 }
126129
qml/Wizard/Pages/60-passwd-type.qml+1
@@ -37,6 +37,7 @@ LocalComponents.Page {
3737
3838 title: i18n.tr("Lock security")
3939 forwardButtonSourceComponent: forwardButton
40+ skip: false
4041
4142 function indexToMethod(index) {
4243 if (index === 0)
qml/Wizard/Pages/here-terms.qml+83−65
@@ -15,9 +15,7 @@
1515 */
1616
1717import QtQuick 2.3
18−import AccountsService 0.1
19−import Qt.labs.folderlistmodel 2.1
20−import Ubuntu.Components 1.1
18+import Ubuntu.Components 1.2
2119import Ubuntu.Web 0.2
2220import ".." as LocalComponents
2321
@@ -26,88 +24,106 @@ LocalComponents.Page {
2624
2725 title: i18n.tr("Terms & Conditions")
2826 customBack: true
27+ customTitle: true
2928
30− FolderListModel {
31− id: termsModel
32− folder: AccountsService.hereLicensePath
33− nameFilters: ["*.html"]
34− showDirs: false
35− showOnlyReadable: true
36− onCountChanged: loadFileContent()
37− }
38−
39− function makeFileName(lang, country) {
40− return lang + "_" + country + ".html"
29+ onBackClicked: {
30+ if (webview.visible) {
31+ showBrowser(false)
32+ } else {
33+ pageStack.prev()
34+ }
4135 }
4236
43− function defaultCountryForLanguage(lang) {
44− if (lang === "cs") return "CZ"
45− if (lang === "da") return "DK"
46− if (lang === "en") return "US"
47− if (lang === "ko") return "KR"
48− if (lang === "zh") return "CN"
49− return lang.toUpperCase()
37+ function showBrowser(show) {
38+ if (show) {
39+ label1.visible = false
40+ label2.visible = false
41+ label3.visible = false
42+ label4.visible = false
43+ label5.visible = false
44+ webview.visible = true
45+ } else {
46+ webview.visible = false
47+ label1.visible = true
48+ label2.visible = true
49+ label3.visible = true
50+ label4.visible = true
51+ label5.visible = true
52+ }
5053 }
5154
52− function determineFileName() {
53− var codes = i18n.language.split(".")[0].split("_")
54− var defaultCountry = defaultCountryForLanguage(codes[0])
55− if (codes.count === 1)
56− codes = [codes[0], defaultCountry]
57− var perfectMatch = makeFileName(codes[0], codes[1])
58− var nearMatch = makeFileName(codes[0], defaultCountry)
59− var nearMatchExists = false
55+ Column {
56+ id: column
57+ anchors.fill: content
58+ spacing: units.gu(3)
6059
61− for (var i = 0; i < termsModel.count; i++) {
62− var fileName = termsModel.get(i, "fileName")
63− if (fileName == perfectMatch) {
64− return perfectMatch
65− } else if (fileName == nearMatch) {
66− nearMatchExists = true
67− }
60+ Label {
61+ id: label1
62+ anchors.left: parent.left
63+ anchors.right: parent.right
64+ wrapMode: Text.Wrap
65+ color: "black"
66+ fontSize: "small"
67+ font.weight: Font.Light
68+ text: i18n.tr("Your device uses positioning technologies provided by HERE.")
6869 }
6970
70− if (nearMatchExists) {
71− return nearMatch
72− } else {
73− return makeFileName("en", "US")
71+ Label {
72+ id: label2
73+ anchors.left: parent.left
74+ anchors.right: parent.right
75+ wrapMode: Text.Wrap
76+ color: "black"
77+ fontSize: "small"
78+ font.weight: Font.Light
79+ text: i18n.tr("To provide you with positioning services and to improve their quality, HERE collects " +
80+ "information about nearby cell towers and Wi-Fi hotspots around your current location " +
81+ "whenever your position is being found.")
7482 }
75− }
7683
77− function loadFileContent() {
78− var xhr = new XMLHttpRequest
79− xhr.open("GET", AccountsService.hereLicensePath + "/" + determineFileName())
80− xhr.onreadystatechange = function() {
81− if (xhr.readyState == XMLHttpRequest.DONE) {
82− termsLabel.text = xhr.responseText
83− }
84+ Label {
85+ id: label3
86+ anchors.left: parent.left
87+ anchors.right: parent.right
88+ wrapMode: Text.Wrap
89+ color: "black"
90+ fontSize: "small"
91+ font.weight: Font.Light
92+ text: i18n.tr("The information collected is used to analyze the service and to " +
93+ "improve the use of service, but not to identify you personally.")
8494 }
85− xhr.send()
86− }
8795
88− onBackClicked: {
89− if (webview.visible) {
90− termsLabel.visible = true
91− } else {
92− pageStack.prev()
96+ Label {
97+ id: label4
98+ anchors.left: parent.left
99+ anchors.right: parent.right
100+ wrapMode: Text.Wrap
101+ color: "black"
102+ fontSize: "small"
103+ font.weight: Font.Light
104+ linkColor: "#dd4814"
105+ text: i18n.tr("By continuing, you agree to the HERE Platform Service Terms:") +
106+ " <a href=\"http://here.com/terms/service-terms\">http://here.com/terms/service-terms</a>"
107+ onLinkActivated: {
108+ showBrowser(true)
109+ webview.url = link
110+ }
93111 }
94− }
95−
96− Column {
97− id: column
98− anchors.fill: content
99112
100113 Label {
101− id: termsLabel
102− objectName: "termsLabel"
114+ id: label5
103115 anchors.left: parent.left
104116 anchors.right: parent.right
105117 wrapMode: Text.Wrap
106118 color: "black"
107− linkColor: UbuntuColors.darkGrey
119+ fontSize: "small"
120+ font.weight: Font.Light
121+ linkColor: "#dd4814"
122+ text: i18n.tr("and Privacy Policy:") +
123+ " <a href=\"http://here.com/privacy/privacy-policy\">http://here.com/privacy/privacy-policy</a>"
108124 onLinkActivated: {
125+ showBrowser(true)
109126 webview.url = link
110− termsLabel.visible = false
111127 }
112128 }
113129
@@ -116,8 +132,10 @@ LocalComponents.Page {
116132 objectName: "webview"
117133 anchors.left: parent.left
118134 anchors.right: parent.right
135+ anchors.leftMargin: 0
136+ anchors.rightMargin: 0
119137 height: parent.height
120− visible: !termsLabel.visible
138+ visible: false
121139 }
122140 }
123141}