aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/modules/qtmaildir/Setting.qml
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/modules/qtmaildir/Setting.qml')
-rw-r--r--desktop/modules/qtmaildir/Setting.qml17
1 files changed, 10 insertions, 7 deletions
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