--Boundary-00=_u53eI5RMDc9kT7U Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Let me open with a question: Is there any technical problem with enabling event handling in KIO::SlaveBase? The attached patch is not really pretty as it uses QCoreApplication::processEvents(). A proper implementation (which I would do once this issue is clarified) would be based on signal/slot communication. But it works and allows to test the event handling. As the event handling is disabled by default, nothing changes for existing kio slaves. But it allows my rebooted nepomuk search kio slave to update the folder contents when the database changes. Cheers, Sebastian --Boundary-00=_u53eI5RMDc9kT7U Content-Type: text/x-diff; charset="us-ascii"; name="slavebase-eventhandling.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="slavebase-eventhandling.diff" Index: slavebase.h =================================================================== --- slavebase.h (revision 832330) +++ slavebase.h (working copy) @@ -54,6 +54,16 @@ virtual ~SlaveBase(); /** + * Enable or disable event handling during dispatching. + * + * \param enabled if \p true events will be handled (for example + * signals will be delivered) during dispatching. + * + * The default is to not handle events. + */ + void setEventHandlingEnabled( bool enabled ); + + /** * @internal * Terminate the slave by calling the destructor and then ::exit() */ Index: slavebase.cpp =================================================================== --- slavebase.cpp (revision 832330) +++ slavebase.cpp (working copy) @@ -97,6 +97,7 @@ KConfig *config; KConfigGroup *configGroup; KUrl onHoldUrl; + bool eventHandlingEnabled:1; struct timeval last_tv; KIO::filesize_t totalSize; @@ -242,6 +243,7 @@ d->remotefile = 0; d->inOpenLoop = false; d->exit_loop = false; + d->eventHandlingEnabled = false; } SlaveBase::~SlaveBase() @@ -252,6 +254,13 @@ s_protocol = ""; } + +void SlaveBase::setEventHandlingEnabled( bool enabled ) +{ + d->eventHandlingEnabled = enabled; +} + + void SlaveBase::dispatchLoop() { while (!d->exit_loop) { @@ -269,7 +278,7 @@ ms = 1000 * qMax(d->timeout - time(0), 1); int ret = -1; - if (d->appConnection.hasTaskAvailable() || d->appConnection.waitForIncomingTask(ms)) { + if (d->appConnection.hasTaskAvailable() || (!d->eventHandlingEnabled && d->appConnection.waitForIncomingTask(ms))) { // dispatch application messages int cmd; QByteArray data; @@ -302,6 +311,9 @@ kDebug(7019)<<" dispatchLoop() slave was killed, returning"; return; } + + if (d->eventHandlingEnabled) + QCoreApplication::processEvents(); } } --Boundary-00=_u53eI5RMDc9kT7U--