Warning, /plasma/plasma-bigscreen/kcms/kdeconnect/ui/DeviceConnectionView.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 SPDX-FileCopyrightText: 2020 Aditya Mehra <aix.m@outlook.com>
0003 SPDX-FileCopyrightText: 2015 Aleix Pol Gonzalez <aleixpol@kde.org>
0004
0005 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0006 */
0007
0008 import QtQuick 2.14
0009 import QtQuick.Layouts 1.14
0010 import QtQuick.Controls 2.14
0011 import org.kde.plasma.core 2.0 as PlasmaCore
0012 import org.kde.plasma.components 2.0 as PlasmaComponents2
0013 import org.kde.plasma.components 3.0 as PlasmaComponents
0014 import org.kde.kirigami 2.12 as Kirigami
0015 import org.kde.mycroft.bigscreen 1.0 as BigScreen
0016 import org.kde.kdeconnect 1.0
0017 import Qt5Compat.GraphicalEffects
0018
0019 import "delegates" as Delegates
0020
0021 Rectangle {
0022 id: deviceView
0023 color: Kirigami.Theme.backgroundColor
0024 property QtObject currentDevice
0025 property bool hasPairingRequests: deviceView.currentDevice.hasPairingRequests
0026 property bool isTrusted: deviceView.currentDevice.isTrusted
0027 property bool isReachable: deviceView.currentDevice.isReachable
0028
0029 onCurrentDeviceChanged: checkCurrentStatus()
0030
0031 onHasPairingRequestsChanged: {
0032 if(hasPairingRequests) {
0033 checkCurrentStatus()
0034 }
0035 }
0036
0037 onIsTrustedChanged: checkCurrentStatus()
0038 onIsReachableChanged: checkCurrentStatus()
0039
0040 onActiveFocusChanged: {
0041 if(activeFocus){
0042 deviceStatView.forceActiveFocus()
0043 }
0044 }
0045
0046 function checkCurrentStatus() {
0047 //if (deviceView.currentDevice.hasPairingRequests) {
0048 // deviceStatView.currentIndex = 1
0049 //} else
0050 // disable pairing request handler in kcm as indicator handles pairing in bigscreen
0051 if (deviceView.currentDevice.isReachable) {
0052 if (deviceView.currentDevice.isTrusted) {
0053 deviceIconStatus.source = deviceView.currentDevice.statusIconName
0054 deviceStatView.currentIndex = 2
0055
0056 } else {
0057 deviceIconStatus.source = deviceView.currentDevice.iconName
0058 deviceStatView.currentIndex = 0
0059 }
0060
0061 } else {
0062 deviceStatView.currentIndex = 3
0063 }
0064 }
0065
0066 ColumnLayout {
0067 id: colLayoutSettingsItem
0068 clip: true
0069
0070 anchors {
0071 top: parent.top
0072 left: parent.left
0073 right: parent.right
0074 bottom: headerAreaSettingsItem.top
0075 margins: Kirigami.Units.largeSpacing * 2
0076 }
0077
0078 Item {
0079 Layout.fillWidth: true
0080 Layout.preferredHeight: parent.height * 0.20
0081 }
0082
0083 Item {
0084 Layout.fillWidth: true
0085 Layout.preferredHeight: parent.height / 3
0086 Layout.alignment: Qt.AlignTop
0087
0088 Rectangle {
0089 id: dIcon
0090 anchors.top: headrSept.bottom
0091 anchors.topMargin: Kirigami.Units.largeSpacing
0092 anchors.horizontalCenter: parent.horizontalCenter
0093 width: PlasmaCore.Units.iconSizes.huge
0094 height: width
0095 radius: 100
0096 color: Kirigami.Theme.backgroundColor
0097
0098 Kirigami.Icon {
0099 id: deviceIconStatus
0100 anchors.centerIn: parent
0101 width: PlasmaCore.Units.iconSizes.large
0102 height: width
0103 source: currentDevice.iconName
0104 }
0105 }
0106
0107 Kirigami.Heading {
0108 id: label2
0109 width: parent.width
0110 anchors.top: dIcon.bottom
0111 anchors.topMargin: Kirigami.Units.largeSpacing
0112 horizontalAlignment: Text.AlignHCenter
0113 wrapMode: Text.WordWrap
0114 level: 2
0115 maximumLineCount: 2
0116 elide: Text.ElideRight
0117 color: Kirigami.Theme.textColor
0118 text: currentDevice.name
0119 }
0120
0121 Kirigami.Separator {
0122 id: lblSept2
0123 anchors.top: label2.bottom
0124 anchors.topMargin: Kirigami.Units.smallSpacing
0125 height: 1
0126 width: parent.width
0127 }
0128
0129 StackLayout {
0130 id: deviceStatView
0131 anchors.top: lblSept2.bottom
0132 anchors.topMargin: Kirigami.Units.largeSpacing
0133 anchors.left: parent.left
0134 anchors.right: parent.right
0135 anchors.bottom: parent.bottom
0136 currentIndex: 0
0137
0138 onActiveFocusChanged: {
0139 if(activeFocus) {
0140 deviceStatView.itemAt(currentIndex).forceActiveFocus();
0141 }
0142 }
0143
0144 Delegates.UnpairedView{
0145 id: unpairedView
0146 }
0147
0148 Delegates.PairRequest{
0149 id: pairRequestView
0150 }
0151
0152 Delegates.PairedView{
0153 id: pairedView
0154 }
0155
0156 Delegates.Unreachable{
0157 id: unreachableView
0158 }
0159 }
0160 }
0161 }
0162
0163 RowLayout {
0164 id: headerAreaSettingsItem
0165 anchors.bottom: parent.bottom
0166 anchors.left: parent.left
0167 anchors.right: parent.right
0168 anchors.margins: Kirigami.Units.largeSpacing * 2
0169 height: Kirigami.Units.gridUnit * 2
0170
0171 PlasmaComponents2.Button {
0172 id: backBtnSettingsItem
0173 iconSource: "arrow-left"
0174 Layout.alignment: Qt.AlignLeft
0175
0176 KeyNavigation.down: deviceStatView
0177
0178 PlasmaComponents2.Highlight {
0179 z: -2
0180 anchors.fill: parent
0181 anchors.margins: -Kirigami.Units.gridUnit / 4
0182 visible: backBtnSettingsItem.activeFocus ? 1 : 0
0183 }
0184
0185 Keys.onReturnPressed: {
0186 clicked()
0187 }
0188
0189 onClicked: {
0190 connectionView.forceActiveFocus()
0191 }
0192 }
0193
0194 Label {
0195 id: backbtnlabelHeading
0196 text: i18n("Press the [←] Back button to return to device selection")
0197 wrapMode: Text.WordWrap
0198 maximumLineCount: 2
0199 Layout.fillWidth: true
0200 Layout.alignment: Qt.AlignRight
0201 }
0202 }
0203 }