Warning, /plasma/plasma-bigscreen/containments/homescreen/package/contents/ui/indicators/KdeConnect.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.14 0009 import QtQuick.Window 2.14 0010 import QtQuick.Layouts 1.14 0011 import QtQml.Models 2.14 0012 import org.kde.plasma.plasmoid 2.0 0013 import QtQuick.Controls 2.14 as Controls 0014 import org.kde.kirigami 2.12 as Kirigami 0015 import org.kde.kdeconnect 1.0 as KDEConnect 0016 import org.kde.plasma.private.nanoshell as NanoShell 0017 0018 AbstractIndicator { 0019 id: connectionIcon 0020 icon.name: "kdeconnect" 0021 property var window 0022 property bool mycroftIntegration: plasmoid.nativeInterface.bigLauncherDbusAdapterInterface.mycroftIntegrationActive() ? 1 : 0 0023 0024 Connections { 0025 target: plasmoid.nativeInterface.bigLauncherDbusAdapterInterface 0026 onEnableMycroftIntegrationChanged: { 0027 mycroftIntegration = plasmoid.nativeInterface.bigLauncherDbusAdapterInterface.mycroftIntegrationActive() 0028 if(mycroftIntegration) { 0029 mycroftLoader.active = true 0030 } else { 0031 mycroftLoader.item.disconnectclose() 0032 } 0033 } 0034 } 0035 0036 KDEConnect.DevicesModel { 0037 id: allDevicesModel 0038 } 0039 0040 Repeater { 0041 model: allDevicesModel 0042 delegate: Item { 0043 property bool pairingRequest: device.hasPairingRequests 0044 property var bigscreenIface: KDEConnect.BigscreenDbusInterfaceFactory.create(device.id()) 0045 0046 Connections { 0047 target: bigscreenIface 0048 onMessageReceived: message => { 0049 if (mycroftLoader.item) { 0050 mycroftLoader.item.sendText(message); 0051 } 0052 } 0053 } 0054 0055 onPairingRequestChanged: { 0056 if (pairingRequest) { 0057 if(device.name.length > 0){ 0058 var component = Qt.createComponent("PairWindow.qml"); 0059 if (component.status != Component.Ready) 0060 { 0061 if (component.status == Component.Error) { 0062 console.debug("Error: "+ component.errorString()); 0063 } 0064 return; 0065 } else { 0066 window = component.createObject("root", {currentDevice: device}) 0067 window.show() 0068 window.requestActivate() 0069 } 0070 0071 } else { 0072 console.log("Unknown Request") 0073 } 0074 0075 } else { 0076 console.log("pairing request timedout/closed") 0077 window.close() 0078 } 0079 } 0080 } 0081 } 0082 0083 Loader { 0084 id: mycroftLoader 0085 source: connectionIcon.mycroftIntegration && Qt.resolvedUrl("MycroftConnect.qml") ? Qt.resolvedUrl("MycroftConnect.qml") : null 0086 } 0087 0088 onClicked: { 0089 NanoShell.StartupFeedback.open( 0090 "kdeconnect", 0091 i18n("KDE Connect"), 0092 connectionIcon.Kirigami.ScenePosition.x + connectionIcon.width/2, 0093 connectionIcon.Kirigami.ScenePosition.y + connectionIcon.height/2, 0094 Math.min(connectionIcon.width, connectionIcon.height)); 0095 plasmoid.nativeInterface.executeCommand("plasma-settings -s -m kcm_mediacenter_kdeconnect") 0096 } 0097 }