Warning, /plasma/discover/discover/qml/WebflowDialog.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *   SPDX-FileCopyrightText: 2022 Aleix Pol Gonzalez <aleixpol@kde.org>
0003  *
0004  *   SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005  */
0006 
0007 import org.kde.kirigami 2.19 as Kirigami
0008 import QtQuick 2.15
0009 import QtQuick.Controls 2.15
0010 import QtQuick.Layouts 1.15
0011 import QtWebView 1.15
0012 
0013 Kirigami.OverlaySheet {
0014     id: sheet
0015     showCloseButton: false
0016     property QtObject transaction
0017     property bool acted: false
0018     property alias url: view.url
0019 
0020     readonly property var p0: Connections {
0021         target: transaction
0022         function onWebflowDone() {
0023             acted = true
0024             sheet.close()
0025         }
0026     }
0027 
0028     contentItem: WebView {
0029         id: view
0030         Layout.preferredWidth: Math.round(window.width * 0.75)
0031         height: Math.round(window.height * 0.75)
0032     }
0033 
0034     footer: RowLayout {
0035         Item { Layout.fillWidth : true }
0036 
0037         Button {
0038             Layout.alignment: Qt.AlignRight
0039             text: i18n("Cancel")
0040             icon.name: "dialog-cancel"
0041             onClicked: {
0042                 transaction.cancel()
0043                 sheet.acted = true
0044                 sheet.close()
0045             }
0046             Keys.onEscapePressed: clicked()
0047         }
0048     }
0049 
0050     onSheetOpenChanged: if(!sheetOpen) {
0051         sheet.destroy(1000)
0052         if (!sheet.acted)
0053             transaction.cancel()
0054     }
0055 }