• 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
  • server
server/main.cpp
Go to the documentation of this file.
1 /* This file is part of the KDE Project
2  Copyright (c) 2007-2010 Sebastian Trueg <trueg@kde.org>
3 
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.
7 
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.
12 
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.
17 */
18 
19 #include "nepomukserver.h"
20 #include "nepomukserver_export.h"
21 
22 #include "nepomukversion.h"
23 
24 #include <kcmdlineargs.h>
25 #include <kaboutdata.h>
26 #include <klocale.h>
27 #include <kcomponentdata.h>
28 #include <kdebug.h>
29 
30 #include <QtCore/QCoreApplication>
31 #include <QtDBus/QDBusConnection>
32 #include <QtDBus/QDBusConnectionInterface>
33 
34 #include <signal.h>
35 
36 
37 namespace {
38 #ifndef Q_OS_WIN
39  void signalHandler( int signal )
40  {
41  switch( signal ) {
42  case SIGHUP:
43  case SIGQUIT:
44  case SIGTERM:
45  case SIGINT:
46  QCoreApplication::instance()->quit();
47  }
48  }
49 
50  void installSignalHandler() {
51  struct sigaction sa;
52  ::memset( &sa, 0, sizeof( sa ) );
53  sa.sa_handler = signalHandler;
54  sigaction( SIGHUP, &sa, 0 );
55  sigaction( SIGINT, &sa, 0 );
56  sigaction( SIGQUIT, &sa, 0 );
57  sigaction( SIGTERM, &sa, 0 );
58  }
59 #endif
60 }
61 
62 
63 extern "C" NEPOMUK_SERVER_EXPORT int kdemain( int argc, char** argv )
64 {
65  KAboutData aboutData( "NepomukServer", "nepomukserver",
66  ki18n("Nepomuk Server"),
67  NEPOMUK_VERSION_STRING,
68  ki18n("Nepomuk Server - Manages Nepomuk storage and services"),
69  KAboutData::License_GPL,
70  ki18n("(c) 2008-2011, Sebastian Trüg"),
71  KLocalizedString(),
72  "http://nepomuk.kde.org" );
73  aboutData.addAuthor(ki18n("Sebastian Trüg"),ki18n("Maintainer"), "trueg@kde.org");
74 
75  KCmdLineArgs::init( argc, argv, &aboutData );
76 
77  KCmdLineOptions options;
78  options.add("noservices", ki18n("Start the nepomukserver without any services"));
79  KCmdLineArgs::addCmdLineOptions(options);
80 
81  KComponentData componentData( &aboutData );
82 
83  if ( QDBusConnection::sessionBus().interface()->isServiceRegistered(QLatin1String("org.kde.NepomukServer")) ) {
84  fprintf( stderr, "Nepomuk server already running.\n" );
85  return 0;
86  }
87 
88 #ifndef Q_OS_WIN
89  installSignalHandler();
90 #endif
91 
92  QCoreApplication app(argc, argv);
93 
94  const KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
95 
96  Nepomuk2::Server* server = new Nepomuk2::Server(!args->isSet("services"), &app);
97  int rv = app.exec();
98 
99  delete server;
100  return rv;
101 }
NEPOMUK_SERVER_EXPORT
#define NEPOMUK_SERVER_EXPORT
Definition: nepomukserver_export.h:27
nepomukserver.h
Nepomuk2::Server
Definition: nepomukserver.h:34
nepomukserver_export.h
kdemain
NEPOMUK_SERVER_EXPORT int kdemain(int argc, char **argv)
Definition: server/main.cpp:63
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