fixed double call onEditingFinished when pressing Enter

This commit is contained in:
vladimir.kuznetsov 2023-01-14 18:30:08 +03:00
parent f24df9fb05
commit bee42ea2fb
3 changed files with 25 additions and 6 deletions

View file

@ -35,6 +35,7 @@ void ClientManagementLogic::onUpdatePage()
if (error != ErrorCode::NoError) { if (error != ErrorCode::NoError) {
QMessageBox::warning(nullptr, APPLICATION_NAME, QMessageBox::warning(nullptr, APPLICATION_NAME,
tr("An error occurred while getting the list of clients.") + "\n" + errorString(error)); tr("An error occurred while getting the list of clients.") + "\n" + errorString(error));
set_busyIndicatorIsRunning(false);
return; return;
} }
} }

View file

@ -9,10 +9,10 @@ import "../../Config"
PageClientInfoBase { PageClientInfoBase {
id: root id: root
protocol: ProtocolEnum.OpenVpn protocol: ProtocolEnum.OpenVpn
enabled: !ClientInfoLogic.busyIndicatorIsRunning
BackButton { BackButton {
id: back id: back
enabled: !ClientInfoLogic.busyIndicatorIsRunning
} }
Caption { Caption {
@ -50,6 +50,7 @@ PageClientInfoBase {
anchors.right: parent.right anchors.right: parent.right
LabelType { LabelType {
enabled: !ClientInfoLogic.busyIndicatorIsRunning
Layout.fillWidth: true Layout.fillWidth: true
font.pixelSize: 20 font.pixelSize: 20
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
@ -57,39 +58,47 @@ PageClientInfoBase {
} }
LabelType { LabelType {
enabled: !ClientInfoLogic.busyIndicatorIsRunning
height: 21 height: 21
text: qsTr("Client name") text: qsTr("Client name")
} }
TextFieldType { TextFieldType {
enabled: !ClientInfoLogic.busyIndicatorIsRunning
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: 31 Layout.preferredHeight: 31
text: ClientInfoLogic.lineEditNameAliasText text: ClientInfoLogic.lineEditNameAliasText
onEditingFinished: { onEditingFinished: {
ClientInfoLogic.lineEditNameAliasText = text if (text !== ClientInfoLogic.lineEditNameAliasText) {
ClientInfoLogic.onLineEditNameAliasEditingFinished() ClientInfoLogic.lineEditNameAliasText = text
ClientInfoLogic.onLineEditNameAliasEditingFinished()
}
} }
} }
LabelType { LabelType {
enabled: !ClientInfoLogic.busyIndicatorIsRunning
Layout.topMargin: 20 Layout.topMargin: 20
height: 21 height: 21
text: qsTr("Certificate id") text: qsTr("Certificate id")
} }
LabelType { LabelType {
enabled: !ClientInfoLogic.busyIndicatorIsRunning
Layout.fillWidth: true Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: ClientInfoLogic.labelOpenVpnCertId text: ClientInfoLogic.labelOpenVpnCertId
} }
LabelType { LabelType {
enabled: !ClientInfoLogic.busyIndicatorIsRunning
Layout.topMargin: 20 Layout.topMargin: 20
height: 21 height: 21
text: qsTr("Certificate") text: qsTr("Certificate")
} }
TextAreaType { TextAreaType {
enabled: !ClientInfoLogic.busyIndicatorIsRunning
Layout.preferredHeight: 200 Layout.preferredHeight: 200
Layout.fillWidth: true Layout.fillWidth: true
@ -100,6 +109,7 @@ PageClientInfoBase {
} }
BlueButtonType { BlueButtonType {
enabled: !ClientInfoLogic.busyIndicatorIsRunning
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: 41 Layout.preferredHeight: 41
text: qsTr("Revoke Certificate") text: qsTr("Revoke Certificate")

View file

@ -9,10 +9,10 @@ import "../../Config"
PageClientInfoBase { PageClientInfoBase {
id: root id: root
protocol: ProtocolEnum.WireGuard protocol: ProtocolEnum.WireGuard
enabled: !ClientInfoLogic.busyIndicatorIsRunning
BackButton { BackButton {
id: back id: back
enabled: !ClientInfoLogic.busyIndicatorIsRunning
} }
Caption { Caption {
@ -50,6 +50,7 @@ PageClientInfoBase {
anchors.right: parent.right anchors.right: parent.right
LabelType { LabelType {
enabled: !ClientInfoLogic.busyIndicatorIsRunning
Layout.fillWidth: true Layout.fillWidth: true
font.pixelSize: 20 font.pixelSize: 20
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
@ -57,27 +58,33 @@ PageClientInfoBase {
} }
LabelType { LabelType {
enabled: !ClientInfoLogic.busyIndicatorIsRunning
height: 21 height: 21
text: qsTr("Client name") text: qsTr("Client name")
} }
TextFieldType { TextFieldType {
enabled: !ClientInfoLogic.busyIndicatorIsRunning
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: 31 Layout.preferredHeight: 31
text: ClientInfoLogic.lineEditNameAliasText text: ClientInfoLogic.lineEditNameAliasText
onEditingFinished: { onEditingFinished: {
ClientInfoLogic.lineEditNameAliasText = text if (text !== ClientInfoLogic.lineEditNameAliasText) {
ClientInfoLogic.onLineEditNameAliasEditingFinished() ClientInfoLogic.lineEditNameAliasText = text
ClientInfoLogic.onLineEditNameAliasEditingFinished()
}
} }
} }
LabelType { LabelType {
enabled: !ClientInfoLogic.busyIndicatorIsRunning
Layout.topMargin: 20 Layout.topMargin: 20
height: 21 height: 21
text: qsTr("Public Key") text: qsTr("Public Key")
} }
TextAreaType { TextAreaType {
enabled: !ClientInfoLogic.busyIndicatorIsRunning
Layout.preferredHeight: 200 Layout.preferredHeight: 200
Layout.fillWidth: true Layout.fillWidth: true
@ -88,6 +95,7 @@ PageClientInfoBase {
} }
BlueButtonType { BlueButtonType {
enabled: !ClientInfoLogic.busyIndicatorIsRunning
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: 41 Layout.preferredHeight: 41
text: qsTr("Revoke Key") text: qsTr("Revoke Key")