• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

NepomukDaemons

ontologydownloadjob.cpp

Go to the documentation of this file.
00001 
00002 class Private
00003 {
00004 public:
00005     void _k_slotHttpGetResult( KJob* job );
00006     void _k_slotData(KIO::Job*, const QByteArray&);
00007 
00008     QUrl ontoNamespace;
00009     KTemporaryFile tmpFile;
00010 };
00011 
00012 
00013 void start()
00014 {
00015     KIO::TransferJob* job = KIO::get( d->ontoNamespace );
00016     connect( job, SIGNAL(result(KJob*)),
00017              this, SLOT(_k_slotHttpGetResult(KJob*)) );
00018     connect( job, SIGNAL(data(KIO::Job*, const QByteArray&)),
00019              this, SLOT(_k_slotData(KIO::Job*, const QByteArray&)) );
00020     job->start();
00021 }
00022 
00023 
00024 void Private::_k_data( KIO::Job*, const QByteArray& data )
00025 {
00026     if( !d->tmpFile.isOpen() ) {
00027         d->tmpFile.open();
00028     }
00029 
00030     d->tmpFile.write( data );
00031 }
00032 
00033 
00034 void Private::_k_slotHttpGetResult( KJob* job )
00035 {
00036     d->tmpFile.close();
00037 
00038     if( !job->error() ) {
00039         QString mimeType = job->mimetype();
00040         const Soprano::Parser* parser =
00041             Soprano::PluginManager::instance()->discoverParserForSerialization( Soprano::mimeTypeToSerialization( mimetype ),
00042                                                                                 mimetype );
00043         if( parser ) {
00044             Soprano::StatementIterator it = parser->parseFile( d->tmpFile.fileName(),
00045                                                                d->ontoNamespace,
00046                                                                Soprano::mimeTypeToSerialization( mimetype ),
00047                                                                mimetype );
00048 
00049         }
00050         else {
00051             // FIXME: report error: unable to handle data of type XXX
00052         }
00053     }
00054     else {
00055         // FIXME: report http error
00056     }
00057 
00058     d->tmpFile.remove();
00059 }

NepomukDaemons

Skip menu "NepomukDaemons"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • KCMShell
  • KNotify
  • KStyles
  • Nepomuk Daemons
Generated for API Reference by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal