diff --git a/TODO.md b/TODO.md index aee38678..3a5e0442 100644 --- a/TODO.md +++ b/TODO.md @@ -1,6 +1,5 @@ # TODO -- members filtering - when inviting members, prevent if user id is on another server and room doesn't allow that - "exception during sync" aren't caught diff --git a/src/gui/Pages/Chat/RoomPane/MemberView.qml b/src/gui/Pages/Chat/RoomPane/MemberView.qml index 82b7c624..1a168858 100644 --- a/src/gui/Pages/Chat/RoomPane/MemberView.qml +++ b/src/gui/Pages/Chat/RoomPane/MemberView.qml @@ -2,6 +2,7 @@ import QtQuick 2.12 import QtQuick.Layouts 1.12 +import SortFilterProxyModel 0.2 import "../../.." import "../../../Base" @@ -10,26 +11,15 @@ HColumnLayout { id: memberList clip: true - model: ModelStore.get(chat.userId, chat.roomId, "members") - // model: HSortFilterProxy { - // model: ModelStore.get(chat.userId, chat.roomId, "members") + model: SortFilterProxyModel { + sourceModel: ModelStore.get(chat.userId, chat.roomId, "members") - // comparator: (a, b) => - // // Sort by power level, then by display name or user ID (no @) - // [ - // a.invited, - // b.power_level, - // (a.display_name || a.id.substring(1)).toLocaleLowerCase(), - // ] < [ - // b.invited, - // a.power_level, - // (b.display_name || b.id.substring(1)).toLocaleLowerCase(), - // ] - - // filter: (item, index) => utils.filterMatchesAny( - // filterField.text, item.display_name, item.id, - // ) - // } + filters: ExpressionFilter { + expression: utils.filterMatches( + filterField.text, model.display_name, + ) + } + } delegate: MemberDelegate { width: memberList.width @@ -53,8 +43,6 @@ HColumnLayout { bordered: false opacity: width >= 16 * theme.uiScale ? 1 : 0 - onTextChanged: memberList.model.reFilter() - Layout.fillWidth: true Layout.fillHeight: true diff --git a/src/gui/PythonBridge/Privates/EventHandlers.qml b/src/gui/PythonBridge/Privates/EventHandlers.qml index 3e3ce09e..1f934eee 100644 --- a/src/gui/PythonBridge/Privates/EventHandlers.qml +++ b/src/gui/PythonBridge/Privates/EventHandlers.qml @@ -83,7 +83,6 @@ QtObject { function onModelItemFieldChanged(syncId, oldIndex, newIndex, field, value){ - print("change", syncId, oldIndex, newIndex, field, value) const model = ModelStore.get(syncId) model.setProperty(oldIndex, field, value)