Nepomuk
resourcemanager.h
Go to the documentation of this file.
00001 /* 00002 * This file is part of the Nepomuk KDE project. 00003 * Copyright (C) 2006-2009 Sebastian Trueg <trueg@kde.org> 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Library General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Library General Public License 00016 * along with this library; see the file COPYING.LIB. If not, write to 00017 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 * Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef _NEPOMUK_RESOURCE_MANAGER_H_ 00022 #define _NEPOMUK_RESOURCE_MANAGER_H_ 00023 00024 #include "nepomuk_export.h" 00025 00026 #include <QtCore/QObject> 00027 #include <QtCore/QUrl> 00028 00029 00030 namespace Soprano { 00031 class Model; 00032 } 00033 00034 namespace Nepomuk { 00035 class Resource; 00036 class Variant; 00037 class ResourceManagerHelper; 00038 class ResourceManagerPrivate; 00039 00051 class NEPOMUK_EXPORT ResourceManager : public QObject 00052 { 00053 Q_OBJECT 00054 00055 public: 00056 static ResourceManager* instance(); 00057 00067 void deleteInstance(); 00068 00080 int init(); 00081 00086 bool initialized() const; 00087 00091 Soprano::Model* mainModel(); 00092 00101 void setOverrideMainModel( Soprano::Model* model ); 00102 00113 #ifndef KDE_NO_DEPRECATED 00114 KDE_DEPRECATED Resource createResourceFromUri( const QString& uri ); 00115 #endif 00116 00123 void removeResource( const QString& uri ); 00124 00134 QList<Resource> allResources(); 00135 00146 QList<Resource> allResourcesOfType( const QUrl& type ); 00147 00151 #ifndef KDE_NO_DEPRECATED 00152 KDE_DEPRECATED QList<Resource> allResourcesOfType( const QString& type ); 00153 #endif 00154 00170 QList<Resource> allResourcesWithProperty( const QUrl& uri, const Variant& v ); 00171 00175 #ifndef KDE_NO_DEPRECATED 00176 KDE_DEPRECATED QList<Resource> allResourcesWithProperty( const QString& uri, const Variant& v ); 00177 #endif 00178 00185 void clearCache(); 00186 00193 #ifndef KDE_NO_DEPRECATED 00194 KDE_DEPRECATED QString generateUniqueUri(); 00195 #endif 00196 00207 QUrl generateUniqueUri( const QString& label ); 00208 00212 void notifyError( const QString& uri, int errorCode ); 00213 00224 static ResourceManager* createManagerForModel( Soprano::Model* model ); 00225 00226 Q_SIGNALS: 00236 void resourceModified( const QString& uri ); 00237 00245 void error( const QString& uri, int errorCode ); 00246 00256 void nepomukSystemStarted(); 00257 00263 void nepomukSystemStopped(); 00264 00265 private Q_SLOTS: 00266 void slotStoreChanged(); 00267 00268 private: 00269 friend class Nepomuk::ResourceManagerHelper; 00270 friend class Nepomuk::Resource; 00271 friend class Nepomuk::ResourceManagerPrivate; 00272 00273 ResourceManager(); 00274 ~ResourceManager(); 00275 00276 ResourceManagerPrivate* const d; 00277 00278 Q_PRIVATE_SLOT( d, void _k_storageServiceInitialized(bool) ) 00279 Q_PRIVATE_SLOT( d, void _k_dbusServiceUnregistered(QString) ) 00280 }; 00281 } 00282 00283 #endif
KDE 4.6 API Reference