author | sandman <sandman> | 2002-09-30 21:37:26 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-09-30 21:37:26 (UTC) |
commit | 9208485864ccbd2a12160334cef302874b50043a (patch) (side-by-side diff) | |
tree | 14a6017f54a86c1be53c87a8ed2b277b62dbcef1 | |
parent | 3c6afa049f07c7e6311b3c88faf8a200827f3452 (diff) | |
download | opie-9208485864ccbd2a12160334cef302874b50043a.zip opie-9208485864ccbd2a12160334cef302874b50043a.tar.gz opie-9208485864ccbd2a12160334cef302874b50043a.tar.bz2 |
misc. cleanups
-rw-r--r-- | core/opie-login/loginwindowimpl.cpp | 3 | ||||
-rw-r--r-- | core/opie-login/main.cpp | 11 |
2 files changed, 7 insertions, 7 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 @@ #include <qpe/qcopenvelope_qws.h> #include <opie/odevice.h> #include <stdio.h> #include <pwd.h> #include <grp.h> #include <unistd.h> #include <stdlib.h> #include <signal.h> #ifdef USEPAM extern "C" { #include <security/pam_appl.h> } #else #include <crypt.h> #include <shadow.h> #endif #include "loginwindowimpl.h" #include "inputmethods.h" +using namespace Opie; + + LoginWindowImpl::LoginWindowImpl ( ) : LoginWindow ( 0, "LOGIN-WINDOW", WStyle_Customize | WStyle_NoBorder | WDestructiveClose ) { QPopupMenu *pop = new QPopupMenu ( this ); pop-> insertItem ( tr( "Restart" ), this, SLOT( restart ( ))); pop-> insertItem ( tr( "Quit" ), this, SLOT( quit ( ))); 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 ); 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 @@ #include <sys/time.h> #include <sys/resource.h> #include <unistd.h> #include <syslog.h> #include <sys/types.h> #include <sys/wait.h> #include <stdio.h> #include <stdlib.h> #include <signal.h> #include <qpe/qpeapplication.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/qpestyle.h> #include <qpe/power.h> #include <opie/odevice.h> #include <qwindowsystem_qws.h> #include <qfile.h> #include "loginwindowimpl.h" #include "calibrate.h" +using namespace Opie; + int login_main ( int argc, char **argv ); void sigusr1 ( int sig ); void exit_closelog ( ); int main ( int argc, char **argv ) { if ( ::geteuid ( ) != 0 ) { ::fprintf ( stderr, "%s can only be executed by root. (or chmod +s)", argv [0] ); return 1; } // struct rlimit rl; // ::getrlimit ( RLIMIT_NOFILE, &rl ); // for ( unsigned int i = 0; i < rl. rlim_cur; i++ ) // ::close ( i ); ::setpgid ( 0, 0 ); ::setsid ( ); ::signal ( SIGUSR1, sigusr1 ); @@ -76,49 +78,49 @@ void sigusr1 ( int /*sig*/ ) void exit_closelog ( ) { ::closelog ( ); } class LoginScreenSaver : public QWSScreenSaver { public: LoginScreenSaver ( ) { m_lcd_status = true; m_backlight_bright = -1; m_backlight_forcedoff = false; // Make sure the LCD is in fact on, (if opie was killed while the LCD is off it would still be off) ODevice::inst ( ) -> setDisplayStatus ( true ); } void restore() { if ( !m_lcd_status ) // We must have turned it off ODevice::inst ( ) -> setDisplayStatus ( true ); - setBacklight ( -1 ); + setBacklight ( -3 ); } bool save( int level ) { switch ( level ) { case 0: if ( backlight() > 1 ) setBacklight( 1 ); // lowest non-off return true; break; case 1: setBacklight( 0 ); // off return true; break; case 2: // We're going to suspend the whole machine if ( PowerStatusManager::readStatus().acStatus() != PowerStatus::Online ) { QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE ); return true; } break; } return false; } @@ -168,57 +170,52 @@ public: ODevice::inst ( ) -> setDisplayBrightness ( bright ); m_backlight_bright = bright; } private: bool m_lcd_status; int m_backlight_bright; bool m_backlight_forcedoff; }; int login_main ( int argc, char **argv ) { QWSServer::setDesktopBackground( QImage() ); QPEApplication app ( argc, argv, QApplication::GuiServer ); app. setFont ( QFont ( "Helvetica", 10 )); app. setStyle ( new QPEStyle ( )); ODevice::inst ( )-> setSoftSuspend ( true ); - { - QCopEnvelope e("QPE/System", "setBacklight(int)" ); - e << -3; // Forced on - } - #if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) if ( !QFile::exists ( "/etc/pointercal" )) { // Make sure calibration widget starts on top. Calibrate *cal = new Calibrate; cal-> exec ( ); delete cal; } #endif - LoginScreenSaver *saver = new LoginScreenSaver; saver-> setIntervals ( ); QWSServer::setScreenSaver ( saver ); + saver-> restore ( ); LoginWindowImpl *lw = new LoginWindowImpl ( ); app. setMainWidget ( lw ); lw-> setGeometry ( 0, 0, app. desktop ( )-> width ( ), app. desktop ( )-> height ( )); lw-> show ( ); int rc = app. exec ( ); ODevice::inst ( )-> setSoftSuspend ( false ); return rc; } |