[PATCH] KProcess port of khelpcenter

Andreas Pakulat apaku at gmx.de
Sun Dec 16 21:07:20 GMT 2007

On 16.12.07 21:49:27, Ralf Habacker wrote:
> Oswald Buddenhagen schrieb:
>> On Thu, Dec 13, 2007 at 06:43:25PM +0100, Ralf Habacker wrote:
>>> appended is a patch which ports KHelpcenter to KProcess.
> a major problem of porting K3Process to KProcess is that KProcess does not 
> provide a pointer to the K3Process in the exit signal.
> void TOC::meinprocExited( K3Process *meinproc )
> This makes it able to identify the object and destroy it in the related 
> slot.
> In KProcess there is no such signal available which requires to have a 
> KProcess pointer be defined in the related class and additional effort to 
> handle multiple calls. As an alternative a List of KProcess pointer could 
> be used, but how could the related KProcess object be detected in the 
> finish slots ?  (Because of this I refactored searchhandler.cpp/h to have a 
> single KProcess instance in each SearchJob)

Thats the reason why Qt has QSignalMapper.

> Another issue is the multibyte handling described in 
> http://techbase.kde.org/Development/Tutorials/Common_Programming_Mistakes#Reading_QString_from_a_KProcess.
> Wouldn't it be better to implement specific signals in KProcess or a 
> subclass to avoid that this has to be fixed on every place where KProcess 
> is needed ?

Well, its not exactly easy to make this work properly. Check 


and if the user of KProcess simply reads the output _after_ the exit of
the process all that extra stuff is not needed at all. Yeap, we could
create a convenience class in kdelibs for 4.1, if we find at least 3
users outside of it. 


A vivid and creative mind characterizes you.

More information about the kde-core-devel mailing list