<br><br><div class="gmail_quote">On Fri, Mar 7, 2008 at 4:22 PM, Bernhard Beschow &lt;<a href="mailto:bbeschow@cs.tu-berlin.de">bbeschow@cs.tu-berlin.de</a>&gt; 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&#39;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&#39;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&#39;m not sure whether KIO<br>
can do this. I&#39;ve seen code for this using a raw tcp socket, but I&#39;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&#39;t implement updateSource(QString).&nbsp; Create a timer in your engine that directs the HTTP data to be updated.&nbsp; Once it returns the data, set the required information using setData.&nbsp; Once everything is updated call checkForUpdates().<br>