Some porting from KIO::Jobs to KJobs
Ricard Marxer Piñón
rmarxer at iua.upf.edu
Thu Jan 18 11:55:15 GMT 2007
Kevin Krammer wrote:
> On Thursday 18 January 2007 01:43, David Faure wrote:
>> On Wednesday 17 January 2007 13:01, Kevin Ottens wrote:
>>> Le Mercredi 17 Janvier 2007 12:43, David Faure a écrit :
>>>> This works for the case of loading contacts, but not when it's indeed
>>>> about files. totalSize(2000) means 2000 bytes, not 2000 files, and you
>>>> need totalFiles/totalDirs in addition.
>>> Right now, totalSize is what's used for percentage computation... I
>>> wonder what percent() is supposed to convey then.
>> There are multiple levels.
>> In uiserver percent is what matters:
>> return i18n( "%1 % of %2 " ).arg( percent ).arg( KIO::convertSize(
>> totalSize ) );
>> Below, in the job (Job::emitPercent), the percent is calculated from
>> processedSize and totalSize, to have that code in one place and not require
>> that the ioslaves have to do it. The percent signal from the job is what
>> goes to uiserver; so Thiago is wrong, it *is* used.
>> [Someone then added SlaveBase::processedPercent though, for the case where
>> the total size can't be known (e.g. kio_audiocd with compression), but
>> that's not implemented yet.]
> Maybe jobs with unknown total should be handled differently. e.g.like a
> QProgressBar has a mode for total==0, but more explicit.
Maybe it does need one. It could be handled as:
Although I do think it's better to avoid unknown length jobs, I would
recommend to set a timeout and use the consumption of the timeout as the
If the job timeouts, then the job should be set to a state
KJob::FINISHED_UNEXPECTEDLY with a new progressInfo and set some actions
like retry or cancel.
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
More information about the kde-core-devel