fix(ChannelPicker): re-hook channel picker with new model and functions
Fixes #4550
This commit is contained in:
parent
c9e049e6d8
commit
311abcd23a
|
@ -777,11 +777,14 @@ Item {
|
||||||
width: 350
|
width: 350
|
||||||
x: parent.width / 2 - width / 2
|
x: parent.width / 2 - width / 2
|
||||||
y: parent.height / 2 - height / 2
|
y: parent.height / 2 - height / 2
|
||||||
// Not Refactored Yet
|
// TODO improve this to work with community Chats as well
|
||||||
// modelList: chatsModel.channelView.chats
|
modelList: mainModule.getChatSectionModule().model
|
||||||
getText: function (modelData) {
|
getText: function (modelData) {
|
||||||
return modelData.name
|
return modelData.name
|
||||||
}
|
}
|
||||||
|
getId: function (modelData) {
|
||||||
|
return modelData.itemId
|
||||||
|
}
|
||||||
getImageComponent: function (parent, modelData) {
|
getImageComponent: function (parent, modelData) {
|
||||||
return statusSmartIdenticonComponent.createObject(parent, {
|
return statusSmartIdenticonComponent.createObject(parent, {
|
||||||
imageSource: modelData.identicon,
|
imageSource: modelData.identicon,
|
||||||
|
@ -789,12 +792,11 @@ Item {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not Refactored Yet
|
onClicked: function (index, id) {
|
||||||
// onClicked: function (index) {
|
Global.changeAppSectionBySectionType(Constants.appSection.chat)
|
||||||
// Global.changeAppSectionBySectionType(Constants.appSection.chat)
|
mainModule.getChatSectionModule().setActiveItem(id, "")
|
||||||
// chatsModel.channelView.setActiveChannelByIndex(index)
|
channelPicker.close()
|
||||||
// channelPicker.close()
|
}
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,9 @@ StatusInputListPopup {
|
||||||
getText: function (modelData) {
|
getText: function (modelData) {
|
||||||
return modelData.shortname
|
return modelData.shortname
|
||||||
}
|
}
|
||||||
|
getId: function (modelData) {
|
||||||
|
return modelData.unicode
|
||||||
|
}
|
||||||
onClicked: function (index) {
|
onClicked: function (index) {
|
||||||
emojiSuggestions.addEmoji(index)
|
emojiSuggestions.addEmoji(index)
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,8 @@ Popup {
|
||||||
property var getImageSource
|
property var getImageSource
|
||||||
property var getImageComponent
|
property var getImageComponent
|
||||||
property var getText: function () {}
|
property var getText: function () {}
|
||||||
property var onClicked: function () {}
|
property var getId: function () {}
|
||||||
|
signal clicked(int index, string id)
|
||||||
property int imageWidth: 22
|
property int imageWidth: 22
|
||||||
property int imageHeight: 22
|
property int imageHeight: 22
|
||||||
property string title
|
property string title
|
||||||
|
@ -119,7 +120,7 @@ Popup {
|
||||||
return popup.close()
|
return popup.close()
|
||||||
}
|
}
|
||||||
if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) {
|
if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) {
|
||||||
return popup.onClicked(listView.currentIndex)
|
return popup.clicked(listView.currentIndex, popup.getId(listView.currentItem.myData))
|
||||||
}
|
}
|
||||||
if (!listView.currentItem.visible) {
|
if (!listView.currentItem.visible) {
|
||||||
goToNextAvailableIndex(false)
|
goToNextAvailableIndex(false)
|
||||||
|
@ -139,12 +140,8 @@ Popup {
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
delegate: Rectangle {
|
delegate: Rectangle {
|
||||||
property string myText: {
|
property variant myData: typeof modelData === "undefined" ? model : modelData
|
||||||
if (typeof modelData === "undefined") {
|
property string myText: popup.getText(myData)
|
||||||
return popup.getText(model)
|
|
||||||
}
|
|
||||||
return popup.getText(modelData)
|
|
||||||
}
|
|
||||||
id: rectangle
|
id: rectangle
|
||||||
visible: searchBox.text === "" || myText.includes(searchBox.text)
|
visible: searchBox.text === "" || myText.includes(searchBox.text)
|
||||||
color: listView.currentIndex === index ? Style.current.backgroundHover : Style.current.transparent
|
color: listView.currentIndex === index ? Style.current.backgroundHover : Style.current.transparent
|
||||||
|
@ -172,10 +169,7 @@ Popup {
|
||||||
if (!popup.getImageComponent) {
|
if (!popup.getImageComponent) {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
if (typeof modelData === "undefined") {
|
return popup.getImageComponent(imageComponentContainer, myData)
|
||||||
return popup.getImageComponent(imageComponentContainer, model)
|
|
||||||
}
|
|
||||||
return popup.getImageComponent(imageComponentContainer, modelData)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -190,10 +184,7 @@ Popup {
|
||||||
if (!popup.getImageSource) {
|
if (!popup.getImageSource) {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
if (typeof modelData === "undefined") {
|
return popup.getImageSource(myData)
|
||||||
return popup.getImageSource(model)
|
|
||||||
}
|
|
||||||
return popup.getImageSource(modelData)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -215,7 +206,7 @@ Popup {
|
||||||
listView.currentIndex = index
|
listView.currentIndex = index
|
||||||
}
|
}
|
||||||
onClicked: {
|
onClicked: {
|
||||||
popup.onClicked(index)
|
popup.clicked(index, popup.getId(myData))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue