FileChooser: download remote files to a cache location to open them through the portal
AbandonedPublic

Authored by jgrulich on Feb 25 2020, 10:25 AM.

Details

Summary

BUG: 418155

Diff Detail

Repository
R838 Flatpak Support: KDE Portal for XDG Desktop
Branch
Plasma/5.18
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 22891
Build 22909: arc lint + arc unit
jgrulich created this revision.Feb 25 2020, 10:25 AM
Restricted Application added a project: Plasma. · View Herald TranscriptFeb 25 2020, 10:25 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
jgrulich requested review of this revision.Feb 25 2020, 10:25 AM
jgrulich retitled this revision from FileChooser: download remote files to a cache location to open them through the portal BUG: 418155 to FileChooser: download remote files to a cache location to open them through the portal.Feb 25 2020, 10:25 AM
jgrulich edited the summary of this revision. (Show Details)
jgrulich added a reviewer: aacid.
ngraham added a subscriber: ngraham.

Shouldn't KIO take care of this stuff automatically? I wouldn't want to lose streaming support for Flatpak apps.

fvogt added a comment.Feb 25 2020, 3:01 PM

Shouldn't KIO take care of this stuff automatically? I wouldn't want to lose streaming support for Flatpak apps.

It should, but there's no API for that yet.

At some point the file dialog can just return a FUSE path if the selected file is a remote URL and only local paths are accepted.

src/filechooser.cpp
210

What about local URLs such as file:///?

Should probably try to use KIO::mostLocalUrl or something like that before.

apol added a subscriber: apol.Feb 25 2020, 5:49 PM

This really isn't ideal. It means we can't deal with any biggish files without having to cache them first.
Also saving back (e.g. in kate) won't work, right?

Maybe we can come up with a solution with fuse?

In D27643#617800, @apol wrote:

This really isn't ideal. It means we can't deal with any biggish files without having to cache them first.
Also saving back (e.g. in kate) won't work, right?

Maybe we can come up with a solution with fuse?

...Or use the existing one. That's what I was hinting at.

With a brief look the ideal scenario is to be able to use DesktopExecParser::resultingArguments, or a class that calls it KRun. That should do the conversion. I'm just not sure if you have the information required to use it.

See D23384

I have never used fuse. I see you can use kio-fuse over dbus to mount a file, but you still have to unmount it, which will be a problem, because from the portal I don't know whether the app is still using it or not.

If anyone is familiar with fuse and have solution in mind, can you give me a hint?

fvogt added a comment.Feb 26 2020, 8:49 AM

I have never used fuse. I see you can use kio-fuse over dbus to mount a file, but you still have to unmount it, which will be a problem, because from the portal I don't know whether the app is still using it or not.

kio-fuse was designed with this in mind and does not even support unmounting. When the file isn't being used anymore, it drops everything except what's needed to reopen the file when requested.

If anyone is familiar with fuse and have solution in mind, can you give me a hint?

In this case it would be as easy as just calling org.kde.KIOFuse org.kde.KIOFuse.VFS mountUrl with the url and it gets a local path back.

This should ideally be handled transparently by the KDE file dialog though.

jgrulich abandoned this revision.Feb 26 2020, 12:27 PM

I have never used fuse. I see you can use kio-fuse over dbus to mount a file, but you still have to unmount it, which will be a problem, because from the portal I don't know whether the app is still using it or not.

kio-fuse was designed with this in mind and does not even support unmounting. When the file isn't being used anymore, it drops everything except what's needed to reopen the file when requested.

If anyone is familiar with fuse and have solution in mind, can you give me a hint?

In this case it would be as easy as just calling org.kde.KIOFuse org.kde.KIOFuse.VFS mountUrl with the url and it gets a local path back.

This should ideally be handled transparently by the KDE file dialog though.

I will make the portal not to freeze the app when there is no local file selected and we can revisit this later. As I can see, there is not even a stable relase of kio-fuse, it also requires the user to start it manually and pick a folder so the experience is not that seamless and as Fabian said, it would be better to have this handled transparently by the file dialog.

I have never used fuse. I see you can use kio-fuse over dbus to mount a file, but you still have to unmount it, which will be a problem, because from the portal I don't know whether the app is still using it or not.

kio-fuse was designed with this in mind and does not even support unmounting. When the file isn't being used anymore, it drops everything except what's needed to reopen the file when requested.

If anyone is familiar with fuse and have solution in mind, can you give me a hint?

In this case it would be as easy as just calling org.kde.KIOFuse org.kde.KIOFuse.VFS mountUrl with the url and it gets a local path back.

This should ideally be handled transparently by the KDE file dialog though.

I will make the portal not to freeze the app when there is no local file selected and we can revisit this later. As I can see, there is not even a stable relase of kio-fuse,

Correct.

it also requires the user to start it manually and pick a folder so the experience is not that seamless and as Fabian said, it would be better to have this handled transparently by the file dialog.

It's an autolaunching DBus service. Just make the call and it's up and running.