From dd8a4ee43c045230fa982c7ee49166f7c8c6529b Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Sun, 20 Sep 2026 11:45:11 +0200 Subject: feat(desktop): dismissable bluetooth pairing error on the page A failed pairing showed the raw bluetoothctl output as a plain red line that only cleared on the next attempt, and the desktop notification is suppressed while the drawer is open, so the failure was easy to miss and impossible to dismiss. Show it in a red card with a close control that clears pairing.error. It has no timeout, and clearing the source means the next identical failure shows again rather than staying hidden. --- desktop/modules/bluetooth/BluetoothPage.qml | 50 ++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 5 deletions(-) (limited to 'desktop/modules/bluetooth/BluetoothPage.qml') diff --git a/desktop/modules/bluetooth/BluetoothPage.qml b/desktop/modules/bluetooth/BluetoothPage.qml index 5bfdc0b..a4ba232 100644 --- a/desktop/modules/bluetooth/BluetoothPage.qml +++ b/desktop/modules/bluetooth/BluetoothPage.qml @@ -180,12 +180,52 @@ Column { } } - Text { + // A failed pairing leaves the real bluetoothctl output here. No timeout: + // it stays until dismissed, and the next failure sets it again, so an + // identical error reappears rather than staying hidden. Dismissing clears + // the source, not a local flag, so it survives this page unloading. The + // desktop notification is sent separately and is not touched by this. + Rectangle { width: page.width visible: page.bt.pairing.error !== "" - wrapMode: Text.Wrap - text: page.bt.pairing.error - font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 3 } - color: Theme.red + implicitHeight: errText.implicitHeight + 16 + radius: 8 + color: Qt.alpha(Theme.red, 0.12) + border.width: 1 + border.color: Qt.alpha(Theme.red, 0.35) + + Text { + id: errText + anchors { + left: parent.left; leftMargin: 10 + right: errClose.left; rightMargin: 8 + verticalCenter: parent.verticalCenter + } + wrapMode: Text.Wrap + text: page.bt.pairing.error + font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 3 } + color: Theme.red + } + + Text { + id: errClose + anchors { right: parent.right; rightMargin: 8; verticalCenter: parent.verticalCenter } + width: 20 + height: 20 + text: "\uf00d" + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + font { family: Theme.iconFamily; pixelSize: 13 } + color: errCloseArea.containsMouse ? Theme.red : Theme.subtext + + MouseArea { + id: errCloseArea + anchors.fill: parent + anchors.margins: -6 + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + onClicked: page.bt.pairing.error = "" + } + } } } -- cgit v1.2.3