delay a few things on startup, such as setting the visibility mode, which ensures...
[personal-kdebase.git] / runtime / nepomuk / services / ontologyloader / desktopontologyupdatejob.cpp
blob10957416d5af16b3f63d72ae9130cb58cd45c90c
1 /* This file is part of the KDE Project
2 Copyright (c) 2008 Sebastian Trueg <trueg@kde.org>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation.
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
19 #include "desktopontologyupdatejob.h"
21 #include <KDebug>
22 #include <KConfigGroup>
23 #include <KDesktopFile>
25 #include <Soprano/StatementIterator>
26 #include <Soprano/PluginManager>
27 #include <Soprano/Parser>
30 Nepomuk::DesktopOntologyUpdateJob::DesktopOntologyUpdateJob( Soprano::Model* mainModel, QObject* parent )
31 : OntologyUpdateJob( mainModel, parent )
36 Nepomuk::DesktopOntologyUpdateJob::~DesktopOntologyUpdateJob()
41 void Nepomuk::DesktopOntologyUpdateJob::setOntologyDesktopFile( const QString& df )
43 m_desktopFilePath = df;
47 Soprano::StatementIterator Nepomuk::DesktopOntologyUpdateJob::data()
49 kDebug() << "Updating ontology" << m_desktopFilePath;
51 KDesktopFile df( m_desktopFilePath );
53 // Parse the ontology data
54 // ------------------------------------
55 QString mimeType = df.desktopGroup().readEntry( "MimeType", QString() );
56 const Soprano::Parser* parser
57 = Soprano::PluginManager::instance()->discoverParserForSerialization( Soprano::mimeTypeToSerialization( mimeType ),
58 mimeType );
59 if ( !parser ) {
60 kDebug() << "No parser to handle" << df.readName() << "(" << mimeType << ")";
61 return 0;
64 kDebug() << "Parsing" << df.readPath();
66 return parser->parseFile( df.readPath(),
67 df.readUrl(),
68 Soprano::mimeTypeToSerialization( mimeType ),
69 mimeType );
72 #include "desktopontologyupdatejob.moc"