diff options
Diffstat (limited to 'desktop/island/Island.qml')
| -rw-r--r-- | desktop/island/Island.qml | 20 |
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 } } |
