-rw-r--r-- | core/launcher/main.cpp | 14 | ||||
-rw-r--r-- | core/opie-login/main.cpp | 14 |
2 files changed, 14 insertions, 14 deletions
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp index 8eaea17..64fb968 100644 --- a/core/launcher/main.cpp +++ b/core/launcher/main.cpp | |||
@@ -57,104 +57,104 @@ void initEnvironment() | |||
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 | 64 | ||
65 | config.setGroup( "Language" ); | 65 | config.setGroup( "Language" ); |
66 | QString lang = config.readEntry( "Language", getenv("LANG") ); | 66 | QString lang = config.readEntry( "Language", getenv("LANG") ); |
67 | if ( !lang.isNull() ) | 67 | if ( !lang.isNull() ) |
68 | setenv( "LANG", lang, 1 ); | 68 | setenv( "LANG", lang, 1 ); |
69 | } | 69 | } |
70 | 70 | ||
71 | 71 | ||
72 | int initApplication( int argc, char ** argv ) | 72 | int initApplication( int argc, char ** argv ) |
73 | { | 73 | { |
74 | initEnvironment(); | 74 | initEnvironment(); |
75 | 75 | ||
76 | #if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_SL5XXX) | 76 | #if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_SL5XXX) |
77 | setenv( "QWS_SIZE", "240x320", 0 ); | 77 | setenv( "QWS_SIZE", "240x320", 0 ); |
78 | #endif | 78 | #endif |
79 | 79 | ||
80 | //Don't flicker at startup: | 80 | //Don't flicker at startup: |
81 | QWSServer::setDesktopBackground( QImage() ); | 81 | QWSServer::setDesktopBackground( QImage() ); |
82 | DesktopApplication a( argc, argv, QApplication::GuiServer ); | 82 | DesktopApplication a( argc, argv, QApplication::GuiServer ); |
83 | 83 | ||
84 | ODevice::inst ( )-> setSoftSuspend ( true ); | 84 | ODevice::inst ( )-> setSoftSuspend ( true ); |
85 | 85 | ||
86 | { // init backlight | 86 | { // init backlight |
87 | QCopEnvelope e("QPE/System", "setBacklight(int)" ); | 87 | QCopEnvelope e("QPE/System", "setBacklight(int)" ); |
88 | e << -3; // Forced on | 88 | e << -3; // Forced on |
89 | } | 89 | } |
90 | 90 | ||
91 | AlarmServer::initialize(); | 91 | AlarmServer::initialize(); |
92 | 92 | ||
93 | Desktop *d = new Desktop(); | 93 | Desktop *d = new Desktop(); |
94 | 94 | ||
95 | QObject::connect( &a, SIGNAL(power()), d, SLOT(togglePower()) ); | 95 | QObject::connect( &a, SIGNAL(power()), d, SLOT(togglePower()) ); |
96 | QObject::connect( &a, SIGNAL(backlight()), d, SLOT(toggleLight()) ); | 96 | QObject::connect( &a, SIGNAL(backlight()), d, SLOT(toggleLight()) ); |
97 | QObject::connect( &a, SIGNAL(symbol()), d, SLOT(toggleSymbolInput()) ); | 97 | QObject::connect( &a, SIGNAL(symbol()), d, SLOT(toggleSymbolInput()) ); |
98 | QObject::connect( &a, SIGNAL(numLockStateToggle()), d, SLOT(toggleNumLockState()) ); | 98 | QObject::connect( &a, SIGNAL(numLockStateToggle()), d, SLOT(toggleNumLockState()) ); |
99 | QObject::connect( &a, SIGNAL(capsLockStateToggle()), d, SLOT(toggleCapsLockState()) ); | 99 | QObject::connect( &a, SIGNAL(capsLockStateToggle()), d, SLOT(toggleCapsLockState()) ); |
100 | QObject::connect( &a, SIGNAL(prepareForRestart()), d, SLOT(terminateServers()) ); | 100 | QObject::connect( &a, SIGNAL(prepareForRestart()), d, SLOT(terminateServers()) ); |
101 | 101 | ||
102 | (void)new SysFileMonitor(d); | 102 | (void)new SysFileMonitor(d); |
103 | Network::createServer(d); | 103 | Network::createServer(d); |
104 | 104 | ||
105 | #if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) | 105 | if ( QWSServer::mouseHandler() ->inherits("QCalibratedMouseHandler") ) { |
106 | if ( !QFile::exists( "/etc/pointercal" ) ) { | 106 | if ( !QFile::exists( "/etc/pointercal" ) ) { |
107 | // Make sure calibration widget starts on top. | 107 | // Make sure calibration widget starts on top. |
108 | Calibrate *cal = new Calibrate; | 108 | Calibrate *cal = new Calibrate; |
109 | cal->exec(); | 109 | cal->exec(); |
110 | delete cal; | 110 | delete cal; |
111 | } | ||
111 | } | 112 | } |
112 | #endif | ||
113 | 113 | ||
114 | d->show(); | 114 | d->show(); |
115 | 115 | ||
116 | if ( QDate::currentDate ( ). year ( ) < 2000 ) { | 116 | if ( QDate::currentDate ( ). year ( ) < 2000 ) { |
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 ) { | 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 ) { |
118 | QCopEnvelope e ( "QPE/Application/systemtime", "setDocument(QString)" ); | 118 | QCopEnvelope e ( "QPE/Application/systemtime", "setDocument(QString)" ); |
119 | e << QString ( ); | 119 | e << QString ( ); |
120 | } | 120 | } |
121 | } | 121 | } |
122 | 122 | ||
123 | int rv = a.exec(); | 123 | int rv = a.exec(); |
124 | 124 | ||
125 | delete d; | 125 | delete d; |
126 | 126 | ||
127 | ODevice::inst ( )-> setSoftSuspend ( false ); | 127 | ODevice::inst ( )-> setSoftSuspend ( false ); |
128 | 128 | ||
129 | return rv; | 129 | return rv; |
130 | } | 130 | } |
131 | 131 | ||
132 | static const char *pidfile_path = "/var/run/opie.pid"; | 132 | static const char *pidfile_path = "/var/run/opie.pid"; |
133 | 133 | ||
134 | void create_pidfile ( ) | 134 | void create_pidfile ( ) |
135 | { | 135 | { |
136 | FILE *f; | 136 | FILE *f; |
137 | 137 | ||
138 | if (( f = ::fopen ( pidfile_path, "w" ))) { | 138 | if (( f = ::fopen ( pidfile_path, "w" ))) { |
139 | ::fprintf ( f, "%d", getpid ( )); | 139 | ::fprintf ( f, "%d", getpid ( )); |
140 | ::fclose ( f ); | 140 | ::fclose ( f ); |
141 | } | 141 | } |
142 | } | 142 | } |
143 | 143 | ||
144 | void remove_pidfile ( ) | 144 | void remove_pidfile ( ) |
145 | { | 145 | { |
146 | ::unlink ( pidfile_path ); | 146 | ::unlink ( pidfile_path ); |
147 | } | 147 | } |
148 | 148 | ||
149 | void handle_sigterm ( int /* sig */ ) | 149 | void handle_sigterm ( int /* sig */ ) |
150 | { | 150 | { |
151 | if ( qApp ) | 151 | if ( qApp ) |
152 | qApp-> quit ( ); | 152 | qApp-> quit ( ); |
153 | } | 153 | } |
154 | 154 | ||
155 | int main( int argc, char ** argv ) | 155 | int main( int argc, char ** argv ) |
156 | { | 156 | { |
157 | ::signal ( SIGCHLD, SIG_IGN ); | 157 | ::signal ( SIGCHLD, SIG_IGN ); |
158 | 158 | ||
159 | ::signal ( SIGTERM, handle_sigterm ); | 159 | ::signal ( SIGTERM, handle_sigterm ); |
160 | ::signal ( SIGINT, handle_sigterm ); | 160 | ::signal ( SIGINT, handle_sigterm ); |
diff --git a/core/opie-login/main.cpp b/core/opie-login/main.cpp index 1800be0..9c40fc4 100644 --- a/core/opie-login/main.cpp +++ b/core/opie-login/main.cpp | |||
@@ -278,91 +278,91 @@ public: | |||
278 | } | 278 | } |
279 | 279 | ||
280 | void setBacklight ( int bright ) | 280 | void setBacklight ( int bright ) |
281 | { | 281 | { |
282 | if ( bright == -3 ) { | 282 | if ( bright == -3 ) { |
283 | // Forced on | 283 | // Forced on |
284 | m_backlight_forcedoff = false; | 284 | m_backlight_forcedoff = false; |
285 | bright = -1; | 285 | bright = -1; |
286 | } | 286 | } |
287 | if ( m_backlight_forcedoff && bright != -2 ) | 287 | if ( m_backlight_forcedoff && bright != -2 ) |
288 | return ; | 288 | return ; |
289 | if ( bright == -2 ) { | 289 | if ( bright == -2 ) { |
290 | // Toggle between off and on | 290 | // Toggle between off and on |
291 | bright = m_backlight_bright ? 0 : -1; | 291 | bright = m_backlight_bright ? 0 : -1; |
292 | m_backlight_forcedoff = !bright; | 292 | m_backlight_forcedoff = !bright; |
293 | } | 293 | } |
294 | 294 | ||
295 | m_backlight_bright = bright; | 295 | m_backlight_bright = bright; |
296 | 296 | ||
297 | bright = backlight ( ); | 297 | bright = backlight ( ); |
298 | ODevice::inst ( ) -> setDisplayBrightness ( bright ); | 298 | ODevice::inst ( ) -> setDisplayBrightness ( bright ); |
299 | 299 | ||
300 | m_backlight_bright = bright; | 300 | m_backlight_bright = bright; |
301 | } | 301 | } |
302 | 302 | ||
303 | private: | 303 | private: |
304 | bool m_lcd_status; | 304 | bool m_lcd_status; |
305 | 305 | ||
306 | int m_backlight_bright; | 306 | int m_backlight_bright; |
307 | bool m_backlight_forcedoff; | 307 | bool m_backlight_forcedoff; |
308 | }; | 308 | }; |
309 | 309 | ||
310 | 310 | ||
311 | namespace Opie { extern int force_appearance; } // HACK to get around the force-style setting | 311 | namespace Opie { extern int force_appearance; } // HACK to get around the force-style setting |
312 | 312 | ||
313 | 313 | ||
314 | int login_main ( int argc, char **argv, pid_t ppid ) | 314 | int login_main ( int argc, char **argv, pid_t ppid ) |
315 | { | 315 | { |
316 | QWSServer::setDesktopBackground( QImage() ); | 316 | QWSServer::setDesktopBackground( QImage() ); |
317 | LoginApplication *app = new LoginApplication ( argc, argv, ppid ); | 317 | LoginApplication *app = new LoginApplication ( argc, argv, ppid ); |
318 | 318 | ||
319 | Opie::force_appearance = 0; | 319 | Opie::force_appearance = 0; |
320 | 320 | ||
321 | app-> setFont ( QFont ( "Helvetica", 10 )); | 321 | app-> setFont ( QFont ( "Helvetica", 10 )); |
322 | app-> setStyle ( new QPEStyle ( )); | 322 | app-> setStyle ( new QPEStyle ( )); |
323 | 323 | ||
324 | ODevice::inst ( )-> setSoftSuspend ( true ); | 324 | ODevice::inst ( )-> setSoftSuspend ( true ); |
325 | 325 | ||
326 | #if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) | 326 | if ( QWSServer::mouseHandler() ->inherits("QCalibratedMouseHandler") ) { |
327 | if ( !QFile::exists ( "/etc/pointercal" )) { | 327 | if ( !QFile::exists ( "/etc/pointercal" )) { |
328 | // Make sure calibration widget starts on top. | 328 | // Make sure calibration widget starts on top. |
329 | Calibrate *cal = new Calibrate; | 329 | Calibrate *cal = new Calibrate; |
330 | cal-> exec ( ); | 330 | cal-> exec ( ); |
331 | delete cal; | 331 | delete cal; |
332 | } | ||
332 | } | 333 | } |
333 | #endif | ||
334 | 334 | ||
335 | LoginScreenSaver *saver = new LoginScreenSaver; | 335 | LoginScreenSaver *saver = new LoginScreenSaver; |
336 | 336 | ||
337 | saver-> setIntervals ( ); | 337 | saver-> setIntervals ( ); |
338 | QWSServer::setScreenSaver ( saver ); | 338 | QWSServer::setScreenSaver ( saver ); |
339 | saver-> restore ( ); | 339 | saver-> restore ( ); |
340 | 340 | ||
341 | 341 | ||
342 | LoginWindowImpl *lw = new LoginWindowImpl ( ); | 342 | LoginWindowImpl *lw = new LoginWindowImpl ( ); |
343 | app-> setMainWidget ( lw ); | 343 | app-> setMainWidget ( lw ); |
344 | lw-> setGeometry ( 0, 0, app-> desktop ( )-> width ( ), app-> desktop ( )-> height ( )); | 344 | lw-> setGeometry ( 0, 0, app-> desktop ( )-> width ( ), app-> desktop ( )-> height ( )); |
345 | lw-> show ( ); | 345 | lw-> show ( ); |
346 | 346 | ||
347 | int rc = app-> exec ( ); | 347 | int rc = app-> exec ( ); |
348 | 348 | ||
349 | ODevice::inst ( )-> setSoftSuspend ( false ); | 349 | ODevice::inst ( )-> setSoftSuspend ( false ); |
350 | 350 | ||
351 | if ( app-> loginAs ( )) { | 351 | if ( app-> loginAs ( )) { |
352 | if ( app-> changeIdentity ( )) { | 352 | if ( app-> changeIdentity ( )) { |
353 | app-> login ( ); | 353 | app-> login ( ); |
354 | 354 | ||
355 | // if login succeeds, it never comes back | 355 | // if login succeeds, it never comes back |
356 | 356 | ||
357 | QMessageBox::critical ( 0, LoginWindowImpl::tr( "Failure" ), LoginWindowImpl::tr( "Could not start OPIE." )); | 357 | QMessageBox::critical ( 0, LoginWindowImpl::tr( "Failure" ), LoginWindowImpl::tr( "Could not start OPIE." )); |
358 | rc = 1; | 358 | rc = 1; |
359 | } | 359 | } |
360 | else { | 360 | else { |
361 | QMessageBox::critical ( 0, LoginWindowImpl::tr( "Failure" ), LoginWindowImpl::tr( "Could not switch to new user identity" )); | 361 | QMessageBox::critical ( 0, LoginWindowImpl::tr( "Failure" ), LoginWindowImpl::tr( "Could not switch to new user identity" )); |
362 | rc = 2; | 362 | rc = 2; |
363 | } | 363 | } |
364 | 364 | ||
365 | } | 365 | } |
366 | return rc; | 366 | return rc; |
367 | } | 367 | } |
368 | 368 | ||