-rw-r--r-- | core/opie-login/main.cpp | 28 |
1 files changed, 22 insertions, 6 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 | |||
@@ -54,6 +54,7 @@ | |||
54 | #include <qlabel.h> | 54 | #include <qlabel.h> |
55 | #include <qtimer.h> | 55 | #include <qtimer.h> |
56 | #include <qfile.h> | 56 | #include <qfile.h> |
57 | #include <qtextstream.h> | ||
57 | 58 | ||
58 | #include "loginapplication.h" | 59 | #include "loginapplication.h" |
59 | #include "loginwindowimpl.h" | 60 | #include "loginwindowimpl.h" |
@@ -74,6 +75,7 @@ static struct option long_options [] = { | |||
74 | 75 | ||
75 | int main ( int argc, char **argv ) | 76 | int main ( int argc, char **argv ) |
76 | { | 77 | { |
78 | int userExited = 0; | ||
77 | pid_t ppid = ::getpid ( ); | 79 | pid_t ppid = ::getpid ( ); |
78 | 80 | ||
79 | if ( ::geteuid ( ) != 0 ) { | 81 | if ( ::geteuid ( ) != 0 ) { |
@@ -137,11 +139,17 @@ int main ( int argc, char **argv ) | |||
137 | } | 139 | } |
138 | } | 140 | } |
139 | int killedbysig = 0; | 141 | int killedbysig = 0; |
142 | userExited=0; | ||
143 | if (WIFEXITED(status)!=0 ) { | ||
144 | if (WEXITSTATUS(status)==137) { | ||
145 | userExited=1; | ||
146 | } | ||
147 | } | ||
140 | 148 | ||
141 | if ( WIFSIGNALED( status )) { | 149 | if ( WIFSIGNALED( status )) { |
142 | switch ( WTERMSIG( status )) { | 150 | switch ( WTERMSIG( status )) { |
143 | case SIGINT : | ||
144 | case SIGTERM: | 151 | case SIGTERM: |
152 | case SIGINT : | ||
145 | case SIGKILL: | 153 | case SIGKILL: |
146 | break; | 154 | break; |
147 | 155 | ||
@@ -162,7 +170,7 @@ int main ( int argc, char **argv ) | |||
162 | 170 | ||
163 | const char *sig = ::strsignal ( killedbysig ); | 171 | const char *sig = ::strsignal ( killedbysig ); |
164 | QLabel *l = new QLabel ( 0, "sig", Qt::WStyle_Customize | Qt::WStyle_NoBorder | Qt::WStyle_Tool ); | 172 | QLabel *l = new QLabel ( 0, "sig", Qt::WStyle_Customize | Qt::WStyle_NoBorder | Qt::WStyle_Tool ); |
165 | l-> setText ( LoginWindowImpl::tr( "OPIE was terminated\nby an uncaught signal\n(%1)\n" ). arg ( sig )); | 173 | l-> setText ( LoginWindowImpl::tr( "Opie was terminated\nby an uncaught signal\n(%1)\n" ). arg ( sig )); |
166 | l-> setAlignment ( Qt::AlignCenter ); | 174 | l-> setAlignment ( Qt::AlignCenter ); |
167 | l-> move ( 0, 0 ); | 175 | l-> move ( 0, 0 ); |
168 | l-> resize ( app-> desktop ( )-> width ( ), app-> desktop ( )-> height ( )); | 176 | l-> resize ( app-> desktop ( )-> width ( ), app-> desktop ( )-> height ( )); |
@@ -175,7 +183,8 @@ int main ( int argc, char **argv ) | |||
175 | } | 183 | } |
176 | else { | 184 | else { |
177 | if ( !autolog ) { | 185 | if ( !autolog ) { |
178 | Config cfg ( "opie-login" ); | 186 | QString confFile=QPEApplication::qpeDir() + "/etc/opie-login.conf"; |
187 | Config cfg ( confFile, Config::File ); | ||
179 | cfg. setGroup ( "General" ); | 188 | cfg. setGroup ( "General" ); |
180 | QString user = cfg. readEntry ( "AutoLogin" ); | 189 | QString user = cfg. readEntry ( "AutoLogin" ); |
181 | 190 | ||
@@ -183,18 +192,25 @@ int main ( int argc, char **argv ) | |||
183 | autolog = ::strdup ( user. latin1 ( )); | 192 | autolog = ::strdup ( user. latin1 ( )); |
184 | } | 193 | } |
185 | 194 | ||
186 | if ( autolog ) { | 195 | if ( autolog && !userExited ) { |
196 | |||
197 | QWSServer::setDesktopBackground( QImage() ); | ||
198 | ODevice::inst ( )-> setDisplayStatus ( true ); | ||
199 | ODevice::inst ( )-> setSoftSuspend ( false ); | ||
200 | LoginApplication *app = new LoginApplication ( argc, argv, ppid ); | ||
187 | LoginApplication::setLoginAs ( autolog ); | 201 | LoginApplication::setLoginAs ( autolog ); |
188 | 202 | ||
203 | |||
189 | if ( LoginApplication::changeIdentity ( )) | 204 | if ( LoginApplication::changeIdentity ( )) |
190 | ::exit ( LoginApplication::login ( )); | 205 | ::exit ( LoginApplication::login ( )); |
191 | else | 206 | else |
192 | ::exit ( 0 ); | 207 | ::exit ( 0 ); |
193 | } | 208 | } |
194 | else | 209 | else { |
195 | ::exit ( login_main ( argc, argv, ppid )); | 210 | ::exit ( login_main ( argc, argv, ppid )); |
196 | } | 211 | } |
197 | } | 212 | } |
213 | } | ||
198 | return 0; | 214 | return 0; |
199 | } | 215 | } |
200 | 216 | ||
@@ -355,7 +371,7 @@ int login_main ( int argc, char **argv, pid_t ppid ) | |||
355 | 371 | ||
356 | // if login succeeds, it never comes back | 372 | // if login succeeds, it never comes back |
357 | 373 | ||
358 | QMessageBox::critical ( 0, LoginWindowImpl::tr( "Failure" ), LoginWindowImpl::tr( "Could not start OPIE." )); | 374 | QMessageBox::critical ( 0, LoginWindowImpl::tr( "Failure" ), LoginWindowImpl::tr( "Could not start Opie." )); |
359 | rc = 1; | 375 | rc = 1; |
360 | } | 376 | } |
361 | else { | 377 | else { |