[Patch] KDirModel fix for non-standard hierarchies

David Faure faure at kde.org
Tue Dec 2 10:46:44 GMT 2008


After I tried convincing everyone that kioslaves should only produce predictable
hierarchies (listing foo://bar/ should produce items with urls like foo://bar/blah and nothing else),
I am finally convinced that this cannot always be done
(for instance: smb:/ -> smb://workgroup -> smb://host -> smb://host/path)
and I finally found a way to support that from KDirModel.

In the very first iteration of KDirModel I had used a QHash<KUrl, ...> and 
it was really slow so I redesigned it not to use that, but yesterday I found that
QHash<KUrl,...> didn't have to be slow ;) I rewrote qHash(KUrl) and now it's 60 times
faster than before... So, back to square one, rewriting KDirModel::nodeForUrl to use
a QHash<KUrl,Node> rather than navigating inside the hierarchy.

The patch also includes a new KDirLister signal so that it emits the parent url
together with the items, so that KDirModel doesn't have to guess what the parent
url is anymore (and in case of non-standard hierarchies, it cannot guess correctly).

All this started as a fix for bug 176555, but I know it will also help other kioslaves (hi nf2 and trueg ;).
It also makes UDS_URL useful again (the fix for 176555 also includes s/UDS_TARGET_URL/UDS_URL/ in kio_smb)

The reason I'm posting this here is... should I commit despite the freeze?
On one hand it's a bugfix, on the other hand it's a redesign of the internals....
the unit tests make me quite confident about it, but of course they're never 100% complete.

One thing to note is that non-standard hierarchies break the "Up" button in konq, though,
when using an iconview rather than a treeview. From smb://host you cannot go up to smb://workgroup
or smb:/. If we want that, then we can forget about this patch and hack KUrl instead :-)
(the point being that if KUrl knows how to go up from there, then KDirModel can just ask
KUrl like it currently does upon receiving new items...). But I guess we want support for
non-standard hierarchies even if Up doesn't work for them.

-- 
David Faure, faure at kde.org, sponsored by Qt Software @ Nokia to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kdirmodel_non_standard_hierarchies.diff
Type: text/x-diff
Size: 22488 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20081202/84def85d/attachment.diff>


More information about the kde-core-devel mailing list