Fix Phone controls runtime accessibility
This commit is contained in:
@@ -138,8 +138,20 @@ Item {
|
||||
color: actionMouse.containsMouse && actionMouse.enabled
|
||||
? Theme.alpha(Theme.accent, 0.15)
|
||||
: Theme.alpha(Theme.accent, 0.075)
|
||||
border.width: actionMouse.activeFocus ? 2 : 0
|
||||
border.color: Theme.accent
|
||||
opacity: actionMouse.enabled ? 1 : 0.48
|
||||
|
||||
Accessible.role: Accessible.Button
|
||||
Accessible.name: actionButton.modelData.label
|
||||
Accessible.description: root.actionAccessibleDescription(actionButton.modelData.id)
|
||||
Accessible.focusable: actionMouse.enabled
|
||||
Accessible.focused: actionMouse.activeFocus
|
||||
Accessible.onPressAction: {
|
||||
if (actionMouse.enabled)
|
||||
root.invoke(actionButton.modelData.id);
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top: parent.top
|
||||
@@ -162,11 +174,7 @@ Item {
|
||||
MouseArea {
|
||||
id: actionMouse
|
||||
anchors.fill: parent
|
||||
enabled: actionButton.modelData.id === "messages"
|
||||
? SystemSettings.bluebubblesAvailable
|
||||
: KdeConnect.phoneReachable
|
||||
&& !KdeConnect.transferActive
|
||||
&& KdeConnect.supports(actionButton.modelData.id)
|
||||
enabled: root.actionEnabled(actionButton.modelData.id)
|
||||
hoverEnabled: true
|
||||
activeFocusOnTab: enabled
|
||||
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
@@ -181,7 +189,7 @@ Item {
|
||||
Text {
|
||||
width: parent.width
|
||||
visible: root.phone && !KdeConnect.phoneReachable && root.actionModels.length > 0
|
||||
text: "Actions become available when the iPhone reconnects"
|
||||
text: "KDE Connect actions are unavailable until the iPhone reconnects"
|
||||
color: Theme.fgMuted
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
font.family: Theme.fontFamily
|
||||
@@ -279,6 +287,20 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
function actionEnabled(action: string): bool {
|
||||
if (action === "messages")
|
||||
return SystemSettings.bluebubblesAvailable;
|
||||
return KdeConnect.phoneReachable
|
||||
&& !KdeConnect.transferActive
|
||||
&& KdeConnect.supports(action);
|
||||
}
|
||||
|
||||
function actionAccessibleDescription(action: string): string {
|
||||
if (action === "messages")
|
||||
return SystemSettings.bluebubblesAvailable ? "Opens BlueBubbles" : "BlueBubbles is not installed";
|
||||
return root.actionEnabled(action) ? "Available through KDE Connect" : "Unavailable through KDE Connect";
|
||||
}
|
||||
|
||||
function localPath(selectedUrl: url): string {
|
||||
const value = String(selectedUrl);
|
||||
if (!value.startsWith("file://"))
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
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 {
|
||||
PhoneControls {
|
||||
id: phoneControls
|
||||
width: 408
|
||||
}
|
||||
|
||||
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 === "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: phoneControls.actionModels.map(action => ({
|
||||
id: action.id,
|
||||
enabled: phoneControls.actionEnabled(action.id)
|
||||
})),
|
||||
bluebubblesAvailable: SystemSettings.bluebubblesAvailable,
|
||||
appLaunches: SystemSettings.launchCount,
|
||||
phoneActions: KdeConnect.actionCount
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user