Bug 295389 - Pasted or dropped items are not selected
Summary: Pasted or dropped items are not selected
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: view-engine: general (show other bugs)
Version: 16.12.2
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Peter Penz
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2012-03-05 22:16 UTC by Frank Reininghaus
Modified: 2012-03-27 17:53 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 4.8.2
Sentry Crash Report:


Attachments
Patch (1.50 KB, patch)
2012-03-27 06:44 UTC, Frank Reininghaus
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Reininghaus 2012-03-05 22:16:18 UTC
User-Agent:       Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20100101 Firefox/10.0.1
Build Identifier: 

If cut/copied items are pasted in the view, or if dragged items are dropped in the view, they don't get selected.

Reproducible: Always

Steps to Reproduce:
1. Open Dolphin, split view, open different folders in both views.
2. Drag and drop items from the right to the left.

Actual Results:  
The dropped items are not selected.

Expected Results:  
The dropped items should get selected.
Comment 1 Frank Reininghaus 2012-03-05 22:17:38 UTC
I'll look into this issue for KDE 4.8.2, unless someone else wants to give this a try :-)
Comment 2 Peter Penz 2012-03-06 07:46:21 UTC
Would be great of course, thanks :-) One note: Although it worked in 4.7 it still was not perfect there too. When the pasting resulted in several copy-operations (e.g. it took lets say 10 seconds), then only the first series of pasted items got selected.
Comment 3 Frank Reininghaus 2012-03-27 06:44:25 UTC
Created attachment 69926 [details]
Patch

In Dolphin 1.x, selecting pasted or dropped items was done using DolphinView's m_newFileNames member. In the big "Dolphin 2.0" commit, this member was removed - it looks like the idea was to let m_selectedUrls handle that. However, this can only work if the path of the pasted or dropped URLs is modified, such that the URLs in m_selectedUrls are really URLs inside the folder shown in the view (i.e., m_selectedUrls must store the *destination* URLs, not the *source* URLs of the paste/drop operation).

The attached patch fixes it. Additionally, it clears the old selection in DolphinView::updateViewState() before the URLs in m_selectedUrls are selected. This is expected when URLs are pasted/dropped. I think that this does not have any unexpected side effects here.

The remaining things to be done are:

1. Port my old DolphinView unit test, which covers selecting pasted URLs, to Dolphin 2.0 (I really should have done this earlier)

2. Make sure that selecting pasted URLs works even if the copy operation is slow, such that the dir lister emits its completed() signal multiple times before the pasting is finished

These things take a bit more time to implement, which is why I'm posting the patch now. At least we can restore the Dolphin 1.x behaviour in time for KDE 4.8.2 then.
Comment 4 Peter Penz 2012-03-27 08:25:05 UTC
Thanks Frank for the patch - I think I'm to blame for removing the corresponding code :-(  Please feel free to commit the current version of the patch!
Comment 5 Frank Reininghaus 2012-03-27 17:51:11 UTC
Git commit 210e5e3b96883f5d856913f81834310ecb3819bf by Frank Reininghaus.
Committed on 27/03/2012 at 19:48.
Pushed by freininghaus into branch 'KDE/4.8'.

Select files which have been pasted or dropped

Also clear the previous selection.
FIXED-IN: 4.8.2

M  +14   -2    dolphin/src/views/dolphinview.cpp

http://commits.kde.org/kde-baseapps/210e5e3b96883f5d856913f81834310ecb3819bf
Comment 6 Frank Reininghaus 2012-03-27 17:53:27 UTC
Git commit 0a3053c05e6295471e846c178482ed926e252357 by Frank Reininghaus.
Committed on 27/03/2012 at 19:48.
Pushed by freininghaus into branch 'master'.

Select files which have been pasted or dropped

Also clear the previous selection.
(cherry picked from commit 210e5e3b96883f5d856913f81834310ecb3819bf)

M  +14   -2    dolphin/src/views/dolphinview.cpp

http://commits.kde.org/kde-baseapps/0a3053c05e6295471e846c178482ed926e252357