summaryrefslogtreecommitdiff
authorsandman <sandman>2002-10-17 00:39:31 (UTC)
committer sandman <sandman>2002-10-17 00:39:31 (UTC)
commit259d10f40405fd77ba0a8947782f716be94da3a5 (patch) (unidiff)
tree636cb3a899d27a8fe41f377fabc5bd170a74c6dc
parent5d28c61d84da1814d356540b557bbfe026da98aa (diff)
downloadopie-259d10f40405fd77ba0a8947782f716be94da3a5.zip
opie-259d10f40405fd77ba0a8947782f716be94da3a5.tar.gz
opie-259d10f40405fd77ba0a8947782f716be94da3a5.tar.bz2
- fix for bug #292 (Improper behaviour of frontlight disabling)
- fix for bug #199 (Desktop visible on resume before password dialog appears)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/desktop.cpp34
-rw-r--r--library/password.cpp24
-rw-r--r--library/password.h1
3 files changed, 46 insertions, 13 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
@@ -178,13 +178,13 @@ public:
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; 181 m_lcd_status = true;
182 } 182 }
183 183
184 setBacklight ( -3 ); 184 setBacklight ( -1 );
185 } 185 }
186 bool save( int level ) 186 bool save( int level )
187 { 187 {
188 switch ( level ) { 188 switch ( level ) {
189 case 0: 189 case 0:
190 if ( m_disable_suspend > 0 && m_enable_dim ) { 190 if ( m_disable_suspend > 0 && m_enable_dim ) {
@@ -329,18 +329,20 @@ private:
329void DesktopApplication::switchLCD ( bool on ) 329void DesktopApplication::switchLCD ( bool on )
330{ 330{
331 if ( qApp ) { 331 if ( qApp ) {
332 DesktopApplication *dapp = (DesktopApplication *) qApp; 332 DesktopApplication *dapp = (DesktopApplication *) qApp;
333 333
334 if ( dapp-> m_screensaver ) { 334 if ( dapp-> m_screensaver ) {
335 if ( on ) 335 if ( on ) {
336 dapp-> m_screensaver-> restore ( ); //setBacklight ( on ? -3 : -1 ); 336 dapp-> m_screensaver-> setDisplayState ( true );
337 else 337 dapp-> m_screensaver-> setBacklight ( -3 );
338 dapp-> m_screensaver-> save ( 1 ); 338 }
339 339 else {
340 } 340 dapp-> m_screensaver-> setDisplayState ( false );
341 }
342 }
341 } 343 }
342} 344}
343 345
344 346
345DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType ) 347DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType )
346 : QPEApplication( argc, argv, appType ) 348 : QPEApplication( argc, argv, appType )
@@ -859,31 +861,41 @@ void Desktop::togglePower()
859{ 861{
860 static bool excllock = false; 862 static bool excllock = false;
861 863
862 qDebug ( "togglePower (locked == %d)", excllock ? 1 : 0 ); 864 qDebug ( "togglePower (locked == %d)", excllock ? 1 : 0 );
863 865
864 if ( excllock ) 866 if ( excllock )
865 return ; 867 return;
866 868
867 excllock = true; 869 excllock = true;
868 870
869 bool wasloggedin = loggedin; 871 bool wasloggedin = loggedin;
870 loggedin = 0; 872 loggedin = 0;
871 suspendTime = QDateTime::currentDateTime(); 873 suspendTime = QDateTime::currentDateTime();
872 874
873 ODevice::inst ( ) -> suspend ( ); 875#ifdef QWS
876 if ( Password::needToAuthenticate ( true ) && qt_screen ) {
877 // Should use a big black window instead.
878 // But this would not show up fast enough
879 QGfx *g = qt_screen-> screenGfx ( );
880 g-> fillRect ( 0, 0, qt_screen-> width ( ), qt_screen-> height ( ));
881 delete g;
882 }
883#endif
884
885 ODevice::inst ( )-> suspend ( );
874 886
875 QWSServer::screenSaverActivate ( false );
876 DesktopApplication::switchLCD ( true ); // force LCD on without slow qcop call 887 DesktopApplication::switchLCD ( true ); // force LCD on without slow qcop call
888 QWSServer::screenSaverActivate ( false );
877 889
878 { 890 {
879 QCopEnvelope( "QPE/Card", "mtabChanged()" ); // might have changed while asleep 891 QCopEnvelope( "QPE/Card", "mtabChanged()" ); // might have changed while asleep
880 } 892 }
881 893
882 if ( wasloggedin ) 894 if ( wasloggedin )
883 login( TRUE ); 895 login ( true );
884 896
885 execAutoStart(); 897 execAutoStart();
886 //qcopBridge->closeOpenConnections(); 898 //qcopBridge->closeOpenConnections();
887 899
888 excllock = false; 900 excllock = false;
889} 901}
diff --git a/library/password.cpp b/library/password.cpp
index 4b22b65..6d126c4 100644
--- a/library/password.cpp
+++ b/library/password.cpp
@@ -24,13 +24,13 @@
24#include <qlabel.h> 24#include <qlabel.h>
25#include <qlineedit.h> 25#include <qlineedit.h>
26#include <qtextview.h> 26#include <qtextview.h>
27#include <qstring.h> 27#include <qstring.h>
28#include <qapplication.h> 28#include <qapplication.h>
29#include <qfile.h> 29#include <qfile.h>
30#include <qwindowsystem_qws.h> 30//#include <qwindowsystem_qws.h>
31 31
32#include <qdialog.h> 32#include <qdialog.h>
33 33
34#include <unistd.h> //for sleep 34#include <unistd.h> //for sleep
35#include "passwordbase_p.h" 35#include "passwordbase_p.h"
36 36
@@ -282,12 +282,31 @@ QString Password::getPassword( const QString& prompt )
282 return QString::null; 282 return QString::null;
283 } 283 }
284} 284}
285 285
286 286
287/*! 287/*!
288 Return if a prompt for the user's passcode is needed.
289
290 If \a at_poweron is TRUE, the dialog is only used if the user's
291 preference request it at poweron
292
293 Opie extension to speed up suspend/resume.
294*/
295
296bool Password::needToAuthenticate(bool at_poweron)
297{
298 Config cfg("Security");
299 cfg.setGroup("Passcode");
300 QString passcode = cfg.readEntry("passcode");
301
302 return ( !passcode.isEmpty()
303 && (!at_poweron || cfg.readNumEntry("passcode_poweron",0)) );
304}
305
306/*!
288 Prompt, fullscreen, for the user's passcode until they get it right. 307 Prompt, fullscreen, for the user's passcode until they get it right.
289 308
290 If \a at_poweron is TRUE, the dialog is only used if the user's 309 If \a at_poweron is TRUE, the dialog is only used if the user's
291 preference request it at poweron; either way, the screen is always repainted 310 preference request it at poweron; either way, the screen is always repainted
292 by this function. (this functionality may move to the caller of this function). 311 by this function. (this functionality may move to the caller of this function).
293*/ 312*/
@@ -321,13 +340,14 @@ void Password::authenticate(bool at_poweron)
321 oi->exec(); 340 oi->exec();
322 pd.reset(); 341 pd.reset();
323 pd.exec(); 342 pd.exec();
324 } 343 }
325 } else if ( at_poweron ) { 344 } else if ( at_poweron ) {
326 // refresh screen #### should probably be in caller 345 // refresh screen #### should probably be in caller
327 // Not needed (we took away the screen blacking) 346 // Not needed (we took away the screen blacking) TT
347 // Not needed (we have intelligent screen blacking) sandman
328 //if ( qwsServer ) 348 //if ( qwsServer )
329 //qwsServer->refresh(); 349 //qwsServer->refresh();
330 } 350 }
331} 351}
332 352
333#include "password.moc" 353#include "password.moc"
diff --git a/library/password.h b/library/password.h
index a3a3e45..a2f2c3c 100644
--- a/library/password.h
+++ b/library/password.h
@@ -22,11 +22,12 @@
22 22
23#include <qstring.h> 23#include <qstring.h>
24 24
25class Password 25class Password
26{ 26{
27public: 27public:
28 static bool needToAuthenticate(bool atpoweron=FALSE); // Opie extension to speed up suspend/resume (sandman)
28 static void authenticate(bool atpoweron=FALSE); 29 static void authenticate(bool atpoweron=FALSE);
29 static QString getPassword( const QString& prompt ); 30 static QString getPassword( const QString& prompt );
30}; 31};
31 32
32#endif // PASSWORD_H 33#endif // PASSWORD_H