-rw-r--r-- | core/launcher/main.cpp | 104 | ||||
-rw-r--r-- | packages | 1 |
2 files changed, 44 insertions, 61 deletions
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp index 1e5eb46..49b41d6 100644 --- a/core/launcher/main.cpp +++ b/core/launcher/main.cpp @@ -1,193 +1,177 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of Qtopia Environment. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "desktop.h" #include "taskbar.h" #include "stabmon.h" #include <qpe/qpeapplication.h> #include <qpe/network.h> #include <qpe/config.h> #if defined( QT_QWS_SHARP ) || defined( QT_QWS_IPAQ ) #include <qpe/custom.h> #endif #include <opie/odevice.h> #include <qmessagebox.h> #include <qfile.h> #include <qimage.h> #include <qwindowsystem_qws.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/alarmserver.h> #include <stdlib.h> #include <stdio.h> #include <signal.h> #include <unistd.h> #if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) #include "../calibrate/calibrate.h" #endif using namespace Opie; -void initEnvironment( ) +void initEnvironment() { - Config config("locale"); - config.setGroup( "Location" ); - QString tz = config.readEntry( "Timezone", getenv("TZ") ); + Config config("locale"); + config.setGroup( "Location" ); + QString tz = config.readEntry( "Timezone", getenv("TZ") ); - // if not timezone set, pick New York - if (tz.isNull()) - tz = "America/New_York"; + // if not timezone set, pick New York + if (tz.isNull()) + tz = "America/New_York"; - setenv( "TZ", tz, 1 ); - config.writeEntry( "Timezone", tz); - - config.setGroup( "Language" ); - QString lang = config.readEntry( "Language", getenv("LANG") ); - if ( !lang.isNull() ) - setenv( "LANG", lang, 1 ); + setenv( "TZ", tz, 1 ); + config.writeEntry( "Timezone", tz); + config.setGroup( "Language" ); + QString lang = config.readEntry( "Language", getenv("LANG") ); + if ( !lang.isNull() ) + setenv( "LANG", lang, 1 ); } int initApplication( int argc, char ** argv ) { - struct ODevice *odev = ODevice::inst(); - - initEnvironment( ); + initEnvironment(); #if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_EBX) setenv( "QWS_SIZE", "240x320", 0 ); #endif //Don't flicker at startup: QWSServer::setDesktopBackground( QImage() ); DesktopApplication a( argc, argv, QApplication::GuiServer ); - int rot; - switch ( odev-> rotation( ) ) { - case None: - rot = 0; - case Rot90: - rot = 90; - case Rot180: - rot = 180; - case Rot270: - rot = 270; - } - a.setDefaultRotation( rot ); - - odev-> setSoftSuspend ( true ); + ODevice::inst ( )-> setSoftSuspend ( true ); - { // init backlight - QCopEnvelope e("QPE/System", "setBacklight(int)" ); - e << -3; // Forced on - } + { // init backlight + QCopEnvelope e("QPE/System", "setBacklight(int)" ); + e << -3; // Forced on + } AlarmServer::initialize(); Desktop *d = new Desktop(); QObject::connect( &a, SIGNAL(power()), d, SLOT(togglePower()) ); QObject::connect( &a, SIGNAL(backlight()), d, SLOT(toggleLight()) ); QObject::connect( &a, SIGNAL(symbol()), d, SLOT(toggleSymbolInput()) ); QObject::connect( &a, SIGNAL(numLockStateToggle()), d, SLOT(toggleNumLockState()) ); QObject::connect( &a, SIGNAL(capsLockStateToggle()), d, SLOT(toggleCapsLockState()) ); QObject::connect( &a, SIGNAL(prepareForRestart()), d, SLOT(terminateServers()) ); (void)new SysFileMonitor(d); Network::createServer(d); #if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) if ( !QFile::exists( "/etc/pointercal" ) ) { - // Make sure calibration widget starts on top. - Calibrate *cal = new Calibrate; - cal->exec(); - delete cal; + // Make sure calibration widget starts on top. + Calibrate *cal = new Calibrate; + cal->exec(); + delete cal; } #endif d->show(); - if ( QDate::currentDate ( ). year ( ) < 2000 ) { - if ( QMessageBox::information ( 0, DesktopApplication::tr( "Information" ), DesktopApplication::tr( "<p>The system date doesn't seem to be valid.\n(%1)</p><p>Do you want to correct the clock ?</p>" ). arg( TimeString::dateString ( QDate::currentDate ( ))), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) { - QCopEnvelope e ( "QPE/Application/systemtime", "setDocument(QString)" ); - e << QString ( ); - } - } + if ( QDate::currentDate ( ). year ( ) < 2000 ) { + if ( QMessageBox::information ( 0, DesktopApplication::tr( "Information" ), DesktopApplication::tr( "<p>The system date doesn't seem to be valid.\n(%1)</p><p>Do you want to correct the clock ?</p>" ). arg( TimeString::dateString ( QDate::currentDate ( ))), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) { + QCopEnvelope e ( "QPE/Application/systemtime", "setDocument(QString)" ); + e << QString ( ); + } + } int rv = a.exec(); delete d; - odev-> setSoftSuspend ( false ); + ODevice::inst ( )-> setSoftSuspend ( false ); return rv; } static const char *pidfile_path = "/var/run/opie.pid"; void create_pidfile ( ) { - FILE *f; + FILE *f; - if (( f = ::fopen ( pidfile_path, "w" ))) { - ::fprintf ( f, "%d", getpid ( )); - ::fclose ( f ); - } + if (( f = ::fopen ( pidfile_path, "w" ))) { + ::fprintf ( f, "%d", getpid ( )); + ::fclose ( f ); + } } void remove_pidfile ( ) { - ::unlink ( pidfile_path ); + ::unlink ( pidfile_path ); } void handle_sigterm ( int /* sig */ ) { - if ( qApp ) - qApp-> quit ( ); + if ( qApp ) + qApp-> quit ( ); } int main( int argc, char ** argv ) { ::signal ( SIGCHLD, SIG_IGN ); - ::signal ( SIGTERM, handle_sigterm ); - ::signal ( SIGINT, handle_sigterm ); + ::signal ( SIGTERM, handle_sigterm ); + ::signal ( SIGINT, handle_sigterm ); - ::setsid ( ); - ::setpgid ( 0, 0 ); + ::setsid ( ); + ::setpgid ( 0, 0 ); - ::atexit ( remove_pidfile ); - create_pidfile ( ); + ::atexit ( remove_pidfile ); + create_pidfile ( ); int retVal = initApplication ( argc, argv ); // Kill them. Kill them all. ::kill ( 0, SIGTERM ); ::sleep ( 1 ); ::kill ( 0, SIGKILL ); return retVal; } @@ -1,139 +1,138 @@ CONFIG_APPSKEY noncore/settings/appskey appskey.pro CONFIG_BINARY noncore/tools/calc2/binary binary.pro CONFIG_CALC2 noncore/tools/calc2 calc2.pro CONFIG_CALIBRATE core/apps/calibrate calibrate.pro CONFIG_CHESS noncore/games/chess chess.pro CONFIG_CONVERTER noncore/unsupported/opiemail/converter converter.pro CONFIG_DIALUP noncore/unsupported/netsetup/dialup dialup.pro CONFIG_DICTIONARY noncore/apps/dictionary dictionary.pro CONFIG_GSMTOOL noncore/comm/gsmtool gsmtool.pro CONFIG_KEYVIEW development/keyview keyview.pro -CONFIG_ROTTEST development/rottest rottest.pro CONFIG_LAN noncore/unsupported/netsetup/lan lan.pro CONFIG_LIB noncore/unsupported/opiemail/lib lib.pro CONFIG_LIBFFMPEG core/multimedia/opieplayer/libffmpeg libffmpeg.pro CONFIG_LIBFLASH core/multimedia/opieplayer/libflash libflash.pro CONFIG_LIBOPIE_PIM libopie/pim pim.pro CONFIG_LIBSQL libsql libsql.pro CONFIG_MOBILEMSG noncore/comm/mobilemsg mobilemsg.pro CONFIG_NETMONAPPLET noncore/unsupported/netmonapplet netmonapplet.pro CONFIG_NETSETUP noncore/unsupported/netsetup netsetup.pro CONFIG_OFILESELECTOR libopie/ofileselector ofileselector.pro CONFIG_OPIE-WRITE noncore/apps/opie-write opie-write.pro CONFIG_OPIEMAIL noncore/unsupported/opiemail opiemail.pro CONFIG_POP3 noncore/unsupported/opiemail/ifaces/pop3 pop3.pro CONFIG_QUICKEXEC quickexec quickexec.pro CONFIG_RESTARTAPPLET core/applets/restartapplet restartapplet.pro CONFIG_RESTARTAPPLET2 core/applets/restartapplet2 restartapplet2.pro CONFIG_SDMON noncore/unsupported/sdmon sdmon.pro CONFIG_SIMPLE noncore/tools/calc2/simple simple.pro CONFIG_SMTP noncore/unsupported/opiemail/ifaces/smtp smtp.pro CONFIG_SPREADSHEET noncore/unsupported/spreadsheet spreadsheet.pro CONFIG_SYSTEMTIME noncore/unsupported/systemtime systemtime.pro CONFIG_TEST libsql/test test.pro CONFIG_TEST noncore/apps/opie-console/test test.pro CONFIG_UBROWSER noncore/net/ubrowser ubrowser.pro CONFIG_WELLENREITER noncore/net/wellenreiter wellenreiter.pro CONFIG_WLANSETUP noncore/unsupported/wlansetup wlansetup.pro CONFIG_ADDRESSBOOK core/pim/addressbook addressbook.pro CONFIG_ADVANCEDFM noncore/apps/advancedfm advancedfm.pro CONFIG_APPEARANCE2 noncore/settings/appearance2 appearance2.pro CONFIG_OPIETOOTH-APPLET noncore/net/opietooth/applet applet.pro CONFIG_AQPKG noncore/apps/aqpkg aqpkg.pro CONFIG_BACKUP noncore/settings/backup backup.pro CONFIG_BATTERYAPPLET core/applets/batteryapplet batteryapplet.pro CONFIG_BEND noncore/mail/bend bend.pro CONFIG_BLUE-PIN noncore/net/opietooth/blue-pin blue-pin.pro CONFIG_BOUNCE noncore/games/bounce bounce.pro CONFIG_BUTTON-SETTINGS core/settings/button button.pro CONFIG_BUZZWORD noncore/games/buzzword buzzword.pro CONFIG_CALCULATOR noncore/tools/calculator calculator.pro CONFIG_CARDMON core/applets/cardmon cardmon.pro CONFIG_CHECKBOOK noncore/apps/checkbook checkbook.pro CONFIG_CITYTIME core/settings/citytime citytime.pro CONFIG_CLIPBOARDAPPLET core/applets/clipboardapplet clipboardapplet.pro CONFIG_CLOCK noncore/tools/clock clock.pro CONFIG_CLOCKAPPLET core/applets/clockapplet clockapplet.pro CONFIG_CONFEDIT noncore/apps/confedit confedit.pro CONFIG_DATEBOOK core/pim/datebook datebook.pro CONFIG_DECO_FLAT noncore/decorations/flat flat.pro CONFIG_DECO_LIQUID noncore/decorations/liquid liquid.pro CONFIG_DECO_POLISHED noncore/decorations/polished polished.pro CONFIG_DRAWPAD noncore/graphics/drawpad drawpad.pro CONFIG_DVORAK inputmethods/dvorak dvorak.pro CONFIG_EMBEDDEDKONSOLE core/apps/embeddedkonsole embeddedkonsole.pro CONFIG_FIFTEEN noncore/games/fifteen fifteen.pro CONFIG_FILEBROWSER core/apps/filebrowser filebrowser.pro CONFIG_FLAT noncore/styles/flat flat.pro CONFIG_FORMATTER noncore/tools/formatter formatter.pro CONFIG_FREETYPE freetype freetype.pro CONFIG_FRESH noncore/styles/fresh fresh.pro CONFIG_FTPLIB noncore/net/ftplib ftplib.pro CONFIG_GO noncore/games/go go.pro CONFIG_HANDWRITING inputmethods/handwriting handwriting.pro CONFIG_HELPBROWSER core/apps/helpbrowser helpbrowser.pro CONFIG_HOMEAPPLET core/applets/homeapplet homeapplet.pro CONFIG_INTERFACES noncore/net/networksettings/interfaces interfaces.pro CONFIG_IRDAAPPLET core/applets/irdaapplet irdaapplet.pro CONFIG_JUMPX inputmethods/jumpx jumpx.pro CONFIG_KBILL noncore/games/kbill kbill.pro CONFIG_KCHECKERS noncore/games/kcheckers kcheckers.pro CONFIG_KEYBOARD inputmethods/keyboard keyboard.pro CONFIG_KEYPEBBLE noncore/comm/keypebble keypebble.pro CONFIG_KJUMPX inputmethods/kjumpx kjumpx.pro CONFIG_KPACMAN noncore/games/kpacman kpacman.pro CONFIG_LANGUAGE noncore/settings/language language.pro CONFIG_LAUNCHER-SETTINGS core/settings/launcher launcher.pro CONFIG_LAUNCHER_CORE core/launcher launcher.pro CONFIG_LIBOPIETOOTH noncore/net/opietooth/lib lib.pro CONFIG_LIBKATE noncore/apps/tinykate/libkate libkate.pro CONFIG_LIBMAD core/multimedia/opieplayer/libmad libmad.pro CONFIG_LIBMAIL noncore/mail/libmail libmail.pro CONFIG_LIBMPEG3 core/multimedia/opieplayer/libmpeg3 libmpeg3.pro CONFIG_LIBOPIE libopie libopie.pro CONFIG_LIBQPE library library.pro CONFIG_LIBQPE-X11 x11/libqpe-x11 libqpe-x11.pro CONFIG_LIGHT-AND-POWER core/settings/light-and-power light-and-power.pro CONFIG_LIQUID noncore/styles/liquid liquid.pro CONFIG_LOGOUTAPPLET core/applets/logoutapplet logoutapplet.pro CONFIG_OPIETOOTH-MANAGER noncore/net/opietooth/manager manager.pro CONFIG_MEDIUMMOUNT noncore/settings/mediummount mediummount.pro CONFIG_METAL noncore/styles/metal metal.pro CONFIG_MINDBREAKER noncore/games/mindbreaker mindbreaker.pro CONFIG_MINESWEEP noncore/games/minesweep minesweep.pro CONFIG_MODPLUG core/multimedia/opieplayer/modplug modplug.pro CONFIG_MULTIKEY inputmethods/multikey multikey.pro CONFIG_NETSYSTEMTIME noncore/settings/netsystemtime netsystemtime.pro CONFIG_NETWORKSETUP noncore/net/networksettings networksettings.pro CONFIG_NOTESAPPLET noncore/applets/notesapplet notesapplet.pro CONFIG_OBEX core/applets/obex obex.pro CONFIG_OCOPSERVER x11/ipc/server ocopserver.pro CONFIG_OIPKG core/apps/oipkg oipkg.pro CONFIG_OPIE-CONSOLE noncore/apps/opie-console opie-console.pro CONFIG_OPIE-LOGIN core/opie-login opie-login.pro CONFIG_OPIEMAIL2 noncore/mail mail.pro CONFIG_OPIE-READER noncore/apps/opie-reader opie-reader.pro CONFIG_OPIE-SH noncore/tools/opie-sh opie-sh.pro CONFIG_OPIE-SHEET noncore/apps/opie-sheet opie-sheet.pro CONFIG_OPIEALARM core/opiealarm CONFIG_OPIEFTP noncore/net/opieftp opieftp.pro CONFIG_OPIEIRC noncore/net/opieirc opieirc.pro CONFIG_OPIEPLAYER core/multimedia/opieplayer opieplayer.pro CONFIG_OPIEPLAYER2 noncore/multimedia/opieplayer2 opieplayer2.pro CONFIG_OXYGEN noncore/apps/oxygen oxygen.pro CONFIG_PARASHOOT noncore/games/parashoot parashoot.pro CONFIG_PICKBOARD inputmethods/pickboard pickboard.pro CONFIG_QASTEROIDS noncore/games/qasteroids qasteroids.pro CONFIG_QCOP core/apps/qcop qcop.pro CONFIG_ODICT noncore/apps/odict odict.pro CONFIG_QPDF noncore/graphics/qpdf qpdf.pro CONFIG_REMOTE noncore/tools/remote remote.pro CONFIG_ROTATION noncore/settings/rotation rotation.pro CONFIG_RUNAPPLET core/applets/runapplet runapplet.pro CONFIG_SCREENSHOTAPPLET core/applets/screenshotapplet screenshotapplet.pro CONFIG_SECURITY core/settings/security security.pro CONFIG_SFCAVE noncore/games/sfcave sfcave.pro CONFIG_SFCAVE-SDL noncore/games/sfcave-sdl sfcave-sdl.pro CONFIG_SHOWIMG noncore/multimedia/showimg showimg.pro CONFIG_SINGLE single single.pro CONFIG_SNAKE noncore/games/snake snake.pro |