summaryrefslogtreecommitdiff
authorkergoth <kergoth>2002-03-28 23:34:43 (UTC)
committer kergoth <kergoth>2002-03-28 23:34:43 (UTC)
commit6c6f578fa5ef1f83cf1ba4978015663360ac2e7e (patch) (unidiff)
tree64cc4c7dc96e9f7439368a696e46e561be79fa4c
parented6bcbba1164cc2235b6d21f20b1de416d36cac2 (diff)
downloadopie-6c6f578fa5ef1f83cf1ba4978015663360ac2e7e.zip
opie-6c6f578fa5ef1f83cf1ba4978015663360ac2e7e.tar.gz
opie-6c6f578fa5ef1f83cf1ba4978015663360ac2e7e.tar.bz2
moved taskbar/ to launcher/.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile14
-rw-r--r--core/launcher/taskbar.cpp4
-rw-r--r--core/opie-login/README2
-rw-r--r--core/opie-login/qdmdialogimpl.cpp2
4 files changed, 11 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index 24a9050..01aba30 100644
--- a/Makefile
+++ b/Makefile
@@ -1,71 +1,71 @@
1default: dynamic 1default: dynamic
2 2
3all: default docs 3all: default docs
4 4
5LIBS=library libopie 5LIBS=library libopie
6 6
7COMPONENTS=$(LOCALCOMPONENTS) inputmethods/keyboard \ 7COMPONENTS=$(LOCALCOMPONENTS) inputmethods/keyboard \
8 inputmethods/pickboard \ 8 inputmethods/pickboard \
9 inputmethods/handwriting \ 9 inputmethods/handwriting \
10 inputmethods/unikeyboard \ 10 inputmethods/unikeyboard \
11 inputmethods/jumpx \ 11 inputmethods/jumpx \
12 inputmethods/dvorak \ 12 inputmethods/dvorak \
13 taskbar/batteryapplet \ 13 launcher/batteryapplet \
14 taskbar/volumeapplet \ 14 launcher/volumeapplet \
15 taskbar/clockapplet \ 15 launcher/clockapplet \
16 taskbar/netmonapplet \ 16 launcher/netmonapplet \
17 taskbar/screenshotapplet \ 17 launcher/screenshotapplet \
18 taskbar/vmemo \ 18 launcher/vmemo \
19 netsetup/dialup \ 19 netsetup/dialup \
20 netsetup/lan \ 20 netsetup/lan \
21 opiemail/ifaces/pop3 opiemail/ifaces/smtp \ 21 opiemail/ifaces/pop3 opiemail/ifaces/smtp \
22 mpegplayer/libmpeg3 \ 22 mpegplayer/libmpeg3 \
23 mpegplayer/libmad \ 23 mpegplayer/libmad \
24 mpegplayer/wavplugin \ 24 mpegplayer/wavplugin \
25 cardmon \ 25 cardmon \
26 sdmon 26 sdmon
27 27
28APPS=$(LOCALAPPS) core/addressbook calculator clock datebook \ 28APPS=$(LOCALAPPS) core/addressbook calculator clock datebook \
29 filebrowser helpbrowser minesweep mpegplayer \ 29 filebrowser helpbrowser minesweep mpegplayer \
30 settings/light-and-power \ 30 settings/light-and-power \
31 settings/language \ 31 settings/language \
32 settings/rotation \ 32 settings/rotation \
33 settings/appearance \ 33 settings/appearance \
34 settings/security \ 34 settings/security \
35 settings/sound \ 35 settings/sound \
36 settings/systemtime \ 36 settings/systemtime \
37 solitaire spreadsheet tetrix textedit \ 37 solitaire spreadsheet tetrix textedit \
38 todo wordgame embeddedkonsole taskbar sysinfo \ 38 todo wordgame embeddedkonsole launcher sysinfo \
39 parashoot snake citytime showimg netsetup tableviewer \ 39 parashoot snake citytime showimg netsetup tableviewer \
40 qipkg mindbreaker go qasteroids qcop fifteen keypebble today opiemail/converter opiemail \ 40 qipkg mindbreaker go qasteroids qcop fifteen keypebble today opiemail/converter opiemail \
41 noncore/tictac noncore/opieftp noncore/drawpad noncore/kcheckers 41 noncore/tictac noncore/opieftp noncore/drawpad noncore/kcheckers
42 42
43DOCS = docs/src/opie-policy 43DOCS = docs/src/opie-policy
44single: mpegplayer/libmpeg3 44single: mpegplayer/libmpeg3
45 45
46dynamic: $(APPS) 46dynamic: $(APPS)
47 47
48docs: $(DOCS) 48docs: $(DOCS)
49 49
50$(COMPONENTS): $(LIBS) 50$(COMPONENTS): $(LIBS)
51 51
52$(APPS): $(LIBS) $(COMPONENTS) 52$(APPS): $(LIBS) $(COMPONENTS)
53 53
54$(LIBS) $(COMPONENTS) $(APPS) $(DOCS) single: 54$(LIBS) $(COMPONENTS) $(APPS) $(DOCS) single:
55 $(MAKE) -C $@ -f Makefile 55 $(MAKE) -C $@ -f Makefile
56 56
57showcomponents: 57showcomponents:
58 @echo $(LIBS) $(APPS) $(COMPONENTS) single 58 @echo $(LIBS) $(APPS) $(COMPONENTS) single
59 59
60clean: 60clean:
61 $(MAKE) -C single -f Makefile $@ 61 $(MAKE) -C single -f Makefile $@
62 for dir in $(APPS) $(LIBS) $(COMPONENTS) $(DOCS); do $(MAKE) -C $$dir -f Makefile $@ || exit 1; done 62 for dir in $(APPS) $(LIBS) $(COMPONENTS) $(DOCS); do $(MAKE) -C $$dir -f Makefile $@ || exit 1; done
63 63
64lupdate: 64lupdate:
65 for dir in $(APPS) $(LIBS) $(COMPONENTS); do $(MAKE) -C $$dir -f Makefile $@ || exit 1; done 65 for dir in $(APPS) $(LIBS) $(COMPONENTS); do $(MAKE) -C $$dir -f Makefile $@ || exit 1; done
66 66
67lrelease: 67lrelease:
68 for dir in $(APPS) $(LIBS) $(COMPONENTS); do $(MAKE) -C $$dir -f Makefile $@ || exit 1; done 68 for dir in $(APPS) $(LIBS) $(COMPONENTS); do $(MAKE) -C $$dir -f Makefile $@ || exit 1; done
69 69
70 70
71.PHONY: default dynamic $(LIBS) $(APPS) $(COMPONENTS) $(DOCS) single showcomponents clean 71.PHONY: default dynamic $(LIBS) $(APPS) $(COMPONENTS) $(DOCS) single showcomponents clean
diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp
index d7f36bd..18d28cb 100644
--- a/core/launcher/taskbar.cpp
+++ b/core/launcher/taskbar.cpp
@@ -1,314 +1,314 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "startmenu.h" 21#include "startmenu.h"
22#include "inputmethods.h" 22#include "inputmethods.h"
23#include "mrulist.h" 23#include "mrulist.h"
24#include "systray.h" 24#include "systray.h"
25#include "calibrate.h" 25#include "calibrate.h"
26#include "wait.h" 26#include "wait.h"
27#include "appicons.h" 27#include "appicons.h"
28 28
29#include "taskbar.h" 29#include "taskbar.h"
30#include "desktop.h" 30#include "desktop.h"
31 31
32#include <qpe/qpeapplication.h> 32#include <qpe/qpeapplication.h>
33#include <qpe/qcopenvelope_qws.h> 33#include <qpe/qcopenvelope_qws.h>
34#include <qpe/global.h> 34#include <qpe/global.h>
35#ifdef QT_QWS_CUSTOM 35#ifdef QT_QWS_CUSTOM
36#include <qpe/custom.h> 36#include <qpe/custom.h>
37#endif 37#endif
38 38
39#include <qlabel.h> 39#include <qlabel.h>
40#include <qlayout.h> 40#include <qlayout.h>
41#include <qtimer.h> 41#include <qtimer.h>
42#include <qwindowsystem_qws.h> 42#include <qwindowsystem_qws.h>
43#include <qwidgetstack.h> 43#include <qwidgetstack.h>
44 44
45#if defined( Q_WS_QWS ) 45#if defined( Q_WS_QWS )
46#include <qwsdisplay_qws.h> 46#include <qwsdisplay_qws.h>
47#include <qgfx_qws.h> 47#include <qgfx_qws.h>
48#endif 48#endif
49 49
50 50
51#define FACTORY(T) \ 51#define FACTORY(T) \
52 static QWidget *new##T( bool maximized ) { \ 52 static QWidget *new##T( bool maximized ) { \
53 QWidget *w = new T( 0, "test", QWidget::WDestructiveClose | QWidget::WGroupLeader ); \ 53 QWidget *w = new T( 0, "test", QWidget::WDestructiveClose | QWidget::WGroupLeader ); \
54 if ( maximized ) { \ 54 if ( maximized ) { \
55 if ( qApp->desktop()->width() <= 350 ) { \ 55 if ( qApp->desktop()->width() <= 350 ) { \
56 w->showMaximized(); \ 56 w->showMaximized(); \
57 } else { \ 57 } else { \
58 w->resize( QSize( 300, 300 ) ); \ 58 w->resize( QSize( 300, 300 ) ); \
59 } \ 59 } \
60 } \ 60 } \
61 w->show(); \ 61 w->show(); \
62 return w; \ 62 return w; \
63 } 63 }
64 64
65 65
66#ifdef SINGLE_APP 66#ifdef SINGLE_APP
67#define APP(a,b,c,d) FACTORY(b) 67#define APP(a,b,c,d) FACTORY(b)
68#include "../taskbar/apps.h" 68#include "../launcher/apps.h"
69#undef APP 69#undef APP
70#endif // SINGLE_APP 70#endif // SINGLE_APP
71 71
72static Global::Command builtins[] = { 72static Global::Command builtins[] = {
73 73
74#ifdef SINGLE_APP 74#ifdef SINGLE_APP
75#define APP(a,b,c,d) { a, new##b, c }, 75#define APP(a,b,c,d) { a, new##b, c },
76#include "../taskbar/apps.h" 76#include "../launcher/apps.h"
77#undef APP 77#undef APP
78#endif 78#endif
79 79
80#if defined(QT_QWS_IPAQ) || defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_EBX) 80#if defined(QT_QWS_IPAQ) || defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_EBX)
81 { "calibrate", TaskBar::calibrate,1, 0 }, 81 { "calibrate", TaskBar::calibrate,1, 0 },
82#endif 82#endif
83#if !defined(QT_QWS_CASSIOPEIA) 83#if !defined(QT_QWS_CASSIOPEIA)
84 { "shutdown", Global::shutdown, 1, 0 }, 84 { "shutdown", Global::shutdown, 1, 0 },
85 // { "run", run, 1, 0 }, 85 // { "run", run, 1, 0 },
86#endif 86#endif
87 87
88 { 0, TaskBar::calibrate,0, 0 }, 88 { 0, TaskBar::calibrate,0, 0 },
89}; 89};
90 90
91static bool initNumLock() 91static bool initNumLock()
92{ 92{
93#ifdef QPE_INITIAL_NUMLOCK_STATE 93#ifdef QPE_INITIAL_NUMLOCK_STATE
94 QPE_INITIAL_NUMLOCK_STATE 94 QPE_INITIAL_NUMLOCK_STATE
95#endif 95#endif
96 return FALSE; 96 return FALSE;
97} 97}
98 98
99class LockKeyState : public QWidget 99class LockKeyState : public QWidget
100{ 100{
101public: 101public:
102 LockKeyState( QWidget *parent ) : 102 LockKeyState( QWidget *parent ) :
103 QWidget(parent), 103 QWidget(parent),
104 nl(initNumLock()), cl(FALSE) 104 nl(initNumLock()), cl(FALSE)
105 { 105 {
106 nl_pm = Resource::loadPixmap("numlock"); 106 nl_pm = Resource::loadPixmap("numlock");
107 cl_pm = Resource::loadPixmap("capslock"); 107 cl_pm = Resource::loadPixmap("capslock");
108 } 108 }
109 QSize sizeHint() const 109 QSize sizeHint() const
110 { 110 {
111 return QSize(nl_pm.width()+2,nl_pm.width()+nl_pm.height()+1); 111 return QSize(nl_pm.width()+2,nl_pm.width()+nl_pm.height()+1);
112 } 112 }
113 void toggleNumLockState() 113 void toggleNumLockState()
114 { 114 {
115 nl = !nl; repaint(); 115 nl = !nl; repaint();
116 } 116 }
117 void toggleCapsLockState() 117 void toggleCapsLockState()
118 { 118 {
119 cl = !cl; repaint(); 119 cl = !cl; repaint();
120 } 120 }
121 void paintEvent( QPaintEvent * ) 121 void paintEvent( QPaintEvent * )
122 { 122 {
123 int y = (height()-sizeHint().height())/2; 123 int y = (height()-sizeHint().height())/2;
124 QPainter p(this); 124 QPainter p(this);
125 if ( nl ) 125 if ( nl )
126 p.drawPixmap(1,y,nl_pm); 126 p.drawPixmap(1,y,nl_pm);
127 if ( cl ) 127 if ( cl )
128 p.drawPixmap(1,y+nl_pm.height()+1,cl_pm); 128 p.drawPixmap(1,y+nl_pm.height()+1,cl_pm);
129 } 129 }
130private: 130private:
131 QPixmap nl_pm, cl_pm; 131 QPixmap nl_pm, cl_pm;
132 bool nl, cl; 132 bool nl, cl;
133}; 133};
134 134
135TaskBar::~TaskBar() 135TaskBar::~TaskBar()
136{ 136{
137} 137}
138 138
139 139
140TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader) 140TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader)
141{ 141{
142 Global::setBuiltinCommands(builtins); 142 Global::setBuiltinCommands(builtins);
143 143
144 sm = new StartMenu( this ); 144 sm = new StartMenu( this );
145 145
146 inputMethods = new InputMethods( this ); 146 inputMethods = new InputMethods( this );
147 connect( inputMethods, SIGNAL(inputToggled(bool)), 147 connect( inputMethods, SIGNAL(inputToggled(bool)),
148 this, SLOT(calcMaxWindowRect()) ); 148 this, SLOT(calcMaxWindowRect()) );
149 //new QuickLauncher( this ); 149 //new QuickLauncher( this );
150 150
151 stack = new QWidgetStack( this ); 151 stack = new QWidgetStack( this );
152 stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) ); 152 stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
153 label = new QLabel(stack); 153 label = new QLabel(stack);
154 154
155 mru = new MRUList( stack ); 155 mru = new MRUList( stack );
156 stack->raiseWidget( mru ); 156 stack->raiseWidget( mru );
157 157
158 waitIcon = new Wait( this ); 158 waitIcon = new Wait( this );
159 (void) new AppIcons( this ); 159 (void) new AppIcons( this );
160 160
161 sysTray = new SysTray( this ); 161 sysTray = new SysTray( this );
162 162
163 // ## make customizable in some way? 163 // ## make customizable in some way?
164#ifdef QT_QWS_CUSTOM 164#ifdef QT_QWS_CUSTOM
165 lockState = new LockKeyState( this ); 165 lockState = new LockKeyState( this );
166#else 166#else
167 lockState = 0; 167 lockState = 0;
168#endif 168#endif
169 169
170#if defined(Q_WS_QWS) 170#if defined(Q_WS_QWS)
171#if !defined(QT_NO_COP) 171#if !defined(QT_NO_COP)
172 QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this ); 172 QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this );
173 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 173 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
174 this, SLOT(receive(const QCString&, const QByteArray&)) ); 174 this, SLOT(receive(const QCString&, const QByteArray&)) );
175#endif 175#endif
176#endif 176#endif
177 waitTimer = new QTimer( this ); 177 waitTimer = new QTimer( this );
178 connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) ); 178 connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) );
179 clearer = new QTimer( this ); 179 clearer = new QTimer( this );
180 QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar())); 180 QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar()));
181 QObject::connect(clearer, SIGNAL(timeout()), sysTray, SLOT(show())); 181 QObject::connect(clearer, SIGNAL(timeout()), sysTray, SLOT(show()));
182} 182}
183 183
184void TaskBar::setStatusMessage( const QString &text ) 184void TaskBar::setStatusMessage( const QString &text )
185{ 185{
186 label->setText( text ); 186 label->setText( text );
187 stack->raiseWidget( label ); 187 stack->raiseWidget( label );
188 if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) ) 188 if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) )
189 sysTray->hide(); 189 sysTray->hide();
190 clearer->start( 3000 ); 190 clearer->start( 3000 );
191} 191}
192 192
193void TaskBar::clearStatusBar() 193void TaskBar::clearStatusBar()
194{ 194{
195 label->clear(); 195 label->clear();
196 stack->raiseWidget( mru ); 196 stack->raiseWidget( mru );
197} 197}
198 198
199void TaskBar::startWait() 199void TaskBar::startWait()
200{ 200{
201 waitIcon->setWaiting( true ); 201 waitIcon->setWaiting( true );
202 // a catchall stop after 10 seconds... 202 // a catchall stop after 10 seconds...
203 waitTimer->start( 10 * 1000, true ); 203 waitTimer->start( 10 * 1000, true );
204} 204}
205 205
206void TaskBar::stopWait(const QString& app) 206void TaskBar::stopWait(const QString& app)
207{ 207{
208 waitTimer->stop(); 208 waitTimer->stop();
209 mru->addTask(sm->execToLink(app)); 209 mru->addTask(sm->execToLink(app));
210 waitIcon->setWaiting( false ); 210 waitIcon->setWaiting( false );
211} 211}
212 212
213void TaskBar::stopWait() 213void TaskBar::stopWait()
214{ 214{
215 waitTimer->stop(); 215 waitTimer->stop();
216 waitIcon->setWaiting( false ); 216 waitIcon->setWaiting( false );
217} 217}
218 218
219void TaskBar::resizeEvent( QResizeEvent *e ) 219void TaskBar::resizeEvent( QResizeEvent *e )
220{ 220{
221 QHBox::resizeEvent( e ); 221 QHBox::resizeEvent( e );
222 calcMaxWindowRect(); 222 calcMaxWindowRect();
223} 223}
224 224
225void TaskBar::styleChange( QStyle &s ) 225void TaskBar::styleChange( QStyle &s )
226{ 226{
227 QHBox::styleChange( s ); 227 QHBox::styleChange( s );
228 calcMaxWindowRect(); 228 calcMaxWindowRect();
229} 229}
230 230
231void TaskBar::calcMaxWindowRect() 231void TaskBar::calcMaxWindowRect()
232{ 232{
233#ifdef Q_WS_QWS 233#ifdef Q_WS_QWS
234 QRect wr; 234 QRect wr;
235 int displayWidth = qApp->desktop()->width(); 235 int displayWidth = qApp->desktop()->width();
236 QRect ir = inputMethods->inputRect(); 236 QRect ir = inputMethods->inputRect();
237 if ( ir.isValid() ) { 237 if ( ir.isValid() ) {
238 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); 238 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 );
239 } else { 239 } else {
240 wr.setCoords( 0, 0, displayWidth-1, y()-1 ); 240 wr.setCoords( 0, 0, displayWidth-1, y()-1 );
241 } 241 }
242 242
243#if QT_VERSION < 300 243#if QT_VERSION < 300
244 QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr, 244 QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr,
245 QSize(qt_screen->width(),qt_screen->height())) 245 QSize(qt_screen->width(),qt_screen->height()))
246 ); 246 );
247#else 247#else
248 QWSServer::setMaxWindowRect( wr ); 248 QWSServer::setMaxWindowRect( wr );
249#endif 249#endif
250#endif 250#endif
251} 251}
252 252
253void TaskBar::receive( const QCString &msg, const QByteArray &data ) 253void TaskBar::receive( const QCString &msg, const QByteArray &data )
254{ 254{
255 QDataStream stream( data, IO_ReadOnly ); 255 QDataStream stream( data, IO_ReadOnly );
256 if ( msg == "message(QString)" ) { 256 if ( msg == "message(QString)" ) {
257 QString text; 257 QString text;
258 stream >> text; 258 stream >> text;
259 setStatusMessage( text ); 259 setStatusMessage( text );
260 } else if ( msg == "hideInputMethod()" ) { 260 } else if ( msg == "hideInputMethod()" ) {
261 inputMethods->hideInputMethod(); 261 inputMethods->hideInputMethod();
262 } else if ( msg == "showInputMethod()" ) { 262 } else if ( msg == "showInputMethod()" ) {
263 inputMethods->showInputMethod(); 263 inputMethods->showInputMethod();
264 } else if ( msg == "reloadInputMethods()" ) { 264 } else if ( msg == "reloadInputMethods()" ) {
265 inputMethods->loadInputMethods(); 265 inputMethods->loadInputMethods();
266 } else if ( msg == "reloadApplets()" ) { 266 } else if ( msg == "reloadApplets()" ) {
267 sysTray->loadApplets(); 267 sysTray->loadApplets();
268 } else if ( msg == "soundAlarm()" ) { 268 } else if ( msg == "soundAlarm()" ) {
269 Desktop::soundAlarm(); 269 Desktop::soundAlarm();
270 } 270 }
271#ifdef CUSTOM_LEDS 271#ifdef CUSTOM_LEDS
272 else if ( msg == "setLed(int,bool)" ) { 272 else if ( msg == "setLed(int,bool)" ) {
273 int led, status; 273 int led, status;
274 stream >> led >> status; 274 stream >> led >> status;
275 CUSTOM_LEDS( led, status ); 275 CUSTOM_LEDS( led, status );
276 } 276 }
277#endif 277#endif
278} 278}
279 279
280QWidget *TaskBar::calibrate(bool) 280QWidget *TaskBar::calibrate(bool)
281{ 281{
282#ifdef Q_WS_QWS 282#ifdef Q_WS_QWS
283 Calibrate *c = new Calibrate; 283 Calibrate *c = new Calibrate;
284 c->show(); 284 c->show();
285 return c; 285 return c;
286#else 286#else
287 return 0; 287 return 0;
288#endif 288#endif
289} 289}
290 290
291void TaskBar::toggleNumLockState() 291void TaskBar::toggleNumLockState()
292{ 292{
293 if ( lockState ) lockState->toggleNumLockState(); 293 if ( lockState ) lockState->toggleNumLockState();
294} 294}
295 295
296void TaskBar::toggleCapsLockState() 296void TaskBar::toggleCapsLockState()
297{ 297{
298 if ( lockState ) lockState->toggleCapsLockState(); 298 if ( lockState ) lockState->toggleCapsLockState();
299} 299}
300 300
301void TaskBar::toggleSymbolInput() 301void TaskBar::toggleSymbolInput()
302{ 302{
303 if ( inputMethods->currentShown() == "Unicode" ) { 303 if ( inputMethods->currentShown() == "Unicode" ) {
304 inputMethods->hideInputMethod(); 304 inputMethods->hideInputMethod();
305 } else { 305 } else {
306 inputMethods->showInputMethod("Unicode"); 306 inputMethods->showInputMethod("Unicode");
307 } 307 }
308} 308}
309 309
310bool TaskBar::recoverMemory() 310bool TaskBar::recoverMemory()
311{ 311{
312 return mru->quitOldApps(); 312 return mru->quitOldApps();
313} 313}
314 314
diff --git a/core/opie-login/README b/core/opie-login/README
index ad3b298..4a4234d 100644
--- a/core/opie-login/README
+++ b/core/opie-login/README
@@ -1,78 +1,78 @@
1 1
2Welcome to LISA System's 2Welcome to LISA System's
3 3
4 QDM - the Login-Dialog for QPE 4 QDM - the Login-Dialog for QPE
5 5
6 6
7WHAT'S THIS: 7WHAT'S THIS:
8 8
9This small add-on for the Qtopia Environment (QPE - see 9This small add-on for the Qtopia Environment (QPE - see
10http://qpe.sourceforge.net for further details) allows You to use your 10http://qpe.sourceforge.net for further details) allows You to use your
11handheld computer running QPE and Linux with the typical Un*x user 11handheld computer running QPE and Linux with the typical Un*x user
12handling, i.e. just log in on a graphical environment, as e.g. KDM or 12handling, i.e. just log in on a graphical environment, as e.g. KDM or
13XDM. This way your personal data can be easily protected against 13XDM. This way your personal data can be easily protected against
14unwanted access from others in case you loose your machine. 14unwanted access from others in case you loose your machine.
15 15
16 16
17STATUS: 17STATUS:
18 18
19Still in development, but should be useable. 19Still in development, but should be useable.
20 20
21 21
22REQUIREMENTS: 22REQUIREMENTS:
23 23
24- QDM needs Linux-PAM (Pluggable Authentication Modules for Linux) for 24- QDM needs Linux-PAM (Pluggable Authentication Modules for Linux) for
25 proper user validation. 25 proper user validation.
26 26
27- the /dev/fb0 device has to writeable to everyone ;-( 27- the /dev/fb0 device has to writeable to everyone ;-(
28 28
29 29
30INSTALLATION: 30INSTALLATION:
31 31
32Per default this little add-on is not enabled. You have to do so 32Per default this little add-on is not enabled. You have to do so
33yourself for now, by setting a compile option variable called 33yourself for now, by setting a compile option variable called
34QT_QWS_LOGIN . Furthermore there have to be made some changes in 34QT_QWS_LOGIN . Furthermore there have to be made some changes in
35taskbar/taskbar.pro : 35launcher/taskbar.pro :
36 36
37At the section HEADERS insert a line: 37At the section HEADERS insert a line:
38 ../login/qdmdialogimpl.h \ 38 ../login/qdmdialogimpl.h \
39 39
40At the section SOURCES insert a line: 40At the section SOURCES insert a line:
41 ../login/qdmdialogimpl.cpp \ 41 ../login/qdmdialogimpl.cpp \
42 42
43 furthermore serte these lines: 43 furthermore serte these lines:
44 44
45 INCLUDEPATH+= ../login 45 INCLUDEPATH+= ../login
46 DEPENDPATH+= ../login 46 DEPENDPATH+= ../login
47 47
48 INTERFACES= ../login/qdmdialog.ui 48 INTERFACES= ../login/qdmdialog.ui
49 49
50For unix-login make folloing changes to a line: 50For unix-login make folloing changes to a line:
51 LIBS = -lqpe -lcrypt 51 LIBS = -lqpe -lcrypt
52 52
53For PAM use the following: 53For PAM use the following:
54 LIBS = -lqpe -ldl -lpam 54 LIBS = -lqpe -ldl -lpam
55 55
56 56
57 57
58CONFIGURATION: 58CONFIGURATION:
59 59
60Configuration of the 'Look' of QDM is done via Qt Designer. Just open 60Configuration of the 'Look' of QDM is done via Qt Designer. Just open
61the .ui file and edit the look of the dialog as you like. You can, for 61the .ui file and edit the look of the dialog as you like. You can, for
62instance, change the logo pixmap. QDM should also be ready for i18n so 62instance, change the logo pixmap. QDM should also be ready for i18n so
63far. 63far.
64 64
65Other configuration stuff, eg welcome string in the upper right, and 65Other configuration stuff, eg welcome string in the upper right, and
66user list can be changed in the qdm_config.h file. 66user list can be changed in the qdm_config.h file.
67 67
68 68
69USAGE: 69USAGE:
70 70
71The QDM comes up, when the QPE is started, and if the QPE is started 71The QDM comes up, when the QPE is started, and if the QPE is started
72as 'root'. Being started as any other user, the uid couldn't be 72as 'root'. Being started as any other user, the uid couldn't be
73changed and the login dialog wouldn't be ofg much use. 73changed and the login dialog wouldn't be ofg much use.
74 74
75 75
76CONTACT: 76CONTACT:
77 77
78http://www.lisa.de 78http://www.lisa.de
diff --git a/core/opie-login/qdmdialogimpl.cpp b/core/opie-login/qdmdialogimpl.cpp
index bb1b453..56f0fc0 100644
--- a/core/opie-login/qdmdialogimpl.cpp
+++ b/core/opie-login/qdmdialogimpl.cpp
@@ -1,455 +1,455 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2001 LISA Systems 2** Copyright (C) 2001 LISA Systems
3** 3**
4** This file is an additional part of Qtopia Environment. 4** This file is an additional part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** For further information contact info@lisa.de 14** For further information contact info@lisa.de
15** 15**
16**********************************************************************/ 16**********************************************************************/
17 17
18/* 18/*
19 * AUTHOR: Christian Rahn 19 * AUTHOR: Christian Rahn
20 * EMAIL: cdr@lisa.de 20 * EMAIL: cdr@lisa.de
21 * 21 *
22 * $Id$ 22 * $Id$
23 */ 23 */
24 24
25#include "qdm_config.h" 25#include "qdm_config.h"
26 26
27#ifdef QT_QWS_LOGIN 27#ifdef QT_QWS_LOGIN
28 28
29#include <pwd.h> 29#include <pwd.h>
30#include <unistd.h> 30#include <unistd.h>
31#include <stdlib.h> 31#include <stdlib.h>
32#include <iostream.h> 32#include <iostream.h>
33#include <assert.h> 33#include <assert.h>
34 34
35#include <qlabel.h> 35#include <qlabel.h>
36#include <qregexp.h> 36#include <qregexp.h>
37#include <qdatetime.h> 37#include <qdatetime.h>
38#include <qmessagebox.h> 38#include <qmessagebox.h>
39#include <qcombobox.h> 39#include <qcombobox.h>
40#include <qlineedit.h> 40#include <qlineedit.h>
41#include <qtranslator.h> 41#include <qtranslator.h>
42#include <qpeapplication.h> 42#include <qpeapplication.h>
43 43
44#include <qwsdisplay_qws.h> 44#include <qwsdisplay_qws.h>
45 45
46#include <string.h> 46#include <string.h>
47#include <stdio.h> 47#include <stdio.h>
48#include <errno.h> 48#include <errno.h>
49#include <unistd.h> 49#include <unistd.h>
50 50
51#include <sys/types.h> 51#include <sys/types.h>
52#include <sys/stat.h> 52#include <sys/stat.h>
53#include <sys/sem.h> 53#include <sys/sem.h>
54#include <sys/shm.h> 54#include <sys/shm.h>
55#include <sys/ipc.h> 55#include <sys/ipc.h>
56 56
57#include <global.h> 57#include <global.h>
58 58
59#if defined(QT_QWS_LOGIN_USEPAM) 59#if defined(QT_QWS_LOGIN_USEPAM)
60extern "C" { 60extern "C" {
61#include <security/pam_appl.h> 61#include <security/pam_appl.h>
62} 62}
63#else 63#else
64#define _XOPEN_SOURCE 64#define _XOPEN_SOURCE
65#include <unistd.h> 65#include <unistd.h>
66#include <crypt.h> 66#include <crypt.h>
67#endif 67#endif
68 68
69 69
70#include "qdmdialogimpl.h" 70#include "qdmdialogimpl.h"
71#include "../taskbar/inputmethods.h" 71#include "../launcher/inputmethods.h"
72 72
73 73
74//---------------------------------------------------------------------------- 74//----------------------------------------------------------------------------
75 75
76//-- taken from semctl man page 76//-- taken from semctl man page
77#if defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED) 77#if defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)
78//-- union semun is defined by including <sys/sem.h> 78//-- union semun is defined by including <sys/sem.h>
79#else 79#else
80//-- according to X/OPEN we have to define it ourselves 80//-- according to X/OPEN we have to define it ourselves
81union semun { 81union semun {
82 int val; // value for SETVAL 82 int val; // value for SETVAL
83 struct semid_ds *buf; // buffer for IPC_STAT, IPC_SET 83 struct semid_ds *buf; // buffer for IPC_STAT, IPC_SET
84 unsigned short int *array; // array for GETALL, SETALL 84 unsigned short int *array; // array for GETALL, SETALL
85 struct seminfo *__buf; // buffer for IPC_INFO 85 struct seminfo *__buf; // buffer for IPC_INFO
86}; 86};
87#endif 87#endif
88 88
89//---------------------------------------------------------------------------- 89//----------------------------------------------------------------------------
90 90
91static const int ShowClockFreq = 1; 91static const int ShowClockFreq = 1;
92 92
93QDM_SHOWNUSERS; 93QDM_SHOWNUSERS;
94 94
95#ifdef QT_QWS_LOGIN_USEPAM 95#ifdef QT_QWS_LOGIN_USEPAM
96 96
97static const char *_PAM_SERVICE = "xdm"; 97static const char *_PAM_SERVICE = "xdm";
98static const char *PAM_password; 98static const char *PAM_password;
99 99
100typedef const struct pam_message pam_message_type; 100typedef const struct pam_message pam_message_type;
101 101
102static int PAM_conv( int, pam_message_type **, struct pam_response **, void * ); 102static int PAM_conv( int, pam_message_type **, struct pam_response **, void * );
103 103
104static struct pam_conv PAM_conversation = { 104static struct pam_conv PAM_conversation = {
105 &PAM_conv, 105 &PAM_conv,
106 NULL 106 NULL
107}; 107};
108 108
109//---------------------------------------------------------------------------- 109//----------------------------------------------------------------------------
110 110
111static char *COPY_STRING( const char * s ) { 111static char *COPY_STRING( const char * s ) {
112 return (s) ? strdup(s) : (char *)NULL; 112 return (s) ? strdup(s) : (char *)NULL;
113} 113}
114 114
115#define GET_MEM if (reply) realloc(reply, size);\ 115#define GET_MEM if (reply) realloc(reply, size);\
116 else reply = (struct pam_response *)malloc(size); \ 116 else reply = (struct pam_response *)malloc(size); \
117 if (!reply) return PAM_CONV_ERR; \ 117 if (!reply) return PAM_CONV_ERR; \
118 size += sizeof(struct pam_response) 118 size += sizeof(struct pam_response)
119 119
120 120
121static int PAM_conv( int num_msg, pam_message_type **msg, 121static int PAM_conv( int num_msg, pam_message_type **msg,
122 struct pam_response **resp, void *) 122 struct pam_response **resp, void *)
123{ 123{
124 int count = 0, replies = 0; 124 int count = 0, replies = 0;
125 struct pam_response *reply = NULL; 125 struct pam_response *reply = NULL;
126 int size = sizeof(struct pam_response); 126 int size = sizeof(struct pam_response);
127 127
128 for( count = 0; count < num_msg; count++ ) { 128 for( count = 0; count < num_msg; count++ ) {
129 switch (msg[count]->msg_style) { 129 switch (msg[count]->msg_style) {
130 case PAM_PROMPT_ECHO_ON: 130 case PAM_PROMPT_ECHO_ON:
131 /* user name given to PAM already */ 131 /* user name given to PAM already */
132 return PAM_CONV_ERR; 132 return PAM_CONV_ERR;
133 133
134 case PAM_PROMPT_ECHO_OFF: 134 case PAM_PROMPT_ECHO_OFF:
135 /* wants password */ 135 /* wants password */
136 GET_MEM; 136 GET_MEM;
137 reply[replies].resp_retcode = PAM_SUCCESS; 137 reply[replies].resp_retcode = PAM_SUCCESS;
138 reply[replies].resp = COPY_STRING(PAM_password); 138 reply[replies].resp = COPY_STRING(PAM_password);
139 replies++; 139 replies++;
140 /* PAM frees resp */ 140 /* PAM frees resp */
141 break; 141 break;
142 case PAM_TEXT_INFO: 142 case PAM_TEXT_INFO:
143 break; 143 break;
144 default: 144 default:
145 /* unknown or PAM_ERROR_MSG */ 145 /* unknown or PAM_ERROR_MSG */
146 if (reply) free (reply); 146 if (reply) free (reply);
147 return PAM_CONV_ERR; 147 return PAM_CONV_ERR;
148 } 148 }
149 } 149 }
150 if (reply) *resp = reply; 150 if (reply) *resp = reply;
151 return PAM_SUCCESS; 151 return PAM_SUCCESS;
152} 152}
153 153
154#endif 154#endif
155 155
156 156
157//---------------------------------------------------------------------------- 157//----------------------------------------------------------------------------
158 158
159QDMDialogImpl::QDMDialogImpl( QWidget* parent, const char* name, bool modal, WFlags f ) 159QDMDialogImpl::QDMDialogImpl( QWidget* parent, const char* name, bool modal, WFlags f )
160 : QDMDialog( parent, name, modal, f ) 160 : QDMDialog( parent, name, modal, f )
161{ 161{
162 showTime(); 162 showTime();
163 clockTimer = startTimer( ShowClockFreq * 1000 );//-- call timer evry min. 163 clockTimer = startTimer( ShowClockFreq * 1000 );//-- call timer evry min.
164 setActiveWindow(); 164 setActiveWindow();
165 setFocus(); 165 setFocus();
166 166
167 input = new InputMethods( this ); 167 input = new InputMethods( this );
168 input->resize( input->sizeHint() ); 168 input->resize( input->sizeHint() );
169 input->move( 0, height() - input->height() ); 169 input->move( 0, height() - input->height() );
170 170
171 for( int i=0; Shown_Users[i]; ++i ) { 171 for( int i=0; Shown_Users[i]; ++i ) {
172 input_user->insertItem( Shown_Users[i] ); 172 input_user->insertItem( Shown_Users[i] );
173 } 173 }
174 input_user->clearEdit(); 174 input_user->clearEdit();
175 175
176 label_welcome->setText( QDM_WELCOME_STRING ); 176 label_welcome->setText( QDM_WELCOME_STRING );
177 177
178}; 178};
179 179
180 180
181 181
182QDMDialogImpl::~QDMDialogImpl() 182QDMDialogImpl::~QDMDialogImpl()
183{ 183{
184 input->lower(); 184 input->lower();
185 input->close( false ); 185 input->close( false );
186 input->hide(); 186 input->hide();
187 delete input; 187 delete input;
188 input = 0; 188 input = 0;
189 if( parent() ) { 189 if( parent() ) {
190 ((QWidget*)parent())->repaint(true); 190 ((QWidget*)parent())->repaint(true);
191 } 191 }
192}; 192};
193 193
194 194
195void QDMDialogImpl::accept () { }; 195void QDMDialogImpl::accept () { };
196void QDMDialogImpl::reject () { }; 196void QDMDialogImpl::reject () { };
197 197
198 198
199void QDMDialogImpl::showTime( void ) 199void QDMDialogImpl::showTime( void )
200{ 200{
201 label_date->setText( QDate::currentDate().toString() ); 201 label_date->setText( QDate::currentDate().toString() );
202 label_time->setText( QTime::currentTime().toString() ); 202 label_time->setText( QTime::currentTime().toString() );
203} 203}
204 204
205 205
206void QDMDialogImpl::timerEvent( QTimerEvent * e ) 206void QDMDialogImpl::timerEvent( QTimerEvent * e )
207{ 207{
208 if( e->timerId() == clockTimer ) 208 if( e->timerId() == clockTimer )
209 showTime(); 209 showTime();
210} 210}
211 211
212 212
213//---------------------------------------------------------------------------- 213//----------------------------------------------------------------------------
214 214
215void QDMDialogImpl::slot_sleepmode() 215void QDMDialogImpl::slot_sleepmode()
216{ 216{
217 const int button = QMessageBox::warning( this, "Shutdown", tr( "Do you really want to go\nto sleep mode now?" ), 217 const int button = QMessageBox::warning( this, "Shutdown", tr( "Do you really want to go\nto sleep mode now?" ),
218 QString::null, tr( "Cancel" ), QString::null,0,1 ); 218 QString::null, tr( "Cancel" ), QString::null,0,1 );
219 switch( button ) { 219 switch( button ) {
220 case 0: 220 case 0:
221 done( Rejected ); 221 done( Rejected );
222 // Global::execute( cmd_shutdown ); 222 // Global::execute( cmd_shutdown );
223 if( vfork() == 0 ) { 223 if( vfork() == 0 ) {
224 execl( QDM_CMD_SLEEP, 0 ); 224 execl( QDM_CMD_SLEEP, 0 );
225 cerr << "Sleepmode: " << strerror( errno ) << endl; 225 cerr << "Sleepmode: " << strerror( errno ) << endl;
226 } 226 }
227 break; 227 break;
228 228
229 default: 229 default:
230 break; 230 break;
231 } 231 }
232} 232}
233 233
234 234
235//---------------------------------------------------------------------------- 235//----------------------------------------------------------------------------
236 236
237void QDMDialogImpl::slot_shutdown() 237void QDMDialogImpl::slot_shutdown()
238{ 238{
239 const int button = QMessageBox::warning( this, "Shutdown", tr("Do you really want to shut\nthe system down now?"), 239 const int button = QMessageBox::warning( this, "Shutdown", tr("Do you really want to shut\nthe system down now?"),
240 QString::null, tr("Cancel"), QString::null,0,1 ); 240 QString::null, tr("Cancel"), QString::null,0,1 );
241 switch( button ) { 241 switch( button ) {
242 case 0: 242 case 0:
243 done( Rejected ); 243 done( Rejected );
244 // Global::execute( cmd_shutdown ); 244 // Global::execute( cmd_shutdown );
245 if( vfork() == 0 ) { 245 if( vfork() == 0 ) {
246 execl( QDM_CMD_SHUTDOWN, 0 ); 246 execl( QDM_CMD_SHUTDOWN, 0 );
247 cerr << "Shutdown: " << strerror( errno ) << endl; 247 cerr << "Shutdown: " << strerror( errno ) << endl;
248 } 248 }
249 break; 249 break;
250 250
251 default: 251 default:
252 break; 252 break;
253 } 253 }
254} 254}
255 255
256 256
257 257
258 258
259//---------------------------------------------------------------------------- 259//----------------------------------------------------------------------------
260 260
261void QDMDialogImpl::informBadPassword() 261void QDMDialogImpl::informBadPassword()
262{ 262{
263 QMessageBox::warning( this, tr("Password wrong"), 263 QMessageBox::warning( this, tr("Password wrong"),
264 tr("The given password is incorrect") ); 264 tr("The given password is incorrect") );
265} 265}
266 266
267 267
268//---------------------------------------------------------------------------- 268//----------------------------------------------------------------------------
269 269
270#if defined(QT_QWS_LOGIN_USEPAM) 270#if defined(QT_QWS_LOGIN_USEPAM)
271 271
272static bool pwcheck_PAM( const char *user, const char *password ) 272static bool pwcheck_PAM( const char *user, const char *password )
273{ 273{
274 bool pw_correct = false; 274 bool pw_correct = false;
275 int pam_error; 275 int pam_error;
276 int pam_return = 0; 276 int pam_return = 0;
277 pam_handle_t *pamh = 0; 277 pam_handle_t *pamh = 0;
278 PAM_password = password.latin1(); 278 PAM_password = password.latin1();
279 279
280 pam_error = pam_start( _PAM_SERVICE, user, &PAM_conversation, &pamh ); 280 pam_error = pam_start( _PAM_SERVICE, user, &PAM_conversation, &pamh );
281 if( pam_error == PAM_SUCCESS ) { 281 if( pam_error == PAM_SUCCESS ) {
282 pam_error = pam_authenticate( pamh, 0 ); 282 pam_error = pam_authenticate( pamh, 0 );
283 if( pam_error == PAM_SUCCESS ) { 283 if( pam_error == PAM_SUCCESS ) {
284 //-- password correct 284 //-- password correct
285 pw_correct = true; 285 pw_correct = true;
286 pam_return = PAM_SUCCESS; 286 pam_return = PAM_SUCCESS;
287 } else { 287 } else {
288 pam_return = pam_error; 288 pam_return = pam_error;
289 } 289 }
290 } else { 290 } else {
291 // cerr << "PAM error: " << pam_strerror( pamh, pam_error ) << endl; 291 // cerr << "PAM error: " << pam_strerror( pamh, pam_error ) << endl;
292 } 292 }
293 pam_end( pamh, pam_return ); 293 pam_end( pamh, pam_return );
294 return pw_correct; 294 return pw_correct;
295} 295}
296 296
297#else 297#else
298 298
299//---------------------------------------------------------------------------- 299//----------------------------------------------------------------------------
300 300
301static bool pwcheck_Unix( const char *user, const char *password ) 301static bool pwcheck_Unix( const char *user, const char *password )
302{ 302{
303 struct passwd * pword = getpwnam( user ); 303 struct passwd * pword = getpwnam( user );
304 if( pword ) { 304 if( pword ) {
305 if( strcmp( crypt(password, password), pword->pw_passwd) == 0 ) { 305 if( strcmp( crypt(password, password), pword->pw_passwd) == 0 ) {
306 return true; 306 return true;
307 } 307 }
308 } 308 }
309 return false; 309 return false;
310} 310}
311 311
312#endif 312#endif
313 313
314 314
315 315
316//---------------------------------------------------------------------------- 316//----------------------------------------------------------------------------
317 317
318void QDMDialogImpl::slot_login() 318void QDMDialogImpl::slot_login()
319{ 319{
320 bool pw_correct = false; 320 bool pw_correct = false;
321 const char *username = input_user->currentText().latin1(); 321 const char *username = input_user->currentText().latin1();
322 const char *password = input_password->text().latin1(); 322 const char *password = input_password->text().latin1();
323 323
324 assert( username ); 324 assert( username );
325 325
326#if defined(QT_QWS_LOGIN_USEPAM) 326#if defined(QT_QWS_LOGIN_USEPAM)
327 pw_correct = pwcheck_PAM( username, password ); 327 pw_correct = pwcheck_PAM( username, password );
328#else 328#else
329 pw_correct = pwcheck_Unix( username, password ); 329 pw_correct = pwcheck_Unix( username, password );
330#endif 330#endif
331 331
332 if( pw_correct ) { 332 if( pw_correct ) {
333 if( changePersona( username ) ) { 333 if( changePersona( username ) ) {
334 // cerr << "Password correct" << endl; 334 // cerr << "Password correct" << endl;
335 done( Accepted ); 335 done( Accepted );
336 return; 336 return;
337 } 337 }
338 } else { 338 } else {
339 // cerr << "Password incorrect" << endl; 339 // cerr << "Password incorrect" << endl;
340 } 340 }
341 informBadPassword(); 341 informBadPassword();
342} 342}
343 343
344 344
345//---------------------------------------------------------------------------- 345//----------------------------------------------------------------------------
346 346
347bool QDMDialogImpl::changePersona( const char *username ) 347bool QDMDialogImpl::changePersona( const char *username )
348{ 348{
349 int err; 349 int err;
350 350
351 //-- get some info on user <username> 351 //-- get some info on user <username>
352 struct passwd * pword; 352 struct passwd * pword;
353 pword = getpwnam( username ); 353 pword = getpwnam( username );
354 354
355 if( pword == 0 ) 355 if( pword == 0 )
356 return false; 356 return false;
357 357
358 gid_t gid = pword->pw_gid; 358 gid_t gid = pword->pw_gid;
359 uid_t uid = pword->pw_uid; 359 uid_t uid = pword->pw_uid;
360 360
361 //-- some very dirty hacks following 361 //-- some very dirty hacks following
362 // extern int qws_display_id; 362 // extern int qws_display_id;
363 extern QString qws_qtePipeFilename(); 363 extern QString qws_qtePipeFilename();
364 extern QString qws_dataDir(); 364 extern QString qws_dataDir();
365 365
366 366
367 const QString QTEdataDir = qws_dataDir(); 367 const QString QTEdataDir = qws_dataDir();
368 QString QTEdataDirNew = QTEdataDir; 368 QString QTEdataDirNew = QTEdataDir;
369 QTEdataDirNew.replace( QRegExp("root"), username ); 369 QTEdataDirNew.replace( QRegExp("root"), username );
370 370
371 const char *qws_display_str = getenv("QWS_DISPLAY"); 371 const char *qws_display_str = getenv("QWS_DISPLAY");
372 372
373 //-- get name of semaphore and lock 373 //-- get name of semaphore and lock
374 QString pipe = qws_qtePipeFilename(); 374 QString pipe = qws_qtePipeFilename();
375 375
376 //-- change owner of semaphore 376 //-- change owner of semaphore
377 key_t semkey = ftok( pipe.latin1(), 'd' ); 377 key_t semkey = ftok( pipe.latin1(), 'd' );
378 int semid = semget( semkey, 0, 0 ); 378 int semid = semget( semkey, 0, 0 );
379 if( semid < 0 ) 379 if( semid < 0 )
380 cerr << "error: semget, " << strerror( errno ) << endl; 380 cerr << "error: semget, " << strerror( errno ) << endl;
381 381
382 struct shmid_ds shminfo; 382 struct shmid_ds shminfo;
383 semun arg; 383 semun arg;
384 semid_ds semidds; 384 semid_ds semidds;
385 arg.buf = & semidds; 385 arg.buf = & semidds;
386 386
387 if( semctl( semid, 0, IPC_STAT, arg ) < 0 ) 387 if( semctl( semid, 0, IPC_STAT, arg ) < 0 )
388 cerr << "error: semctl stat, " << strerror( errno ) << endl; 388 cerr << "error: semctl stat, " << strerror( errno ) << endl;
389 389
390 arg.buf->sem_perm.uid = uid; 390 arg.buf->sem_perm.uid = uid;
391 arg.buf->sem_perm.gid = gid; 391 arg.buf->sem_perm.gid = gid;
392 392
393 if( semctl( semid, 0, IPC_SET, arg ) < 0 ) 393 if( semctl( semid, 0, IPC_SET, arg ) < 0 )
394 cerr << "error: semctl set, " << strerror( errno ) << endl; 394 cerr << "error: semctl set, " << strerror( errno ) << endl;
395 395
396 //-- change owner of shared memory 396 //-- change owner of shared memory
397 key_t memkey = ftok( pipe.latin1(), 'm' ); 397 key_t memkey = ftok( pipe.latin1(), 'm' );
398 int ramid = shmget( memkey, 0, 0 ); 398 int ramid = shmget( memkey, 0, 0 );
399 if( ramid < 0 ) cerr << "error: shmget, " << strerror( errno ) << endl; 399 if( ramid < 0 ) cerr << "error: shmget, " << strerror( errno ) << endl;
400 400
401 if( shmctl( ramid, IPC_STAT, &shminfo ) < 0 ) 401 if( shmctl( ramid, IPC_STAT, &shminfo ) < 0 )
402 cerr << "error: shmctl stat, " << strerror( errno ) << endl; 402 cerr << "error: shmctl stat, " << strerror( errno ) << endl;
403 403
404 shminfo.shm_perm.uid = uid; 404 shminfo.shm_perm.uid = uid;
405 shminfo.shm_perm.gid = gid; 405 shminfo.shm_perm.gid = gid;
406 406
407 if( shmctl( ramid, IPC_SET, &shminfo ) < 0 ) 407 if( shmctl( ramid, IPC_SET, &shminfo ) < 0 )
408 cerr << "error: shmctl set, " << strerror( errno ) << endl; 408 cerr << "error: shmctl set, " << strerror( errno ) << endl;
409 409
410 //-- change owner of region manager 410 //-- change owner of region manager
411 memkey = ftok( pipe.latin1(), 'r' ); 411 memkey = ftok( pipe.latin1(), 'r' );
412 int regionid = shmget( memkey, 0, 0 ); 412 int regionid = shmget( memkey, 0, 0 );
413 if( regionid < 0 ) 413 if( regionid < 0 )
414 cerr << "error: shmget, " << strerror( errno ) << endl; 414 cerr << "error: shmget, " << strerror( errno ) << endl;
415 415
416 if( shmctl( regionid, IPC_STAT, &shminfo ) < 0 ) 416 if( shmctl( regionid, IPC_STAT, &shminfo ) < 0 )
417 cerr << "error: shmctl stat, " << strerror( errno ) << endl; 417 cerr << "error: shmctl stat, " << strerror( errno ) << endl;
418 418
419 shminfo.shm_perm.uid = uid; 419 shminfo.shm_perm.uid = uid;
420 shminfo.shm_perm.gid = gid; 420 shminfo.shm_perm.gid = gid;
421 421
422 if( shmctl( regionid, IPC_SET, &shminfo ) < 0 ) 422 if( shmctl( regionid, IPC_SET, &shminfo ) < 0 )
423 cerr << "error: shmctl set, " << strerror( errno ) << endl; 423 cerr << "error: shmctl set, " << strerror( errno ) << endl;
424 424
425 // cerr << "ungrabbing qws display: " << qws_display_id << " on lock " << pipe << endl; 425 // cerr << "ungrabbing qws display: " << qws_display_id << " on lock " << pipe << endl;
426 // QWSDisplay::ungrab(); 426 // QWSDisplay::ungrab();
427 427
428 //-- presenting socket-file to new user 428 //-- presenting socket-file to new user
429 chown( pipe.latin1(), uid, gid ); 429 chown( pipe.latin1(), uid, gid );
430 chown( QTEdataDir.latin1(), uid, gid ); 430 chown( QTEdataDir.latin1(), uid, gid );
431 431
432 432
433 //-- another dirty hack - force framebuffer to be writeable... 433 //-- another dirty hack - force framebuffer to be writeable...
434 struct stat devstat; 434 struct stat devstat;
435 if( ! stat( "/dev/fb0", &devstat ) ) { 435 if( ! stat( "/dev/fb0", &devstat ) ) {
436 if( chmod( "/dev/fb0", devstat.st_mode |S_IWOTH |S_IWUSR |S_IWGRP ) ) { 436 if( chmod( "/dev/fb0", devstat.st_mode |S_IWOTH |S_IWUSR |S_IWGRP ) ) {
437 cerr << "chmod error: " << strerror( errno ) << endl; 437 cerr << "chmod error: " << strerror( errno ) << endl;
438 } 438 }
439 } 439 }
440 440
441 err = rename( QTEdataDir, QTEdataDirNew ) ; 441 err = rename( QTEdataDir, QTEdataDirNew ) ;
442 if( err < 0 ) cerr << "error: rename " << strerror(errno) 442 if( err < 0 ) cerr << "error: rename " << strerror(errno)
443 << " , " << QTEdataDir << " -> " << QTEdataDirNew << endl; 443 << " , " << QTEdataDir << " -> " << QTEdataDirNew << endl;
444 444
445 // 445 //
446 //-- actually change uid and gid 446 //-- actually change uid and gid
447 // 447 //
448 // cerr << "changing persona, uid: " << uid << " gid: " << gid << endl; 448 // cerr << "changing persona, uid: " << uid << " gid: " << gid << endl;
449 449
450 err = setgid( gid ); 450 err = setgid( gid );
451 if( err != 0 ) cerr << "error: gid changePersona " << err << endl; 451 if( err != 0 ) cerr << "error: gid changePersona " << err << endl;
452 452
453 err = setuid( uid ); 453 err = setuid( uid );
454 if( err != 0 ) cerr << "error: uid changePersona " << err << endl; 454 if( err != 0 ) cerr << "error: uid changePersona " << err << endl;
455 455