-rw-r--r-- | core/launcher/main.cpp | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp index 3e7e0d2..a86aca6 100644 --- a/core/launcher/main.cpp +++ b/core/launcher/main.cpp | |||
@@ -12,68 +12,62 @@ | |||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #ifndef QTOPIA_INTERNAL_FILEOPERATIONS | 21 | #ifndef QTOPIA_INTERNAL_FILEOPERATIONS |
22 | #define QTOPIA_INTERNAL_FILEOPERATIONS | 22 | #define QTOPIA_INTERNAL_FILEOPERATIONS |
23 | #endif | 23 | #endif |
24 | #ifdef QT_QWS_LOGIN | ||
25 | #include "../login/qdmdialogimpl.h" | ||
26 | #endif | ||
27 | #include "calibrate.h" | ||
24 | #include "server.h" | 28 | #include "server.h" |
25 | #include "serverapp.h" | 29 | #include "serverapp.h" |
26 | #include "stabmon.h" | 30 | #include "stabmon.h" |
27 | #include "firstuse.h" | 31 | #include "firstuse.h" |
28 | 32 | ||
33 | /* OPIE */ | ||
34 | #include <opie2/odebug.h> | ||
35 | #include <opie2/odevice.h> | ||
29 | #include <opie2/oglobal.h> | 36 | #include <opie2/oglobal.h> |
30 | |||
31 | #include <qtopia/network.h> | 37 | #include <qtopia/network.h> |
32 | //#include <qtopia/custom.h> | 38 | #include <qtopia/alarmserver.h> |
33 | 39 | using namespace Opie::Core; | |
34 | 40 | ||
41 | /* QT */ | ||
35 | #include <qdir.h> | 42 | #include <qdir.h> |
43 | #include <qmessagebox.h> | ||
36 | #ifdef QWS | 44 | #ifdef QWS |
37 | #include <qwindowsystem_qws.h> | 45 | #include <qwindowsystem_qws.h> |
38 | #include <qtopia/qcopenvelope_qws.h> | 46 | #include <qtopia/qcopenvelope_qws.h> |
39 | #endif | 47 | #endif |
40 | #include <qtopia/alarmserver.h> | 48 | #ifdef Q_WS_QWS |
49 | #include <qkeyboard_qws.h> | ||
50 | #endif | ||
41 | 51 | ||
52 | /* STD */ | ||
42 | #include <stdlib.h> | 53 | #include <stdlib.h> |
43 | #include <stdio.h> | 54 | #include <stdio.h> |
44 | #include <signal.h> | 55 | #include <signal.h> |
45 | #ifndef Q_OS_WIN32 | 56 | #ifndef Q_OS_WIN32 |
46 | #include <unistd.h> | 57 | #include <unistd.h> |
47 | #else | 58 | #else |
48 | #include <process.h> | 59 | #include <process.h> |
49 | #endif | 60 | #endif |
50 | 61 | ||
51 | #include "calibrate.h" | ||
52 | |||
53 | |||
54 | #ifdef QT_QWS_LOGIN | ||
55 | #include "../login/qdmdialogimpl.h" | ||
56 | #endif | ||
57 | |||
58 | #ifdef Q_WS_QWS | ||
59 | #include <qkeyboard_qws.h> | ||
60 | #endif | ||
61 | |||
62 | #include <qmessagebox.h> | ||
63 | #include <opie2/odevice.h> | ||
64 | |||
65 | using namespace Opie::Core; | ||
66 | |||
67 | |||
68 | static void cleanup() | 62 | static void cleanup() |
69 | { | 63 | { |
70 | QDir dir( "/tmp", "qcop-msg-*" ); | 64 | QDir dir( "/tmp", "qcop-msg-*" ); |
71 | 65 | ||
72 | QStringList stale = dir.entryList(); | 66 | QStringList stale = dir.entryList(); |
73 | QStringList::Iterator it; | 67 | QStringList::Iterator it; |
74 | for ( it = stale.begin(); it != stale.end(); ++it ) { | 68 | for ( it = stale.begin(); it != stale.end(); ++it ) { |
75 | dir.remove( *it ); | 69 | dir.remove( *it ); |
76 | } | 70 | } |
77 | } | 71 | } |
78 | 72 | ||
79 | static void refreshTimeZoneConfig() | 73 | static void refreshTimeZoneConfig() |
@@ -112,25 +106,25 @@ static void refreshTimeZoneConfig() | |||
112 | for (QStringList::Iterator it = zoneDefaults.begin(); it != zoneDefaults.end() ; ++it){ | 106 | for (QStringList::Iterator it = zoneDefaults.begin(); it != zoneDefaults.end() ; ++it){ |
113 | cfg.writeEntry( "Zone" + QString::number( zoneIndex ) , *it); | 107 | cfg.writeEntry( "Zone" + QString::number( zoneIndex ) , *it); |
114 | zoneIndex++; | 108 | zoneIndex++; |
115 | } | 109 | } |
116 | } | 110 | } |
117 | // We have an existing list of timezones refresh the | 111 | // We have an existing list of timezones refresh the |
118 | // translations of TimeZone name | 112 | // translations of TimeZone name |
119 | zoneIndex = 0; | 113 | zoneIndex = 0; |
120 | while (cfg.hasKey( "Zone"+ QString::number( zoneIndex ))){ | 114 | while (cfg.hasKey( "Zone"+ QString::number( zoneIndex ))){ |
121 | zoneID = cfg.readEntry( "Zone" + QString::number( zoneIndex )); | 115 | zoneID = cfg.readEntry( "Zone" + QString::number( zoneIndex )); |
122 | curZone = TimeZone( zoneID ); | 116 | curZone = TimeZone( zoneID ); |
123 | if ( !curZone.isValid() ){ | 117 | if ( !curZone.isValid() ){ |
124 | qDebug( "initEnvironment() Invalid TimeZone %s", zoneID.latin1() ); | 118 | odebug << "initEnvironment() Invalid TimeZone " << zoneID << "" << oendl; |
125 | break; | 119 | break; |
126 | } | 120 | } |
127 | cfg.writeEntry( "ZoneName" + QString::number( zoneIndex ), curZone.city() ); | 121 | cfg.writeEntry( "ZoneName" + QString::number( zoneIndex ), curZone.city() ); |
128 | zoneIndex++; | 122 | zoneIndex++; |
129 | } | 123 | } |
130 | #endif | 124 | #endif |
131 | } | 125 | } |
132 | 126 | ||
133 | void initEnvironment() | 127 | void initEnvironment() |
134 | { | 128 | { |
135 | #ifdef Q_OS_WIN32 | 129 | #ifdef Q_OS_WIN32 |
136 | // Config file requires HOME dir which uses QDir which needs the winver | 130 | // Config file requires HOME dir which uses QDir which needs the winver |
@@ -260,25 +254,25 @@ int initApplication( int argc, char ** argv ) | |||
260 | s->show(); | 254 | s->show(); |
261 | 255 | ||
262 | /* THE ARM rtc has problem holdings the time on reset */ | 256 | /* THE ARM rtc has problem holdings the time on reset */ |
263 | if ( QDate::currentDate ( ). year ( ) < 2000 ) { | 257 | if ( QDate::currentDate ( ). year ( ) < 2000 ) { |
264 | if ( QMessageBox::information ( 0, ServerApplication::tr( "Information" ), ServerApplication::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 ) { | 258 | if ( QMessageBox::information ( 0, ServerApplication::tr( "Information" ), ServerApplication::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 ) { |
265 | QCopEnvelope e ( "QPE/Application/systemtime", "setDocument(QString)" ); | 259 | QCopEnvelope e ( "QPE/Application/systemtime", "setDocument(QString)" ); |
266 | e << QString ( ); | 260 | e << QString ( ); |
267 | } | 261 | } |
268 | } | 262 | } |
269 | 263 | ||
270 | int rv = a.exec(); | 264 | int rv = a.exec(); |
271 | 265 | ||
272 | qDebug("exiting..."); | 266 | odebug << "exiting..." << oendl; |
273 | delete s; | 267 | delete s; |
274 | 268 | ||
275 | #ifndef Q_OS_MACX | 269 | #ifndef Q_OS_MACX |
276 | ODevice::inst()->setSoftSuspend( false ); | 270 | ODevice::inst()->setSoftSuspend( false ); |
277 | #endif | 271 | #endif |
278 | 272 | ||
279 | return rv; | 273 | return rv; |
280 | } | 274 | } |
281 | 275 | ||
282 | static const char *pidfile_path = "/var/run/opie.pid"; | 276 | static const char *pidfile_path = "/var/run/opie.pid"; |
283 | 277 | ||
284 | void create_pidfile ( ) | 278 | void create_pidfile ( ) |
@@ -332,21 +326,21 @@ int main( int argc, char ** argv ) | |||
332 | ::sleep ( 1 ); | 326 | ::sleep ( 1 ); |
333 | ::kill ( 0, SIGKILL ); | 327 | ::kill ( 0, SIGKILL ); |
334 | 328 | ||
335 | return retVal; | 329 | return retVal; |
336 | } | 330 | } |
337 | #else | 331 | #else |
338 | 332 | ||
339 | int main( int argc, char ** argv ) | 333 | int main( int argc, char ** argv ) |
340 | { | 334 | { |
341 | int retVal = initApplication( argc, argv ); | 335 | int retVal = initApplication( argc, argv ); |
342 | 336 | ||
343 | if ( DesktopApplication::doRestart ) { | 337 | if ( DesktopApplication::doRestart ) { |
344 | qDebug("Trying to restart"); | 338 | odebug << "Trying to restart" << oendl; |
345 | execl( (QPEApplication::qpeDir()+"bin\\qpe").latin1(), "qpe", 0 ); | 339 | execl( (QPEApplication::qpeDir()+"bin\\qpe").latin1(), "qpe", 0 ); |
346 | } | 340 | } |
347 | 341 | ||
348 | return retVal; | 342 | return retVal; |
349 | } | 343 | } |
350 | 344 | ||
351 | #endif | 345 | #endif |
352 | 346 | ||