RFC: On-demand package installation API in kdelibs

Lubos Lunak l.lunak at suse.cz
Thu Jul 29 13:03:39 BST 2010

On Thursday 29 of July 2010, Kevin Krammer wrote:
> On Wednesday, 2010-07-28, Lubos Lunak wrote:
> >  So the idea is to provide simple API in the form of 'bool
> > tryToEnsureInstalled{MimeType|Binary|Whatever}( QString name )'. Various
> > KDE code will call it when it finds out something is missing and maybe
> > the call solves the problem.
> While I like the idea of making it easy for developers to incorporate such
> a feature, I am afraid that this stile of API is simplified to much.
> Installing things, especially when potentially involving  downloading, is
> inherently asynchronous.
> So such an easy method either returns immediately and provides some kind of
> status signalling or it uses nested event loops.

 Nested loops. Just like e.g. KMessageBox does, so there is nothing inherently 
wrong with it. And there are many cases where it's much simpler to just block 
on the call and wait for the situation to be handled before proceeding.

 But I have async calls in my TODO. It should be enough for every "bool 
foo(xyz)" to just have "startFoo(xyz)" and signal "fooDone(bool)", shouldn't 

> At KDEPIM we've run into numerous nasty side effects when trying to
> shoehorn asynchronous behavior into synchronous APIs.
> Our lesson learned was to never to that again even if making a job based
> API (or something like QTcpSocket's start-and-signal-finish) is more work
> and not as trivial to use until you get used to it.

 Lubos Lunak
 openSUSE Boosters team, KDE developer
 l.lunak at suse.cz , l.lunak at kde.org

More information about the kde-core-devel mailing list