-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: m_backlight_bright = -1; m_backlight_forcedoff = false; // Make sure the LCD is in fact on, (if opie was killed while the LCD is off it would still be off) ODevice::inst ( ) -> setDisplayStatus ( true ); } void restore() { - if ( !m_lcd_status ) // We must have turned it off + if ( !m_lcd_status ) { // We must have turned it off ODevice::inst ( ) -> setDisplayStatus ( true ); + m_lcd_status = true; + } setBacklight ( -3 ); } bool save( int level ) { switch ( level ) { case 0: if ( m_disable_suspend > 0 && m_enable_dim ) { @@ -298,16 +300,24 @@ public: m_backlight_bright = bright; bright = backlight ( ); ODevice::inst ( ) -> setDisplayBrightness ( bright ); m_backlight_bright = bright; } + void setDisplayState ( bool on ) + { + if ( m_lcd_status != on ) { + ODevice::inst ( ) -> setDisplayStatus ( on ); + m_lcd_status = on; + } + } + private: int m_disable_suspend; bool m_enable_dim; bool m_enable_lightoff; bool m_enable_onlylcdoff; bool m_lcd_status; @@ -372,22 +382,16 @@ void DesktopApplication::desktopMessage( const QCString &msg, const QByteArray & QString c, m; stream >> k; stream >> c; stream >> m; qWarning( "KeyRegisterReceived: %i, %s, %s", k, ( const char* ) c, ( const char * ) m ); keyRegisterList.append( QCopKeyRegister( k, c, m ) ); } - else if ( msg == "suspend()" ) { - emit power(); - } - else if ( msg == "home()" ) { - qpedesktop-> home ( ); - } #endif } void DesktopApplication::systemMessage( const QCString & msg, const QByteArray & data ) { #ifdef Q_WS_QWS QDataStream stream ( data, IO_ReadOnly ); @@ -407,16 +411,24 @@ void DesktopApplication::systemMessage( const QCString & msg, const QByteArray & stream >> bright; m_screensaver-> setBacklight( bright ); } else if ( msg == "setScreenSaverMode(int)" ) { int mode; stream >> mode; m_screensaver-> setMode ( mode ); } + else if ( msg == "setDisplayState(int)" ) { + int state; + stream >> state; + m_screensaver-> setDisplayState ( state != 0 ); + } + else if ( msg == "suspend()" ) { + emit power(); + } #endif } enum MemState { Unknown, VeryLow, Low, Normal } memstate = Unknown; #ifdef Q_WS_QWS bool DesktopApplication::qwsEventFilter( QWSEvent *e ) { @@ -623,16 +635,18 @@ Desktop::Desktop() : startTransferServer(); ( void ) new IrServer( this ); rereadVolumes(); packageSlave = new PackageSlave( this ); connect( qApp, SIGNAL( volumeChanged( bool ) ), this, SLOT( rereadVolumes() ) ); qApp->installEventFilter( this ); + + qApp-> setMainWidget ( launcher ); } void Desktop::show() { login( TRUE ); QWidget::show(); } |