diff options
Diffstat (limited to 'desktop/modules/kdeconnect/KdeConnectModule.qml')
| -rw-r--r-- | desktop/modules/kdeconnect/KdeConnectModule.qml | 24 |
1 files changed, 24 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 { |
