-rw-r--r-- | core/opie-login/loginwindowimpl.cpp | 3 | ||||
-rw-r--r-- | core/opie-login/main.cpp | 13 |
2 files changed, 8 insertions, 8 deletions
diff --git a/core/opie-login/loginwindowimpl.cpp b/core/opie-login/loginwindowimpl.cpp index f24ebb3..63baaa6 100644 --- a/core/opie-login/loginwindowimpl.cpp +++ b/core/opie-login/loginwindowimpl.cpp | |||
@@ -13,48 +13,51 @@ | |||
13 | #include <qpe/qcopenvelope_qws.h> | 13 | #include <qpe/qcopenvelope_qws.h> |
14 | 14 | ||
15 | #include <opie/odevice.h> | 15 | #include <opie/odevice.h> |
16 | 16 | ||
17 | #include <stdio.h> | 17 | #include <stdio.h> |
18 | 18 | ||
19 | #include <pwd.h> | 19 | #include <pwd.h> |
20 | #include <grp.h> | 20 | #include <grp.h> |
21 | #include <unistd.h> | 21 | #include <unistd.h> |
22 | #include <stdlib.h> | 22 | #include <stdlib.h> |
23 | #include <signal.h> | 23 | #include <signal.h> |
24 | 24 | ||
25 | #ifdef USEPAM | 25 | #ifdef USEPAM |
26 | extern "C" { | 26 | extern "C" { |
27 | #include <security/pam_appl.h> | 27 | #include <security/pam_appl.h> |
28 | } | 28 | } |
29 | #else | 29 | #else |
30 | #include <crypt.h> | 30 | #include <crypt.h> |
31 | #include <shadow.h> | 31 | #include <shadow.h> |
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | #include "loginwindowimpl.h" | 34 | #include "loginwindowimpl.h" |
35 | #include "inputmethods.h" | 35 | #include "inputmethods.h" |
36 | 36 | ||
37 | using namespace Opie; | ||
38 | |||
39 | |||
37 | LoginWindowImpl::LoginWindowImpl ( ) : LoginWindow ( 0, "LOGIN-WINDOW", WStyle_Customize | WStyle_NoBorder | WDestructiveClose ) | 40 | LoginWindowImpl::LoginWindowImpl ( ) : LoginWindow ( 0, "LOGIN-WINDOW", WStyle_Customize | WStyle_NoBorder | WDestructiveClose ) |
38 | { | 41 | { |
39 | QPopupMenu *pop = new QPopupMenu ( this ); | 42 | QPopupMenu *pop = new QPopupMenu ( this ); |
40 | pop-> insertItem ( tr( "Restart" ), this, SLOT( restart ( ))); | 43 | pop-> insertItem ( tr( "Restart" ), this, SLOT( restart ( ))); |
41 | pop-> insertItem ( tr( "Quit" ), this, SLOT( quit ( ))); | 44 | pop-> insertItem ( tr( "Quit" ), this, SLOT( quit ( ))); |
42 | m_menu-> setPopup ( pop ); | 45 | m_menu-> setPopup ( pop ); |
43 | 46 | ||
44 | QHBoxLayout *lay = new QHBoxLayout ( m_taskbar, 4, 4 ); | 47 | QHBoxLayout *lay = new QHBoxLayout ( m_taskbar, 4, 4 ); |
45 | m_input = new InputMethods ( m_taskbar ); | 48 | m_input = new InputMethods ( m_taskbar ); |
46 | lay-> addWidget ( m_input ); | 49 | lay-> addWidget ( m_input ); |
47 | lay-> addStretch ( 10 ); | 50 | lay-> addStretch ( 10 ); |
48 | 51 | ||
49 | setActiveWindow ( ); | 52 | setActiveWindow ( ); |
50 | m_password-> setFocus ( ); | 53 | m_password-> setFocus ( ); |
51 | 54 | ||
52 | m_user-> insertStringList ( getAllUsers ( )); | 55 | m_user-> insertStringList ( getAllUsers ( )); |
53 | 56 | ||
54 | QTimer::singleShot ( 0, this, SLOT( showIM ( ))); | 57 | QTimer::singleShot ( 0, this, SLOT( showIM ( ))); |
55 | 58 | ||
56 | QString opiedir = ::getenv ( "OPIEDIR" ); | 59 | QString opiedir = ::getenv ( "OPIEDIR" ); |
57 | QPixmap bgpix ( opiedir + "/pics/launcher/opie-background.jpg" ); | 60 | QPixmap bgpix ( opiedir + "/pics/launcher/opie-background.jpg" ); |
58 | 61 | ||
59 | if ( !bgpix. isNull ( )) | 62 | if ( !bgpix. isNull ( )) |
60 | setBackgroundPixmap ( bgpix ); | 63 | setBackgroundPixmap ( bgpix ); |
diff --git a/core/opie-login/main.cpp b/core/opie-login/main.cpp index 718009a..df9451d 100644 --- a/core/opie-login/main.cpp +++ b/core/opie-login/main.cpp | |||
@@ -1,47 +1,49 @@ | |||
1 | #include <sys/time.h> | 1 | #include <sys/time.h> |
2 | #include <sys/resource.h> | 2 | #include <sys/resource.h> |
3 | #include <unistd.h> | 3 | #include <unistd.h> |
4 | #include <syslog.h> | 4 | #include <syslog.h> |
5 | #include <sys/types.h> | 5 | #include <sys/types.h> |
6 | #include <sys/wait.h> | 6 | #include <sys/wait.h> |
7 | #include <stdio.h> | 7 | #include <stdio.h> |
8 | #include <stdlib.h> | 8 | #include <stdlib.h> |
9 | #include <signal.h> | 9 | #include <signal.h> |
10 | 10 | ||
11 | #include <qpe/qpeapplication.h> | 11 | #include <qpe/qpeapplication.h> |
12 | #include <qpe/qcopenvelope_qws.h> | 12 | #include <qpe/qcopenvelope_qws.h> |
13 | #include <qpe/qpestyle.h> | 13 | #include <qpe/qpestyle.h> |
14 | #include <qpe/power.h> | 14 | #include <qpe/power.h> |
15 | 15 | ||
16 | #include <opie/odevice.h> | 16 | #include <opie/odevice.h> |
17 | 17 | ||
18 | #include <qwindowsystem_qws.h> | 18 | #include <qwindowsystem_qws.h> |
19 | #include <qfile.h> | 19 | #include <qfile.h> |
20 | 20 | ||
21 | #include "loginwindowimpl.h" | 21 | #include "loginwindowimpl.h" |
22 | #include "calibrate.h" | 22 | #include "calibrate.h" |
23 | 23 | ||
24 | using namespace Opie; | ||
25 | |||
24 | int login_main ( int argc, char **argv ); | 26 | int login_main ( int argc, char **argv ); |
25 | void sigusr1 ( int sig ); | 27 | void sigusr1 ( int sig ); |
26 | void exit_closelog ( ); | 28 | void exit_closelog ( ); |
27 | 29 | ||
28 | 30 | ||
29 | 31 | ||
30 | int main ( int argc, char **argv ) | 32 | int main ( int argc, char **argv ) |
31 | { | 33 | { |
32 | if ( ::geteuid ( ) != 0 ) { | 34 | if ( ::geteuid ( ) != 0 ) { |
33 | ::fprintf ( stderr, "%s can only be executed by root. (or chmod +s)", argv [0] ); | 35 | ::fprintf ( stderr, "%s can only be executed by root. (or chmod +s)", argv [0] ); |
34 | return 1; | 36 | return 1; |
35 | } | 37 | } |
36 | 38 | ||
37 | //struct rlimit rl; | 39 | //struct rlimit rl; |
38 | //::getrlimit ( RLIMIT_NOFILE, &rl ); | 40 | //::getrlimit ( RLIMIT_NOFILE, &rl ); |
39 | 41 | ||
40 | //for ( unsigned int i = 0; i < rl. rlim_cur; i++ ) | 42 | //for ( unsigned int i = 0; i < rl. rlim_cur; i++ ) |
41 | // ::close ( i ); | 43 | // ::close ( i ); |
42 | 44 | ||
43 | ::setpgid ( 0, 0 ); | 45 | ::setpgid ( 0, 0 ); |
44 | ::setsid ( ); | 46 | ::setsid ( ); |
45 | 47 | ||
46 | ::signal ( SIGUSR1, sigusr1 ); | 48 | ::signal ( SIGUSR1, sigusr1 ); |
47 | 49 | ||
@@ -69,56 +71,56 @@ int main ( int argc, char **argv ) | |||
69 | } | 71 | } |
70 | 72 | ||
71 | void sigusr1 ( int /*sig*/ ) | 73 | void sigusr1 ( int /*sig*/ ) |
72 | { | 74 | { |
73 | ::exit ( 0 ); | 75 | ::exit ( 0 ); |
74 | } | 76 | } |
75 | 77 | ||
76 | void exit_closelog ( ) | 78 | void exit_closelog ( ) |
77 | { | 79 | { |
78 | ::closelog ( ); | 80 | ::closelog ( ); |
79 | } | 81 | } |
80 | 82 | ||
81 | 83 | ||
82 | class LoginScreenSaver : public QWSScreenSaver | 84 | class LoginScreenSaver : public QWSScreenSaver |
83 | { | 85 | { |
84 | public: | 86 | public: |
85 | LoginScreenSaver ( ) | 87 | LoginScreenSaver ( ) |
86 | { | 88 | { |
87 | m_lcd_status = true; | 89 | m_lcd_status = true; |
88 | 90 | ||
89 | m_backlight_bright = -1; | 91 | m_backlight_bright = -1; |
90 | m_backlight_forcedoff = false; | 92 | m_backlight_forcedoff = false; |
91 | 93 | ||
92 | // Make sure the LCD is in fact on, (if opie was killed while the LCD is off it would still be off) | 94 | // Make sure the LCD is in fact on, (if opie was killed while the LCD is off it would still be off) |
93 | ODevice::inst ( ) -> setDisplayStatus ( true ); | 95 | ODevice::inst ( )-> setDisplayStatus ( true ); |
94 | } | 96 | } |
95 | void restore() | 97 | void restore() |
96 | { | 98 | { |
97 | if ( !m_lcd_status ) // We must have turned it off | 99 | if ( !m_lcd_status ) // We must have turned it off |
98 | ODevice::inst ( ) -> setDisplayStatus ( true ); | 100 | ODevice::inst ( ) -> setDisplayStatus ( true ); |
99 | 101 | ||
100 | setBacklight ( -1 ); | 102 | setBacklight ( -3 ); |
101 | } | 103 | } |
102 | bool save( int level ) | 104 | bool save( int level ) |
103 | { | 105 | { |
104 | switch ( level ) { | 106 | switch ( level ) { |
105 | case 0: | 107 | case 0: |
106 | if ( backlight() > 1 ) | 108 | if ( backlight() > 1 ) |
107 | setBacklight( 1 ); // lowest non-off | 109 | setBacklight( 1 ); // lowest non-off |
108 | return true; | 110 | return true; |
109 | break; | 111 | break; |
110 | case 1: | 112 | case 1: |
111 | setBacklight( 0 ); // off | 113 | setBacklight( 0 ); // off |
112 | return true; | 114 | return true; |
113 | break; | 115 | break; |
114 | case 2: | 116 | case 2: |
115 | // We're going to suspend the whole machine | 117 | // We're going to suspend the whole machine |
116 | if ( PowerStatusManager::readStatus().acStatus() != PowerStatus::Online ) { | 118 | if ( PowerStatusManager::readStatus().acStatus() != PowerStatus::Online ) { |
117 | QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE ); | 119 | QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE ); |
118 | return true; | 120 | return true; |
119 | } | 121 | } |
120 | break; | 122 | break; |
121 | } | 123 | } |
122 | return false; | 124 | return false; |
123 | } | 125 | } |
124 | 126 | ||
@@ -168,57 +170,52 @@ public: | |||
168 | ODevice::inst ( ) -> setDisplayBrightness ( bright ); | 170 | ODevice::inst ( ) -> setDisplayBrightness ( bright ); |
169 | 171 | ||
170 | m_backlight_bright = bright; | 172 | m_backlight_bright = bright; |
171 | } | 173 | } |
172 | 174 | ||
173 | private: | 175 | private: |
174 | bool m_lcd_status; | 176 | bool m_lcd_status; |
175 | 177 | ||
176 | int m_backlight_bright; | 178 | int m_backlight_bright; |
177 | bool m_backlight_forcedoff; | 179 | bool m_backlight_forcedoff; |
178 | }; | 180 | }; |
179 | 181 | ||
180 | 182 | ||
181 | 183 | ||
182 | int login_main ( int argc, char **argv ) | 184 | int login_main ( int argc, char **argv ) |
183 | { | 185 | { |
184 | QWSServer::setDesktopBackground( QImage() ); | 186 | QWSServer::setDesktopBackground( QImage() ); |
185 | QPEApplication app ( argc, argv, QApplication::GuiServer ); | 187 | QPEApplication app ( argc, argv, QApplication::GuiServer ); |
186 | 188 | ||
187 | app. setFont ( QFont ( "Helvetica", 10 )); | 189 | app. setFont ( QFont ( "Helvetica", 10 )); |
188 | app. setStyle ( new QPEStyle ( )); | 190 | app. setStyle ( new QPEStyle ( )); |
189 | 191 | ||
190 | ODevice::inst ( )-> setSoftSuspend ( true ); | 192 | ODevice::inst ( )-> setSoftSuspend ( true ); |
191 | 193 | ||
192 | { | ||
193 | QCopEnvelope e("QPE/System", "setBacklight(int)" ); | ||
194 | e << -3; // Forced on | ||
195 | } | ||
196 | |||
197 | #if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) | 194 | #if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) |
198 | if ( !QFile::exists ( "/etc/pointercal" )) { | 195 | if ( !QFile::exists ( "/etc/pointercal" )) { |
199 | // Make sure calibration widget starts on top. | 196 | // Make sure calibration widget starts on top. |
200 | Calibrate *cal = new Calibrate; | 197 | Calibrate *cal = new Calibrate; |
201 | cal-> exec ( ); | 198 | cal-> exec ( ); |
202 | delete cal; | 199 | delete cal; |
203 | } | 200 | } |
204 | #endif | 201 | #endif |
205 | 202 | ||
206 | |||
207 | LoginScreenSaver *saver = new LoginScreenSaver; | 203 | LoginScreenSaver *saver = new LoginScreenSaver; |
208 | 204 | ||
209 | saver-> setIntervals ( ); | 205 | saver-> setIntervals ( ); |
210 | QWSServer::setScreenSaver ( saver ); | 206 | QWSServer::setScreenSaver ( saver ); |
207 | saver-> restore ( ); | ||
211 | 208 | ||
212 | 209 | ||
213 | LoginWindowImpl *lw = new LoginWindowImpl ( ); | 210 | LoginWindowImpl *lw = new LoginWindowImpl ( ); |
214 | app. setMainWidget ( lw ); | 211 | app. setMainWidget ( lw ); |
215 | lw-> setGeometry ( 0, 0, app. desktop ( )-> width ( ), app. desktop ( )-> height ( )); | 212 | lw-> setGeometry ( 0, 0, app. desktop ( )-> width ( ), app. desktop ( )-> height ( )); |
216 | lw-> show ( ); | 213 | lw-> show ( ); |
217 | 214 | ||
218 | int rc = app. exec ( ); | 215 | int rc = app. exec ( ); |
219 | 216 | ||
220 | ODevice::inst ( )-> setSoftSuspend ( false ); | 217 | ODevice::inst ( )-> setSoftSuspend ( false ); |
221 | 218 | ||
222 | return rc; | 219 | return rc; |
223 | } | 220 | } |
224 | 221 | ||