summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/opie-login/config.in2
-rw-r--r--core/opie-login/loginwindowimpl.cpp26
-rw-r--r--core/opie-login/main.cpp10
3 files changed, 19 insertions, 19 deletions
diff --git a/core/opie-login/config.in b/core/opie-login/config.in
index 339b589..a71319c 100644
--- a/core/opie-login/config.in
+++ b/core/opie-login/config.in
@@ -1,4 +1,4 @@
1 config OPIE-LOGIN 1 config OPIE-LOGIN
2 boolean "opie-login (Initial Login app, ala xdm/kdm/gdm)" 2 boolean "opie-login (Initial Login app, ala xdm/kdm/gdm)"
3 default "y" 3 default "y"
4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE 4 depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIECORE2
diff --git a/core/opie-login/loginwindowimpl.cpp b/core/opie-login/loginwindowimpl.cpp
index e1b9360..32f98f3 100644
--- a/core/opie-login/loginwindowimpl.cpp
+++ b/core/opie-login/loginwindowimpl.cpp
@@ -21,144 +21,144 @@
21  -_. . .   )=.  = see the file COPYING. If not, write to the 21  -_. . .   )=.  = see the file COPYING. If not, write to the
22    --        :-=` Free Software Foundation, Inc., 22    --        :-=` Free Software Foundation, Inc.,
23 59 Temple Place - Suite 330, 23 59 Temple Place - Suite 330,
24 Boston, MA 02111-1307, USA. 24 Boston, MA 02111-1307, USA.
25 25
26*/ 26*/
27#include <qpe/version.h> 27#include <qpe/version.h>
28#include <qpushbutton.h> 28#include <qpushbutton.h>
29#include <qlayout.h> 29#include <qlayout.h>
30#include <qlineedit.h> 30#include <qlineedit.h>
31#include <qtimer.h> 31#include <qtimer.h>
32#include <qcombobox.h> 32#include <qcombobox.h>
33#include <qlabel.h> 33#include <qlabel.h>
34#include <qpopupmenu.h> 34#include <qpopupmenu.h>
35#include <qmessagebox.h> 35#include <qmessagebox.h>
36#if QT_VERSION < 300 36#if QT_VERSION < 300
37#include <qgfx_qws.h> 37#include <qgfx_qws.h>
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 <opie/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 "loginwindowimpl.h" 50#include "loginwindowimpl.h"
51#include "loginapplication.h" 51#include "loginapplication.h"
52#include "inputmethods.h" 52#include "inputmethods.h"
53 53
54using namespace Opie; 54using namespace Opie::Core;
55 55
56 56
57LoginWindowImpl::LoginWindowImpl ( ) : LoginWindow ( 0, "LOGIN-WINDOW", WStyle_Customize | WStyle_NoBorder | WDestructiveClose ) 57LoginWindowImpl::LoginWindowImpl ( ) : LoginWindow ( 0, "LOGIN-WINDOW", WStyle_Customize | WStyle_NoBorder | WDestructiveClose )
58{ 58{
59 QPopupMenu *pop = new QPopupMenu ( this ); 59 QPopupMenu *pop = new QPopupMenu ( this );
60 pop-> insertItem ( tr( "Restart" ), this, SLOT( restart())); 60 pop-> insertItem ( tr( "Restart" ), this, SLOT( restart()));
61 pop-> insertItem ( tr( "Quit" ), this, SLOT( quit())); 61 pop-> insertItem ( tr( "Quit" ), this, SLOT( quit()));
62 m_menu-> setPopup ( pop ); 62 m_menu-> setPopup ( pop );
63 63
64 QCopChannel *channel = new QCopChannel ( "QPE/TaskBar", this ); 64 QCopChannel *channel = new QCopChannel ( "QPE/TaskBar", this );
65 connect ( channel, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( receive(const QCString&,const QByteArray&))); 65 connect ( channel, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( receive(const QCString&,const QByteArray&)));
66 66
67 QHBoxLayout *lay = new QHBoxLayout ( m_taskbar, 4, 4 ); 67 QHBoxLayout *lay = new QHBoxLayout ( m_taskbar, 4, 4 );
68 m_input = new InputMethods ( m_taskbar ); 68 m_input = new InputMethods ( m_taskbar );
69 connect ( m_input, SIGNAL( inputToggled(bool)), this, SLOT( calcMaxWindowRect())); 69 connect ( m_input, SIGNAL( inputToggled(bool)), this, SLOT( calcMaxWindowRect()));
70 lay-> addWidget ( m_input ); 70 lay-> addWidget ( m_input );
71 lay-> addStretch ( 10 ); 71 lay-> addStretch ( 10 );
72 72
73 setActiveWindow ( ); 73 setActiveWindow ( );
74 m_password-> setFocus ( ); 74 m_password-> setFocus ( );
75 75
76 m_user-> insertStringList ( lApp-> allUsers ( )); 76 m_user-> insertStringList ( lApp-> allUsers ( ));
77 77
78 //there is no point in displaying the IM for a zaurus 78 //there is no point in displaying the IM for a zaurus
79 if (ODevice::inst ( )-> series ( ) != Model_Zaurus){ 79 if (ODevice::inst ( )-> series ( ) != Model_Zaurus){
80 QTimer::singleShot ( 0, this, SLOT( showIM())); 80 QTimer::singleShot ( 0, this, SLOT( showIM()));
81 } 81 }
82 82
83 QString opiedir = ::getenv ( "OPIEDIR" ); 83 QString opiedir = ::getenv ( "OPIEDIR" );
84 QPixmap bgpix ( opiedir + "/pics/launcher/opie-background.jpg" ); 84 QPixmap bgpix ( opiedir + "/pics/launcher/opie-background.jpg" );
85 85
86 if ( !bgpix. isNull ( )) { 86 if ( !bgpix. isNull ( )) {
87 setBackgroundPixmap ( bgpix ); 87 setBackgroundPixmap ( bgpix );
88 m_caption-> setBackgroundPixmap ( bgpix); 88 m_caption-> setBackgroundPixmap ( bgpix);
89 TextLabel1-> setBackgroundPixmap ( bgpix); 89 TextLabel1-> setBackgroundPixmap ( bgpix);
90 TextLabel2-> setBackgroundPixmap ( bgpix); 90 TextLabel2-> setBackgroundPixmap ( bgpix);
91 } 91 }
92 92
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 ( ))); 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 94
95 Config cfg ( "opie-login" ); 95 Config cfg ( "opie-login" );
96 cfg. setGroup ( "General" ); 96 cfg. setGroup ( "General" );
97 QString last = cfg. readEntry ( "LastLogin" ); 97 QString last = cfg. readEntry ( "LastLogin" );
98 98
99 if ( !last. isEmpty ( )) 99 if ( !last. isEmpty ( ))
100 m_user-> setEditText ( last ); 100 m_user-> setEditText ( last );
101 101
102 calcMaxWindowRect ( ); 102 calcMaxWindowRect ( );
103} 103}
104 104
105LoginWindowImpl::~LoginWindowImpl ( ) 105LoginWindowImpl::~LoginWindowImpl ( )
106{ 106{
107} 107}
108 108
109 109
110void LoginWindowImpl::receive ( const QCString &msg, const QByteArray &data ) 110void LoginWindowImpl::receive ( const QCString &msg, const QByteArray &data )
111{ 111{
112 QDataStream stream ( data, IO_ReadOnly ); 112 QDataStream stream ( data, IO_ReadOnly );
113 113
114 if ( msg == "hideInputMethod()" ) 114 if ( msg == "hideInputMethod()" )
115 m_input-> hideInputMethod ( ); 115 m_input-> hideInputMethod ( );
116 else if ( msg == "showInputMethod()" ) 116 else if ( msg == "showInputMethod()" )
117 m_input-> showInputMethod ( ); 117 m_input-> showInputMethod ( );
118 else if ( msg == "reloadInputMethods()" ) 118 else if ( msg == "reloadInputMethods()" )
119 m_input-> loadInputMethods ( ); 119 m_input-> loadInputMethods ( );
120} 120}
121 121
122void LoginWindowImpl::calcMaxWindowRect ( ) 122void LoginWindowImpl::calcMaxWindowRect ( )
123{ 123{
124#ifdef Q_WS_QWS 124#ifdef Q_WS_QWS
125 QRect wr; 125 QRect wr;
126 int displayWidth = qApp-> desktop ( )-> width ( ); 126 int displayWidth = qApp-> desktop ( )-> width ( );
127 QRect ir = m_input-> inputRect ( ); 127 QRect ir = m_input-> inputRect ( );
128 if ( ir.isValid() ) 128 if ( ir.isValid() )
129 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); 129 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 );
130 else 130 else
131 wr.setCoords( 0, 0, displayWidth-1, m_taskbar->y()-1 ); 131 wr.setCoords( 0, 0, displayWidth-1, m_taskbar->y()-1 );
132 132
133#if QT_VERSION < 300 133#if QT_VERSION < 300
134 wr = qt_screen-> mapToDevice ( wr, QSize ( qt_screen-> width ( ), qt_screen-> height ( ))); 134 wr = qt_screen-> mapToDevice ( wr, QSize ( qt_screen-> width ( ), qt_screen-> height ( )));
135#endif 135#endif
136 136
137 QWSServer::setMaxWindowRect( wr ); 137 QWSServer::setMaxWindowRect( wr );
138#endif 138#endif
139} 139}
140 140
141 141
142void LoginWindowImpl::keyPressEvent ( QKeyEvent *e ) 142void LoginWindowImpl::keyPressEvent ( QKeyEvent *e )
143{ 143{
144 switch ( e-> key ( )) { 144 switch ( e-> key ( )) {
145 case HardKey_Suspend: suspend ( ); 145 case HardKey_Suspend: suspend ( );
146 break; 146 break;
147 case HardKey_Backlight: backlight ( ); 147 case HardKey_Backlight: backlight ( );
148 break; 148 break;
149 default: e-> ignore ( ); 149 default: e-> ignore ( );
150 break; 150 break;
151 } 151 }
152 LoginWindow::keyPressEvent ( e ); 152 LoginWindow::keyPressEvent ( e );
153} 153}
154 154
155 155
156void LoginWindowImpl::toggleEchoMode ( bool t ) 156void LoginWindowImpl::toggleEchoMode ( bool t )
157{ 157{
158 m_password-> setEchoMode ( t ? QLineEdit::Normal : QLineEdit::Password ); 158 m_password-> setEchoMode ( t ? QLineEdit::Normal : QLineEdit::Password );
159} 159}
160 160
161void LoginWindowImpl::showIM ( ) 161void LoginWindowImpl::showIM ( )
162{ 162{
163 m_input-> showInputMethod ( ); 163 m_input-> showInputMethod ( );
164} 164}
diff --git a/core/opie-login/main.cpp b/core/opie-login/main.cpp
index 6aa7287..f0a8ba2 100644
--- a/core/opie-login/main.cpp
+++ b/core/opie-login/main.cpp
@@ -11,73 +11,73 @@
11    .%`+i>       _;_. 11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This file is distributed in the hope that 12    .i_,=:_.      -<s. This file is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of 14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
17..}^=.=       =       ; Public License for more details. 17..}^=.=       =       ; Public License for more details.
18++=   -.     .`     .: 18++=   -.     .`     .:
19 :     =  ...= . :.=- You should have received a copy of the GNU 19 :     =  ...= . :.=- You should have received a copy of the GNU
20 -.   .:....=;==+<; General Public License along with this file; 20 -.   .:....=;==+<; General Public License along with this file;
21  -_. . .   )=.  = see the file COPYING. If not, write to the 21  -_. . .   )=.  = see the file COPYING. If not, write to the
22    --        :-=` Free Software Foundation, Inc., 22    --        :-=` Free Software Foundation, Inc.,
23 59 Temple Place - Suite 330, 23 59 Temple Place - Suite 330,
24 Boston, MA 02111-1307, USA. 24 Boston, MA 02111-1307, USA.
25 25
26*/ 26*/
27 27
28#include "loginapplication.h" 28#include "loginapplication.h"
29#include "loginwindowimpl.h" 29#include "loginwindowimpl.h"
30#include "calibrate.h" 30#include "calibrate.h"
31 31
32/* OPIE */ 32/* OPIE */
33#include <opie2/odevice.h> 33#include <opie2/odevice.h>
34#include <qpe/qpestyle.h> 34#include <qpe/qpestyle.h>
35#include <qpe/power.h> 35#include <qpe/power.h>
36#include <qpe/config.h> 36#include <qpe/config.h>
37 37
38/* QT */ 38/* QT */
39#include <qwindowsystem_qws.h> 39#include <qwindowsystem_qws.h>
40#include <qmessagebox.h> 40#include <qmessagebox.h>
41#include <qlabel.h> 41#include <qlabel.h>
42#include <qtimer.h> 42#include <qtimer.h>
43#include <qfile.h> 43#include <qfile.h>
44 44
45/* STD */ 45/* STD */
46#include <sys/types.h> 46#include <sys/types.h>
47#include <time.h> 47#include <time.h>
48#include <sys/time.h> 48#include <sys/time.h>
49#include <sys/resource.h> 49#include <sys/resource.h>
50#include <unistd.h> 50#include <unistd.h>
51#include <syslog.h> 51#include <syslog.h>
52#include <sys/wait.h> 52#include <sys/wait.h>
53#include <stdio.h> 53#include <stdio.h>
54#include <stdlib.h> 54#include <stdlib.h>
55#include <signal.h> 55#include <signal.h>
56#include <getopt.h> 56#include <getopt.h>
57#include <string.h> 57#include <string.h>
58 58
59using namespace Opie; 59using namespace Opie::Core;
60 60
61int login_main ( int argc, char **argv, pid_t ppid ); 61int login_main ( int argc, char **argv, pid_t ppid );
62void sigterm ( int sig ); 62void sigterm ( int sig );
63void sigint ( int sig ); 63void sigint ( int sig );
64void exit_closelog ( ); 64void exit_closelog ( );
65 65
66static struct option long_options [] = { 66static struct option long_options [] = {
67 { "autologin", 1, 0, 'a' }, 67 { "autologin", 1, 0, 'a' },
68 { 0, 0, 0, 0 } 68 { 0, 0, 0, 0 }
69}; 69};
70 70
71 71
72int main ( int argc, char **argv ) 72int main ( int argc, char **argv )
73{ 73{
74 int userExited = 0; 74 int userExited = 0;
75 pid_t ppid = ::getpid ( ); 75 pid_t ppid = ::getpid ( );
76 76
77 if ( ::geteuid ( ) != 0 ) { 77 if ( ::geteuid ( ) != 0 ) {
78 ::fprintf ( stderr, "%s can only be executed by root. (or chmod +s)", argv [0] ); 78 ::fprintf ( stderr, "%s can only be executed by root. (or chmod +s)", argv [0] );
79 return 1; 79 return 1;
80 } 80 }
81 if ( ::getuid ( ) != 0 ) // qt doesn't really like SUID and 81 if ( ::getuid ( ) != 0 ) // qt doesn't really like SUID and
82 ::setuid ( 0 ); // messes up things like config files 82 ::setuid ( 0 ); // messes up things like config files
83 83
@@ -167,57 +167,57 @@ int main ( int argc, char **argv )
167 // const char *sig = ::strsignal ( killedbysig ); 167 // const char *sig = ::strsignal ( killedbysig );
168 const char *sig = ::sys_siglist[killedbysig]; 168 const char *sig = ::sys_siglist[killedbysig];
169 QLabel *l = new QLabel ( 0, "sig", Qt::WStyle_Customize | Qt::WStyle_NoBorder | Qt::WStyle_Tool ); 169 QLabel *l = new QLabel ( 0, "sig", Qt::WStyle_Customize | Qt::WStyle_NoBorder | Qt::WStyle_Tool );
170 l-> setText ( LoginWindowImpl::tr( "Opie was terminated\nby an uncaught signal\n(%1)\n" ). arg ( sig )); 170 l-> setText ( LoginWindowImpl::tr( "Opie was terminated\nby an uncaught signal\n(%1)\n" ). arg ( sig ));
171 l-> setAlignment ( Qt::AlignCenter ); 171 l-> setAlignment ( Qt::AlignCenter );
172 l-> move ( 0, 0 ); 172 l-> move ( 0, 0 );
173 l-> resize ( app-> desktop ( )-> width ( ), app-> desktop ( )-> height ( )); 173 l-> resize ( app-> desktop ( )-> width ( ), app-> desktop ( )-> height ( ));
174 l-> show ( ); 174 l-> show ( );
175 QTimer::singleShot ( 3000, app, SLOT( quit())); 175 QTimer::singleShot ( 3000, app, SLOT( quit()));
176 app-> exec ( ); 176 app-> exec ( );
177 delete app; 177 delete app;
178 qApp = 0; 178 qApp = 0;
179 } 179 }
180 } 180 }
181 else { 181 else {
182 if ( !autolog ) { 182 if ( !autolog ) {
183 QString confFile=QPEApplication::qpeDir() + "/etc/opie-login.conf"; 183 QString confFile=QPEApplication::qpeDir() + "/etc/opie-login.conf";
184 Config cfg ( confFile, Config::File ); 184 Config cfg ( confFile, Config::File );
185 cfg. setGroup ( "General" ); 185 cfg. setGroup ( "General" );
186 QString user = cfg. readEntry ( "AutoLogin" ); 186 QString user = cfg. readEntry ( "AutoLogin" );
187 187
188 if ( !user. isEmpty ( )) 188 if ( !user. isEmpty ( ))
189 autolog = ::strdup ( user. latin1 ( )); 189 autolog = ::strdup ( user. latin1 ( ));
190 } 190 }
191 191
192 if ( autolog && !userExited ) { 192 if ( autolog && !userExited ) {
193 193
194 QWSServer::setDesktopBackground( QImage() ); 194 QWSServer::setDesktopBackground( QImage() );
195 ODevice::inst ( )-> setDisplayStatus ( true ); 195 ODevice::inst ( )-> setDisplayStatus ( true );
196 ODevice::inst ( )-> setSoftSuspend ( false ); 196 ODevice::inst ( )-> setSoftSuspend ( false );
197 LoginApplication *app = new LoginApplication ( argc, argv, ppid ); 197 LoginApplication *app = new LoginApplication ( argc, argv, ppid );
198 LoginApplication::setLoginAs ( autolog ); 198 LoginApplication::setLoginAs ( autolog );
199 199
200 200
201 if ( LoginApplication::changeIdentity ( )) 201 if ( LoginApplication::changeIdentity ( ))
202 ::exit ( LoginApplication::login ( )); 202 ::exit ( LoginApplication::login ( ));
203 else 203 else
204 ::exit ( 0 ); 204 ::exit ( 0 );
205 } 205 }
206 else { 206 else {
207 ::exit ( login_main ( argc, argv, ppid )); 207 ::exit ( login_main ( argc, argv, ppid ));
208 } 208 }
209 } 209 }
210 } 210 }
211 return 0; 211 return 0;
212} 212}
213 213
214void sigterm ( int /*sig*/ ) 214void sigterm ( int /*sig*/ )
215{ 215{
216 ::exit ( 0 ); 216 ::exit ( 0 );
217} 217}
218 218
219 219
220void exit_closelog ( ) 220void exit_closelog ( )
221{ 221{
222 ::closelog ( ); 222 ::closelog ( );
223} 223}