diff options
| author | luigi1111 <luigi1111w@gmail.com> | 2020-07-08 13:52:22 -0500 |
|---|---|---|
| committer | luigi1111 <luigi1111w@gmail.com> | 2020-07-08 13:52:22 -0500 |
| commit | 1572b4cf799701ab9e88c60a676babb0c84110a4 (patch) | |
| tree | ab2086e676009ab53ab839cfda378ffe5e3550bc /components | |
| parent | 10a47d783ef0556adcc489c738ffe7f48d9fd3b3 (diff) | |
| parent | fead82b1984dcf0a5ec69d861f858cd226c54fde (diff) | |
| download | monzero-gui-1572b4cf799701ab9e88c60a676babb0c84110a4.tar.gz monzero-gui-1572b4cf799701ab9e88c60a676babb0c84110a4.tar.xz monzero-gui-1572b4cf799701ab9e88c60a676babb0c84110a4.zip | |
Merge pull request #2978
fead82b RemoteNodeEdit: initialAddress, add square brackets on ipv6 input (xiphon)
Diffstat (limited to 'components')
| -rw-r--r-- | components/RemoteNodeEdit.qml | 13 |
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] } } |
