1 | /* This file is part of the KDE project |
2 | Copyright (C) 2008 Omat Holding B.V. <info@omat.nl> |
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; if not, write to the Free Software |
16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
17 | */ |
18 | |
19 | #include <kuniqueapplication.h> |
20 | #include <kstartupinfo.h> |
21 | #include <kcmdlineargs.h> |
22 | #include <kaboutdata.h> |
23 | #include <stdio.h> |
24 | #include <stdlib.h> |
25 | |
26 | #include "dock.h" |
27 | |
28 | /** |
29 | * @class AkonadiTrayApplication |
30 | * @author Tom Albers <tomalbers@kde.nl> |
31 | * This class is a simple inheritance from KUniqueApplication |
32 | * the reason that it is reimplemented is that when AkonadiTray |
33 | * is launched a second time it would in the orinal implementation |
34 | * make the show(). which we do not want. This |
35 | * class misses that call. |
36 | */ |
37 | class AkonadiTrayApplication : public KUniqueApplication |
38 | { |
39 | public: |
40 | /** |
41 | * Similar to KUniqueApplication::newInstance, only without |
42 | * the call to raise the widget when a second instance is started. |
43 | */ |
44 | int newInstance() { |
45 | return 0; |
46 | } |
47 | }; |
48 | |
49 | int main( int argc, char *argv[] ) |
50 | { |
51 | KAboutData aboutData( "akonaditray" , 0, |
52 | ki18n( "AkonadiTray" ), |
53 | "0.1" , |
54 | ki18n( "System tray application to control basic Akonadi functions" ), |
55 | KAboutData::License_GPL, |
56 | ki18n( "(c) 2008 Omat Holding B.V." ), |
57 | KLocalizedString() ); |
58 | aboutData.addAuthor( ki18n( "Tom Albers" ), ki18n( "Maintainer and Author" ), |
59 | "tomalbers@kde.nl" , "http://www.omat.nl" ); |
60 | aboutData.setProgramIconName( QLatin1String("akonaditray" ) ); |
61 | |
62 | KCmdLineArgs::init( argc, argv, &aboutData ); |
63 | |
64 | if ( !KUniqueApplication::start() ) { |
65 | fprintf( stderr, "akonaditray is already running!\n" ); |
66 | exit( 0 ); |
67 | } |
68 | |
69 | AkonadiTrayApplication a; |
70 | a.setQuitOnLastWindowClosed( false ); |
71 | |
72 | Tray tray; |
73 | |
74 | return a.exec(); |
75 | } |
76 | |