1 | |
2 | /* |
3 | * This file is part of the KDE Help Center |
4 | * |
5 | * Copyright (c) 2002 Frerich Raabe <raabe@kde.org> |
6 | * |
7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by |
9 | * the Free Software Foundation; either version 2 of the License, or |
10 | * (at your option) any later version. |
11 | * |
12 | * This program is distributed in the hope that it will be useful, |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * GNU General Public License for more details. |
16 | * |
17 | * You should have received a copy of the GNU General Public License |
18 | * along with this program; if not, write to the Free Software |
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
20 | */ |
21 | |
22 | #include "application.h" |
23 | #include "mainwindow.h" |
24 | #include "version.h" |
25 | |
26 | #include <KCmdLineArgs> |
27 | #include <KAboutData> |
28 | #include <KLocale> |
29 | |
30 | using namespace KHC; |
31 | |
32 | Application::Application() : KUniqueApplication(), mMainWindow( 0 ) |
33 | { |
34 | } |
35 | |
36 | int Application::newInstance() |
37 | { |
38 | if (restoringSession()) return 0; |
39 | |
40 | KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); |
41 | |
42 | KUrl url; |
43 | if ( args->count() ) |
44 | url = args->url( 0 ); |
45 | |
46 | if( !mMainWindow ) |
47 | { |
48 | mMainWindow = new MainWindow; |
49 | mMainWindow->show(); |
50 | } |
51 | |
52 | mMainWindow->openUrl( url ); |
53 | |
54 | return KUniqueApplication::newInstance(); |
55 | } |
56 | |
57 | extern "C" int KDE_EXPORT kdemain( int argc, char **argv ) |
58 | { |
59 | KAboutData aboutData( "khelpcenter" , 0, ki18n("KDE Help Center" ), |
60 | HELPCENTER_VERSION, |
61 | ki18n("The KDE Help Center" ), |
62 | KAboutData::License_GPL, |
63 | ki18n("(c) 1999-2011, The KHelpCenter developers" ) ); |
64 | |
65 | aboutData.addAuthor( ki18n("Cornelius Schumacher" ), KLocalizedString(), "schumacher@kde.org" ); |
66 | aboutData.addAuthor( ki18n("Frerich Raabe" ), KLocalizedString(), "raabe@kde.org" ); |
67 | aboutData.addAuthor( ki18n("Matthias Elter" ), ki18n("Original Author" ), |
68 | "me@kde.org" ); |
69 | aboutData.addAuthor( ki18n("Wojciech Smigaj" ), ki18n("Info page support" ), |
70 | "achu@klub.chip.pl" ); |
71 | aboutData.setProgramIconName( "help-browser" ); |
72 | |
73 | KCmdLineArgs::init( argc, argv, &aboutData ); |
74 | |
75 | KCmdLineOptions options; |
76 | options.add("+[url]" , ki18n("URL to display" )); |
77 | KCmdLineArgs::addCmdLineOptions( options ); |
78 | KCmdLineArgs::addStdCmdLineOptions(); |
79 | |
80 | KHC::Application app; |
81 | |
82 | if ( app.isSessionRestored() ) |
83 | { |
84 | RESTORE( MainWindow ); |
85 | } |
86 | |
87 | return app.exec(); |
88 | } |
89 | |
90 | // vim:ts=2:sw=2:et |
91 | |