author | waspe <waspe> | 2003-11-03 17:56:32 (UTC) |
---|---|---|
committer | waspe <waspe> | 2003-11-03 17:56:32 (UTC) |
commit | 9ce566fd5b280622670cf7b0e158f9d9c54e6e9a (patch) (unidiff) | |
tree | a87bc5fa9890457809f457d82c6811835cdebe91 | |
parent | 6d7e3e8b04b63d92c61d1109c35163690f2c9948 (diff) | |
download | opie-9ce566fd5b280622670cf7b0e158f9d9c54e6e9a.zip opie-9ce566fd5b280622670cf7b0e158f9d9c54e6e9a.tar.gz opie-9ce566fd5b280622670cf7b0e158f9d9c54e6e9a.tar.bz2 |
resolved merge conflict
-rw-r--r-- | core/apps/helpbrowser/main.cpp | 11 | ||||
-rw-r--r-- | core/opie-login/main.cpp | 1 |
2 files changed, 2 insertions, 10 deletions
diff --git a/core/apps/helpbrowser/main.cpp b/core/apps/helpbrowser/main.cpp index b1bea56..dc82e93 100644 --- a/core/apps/helpbrowser/main.cpp +++ b/core/apps/helpbrowser/main.cpp | |||
@@ -1,33 +1,26 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "helpbrowser.h" | 21 | #include "helpbrowser.h" |
22 | 22 | ||
23 | #include <qtopia/qpeapplication.h> | 23 | #include <qtopia/qpeapplication.h> |
24 | #include <opie/oapplicationfactory.h> | ||
24 | 25 | ||
25 | int main( int argc, char ** argv ) | 26 | OPIE_EXPORT_APP( OApplicationFactory<HelpBrowser> ) |
26 | { | ||
27 | QPEApplication a( argc, argv ); | ||
28 | |||
29 | HelpBrowser mw; | ||
30 | a.showMainWidget( &mw ); | ||
31 | |||
32 | return a.exec(); | ||
33 | } | ||
diff --git a/core/opie-login/main.cpp b/core/opie-login/main.cpp index 2103216..5ecde1e 100644 --- a/core/opie-login/main.cpp +++ b/core/opie-login/main.cpp | |||
@@ -107,193 +107,192 @@ int main ( int argc, char **argv ) | |||
107 | ::setpgid ( 0, 0 ); | 107 | ::setpgid ( 0, 0 ); |
108 | ::setsid ( ); | 108 | ::setsid ( ); |
109 | 109 | ||
110 | ::signal ( SIGTERM, sigterm ); | 110 | ::signal ( SIGTERM, sigterm ); |
111 | ::signal ( SIGINT, sigterm ); | 111 | ::signal ( SIGINT, sigterm ); |
112 | 112 | ||
113 | ::openlog ( "opie-login", LOG_CONS, LOG_AUTHPRIV ); | 113 | ::openlog ( "opie-login", LOG_CONS, LOG_AUTHPRIV ); |
114 | ::atexit ( exit_closelog ); | 114 | ::atexit ( exit_closelog ); |
115 | 115 | ||
116 | while ( true ) { | 116 | while ( true ) { |
117 | pid_t child = ::fork ( ); | 117 | pid_t child = ::fork ( ); |
118 | 118 | ||
119 | if ( child < 0 ) { | 119 | if ( child < 0 ) { |
120 | ::syslog ( LOG_ERR, "Could not fork GUI process\n" ); | 120 | ::syslog ( LOG_ERR, "Could not fork GUI process\n" ); |
121 | break; | 121 | break; |
122 | } | 122 | } |
123 | else if ( child > 0 ) { | 123 | else if ( child > 0 ) { |
124 | int status = 0; | 124 | int status = 0; |
125 | time_t started = ::time ( 0 ); | 125 | time_t started = ::time ( 0 ); |
126 | 126 | ||
127 | while ( ::waitpid ( child, &status, 0 ) < 0 ) { } | 127 | while ( ::waitpid ( child, &status, 0 ) < 0 ) { } |
128 | 128 | ||
129 | LoginApplication::logout ( ); | 129 | LoginApplication::logout ( ); |
130 | 130 | ||
131 | if (( ::time ( 0 ) - started ) < 3 ) { | 131 | if (( ::time ( 0 ) - started ) < 3 ) { |
132 | if ( autolog ) { | 132 | if ( autolog ) { |
133 | ::syslog ( LOG_ERR, "Respawning too fast -- disabling auto-login\n" ); | 133 | ::syslog ( LOG_ERR, "Respawning too fast -- disabling auto-login\n" ); |
134 | autolog = 0; | 134 | autolog = 0; |
135 | } | 135 | } |
136 | else { | 136 | else { |
137 | ::syslog ( LOG_ERR, "Respawning too fast -- going down\n" ); | 137 | ::syslog ( LOG_ERR, "Respawning too fast -- going down\n" ); |
138 | break; | 138 | break; |
139 | } | 139 | } |
140 | } | 140 | } |
141 | int killedbysig = 0; | 141 | int killedbysig = 0; |
142 | userExited=0; | 142 | userExited=0; |
143 | if (WIFEXITED(status)!=0 ) { | 143 | if (WIFEXITED(status)!=0 ) { |
144 | if (WEXITSTATUS(status)==137) { | 144 | if (WEXITSTATUS(status)==137) { |
145 | userExited=1; | 145 | userExited=1; |
146 | } | 146 | } |
147 | } | 147 | } |
148 | 148 | ||
149 | if ( WIFSIGNALED( status )) { | 149 | if ( WIFSIGNALED( status )) { |
150 | switch ( WTERMSIG( status )) { | 150 | switch ( WTERMSIG( status )) { |
151 | case SIGTERM: | 151 | case SIGTERM: |
152 | case SIGINT : | 152 | case SIGINT : |
153 | case SIGKILL: | 153 | case SIGKILL: |
154 | break; | 154 | break; |
155 | 155 | ||
156 | default : | 156 | default : |
157 | killedbysig = WTERMSIG( status ); | 157 | killedbysig = WTERMSIG( status ); |
158 | break; | 158 | break; |
159 | } | 159 | } |
160 | } | 160 | } |
161 | if ( killedbysig ) { // qpe was killed by an uncaught signal | 161 | if ( killedbysig ) { // qpe was killed by an uncaught signal |
162 | qApp = 0; | 162 | qApp = 0; |
163 | 163 | ||
164 | ::syslog ( LOG_ERR, "Opie was killed by a signal #%d", killedbysig ); | 164 | ::syslog ( LOG_ERR, "Opie was killed by a signal #%d", killedbysig ); |
165 | 165 | ||
166 | QWSServer::setDesktopBackground ( QImage ( )); | 166 | QWSServer::setDesktopBackground ( QImage ( )); |
167 | QApplication *app = new QApplication ( argc, argv, QApplication::GuiServer ); | 167 | QApplication *app = new QApplication ( argc, argv, QApplication::GuiServer ); |
168 | app-> setFont ( QFont ( "Helvetica", 10 )); | 168 | app-> setFont ( QFont ( "Helvetica", 10 )); |
169 | app-> setStyle ( new QPEStyle ( )); | 169 | app-> setStyle ( new QPEStyle ( )); |
170 | 170 | ||
171 | const char *sig = ::strsignal ( killedbysig ); | 171 | const char *sig = ::strsignal ( killedbysig ); |
172 | 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 ); |
173 | 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 )); |
174 | l-> setAlignment ( Qt::AlignCenter ); | 174 | l-> setAlignment ( Qt::AlignCenter ); |
175 | l-> move ( 0, 0 ); | 175 | l-> move ( 0, 0 ); |
176 | l-> resize ( app-> desktop ( )-> width ( ), app-> desktop ( )-> height ( )); | 176 | l-> resize ( app-> desktop ( )-> width ( ), app-> desktop ( )-> height ( )); |
177 | l-> show ( ); | 177 | l-> show ( ); |
178 | QTimer::singleShot ( 3000, app, SLOT( quit ( ))); | 178 | QTimer::singleShot ( 3000, app, SLOT( quit ( ))); |
179 | app-> exec ( ); | 179 | app-> exec ( ); |
180 | delete app; | 180 | delete app; |
181 | qApp = 0; | 181 | qApp = 0; |
182 | } | 182 | } |
183 | } | 183 | } |
184 | else { | 184 | else { |
185 | if ( !autolog ) { | 185 | if ( !autolog ) { |
186 | QString confFile=QPEApplication::qpeDir() + "/etc/opie-login.conf"; | 186 | QString confFile=QPEApplication::qpeDir() + "/etc/opie-login.conf"; |
187 | Config cfg ( confFile, Config::File ); | 187 | Config cfg ( confFile, Config::File ); |
188 | cfg. setGroup ( "General" ); | 188 | cfg. setGroup ( "General" ); |
189 | QString user = cfg. readEntry ( "AutoLogin" ); | 189 | QString user = cfg. readEntry ( "AutoLogin" ); |
190 | 190 | ||
191 | if ( !user. isEmpty ( )) | 191 | if ( !user. isEmpty ( )) |
192 | autolog = ::strdup ( user. latin1 ( )); | 192 | autolog = ::strdup ( user. latin1 ( )); |
193 | } | 193 | } |
194 | 194 | ||
195 | if ( autolog && !userExited ) { | 195 | if ( autolog && !userExited ) { |
196 | 196 | ||
197 | QWSServer::setDesktopBackground( QImage() ); | 197 | QWSServer::setDesktopBackground( QImage() ); |
198 | ODevice::inst ( )-> setDisplayStatus ( true ); | 198 | ODevice::inst ( )-> setDisplayStatus ( true ); |
199 | ODevice::inst ( )-> setSoftSuspend ( false ); | 199 | ODevice::inst ( )-> setSoftSuspend ( false ); |
200 | LoginApplication *app = new LoginApplication ( argc, argv, ppid ); | 200 | LoginApplication *app = new LoginApplication ( argc, argv, ppid ); |
201 | LoginApplication::setLoginAs ( autolog ); | 201 | LoginApplication::setLoginAs ( autolog ); |
202 | 202 | ||
203 | |||
204 | if ( LoginApplication::changeIdentity ( )) | 203 | if ( LoginApplication::changeIdentity ( )) |
205 | ::exit ( LoginApplication::login ( )); | 204 | ::exit ( LoginApplication::login ( )); |
206 | else | 205 | else |
207 | ::exit ( 0 ); | 206 | ::exit ( 0 ); |
208 | } | 207 | } |
209 | else { | 208 | else { |
210 | ::exit ( login_main ( argc, argv, ppid )); | 209 | ::exit ( login_main ( argc, argv, ppid )); |
211 | } | 210 | } |
212 | } | 211 | } |
213 | } | 212 | } |
214 | return 0; | 213 | return 0; |
215 | } | 214 | } |
216 | 215 | ||
217 | void sigterm ( int /*sig*/ ) | 216 | void sigterm ( int /*sig*/ ) |
218 | { | 217 | { |
219 | ::exit ( 0 ); | 218 | ::exit ( 0 ); |
220 | } | 219 | } |
221 | 220 | ||
222 | 221 | ||
223 | void exit_closelog ( ) | 222 | void exit_closelog ( ) |
224 | { | 223 | { |
225 | ::closelog ( ); | 224 | ::closelog ( ); |
226 | } | 225 | } |
227 | 226 | ||
228 | 227 | ||
229 | class LoginScreenSaver : public QWSScreenSaver | 228 | class LoginScreenSaver : public QWSScreenSaver |
230 | { | 229 | { |
231 | public: | 230 | public: |
232 | LoginScreenSaver ( ) | 231 | LoginScreenSaver ( ) |
233 | { | 232 | { |
234 | m_lcd_status = true; | 233 | m_lcd_status = true; |
235 | 234 | ||
236 | m_backlight_bright = -1; | 235 | m_backlight_bright = -1; |
237 | m_backlight_forcedoff = false; | 236 | m_backlight_forcedoff = false; |
238 | 237 | ||
239 | // Make sure the LCD is in fact on, (if opie was killed while the LCD is off it would still be off) | 238 | // Make sure the LCD is in fact on, (if opie was killed while the LCD is off it would still be off) |
240 | ODevice::inst ( )-> setDisplayStatus ( true ); | 239 | ODevice::inst ( )-> setDisplayStatus ( true ); |
241 | } | 240 | } |
242 | void restore() | 241 | void restore() |
243 | { | 242 | { |
244 | if ( !m_lcd_status ) // We must have turned it off | 243 | if ( !m_lcd_status ) // We must have turned it off |
245 | ODevice::inst ( ) -> setDisplayStatus ( true ); | 244 | ODevice::inst ( ) -> setDisplayStatus ( true ); |
246 | 245 | ||
247 | setBacklight ( -3 ); | 246 | setBacklight ( -3 ); |
248 | } | 247 | } |
249 | bool save( int level ) | 248 | bool save( int level ) |
250 | { | 249 | { |
251 | switch ( level ) { | 250 | switch ( level ) { |
252 | case 0: | 251 | case 0: |
253 | if ( backlight() > 1 ) | 252 | if ( backlight() > 1 ) |
254 | setBacklight( 1 ); // lowest non-off | 253 | setBacklight( 1 ); // lowest non-off |
255 | return true; | 254 | return true; |
256 | break; | 255 | break; |
257 | case 1: | 256 | case 1: |
258 | setBacklight( 0 ); // off | 257 | setBacklight( 0 ); // off |
259 | return true; | 258 | return true; |
260 | break; | 259 | break; |
261 | case 2: | 260 | case 2: |
262 | // We're going to suspend the whole machine | 261 | // We're going to suspend the whole machine |
263 | if ( PowerStatusManager::readStatus().acStatus() != PowerStatus::Online ) { | 262 | if ( PowerStatusManager::readStatus().acStatus() != PowerStatus::Online ) { |
264 | QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE ); | 263 | QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE ); |
265 | return true; | 264 | return true; |
266 | } | 265 | } |
267 | break; | 266 | break; |
268 | } | 267 | } |
269 | return false; | 268 | return false; |
270 | } | 269 | } |
271 | 270 | ||
272 | private: | 271 | private: |
273 | public: | 272 | public: |
274 | void setIntervals( int i1 = 30, int i2 = 20, int i3 = 60 ) | 273 | void setIntervals( int i1 = 30, int i2 = 20, int i3 = 60 ) |
275 | { | 274 | { |
276 | int v [4]; | 275 | int v [4]; |
277 | 276 | ||
278 | v [ 0 ] = QMAX( 1000 * i1, 100 ); | 277 | v [ 0 ] = QMAX( 1000 * i1, 100 ); |
279 | v [ 1 ] = QMAX( 1000 * i2, 100 ); | 278 | v [ 1 ] = QMAX( 1000 * i2, 100 ); |
280 | v [ 2 ] = QMAX( 1000 * i3, 100 ); | 279 | v [ 2 ] = QMAX( 1000 * i3, 100 ); |
281 | v [ 3 ] = 0; | 280 | v [ 3 ] = 0; |
282 | 281 | ||
283 | if ( !i1 && !i2 && !i3 ) | 282 | if ( !i1 && !i2 && !i3 ) |
284 | QWSServer::setScreenSaverInterval ( 0 ); | 283 | QWSServer::setScreenSaverInterval ( 0 ); |
285 | else | 284 | else |
286 | QWSServer::setScreenSaverIntervals ( v ); | 285 | QWSServer::setScreenSaverIntervals ( v ); |
287 | } | 286 | } |
288 | 287 | ||
289 | int backlight ( ) | 288 | int backlight ( ) |
290 | { | 289 | { |
291 | if ( m_backlight_bright == -1 ) | 290 | if ( m_backlight_bright == -1 ) |
292 | m_backlight_bright = 255; | 291 | m_backlight_bright = 255; |
293 | 292 | ||
294 | return m_backlight_bright; | 293 | return m_backlight_bright; |
295 | } | 294 | } |
296 | 295 | ||
297 | void setBacklight ( int bright ) | 296 | void setBacklight ( int bright ) |
298 | { | 297 | { |
299 | if ( bright == -3 ) { | 298 | if ( bright == -3 ) { |