diff options
Diffstat (limited to 'desktop')
| -rw-r--r-- | desktop/modules/notifications/NotificationsPage.qml | 14 |
1 files 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 }); + } } } } |
