author | sandman <sandman> | 2002-10-14 01:17:39 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-10-14 01:17:39 (UTC) |
commit | 2c2d282f3d665035300873bddab6e64c843ebc0e (patch) (unidiff) | |
tree | efcab6d90f6529234b6c03cd4589b9fa868cd3a2 | |
parent | 1b8d2ecee642bdecfdc3be15625f2c53bab01e64 (diff) | |
download | opie-2c2d282f3d665035300873bddab6e64c843ebc0e.zip opie-2c2d282f3d665035300873bddab6e64c843ebc0e.tar.gz opie-2c2d282f3d665035300873bddab6e64c843ebc0e.tar.bz2 |
include fix for ipaq/zaurus compile
-rw-r--r-- | core/opie-login/main.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/core/opie-login/main.cpp b/core/opie-login/main.cpp index 2c10f77..8f795e3 100644 --- a/core/opie-login/main.cpp +++ b/core/opie-login/main.cpp | |||
@@ -1,346 +1,347 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This file is free software; you can | 5 | _;:, .> :=|. This file is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This file is distributed in the hope that | 12 | .i_,=:_. -<s. This file is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
17 | ..}^=.= = ; Public License for more details. | 17 | ..}^=.= = ; Public License for more details. |
18 | ++= -. .` .: | 18 | ++= -. .` .: |
19 | : = ...= . :.=- You should have received a copy of the GNU | 19 | : = ...= . :.=- You should have received a copy of the GNU |
20 | -. .:....=;==+<; General Public License along with this file; | 20 | -. .:....=;==+<; General Public License along with this file; |
21 | -_. . . )=. = see the file COPYING. If not, write to the | 21 | -_. . . )=. = see the file COPYING. If not, write to the |
22 | -- :-=` Free Software Foundation, Inc., | 22 | -- :-=` Free Software Foundation, Inc., |
23 | 59 Temple Place - Suite 330, | 23 | 59 Temple Place - Suite 330, |
24 | Boston, MA 02111-1307, USA. | 24 | Boston, MA 02111-1307, USA. |
25 | 25 | ||
26 | */ | 26 | */ |
27 | 27 | ||
28 | #define _GNU_SOURCE | 28 | #define _GNU_SOURCE |
29 | 29 | ||
30 | #include <sys/types.h> | 30 | #include <sys/types.h> |
31 | #include <time.h> | 31 | #include <time.h> |
32 | #include <sys/time.h> | 32 | #include <sys/time.h> |
33 | #include <sys/resource.h> | 33 | #include <sys/resource.h> |
34 | #include <unistd.h> | 34 | #include <unistd.h> |
35 | #include <syslog.h> | 35 | #include <syslog.h> |
36 | #include <sys/wait.h> | 36 | #include <sys/wait.h> |
37 | #include <stdio.h> | 37 | #include <stdio.h> |
38 | #include <stdlib.h> | 38 | #include <stdlib.h> |
39 | #include <signal.h> | 39 | #include <signal.h> |
40 | #include <getopt.h> | 40 | #include <getopt.h> |
41 | #include <string.h> | 41 | #include <string.h> |
42 | 42 | ||
43 | #include <qpe/qpeapplication.h> | 43 | #include <qpe/qpeapplication.h> |
44 | #include <qpe/qcopenvelope_qws.h> | 44 | #include <qpe/qcopenvelope_qws.h> |
45 | #include <qpe/qpestyle.h> | 45 | #include <qpe/qpestyle.h> |
46 | #include <qpe/power.h> | 46 | #include <qpe/power.h> |
47 | 47 | ||
48 | #include <opie/odevice.h> | 48 | #include <opie/odevice.h> |
49 | 49 | ||
50 | #include <qwindowsystem_qws.h> | 50 | #include <qwindowsystem_qws.h> |
51 | #include <qmessagebox.h> | 51 | #include <qmessagebox.h> |
52 | #include <qlabel.h> | 52 | #include <qlabel.h> |
53 | #include <qtimer.h> | 53 | #include <qtimer.h> |
54 | #include <qfile.h> | ||
54 | 55 | ||
55 | #include "loginapplication.h" | 56 | #include "loginapplication.h" |
56 | #include "loginwindowimpl.h" | 57 | #include "loginwindowimpl.h" |
57 | #include "calibrate.h" | 58 | #include "calibrate.h" |
58 | 59 | ||
59 | using namespace Opie; | 60 | using namespace Opie; |
60 | 61 | ||
61 | int login_main ( int argc, char **argv ); | 62 | int login_main ( int argc, char **argv ); |
62 | void sigterm ( int sig ); | 63 | void sigterm ( int sig ); |
63 | void exit_closelog ( ); | 64 | void exit_closelog ( ); |
64 | 65 | ||
65 | static struct option long_options [] = { | 66 | static struct option long_options [] = { |
66 | { "autologin", 1, 0, 'a' }, | 67 | { "autologin", 1, 0, 'a' }, |
67 | { 0, 0, 0, 0 } | 68 | { 0, 0, 0, 0 } |
68 | }; | 69 | }; |
69 | 70 | ||
70 | 71 | ||
71 | int main ( int argc, char **argv ) | 72 | int main ( int argc, char **argv ) |
72 | { | 73 | { |
73 | if ( ::geteuid ( ) != 0 ) { | 74 | if ( ::geteuid ( ) != 0 ) { |
74 | ::fprintf ( stderr, "%s can only be executed by root. (or chmod +s)", argv [0] ); | 75 | ::fprintf ( stderr, "%s can only be executed by root. (or chmod +s)", argv [0] ); |
75 | return 1; | 76 | return 1; |
76 | } | 77 | } |
77 | if ( ::getuid ( ) != 0 ) // qt doesn't really like SUID and | 78 | if ( ::getuid ( ) != 0 ) // qt doesn't really like SUID and |
78 | ::setuid ( 0 ); // messes up things like config files | 79 | ::setuid ( 0 ); // messes up things like config files |
79 | 80 | ||
80 | char *autolog = 0; | 81 | char *autolog = 0; |
81 | int c; | 82 | int c; |
82 | while (( c = ::getopt_long ( argc, argv, "a:", long_options, 0 )) != -1 ) { | 83 | while (( c = ::getopt_long ( argc, argv, "a:", long_options, 0 )) != -1 ) { |
83 | switch ( c ) { | 84 | switch ( c ) { |
84 | case 'a': | 85 | case 'a': |
85 | autolog = optarg; | 86 | autolog = optarg; |
86 | break; | 87 | break; |
87 | default: | 88 | default: |
88 | ::fprintf ( stderr, "Usage: %s [-a|--autologin=<user>]\n", argv [0] ); | 89 | ::fprintf ( stderr, "Usage: %s [-a|--autologin=<user>]\n", argv [0] ); |
89 | return 2; | 90 | return 2; |
90 | } | 91 | } |
91 | } | 92 | } |
92 | 93 | ||
93 | //struct rlimit rl; | 94 | //struct rlimit rl; |
94 | //::getrlimit ( RLIMIT_NOFILE, &rl ); | 95 | //::getrlimit ( RLIMIT_NOFILE, &rl ); |
95 | 96 | ||
96 | //for ( unsigned int i = 0; i < rl. rlim_cur; i++ ) | 97 | //for ( unsigned int i = 0; i < rl. rlim_cur; i++ ) |
97 | // ::close ( i ); | 98 | // ::close ( i ); |
98 | 99 | ||
99 | ::setpgid ( 0, 0 ); | 100 | ::setpgid ( 0, 0 ); |
100 | ::setsid ( ); | 101 | ::setsid ( ); |
101 | 102 | ||
102 | ::signal ( SIGTERM, sigterm ); | 103 | ::signal ( SIGTERM, sigterm ); |
103 | 104 | ||
104 | ::openlog ( "opie-login", LOG_CONS, LOG_AUTHPRIV ); | 105 | ::openlog ( "opie-login", LOG_CONS, LOG_AUTHPRIV ); |
105 | ::atexit ( exit_closelog ); | 106 | ::atexit ( exit_closelog ); |
106 | 107 | ||
107 | while ( true ) { | 108 | while ( true ) { |
108 | pid_t child = ::fork ( ); | 109 | pid_t child = ::fork ( ); |
109 | 110 | ||
110 | if ( child < 0 ) { | 111 | if ( child < 0 ) { |
111 | ::syslog ( LOG_ERR, "Could not fork GUI process\n" ); | 112 | ::syslog ( LOG_ERR, "Could not fork GUI process\n" ); |
112 | break; | 113 | break; |
113 | } | 114 | } |
114 | else if ( child > 0 ) { | 115 | else if ( child > 0 ) { |
115 | int status = 0; | 116 | int status = 0; |
116 | time_t started = ::time ( 0 ); | 117 | time_t started = ::time ( 0 ); |
117 | 118 | ||
118 | while ( ::waitpid ( child, &status, 0 ) < 0 ) { } | 119 | while ( ::waitpid ( child, &status, 0 ) < 0 ) { } |
119 | 120 | ||
120 | if (( ::time ( 0 ) - started ) < 3 ) { | 121 | if (( ::time ( 0 ) - started ) < 3 ) { |
121 | if ( autolog ) { | 122 | if ( autolog ) { |
122 | ::syslog ( LOG_ERR, "Respawning too fast -- disabling auto-login\n" ); | 123 | ::syslog ( LOG_ERR, "Respawning too fast -- disabling auto-login\n" ); |
123 | autolog = 0; | 124 | autolog = 0; |
124 | } | 125 | } |
125 | else { | 126 | else { |
126 | ::syslog ( LOG_ERR, "Respawning too fast -- going down\n" ); | 127 | ::syslog ( LOG_ERR, "Respawning too fast -- going down\n" ); |
127 | break; | 128 | break; |
128 | } | 129 | } |
129 | } | 130 | } |
130 | int killedbysig = 0; | 131 | int killedbysig = 0; |
131 | 132 | ||
132 | if ( WIFSIGNALED( status )) { | 133 | if ( WIFSIGNALED( status )) { |
133 | switch ( WTERMSIG( status )) { | 134 | switch ( WTERMSIG( status )) { |
134 | case SIGINT : | 135 | case SIGINT : |
135 | case SIGTERM: | 136 | case SIGTERM: |
136 | case SIGKILL: | 137 | case SIGKILL: |
137 | break; | 138 | break; |
138 | 139 | ||
139 | default : | 140 | default : |
140 | killedbysig = WTERMSIG( status ); | 141 | killedbysig = WTERMSIG( status ); |
141 | break; | 142 | break; |
142 | } | 143 | } |
143 | } | 144 | } |
144 | if ( killedbysig ) { // qpe was killed by an uncaught signal | 145 | if ( killedbysig ) { // qpe was killed by an uncaught signal |
145 | qApp = 0; | 146 | qApp = 0; |
146 | 147 | ||
147 | QWSServer::setDesktopBackground ( QImage ( )); | 148 | QWSServer::setDesktopBackground ( QImage ( )); |
148 | QApplication *app = new QApplication ( argc, argv, QApplication::GuiServer ); | 149 | QApplication *app = new QApplication ( argc, argv, QApplication::GuiServer ); |
149 | app-> setFont ( QFont ( "Helvetica", 10 )); | 150 | app-> setFont ( QFont ( "Helvetica", 10 )); |
150 | app-> setStyle ( new QPEStyle ( )); | 151 | app-> setStyle ( new QPEStyle ( )); |
151 | 152 | ||
152 | const char *sig = ::strsignal ( killedbysig ); | 153 | const char *sig = ::strsignal ( killedbysig ); |
153 | QLabel *l = new QLabel ( 0, "sig", Qt::WStyle_Customize | Qt::WStyle_NoBorder | Qt::WStyle_Tool ); | 154 | QLabel *l = new QLabel ( 0, "sig", Qt::WStyle_Customize | Qt::WStyle_NoBorder | Qt::WStyle_Tool ); |
154 | l-> setText ( LoginWindowImpl::tr( "OPIE was terminated\nby an uncaught signal\n(%1)\n" ). arg ( sig )); | 155 | l-> setText ( LoginWindowImpl::tr( "OPIE was terminated\nby an uncaught signal\n(%1)\n" ). arg ( sig )); |
155 | l-> setAlignment ( Qt::AlignCenter ); | 156 | l-> setAlignment ( Qt::AlignCenter ); |
156 | l-> move ( 0, 0 ); | 157 | l-> move ( 0, 0 ); |
157 | l-> resize ( app-> desktop ( )-> width ( ), app-> desktop ( )-> height ( )); | 158 | l-> resize ( app-> desktop ( )-> width ( ), app-> desktop ( )-> height ( )); |
158 | l-> show ( ); | 159 | l-> show ( ); |
159 | QTimer::singleShot ( 3000, app, SLOT( quit ( ))); | 160 | QTimer::singleShot ( 3000, app, SLOT( quit ( ))); |
160 | app-> exec ( ); | 161 | app-> exec ( ); |
161 | delete app; | 162 | delete app; |
162 | qApp = 0; | 163 | qApp = 0; |
163 | } | 164 | } |
164 | } | 165 | } |
165 | else { | 166 | else { |
166 | if ( autolog ) { | 167 | if ( autolog ) { |
167 | LoginApplication::setLoginAs ( autolog ); | 168 | LoginApplication::setLoginAs ( autolog ); |
168 | 169 | ||
169 | if ( LoginApplication::changeIdentity ( )) | 170 | if ( LoginApplication::changeIdentity ( )) |
170 | ::exit ( LoginApplication::login ( )); | 171 | ::exit ( LoginApplication::login ( )); |
171 | else | 172 | else |
172 | ::exit ( 0 ); | 173 | ::exit ( 0 ); |
173 | } | 174 | } |
174 | else | 175 | else |
175 | ::exit ( login_main ( argc, argv )); | 176 | ::exit ( login_main ( argc, argv )); |
176 | } | 177 | } |
177 | } | 178 | } |
178 | return 0; | 179 | return 0; |
179 | } | 180 | } |
180 | 181 | ||
181 | void sigterm ( int /*sig*/ ) | 182 | void sigterm ( int /*sig*/ ) |
182 | { | 183 | { |
183 | ::exit ( 0 ); | 184 | ::exit ( 0 ); |
184 | } | 185 | } |
185 | 186 | ||
186 | 187 | ||
187 | void exit_closelog ( ) | 188 | void exit_closelog ( ) |
188 | { | 189 | { |
189 | ::closelog ( ); | 190 | ::closelog ( ); |
190 | } | 191 | } |
191 | 192 | ||
192 | 193 | ||
193 | class LoginScreenSaver : public QWSScreenSaver | 194 | class LoginScreenSaver : public QWSScreenSaver |
194 | { | 195 | { |
195 | public: | 196 | public: |
196 | LoginScreenSaver ( ) | 197 | LoginScreenSaver ( ) |
197 | { | 198 | { |
198 | m_lcd_status = true; | 199 | m_lcd_status = true; |
199 | 200 | ||
200 | m_backlight_bright = -1; | 201 | m_backlight_bright = -1; |
201 | m_backlight_forcedoff = false; | 202 | m_backlight_forcedoff = false; |
202 | 203 | ||
203 | // Make sure the LCD is in fact on, (if opie was killed while the LCD is off it would still be off) | 204 | // Make sure the LCD is in fact on, (if opie was killed while the LCD is off it would still be off) |
204 | ODevice::inst ( )-> setDisplayStatus ( true ); | 205 | ODevice::inst ( )-> setDisplayStatus ( true ); |
205 | } | 206 | } |
206 | void restore() | 207 | void restore() |
207 | { | 208 | { |
208 | if ( !m_lcd_status ) // We must have turned it off | 209 | if ( !m_lcd_status ) // We must have turned it off |
209 | ODevice::inst ( ) -> setDisplayStatus ( true ); | 210 | ODevice::inst ( ) -> setDisplayStatus ( true ); |
210 | 211 | ||
211 | setBacklight ( -3 ); | 212 | setBacklight ( -3 ); |
212 | } | 213 | } |
213 | bool save( int level ) | 214 | bool save( int level ) |
214 | { | 215 | { |
215 | switch ( level ) { | 216 | switch ( level ) { |
216 | case 0: | 217 | case 0: |
217 | if ( backlight() > 1 ) | 218 | if ( backlight() > 1 ) |
218 | setBacklight( 1 ); // lowest non-off | 219 | setBacklight( 1 ); // lowest non-off |
219 | return true; | 220 | return true; |
220 | break; | 221 | break; |
221 | case 1: | 222 | case 1: |
222 | setBacklight( 0 ); // off | 223 | setBacklight( 0 ); // off |
223 | return true; | 224 | return true; |
224 | break; | 225 | break; |
225 | case 2: | 226 | case 2: |
226 | // We're going to suspend the whole machine | 227 | // We're going to suspend the whole machine |
227 | if ( PowerStatusManager::readStatus().acStatus() != PowerStatus::Online ) { | 228 | if ( PowerStatusManager::readStatus().acStatus() != PowerStatus::Online ) { |
228 | QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE ); | 229 | QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE ); |
229 | return true; | 230 | return true; |
230 | } | 231 | } |
231 | break; | 232 | break; |
232 | } | 233 | } |
233 | return false; | 234 | return false; |
234 | } | 235 | } |
235 | 236 | ||
236 | private: | 237 | private: |
237 | public: | 238 | public: |
238 | void setIntervals( int i1 = 30, int i2 = 20, int i3 = 60 ) | 239 | void setIntervals( int i1 = 30, int i2 = 20, int i3 = 60 ) |
239 | { | 240 | { |
240 | int v [4]; | 241 | int v [4]; |
241 | 242 | ||
242 | v [ 0 ] = QMAX( 1000 * i1, 100 ); | 243 | v [ 0 ] = QMAX( 1000 * i1, 100 ); |
243 | v [ 1 ] = QMAX( 1000 * i2, 100 ); | 244 | v [ 1 ] = QMAX( 1000 * i2, 100 ); |
244 | v [ 2 ] = QMAX( 1000 * i3, 100 ); | 245 | v [ 2 ] = QMAX( 1000 * i3, 100 ); |
245 | v [ 3 ] = 0; | 246 | v [ 3 ] = 0; |
246 | 247 | ||
247 | if ( !i1 && !i2 && !i3 ) | 248 | if ( !i1 && !i2 && !i3 ) |
248 | QWSServer::setScreenSaverInterval ( 0 ); | 249 | QWSServer::setScreenSaverInterval ( 0 ); |
249 | else | 250 | else |
250 | QWSServer::setScreenSaverIntervals ( v ); | 251 | QWSServer::setScreenSaverIntervals ( v ); |
251 | } | 252 | } |
252 | 253 | ||
253 | int backlight ( ) | 254 | int backlight ( ) |
254 | { | 255 | { |
255 | if ( m_backlight_bright == -1 ) | 256 | if ( m_backlight_bright == -1 ) |
256 | m_backlight_bright = 255; | 257 | m_backlight_bright = 255; |
257 | 258 | ||
258 | return m_backlight_bright; | 259 | return m_backlight_bright; |
259 | } | 260 | } |
260 | 261 | ||
261 | void setBacklight ( int bright ) | 262 | void setBacklight ( int bright ) |
262 | { | 263 | { |
263 | if ( bright == -3 ) { | 264 | if ( bright == -3 ) { |
264 | // Forced on | 265 | // Forced on |
265 | m_backlight_forcedoff = false; | 266 | m_backlight_forcedoff = false; |
266 | bright = -1; | 267 | bright = -1; |
267 | } | 268 | } |
268 | if ( m_backlight_forcedoff && bright != -2 ) | 269 | if ( m_backlight_forcedoff && bright != -2 ) |
269 | return ; | 270 | return ; |
270 | if ( bright == -2 ) { | 271 | if ( bright == -2 ) { |
271 | // Toggle between off and on | 272 | // Toggle between off and on |
272 | bright = m_backlight_bright ? 0 : -1; | 273 | bright = m_backlight_bright ? 0 : -1; |
273 | m_backlight_forcedoff = !bright; | 274 | m_backlight_forcedoff = !bright; |
274 | } | 275 | } |
275 | 276 | ||
276 | m_backlight_bright = bright; | 277 | m_backlight_bright = bright; |
277 | 278 | ||
278 | bright = backlight ( ); | 279 | bright = backlight ( ); |
279 | ODevice::inst ( ) -> setDisplayBrightness ( bright ); | 280 | ODevice::inst ( ) -> setDisplayBrightness ( bright ); |
280 | 281 | ||
281 | m_backlight_bright = bright; | 282 | m_backlight_bright = bright; |
282 | } | 283 | } |
283 | 284 | ||
284 | private: | 285 | private: |
285 | bool m_lcd_status; | 286 | bool m_lcd_status; |
286 | 287 | ||
287 | int m_backlight_bright; | 288 | int m_backlight_bright; |
288 | bool m_backlight_forcedoff; | 289 | bool m_backlight_forcedoff; |
289 | }; | 290 | }; |
290 | 291 | ||
291 | 292 | ||
292 | 293 | ||
293 | 294 | ||
294 | int login_main ( int argc, char **argv ) | 295 | int login_main ( int argc, char **argv ) |
295 | { | 296 | { |
296 | QWSServer::setDesktopBackground( QImage() ); | 297 | QWSServer::setDesktopBackground( QImage() ); |
297 | LoginApplication *app = new LoginApplication ( argc, argv ); | 298 | LoginApplication *app = new LoginApplication ( argc, argv ); |
298 | 299 | ||
299 | app-> setFont ( QFont ( "Helvetica", 10 )); | 300 | app-> setFont ( QFont ( "Helvetica", 10 )); |
300 | app-> setStyle ( new QPEStyle ( )); | 301 | app-> setStyle ( new QPEStyle ( )); |
301 | 302 | ||
302 | ODevice::inst ( )-> setSoftSuspend ( true ); | 303 | ODevice::inst ( )-> setSoftSuspend ( true ); |
303 | 304 | ||
304 | #if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) | 305 | #if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) |
305 | if ( !QFile::exists ( "/etc/pointercal" )) { | 306 | if ( !QFile::exists ( "/etc/pointercal" )) { |
306 | // Make sure calibration widget starts on top. | 307 | // Make sure calibration widget starts on top. |
307 | Calibrate *cal = new Calibrate; | 308 | Calibrate *cal = new Calibrate; |
308 | cal-> exec ( ); | 309 | cal-> exec ( ); |
309 | delete cal; | 310 | delete cal; |
310 | } | 311 | } |
311 | #endif | 312 | #endif |
312 | 313 | ||
313 | LoginScreenSaver *saver = new LoginScreenSaver; | 314 | LoginScreenSaver *saver = new LoginScreenSaver; |
314 | 315 | ||
315 | saver-> setIntervals ( ); | 316 | saver-> setIntervals ( ); |
316 | QWSServer::setScreenSaver ( saver ); | 317 | QWSServer::setScreenSaver ( saver ); |
317 | saver-> restore ( ); | 318 | saver-> restore ( ); |
318 | 319 | ||
319 | 320 | ||
320 | LoginWindowImpl *lw = new LoginWindowImpl ( ); | 321 | LoginWindowImpl *lw = new LoginWindowImpl ( ); |
321 | app-> setMainWidget ( lw ); | 322 | app-> setMainWidget ( lw ); |
322 | lw-> setGeometry ( 0, 0, app-> desktop ( )-> width ( ), app-> desktop ( )-> height ( )); | 323 | lw-> setGeometry ( 0, 0, app-> desktop ( )-> width ( ), app-> desktop ( )-> height ( )); |
323 | lw-> show ( ); | 324 | lw-> show ( ); |
324 | 325 | ||
325 | int rc = app-> exec ( ); | 326 | int rc = app-> exec ( ); |
326 | 327 | ||
327 | ODevice::inst ( )-> setSoftSuspend ( false ); | 328 | ODevice::inst ( )-> setSoftSuspend ( false ); |
328 | 329 | ||
329 | if ( app-> loginAs ( )) { | 330 | if ( app-> loginAs ( )) { |
330 | if ( app-> changeIdentity ( )) { | 331 | if ( app-> changeIdentity ( )) { |
331 | app-> login ( ); | 332 | app-> login ( ); |
332 | 333 | ||
333 | // if login succeeds, it never comes back | 334 | // if login succeeds, it never comes back |
334 | 335 | ||
335 | QMessageBox::critical ( 0, LoginWindowImpl::tr( "Failure" ), LoginWindowImpl::tr( "Could not start OPIE." )); | 336 | QMessageBox::critical ( 0, LoginWindowImpl::tr( "Failure" ), LoginWindowImpl::tr( "Could not start OPIE." )); |
336 | rc = 1; | 337 | rc = 1; |
337 | } | 338 | } |
338 | else { | 339 | else { |
339 | QMessageBox::critical ( 0, LoginWindowImpl::tr( "Failure" ), LoginWindowImpl::tr( "Could not switch to new user identity" )); | 340 | QMessageBox::critical ( 0, LoginWindowImpl::tr( "Failure" ), LoginWindowImpl::tr( "Could not switch to new user identity" )); |
340 | rc = 2; | 341 | rc = 2; |
341 | } | 342 | } |
342 | 343 | ||
343 | } | 344 | } |
344 | return rc; | 345 | return rc; |
345 | } | 346 | } |
346 | 347 | ||