KIO::ListJob::entries emits twice for folders with 100+ entries. Why?

David Faure faure at kde.org
Thu Nov 15 17:26:15 GMT 2012


On Thursday 15 November 2012 13:12:27 Mark wrote:
> My bad, the second signal is only emitting the remainder of whatever
> comes after the first signal.
> However, i still have the question as to why it happens at all?

So that dolphin doesn't keep the user waiting in front of a blank view for a 
long time when opening /usr/bin. Better emit the entries in multiple batches,
for incremental rendering.

> The two signal stuff for entries only seems to occur when i set:
> job->addMetaData("details", "0");
> If i just comment that line out i have just 1 signal from entries. Why
> is it working like that? I would expect it to behave the same with or
> without addMetaData("details", "0") set. 

The buffering of entries happens in SlaveBase::listEntry and is based on the 
time measurements and estimates and complex logic ;)
Anyway, this shouldn't matter to your program, whether entries is called it 
one go or in multiple batches. If it does, your program is broken.

> I personally would just like to get rid of the first signal since in my 
> case all entries are feeded to a model anyway.

I see several issues with that sentence.
1) Models must be able to react to dynamic changes (e.g. the user creates a 
file), so once they do that, they can also react similarly to "here are 10 
entries" followed by "here are 10 more entries" (= inserting rows).
2) Why not just use KDirModel? It handles all this for you.

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE, in particular KDE Frameworks 5





More information about the kde-core-devel mailing list