1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
/**
* SPDX-FileCopyrightText: 2014 Samoilenko Yuri <kinnalru@gmail.com>
* SPDX-FileCopyrightText: 2016 David Kahles <david.kahles96@gmail.com>
* SPDX-FileCopyrightText: 2024 ivan tkachenko <me@ratijas.tk>
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
pragma ComponentBehavior: Bound
import QtQml
import org.kde.kdeconnect as KDEConnect
QtObject {
id: root
property KDEConnect.DeviceDbusInterface device
property string pluginName
property bool available
property string iconName
readonly property Connections connection: Connections {
id: conn
target: root.device
function onPluginsChanged(): void {
root.pluginsChanged();
}
}
Component.onCompleted: {
pluginsChanged();
}
readonly property KDEConnect.DBusAsyncResponse __availableResponse: KDEConnect.DBusAsyncResponse {
id: availableResponse
autoDelete: false
onSuccess: result => {
root.available = result;
}
onError: message => {
root.available = false;
}
}
function pluginsChanged(): void {
if (device) {
availableResponse.setPendingCall(device.hasPlugin("kdeconnect_" + pluginName));
iconResponse.setPendingCall(device.pluginIconName("kdeconnect_" + pluginName));
}
}
readonly property KDEConnect.DBusAsyncResponse __iconResponse: KDEConnect.DBusAsyncResponse {
id: iconResponse
autoDelete: false
onSuccess: result => {
root.iconName = result;
}
onError: message => {
root.iconName = "";
}
}
}
|