Don't stack pages in layers and instead replace them
This commit is contained in:
17
qml/main.qml
17
qml/main.qml
@@ -73,6 +73,14 @@ Kirigami.ApplicationWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function pushReplaceLayer(page, args) {
|
||||||
|
if (pageStack.layers.depth === 2) {
|
||||||
|
pageStack.layers.replace(page, args);
|
||||||
|
} else {
|
||||||
|
pageStack.layers.push(page, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TrayIcon {
|
TrayIcon {
|
||||||
id: trayIcon
|
id: trayIcon
|
||||||
visible: true
|
visible: true
|
||||||
@@ -90,29 +98,30 @@ Kirigami.ApplicationWindow {
|
|||||||
|
|
||||||
globalDrawer: Kirigami.GlobalDrawer {
|
globalDrawer: Kirigami.GlobalDrawer {
|
||||||
isMenu: true
|
isMenu: true
|
||||||
|
property bool hasLayer
|
||||||
actions: [
|
actions: [
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
text: i18n("Explore rooms")
|
text: i18n("Explore rooms")
|
||||||
iconName: "compass"
|
iconName: "compass"
|
||||||
onTriggered: pageStack.layers.push("qrc:/imports/NeoChat/Page/JoinRoomPage.qml", {"connection": Controller.activeConnection})
|
onTriggered: pushReplaceLayer("qrc:/imports/NeoChat/Page/JoinRoomPage.qml", {"connection": Controller.activeConnection})
|
||||||
enabled: pageStack.layers.currentItem.title !== i18n("Explore Rooms")
|
enabled: pageStack.layers.currentItem.title !== i18n("Explore Rooms")
|
||||||
},
|
},
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
text: i18n("Accounts")
|
text: i18n("Accounts")
|
||||||
iconName: "im-user"
|
iconName: "im-user"
|
||||||
onTriggered: pageStack.layers.push("qrc:/imports/NeoChat/Page/AccountsPage.qml")
|
onTriggered: pushReplaceLayer("qrc:/imports/NeoChat/Page/AccountsPage.qml")
|
||||||
enabled: pageStack.layers.currentItem.title !== i18n("Accounts")
|
enabled: pageStack.layers.currentItem.title !== i18n("Accounts")
|
||||||
},
|
},
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
text: i18n("Settings")
|
text: i18n("Settings")
|
||||||
iconName: "settings-configure"
|
iconName: "settings-configure"
|
||||||
onTriggered: pageStack.layers.push("qrc:/imports/NeoChat/Page/SettingsPage.qml")
|
onTriggered: pushReplaceLayer("qrc:/imports/NeoChat/Page/SettingsPage.qml")
|
||||||
enabled: pageStack.layers.currentItem.title !== i18n("Settings")
|
enabled: pageStack.layers.currentItem.title !== i18n("Settings")
|
||||||
},
|
},
|
||||||
Kirigami.Action {
|
Kirigami.Action {
|
||||||
text: i18n("About Neochat")
|
text: i18n("About Neochat")
|
||||||
iconName: "help-about"
|
iconName: "help-about"
|
||||||
onTriggered: pageStack.layers.push(aboutPage)
|
onTriggered: pushReplaceLayer("qrc:/imports/NeoChat/Page/AboutPage.qml")
|
||||||
enabled: pageStack.layers.currentItem.title !== i18n("About")
|
enabled: pageStack.layers.currentItem.title !== i18n("About")
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user