Disable setImageData for dragging of unmodified images

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

Description

Disable setImageData for dragging of unmodified images

Summary:
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
comment.

Reviewers: Gwenview, muhlenpfordt

Reviewed By: Gwenview, muhlenpfordt

Differential Revision: https://phabricator.kde.org/D14543

Details

Committed
rkflxAug 2 2018, 11:42 AM
Reviewer
Gwenview
Differential Revision
D14543: Disable setImageData for dragging of unmodified images
Parents
R260:b19e0229b0d2: Make sure, a newly saved image is selected in ContextManager
Branches
Unknown
Tags
Unknown
References
tag: v18.07.90