20
22
import SystemSettings 1.0
21
23
import Ubuntu.Components 0.1
22
24
import Ubuntu.Components.ListItems 0.1 as ListItem
23
import Ubuntu.SystemSettings.Cellular 1.0
25
import Ubuntu.Components.Popups 0.1
26
import Ubuntu.Connectivity 1.0
29
title: i18n.tr("Wi-Fi hotspot")
31
objectName: "hotspotPage"
32
title: i18n.tr("Hotspot")
37
// Undefined WifiEnabled means Connectivity is unavailable.
38
when: typeof Connectivity.wifiEnabled === "undefined" ||
39
Connectivity.FlightMode
45
target: hotspotSetupButton
51
when: Connectivity.wifiEnabled === false
53
target: hotspotSwitchWhenWifiDisabled
37
67
anchors.fill: parent
40
text: i18n.tr("Hotspot")
43
checked: hotspotManager.isHotspotActive()
46
hotspotManager.enableHotspot()
48
hotspotManager.disableHotspot()
68
contentWidth: parent.width
69
contentHeight: contentItem.childrenRect.height
70
boundsBehavior: (contentHeight > root.height) ?
71
Flickable.DragAndOvershootBounds : Flickable.StopAtBounds
82
text: i18n.tr("Hotspot")
83
enabled: Connectivity.hotspotStored
84
onClicked: hotspotSwitch.trigger()
87
objectName: "hotspotSwitch"
88
enabled: parent.enabled
89
checked: Connectivity.hotspotEnabled
90
onTriggered: Connectivity.hotspotEnabled = checked
92
// Catch taps if Wi-Fi is disable and prompt user.
94
id: hotspotSwitchWhenWifiDisabled
97
onClicked: enableWifiAction.diag = PopupUtils.open(
56
wrapMode: Text.WordWrap
57
anchors.leftMargin: units.gu(2)
58
anchors.rightMargin: units.gu(2)
59
text : hotspotSwitch.enabled ?
60
i18n.tr("When hotspot is on, other devices can use your cellular data connection over Wi-Fi. Normal data charges apply.")
61
: i18n.tr("Other devices can use your cellular data connection over the Wi-Fi network. Normal data charges apply.")
65
text: i18n.tr("Set up hotspot")
66
anchors.left: parent.left
67
anchors.right: parent.right
68
anchors.leftMargin: units.gu(2)
69
anchors.rightMargin: units.gu(2)
71
pageStack.push(Qt.resolvedUrl("HotspotSetup.qml"), {hotspotManager: hotspotManager})
109
text : Connectivity.hotspotStored ?
110
i18n.tr("When hotspot is on, other devices can use your cellular data connection over Wi-Fi. Normal data charges apply.")
111
: i18n.tr("Other devices can use your cellular data connection over the Wi-Fi network. Normal data charges apply.")
115
id: hotspotSetupButton
116
objectName: "hotspotSetupButton"
117
anchors.horizontalCenter: parent.horizontalCenter
118
width: parent.width - units.gu(4)
119
text: Connectivity.hotspotStored ?
120
i18n.tr("Change Password/Setup…") : i18n.tr("Set Up Hotspot…")
122
setup.setSource(Qt.resolvedUrl("HotspotSetup.qml"));
123
PopupUtils.open(setup.item, root, {});
133
// As soon as Wi-Fi has been turned on, enable the hotspot.
134
function wifiUpdated (updated) {
135
Connectivity.wifiEnabledUpdated.disconnect(wifiUpdated);
136
Connectivity.hotspotEnabled = true;
137
PopupUtils.close(diag);
140
Connectivity.wifiEnabledUpdated.connect(wifiUpdated);
141
hotspotSwitch.checked = true;
142
Connectivity.wifiEnabled = true;
150
objectName: "enableWifiDialog"
151
title: i18n.tr("Wi-Fi is off")
152
text: i18n.tr("In order to create a hotspot, you need to turn Wi-Fi on.")
155
text: i18n.tr("Cancel")
156
onClicked: PopupUtils.close(dialogue)
160
objectName: "confirmEnable"
161
text: i18n.tr("Turn on Wi-Fi")
162
onClicked: enableWifiAction.trigger()
169
onHotspotEnabledUpdated: hotspotSwitch.checked = target.hotspotEnabled