flatpak / xdg-desktop-portal-gtk

Gtk implementation of xdg-desktop-portal
GNU Lesser General Public License v2.1
124 stars 98 forks source link

Missing default file name and extension in Save As #191

Open markummitchell opened 5 years ago

markummitchell commented 5 years ago

Linux distribution and version

Built on Kubuntu 18.04/64 but bug appears on Ubuntu 16.04/64 Gnome and Mint 19.1/64 Cinnamon

Flatpak version

Flatpak 1.0.7

Description of the problem

Default filename and file extension do not appear in Save As dialog

Steps to reproduce

Install 'flatpak install io.github.markummitchell.Engauge_Digitizer'. File/Import to import any image (clicking on Cancel when Checklist Guide Wizard appears). Then File/Save. The default file name does not appear and there is nothing to suggest the '.dig' file extension should be used. Same flatpak works in kde just fine, and executable works just fine in all distros cited above. This references https://github.com/markummitchell/engauge-digitizer/issues/311

AsavarTzeth commented 5 years ago

It took me a long time to figure out, but I finally realized this is the cause of these issues:

In other words, it seems like the QFileDialog setDefaultSuffix function is not respected. This results in a file being saved without the extension inside the sandbox. This is not an issue with xdg-desktop-portal-kde.

Further more, in the case of KeePassXC the app will then try to add this extension itself. Of course that will fail since renaming existing docs is not supported by the document portal.

This is a very serious issue. Because the file will be inaccessible from the host, it is lost upon reboot.

gasinvein commented 5 years ago

I guess this is specific for GTK portal / Qt app combo. Qt app with KDE portal appends the extension correctly, so does GTK app with GTK portal.

markummitchell commented 5 years ago

Thanks so much. I investigated and documented the steps to run with KDE instead of GTK (at the bottom of https://github.com/markummitchell/engauge-digitizer/issues/311) in case anybody else wants to try the switch. I was thinking the switch was something I needed to do in my code and/or packaging process.

I especially appreciate that your team at 'xdg-desktop-portal-gtk' helped even though it turned out the issue actually involves 'xdg-desktop-portal' and 'xdg-desktop-portal-kde' but not your software. Although I am tempted to send a bunch of other applications' bugs to you for similar help, it is probably best to stop at this point and call this a win. Cheers!

gasinvein commented 5 years ago

@markummitchell This bug is still present, maybe leave the issue open until it's really fixed? Switching from gtk portal to kde is just a workaround.

markummitchell commented 5 years ago

Sounds good. I was worried that the issue should be moved to another project, but could not find a bug tracker for xdg-desktop-portal-kde.

ppd commented 4 years ago

Is this even supposed to work regarding the portal API? I think it should. Then this has to be explicitly declared in the portal's API. By adding another key ("default_suffix") or by enforcing a suffix according to the selected filter, which needs to be explicitly declared too.

The more I think about it, the less convinced I am this belongs in the backend. I think handling suffixes like this should be backend agnostic and in https://github.com/flatpak/xdg-desktop-portal.

Glitchy-Tozier commented 3 years ago

This doesn't seem to happen on all applications. Telegram, KeePassXC, and Cockatrice seem to be bugged, while LibreOffice for example seems to work fine. (Linux Mint 20)

I hope this bug is fixed one day :)

gasinvein commented 3 years ago

@Glitchy-Tozier this bug is specific to Qt apps, isn't it? Telegram and KeePassXC are Qt-based, LibreOffice on Flathub is not.

AlessandroBono commented 3 years ago

Kind of related, I've opened https://bugreports.qt.io/browse/QTBUG-91091 on the Qt side.

pkrause1980 commented 5 months ago

Any news on this issue?

I can confirm it / something very similar still happens with Kubuntu 23.10 and xdg-desktop-portal-gtk version 1.14.1-1. But not with xdg-desktop-portal-kde.

The SaveFile dbus message to the desktop-portal has, "current_folder" and, "current_file" but not "current_name". And the file-chooser does not prefill the filename at all.

Please let me know if further information is needed.