Mobile Pages

Currently the page experienc on mobile is suboptimal as back gestures do not work and the startup behaviour is not ideal.

This reworks it so that pages are now pushed as a layer on mobile and at startup only a saved space is restored. It is also setup so that on mobile you'll never see a blank room page (like when you select friends or home).
This commit is contained in:
James Graham
2024-10-15 16:13:02 +00:00
parent cc50e76c0d
commit 365af2cd6c
3 changed files with 49 additions and 8 deletions

View File

@@ -18,6 +18,8 @@ Kirigami.ApplicationWindow {
property NeoChatConnection connection: Controller.activeConnection
readonly property HoverLinkIndicator hoverLinkIndicator: linkIndicator
property bool initialized: false
title: NeoChatConfig.windowTitleFocus ? activeFocusItem + " " + (activeFocusItem ? activeFocusItem.Accessible.name : "") : "NeoChat"
@@ -82,6 +84,17 @@ Kirigami.ApplicationWindow {
Connections {
target: RoomManager
function onCurrentRoomChanged() {
if (RoomManager.currentRoom && pageStack.depth <= 1 && initialized && Kirigami.Settings.isMobile) {
let roomPage = pageStack.layers.push(Qt.createComponent('org.kde.neochat', 'RoomPage'), {
connection: root.connection
});
roomPage.backRequested.connect(event => {
RoomManager.clearCurrentRoom();
});
}
}
function onAskJoinRoom(room) {
Qt.createComponent("org.kde.neochat", "JoinRoomDialog").createObject(root, {
room: room,
@@ -315,9 +328,14 @@ Kirigami.ApplicationWindow {
function load() {
pageStack.replace(roomListComponent);
RoomManager.loadInitialRoom();
let roomPage = pageStack.push(Qt.createComponent('org.kde.neochat', 'RoomPage'), {
connection: root.connection
});
roomPage.forceActiveFocus();
if (!Kirigami.Settings.isMobile) {
let roomPage = pageStack.push(Qt.createComponent('org.kde.neochat', 'RoomPage'), {
connection: root.connection
});
roomPage.forceActiveFocus();
}
initialized = true;
}
}