Commit e6bfc2b7 authored by Volker Krause's avatar Volker Krause

Cleanup/simplify showing of pkpass boarding passes

parent 76d2ff01
......@@ -58,6 +58,7 @@ qml_lint(
BusDelegate.qml
FlightDelegate.qml
HotelDelegate.qml
PkPassPage.qml
PlaceDelegate.qml
RestaurantDelegate.qml
TicketPage.qml
......
......@@ -97,7 +97,7 @@ App.TimelineDelegate {
QQC2.Button {
Layout.alignment: Qt.AlignHCenter
text: qsTr("Boarding Pass")
onClicked: showBoardingPass(root.pass, root.passId)
onClicked: showBoardingPass()
visible: root.passId !== ""
icon.source: root.passId !== "" ? "image://org.kde.pkpass/" + passId + "/icon" : ""
}
......
/*
Copyright (C) 2018 Volker Krause <vkrause@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.5
import org.kde.kirigami 2.0 as Kirigami
import "." as App
Kirigami.Page {
property alias passId: pkpass.passId
property alias pass: pkpass.pass
App.BoardingPass {
x: (parent.width - implicitWidth) / 2
id: pkpass
}
onBackRequested: pageStack.pop()
}
......@@ -29,7 +29,12 @@ Item {
readonly property double headerFontScale: 1.25
signal showBoardingPass(var pass, string passId)
function showBoardingPass()
{
applicationWindow().pageStack.push(pkpassComponent);
applicationWindow().pageStack.currentItem.passId = passId
applicationWindow().pageStack.currentItem.pass = pass
}
function showTicket()
{
......@@ -37,9 +42,13 @@ Item {
applicationWindow().pageStack.currentItem.reservation = reservation;
}
Component {
id: pkpassComponent
App.PkPassPage {}
}
Component {
id: ticketPageComponent
App.TicketPage {
}
App.TicketPage {}
}
}
......@@ -24,7 +24,6 @@ import "." as App
Kirigami.ScrollablePage {
id: root
signal showBoardingPass(var pass, string passId)
title: qsTr("My Itinerary")
// context drawer content
......@@ -100,14 +99,10 @@ Kirigami.ScrollablePage {
item.reservation = Qt.binding(function() { return modelData.reservation; });
item.passId = Qt.binding(function() { return modelData.passId; });
item.pass = Qt.binding(function() { return modelData.pass; });
item.showBoardingPass.connect(onShowBoardingPass);
} else {
item.visible = modelData.isTodayEmpty;
}
}
function onShowBoardingPass(pass, passId) {
root.showBoardingPass(pass, passId)
}
}
section.property: "sectionHeader"
......
......@@ -78,25 +78,6 @@ Kirigami.ApplicationWindow {
pageStack.initialPage: mainPageComponent
Component {
id: mainPageComponent
App.TimelinePage {
onShowBoardingPass: {
pageStack.push(pkpassComponent);
pageStack.currentItem.passId = passId
pageStack.currentItem.pass = pass
}
}
}
Component {
id: pkpassComponent
Kirigami.Page {
property alias passId: pkpass.passId
property alias pass: pkpass.pass
App.BoardingPass {
x: (parent.width - implicitWidth) / 2
id: pkpass
}
onBackRequested: pageStack.pop()
}
App.TimelinePage {}
}
}
......@@ -5,6 +5,7 @@
<file>BusDelegate.qml</file>
<file>FlightDelegate.qml</file>
<file>HotelDelegate.qml</file>
<file>PkPassPage.qml</file>
<file>PlaceDelegate.qml</file>
<file>RestaurantDelegate.qml</file>
<file>TicketPage.qml</file>
......
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