fix: use ChatDocumentHandler.AutoCompletionType enum instead of string to chose delegates
This commit is contained in:
@@ -215,14 +215,12 @@ ToolBar {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
completionMenu.completionType = completionInfo.type
|
||||||
if (completionInfo.type === ChatDocumentHandler.User) {
|
if (completionInfo.type === ChatDocumentHandler.User) {
|
||||||
completionMenu.completionType = "username"
|
|
||||||
completionMenu.model = currentRoom.getUsers(completionInfo.keyword);
|
completionMenu.model = currentRoom.getUsers(completionInfo.keyword);
|
||||||
} else if (completionInfo.type === ChatDocumentHandler.Command) {
|
} else if (completionInfo.type === ChatDocumentHandler.Command) {
|
||||||
completionMenu.completionType = "command"
|
|
||||||
completionMenu.model = CommandModel.filterModel(completionInfo.keyword);
|
completionMenu.model = CommandModel.filterModel(completionInfo.keyword);
|
||||||
} else {
|
} else {
|
||||||
completionMenu.completionType = "emoji"
|
|
||||||
completionMenu.model = EmojiModel.filterModel(completionInfo.keyword);
|
completionMenu.model = EmojiModel.filterModel(completionInfo.keyword);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ Popup {
|
|||||||
property string currentDisplayText: currentItem && currentItem.displayName ? currentItem.displayName : ""
|
property string currentDisplayText: currentItem && currentItem.displayName ? currentItem.displayName : ""
|
||||||
property string currentUserId: currentItem && currentItem.id ? currentItem.id : ""
|
property string currentUserId: currentItem && currentItem.id ? currentItem.id : ""
|
||||||
|
|
||||||
property string completionType: ""
|
property int completionType: ChatDocumentHandler.Emoji
|
||||||
property int beginPosition: 0
|
property int beginPosition: 0
|
||||||
property int endPosition: 0
|
property int endPosition: 0
|
||||||
|
|
||||||
@@ -50,11 +50,11 @@ Popup {
|
|||||||
id: completionListView
|
id: completionListView
|
||||||
implicitWidth: contentWidth
|
implicitWidth: contentWidth
|
||||||
delegate: {
|
delegate: {
|
||||||
if (completionType === "emoji") {
|
if (completionType === ChatDocumentHandler.Emoji) {
|
||||||
emojiDelegate
|
emojiDelegate
|
||||||
} else if (completionType === "command") {
|
} else if (completionType === ChatDocumentHandler.Command) {
|
||||||
commandDelegate
|
commandDelegate
|
||||||
} else if (completionType === "username") {
|
} else if (completionType === ChatDocumentHandler.User) {
|
||||||
usernameDelegate
|
usernameDelegate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user