Skip to content

Commit a18e1a4

Browse files
ut003640deepin-bot[bot]
authored andcommitted
feat: add portal address detection prompt in Control Center
according to user feedback, add a prompt to open the portal web page in the Control Center network connection section. Log: add portal address detection prompt in Control Center Influence: Control Center - portal network PMS: STORY-36815 feat: 控制中心增加portal地址检测提示 根据用户反馈,在控制中心连接网络中增加打开portal网页的提示 Log: 控制中心增加portal地址检测提示 Influence: 控制中心-portal网络
1 parent 78424ce commit a18e1a4

File tree

5 files changed

+290
-165
lines changed

5 files changed

+290
-165
lines changed

dcc-network/qml/PageWiredDevice.qml

Lines changed: 140 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2024 - 2027 UnionTech Software Technology Co., Ltd.
1+
// SPDX-FileCopyrightText: 2024 - 2026 UnionTech Software Technology Co., Ltd.
22
// SPDX-License-Identifier: GPL-3.0-or-later
33
import QtQuick 2.15
44
import QtQuick.Controls 2.15
@@ -105,107 +105,164 @@ DccObject {
105105
height: 16
106106
width: 16
107107
}
108-
content: RowLayout {
109-
spacing: 10
110-
BusyIndicator {
111-
running: model.item.status === NetType.CS_Connecting
112-
visible: running
113-
}
114-
DccCheckIcon {
115-
visible: model.item.status === NetType.CS_Connected && !itemDelegate.hovered
116-
}
117-
NetButton {
118-
implicitHeight: implicitContentHeight - 4
119-
topInset: -4
120-
bottomInset: -4
121-
visible: model.item.status !== NetType.CS_Connecting && itemDelegate.hovered
122-
text: model.item.status === NetType.CS_Connected ? qsTr("Disconnect") : qsTr("Connect")
123-
Layout.alignment: Qt.AlignVCenter
124-
onClicked: {
125-
dccData.exec(model.item.status === NetType.CS_Connected ? NetManager.Disconnect : NetManager.ConnectOrInfo, model.item.id, {})
108+
contentItem: ColumnLayout {
109+
RowLayout {
110+
spacing: 10
111+
D.IconLabel {
112+
Layout.fillWidth: true
113+
spacing: itemDelegate.spacing
114+
mirrored: itemDelegate.mirrored
115+
display: itemDelegate.display
116+
alignment: itemDelegate.display === D.IconLabel.IconOnly
117+
|| itemDelegate.display === D.IconLabel.TextUnderIcon ? Qt.AlignCenter : Qt.AlignLeft | Qt.AlignVCenter
118+
text: itemDelegate.text
119+
font: itemDelegate.font
120+
color: itemDelegate.palette.windowText
121+
icon: D.DTK.makeIcon(
122+
itemDelegate.icon,
123+
itemDelegate.D.DciIcon)
124+
}
125+
BusyIndicator {
126+
running: model.item.status === NetType.CS_Connecting
127+
visible: running
128+
}
129+
DccCheckIcon {
130+
visible: model.item.status === NetType.CS_Connected
131+
&& !itemDelegate.hovered
132+
}
133+
NetButton {
134+
implicitHeight: implicitContentHeight - 4
135+
topInset: -4
136+
bottomInset: -4
137+
visible: model.item.status !== NetType.CS_Connecting
138+
&& itemDelegate.hovered
139+
text: model.item.status
140+
=== NetType.CS_Connected ? qsTr("Disconnect") : qsTr(
141+
"Connect")
142+
Layout.alignment: Qt.AlignVCenter
143+
onClicked: {
144+
dccData.exec(model.item.status === NetType.CS_Connected ? NetManager.Disconnect : NetManager.ConnectOrInfo,
145+
model.item.id, {})
146+
}
126147
}
127-
}
128148

129-
// 箭头悬浮效果 - 右侧圆角(包含分割线)
130-
Item {
131-
width: 30 // 20px悬浮区域 + 10px扩展到边缘
132-
height: 40 // 填满ItemDelegate高度
149+
// 箭头悬浮效果 - 右侧圆角(包含分割线)
150+
Item {
151+
width: 30 // 20px悬浮区域 + 10px扩展到边缘
152+
height: 40 // 填满ItemDelegate高度
133153

134-
Canvas {
135-
id: hoverCanvas
136-
anchors.fill: parent
137-
property color bgColor: "transparent"
154+
Canvas {
155+
id: hoverCanvas
156+
anchors.fill: parent
157+
property color bgColor: "transparent"
138158

139-
onPaint: {
140-
var ctx = getContext("2d")
141-
ctx.clearRect(0, 0, width, height)
159+
onPaint: {
160+
var ctx = getContext("2d")
161+
ctx.clearRect(0, 0,
162+
width, height)
142163

143-
if (bgColor.a > 0) {
144-
ctx.fillStyle = bgColor
145-
ctx.beginPath()
164+
if (bgColor.a > 0) {
165+
ctx.fillStyle = bgColor
166+
ctx.beginPath()
146167

147-
// 绘制右侧圆角的矩形
148-
ctx.moveTo(0, 0) // 左上角
149-
ctx.lineTo(width - 6, 0) // 右上角前
150-
ctx.arcTo(width, 0, width, 6, 6) // 右上圆角
151-
ctx.lineTo(width, height - 6) // 右下角前
152-
ctx.arcTo(width, height, width - 6, height, 6) // 右下圆角
153-
ctx.lineTo(0, height) // 左下角
154-
ctx.lineTo(0, 0) // 回到左上角
168+
// 绘制右侧圆角的矩形
169+
ctx.moveTo(0, 0) // 左上角
170+
ctx.lineTo(width - 6,
171+
0) // 右上角前
172+
ctx.arcTo(width, 0, width,
173+
6, 6) // 右上圆角
174+
ctx.lineTo(width,
175+
height - 6) // 右下角前
176+
ctx.arcTo(width, height,
177+
width - 6,
178+
height, 6) // 右下圆角
179+
ctx.lineTo(0, height) // 左下角
180+
ctx.lineTo(0, 0) // 回到左上角
155181

156-
ctx.fill()
182+
ctx.fill()
183+
}
157184
}
158-
}
159-
160-
onBgColorChanged: requestPaint()
161-
}
162-
163-
// 分割线 - 一直显示
164-
Rectangle {
165-
width: 1
166-
height: 20
167-
anchors.left: parent.left
168-
anchors.leftMargin: 0 // 在悬浮区域最左边
169-
anchors.verticalCenter: parent.verticalCenter
170-
color: palette.windowText
171-
opacity: 0.05
172-
}
173185

174-
D.IconLabel {
175-
anchors.centerIn: parent
176-
icon {
177-
name: "arrow_ordinary_right"
178-
palette: D.DTK.makeIconPalette(palette)
186+
onBgColorChanged: requestPaint()
179187
}
180-
}
181-
182-
MouseArea {
183-
anchors.fill: parent
184-
hoverEnabled: true
185-
acceptedButtons: Qt.LeftButton
186188

187-
onClicked: {
188-
dccData.exec(NetManager.ConnectInfo, model.item.id, {})
189+
// 分割线 - 一直显示
190+
Rectangle {
191+
width: 1
192+
height: 20
193+
anchors.left: parent.left
194+
anchors.leftMargin: 0 // 在悬浮区域最左边
195+
anchors.verticalCenter: parent.verticalCenter
196+
color: palette.windowText
197+
opacity: 0.05
189198
}
190199

191-
onEntered: {
192-
hoverCanvas.bgColor = Qt.rgba(palette.windowText.r, palette.windowText.g, palette.windowText.b, 0.1)
200+
D.IconLabel {
201+
anchors.centerIn: parent
202+
icon {
203+
name: "arrow_ordinary_right"
204+
palette: D.DTK.makeIconPalette(
205+
palette)
206+
}
193207
}
194208

195-
onExited: {
196-
hoverCanvas.bgColor = "transparent"
197-
}
209+
MouseArea {
210+
anchors.fill: parent
211+
hoverEnabled: true
212+
acceptedButtons: Qt.LeftButton
198213

199-
onPressed: {
200-
hoverCanvas.bgColor = Qt.rgba(palette.windowText.r, palette.windowText.g, palette.windowText.b, 0.2)
201-
}
214+
onClicked: {
215+
dccData.exec(NetManager.ConnectInfo,
216+
model.item.id, {})
217+
}
202218

203-
onReleased: {
204-
if (containsMouse) {
205-
hoverCanvas.bgColor = Qt.rgba(palette.windowText.r, palette.windowText.g, palette.windowText.b, 0.1)
206-
} else {
219+
onEntered: {
220+
hoverCanvas.bgColor = Qt.rgba(
221+
palette.windowText.r,
222+
palette.windowText.g,
223+
palette.windowText.b,
224+
0.1)
225+
}
226+
227+
onExited: {
207228
hoverCanvas.bgColor = "transparent"
208229
}
230+
231+
onPressed: {
232+
hoverCanvas.bgColor = Qt.rgba(
233+
palette.windowText.r,
234+
palette.windowText.g,
235+
palette.windowText.b,
236+
0.2)
237+
}
238+
239+
onReleased: {
240+
if (containsMouse) {
241+
hoverCanvas.bgColor = Qt.rgba(
242+
palette.windowText.r,
243+
palette.windowText.g,
244+
palette.windowText.b,
245+
0.1)
246+
} else {
247+
hoverCanvas.bgColor = "transparent"
248+
}
249+
}
250+
}
251+
}
252+
}
253+
D.Label {
254+
Layout.leftMargin: 25
255+
textFormat: Text.RichText
256+
visible: model.item.portalUrl.length > 0
257+
text:qsTr("Open a browser to authenticate")
258+
color: D.DTK.platformTheme.activeColor
259+
MouseArea {
260+
anchors.fill: parent
261+
acceptedButtons: Qt.LeftButton
262+
hoverEnabled: true
263+
cursorShape: Qt.PointingHandCursor
264+
onClicked: function(mouse) {
265+
dccData.exec(NetManager.OpenUrl, model.item.id, {"url": model.item.portalUrl})
209266
}
210267
}
211268
}

0 commit comments

Comments
 (0)