Join room from search bar.

square-messages
Black Hat 2019-03-03 20:07:06 +08:00
parent dd0b59959f
commit 0f21582752
1 changed files with 22 additions and 0 deletions

View File

@ -627,6 +627,8 @@ Item {
AutoTextField {
readonly property bool active: text
readonly property bool isRoom: text.match(/#.*:.*\..*/g) || text.match(/!.*:.*\..*/g)
readonly property bool isUser: text.match(/@.*:.*\..*/g)
Layout.fillWidth: true
Layout.fillHeight: true
@ -641,6 +643,26 @@ Item {
background: Item {}
}
ItemDelegate {
Layout.preferredWidth: height
Layout.fillHeight: true
visible: searchField.isRoom || searchField.isUser
contentItem: MaterialIcon { icon: "\ue145" }
onClicked: {
if (searchField.isRoom) {
controller.joinRoom(controller.connection, searchField.text)
return
}
if (searchField.isUser) {
controller.createDirectChat(controller.connection, searchField.text)
return
}
}
}
Avatar {
Layout.preferredWidth: height
Layout.fillHeight: true