Files
Panama/tests/quickshell/fixtures/PhoneControlsKdeConnect.qml

31 lines
976 B
QML

pragma Singleton
import QtQuick
QtObject {
id: root
property bool available: false
property var devices: []
property bool transferActive: false
property string lastError: ""
property var recentExchange: null
property int actionCount: 0
readonly property var preferredPhone: {
const phones = root.devices.filter(device => device.type === "phone" && device.paired);
return phones.find(device => device.reachable) ?? phones[0] ?? null;
}
readonly property bool phoneReachable: root.preferredPhone?.reachable === true
readonly property var phoneActions: root.preferredPhone?.actions ?? []
function supports(action: string): bool {
return root.phoneActions.indexOf(action) >= 0;
}
function refresh(): void {}
function sendFile(path: string): void { root.actionCount += 1; }
function sendClipboard(): void { root.actionCount += 1; }
function ring(): void { root.actionCount += 1; }
}