From bfdc3ce1e1be950dc810d19490d0b0a8ccaea3e8 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Fri, 13 Nov 2026 09:35:54 +0100 Subject: feat(calendar): end time follows the start, default length setting Moving an event's start now moves its end by the island's default event length, whether the start is typed, wheeled or picked, rolling into the next day past midnight. A multi-day timed event keeps its end, since snapping it to the start's day would drop the other days. Typing follows on every edit that normalises to a valid time, so Save without leaving the field still sees the moved end. A new event gets the same length. The length lives in Prefs as island.eventMinutes (5 to 1440, default 60) and is set on a new Island bar group in the settings window, which the island's other settings will join. Co-Authored-By: Claude Opus 5.5 --- desktop/modules/island/IslandCalendarModule.qml | 76 +++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 desktop/modules/island/IslandCalendarModule.qml (limited to 'desktop/modules') 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. +// +// 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 } + } + } + } + } +} -- cgit v1.2.3