NepomukDaemons
legacystoragebridge.cpp
Go to the documentation of this file.00001 /* 00002 Copyright (C) 2008 by Sebastian Trueg <trueg at kde.org> 00003 00004 This program is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation; either version 2, or (at your option) 00007 any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; if not, write to the Free Software 00016 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00017 */ 00018 00019 #include "legacystoragebridge.h" 00020 00021 #include <Soprano/Client/DBusClient> 00022 #include <Soprano/Client/DBusModel> 00023 00024 00025 Nepomuk::LegacyStorageBridge::LegacyStorageBridge( QObject* parent ) 00026 : Soprano::Server::ServerCore( parent ), 00027 m_client( 0 ) 00028 { 00029 registerAsDBusObject(); 00030 } 00031 00032 00033 Nepomuk::LegacyStorageBridge::~LegacyStorageBridge() 00034 { 00035 } 00036 00037 00038 Soprano::Model* Nepomuk::LegacyStorageBridge::model( const QString& name ) 00039 { 00040 initClient(); 00041 return m_client->createModel( name ); 00042 } 00043 00044 00045 void Nepomuk::LegacyStorageBridge::removeModel( const QString& name ) 00046 { 00047 initClient(); 00048 m_client->removeModel( name ); 00049 } 00050 00051 00052 QStringList Nepomuk::LegacyStorageBridge::allModels() const 00053 { 00054 const_cast<LegacyStorageBridge*>( this )->initClient(); 00055 return m_client->allModels(); 00056 } 00057 00058 00059 void Nepomuk::LegacyStorageBridge::initClient() 00060 { 00061 if ( !m_client ) { 00062 m_client = new Soprano::Client::DBusClient( "org.kde.NepomukStorage", this ); 00063 } 00064 } 00065 00066 #include "legacystoragebridge.moc"