What's the deal with the FreeCAD internal 'Download Manager' getting triggered when dragging a file in to FC ?

A forum for research and development of the user interface of FreeCAD
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

What's the deal with the FreeCAD internal 'Download Manager' getting triggered when dragging a file in to FC ?

Post by Kunda1 »

What is with this feature called Download Manager? What purpose does it serve?
If one drags a file in to FreeCAD, FreeCAD should streamline open it. Instead it invokes this process.

Reproduce:
Open FreeCAD
Open File Manager and drag a file in to FC application
Result: A panel called Download Manager open up.
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
vanuan
Posts: 539
Joined: Wed Oct 24, 2018 9:49 pm

Re: What's the deal with the FreeCAD internal 'Download Manager' getting triggered when dragging a file in to FC ?

Post by vanuan »

Are you talking about the start page? It is a web view. When you drag something into a webview it opens that file. Web view can't handle the FreeCAD file, since it's not an image, not a text file, not a video. It's a binary. And the default behavior when opening a binary in a browser is to download it.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: What's the deal with the FreeCAD internal 'Download Manager' getting triggered when dragging a file in to FC ?

Post by Kunda1 »

vanuan wrote: Thu Sep 17, 2020 2:51 am Are you talking about the start page? It is a web view. When you drag something into a webview it opens that file. Web view can't handle the FreeCAD file, since it's not an image, not a text file, not a video. It's a binary. And the default behavior when opening a binary in a browser is to download it.
hmmm, 'Today I Learned...'
Thanks for that explanation. I do think it's bad form from a UX point of view that users are dragging files in to FC and encountering this unaware of the fact you just explained.
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
vanuan
Posts: 539
Joined: Wed Oct 24, 2018 9:49 pm

Re: What's the deal with the FreeCAD internal 'Download Manager' getting triggered when dragging a file in to FC ?

Post by vanuan »

Kunda1 wrote: Thu Sep 17, 2020 3:58 am hmmm, 'Today I Learned...'
Thanks for that explanation. I do think it's bad form from a UX point of view that users are dragging files in to FC and encountering this unaware of the fact you just explained.
I think we have to ask wmayer to explain why FreeCAD needs this:
https://tracker.freecadweb.org/view.php?id=952

Maybe the original idea was to make FreeCAD a full featured web browser.
Frankly, I don't think FreeCAD should be a web browser. But it kind of is.

So the question is how to make UX better. Specifically, the start page.

First of all, maybe disable an ability to navigate away from the start page.
To do that, you need to open all the links in a real web browser rather than in a web view. This can be achieved by setting the link delegation policy and handling all links to be opened in a browser. Of course, only if the opened page is a start page.

Next, disable drag and drop specifically for the start page. This can be done either by using HTML Drag and Drop API, or using the link handling approach, that is by handling the "file:///" urls while tracking the previously opened page. So that when detecting the FCStd file which is accessible via the "file:///" protocol you could just open it from the local file system.

Actually, it is just another attack vector that you can follow a file link and it would automatically execute some python script on your machine.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: What's the deal with the FreeCAD internal 'Download Manager' getting triggered when dragging a file in to FC ?

Post by Kunda1 »

@vanuan thank you for your important perspective. I learn a lot reading your posts. I'll keep this discussion going to get somewhere with this. Since the Start WB is one of the first things new users interact with and it's important (crucial even) that it designed intelligently for onboarding new users and educating them.
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
wmayer
Founder
Posts: 20309
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: What's the deal with the FreeCAD internal 'Download Manager' getting triggered when dragging a file in to FC ?

Post by wmayer »

The download manager is a feature the project founder JRiegel wanted to have. Its purpose is to drag and drop a url of a web page into FreeCAD to open the download manager and get the file.

So, e.g. if you are in the FreeCAD forum and someone uploaded a file just drag and drop this link to FreeCAD and it automatically downloads the file.

With the conventional workflow you have to click the link and choose the option to download it. Then you have to switch to FreeCAD and either drag and drop from the file manager or use the Open function and navigate to the directory.
So the direct support to get the file is a big time saver.

However, it doesn't work for all kind of links. For example, when you had to login to a page it doesn't work but also on some pages there are some url redirections and there it can fail, too.
User avatar
vanuan
Posts: 539
Joined: Wed Oct 24, 2018 9:49 pm

Re: What's the deal with the FreeCAD internal 'Download Manager' getting triggered when dragging a file in to FC ?

Post by vanuan »

wmayer wrote: Thu Sep 17, 2020 5:09 pmSo, e.g. if you are in the FreeCAD forum and someone uploaded a file just drag and drop this link to FreeCAD and it automatically downloads the file.
This makes sense.

So, opening a download manager for a "file:///" seems like a bug. When you drop a file in any other place than QWebView, it is opened directly.

Another bug is that when you drop an image into a start page, it replaces the start page instead of opening a new window or a download manager.

But that can't be right, why would you even support drag and dropping into a web view rather than a whole application window? Isn't Qt able to intercept dropping a file into a web view? This must've been done intentionally.
wmayer
Founder
Posts: 20309
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: What's the deal with the FreeCAD internal 'Download Manager' getting triggered when dragging a file in to FC ?

Post by wmayer »

vanuan wrote: Fri Sep 18, 2020 2:52 am So, opening a download manager for a "file:///" seems like a bug.
That's a scenario I never had on my radar. But for me this also happens with my system browser when I drag and drop a file it doesn't support it opens the download dialog. Anyway, you're right that FreeCAD should load the file even if dropped on the start page.
vanuan wrote: Fri Sep 18, 2020 2:52 am Another bug is that when you drop an image into a start page, it replaces the start page instead of opening a new window or a download manager.
Hmm, ok.
But that can't be right, why would you even support drag and dropping into a web view rather than a whole application window? Isn't Qt able to intercept dropping a file into a web view? This must've been done intentionally.
I do not know yet what exactly happens internally. Must debug through the code first...
wmayer
Founder
Posts: 20309
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: What's the deal with the FreeCAD internal 'Download Manager' getting triggered when dragging a file in to FC ?

Post by wmayer »

wmayer wrote: Fri Sep 18, 2020 9:58 am Anyway, you're right that FreeCAD should load the file even if dropped on the start page.
git commit dea2fad51
Another bug is that when you drop an image into a start page, it replaces the start page instead of opening a new window or a download manager.
This looks like a valid use case. The image is loaded into the web page and the logic is handled by the web engine. You can go back to the previous content by clicking on the left arrow button.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: What's the deal with the FreeCAD internal 'Download Manager' getting triggered when dragging a file in to FC ?

Post by Kunda1 »

Thank you very much!
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Post Reply