aboutsummaryrefslogtreecommitdiff
path: root/components/RemoteNodeEdit.qml
diff options
context:
space:
mode:
authorxiphon <xiphon@protonmail.com>2020-07-02 13:29:27 +0000
committerxiphon <xiphon@protonmail.com>2020-07-02 13:39:56 +0000
commitfead82b1984dcf0a5ec69d861f858cd226c54fde (patch)
tree841eefb60ddec104df0fb1bd8e6c3478877fdcc0 /components/RemoteNodeEdit.qml
parente1e862bce49467e0cafb18c837eeecb7fd505bb4 (diff)
downloadmonzero-gui-fead82b1984dcf0a5ec69d861f858cd226c54fde.tar.gz
monzero-gui-fead82b1984dcf0a5ec69d861f858cd226c54fde.tar.xz
monzero-gui-fead82b1984dcf0a5ec69d861f858cd226c54fde.zip
RemoteNodeEdit: initialAddress, add square brackets on ipv6 input
Diffstat (limited to 'components/RemoteNodeEdit.qml')
-rw-r--r--components/RemoteNodeEdit.qml13
1 files changed, 12 insertions, 1 deletions
diff --git a/components/RemoteNodeEdit.qml b/components/RemoteNodeEdit.qml
index e6076823..6dcd617b 100644
--- a/components/RemoteNodeEdit.qml
+++ b/components/RemoteNodeEdit.qml
@@ -43,6 +43,9 @@ GridLayout {
property alias daemonAddrLabelText: daemonAddr.labelText
property alias daemonPortLabelText: daemonPort.labelText
+ property string initialAddress: ""
+ property var initialHostPort: initialAddress.match(/^(.*?)(?:\:?(\d*))$/)
+
// TODO: LEGACY; remove these placeHolder variables when
// the wizards get redesigned to the black-theme
property string placeholderFontFamily: MoneroComponents.Style.fontRegular.name
@@ -58,6 +61,9 @@ GridLayout {
property bool lineEditFontBold: false
property int lineEditFontSize: 15
+ // Author: David M. Syzdek https://github.com/syzdek https://gist.github.com/syzdek/6086792
+ readonly property var ipv6Regex: /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe08:(:[0-9a-fA-F]{1,4}){2,2}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/
+
signal editingFinished()
signal textChanged()
@@ -91,8 +97,12 @@ GridLayout {
fontColor: lineEditFontColor
fontBold: lineEditFontBold
fontSize: lineEditFontSize
- onEditingFinished: root.editingFinished()
+ onEditingFinished: {
+ text = text.replace(ipv6Regex, "[$1]");
+ root.editingFinished();
+ }
onTextChanged: root.textChanged()
+ text: initialHostPort[1]
}
LineEdit {
@@ -114,5 +124,6 @@ GridLayout {
onEditingFinished: root.editingFinished()
onTextChanged: root.textChanged()
+ text: initialHostPort[2]
}
}