Fix drop menu position with urlnavigator drops
ClosedPublic

Authored by elvisangelaccio on Jul 13 2017, 4:01 PM.

Details

Summary

Commit 1e251d2f6a in kio broke drop menus when dropping on the URL
navigator (menus show up in the DolphinView rather than the URL bar).
This happens because in DolphinView::dropUrls() we set this as the
widget passed to KJobWidgets::setWindow() (in DragAndDropHelper::dropUrls()).

We need to replace this with the actual widget that received the QDropEvent
and that can mapToGlobal() the relative pos of the drop event.
Unfortunately this widget is not KUrlNavigator itself, but one of its
KUrlNavigatorButton children (private class, not exported). So
unfortunately we need a new API in KIO that exposes this child widget.

Test Plan

Drop something on the url navigator, drop menu shows up where the drop happened.

Diff Detail

Repository
R318 Dolphin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
Restricted Application added a subscriber: Konqueror. · View Herald TranscriptJul 13 2017, 4:01 PM
dfaure added a subscriber: dfaure.Jul 14 2017, 11:13 AM
dfaure added inline comments.
src/views/dolphinview.cpp
1054

This calls dropUrls(), directly so using sender() in dropUrls() seems dangerous, it will get the sender who got us here, which might work but that's a bit indirect and fragile.
Is there no way to get to the KUrlNavigator more cleanly from this class?

  • Refactor so that we can avoid the usage of sender().
elvisangelaccio marked an inline comment as done.Jul 14 2017, 4:47 PM
dfaure accepted this revision.Jul 14 2017, 7:21 PM

Looks much better to me.

This revision is now accepted and ready to land.Jul 14 2017, 7:21 PM
This revision was automatically updated to reflect the committed changes.