1/* This file is part of the KDE project
2 Copyright (C) Andrew Stanley-Jones <asj@cban.com>
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; see the file COPYING. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19
20#include <stdio.h>
21#include <stdlib.h>
22
23#include <KLocale>
24#include <KCmdLineArgs>
25#include <KAboutData>
26#include <KUniqueApplication>
27#include <KConfigDialogManager>
28
29#include "tray.h"
30#include "klipper.h"
31
32extern "C" int KDE_EXPORT kdemain(int argc, char *argv[])
33{
34 Klipper::createAboutData();
35 KCmdLineArgs::init( argc, argv, Klipper::aboutData());
36 KUniqueApplication::addCmdLineOptions();
37
38 if (!KUniqueApplication::start()) {
39 fprintf(stderr, "Klipper is already running! Check it in the system tray in the panel.\n");
40 exit(0);
41 }
42 KUniqueApplication app;
43 app.disableSessionManagement();
44 app.setQuitOnLastWindowClosed( false );
45
46 // make KConfigDialog "know" when our actions page is changed
47 KConfigDialogManager::changedMap()->insert("ActionsTreeWidget", SIGNAL(changed()));
48
49 KlipperTray klipper;
50 int ret = app.exec();
51 Klipper::destroyAboutData();
52 return ret;
53}
54