Refactor determining mime data for selection
ClosedPublic

Authored by rkflx on May 31 2018, 7:08 PM.

Details

Summary

Both copying and drag-and-drop of images requires adding appropriate
mime data to the clipboard and drag handler respectively.

f365a38fa28f implemented support for copying modified images. To be able
to also support drag-and-drop of modified images without having to
duplicate code, we extract the relevant bits into a standalone helper
function.

As in different places the selection is determined either by Qt's
internal models, contextManager or a single document, and we don't
have access to the global selection in contextManager everywhere, we
standardize on a KFileItemList to pass the selection.

While at it, we slightly improve some comments.

Test Plan

Make sure that copying both unmodified and modified images of various
filetypes works as before and in all modes, in particular Browse,
View and Compare (for details, see test plan of
f365a38fa28f).

Diff Detail

Repository
R260 Gwenview
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
rkflx requested review of this revision.May 31 2018, 7:08 PM
rkflx created this revision.
muhlenpfordt accepted this revision.Jun 1 2018, 9:50 AM

Looks fine! :)
I can't spot any different behaviour and the patch also improves readability.

app/fileopscontextmanageritem.cpp
51

Not needed anymore (also before your patch) - seems to be a leftover from ccfa1ea160ba.

This revision is now accepted and ready to land.Jun 1 2018, 9:50 AM
rkflx marked an inline comment as done.Jun 1 2018, 8:37 PM
rkflx added inline comments.
app/fileopscontextmanageritem.cpp
51

Good catch, but I think I prefer cleaning up the headers at another time (there are lots of similar unneeded headers…).

Keeps the patch cleaner, as the removed includes correspond to the added includes ;)

ccfa1ea160ba

Interesting. At least nowadays, it seems we are simply using KIO instead of that code…

This revision was automatically updated to reflect the committed changes.
rkflx marked an inline comment as done.