Suggesting another little improvement for KJob class

Ricard Marxer Piñón rmarxer at iua.upf.edu
Thu Feb 8 15:09:01 GMT 2007


Kevin Ottens wrote:
> Le mercredi 7 février 2007 19:57, Rafael Fernández López a écrit :
>   
>> I came out with a problem with kuiserver. We have capabilities, and think
>> about the capability "Pausable". When we receive a signal of which action
>> was triggered, we will get KJob::Pausable as actionId. When you click on
>> the "Pause" button, it should go to "Resume", and then, the problem comes,
>> how to do in an elegant way to retrieve a different KJob::Pausable than
>> before... I mean, it is not cute at all having KJob::Pausable,
>> KJob::Resumeable (i don't even know if it is said this way). If a job can
>> be paused, then it can be resumed.
>>     
>
> Wouldn't it be simply solved by having suspend(), resume() and toggleSuspend() 
> on KJob?
>
>   
>> So I came up with an idea, and I don't really know if is the best, but it
>> can give us a more interesting approach to jobs in general. I suggest
>> having new methods in KJob class:
>>
>> void setState(State state);
>> State state() const;
>>
>> Where State could be an enum, for example with some of this: "InProgress,
>> Paused, Cancelled, Failed". I don't know if more or them may be
>> interesting.
>>
>> What do you think ?
>>     
>
> I wonder how useful it could be if your current issue is solved by a 
> togglePause(). Anyone see where we would want to query the state of a job? 
> AFAIK it's a need we don't have.
>   
There's only a few use cases I can think of for having states:
- A user wants to queue a job but not having it started (need a state 
"not started"): I want to burn a file to a CD but the file hasn't 
finished downloading.  I could create the job using K3b and publish it 
to the kuiserver as not started.

- A user wants to know by looking at the kuiserver which jobs have 
finished (need a state "finished"): I have started downloading some 
files and I want them to stay in the kuiserver when finished downloading.

- A user wants to know when a job is waiting for the user to answer a 
question (need a state "waiting"): I have copied some files and there 
are some overwriting questions.

What do you think?

> I think that apart from isSuspended(), available in KIO::Job for now, nothing 
> else is required.
>
> Regards.
>   





More information about the kde-core-devel mailing list