diff options
| author | Danilo M. <danix@danix.xyz> | 2026-11-07 12:06:21 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-11-07 12:06:21 +0100 |
| commit | 1aaf9fbaf3fbb91218a4aea9455bc22c45707c6c (patch) | |
| tree | 9743a5a4f683f63b39c2905400d70c5eac08e2c3 /desktop/modules/sonix | |
| parent | 3d871cd89c7ccde777a54916d8a3232cfb7ce5e9 (diff) | |
| download | quickshell-1aaf9fbaf3fbb91218a4aea9455bc22c45707c6c.tar.gz quickshell-1aaf9fbaf3fbb91218a4aea9455bc22c45707c6c.zip | |
sonix: folders tab fixes from review
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Diffstat (limited to 'desktop/modules/sonix')
| -rw-r--r-- | desktop/modules/sonix/SonixFolders.qml | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/desktop/modules/sonix/SonixFolders.qml b/desktop/modules/sonix/SonixFolders.qml index ad7ae88..b00f4c3 100644 --- a/desktop/modules/sonix/SonixFolders.qml +++ b/desktop/modules/sonix/SonixFolders.qml @@ -33,9 +33,11 @@ Column { function report(ok, d, err) { fo.error = ok ? "" : err; } function go(p) { + fo.notice = ""; Sonix.get("/api/browse?" + S.query({ path: p }), (ok, d, err) => { fo.report(ok, d, err); if (!ok) return; + if (typeof d !== "object" || d === null) { fo.error = String(d).trim() || "unexpected answer"; return; } fo.root = d.root; fo.path = d.path; fo.entries = d.entries || []; @@ -48,11 +50,13 @@ Column { function filesIn(folder, cb) { Sonix.get("/api/browse?" + S.query({ path: folder }), (ok, d, err) => { if (!ok) { fo.report(ok, d, err); return; } + if (typeof d !== "object" || d === null) { fo.error = String(d).trim() || "unexpected answer"; return; } cb((d.entries || []).filter(e => !e.dir).map(e => e.path)); }); } function playFolder(folder) { + fo.notice = ""; fo.filesIn(folder, files => { if (files.length === 0) { fo.error = "no tracks directly in this folder"; return; } Sonix.command({ do: "play_path", path: files[0], list: "folder", value: folder }, null, fo.report); @@ -62,6 +66,7 @@ Column { function addTo(name) { const a = fo.adding; if (!a || name === "") return; + newName.value = ""; const send = paths => { if (paths.length === 0) { fo.error = "no tracks directly in this folder"; return; } Sonix.command({ do: "playlist_add", value: name }, paths.join("\n"), (ok, d, err) => { @@ -102,7 +107,7 @@ Column { Button { text: "Up" - icon: "" + icon: "\uf062" enabled: fo.path !== fo.root onClicked: fo.go(S.parentOf(fo.path, fo.root)) } @@ -164,7 +169,7 @@ Column { glyph: fo.glyph(0xF040A) // md-play onClicked: modelData.dir ? fo.playFolder(modelData.path) - : Sonix.command({ do: "play_path", path: modelData.path, list: "folder", value: fo.path }, null, fo.report) + : (fo.notice = "", Sonix.command({ do: "play_path", path: modelData.path, list: "folder", value: fo.path }, null, fo.report)) } TransportButton { glyph: fo.glyph(0xF0415) // md-plus |
