diff --git a/src/StatusQ/Components/StatusChatList.qml b/src/StatusQ/Components/StatusChatList.qml index 3e7f9b53..487e701d 100644 --- a/src/StatusQ/Components/StatusChatList.qml +++ b/src/StatusQ/Components/StatusChatList.qml @@ -23,8 +23,6 @@ Column { property Component popupMenu - property var filterFn - signal chatItemSelected(string categoryId, string id) signal chatItemUnmuted(string id) signal chatItemReordered(string id, int from, int to) @@ -45,13 +43,6 @@ Column { height: statusChatListItem.height property alias chatListItem: statusChatListItem - visible: { - if (!!statusChatList.filterFn) { - return statusChatList.filterFn(model) - } - return true - } - MouseArea { id: dragSensor diff --git a/src/StatusQ/Components/StatusChatListAndCategories.qml b/src/StatusQ/Components/StatusChatListAndCategories.qml index 18fc5fa7..57d37985 100644 --- a/src/StatusQ/Components/StatusChatListAndCategories.qml +++ b/src/StatusQ/Components/StatusChatListAndCategories.qml @@ -7,6 +7,8 @@ import StatusQ.Components 0.1 import StatusQ.Popups 0.1 import StatusQ.Core 0.1 +import SortFilterProxyModel 0.2 + Item { id: statusChatListAndCategories @@ -75,16 +77,27 @@ Item { onChatItemUnmuted: statusChatListAndCategories.chatItemUnmuted(id) onChatItemReordered: statusChatListAndCategories.chatItemReordered(categoryId, id, from, to) draggableItems: statusChatListAndCategories.draggableItems - model: statusChatListAndCategories.model - filterFn: function (model) { - return !model.isCategory + + model: SortFilterProxyModel { + sourceModel: statusChatListAndCategories.model + + filters: ValueFilter { roleName: "isCategory"; value: false } + sorters: RoleSorter { roleName: "position" } } + popupMenu: statusChatListAndCategories.chatListPopupMenu } DelegateModel { id: delegateModel - model: statusChatListAndCategories.model + + model: SortFilterProxyModel { + sourceModel: statusChatListAndCategories.model + + filters: ValueFilter { roleName: "isCategory"; value: true } + sorters: RoleSorter { roleName: "position" } + } + delegate: Item { id: draggable width: statusChatListCategory.width @@ -139,7 +152,11 @@ Item { showActionButtons: statusChatListAndCategories.showCategoryActionButtons addButton.onClicked: statusChatListAndCategories.categoryAddButtonClicked(model.itemId) - chatList.model: model.subItems + chatList.model: SortFilterProxyModel { + sourceModel: model.subItems + sorters: RoleSorter { roleName: "position" } + } + chatList.onChatItemSelected: statusChatListAndCategories.chatItemSelected(categoryId, id) chatList.onChatItemUnmuted: statusChatListAndCategories.chatItemUnmuted(id) chatList.onChatItemReordered: statusChatListAndCategories.chatItemReordered(model.itemId, id, from, to) diff --git a/src/StatusQ/Components/StatusChatListCategory.qml b/src/StatusQ/Components/StatusChatListCategory.qml index 0be28614..d89904ee 100644 --- a/src/StatusQ/Components/StatusChatListCategory.qml +++ b/src/StatusQ/Components/StatusChatListCategory.qml @@ -35,7 +35,6 @@ Column { StatusChatListCategoryItem { id: statusChatListCategoryItem title: statusChatListCategory.name - visible: model.isCategory opened: statusChatListCategory.opened sensor.pressAndHoldInterval: 150 @@ -66,9 +65,6 @@ Column { anchors.horizontalCenter: parent.horizontalCenter visible: statusChatListCategory.opened categoryId: statusChatListCategory.categoryId - filterFn: function (model) { - return !!model.parentItemId && model.parentItemId === statusChatList.categoryId - } popupMenu: statusChatListCategory.chatListPopupMenu }