Warning, /plasma/plasma-bigscreen/kcms/kdeconnect/ui/delegates/UnpairedView.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2020 Aditya Mehra <aix.m@outlook.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 */
0006 
0007 import QtQuick 2.14
0008 import QtQuick.Layouts 1.14
0009 import QtQuick.Controls 2.14
0010 import org.kde.kirigami 2.12 as Kirigami
0011 import org.kde.plasma.components 3.0 as PlasmaComponents
0012 import org.kde.kdeconnect 1.0
0013 
0014 Item {
0015     id: untrustedDevice
0016     Layout.fillWidth: true
0017     Layout.fillHeight: true
0018     
0019     onActiveFocusChanged: {
0020         pairBtn.forceActiveFocus()
0021     }
0022     
0023     Timer {
0024            id: timer
0025     }
0026 
0027     function delay(delayTime, cb) {
0028             timer.interval = delayTime;
0029             timer.repeat = false;
0030             timer.triggered.connect(cb);
0031             timer.start();
0032     }
0033     
0034     ColumnLayout {
0035         anchors.fill: parent
0036         
0037         PlasmaComponents.Label {
0038             Layout.fillWidth: true
0039             horizontalAlignment: Text.AlignHCenter
0040             text: i18n("This device is not paired")
0041         }
0042         
0043         Button {
0044             id: pairBtn
0045             Layout.fillWidth: true
0046             Layout.preferredHeight: Kirigami.Units.gridUnit * 2
0047             Kirigami.Theme.colorSet: Kirigami.Theme.Button
0048             
0049             Keys.onReturnPressed: {
0050                 clicked()
0051             }
0052                 
0053             onClicked: {
0054                 deviceView.currentDevice.requestPair()
0055                 pairRequestNotification.visible = true
0056                 delay(2500, function() {
0057                     pairRequestNotification.visible = false
0058                 })
0059             }
0060                 
0061             KeyNavigation.up: backBtnSettingsItem
0062         
0063             background: Rectangle {
0064                 color: pairBtn.activeFocus ? Kirigami.Theme.highlightColor : Kirigami.Theme.backgroundColor
0065                 border.width: 0.75
0066                 border.color: Qt.tint(Kirigami.Theme.textColor, Qt.rgba(Kirigami.Theme.backgroundColor.r, Kirigami.Theme.backgroundColor.g, Kirigami.Theme.backgroundColor.b, 0.8))
0067             }
0068             
0069             contentItem: Item {
0070                 RowLayout {
0071                     anchors.centerIn: parent
0072                 
0073                     Kirigami.Icon {
0074                         Layout.preferredWidth: PlasmaCore.Units.iconSizes.small
0075                         Layout.preferredHeight: PlasmaCore.Units.iconSizes.small
0076                         source: "network-connect"
0077                     }
0078                     
0079                     PlasmaComponents.Label {
0080                         text: i18n("Pair")
0081                     }
0082                 }
0083             }
0084         }
0085         
0086         PlasmaComponents.Label {
0087             id: pairRequestNotification
0088             Layout.fillWidth: true
0089             horizontalAlignment: Text.AlignHCenter
0090             visible: false
0091             text: i18n("Pairing request sent to device")
0092         }
0093     }
0094 }