Support drag and drop between shared folder view containments
ClosedPublic

Authored by amantia on Nov 16 2017, 4:14 PM.

Diff Detail

Repository
R119 Plasma Desktop
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
mwolff created this revision.Nov 16 2017, 4:14 PM
Restricted Application added a project: Plasma. · View Herald TranscriptNov 16 2017, 4:14 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript

I think only drops between containments should be special-cased.

amantia updated this revision to Diff 22630.Nov 20 2017, 10:10 AM

Fix problem of having ghost items,
fix problem of losing items when an item is moved to a screen and back.
Add unit test for the positioner when items are moved between screens.

Problem: moving multiple items works, but the items are positioned wrongly.

mwolff planned changes to this revision.Nov 20 2017, 10:12 AM

andras, please comandeer this change. and I feel your pain re arc usability... phabricator with patch series is a nightmare for developers

containments/desktop/package/contents/ui/FolderViewLayer.qml
192 ↗(On Diff #22630)

looks like you send the full diff of your branch, use arc diff HEAD^ instead to only send one patch

amantia commandeered this revision.Nov 20 2017, 10:13 AM
amantia edited reviewers, added: mwolff; removed: amantia.

Commandeered and trying to fix the mess now.

amantia updated this revision to Diff 22631.Nov 20 2017, 10:16 AM

Fix uploaded diff

mwolff requested changes to this revision.Nov 20 2017, 10:23 AM

I guess we should split this patch up into three parts:

a) add unit test + the fix you found
b) (if still required) enforce uniqueness in Positoiner::updateMaps + unit test
c) support drag and drop

containments/desktop/plugins/folder/autotests/positionertest.cpp
219 ↗(On Diff #22631)

second? this is the first and only one in this test, no?

229 ↗(On Diff #22631)

QVERIFY the wait, also below

232 ↗(On Diff #22631)

why not use hashes here too, then you can compare those below directly without having to convert the returned hash to a map first?

261 ↗(On Diff #22631)

verify

282 ↗(On Diff #22631)

verify

containments/desktop/plugins/folder/autotests/positionertest.h
58 ↗(On Diff #22631)

could be a free function, no need to make this a member

containments/desktop/plugins/folder/positioner.cpp
28

do we still need this? I don't think so - I added this only for debugging purposes. should probably be part of a unit test now

450

should also be removed and covered by a unit test instead I think

694

this may be obsoleted by now, can you check whether it's still required?

This revision now requires changes to proceed.Nov 20 2017, 10:23 AM
amantia updated this revision to Diff 22632.Nov 20 2017, 10:37 AM

Clean unit test and code: move out the unique testing part (will be moved to a new patch)

containments/desktop/plugins/folder/autotests/positionertest.cpp
219 ↗(On Diff #22631)

There is one coming from init() (m_folderModel)

229 ↗(On Diff #22631)

Changed, the rest is actually not needed (no folder parsing is performed, just the filter changes)

232 ↗(On Diff #22631)

Right, I will change, makes sense. The original idea for the map was that I can more easily read that as it is sorted.

containments/desktop/plugins/folder/autotests/positionertest.h
58 ↗(On Diff #22631)

I removed it.

containments/desktop/plugins/folder/positioner.cpp
28

I was wondering about it, especially that I don't like asserts :) I will remove them.

450

Ok.

694

I think it is still needed, but I will check.

amantia updated this revision to Diff 22657.Nov 20 2017, 3:08 PM

Move out fix for proxy to source and remove the change from updateMap

amantia retitled this revision from WIP: support drag and drop between shared folder view containments to Support drag and drop between shared folder view containments.Nov 20 2017, 3:15 PM
amantia edited the summary of this revision. (Show Details)
amantia added reviewers: Plasma, hein.
amantia updated this revision to Diff 22677.Nov 20 2017, 9:12 PM
  • More stricter detection for moving between screens to fix issue

when a file is moved/copied out from within a folder of the desktop.

  • Enable the code only when the folder view is used in a containment

Bugs to fix:

  • d&d from dolphin to a secondary screen drops the item to the first screen
  • d&d multiple items between the screen positions them in wrong place
amantia updated this revision to Diff 22679.Nov 20 2017, 9:54 PM

Drop the items to the right screen when dragging from outside of the folder view.

I admit it is not the nicest code for finding the final URL (that will be returned by
KDirModel), ideas are welcome to improve it.

mwolff requested changes to this revision.Nov 20 2017, 11:01 PM
mwolff added inline comments.
containments/desktop/plugins/folder/foldermodel.cpp
1126

don't we need to check something like targetUrl.toString().startsWith(dropTargetUrl.toString()) like above? I.e. including schema and so forth? This could otherwise match for file://foo/bar vs. sftp://host/foo/bar, no?

This revision now requires changes to proceed.Nov 20 2017, 11:01 PM
amantia updated this revision to Diff 22682.Nov 21 2017, 10:08 AM
  • Improve path detection as suggested by Milian
  • fix d&d for multiple items. There is only one issue, but I think it is acceptable this way:

when moving two or more items that are not near each other to a new screen, they will be layed
out in a row (or multiple rows) instead of keeping their original relative positions to each other,
like when it happens for moving around on the same screen.

mwolff accepted this revision.Nov 22 2017, 9:45 AM

lgtm in general, but a unit test for the positioner would be good to have

containments/desktop/plugins/folder/foldermodel.cpp
1053

broken indent

containments/desktop/plugins/folder/positioner.cpp
403

can we get a unit test for this?

This revision is now accepted and ready to land.Nov 22 2017, 9:45 AM
hein added inline comments.Nov 22 2017, 1:05 PM
containments/desktop/plugins/folder/foldermodel.cpp
1122

The code in this patch doesn't test for m_screenMapper being set. I don't think FolderModel should require one to work.

amantia updated this revision to Diff 22797.Nov 23 2017, 6:53 AM

Guard m_screenMapper usage

mwolff requested changes to this revision.Nov 23 2017, 3:19 PM
mwolff added inline comments.
containments/desktop/plugins/folder/foldermodel.cpp
1071

unguarded

1123

unguarded

1131

unguarded

This revision now requires changes to proceed.Nov 23 2017, 3:19 PM
amantia added inline comments.Nov 23 2017, 3:21 PM
containments/desktop/plugins/folder/foldermodel.cpp
1123

It is guarded (line 1117)

1131

same here

amantia updated this revision to Diff 22868.Nov 24 2017, 6:43 AM

Guard screenmapper usage

amantia marked an inline comment as done.Nov 24 2017, 6:43 AM
hein accepted this revision.Nov 24 2017, 9:01 AM

lgtm, but Phab says "You can not accept this revision because you have already accepted it."

mwolff accepted this revision.Nov 24 2017, 11:16 AM

thanks for the clarification

This revision is now accepted and ready to land.Nov 24 2017, 11:16 AM
This revision was automatically updated to reflect the committed changes.