#include <loader.h>
Inherits TQObject.
Signals | |
void | loadingComplete (Loader *loader, Document doc, Status status) |
Public Member Functions | |
void | loadFrom (const KURL &url, DataRetriever *retriever) |
int | errorCode () const |
const KURL & | discoveredFeedURL () const |
void | abort () |
Static Public Member Functions | |
static Loader * | create () |
static Loader * | create (TQObject *object, const char *slot) |
Friends | |
class | someClassWhichDoesNotExist |
Detailed Description
This class is the preferred way of loading RSS files.
Usage is very straightforward:
This creates a Loader object, connects it's loadingComplete() signal to your custom slot and then makes it load the file 'http://www.blah.org/foobar.rdf' using the FileRetriever. You could've done something like this as well:
That'd make the Loader use another algorithm for retrieving the RSS data; 'OutputRetriever' will make it execute the script '/home/myself/some-script.py' and assume whatever that script prints to stdout is RSS markup. This is e.g. handy for conversion scripts, which download an HTML file and convert it's contents into RSS markup.
No matter what kind of retrieval algorithm you employ, your 'slotLoadingComplete' method might look like this:
- Note
- You have to create a copy of the passed Document instance in case you want/need to use it after the slot attached to the loadingComplete signal goes out of scope. This is e.g. the case if you intend to call getPixmap() on Document::image()!
Member Function Documentation
◆ create() [1/2]
|
static |
Constructs a Loader instance.
This is pretty much what the default constructor would do, except that it ensures that all Loader instances have been allocated on the heap (this is required so that Loader's can delete themselves safely after they emitted the loadingComplete() signal.).
- Returns
- A pointer to a new Loader instance.
Definition at line 263 of file loader.cpp.
◆ create() [2/2]
|
static |
Convenience method.
Does the same as the above method except that it also does the job of connecting the loadingComplete() signal to the given slot for you.
- Parameters
-
object A TQObject which features the specified slot slot Which slot to connect to.
Definition at line 268 of file loader.cpp.
◆ errorCode()
int Loader::errorCode | ( | ) | const |
Retrieves the error code of the last loading process (if any), as reported by the employed data retrever.
Definition at line 299 of file loader.cpp.
◆ loadFrom()
void Loader::loadFrom | ( | const KURL & | url, |
DataRetriever * | retriever | ||
) |
Loads the RSS file referenced by the given URL using the specified retrieval algorithm.
Make sure that you connected to the loadingComplete() signal before calling this method so that you're guaranteed to get notified when the loading finished.
- Note
- A Loader object cannot load from multiple URLs simultaneously; consequently, subsequent calls to loadFrom will be discarded silently, only the first loadFrom request will be executed.
- Parameters
-
url An URL referencing the input file. retriever A subclass of DataRetriever which implements a specialized retrieval behaviour. Note that the ownership of the retriever is transferred to the Loader, i.e. the Loader will delete it when it doesn't need it anymore.
- See also
- DataRetriever, Loader::loadingComplete()
Definition at line 285 of file loader.cpp.
◆ loadingComplete
This signal gets emitted when the loading process triggered by calling loadFrom() finished.
- Parameters
-
loader A pointer pointing to the loader object which emitted this signal; this is handy in case you connect multiple loaders to a single slot. doc In case status is Success, this parameter holds the parsed RSS file. In case it's RetrieveError, you should query loader->errorCode() for the actual error code. Note that you have to create a copy of the passed Document instance in case you want/need to use it after the slot attached to the loadingComplete signal goes out of scope. This is e.g. the case if you intend to call getPixmap() on Document::image()! status A status byte telling whether there were any problems while retrieving or parsing the data.
- See also
- Document, Status
The documentation for this class was generated from the following files: