Warning, /network/kdeconnect-kde/app/qml/DevicePage.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 * SPDX-FileCopyrightText: 2015 Aleix Pol Gonzalez <aleixpol@kde.org>
0003 *
0004 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 */
0006
0007 import QtQuick
0008 import QtCore
0009 import QtQuick.Controls as QQC2
0010 import QtQuick.Layouts
0011 import QtQuick.Dialogs
0012 import org.kde.kirigami as Kirigami
0013 import org.kde.kdeconnect
0014
0015 Kirigami.ScrollablePage {
0016 id: root
0017 property QtObject currentDevice
0018 title: currentDevice.name
0019
0020 actions: [
0021 Kirigami.Action {
0022 icon.name: "network-disconnect"
0023 onTriggered: root.currentDevice.unpair()
0024 text: i18nd("kdeconnect-app", "Unpair")
0025 visible: root.currentDevice && root.currentDevice.isPaired
0026 },
0027 Kirigami.Action {
0028 icon.name: "hands-free"
0029 text: i18nd("kdeconnect-app", "Send Ping")
0030 visible: root.currentDevice && root.currentDevice.isPaired && root.currentDevice.isReachable
0031 onTriggered: {
0032 root.currentDevice.pluginCall("ping", "sendPing");
0033 }
0034 },
0035 Kirigami.Action {
0036 icon.name: "settings-configure"
0037 text: i18n("Plugin Settings")
0038 visible: root.currentDevice && root.currentDevice.isPaired && root.currentDevice.isReachable
0039 onTriggered: {
0040 pageStack.push(
0041 Qt.resolvedUrl("PluginSettings.qml"),
0042 {device: currentDevice.id()}
0043 );
0044 }
0045 }
0046 ]
0047
0048 ListView {
0049 model: plugins.filter((plugin) => plugin.loaded)
0050 delegate: QQC2.ItemDelegate {
0051 text: modelData.name
0052 icon.name: modelData.iconName
0053 highlighted: false
0054 icon.color: "transparent"
0055 width: ListView.view.width
0056 onClicked: modelData.onClick()
0057 }
0058
0059 property list<QtObject> plugins: [
0060 PluginItem {
0061 name: i18nd("kdeconnect-app", "Multimedia control")
0062 interfaceFactory: MprisDbusInterfaceFactory
0063 component: "mpris.qml"
0064 pluginName: "mprisremote"
0065 device: root.currentDevice
0066 },
0067 PluginItem {
0068 name: i18nd("kdeconnect-app", "Remote input")
0069 interfaceFactory: RemoteControlDbusInterfaceFactory
0070 component: "mousepad.qml"
0071 pluginName: "remotecontrol"
0072 device: root.currentDevice
0073 },
0074 PluginItem {
0075 name: i18nd("kdeconnect-app", "Presentation Remote")
0076 interfaceFactory: RemoteKeyboardDbusInterfaceFactory
0077 component: "presentationRemote.qml"
0078 pluginName: "remotecontrol"
0079 device: root.currentDevice
0080 },
0081 PluginItem {
0082 readonly property var lockIface: LockDeviceDbusInterfaceFactory.create(root.currentDevice.id())
0083 pluginName: "lockdevice"
0084 name: lockIface.isLocked ? i18nd("kdeconnect-app", "Unlock") : i18nd("kdeconnect-app", "Lock")
0085 onClick: () => lockIface.isLocked = !lockIface.isLocked;
0086 device: root.currentDevice
0087 },
0088 PluginItem {
0089 readonly property var findmyphoneIface: FindMyPhoneDbusInterfaceFactory.create(root.currentDevice.id())
0090 pluginName: "findmyphone"
0091 name: i18nd("kdeconnect-app", "Find Device")
0092 onClick: () => findmyphoneIface.ring()
0093 device: root.currentDevice
0094 },
0095 PluginItem {
0096 name: i18nd("kdeconnect-app", "Run command")
0097 interfaceFactory: RemoteCommandsDbusInterfaceFactory
0098 component: "runcommand.qml"
0099 pluginName: "remotecommands"
0100 device: root.currentDevice
0101 },
0102 PluginItem {
0103 readonly property var clipboardIface: ClipboardDbusInterfaceFactory.create(root.currentDevice.id())
0104 pluginName: "clipboard"
0105 name: i18nd("kdeconnect-app", "Send Clipboard")
0106 onClick: () => clipboardIface.sendClipboard()
0107 device: root.currentDevice
0108 },
0109 PluginItem {
0110 pluginName: "share"
0111 name: i18nd("kdeconnect-app", "Share File")
0112 onClick: () => fileDialog.open()
0113 device: root.currentDevice
0114 },
0115 PluginItem {
0116 name: i18nd("kdeconnect-app", "Volume control")
0117 interfaceFactory: RemoteSystemVolumeDbusInterfaceFactory
0118 component: "volume.qml"
0119 pluginName: "remotesystemvolume"
0120 device: root.currentDevice
0121 }
0122 ]
0123
0124 Kirigami.PlaceholderMessage {
0125 text: i18nd("kdeconnect-app", "This device is not paired")
0126 anchors.centerIn: parent
0127 visible: root.currentDevice && root.currentDevice.isReachable && !root.currentDevice.isPaired && !root.currentDevice.isPairRequestedByPeer && !root.currentDevice.isPairRequested
0128 helpfulAction: Kirigami.Action {
0129 text: i18ndc("kdeconnect-app", "Request pairing with a given device", "Pair")
0130 icon.name:"network-connect"
0131 onTriggered: root.currentDevice.requestPairing()
0132 }
0133 }
0134
0135 Kirigami.PlaceholderMessage {
0136 text: i18nd("kdeconnect-app", "Pair requested")
0137 anchors.centerIn: parent
0138 visible: root.currentDevice && root.currentDevice.isReachable && root.currentDevice.isPairRequested
0139 QQC2.BusyIndicator {
0140 Layout.alignment: Qt.AlignHCenter
0141 }
0142 }
0143
0144 Kirigami.PlaceholderMessage {
0145 text: i18n("Pair requested")
0146 visible: root.currentDevice && root.currentDevice.isPairRequestedByPeer
0147 anchors.centerIn: parent
0148 spacing: Kirigami.Units.largeSpacing
0149 RowLayout {
0150 QQC2.Button {
0151 text: i18nd("kdeconnect-app", "Accept")
0152 icon.name:"dialog-ok"
0153 onClicked: root.currentDevice.acceptPairing()
0154 }
0155
0156 QQC2.Button {
0157 text: i18nd("kdeconnect-app", "Reject")
0158 icon.name:"dialog-cancel"
0159 onClicked: root.currentDevice.cancelPairing()
0160 }
0161 }
0162 }
0163
0164 Kirigami.PlaceholderMessage {
0165 visible: root.currentDevice && !root.currentDevice.isReachable
0166 text: i18nd("kdeconnect-app", "This device is not reachable")
0167 anchors.centerIn: parent
0168 }
0169 }
0170
0171 FileDialog {
0172 id: fileDialog
0173 readonly property var shareIface: root.currentDevice ? ShareDbusInterfaceFactory.create(root.currentDevice.id()) : null
0174 title: i18nd("kdeconnect-app", "Please choose a file")
0175 currentFolder: StandardPaths.standardLocations(StandardPaths.HomeLocation)[0]
0176 onAccepted: shareIface.shareUrl(fileDialog.fileUrl)
0177 }
0178 }