Commit d22301b1 authored by Volker Krause's avatar Volker Krause
Browse files

Properly handle modal pages

This fixes various page flow issues when opening multiple of those.
parent 98201b85
......@@ -27,7 +27,7 @@ Kirigami.Page {
text: i18n("Pick Location")
onTriggered: {
coordinate = map.center;
applicationWindow().pageStack.pop();
applicationWindow().pageStack.goBack();
}
}
......
......@@ -54,7 +54,7 @@ Kirigami.ScrollablePage {
Kirigami.FormData.isSection: true
text: i18n("Favorite Locations")
icon.name: "go-home-symbolic"
onClicked: applicationWindow().pageStack.push(favoriteLocationPage);
onClicked: applicationWindow().pageStack.layers.push(favoriteLocationPage);
}
// Online services
......@@ -90,7 +90,7 @@ Kirigami.ScrollablePage {
Kirigami.FormData.isSection: true
text: i18n("Public Transport Information Sources...")
icon.name: "settings-configure"
onClicked: applicationWindow().pageStack.push(ptBackendPage)
onClicked: applicationWindow().pageStack.layers.push(ptBackendPage)
}
QQC2.Switch {
......
......@@ -48,7 +48,7 @@ Kirigami.ScrollablePage {
QQC2.Button {
text: i18n("Got it!")
onClicked: applicationWindow().pageStack.pop();
onClicked: applicationWindow().pageStack.goBack();
Layout.alignment: Qt.AlignRight
visible: ReservationManager.isEmpty()
}
......
......@@ -79,7 +79,8 @@ Kirigami.ApplicationWindow {
id: statsAction
text: i18n("Statistics")
iconName: "view-statistics"
onTriggered: pageStack.push(statisticsComponent)
enabled: pageStack.layers.depth < 2
onTriggered: pageStack.layers.push(statisticsComponent)
},
Kirigami.Action {
id: healtCertAction
......@@ -87,15 +88,17 @@ Kirigami.ApplicationWindow {
iconName: "cross-shape"
onTriggered: {
healtCertificateComponent.source = "HealthCertificatePage.qml"
pageStack.push(healtCertificateComponent.item)
pageStack.layers.push(healtCertificateComponent.item)
}
enabled: pageStack.layers.depth < 2
visible: HealthCertificateManager.isAvailable
},
Kirigami.Action {
id: settingsAction
text: i18n("Settings...")
iconName: "settings-configure"
onTriggered: pageStack.push(settingsComponent)
enabled: pageStack.layers.depth < 2
onTriggered: pageStack.layers.push(settingsComponent)
},
Kirigami.Action {
text: i18n("Export...")
......@@ -105,19 +108,22 @@ Kirigami.ApplicationWindow {
Kirigami.Action {
text: i18n("Help")
iconName: "help-contents"
onTriggered: pageStack.push(welcomeComponent)
enabled: pageStack.layers.depth < 2
onTriggered: pageStack.layers.push(welcomeComponent)
},
Kirigami.Action {
id: aboutAction
text: i18n("About")
iconName: "help-about-symbolic"
onTriggered: pageStack.push(aboutComponent)
enabled: pageStack.layers.depth < 2
onTriggered: pageStack.layers.push(aboutComponent)
},
Kirigami.Action {
id: devModeAction
text: "Development"
iconName: "tools-report-bug"
onTriggered: pageStack.push(devModePageComponent)
enabled: pageStack.layers.depth < 2
onTriggered: pageStack.layers.push(devModePageComponent)
visible: Settings.developmentMode
}
]
......@@ -164,25 +170,17 @@ Kirigami.ApplicationWindow {
}
Component {
id: settingsComponent
App.SettingsPage {
id: settingsPage
onIsCurrentPageChanged: settingsAction.enabled = !settingsPage.isCurrentPage
}
App.SettingsPage {}
}
Component {
id: aboutComponent
App.AboutPage {
id: aboutPage
onIsCurrentPageChanged: aboutAction.enabled = !aboutPage.isCurrentPage
}
App.AboutPage {}
}
Component {
id: statisticsComponent
App.StatisticsPage {
id: statsPage
reservationManager: ReservationManager
tripGroupManager: TripGroupManager
onIsCurrentPageChanged: statsAction.enabled = !statsPage.isCurrentPage
}
}
// replace loader with component once we depend on KHealthCertificate unconditionally
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment