aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/modules/island
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/modules/island')
-rw-r--r--desktop/modules/island/IslandCalendarModule.qml76
1 files changed, 76 insertions, 0 deletions
diff --git a/desktop/modules/island/IslandCalendarModule.qml b/desktop/modules/island/IslandCalendarModule.qml
new file mode 100644
index 0000000..6525d11
--- /dev/null
+++ b/desktop/modules/island/IslandCalendarModule.qml
@@ -0,0 +1,76 @@
+// Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+import QtQuick
+import "../.."
+import "../appearance"
+
+// The island bar's settings group, starting with the calendar's.
+Module {
+ id: mod
+ name: "island-calendar"
+ label: "Calendar"
+ // nf-md-calendar, present in Inconsolata Nerd Font.
+ icon: "\u{f00ed}"
+ settings: true
+ group: "Island bar"
+ keywords: ["island", "calendar", "event", "length", "duration", "end time"]
+ searchItems: [{ text: "Default event length", key: "eventMinutes" }]
+
+ // The draft, as typed; dirty while it differs from what is saved.
+ property string draft: String(Prefs.island.eventMinutes)
+ readonly property bool valid: /^\d+$/.test(draft) && +draft >= 5 && +draft <= 1440
+ dirty: draft !== String(Prefs.island.eventMinutes)
+ function refresh() { if (!mod.dirty) mod.draft = String(Prefs.island.eventMinutes); }
+
+ page: Component {
+ Page {
+ title: "Calendar"
+ actions: Component {
+ SaveBar {
+ dirty: mod.dirty; valid: mod.valid
+ error: mod.valid ? "" : "Length is 5 to 1440 minutes."
+ onSave: Prefs.setIsland({ eventMinutes: +mod.draft })
+ onDiscard: mod.draft = String(Prefs.island.eventMinutes)
+ }
+ }
+ Column {
+ objectName: "eventMinutes"
+ width: parent.width
+ spacing: 8
+ Row {
+ spacing: 8
+ Text {
+ anchors.verticalCenter: parent.verticalCenter
+ text: "Default event length"
+ color: Theme.subtext
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 3 }
+ }
+ // Read on every change: a click on Save ends no editing.
+ Field { width: 60; value: mod.draft; onValueChanged: mod.draft = value }
+ Text {
+ anchors.verticalCenter: parent.verticalCenter
+ text: "minutes"
+ color: Theme.subtext
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 3 }
+ }
+ }
+ Text {
+ width: parent.width
+ wrapMode: Text.WordWrap
+ text: "A new event gets this length, and its end keeps it when the start moves."
+ color: Theme.overlay
+ font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 4 }
+ }
+ }
+ }
+ }
+}