-rw-r--r-- | core/apps/calibrate/main.cpp | 3 | ||||
-rw-r--r-- | core/opie-login/main.cpp | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/core/apps/calibrate/main.cpp b/core/apps/calibrate/main.cpp index 1c295eb..ec9b5ec 100644 --- a/core/apps/calibrate/main.cpp +++ b/core/apps/calibrate/main.cpp | |||
@@ -1,46 +1,47 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
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 | #include "calibrate.h" | 21 | #include "calibrate.h" |
22 | 22 | ||
23 | #include <qfile.h> | 23 | #include <qfile.h> |
24 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
25 | 25 | ||
26 | #ifdef QWS | 26 | #ifdef QWS |
27 | #include <qwindowsystem_qws.h> | 27 | #include <qwindowsystem_qws.h> |
28 | #endif | 28 | #endif |
29 | 29 | ||
30 | int main( int argc, char ** argv ) | 30 | int main( int argc, char ** argv ) |
31 | { | 31 | { |
32 | QPEApplication a( argc, argv ); | 32 | QPEApplication a( argc, argv ); |
33 | int retval = 0; | 33 | int retval = 0; |
34 | 34 | ||
35 | #ifdef QWS | 35 | #ifdef QWS |
36 | if ( QWSServer::mouseHandler() ->inherits("QCalibratedMouseHandler") ) { | 36 | if ( QWSServer::mouseHandler() && |
37 | QWSServer::mouseHandler() ->inherits("QCalibratedMouseHandler") ) { | ||
37 | #endif | 38 | #endif |
38 | // Make sure calibration widget starts on top. | 39 | // Make sure calibration widget starts on top. |
39 | Calibrate cal; | 40 | Calibrate cal; |
40 | a.setMainWidget(&cal); | 41 | a.setMainWidget(&cal); |
41 | a.showMainWidget(&cal); | 42 | a.showMainWidget(&cal); |
42 | return a.exec(); | 43 | return a.exec(); |
43 | #ifdef QWS | 44 | #ifdef QWS |
44 | } | 45 | } |
45 | #endif | 46 | #endif |
46 | } | 47 | } |
diff --git a/core/opie-login/main.cpp b/core/opie-login/main.cpp index 7dcb5f6..2103216 100644 --- a/core/opie-login/main.cpp +++ b/core/opie-login/main.cpp | |||
@@ -295,91 +295,92 @@ public: | |||
295 | } | 295 | } |
296 | 296 | ||
297 | void setBacklight ( int bright ) | 297 | void setBacklight ( int bright ) |
298 | { | 298 | { |
299 | if ( bright == -3 ) { | 299 | if ( bright == -3 ) { |
300 | // Forced on | 300 | // Forced on |
301 | m_backlight_forcedoff = false; | 301 | m_backlight_forcedoff = false; |
302 | bright = -1; | 302 | bright = -1; |
303 | } | 303 | } |
304 | if ( m_backlight_forcedoff && bright != -2 ) | 304 | if ( m_backlight_forcedoff && bright != -2 ) |
305 | return ; | 305 | return ; |
306 | if ( bright == -2 ) { | 306 | if ( bright == -2 ) { |
307 | // Toggle between off and on | 307 | // Toggle between off and on |
308 | bright = m_backlight_bright ? 0 : -1; | 308 | bright = m_backlight_bright ? 0 : -1; |
309 | m_backlight_forcedoff = !bright; | 309 | m_backlight_forcedoff = !bright; |
310 | } | 310 | } |
311 | 311 | ||
312 | m_backlight_bright = bright; | 312 | m_backlight_bright = bright; |
313 | 313 | ||
314 | bright = backlight ( ); | 314 | bright = backlight ( ); |
315 | ODevice::inst ( ) -> setDisplayBrightness ( bright ); | 315 | ODevice::inst ( ) -> setDisplayBrightness ( bright ); |
316 | 316 | ||
317 | m_backlight_bright = bright; | 317 | m_backlight_bright = bright; |
318 | } | 318 | } |
319 | 319 | ||
320 | private: | 320 | private: |
321 | bool m_lcd_status; | 321 | bool m_lcd_status; |
322 | 322 | ||
323 | int m_backlight_bright; | 323 | int m_backlight_bright; |
324 | bool m_backlight_forcedoff; | 324 | bool m_backlight_forcedoff; |
325 | }; | 325 | }; |
326 | 326 | ||
327 | 327 | ||
328 | namespace Opie { extern int force_appearance; } // HACK to get around the force-style setting | 328 | namespace Opie { extern int force_appearance; } // HACK to get around the force-style setting |
329 | 329 | ||
330 | 330 | ||
331 | int login_main ( int argc, char **argv, pid_t ppid ) | 331 | int login_main ( int argc, char **argv, pid_t ppid ) |
332 | { | 332 | { |
333 | QWSServer::setDesktopBackground( QImage() ); | 333 | QWSServer::setDesktopBackground( QImage() ); |
334 | LoginApplication *app = new LoginApplication ( argc, argv, ppid ); | 334 | LoginApplication *app = new LoginApplication ( argc, argv, ppid ); |
335 | 335 | ||
336 | Opie::force_appearance = 0; | 336 | Opie::force_appearance = 0; |
337 | 337 | ||
338 | app-> setFont ( QFont ( "Helvetica", 10 )); | 338 | app-> setFont ( QFont ( "Helvetica", 10 )); |
339 | app-> setStyle ( new QPEStyle ( )); | 339 | app-> setStyle ( new QPEStyle ( )); |
340 | 340 | ||
341 | ODevice::inst ( )-> setSoftSuspend ( true ); | 341 | ODevice::inst ( )-> setSoftSuspend ( true ); |
342 | 342 | ||
343 | if ( QWSServer::mouseHandler() ->inherits("QCalibratedMouseHandler") ) { | 343 | if ( QWSServer::mouseHandler() && |
344 | QWSServer::mouseHandler() ->inherits("QCalibratedMouseHandler") ) { | ||
344 | if ( !QFile::exists ( "/etc/pointercal" )) { | 345 | if ( !QFile::exists ( "/etc/pointercal" )) { |
345 | // Make sure calibration widget starts on top. | 346 | // Make sure calibration widget starts on top. |
346 | Calibrate *cal = new Calibrate; | 347 | Calibrate *cal = new Calibrate; |
347 | cal-> exec ( ); | 348 | cal-> exec ( ); |
348 | delete cal; | 349 | delete cal; |
349 | } | 350 | } |
350 | } | 351 | } |
351 | 352 | ||
352 | LoginScreenSaver *saver = new LoginScreenSaver; | 353 | LoginScreenSaver *saver = new LoginScreenSaver; |
353 | 354 | ||
354 | saver-> setIntervals ( ); | 355 | saver-> setIntervals ( ); |
355 | QWSServer::setScreenSaver ( saver ); | 356 | QWSServer::setScreenSaver ( saver ); |
356 | saver-> restore ( ); | 357 | saver-> restore ( ); |
357 | 358 | ||
358 | 359 | ||
359 | LoginWindowImpl *lw = new LoginWindowImpl ( ); | 360 | LoginWindowImpl *lw = new LoginWindowImpl ( ); |
360 | app-> setMainWidget ( lw ); | 361 | app-> setMainWidget ( lw ); |
361 | lw-> setGeometry ( 0, 0, app-> desktop ( )-> width ( ), app-> desktop ( )-> height ( )); | 362 | lw-> setGeometry ( 0, 0, app-> desktop ( )-> width ( ), app-> desktop ( )-> height ( )); |
362 | lw-> show ( ); | 363 | lw-> show ( ); |
363 | 364 | ||
364 | int rc = app-> exec ( ); | 365 | int rc = app-> exec ( ); |
365 | 366 | ||
366 | ODevice::inst ( )-> setSoftSuspend ( false ); | 367 | ODevice::inst ( )-> setSoftSuspend ( false ); |
367 | 368 | ||
368 | if ( app-> loginAs ( )) { | 369 | if ( app-> loginAs ( )) { |
369 | if ( app-> changeIdentity ( )) { | 370 | if ( app-> changeIdentity ( )) { |
370 | app-> login ( ); | 371 | app-> login ( ); |
371 | 372 | ||
372 | // if login succeeds, it never comes back | 373 | // if login succeeds, it never comes back |
373 | 374 | ||
374 | QMessageBox::critical ( 0, LoginWindowImpl::tr( "Failure" ), LoginWindowImpl::tr( "Could not start Opie." )); | 375 | QMessageBox::critical ( 0, LoginWindowImpl::tr( "Failure" ), LoginWindowImpl::tr( "Could not start Opie." )); |
375 | rc = 1; | 376 | rc = 1; |
376 | } | 377 | } |
377 | else { | 378 | else { |
378 | QMessageBox::critical ( 0, LoginWindowImpl::tr( "Failure" ), LoginWindowImpl::tr( "Could not switch to new user identity" )); | 379 | QMessageBox::critical ( 0, LoginWindowImpl::tr( "Failure" ), LoginWindowImpl::tr( "Could not switch to new user identity" )); |
379 | rc = 2; | 380 | rc = 2; |
380 | } | 381 | } |
381 | 382 | ||
382 | } | 383 | } |
383 | return rc; | 384 | return rc; |
384 | } | 385 | } |
385 | 386 | ||