mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-26 04:58:49 +03:00
Add fancy label if you enter a bad mxid
This commit is contained in:
parent
3c999ade95
commit
4746fcd16f
1 changed files with 73 additions and 0 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue