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

0001 // SPDX-FileCopyrightText: 2019 Volker Krause <vkrause@kde.org>
0002 // SPDX-FileCopyrightText: 2022 Carl Schwan <carl@carlschwan.eu>
0003 // SPDX-License-Identifier: LGPL-2.0-or-later
0004 
0005 import QtQuick
0006 import QtQuick.Layouts
0007 import QtQuick.Controls as QQC2
0008 import org.kde.kirigami as Kirigami
0009 import org.kde.kirigamiaddons.formcard as FormCard
0010 import org.kde.itinerary
0011 
0012 /// Booking details
0013 ColumnLayout {
0014     id: root
0015 
0016     required property var reservation
0017 
0018     visible: referenceLabel.visible || underNameLabel.visible || ticketNumberLabel.visible || priceLabel.visible
0019 
0020     Layout.fillWidth: true
0021 
0022     FormCard.FormHeader {
0023         title: i18n("Booking")
0024     }
0025 
0026     FormCard.FormCard {
0027         FormCard.FormTextDelegate {
0028             id: referenceLabel
0029             text: i18n("Reference")
0030             description: root.reservation.reservationNumber
0031             visible: root.reservation.reservationNumber
0032 
0033             trailing: QQC2.ToolButton {
0034                 display: QQC2.AbstractButton.IconOnly
0035                 text: i18nc("@info:tooltip", "Copy to Clipboard")
0036                 icon.name: "edit-copy"
0037                 onClicked: {
0038                     Clipboard.saveText(root.reservation.reservationNumber);
0039                     applicationWindow().showPassiveNotification(i18n("Booking reference copied to clipboard"));
0040                 }
0041 
0042                 QQC2.ToolTip.text: text
0043                 QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
0044                 QQC2.ToolTip.visible: hovered
0045             }
0046         }
0047 
0048         FormCard.FormDelegateSeparator { visible: referenceLabel.visible }
0049 
0050         FormCard.FormTextDelegate {
0051             id: underNameLabel
0052             text: i18n("Under name")
0053             description: root.reservation.underName ? root.reservation.underName.name : ''
0054             visible: description
0055         }
0056 
0057         FormCard.FormDelegateSeparator { visible: underNameLabel.visible }
0058 
0059         FormCard.FormTextDelegate {
0060             id: ticketNumberLabel
0061             text: i18n("Ticket number:")
0062             description: root.reservation.reservedTicket ? root.reservation.reservedTicket.ticketNumber : ''
0063             visible: description.length > 0 && description !== referenceLabel.description
0064 
0065             trailing: QQC2.ToolButton {
0066                 display: QQC2.AbstractButton.IconOnly
0067                 text: i18nc("@info:tooltip", "Copy to Clipboard")
0068                 icon.name: "edit-copy"
0069                 onClicked: {
0070                     Clipboard.saveText(root.reservation.reservedTicket.ticketNumber);
0071                     applicationWindow().showPassiveNotification(i18n("Ticket number copied to clipboard"));
0072                 }
0073 
0074                 QQC2.ToolTip.text: text
0075                 QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
0076                 QQC2.ToolTip.visible: hovered
0077             }
0078         }
0079 
0080         FormCard.FormDelegateSeparator { visible: ticketNumberLabel.visible }
0081 
0082         FormPriceDelegate {
0083             id: priceLabel
0084             item: root.reservation
0085         }
0086     }
0087 }