diff options
author | Loren Burkholder <computersemiexpert@outlook.com> | 2021-07-20 18:27:29 -0400 |
---|---|---|
committer | Loren Burkholder <computersemiexpert@outlook.com> | 2021-07-20 21:48:10 -0400 |
commit | 823e74039698daac8bd45bf13c71b193c60ea226 (patch) | |
tree | 9f46c8e0121e284cac4b5ac9eb9e9d0486a8566a /resources/qml/InviteDialog.qml | |
parent | Use elided label (diff) | |
download | nheko-823e74039698daac8bd45bf13c71b193c60ea226.tar.xz |
Check with regex everywhere
Diffstat (limited to '')
-rw-r--r-- | resources/qml/InviteDialog.qml | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/resources/qml/InviteDialog.qml b/resources/qml/InviteDialog.qml index 1be2e06c..026e3297 100644 --- a/resources/qml/InviteDialog.qml +++ b/resources/qml/InviteDialog.qml @@ -15,14 +15,14 @@ ApplicationWindow { property InviteesModel invitees function addInvite() { - if (inviteeEntry.text.match("@.+?:.{3,}")) { + if (inviteeEntry.isValidMxid) { invitees.addUser(inviteeEntry.text); inviteeEntry.clear(); } } function cleanUpAndClose() { - if (inviteeEntry.text.match("@.+?:.{3,}")) + if (inviteeEntry.isValidMxid) addInvite(); invitees.accept(); @@ -63,11 +63,13 @@ ApplicationWindow { MatrixTextField { id: inviteeEntry + property bool isValidMxid: text.match("@.+?:.{3,}") + backgroundColor: Nheko.colors.window placeholderText: qsTr("@joe:matrix.org", "Example user id. The name 'joe' can be localized however you want.") Layout.fillWidth: true onAccepted: { - if (text !== "") + if (isValidMxid) addInvite(); } @@ -82,7 +84,7 @@ ApplicationWindow { Button { text: qsTr("Add") - enabled: inviteeEntry.text.match("@.+?:.{3,}") + enabled: inviteeEntry.isValidMxid onClicked: addInvite() } |