Skip to content

Commit 1df70e5

Browse files
committed
fix: Processing password unedited and not visible
Processing password unedited and not visible pms: BUG-287123
1 parent 37f9657 commit 1df70e5

File tree

4 files changed

+26
-119
lines changed

4 files changed

+26
-119
lines changed

dcc-network/qml/NetPasswordEdit.qml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import QtQuick 2.15
44

55
import org.deepin.dtk 1.0 as D
66

7+
import org.deepin.dcc 1.0
8+
79
D.PasswordEdit {
810
property var dataItem
911
property bool newInput: false

dcc-network/qml/SectionPPPOE.qml

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -92,29 +92,10 @@ DccTitleObject {
9292
displayName: qsTr("Password")
9393
weight: 30
9494
pageType: DccObject.Editor
95-
page: D.PasswordEdit {
96-
property bool newInput: false
97-
placeholderText: qsTr("Required")
95+
page: NetPasswordEdit {
96+
dataItem: root
9897
text: config.hasOwnProperty("password") ? config.password : ""
99-
echoButtonVisible: newInput
100-
onTextChanged: {
101-
if (showAlert) {
102-
errorKey = ""
103-
}
104-
if (config.password !== text) {
105-
config.password = text
106-
root.editClicked()
107-
}
108-
}
109-
showAlert: errorKey === dccObj.name
110-
alertDuration: 2000
111-
onShowAlertChanged: {
112-
if (showAlert) {
113-
DccApp.showPage(dccObj)
114-
forceActiveFocus()
115-
}
116-
}
117-
Component.onCompleted: newInput = !config.hasOwnProperty("password")
98+
onTextUpdated: config.password = text
11899
}
119100
}
120101
}

dcc-network/qml/SectionVPN.qml

Lines changed: 13 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -806,26 +806,10 @@ DccTitleObject {
806806
weight: 180
807807
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")))
808808
pageType: DccObject.Editor
809-
page: D.PasswordEdit {
810-
placeholderText: qsTr("Required")
809+
page: NetPasswordEdit {
810+
dataItem: root
811811
text: secretMap.hasOwnProperty(dccObj.name) ? secretMap[dccObj.name] : ""
812-
onTextChanged: {
813-
if (showAlert) {
814-
errorKey = ""
815-
}
816-
if (secretMap[dccObj.name] !== text) {
817-
secretMap[dccObj.name] = text
818-
root.editClicked()
819-
}
820-
}
821-
showAlert: errorKey === dccObj.name
822-
alertDuration: 2000
823-
onShowAlertChanged: {
824-
if (showAlert) {
825-
DccApp.showPage(dccObj)
826-
forceActiveFocus()
827-
}
828-
}
812+
onTextUpdated: secretMap[dccObj.name] = text
829813
}
830814
}
831815
DccObject {
@@ -1086,26 +1070,10 @@ DccTitleObject {
10861070
weight: 380
10871071
visible: dataMap["Xauth password-flags"] === "0" && (vpnType & (NetUtils.VpnTypeEnum["vpnc"]))
10881072
pageType: DccObject.Editor
1089-
page: D.PasswordEdit {
1090-
placeholderText: qsTr("Required")
1073+
page: NetPasswordEdit {
1074+
dataItem: root
10911075
text: secretMap.hasOwnProperty(dccObj.name) ? secretMap[dccObj.name] : ""
1092-
onTextChanged: {
1093-
if (showAlert) {
1094-
errorKey = ""
1095-
}
1096-
if (secretMap[dccObj.name] !== text) {
1097-
secretMap[dccObj.name] = text
1098-
root.editClicked()
1099-
}
1100-
}
1101-
showAlert: errorKey === dccObj.name
1102-
alertDuration: 2000
1103-
onShowAlertChanged: {
1104-
if (showAlert) {
1105-
DccApp.showPage(dccObj)
1106-
forceActiveFocus()
1107-
}
1108-
}
1076+
onTextUpdated: secretMap[dccObj.name] = text
11091077
}
11101078
}
11111079
DccObject {
@@ -1153,26 +1121,10 @@ DccTitleObject {
11531121
weight: 410
11541122
visible: dataMap["IPSec secret-flags"] === "0" && (vpnType & (NetUtils.VpnTypeEnum["vpnc"]))
11551123
pageType: DccObject.Editor
1156-
page: D.PasswordEdit {
1157-
placeholderText: qsTr("Required")
1124+
page: NetPasswordEdit {
1125+
dataItem: root
11581126
text: secretMap.hasOwnProperty(dccObj.name) ? secretMap[dccObj.name] : ""
1159-
onTextChanged: {
1160-
if (showAlert) {
1161-
errorKey = ""
1162-
}
1163-
if (secretMap[dccObj.name] !== text) {
1164-
secretMap[dccObj.name] = text
1165-
root.editClicked()
1166-
}
1167-
}
1168-
showAlert: errorKey === dccObj.name
1169-
alertDuration: 2000
1170-
onShowAlertChanged: {
1171-
if (showAlert) {
1172-
DccApp.showPage(dccObj)
1173-
forceActiveFocus()
1174-
}
1175-
}
1127+
onTextUpdated: secretMap[dccObj.name] = text
11761128
}
11771129
}
11781130
DccObject {
@@ -2076,7 +2028,7 @@ DccTitleObject {
20762028
visible: dataMap["proxy-type"] !== "none"
20772029
pageType: DccObject.Editor
20782030
page: D.SpinBox {
2079-
value: dataMap.hasOwnProperty(dccObj.name) ? parseInt(dataMap[dccObj.name], 10) : 1300
2031+
value: dataMap.hasOwnProperty(dccObj.name) ? parseInt(dataMap[dccObj.name], 10) : 0
20802032
from: 0
20812033
to: 65535
20822034
onValueChanged: {
@@ -2115,26 +2067,10 @@ DccTitleObject {
21152067
weight: 60
21162068
visible: dataMap["proxy-type"] === "http"
21172069
pageType: DccObject.Editor
2118-
page: D.PasswordEdit {
2119-
placeholderText: qsTr("Required")
2070+
page: NetPasswordEdit {
21202071
text: secretMap.hasOwnProperty(dccObj.name) ? secretMap[dccObj.name] : ""
2121-
onTextChanged: {
2122-
if (showAlert) {
2123-
errorKey = ""
2124-
}
2125-
if (secretMap[dccObj.name] !== text) {
2126-
secretMap[dccObj.name] = text
2127-
root.editClicked()
2128-
}
2129-
}
2130-
showAlert: errorKey === dccObj.name
2131-
alertDuration: 2000
2132-
onShowAlertChanged: {
2133-
if (showAlert) {
2134-
DccApp.showPage(dccObj)
2135-
forceActiveFocus()
2136-
}
2137-
}
2072+
dataItem: root
2073+
onTextUpdated: secretMap[dccObj.name] = text
21382074
}
21392075
}
21402076
}

dcc-network/qml/SystemProxyConfigItem.qml

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,21 @@ DccObject {
1616
property var config: null
1717
property bool hasAuth: config.auth
1818
property bool userAlert: false
19-
property bool passwordAlert: false
2019
property bool hasUrl: false
2120

21+
property string errorKey: ""
22+
signal editClicked
23+
2224
function checkInput() {
25+
errorKey = ""
2326
if (hasAuth) {
2427
userAlert = false
2528
if (!config.user || config.user.lenght === 0) {
2629
userAlert = true
2730
return false
2831
}
29-
passwordAlert = false
3032
if (!config.password || config.password.lenght === 0) {
31-
passwordAlert = true
33+
errorKey = "password"
3234
return false
3335
}
3436
}
@@ -128,24 +130,10 @@ DccObject {
128130
visible: hasAuth
129131
weight: 50
130132
pageType: DccObject.Editor
131-
page: D.PasswordEdit {
132-
topInset: 4
133-
bottomInset: 4
133+
page: NetPasswordEdit {
134+
dataItem: root
134135
text: config.password
135-
placeholderText: qsTr("Required")
136-
showAlert: passwordAlert
137-
onTextChanged: {
138-
passwordAlert = false
139-
if (config.password !== text) {
140-
config.password = text
141-
}
142-
}
143-
onShowAlertChanged: {
144-
if (showAlert) {
145-
DccApp.showPage(dccObj)
146-
forceActiveFocus()
147-
}
148-
}
136+
onTextUpdated: config.password = text
149137
}
150138
}
151139
}

0 commit comments

Comments
 (0)