diff options
Diffstat (limited to 'desktop/modules/notifications')
| -rw-r--r-- | desktop/modules/notifications/NotificationsModule.qml | 14 | ||||
| -rw-r--r-- | desktop/modules/notifications/NotificationsPage.qml | 8 |
2 files changed, 9 insertions, 13 deletions
diff --git a/desktop/modules/notifications/NotificationsModule.qml b/desktop/modules/notifications/NotificationsModule.qml index 7a113df..df52949 100644 --- a/desktop/modules/notifications/NotificationsModule.qml +++ b/desktop/modules/notifications/NotificationsModule.qml @@ -27,6 +27,7 @@ Module { property var draft: Notify.config property string notice: "" + property string error: "" // The installed sound themes (directories with an index.theme), and the // system theme as gsettings has it, "" when unreadable. Both reread on // every refresh, so a change made outside the page shows. @@ -45,7 +46,7 @@ Module { nm.themeLister.running = false; nm.themeLister.running = true; nm.gsGet.running = false; nm.gsGet.running = true; } - function discard() { nm.follow(); nm.notice = ""; } + function discard() { nm.follow(); nm.notice = ""; nm.error = ""; } function edit(patch) { nm.draft = Object.assign({}, nm.draft, patch); } // Unknown keys in the file survive, including inside timeouts and @@ -56,6 +57,7 @@ Module { // the sequence notes' bodyWriter uses (NotesModule.qml). function save() { nm.notice = ""; + nm.error = ""; const raw = Notify.rawConfig; const obj = v => v && typeof v === "object" && !Array.isArray(v) ? v : {}; const out = Object.assign({}, raw, nm.draft, { @@ -82,10 +84,10 @@ Module { nm.saver.stdinEnabled = false; } onExited: code => { - nm.notice = code === 0 ? "saved" - : code === 2 ? "saved; notifyd not reachable, it reads the file at its next start" - : code === 3 ? "saved; the system sound theme could not be set" - : "could not write " + Notify.configPath; + if (code === 1) nm.error = "could not write config.json"; + else nm.notice = code === 0 ? "saved" + : code === 2 ? "saved; notifyd not running, it reads it at start" + : "saved; system sound theme not set"; nm.gsGet.running = false; nm.gsGet.running = true; } } @@ -110,6 +112,8 @@ Module { title: "Notifications" actions: Component { SaveBar { dirty: nm.dirty; valid: nm.valid; note: "caps are 1 to 100"; busy: nm.saver.running + notice: nm.notice; noticeColor: nm.notice === "saved" ? Theme.green : Theme.yellow + error: nm.error onSave: nm.save(); onDiscard: nm.discard() } } NotificationsPage { width: parent.width; mod: nm } diff --git a/desktop/modules/notifications/NotificationsPage.qml b/desktop/modules/notifications/NotificationsPage.qml index ce09a9d..612fb83 100644 --- a/desktop/modules/notifications/NotificationsPage.qml +++ b/desktop/modules/notifications/NotificationsPage.qml @@ -286,12 +286,4 @@ Column { value = ""; } } - - Text { - width: pg.width; wrapMode: Text.Wrap - visible: pg.mod.notice !== "" - text: pg.mod.notice - color: pg.mod.notice === "saved" ? Theme.green : Theme.yellow - font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 3 } - } } |
