Warning, /plasma/plasma-bigscreen/containments/homescreen/package/contents/ui/indicators/PairWindow.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2019 Marco Martin <mart@kde.org>
0003     SPDX-FileCopyrightText: 2019 Aditya Mehra <aix.m@outlook.com>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 import QtQuick 2.15
0009 import QtQuick.Window 2.15
0010 import QtQuick.Layouts 1.15
0011 import QtQuick.Controls 2.15 as Controls
0012 import org.kde.plasma.core 2.0 as PlasmaCore
0013 import org.kde.plasma.components 3.0 as PlasmaComponents
0014 import org.kde.kirigami 2.19 as Kirigami
0015 import org.kde.kdeconnect 1.0 as KDEConnect
0016 
0017 Window {
0018     id: root
0019     property QtObject currentDevice
0020     color: Qt.rgba(0, 0, 0, 0.8)
0021     flags: Qt.WindowStaysOnTopHint
0022 
0023     Kirigami.Theme.colorSet: Kirigami.Theme.Complementary
0024     
0025     onVisibleChanged: {
0026         if(visible){
0027             showMaximized()
0028             acceptButton.forceActiveFocus()
0029         }
0030     }
0031     
0032     Item {
0033         id: contentItem
0034         anchors.fill: parent
0035 
0036         ColumnLayout {
0037             id: pairingDialogLayout
0038             anchors.centerIn: parent
0039 
0040             Kirigami.Heading {
0041                 level: 3
0042                 text: i18n("Pairing Request From %1", currentDevice.name)
0043             }
0044 
0045             RowLayout {
0046                 Layout.fillWidth: true
0047                 Layout.minimumHeight: Kirigami.Units.gridUnit * 3
0048 
0049                 PlasmaComponents.Button {
0050                     id: acceptButton
0051                     Layout.fillWidth: true
0052                     Layout.minimumHeight: Kirigami.Units.gridUnit * 3
0053                     KeyNavigation.right: rejectButton
0054                     KeyNavigation.left: acceptButton
0055                     
0056                     background: Rectangle {
0057                         color: acceptButton.activeFocus ? Kirigami.Theme.highlightColor : Kirigami.Theme.backgroundColor
0058                     }
0059                     
0060                     contentItem: Item {
0061                         RowLayout {
0062                             anchors.centerIn: parent
0063                             Kirigami.Icon {
0064                                 Layout.preferredWidth: PlasmaCore.Units.iconSizes.small
0065                                 Layout.preferredHeight: PlasmaCore.Units.iconSizes.small
0066                                 source: "dialog-ok"
0067                             }
0068                             Controls.Label {
0069                                 text: i18n("Accept")
0070                             }
0071                         }
0072                     }
0073                                         
0074                     onClicked: (mouse)=> {
0075                         currentDevice.acceptPairing()
0076                         root.close()
0077                     }
0078                     
0079                     Keys.onReturnPressed: (event)=> {
0080                         clicked()
0081                     }
0082 
0083                 }
0084 
0085                 PlasmaComponents.Button {
0086                     id: rejectButton
0087                     Layout.fillWidth: true
0088                     Layout.minimumHeight: Kirigami.Units.gridUnit * 3
0089                     KeyNavigation.right: rejectButton
0090                     KeyNavigation.left: acceptButton
0091                     
0092                     background: Rectangle {
0093                         color: rejectButton.activeFocus ? Kirigami.Theme.highlightColor : Kirigami.Theme.backgroundColor
0094                     }
0095                     
0096                     contentItem: Item {
0097                         RowLayout {
0098                             anchors.centerIn: parent
0099                             Kirigami.Icon {
0100                                 Layout.preferredWidth: PlasmaCore.Units.iconSizes.small
0101                                 Layout.preferredHeight: PlasmaCore.Units.iconSizes.small
0102                                 source: "dialog-cancel"
0103                             }
0104                             Controls.Label {
0105                                 text: i18n("Reject")
0106                             }
0107                         }
0108                     }
0109                     
0110                     onClicked: (mouse)=> {
0111                         currentDevice.rejectPairing()
0112                         root.close()
0113                     }
0114                     
0115                     Keys.onReturnPressed: (event)=> {
0116                         clicked()
0117                     }
0118                 }
0119             }
0120         }
0121     }
0122 }