@@ -16,6 +16,7 @@
1616
1717import QtQuick 2.0
1818import QMenuModel 0.1 as QMenuModel
19+import QtSystemInfo 5.0
1920import Ubuntu.Components 0.1
2021import Ubuntu.Components.ListItems 0.1 as ListItem
2122import Ubuntu.Settings.Menus 0.1 as Menus
@@ -28,7 +29,7 @@ LocalComponents.Page {
2829 title: i18n.tr("Connect to Wi‑Fi")
2930 forwardButtonSourceComponent: forwardButton
3031
31− readonly property bool connected: mainMenu.connectedAPs === 1
32+ readonly property bool connected: networkInfo.accessPointName
3233
3334 function getExtendedProperty(object, propertyName, defaultValue) {
3435 if (object && object.hasOwnProperty(propertyName)) {
@@ -44,6 +45,23 @@ LocalComponents.Page {
4445 menuObjectPath: "/com/canonical/indicator/network/phone_wifi_settings"
4546 }
4647
48+ NetworkInfo {
49+ id: networkInfo
50+
51+ property string accessPointName: getAccessPointName()
52+
53+ monitorNetworkName: true
54+ monitorNetworkStatus: true
55+
56+ onNetworkNameChanged: getAccessPointName()
57+ onNetworkStatusChanged: if (status !== NetworkInfo.HomeNetwork) accessPointName = ""
58+
59+ function getAccessPointName() {
60+ // 0 is the interface
61+ accessPointName = networkName(NetworkInfo.WlanMode, 0)
62+ }
63+ }
64+
4765 Component {
4866 id: accessPointComponent
4967 ListItem.Standard {
@@ -119,11 +137,6 @@ LocalComponents.Page {
119137 onCheckedChanged: {
120138 // Can't rely on binding. Checked is assigned on click.
121139 checkBoxActive.checked = checked;
122− if (checked) {
123− mainMenu.connectedAPs++
124− } else {
125− mainMenu.connectedAPs--
126− }
127140 }
128141 onActivate: unityMenuModel.activate(menuIndex);
129142 }
@@ -165,9 +178,6 @@ LocalComponents.Page {
165178 Repeater {
166179 id: mainMenu
167180
168− // FIXME Check connection better https://bugs.launchpad.net/indicator-network/+bug/1349371
169− property int connectedAPs: 0
170−
171181 model: menuModel
172182
173183 delegate: Loader {