summaryrefslogtreecommitdiff
path: root/core/launcher/desktop.cpp
Side-by-side diff
Diffstat (limited to 'core/launcher/desktop.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/desktop.cpp34
1 files changed, 23 insertions, 11 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp
index 0e60839..d74b745 100644
--- a/core/launcher/desktop.cpp
+++ b/core/launcher/desktop.cpp
@@ -172,25 +172,25 @@ public:
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
ODevice::inst ( ) -> setDisplayStatus ( true );
m_lcd_status = true;
}
- setBacklight ( -3 );
+ setBacklight ( -1 );
}
bool save( int level )
{
switch ( level ) {
case 0:
if ( m_disable_suspend > 0 && m_enable_dim ) {
if ( backlight() > 1 )
setBacklight( 1 ); // lowest non-off
}
return true;
break;
case 1:
@@ -323,30 +323,32 @@ private:
int m_backlight_bright;
bool m_backlight_forcedoff;
};
void DesktopApplication::switchLCD ( bool on )
{
if ( qApp ) {
DesktopApplication *dapp = (DesktopApplication *) qApp;
if ( dapp-> m_screensaver ) {
- if ( on )
- dapp-> m_screensaver-> restore ( ); //setBacklight ( on ? -3 : -1 );
- else
- dapp-> m_screensaver-> save ( 1 );
-
- }
+ if ( on ) {
+ dapp-> m_screensaver-> setDisplayState ( true );
+ dapp-> m_screensaver-> setBacklight ( -3 );
+ }
+ else {
+ dapp-> m_screensaver-> setDisplayState ( false );
+ }
+ }
}
}
DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType )
: QPEApplication( argc, argv, appType )
{
QTimer * t = new QTimer( this );
connect( t, SIGNAL( timeout() ), this, SLOT( psTimeout() ) );
t->start( 10000 );
ps = new PowerStatus;
@@ -853,43 +855,53 @@ void Desktop::execAutoStart()
#include <linux/ioctl.h>
#include <time.h>
#endif
void Desktop::togglePower()
{
static bool excllock = false;
qDebug ( "togglePower (locked == %d)", excllock ? 1 : 0 );
if ( excllock )
- return ;
+ return;
excllock = true;
bool wasloggedin = loggedin;
loggedin = 0;
suspendTime = QDateTime::currentDateTime();
- ODevice::inst ( ) -> suspend ( );
+#ifdef QWS
+ if ( Password::needToAuthenticate ( true ) && qt_screen ) {
+ // Should use a big black window instead.
+ // But this would not show up fast enough
+ QGfx *g = qt_screen-> screenGfx ( );
+ g-> fillRect ( 0, 0, qt_screen-> width ( ), qt_screen-> height ( ));
+ delete g;
+ }
+#endif
+
+ ODevice::inst ( )-> suspend ( );
- QWSServer::screenSaverActivate ( false );
DesktopApplication::switchLCD ( true ); // force LCD on without slow qcop call
+ QWSServer::screenSaverActivate ( false );
{
QCopEnvelope( "QPE/Card", "mtabChanged()" ); // might have changed while asleep
}
if ( wasloggedin )
- login( TRUE );
+ login ( true );
execAutoStart();
//qcopBridge->closeOpenConnections();
excllock = false;
}
void Desktop::toggleLight()
{
QCopEnvelope e( "QPE/System", "setBacklight(int)" );
e << -2; // toggle
}