From d30518748d926b380557dd99b2e5bcb083aafb0a Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Mon, 19 Oct 2026 09:21:35 +0200 Subject: desktop: rebind the notification page's fields after an edit Typing replaces a Field's value binding, so Discard left the typed text showing over the reverted draft, and a rejected timeout kept displaying. Co-Authored-By: Claude Opus 5.5 --- desktop/modules/notifications/NotificationsPage.qml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/desktop/modules/notifications/NotificationsPage.qml b/desktop/modules/notifications/NotificationsPage.qml index b85a6d7..37fa2a1 100644 --- a/desktop/modules/notifications/NotificationsPage.qml +++ b/desktop/modules/notifications/NotificationsPage.qml @@ -48,7 +48,13 @@ Column { visible: pg.d.timeouts[modelData[0]] !== 0 value: String(pg.d.timeouts[modelData[0]]) placeholder: "seconds" - onEdited: { const n = parseInt(value, 10); if (n > 0 && n <= 86400) pg.setTimeout(modelData[0], n); } + // Typing drops the value binding too: put it back so Discard + // shows the draft, and a rejected entry reverts at once. + onEdited: { + const n = parseInt(value, 10); + value = Qt.binding(() => String(pg.d.timeouts[modelData[0]])); + if (n > 0 && n <= 86400) pg.setTimeout(modelData[0], n); + } } Toggle { anchors.verticalCenter: parent.verticalCenter @@ -80,7 +86,11 @@ Column { anchors.verticalCenter: parent.verticalCenter value: String(pg.d[modelData[0]]) border.color: pg.d[modelData[0]] >= 1 && pg.d[modelData[0]] <= 100 ? Qt.alpha(Theme.text, 0.12) : Theme.red - onEdited: pg.mod.edit({ [modelData[0]]: parseInt(value, 10) || 0 }) + onEdited: { + const n = parseInt(value, 10) || 0; + value = Qt.binding(() => String(pg.d[modelData[0]])); + pg.mod.edit({ [modelData[0]]: n }); + } } } } -- cgit v1.2.3