Slows starting of downloading with KIO

David Faure faure at kde.org
Mon Jan 2 10:22:31 GMT 2006


On Sunday 01 January 2006 21:17, Michael Brade wrote:
> On Friday 30 December 2005 15:53, David Faure wrote:
> > On Thursday 22 December 2005 17:49, Michael Brade wrote:
> > > yeah, almost.. kio would now use kdirlister_p.h. Ok, it's not that bad
> > > since it's still not installed and exposed. But something to keep in
> > > mind.
> >
> > Well, not if you add a KDirLister method like
> > KFileItem* itemForURL( const KURL & )
> > for me :)
> > (static preferrably, but doesn't matter much)
> Good point, we should make itemsForDir() static as well and rename it to 
> itemsForURL(). 
I prefer itemsForDir, it's clear that it's about all the items for a directory.
Otherwise we have itemForURL (for a file) and itemsForURL (for a directory),
which look too much like each other.

> Which method to use. Well, not sure, itemForURL sounds good if we can make the 
> lookup more efficient that way. Because if all you need is a file most of the 
> time or even the whole contents of a directory then itemForURL wouldn't gain 
> us much. But if you possibly need the directory item itself we might be 
> better off with a new itemForURL method indeed. 

Hmm, all I need is one item (one file or directory) most of the time, and this is why
I was suggesting itemForURL() - it would fine the right KFileItem for the item (file/directory)
whose URL is given. I think you misunderstood with "url == url of the directory".

> About the naming, it should be consistent: we have KDirLister::findByURL() and 
> findByName() already. So call all static methods querying the global items 
> item(s)*() and all methods operating on the files the KDirLister holds 
> find*()? Suggestions?

Oh, I see; tricky.

I think the static methods should be cachedItemForURL and cachedItemsForDir,
that way it's clear that the caller might get nothing in return, when the directory hasn't
been listed yet, or has been removed from the cache for any reason.
Otherwise I foresee people assuming that KDirLister::itemForURL()/itemsForDir()
will take care of everything [synchronous directory listing over kio? no thanks :)].

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).





More information about the kde-core-devel mailing list