<br><br><div class="gmail_quote">On Fri, Mar 7, 2008 at 4:22 PM, Bernhard Beschow <<a href="mailto:bbeschow@cs.tu-berlin.de">bbeschow@cs.tu-berlin.de</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi all,<br>
<br>
inside a data engine I'd like to request some data via http. There is the<br>
QHttp class I could use as well as KIO. Both of them seem to be asynchronous.<br>
Now I ran into trouble combining those with DataEngines for the following<br>
reason:<br>
<br>
In my data engine, data is fetched asynchronously via QHttp each time<br>
updateSource gets called. After sending the request, the method returns false,<br>
while the QHttp object is waiting for a response. When new data is available,<br>
it is applied using setData, but the visualizations don't get updated until<br>
updateSource gets called next time. Even worse, this results in old data to<br>
be displayed. So I wonder what the proper way is to implement asynchronous<br>
data retrieval?<br>
<br>
Of course, there is also synchronous data fetching. I'm not sure whether KIO<br>
can do this. I've seen code for this using a raw tcp socket, but I'd rather<br>
have high-level http access to the data. Anyway, blocking is probably not an<br>
option here since it blocks the whole applet (or even plasma), right?<br>
<br>
Any hints are very welcome. Thanks in advance!<br>
<br>
Best whishes,<br>
Bernhard<br>
_______________________________________________<br>
Panel-devel mailing list<br>
<a href="mailto:Panel-devel@kde.org">Panel-devel@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/panel-devel" target="_blank">https://mail.kde.org/mailman/listinfo/panel-devel</a><br>
</blockquote></div><br><br>Don't implement updateSource(QString). Create a timer in your engine that directs the HTTP data to be updated. Once it returns the data, set the required information using setData. Once everything is updated call checkForUpdates().<br>