Disable setImageData for dragging of unmodified images

Authored by rkflx on Aug 1 2018, 9:37 PM.



3bb8beb56fba and 984b9737f079 led to Gwenview adding the raw image data
to the mimedata used when dragging or copying images. In general that's
fine and sometimes even needed (e.g. when pasting to GIMP).

However, when dragging to the Plasma desktop to copy the image or set it
as a wallpaper, the drag cursor would stutter and only change to the
green accepting cursor when hovering for a while. Furthermore, upon
dropping the image the context menu presenting the actions would take a
very long time showing up. This is caused by requesting a deep copy of
the mimedata in kdeclarative, resulting in the conversion of the image
data to all image formats Qt supports (for details, see D13249#300894).

The same problem can be observed when trying to drop an image to
Chromium, which does not work at all.

Therefore we change selectionMimeData to only set the URL for dragging
unmodified images, which solves the issue both for Plasma and for
Chromium. (For modified images the problem persists, but it is
considered more important to provide the modified image data in this
case for applications supporting it.)

Test Plan

In both Browse and View mode, drag images to the desktop.
The context menu should appear swiftly. Also, the behaviour for copying
and dragging in all other cases should work as specified in the added

Diff Detail

R260 Gwenview
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
rkflx requested review of this revision.Aug 1 2018, 9:37 PM
rkflx created this revision.
muhlenpfordt accepted this revision.Aug 2 2018, 8:57 AM

Works good for me and solves the issue as stated.
Copy&paste is not affected and operates as before for all applications I tested.
For drag&drop I can't find any restrictions where something is not working as expected.

This revision is now accepted and ready to land.Aug 2 2018, 8:57 AM
This revision was automatically updated to reflect the committed changes.