diff --git a/harmonyqml/backend/model/list_model.py b/harmonyqml/backend/model/list_model.py index a283476a..71fc9d28 100644 --- a/harmonyqml/backend/model/list_model.py +++ b/harmonyqml/backend/model/list_model.py @@ -197,7 +197,6 @@ class ListModel(QAbstractListModel): if (n <= 0) or (from_ == to) or (qlast == to) or \ not (self.rowCount() > qlast >= 0) or \ not self.rowCount() >= to >= 0: - logging.warning("No need for move or out of range") return qidx = QModelIndex() diff --git a/harmonyqml/backend/signal_manager.py b/harmonyqml/backend/signal_manager.py index 20e1d1dd..916bf847 100644 --- a/harmonyqml/backend/signal_manager.py +++ b/harmonyqml/backend/signal_manager.py @@ -115,6 +115,14 @@ class SignalManager(QObject): ) model.updateOrAppendWhere("roomId", room_id, item) + index = model.indexWhere("roomId", room_id) + + if category == "Invites": + model.move(index, 0) + + elif category == "Left": + model.move(index, len(model)) + def onRoomSyncPrevBatchTokenReceived( diff --git a/harmonyqml/components/sidePane/RoomList.qml b/harmonyqml/components/sidePane/RoomList.qml index 9bbfe819..aa96443b 100644 --- a/harmonyqml/components/sidePane/RoomList.qml +++ b/harmonyqml/components/sidePane/RoomList.qml @@ -8,9 +8,9 @@ ListView { property int childrenHeight: 36 property int sectionHeight: 16 + spacing - property int contentHeight: 0 + property int contentHeight: getContentHeight() - onCountChanged: { + function getContentHeight() { var sections = [] for (var i = 0; i < model.count; i++) { @@ -24,6 +24,11 @@ ListView { sectionHeight * sections.length } + Connections { + target: model + onChanged: getContentHeight() + } + id: roomList spacing: 8 model: Backend.models.rooms.get(forUserId)