SUMMARY Split from bug 491961 When Spectacle is set to auto copy an image, and a screenshot other than rectangular area is taken, it cannot be pasted in in Dolphin without manually picking its filetype Per 491961, this has 3 different contributing factors requiring 3 different reports. 1. Klipper doesn't preserve "application/x-kde-suggestedfilename". Bug 491961 2. Klipper puts "application/x-kde-onlyReplaceEmpty" first when it should be near the end of the mimetype list. 3. KIO's paste dialog shouldn't offer custom KDE mimetypes that are only used as hints. STEPS TO REPRODUCE - Open Dolphin Spectacle Settings: - When launching, do not take screenshot automatically - After taking screenshot, copy image to clipboard 1. Copy an image from spectacle, use any type of screenshot except Rectangular Region 2. Attempt to paste the image into Dolphin with Ctrl V 3. Enter a name at the prompt (Note: when the content is properly pasted, the name is auto suggested like with saving to file ex Screenshot_date-time.ico) OBSERVED RESULT The name field is blank The Data type is "application/x-kde-onlyReplaceEmpty" Nothing is pasted to the folder in Dolphin EXPECTED RESULT The name is pre-populated in keeping with the default name settings in Spectacle's settings The Data type matches the image format (png, tiff, jpg etc) The image is pasted as a file in the folder in Dolphin SOFTWARE/OS VERSIONS KDE Plasma git-master on Solus ADDITIONAL INFORMATION Clicking the Copy button in Spectacle allows the image to be pasted in Dolphin as normal Discovered when testing !391 https://invent.kde.org/graphics/spectacle/-/merge_requests/391
Relevant stuff is in src/widgets/paste.cpp
I've determined that Klipper is not actually at fault. It's actually a KIO paste dialog problem that "application/x-kde-onlyReplaceEmpty" comes first. Klipper puts it last in the format list like it should. In bug 491961 I assumed that the paste dialog formats followed the order of the formats list since the image formats were shown in that order, but I suppose it's slightly different. For posterity, the real bug is bug 492006.
After a bit more testing, it's still technically an issue for KIO, but the actual source of the format ordering issue is probably something more internal to Qt. It seems that first Klipper uses QMimeData::setImageData, which only sets "application/x-qt-image". After that, Klipper sets "application/x-kde-onlyReplaceEmpty". Slightly later it appends all the other image formats. This is why "application/x-kde-onlyReplaceEmpty" shows up before PNG. It seems like you can't assume that hint mimetypes will go after the automatically set image types even if you set them after QMimeData::setImageData.