Bug 334808

Summary: Dragging and re-ordering favourites in kickoff is broken
Product: [Plasma] plasmashell Reporter: David Edmundson <kde>
Component: Application Launcher (Kickoff) widgetAssignee: Eike Hein <hein>
Status: RESOLVED FIXED    
Severity: normal CC: hein, mklapetek, sebas
Priority: NOR    
Version: master   
Target Milestone: 1.0   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Kickoff favorites DND revamp

Description David Edmundson 2014-05-15 11:06:31 UTC
When dragging an item the drop indicator is nowhere near the mouse
Comment 1 Eike Hein 2014-05-15 12:23:30 UTC
This works perfectly fine for me - can you tell me more about the containment context? It might be a coordinate mapping bug in the Plasma component.
Comment 2 Martin Klapetek 2014-05-15 13:13:09 UTC
Related commit in kdeclarative: ebeb7d

Reverting this^ fixes it, however:

<Sho_> on the downside, reverting that will completely break dnd reordering in kicker
<Sho_> because it gets bogus negative coordinates in the events
<Sho_> so ... that mapping needs more investigation
Comment 3 Eike Hein 2014-05-15 13:14:50 UTC
Assigning to me - I broke it, I shall fix it :)
Comment 4 Eike Hein 2014-05-15 15:54:30 UTC
This isn't my fault after all; the delivered event coordinates are correct. Rather, the DND code in Kickoff has numerous bugs:

- Calculates wrong coordinates for the drop target visualization and the drop row, because it doesn't take care of mapping to the list view's content item and works from a completely wrong delegate height.
- Doesn't handle situations correctly where the drop row is adjacent to the source row.
- A bunch of unnecessary vars.

I'm working on rewriting it and will attach a patch for review soon.
Comment 5 Eike Hein 2014-05-15 16:17:08 UTC
Created attachment 86650 [details]
Kickoff favorites DND revamp

This patch fixes various bugs in Kickoff favorites DND:

- Drop target viz positioning in general.
- Drop row calculation.
- Aborts drop handling if state after drag move isn't safe.
- Aborts drops into slots adjacent to the source item (and doesn't viz them).

However, Kickoff DND still has todos:
- Neither the old nor the new code attempts to handle drops into listview overflow (i.e. scrolling the view along). The new code at least aborts for safety instead of producing things like rendering the drop target viz above the tab bar.
- The drop target viz doesn't resize to stay within the viewport bounds when there's a scrollbar.

Someone else needs to pick up the baton on those, though.
Comment 6 Eike Hein 2014-05-16 02:41:53 UTC
I ended up addressing the above-mentioned todos as well, will commit shortly.
Comment 7 Eike Hein 2014-05-16 02:45:28 UTC
Git commit 2d836eaa882342e8dc7c294468e14f8fd5519e89 by Eike Hein.
Committed on 16/05/2014 at 02:42.
Pushed by hein into branch 'master'.

Fix various bugs in favorites DND.

- Fix generally incorrect drop target viz positioning and when
  the view is scrolled.
- Fix drop row calculation when the view is scrolled.
- Don't offer no-op drops into adjacent slots.
- Some additional safety checks.

M  +47   -20   applets/kickoff/package/contents/ui/FavoritesView.qml

http://commits.kde.org/plasma-desktop/2d836eaa882342e8dc7c294468e14f8fd5519e89