Warning, /pim/vakzination/src/qml/RecoveryDetailsSheet.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-License-Identifier: GPL-2.0-or-later 0003 SPDX-FileCopyrightText: 2021 Nicolas Fella <nicolas.fella@gmx.de> 0004 */ 0005 0006 import QtQuick 2.15 0007 import QtQuick.Controls 2.15 as QQC2 0008 import QtQuick.Layouts 1.2 0009 import org.kde.kirigami 2.15 as Kirigami 0010 import org.kde.khealthcertificate 1.0 as KHC 0011 0012 ColumnLayout { 0013 0014 required property var certificate 0015 0016 function daysTo(d1, d2) { 0017 return (d2.getTime() - d1.getTime()) / (1000 * 60 * 60 * 24); 0018 } 0019 0020 Kirigami.FormLayout { 0021 0022 Kirigami.Separator { 0023 Kirigami.FormData.isSection: true 0024 Kirigami.FormData.label: i18n("Person") 0025 } 0026 0027 QQC2.Label { 0028 text: certificate.name 0029 Kirigami.FormData.label: i18n("Name:") 0030 } 0031 QQC2.Label { 0032 text: certificate.dateOfBirth.toLocaleDateString(Qt.locale(), Locale.ShortFormat) 0033 visible: !isNaN(certificate.dateOfBirth.getTime()) 0034 Kirigami.FormData.label: i18n("Date of birth:") 0035 } 0036 0037 Kirigami.Separator { 0038 Kirigami.FormData.isSection: true 0039 Kirigami.FormData.label: i18n("Recovery") 0040 } 0041 0042 QQC2.Label { 0043 text: certificate.dateOfPositiveTest.toLocaleDateString(Qt.locale(), Locale.ShortFormat) 0044 Kirigami.FormData.label: i18n("Positive test:") 0045 } 0046 QQC2.Label { 0047 text: certificate.disease 0048 Kirigami.FormData.label: i18n("Disease:") 0049 } 0050 QQC2.Label { 0051 text: certificate.validFrom.toLocaleDateString(Qt.locale(), Locale.ShortFormat) 0052 Kirigami.FormData.label: i18n("Valid from:") 0053 } 0054 QQC2.Label { 0055 text: certificate.validUntil.toLocaleDateString(Qt.locale(), Locale.ShortFormat) 0056 Kirigami.FormData.label: i18n("Valid until:") 0057 } 0058 0059 Kirigami.Separator { 0060 Kirigami.FormData.isSection: true 0061 Kirigami.FormData.label: i18n("Certificate") 0062 } 0063 0064 QQC2.Label { 0065 text: certificate.certificateIssuer 0066 Kirigami.FormData.label: i18n("Issuer:") 0067 visible: text !== "" 0068 } 0069 QQC2.Label { 0070 text: certificate.certificateId 0071 Kirigami.FormData.label: i18n("Identifier:") 0072 wrapMode: Text.Wrap 0073 } 0074 QQC2.Label { 0075 text: certificate.certificateIssueDate.toLocaleString(Qt.locale(), Locale.ShortFormat) 0076 Kirigami.FormData.label: i18n("Issued:") 0077 visible: !isNaN(certificate.certificateIssueDate.getTime()) 0078 } 0079 QQC2.Label { 0080 text: certificate.certificateExpiryDate.toLocaleString(Qt.locale(), Locale.ShortFormat) 0081 Kirigami.FormData.label: i18n("Expires:") 0082 visible: !isNaN(certificate.certificateExpiryDate.getTime()) 0083 color: certificate.certificateExpiryDate.getTime() < Date.now() ? Kirigami.Theme.negativeTextColor : Kirigami.Theme.textColor 0084 } 0085 Kirigami.Icon { 0086 source: { 0087 switch(certificate.signatureState) { 0088 case KHC.HealthCertificate.ValidSignature: return "dialog-ok"; 0089 case KHC.HealthCertificate.UnknownSignature: return "question"; 0090 case KHC.HealthCertificate.InvalidSignature: 0091 default: 0092 return "dialog-error-symbolic"; 0093 } 0094 } 0095 height: Kirigami.Units.gridUnit 0096 Kirigami.FormData.label: i18n("Signature:") 0097 color: { 0098 switch(certificate.signatureState) { 0099 case KHC.HealthCertificate.ValidSignature: return Kirigami.Theme.positiveTextColor; 0100 case KHC.HealthCertificate.UnknownSignature: return Kirigami.Theme.neutralTextColor; 0101 case KHC.HealthCertificate.InvalidSignature: 0102 default: 0103 return Kirigami.Theme.negativeTextColor; 0104 } 0105 } 0106 visible: certificate.signatureState != KHC.HealthCertificate.UncheckedSignature 0107 } 0108 } 0109 }