fix: use ChatDocumentHandler.AutoCompletionType enum instead of string to chose delegates

This commit is contained in:
Srevin Saju
2021-05-05 20:25:25 +03:00
parent 18a2d6d6d6
commit 24bf460e9f
2 changed files with 5 additions and 7 deletions

View File

@@ -215,14 +215,12 @@ ToolBar {
return;
}
completionMenu.completionType = completionInfo.type
if (completionInfo.type === ChatDocumentHandler.User) {
completionMenu.completionType = "username"
completionMenu.model = currentRoom.getUsers(completionInfo.keyword);
} else if (completionInfo.type === ChatDocumentHandler.Command) {
completionMenu.completionType = "command"
completionMenu.model = CommandModel.filterModel(completionInfo.keyword);
} else {
completionMenu.completionType = "emoji"
completionMenu.model = EmojiModel.filterModel(completionInfo.keyword);
}

View File

@@ -25,7 +25,7 @@ Popup {
property string currentDisplayText: currentItem && currentItem.displayName ? currentItem.displayName : ""
property string currentUserId: currentItem && currentItem.id ? currentItem.id : ""
property string completionType: ""
property int completionType: ChatDocumentHandler.Emoji
property int beginPosition: 0
property int endPosition: 0
@@ -50,11 +50,11 @@ Popup {
id: completionListView
implicitWidth: contentWidth
delegate: {
if (completionType === "emoji") {
if (completionType === ChatDocumentHandler.Emoji) {
emojiDelegate
} else if (completionType === "command") {
} else if (completionType === ChatDocumentHandler.Command) {
commandDelegate
} else if (completionType === "username") {
} else if (completionType === ChatDocumentHandler.User) {
usernameDelegate
}
}