-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 @@ #include <qapplication.h> #include <qpushbutton.h> #include <qlayout.h> #include <qframe.h> #include <qlineedit.h> #include <qtimer.h> #include <qcombobox.h> #include <qpixmap.h> #include <qlabel.h> #include <qpopupmenu.h> #include <qmessagebox.h> #include <qpe/qcopenvelope_qws.h> #include <opie/odevice.h> #include <stdio.h> #include <pwd.h> #include <grp.h> #include <unistd.h> #include <stdlib.h> -#undef USEPAM // FOR my toolchain #ifdef USEPAM extern "C" { #include <security/pam_appl.h> } #else #include <crypt.h> #include <shadow.h> #endif #include "loginwindowimpl.h" #include "inputmethods.h" LoginWindowImpl::LoginWindowImpl ( ) : LoginWindow ( 0, "LOGIN-WINDOW", WStyle_Customize | WStyle_NoBorder | WDestructiveClose ) { QPopupMenu *pop = new QPopupMenu ( this ); pop-> insertItem ( tr( "Restart" ), this, SLOT( restart ( ))); m_menu-> setPopup ( pop ); QHBoxLayout *lay = new QHBoxLayout ( m_taskbar, 4, 4 ); m_input = new InputMethods ( m_taskbar ); lay-> addWidget ( m_input ); lay-> addStretch ( 10 ); setActiveWindow ( ); m_password-> setFocus ( ); m_user-> insertStringList ( getAllUsers ( )); QTimer::singleShot ( 0, this, SLOT( showIM ( ))); QString opiedir = ::getenv ( "OPIEDIR" ); QPixmap bgpix ( opiedir + "/pics/launcher/opie-background.jpg" ); if ( !bgpix. isNull ( )) setBackgroundPixmap ( bgpix ); m_caption-> setText ( m_caption-> text ( ) + tr( "<center><h1><u>%1 %2</u></h1></center>" ). arg ( ODevice::inst ( )-> systemString ( )). arg ( ODevice::inst ( )-> systemVersionString ( ))); } LoginWindowImpl::~LoginWindowImpl ( ) { } void LoginWindowImpl::keyPressEvent ( QKeyEvent *e ) { switch ( e-> key ( )) { case Key_F34: suspend ( ); break; case Key_F35: backlight ( ); break; default : e-> ignore ( ); break; } LoginWindow::keyPressEvent ( e ); } void LoginWindowImpl::toggleEchoMode ( bool t ) { m_password-> setEchoMode ( t ? QLineEdit::Normal : QLineEdit::Password ); } QStringList LoginWindowImpl::getAllUsers ( ) { struct passwd *pwd; QStringList sl; while (( pwd = getpwent ( ))) { if (( pwd-> pw_uid == 0 ) || ( pwd-> pw_uid >= 500 && pwd-> pw_uid < 65534 )) sl << QString ( pwd-> pw_name ); } endpwent ( ); return sl; } void LoginWindowImpl::showIM ( ) { m_input-> showInputMethod ( ); } void LoginWindowImpl::restart ( ) { qApp-> quit ( ); } void LoginWindowImpl::suspend ( ) { system ( "apm -s" ); usleep ( 1 * 1000 * 1000 ); { QCopEnvelope e("QPE/System", "setBacklight(int)"); e << -3; // Force on } } 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 @@ TEMPLATE = app CONFIG = qt warn_on debug usepam HEADERS = loginwindowimpl.h \ ../launcher/inputmethods.h \ ../apps/calibrate/calibrate.h SOURCES = loginwindowimpl.cpp \ ../launcher/inputmethods.cpp \ ../apps/calibrate/calibrate.cpp \ main.cpp INTERFACES = loginwindow.ui INCLUDEPATH += $(OPIEDIR)/include ../launcher ../apps/calibrate DEPENDPATH += $(OPIEDIR)/include ../launcher ../apps/calibrate LIBS += -lqpe -lopie -#usepam:LIBS += -lpam -#usepam:DEFINES += USEPAM +usepam:LIBS += -lpam +usepam:DEFINES += USEPAM DESTDIR = $(OPIEDIR)/bin TARGET = opie-login |