@@ -1,4 +1,4 @@
2 * Copyright (C) 2013 Canonical, Ltd.
2 * Copyright (C) 2013 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
4 * This program is free software; you can redistribute it and/or modify
@@ -63,7 +63,7 @@ LocalComponents.Page {
63 function getAccessPointName() {
63 function getAccessPointName() {
64 // 0 is the interface
64 // 0 is the interface
65 if (currentNetworkMode === NetworkInfo.WlanMode &&
65 if (currentNetworkMode === NetworkInfo.WlanMode &&
66− networkStatus(NetworkInfo.WlanMode, 0) === NetworkInfo.HomeNetwork)
66+ networkStatus(NetworkInfo.WlanMode, 0) === NetworkInfo.HomeNetwork)
67 accessPointName = networkName(NetworkInfo.WlanMode, 0);
67 accessPointName = networkName(NetworkInfo.WlanMode, 0);
69 accessPointName = "";
69 accessPointName = "";
@@ -84,23 +84,26 @@ LocalComponents.Page {
84 index: menuIndex
84 index: menuIndex
85 name: getExtendedProperty(extendedData, "xCanonicalWifiApStrengthAction", "")
85 name: getExtendedProperty(extendedData, "xCanonicalWifiApStrengthAction", "")
87− property bool checked: menuData && menuData.isToggled || false
88− property bool secure: getExtendedProperty(extendedData, "xCanonicalWifiApIsSecure", false)
87+ readonly property bool secure: getExtendedProperty(extendedData, "xCanonicalWifiApIsSecure", false)
89− property bool adHoc: getExtendedProperty(extendedData, "xCanonicalWifiApIsAdhoc", false)
88+ readonly property bool adHoc: getExtendedProperty(extendedData, "xCanonicalWifiApIsAdhoc", false)
90− property bool enterprise: getExtendedProperty(extendedData, "xCanonicalWifiApIsEnterprise", false)
89+ readonly property bool enterprise: getExtendedProperty(extendedData, "xCanonicalWifiApIsEnterprise", false)
90+ readonly property bool isAccessPoint: menuData.type === "unity.widgets.systemsettings.tablet.accesspoint"
91 property int signalStrength: strengthAction.valid ? strengthAction.state : 0
91 property int signalStrength: strengthAction.valid ? strengthAction.state : 0
92 property int menuIndex: -1
92 property int menuIndex: -1
94 function loadAttributes() {
94 function loadAttributes() {
95 if (!unityMenuModel || menuIndex == -1) return;
95 if (!unityMenuModel || menuIndex == -1) return;
96 unityMenuModel.loadExtendedAttributes(menuIndex, {'x-canonical-wifi-ap-is-adhoc': 'bool',
96 unityMenuModel.loadExtendedAttributes(menuIndex, {'x-canonical-wifi-ap-is-adhoc': 'bool',
97− 'x-canonical-wifi-ap-is-secure': 'bool',
97+ 'x-canonical-wifi-ap-is-secure': 'bool',
98− 'x-canonical-wifi-ap-is-enterprise': 'bool',
98+ 'x-canonical-wifi-ap-is-enterprise': 'bool',
99− 'x-canonical-wifi-ap-strength-action': 'string'});
99+ 'x-canonical-wifi-ap-strength-action': 'string'});
102 text: menuData && menuData.label || ""
104 text: menuData && menuData.label || ""
103 enabled: menuData && menuData.sensitive || false
105 enabled: menuData && menuData.sensitive || false
106+ height: isAccessPoint && !enterprise ? units.gu(6) : 0
104 visible: !enterprise
107 visible: !enterprise
105 __foregroundColor: "#525252"
108 __foregroundColor: "#525252"
106 showDivider: true
109 showDivider: true
@@ -125,7 +128,7 @@ LocalComponents.Page {
125 return imageName;
128 return imageName;
127 iconFrame: false
130 iconFrame: false
128− onClicked: unityMenuModel.activate(menuIndex);
131+ onClicked: accessPoint.activate();
130 Component.onCompleted: {
133 Component.onCompleted: {
131 loadAttributes();
134 loadAttributes();
@@ -136,6 +139,7 @@ LocalComponents.Page {
136 onMenuIndexChanged: {
139 onMenuIndexChanged: {
137 loadAttributes();
140 loadAttributes();
142+ onActivate: unityMenuModel.activate(menuIndex);
@@ -151,45 +155,29 @@ LocalComponents.Page {
151 anchors.right: parent.right
155 anchors.right: parent.right
152 font.weight: Font.Light
156 font.weight: Font.Light
153 color: "#525252"
157 color: "#525252"
154− text: mainMenu.count > 0 ? i18n.tr("Available Wi-Fi networks")
158+ text: listview.count > 0 ? i18n.tr("Available Wi-Fi networks")
155 : i18n.tr("No available Wi-Fi networks")
159 : i18n.tr("No available Wi-Fi networks")
158− Flickable {
162+ ListView {
159 anchors.left: parent.left
164 anchors.left: parent.left
160 anchors.right: parent.right
165 anchors.right: parent.right
161− height: column.height - label.height - column.spacing
166+ model: menuModel
162− contentHeight: contentItem.childrenRect.height
164− flickDeceleration: 1500 * units.gridUnit / 8
165− maximumFlickVelocity: 2500 * units.gridUnit / 8
166− boundsBehavior: (contentHeight > height) ? Flickable.DragAndOvershootBounds : Flickable.StopAtBounds
169− anchors.left: parent.left
170− anchors.right: parent.right
175− model: menuModel
168+ delegate: Loader {
177− delegate: Loader {
171+ readonly property bool isAccessPoint: model.type === "unity.widgets.systemsettings.tablet.accesspoint"
180− readonly property bool isAccessPoint: model.type === "unity.widgets.systemsettings.tablet.accesspoint"
182− anchors.left: parent.left
173+ anchors.left: parent.left
183− anchors.right: parent.right
174+ anchors.right: parent.right
184− height: isAccessPoint ? units.gu(6) : 0
185− asynchronous: true
175+ asynchronous: true
186− sourceComponent: isAccessPoint ? accessPointComponent : null
176+ sourceComponent: isAccessPoint ? accessPointComponent : null
188− onLoaded: {
178+ onLoaded: {
189− item.menuData = Qt.binding(function() { return model; });
179+ item.menuData = Qt.binding(function() { return model; });
190− item.menuIndex = Qt.binding(function() { return index; });
180+ item.menuIndex = Qt.binding(function() { return index; });
@@ -198,7 +186,7 @@ LocalComponents.Page {
198 Component {
186 Component {
199 id: forwardButton
187 id: forwardButton
200 LocalComponents.StackButton {
188 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")
202 onClicked: pageStack.next()
190 onClicked: pageStack.next()