On Thursday 12 January 2006 09:32, Roberto Cappuccio wrote:
> Alle 09:29, gioved=EC 12 gennaio 2006, hai scritto:
> > Hi,
> >
> > If a function launches a KIO::Job, is there a way for the function to w=

ait for
> > the job's completion before returning?

1) usually you don't want to do that, it will block the GUI for a possibly =
long time,
it's much better to connect to the result signal and proceed there.

2) ok in some cases you do want to do that. Out of laziness, or out of opti=
mism overflow
You can either
- find an appropriate KIO::NetAccess method to call instead of KIO::get/co=
- assuming you're using kdelibs >=3D 3.4, create the Job as usual and then=
if ( NetAccess::synchronousRun( job ... ) ) { =


> > I have tried with a loop checking a variable that is set by the slot
> > connected to the completion signal of the Job, but it does not work.

Please avoid busy loops - they burn CPU and they don't help here anyway,
since you need to go to the event loop for event processing to happen.
NetAccess opens a sub-event-loop.

-- =

David Faure, faure@kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).


>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscrib=

e <<