kdeconnect-kde/declarativeplugin/qml/PluginChecker.qml
Fabian Arndt b24d629802 virtualmonitor: implemented capabilities check
BUG: 485829

## Summary

Currently, the plugin just fails silently if the local device is missing the `krfb` package or if the remote device misses an `vnc://` protocol/scheme handler. You click the button and nothing happens.

One issue is, that the plugin is considered `virtualmonitor.available` in the `DeviceDelegate.qml`, even if the check for `krfb-virtualmonitor` fails and no dbus-path is provided. I investigated the behavior a bit, but ignored it in the end as this MR benefits from being shown for device constellations that _could_ provide this feature.

A warning is shown with brief instructions, how to get the plugin working correctly.

- Check if krfb-virtualmonitor is available locally
- Check default scheme handler for vnc:// on device (Linux)
- Show warnings / reasons, if no connection could be established


## Test Plan

Regarding if the devices have mentioned packages installed, we should see different behaviors.

If the remote device has no VNC client, it can not connect to out server. _A warning should be shown._

If the local device hasn't the `krfb-virtualmonitor` available, the remote device couldn't connect. _A warning should be shown._

If both problems are present, _both warnings should be shown._


If none of these are present, no warning should be shown and we should try to establish a connection.


The connection attempts failed? _A warning should be shown._
2024-05-30 23:13:54 +00:00

47 lines
1.3 KiB
QML

/**
* SPDX-FileCopyrightText: 2014 Samoilenko Yuri <kinnalru@gmail.com>
* SPDX-FileCopyrightText: 2016 David Kahles <david.kahles96@gmail.com>
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
import QtQml 2.2
import org.kde.kdeconnect 1.0
QtObject {
id: root
property alias device: conn.target
property string pluginName: ""
property bool available: false
property string iconName: ""
readonly property Connections connection: Connections {
id: conn
function onPluginsChanged() {
root.pluginsChanged();
}
}
Component.onCompleted: pluginsChanged()
readonly property var v: DBusAsyncResponse {
id: availableResponse
autoDelete: false
onSuccess: (result) => { root.available = result; }
onError: () => { root.available = false }
}
function pluginsChanged() {
availableResponse.setPendingCall(device.hasPlugin("kdeconnect_" + pluginName))
iconResponse.setPendingCall(device.pluginIconName("kdeconnect_" + pluginName))
}
readonly property var vv: DBusAsyncResponse {
id: iconResponse
autoDelete: false
onSuccess: (result) => { root.iconName = result; }
onError: () => { root.iconName = "" }
}
}