From abd85b71acd21eb3c7d20b4d04c0d77511cc09c8 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Thu, 26 Nov 2026 10:23:59 +0100 Subject: feat(calendar): a dropped .ics opens the event editor, filled in A lone .ics dropped on the island's sliver goes to the calendar rather than the assistant canvas: the panel opens on the event's month with the new-event form filled from the file, for review before Save. The bubble says where the drop will go while the drag is over it. calctl gains `read FILE`, which returns the file's master VEVENT in the same shape as `get`, with no UID so saving creates a new event in the default calendar. A rule or alarm the form cannot express reads `none`: `custom` would tell apply() to keep what is there, and a new event has nothing there to keep. The drop no longer needs the assistant to be present for .ics files. Co-Authored-By: Claude Opus 5.5 --- desktop/island/Island.qml | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'desktop/island/Island.qml') diff --git a/desktop/island/Island.qml b/desktop/island/Island.qml index f11225b..decde30 100644 --- a/desktop/island/Island.qml +++ b/desktop/island/Island.qml @@ -233,10 +233,13 @@ PanelWindow { // --- file drop --------------------------------------------------------- // A file dragged onto the sliver opens a bubble to drop it on; the drop - // hands it to the assistant canvas. Wayland reports a drag only once it + // hands it to the assistant canvas, or a lone .ics to the calendar's + // editor, filled in for review. Wayland reports a drag only once it // enters an input region, so the receptor is the sliver's width at rest // and grows to hold the bubble while a drag is over it. property bool dropHold: false + property bool dropIcs: false // a lone .ics: the calendar takes it + function isIcs(urls) { return urls.length === 1 && /\.ics$/i.test(String(urls[0])); } // Why the last drop was refused, shown in the bubble for a moment. property string dropNote: "" Timer { id: noteTimer; interval: 2500; onTriggered: win.dropNote = "" } @@ -252,9 +255,10 @@ PanelWindow { DropArea { anchors.fill: parent - enabled: win.asst !== null onEntered: drag => { - drag.accepted = drag.hasUrls && (drag.supportedActions & Qt.CopyAction); + win.dropIcs = win.isIcs(drag.urls); + drag.accepted = drag.hasUrls && (drag.supportedActions & Qt.CopyAction) + && (win.dropIcs || win.asst !== null); if (drag.accepted) { win.dropHold = true; drag.accept(Qt.CopyAction); } } onExited: win.dropHold = false @@ -275,7 +279,13 @@ PanelWindow { drop.accepted = false; return; } - win.asst.attach(paths); + if (win.isIcs(paths)) { + win.shown = true; + win.panel = "calendar"; + clock.importFile(paths[0]); + } else { + win.asst.attach(paths); + } drop.accept(Qt.CopyAction); } } @@ -291,7 +301,7 @@ PanelWindow { border.color: Qt.alpha(win.dropHold ? Theme.accent : Theme.red, 0.6) Text { anchors.centerIn: parent - text: win.dropHold ? "Drop for the assistant" : win.dropNote + text: !win.dropHold ? win.dropNote : win.dropIcs ? "Drop to add to the calendar" : "Drop for the assistant" color: win.dropHold ? Theme.text : Theme.red font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2 } } -- cgit v1.2.3