Bug 490653

Summary: Drag and drop files into Gajim (Flatpak) does not work
Product: [Plasma] kwin Reporter: postix <postix>
Component: Wayland drag-and-dropAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED DOWNSTREAM    
Severity: normal CC: kde, nate, sitter
Priority: HI    
Version First Reported In: 6.1.3   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description postix 2024-07-22 15:29:05 UTC
SUMMARY

Dragging a file, which can normally be chosen with the file picker in Gajim, into the Gajim (Flatpak [1]) in order to send it to a contact, does not work:

* On Wayland with Gajim running either as an XWayland app (adjusted with flatseal and verified with xeyes) or as an Wayland app (by defaut), the cursor shows a forbidden sign

* On X11 dragging _almost_ works: You can drop a file and Gajim logs
> gajim.gtk.chatstack        Drop received: b'file:///home/user/myfile.png', 0
but the GUI does not show that anything has been dropped.

Works fine on X11 and Wayland with the native (non-Flatpak) version though.
Mind Gajim's package on Fedora has unfortunately been unmaintained for over a year and the Flatpak is strongly recommended.

[1] https://flathub.org/apps/org.gajim.Gajim

SOFTWARE/OS VERSIONS
Operating System: Fedora Linux 40
KDE Plasma Version: 6.1.3
KDE Frameworks Version: 6.4.0
Qt Version: 6.7.2
Graphics Platform: Wayland
Comment 1 postix 2024-07-22 15:36:56 UTC
For testing:
*  Install Gajim (Flatpak)
* Create an free account e.g. on conversations.im
* Start a new chat with the + sign: choose Note to your self
* Try to drag and drop a file from Dolphin into the chat with yourself
Comment 2 David Edmundson 2024-07-24 14:12:07 UTC
Can you confirm if it works on gnome?
Comment 3 postix 2024-07-24 16:42:43 UTC
(In reply to David Edmundson from comment #2)
> Can you confirm if it works on gnome?

Yes, just tested it with two freshly set up and updated Fedora 40 virtual machines, Gnome Workstation and KDE Spin editions.
installed org.gajim.Gajim from flathub.

* Works perfectly fine on Gnome Wayland
* Does not work as described on KDE Plasma Wayland
Comment 4 Harald Sitter 2024-07-26 16:22:32 UTC
this

https://dev.gajim.org/gajim/gajim/-/blob/66f6ed7ff47e7121f5d25a1f2b9717b922f2400c/gajim/gtk/file_transfer_selector.py#L84

is not the correct mimetype

https://github.com/flatpak/xdg-desktop-portal/blob/a74c2ee93befca1f8583e86e165dbe90a0e72a15/data/org.freedesktop.portal.FileTransfer.xml#L30

it works on gnome because gtk originally had the wrong mimetype and still provides the wrong one for a couple releases for compatibility. Please file a bug with gajim.
Comment 5 postix 2024-07-26 20:01:20 UTC
Thank you Harald! \o/
Comment 6 postix 2024-07-31 10:50:34 UTC
Hi Harald, Gajim now has updated the mime type [1], but the issue remains the same in Gajim 1.9.3 flatpak.
So, is it yet rather a kwin bug after all?

[1] https://dev.gajim.org/gajim/gajim/-/blob/master/gajim/gtk/file_transfer_selector.py?ref_type=heads#L84
Comment 7 Harald Sitter 2024-07-31 11:13:20 UTC
Does it work on x11?
Comment 8 postix 2024-07-31 11:46:33 UTC
(In reply to Harald Sitter from comment #7)
> Does it work on x11?

The situation hasn't changed and is still the same as in https://bugs.kde.org/show_bug.cgi?id=490653#c3
I'd happy for any idea how to further debug this issue. :)
Comment 9 Harald Sitter 2024-07-31 13:40:35 UTC
(In reply to postix from comment #1)
> For testing:
> *  Install Gajim (Flatpak)
> * Create an free account e.g. on conversations.im
> * Start a new chat with the + sign: choose Note to your self
> * Try to drag and drop a file from Dolphin into the chat with yourself

This works fine for me on wayland so long as I first click on the attachment icon. When I just try to drop it onto the chat it doesn't work strangely enough. I am not convinced that bug is on our end though seeing as it works on the attachment view now.
Comment 10 Harald Sitter 2024-07-31 13:45:34 UTC
Oh the humanity!

https://dev.gajim.org/search?search=vnd.portal.files&nav_source=navbar&project_id=30&group_id=6&search_code=true&repository_ref=master

The incorrect mimetypes in chat_stack.py are probably why the described use case doesn't work. avatar.py I am not sure but also is wrong.
Comment 11 postix 2024-07-31 13:48:01 UTC
> The incorrect mimetypes in chat_stack.py are probably why the described use case doesn't work. 
I think you are a hero! Thanks!