kiwix / kiwix-desktop

Kiwix for Windows and GNU/Linux desktops
https://download.kiwix.org/release/kiwix-desktop/
GNU General Public License v3.0
737 stars 97 forks source link

PDF file dialog box should allow to open PDF file directly with PDF reader #697

Open cjohnsto-nz opened 2 years ago

cjohnsto-nz commented 2 years ago

More of a feature request than an issue, Currently the behavior of the Desktop app differs to the UWP and the browser extensions. In the UWA app, PDF files are automatically saved to a folder in the Downloads area, and opened automatically.

Kiwix deskop opens a dialog, and asks the user where they would like to save the PDF. I would imagine that in the vast majority of situations, a user clicking on a PDF in Kiwix would rather it just open than be asked where to save it to.

I would request that the files either be stored in a temporary location and automatically opened, or behave like the UWP apps and the browser extensions; storing the file in the downloads location and then opening the file in the shell associated application.

kelson42 commented 2 years ago

Really surpised that the dialog does not provide a way to open the pdf directly in a PDF reader.

cjohnsto-nz commented 2 years ago

The dialog is just the typical Windows Save As dialog. It looks like it hasn't picked up the PDF mime type. image

I think it would be best to save the file to a temp directory, or a download directory, and to follow up the file writing with ShellExecute(0, 0, L"FILE_URI", 0, 0 , SW_SHOW );

kelson42 commented 2 years ago

@cjohnsto-nz Which exact zim file and article do you test with?

cjohnsto-nz commented 2 years ago

http://x3200.media/kelson.zim

Go to page Pro C9100/9110 and click the Point to Point Diagram link.

It's a Mediawiki I've drafted as a POC for a knowledgebase, dumped to .zim with mwoffliner.

kelson42 commented 2 years ago

Mime-type seems correct, so yes we have an improvement potential here:

path: I/M205_m238_ptop.pdf
»       title:           M205_m238_ptop.pdf
»       idx:             46
»       type:            item
»       mime-type:       application/pdf
»       item size:    2171551
kelson42 commented 2 years ago

@asashnov @juuz0 Do you know if Qt provides a way to open a known (by the OS) mime-type by an installed application, before offering the opportunity to save the file to the fs?

juuz0 commented 2 years ago

https://doc.qt.io/qt-5/qdesktopservices.html I think?

http://x3200.media/kelson.zim

This is not available anymore though, cant test

cjohnsto-nz commented 2 years ago

Oops. Moved the web server. It should be there again now.

kelson42 commented 2 years ago

@juuz0 sure? The file is still there for me.

kelson42 commented 2 years ago

There is a zim with pdf and epub content here as well http://download.kiwix.org/zim/other/lesbelleshistoires_fr_2020-05.zim

kelson42 commented 2 years ago

@juuz0 Does your code test has been conclusive?

juuz0 commented 2 years ago

@kelson42 I can reproduce the issue, yes. But haven't figured out a way yet. Will see again

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

vinurk commented 4 months ago

Added a PR, that downloads the pdf file in the downloads directory and opens it using the pdf reader.