xdg-desktop-portal-gtk icon indicating copy to clipboard operation
xdg-desktop-portal-gtk copied to clipboard

Missing default file name and extension in Save As

Open markummitchell opened this issue 5 years ago • 10 comments

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

markummitchell avatar Mar 02 '19 23:03 markummitchell

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

  • https://github.com/flathub/org.keepassxc.KeePassXC/issues/4
  • https://github.com/flathub/org.keepassxc.KeePassXC/issues/27

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.

AsavarTzeth avatar Mar 19 '19 08:03 AsavarTzeth

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.

gasinvein avatar Mar 19 '19 09:03 gasinvein

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!

markummitchell avatar Apr 20 '19 07:04 markummitchell

@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.

gasinvein avatar Apr 20 '19 09:04 gasinvein

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.

markummitchell avatar Apr 20 '19 15:04 markummitchell

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.

ppd avatar Jun 10 '20 11:06 ppd

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 :)

Glitchy-Tozier avatar Nov 23 '20 14:11 Glitchy-Tozier

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

gasinvein avatar Nov 23 '20 15:11 gasinvein

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

AlessandroBono avatar Feb 12 '21 11:02 AlessandroBono

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.

pkrause1980 avatar Apr 04 '24 15:04 pkrause1980