Warning, /network/angelfish/lib/contents/ui/ErrorHandler.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2014-2015 Sebastian Kügler <sebas@kde.org>
0002 //
0003 // SPDX-License-Identifier: GPL-2.0-or-later
0004 
0005 import QtQuick 2.3
0006 import QtQuick.Controls 2.0 as Controls
0007 import QtQuick.Layouts 1.0
0008 import QtWebEngine 1.1
0009 
0010 import org.kde.kirigami 2.17 as Kirigami
0011 
0012 
0013 Item {
0014     id: errorHandler
0015 
0016     signal refreshRequested
0017     signal certificateIgnored
0018 
0019     property string errorCode: ""
0020     property alias errorString: errorDescription.text
0021     property var certErrors: []
0022 
0023     Kirigami.Theme.inherit: false
0024     Kirigami.Theme.colorSet: Kirigami.Theme.View
0025 
0026     Behavior on height { NumberAnimation { duration: Kirigami.Units.longDuration; easing.type: Easing.InOutQuad} }
0027 
0028     Rectangle {
0029         anchors.fill: parent
0030         Kirigami.Theme.inherit: true
0031         color: Kirigami.Theme.backgroundColor
0032     }
0033 
0034     ColumnLayout {
0035         spacing: Kirigami.Units.gridUnit
0036         anchors {
0037             fill: parent
0038             margins: Kirigami.Units.gridUnit
0039         }
0040         Kirigami.Heading {
0041             opacity: 0.3
0042             text: errorCode
0043         }
0044         Kirigami.Heading {
0045             level: 3
0046             Layout.fillHeight: false
0047             text: i18n("Error loading the page")
0048         }
0049         Controls.Label {
0050             id: errorDescription
0051             Layout.fillHeight: false
0052         }
0053         Item {
0054             Layout.fillHeight: true
0055         }
0056         Controls.ToolButton {
0057             Layout.alignment: Qt.AlignHCenter
0058             text: i18n("Retry")
0059             icon.name: "view-refresh"
0060             onClicked: errorHandler.refreshRequested()
0061         }
0062     }
0063     Kirigami.OverlayDrawer {
0064         id: sslErrorDrawer
0065         edge: Qt.BottomEdge
0066         contentItem: ColumnLayout {
0067             Controls.Label {
0068                 Layout.fillWidth: true
0069                 wrapMode: Text.WordWrap
0070                 text: i18n(
0071 "Do you wish to continue?\n\n \
0072 If you wish so, you may continue with an unverified certificate.\n \
0073 Accepting an unverified certificate means\n \
0074 you may not be connected with the host you tried to connect to.\n \
0075 Do you wish to override the security check and continue?")
0076             }
0077             Controls.Button {
0078                 Layout.alignment: Qt.AlignRight
0079                 text: i18n("Yes")
0080                 onClicked: {
0081                     certErrors.shift().ignoreCertificateError();
0082                     errorHandler.certificateIgnored();
0083                     sslErrorDrawer.close();
0084                 }
0085             }
0086             Controls.Button {
0087                 Layout.alignment: Qt.AlignRight
0088                 text: i18n("No")
0089                 onClicked: {
0090                     certErrors.shift().rejectCertificate();
0091                     sslErrorDrawer.close();
0092                 }
0093             }
0094         }
0095     }
0096 
0097     function open(error){
0098         certErrors.push(error);
0099         sslErrorDrawer.open();
0100     }
0101 }