aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/modules/sbbuilder/Store.qml
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/modules/sbbuilder/Store.qml')
-rw-r--r--desktop/modules/sbbuilder/Store.qml12
1 files changed, 10 insertions, 2 deletions
diff --git a/desktop/modules/sbbuilder/Store.qml b/desktop/modules/sbbuilder/Store.qml
index b4a1ba1..c2afa5d 100644
--- a/desktop/modules/sbbuilder/Store.qml
+++ b/desktop/modules/sbbuilder/Store.qml
@@ -13,7 +13,8 @@ import QtQuick
import "Toml.js" as T
// One config.toml's draft, the store qtmaildir's Setting and BoolSetting
-// edit. Fields hand it text; it writes the type of the key's default, the
+// edit. ponytail: a list entry holding a space cannot be entered here; edit
+// the file. Fields hand it text; it writes the type of the key's default, the
// type sb-builder checks on load: a list is words split on spaces, a number
// is a number, a switch is true or false.
QtObject {
@@ -45,10 +46,17 @@ QtObject {
function value(section, key) { return T.get(st.draft, section, key) ?? st.fallback(section, key); }
function entries(section) { return T.entries(st.draft, section); }
function put(section, key, v) {
- try { st.draft = T.set(st.draft, section, key, v); } catch (e) { st.error = e.message; }
+ try { st.draft = T.set(st.draft, section, key, v); } catch (e) {
+ st.error = e.message;
+ st.markInvalid(section + "/" + key, true); // hold Save back
+ }
}
// A field's text; null or "" unsets.
function set(section, key, t) {
+ // An empty manifest URL is a row still being typed: unsetting would
+ // remove it. Mark it invalid instead; Setting marks the id valid just
+ // before calling set, so this mark, made after, is the one that stays.
+ if (section === "manifests" && t === "") return st.markInvalid(section + "/" + key, true);
if (t === null || t === "") return st.put(section, key, null);
const d = st.fallback(section, key);
st.put(section, key, Array.isArray(d) ? t.split(/\s+/).filter(x => x !== "")