add more spacing
[personal-kdebase.git] / runtime / nepomuk / services / ontologyloader / ontologydownloadjob.cpp
blobd20f19f965faca7c85c2a94af42e3d7bc87c8e45
2 class Private
4 public:
5 void _k_slotHttpGetResult( KJob* job );
6 void _k_slotData(KIO::Job*, const QByteArray&);
8 QUrl ontoNamespace;
9 KTemporaryFile tmpFile;
13 void start()
15 KIO::TransferJob* job = KIO::get( d->ontoNamespace );
16 connect( job, SIGNAL(result(KJob*)),
17 this, SLOT(_k_slotHttpGetResult(KJob*)) );
18 connect( job, SIGNAL(data(KIO::Job*, const QByteArray&)),
19 this, SLOT(_k_slotData(KIO::Job*, const QByteArray&)) );
20 job->start();
24 void Private::_k_data( KIO::Job*, const QByteArray& data )
26 if( !d->tmpFile.isOpen() ) {
27 d->tmpFile.open();
30 d->tmpFile.write( data );
34 void Private::_k_slotHttpGetResult( KJob* job )
36 d->tmpFile.close();
38 if( !job->error() ) {
39 QString mimeType = job->mimetype();
40 const Soprano::Parser* parser =
41 Soprano::PluginManager::instance()->discoverParserForSerialization( Soprano::mimeTypeToSerialization( mimetype ),
42 mimetype );
43 if( parser ) {
44 Soprano::StatementIterator it = parser->parseFile( d->tmpFile.fileName(),
45 d->ontoNamespace,
46 Soprano::mimeTypeToSerialization( mimetype ),
47 mimetype );
50 else {
51 // FIXME: report error: unable to handle data of type XXX
54 else {
55 // FIXME: report http error
58 d->tmpFile.remove();