@@ -15,9 +15,7 @@
17import QtQuick 2.3
17import 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
21import Ubuntu.Web 0.2
19import Ubuntu.Web 0.2
22import ".." as LocalComponents
20import ".." as LocalComponents
@@ -26,88 +24,106 @@ LocalComponents.Page {
27 title: i18n.tr("Terms & Conditions")
25 title: i18n.tr("Terms & Conditions")
28 customBack: true
26 customBack: true
30− FolderListModel {
29+ onBackClicked: {
31− id: termsModel
30+ if (webview.visible) {
32− folder: AccountsService.hereLicensePath
31+ showBrowser(false)
33− nameFilters: ["*.html"]
32+ } else {
34− showDirs: false
33+ pageStack.prev()
35− showOnlyReadable: true
34+ }
36− onCountChanged: loadFileContent()
39− function makeFileName(lang, country) {
40− return lang + "_" + country + ".html"
43− function defaultCountryForLanguage(lang) {
37+ function showBrowser(show) {
44− if (lang === "cs") return "CZ"
38+ if (show) {
45− if (lang === "da") return "DK"
39+ label1.visible = false
46− if (lang === "en") return "US"
40+ label2.visible = false
47− if (lang === "ko") return "KR"
41+ label3.visible = false
48− if (lang === "zh") return "CN"
42+ label4.visible = false
49− return lang.toUpperCase()
43+ label5.visible = false
44+ webview.visible = true
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− function determineFileName() {
55+ Column {
53− var codes = i18n.language.split(".")[0].split("_")
56+ id: column
54− var defaultCountry = defaultCountryForLanguage(codes[0])
57+ anchors.fill: content
55− if (codes.count === 1)
58+ spacing: units.gu(3)
56− codes = [codes[0], defaultCountry]
57− var perfectMatch = makeFileName(codes[0], codes[1])
58− var nearMatch = makeFileName(codes[0], defaultCountry)
59− var nearMatchExists = false
61− for (var i = 0; i < termsModel.count; i++) {
60+ Label {
62− var fileName = termsModel.get(i, "fileName")
61+ id: label1
63− if (fileName == perfectMatch) {
62+ anchors.left: parent.left
64− return perfectMatch
63+ anchors.right: parent.right
65− } else if (fileName == nearMatch) {
64+ wrapMode: Text.Wrap
66− nearMatchExists = true
65+ color: "black"
67− }
66+ fontSize: "small"
67+ font.weight: Font.Light
68+ text: i18n.tr("Your device uses positioning technologies provided by HERE.")
70− if (nearMatchExists) {
71+ Label {
71− return nearMatch
72+ id: label2
72− } else {
73+ anchors.left: parent.left
73− return makeFileName("en", "US")
74+ anchors.right: parent.right
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.")
77− function loadFileContent() {
84+ Label {
78− var xhr = new XMLHttpRequest
85+ id: label3
79− xhr.open("GET", AccountsService.hereLicensePath + "/" + determineFileName())
86+ anchors.left: parent.left
80− xhr.onreadystatechange = function() {
87+ anchors.right: parent.right
81− if (xhr.readyState == XMLHttpRequest.DONE) {
88+ wrapMode: Text.Wrap
82− termsLabel.text = xhr.responseText
89+ color: "black"
83− }
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.")
88− onBackClicked: {
96+ Label {
89− if (webview.visible) {
97+ id: label4
90− termsLabel.visible = true
98+ anchors.left: parent.left
91− } else {
99+ anchors.right: parent.right
92− pageStack.prev()
100+ wrapMode: Text.Wrap
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>"
98− anchors.fill: content
101− id: termsLabel
114+ id: label5
102− objectName: "termsLabel"
103 anchors.left: parent.left
115 anchors.left: parent.left
104 anchors.right: parent.right
116 anchors.right: parent.right
105 wrapMode: Text.Wrap
117 wrapMode: Text.Wrap
106 color: "black"
118 color: "black"
120+ font.weight: Font.Light
107− linkColor: UbuntuColors.darkGrey
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>"
108 onLinkActivated: {
124 onLinkActivated: {
109 webview.url = link
126 webview.url = link
110− termsLabel.visible = false
@@ -116,8 +132,10 @@ LocalComponents.Page {
116 objectName: "webview"
132 objectName: "webview"
117 anchors.left: parent.left
133 anchors.left: parent.left
118 anchors.right: parent.right
134 anchors.right: parent.right
135+ anchors.leftMargin: 0
136+ anchors.rightMargin: 0
119 height: parent.height
137 height: parent.height
120− visible: !termsLabel.visible
138+ visible: false