Warning, /pim/vakzination/src/qml/main.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 QtCore
0007 import QtQuick 2.15
0008 import QtQuick.Controls 2.15 as Controls
0009 import QtQuick.Layouts 1.2
0010 import QtQuick.Dialogs
0011 import org.kde.kirigami 2.15 as Kirigami
0012 
0013 import org.kde.vakzination 1.0
0014 
0015 Kirigami.ApplicationWindow {
0016     id: root
0017 
0018     title: i18n("Your Certificates")
0019 
0020     globalDrawer: Kirigami.GlobalDrawer {
0021         isMenu: true
0022         actions: [
0023             Kirigami.Action {
0024                 text: i18n("Import from file")
0025                 icon.name: "folder-open"
0026                 onTriggered: fileDialog.open()
0027             },
0028             Kirigami.Action {
0029                 text: i18n("Import from clipboard")
0030                 icon.name: "edit-paste"
0031                 onTriggered: CertificatesModel.importCertificateFromClipboard()
0032             },
0033             Kirigami.Action {
0034                 text: i18n("Scan QR code")
0035                 icon.name: "view-barcode-qr"
0036                 onTriggered: applicationWindow().pageStack.push(scanBarcodePage);
0037             }
0038         ]
0039     }
0040 
0041     minimumWidth: Kirigami.Units.gridUnit * 20
0042     minimumHeight: Kirigami.Units.gridUnit * 20
0043 
0044     pageStack.globalToolBar.toolbarActionAlignment: Qt.AlignLeft
0045 
0046     pageStack.initialPage: Qt.resolvedUrl("CertificatesPage.qml")
0047 
0048     FileDialog {
0049         id: fileDialog
0050         currentFolder: StandardPaths.writableLocation(StandardPaths.DocumentsLocation)
0051         onAccepted: CertificatesModel.importCertificate(selectedFile)
0052     }
0053 
0054     Component {
0055         id: scanBarcodePage
0056         ScanBarcodePage {}
0057     }
0058 
0059     DropArea {
0060         onEntered: {
0061             if (!drag.hasUrls) {
0062                 drag.accepted = false;
0063             }
0064         }
0065         onDropped: {
0066             for (const i in drop.urls) {
0067                 CertificatesModel.importCertificate(drop.urls[i]);
0068             }
0069         }
0070         anchors.fill: parent
0071     }
0072 }