2 Copyright (c) 1999 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
3 Copyright (c) 2000 Matthias Elter <elter@kde.org>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 * start "kinfocenter --nofork" in a debugger.
24 * If you want to test with command line arguments you need
25 * -after you have started kinfocenter in the debugger-
26 * open another shell and run kinfocenter with the desired
27 * command line arguments.
29 * The command line arguments will be passed to the version of
30 * kinfocenter in the debugger via DCOP and will cause a call
38 #include <kcmdlineargs.h>
39 #include <kaboutdata.h>
40 #include <kglobalsettings.h>
42 #include <kconfiggroup.h>
46 #include <kapplication.h>
49 #include <QDesktopWidget>
53 KInfoCenterApp::KInfoCenterApp() :
54 KUniqueApplication() {
56 toplevel
= new TopLevel();
58 QRect desk
= KGlobalSettings::desktopGeometry(toplevel
);
59 KConfigGroup
config(KGlobal::config(), "General");
61 // never bigger than workspace as reported by desk
62 // 940x700 on 96 dpi, 12 pt font
63 // 800x600 on 72 dpi, 12 pt font
64 // --> 368 + 6 x dpiX, 312 + 4 x dpiY
65 // Adjusted for font size
66 int fontSize
= toplevel
->fontInfo().pointSize();
68 fontSize
= (toplevel
->fontInfo().pixelSize() * 72) / toplevel
->logicalDpiX();
69 int x
= config
.readEntry(QString::fromLatin1("InitialWidth %1").arg(desk
.width()), qMin(desk
.width(), 368 + (6*toplevel
->logicalDpiX()*fontSize
)/12) );
70 int y
= config
.readEntry(QString::fromLatin1("InitialHeight %1").arg(desk
.height()), qMin(desk
.height(), 312 + (4*toplevel
->logicalDpiX()*fontSize
)/12) );
72 toplevel
->resize(x
, y
);
77 KInfoCenterApp::~KInfoCenterApp() {
79 KConfigGroup
config(KGlobal::config(), "General");
80 QDesktopWidget
*desk
= QApplication::desktop();
81 config
.writeEntry(QString::fromLatin1("InitialWidth %1").arg(desk
->width()), toplevel
->width());
82 config
.writeEntry(QString::fromLatin1("InitialHeight %1").arg(desk
->height()), toplevel
->height());
87 extern "C"KDE_EXPORT
int kdemain(int argc
, char *argv
[])
89 KLocale::setMainCatalog("kinfocenter");
91 KAboutData
aboutKInfoCenter( "kinfocenter", 0, ki18n("KDE Info Center"),
92 KDE_VERSION_STRING
, ki18n("The KDE Info Center"), KAboutData::License_GPL
,
93 ki18n("(c) 1998-2004, The KDE Control Center Developers"));
95 QByteArray argv_0
= argv
[0];
96 KAboutData
*aboutData
= &aboutKInfoCenter
;
98 aboutData
->addAuthor(ki18n("Nicolas Ternisien"), ki18n("Current Maintainer"), "nicolas.ternisien@gmail.com");
99 aboutData
->addAuthor(ki18n("Helge Deller"), ki18n("Previous Maintainer"), "deller@kde.org");
100 aboutData
->addAuthor(ki18n("Matthias Hoelzer-Kluepfel"),KLocalizedString(), "hoelzer@kde.org");
101 aboutData
->addAuthor(ki18n("Matthias Elter"),KLocalizedString(), "elter@kde.org");
102 aboutData
->addAuthor(ki18n("Matthias Ettrich"),KLocalizedString(), "ettrich@kde.org");
103 aboutData
->addAuthor(ki18n("Waldo Bastian"),KLocalizedString(), "bastian@kde.org");
105 KCmdLineArgs::init( argc
, argv
, aboutData
);
106 KUniqueApplication::addCmdLineOptions();
110 if (!KInfoCenterApp::start()) {
111 kDebug() << "kinfocenter is already running!\n";