-rw-r--r-- | core/opie-login/main.cpp | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/core/opie-login/main.cpp b/core/opie-login/main.cpp index d95a59b..7dcb5f6 100644 --- a/core/opie-login/main.cpp +++ b/core/opie-login/main.cpp @@ -53,8 +53,9 @@ #include <qmessagebox.h> #include <qlabel.h> #include <qtimer.h> #include <qfile.h> +#include <qtextstream.h> #include "loginapplication.h" #include "loginwindowimpl.h" #include "calibrate.h" @@ -73,8 +74,9 @@ static struct option long_options [] = { int main ( int argc, char **argv ) { + int userExited = 0; pid_t ppid = ::getpid ( ); if ( ::geteuid ( ) != 0 ) { ::fprintf ( stderr, "%s can only be executed by root. (or chmod +s)", argv [0] ); @@ -136,13 +138,19 @@ int main ( int argc, char **argv ) break; } } int killedbysig = 0; + userExited=0; + if (WIFEXITED(status)!=0 ) { + if (WEXITSTATUS(status)==137) { + userExited=1; + } + } if ( WIFSIGNALED( status )) { switch ( WTERMSIG( status )) { - case SIGINT : case SIGTERM: + case SIGINT : case SIGKILL: break; default : @@ -161,9 +169,9 @@ int main ( int argc, char **argv ) app-> setStyle ( new QPEStyle ( )); const char *sig = ::strsignal ( killedbysig ); QLabel *l = new QLabel ( 0, "sig", Qt::WStyle_Customize | Qt::WStyle_NoBorder | Qt::WStyle_Tool ); - l-> setText ( LoginWindowImpl::tr( "OPIE was terminated\nby an uncaught signal\n(%1)\n" ). arg ( sig )); + l-> setText ( LoginWindowImpl::tr( "Opie was terminated\nby an uncaught signal\n(%1)\n" ). arg ( sig )); l-> setAlignment ( Qt::AlignCenter ); l-> move ( 0, 0 ); l-> resize ( app-> desktop ( )-> width ( ), app-> desktop ( )-> height ( )); l-> show ( ); @@ -174,26 +182,34 @@ int main ( int argc, char **argv ) } } else { if ( !autolog ) { - Config cfg ( "opie-login" ); + QString confFile=QPEApplication::qpeDir() + "/etc/opie-login.conf"; + Config cfg ( confFile, Config::File ); cfg. setGroup ( "General" ); QString user = cfg. readEntry ( "AutoLogin" ); if ( !user. isEmpty ( )) autolog = ::strdup ( user. latin1 ( )); } - if ( autolog ) { - LoginApplication::setLoginAs ( autolog ); + if ( autolog && !userExited ) { + + QWSServer::setDesktopBackground( QImage() ); + ODevice::inst ( )-> setDisplayStatus ( true ); + ODevice::inst ( )-> setSoftSuspend ( false ); + LoginApplication *app = new LoginApplication ( argc, argv, ppid ); + LoginApplication::setLoginAs ( autolog ); + if ( LoginApplication::changeIdentity ( )) ::exit ( LoginApplication::login ( )); else ::exit ( 0 ); } - else + else { ::exit ( login_main ( argc, argv, ppid )); + } } } return 0; } @@ -354,9 +370,9 @@ int login_main ( int argc, char **argv, pid_t ppid ) app-> login ( ); // if login succeeds, it never comes back - QMessageBox::critical ( 0, LoginWindowImpl::tr( "Failure" ), LoginWindowImpl::tr( "Could not start OPIE." )); + QMessageBox::critical ( 0, LoginWindowImpl::tr( "Failure" ), LoginWindowImpl::tr( "Could not start Opie." )); rc = 1; } else { QMessageBox::critical ( 0, LoginWindowImpl::tr( "Failure" ), LoginWindowImpl::tr( "Could not switch to new user identity" )); |