-rw-r--r-- | core/opie-login/loginwindowimpl.cpp | 1 | ||||
-rw-r--r-- | core/opie-login/opie-login.pro | 4 |
2 files changed, 2 insertions, 3 deletions
diff --git a/core/opie-login/loginwindowimpl.cpp b/core/opie-login/loginwindowimpl.cpp index 26d9225..3265b46 100644 --- a/core/opie-login/loginwindowimpl.cpp +++ b/core/opie-login/loginwindowimpl.cpp | |||
@@ -1,120 +1,119 @@ | |||
1 | #include <qapplication.h> | 1 | #include <qapplication.h> |
2 | #include <qpushbutton.h> | 2 | #include <qpushbutton.h> |
3 | #include <qlayout.h> | 3 | #include <qlayout.h> |
4 | #include <qframe.h> | 4 | #include <qframe.h> |
5 | #include <qlineedit.h> | 5 | #include <qlineedit.h> |
6 | #include <qtimer.h> | 6 | #include <qtimer.h> |
7 | #include <qcombobox.h> | 7 | #include <qcombobox.h> |
8 | #include <qpixmap.h> | 8 | #include <qpixmap.h> |
9 | #include <qlabel.h> | 9 | #include <qlabel.h> |
10 | #include <qpopupmenu.h> | 10 | #include <qpopupmenu.h> |
11 | #include <qmessagebox.h> | 11 | #include <qmessagebox.h> |
12 | 12 | ||
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 | 23 | ||
24 | #undef USEPAM // FOR my toolchain | ||
25 | #ifdef USEPAM | 24 | #ifdef USEPAM |
26 | extern "C" { | 25 | extern "C" { |
27 | #include <security/pam_appl.h> | 26 | #include <security/pam_appl.h> |
28 | } | 27 | } |
29 | #else | 28 | #else |
30 | #include <crypt.h> | 29 | #include <crypt.h> |
31 | #include <shadow.h> | 30 | #include <shadow.h> |
32 | #endif | 31 | #endif |
33 | 32 | ||
34 | #include "loginwindowimpl.h" | 33 | #include "loginwindowimpl.h" |
35 | #include "inputmethods.h" | 34 | #include "inputmethods.h" |
36 | 35 | ||
37 | LoginWindowImpl::LoginWindowImpl ( ) : LoginWindow ( 0, "LOGIN-WINDOW", WStyle_Customize | WStyle_NoBorder | WDestructiveClose ) | 36 | LoginWindowImpl::LoginWindowImpl ( ) : LoginWindow ( 0, "LOGIN-WINDOW", WStyle_Customize | WStyle_NoBorder | WDestructiveClose ) |
38 | { | 37 | { |
39 | QPopupMenu *pop = new QPopupMenu ( this ); | 38 | QPopupMenu *pop = new QPopupMenu ( this ); |
40 | pop-> insertItem ( tr( "Restart" ), this, SLOT( restart ( ))); | 39 | pop-> insertItem ( tr( "Restart" ), this, SLOT( restart ( ))); |
41 | m_menu-> setPopup ( pop ); | 40 | m_menu-> setPopup ( pop ); |
42 | 41 | ||
43 | QHBoxLayout *lay = new QHBoxLayout ( m_taskbar, 4, 4 ); | 42 | QHBoxLayout *lay = new QHBoxLayout ( m_taskbar, 4, 4 ); |
44 | m_input = new InputMethods ( m_taskbar ); | 43 | m_input = new InputMethods ( m_taskbar ); |
45 | lay-> addWidget ( m_input ); | 44 | lay-> addWidget ( m_input ); |
46 | lay-> addStretch ( 10 ); | 45 | lay-> addStretch ( 10 ); |
47 | 46 | ||
48 | setActiveWindow ( ); | 47 | setActiveWindow ( ); |
49 | m_password-> setFocus ( ); | 48 | m_password-> setFocus ( ); |
50 | 49 | ||
51 | m_user-> insertStringList ( getAllUsers ( )); | 50 | m_user-> insertStringList ( getAllUsers ( )); |
52 | 51 | ||
53 | QTimer::singleShot ( 0, this, SLOT( showIM ( ))); | 52 | QTimer::singleShot ( 0, this, SLOT( showIM ( ))); |
54 | 53 | ||
55 | QString opiedir = ::getenv ( "OPIEDIR" ); | 54 | QString opiedir = ::getenv ( "OPIEDIR" ); |
56 | QPixmap bgpix ( opiedir + "/pics/launcher/opie-background.jpg" ); | 55 | QPixmap bgpix ( opiedir + "/pics/launcher/opie-background.jpg" ); |
57 | 56 | ||
58 | if ( !bgpix. isNull ( )) | 57 | if ( !bgpix. isNull ( )) |
59 | setBackgroundPixmap ( bgpix ); | 58 | setBackgroundPixmap ( bgpix ); |
60 | 59 | ||
61 | m_caption-> setText ( m_caption-> text ( ) + tr( "<center><h1><u>%1 %2</u></h1></center>" ). arg ( ODevice::inst ( )-> systemString ( )). arg ( ODevice::inst ( )-> systemVersionString ( ))); | 60 | m_caption-> setText ( m_caption-> text ( ) + tr( "<center><h1><u>%1 %2</u></h1></center>" ). arg ( ODevice::inst ( )-> systemString ( )). arg ( ODevice::inst ( )-> systemVersionString ( ))); |
62 | } | 61 | } |
63 | 62 | ||
64 | LoginWindowImpl::~LoginWindowImpl ( ) | 63 | LoginWindowImpl::~LoginWindowImpl ( ) |
65 | { | 64 | { |
66 | } | 65 | } |
67 | 66 | ||
68 | void LoginWindowImpl::keyPressEvent ( QKeyEvent *e ) | 67 | void LoginWindowImpl::keyPressEvent ( QKeyEvent *e ) |
69 | { | 68 | { |
70 | switch ( e-> key ( )) { | 69 | switch ( e-> key ( )) { |
71 | case Key_F34: suspend ( ); | 70 | case Key_F34: suspend ( ); |
72 | break; | 71 | break; |
73 | case Key_F35: backlight ( ); | 72 | case Key_F35: backlight ( ); |
74 | break; | 73 | break; |
75 | default : e-> ignore ( ); | 74 | default : e-> ignore ( ); |
76 | break; | 75 | break; |
77 | } | 76 | } |
78 | LoginWindow::keyPressEvent ( e ); | 77 | LoginWindow::keyPressEvent ( e ); |
79 | } | 78 | } |
80 | 79 | ||
81 | 80 | ||
82 | void LoginWindowImpl::toggleEchoMode ( bool t ) | 81 | void LoginWindowImpl::toggleEchoMode ( bool t ) |
83 | { | 82 | { |
84 | m_password-> setEchoMode ( t ? QLineEdit::Normal : QLineEdit::Password ); | 83 | m_password-> setEchoMode ( t ? QLineEdit::Normal : QLineEdit::Password ); |
85 | } | 84 | } |
86 | 85 | ||
87 | QStringList LoginWindowImpl::getAllUsers ( ) | 86 | QStringList LoginWindowImpl::getAllUsers ( ) |
88 | { | 87 | { |
89 | struct passwd *pwd; | 88 | struct passwd *pwd; |
90 | QStringList sl; | 89 | QStringList sl; |
91 | 90 | ||
92 | while (( pwd = getpwent ( ))) { | 91 | while (( pwd = getpwent ( ))) { |
93 | if (( pwd-> pw_uid == 0 ) || ( pwd-> pw_uid >= 500 && pwd-> pw_uid < 65534 )) | 92 | if (( pwd-> pw_uid == 0 ) || ( pwd-> pw_uid >= 500 && pwd-> pw_uid < 65534 )) |
94 | sl << QString ( pwd-> pw_name ); | 93 | sl << QString ( pwd-> pw_name ); |
95 | } | 94 | } |
96 | 95 | ||
97 | endpwent ( ); | 96 | endpwent ( ); |
98 | 97 | ||
99 | return sl; | 98 | return sl; |
100 | } | 99 | } |
101 | 100 | ||
102 | void LoginWindowImpl::showIM ( ) | 101 | void LoginWindowImpl::showIM ( ) |
103 | { | 102 | { |
104 | m_input-> showInputMethod ( ); | 103 | m_input-> showInputMethod ( ); |
105 | } | 104 | } |
106 | 105 | ||
107 | void LoginWindowImpl::restart ( ) | 106 | void LoginWindowImpl::restart ( ) |
108 | { | 107 | { |
109 | qApp-> quit ( ); | 108 | qApp-> quit ( ); |
110 | } | 109 | } |
111 | 110 | ||
112 | void LoginWindowImpl::suspend ( ) | 111 | void LoginWindowImpl::suspend ( ) |
113 | { | 112 | { |
114 | system ( "apm -s" ); | 113 | system ( "apm -s" ); |
115 | usleep ( 1 * 1000 * 1000 ); | 114 | usleep ( 1 * 1000 * 1000 ); |
116 | { | 115 | { |
117 | QCopEnvelope e("QPE/System", "setBacklight(int)"); | 116 | QCopEnvelope e("QPE/System", "setBacklight(int)"); |
118 | e << -3; // Force on | 117 | e << -3; // Force on |
119 | } | 118 | } |
120 | } | 119 | } |
diff --git a/core/opie-login/opie-login.pro b/core/opie-login/opie-login.pro index ef449ab..35c1ed0 100644 --- a/core/opie-login/opie-login.pro +++ b/core/opie-login/opie-login.pro | |||
@@ -1,25 +1,25 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG = qt warn_on debug usepam | 2 | CONFIG = qt warn_on debug usepam |
3 | 3 | ||
4 | HEADERS = loginwindowimpl.h \ | 4 | HEADERS = loginwindowimpl.h \ |
5 | ../launcher/inputmethods.h \ | 5 | ../launcher/inputmethods.h \ |
6 | ../apps/calibrate/calibrate.h | 6 | ../apps/calibrate/calibrate.h |
7 | 7 | ||
8 | SOURCES = loginwindowimpl.cpp \ | 8 | SOURCES = loginwindowimpl.cpp \ |
9 | ../launcher/inputmethods.cpp \ | 9 | ../launcher/inputmethods.cpp \ |
10 | ../apps/calibrate/calibrate.cpp \ | 10 | ../apps/calibrate/calibrate.cpp \ |
11 | main.cpp | 11 | main.cpp |
12 | 12 | ||
13 | INTERFACES = loginwindow.ui | 13 | INTERFACES = loginwindow.ui |
14 | 14 | ||
15 | INCLUDEPATH += $(OPIEDIR)/include ../launcher ../apps/calibrate | 15 | INCLUDEPATH += $(OPIEDIR)/include ../launcher ../apps/calibrate |
16 | DEPENDPATH += $(OPIEDIR)/include ../launcher ../apps/calibrate | 16 | DEPENDPATH += $(OPIEDIR)/include ../launcher ../apps/calibrate |
17 | 17 | ||
18 | LIBS += -lqpe -lopie | 18 | LIBS += -lqpe -lopie |
19 | 19 | ||
20 | #usepam:LIBS += -lpam | 20 | usepam:LIBS += -lpam |
21 | #usepam:DEFINES += USEPAM | 21 | usepam:DEFINES += USEPAM |
22 | 22 | ||
23 | DESTDIR = $(OPIEDIR)/bin | 23 | DESTDIR = $(OPIEDIR)/bin |
24 | TARGET = opie-login | 24 | TARGET = opie-login |
25 | 25 | ||