Rework roommanager for improved stability
Fixes #645 - Active space handling is moved from QML to RoomManager - Active tab in SpaceDrawer (space / no space / DM) is unified in a single variable - RoomList & RoomPage loading is simplified: We're always pushing a RoomPage now; if there is no room, a placeholder is shown - SpaceHomePage is moved into RoomPage; This replaces the entire push/replace room/spacehome logic - If the current room is a space, the space home is shown, otherwise the timeline - The concept of "previous room" is removed entirely. If we're leaving the active room, the placeholder room page is shown - When clicking on a space in the list, the space room list is switched and the space home page is shown In short, these changes should (after some initial regressions) lead to a less crashy NeoChat :)
This commit is contained in:
@@ -72,7 +72,7 @@ Kirigami.Page {
|
||||
/// Disable cancel shortcut. Used by the separate window since it provides its own cancel implementation.
|
||||
property bool disableCancelShortcut: false
|
||||
|
||||
title: root.currentRoom.displayName
|
||||
title: root.currentRoom ? root.currentRoom.displayName : ""
|
||||
focus: true
|
||||
padding: 0
|
||||
|
||||
@@ -116,7 +116,7 @@ Kirigami.Page {
|
||||
Loader {
|
||||
id: timelineViewLoader
|
||||
anchors.fill: parent
|
||||
active: root.currentRoom && !root.currentRoom.isInvite && !root.loading
|
||||
active: root.currentRoom && !root.currentRoom.isInvite && !root.loading && !root.currentRoom.isSpace
|
||||
sourceComponent: TimelineView {
|
||||
id: timelineView
|
||||
currentRoom: root.currentRoom
|
||||
@@ -143,7 +143,23 @@ Kirigami.Page {
|
||||
}
|
||||
|
||||
Loader {
|
||||
active: root.loading && !invitationLoader.active
|
||||
id: spaceLoader
|
||||
active: root.currentRoom && root.currentRoom.isSpace
|
||||
anchors.fill: parent
|
||||
sourceComponent: SpaceHomePage {}
|
||||
}
|
||||
|
||||
Loader {
|
||||
active: !RoomManager.currentRoom
|
||||
anchors.centerIn: parent
|
||||
sourceComponent: Kirigami.PlaceholderMessage {
|
||||
icon.name: "org.kde.neochat"
|
||||
text: i18n("Welcome to NeoChat")
|
||||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
active: root.loading && !invitationLoader.active && RoomManager.currentRoom && !spaceLoader.active
|
||||
anchors.centerIn: parent
|
||||
sourceComponent: Kirigami.LoadingPlaceholder {
|
||||
anchors.centerIn: parent
|
||||
@@ -176,11 +192,7 @@ Kirigami.Page {
|
||||
Connections {
|
||||
target: RoomManager
|
||||
function onCurrentRoomChanged() {
|
||||
if (!RoomManager.currentRoom) {
|
||||
if (pageStack.lastItem === root) {
|
||||
pageStack.pop();
|
||||
}
|
||||
} else if (root.currentRoom.isInvite) {
|
||||
if (root.currentRoom && root.currentRoom.isInvite) {
|
||||
root.currentRoom.clearInvitationNotification();
|
||||
}
|
||||
}
|
||||
@@ -188,6 +200,10 @@ Kirigami.Page {
|
||||
function onWarning(title, message) {
|
||||
root.warning(title, message);
|
||||
}
|
||||
|
||||
function onGoToEvent(eventId) {
|
||||
(timelineViewLoader.item as TimelineView).goToEvent(eventId);
|
||||
}
|
||||
}
|
||||
|
||||
Shortcut {
|
||||
|
||||
Reference in New Issue
Block a user