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

NepomukDaemons

strigiservice.cpp

Go to the documentation of this file.
00001 /* This file is part of the KDE Project
00002    Copyright (c) 2008 Sebastian Trueg <trueg@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License version 2 as published by the Free Software Foundation.
00007 
00008    This library is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011    Library General Public License for more details.
00012 
00013    You should have received a copy of the GNU Library General Public License
00014    along with this library; see the file COPYING.LIB.  If not, write to
00015    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00016    Boston, MA 02110-1301, USA.
00017 */
00018 
00019 #include "strigiservice.h"
00020 #include "strigiserviceadaptor.h"
00021 #include "priority.h"
00022 #include "indexscheduler.h"
00023 #include "eventmonitor.h"
00024 #include "systray.h"
00025 #include "config.h"
00026 #include "statuswidget.h"
00027 #include "nepomukstorageinterface.h"
00028 
00029 #include <KDebug>
00030 
00031 #include <strigi/indexpluginloader.h>
00032 #include <strigi/indexmanager.h>
00033 
00034 #include <nepomuk/resourcemanager.h>
00035 
00036 
00037 Nepomuk::StrigiService::StrigiService( QObject* parent, const QList<QVariant>& )
00038     : Service( parent, true )
00039 {
00040     // only so ResourceManager won't open yet another connection to the nepomuk server
00041     ResourceManager::instance()->setOverrideMainModel( mainModel() );
00042 
00043     // lower process priority - we do not want to spoil KDE usage
00044     // ==============================================================
00045     if ( !lowerPriority() )
00046         kDebug() << "Failed to lower priority.";
00047     if ( !lowerSchedulingPriority() )
00048         kDebug() << "Failed to lower scheduling priority.";
00049     if ( !lowerIOPriority() )
00050         kDebug() << "Failed to lower io priority.";
00051 
00052     // Using Strigi with the redland backend is torture.
00053     // Thus we simply fail initialization if it is used
00054     // ==============================================================
00055     if ( org::kde::nepomuk::Storage( "org.kde.NepomukStorage",
00056                                      "/nepomukstorage",
00057                                      QDBusConnection::sessionBus() )
00058          .usedSopranoBackend().value() != QString::fromLatin1( "redland" ) ) {
00059         // setup the actual index scheduler including strigi stuff
00060         // ==============================================================
00061         if ( ( m_indexManager = Strigi::IndexPluginLoader::createIndexManager( "sopranobackend", 0 ) ) ) {
00062             m_indexScheduler = new IndexScheduler( m_indexManager, this );
00063 
00064             ( void )new EventMonitor( m_indexScheduler, this );
00065             ( void )new StrigiServiceAdaptor( m_indexScheduler, this );
00066             StatusWidget* sw = new StatusWidget( mainModel(), m_indexScheduler );
00067             ( new SystemTray( m_indexScheduler, sw ) )->show();
00068 
00069             m_indexScheduler->start();
00070         }
00071         else {
00072             kDebug() << "Failed to load sopranobackend Strigi index manager.";
00073         }
00074 
00075 
00076         // service initialization done if creating a strigi index manager was successful
00077         // ==============================================================
00078         setServiceInitialized( m_indexManager != 0 );
00079     }
00080     else {
00081         kDebug() << "Will not start when using redland Soprano backend due to horrible performance.";
00082         setServiceInitialized( false );
00083     }
00084 }
00085 
00086 
00087 Nepomuk::StrigiService::~StrigiService()
00088 {
00089     if ( m_indexManager ) {
00090         m_indexScheduler->stop();
00091         m_indexScheduler->wait();
00092         Strigi::IndexPluginLoader::deleteIndexManager( m_indexManager );
00093     }
00094 }
00095 
00096 
00097 #include <kpluginfactory.h>
00098 #include <kpluginloader.h>
00099 
00100 NEPOMUK_EXPORT_SERVICE( Nepomuk::StrigiService, "nepomukstrigiservice" )
00101 
00102 #include "strigiservice.moc"
00103 

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