Warning, /pim/itinerary/src/app/TimelineDelegate.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2018 Volker Krause <vkrause@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 import QtQuick
0008 import QtQuick.Layouts
0009 import QtQuick.Controls as QQC2
0010 import org.kde.kirigami as Kirigami
0011 import org.kde.kirigamiaddons.formcard as FormCard
0012 import org.kde.itinerary
0013 
0014 FormCard.FormCard {
0015     id: root
0016     width: ListView.view.width
0017     /** Reservation batch identifier (@see ReservationManager). */
0018     property alias batchId: _controller.batchId
0019     /** All reservations that are part of this patch. */
0020     property var resIds: ReservationManager.reservationsForBatch(root.batchId)
0021     /** A random reservation object, in case there's more than one.
0022      *  Use this only for accessing properties that will be the same for all travelers.
0023      */
0024     readonly property var reservation: ReservationManager.reservation(root.batchId);
0025     /** Reservation::reservationFor, unique for all travelers on a multi-traveler reservation set */
0026     readonly property var reservationFor: reservation.reservationFor
0027     property var rangeType
0028 
0029     property Item headerItem
0030     property alias headerIcon: _headerIcon
0031     property alias headerIconSource: _headerIcon.source
0032     property alias contentItem: content.contentItem
0033     signal clicked
0034 
0035     property QtObject controller: TimelineDelegateController {
0036         id: _controller
0037         reservationManager: ReservationManager
0038         liveDataManager: LiveDataManager
0039         transferManager: TransferManager
0040         documentManager: DocumentManager
0041     }
0042     property alias arrival: _controller.arrival
0043     property alias departure: _controller.departure
0044 
0045     function showDetails(detailsComponent) {
0046         while (applicationWindow().pageStack.depth > 1) {
0047             applicationWindow().pageStack.pop();
0048         }
0049         applicationWindow().pageStack.push(detailsComponent);
0050     }
0051 
0052     property color headerTextColor: controller.isCanceled ? headerBackground.Kirigami.Theme.disabledTextColor : headerBackground.Kirigami.Theme.textColor
0053     FormCard.AbstractFormDelegate {
0054         onClicked: root.clicked()
0055         background: Rectangle {
0056             id: headerBackground
0057             color: Kirigami.Theme.backgroundColor
0058             Kirigami.Theme.colorSet: controller.isCurrent ? Kirigami.Theme.Selection : controller.isCanceled ? Kirigami.Theme.View : Kirigami.Theme.Header
0059             Kirigami.Theme.inherit: false
0060 
0061             Rectangle {
0062                 id: progressBar
0063                 visible: controller.isCurrent
0064                 anchors.bottom: headerBackground.bottom
0065                 anchors.left: headerBackground.left
0066                 height: Kirigami.Units.smallSpacing
0067                 width: controller.progress * headerBackground.width
0068                 color: Kirigami.Theme.visitedLinkColor
0069             }
0070         }
0071         contentItem: RowLayout {
0072             id: headerLayout
0073 
0074             TransportIcon {
0075                 id: _headerIcon
0076                 color: root.headerTextColor
0077                 isMask: true
0078                 size: Kirigami.Units.iconSizes.smallMedium
0079             }
0080         }
0081     }
0082 
0083     FormCard.AbstractFormDelegate {
0084         id: content
0085         onClicked: root.clicked()
0086         Layout.fillWidth: true
0087 
0088     }
0089 
0090     onHeaderItemChanged: {
0091         if (headerItem) {
0092             headerItem.parent = headerLayout
0093         }
0094     }
0095 
0096     Accessible.onPressAction: root.clicked()
0097 }