Commit e4b0e482 authored by Volker Krause's avatar Volker Krause

Don't duplicate the pkpass component

Instead, move it to main.qml and parameterize the component creation when
pushing the page on to the page stack.
parent 8adf3dd4
......@@ -28,21 +28,13 @@ Kirigami.ScrollablePage {
property variant reservation
property string passId
Component {
id: pkpassComponent
App.PkPassPage {
passId: root.passId
pass: _pkpassManager.passObject(root.passId)
}
}
actions {
contextualActions: [
Kirigami.Action {
iconSource: root.passId !== "" ? "image://org.kde.pkpass/" + passId + "/icon" : ""
text: qsTr("Boarding Pass")
visible: root.passId !== ""
onTriggered: applicationWindow().pageStack.push(pkpassComponent);
onTriggered: applicationWindow().pageStack.push(pkpassComponent, {"passId": root.passId });
}
]
}
......
......@@ -103,7 +103,7 @@ App.TimelineDelegate {
QQC2.Button {
Layout.alignment: Qt.AlignHCenter
text: qsTr("Boarding Pass")
onClicked: showBoardingPass();
onClicked: applicationWindow().pageStack.push(pkpassComponent, {"passId": root.passId });
visible: root.passId !== ""
icon.source: root.passId !== "" ? "image://org.kde.pkpass/" + passId + "/icon" : ""
// this prevents a tinting/masking effect turning the icon monochrome with the breeze style
......
......@@ -31,17 +31,4 @@ Kirigami.AbstractCard {
readonly property double headerFontScale: 1.25
showClickFeedback: true
function showBoardingPass()
{
applicationWindow().pageStack.push(pkpassComponent);
}
Component {
id: pkpassComponent
App.PkPassPage {
passId: root.passId
pass: _pkpassManager.passObject(root.passId)
}
}
}
......@@ -76,8 +76,15 @@ Kirigami.ApplicationWindow {
id: contextDrawer
}
pageStack.initialPage: mainPageComponent
Component {
id: mainPageComponent
App.TimelinePage {}
}
Component {
id: pkpassComponent
App.PkPassPage {
pass: _pkpassManager.passObject(passId)
}
}
}
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