1 /* This file is part of the KDE Project
2 Copyright (c) 2007 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 "nepomukserver.h"
20 #include "nepomukserver_export.h"
22 #include <kuniqueapplication.h>
23 #include <kapplication.h>
24 #include <kcmdlineargs.h>
25 #include <kaboutdata.h>
29 #include <kconfiggroup.h>
36 void signalHandler( int signal
)
50 void installSignalHandler() {
53 ::memset( &sa
, 0, sizeof( sa
) );
54 sa
.sa_handler
= signalHandler
;
55 sigaction( SIGHUP
, &sa
, 0 );
56 sigaction( SIGINT
, &sa
, 0 );
57 sigaction( SIGQUIT
, &sa
, 0 );
58 sigaction( SIGTERM
, &sa
, 0 );
65 class ServerApplication
: public KUniqueApplication
69 : KUniqueApplication(),
75 m_server
= new Server( this );
86 extern "C" NEPOMUK_SERVER_EXPORT
int kdemain( int argc
, char** argv
)
88 KAboutData
aboutData( "NepomukServer", "nepomuk",
89 ki18n("Nepomuk Server"),
91 ki18n("Nepomuk Server - Manages Nepomuk storage and services"),
92 KAboutData::License_GPL
,
93 ki18n("(c) 2008, Sebastian Trüg"),
95 "http://nepomuk.kde.org" );
96 aboutData
.addAuthor(ki18n("Sebastian Trüg"),ki18n("Maintainer"), "trueg@kde.org");
98 KCmdLineArgs::init( argc
, argv
, &aboutData
);
100 KUniqueApplication::addCmdLineOptions();
102 KComponentData
componentData( &aboutData
);
104 if ( !KUniqueApplication::start() ) {
105 fprintf( stderr
, "Nepomuk server already running.\n" );
109 installSignalHandler();
111 Nepomuk::ServerApplication app
;
112 app
.setQuitOnLastWindowClosed( false );