diff options
| author | Danilo M. <danix@danix.xyz> | 2026-10-21 10:20:18 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-10-21 10:20:18 +0200 |
| commit | a16a02a12f6945c1b9e0b1e6a5716678f50eaa93 (patch) | |
| tree | fe483fcf2fd00bde5658a4c0bd5b7362ceb094a1 /desktop/modules/sbbuilder/Store.qml | |
| parent | 82ddf40282e7dc913a241a8f31cb2855b1bb74da (diff) | |
| download | quickshell-a16a02a12f6945c1b9e0b1e6a5716678f50eaa93.tar.gz quickshell-a16a02a12f6945c1b9e0b1e6a5716678f50eaa93.zip | |
sbbuilder: fixes from review
Toml: a value followed by anything but a comment was parsed as if the
line ended there, so a multi-line string (which opens with an empty one)
or `x = "a" junk` read as valid and set() could write a duplicate or
mangle it. entries() now skips such lines and set() refuses them with the
existing "cannot edit" error. The ponytail comment names the ceilings.
Store: a failed put left Save enabled with a stale draft; it now marks the
key invalid. An empty manifest URL used to unset, which removed the row
being typed in; it now marks the row invalid instead (Setting clears the
mark just before set, so the one made inside set stays). Noted that list
entries with spaces cannot be entered here.
Sbb: refresh() ran an ssh fetch for the desktop page too and let two
fetches overlap, or one run during a save. It is split into reloadDesktop()
and fetch(false), and fetch() returns while busy. A successful config-get
clears a stale VM error, and a missing text reads as empty. The put now
writes and records the draft as sent, so typing during the save is not
marked saved.
SbbVmModule: fields are read-only while busy, a Reload button sits beside
the status line, and the manifest URL field says Remove deletes the row.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Diffstat (limited to 'desktop/modules/sbbuilder/Store.qml')
| -rw-r--r-- | desktop/modules/sbbuilder/Store.qml | 12 |
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 !== "") |
