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 as Kirigami
0008 import QtQuick
0009 import QtQuick.Controls
0010 import QtQuick.Layouts
0011 import QtWebView
0012 
0013 Kirigami.OverlaySheet {
0014     id: sheet
0015 
0016     property QtObject transaction
0017     property bool acted: false
0018     property alias url: view.url
0019 
0020     showCloseButton: false
0021 
0022     readonly property var p0: Connections {
0023         target: transaction
0024         function onWebflowDone() {
0025             acted = true
0026             sheet.close()
0027         }
0028     }
0029 
0030     WebView {
0031         id: view
0032         Layout.preferredWidth: Math.round(window.width * 0.75)
0033         height: Math.round(window.height * 0.75)
0034     }
0035 
0036     footer: RowLayout {
0037         Item { Layout.fillWidth : true }
0038 
0039         Button {
0040             Layout.alignment: Qt.AlignRight
0041             text: i18n("Cancel")
0042             icon.name: "dialog-cancel"
0043             onClicked: {
0044                 transaction.cancel()
0045                 sheet.acted = true
0046                 sheet.close()
0047             }
0048             Keys.onEscapePressed: clicked()
0049         }
0050     }
0051 
0052     onVisibleChanged: if (!visible) {
0053         sheet.destroy(1000)
0054         if (!sheet.acted) {
0055             transaction.cancel()
0056         }
0057     }
0058 }