When leaving room, try to go to previous page
This commit is contained in:
parent
46ff911bfa
commit
de59948214
|
@ -21,7 +21,11 @@ HPage {
|
||||||
|
|
||||||
onRoomInfoChanged: {
|
onRoomInfoChanged: {
|
||||||
if (roomInfo.left) {
|
if (roomInfo.left) {
|
||||||
// If left, the room will most likely be gone on client restart
|
// If left, the room will most likely be gone on client restart.
|
||||||
|
// Try to switch back to the previous page.
|
||||||
|
if (pageLoader.showPrevious()) return
|
||||||
|
|
||||||
|
// If there wasn't any previous page, show default page.
|
||||||
window.uiState.page = "Pages/Default.qml"
|
window.uiState.page = "Pages/Default.qml"
|
||||||
window.uiState.pageProperties = {}
|
window.uiState.pageProperties = {}
|
||||||
window.uiStateChanged()
|
window.uiStateChanged()
|
||||||
|
|
|
@ -134,7 +134,7 @@ Item {
|
||||||
|
|
||||||
function showPrevious(timesBack=1) {
|
function showPrevious(timesBack=1) {
|
||||||
timesBack = Math.min(timesBack, history.length - 1)
|
timesBack = Math.min(timesBack, history.length - 1)
|
||||||
if (timesBack < 1) return
|
if (timesBack < 1) return false
|
||||||
|
|
||||||
let [componentUrl, properties] = history[timesBack]
|
let [componentUrl, properties] = history[timesBack]
|
||||||
|
|
||||||
|
@ -143,6 +143,7 @@ Item {
|
||||||
window.uiState.page = componentUrl
|
window.uiState.page = componentUrl
|
||||||
window.uiState.pageProperties = properties
|
window.uiState.pageProperties = properties
|
||||||
window.uiStateChanged()
|
window.uiStateChanged()
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
onStatusChanged: if (status == Loader.Ready) {
|
onStatusChanged: if (status == Loader.Ready) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user