2022-03-07 20:34:59 +00:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Controls 2.3
|
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Controls.Validators 0.1
|
|
|
|
import StatusQ.Popups 0.1
|
|
|
|
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
StatusModal {
|
|
|
|
id: popup
|
|
|
|
|
|
|
|
anchors.centerIn: parent
|
|
|
|
height: 560
|
|
|
|
header.title: qsTr("Waku nodes")
|
|
|
|
|
|
|
|
property var messagingStore
|
|
|
|
|
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
|
|
|
|
|
|
|
onOpened: {
|
|
|
|
nameInput.text = "";
|
|
|
|
enodeInput.text = "";
|
|
|
|
}
|
|
|
|
|
|
|
|
contentItem: Item {
|
|
|
|
width: parent.width
|
|
|
|
height: parent.height
|
|
|
|
|
|
|
|
StatusInput {
|
|
|
|
id: nameInput
|
2022-04-04 11:26:30 +00:00
|
|
|
label: qsTr("Name")
|
|
|
|
input.placeholderText: qsTr("Specify a name")
|
2022-03-07 20:34:59 +00:00
|
|
|
validators: [StatusMinLengthValidator {
|
|
|
|
minLength: 1
|
2022-04-04 11:26:30 +00:00
|
|
|
errorMessage: qsTr("You need to enter a name")
|
2022-03-07 20:34:59 +00:00
|
|
|
}]
|
|
|
|
validationMode: StatusInput.ValidationMode.OnlyWhenDirty
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusInput {
|
|
|
|
id: enodeInput
|
2022-04-04 11:26:30 +00:00
|
|
|
label: qsTr("History node address")
|
2022-03-07 20:34:59 +00:00
|
|
|
input.placeholderText: "enode://{enode-id}:{password}@{ip-address}:{port-number}"
|
|
|
|
validators: [StatusMinLengthValidator {
|
|
|
|
minLength: 1
|
2022-04-04 11:26:30 +00:00
|
|
|
errorMessage: qsTr("You need to enter the enode address")
|
2022-03-07 20:34:59 +00:00
|
|
|
},
|
|
|
|
StatusRegularExpressionValidator {
|
|
|
|
errorMessage: qsTr("The format must be: enode://{enode-id}:{password}@{ip-address}:{port}")
|
|
|
|
regularExpression: /enode:\/\/[a-z0-9]+:[a-z0-9]+@(\b25[0-5]|\b2[0-4][0-9]|\b[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}:[0-9]+/
|
|
|
|
}]
|
|
|
|
validationMode: StatusInput.ValidationMode.OnlyWhenDirty
|
|
|
|
anchors.top: nameInput.bottom
|
|
|
|
anchors.topMargin: Style.current.bigPadding
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rightButtons: [
|
|
|
|
StatusButton {
|
2022-04-04 11:26:30 +00:00
|
|
|
text: qsTr("Save")
|
2022-03-07 20:34:59 +00:00
|
|
|
enabled: nameInput.valid && enodeInput.valid
|
|
|
|
// enabled: nameInput.text !== "" && enodeInput.text !== ""
|
|
|
|
onClicked: {
|
|
|
|
root.messagingStore.saveNewMailserver(nameInput.text, enodeInput.text)
|
|
|
|
popup.close()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|