Change the behaviour when clicking on a space
- When click on a space the space home page is shown, unless the current room is also a member of the new space - When changing to friends or global the first is entered - The global now only contains rooms that are not part of a space - Global is now home
This commit is contained in:
@@ -105,6 +105,8 @@ Kirigami.Page {
|
||||
Layout.fillHeight: true
|
||||
|
||||
connection: root.connection
|
||||
|
||||
onSpacesUpdated: sortFilterRoomListModel.invalidate()
|
||||
}
|
||||
|
||||
Kirigami.Separator {
|
||||
@@ -204,12 +206,24 @@ Kirigami.Page {
|
||||
sourceModel: root.roomListModel
|
||||
roomSortOrder: SortFilterRoomListModel.Categories
|
||||
onLayoutChanged: {
|
||||
layoutTimer.restart()
|
||||
listView.currentIndex = sortFilterRoomListModel.mapFromSource(itemSelection.currentIndex).row
|
||||
}
|
||||
activeSpaceId: spaceDrawer.selectedSpaceId
|
||||
mode: spaceDrawer.showDirectChats ? SortFilterRoomListModel.DirectChats : SortFilterRoomListModel.Rooms
|
||||
}
|
||||
|
||||
// HACK: This is the only way to guarantee the correct choice when
|
||||
// there are multiple property changes that invalidate the filter. I.e.
|
||||
// in this case activeSpaceId followed by mode.
|
||||
Timer {
|
||||
id: layoutTimer
|
||||
interval: 100
|
||||
onTriggered: if (spaceDrawer.showDirectChats || spaceDrawer.selectedSpaceId.length < 1) {
|
||||
RoomManager.enterRoom(listView.itemAtIndex(0).currentRoom)
|
||||
}
|
||||
}
|
||||
|
||||
section {
|
||||
property: "category"
|
||||
delegate: root.collapsed ? foldButton : sectionHeader
|
||||
|
||||
@@ -25,6 +25,8 @@ QQC2.Control {
|
||||
|
||||
property bool showDirectChats: false
|
||||
|
||||
signal spacesUpdated()
|
||||
|
||||
contentItem: Loader {
|
||||
id: sidebarColumn
|
||||
z: 0
|
||||
@@ -83,9 +85,9 @@ QQC2.Control {
|
||||
Layout.maximumHeight: width - Kirigami.Units.smallSpacing
|
||||
Layout.topMargin: Kirigami.Units.smallSpacing / 2
|
||||
|
||||
text: i18n("All Rooms")
|
||||
text: i18n("Home")
|
||||
contentItem: Kirigami.Icon {
|
||||
source: "globe"
|
||||
source: "user-home-symbolic"
|
||||
}
|
||||
|
||||
checked: root.selectedSpaceId === "" && root.showDirectChats === false
|
||||
@@ -145,6 +147,7 @@ QQC2.Control {
|
||||
sourceModel: RoomListModel {
|
||||
connection: root.connection
|
||||
}
|
||||
onLayoutChanged: root.spacesUpdated()
|
||||
}
|
||||
onCountChanged: {
|
||||
if (!root.connection.room(root.selectedSpaceId)) {
|
||||
@@ -169,6 +172,9 @@ QQC2.Control {
|
||||
|
||||
onSelected: {
|
||||
root.showDirectChats = false
|
||||
if (!SpaceHierarchyCache.isSpaceChild(roomId, RoomManager.currentRoom.id) || root.selectedSpaceId == roomId) {
|
||||
RoomManager.enterSpaceHome(currentRoom)
|
||||
}
|
||||
root.selectedSpaceId = roomId
|
||||
}
|
||||
checked: root.selectedSpaceId === roomId
|
||||
|
||||
Reference in New Issue
Block a user