-rw-r--r-- | core/launcher/main.cpp | 7 | ||||
-rw-r--r-- | core/opie-login/main.cpp | 7 |
2 files changed, 1 insertions, 13 deletions
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp index 734d072..5bbed59 100644 --- a/core/launcher/main.cpp +++ b/core/launcher/main.cpp | |||
@@ -137,89 +137,82 @@ static bool firstUse() | |||
137 | FirstUse *fu = new FirstUse(); | 137 | FirstUse *fu = new FirstUse(); |
138 | fu->exec(); | 138 | fu->exec(); |
139 | bool rs = fu->restartNeeded(); | 139 | bool rs = fu->restartNeeded(); |
140 | delete fu; | 140 | delete fu; |
141 | return rs; | 141 | return rs; |
142 | } | 142 | } |
143 | 143 | ||
144 | int initApplication( int argc, char ** argv ) | 144 | int initApplication( int argc, char ** argv ) |
145 | { | 145 | { |
146 | cleanup(); | 146 | cleanup(); |
147 | initEnvironment(); | 147 | initEnvironment(); |
148 | 148 | ||
149 | #ifdef QWS | 149 | #ifdef QWS |
150 | QWSServer::setDesktopBackground( QImage() ); | 150 | QWSServer::setDesktopBackground( QImage() ); |
151 | #endif | 151 | #endif |
152 | ServerApplication a( argc, argv, QApplication::GuiServer ); | 152 | ServerApplication a( argc, argv, QApplication::GuiServer ); |
153 | initKeyboard(); | 153 | initKeyboard(); |
154 | 154 | ||
155 | if ( firstUse() ) | 155 | if ( firstUse() ) |
156 | { | 156 | { |
157 | a.restart(); | 157 | a.restart(); |
158 | return 0; | 158 | return 0; |
159 | } | 159 | } |
160 | 160 | ||
161 | #ifndef Q_OS_MACX | ||
162 | ODevice::inst()->setSoftSuspend( true ); | ||
163 | #endif | ||
164 | { | 161 | { |
165 | QCopEnvelope e("QPE/System", "setBacklight(int)" ); | 162 | QCopEnvelope e("QPE/System", "setBacklight(int)" ); |
166 | e << -3; // Forced on | 163 | e << -3; // Forced on |
167 | } | 164 | } |
168 | 165 | ||
169 | AlarmServer::initialize(); | 166 | AlarmServer::initialize(); |
170 | Server *s = new Server(); | 167 | Server *s = new Server(); |
171 | new SysFileMonitor(s); | 168 | new SysFileMonitor(s); |
172 | #ifdef QWS | 169 | #ifdef QWS |
173 | Network::createServer(s); | 170 | Network::createServer(s); |
174 | #endif | 171 | #endif |
175 | s->show(); | 172 | s->show(); |
176 | 173 | ||
177 | #if 0 | 174 | #if 0 |
178 | if ( QDate::currentDate().year() < 2005 ) | 175 | if ( QDate::currentDate().year() < 2005 ) |
179 | { | 176 | { |
180 | if ( QMessageBox::information ( 0, ServerApplication::tr( "Information" ), | 177 | if ( QMessageBox::information ( 0, ServerApplication::tr( "Information" ), |
181 | ServerApplication::tr( "<p>The system date doesn't seem to be valid.\n(%1)</p><p>Do you want to correct the clock ?</p>" ) | 178 | ServerApplication::tr( "<p>The system date doesn't seem to be valid.\n(%1)</p><p>Do you want to correct the clock ?</p>" ) |
182 | .arg( TimeString::dateString( QDate::currentDate())), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 179 | .arg( TimeString::dateString( QDate::currentDate())), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
183 | { | 180 | { |
184 | QCopEnvelope e ( "QPE/Application/systemtime", "setDocument(QString)" ); | 181 | QCopEnvelope e ( "QPE/Application/systemtime", "setDocument(QString)" ); |
185 | e << QString ( ); | 182 | e << QString ( ); |
186 | } | 183 | } |
187 | } | 184 | } |
188 | #endif | 185 | #endif |
189 | 186 | ||
190 | create_pidfile(); | 187 | create_pidfile(); |
191 | odebug << "--> mainloop in" << oendl; | 188 | odebug << "--> mainloop in" << oendl; |
192 | int rv = a.exec(); | 189 | int rv = a.exec(); |
193 | odebug << "<-- mainloop out" << oendl; | 190 | odebug << "<-- mainloop out" << oendl; |
194 | remove_pidfile(); | 191 | remove_pidfile(); |
195 | odebug << "removing server object..." << oendl; | 192 | odebug << "removing server object..." << oendl; |
196 | delete s; | 193 | delete s; |
197 | 194 | ||
198 | #ifndef Q_OS_MACX | ||
199 | ODevice::inst()->setSoftSuspend( false ); | ||
200 | #endif | ||
201 | |||
202 | odebug << "returning from qpe/initapplication..." << oendl; | 195 | odebug << "returning from qpe/initapplication..." << oendl; |
203 | return rv; | 196 | return rv; |
204 | } | 197 | } |
205 | 198 | ||
206 | static const char *pidfile_path = "/var/run/opie.pid"; | 199 | static const char *pidfile_path = "/var/run/opie.pid"; |
207 | 200 | ||
208 | void create_pidfile() | 201 | void create_pidfile() |
209 | { | 202 | { |
210 | FILE *f; | 203 | FILE *f; |
211 | 204 | ||
212 | if (( f = ::fopen( pidfile_path, "w" ))) { | 205 | if (( f = ::fopen( pidfile_path, "w" ))) { |
213 | ::fprintf( f, "%d", getpid ( )); | 206 | ::fprintf( f, "%d", getpid ( )); |
214 | ::fclose( f ); | 207 | ::fclose( f ); |
215 | } | 208 | } |
216 | else | 209 | else |
217 | { | 210 | { |
218 | odebug << "couldn't create pidfile: " << strerror( errno ) << oendl; | 211 | odebug << "couldn't create pidfile: " << strerror( errno ) << oendl; |
219 | } | 212 | } |
220 | } | 213 | } |
221 | 214 | ||
222 | void remove_pidfile() | 215 | void remove_pidfile() |
223 | { | 216 | { |
224 | ::unlink( pidfile_path ); | 217 | ::unlink( pidfile_path ); |
225 | } | 218 | } |
diff --git a/core/opie-login/main.cpp b/core/opie-login/main.cpp index 0699d0a..2de0180 100644 --- a/core/opie-login/main.cpp +++ b/core/opie-login/main.cpp | |||
@@ -171,50 +171,49 @@ int main ( int argc, char **argv ) | |||
171 | l-> setAlignment ( Qt::AlignCenter ); | 171 | l-> setAlignment ( Qt::AlignCenter ); |
172 | l-> move ( 0, 0 ); | 172 | l-> move ( 0, 0 ); |
173 | l-> resize ( app-> desktop ( )-> width ( ), app-> desktop ( )-> height ( )); | 173 | l-> resize ( app-> desktop ( )-> width ( ), app-> desktop ( )-> height ( )); |
174 | l-> show ( ); | 174 | l-> show ( ); |
175 | QTimer::singleShot ( 3000, app, SLOT( quit())); | 175 | QTimer::singleShot ( 3000, app, SLOT( quit())); |
176 | app-> exec ( ); | 176 | app-> exec ( ); |
177 | delete app; | 177 | delete app; |
178 | qApp = 0; | 178 | qApp = 0; |
179 | } | 179 | } |
180 | } | 180 | } |
181 | else { | 181 | else { |
182 | if ( !autolog ) { | 182 | if ( !autolog ) { |
183 | QString confFile=QPEApplication::qpeDir() + "etc/opie-login.conf"; | 183 | QString confFile=QPEApplication::qpeDir() + "etc/opie-login.conf"; |
184 | Config cfg ( confFile, Config::File ); | 184 | Config cfg ( confFile, Config::File ); |
185 | cfg. setGroup ( "General" ); | 185 | cfg. setGroup ( "General" ); |
186 | QString user = cfg. readEntry ( "AutoLogin" ); | 186 | QString user = cfg. readEntry ( "AutoLogin" ); |
187 | 187 | ||
188 | if ( !user. isEmpty ( )) | 188 | if ( !user. isEmpty ( )) |
189 | autolog = ::strdup ( user. latin1 ( )); | 189 | autolog = ::strdup ( user. latin1 ( )); |
190 | } | 190 | } |
191 | 191 | ||
192 | if ( autolog && !userExited ) { | 192 | if ( autolog && !userExited ) { |
193 | 193 | ||
194 | QWSServer::setDesktopBackground( QImage() ); | 194 | QWSServer::setDesktopBackground( QImage() ); |
195 | ODevice::inst ( )-> setDisplayStatus ( true ); | 195 | ODevice::inst()->setDisplayStatus( true ); |
196 | ODevice::inst ( )-> setSoftSuspend ( false ); | ||
197 | LoginApplication *app = new LoginApplication ( argc, argv, ppid ); | 196 | LoginApplication *app = new LoginApplication ( argc, argv, ppid ); |
198 | LoginApplication::setLoginAs ( autolog ); | 197 | LoginApplication::setLoginAs ( autolog ); |
199 | 198 | ||
200 | 199 | ||
201 | if ( LoginApplication::changeIdentity ( )) | 200 | if ( LoginApplication::changeIdentity ( )) |
202 | ::exit ( LoginApplication::login ( )); | 201 | ::exit ( LoginApplication::login ( )); |
203 | else | 202 | else |
204 | ::exit ( 0 ); | 203 | ::exit ( 0 ); |
205 | } | 204 | } |
206 | else { | 205 | else { |
207 | ::exit ( login_main ( argc, argv, ppid )); | 206 | ::exit ( login_main ( argc, argv, ppid )); |
208 | } | 207 | } |
209 | } | 208 | } |
210 | } | 209 | } |
211 | return 0; | 210 | return 0; |
212 | } | 211 | } |
213 | 212 | ||
214 | void sigterm ( int /*sig*/ ) | 213 | void sigterm ( int /*sig*/ ) |
215 | { | 214 | { |
216 | ::exit ( 0 ); | 215 | ::exit ( 0 ); |
217 | } | 216 | } |
218 | 217 | ||
219 | 218 | ||
220 | void exit_closelog ( ) | 219 | void exit_closelog ( ) |
@@ -314,70 +313,66 @@ public: | |||
314 | m_backlight_bright = bright; | 313 | m_backlight_bright = bright; |
315 | } | 314 | } |
316 | 315 | ||
317 | private: | 316 | private: |
318 | bool m_lcd_status; | 317 | bool m_lcd_status; |
319 | 318 | ||
320 | int m_backlight_bright; | 319 | int m_backlight_bright; |
321 | bool m_backlight_forcedoff; | 320 | bool m_backlight_forcedoff; |
322 | }; | 321 | }; |
323 | 322 | ||
324 | 323 | ||
325 | namespace Opie { extern int force_appearance; } // HACK to get around the force-style setting | 324 | namespace Opie { extern int force_appearance; } // HACK to get around the force-style setting |
326 | 325 | ||
327 | 326 | ||
328 | int login_main ( int argc, char **argv, pid_t ppid ) | 327 | int login_main ( int argc, char **argv, pid_t ppid ) |
329 | { | 328 | { |
330 | QWSServer::setDesktopBackground( QImage() ); | 329 | QWSServer::setDesktopBackground( QImage() ); |
331 | LoginApplication *app = new LoginApplication ( argc, argv, ppid ); | 330 | LoginApplication *app = new LoginApplication ( argc, argv, ppid ); |
332 | 331 | ||
333 | Opie::force_appearance = 0; | 332 | Opie::force_appearance = 0; |
334 | 333 | ||
335 | app-> setFont ( QFont ( "Helvetica", 10 )); | 334 | app-> setFont ( QFont ( "Helvetica", 10 )); |
336 | app-> setStyle ( new QPEStyle ( )); | 335 | app-> setStyle ( new QPEStyle ( )); |
337 | 336 | ||
338 | ODevice::inst ( )-> setSoftSuspend ( true ); | ||
339 | |||
340 | if ( QWSServer::mouseHandler() && | 337 | if ( QWSServer::mouseHandler() && |
341 | QWSServer::mouseHandler() ->inherits("QCalibratedMouseHandler") ) { | 338 | QWSServer::mouseHandler() ->inherits("QCalibratedMouseHandler") ) { |
342 | if ( !QFile::exists ( "/etc/pointercal" )) { | 339 | if ( !QFile::exists ( "/etc/pointercal" )) { |
343 | // Make sure calibration widget starts on top. | 340 | // Make sure calibration widget starts on top. |
344 | Calibrate *cal = new Calibrate; | 341 | Calibrate *cal = new Calibrate; |
345 | cal-> exec ( ); | 342 | cal-> exec ( ); |
346 | delete cal; | 343 | delete cal; |
347 | } | 344 | } |
348 | } | 345 | } |
349 | 346 | ||
350 | LoginScreenSaver *saver = new LoginScreenSaver; | 347 | LoginScreenSaver *saver = new LoginScreenSaver; |
351 | 348 | ||
352 | saver-> setIntervals ( ); | 349 | saver-> setIntervals ( ); |
353 | QWSServer::setScreenSaver ( saver ); | 350 | QWSServer::setScreenSaver ( saver ); |
354 | saver-> restore ( ); | 351 | saver-> restore ( ); |
355 | 352 | ||
356 | 353 | ||
357 | LoginWindowImpl *lw = new LoginWindowImpl ( ); | 354 | LoginWindowImpl *lw = new LoginWindowImpl ( ); |
358 | app-> setMainWidget ( lw ); | 355 | app-> setMainWidget ( lw ); |
359 | lw-> setGeometry ( 0, 0, app-> desktop ( )-> width ( ), app-> desktop ( )-> height ( )); | 356 | lw-> setGeometry ( 0, 0, app-> desktop ( )-> width ( ), app-> desktop ( )-> height ( )); |
360 | lw-> show ( ); | 357 | lw-> show ( ); |
361 | 358 | ||
362 | int rc = app-> exec ( ); | 359 | int rc = app-> exec ( ); |
363 | 360 | ||
364 | ODevice::inst ( )-> setSoftSuspend ( false ); | ||
365 | |||
366 | if ( app-> loginAs ( )) { | 361 | if ( app-> loginAs ( )) { |
367 | if ( app-> changeIdentity ( )) { | 362 | if ( app-> changeIdentity ( )) { |
368 | app-> login ( ); | 363 | app-> login ( ); |
369 | 364 | ||
370 | // if login succeeds, it never comes back | 365 | // if login succeeds, it never comes back |
371 | 366 | ||
372 | QMessageBox::critical ( 0, LoginWindowImpl::tr( "Failure" ), LoginWindowImpl::tr( "Could not start Opie." )); | 367 | QMessageBox::critical ( 0, LoginWindowImpl::tr( "Failure" ), LoginWindowImpl::tr( "Could not start Opie." )); |
373 | rc = 1; | 368 | rc = 1; |
374 | } | 369 | } |
375 | else { | 370 | else { |
376 | QMessageBox::critical ( 0, LoginWindowImpl::tr( "Failure" ), LoginWindowImpl::tr( "Could not switch to new user identity" )); | 371 | QMessageBox::critical ( 0, LoginWindowImpl::tr( "Failure" ), LoginWindowImpl::tr( "Could not switch to new user identity" )); |
377 | rc = 2; | 372 | rc = 2; |
378 | } | 373 | } |
379 | 374 | ||
380 | } | 375 | } |
381 | return rc; | 376 | return rc; |
382 | } | 377 | } |
383 | 378 | ||