Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions dcc-network/qml/PageHotspot.qml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ DccObject {
property var config: null
property bool isAirplane: false
property string interfaceName: ""
enum Status {
Disabling,
Enabling,
Disabled,
Enabled
}
property int hotspotStatus: (netItem && netItem.isEnabled) ? PageHotspot.Status.Enabled : PageHotspot.Status.Disabled

function setNetItem(item) {
if (netItem !== item) {
Expand Down Expand Up @@ -95,10 +102,11 @@ DccObject {
D.Switch {
id: switchControl
anchors.fill: parent
checked: netItem.isEnabled
enabled: netItem.enabledable && !isAirplane && netItem.deviceEnabled
checked: root.hotspotStatus === PageHotspot.Status.Enabled || root.hotspotStatus === PageHotspot.Status.Enabling
enabled: netItem.enabledable && !isAirplane && netItem.deviceEnabled && root.hotspotStatus !== PageHotspot.Status.Enabling && root.hotspotStatus !== PageHotspot.Status.Disabling
onClicked: {
if (checked) {
root.hotspotStatus = PageHotspot.Status.Enabling
if (config["connection"]["uuid"] === "{00000000-0000-0000-0000-000000000000}") {
dccData.exec(NetManager.SetConnectInfo, netItem.id, config)
} else {
Expand All @@ -107,6 +115,7 @@ DccObject {
})
}
} else {
root.hotspotStatus = PageHotspot.Status.Disabling
dccData.exec(NetManager.Disconnect, netItem.id, {
"uuid": config["connection"]["uuid"]
})
Expand All @@ -121,6 +130,9 @@ DccObject {
root.config = config
updateDevModel()
}
function onIsEnabledChanged() {
root.hotspotStatus = netItem.isEnabled ? PageHotspot.Status.Enabled : PageHotspot.Status.Disabled
}
}

DccObject {
Expand Down
Loading