summaryrefslogtreecommitdiff
path: root/core
authorpaule <paule>2007-01-31 05:11:56 (UTC)
committer paule <paule>2007-01-31 05:11:56 (UTC)
commit3a2db1ba1395a6d33de421ed5f3b04df53ced5bc (patch) (side-by-side diff)
tree19af403919546824965303db78820a3f2a176bda /core
parentf4e6ede30d494ad91fdbd0fd72498ef3a44bf7ee (diff)
downloadopie-3a2db1ba1395a6d33de421ed5f3b04df53ced5bc.zip
opie-3a2db1ba1395a6d33de421ed5f3b04df53ced5bc.tar.gz
opie-3a2db1ba1395a6d33de421ed5f3b04df53ced5bc.tar.bz2
Specify correct parameters to needToAuthenticate() and login() so that appropriate setting is read when determining whether to authenticate or not. Fixes bug #1830.
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/serverapp.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/launcher/serverapp.cpp b/core/launcher/serverapp.cpp
index 6fe0479..0e92040 100644
--- a/core/launcher/serverapp.cpp
+++ b/core/launcher/serverapp.cpp
@@ -485,212 +485,212 @@ void ServerApplication::reloadPowerWarnSettings ( )
int iv = cfg. readNumEntry ( "checkinterval", 10000 );
m_apm_timer-> stop ( );
if ( iv )
m_apm_timer-> start ( iv );
m_powerVeryLow = cfg. readNumEntry ( "powerverylow", 10 );
m_powerCritical = cfg. readNumEntry ( "powervcritical", 5 );
}
void ServerApplication::launcherMessage( const QCString & msg, const QByteArray & data )
{
QDataStream stream ( data, IO_ReadOnly );
if ( msg == "deviceButton(int,int,int)" ) {
int keycode, press, autoRepeat;
stream >> keycode >> press >> autoRepeat;
kf->checkButtonAction ( true, keycode, press, autoRepeat );
}
else if ( msg == "keyRegister(int,QCString,QCString)" ) {
int k;
QCString c, m;
stream >> k >> c >> m;
kf -> registerKey( QCopKeyRegister(k, c, m) );
}
}
bool ServerApplication::screenLocked()
{
return loggedin == 0;
}
void ServerApplication::login(bool at_poweron)
{
if ( !loggedin ) {
Global::terminateBuiltin("calibrate"); // No tr
int lockMode = at_poweron ? Opie::Security::IfPowerOn : Opie::Security::IfResume;
Opie::Security::MultiauthPassword::authenticate(lockMode);
loggedin=1;
#ifndef QT_NO_COP
QCopEnvelope e( "QPE/Desktop", "unlocked()" );
#endif
}
}
#if defined(QPE_HAVE_TOGGLELIGHT)
#include <qtopia/config.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <linux/ioctl.h>
#include <time.h>
#endif
namespace {
void execAutoStart(const QDateTime& suspendTime ) {
QString appName;
int delay;
QDateTime now = QDateTime::currentDateTime();
Config cfg( "autostart" );
cfg.setGroup( "AutoStart" );
appName = cfg.readEntry( "Apps", "" );
delay = cfg.readNumEntry( "Delay", 0 );
// If the time between suspend and resume was longer then the
// value saved as delay, start the app
if ( suspendTime.secsTo( now ) >= ( delay * 60 ) && !appName.isEmpty() ) {
QCopEnvelope e( "QPE/System", "execute(QString)" );
e << QString( appName );
}
}
}
void ServerApplication::togglePower()
{
static bool excllock = false;
if ( excllock )
return ;
excllock = true;
bool wasloggedin = loggedin;
loggedin = 0;
m_suspendTime = QDateTime::currentDateTime();
#ifdef QWS
- if ( Opie::Security::MultiauthPassword::needToAuthenticate ( true ) && qt_screen ) {
+ if ( Opie::Security::MultiauthPassword::needToAuthenticate ( false ) && 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 ( );
ServerApplication::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 ( false );
execAutoStart(m_suspendTime);
//qcopBridge->closeOpenConnections();
excllock = false;
}
void ServerApplication::toggleLight()
{
#ifndef QT_NO_COP
QCopEnvelope e("QPE/System", "setBacklight(int)");
e << -2; // toggle
#endif
}
/*
* We still listen to key events but handle them in
* a special class
*/
bool ServerApplication::eventFilter( QObject *o, QEvent *e) {
if ( e->type() != QEvent::KeyPress &&
e->type() != QEvent::KeyRelease )
return QPEApplication::eventFilter( o, e );
QKeyEvent *ke = static_cast<QKeyEvent*>( e );
if ( kf->checkButtonAction( true, ke->key(),
e->type() == QEvent::KeyPress,
ke-> isAutoRepeat() ))
return true;
return QPEApplication::eventFilter( o, e );
}
#ifdef Q_WS_QWS
bool ServerApplication::qwsEventFilter( QWSEvent *e )
{
checkMemory();
if ( e->type == QWSEvent::Mouse ) {
QWSMouseEvent *me = (QWSMouseEvent *)e;
static bool up = TRUE;
if ( me->simpleData.state&LeftButton ) {
if ( up ) {
up = FALSE;
screenClick(TRUE);
}
} else if ( !up ) {
up = TRUE;
screenClick(FALSE);
}
} else
if ( e->type == QWSEvent::Key ) {
QWSKeyEvent * ke = static_cast<QWSKeyEvent*>( e );
if ( kf->checkButtonAction( false,
ke-> simpleData.keycode,
ke-> simpleData.is_press,
ke-> simpleData.is_auto_repeat ) )
return true;
}
return QPEApplication::qwsEventFilter( e );
}
#endif
/* ### FIXME libqtopia Plugin Safe Mode */
void ServerApplication::showSafeMode()
{
#if 0
if ( QMessageBox::warning(0, tr("Safe Mode"), tr("<P>A system startup error occurred, "
"and the system is now in Safe Mode. "
"Plugins are not loaded in Safe Mode. "
"You can use the Plugin Manager to "
"disable plugins that cause system error."), tr("OK"), tr("Plugin Manager..."), 0) == 1 )
{
Global::execute( "pluginmanager" );
}
#endif
}
void ServerApplication::clearSafeMode()
{
#if 0
// If we've been running OK for a while then we won't bother going into
// safe mode immediately on the next crash.
Config cfg( "PluginLoader" );
cfg.setGroup( "Global" );
QString mode = cfg.readEntry( "Mode", "Normal" );
if ( mode == "MaybeSafe" ) {
cfg.writeEntry( "Mode", "Normal" );
}
#endif