-rw-r--r-- | core/launcher/desktop.cpp | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp index 6ee7132..0e60839 100644 --- a/core/launcher/desktop.cpp +++ b/core/launcher/desktop.cpp | |||
@@ -171,18 +171,20 @@ public: | |||
171 | m_backlight_bright = -1; | 171 | m_backlight_bright = -1; |
172 | m_backlight_forcedoff = false; | 172 | m_backlight_forcedoff = false; |
173 | 173 | ||
174 | // Make sure the LCD is in fact on, (if opie was killed while the LCD is off it would still be off) | 174 | // Make sure the LCD is in fact on, (if opie was killed while the LCD is off it would still be off) |
175 | ODevice::inst ( ) -> setDisplayStatus ( true ); | 175 | ODevice::inst ( ) -> setDisplayStatus ( true ); |
176 | } | 176 | } |
177 | void restore() | 177 | void restore() |
178 | { | 178 | { |
179 | if ( !m_lcd_status ) // We must have turned it off | 179 | if ( !m_lcd_status ) { // We must have turned it off |
180 | ODevice::inst ( ) -> setDisplayStatus ( true ); | 180 | ODevice::inst ( ) -> setDisplayStatus ( true ); |
181 | m_lcd_status = true; | ||
182 | } | ||
181 | 183 | ||
182 | setBacklight ( -3 ); | 184 | setBacklight ( -3 ); |
183 | } | 185 | } |
184 | bool save( int level ) | 186 | bool save( int level ) |
185 | { | 187 | { |
186 | switch ( level ) { | 188 | switch ( level ) { |
187 | case 0: | 189 | case 0: |
188 | if ( m_disable_suspend > 0 && m_enable_dim ) { | 190 | if ( m_disable_suspend > 0 && m_enable_dim ) { |
@@ -298,16 +300,24 @@ public: | |||
298 | m_backlight_bright = bright; | 300 | m_backlight_bright = bright; |
299 | 301 | ||
300 | bright = backlight ( ); | 302 | bright = backlight ( ); |
301 | ODevice::inst ( ) -> setDisplayBrightness ( bright ); | 303 | ODevice::inst ( ) -> setDisplayBrightness ( bright ); |
302 | 304 | ||
303 | m_backlight_bright = bright; | 305 | m_backlight_bright = bright; |
304 | } | 306 | } |
305 | 307 | ||
308 | void setDisplayState ( bool on ) | ||
309 | { | ||
310 | if ( m_lcd_status != on ) { | ||
311 | ODevice::inst ( ) -> setDisplayStatus ( on ); | ||
312 | m_lcd_status = on; | ||
313 | } | ||
314 | } | ||
315 | |||
306 | private: | 316 | private: |
307 | int m_disable_suspend; | 317 | int m_disable_suspend; |
308 | bool m_enable_dim; | 318 | bool m_enable_dim; |
309 | bool m_enable_lightoff; | 319 | bool m_enable_lightoff; |
310 | bool m_enable_onlylcdoff; | 320 | bool m_enable_onlylcdoff; |
311 | 321 | ||
312 | bool m_lcd_status; | 322 | bool m_lcd_status; |
313 | 323 | ||
@@ -372,22 +382,16 @@ void DesktopApplication::desktopMessage( const QCString &msg, const QByteArray & | |||
372 | QString c, m; | 382 | QString c, m; |
373 | stream >> k; | 383 | stream >> k; |
374 | stream >> c; | 384 | stream >> c; |
375 | stream >> m; | 385 | stream >> m; |
376 | 386 | ||
377 | qWarning( "KeyRegisterReceived: %i, %s, %s", k, ( const char* ) c, ( const char * ) m ); | 387 | qWarning( "KeyRegisterReceived: %i, %s, %s", k, ( const char* ) c, ( const char * ) m ); |
378 | keyRegisterList.append( QCopKeyRegister( k, c, m ) ); | 388 | keyRegisterList.append( QCopKeyRegister( k, c, m ) ); |
379 | } | 389 | } |
380 | else if ( msg == "suspend()" ) { | ||
381 | emit power(); | ||
382 | } | ||
383 | else if ( msg == "home()" ) { | ||
384 | qpedesktop-> home ( ); | ||
385 | } | ||
386 | #endif | 390 | #endif |
387 | } | 391 | } |
388 | 392 | ||
389 | 393 | ||
390 | void DesktopApplication::systemMessage( const QCString & msg, const QByteArray & data ) | 394 | void DesktopApplication::systemMessage( const QCString & msg, const QByteArray & data ) |
391 | { | 395 | { |
392 | #ifdef Q_WS_QWS | 396 | #ifdef Q_WS_QWS |
393 | QDataStream stream ( data, IO_ReadOnly ); | 397 | QDataStream stream ( data, IO_ReadOnly ); |
@@ -407,16 +411,24 @@ void DesktopApplication::systemMessage( const QCString & msg, const QByteArray & | |||
407 | stream >> bright; | 411 | stream >> bright; |
408 | m_screensaver-> setBacklight( bright ); | 412 | m_screensaver-> setBacklight( bright ); |
409 | } | 413 | } |
410 | else if ( msg == "setScreenSaverMode(int)" ) { | 414 | else if ( msg == "setScreenSaverMode(int)" ) { |
411 | int mode; | 415 | int mode; |
412 | stream >> mode; | 416 | stream >> mode; |
413 | m_screensaver-> setMode ( mode ); | 417 | m_screensaver-> setMode ( mode ); |
414 | } | 418 | } |
419 | else if ( msg == "setDisplayState(int)" ) { | ||
420 | int state; | ||
421 | stream >> state; | ||
422 | m_screensaver-> setDisplayState ( state != 0 ); | ||
423 | } | ||
424 | else if ( msg == "suspend()" ) { | ||
425 | emit power(); | ||
426 | } | ||
415 | #endif | 427 | #endif |
416 | } | 428 | } |
417 | 429 | ||
418 | enum MemState { Unknown, VeryLow, Low, Normal } memstate = Unknown; | 430 | enum MemState { Unknown, VeryLow, Low, Normal } memstate = Unknown; |
419 | 431 | ||
420 | #ifdef Q_WS_QWS | 432 | #ifdef Q_WS_QWS |
421 | bool DesktopApplication::qwsEventFilter( QWSEvent *e ) | 433 | bool DesktopApplication::qwsEventFilter( QWSEvent *e ) |
422 | { | 434 | { |
@@ -623,16 +635,18 @@ Desktop::Desktop() : | |||
623 | startTransferServer(); | 635 | startTransferServer(); |
624 | ( void ) new IrServer( this ); | 636 | ( void ) new IrServer( this ); |
625 | rereadVolumes(); | 637 | rereadVolumes(); |
626 | 638 | ||
627 | packageSlave = new PackageSlave( this ); | 639 | packageSlave = new PackageSlave( this ); |
628 | connect( qApp, SIGNAL( volumeChanged( bool ) ), this, SLOT( rereadVolumes() ) ); | 640 | connect( qApp, SIGNAL( volumeChanged( bool ) ), this, SLOT( rereadVolumes() ) ); |
629 | 641 | ||
630 | qApp->installEventFilter( this ); | 642 | qApp->installEventFilter( this ); |
643 | |||
644 | qApp-> setMainWidget ( launcher ); | ||
631 | } | 645 | } |
632 | 646 | ||
633 | void Desktop::show() | 647 | void Desktop::show() |
634 | { | 648 | { |
635 | login( TRUE ); | 649 | login( TRUE ); |
636 | QWidget::show(); | 650 | QWidget::show(); |
637 | } | 651 | } |
638 | 652 | ||