Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions dcc-network/qml/NetPasswordEdit.qml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import QtQuick 2.15

import org.deepin.dtk 1.0 as D

import org.deepin.dcc 1.0

D.PasswordEdit {
property var dataItem
property bool newInput: false
Expand Down
25 changes: 3 additions & 22 deletions dcc-network/qml/SectionPPPOE.qml
Original file line number Diff line number Diff line change
Expand Up @@ -92,29 +92,10 @@ DccTitleObject {
displayName: qsTr("Password")
weight: 30
pageType: DccObject.Editor
page: D.PasswordEdit {
property bool newInput: false
placeholderText: qsTr("Required")
page: NetPasswordEdit {
dataItem: root
text: config.hasOwnProperty("password") ? config.password : ""
echoButtonVisible: newInput
onTextChanged: {
if (showAlert) {
errorKey = ""
}
if (config.password !== text) {
config.password = text
root.editClicked()
}
}
showAlert: errorKey === dccObj.name
alertDuration: 2000
onShowAlertChanged: {
if (showAlert) {
DccApp.showPage(dccObj)
forceActiveFocus()
}
}
Component.onCompleted: newInput = !config.hasOwnProperty("password")
onTextUpdated: config.password = text
}
}
}
Expand Down
90 changes: 13 additions & 77 deletions dcc-network/qml/SectionVPN.qml
Original file line number Diff line number Diff line change
Expand Up @@ -806,26 +806,10 @@ DccTitleObject {
weight: 180
visible: ((vpnType & NetUtils.VpnTypeEnum["strongswan"]) && (dataMap["method"] === "eap" || dataMap["method"] === "psk")) || (dataMap["password-flags"] === "0" && ((vpnType & (NetUtils.VpnTypeEnum["l2tp"] | NetUtils.VpnTypeEnum["pptp"])) || (vpnType & (NetUtils.VpnTypeEnum["openvpn"])) && (dataMap["connection-type"] === "password" || dataMap["connection-type"] === "password-tls")))
pageType: DccObject.Editor
page: D.PasswordEdit {
placeholderText: qsTr("Required")
page: NetPasswordEdit {
dataItem: root
text: secretMap.hasOwnProperty(dccObj.name) ? secretMap[dccObj.name] : ""
onTextChanged: {
if (showAlert) {
errorKey = ""
}
if (secretMap[dccObj.name] !== text) {
secretMap[dccObj.name] = text
root.editClicked()
}
}
showAlert: errorKey === dccObj.name
alertDuration: 2000
onShowAlertChanged: {
if (showAlert) {
DccApp.showPage(dccObj)
forceActiveFocus()
}
}
onTextUpdated: secretMap[dccObj.name] = text
}
}
DccObject {
Expand Down Expand Up @@ -1086,26 +1070,10 @@ DccTitleObject {
weight: 380
visible: dataMap["Xauth password-flags"] === "0" && (vpnType & (NetUtils.VpnTypeEnum["vpnc"]))
pageType: DccObject.Editor
page: D.PasswordEdit {
placeholderText: qsTr("Required")
page: NetPasswordEdit {
dataItem: root
text: secretMap.hasOwnProperty(dccObj.name) ? secretMap[dccObj.name] : ""
onTextChanged: {
if (showAlert) {
errorKey = ""
}
if (secretMap[dccObj.name] !== text) {
secretMap[dccObj.name] = text
root.editClicked()
}
}
showAlert: errorKey === dccObj.name
alertDuration: 2000
onShowAlertChanged: {
if (showAlert) {
DccApp.showPage(dccObj)
forceActiveFocus()
}
}
onTextUpdated: secretMap[dccObj.name] = text
}
}
DccObject {
Expand Down Expand Up @@ -1153,26 +1121,10 @@ DccTitleObject {
weight: 410
visible: dataMap["IPSec secret-flags"] === "0" && (vpnType & (NetUtils.VpnTypeEnum["vpnc"]))
pageType: DccObject.Editor
page: D.PasswordEdit {
placeholderText: qsTr("Required")
page: NetPasswordEdit {
dataItem: root
text: secretMap.hasOwnProperty(dccObj.name) ? secretMap[dccObj.name] : ""
onTextChanged: {
if (showAlert) {
errorKey = ""
}
if (secretMap[dccObj.name] !== text) {
secretMap[dccObj.name] = text
root.editClicked()
}
}
showAlert: errorKey === dccObj.name
alertDuration: 2000
onShowAlertChanged: {
if (showAlert) {
DccApp.showPage(dccObj)
forceActiveFocus()
}
}
onTextUpdated: secretMap[dccObj.name] = text
}
}
DccObject {
Expand Down Expand Up @@ -2076,7 +2028,7 @@ DccTitleObject {
visible: dataMap["proxy-type"] !== "none"
pageType: DccObject.Editor
page: D.SpinBox {
value: dataMap.hasOwnProperty(dccObj.name) ? parseInt(dataMap[dccObj.name], 10) : 1300
value: dataMap.hasOwnProperty(dccObj.name) ? parseInt(dataMap[dccObj.name], 10) : 0
from: 0
to: 65535
onValueChanged: {
Expand Down Expand Up @@ -2115,26 +2067,10 @@ DccTitleObject {
weight: 60
visible: dataMap["proxy-type"] === "http"
pageType: DccObject.Editor
page: D.PasswordEdit {
placeholderText: qsTr("Required")
page: NetPasswordEdit {
text: secretMap.hasOwnProperty(dccObj.name) ? secretMap[dccObj.name] : ""
onTextChanged: {
if (showAlert) {
errorKey = ""
}
if (secretMap[dccObj.name] !== text) {
secretMap[dccObj.name] = text
root.editClicked()
}
}
showAlert: errorKey === dccObj.name
alertDuration: 2000
onShowAlertChanged: {
if (showAlert) {
DccApp.showPage(dccObj)
forceActiveFocus()
}
}
dataItem: root
onTextUpdated: secretMap[dccObj.name] = text
}
}
}
Expand Down
42 changes: 15 additions & 27 deletions dcc-network/qml/SystemProxyConfigItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ DccObject {
id: root
property var config: null
property bool hasAuth: config.auth
property bool userAlert: false
property bool passwordAlert: false
property bool hasUrl: false

property string errorKey: ""
signal editClicked

function checkInput() {
errorKey = ""
if (hasAuth) {
userAlert = false
if (!config.user || config.user.lenght === 0) {
userAlert = true
if (!config.user || config.user.length === 0) {
errorKey = "user"
return false
}
passwordAlert = false
if (!config.password || config.password.lenght === 0) {
passwordAlert = true
if (!config.password || config.password.length === 0) {
errorKey = "password"
return false
}
}
Expand Down Expand Up @@ -106,9 +106,11 @@ DccObject {
bottomInset: 4
text: config.user
placeholderText: qsTr("Required")
showAlert: userAlert
showAlert: errorKey === dccObj.name
onTextChanged: {
userAlert = false
if (showAlert) {
errorKey = ""
}
if (config.user !== text) {
config.user = text
}
Expand All @@ -128,24 +130,10 @@ DccObject {
visible: hasAuth
weight: 50
pageType: DccObject.Editor
page: D.PasswordEdit {
topInset: 4
bottomInset: 4
page: NetPasswordEdit {
dataItem: root
text: config.password
placeholderText: qsTr("Required")
showAlert: passwordAlert
onTextChanged: {
passwordAlert = false
if (config.password !== text) {
config.password = text
}
}
onShowAlertChanged: {
if (showAlert) {
DccApp.showPage(dccObj)
forceActiveFocus()
}
}
onTextUpdated: config.password = text
}
}
}
Loading