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