[dolphin] [Bug 470147] Symlinked Folders: Cut elements are not desaturated anymore

Jin Liu bugzilla_noreply at kde.org
Mon Aug 7 09:21:13 BST 2023


https://bugs.kde.org/show_bug.cgi?id=470147

--- Comment #7 from Jin Liu <ad.liu.jin at gmail.com> ---
I've found the cause of this bug:

Dolphin (in KFileItemClipboard) uses KUrlMimeData::urlsFromMimeData to get the
list of cut files from the clipboard.
(https://invent.kde.org/system/dolphin/-/blob/master/src/kitemviews/private/kfileitemclipboard.cpp#L55)

That method was modified about 1 year ago to get the list from
xdg-portal.FileTransfer, instead of directly from the clipboard.
(https://invent.kde.org/frameworks/kcoreaddons/-/blob/master/src/lib/io/kurlmimedata.cpp#L149)

And the FileTransfer portal, which operates on fds, not paths, obviously can't
preserve the original (symlinked) path. So when you cut some files inside a
symlinked dir, while the text/uri-list and application/x-kde4-urilist types in
the clipboard contain the correct path, what you get from the FileTransfer
portal are canonical paths inside the target dir. Therefore, files in the
symlinked dir are not shown as cut (desaturated). But if you go to the target
dir, files there are desaturated.

So there are 3 ways to fix this:

1. When checking for cut files, Dolphin can resolve both the current dir and
paths from the clipboard to their canonical form. This could be slow, and
unnecessary (reasoning below).

2. Instead of KUrlMimeData::urlsFromMimeData, KFileItemClipboard can call some
new method that doesn't use xdg-portal, but read the application/x-kde4-urilist
type from the clipboard directly. I don't think there's requirement that files
cut in Dolphin inside a sandbox shall be shown as cut in another Dolphin
outside the sandbox, so it's really unnecessary to call xdg-portal here.

3. Better, Dolphin can set some marker in the clipboard item when cutting
files, so when pasting/checking in the same Dolphin process (or in the same
sandbox), KUrlMimeData::urlsFromMimeData sees this marker and uses the
clipboard item directly, not calling xdg-portal. That would fix this and other
xdg-portal related bugs (e.g. https://bugs.kde.org/show_bug.cgi?id=464225) once
for all, when not actually doing cross-application cut&paste.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the kfm-devel mailing list