Development/Tutorials/KIO Slaves/Using KIO Slaves in your Program

In this chapter we write a simple browser to show how easy it is to use kioslaves in KDE 4. The browser will download the page www.kde.org and show the html sourcecode. It will not render html - remember this is a programming demo.
The purpose of kioslaves is to have access to a given storage or data representation without the need for blocking calls. This is solved via QT's signal/slot mechanism: Once the data has arrived, e.g. from a web page, it triggers a signal. The signal is connected to the respective slot and can start processing the data.

As discussed, the Browser class does not do a busy wait for the data to arrive from the web. Instead, it uses the http kioslave's signal data by connecting it to the slot dataishere. dataIsHere gets the http transmission via its parameter data and just outputs it. That's it - no blocking, no busy wait!