Warning, /graphics/okular/mobile/app/package/contents/ui/SignaturePropertiesDialog.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 * SPDX-FileCopyrightText: 2022 Albert Astals Cid <aacid@kde.org>
0003 *
0004 * SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006
0007 import QtCore
0008 import QtQuick 2.15
0009 import QtQuick.Window 2.15
0010 import QtQuick.Controls 2.15 as QQC2
0011 import QtQuick.Dialogs as QQD
0012 import QtQuick.Layouts 1.15
0013 import org.kde.kirigami 2.17 as Kirigami
0014
0015 Kirigami.OverlaySheet
0016 {
0017 id: root
0018
0019 property alias signatureValidityText: signatureValidity.text
0020 property alias documentModificationsText: documentModifications.text
0021 property alias signerNameText: signerName.text
0022 property alias signingTimeText: signingTime.text
0023 property alias signingLocationText: signingLocation.text
0024 property alias signingReasonText: signingReason.text
0025
0026 property var certificateModel
0027 property int signatureRevisionIndex: -1
0028
0029 signal saveSignatureSignedVersion(url path)
0030
0031 title: i18n("Signature Properties")
0032
0033 function showErrorDialog() {
0034 errorDialog.open();
0035 }
0036
0037 ColumnLayout {
0038 // Without this the width is unreasonably narrow, potentially
0039 // https://invent.kde.org/frameworks/kirigami/-/merge_requests/487 fixes it
0040 // check when a kirigami with that is required as minimum version
0041 Layout.preferredWidth: Math.min(Window.window.width, 360)
0042
0043 QQC2.GroupBox {
0044 Layout.fillWidth: true
0045 title: i18n("Validity Status")
0046
0047 Kirigami.FormLayout {
0048 width: parent.width
0049 QQC2.Label {
0050 id: signatureValidity
0051 Kirigami.FormData.label: i18n("Signature Validity:")
0052 wrapMode: Text.Wrap
0053 Layout.fillWidth: true
0054 }
0055 QQC2.Label {
0056 id: documentModifications
0057 Kirigami.FormData.label: i18n("Document Modifications:")
0058 wrapMode: Text.Wrap
0059 Layout.fillWidth: true
0060 }
0061 }
0062 }
0063 QQC2.GroupBox {
0064 title: i18n("Additional Information")
0065 Layout.fillWidth: true
0066
0067 Kirigami.FormLayout {
0068 id: additionalInformationLayout
0069
0070 width: parent.width
0071 QQC2.Label {
0072 id: signerName
0073 Kirigami.FormData.label: i18n("Signed By:")
0074 wrapMode: Text.Wrap
0075 Layout.fillWidth: true
0076 }
0077 QQC2.Label {
0078 id: signingTime
0079 Kirigami.FormData.label: i18n("Signing Time:")
0080 wrapMode: Text.Wrap
0081 Layout.fillWidth: true
0082 }
0083 QQC2.Label {
0084 id: signingReason
0085 Kirigami.FormData.label: i18n("Reason:")
0086 visible: text
0087 wrapMode: Text.Wrap
0088 Layout.fillWidth: true
0089 }
0090 QQC2.Label {
0091 id: signingLocation
0092 Kirigami.FormData.label: i18n("Location:")
0093 visible: text
0094 wrapMode: Text.Wrap
0095 Layout.fillWidth: true
0096 }
0097 }
0098 }
0099
0100 QQC2.GroupBox {
0101 title: i18n("Document Version")
0102 Layout.fillWidth: true
0103
0104 visible: root.signatureRevisionIndex >= 0
0105
0106 RowLayout {
0107 width: parent.width
0108
0109 QQC2.Label {
0110 Layout.fillWidth: true
0111 text: i18nc("Document Revision <current> of <total>", "Document Revision %1 of %2", root.signatureRevisionIndex + 1, documentItem.signaturesModel.count)
0112 wrapMode: Text.Wrap
0113 }
0114 QQC2.Button {
0115 text: i18n("Save Signed Version...")
0116 onClicked: {
0117 fileDialog.open();
0118 }
0119 }
0120 }
0121 }
0122
0123 QQC2.DialogButtonBox {
0124 Layout.topMargin: Kirigami.Units.largeSpacing
0125 Layout.fillWidth: true
0126
0127 QQC2.Button {
0128 QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.ActionRole
0129 text: i18n("View Certificate...")
0130 onClicked: {
0131 var dialog = dialogComponent.createObject(Window.window, {
0132 certificateModel: root.certificateModel
0133 })
0134 dialog.open()
0135 }
0136
0137 Component {
0138 id: dialogComponent
0139 CertificateViewerDialog {
0140 onVisibleChanged: if(!visible) {
0141 destroy(1000)
0142 }
0143 }
0144 }
0145 }
0146
0147 QQC2.Button {
0148 QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.DestructiveRole
0149 text: i18n("Close")
0150 icon.name: "dialog-close"
0151 onClicked: root.close()
0152 }
0153 }
0154
0155 QQD.FileDialog {
0156 id: fileDialog
0157 currentFolder: StandardPaths.standardLocations(StandardPaths.DocumentsLocation)[0]
0158 fileMode: QQD.FileDialog.SaveFile
0159 onAccepted: {
0160 root.saveSignatureSignedVersion(fileDialog.selectedFile);
0161 }
0162 }
0163
0164 // TODO Use Kirigami.PromptDialog when we depend on KF >= 5.89
0165 // this way we can probably remove that ridiculous z value
0166 QQC2.Dialog {
0167 id: errorDialog
0168 z: 200
0169 title: i18n("Error")
0170 contentItem: QQC2.Label {
0171 text: i18n("Could not save the signature.")
0172 }
0173 standardButtons: QQC2.Dialog.Ok
0174
0175 onAccepted: close();
0176 }
0177 }
0178 }