Scroll to newly pasted/dropped files.
Review Request #109950 - Created April 10, 2013 and submitted
Scroll to newly pasted/dropped files. If multiple files are pasted/dropped, then it scrolls to the first pasted/dropped file.
Works. All test passed. Paste one file -> Scrolls to this file Drop one file -> Scrolls to this file Paste multiple files -> Scrolls to the first inserted file Drop multiple files -> Scrolls to the first inserted file
First of all, thanks for the patch! Some remarks: 1. I have only noticed now that the slot "slotUrlPasted" does not exist at all. I must have missed this in your review request https://git.reviewboard.kde.org/r/107351/. This causes a runtime warning when pasting files -> probably the connection should be removed (in a separate commit), right? 2. I've noticed that we don't even select dropped files at the moment. I'm not entirely sure if this is intentional (maybe because the view where items are dropped is often the inactive one in a split view setup). I guess some research should be done before we change this. 3. When I first looked at the patch, I thought that it cannot work because markUrlAsCurrent(*it) is called in updateViewState *after* the current item is changed, and the new current item is scrolled to. But it does work sometimes (but not always), apparently because the function is called twice after pasting an item (possibly because the dir lister emits its completed() signal twice). Have you investigated this? I would prefer an approach that always works (and that would ideally not make updateViewState more complex than it is at the moment).
Thanks for the new patch and sorry for the late response - I was pretty busy with non-KDE things this week. The new approach looks good to me :-) There's just one thing that might need further thought - what happens if many large files are pasted, such that they are not all created together, but rather in multiple batches? They are all selected now thanks to your recent efforts in this area, which are much appreciated. But with this patch, the current item (and possibly the scroll offset of the view) would change every time a new item appears, right? I don't see a good solution to this issue. Maybe we do need a new bool member (like you suggested in version 1) after all which is set to true when pasting and set to false after the markUrlAsCurrent() call has been made for the first pasted item in slotAboutToCreate().