Add fancy label if you enter a bad mxid

This commit is contained in:
Loren Burkholder 2021-06-11 20:48:20 -04:00
parent 3c999ade95
commit 4746fcd16f

View file

@ -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