[PATCH] Tiny patch for spring-loaded folders in Dolphin

Simon St James kdedevel at etotheipiplusone.com
Sat Aug 9 21:05:38 BST 2008


Hi all,

On Friday 08 August 2008 19:38:00 Peter Penz wrote:
> I just meant the simple version: If an item is dragged above a folder X
> from the icon-view, the folder X should get opened after ~300 ms. No
> "expanding" is meant like in a treeview :-) It's the same functionality
> like offered in Konqueror for KDE 3.
>
> Oh, I just faced the regression that the autoexpanding in the Folders Panel
> (F8) does not work anymore :-( I assumed that this is still working, so
> what I meant is: For treeviews like in the Folders Panel or the details
> view with expandable folders the spring-loaded-folders functionality should
> _always_ be available, as it is easy possible for the user to collapse the
> folder again or to go to the parent.
>
> For other views (icons view, details view without expandable folders) it
> should be turned off per default as it is not possible anymore to go back
> as soon as the folder has been entered during dragging. I'm not sure about
> the column-view here - well let's try it before deciding anything here.

Phew - I think I may be out of my depth, here - this is considerably harder 
than I expected!

Ok, please find attached the current, much more complex patch.  It mostly 
works, with one exception - if you drag an item onto a folder that would 
cause the view showing the dragged item to disappear - for example, dragging 
from a DolphinIconView into a folder which is set to use DolphinDetailsView, 
or dragging from a directory X to a sibling Y via X's parent in columns view, 
then the folder is entered correctly, but the dragging is cancelled, so you 
can't keep "drilling down", which is disconcerting.  I have no idea where the 
drag is cancelled, or how and whether this can be fixed.

The basic idea is to create a class called AutoExpander (incidentally, naming 
is one of my weak points - please feel free to suggest alternative names!) 
that can add spring-loaded functionality to most QAbstractItemViews - I 
preferred this approach to duplicating code in the various class types.  The 
original patch leveraged QTreeView's own auto-expand functionality, but I've 
now abandoned that as a) auto-expand would have to be written for the other 
view types anyway and b) QTreeView's auto-expand doesn't play well with the 
auto-scrolling in the sidebar tree.  The class had to have the 
LIBDOLPHINPRIVATE_EXPORT directive as treesidebarpage uses it - I'm not sure 
if this is a problem or not.

The AutoExpander intercepts dragging events sent to the QAbstractItemView it 
is attached to and does the expected stuff - setting timers, auto-expanding 
branches (if the view is a tree) and emitting signals to signal that a 
directory should be auto-entered (otherwise).

The AutoExpandAnyView setting does not currently appear in the UI.

There are a few TODOs in there which represent things that I'd appreciate 
advice on.

This patch obsoletes the original patch.

Best Wishes,
Simon

PS - If you think the whole approach sucks and you have a better way, please 
let me know - I won't be offended ;)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dolphin-springloaded2.patch
Type: text/x-diff
Size: 11777 bytes
Desc: not available
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20080809/3def073d/attachment.patch>


More information about the kfm-devel mailing list