-rw-r--r-- | core/opie-login/loginapplication.cpp | 27 | ||||
-rw-r--r-- | core/opie-login/loginapplication.h | 27 | ||||
-rw-r--r-- | core/opie-login/loginwindowimpl.cpp | 29 | ||||
-rw-r--r-- | core/opie-login/loginwindowimpl.h | 27 | ||||
-rw-r--r-- | core/opie-login/main.cpp | 27 |
5 files changed, 136 insertions, 1 deletions
diff --git a/core/opie-login/loginapplication.cpp b/core/opie-login/loginapplication.cpp index cd58c47..103d63b 100644 --- a/core/opie-login/loginapplication.cpp +++ b/core/opie-login/loginapplication.cpp | |||
@@ -1,48 +1,75 @@ | |||
1 | /* | ||
2 | =. This file is part of the OPIE Project | ||
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | ||
4 | .>+-= | ||
5 | _;:, .> :=|. This file is free software; you can | ||
6 | .> <`_, > . <= redistribute it and/or modify it under | ||
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
8 | .="- .-=="i, .._ License as published by the Free Software | ||
9 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
10 | ._= =} : or (at your option) any later version. | ||
11 | .%`+i> _;_. | ||
12 | .i_,=:_. -<s. This file is distributed in the hope that | ||
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
14 | : .. .:, . . . without even the implied warranty of | ||
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
17 | ..}^=.= = ; Public License for more details. | ||
18 | ++= -. .` .: | ||
19 | : = ...= . :.=- You should have received a copy of the GNU | ||
20 | -. .:....=;==+<; General Public License along with this file; | ||
21 | -_. . . )=. = see the file COPYING. If not, write to the | ||
22 | -- :-=` Free Software Foundation, Inc., | ||
23 | 59 Temple Place - Suite 330, | ||
24 | Boston, MA 02111-1307, USA. | ||
25 | |||
26 | */ | ||
27 | |||
1 | #include <pwd.h> | 28 | #include <pwd.h> |
2 | #include <grp.h> | 29 | #include <grp.h> |
3 | #include <unistd.h> | 30 | #include <unistd.h> |
4 | #include <stdlib.h> | 31 | #include <stdlib.h> |
5 | #include <signal.h> | 32 | #include <signal.h> |
6 | 33 | ||
7 | #ifdef USEPAM | 34 | #ifdef USEPAM |
8 | extern "C" { | 35 | extern "C" { |
9 | #include <security/pam_appl.h> | 36 | #include <security/pam_appl.h> |
10 | } | 37 | } |
11 | #else | 38 | #else |
12 | #include <crypt.h> | 39 | #include <crypt.h> |
13 | #include <shadow.h> | 40 | #include <shadow.h> |
14 | #endif | 41 | #endif |
15 | 42 | ||
16 | #include "loginapplication.h" | 43 | #include "loginapplication.h" |
17 | 44 | ||
18 | LoginApplication *lApp; | 45 | LoginApplication *lApp; |
19 | 46 | ||
20 | LoginApplication::LoginApplication ( int &argc, char **argv ) | 47 | LoginApplication::LoginApplication ( int &argc, char **argv ) |
21 | : QPEApplication ( argc, argv, GuiServer ) | 48 | : QPEApplication ( argc, argv, GuiServer ) |
22 | { | 49 | { |
23 | lApp = this; | 50 | lApp = this; |
24 | } | 51 | } |
25 | 52 | ||
26 | const char *LoginApplication::s_username = 0; | 53 | const char *LoginApplication::s_username = 0; |
27 | 54 | ||
28 | #ifdef USEPAM | 55 | #ifdef USEPAM |
29 | 56 | ||
30 | const char *LoginApplication::s_pam_password = 0; | 57 | const char *LoginApplication::s_pam_password = 0; |
31 | 58 | ||
32 | int LoginApplication::pam_helper ( int num_msg, const struct pam_message **msg, struct pam_response **resp, void * ) | 59 | int LoginApplication::pam_helper ( int num_msg, const struct pam_message **msg, struct pam_response **resp, void * ) |
33 | { | 60 | { |
34 | int replies = 0; | 61 | int replies = 0; |
35 | struct pam_response *reply = 0; | 62 | struct pam_response *reply = 0; |
36 | int size = sizeof( struct pam_response ); | 63 | int size = sizeof( struct pam_response ); |
37 | 64 | ||
38 | for ( int i = 0; i < num_msg; i++ ) { | 65 | for ( int i = 0; i < num_msg; i++ ) { |
39 | switch ( msg [i]-> msg_style ) { | 66 | switch ( msg [i]-> msg_style ) { |
40 | case PAM_PROMPT_ECHO_ON: // user name given to PAM already | 67 | case PAM_PROMPT_ECHO_ON: // user name given to PAM already |
41 | return PAM_CONV_ERR; | 68 | return PAM_CONV_ERR; |
42 | 69 | ||
43 | case PAM_PROMPT_ECHO_OFF: // wants password | 70 | case PAM_PROMPT_ECHO_OFF: // wants password |
44 | reply = (struct pam_response *) ::realloc ( reply, size ); | 71 | reply = (struct pam_response *) ::realloc ( reply, size ); |
45 | if ( !reply ) | 72 | if ( !reply ) |
46 | return PAM_CONV_ERR; | 73 | return PAM_CONV_ERR; |
47 | size += sizeof( struct pam_response ); | 74 | size += sizeof( struct pam_response ); |
48 | 75 | ||
diff --git a/core/opie-login/loginapplication.h b/core/opie-login/loginapplication.h index a709c5b..062c088 100644 --- a/core/opie-login/loginapplication.h +++ b/core/opie-login/loginapplication.h | |||
@@ -1,40 +1,67 @@ | |||
1 | /* | ||
2 | =. This file is part of the OPIE Project | ||
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | ||
4 | .>+-= | ||
5 | _;:, .> :=|. This file is free software; you can | ||
6 | .> <`_, > . <= redistribute it and/or modify it under | ||
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
8 | .="- .-=="i, .._ License as published by the Free Software | ||
9 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
10 | ._= =} : or (at your option) any later version. | ||
11 | .%`+i> _;_. | ||
12 | .i_,=:_. -<s. This file is distributed in the hope that | ||
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
14 | : .. .:, . . . without even the implied warranty of | ||
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
17 | ..}^=.= = ; Public License for more details. | ||
18 | ++= -. .` .: | ||
19 | : = ...= . :.=- You should have received a copy of the GNU | ||
20 | -. .:....=;==+<; General Public License along with this file; | ||
21 | -_. . . )=. = see the file COPYING. If not, write to the | ||
22 | -- :-=` Free Software Foundation, Inc., | ||
23 | 59 Temple Place - Suite 330, | ||
24 | Boston, MA 02111-1307, USA. | ||
25 | |||
26 | */ | ||
27 | |||
1 | #ifndef __OPIE_LOGINAPPLICATION_H__ | 28 | #ifndef __OPIE_LOGINAPPLICATION_H__ |
2 | #define __OPIE_LOGINAPPLICATION_H__ | 29 | #define __OPIE_LOGINAPPLICATION_H__ |
3 | 30 | ||
4 | #include <qstringlist.h> | 31 | #include <qstringlist.h> |
5 | 32 | ||
6 | #include <qpe/qpeapplication.h> | 33 | #include <qpe/qpeapplication.h> |
7 | 34 | ||
8 | #ifdef USEPAM | 35 | #ifdef USEPAM |
9 | struct pam_message; | 36 | struct pam_message; |
10 | struct pam_response; | 37 | struct pam_response; |
11 | #endif | 38 | #endif |
12 | 39 | ||
13 | class LoginApplication : public QPEApplication { | 40 | class LoginApplication : public QPEApplication { |
14 | public: | 41 | public: |
15 | LoginApplication ( int &argc, char **argv ); | 42 | LoginApplication ( int &argc, char **argv ); |
16 | 43 | ||
17 | static bool checkPassword ( const char *user, const char *password ); | 44 | static bool checkPassword ( const char *user, const char *password ); |
18 | 45 | ||
19 | static const char *loginAs ( ); | 46 | static const char *loginAs ( ); |
20 | static void setLoginAs ( const char *user ); | 47 | static void setLoginAs ( const char *user ); |
21 | 48 | ||
22 | static bool changeIdentity ( ); | 49 | static bool changeIdentity ( ); |
23 | static bool login ( ); | 50 | static bool login ( ); |
24 | 51 | ||
25 | static QStringList allUsers ( ); | 52 | static QStringList allUsers ( ); |
26 | 53 | ||
27 | void quitToConsole ( ); | 54 | void quitToConsole ( ); |
28 | 55 | ||
29 | private: | 56 | private: |
30 | static const char *s_username; | 57 | static const char *s_username; |
31 | 58 | ||
32 | #ifdef USEPAM | 59 | #ifdef USEPAM |
33 | static int pam_helper ( int num_msg, const struct pam_message **msg, struct pam_response **resp, void * ); | 60 | static int pam_helper ( int num_msg, const struct pam_message **msg, struct pam_response **resp, void * ); |
34 | static const char *s_pam_password; | 61 | static const char *s_pam_password; |
35 | #endif | 62 | #endif |
36 | }; | 63 | }; |
37 | 64 | ||
38 | extern LoginApplication *lApp; | 65 | extern LoginApplication *lApp; |
39 | 66 | ||
40 | #endif | 67 | #endif |
diff --git a/core/opie-login/loginwindowimpl.cpp b/core/opie-login/loginwindowimpl.cpp index 3694513..fe2906a 100644 --- a/core/opie-login/loginwindowimpl.cpp +++ b/core/opie-login/loginwindowimpl.cpp | |||
@@ -1,48 +1,75 @@ | |||
1 | /* | ||
2 | =. This file is part of the OPIE Project | ||
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | ||
4 | .>+-= | ||
5 | _;:, .> :=|. This file is free software; you can | ||
6 | .> <`_, > . <= redistribute it and/or modify it under | ||
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
8 | .="- .-=="i, .._ License as published by the Free Software | ||
9 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
10 | ._= =} : or (at your option) any later version. | ||
11 | .%`+i> _;_. | ||
12 | .i_,=:_. -<s. This file is distributed in the hope that | ||
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
14 | : .. .:, . . . without even the implied warranty of | ||
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
17 | ..}^=.= = ; Public License for more details. | ||
18 | ++= -. .` .: | ||
19 | : = ...= . :.=- You should have received a copy of the GNU | ||
20 | -. .:....=;==+<; General Public License along with this file; | ||
21 | -_. . . )=. = see the file COPYING. If not, write to the | ||
22 | -- :-=` Free Software Foundation, Inc., | ||
23 | 59 Temple Place - Suite 330, | ||
24 | Boston, MA 02111-1307, USA. | ||
25 | |||
26 | */ | ||
27 | |||
1 | #include <qapplication.h> | 28 | #include <qapplication.h> |
2 | #include <qpushbutton.h> | 29 | #include <qpushbutton.h> |
3 | #include <qlayout.h> | 30 | #include <qlayout.h> |
4 | #include <qframe.h> | 31 | #include <qframe.h> |
5 | #include <qlineedit.h> | 32 | #include <qlineedit.h> |
6 | #include <qtimer.h> | 33 | #include <qtimer.h> |
7 | #include <qcombobox.h> | 34 | #include <qcombobox.h> |
8 | #include <qpixmap.h> | 35 | #include <qpixmap.h> |
9 | #include <qlabel.h> | 36 | #include <qlabel.h> |
10 | #include <qpopupmenu.h> | 37 | #include <qpopupmenu.h> |
11 | #include <qmessagebox.h> | 38 | #include <qmessagebox.h> |
12 | #include <qimage.h> | 39 | #include <qimage.h> |
13 | 40 | ||
14 | #include <qpe/resource.h> | 41 | #include <qpe/resource.h> |
15 | #include <qpe/qcopenvelope_qws.h> | 42 | #include <qpe/qcopenvelope_qws.h> |
16 | #include <qpe/config.h> | 43 | #include <qpe/config.h> |
17 | 44 | ||
18 | #include <opie/odevice.h> | 45 | #include <opie/odevice.h> |
19 | 46 | ||
20 | #include <stdio.h> | 47 | #include <stdio.h> |
21 | #include <stdlib.h> | 48 | #include <stdlib.h> |
22 | 49 | ||
23 | #include "loginwindowimpl.h" | 50 | #include "loginwindowimpl.h" |
24 | #include "loginapplication.h" | 51 | #include "loginapplication.h" |
25 | #include "inputmethods.h" | 52 | #include "inputmethods.h" |
26 | 53 | ||
27 | using namespace Opie; | 54 | using namespace Opie; |
28 | 55 | ||
29 | 56 | ||
30 | LoginWindowImpl::LoginWindowImpl ( ) : LoginWindow ( 0, "LOGIN-WINDOW", WStyle_Customize | WStyle_NoBorder | WDestructiveClose ) | 57 | LoginWindowImpl::LoginWindowImpl ( ) : LoginWindow ( 0, "LOGIN-WINDOW", WStyle_Customize | WStyle_NoBorder | WDestructiveClose ) |
31 | { | 58 | { |
32 | QPopupMenu *pop = new QPopupMenu ( this ); | 59 | QPopupMenu *pop = new QPopupMenu ( this ); |
33 | pop-> insertItem ( tr( "Restart" ), this, SLOT( restart ( ))); | 60 | pop-> insertItem ( tr( "Restart" ), this, SLOT( restart ( ))); |
34 | pop-> insertItem ( tr( "Quit" ), this, SLOT( quit ( ))); | 61 | pop-> insertItem ( tr( "Quit" ), this, SLOT( quit ( ))); |
35 | m_menu-> setPopup ( pop ); | 62 | m_menu-> setPopup ( pop ); |
36 | 63 | ||
37 | QHBoxLayout *lay = new QHBoxLayout ( m_taskbar, 4, 4 ); | 64 | QHBoxLayout *lay = new QHBoxLayout ( m_taskbar, 4, 4 ); |
38 | m_input = new InputMethods ( m_taskbar ); | 65 | m_input = new InputMethods ( m_taskbar ); |
39 | lay-> addWidget ( m_input ); | 66 | lay-> addWidget ( m_input ); |
40 | lay-> addStretch ( 10 ); | 67 | lay-> addStretch ( 10 ); |
41 | 68 | ||
42 | setActiveWindow ( ); | 69 | setActiveWindow ( ); |
43 | m_password-> setFocus ( ); | 70 | m_password-> setFocus ( ); |
44 | 71 | ||
45 | m_user-> insertStringList ( lApp-> allUsers ( )); | 72 | m_user-> insertStringList ( lApp-> allUsers ( )); |
46 | 73 | ||
47 | QTimer::singleShot ( 0, this, SLOT( showIM ( ))); | 74 | QTimer::singleShot ( 0, this, SLOT( showIM ( ))); |
48 | 75 | ||
@@ -80,97 +107,97 @@ void LoginWindowImpl::keyPressEvent ( QKeyEvent *e ) | |||
80 | } | 107 | } |
81 | 108 | ||
82 | 109 | ||
83 | void LoginWindowImpl::toggleEchoMode ( bool t ) | 110 | void LoginWindowImpl::toggleEchoMode ( bool t ) |
84 | { | 111 | { |
85 | m_password-> setEchoMode ( t ? QLineEdit::Normal : QLineEdit::Password ); | 112 | m_password-> setEchoMode ( t ? QLineEdit::Normal : QLineEdit::Password ); |
86 | } | 113 | } |
87 | 114 | ||
88 | void LoginWindowImpl::showIM ( ) | 115 | void LoginWindowImpl::showIM ( ) |
89 | { | 116 | { |
90 | m_input-> showInputMethod ( ); | 117 | m_input-> showInputMethod ( ); |
91 | } | 118 | } |
92 | 119 | ||
93 | void LoginWindowImpl::restart ( ) | 120 | void LoginWindowImpl::restart ( ) |
94 | { | 121 | { |
95 | qApp-> quit ( ); | 122 | qApp-> quit ( ); |
96 | } | 123 | } |
97 | 124 | ||
98 | void LoginWindowImpl::quit ( ) | 125 | void LoginWindowImpl::quit ( ) |
99 | { | 126 | { |
100 | lApp-> quitToConsole ( ); | 127 | lApp-> quitToConsole ( ); |
101 | } | 128 | } |
102 | 129 | ||
103 | void LoginWindowImpl::suspend ( ) | 130 | void LoginWindowImpl::suspend ( ) |
104 | { | 131 | { |
105 | ODevice::inst ( )-> suspend ( ); | 132 | ODevice::inst ( )-> suspend ( ); |
106 | 133 | ||
107 | QCopEnvelope e("QPE/System", "setBacklight(int)"); | 134 | QCopEnvelope e("QPE/System", "setBacklight(int)"); |
108 | e << -3; // Force on | 135 | e << -3; // Force on |
109 | } | 136 | } |
110 | 137 | ||
111 | void LoginWindowImpl::backlight ( ) | 138 | void LoginWindowImpl::backlight ( ) |
112 | { | 139 | { |
113 | QCopEnvelope e("QPE/System", "setBacklight(int)"); | 140 | QCopEnvelope e("QPE/System", "setBacklight(int)"); |
114 | e << -2; // toggle | 141 | e << -2; // toggle |
115 | } | 142 | } |
116 | 143 | ||
117 | class WaitLogo : public QLabel { | 144 | class WaitLogo : public QLabel { |
118 | public: | 145 | public: |
119 | WaitLogo ( ) : QLabel ( 0, "wait hack!", WStyle_Customize | WStyle_NoBorder | WStyle_Tool ) | 146 | WaitLogo ( ) : QLabel ( 0, "wait hack!", WStyle_Customize | WStyle_NoBorder | WStyle_Tool ) |
120 | { | 147 | { |
121 | QImage img = Resource::loadImage ( "launcher/new_wait" ); | 148 | QImage img = Resource::loadImage ( "launcher/new_wait" ); |
122 | QPixmap pix; | 149 | QPixmap pix; |
123 | pix. convertFromImage ( img ); | 150 | pix. convertFromImage ( img ); |
124 | setPixmap ( pix ); | 151 | setPixmap ( pix ); |
125 | setAlignment ( AlignCenter ); | 152 | setAlignment ( AlignCenter ); |
126 | move ( 0, 0 ); | 153 | move ( 0, 0 ); |
127 | resize ( qApp-> desktop ( )-> width ( ), qApp-> desktop ( )-> height ( )); | 154 | resize ( qApp-> desktop ( )-> width ( ), qApp-> desktop ( )-> height ( )); |
128 | 155 | ||
129 | m_visible = false; | 156 | m_visible = false; |
130 | show ( ); | 157 | show ( ); |
131 | } | 158 | } |
132 | 159 | ||
133 | virtual void showEvent ( QShowEvent *e ) | 160 | virtual void showEvent ( QShowEvent *e ) |
134 | { | 161 | { |
135 | QLabel::showEvent ( e ); | 162 | QLabel::showEvent ( e ); |
136 | m_visible = true; | 163 | m_visible = true; |
137 | } | 164 | } |
138 | 165 | ||
139 | virtual void paintEvent ( QPaintEvent *e ) | 166 | virtual void paintEvent ( QPaintEvent *e ) |
140 | { | 167 | { |
141 | QLabel::paintEvent ( e ); | 168 | QLabel::paintEvent ( e ); |
142 | if ( m_visible ) | 169 | if ( m_visible ) |
143 | qApp-> quit ( ); | 170 | qApp-> quit ( ); |
144 | } | 171 | } |
145 | 172 | ||
146 | private: | 173 | private: |
147 | bool m_visible; | 174 | bool m_visible; |
148 | }; | 175 | }; |
149 | 176 | ||
150 | void LoginWindowImpl::login ( ) | 177 | void LoginWindowImpl::login ( ) |
151 | { | 178 | { |
152 | const char *user = ::strdup ( m_user-> currentText ( ). local8Bit ( )); | 179 | const char *user = ::strdup ( m_user-> currentText ( ). local8Bit ( )); |
153 | const char *pass = ::strdup ( m_password-> text ( ). local8Bit ( )); | 180 | const char *pass = ::strdup ( m_password-> text ( ). local8Bit ( )); |
154 | 181 | ||
155 | if ( !user || !user [0] ) | 182 | if ( !user || !user [0] ) |
156 | return; | 183 | return; |
157 | if ( !pass ) | 184 | if ( !pass ) |
158 | pass = ""; | 185 | pass = ""; |
159 | 186 | ||
160 | if ( lApp-> checkPassword ( user, pass )) { | 187 | if ( lApp-> checkPassword ( user, pass )) { |
161 | Config cfg ( "opie-login" ); | 188 | Config cfg ( "opie-login" ); |
162 | cfg. setGroup ( "General" ); | 189 | cfg. setGroup ( "General" ); |
163 | cfg. writeEntry ( "LastLogin", user ); | 190 | cfg. writeEntry ( "LastLogin", user ); |
164 | cfg. write ( ); | 191 | cfg. write ( ); |
165 | 192 | ||
166 | lApp-> setLoginAs ( user ); | 193 | lApp-> setLoginAs ( user ); |
167 | 194 | ||
168 | // Draw a big wait icon, the image can be altered in later revisions | 195 | // Draw a big wait icon, the image can be altered in later revisions |
169 | m_input-> hideInputMethod ( ); | 196 | m_input-> hideInputMethod ( ); |
170 | new WaitLogo ( ); | 197 | new WaitLogo ( ); |
171 | // WaitLogo::showEvent() calls qApp-> quit() | 198 | // WaitLogo::showEvent() calls qApp-> quit() |
172 | } | 199 | } |
173 | else { | 200 | else { |
174 | QMessageBox::warning ( this, tr( "Wrong password" ), tr( "The given password is incorrect." )); | 201 | QMessageBox::warning ( this, tr( "Wrong password" ), tr( "The given password is incorrect." )); |
175 | m_password-> clear ( ); | 202 | m_password-> clear ( ); |
176 | } | 203 | } |
diff --git a/core/opie-login/loginwindowimpl.h b/core/opie-login/loginwindowimpl.h index 2e2ba0d..e769b03 100644 --- a/core/opie-login/loginwindowimpl.h +++ b/core/opie-login/loginwindowimpl.h | |||
@@ -1,34 +1,61 @@ | |||
1 | /* | ||
2 | =. This file is part of the OPIE Project | ||
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | ||
4 | .>+-= | ||
5 | _;:, .> :=|. This file is free software; you can | ||
6 | .> <`_, > . <= redistribute it and/or modify it under | ||
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
8 | .="- .-=="i, .._ License as published by the Free Software | ||
9 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
10 | ._= =} : or (at your option) any later version. | ||
11 | .%`+i> _;_. | ||
12 | .i_,=:_. -<s. This file is distributed in the hope that | ||
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
14 | : .. .:, . . . without even the implied warranty of | ||
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
17 | ..}^=.= = ; Public License for more details. | ||
18 | ++= -. .` .: | ||
19 | : = ...= . :.=- You should have received a copy of the GNU | ||
20 | -. .:....=;==+<; General Public License along with this file; | ||
21 | -_. . . )=. = see the file COPYING. If not, write to the | ||
22 | -- :-=` Free Software Foundation, Inc., | ||
23 | 59 Temple Place - Suite 330, | ||
24 | Boston, MA 02111-1307, USA. | ||
25 | |||
26 | */ | ||
27 | |||
1 | #ifndef __OPIE_LOGINWINDOW_IMPL_H__ | 28 | #ifndef __OPIE_LOGINWINDOW_IMPL_H__ |
2 | #define __OPIE_LOGINWINDOW_IMPL_H__ | 29 | #define __OPIE_LOGINWINDOW_IMPL_H__ |
3 | 30 | ||
4 | #include "loginwindow.h" | 31 | #include "loginwindow.h" |
5 | 32 | ||
6 | class InputMethods; | 33 | class InputMethods; |
7 | 34 | ||
8 | class LoginWindowImpl : public LoginWindow { | 35 | class LoginWindowImpl : public LoginWindow { |
9 | Q_OBJECT | 36 | Q_OBJECT |
10 | 37 | ||
11 | public: | 38 | public: |
12 | LoginWindowImpl ( ); | 39 | LoginWindowImpl ( ); |
13 | virtual ~LoginWindowImpl ( ); | 40 | virtual ~LoginWindowImpl ( ); |
14 | 41 | ||
15 | protected slots: | 42 | protected slots: |
16 | void restart ( ); | 43 | void restart ( ); |
17 | void quit ( ); | 44 | void quit ( ); |
18 | void showIM ( ); | 45 | void showIM ( ); |
19 | void suspend ( ); | 46 | void suspend ( ); |
20 | void backlight ( ); | 47 | void backlight ( ); |
21 | void login ( ); | 48 | void login ( ); |
22 | void toggleEchoMode ( bool ); | 49 | void toggleEchoMode ( bool ); |
23 | 50 | ||
24 | protected: | 51 | protected: |
25 | virtual void keyPressEvent ( QKeyEvent *e ); | 52 | virtual void keyPressEvent ( QKeyEvent *e ); |
26 | 53 | ||
27 | QStringList getAllUsers ( ); | 54 | QStringList getAllUsers ( ); |
28 | bool changeIdentity ( const char *user ); | 55 | bool changeIdentity ( const char *user ); |
29 | 56 | ||
30 | private: | 57 | private: |
31 | InputMethods *m_input; | 58 | InputMethods *m_input; |
32 | }; | 59 | }; |
33 | 60 | ||
34 | #endif | 61 | #endif |
diff --git a/core/opie-login/main.cpp b/core/opie-login/main.cpp index 91610af..2c10f77 100644 --- a/core/opie-login/main.cpp +++ b/core/opie-login/main.cpp | |||
@@ -1,48 +1,75 @@ | |||
1 | /* | ||
2 | =. This file is part of the OPIE Project | ||
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | ||
4 | .>+-= | ||
5 | _;:, .> :=|. This file is free software; you can | ||
6 | .> <`_, > . <= redistribute it and/or modify it under | ||
7 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
8 | .="- .-=="i, .._ License as published by the Free Software | ||
9 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
10 | ._= =} : or (at your option) any later version. | ||
11 | .%`+i> _;_. | ||
12 | .i_,=:_. -<s. This file is distributed in the hope that | ||
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
14 | : .. .:, . . . without even the implied warranty of | ||
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
17 | ..}^=.= = ; Public License for more details. | ||
18 | ++= -. .` .: | ||
19 | : = ...= . :.=- You should have received a copy of the GNU | ||
20 | -. .:....=;==+<; General Public License along with this file; | ||
21 | -_. . . )=. = see the file COPYING. If not, write to the | ||
22 | -- :-=` Free Software Foundation, Inc., | ||
23 | 59 Temple Place - Suite 330, | ||
24 | Boston, MA 02111-1307, USA. | ||
25 | |||
26 | */ | ||
27 | |||
1 | #define _GNU_SOURCE | 28 | #define _GNU_SOURCE |
2 | 29 | ||
3 | #include <sys/types.h> | 30 | #include <sys/types.h> |
4 | #include <time.h> | 31 | #include <time.h> |
5 | #include <sys/time.h> | 32 | #include <sys/time.h> |
6 | #include <sys/resource.h> | 33 | #include <sys/resource.h> |
7 | #include <unistd.h> | 34 | #include <unistd.h> |
8 | #include <syslog.h> | 35 | #include <syslog.h> |
9 | #include <sys/wait.h> | 36 | #include <sys/wait.h> |
10 | #include <stdio.h> | 37 | #include <stdio.h> |
11 | #include <stdlib.h> | 38 | #include <stdlib.h> |
12 | #include <signal.h> | 39 | #include <signal.h> |
13 | #include <getopt.h> | 40 | #include <getopt.h> |
14 | #include <string.h> | 41 | #include <string.h> |
15 | 42 | ||
16 | #include <qpe/qpeapplication.h> | 43 | #include <qpe/qpeapplication.h> |
17 | #include <qpe/qcopenvelope_qws.h> | 44 | #include <qpe/qcopenvelope_qws.h> |
18 | #include <qpe/qpestyle.h> | 45 | #include <qpe/qpestyle.h> |
19 | #include <qpe/power.h> | 46 | #include <qpe/power.h> |
20 | 47 | ||
21 | #include <opie/odevice.h> | 48 | #include <opie/odevice.h> |
22 | 49 | ||
23 | #include <qwindowsystem_qws.h> | 50 | #include <qwindowsystem_qws.h> |
24 | #include <qmessagebox.h> | 51 | #include <qmessagebox.h> |
25 | #include <qlabel.h> | 52 | #include <qlabel.h> |
26 | #include <qtimer.h> | 53 | #include <qtimer.h> |
27 | 54 | ||
28 | #include "loginapplication.h" | 55 | #include "loginapplication.h" |
29 | #include "loginwindowimpl.h" | 56 | #include "loginwindowimpl.h" |
30 | #include "calibrate.h" | 57 | #include "calibrate.h" |
31 | 58 | ||
32 | using namespace Opie; | 59 | using namespace Opie; |
33 | 60 | ||
34 | int login_main ( int argc, char **argv ); | 61 | int login_main ( int argc, char **argv ); |
35 | void sigterm ( int sig ); | 62 | void sigterm ( int sig ); |
36 | void exit_closelog ( ); | 63 | void exit_closelog ( ); |
37 | 64 | ||
38 | static struct option long_options [] = { | 65 | static struct option long_options [] = { |
39 | { "autologin", 1, 0, 'a' }, | 66 | { "autologin", 1, 0, 'a' }, |
40 | { 0, 0, 0, 0 } | 67 | { 0, 0, 0, 0 } |
41 | }; | 68 | }; |
42 | 69 | ||
43 | 70 | ||
44 | int main ( int argc, char **argv ) | 71 | int main ( int argc, char **argv ) |
45 | { | 72 | { |
46 | if ( ::geteuid ( ) != 0 ) { | 73 | if ( ::geteuid ( ) != 0 ) { |
47 | ::fprintf ( stderr, "%s can only be executed by root. (or chmod +s)", argv [0] ); | 74 | ::fprintf ( stderr, "%s can only be executed by root. (or chmod +s)", argv [0] ); |
48 | return 1; | 75 | return 1; |