1
/**************************************************************************
3
main.cpp - The main function for KPager
4
Copyright (C) 1998-2000 Antonio Larrosa Jimenez
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
Send comments and bug fixes to larrosa@kde.org
22
***************************************************************************/
24
#include <kuniqueapplication.h>
26
#include <kcmdlineargs.h>
27
#include <kaboutdata.h>
31
#include <qsessionmanager.h>
35
static KCmdLineOptions pagerOpts[] =
37
{ "hidden", I18N_NOOP("Create pager but keep the window hidden"), 0 },
41
bool closed_by_sm = false;
43
class KPagerApplication : public KUniqueApplication
46
KPagerApplication() : KUniqueApplication() {}
48
void commitData(QSessionManager& sm) {
49
if (mainWidget()->isHidden()) {
50
sm.setRestartHint( QSessionManager::RestartNever );
54
KUniqueApplication::commitData( sm );
65
int main(int argc, char **argv)
67
KAboutData *aboutdata = new KAboutData("kpager", "KPager", "1.5",
68
I18N_NOOP("Desktop Overview"), KAboutData::License_GPL,
69
"(C) 1998-2002, Antonio Larrosa Jimenez","",
70
"http://devel-home.kde.org/~larrosa/kpager.html");
72
aboutdata->addAuthor("Antonio Larrosa Jimenez",
73
I18N_NOOP("Original Developer/Maintainer"),"larrosa@kde.org",
74
"http://devel-home.kde.org/~larrosa/index.html");
75
aboutdata->addAuthor("Matthias Elter",
76
I18N_NOOP("Developer"),"elter@kde.org", "");
77
aboutdata->addAuthor("Matthias Ettrich",
78
I18N_NOOP("Developer"),"ettrich@kde.org", "");
80
KCmdLineArgs::init(argc, argv, aboutdata);
81
KCmdLineArgs::addCmdLineOptions(pagerOpts);
82
KUniqueApplication::addCmdLineOptions();
84
if (!KUniqueApplication::start())
86
kdError() << "kpager is already running!" << endl;
91
KApplication * app = new KPagerApplication;
92
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
94
KPagerMainWindow *kpager = new KPagerMainWindow(0,"KPager");
95
kpager->setPlainCaption( i18n("Desktop Pager") );
98
app->setMainWidget(kpager);
99
if (!args->isSet("hidden")) kpager->show();
102
int ret = app->exec();