Skip to content

Commit 7f3e167

Browse files
committed
fix: Personal hotspot status when modifying airplane mode
Personal hotspot status when modifying airplane mode pms: BUG-303529
1 parent 61fa502 commit 7f3e167

5 files changed

Lines changed: 52 additions & 30 deletions

File tree

dcc-network/qml/PageAirplane.qml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,19 @@ DccObject {
2424
page: devCheck
2525
Component {
2626
id: devCheck
27-
D.Switch {
28-
checked: item.isEnabled
29-
enabled: item.enabledable
30-
onClicked: {
31-
dccData.exec(NetManager.SetConnectInfo, item.id, {
32-
"enable": checked
33-
})
27+
Item {
28+
implicitHeight: switchControl.implicitHeight
29+
implicitWidth: switchControl.implicitWidth
30+
D.Switch {
31+
id: switchControl
32+
anchors.fill: parent
33+
checked: item.isEnabled
34+
enabled: item.enabledable
35+
onClicked: {
36+
dccData.exec(NetManager.SetConnectInfo, item.id, {
37+
"enable": checked
38+
})
39+
}
3440
}
3541
}
3642
}

dcc-network/qml/PageHotspot.qml

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ DccObject {
1717
property var item: null
1818
property var airplaneItem: null
1919
property var config: null
20+
property bool isAirplane: false
2021
property string interfaceName: ""
2122

2223
function setItem(netItem) {
@@ -87,22 +88,28 @@ DccObject {
8788
page: devCheck
8889
Component {
8990
id: devCheck
90-
D.Switch {
91-
checked: item.isEnabled
92-
enabled: item.enabledable
93-
onClicked: {
94-
if (checked) {
95-
if (config["connection"]["uuid"] === "{00000000-0000-0000-0000-000000000000}") {
96-
dccData.exec(NetManager.SetConnectInfo, item.id, config)
91+
Item {
92+
implicitHeight: switchControl.implicitHeight
93+
implicitWidth: switchControl.implicitWidth
94+
D.Switch {
95+
id: switchControl
96+
anchors.fill: parent
97+
checked: item.isEnabled
98+
enabled: item.enabledable && !isAirplane
99+
onClicked: {
100+
if (checked) {
101+
if (config["connection"]["uuid"] === "{00000000-0000-0000-0000-000000000000}") {
102+
dccData.exec(NetManager.SetConnectInfo, item.id, config)
103+
} else {
104+
dccData.exec(NetManager.Connect, item.id, {
105+
"uuid": config["connection"]["uuid"]
106+
})
107+
}
97108
} else {
98-
dccData.exec(NetManager.Connect, item.id, {
109+
dccData.exec(NetManager.Disconnect, item.id, {
99110
"uuid": config["connection"]["uuid"]
100111
})
101112
}
102-
} else {
103-
dccData.exec(NetManager.Disconnect, item.id, {
104-
"uuid": config["connection"]["uuid"]
105-
})
106113
}
107114
}
108115
}
@@ -132,6 +139,7 @@ DccObject {
132139
name: "hotspotTitle"
133140
parentName: root.name + "/menu"
134141
weight: 20
142+
visible: !isAirplane
135143
displayName: qsTr("My Hotspot")
136144
pageType: DccObject.Item
137145
page: RowLayout {
@@ -342,6 +350,7 @@ DccObject {
342350
name: "hotspotConfig"
343351
parentName: root.name + "/menu"
344352
weight: 30
353+
visible: !isAirplane
345354
pageType: DccObject.Item
346355
page: DccGroupView {}
347356
DccObject {
@@ -413,13 +422,15 @@ DccObject {
413422
DccTitleObject {
414423
name: "shareTitle"
415424
parentName: root.name + "/menu"
425+
visible: !isAirplane
416426
weight: 40
417427
displayName: qsTr("Shared Settings")
418428
}
419429
DccObject {
420430
id: shareConfig
421431
name: "shareConfig"
422432
parentName: root.name + "/menu"
433+
visible: !isAirplane
423434
weight: 50
424435
pageType: DccObject.Item
425436
page: DccGroupView {}
@@ -487,7 +498,7 @@ DccObject {
487498
DccObject {
488499
name: "airplaneTips"
489500
parentName: root.name + "/menu"
490-
visible: root.airplaneItem && root.airplaneItem.isEnabled && root.airplaneItem.enabledable
501+
visible: isAirplane
491502
displayName: qsTr("If you want to use the personal hotspot, disable Airplane Mode first and then enable the wireless network adapter.")
492503
weight: 70
493504
pageType: DccObject.Item

dcc-network/qml/PageWiredDevice.qml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@ DccObject {
2727

2828
Component {
2929
id: devCheck
30-
D.Switch {
31-
checked: item.isEnabled
32-
enabled: item.enabledable
33-
onClicked: {
34-
dccData.exec(item.isEnabled ? NetManager.DisabledDevice : NetManager.EnabledDevice, item.id, {})
30+
RowLayout {
31+
D.Switch {
32+
checked: item.isEnabled
33+
enabled: item.enabledable
34+
onClicked: {
35+
dccData.exec(item.isEnabled ? NetManager.DisabledDevice : NetManager.EnabledDevice, item.id, {})
36+
}
3537
}
3638
}
3739
}

dcc-network/qml/PageWirelessDevice.qml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@ DccObject {
2929

3030
Component {
3131
id: devCheck
32-
D.Switch {
33-
checked: root.item.isEnabled
34-
enabled: root.item.enabledable
35-
onClicked: {
36-
dccData.exec(root.item.isEnabled ? NetManager.DisabledDevice : NetManager.EnabledDevice, root.item.id, {})
32+
RowLayout {
33+
D.Switch {
34+
checked: root.item.isEnabled
35+
enabled: root.item.enabledable
36+
onClicked: {
37+
dccData.exec(root.item.isEnabled ? NetManager.DisabledDevice : NetManager.EnabledDevice, root.item.id, {})
38+
}
3739
}
3840
}
3941
}

dcc-network/qml/networkMain.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ DccObject {
138138
property var showPage: root.showPage
139139
name: "personalHotspot"
140140
parentName: "network"
141+
isAirplane: dccData.root.isEnabled
141142
weight: 3040
142143
}
143144
PageAirplane {

0 commit comments

Comments
 (0)