author | kergoth <kergoth> | 2003-01-26 03:30:49 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2003-01-26 03:30:49 (UTC) |
commit | 77af78cf44026f52cc119a16554749daefc59617 (patch) (unidiff) | |
tree | 8b2afa79b4efa5a1b0f0e4d5a488796067d904a1 | |
parent | 7efc361470c6c91eb06ae7e800bb64aa645f6f73 (diff) | |
download | opie-77af78cf44026f52cc119a16554749daefc59617.zip opie-77af78cf44026f52cc119a16554749daefc59617.tar.gz opie-77af78cf44026f52cc119a16554749daefc59617.tar.bz2 |
Undo unintentional commit
-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 | |||
@@ -28,166 +28,150 @@ | |||
28 | #if defined( QT_QWS_SHARP ) || defined( QT_QWS_IPAQ ) | 28 | #if defined( QT_QWS_SHARP ) || defined( QT_QWS_IPAQ ) |
29 | #include <qpe/custom.h> | 29 | #include <qpe/custom.h> |
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | #include <opie/odevice.h> | 32 | #include <opie/odevice.h> |
33 | 33 | ||
34 | #include <qmessagebox.h> | 34 | #include <qmessagebox.h> |
35 | #include <qfile.h> | 35 | #include <qfile.h> |
36 | #include <qimage.h> | 36 | #include <qimage.h> |
37 | #include <qwindowsystem_qws.h> | 37 | #include <qwindowsystem_qws.h> |
38 | #include <qpe/qcopenvelope_qws.h> | 38 | #include <qpe/qcopenvelope_qws.h> |
39 | #include <qpe/alarmserver.h> | 39 | #include <qpe/alarmserver.h> |
40 | 40 | ||
41 | #include <stdlib.h> | 41 | #include <stdlib.h> |
42 | #include <stdio.h> | 42 | #include <stdio.h> |
43 | #include <signal.h> | 43 | #include <signal.h> |
44 | #include <unistd.h> | 44 | #include <unistd.h> |
45 | 45 | ||
46 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) | 46 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) |
47 | #include "../calibrate/calibrate.h" | 47 | #include "../calibrate/calibrate.h" |
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | using namespace Opie; | 50 | using namespace Opie; |
51 | 51 | ||
52 | void initEnvironment( ) | 52 | void initEnvironment() |
53 | { | 53 | { |
54 | Config config("locale"); | 54 | Config config("locale"); |
55 | config.setGroup( "Location" ); | 55 | config.setGroup( "Location" ); |
56 | QString tz = config.readEntry( "Timezone", getenv("TZ") ); | 56 | QString tz = config.readEntry( "Timezone", getenv("TZ") ); |
57 | 57 | ||
58 | // if not timezone set, pick New York | 58 | // if not timezone set, pick New York |
59 | if (tz.isNull()) | 59 | if (tz.isNull()) |
60 | tz = "America/New_York"; | 60 | tz = "America/New_York"; |
61 | 61 | ||
62 | setenv( "TZ", tz, 1 ); | 62 | setenv( "TZ", tz, 1 ); |
63 | config.writeEntry( "Timezone", tz); | 63 | config.writeEntry( "Timezone", tz); |
64 | |||
65 | config.setGroup( "Language" ); | ||
66 | QString lang = config.readEntry( "Language", getenv("LANG") ); | ||
67 | if ( !lang.isNull() ) | ||
68 | setenv( "LANG", lang, 1 ); | ||
69 | 64 | ||
65 | config.setGroup( "Language" ); | ||
66 | QString lang = config.readEntry( "Language", getenv("LANG") ); | ||
67 | if ( !lang.isNull() ) | ||
68 | setenv( "LANG", lang, 1 ); | ||
70 | } | 69 | } |
71 | 70 | ||
72 | 71 | ||
73 | int initApplication( int argc, char ** argv ) | 72 | int initApplication( int argc, char ** argv ) |
74 | { | 73 | { |
75 | struct ODevice *odev = ODevice::inst(); | 74 | initEnvironment(); |
76 | |||
77 | initEnvironment( ); | ||
78 | 75 | ||
79 | #if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_EBX) | 76 | #if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_EBX) |
80 | setenv( "QWS_SIZE", "240x320", 0 ); | 77 | setenv( "QWS_SIZE", "240x320", 0 ); |
81 | #endif | 78 | #endif |
82 | 79 | ||
83 | //Don't flicker at startup: | 80 | //Don't flicker at startup: |
84 | QWSServer::setDesktopBackground( QImage() ); | 81 | QWSServer::setDesktopBackground( QImage() ); |
85 | DesktopApplication a( argc, argv, QApplication::GuiServer ); | 82 | DesktopApplication a( argc, argv, QApplication::GuiServer ); |
86 | 83 | ||
87 | int rot; | 84 | ODevice::inst ( )-> setSoftSuspend ( true ); |
88 | switch ( odev-> rotation( ) ) { | ||
89 | case None: | ||
90 | rot = 0; | ||
91 | case Rot90: | ||
92 | rot = 90; | ||
93 | case Rot180: | ||
94 | rot = 180; | ||
95 | case Rot270: | ||
96 | rot = 270; | ||
97 | } | ||
98 | a.setDefaultRotation( rot ); | ||
99 | |||
100 | odev-> setSoftSuspend ( true ); | ||
101 | 85 | ||
102 | { // init backlight | 86 | { // init backlight |
103 | QCopEnvelope e("QPE/System", "setBacklight(int)" ); | 87 | QCopEnvelope e("QPE/System", "setBacklight(int)" ); |
104 | e << -3; // Forced on | 88 | e << -3; // Forced on |
105 | } | 89 | } |
106 | 90 | ||
107 | AlarmServer::initialize(); | 91 | AlarmServer::initialize(); |
108 | 92 | ||
109 | Desktop *d = new Desktop(); | 93 | Desktop *d = new Desktop(); |
110 | 94 | ||
111 | QObject::connect( &a, SIGNAL(power()), d, SLOT(togglePower()) ); | 95 | QObject::connect( &a, SIGNAL(power()), d, SLOT(togglePower()) ); |
112 | QObject::connect( &a, SIGNAL(backlight()), d, SLOT(toggleLight()) ); | 96 | QObject::connect( &a, SIGNAL(backlight()), d, SLOT(toggleLight()) ); |
113 | QObject::connect( &a, SIGNAL(symbol()), d, SLOT(toggleSymbolInput()) ); | 97 | QObject::connect( &a, SIGNAL(symbol()), d, SLOT(toggleSymbolInput()) ); |
114 | QObject::connect( &a, SIGNAL(numLockStateToggle()), d, SLOT(toggleNumLockState()) ); | 98 | QObject::connect( &a, SIGNAL(numLockStateToggle()), d, SLOT(toggleNumLockState()) ); |
115 | QObject::connect( &a, SIGNAL(capsLockStateToggle()), d, SLOT(toggleCapsLockState()) ); | 99 | QObject::connect( &a, SIGNAL(capsLockStateToggle()), d, SLOT(toggleCapsLockState()) ); |
116 | QObject::connect( &a, SIGNAL(prepareForRestart()), d, SLOT(terminateServers()) ); | 100 | QObject::connect( &a, SIGNAL(prepareForRestart()), d, SLOT(terminateServers()) ); |
117 | 101 | ||
118 | (void)new SysFileMonitor(d); | 102 | (void)new SysFileMonitor(d); |
119 | Network::createServer(d); | 103 | Network::createServer(d); |
120 | 104 | ||
121 | #if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) | 105 | #if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) |
122 | if ( !QFile::exists( "/etc/pointercal" ) ) { | 106 | if ( !QFile::exists( "/etc/pointercal" ) ) { |
123 | // Make sure calibration widget starts on top. | 107 | // Make sure calibration widget starts on top. |
124 | Calibrate *cal = new Calibrate; | 108 | Calibrate *cal = new Calibrate; |
125 | cal->exec(); | 109 | cal->exec(); |
126 | delete cal; | 110 | delete cal; |
127 | } | 111 | } |
128 | #endif | 112 | #endif |
129 | 113 | ||
130 | d->show(); | 114 | d->show(); |
131 | 115 | ||
132 | if ( QDate::currentDate ( ). year ( ) < 2000 ) { | 116 | if ( QDate::currentDate ( ). year ( ) < 2000 ) { |
133 | 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 ) { | 117 | 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 ) { |
134 | QCopEnvelope e ( "QPE/Application/systemtime", "setDocument(QString)" ); | 118 | QCopEnvelope e ( "QPE/Application/systemtime", "setDocument(QString)" ); |
135 | e << QString ( ); | 119 | e << QString ( ); |
136 | } | 120 | } |
137 | } | 121 | } |
138 | 122 | ||
139 | int rv = a.exec(); | 123 | int rv = a.exec(); |
140 | 124 | ||
141 | delete d; | 125 | delete d; |
142 | 126 | ||
143 | odev-> setSoftSuspend ( false ); | 127 | ODevice::inst ( )-> setSoftSuspend ( false ); |
144 | 128 | ||
145 | return rv; | 129 | return rv; |
146 | } | 130 | } |
147 | 131 | ||
148 | static const char *pidfile_path = "/var/run/opie.pid"; | 132 | static const char *pidfile_path = "/var/run/opie.pid"; |
149 | 133 | ||
150 | void create_pidfile ( ) | 134 | void create_pidfile ( ) |
151 | { | 135 | { |
152 | FILE *f; | 136 | FILE *f; |
153 | 137 | ||
154 | if (( f = ::fopen ( pidfile_path, "w" ))) { | 138 | if (( f = ::fopen ( pidfile_path, "w" ))) { |
155 | ::fprintf ( f, "%d", getpid ( )); | 139 | ::fprintf ( f, "%d", getpid ( )); |
156 | ::fclose ( f ); | 140 | ::fclose ( f ); |
157 | } | 141 | } |
158 | } | 142 | } |
159 | 143 | ||
160 | void remove_pidfile ( ) | 144 | void remove_pidfile ( ) |
161 | { | 145 | { |
162 | ::unlink ( pidfile_path ); | 146 | ::unlink ( pidfile_path ); |
163 | } | 147 | } |
164 | 148 | ||
165 | void handle_sigterm ( int /* sig */ ) | 149 | void handle_sigterm ( int /* sig */ ) |
166 | { | 150 | { |
167 | if ( qApp ) | 151 | if ( qApp ) |
168 | qApp-> quit ( ); | 152 | qApp-> quit ( ); |
169 | } | 153 | } |
170 | 154 | ||
171 | int main( int argc, char ** argv ) | 155 | int main( int argc, char ** argv ) |
172 | { | 156 | { |
173 | ::signal ( SIGCHLD, SIG_IGN ); | 157 | ::signal ( SIGCHLD, SIG_IGN ); |
174 | 158 | ||
175 | ::signal ( SIGTERM, handle_sigterm ); | 159 | ::signal ( SIGTERM, handle_sigterm ); |
176 | ::signal ( SIGINT, handle_sigterm ); | 160 | ::signal ( SIGINT, handle_sigterm ); |
177 | 161 | ||
178 | ::setsid ( ); | 162 | ::setsid ( ); |
179 | ::setpgid ( 0, 0 ); | 163 | ::setpgid ( 0, 0 ); |
180 | 164 | ||
181 | ::atexit ( remove_pidfile ); | 165 | ::atexit ( remove_pidfile ); |
182 | create_pidfile ( ); | 166 | create_pidfile ( ); |
183 | 167 | ||
184 | int retVal = initApplication ( argc, argv ); | 168 | int retVal = initApplication ( argc, argv ); |
185 | 169 | ||
186 | // Kill them. Kill them all. | 170 | // Kill them. Kill them all. |
187 | ::kill ( 0, SIGTERM ); | 171 | ::kill ( 0, SIGTERM ); |
188 | ::sleep ( 1 ); | 172 | ::sleep ( 1 ); |
189 | ::kill ( 0, SIGKILL ); | 173 | ::kill ( 0, SIGKILL ); |
190 | 174 | ||
191 | return retVal; | 175 | return retVal; |
192 | } | 176 | } |
193 | 177 | ||
@@ -1,35 +1,34 @@ | |||
1 | CONFIG_APPSKEY noncore/settings/appskeyappskey.pro | 1 | CONFIG_APPSKEY noncore/settings/appskeyappskey.pro |
2 | CONFIG_BINARY noncore/tools/calc2/binarybinary.pro | 2 | CONFIG_BINARY noncore/tools/calc2/binarybinary.pro |
3 | CONFIG_CALC2 noncore/tools/calc2calc2.pro | 3 | CONFIG_CALC2 noncore/tools/calc2calc2.pro |
4 | CONFIG_CALIBRATE core/apps/calibratecalibrate.pro | 4 | CONFIG_CALIBRATE core/apps/calibratecalibrate.pro |
5 | CONFIG_CHESS noncore/games/chesschess.pro | 5 | CONFIG_CHESS noncore/games/chesschess.pro |
6 | CONFIG_CONVERTER noncore/unsupported/opiemail/converterconverter.pro | 6 | CONFIG_CONVERTER noncore/unsupported/opiemail/converterconverter.pro |
7 | CONFIG_DIALUP noncore/unsupported/netsetup/dialupdialup.pro | 7 | CONFIG_DIALUP noncore/unsupported/netsetup/dialupdialup.pro |
8 | CONFIG_DICTIONARY noncore/apps/dictionarydictionary.pro | 8 | CONFIG_DICTIONARY noncore/apps/dictionarydictionary.pro |
9 | CONFIG_GSMTOOL noncore/comm/gsmtoolgsmtool.pro | 9 | CONFIG_GSMTOOL noncore/comm/gsmtoolgsmtool.pro |
10 | CONFIG_KEYVIEW development/keyviewkeyview.pro | 10 | CONFIG_KEYVIEW development/keyviewkeyview.pro |
11 | CONFIG_ROTTEST development/rottestrottest.pro | ||
12 | CONFIG_LAN noncore/unsupported/netsetup/lanlan.pro | 11 | CONFIG_LAN noncore/unsupported/netsetup/lanlan.pro |
13 | CONFIG_LIB noncore/unsupported/opiemail/liblib.pro | 12 | CONFIG_LIB noncore/unsupported/opiemail/liblib.pro |
14 | CONFIG_LIBFFMPEG core/multimedia/opieplayer/libffmpeglibffmpeg.pro | 13 | CONFIG_LIBFFMPEG core/multimedia/opieplayer/libffmpeglibffmpeg.pro |
15 | CONFIG_LIBFLASH core/multimedia/opieplayer/libflashlibflash.pro | 14 | CONFIG_LIBFLASH core/multimedia/opieplayer/libflashlibflash.pro |
16 | CONFIG_LIBOPIE_PIM libopie/pimpim.pro | 15 | CONFIG_LIBOPIE_PIM libopie/pimpim.pro |
17 | CONFIG_LIBSQL libsqllibsql.pro | 16 | CONFIG_LIBSQL libsqllibsql.pro |
18 | CONFIG_MOBILEMSG noncore/comm/mobilemsgmobilemsg.pro | 17 | CONFIG_MOBILEMSG noncore/comm/mobilemsgmobilemsg.pro |
19 | CONFIG_NETMONAPPLET noncore/unsupported/netmonappletnetmonapplet.pro | 18 | CONFIG_NETMONAPPLET noncore/unsupported/netmonappletnetmonapplet.pro |
20 | CONFIG_NETSETUP noncore/unsupported/netsetupnetsetup.pro | 19 | CONFIG_NETSETUP noncore/unsupported/netsetupnetsetup.pro |
21 | CONFIG_OFILESELECTOR libopie/ofileselectorofileselector.pro | 20 | CONFIG_OFILESELECTOR libopie/ofileselectorofileselector.pro |
22 | CONFIG_OPIE-WRITE noncore/apps/opie-writeopie-write.pro | 21 | CONFIG_OPIE-WRITE noncore/apps/opie-writeopie-write.pro |
23 | CONFIG_OPIEMAIL noncore/unsupported/opiemailopiemail.pro | 22 | CONFIG_OPIEMAIL noncore/unsupported/opiemailopiemail.pro |
24 | CONFIG_POP3 noncore/unsupported/opiemail/ifaces/pop3pop3.pro | 23 | CONFIG_POP3 noncore/unsupported/opiemail/ifaces/pop3pop3.pro |
25 | CONFIG_QUICKEXEC quickexecquickexec.pro | 24 | CONFIG_QUICKEXEC quickexecquickexec.pro |
26 | CONFIG_RESTARTAPPLET core/applets/restartappletrestartapplet.pro | 25 | CONFIG_RESTARTAPPLET core/applets/restartappletrestartapplet.pro |
27 | CONFIG_RESTARTAPPLET2 core/applets/restartapplet2restartapplet2.pro | 26 | CONFIG_RESTARTAPPLET2 core/applets/restartapplet2restartapplet2.pro |
28 | CONFIG_SDMON noncore/unsupported/sdmonsdmon.pro | 27 | CONFIG_SDMON noncore/unsupported/sdmonsdmon.pro |
29 | CONFIG_SIMPLE noncore/tools/calc2/simplesimple.pro | 28 | CONFIG_SIMPLE noncore/tools/calc2/simplesimple.pro |
30 | CONFIG_SMTP noncore/unsupported/opiemail/ifaces/smtpsmtp.pro | 29 | CONFIG_SMTP noncore/unsupported/opiemail/ifaces/smtpsmtp.pro |
31 | CONFIG_SPREADSHEET noncore/unsupported/spreadsheetspreadsheet.pro | 30 | CONFIG_SPREADSHEET noncore/unsupported/spreadsheetspreadsheet.pro |
32 | CONFIG_SYSTEMTIME noncore/unsupported/systemtimesystemtime.pro | 31 | CONFIG_SYSTEMTIME noncore/unsupported/systemtimesystemtime.pro |
33 | CONFIG_TEST libsql/testtest.pro | 32 | CONFIG_TEST libsql/testtest.pro |
34 | CONFIG_TEST noncore/apps/opie-console/testtest.pro | 33 | CONFIG_TEST noncore/apps/opie-console/testtest.pro |
35 | CONFIG_UBROWSER noncore/net/ubrowserubrowser.pro | 34 | CONFIG_UBROWSER noncore/net/ubrowserubrowser.pro |