Files
Panama/config/dot/quickshell/phone-controls-harness.qml
T

69 lines
2.2 KiB
QML

import Quickshell
import Quickshell.Io
import QtQuick
import qs.modules.quicksettings
import qs.services
// Component-only diagnostic surface. The contract replaces the two services in
// its copied configuration with fixture singletons before this file is run.
ShellRoot {
PhoneActions {
id: phoneActions
}
IpcHandler {
target: "phone-controls-test"
function fixture(name: string): void {
KdeConnect.available = false;
KdeConnect.transferActive = false;
KdeConnect.lastError = "";
if (name === "offline") {
KdeConnect.devices = [{
id: "fixture-phone",
name: "Fixture iPhone",
type: "phone",
paired: true,
reachable: false,
actions: []
}];
} else if (name === "unsupported") {
KdeConnect.available = true;
KdeConnect.devices = [{
id: "fixture-phone",
name: "Fixture iPhone",
type: "phone",
paired: true,
reachable: true,
actions: ["share"]
}];
} else if (name === "transfer") {
KdeConnect.available = true;
KdeConnect.transferActive = true;
KdeConnect.devices = [{
id: "fixture-phone",
name: "Fixture iPhone",
type: "phone",
paired: true,
reachable: true,
actions: ["share", "clipboard", "ring"]
}];
}
}
function status(): string {
return JSON.stringify({
actions: phoneActions.actionModels.map(action => ({
id: action.id,
enabled: phoneActions.actionEnabled(action.id)
})),
bluebubblesAvailable: SystemSettings.bluebubblesAvailable,
appLaunches: SystemSettings.launchCount,
phoneActions: KdeConnect.actionCount
});
}
}
}