From 6e45e93e6e225015304716b934bea5dd1f3e1478 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Wed, 21 Oct 2026 10:11:11 +0200 Subject: qtmaildir: Setting and BoolSetting take the draft as a store The sb-builder pages need the same fields over another file. The store defaults to Qtm, so the Mail pages are unchanged. Co-Authored-By: Claude Sonnet 5.5 --- desktop/modules/qtmaildir/BoolSetting.qml | 5 +++-- desktop/modules/qtmaildir/Setting.qml | 17 ++++++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) (limited to 'desktop/modules') diff --git a/desktop/modules/qtmaildir/BoolSetting.qml b/desktop/modules/qtmaildir/BoolSetting.qml index f5f8feb..a6a7030 100644 --- a/desktop/modules/qtmaildir/BoolSetting.qml +++ b/desktop/modules/qtmaildir/BoolSetting.qml @@ -21,11 +21,12 @@ Item { property string label property bool fallback: false property string hint: "" + property var store: Qtm objectName: section + "/" + key width: parent ? parent.width : 0 height: 34 - readonly property var raw: Qtm.get(s.section, s.key) + readonly property var raw: s.store.get(s.section, s.key) readonly property bool on: s.raw === undefined ? s.fallback : s.raw === "true" Text { @@ -41,7 +42,7 @@ Item { id: sw anchors { left: lbl.right; leftMargin: 8; verticalCenter: parent.verticalCenter } checked: s.on - onToggled: Qtm.set(s.section, s.key, checked ? "true" : "false") + onToggled: s.store.set(s.section, s.key, checked ? "true" : "false") } Text { anchors { left: sw.right; leftMargin: 10; right: parent.right; verticalCenter: parent.verticalCenter } diff --git a/desktop/modules/qtmaildir/Setting.qml b/desktop/modules/qtmaildir/Setting.qml index d29ee6e..69d47ad 100644 --- a/desktop/modules/qtmaildir/Setting.qml +++ b/desktop/modules/qtmaildir/Setting.qml @@ -12,7 +12,7 @@ import QtQuick import "../.." -// One labelled key of qtmaildir.conf: a text field that edits the draft as +// One labelled key of a settings file: a text field that edits the draft as // it is typed; the page's Save writes it. Emptied, the key is unset and // qtmaildir uses its default, which the placeholder names. kind "int" or // "float" checks the number and its range: a refused value stays out of the @@ -29,12 +29,15 @@ Column { property real max: Infinity // A #rrggbb key: a swatch beside the field opens a colour dialog. property bool colour: false + // The draft it edits: get, set, markInvalid, invalid. qtmaildir's by + // default; sbbuilder passes its own. + property var store: Qtm // What a search hit scrolls to. objectName: section + "/" + key width: parent ? parent.width : 0 spacing: 2 - readonly property string value: Qtm.get(s.section, s.key) ?? "" + readonly property string value: s.store.get(s.section, s.key) ?? "" property string problem: "" function apply(t) { @@ -47,8 +50,8 @@ Column { : `a number from ${s.min} to ${s.max}`; } s.problem = bad; - Qtm.markInvalid(s.objectName, bad !== ""); - if (bad === "") Qtm.set(s.section, s.key, t === "" ? null : t); + s.store.markInvalid(s.objectName, bad !== ""); + if (bad === "") s.store.set(s.section, s.key, t === "" ? null : t); } // The field is not bound to the value, which would reset the cursor and @@ -56,12 +59,12 @@ Column { // moves under it (Discard, a colour picked, a save of another page). onValueChanged: if (ti.text.trim() !== s.value && s.problem === "") ti.text = s.value Connections { - target: Qtm - function onInvalidChanged() { if (s.problem !== "" && !Qtm.invalid[s.objectName]) { s.problem = ""; ti.text = s.value; } } + target: s.store + function onInvalidChanged() { if (s.problem !== "" && !s.store.invalid[s.objectName]) { s.problem = ""; ti.text = s.value; } } } // A field that goes away cannot hold Save back; the draft keeps its last // good value. - Component.onDestruction: Qtm.markInvalid(s.objectName, false) + Component.onDestruction: s.store.markInvalid(s.objectName, false) Item { width: s.width -- cgit v1.2.3