summaryrefslogtreecommitdiff
path: root/core/opie-login
Unidiff
Diffstat (limited to 'core/opie-login') (more/less context) (ignore whitespace changes)
-rw-r--r--core/opie-login/.cvsignore3
-rw-r--r--core/opie-login/README78
-rw-r--r--core/opie-login/qdm_config.h30
-rw-r--r--core/opie-login/qdmdialog.ui856
-rw-r--r--core/opie-login/qdmdialogimpl.cpp535
-rw-r--r--core/opie-login/qdmdialogimpl.h90
6 files changed, 1592 insertions, 0 deletions
diff --git a/core/opie-login/.cvsignore b/core/opie-login/.cvsignore
new file mode 100644
index 0000000..edfa921
--- a/dev/null
+++ b/core/opie-login/.cvsignore
@@ -0,0 +1,3 @@
1moc_*
2*.moc
3Makefile
diff --git a/core/opie-login/README b/core/opie-login/README
new file mode 100644
index 0000000..ad3b298
--- a/dev/null
+++ b/core/opie-login/README
@@ -0,0 +1,78 @@
1
2Welcome to LISA System's
3
4 QDM - the Login-Dialog for QPE
5
6
7WHAT'S THIS:
8
9This small add-on for the Qtopia Environment (QPE - see
10http://qpe.sourceforge.net for further details) allows You to use your
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
13XDM. This way your personal data can be easily protected against
14unwanted access from others in case you loose your machine.
15
16
17STATUS:
18
19Still in development, but should be useable.
20
21
22REQUIREMENTS:
23
24- QDM needs Linux-PAM (Pluggable Authentication Modules for Linux) for
25 proper user validation.
26
27- the /dev/fb0 device has to writeable to everyone ;-(
28
29
30INSTALLATION:
31
32Per default this little add-on is not enabled. You have to do so
33yourself for now, by setting a compile option variable called
34QT_QWS_LOGIN . Furthermore there have to be made some changes in
35taskbar/taskbar.pro :
36
37At the section HEADERS insert a line:
38 ../login/qdmdialogimpl.h \
39
40At the section SOURCES insert a line:
41 ../login/qdmdialogimpl.cpp \
42
43 furthermore serte these lines:
44
45 INCLUDEPATH+= ../login
46 DEPENDPATH+= ../login
47
48 INTERFACES= ../login/qdmdialog.ui
49
50For unix-login make folloing changes to a line:
51 LIBS = -lqpe -lcrypt
52
53For PAM use the following:
54 LIBS = -lqpe -ldl -lpam
55
56
57
58CONFIGURATION:
59
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
62instance, change the logo pixmap. QDM should also be ready for i18n so
63far.
64
65Other configuration stuff, eg welcome string in the upper right, and
66user list can be changed in the qdm_config.h file.
67
68
69USAGE:
70
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
73changed and the login dialog wouldn't be ofg much use.
74
75
76CONTACT:
77
78http://www.lisa.de
diff --git a/core/opie-login/qdm_config.h b/core/opie-login/qdm_config.h
new file mode 100644
index 0000000..bf5b5a4
--- a/dev/null
+++ b/core/opie-login/qdm_config.h
@@ -0,0 +1,30 @@
1//-- -*- c++ -*-
2
3#ifndef _QDM_CONFIG_H
4#define _QDM_CONFIG_H
5
6/*
7 * Config file for QDM
8 */
9
10
11/** define this to enable the qdm login dialog for qpe */
12#define QT_QWS_LOGIN
13
14/** define this to let qdm use Linux-PAM */
15//define QT_QWS_LOGIN_USEPAM
16
17/** this is the list of users shown in the input-list */
18#define QDM_SHOWNUSERS static char *Shown_Users[] = { "guest", "root", "lisa", 0 };
19
20/** which command to execute when going to sleep mode */
21 #define QDM_CMD_SLEEP "/sbin/shutdow","-z","now"
22
23/** which command to execute when shutting down */
24 #define QDM_CMD_SHUTDOWN"/sbin/shutdow","-z","now"
25
26/** Welcome string on dialog */
27 #define QDM_WELCOME_STRING"Welcome to\nmLinux [iPAQ]"
28
29
30#endif //-- _QDM_CONFIG_H
diff --git a/core/opie-login/qdmdialog.ui b/core/opie-login/qdmdialog.ui
new file mode 100644
index 0000000..c9faf6f
--- a/dev/null
+++ b/core/opie-login/qdmdialog.ui
@@ -0,0 +1,856 @@
1<!DOCTYPE UI><UI>
2<class>QDMDialog</class>
3<widget>
4 <class>QDialog</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>QDMDialog</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>7</y>
14 <width>240</width>
15 <height>320</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>sizePolicy</name>
20 <sizepolicy>
21 <hsizetype>0</hsizetype>
22 <vsizetype>1</vsizetype>
23 </sizepolicy>
24 </property>
25 <property stdset="1">
26 <name>minimumSize</name>
27 <size>
28 <width>240</width>
29 <height>240</height>
30 </size>
31 </property>
32 <property stdset="1">
33 <name>maximumSize</name>
34 <size>
35 <width>240</width>
36 <height>320</height>
37 </size>
38 </property>
39 <property stdset="1">
40 <name>palette</name>
41 <palette>
42 <active>
43 <color>
44 <red>0</red>
45 <green>0</green>
46 <blue>0</blue>
47 </color>
48 <color>
49 <red>228</red>
50 <green>228</green>
51 <blue>228</blue>
52 </color>
53 <color>
54 <red>255</red>
55 <green>255</green>
56 <blue>255</blue>
57 </color>
58 <color>
59 <red>242</red>
60 <green>242</green>
61 <blue>242</blue>
62 </color>
63 <color>
64 <red>78</red>
65 <green>78</green>
66 <blue>78</blue>
67 </color>
68 <color>
69 <red>183</red>
70 <green>183</green>
71 <blue>183</blue>
72 </color>
73 <color>
74 <red>0</red>
75 <green>0</green>
76 <blue>0</blue>
77 </color>
78 <color>
79 <red>255</red>
80 <green>255</green>
81 <blue>255</blue>
82 </color>
83 <color>
84 <red>0</red>
85 <green>0</green>
86 <blue>0</blue>
87 </color>
88 <color>
89 <red>255</red>
90 <green>255</green>
91 <blue>255</blue>
92 </color>
93 <color>
94 <red>220</red>
95 <green>220</green>
96 <blue>220</blue>
97 </color>
98 <color>
99 <red>0</red>
100 <green>0</green>
101 <blue>0</blue>
102 </color>
103 <color>
104 <red>10</red>
105 <green>95</green>
106 <blue>137</blue>
107 </color>
108 <color>
109 <red>255</red>
110 <green>255</green>
111 <blue>255</blue>
112 </color>
113 </active>
114 <disabled>
115 <color>
116 <red>0</red>
117 <green>0</green>
118 <blue>0</blue>
119 </color>
120 <color>
121 <red>228</red>
122 <green>228</green>
123 <blue>228</blue>
124 </color>
125 <color>
126 <red>255</red>
127 <green>255</green>
128 <blue>255</blue>
129 </color>
130 <color>
131 <red>242</red>
132 <green>242</green>
133 <blue>242</blue>
134 </color>
135 <color>
136 <red>78</red>
137 <green>78</green>
138 <blue>78</blue>
139 </color>
140 <color>
141 <red>183</red>
142 <green>183</green>
143 <blue>183</blue>
144 </color>
145 <color>
146 <red>183</red>
147 <green>183</green>
148 <blue>183</blue>
149 </color>
150 <color>
151 <red>255</red>
152 <green>255</green>
153 <blue>255</blue>
154 </color>
155 <color>
156 <red>0</red>
157 <green>0</green>
158 <blue>0</blue>
159 </color>
160 <color>
161 <red>255</red>
162 <green>255</green>
163 <blue>255</blue>
164 </color>
165 <color>
166 <red>220</red>
167 <green>220</green>
168 <blue>220</blue>
169 </color>
170 <color>
171 <red>0</red>
172 <green>0</green>
173 <blue>0</blue>
174 </color>
175 <color>
176 <red>0</red>
177 <green>0</green>
178 <blue>128</blue>
179 </color>
180 <color>
181 <red>255</red>
182 <green>255</green>
183 <blue>255</blue>
184 </color>
185 </disabled>
186 <inactive>
187 <color>
188 <red>0</red>
189 <green>0</green>
190 <blue>0</blue>
191 </color>
192 <color>
193 <red>228</red>
194 <green>228</green>
195 <blue>228</blue>
196 </color>
197 <color>
198 <red>255</red>
199 <green>255</green>
200 <blue>255</blue>
201 </color>
202 <color>
203 <red>242</red>
204 <green>242</green>
205 <blue>242</blue>
206 </color>
207 <color>
208 <red>78</red>
209 <green>78</green>
210 <blue>78</blue>
211 </color>
212 <color>
213 <red>183</red>
214 <green>183</green>
215 <blue>183</blue>
216 </color>
217 <color>
218 <red>0</red>
219 <green>0</green>
220 <blue>0</blue>
221 </color>
222 <color>
223 <red>255</red>
224 <green>255</green>
225 <blue>255</blue>
226 </color>
227 <color>
228 <red>0</red>
229 <green>0</green>
230 <blue>0</blue>
231 </color>
232 <color>
233 <red>255</red>
234 <green>255</green>
235 <blue>255</blue>
236 </color>
237 <color>
238 <red>220</red>
239 <green>220</green>
240 <blue>220</blue>
241 </color>
242 <color>
243 <red>0</red>
244 <green>0</green>
245 <blue>0</blue>
246 </color>
247 <color>
248 <red>10</red>
249 <green>95</green>
250 <blue>137</blue>
251 </color>
252 <color>
253 <red>255</red>
254 <green>255</green>
255 <blue>255</blue>
256 </color>
257 </inactive>
258 </palette>
259 </property>
260 <property stdset="1">
261 <name>caption</name>
262 <string>QDM</string>
263 </property>
264 <widget>
265 <class>QLabel</class>
266 <property stdset="1">
267 <name>name</name>
268 <cstring>label_logo</cstring>
269 </property>
270 <property stdset="1">
271 <name>geometry</name>
272 <rect>
273 <x>10</x>
274 <y>10</y>
275 <width>100</width>
276 <height>33</height>
277 </rect>
278 </property>
279 <property stdset="1">
280 <name>palette</name>
281 <palette>
282 <active>
283 <color>
284 <red>0</red>
285 <green>0</green>
286 <blue>0</blue>
287 </color>
288 <color>
289 <red>220</red>
290 <green>220</green>
291 <blue>220</blue>
292 </color>
293 <color>
294 <red>255</red>
295 <green>255</green>
296 <blue>255</blue>
297 </color>
298 <color>
299 <red>237</red>
300 <green>237</green>
301 <blue>237</blue>
302 </color>
303 <color>
304 <red>110</red>
305 <green>110</green>
306 <blue>110</blue>
307 </color>
308 <color>
309 <red>146</red>
310 <green>146</green>
311 <blue>146</blue>
312 </color>
313 <color>
314 <red>0</red>
315 <green>0</green>
316 <blue>0</blue>
317 </color>
318 <color>
319 <red>255</red>
320 <green>255</green>
321 <blue>255</blue>
322 </color>
323 <color>
324 <red>0</red>
325 <green>0</green>
326 <blue>0</blue>
327 </color>
328 <color>
329 <red>255</red>
330 <green>255</green>
331 <blue>255</blue>
332 </color>
333 <color>
334 <red>255</red>
335 <green>255</green>
336 <blue>255</blue>
337 </color>
338 <color>
339 <red>0</red>
340 <green>0</green>
341 <blue>0</blue>
342 </color>
343 <color>
344 <red>84</red>
345 <green>112</green>
346 <blue>152</blue>
347 </color>
348 <color>
349 <red>255</red>
350 <green>255</green>
351 <blue>255</blue>
352 </color>
353 </active>
354 <disabled>
355 <color>
356 <red>128</red>
357 <green>128</green>
358 <blue>128</blue>
359 </color>
360 <color>
361 <red>220</red>
362 <green>220</green>
363 <blue>220</blue>
364 </color>
365 <color>
366 <red>255</red>
367 <green>255</green>
368 <blue>255</blue>
369 </color>
370 <color>
371 <red>253</red>
372 <green>253</green>
373 <blue>253</blue>
374 </color>
375 <color>
376 <red>110</red>
377 <green>110</green>
378 <blue>110</blue>
379 </color>
380 <color>
381 <red>146</red>
382 <green>146</green>
383 <blue>146</blue>
384 </color>
385 <color>
386 <red>0</red>
387 <green>0</green>
388 <blue>0</blue>
389 </color>
390 <color>
391 <red>255</red>
392 <green>255</green>
393 <blue>255</blue>
394 </color>
395 <color>
396 <red>128</red>
397 <green>128</green>
398 <blue>128</blue>
399 </color>
400 <color>
401 <red>255</red>
402 <green>255</green>
403 <blue>255</blue>
404 </color>
405 <color>
406 <red>255</red>
407 <green>255</green>
408 <blue>255</blue>
409 </color>
410 <color>
411 <red>0</red>
412 <green>0</green>
413 <blue>0</blue>
414 </color>
415 <color>
416 <red>84</red>
417 <green>112</green>
418 <blue>152</blue>
419 </color>
420 <color>
421 <red>255</red>
422 <green>255</green>
423 <blue>255</blue>
424 </color>
425 </disabled>
426 <inactive>
427 <color>
428 <red>0</red>
429 <green>0</green>
430 <blue>0</blue>
431 </color>
432 <color>
433 <red>220</red>
434 <green>220</green>
435 <blue>220</blue>
436 </color>
437 <color>
438 <red>255</red>
439 <green>255</green>
440 <blue>255</blue>
441 </color>
442 <color>
443 <red>253</red>
444 <green>253</green>
445 <blue>253</blue>
446 </color>
447 <color>
448 <red>110</red>
449 <green>110</green>
450 <blue>110</blue>
451 </color>
452 <color>
453 <red>146</red>
454 <green>146</green>
455 <blue>146</blue>
456 </color>
457 <color>
458 <red>0</red>
459 <green>0</green>
460 <blue>0</blue>
461 </color>
462 <color>
463 <red>255</red>
464 <green>255</green>
465 <blue>255</blue>
466 </color>
467 <color>
468 <red>0</red>
469 <green>0</green>
470 <blue>0</blue>
471 </color>
472 <color>
473 <red>255</red>
474 <green>255</green>
475 <blue>255</blue>
476 </color>
477 <color>
478 <red>255</red>
479 <green>255</green>
480 <blue>255</blue>
481 </color>
482 <color>
483 <red>0</red>
484 <green>0</green>
485 <blue>0</blue>
486 </color>
487 <color>
488 <red>84</red>
489 <green>112</green>
490 <blue>152</blue>
491 </color>
492 <color>
493 <red>255</red>
494 <green>255</green>
495 <blue>255</blue>
496 </color>
497 </inactive>
498 </palette>
499 </property>
500 <property stdset="1">
501 <name>frameShape</name>
502 <enum>Panel</enum>
503 </property>
504 <property stdset="1">
505 <name>frameShadow</name>
506 <enum>Sunken</enum>
507 </property>
508 <property stdset="1">
509 <name>margin</name>
510 <number>2</number>
511 </property>
512 <property stdset="1">
513 <name>pixmap</name>
514 <pixmap>image0</pixmap>
515 </property>
516 <property stdset="1">
517 <name>scaledContents</name>
518 <bool>true</bool>
519 </property>
520 </widget>
521 <widget>
522 <class>QLabel</class>
523 <property stdset="1">
524 <name>name</name>
525 <cstring>label_welcome</cstring>
526 </property>
527 <property stdset="1">
528 <name>geometry</name>
529 <rect>
530 <x>120</x>
531 <y>10</y>
532 <width>110</width>
533 <height>40</height>
534 </rect>
535 </property>
536 <property stdset="1">
537 <name>font</name>
538 <font>
539 <pointsize>14</pointsize>
540 <bold>1</bold>
541 </font>
542 </property>
543 <property stdset="1">
544 <name>text</name>
545 <string>Welcome to
546mLinux [iPAQ]</string>
547 </property>
548 <property stdset="1">
549 <name>alignment</name>
550 <set>AlignCenter</set>
551 </property>
552 <property>
553 <name>hAlign</name>
554 </property>
555 </widget>
556 <widget>
557 <class>QLabel</class>
558 <property stdset="1">
559 <name>name</name>
560 <cstring>label_time</cstring>
561 </property>
562 <property stdset="1">
563 <name>geometry</name>
564 <rect>
565 <x>180</x>
566 <y>50</y>
567 <width>50</width>
568 <height>16</height>
569 </rect>
570 </property>
571 <property stdset="1">
572 <name>text</name>
573 <string>12:30:88</string>
574 </property>
575 </widget>
576 <widget>
577 <class>QLabel</class>
578 <property stdset="1">
579 <name>name</name>
580 <cstring>label_date</cstring>
581 </property>
582 <property stdset="1">
583 <name>geometry</name>
584 <rect>
585 <x>70</x>
586 <y>50</y>
587 <width>100</width>
588 <height>16</height>
589 </rect>
590 </property>
591 <property stdset="1">
592 <name>text</name>
593 <string>Wed Feb 12 2001</string>
594 </property>
595 </widget>
596 <widget>
597 <class>QLabel</class>
598 <property stdset="1">
599 <name>name</name>
600 <cstring>TextLabel5</cstring>
601 </property>
602 <property stdset="1">
603 <name>geometry</name>
604 <rect>
605 <x>20</x>
606 <y>50</y>
607 <width>50</width>
608 <height>16</height>
609 </rect>
610 </property>
611 <property stdset="1">
612 <name>text</name>
613 <string>Today:</string>
614 </property>
615 </widget>
616 <widget>
617 <class>QGroupBox</class>
618 <property stdset="1">
619 <name>name</name>
620 <cstring>GroupBox3</cstring>
621 </property>
622 <property stdset="1">
623 <name>geometry</name>
624 <rect>
625 <x>10</x>
626 <y>80</y>
627 <width>220</width>
628 <height>120</height>
629 </rect>
630 </property>
631 <property stdset="1">
632 <name>backgroundOrigin</name>
633 <enum>WidgetOrigin</enum>
634 </property>
635 <property stdset="1">
636 <name>title</name>
637 <string>Login</string>
638 </property>
639 <widget>
640 <class>QPushButton</class>
641 <property stdset="1">
642 <name>name</name>
643 <cstring>PushButton3</cstring>
644 </property>
645 <property stdset="1">
646 <name>geometry</name>
647 <rect>
648 <x>160</x>
649 <y>60</y>
650 <width>50</width>
651 <height>21</height>
652 </rect>
653 </property>
654 <property stdset="1">
655 <name>text</name>
656 <string>Clear</string>
657 </property>
658 </widget>
659 <widget>
660 <class>QLineEdit</class>
661 <property stdset="1">
662 <name>name</name>
663 <cstring>input_password</cstring>
664 </property>
665 <property stdset="1">
666 <name>geometry</name>
667 <rect>
668 <x>80</x>
669 <y>60</y>
670 <width>70</width>
671 <height>22</height>
672 </rect>
673 </property>
674 <property stdset="1">
675 <name>echoMode</name>
676 <enum>Password</enum>
677 </property>
678 </widget>
679 <widget>
680 <class>QComboBox</class>
681 <property stdset="1">
682 <name>name</name>
683 <cstring>input_user</cstring>
684 </property>
685 <property stdset="1">
686 <name>geometry</name>
687 <rect>
688 <x>80</x>
689 <y>30</y>
690 <width>120</width>
691 <height>21</height>
692 </rect>
693 </property>
694 <property stdset="1">
695 <name>editable</name>
696 <bool>true</bool>
697 </property>
698 </widget>
699 <widget>
700 <class>QLabel</class>
701 <property stdset="1">
702 <name>name</name>
703 <cstring>label_user</cstring>
704 </property>
705 <property stdset="1">
706 <name>geometry</name>
707 <rect>
708 <x>10</x>
709 <y>30</y>
710 <width>60</width>
711 <height>21</height>
712 </rect>
713 </property>
714 <property stdset="1">
715 <name>text</name>
716 <string>User</string>
717 </property>
718 </widget>
719 <widget>
720 <class>QLabel</class>
721 <property stdset="1">
722 <name>name</name>
723 <cstring>label_password</cstring>
724 </property>
725 <property stdset="1">
726 <name>geometry</name>
727 <rect>
728 <x>10</x>
729 <y>60</y>
730 <width>60</width>
731 <height>21</height>
732 </rect>
733 </property>
734 <property stdset="1">
735 <name>text</name>
736 <string>Password</string>
737 </property>
738 </widget>
739 <widget>
740 <class>QPushButton</class>
741 <property stdset="1">
742 <name>name</name>
743 <cstring>button_shutdown</cstring>
744 </property>
745 <property stdset="1">
746 <name>geometry</name>
747 <rect>
748 <x>150</x>
749 <y>90</y>
750 <width>61</width>
751 <height>20</height>
752 </rect>
753 </property>
754 <property stdset="1">
755 <name>text</name>
756 <string>Shutdown</string>
757 </property>
758 </widget>
759 <widget>
760 <class>QPushButton</class>
761 <property stdset="1">
762 <name>name</name>
763 <cstring>button_login</cstring>
764 </property>
765 <property stdset="1">
766 <name>geometry</name>
767 <rect>
768 <x>10</x>
769 <y>90</y>
770 <width>60</width>
771 <height>20</height>
772 </rect>
773 </property>
774 <property stdset="1">
775 <name>text</name>
776 <string>Login</string>
777 </property>
778 </widget>
779 <widget>
780 <class>QPushButton</class>
781 <property stdset="1">
782 <name>name</name>
783 <cstring>button_sleep</cstring>
784 </property>
785 <property stdset="1">
786 <name>geometry</name>
787 <rect>
788 <x>90</x>
789 <y>90</y>
790 <width>60</width>
791 <height>20</height>
792 </rect>
793 </property>
794 <property stdset="1">
795 <name>text</name>
796 <string>Sleep</string>
797 </property>
798 </widget>
799 </widget>
800</widget>
801<images>
802 <image>
803 <name>image0</name>
804 <data format="XPM.GZ" length="4080">789ced97db72e2461086effd149475e74a69413258d4d65ef880c7c022cbd8eb35a472a123c8465a09640ebb9577cffc3d033a986c2a38a9ca45bacb653ecd34bf7aba67843e9cd49eac41ede4c3d122b3b3d0adb9537b5e3bf15ea368f3eb6f9f7e1c1db78d9adea8358d5ae3f897a3e3b8e6d6943a19302234e04005d8a8c3811ea10107da40ad01073e123a70e01d502703ce086d38f00bf0b401075e13da70e03760b30e070e086d38d001b6c8804be059130e4c091d3850071aa770a04fe8c2817d609b0ca801e92e68b24be8c18109d0d1e1c021a10f07f6806e130e3409c98016d03b8303c784011c3802fa677020230ce0c00c180486236a3495e8d7697228b0ad891a2d24b6448d3a126d8d4637123d8d6227026d4dd7806b894d51a3ae44e39462eb12bd535ad82b8981a8d1ad40476b52facf129b4d4abf21d168d1d27d97e8b668f446627046a35f05ba4d83bef95262dba01a9d4b740c2aca834457543010e8e96d2aca85c49628e8ab44dba6d1cf123d87eef945a0df10057d92d87269ade612db2e15e55ea2e7d13aaf24061e65a40a84112ab6eda87bcdb56dcf7f7335984c4361cf2f7bc3669ee7450526152f8ebfed5749f8505ab9369f2cb29d2d16af7bee4d89e3385abe4765b5ceb2e9e6fbf9457079d509b3cefc6dd435d788638fbd43e5669a65dd95848bcd9e25eb7971348b62a5ff0e950d5fa6cffb674b1bc4b16df2c0d92e99bfafd2c9b2f0fc6722a68d1887af9a7bb8ca33af79e7767f6fed52b154247377b8ca4af4d6e6ea72bf125219f0ff335effe1c12aeafd3adc7671f781bd097178dd4d84f276fe72b88aaabedc4c3a62cf848b6a428c7ff98c3e3cc6b1d27b870ab7d5ebd76e678a849eca0383288eae53d82c4fe6501552bac1d2754bd746d8f6b945e377abf0038dcb2c56c52bbe1247b9c5b1f30fa8acaa2aa3bb387eb4c6c212de6ddef8309555a110975c655d4d253fc3f9ce11c96c55664369bdbf529984f5877bfa346ff0460b8ba70df555dedc431efd382ea8283bb37eae82c332ec7436ddee063db6b9280e6acab612c2f8ce8cd2ad4ab12f9471316ca8545556b761b87db84c17f5f2b9cf0b1115ef52930f0052d1d3dcfaa530b65c2e476ac59ece9fd793ce66520f569591beae27a5707e41dfe6f2afdbff2aff61959ee627f96e1ca2977b79439baeef0e775b2d11b64546c472a4e042a3b1c4d7127ab970993ada3da35553676a2f3f26923e53597e245896e5f0bf1d02ac9d8a95a64c1debf9ce64a9a53293de6892f2132fe98fd3fc8ad6af3e0f8bbbbbaae2f3347d96cf182db7270c73fda55f3cbfb4e24ee4292ffdd25e2bab9456ccf2d5d44d8a33cc7e2a5e4048332d9c2c56f5a731f387052aab9426f2486bc9d4caaf6eaa8b6f614159696e6eaec9573a35ff54a5b262951963de378c5e01ccc42f97861597cfc268f9a02e4eadf458af32830d355feb1dfffef1e80f6ca1ac19</data>
805 </image>
806</images>
807<connections>
808 <connection>
809 <sender>button_shutdown</sender>
810 <signal>clicked()</signal>
811 <receiver>QDMDialog</receiver>
812 <slot>slot_shutdown()</slot>
813 </connection>
814 <connection>
815 <sender>button_login</sender>
816 <signal>clicked()</signal>
817 <receiver>QDMDialog</receiver>
818 <slot>slot_login()</slot>
819 </connection>
820 <connection>
821 <sender>input_password</sender>
822 <signal>returnPressed()</signal>
823 <receiver>button_login</receiver>
824 <slot>setFocus()</slot>
825 </connection>
826 <connection>
827 <sender>input_user</sender>
828 <signal>highlighted(const QString&amp;)</signal>
829 <receiver>input_password</receiver>
830 <slot>setFocus()</slot>
831 </connection>
832 <connection>
833 <sender>PushButton3</sender>
834 <signal>clicked()</signal>
835 <receiver>input_password</receiver>
836 <slot>clear()</slot>
837 </connection>
838 <connection>
839 <sender>button_sleep</sender>
840 <signal>clicked()</signal>
841 <receiver>QDMDialog</receiver>
842 <slot>slot_sleepmode()</slot>
843 </connection>
844 <slot access="public">slot_sleepmode()</slot>
845 <slot access="public">slot_login()</slot>
846 <slot access="public">slot_shutdown()</slot>
847</connections>
848<tabstops>
849 <tabstop>input_user</tabstop>
850 <tabstop>input_password</tabstop>
851 <tabstop>button_login</tabstop>
852 <tabstop>PushButton3</tabstop>
853 <tabstop>button_sleep</tabstop>
854 <tabstop>button_shutdown</tabstop>
855</tabstops>
856</UI>
diff --git a/core/opie-login/qdmdialogimpl.cpp b/core/opie-login/qdmdialogimpl.cpp
new file mode 100644
index 0000000..bb1b453
--- a/dev/null
+++ b/core/opie-login/qdmdialogimpl.cpp
@@ -0,0 +1,535 @@
1/**********************************************************************
2** Copyright (C) 2001 LISA Systems
3**
4** This file is an additional part of Qtopia Environment.
5**
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
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
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.
13**
14** For further information contact info@lisa.de
15**
16**********************************************************************/
17
18/*
19 * AUTHOR: Christian Rahn
20 * EMAIL: cdr@lisa.de
21 *
22 * $Id$
23 */
24
25#include "qdm_config.h"
26
27#ifdef QT_QWS_LOGIN
28
29#include <pwd.h>
30#include <unistd.h>
31#include <stdlib.h>
32#include <iostream.h>
33#include <assert.h>
34
35#include <qlabel.h>
36#include <qregexp.h>
37#include <qdatetime.h>
38#include <qmessagebox.h>
39#include <qcombobox.h>
40#include <qlineedit.h>
41#include <qtranslator.h>
42#include <qpeapplication.h>
43
44#include <qwsdisplay_qws.h>
45
46#include <string.h>
47#include <stdio.h>
48#include <errno.h>
49#include <unistd.h>
50
51#include <sys/types.h>
52#include <sys/stat.h>
53#include <sys/sem.h>
54#include <sys/shm.h>
55#include <sys/ipc.h>
56
57#include <global.h>
58
59#if defined(QT_QWS_LOGIN_USEPAM)
60extern "C" {
61#include <security/pam_appl.h>
62}
63#else
64#define _XOPEN_SOURCE
65#include <unistd.h>
66#include <crypt.h>
67#endif
68
69
70#include "qdmdialogimpl.h"
71#include "../taskbar/inputmethods.h"
72
73
74//----------------------------------------------------------------------------
75
76//-- taken from semctl man page
77#if defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)
78//-- union semun is defined by including <sys/sem.h>
79#else
80//-- according to X/OPEN we have to define it ourselves
81union semun {
82 int val; // value for SETVAL
83 struct semid_ds *buf; // buffer for IPC_STAT, IPC_SET
84 unsigned short int *array; // array for GETALL, SETALL
85 struct seminfo *__buf; // buffer for IPC_INFO
86};
87#endif
88
89//----------------------------------------------------------------------------
90
91static const int ShowClockFreq = 1;
92
93QDM_SHOWNUSERS;
94
95#ifdef QT_QWS_LOGIN_USEPAM
96
97static const char *_PAM_SERVICE = "xdm";
98static const char *PAM_password;
99
100typedef const struct pam_message pam_message_type;
101
102static int PAM_conv( int, pam_message_type **, struct pam_response **, void * );
103
104static struct pam_conv PAM_conversation = {
105 &PAM_conv,
106 NULL
107};
108
109//----------------------------------------------------------------------------
110
111static char *COPY_STRING( const char * s ) {
112 return (s) ? strdup(s) : (char *)NULL;
113}
114
115#define GET_MEM if (reply) realloc(reply, size);\
116 else reply = (struct pam_response *)malloc(size); \
117 if (!reply) return PAM_CONV_ERR; \
118 size += sizeof(struct pam_response)
119
120
121static int PAM_conv( int num_msg, pam_message_type **msg,
122 struct pam_response **resp, void *)
123{
124 int count = 0, replies = 0;
125 struct pam_response *reply = NULL;
126 int size = sizeof(struct pam_response);
127
128 for( count = 0; count < num_msg; count++ ) {
129 switch (msg[count]->msg_style) {
130 case PAM_PROMPT_ECHO_ON:
131 /* user name given to PAM already */
132 return PAM_CONV_ERR;
133
134 case PAM_PROMPT_ECHO_OFF:
135 /* wants password */
136 GET_MEM;
137 reply[replies].resp_retcode = PAM_SUCCESS;
138 reply[replies].resp = COPY_STRING(PAM_password);
139 replies++;
140 /* PAM frees resp */
141 break;
142 case PAM_TEXT_INFO:
143 break;
144 default:
145 /* unknown or PAM_ERROR_MSG */
146 if (reply) free (reply);
147 return PAM_CONV_ERR;
148 }
149 }
150 if (reply) *resp = reply;
151 return PAM_SUCCESS;
152}
153
154#endif
155
156
157//----------------------------------------------------------------------------
158
159QDMDialogImpl::QDMDialogImpl( QWidget* parent, const char* name, bool modal, WFlags f )
160 : QDMDialog( parent, name, modal, f )
161{
162 showTime();
163 clockTimer = startTimer( ShowClockFreq * 1000 );//-- call timer evry min.
164 setActiveWindow();
165 setFocus();
166
167 input = new InputMethods( this );
168 input->resize( input->sizeHint() );
169 input->move( 0, height() - input->height() );
170
171 for( int i=0; Shown_Users[i]; ++i ) {
172 input_user->insertItem( Shown_Users[i] );
173 }
174 input_user->clearEdit();
175
176 label_welcome->setText( QDM_WELCOME_STRING );
177
178};
179
180
181
182QDMDialogImpl::~QDMDialogImpl()
183{
184 input->lower();
185 input->close( false );
186 input->hide();
187 delete input;
188 input = 0;
189 if( parent() ) {
190 ((QWidget*)parent())->repaint(true);
191 }
192};
193
194
195void QDMDialogImpl::accept () { };
196void QDMDialogImpl::reject () { };
197
198
199void QDMDialogImpl::showTime( void )
200{
201 label_date->setText( QDate::currentDate().toString() );
202 label_time->setText( QTime::currentTime().toString() );
203}
204
205
206void QDMDialogImpl::timerEvent( QTimerEvent * e )
207{
208 if( e->timerId() == clockTimer )
209 showTime();
210}
211
212
213//----------------------------------------------------------------------------
214
215void QDMDialogImpl::slot_sleepmode()
216{
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 );
219 switch( button ) {
220 case 0:
221 done( Rejected );
222 // Global::execute( cmd_shutdown );
223 if( vfork() == 0 ) {
224 execl( QDM_CMD_SLEEP, 0 );
225 cerr << "Sleepmode: " << strerror( errno ) << endl;
226 }
227 break;
228
229 default:
230 break;
231 }
232}
233
234
235//----------------------------------------------------------------------------
236
237void QDMDialogImpl::slot_shutdown()
238{
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 );
241 switch( button ) {
242 case 0:
243 done( Rejected );
244 // Global::execute( cmd_shutdown );
245 if( vfork() == 0 ) {
246 execl( QDM_CMD_SHUTDOWN, 0 );
247 cerr << "Shutdown: " << strerror( errno ) << endl;
248 }
249 break;
250
251 default:
252 break;
253 }
254}
255
256
257
258
259//----------------------------------------------------------------------------
260
261void QDMDialogImpl::informBadPassword()
262{
263 QMessageBox::warning( this, tr("Password wrong"),
264 tr("The given password is incorrect") );
265}
266
267
268//----------------------------------------------------------------------------
269
270#if defined(QT_QWS_LOGIN_USEPAM)
271
272static bool pwcheck_PAM( const char *user, const char *password )
273{
274 bool pw_correct = false;
275 int pam_error;
276 int pam_return = 0;
277 pam_handle_t *pamh = 0;
278 PAM_password = password.latin1();
279
280 pam_error = pam_start( _PAM_SERVICE, user, &PAM_conversation, &pamh );
281 if( pam_error == PAM_SUCCESS ) {
282 pam_error = pam_authenticate( pamh, 0 );
283 if( pam_error == PAM_SUCCESS ) {
284 //-- password correct
285 pw_correct = true;
286 pam_return = PAM_SUCCESS;
287 } else {
288 pam_return = pam_error;
289 }
290 } else {
291 // cerr << "PAM error: " << pam_strerror( pamh, pam_error ) << endl;
292 }
293 pam_end( pamh, pam_return );
294 return pw_correct;
295}
296
297#else
298
299//----------------------------------------------------------------------------
300
301static bool pwcheck_Unix( const char *user, const char *password )
302{
303 struct passwd * pword = getpwnam( user );
304 if( pword ) {
305 if( strcmp( crypt(password, password), pword->pw_passwd) == 0 ) {
306 return true;
307 }
308 }
309 return false;
310}
311
312#endif
313
314
315
316//----------------------------------------------------------------------------
317
318void QDMDialogImpl::slot_login()
319{
320 bool pw_correct = false;
321 const char *username = input_user->currentText().latin1();
322 const char *password = input_password->text().latin1();
323
324 assert( username );
325
326#if defined(QT_QWS_LOGIN_USEPAM)
327 pw_correct = pwcheck_PAM( username, password );
328#else
329 pw_correct = pwcheck_Unix( username, password );
330#endif
331
332 if( pw_correct ) {
333 if( changePersona( username ) ) {
334 // cerr << "Password correct" << endl;
335 done( Accepted );
336 return;
337 }
338 } else {
339 // cerr << "Password incorrect" << endl;
340 }
341 informBadPassword();
342}
343
344
345//----------------------------------------------------------------------------
346
347bool QDMDialogImpl::changePersona( const char *username )
348{
349 int err;
350
351 //-- get some info on user <username>
352 struct passwd * pword;
353 pword = getpwnam( username );
354
355 if( pword == 0 )
356 return false;
357
358 gid_t gid = pword->pw_gid;
359 uid_t uid = pword->pw_uid;
360
361 //-- some very dirty hacks following
362 // extern int qws_display_id;
363 extern QString qws_qtePipeFilename();
364 extern QString qws_dataDir();
365
366
367 const QString QTEdataDir = qws_dataDir();
368 QString QTEdataDirNew = QTEdataDir;
369 QTEdataDirNew.replace( QRegExp("root"), username );
370
371 const char *qws_display_str = getenv("QWS_DISPLAY");
372
373 //-- get name of semaphore and lock
374 QString pipe = qws_qtePipeFilename();
375
376 //-- change owner of semaphore
377 key_t semkey = ftok( pipe.latin1(), 'd' );
378 int semid = semget( semkey, 0, 0 );
379 if( semid < 0 )
380 cerr << "error: semget, " << strerror( errno ) << endl;
381
382 struct shmid_ds shminfo;
383 semun arg;
384 semid_ds semidds;
385 arg.buf = & semidds;
386
387 if( semctl( semid, 0, IPC_STAT, arg ) < 0 )
388 cerr << "error: semctl stat, " << strerror( errno ) << endl;
389
390 arg.buf->sem_perm.uid = uid;
391 arg.buf->sem_perm.gid = gid;
392
393 if( semctl( semid, 0, IPC_SET, arg ) < 0 )
394 cerr << "error: semctl set, " << strerror( errno ) << endl;
395
396 //-- change owner of shared memory
397 key_t memkey = ftok( pipe.latin1(), 'm' );
398 int ramid = shmget( memkey, 0, 0 );
399 if( ramid < 0 ) cerr << "error: shmget, " << strerror( errno ) << endl;
400
401 if( shmctl( ramid, IPC_STAT, &shminfo ) < 0 )
402 cerr << "error: shmctl stat, " << strerror( errno ) << endl;
403
404 shminfo.shm_perm.uid = uid;
405 shminfo.shm_perm.gid = gid;
406
407 if( shmctl( ramid, IPC_SET, &shminfo ) < 0 )
408 cerr << "error: shmctl set, " << strerror( errno ) << endl;
409
410 //-- change owner of region manager
411 memkey = ftok( pipe.latin1(), 'r' );
412 int regionid = shmget( memkey, 0, 0 );
413 if( regionid < 0 )
414 cerr << "error: shmget, " << strerror( errno ) << endl;
415
416 if( shmctl( regionid, IPC_STAT, &shminfo ) < 0 )
417 cerr << "error: shmctl stat, " << strerror( errno ) << endl;
418
419 shminfo.shm_perm.uid = uid;
420 shminfo.shm_perm.gid = gid;
421
422 if( shmctl( regionid, IPC_SET, &shminfo ) < 0 )
423 cerr << "error: shmctl set, " << strerror( errno ) << endl;
424
425 // cerr << "ungrabbing qws display: " << qws_display_id << " on lock " << pipe << endl;
426 // QWSDisplay::ungrab();
427
428 //-- presenting socket-file to new user
429 chown( pipe.latin1(), uid, gid );
430 chown( QTEdataDir.latin1(), uid, gid );
431
432
433 //-- another dirty hack - force framebuffer to be writeable...
434 struct stat devstat;
435 if( ! stat( "/dev/fb0", &devstat ) ) {
436 if( chmod( "/dev/fb0", devstat.st_mode |S_IWOTH |S_IWUSR |S_IWGRP ) ) {
437 cerr << "chmod error: " << strerror( errno ) << endl;
438 }
439 }
440
441 err = rename( QTEdataDir, QTEdataDirNew ) ;
442 if( err < 0 ) cerr << "error: rename " << strerror(errno)
443 << " , " << QTEdataDir << " -> " << QTEdataDirNew << endl;
444
445 //
446 //-- actually change uid and gid
447 //
448 // cerr << "changing persona, uid: " << uid << " gid: " << gid << endl;
449
450 err = setgid( gid );
451 if( err != 0 ) cerr << "error: gid changePersona " << err << endl;
452
453 err = setuid( uid );
454 if( err != 0 ) cerr << "error: uid changePersona " << err << endl;
455
456
457 //-- set some environment
458 setenv( "QWS_DISPLAY", qws_display_str, true );
459 setenv( "LOGNAME", username, true );
460 setenv( "USER", username, true );
461 setenv( "HOME", pword->pw_dir, true );
462
463 // cout << "QTE data dir: " << qws_dataDir() << endl;
464
465 //-- I am reborn
466
467 return true;
468}
469
470
471
472//----------------------------------------------------------------------------
473
474bool QDMDialogImpl::login( QWidget *parent )
475{
476 //-- only when called as 'root' do login-box
477 if( getuid() != 0 )
478 return true;
479
480
481 //-- are we coming from a 'restart' ?
482 if( getenv("QDM_STARTED") )
483 return true;
484 else
485 unsetenv("QDM_STARTED");
486
487
488#ifndef QT_NO_TRANSLATION
489 QString lang = getenv( "LANG" );
490
491 QTranslator * trans = new QTranslator(qApp);
492 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/login.qm";
493 if ( trans->load( tfn ))
494 qApp->installTranslator( trans );
495 else {
496 delete trans;
497 trans = 0;
498 }
499#endif
500
501 if( parent ) parent->erase();
502
503 QDMDialog *dialog = new QDMDialogImpl( parent, "Login", true //);
504 ,WStyle_NoBorder | WStyle_Customize );
505
506#if QT_VERSION >= 300
507 Q_CHECK_PTR( dialog );
508#else
509 CHECK_PTR( dialog );
510#endif
511 int result = dialog->exec();
512 delete dialog;
513
514 if( parent ) parent->erase();
515
516#ifndef QT_NO_TRANSLATION
517 if( trans ) {
518 qApp->removeTranslator( trans );
519 delete trans;
520 trans = 0;
521 }
522#endif
523
524 setenv( "QDM_STARTED", "", true );
525
526 // if( parent ) parent->erase();
527
528 //-- get all configs going
529 Global::restart();
530
531 return result;
532}
533
534
535#endif //-- QT_QWS_LOGIN
diff --git a/core/opie-login/qdmdialogimpl.h b/core/opie-login/qdmdialogimpl.h
new file mode 100644
index 0000000..d62695b
--- a/dev/null
+++ b/core/opie-login/qdmdialogimpl.h
@@ -0,0 +1,90 @@
1//-- -*- c++ -*-
2/**********************************************************************
3** Copyright (C) 2001 LISA Systems
4**
5** This file is an additional part of Qtopia Environment.
6**
7** This file may be distributed and/or modified under the terms of the
8** GNU General Public License version 2 as published by the Free Software
9** Foundation and appearing in the file LICENSE.GPL included in the
10** packaging of this file.
11**
12** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
13** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14**
15** For further information contact info@lisa.de
16**
17**********************************************************************/
18
19/*
20 * AUTHOR: Christian Rahn
21 * EMAIL: cdr@lisa.de
22 *
23 * $Id$
24 */
25
26#ifndef _QDM_IMPL_H
27#define _QDM_IMPL_H
28
29#include "qdm_config.h"
30
31#if defined(QT_QWS_LOGIN)
32
33#include "qdmdialog.h"
34
35class InputMethods;
36
37class QDMDialogImpl : public QDMDialog
38{
39 Q_OBJECT
40
41 public:
42 /** Pop up login dialog and do all stuff */
43 static bool login( QWidget * parent = 0 );
44
45 protected:
46 /** a protected constructor */
47 QDMDialogImpl( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags f = 0 );
48 ~QDMDialogImpl();
49
50 /** Timer for clock display */
51 void timerEvent( QTimerEvent * );
52
53 /** The Timer for the clock */
54 int clockTimer;
55
56 /** Conersation function for PAM */
57 // int PAM_conv (int num_msg, pam_message_type **msg, struct pam_response **resp, void *);
58
59 /** Just become (i.e. log in as) user <name> */
60 bool changePersona( const char *name );
61
62 /** Inform about an incorrect given password */
63 void informBadPassword();
64
65private:
66 InputMethods *input;
67
68 protected slots:
69 /** These got to be overridden so that the login dialog can't be circumvented */
70 virtual void accept ();
71 virtual void reject ();
72
73public slots:
74 /** Display the atual time and date */
75 void showTime( void );
76
77 /** login button pressed */
78 virtual void slot_login();
79
80 /** Shutdown button pressed */
81 virtual void slot_shutdown();
82
83 /** Sleep button pressed */
84 virtual void slot_sleepmode();
85};
86
87#endif //-- QT_QWS_LOGIN
88
89#endif //-- _QDM_IMPL_H
90