doc fixes found while translating
[kdepim.git] / knode / knapplication.cpp
blob9c5edc839a11e28d8711fd7f757986efba86e750
1 /*
2 knapplication.cpp
4 KNode, the KDE newsreader
5 Copyright (c) 1999-2010 the KNode authors.
6 See file AUTHORS for details
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software Foundation,
14 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, US
17 #include "knapplication.h"
19 #include <kwindowsystem.h>
20 #include <kdebug.h>
21 #include <kcmdlineargs.h>
23 #include "knode.h"
24 #include "knmainwidget.h"
25 #include "knapplication.moc"
28 int KNApplication::newInstance()
30 kDebug() << "KNApplication::newInstance()";
32 if (!mainWidget()) {
33 if ( isSessionRestored() ) {
34 int n = 1;
35 while (KNMainWindow::canBeRestored(n)){
36 if (KNMainWindow::classNameOfToplevel(n)=="KNMainWindow") {
37 KNMainWindow* mainWin = new KNMainWindow;
38 mainWin->restore(n);
39 if ( n == 1 )
40 setMainWidget( mainWin );
41 break;
43 n++;
47 if (!mainWidget()) {
48 KNMainWindow* mainWin = new KNMainWindow;
49 setMainWidget(mainWin); // this makes the external viewer windows close on shutdown...
50 mainWin->show();
54 // Handle window activation and startup notification
55 KUniqueApplication::newInstance();
57 // process URLs...
58 KNMainWidget *w = static_cast<KNMainWindow*>(mainWidget())->mainWidget();
59 w->handleCommandLine();
61 kDebug() << "KNApplication::newInstance() done";
62 return 0;