Avoid visual Phone harness teardown
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import QtQuick
|
||||
import qs.services
|
||||
|
||||
// Nonvisual owner of Phone Controls' stable action model and enablement rules.
|
||||
// Keeping this logic free of delegates and icons makes it safe to exercise in
|
||||
// disposable diagnostic engines.
|
||||
QtObject {
|
||||
id: root
|
||||
|
||||
readonly property var actionModels: [
|
||||
{ id: "share", glyph: "\u{F0142}", label: "Send file" },
|
||||
{ id: "clipboard", glyph: "\u{F014C}", label: "Clipboard" },
|
||||
{ id: "ring", glyph: "\u{F009A}", label: "Ring" },
|
||||
{ id: "messages", glyph: "\u{F0365}", label: "Messages" }
|
||||
]
|
||||
|
||||
function actionEnabled(action: string): bool {
|
||||
if (action === "messages")
|
||||
return SystemSettings.bluebubblesAvailable;
|
||||
return KdeConnect.phoneReachable
|
||||
&& !KdeConnect.transferActive
|
||||
&& KdeConnect.supports(action);
|
||||
}
|
||||
}
|
||||
@@ -10,14 +10,11 @@ Item {
|
||||
signal toggleExpanded
|
||||
|
||||
readonly property var phone: KdeConnect.preferredPhone
|
||||
// Keep the four slots stable. The KDE actions can become unavailable when
|
||||
// the phone disconnects, but the layout should not shift beneath Messages.
|
||||
readonly property var actionModels: [
|
||||
{ id: "share", glyph: "\u{F0142}", label: "Send file" },
|
||||
{ id: "clipboard", glyph: "\u{F014C}", label: "Clipboard" },
|
||||
{ id: "ring", glyph: "\u{F009A}", label: "Ring" },
|
||||
{ id: "messages", glyph: "\u{F0365}", label: "Messages" }
|
||||
]
|
||||
readonly property var actionModels: phoneActions.actionModels
|
||||
|
||||
PhoneActions {
|
||||
id: phoneActions
|
||||
}
|
||||
|
||||
implicitHeight: content.implicitHeight
|
||||
|
||||
@@ -288,11 +285,7 @@ Item {
|
||||
}
|
||||
|
||||
function actionEnabled(action: string): bool {
|
||||
if (action === "messages")
|
||||
return SystemSettings.bluebubblesAvailable;
|
||||
return KdeConnect.phoneReachable
|
||||
&& !KdeConnect.transferActive
|
||||
&& KdeConnect.supports(action);
|
||||
return phoneActions.actionEnabled(action);
|
||||
}
|
||||
|
||||
function actionAccessibleDescription(action: string): string {
|
||||
|
||||
@@ -8,6 +8,7 @@ HomeBrightnessSlider 1.0 HomeBrightnessSlider.qml
|
||||
HomeControls 1.0 HomeControls.qml
|
||||
HomeTile 1.0 HomeTile.qml
|
||||
IconButton 1.0 IconButton.qml
|
||||
PhoneActions 1.0 PhoneActions.qml
|
||||
PhoneControls 1.0 PhoneControls.qml
|
||||
QuickSettings 1.0 QuickSettings.qml
|
||||
QuickSettingsPanel 1.0 QuickSettingsPanel.qml
|
||||
|
||||
@@ -8,9 +8,8 @@ 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
|
||||
PhoneActions {
|
||||
id: phoneActions
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
@@ -46,9 +45,9 @@ ShellRoot {
|
||||
|
||||
function status(): string {
|
||||
return JSON.stringify({
|
||||
actions: phoneControls.actionModels.map(action => ({
|
||||
actions: phoneActions.actionModels.map(action => ({
|
||||
id: action.id,
|
||||
enabled: phoneControls.actionEnabled(action.id)
|
||||
enabled: phoneActions.actionEnabled(action.id)
|
||||
})),
|
||||
bluebubblesAvailable: SystemSettings.bluebubblesAvailable,
|
||||
appLaunches: SystemSettings.launchCount,
|
||||
|
||||
Reference in New Issue
Block a user