on xenial help sign in
switch to a ListView; fix activating an AP
commitd2aeca1dbcffd1456b7ee588636a4865673749d3 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateMon 31 Aug 2015, 14:10 (11 years ago) parent7acba4c
3 files changed+32−46
qml/Wizard/Pages.qml+1−1 qml/Wizard/Pages/30-wifi.qml+29−41 qml/Wizard/Pages/50-timezone.qml+2−4
qml/Wizard/Pages.qml+1−1
@@ -31,7 +31,7 @@ Item {
3131 // the user exits the wizard.
3232 property int passwordMethod: UbuntuSecurityPrivacyPanel.Passphrase
3333 property string password: ""
34− property string countryCode: "US"
34+ property string countryCode: "US" // default country (for the timezone page)
3535
3636 UbuntuSecurityPrivacyPanel {
3737 id: securityPrivacy
qml/Wizard/Pages/30-wifi.qml+29−41
@@ -1,4 +1,4 @@
1−/*
1+/*
22 * Copyright (C) 2013 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
@@ -63,7 +63,7 @@ LocalComponents.Page {
6363 function getAccessPointName() {
6464 // 0 is the interface
6565 if (currentNetworkMode === NetworkInfo.WlanMode &&
66− networkStatus(NetworkInfo.WlanMode, 0) === NetworkInfo.HomeNetwork)
66+ networkStatus(NetworkInfo.WlanMode, 0) === NetworkInfo.HomeNetwork)
6767 accessPointName = networkName(NetworkInfo.WlanMode, 0);
6868 else
6969 accessPointName = "";
@@ -84,23 +84,26 @@ LocalComponents.Page {
8484 index: menuIndex
8585 name: getExtendedProperty(extendedData, "xCanonicalWifiApStrengthAction", "")
8686 }
87− property bool checked: menuData && menuData.isToggled || false
88− property bool secure: getExtendedProperty(extendedData, "xCanonicalWifiApIsSecure", false)
89− property bool adHoc: getExtendedProperty(extendedData, "xCanonicalWifiApIsAdhoc", false)
90− property bool enterprise: getExtendedProperty(extendedData, "xCanonicalWifiApIsEnterprise", false)
87+ readonly property bool secure: getExtendedProperty(extendedData, "xCanonicalWifiApIsSecure", false)
88+ readonly property bool adHoc: getExtendedProperty(extendedData, "xCanonicalWifiApIsAdhoc", false)
89+ readonly property bool enterprise: getExtendedProperty(extendedData, "xCanonicalWifiApIsEnterprise", false)
90+ readonly property bool isAccessPoint: menuData.type === "unity.widgets.systemsettings.tablet.accesspoint"
9191 property int signalStrength: strengthAction.valid ? strengthAction.state : 0
9292 property int menuIndex: -1
9393
9494 function loadAttributes() {
9595 if (!unityMenuModel || menuIndex == -1) return;
9696 unityMenuModel.loadExtendedAttributes(menuIndex, {'x-canonical-wifi-ap-is-adhoc': 'bool',
97− 'x-canonical-wifi-ap-is-secure': 'bool',
98− 'x-canonical-wifi-ap-is-enterprise': 'bool',
99− 'x-canonical-wifi-ap-strength-action': 'string'});
97+ 'x-canonical-wifi-ap-is-secure': 'bool',
98+ 'x-canonical-wifi-ap-is-enterprise': 'bool',
99+ 'x-canonical-wifi-ap-strength-action': 'string'});
100100 }
101101
102+ signal activate()
103+
102104 text: menuData && menuData.label || ""
103105 enabled: menuData && menuData.sensitive || false
106+ height: isAccessPoint && !enterprise ? units.gu(6) : 0
104107 visible: !enterprise
105108 __foregroundColor: "#525252"
106109 showDivider: true
@@ -125,7 +128,7 @@ LocalComponents.Page {
125128 return imageName;
126129 }
127130 iconFrame: false
128− onClicked: unityMenuModel.activate(menuIndex);
131+ onClicked: accessPoint.activate();
129132
130133 Component.onCompleted: {
131134 loadAttributes();
@@ -136,6 +139,7 @@ LocalComponents.Page {
136139 onMenuIndexChanged: {
137140 loadAttributes();
138141 }
142+ onActivate: unityMenuModel.activate(menuIndex);
139143 }
140144 }
141145
@@ -151,45 +155,29 @@ LocalComponents.Page {
151155 anchors.right: parent.right
152156 font.weight: Font.Light
153157 color: "#525252"
154− text: mainMenu.count > 0 ? i18n.tr("Available Wi-Fi networks")
158+ text: listview.count > 0 ? i18n.tr("Available Wi-Fi networks")
155159 : i18n.tr("No available Wi-Fi networks")
156160 }
157161
158− Flickable {
162+ ListView {
163+ id: listview
159164 anchors.left: parent.left
160165 anchors.right: parent.right
161− height: column.height - label.height - column.spacing
162− contentHeight: contentItem.childrenRect.height
163− clip: true
164− flickDeceleration: 1500 * units.gridUnit / 8
165− maximumFlickVelocity: 2500 * units.gridUnit / 8
166− boundsBehavior: (contentHeight > height) ? Flickable.DragAndOvershootBounds : Flickable.StopAtBounds
167−
168− Column {
169− anchors.left: parent.left
170− anchors.right: parent.right
171−
172− Repeater {
173− id: mainMenu
166+ model: menuModel
174167
175− model: menuModel
168+ delegate: Loader {
169+ id: loader
176170
177− delegate: Loader {
178− id: loader
171+ readonly property bool isAccessPoint: model.type === "unity.widgets.systemsettings.tablet.accesspoint"
179172
180− readonly property bool isAccessPoint: model.type === "unity.widgets.systemsettings.tablet.accesspoint"
181−
182− anchors.left: parent.left
183− anchors.right: parent.right
184− height: isAccessPoint ? units.gu(6) : 0
185− asynchronous: true
186− sourceComponent: isAccessPoint ? accessPointComponent : null
173+ anchors.left: parent.left
174+ anchors.right: parent.right
175+ asynchronous: true
176+ sourceComponent: isAccessPoint ? accessPointComponent : null
187177
188− onLoaded: {
189− item.menuData = Qt.binding(function() { return model; });
190− item.menuIndex = Qt.binding(function() { return index; });
191− }
192− }
178+ onLoaded: {
179+ item.menuData = Qt.binding(function() { return model; });
180+ item.menuIndex = Qt.binding(function() { return index; });
193181 }
194182 }
195183 }
@@ -198,7 +186,7 @@ LocalComponents.Page {
198186 Component {
199187 id: forwardButton
200188 LocalComponents.StackButton {
201− text: (connected || mainMenu.count === 0) ? i18n.tr("Next") : i18n.tr("Skip")
189+ text: (connected || listview.count === 0) ? i18n.tr("Next") : i18n.tr("Skip")
202190 onClicked: pageStack.next()
203191 }
204192 }
qml/Wizard/Pages/50-timezone.qml+2−4
@@ -121,9 +121,7 @@ LocalComponents.Page {
121121 }
122122
123123 height: column.height - searchField.height - column.spacing - topMargin
124−
125124 model: tzFilterModel
126−
127125 delegate: tzComponent
128126 }
129127 }
@@ -134,8 +132,8 @@ LocalComponents.Page {
134132 text: i18n.tr("Next")
135133 enabled: selectedTimeZone != ""
136134 onClicked: {
137− UbuntuTimeDatePanel.timeZone = selectedTimeZone
138− pageStack.next()
135+ UbuntuTimeDatePanel.timeZone = selectedTimeZone;
136+ pageStack.next();
139137 }
140138 }
141139 }