aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/modules/kdeconnect
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-09-14 19:20:01 +0200
committerDanilo M. <danix@danix.xyz>2026-09-14 19:20:01 +0200
commit46bcb60bd7dff4b2532b47146ab3e75d2c000912 (patch)
treeeee88f39313b918420796da0e46940bfd214ed30 /desktop/modules/kdeconnect
parent6bf3730a54ccb4cdcf9d6050f51d2b11ab1754e4 (diff)
downloadquickshell-46bcb60bd7dff4b2532b47146ab3e75d2c000912.tar.gz
quickshell-46bcb60bd7dff4b2532b47146ab3e75d2c000912.zip
feat(desktop): share a file to a KDE Connect device
A QtQuick.Dialogs FileDialog held on the module, not the page, so a closed drawer does not destroy it mid-pick. The path is decoded from the file:// URL before it reaches kdeconnect-cli.
Diffstat (limited to 'desktop/modules/kdeconnect')
-rw-r--r--desktop/modules/kdeconnect/KdeConnectModule.qml24
-rw-r--r--desktop/modules/kdeconnect/KdeConnectRow.qml6
2 files changed, 30 insertions, 0 deletions
diff --git a/desktop/modules/kdeconnect/KdeConnectModule.qml b/desktop/modules/kdeconnect/KdeConnectModule.qml
index 1175b81..941808d 100644
--- a/desktop/modules/kdeconnect/KdeConnectModule.qml
+++ b/desktop/modules/kdeconnect/KdeConnectModule.qml
@@ -12,6 +12,7 @@
import Quickshell
import Quickshell.Io
import QtQuick
+import QtQuick.Dialogs
import "../.."
// Not always active: there is no push to listen to without a generic D-Bus
@@ -152,6 +153,29 @@ Module {
`xdg-open "$(kdeconnect-cli --get-mount-point -d ${JSON.stringify(id)})"`]);
}
+ // --- share ---
+
+ // The dialog is held on the module, not the page, so closing the drawer
+ // mid-pick does not destroy it under the user.
+ property string shareTarget: ""
+
+ function share(id) {
+ mod.shareTarget = id;
+ shareDialog.open();
+ }
+
+ // A FileDialog hands back a file:// URL; kdeconnect-cli wants a path.
+ function pathOf(u) {
+ return decodeURIComponent(u.toString().replace(/^file:\/\//, ""));
+ }
+
+ property FileDialog shareDialog: FileDialog {
+ title: "Share with device"
+ fileMode: FileDialog.OpenFile
+ onAccepted: mod.run("Share",
+ ["kdeconnect-cli", "--share", mod.pathOf(selectedFile), "-d", mod.shareTarget])
+ }
+
tileContent: Component { KdeConnectTile { mod: mod } }
page: Component {
diff --git a/desktop/modules/kdeconnect/KdeConnectRow.qml b/desktop/modules/kdeconnect/KdeConnectRow.qml
index 0c58fc0..245afcc 100644
--- a/desktop/modules/kdeconnect/KdeConnectRow.qml
+++ b/desktop/modules/kdeconnect/KdeConnectRow.qml
@@ -88,6 +88,12 @@ Rectangle {
Button {
visible: row.device.reachable
+ text: "Share"
+ onClicked: row.mod.share(row.device.id)
+ }
+
+ Button {
+ visible: row.device.reachable
text: "Mount"
onClicked: row.mod.mount(row.device.id)
}