summaryrefslogtreecommitdiff
path: root/core/opie-login/loginwindowimpl.cpp
authorzecke <zecke>2004-07-09 21:36:37 (UTC)
committer zecke <zecke>2004-07-09 21:36:37 (UTC)
commit944adb8bf2741a16cf627d19e08f51c08920ad89 (patch) (unidiff)
tree5f9edc9784e0268a00fe68ec74d7151900c5183a /core/opie-login/loginwindowimpl.cpp
parentc5d3262afd775bce81b99c5dc06e74c4686cee2a (diff)
downloadopie-944adb8bf2741a16cf627d19e08f51c08920ad89.zip
opie-944adb8bf2741a16cf627d19e08f51c08920ad89.tar.gz
opie-944adb8bf2741a16cf627d19e08f51c08920ad89.tar.bz2
Add setting a root password if none is set to opie-login
If you directly start Opie-Taskbar or use AutoLogin you will not be presented by a set root password gui
Diffstat (limited to 'core/opie-login/loginwindowimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/opie-login/loginwindowimpl.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/core/opie-login/loginwindowimpl.cpp b/core/opie-login/loginwindowimpl.cpp
index 32f98f3..73c2cbe 100644
--- a/core/opie-login/loginwindowimpl.cpp
+++ b/core/opie-login/loginwindowimpl.cpp
@@ -38,24 +38,25 @@
38#endif 38#endif
39#include <qwindowsystem_qws.h> 39#include <qwindowsystem_qws.h>
40 40
41#include <qpe/resource.h> 41#include <qpe/resource.h>
42#include <qpe/qcopenvelope_qws.h> 42#include <qpe/qcopenvelope_qws.h>
43#include <qpe/config.h> 43#include <qpe/config.h>
44 44
45#include <opie2/odevice.h> 45#include <opie2/odevice.h>
46 46
47#include <stdio.h> 47#include <stdio.h>
48#include <stdlib.h> 48#include <stdlib.h>
49 49
50#include "passworddialogimpl.h"
50#include "loginwindowimpl.h" 51#include "loginwindowimpl.h"
51#include "loginapplication.h" 52#include "loginapplication.h"
52#include "inputmethods.h" 53#include "inputmethods.h"
53 54
54using namespace Opie::Core; 55using namespace Opie::Core;
55 56
56 57
57LoginWindowImpl::LoginWindowImpl ( ) : LoginWindow ( 0, "LOGIN-WINDOW", WStyle_Customize | WStyle_NoBorder | WDestructiveClose ) 58LoginWindowImpl::LoginWindowImpl ( ) : LoginWindow ( 0, "LOGIN-WINDOW", WStyle_Customize | WStyle_NoBorder | WDestructiveClose )
58{ 59{
59 QPopupMenu *pop = new QPopupMenu ( this ); 60 QPopupMenu *pop = new QPopupMenu ( this );
60 pop-> insertItem ( tr( "Restart" ), this, SLOT( restart())); 61 pop-> insertItem ( tr( "Restart" ), this, SLOT( restart()));
61 pop-> insertItem ( tr( "Quit" ), this, SLOT( quit())); 62 pop-> insertItem ( tr( "Quit" ), this, SLOT( quit()));
@@ -81,34 +82,39 @@ LoginWindowImpl::LoginWindowImpl ( ) : LoginWindow ( 0, "LOGIN-WINDOW", WStyle_C
81 } 82 }
82 83
83 QString opiedir = ::getenv ( "OPIEDIR" ); 84 QString opiedir = ::getenv ( "OPIEDIR" );
84 QPixmap bgpix ( opiedir + "/pics/launcher/opie-background.jpg" ); 85 QPixmap bgpix ( opiedir + "/pics/launcher/opie-background.jpg" );
85 86
86 if ( !bgpix. isNull ( )) { 87 if ( !bgpix. isNull ( )) {
87 setBackgroundPixmap ( bgpix ); 88 setBackgroundPixmap ( bgpix );
88 m_caption-> setBackgroundPixmap ( bgpix); 89 m_caption-> setBackgroundPixmap ( bgpix);
89 TextLabel1-> setBackgroundPixmap ( bgpix); 90 TextLabel1-> setBackgroundPixmap ( bgpix);
90 TextLabel2-> setBackgroundPixmap ( bgpix); 91 TextLabel2-> setBackgroundPixmap ( bgpix);
91 } 92 }
92 93
93 m_caption-> setText ( tr("<center>Welcome to OPIE %1</center><center>& %2 %3</center>"). arg(QPE_VERSION). arg ( ODevice::inst ( )-> systemString ( )). arg ( ODevice::inst ( )-> systemVersionString ( ))); 94 //m_caption-> setText ( tr("<center>Welcome to OPIE %1</center><center>& %2 %3</center>"). arg(QPE_VERSION). arg ( ODevice::inst ( )-> systemString ( )). arg ( ODevice::inst ( )-> systemVersionString ( )));
94 95
95 Config cfg ( "opie-login" ); 96 Config cfg ( "opie-login" );
96 cfg. setGroup ( "General" ); 97 cfg. setGroup ( "General" );
97 QString last = cfg. readEntry ( "LastLogin" ); 98 QString last = cfg. readEntry ( "LastLogin" );
98 99
99 if ( !last. isEmpty ( )) 100 if ( !last. isEmpty ( ))
100 m_user-> setEditText ( last ); 101 m_user-> setEditText ( last );
101 102
102 calcMaxWindowRect ( ); 103 calcMaxWindowRect ( );
104
105 if ( PasswordDialogImpl::needDialog() )
106 QTimer::singleShot(10, this, SLOT(showPasswordDialog()) );
107
108
103} 109}
104 110
105LoginWindowImpl::~LoginWindowImpl ( ) 111LoginWindowImpl::~LoginWindowImpl ( )
106{ 112{
107} 113}
108 114
109 115
110void LoginWindowImpl::receive ( const QCString &msg, const QByteArray &data ) 116void LoginWindowImpl::receive ( const QCString &msg, const QByteArray &data )
111{ 117{
112 QDataStream stream ( data, IO_ReadOnly ); 118 QDataStream stream ( data, IO_ReadOnly );
113 119
114 if ( msg == "hideInputMethod()" ) 120 if ( msg == "hideInputMethod()" )
@@ -239,12 +245,18 @@ void LoginWindowImpl::login ( )
239 lApp-> setLoginAs ( user ); 245 lApp-> setLoginAs ( user );
240 246
241 // Draw a big wait icon, the image can be altered in later revisions 247 // Draw a big wait icon, the image can be altered in later revisions
242 m_input-> hideInputMethod ( ); 248 m_input-> hideInputMethod ( );
243 new WaitLogo ( ); 249 new WaitLogo ( );
244 // WaitLogo::showEvent() calls qApp-> quit() 250 // WaitLogo::showEvent() calls qApp-> quit()
245 } 251 }
246 else { 252 else {
247 QMessageBox::warning ( this, tr( "Wrong password" ), tr( "The given password is incorrect." )); 253 QMessageBox::warning ( this, tr( "Wrong password" ), tr( "The given password is incorrect." ));
248 m_password-> clear ( ); 254 m_password-> clear ( );
249 } 255 }
250} 256}
257
258void LoginWindowImpl::showPasswordDialog() {
259 PasswordDialogImpl dia( this );
260 dia.showMaximized();
261 dia.exec();
262}