• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

Nepomuk-Core

  • sources
  • kde-4.12
  • kdelibs
  • nepomuk-core
  • services
  • storage
ontologydownloadjob.cpp
Go to the documentation of this file.
1 
2 class Private
3 {
4 public:
5  void _k_slotHttpGetResult( KJob* job );
6  void _k_slotData(KIO::Job*, const QByteArray&);
7 
8  QUrl ontoNamespace;
9  KTemporaryFile tmpFile;
10 };
11 
12 
13 void start()
14 {
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();
21 }
22 
23 
24 void Private::_k_data( KIO::Job*, const QByteArray& data )
25 {
26  if( !d->tmpFile.isOpen() ) {
27  d->tmpFile.open();
28  }
29 
30  d->tmpFile.write( data );
31 }
32 
33 
34 void Private::_k_slotHttpGetResult( KJob* job )
35 {
36  d->tmpFile.close();
37 
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 );
48 
49  }
50  else {
51  // FIXME: report error: unable to handle data of type XXX
52  }
53  }
54  else {
55  // FIXME: report http error
56  }
57 
58  d->tmpFile.remove();
59 }
start
void start()
Definition: ontologydownloadjob.cpp:13
KJob
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:08 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Nepomuk-Core

Skip menu "Nepomuk-Core"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal