Add fancy label if you enter a bad mxid
1 files changed, 73 insertions, 0 deletions
diff --git a/resources/qml/InviteDialog.qml b/resources/qml/InviteDialog.qml
index 002a35c2..9ace3246 100644
--- a/resources/qml/InviteDialog.qml
+++ b/resources/qml/InviteDialog.qml
@@ -16,6 +16,10 @@ ApplicationWindow {
invitees.addUser(inviteeEntry.text);
inviteeEntry.clear();
}
+ else
+ {
+ warningLabel.show()
+ }
}
title: qsTr("Invite users to ") + roomName
@@ -51,6 +55,11 @@ ApplicationWindow {
Layout.fillWidth: true
onAccepted: if (text !== "") addInvite()
Component.onCompleted: forceActiveFocus()
+
+ Shortcut {
+ sequence: "Ctrl+Enter"
+ onActivated: inviteDialogRoot.accept()
+ }
}
Button {
@@ -59,6 +68,70 @@ ApplicationWindow {
}
}
+ Label {
+ id: warningLabel
+
+ function show() {
+ state = "shown";
+ warningLabelTimer.start();
+ }
+
+ text: qsTr("Please enter a valid username (e.g. @joe:matrix.org).")
+ color: "red"
+ visible: false
+ opacity: 0
+ state: "hidden"
+
+ states: [
+ State {
+ name: "shown"
+ PropertyChanges {
+ target: warningLabel
+ opacity: 1
+ visible: true
+ }
+ },
+ State {
+ name: "hidden"
+ PropertyChanges {
+ target: warningLabel
+ opacity: 0
+ visible: false
+ }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ from: "shown"
+ to: "hidden"
+ reversible: true
+
+ SequentialAnimation {
+ NumberAnimation {
+ target: warningLabel
+ property: "opacity"
+ duration: 500
+ }
+
+ PropertyAction {
+ target: warningLabel
+ property: "visible"
+ }
+ }
+ }
+ ]
+
+ Timer {
+ id: warningLabelTimer
+
+ interval: 2000
+ repeat: false
+ running: false
+ onTriggered: warningLabel.state = "hidden"
+ }
+ }
+
ListView {
id: inviteesList
|