David Faure faure at kde.org
Wed Oct 11 22:08:32 BST 2006

On Wednesday 11 October 2006 22:42, Benjamin Meyer wrote:
> On Wednesday 11 October 2006 10:03 pm, Benjamin Meyer wrote:
> > On Tuesday 26 September 2006 3:36 pm, David Faure wrote:
> > > SVN commit 588613 by dfaure:
> > >
> > > KDirModel, a directory model for KIO-based directory listings.
> > >  Handles files being created, modified and deleted at runtime.
> > >  With unit tests and a gui test program (which creates QListViews and a
> > > QTreeView to test it) The model has been tested with 10000 subdirs and
> > > the branch opens as fast as it did in kde3 times.
> >
> > I like how you have canFetchMore only return true if it is a dir and 0
> > count. I have a flag in my own model, but like you said in the comment, the
> > common case is not an empty directory.   Worst case would be a directory
> > that is empty that is viewed in a tree and the user constantly is opening
> > and closing it.
Yes, that was my thinking. Why would someone do that - and if someone does,
well he'll pay the price for a few more listDirs(), no big deal.

> >
> > while(canFetchMore(parent))
> > 	fetchMore(parent);
That would be a rather broken thing to do with an asynchronous model (fetchMore
schedules to get more data, but doesn't get it right away), wouldn't it? Or do you
know that views can do something like that? (which would then mean a bool 
populated is needed for sure).

> > One thing is that there is already a list of dirs that is being watched by
> > the kdirlister.  If there was a function to determine if a directory has
> > already been added to that canFetchMore could return false and you wouldn't
> > need to have a bool populated flag.
Yes that was my idea too, I also have a comment saying so in KDirModel::canFetchMore :)
    // Maybe we can ask KDirLister "have you listed <url> already"? (to discuss with M. Brade)

> Saving a few bytes is nothing compared to the list of QUrl's in kdirlister:
> KUrl::List lstDirs which repeats a whole lot of data.
That's true. Redesigning KDirLister is planned (hopefully by Michael, otherwise by me) ;-)
Although we might want to support urls with unrelated urls as children, so storing only
filenames might not be enough.
Anyway, bloating up KDirModel because KDirLister is bloated would have been a bad excuse :)

> Another reason why we need a good memory profiling tool.
Yes... I only know of valgrind massif but it's not very precise.

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