aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/island/Island.qml
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-11-26 10:23:59 +0100
committerDanilo M. <danix@danix.xyz>2026-11-26 10:23:59 +0100
commitabd85b71acd21eb3c7d20b4d04c0d77511cc09c8 (patch)
tree65b061334be923f5f1df0b31169ca4345e556a22 /desktop/island/Island.qml
parent26956721dfb6c7f32153f283b1b07fd2eaf5b19b (diff)
downloadquickshell-abd85b71acd21eb3c7d20b4d04c0d77511cc09c8.tar.gz
quickshell-abd85b71acd21eb3c7d20b4d04c0d77511cc09c8.zip
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 <noreply@anthropic.com>
Diffstat (limited to 'desktop/island/Island.qml')
-rw-r--r--desktop/island/Island.qml20
1 files changed, 15 insertions, 5 deletions
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 }
}