summaryrefslogtreecommitdiff
path: root/core/launcher
Unidiff
Diffstat (limited to 'core/launcher') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/.cvsignore7
-rw-r--r--core/launcher/Makefile.in867
-rw-r--r--core/launcher/appicons.cpp129
-rw-r--r--core/launcher/appicons.h51
-rw-r--r--core/launcher/apps.h83
-rw-r--r--core/launcher/background.cpp41
-rw-r--r--core/launcher/background.h40
-rw-r--r--core/launcher/desktop.cpp655
-rw-r--r--core/launcher/desktop.h129
-rw-r--r--core/launcher/info.cpp116
-rw-r--r--core/launcher/info.h55
-rw-r--r--core/launcher/inputmethods.cpp297
-rw-r--r--core/launcher/inputmethods.h76
-rw-r--r--core/launcher/irserver.cpp50
-rw-r--r--core/launcher/irserver.h20
-rw-r--r--core/launcher/launcher.cpp804
-rw-r--r--core/launcher/launcher.h136
-rw-r--r--core/launcher/launcher.pro110
-rw-r--r--core/launcher/launcherview.cpp596
-rw-r--r--core/launcher/launcherview.h81
-rw-r--r--core/launcher/main.cpp276
-rw-r--r--core/launcher/mrulist.cpp199
-rw-r--r--core/launcher/mrulist.h55
-rw-r--r--core/launcher/obexinterface.h40
-rw-r--r--core/launcher/packageslave.cpp97
-rw-r--r--core/launcher/packageslave.h52
-rw-r--r--core/launcher/qcopbridge.cpp416
-rw-r--r--core/launcher/qcopbridge.h95
-rw-r--r--core/launcher/qpe-taskbar.control9
-rw-r--r--core/launcher/quicklauncher.cpp49
-rw-r--r--core/launcher/quicklauncher.h40
-rw-r--r--core/launcher/shutdown.ui1323
-rw-r--r--core/launcher/shutdownimpl.cpp95
-rw-r--r--core/launcher/shutdownimpl.h50
-rw-r--r--core/launcher/sidething.cpp75
-rw-r--r--core/launcher/sidething.h43
-rw-r--r--core/launcher/stabmon.cpp92
-rw-r--r--core/launcher/stabmon.h34
-rw-r--r--core/launcher/startmenu.cpp171
-rw-r--r--core/launcher/startmenu.h76
-rw-r--r--core/launcher/syncdialog.ui228
-rw-r--r--core/launcher/systray.cpp107
-rw-r--r--core/launcher/systray.h58
-rw-r--r--core/launcher/taskbar.cpp314
-rw-r--r--core/launcher/taskbar.h86
-rw-r--r--core/launcher/transferserver.cpp1245
-rw-r--r--core/launcher/transferserver.h168
-rw-r--r--core/launcher/wait.cpp64
-rw-r--r--core/launcher/wait.h45
49 files changed, 9945 insertions, 0 deletions
diff --git a/core/launcher/.cvsignore b/core/launcher/.cvsignore
new file mode 100644
index 0000000..1924a2d
--- a/dev/null
+++ b/core/launcher/.cvsignore
@@ -0,0 +1,7 @@
1moc_*
2*.moc
3Makefile
4shutdown.cpp
5shutdown.h
6qimpenprefbase.h
7lnkpropertiesbase.h
diff --git a/core/launcher/Makefile.in b/core/launcher/Makefile.in
new file mode 100644
index 0000000..e129fca
--- a/dev/null
+++ b/core/launcher/Makefile.in
@@ -0,0 +1,867 @@
1#############################################################################
2
3####### Compiler, tools and options
4
5 CXX =$(SYSCONF_CXX) $(QT_CXX_MT)
6 CXXFLAGS=$(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS)
7 CC =$(SYSCONF_CC) $(QT_C_MT)
8 CFLAGS =$(SYSCONF_CFLAGS)
9 INCPATH =-I$(QPEDIR)/include -I$(QPEDIR)/calibrate -I$(QPEDIR)/rsync
10 LFLAGS =$(SYSCONF_LFLAGS_QT) $(SYSCONF_RPATH_QT) $(SYSCONF_LFLAGS) $(QT_LFLAGS_MT)
11 LIBS =$(SUBLIBS) -lqpe -lcrypt $(SYSCONF_LIBS_QT) $(SYSCONF_LIBS) $(SYSCONF_LIBS_QTAPP)
12 MOC =$(SYSCONF_MOC)
13 UIC =$(SYSCONF_UIC)
14
15####### Target
16
17DESTDIR = $(QPEDIR)/bin/
18VER_MAJ = 1
19VER_MIN = 0
20VER_PATCH = 0
21 TARGET= qpe
22TARGET1 = lib$(TARGET).so.$(VER_MAJ)
23
24####### Files
25
26 HEADERS =background.h \
27 desktop.h \
28 info.h \
29 appicons.h \
30 taskbar.h \
31 sidething.h \
32 mrulist.h \
33 stabmon.h \
34 inputmethods.h \
35 systray.h \
36 wait.h \
37 shutdownimpl.h \
38 launcher.h \
39 launcherview.h \
40 ../calibrate/calibrate.h \
41 startmenu.h \
42 transferserver.h \
43 qcopbridge.h \
44 packageslave.h \
45 irserver.h \
46 $(QPEDIR)/rsync/buf.h \
47 $(QPEDIR)/rsync/checksum.h \
48 $(QPEDIR)/rsync/command.h \
49 $(QPEDIR)/rsync/emit.h \
50 $(QPEDIR)/rsync/job.h \
51 $(QPEDIR)/rsync/netint.h \
52 $(QPEDIR)/rsync/protocol.h \
53 $(QPEDIR)/rsync/prototab.h \
54 $(QPEDIR)/rsync/rsync.h \
55 $(QPEDIR)/rsync/search.h \
56 $(QPEDIR)/rsync/stream.h \
57 $(QPEDIR)/rsync/sumset.h \
58 $(QPEDIR)/rsync/trace.h \
59 $(QPEDIR)/rsync/types.h \
60 $(QPEDIR)/rsync/util.h \
61 $(QPEDIR)/rsync/whole.h \
62 $(QPEDIR)/rsync/config_rsync.h \
63 $(QPEDIR)/rsync/qrsync.h
64 SOURCES =background.cpp \
65 desktop.cpp \
66 info.cpp \
67 appicons.cpp \
68 taskbar.cpp \
69 sidething.cpp \
70 mrulist.cpp \
71 stabmon.cpp \
72 inputmethods.cpp \
73 systray.cpp \
74 wait.cpp \
75 shutdownimpl.cpp \
76 launcher.cpp \
77 launcherview.cpp \
78 $(QPEDIR)/calibrate/calibrate.cpp \
79 transferserver.cpp \
80 packageslave.cpp \
81 irserver.cpp \
82 qcopbridge.cpp \
83 startmenu.cpp \
84 main.cpp \
85 $(QPEDIR)/rsync/base64.c \
86 $(QPEDIR)/rsync/buf.c \
87 $(QPEDIR)/rsync/checksum.c \
88 $(QPEDIR)/rsync/command.c \
89 $(QPEDIR)/rsync/delta.c \
90 $(QPEDIR)/rsync/emit.c \
91 $(QPEDIR)/rsync/hex.c \
92 $(QPEDIR)/rsync/job.c \
93 $(QPEDIR)/rsync/mdfour.c \
94 $(QPEDIR)/rsync/mksum.c \
95 $(QPEDIR)/rsync/msg.c \
96 $(QPEDIR)/rsync/netint.c \
97 $(QPEDIR)/rsync/patch.c \
98 $(QPEDIR)/rsync/prototab.c \
99 $(QPEDIR)/rsync/readsums.c \
100 $(QPEDIR)/rsync/scoop.c \
101 $(QPEDIR)/rsync/search.c \
102 $(QPEDIR)/rsync/stats.c \
103 $(QPEDIR)/rsync/stream.c \
104 $(QPEDIR)/rsync/sumset.c \
105 $(QPEDIR)/rsync/trace.c \
106 $(QPEDIR)/rsync/tube.c \
107 $(QPEDIR)/rsync/util.c \
108 $(QPEDIR)/rsync/version.c \
109 $(QPEDIR)/rsync/whole.c \
110 $(QPEDIR)/rsync/qrsync.cpp
111 OBJECTS =background.o \
112 desktop.o \
113 info.o \
114 appicons.o \
115 taskbar.o \
116 sidething.o \
117 mrulist.o \
118 stabmon.o \
119 inputmethods.o \
120 systray.o \
121 wait.o \
122 shutdownimpl.o \
123 launcher.o \
124 launcherview.o \
125 $(QPEDIR)/calibrate/calibrate.o \
126 transferserver.o \
127 packageslave.o \
128 irserver.o \
129 qcopbridge.o \
130 startmenu.o \
131 main.o \
132 $(QPEDIR)/rsync/base64.o \
133 $(QPEDIR)/rsync/buf.o \
134 $(QPEDIR)/rsync/checksum.o \
135 $(QPEDIR)/rsync/command.o \
136 $(QPEDIR)/rsync/delta.o \
137 $(QPEDIR)/rsync/emit.o \
138 $(QPEDIR)/rsync/hex.o \
139 $(QPEDIR)/rsync/job.o \
140 $(QPEDIR)/rsync/mdfour.o \
141 $(QPEDIR)/rsync/mksum.o \
142 $(QPEDIR)/rsync/msg.o \
143 $(QPEDIR)/rsync/netint.o \
144 $(QPEDIR)/rsync/patch.o \
145 $(QPEDIR)/rsync/prototab.o \
146 $(QPEDIR)/rsync/readsums.o \
147 $(QPEDIR)/rsync/scoop.o \
148 $(QPEDIR)/rsync/search.o \
149 $(QPEDIR)/rsync/stats.o \
150 $(QPEDIR)/rsync/stream.o \
151 $(QPEDIR)/rsync/sumset.o \
152 $(QPEDIR)/rsync/trace.o \
153 $(QPEDIR)/rsync/tube.o \
154 $(QPEDIR)/rsync/util.o \
155 $(QPEDIR)/rsync/version.o \
156 $(QPEDIR)/rsync/whole.o \
157 $(QPEDIR)/rsync/qrsync.o \
158 shutdown.o \
159 syncdialog.o
160INTERFACES = shutdown.ui \
161 syncdialog.ui
162UICDECLS = shutdown.h \
163 syncdialog.h
164UICIMPLS = shutdown.cpp \
165 syncdialog.cpp
166 SRCMOC =moc_background.cpp \
167 moc_desktop.cpp \
168 moc_info.cpp \
169 moc_appicons.cpp \
170 moc_taskbar.cpp \
171 moc_sidething.cpp \
172 moc_inputmethods.cpp \
173 moc_systray.cpp \
174 moc_shutdownimpl.cpp \
175 moc_launcher.cpp \
176 moc_launcherview.cpp \
177 ../calibrate/moc_calibrate.cpp \
178 moc_startmenu.cpp \
179 moc_transferserver.cpp \
180 moc_qcopbridge.cpp \
181 moc_packageslave.cpp \
182 moc_irserver.cpp \
183 appicons.moc \
184 moc_shutdown.cpp \
185 moc_syncdialog.cpp
186 OBJMOC =moc_background.o \
187 moc_desktop.o \
188 moc_info.o \
189 moc_appicons.o \
190 moc_taskbar.o \
191 moc_sidething.o \
192 moc_inputmethods.o \
193 moc_systray.o \
194 moc_shutdownimpl.o \
195 moc_launcher.o \
196 moc_launcherview.o \
197 ../calibrate/moc_calibrate.o \
198 moc_startmenu.o \
199 moc_transferserver.o \
200 moc_qcopbridge.o \
201 moc_packageslave.o \
202 moc_irserver.o \
203 moc_shutdown.o \
204 moc_syncdialog.o
205
206
207####### Implicit rules
208
209.SUFFIXES: .cpp .cxx .cc .C .c
210
211.cpp.o:
212 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
213
214.cxx.o:
215 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
216
217.cc.o:
218 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
219
220.C.o:
221 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
222
223.c.o:
224 $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
225
226####### Build rules
227
228
229all: $(DESTDIR)$(TARGET)
230
231$(DESTDIR)$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS)
232 $(SYSCONF_LINK) $(LFLAGS) -o $(DESTDIR)$(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)
233
234moc: $(SRCMOC)
235
236tmake:
237 tmake taskbar.pro
238
239clean:
240 -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS)
241 -rm -f *~ core
242 -rm -f allmoc.cpp
243
244####### Extension Modules
245
246listpromodules:
247 @echo
248
249listallmodules:
250 @echo
251
252listaddonpromodules:
253 @echo
254
255listaddonentmodules:
256 @echo
257
258
259REQUIRES=
260
261####### Sub-libraries
262
263
264###### Combined headers
265
266
267
268####### Compile
269
270background.o: background.cpp \
271 background.h \
272 desktop.h \
273 shutdownimpl.h \
274 shutdown.h \
275 $(QPEDIR)/include/qpe/qpeapplication.h \
276 $(QPEDIR)/include/qpe/resource.h
277
278desktop.o: desktop.cpp \
279 desktop.h \
280 shutdownimpl.h \
281 shutdown.h \
282 $(QPEDIR)/include/qpe/qpeapplication.h \
283 info.h \
284 background.h \
285 launcher.h \
286 launcherview.h \
287 $(QPEDIR)/include/qpe/storage.h \
288 mrulist.h \
289 $(QPEDIR)/include/qpe/applnk.h \
290 qcopbridge.h \
291 startmenu.h \
292 taskbar.h \
293 $(QPEDIR)/include/qpe/custom.h \
294 transferserver.h \
295 irserver.h \
296 packageslave.h \
297 $(QPEDIR)/include/qpe/mimetype.h \
298 $(QPEDIR)/include/qpe/password.h \
299 $(QPEDIR)/include/qpe/config.h \
300 $(QPEDIR)/include/qpe/power.h \
301 $(QPEDIR)/include/qpe/qcopenvelope_qws.h \
302 $(QPEDIR)/include/qpe/global.h
303
304info.o: info.cpp \
305 info.h \
306 background.h \
307 desktop.h \
308 shutdownimpl.h \
309 shutdown.h \
310 $(QPEDIR)/include/qpe/qpeapplication.h \
311 $(QPEDIR)/include/qpe/resource.h \
312 $(QPEDIR)/include/qpe/version.h
313
314appicons.o: appicons.cpp \
315 appicons.moc \
316 appicons.h \
317 $(QPEDIR)/include/qpe/qcopenvelope_qws.h
318
319taskbar.o: taskbar.cpp \
320 startmenu.h \
321 inputmethods.h \
322 $(QPEDIR)/include/qpe/inputmethodinterface.h \
323 $(QPEDIR)/include/qpe/qcom.h \
324 $(QPEDIR)/include/qpe/quuid.h \
325 mrulist.h \
326 $(QPEDIR)/include/qpe/applnk.h \
327 systray.h \
328 $(QPEDIR)/include/qpe/taskbarappletinterface.h \
329 $(QPEDIR)/calibrate/calibrate.h \
330 wait.h \
331 $(QPEDIR)/include/qpe/resource.h \
332 appicons.h \
333 taskbar.h \
334 $(QPEDIR)/include/qpe/custom.h \
335 desktop.h \
336 shutdownimpl.h \
337 shutdown.h \
338 $(QPEDIR)/include/qpe/qpeapplication.h \
339 $(QPEDIR)/include/qpe/qcopenvelope_qws.h \
340 $(QPEDIR)/include/qpe/global.h \
341 ../taskbar/apps.h \
342 ../addressbook/addressbook.h \
343 ../datebook/datebook.h \
344 $(QPEDIR)/include/qpe/datebookdb.h \
345 $(QPEDIR)/include/qpe/event.h \
346 $(QPEDIR)/include/qpe/palmtoprecord.h \
347 ../helpbrowser/helpbrowser.h \
348 ../minesweep/minesweep.h \
349 ../textedit/textedit.h \
350 $(QPEDIR)/include/qpe/filemanager.h \
351 ../todo/mainwindow.h \
352 ../citytime/citytime.h \
353 ../clock/clock.h \
354 ../calculator/calculatorimpl.h \
355 ../sysinfo/sysinfo.h \
356 ../settings/appearance/settings.h \
357 ../settings/systemtime/settime.h \
358 $(QPEDIR)/include/qpe/timestring.h \
359 ../filebrowser/filebrowser.h \
360 ../solitaire/canvascardwindow.h \
361 ../snake/interface.h \
362 ../parashoot/interface.h \
363 $(QPEDIR)/include/qpe/sound.h \
364 ../mpegplayer/mediaplayer.h \
365 $(QPEDIR)/include/qpe/qlibrary.h \
366 ../embeddedkonsole/konsole.h \
367 ../wordgame/wordgame.h \
368 $(QPEDIR)/include/qpe/qdawg.h
369
370sidething.o: sidething.cpp \
371 sidething.h \
372 startmenu.h \
373 $(QPEDIR)/include/qpe/resource.h
374
375mrulist.o: mrulist.cpp \
376 mrulist.h \
377 $(QPEDIR)/include/qpe/applnk.h \
378 $(QPEDIR)/include/qpe/global.h \
379 $(QPEDIR)/include/qpe/resource.h
380
381stabmon.o: stabmon.cpp \
382 stabmon.h \
383 $(QPEDIR)/include/qpe/qcopenvelope_qws.h
384
385inputmethods.o: inputmethods.cpp \
386 inputmethods.h \
387 $(QPEDIR)/include/qpe/inputmethodinterface.h \
388 $(QPEDIR)/include/qpe/qcom.h \
389 $(QPEDIR)/include/qpe/quuid.h \
390 $(QPEDIR)/include/qpe/config.h \
391 $(QPEDIR)/include/qpe/qpeapplication.h \
392 $(QPEDIR)/include/qpe/qlibrary.h
393
394systray.o: systray.cpp \
395 $(QPEDIR)/include/qpe/qpeapplication.h \
396 $(QPEDIR)/include/qpe/qlibrary.h \
397 $(QPEDIR)/include/qpe/qcom.h \
398 $(QPEDIR)/include/qpe/quuid.h \
399 $(QPEDIR)/include/qpe/config.h \
400 quicklauncher.h \
401 systray.h \
402 $(QPEDIR)/include/qpe/taskbarappletinterface.h
403
404wait.o: wait.cpp \
405 wait.h \
406 $(QPEDIR)/include/qpe/resource.h
407
408shutdownimpl.o: shutdownimpl.cpp \
409 shutdownimpl.h \
410 shutdown.h \
411 $(QPEDIR)/include/qpe/global.h
412
413launcher.o: launcher.cpp \
414 $(QPEDIR)/include/qpe/qcopenvelope_qws.h \
415 $(QPEDIR)/include/qpe/resource.h \
416 $(QPEDIR)/include/qpe/applnk.h \
417 $(QPEDIR)/include/qpe/config.h \
418 $(QPEDIR)/include/qpe/global.h \
419 $(QPEDIR)/include/qpe/qpeapplication.h \
420 $(QPEDIR)/include/qpe/mimetype.h \
421 $(QPEDIR)/include/qpe/storage.h \
422 launcherview.h \
423 launcher.h \
424 $(QPEDIR)/include/qpe/lnkproperties.h \
425 mrulist.h \
426 $(QPEDIR)/rsync/qrsync.h
427
428launcherview.o: launcherview.cpp \
429 launcherview.h \
430 $(QPEDIR)/include/qpe/storage.h \
431 $(QPEDIR)/include/qpe/qpeapplication.h \
432 $(QPEDIR)/include/qpe/applnk.h \
433 $(QPEDIR)/include/qpe/qpedebug.h \
434 $(QPEDIR)/include/qpe/categories.h \
435 $(QPEDIR)/include/qpe/categoryselect.h \
436 $(QPEDIR)/include/qpe/menubutton.h \
437 $(QPEDIR)/include/qpe/resource.h \
438 $(QPEDIR)/include/qpe/qpetoolbar.h
439
440$(QPEDIR)/calibrate/calibrate.o: $(QPEDIR)/calibrate/calibrate.cpp \
441 $(QPEDIR)/calibrate/calibrate.h \
442 $(QPEDIR)/include/qpe/resource.h
443
444transferserver.o: transferserver.cpp \
445 $(QPEDIR)/include/qpe/qprocess.h \
446 $(QPEDIR)/include/qpe/process.h \
447 transferserver.h
448
449packageslave.o: packageslave.cpp \
450 packageslave.h \
451 $(QPEDIR)/include/qpe/process.h \
452 $(QPEDIR)/include/qpe/qcopenvelope_qws.h
453
454irserver.o: irserver.cpp \
455 irserver.h \
456 $(QPEDIR)/include/qpe/qlibrary.h \
457 $(QPEDIR)/include/qpe/qcom.h \
458 $(QPEDIR)/include/qpe/quuid.h \
459 $(QPEDIR)/include/qpe/qpeapplication.h \
460 obexinterface.h
461
462qcopbridge.o: qcopbridge.cpp \
463 qcopbridge.h \
464 $(QPEDIR)/include/qpe/qcopenvelope_qws.h \
465 $(QPEDIR)/include/qpe/qpeapplication.h
466
467startmenu.o: startmenu.cpp \
468 startmenu.h \
469 sidething.h \
470 mrulist.h \
471 $(QPEDIR)/include/qpe/applnk.h \
472 info.h \
473 background.h \
474 $(QPEDIR)/include/qpe/qpeapplication.h \
475 $(QPEDIR)/include/qpe/config.h \
476 $(QPEDIR)/include/qpe/global.h \
477 $(QPEDIR)/include/qpe/resource.h
478
479main.o: main.cpp \
480 desktop.h \
481 shutdownimpl.h \
482 shutdown.h \
483 $(QPEDIR)/include/qpe/qpeapplication.h \
484 taskbar.h \
485 $(QPEDIR)/include/qpe/custom.h \
486 stabmon.h \
487 $(QPEDIR)/include/qpe/network.h \
488 $(QPEDIR)/include/qpe/config.h \
489 $(QPEDIR)/include/qpe/qcopenvelope_qws.h \
490 $(QPEDIR)/include/qpe/alarmserver.h \
491 ../calibrate/calibrate.h \
492 ../login/qdmdialogimpl.h \
493 $(QPEDIR)/include/qpe/global.h
494
495$(QPEDIR)/rsync/base64.o: $(QPEDIR)/rsync/base64.c \
496 $(QPEDIR)/rsync/config_rsync.h \
497 $(QPEDIR)/rsync/config_linux.h \
498 $(QPEDIR)/rsync/rsync.h
499
500$(QPEDIR)/rsync/buf.o: $(QPEDIR)/rsync/buf.c \
501 $(QPEDIR)/rsync/config_rsync.h \
502 $(QPEDIR)/rsync/config_linux.h \
503 $(QPEDIR)/rsync/rsync.h \
504 $(QPEDIR)/rsync/trace.h \
505 $(QPEDIR)/rsync/buf.h \
506 $(QPEDIR)/rsync/util.h
507
508$(QPEDIR)/rsync/checksum.o: $(QPEDIR)/rsync/checksum.c \
509 $(QPEDIR)/rsync/config_rsync.h \
510 $(QPEDIR)/rsync/config_linux.h \
511 $(QPEDIR)/rsync/rsync.h \
512 $(QPEDIR)/rsync/checksum.h
513
514$(QPEDIR)/rsync/command.o: $(QPEDIR)/rsync/command.c \
515 $(QPEDIR)/rsync/config_rsync.h \
516 $(QPEDIR)/rsync/config_linux.h \
517 $(QPEDIR)/rsync/rsync.h \
518 $(QPEDIR)/rsync/command.h
519
520$(QPEDIR)/rsync/delta.o: $(QPEDIR)/rsync/delta.c \
521 $(QPEDIR)/rsync/config_rsync.h \
522 $(QPEDIR)/rsync/config_linux.h \
523 $(QPEDIR)/rsync/rsync.h \
524 $(QPEDIR)/rsync/emit.h \
525 $(QPEDIR)/rsync/stream.h \
526 $(QPEDIR)/rsync/util.h \
527 $(QPEDIR)/rsync/sumset.h \
528 $(QPEDIR)/rsync/job.h \
529 $(QPEDIR)/rsync/trace.h \
530 $(QPEDIR)/rsync/checksum.h \
531 $(QPEDIR)/rsync/search.h \
532 $(QPEDIR)/rsync/types.h
533
534$(QPEDIR)/rsync/emit.o: $(QPEDIR)/rsync/emit.c \
535 $(QPEDIR)/rsync/config_rsync.h \
536 $(QPEDIR)/rsync/config_linux.h \
537 $(QPEDIR)/rsync/rsync.h \
538 $(QPEDIR)/rsync/command.h \
539 $(QPEDIR)/rsync/protocol.h \
540 $(QPEDIR)/rsync/trace.h \
541 $(QPEDIR)/rsync/emit.h \
542 $(QPEDIR)/rsync/prototab.h \
543 $(QPEDIR)/rsync/netint.h \
544 $(QPEDIR)/rsync/sumset.h \
545 $(QPEDIR)/rsync/job.h
546
547$(QPEDIR)/rsync/hex.o: $(QPEDIR)/rsync/hex.c \
548 $(QPEDIR)/rsync/config_rsync.h \
549 $(QPEDIR)/rsync/config_linux.h \
550 $(QPEDIR)/rsync/rsync.h
551
552$(QPEDIR)/rsync/job.o: $(QPEDIR)/rsync/job.c \
553 $(QPEDIR)/rsync/config_rsync.h \
554 $(QPEDIR)/rsync/config_linux.h \
555 $(QPEDIR)/rsync/rsync.h \
556 $(QPEDIR)/rsync/stream.h \
557 $(QPEDIR)/rsync/util.h \
558 $(QPEDIR)/rsync/sumset.h \
559 $(QPEDIR)/rsync/job.h \
560 $(QPEDIR)/rsync/trace.h
561
562$(QPEDIR)/rsync/mdfour.o: $(QPEDIR)/rsync/mdfour.c \
563 $(QPEDIR)/rsync/config_rsync.h \
564 $(QPEDIR)/rsync/config_linux.h \
565 $(QPEDIR)/rsync/rsync.h \
566 $(QPEDIR)/rsync/trace.h \
567 $(QPEDIR)/rsync/types.h
568
569$(QPEDIR)/rsync/mksum.o: $(QPEDIR)/rsync/mksum.c \
570 $(QPEDIR)/rsync/config_rsync.h \
571 $(QPEDIR)/rsync/config_linux.h \
572 $(QPEDIR)/rsync/rsync.h \
573 $(QPEDIR)/rsync/stream.h \
574 $(QPEDIR)/rsync/util.h \
575 $(QPEDIR)/rsync/sumset.h \
576 $(QPEDIR)/rsync/job.h \
577 $(QPEDIR)/rsync/protocol.h \
578 $(QPEDIR)/rsync/netint.h \
579 $(QPEDIR)/rsync/trace.h \
580 $(QPEDIR)/rsync/checksum.h
581
582$(QPEDIR)/rsync/msg.o: $(QPEDIR)/rsync/msg.c \
583 $(QPEDIR)/rsync/config_rsync.h \
584 $(QPEDIR)/rsync/config_linux.h \
585 $(QPEDIR)/rsync/rsync.h
586
587$(QPEDIR)/rsync/netint.o: $(QPEDIR)/rsync/netint.c \
588 $(QPEDIR)/rsync/config_rsync.h \
589 $(QPEDIR)/rsync/config_linux.h \
590 $(QPEDIR)/rsync/rsync.h \
591 $(QPEDIR)/rsync/job.h \
592 $(QPEDIR)/rsync/netint.h \
593 $(QPEDIR)/rsync/trace.h \
594 $(QPEDIR)/rsync/stream.h
595
596$(QPEDIR)/rsync/patch.o: $(QPEDIR)/rsync/patch.c \
597 $(QPEDIR)/rsync/config_rsync.h \
598 $(QPEDIR)/rsync/config_linux.h \
599 $(QPEDIR)/rsync/rsync.h \
600 $(QPEDIR)/rsync/util.h \
601 $(QPEDIR)/rsync/trace.h \
602 $(QPEDIR)/rsync/protocol.h \
603 $(QPEDIR)/rsync/netint.h \
604 $(QPEDIR)/rsync/command.h \
605 $(QPEDIR)/rsync/sumset.h \
606 $(QPEDIR)/rsync/prototab.h \
607 $(QPEDIR)/rsync/stream.h \
608 $(QPEDIR)/rsync/job.h
609
610$(QPEDIR)/rsync/prototab.o: $(QPEDIR)/rsync/prototab.c \
611 $(QPEDIR)/rsync/config_rsync.h \
612 $(QPEDIR)/rsync/config_linux.h \
613 $(QPEDIR)/rsync/rsync.h \
614 $(QPEDIR)/rsync/protocol.h \
615 $(QPEDIR)/rsync/command.h \
616 $(QPEDIR)/rsync/prototab.h
617
618$(QPEDIR)/rsync/readsums.o: $(QPEDIR)/rsync/readsums.c \
619 $(QPEDIR)/rsync/config_rsync.h \
620 $(QPEDIR)/rsync/config_linux.h \
621 $(QPEDIR)/rsync/rsync.h \
622 $(QPEDIR)/rsync/sumset.h \
623 $(QPEDIR)/rsync/job.h \
624 $(QPEDIR)/rsync/trace.h \
625 $(QPEDIR)/rsync/netint.h \
626 $(QPEDIR)/rsync/protocol.h \
627 $(QPEDIR)/rsync/util.h \
628 $(QPEDIR)/rsync/stream.h
629
630$(QPEDIR)/rsync/scoop.o: $(QPEDIR)/rsync/scoop.c \
631 $(QPEDIR)/rsync/config_rsync.h \
632 $(QPEDIR)/rsync/config_linux.h \
633 $(QPEDIR)/rsync/rsync.h \
634 $(QPEDIR)/rsync/job.h \
635 $(QPEDIR)/rsync/stream.h \
636 $(QPEDIR)/rsync/trace.h \
637 $(QPEDIR)/rsync/util.h
638
639$(QPEDIR)/rsync/search.o: $(QPEDIR)/rsync/search.c \
640 $(QPEDIR)/rsync/config_rsync.h \
641 $(QPEDIR)/rsync/config_linux.h \
642 $(QPEDIR)/rsync/rsync.h \
643 $(QPEDIR)/rsync/trace.h \
644 $(QPEDIR)/rsync/util.h \
645 $(QPEDIR)/rsync/sumset.h \
646 $(QPEDIR)/rsync/search.h \
647 $(QPEDIR)/rsync/checksum.h
648
649$(QPEDIR)/rsync/stats.o: $(QPEDIR)/rsync/stats.c \
650 $(QPEDIR)/rsync/config_rsync.h \
651 $(QPEDIR)/rsync/config_linux.h \
652 $(QPEDIR)/rsync/rsync.h \
653 $(QPEDIR)/rsync/trace.h
654
655$(QPEDIR)/rsync/stream.o: $(QPEDIR)/rsync/stream.c \
656 $(QPEDIR)/rsync/config_rsync.h \
657 $(QPEDIR)/rsync/config_linux.h \
658 $(QPEDIR)/rsync/rsync.h \
659 $(QPEDIR)/rsync/stream.h \
660 $(QPEDIR)/rsync/util.h \
661 $(QPEDIR)/rsync/trace.h
662
663$(QPEDIR)/rsync/sumset.o: $(QPEDIR)/rsync/sumset.c \
664 $(QPEDIR)/rsync/config_rsync.h \
665 $(QPEDIR)/rsync/config_linux.h \
666 $(QPEDIR)/rsync/rsync.h \
667 $(QPEDIR)/rsync/sumset.h \
668 $(QPEDIR)/rsync/util.h \
669 $(QPEDIR)/rsync/trace.h
670
671$(QPEDIR)/rsync/trace.o: $(QPEDIR)/rsync/trace.c \
672 $(QPEDIR)/rsync/config_rsync.h \
673 $(QPEDIR)/rsync/config_linux.h \
674 $(QPEDIR)/rsync/rsync.h \
675 $(QPEDIR)/rsync/util.h \
676 $(QPEDIR)/rsync/trace.h
677
678$(QPEDIR)/rsync/tube.o: $(QPEDIR)/rsync/tube.c \
679 $(QPEDIR)/rsync/config_rsync.h \
680 $(QPEDIR)/rsync/config_linux.h \
681 $(QPEDIR)/rsync/rsync.h \
682 $(QPEDIR)/rsync/trace.h \
683 $(QPEDIR)/rsync/util.h \
684 $(QPEDIR)/rsync/job.h \
685 $(QPEDIR)/rsync/stream.h
686
687$(QPEDIR)/rsync/util.o: $(QPEDIR)/rsync/util.c \
688 $(QPEDIR)/rsync/config_rsync.h \
689 $(QPEDIR)/rsync/config_linux.h \
690 $(QPEDIR)/rsync/util.h \
691 $(QPEDIR)/rsync/rsync.h \
692 $(QPEDIR)/rsync/trace.h
693
694$(QPEDIR)/rsync/version.o: $(QPEDIR)/rsync/version.c \
695 $(QPEDIR)/rsync/config_rsync.h \
696 $(QPEDIR)/rsync/config_linux.h \
697 $(QPEDIR)/rsync/rsync.h
698
699$(QPEDIR)/rsync/whole.o: $(QPEDIR)/rsync/whole.c \
700 $(QPEDIR)/rsync/config_rsync.h \
701 $(QPEDIR)/rsync/config_linux.h \
702 $(QPEDIR)/rsync/rsync.h \
703 $(QPEDIR)/rsync/trace.h \
704 $(QPEDIR)/rsync/fileutil.h \
705 $(QPEDIR)/rsync/sumset.h \
706 $(QPEDIR)/rsync/job.h \
707 $(QPEDIR)/rsync/buf.h \
708 $(QPEDIR)/rsync/whole.h \
709 $(QPEDIR)/rsync/util.h
710
711$(QPEDIR)/rsync/qrsync.o: $(QPEDIR)/rsync/qrsync.cpp \
712 $(QPEDIR)/rsync/qrsync.h \
713 $(QPEDIR)/rsync/rsync.h
714
715shutdown.h: shutdown.ui
716 $(UIC) shutdown.ui -o $(INTERFACE_DECL_PATH)/shutdown.h
717
718shutdown.cpp: shutdown.ui
719 $(UIC) shutdown.ui -i shutdown.h -o shutdown.cpp
720
721syncdialog.h: syncdialog.ui
722 $(UIC) syncdialog.ui -o $(INTERFACE_DECL_PATH)/syncdialog.h
723
724syncdialog.cpp: syncdialog.ui
725 $(UIC) syncdialog.ui -i syncdialog.h -o syncdialog.cpp
726
727shutdown.o: shutdown.cpp \
728 shutdown.h
729
730syncdialog.o: syncdialog.cpp
731
732moc_background.o: moc_background.cpp \
733 background.h
734
735moc_desktop.o: moc_desktop.cpp \
736 desktop.h \
737 shutdownimpl.h \
738 shutdown.h \
739 $(QPEDIR)/include/qpe/qpeapplication.h
740
741moc_info.o: moc_info.cpp \
742 info.h \
743 background.h
744
745moc_appicons.o: moc_appicons.cpp \
746 appicons.h
747
748moc_taskbar.o: moc_taskbar.cpp \
749 taskbar.h \
750 $(QPEDIR)/include/qpe/custom.h
751
752moc_sidething.o: moc_sidething.cpp \
753 sidething.h \
754 startmenu.h
755
756moc_inputmethods.o: moc_inputmethods.cpp \
757 inputmethods.h \
758 $(QPEDIR)/include/qpe/inputmethodinterface.h \
759 $(QPEDIR)/include/qpe/qcom.h \
760 $(QPEDIR)/include/qpe/quuid.h
761
762moc_systray.o: moc_systray.cpp \
763 systray.h \
764 $(QPEDIR)/include/qpe/taskbarappletinterface.h \
765 $(QPEDIR)/include/qpe/qcom.h \
766 $(QPEDIR)/include/qpe/quuid.h
767
768moc_shutdownimpl.o: moc_shutdownimpl.cpp \
769 shutdownimpl.h \
770 shutdown.h
771
772moc_launcher.o: moc_launcher.cpp \
773 launcher.h \
774 launcherview.h \
775 $(QPEDIR)/include/qpe/storage.h
776
777moc_launcherview.o: moc_launcherview.cpp \
778 launcherview.h \
779 $(QPEDIR)/include/qpe/storage.h
780
781../calibrate/moc_calibrate.o: ../calibrate/moc_calibrate.cpp \
782 ../calibrate/calibrate.h
783
784moc_startmenu.o: moc_startmenu.cpp \
785 startmenu.h
786
787moc_transferserver.o: moc_transferserver.cpp \
788 transferserver.h
789
790moc_qcopbridge.o: moc_qcopbridge.cpp \
791 qcopbridge.h
792
793moc_packageslave.o: moc_packageslave.cpp \
794 packageslave.h
795
796moc_irserver.o: moc_irserver.cpp \
797 irserver.h
798
799moc_shutdown.o: appicons.moc \
800 appicons.cpp \
801 appicons.h \
802 $(QPEDIR)/include/qpe/qcopenvelope_qws.h
803
804moc_syncdialog.o: moc_shutdown.cpp \
805 shutdown.h
806
807moc_background.cpp: background.h
808 $(MOC) background.h -o moc_background.cpp
809
810moc_desktop.cpp: desktop.h
811 $(MOC) desktop.h -o moc_desktop.cpp
812
813moc_info.cpp: info.h
814 $(MOC) info.h -o moc_info.cpp
815
816moc_appicons.cpp: appicons.h
817 $(MOC) appicons.h -o moc_appicons.cpp
818
819moc_taskbar.cpp: taskbar.h
820 $(MOC) taskbar.h -o moc_taskbar.cpp
821
822moc_sidething.cpp: sidething.h
823 $(MOC) sidething.h -o moc_sidething.cpp
824
825moc_inputmethods.cpp: inputmethods.h
826 $(MOC) inputmethods.h -o moc_inputmethods.cpp
827
828moc_systray.cpp: systray.h
829 $(MOC) systray.h -o moc_systray.cpp
830
831moc_shutdownimpl.cpp: shutdownimpl.h
832 $(MOC) shutdownimpl.h -o moc_shutdownimpl.cpp
833
834moc_launcher.cpp: launcher.h
835 $(MOC) launcher.h -o moc_launcher.cpp
836
837moc_launcherview.cpp: launcherview.h
838 $(MOC) launcherview.h -o moc_launcherview.cpp
839
840../calibrate/moc_calibrate.cpp: ../calibrate/calibrate.h
841 $(MOC) ../calibrate/calibrate.h -o ../calibrate/moc_calibrate.cpp
842
843moc_startmenu.cpp: startmenu.h
844 $(MOC) startmenu.h -o moc_startmenu.cpp
845
846moc_transferserver.cpp: transferserver.h
847 $(MOC) transferserver.h -o moc_transferserver.cpp
848
849moc_qcopbridge.cpp: qcopbridge.h
850 $(MOC) qcopbridge.h -o moc_qcopbridge.cpp
851
852moc_packageslave.cpp: packageslave.h
853 $(MOC) packageslave.h -o moc_packageslave.cpp
854
855moc_irserver.cpp: irserver.h
856 $(MOC) irserver.h -o moc_irserver.cpp
857
858appicons.moc: appicons.cpp
859 $(MOC) appicons.cpp -o appicons.moc
860
861moc_shutdown.cpp: shutdown.h
862 $(MOC) shutdown.h -o moc_shutdown.cpp
863
864moc_syncdialog.cpp: syncdialog.h
865 $(MOC) syncdialog.h -o moc_syncdialog.cpp
866
867
diff --git a/core/launcher/appicons.cpp b/core/launcher/appicons.cpp
new file mode 100644
index 0000000..c51ee5a
--- a/dev/null
+++ b/core/launcher/appicons.cpp
@@ -0,0 +1,129 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21
22#include "appicons.h"
23
24#include <qpe/qcopenvelope_qws.h>
25
26#include <qtooltip.h>
27#include <qpixmap.h>
28
29
30AppIcons::AppIcons( QWidget *parent ) :
31 QHBox(parent)
32{
33 buttons.setAutoDelete(TRUE);
34
35#ifndef QT_NO_COP
36 QCopChannel* channel = new QCopChannel("Qt/Tray", this);
37 connect(channel, SIGNAL(received(const QCString&, const QByteArray&)),
38 this, SLOT(receive(const QCString&, const QByteArray&)));
39#endif
40}
41
42void AppIcons::setIcon(int id, const QPixmap& pm)
43{
44 button(id)->setPixmap(pm);
45}
46
47class FlatButton : public QLabel {
48 Q_OBJECT
49public:
50 FlatButton(QWidget* parent) : QLabel(parent) { }
51
52 void mouseDoubleClickEvent(QMouseEvent* e)
53 {
54 emit clicked(e->pos(),e->button(),TRUE);
55 }
56 void mouseReleaseEvent(QMouseEvent* e)
57 {
58 if ( rect().contains(e->pos()) )
59 emit clicked(e->pos(),e->button(),FALSE);
60 }
61
62signals:
63 void clicked(const QPoint&, int, bool);
64};
65
66QLabel* AppIcons::button(int id)
67{
68 QLabel* f = buttons.find(id);
69 if ( !f ) {
70 buttons.insert(id,f=new FlatButton(this));
71 connect(f,SIGNAL(clicked(const QPoint&, int, bool)),this,SLOT(clicked(const QPoint&, int, bool)));
72 f->show();
73 }
74 return f;
75}
76
77int AppIcons::findId(QLabel* b)
78{
79 QIntDictIterator<QLabel> it(buttons);
80 for ( ; ; ++it )
81 if ( it.current() == b ) return it.currentKey();
82}
83
84void AppIcons::clicked(const QPoint& relpos, int button, bool dbl)
85{
86#ifndef QT_NO_COP
87 QLabel* s = (QLabel*)sender();
88 if ( button == RightButton ) {
89 QCopEnvelope("Qt/Tray","popup(int,QPoint)")
90 << findId(s) << s->mapToGlobal(QPoint(0,0));
91 } else {
92 QCopEnvelope("Qt/Tray",
93 dbl ? "doubleClicked(int,QPoint)" : "clicked(int,QPoint)")
94 << findId(s) << relpos;
95 }
96#endif
97}
98
99void AppIcons::setToolTip(int id, const QString& tip)
100{
101 QToolTip::add(button(id),tip);
102}
103
104void AppIcons::remove(int id)
105{
106 buttons.remove(id);
107}
108
109void AppIcons::receive( const QCString &msg, const QByteArray &data )
110{
111 QDataStream stream( data, IO_ReadOnly );
112 if ( msg == "remove(int)" ) {
113 int id;
114 stream >> id;
115 remove(id);
116 } else if ( msg == "setIcon(int,QPixmap)" ) {
117 int id;
118 QPixmap pm;
119 stream >> id >> pm;
120 setIcon(id,pm);
121 } else if ( msg == "setToolTip(int,QString)" ) {
122 int id;
123 QString s;
124 stream >> id >> s;
125 setToolTip(id,s);
126 }
127}
128
129#include "appicons.moc"
diff --git a/core/launcher/appicons.h b/core/launcher/appicons.h
new file mode 100644
index 0000000..f53f4a7
--- a/dev/null
+++ b/core/launcher/appicons.h
@@ -0,0 +1,51 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#ifndef APPICONS_H
22#define APPICONS_H
23
24
25#include <qhbox.h>
26#include <qintdict.h>
27#include <qlabel.h>
28
29
30class AppIcons : public QHBox
31{
32 Q_OBJECT
33
34public:
35 AppIcons( QWidget *parent );
36 void setIcon(int id, const QPixmap&);
37 void setToolTip(int id, const QString&);
38 void remove(int id);
39
40private slots:
41 void receive( const QCString &msg, const QByteArray &data );
42 void clicked(const QPoint& relpos, int button, bool dbl);
43
44private:
45 QIntDict<QLabel> buttons;
46 QLabel* button(int id);
47 int findId(QLabel*);
48};
49
50
51#endif
diff --git a/core/launcher/apps.h b/core/launcher/apps.h
new file mode 100644
index 0000000..6216941
--- a/dev/null
+++ b/core/launcher/apps.h
@@ -0,0 +1,83 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21
22// To add a new app, include appropriate files and add another APP().
23
24#ifndef APP_INCLUDES
25#define APP_INCLUDES
26
27#include "../addressbook/addressbook.h"
28#include "../datebook/datebook.h"
29#include "../helpbrowser/helpbrowser.h"
30#include "../minesweep/minesweep.h"
31#include "../textedit/textedit.h"
32#include "../todo/mainwindow.h"
33#include "../citytime/citytime.h"
34#include "../clock/clock.h"
35#include "../calculator/calculatorimpl.h"
36#include "../sysinfo/sysinfo.h"
37#include "../settings/appearance/settings.h"
38//#include "../settings/language/settings.h"
39//#include "../settings/light-and-power/settings.h"
40//#include "../settings/rotation/settings.h"
41#include "../settings/systemtime/settime.h"
42#if !defined(QT_QPE_SMALL_BUILD)
43#include "../filebrowser/filebrowser.h"
44#include "../solitaire/canvascardwindow.h"
45#include "../snake/interface.h"
46#include "../parashoot/interface.h"
47#include "../mpegplayer/mediaplayer.h"
48#endif
49#if !defined(QT_DEMO_SINGLE_FLOPPY) && !defined(QT_QPE_SMALL_BUILD)
50#include "../embeddedkonsole/konsole.h"
51#include "../wordgame/wordgame.h"
52#endif
53
54#endif
55
56// app-id class maximize? documentary?
57
58 APP( "addressbook", AddressbookWindow, 1, 0 )
59 APP( "datebook", DateBook, 1, 0 )
60 APP( "helpbrowser", HelpBrowser, 1, 1 )
61 APP( "textedit", TextEdit, 1, 1 )
62 APP( "todo", TodoWindow, 1, 0 )
63 APP( "calculator", CalculatorImpl, 1, 0 )
64 APP( "citytime", CityTime, 1, 0 )
65 APP( "clock", Clock, 1, 0 )
66 APP( "minesweep", MineSweep, 1, 0 )
67 APP( "sysinfo", SystemInfo, 1, 0 )
68 APP( "appearance", AppearanceSettings, 1, 0 )
69 APP( "systemtime", SetDateTime, 1, 0 )
70#if !defined(QT_QPE_SMALL_BUILD)
71 //APP( "light-and-power", LightSettings, 1, 0 )
72 //APP( "sound", SoundSettings, 1, 0 )
73 APP( "filebrowser", FileBrowser, 1, 0 )
74 APP( "solitaire", CanvasCardWindow, 1, 0 )
75 APP( "snake", SnakeGame, 1, 0 )
76 APP( "parashoot", ParaShoot, 1, 0 )
77 APP( "mpegplayer", MediaPlayer, 1, 0 )
78#endif
79#if !defined(QT_DEMO_SINGLE_FLOPPY) && !defined(QT_QPE_SMALL_BUILD)
80 APP( "embeddedkonsole", Konsole, 1, 0 )
81 APP( "wordgame", WordGame, 1, 0 )
82#endif
83
diff --git a/core/launcher/background.cpp b/core/launcher/background.cpp
new file mode 100644
index 0000000..04ebc37
--- a/dev/null
+++ b/core/launcher/background.cpp
@@ -0,0 +1,41 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include "background.h"
22#include "desktop.h"
23
24#include <qpe/resource.h>
25
26#include <qpainter.h>
27
28
29Background::Background( Desktop *d ) :
30 QWidget( d, 0, WStyle_Tool | WStyle_Customize )
31{
32/*
33 if ( QPixmap::defaultDepth() < 12 ) {
34 setBackgroundColor(QColor(0x20, 0xb0, 0x50));
35 } else {
36 setBackgroundPixmap( Resource::loadPixmap( "bg" ) );
37 }
38*/
39 setBackgroundMode( PaletteButton );
40}
41
diff --git a/core/launcher/background.h b/core/launcher/background.h
new file mode 100644
index 0000000..0885747
--- a/dev/null
+++ b/core/launcher/background.h
@@ -0,0 +1,40 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#ifndef __BACKGROUND_H__
22#define __BACKGROUND_H__
23
24
25#include <qwidget.h>
26
27
28class Desktop;
29
30
31class Background : public QWidget {
32 Q_OBJECT
33public:
34 Background( Desktop *d );
35};
36
37
38#endif // __BACKGROUND_H__
39
40
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp
new file mode 100644
index 0000000..d39af25
--- a/dev/null
+++ b/core/launcher/desktop.cpp
@@ -0,0 +1,655 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include "desktop.h"
22#include "info.h"
23#include "launcher.h"
24#include "mrulist.h"
25#include "qcopbridge.h"
26#include "shutdownimpl.h"
27#include "startmenu.h"
28#include "taskbar.h"
29#include "transferserver.h"
30#include "irserver.h"
31#include "packageslave.h"
32
33#include <qpe/applnk.h>
34#include <qpe/mimetype.h>
35#include <qpe/password.h>
36#include <qpe/config.h>
37#include <qpe/power.h>
38#include <qpe/qcopenvelope_qws.h>
39#include <qpe/global.h>
40#ifdef QT_QWS_CUSTOM
41#include "qpe/custom.h"
42#endif
43
44#include <qgfx_qws.h>
45#include <qmainwindow.h>
46#include <qmessagebox.h>
47#include <qtimer.h>
48#include <qwindowsystem_qws.h>
49
50#include <stdlib.h>
51#include <unistd.h>
52
53static Desktop* qpedesktop = 0;
54static int loggedin=0;
55static void login(bool at_poweron)
56{
57 if ( !loggedin ) {
58 Global::terminateBuiltin("calibrate");
59 Password::authenticate(at_poweron);
60 loggedin=1;
61 QCopEnvelope e( "QPE/Desktop", "unlocked()" );
62 }
63}
64
65bool Desktop::screenLocked()
66{
67 return loggedin == 0;
68}
69
70/*
71 Priority is number of alerts that are needed to pop up
72 alert.
73 */
74class DesktopPowerAlerter : public QMessageBox
75{
76public:
77 DesktopPowerAlerter( QWidget *parent, const char *name = 0 )
78 : QMessageBox( tr("Battery Status"), "Low Battery",
79 QMessageBox::Critical,
80 QMessageBox::Ok | QMessageBox::Default,
81 QMessageBox::NoButton, QMessageBox::NoButton,
82 parent, name, FALSE )
83 {
84 currentPriority = INT_MAX;
85 alertCount = 0;
86 }
87
88 void alert( const QString &text, int priority );
89 void hideEvent( QHideEvent * );
90private:
91 int currentPriority;
92 int alertCount;
93};
94
95void DesktopPowerAlerter::alert( const QString &text, int priority )
96{
97 alertCount++;
98 if ( alertCount < priority )
99 return;
100 if ( priority > currentPriority )
101 return;
102 currentPriority = priority;
103 setText( text );
104 show();
105}
106
107
108void DesktopPowerAlerter::hideEvent( QHideEvent *e )
109{
110 QMessageBox::hideEvent( e );
111 alertCount = 0;
112 currentPriority = INT_MAX;
113}
114
115
116
117DesktopApplication::DesktopApplication( int& argc, char **argv, Type t )
118 : QPEApplication( argc, argv, t )
119{
120
121 QTimer *t = new QTimer( this );
122 connect( t, SIGNAL(timeout()), this, SLOT(psTimeout()) );
123 t->start( 10000 );
124 ps = new PowerStatus;
125 pa = new DesktopPowerAlerter( 0 );
126}
127
128
129DesktopApplication::~DesktopApplication()
130{
131 delete ps;
132 delete pa;
133}
134
135
136enum MemState { Unknown, VeryLow, Low, Normal } memstate=Unknown;
137
138#ifdef Q_WS_QWS
139bool DesktopApplication::qwsEventFilter( QWSEvent *e )
140{
141 qpedesktop->checkMemory();
142
143 if ( e->type == QWSEvent::Key ) {
144 QWSKeyEvent *ke = (QWSKeyEvent *)e;
145 if ( !loggedin && ke->simpleData.keycode != Key_F34 )
146 return TRUE;
147 bool press = ke->simpleData.is_press;
148 if ( !keyboardGrabbed() ) {
149 if ( ke->simpleData.keycode == Key_F9 ) {
150 if ( press ) emit datebook();
151 return TRUE;
152 }
153 if ( ke->simpleData.keycode == Key_F10 ) {
154 if ( !press && cardSendTimer ) {
155 emit contacts();
156 delete cardSendTimer;
157 } else if ( press ) {
158 cardSendTimer = new QTimer();
159 cardSendTimer->start( 2000, TRUE );
160 connect( cardSendTimer, SIGNAL( timeout() ), this, SLOT( sendCard() ) );
161 }
162 return TRUE;
163 }
164 /* menu key now opens application menu/toolbar
165 if ( ke->simpleData.keycode == Key_F11 ) {
166 if ( press ) emit menu();
167 return TRUE;
168 }
169 */
170 if ( ke->simpleData.keycode == Key_F12 ) {
171 while( activePopupWidget() )
172 activePopupWidget()->close();
173 if ( press ) emit launch();
174 return TRUE;
175 }
176 if ( ke->simpleData.keycode == Key_F13 ) {
177 if ( press ) emit email();
178 return TRUE;
179 }
180 }
181 if ( ke->simpleData.keycode == Key_F34 ) {
182 if ( press ) emit power();
183 return TRUE;
184 }
185 if ( ke->simpleData.keycode == Key_F35 ) {
186 if ( press ) emit backlight();
187 return TRUE;
188 }
189 if ( ke->simpleData.keycode == Key_F32 ) {
190 if ( press ) QCopEnvelope e( "QPE/Desktop", "startSync()" );
191 return TRUE;
192 }
193 if ( ke->simpleData.keycode == Key_F31 && !ke->simpleData.modifiers ) {
194 if ( press ) emit symbol();
195 return TRUE;
196 }
197 if ( ke->simpleData.keycode == Key_NumLock ) {
198 if ( press ) emit numLockStateToggle();
199 }
200 if ( ke->simpleData.keycode == Key_CapsLock ) {
201 if ( press ) emit capsLockStateToggle();
202 }
203 if ( press )
204 qpedesktop->keyClick();
205 } else {
206 if ( e->type == QWSEvent::Mouse ) {
207 QWSMouseEvent *me = (QWSMouseEvent *)e;
208 static bool up = TRUE;
209 if ( me->simpleData.state&LeftButton ) {
210 if ( up ) {
211 up = FALSE;
212 qpedesktop->screenClick();
213 }
214 } else {
215 up = TRUE;
216 }
217 }
218 }
219
220 return QPEApplication::qwsEventFilter( e );
221}
222#endif
223
224void DesktopApplication::psTimeout()
225{
226 qpedesktop->checkMemory(); // in case no events are being generated
227
228 *ps = PowerStatusManager::readStatus();
229
230 if ( (ps->batteryStatus() == PowerStatus::VeryLow ) ) {
231 pa->alert( tr( "Battery is running very low." ), 6 );
232 }
233
234 if ( ps->batteryStatus() == PowerStatus::Critical ) {
235 pa->alert( tr( "Battery level is critical!\n"
236 "Keep power off until power restored!" ), 1 );
237 }
238
239 if ( ps->backupBatteryStatus() == PowerStatus::VeryLow ) {
240 pa->alert( tr( "The Back-up battery is very low.\nPlease charge the back-up battery." ), 3 );
241 }
242}
243
244
245void DesktopApplication::sendCard()
246{
247 delete cardSendTimer;
248 cardSendTimer = 0;
249 QString card = getenv("HOME");
250 card += "/Applications/addressbook/businesscard.vcf";
251
252 if ( QFile::exists( card ) ) {
253 QCopEnvelope e("QPE/Obex", "send(QString,QString,QString)");
254 QString mimetype = "text/x-vCard";
255 e << tr("business card") << card << mimetype;
256 }
257}
258
259#if defined(QPE_HAVE_MEMALERTER)
260QPE_MEMALERTER_IMPL
261#endif
262
263#if defined(CUSTOM_SOUND_IMPL)
264CUSTOM_SOUND_IMPL
265#endif
266
267//===========================================================================
268
269Desktop::Desktop() :
270 QWidget( 0, 0, WStyle_Tool | WStyle_Customize ),
271 qcopBridge( 0 ),
272 transferServer( 0 ),
273 packageSlave( 0 )
274{
275#ifdef CUSTOM_SOUND_INIT
276 CUSTOM_SOUND_INIT;
277#endif
278
279 qpedesktop = this;
280
281// bg = new Info( this );
282 tb = new TaskBar;
283
284 launcher = new Launcher( 0, 0, WStyle_Customize | QWidget::WGroupLeader );
285
286 connect(launcher, SIGNAL(busy()), tb, SLOT(startWait()));
287 connect(launcher, SIGNAL(notBusy(const QString&)), tb, SLOT(stopWait(const QString&)));
288
289 int displayw = qApp->desktop()->width();
290 int displayh = qApp->desktop()->height();
291
292
293 QSize sz = tb->sizeHint();
294
295 setGeometry( 0, displayh-sz.height(), displayw, sz.height() );
296 tb->setGeometry( 0, displayh-sz.height(), displayw, sz.height() );
297
298 tb->show();
299 launcher->showMaximized();
300 launcher->show();
301 launcher->raise();
302#if defined(QPE_HAVE_MEMALERTER)
303 initMemalerter();
304#endif
305 // start services
306 startTransferServer();
307 (void) new IrServer( this );
308 rereadVolumes();
309
310 packageSlave = new PackageSlave( this );
311 connect(qApp, SIGNAL(volumeChanged(bool)), this, SLOT(rereadVolumes()));
312
313 qApp->installEventFilter( this );
314}
315
316void Desktop::show()
317{
318 login(TRUE);
319 QWidget::show();
320}
321
322Desktop::~Desktop()
323{
324 delete launcher;
325 delete tb;
326 delete qcopBridge;
327 delete transferServer;
328}
329
330bool Desktop::recoverMemory()
331{
332 return tb->recoverMemory();
333}
334
335void Desktop::checkMemory()
336{
337#if defined(QPE_HAVE_MEMALERTER)
338 static bool ignoreNormal=FALSE;
339 static bool existingMessage=FALSE;
340
341 if(existingMessage)
342 return; // don't show a second message while still on first
343
344 existingMessage = TRUE;
345 switch ( memstate ) {
346 case Unknown:
347 break;
348 case Low:
349 memstate = Unknown;
350 if ( recoverMemory() )
351 ignoreNormal = TRUE;
352 else
353 QMessageBox::warning( 0 , "Memory Status",
354 "The memory smacks of shortage. \n"
355 "Please save data. " );
356 break;
357 case Normal:
358 memstate = Unknown;
359 if ( ignoreNormal )
360 ignoreNormal = FALSE;
361 else
362 QMessageBox::information ( 0 , "Memory Status",
363 "There is enough memory again." );
364 break;
365 case VeryLow:
366 memstate = Unknown;
367 QMessageBox::critical( 0 , "Memory Status",
368 "The memory is very low. \n"
369 "Please end this application \n"
370 "immediately." );
371 recoverMemory();
372 }
373 existingMessage = FALSE;
374#endif
375}
376
377static bool isVisibleWindow(int wid)
378{
379 const QList<QWSWindow> &list = qwsServer->clientWindows();
380 QWSWindow* w;
381 for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) {
382 if ( w->winId() == wid )
383 return !w->isFullyObscured();
384 }
385 return FALSE;
386}
387
388static bool hasVisibleWindow(const QString& clientname)
389{
390 const QList<QWSWindow> &list = qwsServer->clientWindows();
391 QWSWindow* w;
392 for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) {
393 if ( w->client()->identity() == clientname && !w->isFullyObscured() )
394 return TRUE;
395 }
396 return FALSE;
397}
398
399void Desktop::raiseLauncher()
400{
401 if ( isVisibleWindow(launcher->winId()) )
402 launcher->nextView();
403 else
404 launcher->raise();
405}
406
407void Desktop::executeOrModify(const QString& appLnkFile)
408{
409 AppLnk lnk(MimeType::appsFolderName() + "/" + appLnkFile);
410 if ( lnk.isValid() ) {
411 QCString app = lnk.exec().utf8();
412 Global::terminateBuiltin("calibrate");
413 if ( QCopChannel::isRegistered("QPE/Application/" + app) ) {
414 MRUList::addTask(&lnk);
415 if ( hasVisibleWindow(app) )
416 QCopChannel::send("QPE/Application/" + app, "nextView()");
417 else
418 QCopChannel::send("QPE/Application/" + app, "raise()");
419 } else {
420 lnk.execute();
421 }
422 }
423}
424
425void Desktop::raiseDatebook()
426{
427 executeOrModify("Applications/datebook.desktop");
428}
429
430void Desktop::raiseContacts()
431{
432 executeOrModify("Applications/addressbook.desktop");
433}
434
435void Desktop::raiseMenu()
436{
437 Global::terminateBuiltin("calibrate");
438 tb->startMenu()->launch();
439}
440
441void Desktop::raiseEmail()
442{
443 executeOrModify("Applications/qtmail.desktop");
444}
445
446#if defined(QPE_HAVE_TOGGLELIGHT)
447#include <qpe/config.h>
448
449#include <sys/ioctl.h>
450#include <sys/types.h>
451#include <fcntl.h>
452#include <unistd.h>
453#include <errno.h>
454#include <linux/ioctl.h>
455#include <time.h>
456#endif
457
458static bool blanked=FALSE;
459
460static void blankScreen()
461{
462 if ( !qt_screen ) return;
463 /* Should use a big black window instead.
464 QGfx* g = qt_screen->screenGfx();
465 g->fillRect(0,0,qt_screen->width(),qt_screen->height());
466 delete g;
467 */
468 blanked = TRUE;
469}
470
471static void darkScreen()
472{
473 extern void qpe_setBacklight(int);
474 qpe_setBacklight(0); // force off
475}
476
477
478void Desktop::togglePower()
479{
480 bool wasloggedin = loggedin;
481 loggedin=0;
482 darkScreen();
483 if ( wasloggedin )
484 blankScreen();
485 system("apm --suspend");
486 QWSServer::screenSaverActivate( FALSE );
487 {
488 QCopEnvelope("QPE/Card", "mtabChanged()" ); // might have changed while asleep
489 QCopEnvelope e("QPE/System", "setBacklight(int)");
490 e << -3; // Force on
491 }
492 if ( wasloggedin )
493 login(TRUE);
494 //qcopBridge->closeOpenConnections();
495 //qDebug("called togglePower()!!!!!!");
496}
497
498void Desktop::toggleLight()
499{
500 QCopEnvelope e("QPE/System", "setBacklight(int)");
501 e << -2; // toggle
502}
503
504void Desktop::toggleSymbolInput()
505{
506 tb->toggleSymbolInput();
507}
508
509void Desktop::toggleNumLockState()
510{
511 tb->toggleNumLockState();
512}
513
514void Desktop::toggleCapsLockState()
515{
516 tb->toggleCapsLockState();
517}
518
519void Desktop::styleChange( QStyle &s )
520{
521 QWidget::styleChange( s );
522 int displayw = qApp->desktop()->width();
523 int displayh = qApp->desktop()->height();
524
525 QSize sz = tb->sizeHint();
526
527 tb->setGeometry( 0, displayh-sz.height(), displayw, sz.height() );
528}
529
530void DesktopApplication::shutdown()
531{
532 if ( type() != GuiServer )
533 return;
534 ShutdownImpl *sd = new ShutdownImpl( 0, 0, WDestructiveClose );
535 connect( sd, SIGNAL(shutdown(ShutdownImpl::Type)),
536 this, SLOT(shutdown(ShutdownImpl::Type)) );
537 sd->showMaximized();
538}
539
540void DesktopApplication::shutdown( ShutdownImpl::Type t )
541{
542 switch ( t ) {
543 case ShutdownImpl::ShutdownSystem:
544 execlp("shutdown", "shutdown", "-h", "now", (void*)0);
545 break;
546 case ShutdownImpl::RebootSystem:
547 execlp("shutdown", "shutdown", "-r", "now", (void*)0);
548 break;
549 case ShutdownImpl::RestartDesktop:
550 restart();
551 break;
552 case ShutdownImpl::TerminateDesktop:
553 prepareForTermination(FALSE);
554 quit();
555 break;
556 }
557}
558
559void DesktopApplication::restart()
560{
561 prepareForTermination(TRUE);
562
563#ifdef Q_WS_QWS
564 for ( int fd = 3; fd < 100; fd++ )
565 close( fd );
566#if defined(QT_DEMO_SINGLE_FLOPPY)
567 execl( "/sbin/init", "qpe", 0 );
568#elif defined(QT_QWS_CASSIOPEIA)
569 execl( "/bin/sh", "sh", 0 );
570#else
571 execl( (qpeDir()+"/bin/qpe").latin1(), "qpe", 0 );
572#endif
573 exit(1);
574#endif
575}
576
577void Desktop::startTransferServer()
578{
579 // start qcop bridge server
580 qcopBridge = new QCopBridge( 4243 );
581 if ( !qcopBridge->ok() ) {
582 delete qcopBridge;
583 qcopBridge = 0;
584 }
585 // start transfer server
586 transferServer = new TransferServer( 4242 );
587 if ( !transferServer->ok() ) {
588 delete transferServer;
589 transferServer = 0;
590 }
591 if ( !transferServer || !qcopBridge )
592 startTimer( 2000 );
593}
594
595void Desktop::timerEvent( QTimerEvent *e )
596{
597 killTimer( e->timerId() );
598 startTransferServer();
599}
600
601void Desktop::terminateServers()
602{
603 delete transferServer;
604 delete qcopBridge;
605 transferServer = 0;
606 qcopBridge = 0;
607}
608
609void Desktop::rereadVolumes()
610{
611 Config cfg("Sound");
612 cfg.setGroup("System");
613 touchclick = cfg.readBoolEntry("Touch");
614 keyclick = cfg.readBoolEntry("Key");
615}
616
617void Desktop::keyClick()
618{
619#ifdef CUSTOM_SOUND_KEYCLICK
620 if ( keyclick )
621 CUSTOM_SOUND_KEYCLICK;
622#endif
623}
624
625void Desktop::screenClick()
626{
627#ifdef CUSTOM_SOUND_TOUCH
628 if ( touchclick )
629 CUSTOM_SOUND_TOUCH;
630#endif
631}
632
633void Desktop::soundAlarm()
634{
635#ifdef CUSTOM_SOUND_ALARM
636 CUSTOM_SOUND_ALARM;
637#endif
638}
639
640bool Desktop::eventFilter( QObject *w, QEvent *ev )
641{
642 if ( ev->type() == QEvent::KeyPress ) {
643 QKeyEvent *ke = (QKeyEvent *)ev;
644 if ( ke->key() == Qt::Key_F11 ) { // menu key
645 QWidget *active = qApp->activeWindow();
646 if ( active && active->isPopup() ) {
647 active->close();
648 }
649 raiseMenu();
650 return TRUE;
651 }
652 }
653 return FALSE;
654}
655
diff --git a/core/launcher/desktop.h b/core/launcher/desktop.h
new file mode 100644
index 0000000..dfdbeab
--- a/dev/null
+++ b/core/launcher/desktop.h
@@ -0,0 +1,129 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#ifndef __DESKTOP_H__
22#define __DESKTOP_H__
23
24
25#include "shutdownimpl.h"
26
27#include <qpe/qpeapplication.h>
28
29#include <qwidget.h>
30
31class Background;
32class Launcher;
33class TaskBar;
34class PowerStatus;
35class QCopBridge;
36class TransferServer;
37class DesktopPowerAlerter;
38class PackageSlave;
39
40class DesktopApplication : public QPEApplication
41{
42 Q_OBJECT
43public:
44 DesktopApplication( int& argc, char **argv, Type t );
45 ~DesktopApplication();
46signals:
47 void home();
48 void datebook();
49 void contacts();
50 void launch();
51 void email();
52 void backlight();
53 void power();
54 void symbol();
55 void numLockStateToggle();
56 void capsLockStateToggle();
57 void prepareForRestart();
58
59protected:
60#ifdef Q_WS_QWS
61 bool qwsEventFilter( QWSEvent * );
62#endif
63 void shutdown();
64 void restart();
65
66protected slots:
67 void shutdown(ShutdownImpl::Type);
68 void psTimeout();
69 void sendCard();
70private:
71 DesktopPowerAlerter *pa;
72 PowerStatus *ps;
73 QTimer *cardSendTimer;
74};
75
76
77class Desktop : public QWidget {
78 Q_OBJECT
79public:
80 Desktop();
81 ~Desktop();
82
83 static bool screenLocked();
84
85 void show();
86 void checkMemory();
87
88 void keyClick();
89 void screenClick();
90 static void soundAlarm();
91
92public slots:
93 void raiseDatebook();
94 void raiseContacts();
95 void raiseMenu();
96 void raiseLauncher();
97 void raiseEmail();
98 void togglePower();
99 void toggleLight();
100 void toggleNumLockState();
101 void toggleCapsLockState();
102 void toggleSymbolInput();
103 void terminateServers();
104 void rereadVolumes();
105
106protected:
107 void executeOrModify(const QString& appLnkFile);
108 void styleChange( QStyle & );
109 void timerEvent( QTimerEvent *e );
110 bool eventFilter( QObject *, QEvent * );
111
112 QWidget *bg;
113 Launcher *launcher;
114 TaskBar *tb;
115
116private:
117 void startTransferServer();
118 bool recoverMemory();
119
120 QCopBridge *qcopBridge;
121 TransferServer *transferServer;
122 PackageSlave *packageSlave;
123
124 bool keyclick,touchclick;
125};
126
127
128#endif // __DESKTOP_H__
129
diff --git a/core/launcher/info.cpp b/core/launcher/info.cpp
new file mode 100644
index 0000000..609e9e2
--- a/dev/null
+++ b/core/launcher/info.cpp
@@ -0,0 +1,116 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include "info.h"
22#include "desktop.h"
23
24#include <qpe/resource.h>
25#include <qpe/version.h>
26
27#include <qlayout.h>
28#include <qimage.h>
29#include <qpainter.h>
30#include <qsimplerichtext.h>
31
32
33Info *desktopInfo = NULL;
34
35
36Info::Info( Desktop *d ) : Background( d ), needsClear(FALSE), menuHasBeenClicked(FALSE)
37{
38 QString motd;
39 /* eg.
40 =
41 "<table width=100% cellspacing=0 cellpadding=2>"
42 "<tr><td bgcolor=#9090ff><h2>Today&nbsp;&nbsp;&nbsp;&nbsp;<small>June 15, 2001</small></h2></td>"
43 "<tr><td bgcolor=#c0c0ff><big><a href=datebook>Appointments</a></big>"
44 "<tr><td bgcolor=#e0e0ff>"
45 "<b>8:30am</b> Meeting with John<br>"
46 "<b>1:10pm</b> Lunch with Sharon"
47 "<tr><td bgcolor=#c0c0ff><big><a href=todo>Reminders</a></big>"
48 "<tr><td bgcolor=#e0e0ff>"
49 "<b>#1</b> Port XMAME to QPE<br>"
50 "<b>#2</b> Flowers for wife"
51 "<tr><td bgcolor=#c0c0ff><big><a href=channels>Net channels</a></big>"
52 "<tr><td bgcolor=#e0e0ff>"
53 "<b>LinuxDevices:</b><a href=http://www.linuxdevices.com> QPE announcement</a><br>"
54 "<b>Slashdot:</b><a href=http://www.slashdot.org> GPL Examined</a>"
55 "</table>";
56 */
57 info = new QSimpleRichText(motd, QFont("lucidux_sans",10));
58 desktopInfo = this;
59}
60
61
62void Info::mouseReleaseEvent( QMouseEvent * )
63{
64}
65
66
67void Info::menuClicked( )
68{
69 QPainter p(this);
70 if ( needsClear ) {
71 QColor col = colorGroup().color( QColorGroup::Button ).dark( 0 );
72 p.fillRect( 5, height() - 24, width() - 5, 20, col );
73 needsClear = FALSE;
74 menuHasBeenClicked = TRUE;
75 }
76}
77
78
79void Info::paintEvent( QPaintEvent *e )
80{
81 QPainter p(this);
82
83 BrushStyle styles[] = { Dense1Pattern, Dense2Pattern, Dense3Pattern,
84 Dense4Pattern, Dense5Pattern, Dense6Pattern };
85
86 QColor shade = colorGroup().color( QColorGroup::Button ).dark( 110 );
87 int blend = width() * 3 / 4;
88 int step = blend/6;
89 p.fillRect( 0, 0, width()-blend, 30, shade );
90 for ( int i = 0; i < 6; i++ ) {
91 QBrush brush( shade, styles[i] );
92 p.fillRect( width()-blend+i*step, 0, step, 30, brush );
93 }
94 p.setFont( QFont("Helvetica", 24, QFont::Bold) );
95 p.setPen( shade.dark( 140 ) );
96 p.drawText( 5, 24, "QPE" );
97 int pos = 5 + p.fontMetrics().width( "QPE" );
98 QFont f("Helvetica", 10, QFont::Bold);
99 p.setFont( f );
100 p.drawText( pos + 5, 24, QString( "Version " ) + QPE_VERSION );
101
102 if (!menuHasBeenClicked) {
103 p.drawText( 5, height()-10, QString( "Click on the " ) );
104 int pos = 5 + p.fontMetrics().width( "Click on the " );
105 p.drawPixmap( pos, height()-10-14, Resource::loadPixmap( "go" ) );
106 p.drawText( pos + 16, height()-10, QString( " logo to start." ) );
107 needsClear = TRUE;
108 }
109
110 if ( info ) {
111 info->setWidth(&p,width()-10);
112 info->draw(&p, 5, 35, e->region(), colorGroup());
113 }
114}
115
116
diff --git a/core/launcher/info.h b/core/launcher/info.h
new file mode 100644
index 0000000..317dec5
--- a/dev/null
+++ b/core/launcher/info.h
@@ -0,0 +1,55 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#ifndef __INFO_H__
22#define __INFO_H__
23
24
25#include <qwidget.h>
26#include <qpainter.h>
27#include "background.h"
28
29class QSimpleRichText;
30
31class Info : public Background {
32 Q_OBJECT
33public:
34 Info( Desktop *d );
35 void menuClicked( );
36
37signals:
38 void giveInfo( );
39
40protected:
41 void mouseReleaseEvent( QMouseEvent *e );
42 void paintEvent( QPaintEvent *pe );
43
44private:
45 QSimpleRichText* info;
46 bool needsClear;
47 bool menuHasBeenClicked;
48};
49
50
51extern Info *desktopInfo;
52
53
54#endif // __INFO_H__
55
diff --git a/core/launcher/inputmethods.cpp b/core/launcher/inputmethods.cpp
new file mode 100644
index 0000000..003dc77
--- a/dev/null
+++ b/core/launcher/inputmethods.cpp
@@ -0,0 +1,297 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include "inputmethods.h"
22
23#include <qpe/config.h>
24#include <qpe/qpeapplication.h>
25#include <qpe/inputmethodinterface.h>
26#include <qpe/qlibrary.h>
27
28#include <qpopupmenu.h>
29#include <qpushbutton.h>
30#include <qtoolbutton.h>
31#include <qwidget.h>
32#include <qlayout.h>
33#include <qtimer.h>
34#include <qdir.h>
35#include <stdlib.h>
36#include <qtranslator.h>
37
38#ifdef Q_WS_QWS
39#include <qwindowsystem_qws.h>
40#include <qwsevent_qws.h>
41#endif
42
43#ifdef SINGLE_APP
44#include "handwritingimpl.h"
45#include "keyboardimpl.h"
46#include "pickboardimpl.h"
47#endif
48
49
50/* XPM */
51static const char * tri_xpm[]={
52"9 9 2 1",
53"a c #000000",
54". c None",
55".........",
56".........",
57".........",
58"....a....",
59"...aaa...",
60"..aaaaa..",
61".aaaaaaa.",
62".........",
63"........."};
64
65static const int inputWidgetStyle = QWidget::WStyle_Customize |
66 QWidget::WStyle_Tool |
67 QWidget::WStyle_StaysOnTop |
68 QWidget::WGroupLeader;
69
70InputMethods::InputMethods( QWidget *parent ) :
71 QWidget( parent, "InputMethods", WStyle_Tool | WStyle_Customize )
72{
73 method = NULL;
74
75 QHBoxLayout *hbox = new QHBoxLayout( this );
76
77 kbdButton = new QToolButton( this );
78 kbdButton->setFocusPolicy(NoFocus);
79 kbdButton->setToggleButton( TRUE );
80 kbdButton->setFixedHeight( 17 );
81 kbdButton->setFixedWidth( 32 );
82 kbdButton->setAutoRaise( TRUE );
83 kbdButton->setUsesBigPixmap( TRUE );
84 hbox->addWidget( kbdButton );
85 connect( kbdButton, SIGNAL(toggled(bool)), this, SLOT(showKbd(bool)) );
86
87 kbdChoice = new QToolButton( this );
88 kbdChoice->setFocusPolicy(NoFocus);
89 kbdChoice->setPixmap( QPixmap( (const char **)tri_xpm ) );
90 kbdChoice->setFixedHeight( 17 );
91 kbdChoice->setFixedWidth( 12 );
92 kbdChoice->setAutoRaise( TRUE );
93 hbox->addWidget( kbdChoice );
94 connect( kbdChoice, SIGNAL(clicked()), this, SLOT(chooseKbd()) );
95
96 connect( (QPEApplication*)qApp, SIGNAL(clientMoused()),
97 this, SLOT(resetStates()) );
98
99 loadInputMethods();
100}
101
102InputMethods::~InputMethods()
103{
104#ifndef SINGLE_APP
105 QValueList<InputMethod>::Iterator mit;
106 for ( mit = inputMethodList.begin(); mit != inputMethodList.end(); ++mit ) {
107 int i = (*mit).interface->release();
108 (*mit).library->unload();
109 delete (*mit).library;
110 }
111#endif
112}
113
114void InputMethods::hideInputMethod()
115{
116 kbdButton->setOn( FALSE );
117}
118
119void InputMethods::showInputMethod()
120{
121 kbdButton->setOn( TRUE );
122}
123
124void InputMethods::showInputMethod(const QString& name)
125{
126 int i = 0;
127 QValueList<InputMethod>::Iterator it;
128 InputMethod *im = 0;
129 for ( it = inputMethodList.begin(); it != inputMethodList.end(); ++it, i++ ) {
130 if ( (*it).interface->name() == name ) {
131 im = &(*it);
132 break;
133 }
134 }
135 if ( im )
136 chooseMethod(im);
137}
138
139void InputMethods::resetStates()
140{
141 if ( method )
142 method->interface->resetState();
143}
144
145QRect InputMethods::inputRect() const
146{
147 if ( !method || !method->widget->isVisible() )
148 return QRect();
149 else
150 return method->widget->geometry();
151}
152
153void InputMethods::loadInputMethods()
154{
155#ifndef SINGLE_APP
156 hideInputMethod();
157 method = 0;
158
159 QValueList<InputMethod>::Iterator mit;
160 for ( mit = inputMethodList.begin(); mit != inputMethodList.end(); ++mit ) {
161 (*mit).interface->release();
162 (*mit).library->unload();
163 delete (*mit).library;
164 }
165 inputMethodList.clear();
166
167 QString path = QPEApplication::qpeDir() + "/plugins/inputmethods";
168 QDir dir( path, "lib*.so" );
169 QStringList list = dir.entryList();
170 QStringList::Iterator it;
171 for ( it = list.begin(); it != list.end(); ++it ) {
172 InputMethodInterface *iface = 0;
173 QLibrary *lib = new QLibrary( path + "/" + *it );
174 if ( lib->queryInterface( IID_InputMethod, (QUnknownInterface**)&iface ) == QS_OK ) {
175 InputMethod input;
176 input.library = lib;
177 input.interface = iface;
178 input.widget = input.interface->inputMethod( 0, inputWidgetStyle );
179 input.interface->onKeyPress( this, SLOT(sendKey(ushort,ushort,ushort,bool,bool)) );
180 inputMethodList.append( input );
181 QString lang = getenv( "LANG" );
182 QTranslator * trans = new QTranslator(qApp);
183 QString type = (*it).left( (*it).find(".") );
184 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm";
185 qDebug("tr for inputmethod: %s", tfn.latin1() );
186 if ( trans->load( tfn ))
187 qApp->installTranslator( trans );
188 else
189 delete trans;
190 } else {
191 delete lib;
192 }
193 }
194#else
195 InputMethod input;
196 input.interface = new HandwritingImpl();
197 input.widget = input.interface->inputMethod( 0, inputWidgetStyle );
198 input.interface->onKeyPress( this, SLOT(sendKey(ushort,ushort,ushort,bool,bool)) );
199 inputMethodList.append( input );
200 input.interface = new KeyboardImpl();
201 input.widget = input.interface->inputMethod( 0, inputWidgetStyle );
202 input.interface->onKeyPress( this, SLOT(sendKey(ushort,ushort,ushort,bool,bool)) );
203 inputMethodList.append( input );
204 input.interface = new PickboardImpl();
205 input.widget = input.interface->inputMethod( 0, inputWidgetStyle );
206 input.interface->onKeyPress( this, SLOT(sendKey(ushort,ushort,ushort,bool,bool)) );
207 inputMethodList.append( input );
208#endif
209 if ( !inputMethodList.isEmpty() ) {
210 method = &inputMethodList[0];
211 kbdButton->setPixmap( *method->interface->icon() );
212 }
213 if ( !inputMethodList.isEmpty() )
214 kbdButton->show();
215 else
216 kbdButton->hide();
217 if ( inputMethodList.count() > 1 )
218 kbdChoice->show();
219 else
220 kbdChoice->hide();
221}
222
223void InputMethods::chooseKbd()
224{
225 QPopupMenu pop( this );
226
227 int i = 0;
228 QValueList<InputMethod>::Iterator it;
229 for ( it = inputMethodList.begin(); it != inputMethodList.end(); ++it, i++ ) {
230 pop.insertItem( (*it).interface->name(), i );
231 if ( method == &(*it) )
232 pop.setItemChecked( i, TRUE );
233 }
234
235 QPoint pt = mapToGlobal(kbdChoice->geometry().topRight());
236 QSize s = pop.sizeHint();
237 pt.ry() -= s.height();
238 pt.rx() -= s.width();
239 i = pop.exec( pt );
240 if ( i == -1 )
241 return;
242 InputMethod *im = &inputMethodList[i];
243 chooseMethod(im);
244}
245
246void InputMethods::chooseMethod(InputMethod* im)
247{
248 if ( im != method ) {
249 if ( method && method->widget->isVisible() )
250 method->widget->hide();
251 method = im;
252 kbdButton->setPixmap( *method->interface->icon() );
253 }
254 if ( !kbdButton->isOn() )
255 kbdButton->setOn( TRUE );
256 else
257 showKbd( TRUE );
258}
259
260
261void InputMethods::showKbd( bool on )
262{
263 if ( !method )
264 return;
265
266 if ( on ) {
267 method->interface->resetState();
268 // HACK... Make the texteditor fit with all input methods
269 // Input methods should also never use more than about 40% of the screen
270 int height = QMIN( method->widget->sizeHint().height(), 134 );
271 method->widget->resize( qApp->desktop()->width(), height );
272 method->widget->move( 0, mapToGlobal( QPoint() ).y() - height );
273 method->widget->show();
274 } else {
275 method->widget->hide();
276 }
277
278 emit inputToggled( on );
279}
280
281bool InputMethods::shown() const
282{
283 return method && method->widget->isVisible();
284}
285
286QString InputMethods::currentShown() const
287{
288 return method && method->widget->isVisible()
289 ? method->interface->name() : QString::null;
290}
291
292void InputMethods::sendKey( ushort unicode, ushort scancode, ushort mod, bool press, bool repeat )
293{
294#if defined(Q_WS_QWS)
295 QWSServer::sendKeyEvent( unicode, scancode, mod, press, repeat );
296#endif
297}
diff --git a/core/launcher/inputmethods.h b/core/launcher/inputmethods.h
new file mode 100644
index 0000000..286a818
--- a/dev/null
+++ b/core/launcher/inputmethods.h
@@ -0,0 +1,76 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#ifndef __INPUT_METHODS_H__
22#define __INPUT_METHODS_H__
23
24
25#include <qpe/inputmethodinterface.h>
26
27#include <qwidget.h>
28#include <qvaluelist.h>
29
30class QToolButton;
31class QLibrary;
32
33struct InputMethod
34{
35#ifndef QT_NO_COMPONENT
36 QLibrary *library;
37#endif
38 QWidget *widget;
39 InputMethodInterface *interface;
40};
41
42class InputMethods : public QWidget
43{
44 Q_OBJECT
45public:
46 InputMethods( QWidget * );
47 ~InputMethods();
48
49 QRect inputRect() const;
50 bool shown() const;
51 QString currentShown() const; // name of interface
52 void showInputMethod(const QString& id);
53 void showInputMethod();
54 void hideInputMethod();
55 void loadInputMethods();
56
57signals:
58 void inputToggled( bool on );
59
60private slots:
61 void chooseKbd();
62 void showKbd( bool );
63 void resetStates();
64 void sendKey( ushort unicode, ushort scancode, ushort modifiers, bool, bool );
65
66private:
67 void chooseMethod(InputMethod* im);
68 QToolButton *kbdButton;
69 QToolButton *kbdChoice;
70 InputMethod *method;
71 QValueList<InputMethod> inputMethodList;
72};
73
74
75#endif // __INPUT_METHODS_H__
76
diff --git a/core/launcher/irserver.cpp b/core/launcher/irserver.cpp
new file mode 100644
index 0000000..b22e064
--- a/dev/null
+++ b/core/launcher/irserver.cpp
@@ -0,0 +1,50 @@
1#include "irserver.h"
2
3#include <qpe/qlibrary.h>
4#include <qpe/qpeapplication.h>
5
6#include <qtranslator.h>
7#include <stdlib.h>
8
9#include "obexinterface.h"
10
11#include <qdir.h>
12
13IrServer::IrServer( QObject *parent, const char *name )
14 : QObject( parent, name )
15{
16 lib = 0;
17 QString path = QPEApplication::qpeDir() + "/plugins/obex/";
18 QDir dir( path, "lib*.so" );
19 QStringList list = dir.entryList();
20 QStringList::Iterator it;
21 for ( it = list.begin(); it != list.end(); ++it ) {
22 ObexInterface *iface = 0;
23 QLibrary *trylib = new QLibrary( path + *it );
24 qDebug("trying lib %s", (path + (*it)).latin1() );
25 if ( trylib->queryInterface( IID_ObexInterface, (QUnknownInterface**)&iface ) == QS_OK ) {
26 lib = trylib;
27 qDebug("found obex lib" );
28 QString lang = getenv( "LANG" );
29 QTranslator * trans = new QTranslator(qApp);
30 QString type = (*it).left( (*it).find(".") );
31 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm";
32 qDebug("tr fpr obex: %s", tfn.latin1() );
33 if ( trans->load( tfn ))
34 qApp->installTranslator( trans );
35 else
36 delete trans;
37
38 break;
39 } else {
40 delete lib;
41 }
42 }
43 if ( !lib )
44 qDebug("could not load IR plugin" );
45}
46
47IrServer::~IrServer()
48{
49 delete lib;
50}
diff --git a/core/launcher/irserver.h b/core/launcher/irserver.h
new file mode 100644
index 0000000..f9f682f
--- a/dev/null
+++ b/core/launcher/irserver.h
@@ -0,0 +1,20 @@
1#ifndef IRSERVER_H
2#define IRSERVER_H
3
4#include <qobject.h>
5
6class QCopChannel;
7class QLibrary;
8
9class IrServer : public QObject
10{
11 Q_OBJECT
12public:
13 IrServer( QObject *parent = 0, const char *name = 0 );
14 ~IrServer();
15
16private:
17 QLibrary *lib;
18};
19
20#endif
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
new file mode 100644
index 0000000..66a2ce5
--- a/dev/null
+++ b/core/launcher/launcher.cpp
@@ -0,0 +1,804 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include <qpe/qcopenvelope_qws.h>
22#include <qpe/resource.h>
23#include <qpe/applnk.h>
24#include <qpe/config.h>
25#include <qpe/global.h>
26#include <qpe/qpeapplication.h>
27#include <qpe/mimetype.h>
28#include <qpe/storage.h>
29#include <qpe/palmtoprecord.h>
30
31#include <qdir.h>
32#include <qwindowsystem_qws.h>
33#include <qtimer.h>
34#include <qcombobox.h>
35#include <qvbox.h>
36#include <qlayout.h>
37#include <qstyle.h>
38#include <qpushbutton.h>
39#include <qtabbar.h>
40#include <qwidgetstack.h>
41#include <qlayout.h>
42#include <qregexp.h>
43#include <qmessagebox.h>
44#include <qframe.h>
45#include <qpainter.h>
46#include <qlabel.h>
47#include <qtextstream.h>
48
49#include "launcherview.h"
50#include "launcher.h"
51#include "syncdialog.h"
52#include "desktop.h"
53#include <qpe/lnkproperties.h>
54#include "mrulist.h"
55#include "qrsync.h"
56#include <stdlib.h>
57#include <unistd.h>
58
59#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
60#include <stdio.h>
61#include <sys/vfs.h>
62#include <mntent.h>
63#endif
64
65//#define SHOW_ALL
66
67CategoryTabWidget::CategoryTabWidget( QWidget* parent ) :
68 QVBox( parent )
69{
70 categoryBar = 0;
71 stack = 0;
72}
73
74void CategoryTabWidget::prevTab()
75{
76 if ( categoryBar ) {
77 int n = categoryBar->count();
78 int tab = categoryBar->currentTab();
79 if ( tab >= 0 )
80 categoryBar->setCurrentTab( (tab - 1 + n)%n );
81 }
82}
83
84void CategoryTabWidget::nextTab()
85{
86 if ( categoryBar ) {
87 int n = categoryBar->count();
88 int tab = categoryBar->currentTab();
89 categoryBar->setCurrentTab( (tab + 1)%n );
90 }
91}
92
93void CategoryTabWidget::addItem( const QString& linkfile )
94{
95 int i=0;
96 AppLnk *app = new AppLnk(linkfile);
97 if ( !app->isValid() ) {
98 delete app;
99 return;
100 }
101 if ( !app->file().isEmpty() ) {
102 // A document
103 delete app;
104 app = new DocLnk(linkfile);
105 ((LauncherView*)(stack->widget(ids.count()-1)))->addItem(app);
106 return;
107 }
108 for ( QStringList::Iterator it=ids.begin(); it!=ids.end(); ++it) {
109 if ( !(*it).isEmpty() ) {
110 QRegExp tf(*it,FALSE,TRUE);
111 if ( tf.match(app->type()) >= 0 ) {
112 ((LauncherView*)stack->widget(i))->addItem(app);
113 return;
114 }
115 i++;
116 }
117 }
118}
119
120void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder,
121 AppLnkSet* docFolder, const QList<FileSystem> &fs)
122{
123 delete categoryBar;
124 categoryBar = new CategoryTabBar( this );
125 QPalette pal = categoryBar->palette();
126 pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) );
127 pal.setColor( QColorGroup::Background, pal.active().background().light(110) );
128 categoryBar->setPalette( pal );
129
130 delete stack;
131 stack = new QWidgetStack(this);
132 tabs=0;
133
134 ids.clear();
135
136 QStringList types = rootFolder->types();
137 for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) {
138 if ( !(*it).isEmpty() ) {
139 newView(*it,rootFolder->typePixmap(*it),rootFolder->typeName(*it));
140 }
141 }
142 QListIterator<AppLnk> it( rootFolder->children() );
143 AppLnk* l;
144 while ( (l=it.current()) ) {
145 if ( l->type() == "Separator" ) {
146 rootFolder->remove(l);
147 delete l;
148 } else {
149 int i=0;
150 for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) {
151 if ( *it == l->type() )
152 ((LauncherView*)stack->widget(i))->addItem(l,FALSE);
153 i++;
154 }
155 }
156 ++it;
157 }
158 rootFolder->detachChildren();
159 for (int i=0; i<tabs; i++)
160 ((LauncherView*)stack->widget(i))->sort();
161
162 // all documents
163 docview = newView( QString::null, Resource::loadPixmap("DocsIcon"), tr("Documents"));
164 docview->populate( docFolder, QString::null );
165 docFolder->detachChildren();
166 docview->setFileSystems(fs);
167 docview->setToolsEnabled(TRUE);
168
169 connect( categoryBar, SIGNAL(selected(int)), stack, SLOT(raiseWidget(int)) );
170
171 ((LauncherView*)stack->widget(0))->setFocus();
172
173 categoryBar->show();
174 stack->show();
175}
176
177void CategoryTabWidget::updateDocs(AppLnkSet* docFolder, const QList<FileSystem> &fs)
178{
179 docview->populate( docFolder, QString::null );
180 docFolder->detachChildren();
181 docview->setFileSystems(fs);
182 docview->updateTools();
183}
184
185LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label )
186{
187 LauncherView* view = new LauncherView( stack );
188 connect( view, SIGNAL(clicked(const AppLnk*)),
189 this, SIGNAL(clicked(const AppLnk*)));
190 connect( view, SIGNAL(rightPressed(AppLnk*)),
191 this, SIGNAL(rightPressed(AppLnk*)));
192 ids.append(id);
193 categoryBar->addTab( new QTab( pm, label ) );
194 stack->addWidget( view, tabs++ );
195 return view;
196}
197
198void CategoryTabWidget::updateLink(const QString& linkfile)
199{
200 int i=0;
201 LauncherView* view;
202 while ((view = (LauncherView*)stack->widget(i++))) {
203 if ( view->removeLink(linkfile) )
204 break;
205 }
206 addItem(linkfile);
207 docview->updateTools();
208}
209
210void CategoryTabWidget::paletteChange( const QPalette &p )
211{
212 QVBox::paletteChange( p );
213 QPalette pal = palette();
214 pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) );
215 pal.setColor( QColorGroup::Background, pal.active().background().light(110) );
216 categoryBar->setPalette( pal );
217 categoryBar->update();
218}
219
220void CategoryTabWidget::setBusy(bool on)
221{
222 if ( on )
223 ((LauncherView*)stack->visibleWidget())->setBusy(TRUE);
224 else
225 for (int i=0; i<tabs; i++)
226 ((LauncherView*)stack->widget(i))->setBusy(FALSE);
227}
228
229
230CategoryTabBar::CategoryTabBar( QWidget *parent, const char *name )
231 : QTabBar( parent, name )
232{
233 setFocusPolicy( NoFocus );
234 connect( this, SIGNAL( selected(int) ), this, SLOT( layoutTabs() ) );
235}
236
237CategoryTabBar::~CategoryTabBar()
238{
239}
240
241void CategoryTabBar::layoutTabs()
242{
243 if ( !count() )
244 return;
245
246// int percentFalloffTable[] = { 100, 70, 40, 12, 6, 3, 1, 0 };
247 int hiddenTabWidth = -12;
248 int middleTab = currentTab();
249 int hframe, vframe, overlap;
250 style().tabbarMetrics( this, hframe, vframe, overlap );
251 QFontMetrics fm = fontMetrics();
252 int x = 0;
253 QRect r;
254 QTab *t;
255 int available = width()-1;
256 int required = 0;
257 for ( int i = 0; i < count(); i++ ) {
258 t = tab(i);
259 // if (( i < (middleTab - 1) ) || ( i > (middleTab + 1) )) {
260 if ( i != middleTab ) {
261 // required += hiddenTabWidth + hframe - overlap;
262 available -= hiddenTabWidth + hframe - overlap;
263 if ( t->iconSet() != 0 )
264 available -= t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width();
265 } else {
266 required += fm.width( t->text() ) + hframe - overlap;
267 if ( t->iconSet() != 0 )
268 required += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width();
269 }
270 }
271 for ( int i = 0; i < count(); i++ ) {
272 t = tab(i);
273 // if (( i < (middleTab - 1) ) || ( i > (middleTab + 1) )) {
274 if ( i != middleTab ) {
275 int w = hiddenTabWidth;
276 int ih = 0;
277 if ( t->iconSet() != 0 ) {
278 w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width();
279 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height();
280 }
281 int h = QMAX( fm.height(), ih );
282 h = QMAX( h, QApplication::globalStrut().height() );
283
284 h += vframe;
285 w += hframe;
286
287 t->setRect( QRect(x, 0, w, h) );
288 x += t->rect().width() - overlap;
289 r = r.unite( t->rect() );
290 } else {
291 int w = fm.width( t->text() );
292 int ih = 0;
293 if ( t->iconSet() != 0 ) {
294 w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width();
295 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height();
296 }
297 int h = QMAX( fm.height(), ih );
298 h = QMAX( h, QApplication::globalStrut().height() );
299
300 h += vframe;
301 w += hframe;
302
303 // t->setRect( QRect(x, 0, w * available/required, h) );
304 t->setRect( QRect(x, 0, available, h) );
305 x += t->rect().width() - overlap;
306 r = r.unite( t->rect() );
307 }
308 }
309
310 QRect rr = tab(count()-1)->rect();
311 rr.setRight(width()-1);
312 tab(count()-1)->setRect( rr );
313
314 for ( t = tabList()->first(); t; t = tabList()->next() ) {
315 QRect tr = t->rect();
316 tr.setHeight( r.height() );
317 t->setRect( tr );
318 }
319
320 update();
321}
322
323
324void CategoryTabBar::paint( QPainter * p, QTab * t, bool selected ) const
325{
326#if QT_VERSION >= 300
327 QStyle::SFlags flags = QStyle::Style_Default;
328 if ( selected )
329 flags |= QStyle::Style_Selected;
330 style().drawControl( QStyle::CE_TabBarTab, p, this, t->rect(),
331 colorGroup(), flags, QStyleOption(t) );
332#else
333 style().drawTab( p, this, t, selected );
334#endif
335
336 QRect r( t->rect() );
337 QFont f( font() );
338 if ( selected )
339 f.setBold( TRUE );
340 p->setFont( f );
341
342 int iw = 0;
343 int ih = 0;
344 if ( t->iconSet() != 0 ) {
345 iw = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width() + 2;
346 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height();
347 }
348 int w = iw + p->fontMetrics().width( t->text() ) + 4;
349 int h = QMAX(p->fontMetrics().height() + 4, ih );
350 paintLabel( p, QRect( r.left() + (r.width()-w)/2 - 3,
351 r.top() + (r.height()-h)/2, w, h ), t,
352#if QT_VERSION >= 300
353 t->identifier() == keyboardFocusTab()
354#else
355 t->identitifer() == keyboardFocusTab()
356#endif
357 );
358}
359
360
361void CategoryTabBar::paintLabel( QPainter* p, const QRect&,
362 QTab* t, bool has_focus ) const
363{
364 QRect r = t->rect();
365 // if ( t->id != currentTab() )
366 //r.moveBy( 1, 1 );
367 //
368 if ( t->iconSet() ) {
369 // the tab has an iconset, draw it in the right mode
370 QIconSet::Mode mode = (t->isEnabled() && isEnabled()) ? QIconSet::Normal : QIconSet::Disabled;
371 if ( mode == QIconSet::Normal && has_focus )
372 mode = QIconSet::Active;
373 QPixmap pixmap = t->iconSet()->pixmap( QIconSet::Small, mode );
374 int pixw = pixmap.width();
375 int pixh = pixmap.height();
376 p->drawPixmap( r.left() + 6, r.center().y() - pixh / 2 + 1, pixmap );
377 r.setLeft( r.left() + pixw + 5 );
378 }
379
380 QRect tr = r;
381
382 if ( r.width() < 20 )
383 return;
384
385 if ( t->isEnabled() && isEnabled() ) {
386#if defined(_WS_WIN32_)
387 if ( colorGroup().brush( QColorGroup::Button ) == colorGroup().brush( QColorGroup::Background ) )
388 p->setPen( colorGroup().buttonText() );
389 else
390 p->setPen( colorGroup().foreground() );
391#else
392 p->setPen( colorGroup().foreground() );
393#endif
394 p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() );
395 } else {
396 p->setPen( palette().disabled().foreground() );
397 p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() );
398 }
399}
400
401//---------------------------------------------------------------------------
402
403Launcher::Launcher( QWidget* parent, const char* name, WFlags fl )
404 : QMainWindow( parent, name, fl )
405{
406 setCaption( tr("Launcher") );
407
408 syncDialog = 0;
409
410 // we have a pretty good idea how big we'll be
411 setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() );
412
413 tabs = 0;
414 rootFolder = 0;
415 docsFolder = 0;
416
417 tabs = new CategoryTabWidget( this );
418 tabs->setMaximumWidth( qApp->desktop()->width() );
419 setCentralWidget( tabs );
420
421 connect( tabs, SIGNAL(selected(const QString&)),
422 this, SLOT(viewSelected(const QString&)) );
423 connect( tabs, SIGNAL(clicked(const AppLnk*)),
424 this, SLOT(select(const AppLnk*)));
425 connect( tabs, SIGNAL(rightPressed(AppLnk*)),
426 this, SLOT(properties(AppLnk*)));
427
428#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
429 QCopChannel* sysChannel = new QCopChannel( "QPE/System", this );
430 connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)),
431 this, SLOT(systemMessage( const QCString &, const QByteArray &)) );
432#endif
433
434 storage = new StorageInfo( this );
435 connect( storage, SIGNAL( disksChanged() ), SLOT( storageChanged() ) );
436
437 updateTabs();
438
439 preloadApps();
440
441 in_lnk_props = FALSE;
442 got_lnk_change = FALSE;
443}
444
445Launcher::~Launcher()
446{
447}
448
449static bool isVisibleWindow(int wid)
450{
451 const QList<QWSWindow> &list = qwsServer->clientWindows();
452 QWSWindow* w;
453 for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) {
454 if ( w->winId() == wid )
455 return !w->isFullyObscured();
456 }
457 return FALSE;
458}
459
460void Launcher::showMaximized()
461{
462 if ( isVisibleWindow( winId() ) )
463 doMaximize();
464 else
465 QTimer::singleShot( 20, this, SLOT(doMaximize()) );
466}
467
468void Launcher::doMaximize()
469{
470 QMainWindow::showMaximized();
471}
472
473void Launcher::updateMimeTypes()
474{
475 MimeType::clear();
476 updateMimeTypes(rootFolder);
477}
478
479void Launcher::updateMimeTypes(AppLnkSet* folder)
480{
481 for ( QListIterator<AppLnk> it( folder->children() ); it.current(); ++it ) {
482 AppLnk *app = it.current();
483 if ( app->type() == "Folder" )
484 updateMimeTypes((AppLnkSet *)app);
485 else {
486 MimeType::registerApp(*app);
487 }
488 }
489}
490
491void Launcher::loadDocs()
492{
493 delete docsFolder;
494 docsFolder = new DocLnkSet;
495 Global::findDocuments(docsFolder);
496}
497
498void Launcher::updateTabs()
499{
500 MimeType::updateApplications(); // ### reads all applnks twice
501
502 delete rootFolder;
503 rootFolder = new AppLnkSet( MimeType::appsFolderName() );
504
505 loadDocs();
506
507 tabs->initializeCategories(rootFolder, docsFolder, storage->fileSystems());
508}
509
510void Launcher::updateDocs()
511{
512 loadDocs();
513 tabs->updateDocs(docsFolder,storage->fileSystems());
514}
515
516void Launcher::viewSelected(const QString& s)
517{
518 setCaption( s + tr(" - Launcher") );
519}
520
521void Launcher::nextView()
522{
523 tabs->nextTab();
524}
525
526
527void Launcher::select( const AppLnk *appLnk )
528{
529 if ( appLnk->type() == "Folder" ) {
530 // Not supported: flat is simpler for the user
531 } else {
532 if ( appLnk->exec().isNull() ) {
533 QMessageBox::information(this,tr("No application"),
534 tr("<p>No application is defined for this document."
535 "<p>Type is %1.").arg(appLnk->type()));
536 return;
537 }
538 tabs->setBusy(TRUE);
539 emit executing( appLnk );
540 appLnk->execute();
541 }
542}
543
544void Launcher::externalSelected(const AppLnk *appLnk)
545{
546 tabs->setBusy(TRUE);
547 emit executing( appLnk );
548}
549
550void Launcher::properties( AppLnk *appLnk )
551{
552 if ( appLnk->type() == "Folder" ) {
553 // Not supported: flat is simpler for the user
554 } else {
555 in_lnk_props = TRUE;
556 got_lnk_change = FALSE;
557 LnkProperties prop(appLnk);
558 connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *)));
559 prop.showMaximized();
560 prop.exec();
561 in_lnk_props = FALSE;
562 if ( got_lnk_change ) {
563 updateLink(lnk_change);
564 }
565 }
566}
567
568void Launcher::updateLink(const QString& link)
569{
570 if (link.isNull())
571 updateTabs();
572 else if (link.isEmpty())
573 updateDocs();
574 else
575 tabs->updateLink(link);
576}
577
578void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
579{
580 QDataStream stream( data, IO_ReadOnly );
581 if ( msg == "linkChanged(QString)" ) {
582 QString link;
583 stream >> link;
584 if ( in_lnk_props ) {
585 got_lnk_change = TRUE;
586 lnk_change = link;
587 } else {
588 updateLink(link);
589 }
590 } else if ( msg == "busy()" ) {
591 emit busy();
592 } else if ( msg == "notBusy(QString)" ) {
593 QString app;
594 stream >> app;
595 tabs->setBusy(FALSE);
596 emit notBusy(app);
597 } else if ( msg == "mkdir(QString)" ) {
598 QString dir;
599 stream >> dir;
600 if ( !dir.isEmpty() )
601 mkdir( dir );
602 } else if ( msg == "rdiffGenSig(QString,QString)" ) {
603 QString baseFile, sigFile;
604 stream >> baseFile >> sigFile;
605 QRsync::generateSignature( baseFile, sigFile );
606 } else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) {
607 QString baseFile, sigFile, deltaFile;
608 stream >> baseFile >> sigFile >> deltaFile;
609 QRsync::generateDiff( baseFile, sigFile, deltaFile );
610 } else if ( msg == "rdiffApplyPatch(QString,QString)" ) {
611 QString baseFile, deltaFile;
612 stream >> baseFile >> deltaFile;
613 if ( !QFile::exists( baseFile ) ) {
614 QFile f( baseFile );
615 f.open( IO_WriteOnly );
616 f.close();
617 }
618 QRsync::applyDiff( baseFile, deltaFile );
619 QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" );
620 e << baseFile;
621 } else if ( msg == "rdiffCleanup()" ) {
622 mkdir( "/tmp/rdiff" );
623 QDir dir;
624 dir.setPath( "/tmp/rdiff" );
625 QStringList entries = dir.entryList();
626 for ( QStringList::Iterator it = entries.begin(); it != entries.end(); ++it )
627 dir.remove( *it );
628 } else if ( msg == "sendHandshakeInfo()" ) {
629 QString home = getenv( "HOME" );
630 QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" );
631 e << home;
632 int locked = (int) Desktop::screenLocked();
633 e << locked;
634 } else if ( msg == "sendCardInfo()" ) {
635 QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" );
636 const QList<FileSystem> &fs = storage->fileSystems();
637 QListIterator<FileSystem> it ( fs );
638 QString s;
639 QString homeDir = getenv("HOME");
640 QString hardDiskHome;
641 for ( ; it.current(); ++it ) {
642 if ( (*it)->isRemovable() )
643 s += (*it)->name() + "=" + (*it)->path() + "/Documents "
644 + QString::number( (*it)->availBlocks() * (*it)->blockSize() )
645 + " " + (*it)->options() + ";";
646 else if ( (*it)->disk() == "/dev/mtdblock1" ||
647 (*it)->disk() == "/dev/mtdblock/1" )
648 s += (*it)->name() + "=" + homeDir + "/Documents "
649 + QString::number( (*it)->availBlocks() * (*it)->blockSize() )
650 + " " + (*it)->options() + ";";
651 else if ( (*it)->name().contains( "Hard Disk") &&
652 homeDir.contains( (*it)->path() ) &&
653 (*it)->path().length() > hardDiskHome.length() )
654 hardDiskHome =
655 (*it)->name() + "=" + homeDir + "/Documents "
656 + QString::number( (*it)->availBlocks() * (*it)->blockSize() )
657 + " " + (*it)->options() + ";";
658 }
659 if ( !hardDiskHome.isEmpty() )
660 s += hardDiskHome;
661
662 e << s;
663 } else if ( msg == "sendSyncDate(QString)" ) {
664 QString app;
665 stream >> app;
666 Config cfg( "qpe" );
667 cfg.setGroup("SyncDate");
668 QCopEnvelope e( "QPE/Desktop", "syncDate(QString,QString)" );
669 e << app << cfg.readEntry( app );
670 //qDebug("QPE/System sendSyncDate for %s: response %s", app.latin1(),
671 //cfg.readEntry( app ).latin1() );
672 } else if ( msg == "setSyncDate(QString,QString)" ) {
673 QString app, date;
674 stream >> app >> date;
675 Config cfg( "qpe" );
676 cfg.setGroup("SyncDate");
677 cfg.writeEntry( app, date );
678 //qDebug("setSyncDate(QString,QString) %s %s", app.latin1(), date.latin1());
679 } else if ( msg == "startSync(QString)" ) {
680 QString what;
681 stream >> what;
682 delete syncDialog; syncDialog = 0;
683 syncDialog = new SyncDialog( this, "syncProgress", FALSE,
684 WStyle_Tool | WStyle_Customize |
685 Qt::WStyle_StaysOnTop );
686 syncDialog->showMaximized();
687 syncDialog->whatLabel->setText( "<b>" + what + "</b>" );
688 connect( syncDialog->buttonCancel, SIGNAL( clicked() ),
689 SLOT( cancelSync() ) );
690 }
691 else if ( msg == "stopSync()") {
692 delete syncDialog; syncDialog = 0;
693 } else if ( msg == "getAllDocLinks()" ) {
694 loadDocs();
695
696 QString contents;
697
698 for ( QListIterator<DocLnk> it( docsFolder->children() ); it.current(); ++it ) {
699 DocLnk *doc = it.current();
700 QString lfn = doc->linkFile();
701 QFileInfo fi( doc->file() );
702 if ( !fi.exists() )
703 continue;
704
705
706
707 QFile f( lfn );
708 if ( f.open( IO_ReadOnly ) ) {
709 QTextStream ts( &f );
710 ts.setEncoding( QTextStream::UnicodeUTF8 );
711 contents += ts.read();
712 f.close();
713 } else {
714 contents += "[Desktop Entry]\n";
715 contents += "Categories = " + Qtopia::Record::idsToString( doc->categories() ) + "\n";
716 contents += "File = "+doc->file()+"\n";
717 contents += "Name = "+doc->name()+"\n";
718 contents += "Type = "+doc->type()+"\n";
719 }
720 contents += QString("Size = %1\n").arg( fi.size() );
721 }
722
723 //qDebug( "sending length %d", contents.length() );
724 QCopEnvelope e( "QPE/Desktop", "docLinks(QString)" );
725 e << contents;
726
727 //qDebug( "================ \n\n%s\n\n===============",
728 //contents.latin1() );
729
730 delete docsFolder;
731 docsFolder = 0;
732 }
733}
734
735void Launcher::cancelSync()
736{
737 QCopEnvelope e( "QPE/Desktop", "cancelSync()" );
738}
739
740void Launcher::storageChanged()
741{
742 if ( in_lnk_props ) {
743 got_lnk_change = TRUE;
744 lnk_change = "";
745 } else {
746 updateDocs();
747 }
748}
749
750
751bool Launcher::mkdir(const QString &localPath)
752{
753 QDir fullDir(localPath);
754 if (fullDir.exists())
755 return true;
756
757 // at this point the directory doesn't exist
758 // go through the directory tree and start creating the direcotories
759 // that don't exist; if we can't create the directories, return false
760
761 QString dirSeps = "/";
762 int dirIndex = localPath.find(dirSeps);
763 QString checkedPath;
764
765 // didn't find any seps; weird, use the cur dir instead
766 if (dirIndex == -1) {
767 //qDebug("No seperators found in path %s", localPath.latin1());
768 checkedPath = QDir::currentDirPath();
769 }
770
771 while (checkedPath != localPath) {
772 // no more seperators found, use the local path
773 if (dirIndex == -1)
774 checkedPath = localPath;
775 else {
776 // the next directory to check
777 checkedPath = localPath.left(dirIndex) + "/";
778 // advance the iterator; the next dir seperator
779 dirIndex = localPath.find(dirSeps, dirIndex+1);
780 }
781
782 QDir checkDir(checkedPath);
783 if (!checkDir.exists()) {
784 //qDebug("mkdir making dir %s", checkedPath.latin1());
785
786 if (!checkDir.mkdir(checkedPath)) {
787 qDebug("Unable to make directory %s", checkedPath.latin1());
788 return FALSE;
789 }
790 }
791
792 }
793 return TRUE;
794}
795
796void Launcher::preloadApps()
797{
798 Config cfg("Launcher");
799 cfg.setGroup("Preload");
800 QStringList apps = cfg.readListEntry("Apps",',');
801 for (QStringList::ConstIterator it=apps.begin(); it!=apps.end(); ++it) {
802 QCopEnvelope e("QPE/Application/"+(*it).local8Bit(), "enablePreload()");
803 }
804}
diff --git a/core/launcher/launcher.h b/core/launcher/launcher.h
new file mode 100644
index 0000000..00ae980
--- a/dev/null
+++ b/core/launcher/launcher.h
@@ -0,0 +1,136 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#ifndef LAUNCHER_H
21#define LAUNCHER_H
22
23#include <qmainwindow.h>
24#include <qtabbar.h>
25#include <qstringlist.h>
26#include <qvbox.h>
27#include <qlist.h>
28#include "launcherview.h"
29
30class AppLnk;
31class AppLnkSet;
32class DocLnkSet;
33class QWidgetStack;
34class StorageInfo;
35class SyncDialog;
36
37class CategoryTabBar : public QTabBar
38{
39 Q_OBJECT
40public:
41 CategoryTabBar( QWidget *parent=0, const char *name=0 );
42 ~CategoryTabBar();
43
44protected slots:
45 virtual void layoutTabs();
46
47protected:
48 void paint ( QPainter *p, QTab *t, bool f ) const;
49 void paintLabel( QPainter* p, const QRect& br, QTab* t, bool has_focus ) const;
50};
51
52class CategoryTabWidget : public QVBox {
53 // can't use a QTabWidget, since it won't let us set the frame style.
54 Q_OBJECT
55public:
56 CategoryTabWidget( QWidget* parent );
57 void initializeCategories(AppLnkSet* rootFolder, AppLnkSet* docFolder,
58 const QList<FileSystem> &);
59 void updateDocs(AppLnkSet* docFolder, const QList<FileSystem> &fs);
60 void updateLink(const QString& linkfile);
61 void setBusy(bool on);
62
63signals:
64 void selected(const QString&);
65 void clicked(const AppLnk*);
66 void rightPressed(AppLnk*);
67
68public slots:
69 void nextTab();
70 void prevTab();
71
72protected:
73 void paletteChange( const QPalette &p );
74
75private:
76 CategoryTabBar* categoryBar;
77 QWidgetStack* stack;
78 LauncherView* docview;
79 QStringList ids;
80 int tabs;
81 LauncherView* newView( const QString&, const QPixmap& pm, const QString& label );
82 void addItem( const QString& );
83};
84
85class Launcher : public QMainWindow
86{
87 Q_OBJECT
88 friend class LauncherPrivate;
89public:
90 Launcher( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
91 ~Launcher();
92
93 static QString appsFolderName();
94
95 virtual void showMaximized();
96 static bool mkdir(const QString &path);
97
98public slots:
99 void viewSelected(const QString&);
100 void select( const AppLnk * );
101 void externalSelected( const AppLnk *);
102 void properties( AppLnk * );
103 void nextView();
104
105signals:
106 void executing( const AppLnk * );
107 void busy();
108 void notBusy(const QString&);
109
110private slots:
111 void doMaximize();
112 void systemMessage( const QCString &, const QByteArray &);
113 void storageChanged();
114 void cancelSync();
115
116private:
117 void updateApps();
118 void loadDocs();
119 void updateDocs();
120 void updateTabs();
121 void updateMimeTypes();
122 void updateMimeTypes(AppLnkSet*);
123 void preloadApps();
124 AppLnkSet *rootFolder;
125 DocLnkSet *docsFolder;
126 CategoryTabWidget *tabs;
127 StorageInfo *storage;
128 SyncDialog *syncDialog;
129
130 void updateLink(const QString& link);
131 bool in_lnk_props;
132 bool got_lnk_change;
133 QString lnk_change;
134};
135
136#endif // LAUNCHERVIEW_H
diff --git a/core/launcher/launcher.pro b/core/launcher/launcher.pro
new file mode 100644
index 0000000..7d7c9ac
--- a/dev/null
+++ b/core/launcher/launcher.pro
@@ -0,0 +1,110 @@
1 TEMPLATE= app
2
3 CONFIG = qt warn_on release
4
5 DESTDIR = $(QPEDIR)/bin
6
7 HEADERS = background.h \
8 desktop.h \
9 info.h \
10 appicons.h \
11 taskbar.h \
12 sidething.h \
13 mrulist.h \
14 stabmon.h \
15 inputmethods.h \
16 systray.h \
17 wait.h \
18 shutdownimpl.h \
19 launcher.h \
20 launcherview.h \
21 ../calibrate/calibrate.h \
22 startmenu.h \
23 transferserver.h \
24 qcopbridge.h \
25 packageslave.h \
26 irserver.h \
27 $(QPEDIR)/rsync/buf.h \
28 $(QPEDIR)/rsync/checksum.h \
29 $(QPEDIR)/rsync/command.h \
30 $(QPEDIR)/rsync/emit.h \
31 $(QPEDIR)/rsync/job.h \
32 $(QPEDIR)/rsync/netint.h \
33 $(QPEDIR)/rsync/protocol.h \
34 $(QPEDIR)/rsync/prototab.h \
35 $(QPEDIR)/rsync/rsync.h \
36 $(QPEDIR)/rsync/search.h \
37 $(QPEDIR)/rsync/stream.h \
38 $(QPEDIR)/rsync/sumset.h \
39 $(QPEDIR)/rsync/trace.h \
40 $(QPEDIR)/rsync/types.h \
41 $(QPEDIR)/rsync/util.h \
42 $(QPEDIR)/rsync/whole.h \
43 $(QPEDIR)/rsync/config_rsync.h \
44 $(QPEDIR)/rsync/qrsync.h
45 # quicklauncher.h \
46
47 SOURCES = background.cpp \
48 desktop.cpp \
49 info.cpp \
50 appicons.cpp \
51 taskbar.cpp \
52 sidething.cpp \
53 mrulist.cpp \
54 stabmon.cpp \
55 inputmethods.cpp \
56 systray.cpp \
57 wait.cpp \
58 shutdownimpl.cpp \
59 launcher.cpp \
60 launcherview.cpp \
61 $(QPEDIR)/calibrate/calibrate.cpp \
62 transferserver.cpp \
63 packageslave.cpp \
64 irserver.cpp \
65 qcopbridge.cpp \
66 startmenu.cpp \
67 main.cpp \
68 $(QPEDIR)/rsync/base64.c \
69 $(QPEDIR)/rsync/buf.c \
70 $(QPEDIR)/rsync/checksum.c \
71 $(QPEDIR)/rsync/command.c \
72 $(QPEDIR)/rsync/delta.c \
73 $(QPEDIR)/rsync/emit.c \
74 $(QPEDIR)/rsync/hex.c \
75 $(QPEDIR)/rsync/job.c \
76 $(QPEDIR)/rsync/mdfour.c \
77 $(QPEDIR)/rsync/mksum.c \
78 $(QPEDIR)/rsync/msg.c \
79 $(QPEDIR)/rsync/netint.c \
80 $(QPEDIR)/rsync/patch.c \
81 $(QPEDIR)/rsync/prototab.c \
82 $(QPEDIR)/rsync/readsums.c \
83 $(QPEDIR)/rsync/scoop.c \
84 $(QPEDIR)/rsync/search.c \
85 $(QPEDIR)/rsync/stats.c \
86 $(QPEDIR)/rsync/stream.c \
87 $(QPEDIR)/rsync/sumset.c \
88 $(QPEDIR)/rsync/trace.c \
89 $(QPEDIR)/rsync/tube.c \
90 $(QPEDIR)/rsync/util.c \
91 $(QPEDIR)/rsync/version.c \
92 $(QPEDIR)/rsync/whole.c \
93 $(QPEDIR)/rsync/qrsync.cpp
94
95 INTERFACES= shutdown.ui syncdialog.ui
96
97INCLUDEPATH += $(QPEDIR)/include
98 DEPENDPATH+= $(QPEDIR)/include .
99
100INCLUDEPATH += $(QPEDIR)/calibrate
101 DEPENDPATH+= $(QPEDIR)/calibrate
102
103INCLUDEPATH += $(QPEDIR)/rsync
104 DEPENDPATH+= $(QPEDIR)/rsync
105
106 TARGET = qpe
107
108 LIBS += -lqpe -lcrypt
109
110TRANSLATIONS = ../i18n/de/qpe.ts
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp
new file mode 100644
index 0000000..68e3245
--- a/dev/null
+++ b/core/launcher/launcherview.cpp
@@ -0,0 +1,596 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include "launcherview.h"
22
23#include <qpe/qpeapplication.h>
24#include <qpe/applnk.h>
25#include <qpe/qpedebug.h>
26#include <qpe/categories.h>
27#include <qpe/categoryselect.h>
28#include <qpe/menubutton.h>
29#include <qpe/resource.h>
30#include <qpe/qpetoolbar.h>
31
32#include <qtimer.h>
33#include <qdict.h>
34#include <qfile.h>
35#include <qfileinfo.h>
36#include <qhbox.h>
37#include <qiconview.h>
38#include <qpainter.h>
39#include <qregexp.h>
40#include <qtoolbutton.h>
41
42class LauncherIconView : public QIconView {
43public:
44 LauncherIconView( QWidget* parent, const char* name=0 ) :
45 QIconView(parent,name),
46 tf(""),
47 cf(0),
48 bsy(0)
49 {
50 sortmeth = Name;
51 hidden.setAutoDelete(TRUE);
52 ike = FALSE;
53 }
54
55 ~LauncherIconView()
56 {
57#if 0 // debuggery
58 QListIterator<AppLnk> it(hidden);
59 AppLnk* l;
60 while ((l=it.current())) {
61 ++it;
62 //qDebug("%p: hidden (should remove)",l);
63 }
64#endif
65 }
66
67 QIconViewItem* busyItem() const { return bsy; }
68
69 void updateCategoriesAndMimeTypes();
70
71 void doAutoScroll()
72 {
73 // We don't want rubberbanding (yet)
74 }
75
76 void setBusy(bool on)
77 {
78 QIconViewItem *c = on ? currentItem() : 0;
79 if ( bsy != c ) {
80 QIconViewItem* o = bsy;
81 bsy = c;
82 if ( o ) o->repaint();
83 if ( c ) c->repaint();
84 }
85 }
86
87 bool inKeyEvent() const { return ike; }
88 void keyPressEvent(QKeyEvent* e)
89 {
90 ike = TRUE;
91 if ( e->key() == Key_F33 ) {
92 // "OK" button
93 returnPressed(currentItem());
94 }
95 QIconView::keyPressEvent(e);
96 ike = FALSE;
97 }
98
99 void addItem(AppLnk* app, bool resort=TRUE);
100 bool removeLink(const QString& linkfile);
101
102 QStringList mimeTypes() const;
103 QStringList categories() const;
104
105 void clear()
106 {
107 mimes.clear();
108 cats.clear();
109 QIconView::clear();
110 hidden.clear();
111 }
112
113 void addCatsAndMimes(AppLnk* app)
114 {
115 // QStringList c = app->categories();
116 // for (QStringList::ConstIterator cit=c.begin(); cit!=c.end(); ++cit) {
117 // cats.replace(*cit,(void*)1);
118 // }
119 QString maj=app->type();
120 int sl=maj.find('/');
121 if (sl>=0) {
122 QString k = maj.left(sl);
123 mimes.replace(k,(void*)1);
124 }
125 }
126
127 void drawBackground( QPainter *p, const QRect &r )
128 {
129 //int backgroundMode = QPixmap::defaultDepth() >= 12 ? 1 : 0;
130 int backgroundMode = 2;
131
132 if ( backgroundMode == 1 ) {
133
134 // Double buffer the background
135 static QPixmap *bg = NULL;
136 static QColor bgColor;
137
138 if ( (bg == NULL) || (bgColor != colorGroup().button()) ) {
139 // Create a new background double buffer
140 if (bg == NULL)
141 bg = new QPixmap( width(), height() );
142 bgColor = colorGroup().button();
143 QPainter painter( bg );
144
145 painter.fillRect( QRect( 0, 0, width(), height() ), QBrush( white ) );
146
147 // Overlay the Qtopia logo in the center
148 QImage logo = Resource::loadImage( "qpe-logo" );
149 if ( !logo.isNull() )
150 painter.drawImage( (width() - logo.width()) / 2,
151 (height() - logo.height()) / 2, logo );
152 }
153
154 // Draw the double buffer to the widget (it is tiled for when the icon view is large)
155 p->drawTiledPixmap( r, *bg, QPoint( (r.x() + contentsX()) % bg->width(),
156 (r.y() + contentsY()) % bg->height() ) );
157 } else if ( backgroundMode == 2 ) {
158 static QPixmap *bg = 0;
159 static QColor bgColor;
160 if ( !bg || (bgColor != colorGroup().background()) ) {
161 bgColor = colorGroup().background();
162 bg = new QPixmap( width(), 9 );
163 QPainter painter( bg );
164 for ( int i = 0; i < 3; i++ ) {
165 painter.setPen( white );
166 painter.drawLine( 0, i*3, width()-1, i*3 );
167 painter.drawLine( 0, i*3+1, width()-1, i*3+1 );
168 painter.setPen( colorGroup().background().light(105) );
169 painter.drawLine( 0, i*3+2, width()-1, i*3+2 );
170 }
171 }
172 p->drawTiledPixmap( r, *bg, QPoint( (r.x() + contentsX()) % bg->width(),
173 (r.y() + contentsY()) % bg->height() ) );
174 } else {
175 p->fillRect( r, QBrush( white ) );
176 }
177 }
178
179 void hideOrShowItems(bool resort);
180
181 void setTypeFilter(const QString& typefilter, bool resort)
182 {
183 tf = QRegExp(typefilter,FALSE,TRUE);
184 hideOrShowItems(resort);
185 }
186
187 void setCategoryFilter( int catfilter, bool resort )
188 {
189 Categories cat;
190 cat.load( categoryFileName() );
191 QString str;
192 if ( catfilter == -2 )
193 cf = 0;
194 else
195 cf = catfilter;
196 hideOrShowItems(resort);
197 }
198
199 enum SortMethod { Name, Date, Type };
200
201 void setSortMethod( SortMethod m )
202 {
203 if ( sortmeth != m ) {
204 sortmeth = m;
205 sort();
206 }
207 }
208
209 int compare(const AppLnk* a, const AppLnk* b)
210 {
211 switch (sortmeth) {
212 case Name:
213 return a->name().compare(b->name());
214 case Date: {
215 QFileInfo fa(a->linkFile());
216 if ( !fa.exists() ) fa.setFile(a->file());
217 QFileInfo fb(b->linkFile());
218 if ( !fb.exists() ) fb.setFile(b->file());
219 return fa.lastModified().secsTo(fb.lastModified());
220 }
221 case Type:
222 return a->type().compare(b->type());
223 }
224 return 0;
225 }
226
227protected:
228
229 void styleChange( QStyle &old )
230 {
231 QIconView::styleChange( old );
232 //### duplicated code from LauncherView constructor
233 int dw = QApplication::desktop()->width();
234 setGridX( (dw-13-style().scrollBarExtent().width())/3 ); // tweaked for 8pt+dw=176 and 10pt+dw=240
235 }
236
237private:
238 QList<AppLnk> hidden;
239 QDict<void> mimes;
240 QDict<void> cats;
241 SortMethod sortmeth;
242 QRegExp tf;
243 int cf;
244 QIconViewItem* bsy;
245 bool ike;
246
247};
248
249
250bool LauncherView::bsy=FALSE;
251
252void LauncherView::setBusy(bool on)
253{
254 icons->setBusy(on);
255}
256
257class LauncherItem : public QIconViewItem
258{
259public:
260 LauncherItem( QIconView *parent, AppLnk* applnk );
261 ~LauncherItem()
262 {
263 LauncherIconView* liv = (LauncherIconView*)iconView();
264 if ( liv->busyItem() == this )
265 liv->setBusy(FALSE);
266 delete app;
267 }
268
269 AppLnk* appLnk() const { return app; }
270 AppLnk* takeAppLnk() { AppLnk* r=app; app=0; return r; }
271
272 virtual int compare ( QIconViewItem * i ) const;
273
274 void paintItem( QPainter *p, const QColorGroup &cg )
275 {
276 LauncherIconView* liv = (LauncherIconView*)iconView();
277 QBrush oldBrush( liv->itemTextBackground() );
278 QColorGroup mycg( cg );
279 if ( liv->currentItem() == this ) {
280 liv->setItemTextBackground( cg.brush( QColorGroup::Highlight ) );
281 mycg.setColor( QColorGroup::Text, cg.color( QColorGroup::HighlightedText ) );
282 }
283 QIconViewItem::paintItem(p,mycg);
284 if ( liv->currentItem() == this )
285 liv->setItemTextBackground( oldBrush );
286 if ( liv->busyItem() == this ) {
287 static QPixmap* busypm=0;
288 if ( !busypm )
289 busypm = new QPixmap(Resource::loadPixmap("launching"));
290 p->drawPixmap(x()+(width()-busypm->width())/2, y(),*busypm);
291 }
292 }
293
294protected:
295 AppLnk* app;
296};
297
298
299LauncherItem::LauncherItem( QIconView *parent, AppLnk *applnk )
300 : QIconViewItem( parent, applnk->name(), applnk->bigPixmap() ),
301 app(applnk) // Takes ownership
302{
303}
304
305int LauncherItem::compare ( QIconViewItem * i ) const
306{
307 LauncherIconView* view = (LauncherIconView*)iconView();
308 return view->compare(app,((LauncherItem *)i)->appLnk());
309}
310
311QStringList LauncherIconView::mimeTypes() const
312{
313 QStringList r;
314 QDictIterator<void> it(mimes);
315 while (it.current()) {
316 r.append(it.currentKey());
317 ++it;
318 }
319 r.sort();
320 return r;
321}
322
323void LauncherIconView::addItem(AppLnk* app, bool resort)
324{
325 addCatsAndMimes(app);
326
327 if ( (tf.isEmpty() || tf.match(app->type()) >= 0)
328 && (cf == 0 || app->categories().contains(cf)
329 || cf == -1 && app->categories().count() == 0 ) )
330 (void) new LauncherItem( this, app );
331 else
332 hidden.append(app);
333 if ( resort )
334 sort();
335}
336
337void LauncherIconView::updateCategoriesAndMimeTypes()
338{
339 mimes.clear();
340 cats.clear();
341 LauncherItem* item = (LauncherItem*)firstItem();
342 while (item) {
343 addCatsAndMimes(item->appLnk());
344 item = (LauncherItem*)item->nextItem();
345 }
346 QListIterator<AppLnk> it(hidden);
347 AppLnk* l;
348 while ((l=it.current())) {
349 addCatsAndMimes(l);
350 ++it;
351 }
352}
353
354void LauncherIconView::hideOrShowItems(bool resort)
355{
356 hidden.setAutoDelete(FALSE);
357 QList<AppLnk> links=hidden;
358 hidden.clear();
359 hidden.setAutoDelete(TRUE);
360 LauncherItem* item = (LauncherItem*)firstItem();
361 while (item) {
362 links.append(item->takeAppLnk());
363 item = (LauncherItem*)item->nextItem();
364 }
365 clear();
366 QListIterator<AppLnk> it(links);
367 AppLnk* l;
368 while ((l=it.current())) {
369 addItem(l,FALSE);
370 ++it;
371 }
372 if ( resort )
373 sort();
374}
375
376bool LauncherIconView::removeLink(const QString& linkfile)
377{
378 LauncherItem* item = (LauncherItem*)firstItem();
379 while (item) {
380 if ( item->appLnk()->linkFile() == linkfile ) {
381 delete item;
382 return TRUE;
383 }
384 item = (LauncherItem*)item->nextItem();
385 }
386 QListIterator<AppLnk> it(hidden);
387 AppLnk* l;
388 while ((l=it.current())) {
389 ++it;
390 if ( l->linkFile() == linkfile ) {
391 hidden.removeRef(l);
392 return TRUE;
393 }
394 }
395 return FALSE;
396}
397
398LauncherView::LauncherView( QWidget* parent, const char* name, WFlags fl )
399 : QVBox( parent, name, fl )
400{
401 icons = new LauncherIconView( this );
402 setFocusProxy(icons);
403 QPEApplication::setStylusOperation( icons->viewport(), QPEApplication::RightOnHold );
404
405 int dw = QApplication::desktop()->width();
406 icons->setItemsMovable( FALSE );
407 icons->setAutoArrange( TRUE );
408 icons->setSorting( TRUE );
409 icons->setGridX( (dw-13-style().scrollBarExtent().width())/3 ); // tweaked for 8pt+dw=176 and 10pt+dw=240
410 icons->setGridY( fontMetrics().height()*2+24 );
411 icons->setFrameStyle( QFrame::NoFrame );
412 icons->setSpacing( 4 );
413 icons->setMargin( 0 );
414 icons->setSelectionMode( QIconView::Multi );
415 icons->setBackgroundMode( PaletteBase );
416
417 connect( icons, SIGNAL(mouseButtonClicked(int, QIconViewItem *, const QPoint&)),
418 SLOT(itemClicked(int, QIconViewItem *)) );
419 connect( icons, SIGNAL(selectionChanged()),
420 SLOT(selectionChanged()) );
421 connect( icons, SIGNAL(returnPressed(QIconViewItem *)),
422 SLOT(returnPressed(QIconViewItem *)) );
423 connect( icons, SIGNAL(mouseButtonPressed(int, QIconViewItem *, const QPoint&)),
424 SLOT(itemPressed(int, QIconViewItem *)) );
425
426 tools = 0;
427}
428
429LauncherView::~LauncherView()
430{
431}
432
433void LauncherView::setToolsEnabled(bool y)
434{
435 if ( !y != !tools ) {
436 if ( y ) {
437 tools = new QHBox(this);
438
439 // Type filter
440 typemb = new MenuButton(tools);
441 typemb->setLabel(tr("Type: %1"));
442
443 // Category filter
444 catmb = new CategorySelect(tools);
445
446 updateTools();
447 tools->show();
448 } else {
449 delete tools;
450 tools = 0;
451 }
452 }
453}
454
455void LauncherView::updateTools()
456{
457 disconnect( typemb, SIGNAL(selected(const QString&)),
458 this, SLOT(showType(const QString&)) );
459 disconnect( catmb, SIGNAL(signalSelected(int)),
460 this, SLOT(showCategory(int)) );
461
462 icons->updateCategoriesAndMimeTypes();
463
464 QString prev;
465
466 // Type filter
467 QStringList types;
468 types << tr("All");
469 types << "--";
470 types += icons->mimeTypes();
471 prev = typemb->currentText();
472 typemb->clear();
473 typemb->insertItems(types);
474 typemb->select(prev);
475
476 Categories cats( 0 );
477 cats.load( categoryFileName() );
478 QArray<int> vl( 0 );
479 catmb->setCategories( vl, "Document View", tr("Document View") );
480 catmb->setRemoveCategoryEdit( TRUE );
481 catmb->setAllCategories( TRUE );
482
483 connect(typemb, SIGNAL(selected(const QString&)), this, SLOT(showType(const QString&)));
484 connect(catmb, SIGNAL(signalSelected(int)), this, SLOT(showCategory(int)));
485}
486
487void LauncherView::sortBy(int s)
488{
489 icons->setSortMethod((LauncherIconView::SortMethod)s);
490}
491
492void LauncherView::showType(const QString& t)
493{
494 if ( t == tr("All") ) {
495 icons->setTypeFilter("",TRUE);
496 } else {
497 icons->setTypeFilter(t+"/*",TRUE);
498 }
499}
500
501void LauncherView::showCategory( int c )
502{
503 icons->setCategoryFilter( c, TRUE );
504}
505
506void LauncherView::resizeEvent(QResizeEvent *e)
507{
508 QVBox::resizeEvent( e );
509 if ( e->size().width() != e->oldSize().width() )
510 sort();
511}
512
513void LauncherView::populate( AppLnkSet *folder, const QString& typefilter )
514{
515 icons->clear();
516 internalPopulate( folder, typefilter );
517}
518
519void LauncherView::selectionChanged()
520{
521 QIconViewItem* item = icons->currentItem();
522 if ( item && item->isSelected() ) {
523 AppLnk *appLnk = ((LauncherItem *)item)->appLnk();
524 if ( icons->inKeyEvent() ) // not for mouse press
525 emit clicked( appLnk );
526 item->setSelected(FALSE);
527 }
528}
529
530void LauncherView::returnPressed( QIconViewItem *item )
531{
532 if ( item ) {
533 AppLnk *appLnk = ((LauncherItem *)item)->appLnk();
534 emit clicked( appLnk );
535 }
536}
537
538void LauncherView::itemClicked( int btn, QIconViewItem *item )
539{
540 if ( item ) {
541 AppLnk *appLnk = ((LauncherItem *)item)->appLnk();
542 if ( btn == LeftButton ) {
543 // Make sure it's the item we execute that gets highlighted
544 icons->setCurrentItem( item );
545 emit clicked( appLnk );
546 }
547 item->setSelected(FALSE);
548 }
549}
550
551void LauncherView::itemPressed( int btn, QIconViewItem *item )
552{
553 if ( item ) {
554 AppLnk *appLnk = ((LauncherItem *)item)->appLnk();
555 if ( btn == RightButton )
556 emit rightPressed( appLnk );
557/*
558 else if ( btn == LeftButton )
559 emit clicked( appLnk );
560*/
561 item->setSelected(FALSE);
562 }
563}
564
565void LauncherView::internalPopulate( AppLnkSet *folder, const QString& typefilter )
566{
567 QListIterator<AppLnk> it( folder->children() );
568 icons->setTypeFilter(typefilter,FALSE);
569
570 while ( it.current() ) {
571 icons->addItem(*it,FALSE);
572 ++it;
573 }
574
575 icons->sort();
576}
577
578bool LauncherView::removeLink(const QString& linkfile)
579{
580 return icons->removeLink(linkfile);
581}
582
583void LauncherView::sort()
584{
585 icons->sort();
586}
587
588void LauncherView::addItem(AppLnk* app, bool resort)
589{
590 icons->addItem(app,resort);
591}
592
593void LauncherView::setFileSystems(const QList<FileSystem> &)
594{
595 // ### does nothing now...
596}
diff --git a/core/launcher/launcherview.h b/core/launcher/launcherview.h
new file mode 100644
index 0000000..3aaef7e
--- a/dev/null
+++ b/core/launcher/launcherview.h
@@ -0,0 +1,81 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#ifndef LAUNCHERVIEW_H
21#define LAUNCHERVIEW_H
22
23#include <qpe/storage.h>
24
25#include <qvbox.h>
26
27class AppLnk;
28class AppLnkSet;
29class CategorySelect;
30class LauncherIconView;
31class QIconView;
32class QIconViewItem;
33class MenuButton;
34
35class LauncherView : public QVBox
36{
37 Q_OBJECT
38
39public:
40 LauncherView( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
41 ~LauncherView();
42
43 bool removeLink(const QString& linkfile);
44 void addItem(AppLnk* app, bool resort=TRUE);
45 void sort();
46
47 void setFileSystems(const QList<FileSystem> &);
48 void setToolsEnabled(bool);
49 void updateTools();
50
51 void setBusy(bool);
52
53public slots:
54 void populate( AppLnkSet *folder, const QString& categoryfilter );
55
56signals:
57 void clicked( const AppLnk * );
58 void rightPressed( AppLnk * );
59
60protected slots:
61 void selectionChanged();
62 void returnPressed( QIconViewItem *item );
63 void itemClicked( int, QIconViewItem * );
64 void itemPressed( int, QIconViewItem * );
65 void sortBy(int);
66 void showType(const QString&);
67 void showCategory( int );
68 void resizeEvent(QResizeEvent *);
69
70protected:
71 void internalPopulate( AppLnkSet *, const QString& categoryfilter );
72
73private:
74 static bool bsy;
75 QWidget* tools;
76 LauncherIconView* icons;
77 MenuButton *typemb;
78 CategorySelect *catmb;
79};
80
81#endif // LAUNCHERVIEW_H
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp
new file mode 100644
index 0000000..024f9cc
--- a/dev/null
+++ b/core/launcher/main.cpp
@@ -0,0 +1,276 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include "desktop.h"
22#include "taskbar.h"
23#include "stabmon.h"
24
25#include <qpe/qpeapplication.h>
26#include <qpe/network.h>
27#include <qpe/config.h>
28#ifdef QT_QWS_CUSTOM
29#include <qpe/custom.h>
30#endif
31
32#include <qfile.h>
33#include <qwindowsystem_qws.h>
34#include <qpe/qcopenvelope_qws.h>
35#include <qpe/alarmserver.h>
36
37#include <stdlib.h>
38#include <stdio.h>
39#include <signal.h>
40#include <unistd.h>
41
42#if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX)
43#include "../calibrate/calibrate.h"
44#endif
45
46#ifdef QT_QWS_LOGIN
47#include "../login/qdmdialogimpl.h"
48#endif
49
50#ifdef QT_QWS_CASSIOPEIA
51static void ignoreMessage( QtMsgType, const char * )
52{
53}
54#include <sys/mount.h>
55#include <sys/types.h>
56#include <sys/stat.h>
57#include <sys/time.h>
58#include <fcntl.h>
59#include <qdatetime.h>
60
61void initCassiopeia()
62{
63 // MIPSEL-specific init - make sure /proc exists for shm
64/*
65 if ( mount("/dev/ram0", "/", "ext2", MS_REMOUNT | MS_MGC_VAL, 0 ) ) {
66 perror("Remounting - / read/write");
67 }
68*/
69 if ( mount("none", "/tmp", "ramfs", 0, 0 ) ) {
70 perror("mounting ramfs /tmp");
71 } else {
72 fprintf( stderr, "mounted /tmp\n" );
73 }
74 if ( mount("none", "/home", "ramfs", 0, 0 ) ) {
75 perror("mounting ramfs /home");
76 } else {
77 fprintf( stderr, "mounted /home\n" );
78 }
79 if ( mount("none","/proc","proc",0,0) ) {
80 perror("Mounting - /proc");
81 } else {
82 fprintf( stderr, "mounted /proc\n" );
83 }
84 if ( mount("none","/mnt","shm",0,0) ) {
85 perror("Mounting - shm");
86 }
87 setenv( "QTDIR", "/", 1 );
88 setenv( "QPEDIR", "/", 1 );
89 setenv( "HOME", "/home", 1 );
90 mkdir( "/home/Documents", 0755 );
91
92 // set a reasonable starting date
93 QDateTime dt( QDate( 2001, 3, 15 ) );
94 QDateTime now = QDateTime::currentDateTime();
95 int change = now.secsTo( dt );
96
97 time_t t = ::time(0);
98 t += change;
99 stime(&t);
100
101 qInstallMsgHandler(ignoreMessage);
102}
103#endif
104
105#ifdef QPE_OWNAPM
106#include <sys/ioctl.h>
107#include <sys/types.h>
108#include <fcntl.h>
109#include <unistd.h>
110#include <errno.h>
111#include <linux/ioctl.h>
112#include <qpe/global.h>
113
114static void disableAPM()
115{
116
117 int fd, cur_val, ret;
118 char *device = "/dev/apm_bios";
119
120 fd = open (device, O_WRONLY);
121
122 if (fd == -1) {
123 perror(device);
124 return;
125 }
126
127 cur_val = ioctl(fd, APM_IOCGEVTSRC, 0);
128 if (cur_val == -1) {
129 perror("ioctl");
130 exit(errno);
131 }
132
133 ret = ioctl(fd, APM_IOCSEVTSRC, cur_val & ~APM_EVT_POWER_BUTTON);
134 if (ret == -1) {
135 perror("ioctl");
136 return;
137 }
138 close(fd);
139}
140
141static void initAPM()
142{
143 // So that we have to do it ourself, but better.
144 disableAPM();
145}
146#endif
147
148#ifdef QT_DEMO_SINGLE_FLOPPY
149#include <sys/mount.h>
150
151void initFloppy()
152{
153 mount("none","/proc","proc",0,0);
154 setenv( "QTDIR", "/", 0 );
155 setenv( "HOME", "/root", 0 );
156 setenv( "QWS_SIZE", "240x320", 0 );
157}
158#endif
159
160
161void initEnvironment()
162{
163 Config config("locale");
164 config.setGroup( "Location" );
165 QString tz = config.readEntry( "Timezone", getenv("TZ") );
166
167 // if not timezone set, pick New York
168 if (tz.isNull())
169 tz = "America/New_York";
170
171 setenv( "TZ", tz, 1 );
172 config.writeEntry( "Timezone", tz);
173
174 config.setGroup( "Language" );
175 QString lang = config.readEntry( "Language", getenv("LANG") );
176 if ( !lang.isNull() )
177 setenv( "LANG", lang, 1 );
178}
179
180static void initBacklight()
181{
182 QCopEnvelope e("QPE/System", "setBacklight(int)" );
183 e << -3; // Forced on
184}
185
186
187
188int initApplication( int argc, char ** argv )
189{
190#ifdef QT_QWS_CASSIOPEIA
191 initCassiopeia();
192#endif
193
194#ifdef QPE_OWNAPM
195 initAPM();
196#endif
197
198#ifdef QT_DEMO_SINGLE_FLOPPY
199 initFloppy();
200#endif
201
202 initEnvironment();
203
204#if !defined(QT_QWS_CASSIOPEIA) && !defined(QT_QWS_IPAQ) && !defined(QT_QWS_EBX)
205 setenv( "QWS_SIZE", "240x320", 0 );
206#endif
207
208 //Don't flicker at startup:
209 QWSServer::setDesktopBackground( QImage() );
210 DesktopApplication a( argc, argv, QApplication::GuiServer );
211
212 initBacklight();
213
214 AlarmServer::initialize();
215
216#if defined(QT_QWS_LOGIN)
217 for( int i=0; i<a.argc(); i++ )
218 if( strcmp( a.argv()[i], "-login" ) == 0 ) {
219 QDMDialogImpl::login( );
220 return 0;
221 }
222#endif
223
224 Desktop *d = new Desktop();
225
226 QObject::connect( &a, SIGNAL(datebook()), d, SLOT(raiseDatebook()) );
227 QObject::connect( &a, SIGNAL(contacts()), d, SLOT(raiseContacts()) );
228 QObject::connect( &a, SIGNAL(launch()), d, SLOT(raiseLauncher()) );
229 QObject::connect( &a, SIGNAL(email()), d, SLOT(raiseEmail()) );
230 QObject::connect( &a, SIGNAL(power()), d, SLOT(togglePower()) );
231 QObject::connect( &a, SIGNAL(backlight()), d, SLOT(toggleLight()) );
232 QObject::connect( &a, SIGNAL(symbol()), d, SLOT(toggleSymbolInput()) );
233 QObject::connect( &a, SIGNAL(numLockStateToggle()), d, SLOT(toggleNumLockState()) );
234 QObject::connect( &a, SIGNAL(capsLockStateToggle()), d, SLOT(toggleCapsLockState()) );
235 QObject::connect( &a, SIGNAL(prepareForRestart()), d, SLOT(terminateServers()) );
236
237 (void)new SysFileMonitor(d);
238 Network::createServer(d);
239
240#if defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX)
241 if ( !QFile::exists( "/etc/pointercal" ) ) {
242 // Make sure calibration widget starts on top.
243 Calibrate *cal = new Calibrate;
244 cal->exec();
245 delete cal;
246 }
247#endif
248
249 d->show();
250
251 int rv = a.exec();
252
253 delete d;
254
255 return rv;
256}
257
258int main( int argc, char ** argv )
259{
260#ifndef SINGLE_APP
261 signal( SIGCHLD, SIG_IGN );
262#endif
263
264 int retVal = initApplication( argc, argv );
265
266#ifndef SINGLE_APP
267 // Kill them. Kill them all.
268 setpgid( getpid(), getppid() );
269 killpg( getpid(), SIGTERM );
270 sleep( 1 );
271 killpg( getpid(), SIGKILL );
272#endif
273
274 return retVal;
275}
276
diff --git a/core/launcher/mrulist.cpp b/core/launcher/mrulist.cpp
new file mode 100644
index 0000000..4daf7d2
--- a/dev/null
+++ b/core/launcher/mrulist.cpp
@@ -0,0 +1,199 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include "mrulist.h"
22
23#include <qpe/global.h>
24#include <qpe/applnk.h>
25#include <qpe/resource.h>
26
27#include <qframe.h>
28#include <qpushbutton.h>
29#include <qtoolbutton.h>
30#include <qpopupmenu.h>
31#include <qpainter.h>
32#include <qwindowsystem_qws.h>
33
34
35 QList<MRUList>*MRUList::MRUListWidgets = NULL;
36 QList<AppLnk>*MRUList::task = NULL;
37
38
39MRUList::MRUList( QWidget *parent )
40 : QFrame( parent ), selected(-1), oldsel(-1)
41{
42 setBackgroundMode( PaletteButton );
43 if (!MRUListWidgets)
44 MRUListWidgets = new QList<MRUList>;
45 if (!task)
46 task = new QList<AppLnk>;
47 MRUListWidgets->append( this );
48}
49
50
51MRUList::~MRUList()
52{
53 if (MRUListWidgets)
54 MRUListWidgets->remove( this );
55 if (task)
56 task->setAutoDelete( TRUE );
57}
58
59
60QSize MRUList::sizeHint() const
61{
62 return QSize( frameWidth(), 16 );
63}
64
65
66void MRUList::addTask( const AppLnk *appLnk )
67{
68 if ( !appLnk )
69 return;
70 unsigned int i = 0;
71
72 if ( !task )
73 return;
74
75 for ( ; i < task->count(); i++ ) {
76 AppLnk *t = task->at(i);
77 if ( t->exec() == appLnk->exec() ) {
78 if (i != 0) {
79 task->remove();
80 task->prepend( t );
81 }
82 for (unsigned i = 0; i < MRUListWidgets->count(); i++ )
83 MRUListWidgets->at(i)->update();
84 return;
85 }
86 }
87
88 AppLnk *t = new AppLnk( *appLnk );
89 // DocLnks have an overloaded virtual function exec()
90 t->setExec( appLnk->exec() );
91 task->prepend( t );
92
93 if ( task->count() > 6 ) {
94 t = task->last();
95 task->remove();
96 Global::terminate(t);
97 delete t;
98 }
99
100 for (unsigned i = 0; i < MRUListWidgets->count(); i++ )
101 MRUListWidgets->at(i)->update();
102}
103
104bool MRUList::quitOldApps()
105{
106 QStringList appsstarted;
107 QStringList appsrunning;
108 for ( int i=task->count()-1; i>=0; --i ) {
109 AppLnk *t = task->at(i);
110 appsstarted.append(t->exec());
111 }
112
113 const QList<QWSWindow> &list = qwsServer->clientWindows();
114 QWSWindow* w;
115 for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) {
116 QString app = w->client()->identity();
117 if ( appsstarted.contains(app) && !appsrunning.contains(app) )
118 appsrunning.append(app);
119 }
120
121 if ( appsrunning.count() > 1 ) {
122 QStringList::ConstIterator it = appsrunning.begin();
123 ++it; // top stays running!
124 for (; it != appsrunning.end(); it++) {
125 for ( int i=task->count()-1; i>=0; --i ) {
126 AppLnk *t = task->at(i);
127 if ( t->exec() == *it )
128 Global::terminate(t);
129 }
130 }
131 return TRUE;
132 } else {
133 return FALSE;
134 }
135}
136
137
138void MRUList::mousePressEvent(QMouseEvent *e)
139{
140 selected = 0;
141 int x=0;
142 QListIterator<AppLnk> it( *task );
143 for ( ; it.current(); ++it,++selected,x+=15 ) {
144 if ( x + 15 <= width() ) {
145 if ( e->x() >= x && e->x() < x+15 ) {
146 if ( selected < (int)task->count() ) {
147 repaint(FALSE);
148 return;
149 }
150 }
151 } else {
152 break;
153 }
154 }
155 selected = -1;
156 repaint( FALSE );
157}
158
159
160void MRUList::mouseReleaseEvent(QMouseEvent *)
161{
162 if ( selected >= 0 ) {
163 if ( parentWidget() )
164 if ( parentWidget()->isA( "QPopupMenu" ) )
165 parentWidget()->hide();
166 Global::execute( task->at(selected)->exec() );
167 selected = -1;
168 oldsel = -1;
169 update();
170 }
171}
172
173
174void MRUList::paintEvent( QPaintEvent * )
175{
176 QPainter p( this );
177 AppLnk *t;
178 int x = 0;
179 int y = (height() - 14) / 2;
180 int i = 0;
181
182 p.fillRect( 0, 0, width(), height(), colorGroup().background() );
183
184 if ( task ) {
185 QListIterator<AppLnk> it( *task );
186 for ( ; it.current(); i++, ++it ) {
187 if ( x + 15 <= width() ) {
188 t = it.current();
189 if ( (int)i == selected )
190 p.fillRect( x, y, 15, t->pixmap().height()+1, colorGroup().highlight() );
191 else if ( (int)i == oldsel )
192 p.eraseRect( x, y, 15, t->pixmap().height()+1 );
193 p.drawPixmap( x, y, t->pixmap() );
194 x += 15;
195 }
196 }
197 }
198}
199
diff --git a/core/launcher/mrulist.h b/core/launcher/mrulist.h
new file mode 100644
index 0000000..141a09b
--- a/dev/null
+++ b/core/launcher/mrulist.h
@@ -0,0 +1,55 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#ifndef __MRU_LIST_H__
22#define __MRU_LIST_H__
23
24
25#include <qpe/applnk.h>
26
27#include <qframe.h>
28#include <qlist.h>
29#include <qpixmap.h>
30
31
32class MRUList : public QFrame
33{
34public:
35 MRUList( QWidget *parent );
36 ~MRUList();
37 virtual QSize sizeHint() const;
38 static void addTask( const AppLnk *appLnk );
39 bool quitOldApps();
40
41protected:
42 void mousePressEvent(QMouseEvent *e);
43 void mouseReleaseEvent(QMouseEvent *e);
44 void paintEvent( QPaintEvent *event );
45
46private:
47 static QList<MRUList> *MRUListWidgets;
48 static QList<AppLnk> *task;
49 int selected;
50 int oldsel;
51};
52
53
54#endif // __MRU_LIST_H__
55
diff --git a/core/launcher/obexinterface.h b/core/launcher/obexinterface.h
new file mode 100644
index 0000000..a73fde6
--- a/dev/null
+++ b/core/launcher/obexinterface.h
@@ -0,0 +1,40 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#ifndef OBEXINTERFACE_H
22#define OBEXINTERFACE_H
23
24#include <qpe/qcom.h>
25
26#ifndef QT_NO_COMPONENT
27// ### regenerate!!!!!!
28// {6CA35D0B-C637-4865-A667-7D4CD8A70407}
29# ifndef IID_ObexInterface
30# define IID_ObexInterface QUuid( 0x6ca35d0b, 0xc637, 0x4865, 0xa6, 0x67, 0x7d, 0x4c, 0xd8, 0xa7, 0x04, 0x07)
31# endif
32#endif
33
34class QObject;
35
36struct ObexInterface : public QUnknownInterface
37{
38};
39
40#endif
diff --git a/core/launcher/packageslave.cpp b/core/launcher/packageslave.cpp
new file mode 100644
index 0000000..4f149a5
--- a/dev/null
+++ b/core/launcher/packageslave.cpp
@@ -0,0 +1,97 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include "packageslave.h"
22
23#include <qpe/process.h>
24#include <qpe/qcopenvelope_qws.h>
25
26#include <qdatastream.h>
27#include <qcopchannel_qws.h>
28
29#include <unistd.h>
30
31PackageSlave::PackageSlave( QObject *parent, char* name )
32 : QObject( parent, name ), packageChannel( 0 )
33{
34 // setup qcop channel
35 packageChannel = new QCopChannel( "QPE/Package", this );
36 connect( packageChannel, SIGNAL( received(const QCString &, const QByteArray &) ),
37 this, SLOT( qcopMessage( const QCString &, const QByteArray &) ) );
38}
39
40void PackageSlave::qcopMessage( const QCString &msg, const QByteArray &data )
41{
42 QDataStream stream( data, IO_ReadOnly );
43
44 if ( msg == "installPackage(QString)" ) {
45 QString file;
46 stream >> file;
47 installPackage( file );
48 }
49 else if ( msg == "removePackage(QString)" ) {
50 QString file;
51 stream >> file;
52 removePackage( file );
53 }
54}
55
56void PackageSlave::installPackage( const QString &package )
57{
58 Process proc( QStringList() << "ipkg" << "install" << package );
59
60 sendReply( "installStarted(QString)", package );
61
62 QString output;
63 if ( proc.exec( "", output ) ) {
64 sendReply( "installDone(QString)", package );
65 }
66 else {
67 sendReply( "installFailed(QString)", package );
68 }
69 QCopEnvelope e("QPE/System", "linkChanged(QString)");
70 QString lf = QString::null;
71 e << lf;
72 unlink( package );
73}
74
75void PackageSlave::removePackage( const QString &package )
76{
77 Process proc( QStringList() << "ipkg" << "remove" << package );
78
79 sendReply( "removeStarted(QString)", package );
80
81 QString output;
82 if ( proc.exec( "", output ) ) {
83 sendReply( "removeDone(QString)", package );
84 }
85 else {
86 sendReply( "removeFailed(QString)", package );
87 }
88 QCopEnvelope e("QPE/System", "linkChanged(QString)");
89 QString lf = QString::null;
90 e << lf;
91}
92
93void PackageSlave::sendReply( const QCString& msg, const QString& arg )
94{
95 QCopEnvelope e( "QPE/Desktop", msg );
96 e << arg;
97}
diff --git a/core/launcher/packageslave.h b/core/launcher/packageslave.h
new file mode 100644
index 0000000..036abed
--- a/dev/null
+++ b/core/launcher/packageslave.h
@@ -0,0 +1,52 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#ifndef __packageslave_h__
22#define __packageslave_h__
23
24#include <qobject.h>
25
26class QCopChannel;
27
28class PackageSlave : public QObject
29{
30 Q_OBJECT
31
32public:
33 PackageSlave( QObject *parent, char* name = 0 );
34
35protected:
36 void installPackage( const QString &package );
37 void removePackage( const QString &package );
38
39protected slots:
40 void qcopMessage( const QCString &msg, const QByteArray &data );
41
42private:
43 void sendReply( const QCString& msg, const QString& arg );
44
45private:
46 QCopChannel *packageChannel;
47};
48
49
50#endif // __QUICK_LAUNCHER_H__
51
52
diff --git a/core/launcher/qcopbridge.cpp b/core/launcher/qcopbridge.cpp
new file mode 100644
index 0000000..c78e827
--- a/dev/null
+++ b/core/launcher/qcopbridge.cpp
@@ -0,0 +1,416 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include "qcopbridge.h"
22#include "transferserver.h"
23
24#include <qpe/qcopenvelope_qws.h>
25#include <qpe/qpeapplication.h>
26
27#include <qdir.h>
28#include <qfile.h>
29#include <qtextstream.h>
30#include <qdatastream.h>
31#include <qstringlist.h>
32#include <qfileinfo.h>
33#include <qregexp.h>
34#include <qcopchannel_qws.h>
35
36#define _XOPEN_SOURCE
37#include <pwd.h>
38#include <sys/types.h>
39#include <unistd.h>
40
41#if defined(_OS_LINUX_)
42#include <shadow.h>
43#endif
44
45//#define INSECURE
46
47const int block_size = 51200;
48
49QCopBridge::QCopBridge( Q_UINT16 port, QObject *parent = 0,
50 const char* name = 0)
51 : QServerSocket( port, 1, parent, name ),
52 desktopChannel( 0 ),
53 cardChannel( 0 )
54{
55 if ( !ok() )
56 qWarning( "Failed to bind to port %d", port );
57 else {
58 desktopChannel = new QCopChannel( "QPE/Desktop", this );
59 connect( desktopChannel, SIGNAL(received(const QCString &, const QByteArray &)),
60 this, SLOT(desktopMessage( const QCString &, const QByteArray &)) );
61 cardChannel = new QCopChannel( "QPE/Card", this );
62 connect( cardChannel, SIGNAL(received(const QCString &, const QByteArray &)),
63 this, SLOT(desktopMessage( const QCString &, const QByteArray &)) );
64 }
65 sendSync = FALSE;
66}
67
68QCopBridge::~QCopBridge()
69{
70 delete desktopChannel;
71}
72
73void QCopBridge::newConnection( int socket )
74{
75 QCopBridgePI *pi = new QCopBridgePI( socket, this );
76 openConnections.append( pi );
77 connect ( pi, SIGNAL( connectionClosed( QCopBridgePI *) ), this, SLOT( connectionClosed( QCopBridgePI *) ) );
78 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend;
79
80 if ( sendSync ) {
81 pi ->startSync();
82 sendSync = FALSE;
83 }
84}
85
86void QCopBridge::connectionClosed( QCopBridgePI *pi )
87{
88 openConnections.remove( pi );
89 if ( openConnections.count() == 0 ) {
90 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
91 }
92}
93
94void QCopBridge::closeOpenConnections()
95{
96 QCopBridgePI *pi;
97 for ( pi = openConnections.first(); pi != 0; pi = openConnections.next() )
98 pi->close();
99}
100
101
102void QCopBridge::desktopMessage( const QCString &command, const QByteArray &args )
103{
104 command.stripWhiteSpace();
105
106 int paren = command.find( "(" );
107 if ( paren <= 0 ) {
108 qDebug("DesktopMessage: bad qcop syntax");
109 return;
110 }
111
112 QString params = command.mid( paren + 1 );
113 if ( params[params.length()-1] != ')' ) {
114 qDebug("DesktopMessage: bad qcop syntax");
115 return;
116 }
117
118 params.truncate( params.length()-1 );
119
120 QStringList paramList = QStringList::split( ",", params );
121 QString data;
122 if ( paramList.count() ) {
123 QDataStream stream( args, IO_ReadOnly );
124 for ( QStringList::Iterator it = paramList.begin(); it != paramList.end(); ++it ) {
125 QString str;
126 if ( *it == "QString" ) {
127 stream >> str;
128 } else if ( *it == "QCString" ) {
129 QCString cstr;
130 stream >> cstr;
131 str = QString::fromLocal8Bit( cstr );
132 } else if ( *it == "int" ) {
133 int i;
134 stream >> i;
135 str = QString::number( i );
136 } else if ( *it == "bool" ) {
137 int i;
138 stream >> i;
139 str = QString::number( i );
140 } else {
141 qDebug(" cannot route the argument type %s throught the qcop bridge", (*it).latin1() );
142 return;
143 }
144 str.replace( QRegExp("&"), "&amp;" );
145 str.replace( QRegExp(" "), "&0x20;" );
146 str.replace( QRegExp("\n"), "&0x0d;" );
147 str.replace( QRegExp("\r"), "&0x0a;" );
148 data += " " + str;
149 }
150 }
151 QString sendCommand = QString(command.data()) + data;
152 // send the command to all open connections
153 if ( command == "startSync()" ) {
154 // we need to buffer it a bit
155 sendSync = TRUE;
156 startTimer( 20000 );
157 }
158
159 QCopBridgePI *pi;
160 for ( pi = openConnections.first(); pi != 0; pi = openConnections.next() ) {
161 pi->sendDesktopMessage( sendCommand );
162 }
163}
164
165void QCopBridge::timerEvent( QTimerEvent * )
166{
167 sendSync = FALSE;
168 killTimers();
169}
170
171
172QCopBridgePI::QCopBridgePI( int socket, QObject *parent = 0, const char* name = 0 )
173 : QSocket( parent, name )
174{
175 setSocket( socket );
176
177 peerport = peerPort();
178 peeraddress = peerAddress();
179
180#ifndef INSECURE
181 if ( !accessAuthorized(peeraddress) ) {
182 state = Forbidden;
183 startTimer( 0 );
184 } else
185 #endif
186 {
187 state = Connected;
188 sendSync = FALSE;
189 connect( this, SIGNAL( readyRead() ), SLOT( read() ) );
190 connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) );
191
192 send( "220 Qtopia QCop bridge ready!" );
193 state = Wait_USER;
194
195 // idle timer to close connections when not used anymore
196 startTimer( 60000 );
197 connected = TRUE;
198 }
199}
200
201
202QCopBridgePI::~QCopBridgePI()
203{
204
205}
206
207void QCopBridgePI::connectionClosed()
208{
209 emit connectionClosed( this );
210 // qDebug( "Debug: Connection closed" );
211 delete this;
212}
213
214void QCopBridgePI::sendDesktopMessage( const QString &msg )
215{
216 QString str = "CALL QPE/Desktop " + msg;
217 send ( str );
218}
219
220
221void QCopBridgePI::send( const QString& msg )
222{
223 QTextStream os( this );
224 os << msg << endl;
225 //qDebug( "sending qcop message: %s", msg.latin1() );
226}
227
228void QCopBridgePI::read()
229{
230 while ( canReadLine() )
231 process( readLine().stripWhiteSpace() );
232}
233
234bool QCopBridgePI::checkUser( const QString& user )
235{
236 if ( user.isEmpty() ) return FALSE;
237
238 struct passwd *pw;
239 pw = getpwuid( geteuid() );
240 QString euser = QString::fromLocal8Bit( pw->pw_name );
241 return user == euser;
242}
243
244bool QCopBridgePI::checkPassword( const QString& password )
245{
246 // ### HACK for testing on local host
247 return true;
248
249 /*
250 struct passwd *pw = 0;
251 struct spwd *spw = 0;
252
253 pw = getpwuid( geteuid() );
254 spw = getspnam( pw->pw_name );
255
256 QString cpwd = QString::fromLocal8Bit( pw->pw_passwd );
257 if ( cpwd == "x" && spw )
258 cpwd = QString::fromLocal8Bit( spw->sp_pwdp );
259
260 QString cpassword = QString::fromLocal8Bit( crypt( password.local8Bit(), cpwd.local8Bit() ) );
261 return cpwd == cpassword;
262*/
263}
264
265void QCopBridgePI::process( const QString& message )
266{
267 //qDebug( "Command: %s", message.latin1() );
268
269 // split message using "," as separator
270 QStringList msg = QStringList::split( " ", message );
271 if ( msg.isEmpty() ) return;
272
273 // command token
274 QString cmd = msg[0].upper();
275
276 // argument token
277 QString arg;
278 if ( msg.count() >= 2 )
279 arg = msg[1];
280
281 // we always respond to QUIT, regardless of state
282 if ( cmd == "QUIT" ) {
283 send( "211 Have a nice day!" );
284 delete this;
285 return;
286 }
287
288 // connected to client
289 if ( Connected == state )
290 return;
291
292 // waiting for user name
293 if ( Wait_USER == state ) {
294
295 if ( cmd != "USER" || msg.count() < 2 || !checkUser( arg ) ) {
296 send( "530 Please login with USER and PASS" );
297 return;
298 }
299 send( "331 User name ok, need password" );
300 state = Wait_PASS;
301 return;
302 }
303
304 // waiting for password
305 if ( Wait_PASS == state ) {
306
307 if ( cmd != "PASS" || !checkPassword( arg ) ) {
308 //if ( cmd != "PASS" || msg.count() < 2 || !checkPassword( arg ) ) {
309 send( "530 Please login with USER and PASS" );
310 return;
311 }
312 send( "230 User logged in, proceed" );
313 state = Ready;
314 if ( sendSync ) {
315 sendDesktopMessage( "startSync()" );
316 sendSync = FALSE;
317 }
318 return;
319 }
320
321 // noop (NOOP)
322 else if ( cmd == "NOOP" ) {
323 connected = TRUE;
324 send( "200 Command okay" );
325 }
326
327 // call (CALL)
328 else if ( cmd == "CALL" ) {
329
330 // example: call QPE/System execute(QString) addressbook
331
332 if ( msg.count() < 3 ) {
333 send( "500 Syntax error, command unrecognized" );
334 }
335 else {
336
337 QString channel = msg[1];
338 QString command = msg[2];
339
340 command.stripWhiteSpace();
341
342 int paren = command.find( "(" );
343 if ( paren <= 0 ) {
344 send( "500 Syntax error, command unrecognized" );
345 return;
346 }
347
348 QString params = command.mid( paren + 1 );
349 if ( params[params.length()-1] != ')' ) {
350 send( "500 Syntax error, command unrecognized" );
351 return;
352 }
353
354 params.truncate( params.length()-1 );
355 QByteArray buffer;
356 QDataStream ds( buffer, IO_WriteOnly );
357
358 int msgId = 3;
359
360 QStringList paramList = QStringList::split( ",", params );
361 if ( paramList.count() > msg.count() - 3 ) {
362 send( "500 Syntax error, command unrecognized" );
363 return;
364 }
365
366 for ( QStringList::Iterator it = paramList.begin(); it != paramList.end(); ++it ) {
367
368 QString arg = msg[msgId];
369 arg.replace( QRegExp("&0x20;"), " " );
370 arg.replace( QRegExp("&amp;"), "&" );
371 arg.replace( QRegExp("&0x0d;"), "\n" );
372 arg.replace( QRegExp("&0x0a;"), "\r" );
373 if ( *it == "QString" )
374 ds << arg;
375 else if ( *it == "QCString" )
376 ds << arg.local8Bit();
377 else if ( *it == "int" )
378 ds << arg.toInt();
379 else if ( *it == "bool" )
380 ds << arg.toInt();
381 else {
382 send( "500 Syntax error, command unrecognized" );
383 return;
384 }
385 msgId++;
386 }
387
388 if ( !QCopChannel::isRegistered( channel.latin1() ) ) {
389 // send message back about it
390 QString answer = "599 ChannelNotRegistered " + channel;
391 send( answer );
392 return;
393 }
394
395 if ( paramList.count() )
396 QCopChannel::send( channel.latin1(), command.latin1(), buffer );
397 else
398 QCopChannel::send( channel.latin1(), command.latin1() );
399
400 send( "200 Command okay" );
401 }
402 }
403 // not implemented
404 else
405 send( "502 Command not implemented" );
406}
407
408
409
410void QCopBridgePI::timerEvent( QTimerEvent * )
411{
412 if ( connected )
413 connected = FALSE;
414 else
415 connectionClosed();
416}
diff --git a/core/launcher/qcopbridge.h b/core/launcher/qcopbridge.h
new file mode 100644
index 0000000..114b3ee
--- a/dev/null
+++ b/core/launcher/qcopbridge.h
@@ -0,0 +1,95 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#ifndef __qcopbridge_h__
21#define __qcopbridge_h__
22
23#include <qserversocket.h>
24#include <qsocket.h>
25#include <qdir.h>
26#include <qfile.h>
27#include <qbuffer.h>
28
29class QFileInfo;
30class QCopBridgePI;
31class QCopChannel;
32
33class QCopBridge : public QServerSocket
34{
35 Q_OBJECT
36
37public:
38 QCopBridge( Q_UINT16 port, QObject *parent = 0, const char* name = 0 );
39 virtual ~QCopBridge();
40
41 void newConnection( int socket );
42 void closeOpenConnections();
43
44public slots:
45 void connectionClosed( QCopBridgePI *pi );
46 void desktopMessage( const QCString &call, const QByteArray & );
47
48protected:
49 void timerEvent( QTimerEvent * );
50
51private:
52 QCopChannel *desktopChannel;
53 QCopChannel *cardChannel;
54 QList<QCopBridgePI> openConnections;
55 bool sendSync;
56};
57
58
59class QCopBridgePI : public QSocket
60{
61 Q_OBJECT
62
63 enum State { Connected, Wait_USER, Wait_PASS, Ready, Forbidden };
64
65public:
66 QCopBridgePI( int socket, QObject *parent = 0, const char* name = 0 );
67 virtual ~QCopBridgePI();
68
69 void sendDesktopMessage( const QString &msg );
70 void startSync() { sendSync = TRUE; }
71
72signals:
73 void connectionClosed( QCopBridgePI *);
74
75protected slots:
76 void read();
77 void send( const QString& msg );
78 void process( const QString& command );
79 void connectionClosed();
80
81protected:
82 bool checkUser( const QString& user );
83 bool checkPassword( const QString& pw );
84
85 void timerEvent( QTimerEvent *e );
86
87private:
88 State state;
89 Q_UINT16 peerport;
90 QHostAddress peeraddress;
91 bool connected;
92 bool sendSync;
93};
94
95#endif
diff --git a/core/launcher/qpe-taskbar.control b/core/launcher/qpe-taskbar.control
new file mode 100644
index 0000000..f78f136
--- a/dev/null
+++ b/core/launcher/qpe-taskbar.control
@@ -0,0 +1,9 @@
1Files: bin/qpe apps/Settings/Calibrate.desktop
2Priority: required
3Section: qpe/system
4Maintainer: Warwick Allison <warwick@trolltech.com>
5Architecture: arm
6Version: $QPE_VERSION-3
7Depends: qt-embedded (>=$QTE_VERSION)
8Description: Launcher for QPE
9 The "finder" or "explorer", or whatever you want to call it.
diff --git a/core/launcher/quicklauncher.cpp b/core/launcher/quicklauncher.cpp
new file mode 100644
index 0000000..925b3b5
--- a/dev/null
+++ b/core/launcher/quicklauncher.cpp
@@ -0,0 +1,49 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include <qapplication.h>
22#include <qlayout.h>
23#include <qpushbutton.h>
24#include <applnk.h>
25#include <resource.h>
26#include "quicklauncher.h"
27
28
29void QuickLauncher::addLauncherButton( AppLnk *appLnk )
30{
31 QPushButton *pb = new QPushButton( this );
32 // It's no a QObject anymore
33 //pb->connect( pb, SIGNAL( clicked( ) ), appLnk, SLOT( execute() ) );
34 pb->setPixmap( appLnk->pixmap() );
35 pb->setFocusPolicy( QWidget::NoFocus );
36 pb->setFlat( TRUE );
37 pb->setFixedSize( 18, 18 );
38}
39
40
41QuickLauncher::QuickLauncher( QWidget *parent ) : QHBox( parent )
42{
43// Example usage to add icons to the quick launcher area
44// addLauncherButton( "filebrowser_icon", "filebrowser" );
45// addLauncherButton( "textedit_icon", "textedit" );
46// addLauncherButton( "help_icon", "helpbrowser" );
47}
48
49
diff --git a/core/launcher/quicklauncher.h b/core/launcher/quicklauncher.h
new file mode 100644
index 0000000..92c6c66
--- a/dev/null
+++ b/core/launcher/quicklauncher.h
@@ -0,0 +1,40 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#ifndef __QUICK_LAUNCHER_H__
22#define __QUICK_LAUNCHER_H__
23
24
25#include <qhbox.h>
26
27class AppLnk;
28
29
30class QuickLauncher : public QHBox {
31 Q_OBJECT
32public:
33 QuickLauncher( QWidget *parent );
34 void addLauncherButton( AppLnk * );
35};
36
37
38#endif // __QUICK_LAUNCHER_H__
39
40
diff --git a/core/launcher/shutdown.ui b/core/launcher/shutdown.ui
new file mode 100644
index 0000000..0023427
--- a/dev/null
+++ b/core/launcher/shutdown.ui
@@ -0,0 +1,1323 @@
1<!DOCTYPE UI><UI>
2<class>Shutdown</class>
3<widget>
4 <class>QWidget</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>Form1</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>437</width>
15 <height>465</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Shut down...</string>
21 </property>
22 <property>
23 <name>layoutMargin</name>
24 </property>
25 <property>
26 <name>layoutSpacing</name>
27 </property>
28 <vbox>
29 <property stdset="1">
30 <name>margin</name>
31 <number>6</number>
32 </property>
33 <property stdset="1">
34 <name>spacing</name>
35 <number>3</number>
36 </property>
37 <widget>
38 <class>QButtonGroup</class>
39 <property stdset="1">
40 <name>name</name>
41 <cstring>ButtonGroup1</cstring>
42 </property>
43 <property stdset="1">
44 <name>title</name>
45 <string>Terminate</string>
46 </property>
47 <property>
48 <name>layoutMargin</name>
49 </property>
50 <property>
51 <name>layoutSpacing</name>
52 </property>
53 <grid>
54 <property stdset="1">
55 <name>margin</name>
56 <number>7</number>
57 </property>
58 <property stdset="1">
59 <name>spacing</name>
60 <number>3</number>
61 </property>
62 <widget row="1" column="1" >
63 <class>QPushButton</class>
64 <property stdset="1">
65 <name>name</name>
66 <cstring>quit</cstring>
67 </property>
68 <property stdset="1">
69 <name>sizePolicy</name>
70 <sizepolicy>
71 <hsizetype>3</hsizetype>
72 <vsizetype>0</vsizetype>
73 </sizepolicy>
74 </property>
75 <property stdset="1">
76 <name>palette</name>
77 <palette>
78 <active>
79 <color>
80 <red>0</red>
81 <green>0</green>
82 <blue>0</blue>
83 </color>
84 <color>
85 <red>236</red>
86 <green>236</green>
87 <blue>179</blue>
88 </color>
89 <color>
90 <red>255</red>
91 <green>255</green>
92 <blue>255</blue>
93 </color>
94 <color>
95 <red>245</red>
96 <green>245</green>
97 <blue>217</blue>
98 </color>
99 <color>
100 <red>118</red>
101 <green>118</green>
102 <blue>89</blue>
103 </color>
104 <color>
105 <red>157</red>
106 <green>157</green>
107 <blue>119</blue>
108 </color>
109 <color>
110 <red>0</red>
111 <green>0</green>
112 <blue>0</blue>
113 </color>
114 <color>
115 <red>255</red>
116 <green>255</green>
117 <blue>255</blue>
118 </color>
119 <color>
120 <red>0</red>
121 <green>0</green>
122 <blue>0</blue>
123 </color>
124 <color>
125 <red>255</red>
126 <green>255</green>
127 <blue>255</blue>
128 </color>
129 <color>
130 <red>222</red>
131 <green>222</green>
132 <blue>222</blue>
133 </color>
134 <color>
135 <red>0</red>
136 <green>0</green>
137 <blue>0</blue>
138 </color>
139 <color>
140 <red>0</red>
141 <green>0</green>
142 <blue>128</blue>
143 </color>
144 <color>
145 <red>255</red>
146 <green>255</green>
147 <blue>255</blue>
148 </color>
149 </active>
150 <disabled>
151 <color>
152 <red>128</red>
153 <green>128</green>
154 <blue>128</blue>
155 </color>
156 <color>
157 <red>236</red>
158 <green>236</green>
159 <blue>179</blue>
160 </color>
161 <color>
162 <red>255</red>
163 <green>255</green>
164 <blue>255</blue>
165 </color>
166 <color>
167 <red>255</red>
168 <green>255</green>
169 <blue>209</blue>
170 </color>
171 <color>
172 <red>118</red>
173 <green>118</green>
174 <blue>89</blue>
175 </color>
176 <color>
177 <red>157</red>
178 <green>157</green>
179 <blue>119</blue>
180 </color>
181 <color>
182 <red>128</red>
183 <green>128</green>
184 <blue>128</blue>
185 </color>
186 <color>
187 <red>255</red>
188 <green>255</green>
189 <blue>255</blue>
190 </color>
191 <color>
192 <red>128</red>
193 <green>128</green>
194 <blue>128</blue>
195 </color>
196 <color>
197 <red>255</red>
198 <green>255</green>
199 <blue>255</blue>
200 </color>
201 <color>
202 <red>222</red>
203 <green>222</green>
204 <blue>222</blue>
205 </color>
206 <color>
207 <red>0</red>
208 <green>0</green>
209 <blue>0</blue>
210 </color>
211 <color>
212 <red>0</red>
213 <green>0</green>
214 <blue>128</blue>
215 </color>
216 <color>
217 <red>255</red>
218 <green>255</green>
219 <blue>255</blue>
220 </color>
221 </disabled>
222 <inactive>
223 <color>
224 <red>0</red>
225 <green>0</green>
226 <blue>0</blue>
227 </color>
228 <color>
229 <red>236</red>
230 <green>236</green>
231 <blue>179</blue>
232 </color>
233 <color>
234 <red>255</red>
235 <green>255</green>
236 <blue>255</blue>
237 </color>
238 <color>
239 <red>255</red>
240 <green>255</green>
241 <blue>209</blue>
242 </color>
243 <color>
244 <red>118</red>
245 <green>118</green>
246 <blue>89</blue>
247 </color>
248 <color>
249 <red>157</red>
250 <green>157</green>
251 <blue>119</blue>
252 </color>
253 <color>
254 <red>0</red>
255 <green>0</green>
256 <blue>0</blue>
257 </color>
258 <color>
259 <red>255</red>
260 <green>255</green>
261 <blue>255</blue>
262 </color>
263 <color>
264 <red>0</red>
265 <green>0</green>
266 <blue>0</blue>
267 </color>
268 <color>
269 <red>255</red>
270 <green>255</green>
271 <blue>255</blue>
272 </color>
273 <color>
274 <red>222</red>
275 <green>222</green>
276 <blue>222</blue>
277 </color>
278 <color>
279 <red>0</red>
280 <green>0</green>
281 <blue>0</blue>
282 </color>
283 <color>
284 <red>0</red>
285 <green>0</green>
286 <blue>128</blue>
287 </color>
288 <color>
289 <red>255</red>
290 <green>255</green>
291 <blue>255</blue>
292 </color>
293 </inactive>
294 </palette>
295 </property>
296 <property stdset="1">
297 <name>text</name>
298 <string>Terminate Server</string>
299 </property>
300 <property stdset="1">
301 <name>buttonGroupId</name>
302 <number>4</number>
303 </property>
304 </widget>
305 <widget row="1" column="0" >
306 <class>QPushButton</class>
307 <property stdset="1">
308 <name>name</name>
309 <cstring>reboot</cstring>
310 </property>
311 <property stdset="1">
312 <name>sizePolicy</name>
313 <sizepolicy>
314 <hsizetype>3</hsizetype>
315 <vsizetype>0</vsizetype>
316 </sizepolicy>
317 </property>
318 <property stdset="1">
319 <name>palette</name>
320 <palette>
321 <active>
322 <color>
323 <red>0</red>
324 <green>0</green>
325 <blue>0</blue>
326 </color>
327 <color>
328 <red>236</red>
329 <green>183</green>
330 <blue>181</blue>
331 </color>
332 <color>
333 <red>255</red>
334 <green>255</green>
335 <blue>255</blue>
336 </color>
337 <color>
338 <red>245</red>
339 <green>219</green>
340 <blue>218</blue>
341 </color>
342 <color>
343 <red>118</red>
344 <green>92</green>
345 <blue>91</blue>
346 </color>
347 <color>
348 <red>157</red>
349 <green>122</green>
350 <blue>121</blue>
351 </color>
352 <color>
353 <red>0</red>
354 <green>0</green>
355 <blue>0</blue>
356 </color>
357 <color>
358 <red>255</red>
359 <green>255</green>
360 <blue>255</blue>
361 </color>
362 <color>
363 <red>0</red>
364 <green>0</green>
365 <blue>0</blue>
366 </color>
367 <color>
368 <red>255</red>
369 <green>255</green>
370 <blue>255</blue>
371 </color>
372 <color>
373 <red>222</red>
374 <green>222</green>
375 <blue>222</blue>
376 </color>
377 <color>
378 <red>0</red>
379 <green>0</green>
380 <blue>0</blue>
381 </color>
382 <color>
383 <red>0</red>
384 <green>0</green>
385 <blue>128</blue>
386 </color>
387 <color>
388 <red>255</red>
389 <green>255</green>
390 <blue>255</blue>
391 </color>
392 </active>
393 <disabled>
394 <color>
395 <red>128</red>
396 <green>128</green>
397 <blue>128</blue>
398 </color>
399 <color>
400 <red>236</red>
401 <green>183</green>
402 <blue>181</blue>
403 </color>
404 <color>
405 <red>255</red>
406 <green>255</green>
407 <blue>255</blue>
408 </color>
409 <color>
410 <red>255</red>
411 <green>213</green>
412 <blue>212</blue>
413 </color>
414 <color>
415 <red>118</red>
416 <green>92</green>
417 <blue>91</blue>
418 </color>
419 <color>
420 <red>157</red>
421 <green>122</green>
422 <blue>121</blue>
423 </color>
424 <color>
425 <red>128</red>
426 <green>128</green>
427 <blue>128</blue>
428 </color>
429 <color>
430 <red>255</red>
431 <green>255</green>
432 <blue>255</blue>
433 </color>
434 <color>
435 <red>128</red>
436 <green>128</green>
437 <blue>128</blue>
438 </color>
439 <color>
440 <red>255</red>
441 <green>255</green>
442 <blue>255</blue>
443 </color>
444 <color>
445 <red>222</red>
446 <green>222</green>
447 <blue>222</blue>
448 </color>
449 <color>
450 <red>0</red>
451 <green>0</green>
452 <blue>0</blue>
453 </color>
454 <color>
455 <red>0</red>
456 <green>0</green>
457 <blue>128</blue>
458 </color>
459 <color>
460 <red>255</red>
461 <green>255</green>
462 <blue>255</blue>
463 </color>
464 </disabled>
465 <inactive>
466 <color>
467 <red>0</red>
468 <green>0</green>
469 <blue>0</blue>
470 </color>
471 <color>
472 <red>236</red>
473 <green>183</green>
474 <blue>181</blue>
475 </color>
476 <color>
477 <red>255</red>
478 <green>255</green>
479 <blue>255</blue>
480 </color>
481 <color>
482 <red>255</red>
483 <green>213</green>
484 <blue>212</blue>
485 </color>
486 <color>
487 <red>118</red>
488 <green>92</green>
489 <blue>91</blue>
490 </color>
491 <color>
492 <red>157</red>
493 <green>122</green>
494 <blue>121</blue>
495 </color>
496 <color>
497 <red>0</red>
498 <green>0</green>
499 <blue>0</blue>
500 </color>
501 <color>
502 <red>255</red>
503 <green>255</green>
504 <blue>255</blue>
505 </color>
506 <color>
507 <red>0</red>
508 <green>0</green>
509 <blue>0</blue>
510 </color>
511 <color>
512 <red>255</red>
513 <green>255</green>
514 <blue>255</blue>
515 </color>
516 <color>
517 <red>222</red>
518 <green>222</green>
519 <blue>222</blue>
520 </color>
521 <color>
522 <red>0</red>
523 <green>0</green>
524 <blue>0</blue>
525 </color>
526 <color>
527 <red>0</red>
528 <green>0</green>
529 <blue>128</blue>
530 </color>
531 <color>
532 <red>255</red>
533 <green>255</green>
534 <blue>255</blue>
535 </color>
536 </inactive>
537 </palette>
538 </property>
539 <property stdset="1">
540 <name>text</name>
541 <string>Reboot</string>
542 </property>
543 <property stdset="1">
544 <name>buttonGroupId</name>
545 <number>2</number>
546 </property>
547 </widget>
548 <widget row="0" column="1" >
549 <class>QPushButton</class>
550 <property stdset="1">
551 <name>name</name>
552 <cstring>restart</cstring>
553 </property>
554 <property stdset="1">
555 <name>palette</name>
556 <palette>
557 <active>
558 <color>
559 <red>0</red>
560 <green>0</green>
561 <blue>0</blue>
562 </color>
563 <color>
564 <red>236</red>
565 <green>236</green>
566 <blue>179</blue>
567 </color>
568 <color>
569 <red>255</red>
570 <green>255</green>
571 <blue>255</blue>
572 </color>
573 <color>
574 <red>245</red>
575 <green>245</green>
576 <blue>217</blue>
577 </color>
578 <color>
579 <red>118</red>
580 <green>118</green>
581 <blue>89</blue>
582 </color>
583 <color>
584 <red>157</red>
585 <green>157</green>
586 <blue>119</blue>
587 </color>
588 <color>
589 <red>0</red>
590 <green>0</green>
591 <blue>0</blue>
592 </color>
593 <color>
594 <red>255</red>
595 <green>255</green>
596 <blue>255</blue>
597 </color>
598 <color>
599 <red>0</red>
600 <green>0</green>
601 <blue>0</blue>
602 </color>
603 <color>
604 <red>255</red>
605 <green>255</green>
606 <blue>255</blue>
607 </color>
608 <color>
609 <red>222</red>
610 <green>222</green>
611 <blue>222</blue>
612 </color>
613 <color>
614 <red>0</red>
615 <green>0</green>
616 <blue>0</blue>
617 </color>
618 <color>
619 <red>0</red>
620 <green>0</green>
621 <blue>128</blue>
622 </color>
623 <color>
624 <red>255</red>
625 <green>255</green>
626 <blue>255</blue>
627 </color>
628 </active>
629 <disabled>
630 <color>
631 <red>128</red>
632 <green>128</green>
633 <blue>128</blue>
634 </color>
635 <color>
636 <red>236</red>
637 <green>236</green>
638 <blue>179</blue>
639 </color>
640 <color>
641 <red>255</red>
642 <green>255</green>
643 <blue>255</blue>
644 </color>
645 <color>
646 <red>255</red>
647 <green>255</green>
648 <blue>209</blue>
649 </color>
650 <color>
651 <red>118</red>
652 <green>118</green>
653 <blue>89</blue>
654 </color>
655 <color>
656 <red>157</red>
657 <green>157</green>
658 <blue>119</blue>
659 </color>
660 <color>
661 <red>128</red>
662 <green>128</green>
663 <blue>128</blue>
664 </color>
665 <color>
666 <red>255</red>
667 <green>255</green>
668 <blue>255</blue>
669 </color>
670 <color>
671 <red>128</red>
672 <green>128</green>
673 <blue>128</blue>
674 </color>
675 <color>
676 <red>255</red>
677 <green>255</green>
678 <blue>255</blue>
679 </color>
680 <color>
681 <red>222</red>
682 <green>222</green>
683 <blue>222</blue>
684 </color>
685 <color>
686 <red>0</red>
687 <green>0</green>
688 <blue>0</blue>
689 </color>
690 <color>
691 <red>0</red>
692 <green>0</green>
693 <blue>128</blue>
694 </color>
695 <color>
696 <red>255</red>
697 <green>255</green>
698 <blue>255</blue>
699 </color>
700 </disabled>
701 <inactive>
702 <color>
703 <red>0</red>
704 <green>0</green>
705 <blue>0</blue>
706 </color>
707 <color>
708 <red>236</red>
709 <green>236</green>
710 <blue>179</blue>
711 </color>
712 <color>
713 <red>255</red>
714 <green>255</green>
715 <blue>255</blue>
716 </color>
717 <color>
718 <red>255</red>
719 <green>255</green>
720 <blue>209</blue>
721 </color>
722 <color>
723 <red>118</red>
724 <green>118</green>
725 <blue>89</blue>
726 </color>
727 <color>
728 <red>157</red>
729 <green>157</green>
730 <blue>119</blue>
731 </color>
732 <color>
733 <red>0</red>
734 <green>0</green>
735 <blue>0</blue>
736 </color>
737 <color>
738 <red>255</red>
739 <green>255</green>
740 <blue>255</blue>
741 </color>
742 <color>
743 <red>0</red>
744 <green>0</green>
745 <blue>0</blue>
746 </color>
747 <color>
748 <red>255</red>
749 <green>255</green>
750 <blue>255</blue>
751 </color>
752 <color>
753 <red>222</red>
754 <green>222</green>
755 <blue>222</blue>
756 </color>
757 <color>
758 <red>0</red>
759 <green>0</green>
760 <blue>0</blue>
761 </color>
762 <color>
763 <red>0</red>
764 <green>0</green>
765 <blue>128</blue>
766 </color>
767 <color>
768 <red>255</red>
769 <green>255</green>
770 <blue>255</blue>
771 </color>
772 </inactive>
773 </palette>
774 </property>
775 <property stdset="1">
776 <name>text</name>
777 <string>Restart Server</string>
778 </property>
779 <property stdset="1">
780 <name>buttonGroupId</name>
781 <number>3</number>
782 </property>
783 </widget>
784 <widget row="0" column="0" >
785 <class>QPushButton</class>
786 <property stdset="1">
787 <name>name</name>
788 <cstring>shutdown</cstring>
789 </property>
790 <property stdset="1">
791 <name>palette</name>
792 <palette>
793 <active>
794 <color>
795 <red>0</red>
796 <green>0</green>
797 <blue>0</blue>
798 </color>
799 <color>
800 <red>236</red>
801 <green>183</green>
802 <blue>181</blue>
803 </color>
804 <color>
805 <red>255</red>
806 <green>255</green>
807 <blue>255</blue>
808 </color>
809 <color>
810 <red>245</red>
811 <green>219</green>
812 <blue>218</blue>
813 </color>
814 <color>
815 <red>118</red>
816 <green>92</green>
817 <blue>91</blue>
818 </color>
819 <color>
820 <red>157</red>
821 <green>122</green>
822 <blue>121</blue>
823 </color>
824 <color>
825 <red>0</red>
826 <green>0</green>
827 <blue>0</blue>
828 </color>
829 <color>
830 <red>255</red>
831 <green>255</green>
832 <blue>255</blue>
833 </color>
834 <color>
835 <red>0</red>
836 <green>0</green>
837 <blue>0</blue>
838 </color>
839 <color>
840 <red>255</red>
841 <green>255</green>
842 <blue>255</blue>
843 </color>
844 <color>
845 <red>222</red>
846 <green>222</green>
847 <blue>222</blue>
848 </color>
849 <color>
850 <red>0</red>
851 <green>0</green>
852 <blue>0</blue>
853 </color>
854 <color>
855 <red>0</red>
856 <green>0</green>
857 <blue>128</blue>
858 </color>
859 <color>
860 <red>255</red>
861 <green>255</green>
862 <blue>255</blue>
863 </color>
864 </active>
865 <disabled>
866 <color>
867 <red>128</red>
868 <green>128</green>
869 <blue>128</blue>
870 </color>
871 <color>
872 <red>236</red>
873 <green>183</green>
874 <blue>181</blue>
875 </color>
876 <color>
877 <red>255</red>
878 <green>255</green>
879 <blue>255</blue>
880 </color>
881 <color>
882 <red>255</red>
883 <green>213</green>
884 <blue>212</blue>
885 </color>
886 <color>
887 <red>118</red>
888 <green>92</green>
889 <blue>91</blue>
890 </color>
891 <color>
892 <red>157</red>
893 <green>122</green>
894 <blue>121</blue>
895 </color>
896 <color>
897 <red>128</red>
898 <green>128</green>
899 <blue>128</blue>
900 </color>
901 <color>
902 <red>255</red>
903 <green>255</green>
904 <blue>255</blue>
905 </color>
906 <color>
907 <red>128</red>
908 <green>128</green>
909 <blue>128</blue>
910 </color>
911 <color>
912 <red>255</red>
913 <green>255</green>
914 <blue>255</blue>
915 </color>
916 <color>
917 <red>222</red>
918 <green>222</green>
919 <blue>222</blue>
920 </color>
921 <color>
922 <red>0</red>
923 <green>0</green>
924 <blue>0</blue>
925 </color>
926 <color>
927 <red>0</red>
928 <green>0</green>
929 <blue>128</blue>
930 </color>
931 <color>
932 <red>255</red>
933 <green>255</green>
934 <blue>255</blue>
935 </color>
936 </disabled>
937 <inactive>
938 <color>
939 <red>0</red>
940 <green>0</green>
941 <blue>0</blue>
942 </color>
943 <color>
944 <red>236</red>
945 <green>183</green>
946 <blue>181</blue>
947 </color>
948 <color>
949 <red>255</red>
950 <green>255</green>
951 <blue>255</blue>
952 </color>
953 <color>
954 <red>255</red>
955 <green>213</green>
956 <blue>212</blue>
957 </color>
958 <color>
959 <red>118</red>
960 <green>92</green>
961 <blue>91</blue>
962 </color>
963 <color>
964 <red>157</red>
965 <green>122</green>
966 <blue>121</blue>
967 </color>
968 <color>
969 <red>0</red>
970 <green>0</green>
971 <blue>0</blue>
972 </color>
973 <color>
974 <red>255</red>
975 <green>255</green>
976 <blue>255</blue>
977 </color>
978 <color>
979 <red>0</red>
980 <green>0</green>
981 <blue>0</blue>
982 </color>
983 <color>
984 <red>255</red>
985 <green>255</green>
986 <blue>255</blue>
987 </color>
988 <color>
989 <red>222</red>
990 <green>222</green>
991 <blue>222</blue>
992 </color>
993 <color>
994 <red>0</red>
995 <green>0</green>
996 <blue>0</blue>
997 </color>
998 <color>
999 <red>0</red>
1000 <green>0</green>
1001 <blue>128</blue>
1002 </color>
1003 <color>
1004 <red>255</red>
1005 <green>255</green>
1006 <blue>255</blue>
1007 </color>
1008 </inactive>
1009 </palette>
1010 </property>
1011 <property stdset="1">
1012 <name>text</name>
1013 <string>Shutdown</string>
1014 </property>
1015 <property stdset="1">
1016 <name>buttonGroupId</name>
1017 <number>1</number>
1018 </property>
1019 </widget>
1020 </grid>
1021 </widget>
1022 <widget>
1023 <class>QLabel</class>
1024 <property stdset="1">
1025 <name>name</name>
1026 <cstring>info</cstring>
1027 </property>
1028 <property stdset="1">
1029 <name>text</name>
1030 <string>&lt;p&gt;
1031These termination options are provided primarily for use while developing and testing the Qtopia system. In a normal environment, these concepts are unnecessary.</string>
1032 </property>
1033 </widget>
1034 <widget>
1035 <class>QProgressBar</class>
1036 <property stdset="1">
1037 <name>name</name>
1038 <cstring>progressBar</cstring>
1039 </property>
1040 <property stdset="1">
1041 <name>frameShape</name>
1042 <enum>Panel</enum>
1043 </property>
1044 <property stdset="1">
1045 <name>frameShadow</name>
1046 <enum>Sunken</enum>
1047 </property>
1048 <property stdset="1">
1049 <name>totalSteps</name>
1050 <number>20</number>
1051 </property>
1052 <property stdset="1">
1053 <name>indicatorFollowsStyle</name>
1054 <bool>false</bool>
1055 </property>
1056 </widget>
1057 <spacer>
1058 <property>
1059 <name>name</name>
1060 <cstring>Spacer2</cstring>
1061 </property>
1062 <property stdset="1">
1063 <name>orientation</name>
1064 <enum>Vertical</enum>
1065 </property>
1066 <property stdset="1">
1067 <name>sizeType</name>
1068 <enum>Expanding</enum>
1069 </property>
1070 <property>
1071 <name>sizeHint</name>
1072 <size>
1073 <width>20</width>
1074 <height>20</height>
1075 </size>
1076 </property>
1077 </spacer>
1078 <widget>
1079 <class>QPushButton</class>
1080 <property stdset="1">
1081 <name>name</name>
1082 <cstring>cancel</cstring>
1083 </property>
1084 <property stdset="1">
1085 <name>sizePolicy</name>
1086 <sizepolicy>
1087 <hsizetype>1</hsizetype>
1088 <vsizetype>7</vsizetype>
1089 </sizepolicy>
1090 </property>
1091 <property stdset="1">
1092 <name>palette</name>
1093 <palette>
1094 <active>
1095 <color>
1096 <red>0</red>
1097 <green>0</green>
1098 <blue>0</blue>
1099 </color>
1100 <color>
1101 <red>181</red>
1102 <green>222</green>
1103 <blue>178</blue>
1104 </color>
1105 <color>
1106 <red>255</red>
1107 <green>255</green>
1108 <blue>255</blue>
1109 </color>
1110 <color>
1111 <red>218</red>
1112 <green>238</green>
1113 <blue>216</blue>
1114 </color>
1115 <color>
1116 <red>90</red>
1117 <green>111</green>
1118 <blue>89</blue>
1119 </color>
1120 <color>
1121 <red>120</red>
1122 <green>148</green>
1123 <blue>118</blue>
1124 </color>
1125 <color>
1126 <red>0</red>
1127 <green>0</green>
1128 <blue>0</blue>
1129 </color>
1130 <color>
1131 <red>255</red>
1132 <green>255</green>
1133 <blue>255</blue>
1134 </color>
1135 <color>
1136 <red>0</red>
1137 <green>0</green>
1138 <blue>0</blue>
1139 </color>
1140 <color>
1141 <red>255</red>
1142 <green>255</green>
1143 <blue>255</blue>
1144 </color>
1145 <color>
1146 <red>174</red>
1147 <green>222</green>
1148 <blue>158</blue>
1149 </color>
1150 <color>
1151 <red>0</red>
1152 <green>0</green>
1153 <blue>0</blue>
1154 </color>
1155 <color>
1156 <red>0</red>
1157 <green>0</green>
1158 <blue>128</blue>
1159 </color>
1160 <color>
1161 <red>255</red>
1162 <green>255</green>
1163 <blue>255</blue>
1164 </color>
1165 </active>
1166 <disabled>
1167 <color>
1168 <red>128</red>
1169 <green>128</green>
1170 <blue>128</blue>
1171 </color>
1172 <color>
1173 <red>181</red>
1174 <green>222</green>
1175 <blue>178</blue>
1176 </color>
1177 <color>
1178 <red>255</red>
1179 <green>255</green>
1180 <blue>255</blue>
1181 </color>
1182 <color>
1183 <red>207</red>
1184 <green>255</green>
1185 <blue>204</blue>
1186 </color>
1187 <color>
1188 <red>90</red>
1189 <green>111</green>
1190 <blue>89</blue>
1191 </color>
1192 <color>
1193 <red>120</red>
1194 <green>148</green>
1195 <blue>118</blue>
1196 </color>
1197 <color>
1198 <red>128</red>
1199 <green>128</green>
1200 <blue>128</blue>
1201 </color>
1202 <color>
1203 <red>255</red>
1204 <green>255</green>
1205 <blue>255</blue>
1206 </color>
1207 <color>
1208 <red>128</red>
1209 <green>128</green>
1210 <blue>128</blue>
1211 </color>
1212 <color>
1213 <red>255</red>
1214 <green>255</green>
1215 <blue>255</blue>
1216 </color>
1217 <color>
1218 <red>174</red>
1219 <green>222</green>
1220 <blue>158</blue>
1221 </color>
1222 <color>
1223 <red>0</red>
1224 <green>0</green>
1225 <blue>0</blue>
1226 </color>
1227 <color>
1228 <red>0</red>
1229 <green>0</green>
1230 <blue>128</blue>
1231 </color>
1232 <color>
1233 <red>255</red>
1234 <green>255</green>
1235 <blue>255</blue>
1236 </color>
1237 </disabled>
1238 <inactive>
1239 <color>
1240 <red>0</red>
1241 <green>0</green>
1242 <blue>0</blue>
1243 </color>
1244 <color>
1245 <red>181</red>
1246 <green>222</green>
1247 <blue>178</blue>
1248 </color>
1249 <color>
1250 <red>255</red>
1251 <green>255</green>
1252 <blue>255</blue>
1253 </color>
1254 <color>
1255 <red>207</red>
1256 <green>255</green>
1257 <blue>204</blue>
1258 </color>
1259 <color>
1260 <red>90</red>
1261 <green>111</green>
1262 <blue>89</blue>
1263 </color>
1264 <color>
1265 <red>120</red>
1266 <green>148</green>
1267 <blue>118</blue>
1268 </color>
1269 <color>
1270 <red>0</red>
1271 <green>0</green>
1272 <blue>0</blue>
1273 </color>
1274 <color>
1275 <red>255</red>
1276 <green>255</green>
1277 <blue>255</blue>
1278 </color>
1279 <color>
1280 <red>0</red>
1281 <green>0</green>
1282 <blue>0</blue>
1283 </color>
1284 <color>
1285 <red>255</red>
1286 <green>255</green>
1287 <blue>255</blue>
1288 </color>
1289 <color>
1290 <red>174</red>
1291 <green>222</green>
1292 <blue>158</blue>
1293 </color>
1294 <color>
1295 <red>0</red>
1296 <green>0</green>
1297 <blue>0</blue>
1298 </color>
1299 <color>
1300 <red>0</red>
1301 <green>0</green>
1302 <blue>128</blue>
1303 </color>
1304 <color>
1305 <red>255</red>
1306 <green>255</green>
1307 <blue>255</blue>
1308 </color>
1309 </inactive>
1310 </palette>
1311 </property>
1312 <property stdset="1">
1313 <name>text</name>
1314 <string>Cancel</string>
1315 </property>
1316 <property stdset="1">
1317 <name>default</name>
1318 <bool>true</bool>
1319 </property>
1320 </widget>
1321 </vbox>
1322</widget>
1323</UI>
diff --git a/core/launcher/shutdownimpl.cpp b/core/launcher/shutdownimpl.cpp
new file mode 100644
index 0000000..06ed756
--- a/dev/null
+++ b/core/launcher/shutdownimpl.cpp
@@ -0,0 +1,95 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include "shutdownimpl.h"
22
23#include <qpe/global.h>
24
25#include <qtimer.h>
26#include <qprogressbar.h>
27#include <qpushbutton.h>
28#include <qbuttongroup.h>
29#include <qlabel.h>
30
31
32
33#include <stdio.h>
34ShutdownImpl::ShutdownImpl( QWidget* parent, const char *name, WFlags fl )
35 : Shutdown( parent, name, fl )
36{
37 timer = new QTimer( this );
38 connect( timer, SIGNAL(timeout()), this, SLOT(timeout()) );
39
40 connect( ButtonGroup1, SIGNAL(clicked(int)), this, SLOT(buttonClicked(int)) );
41 connect( cancel, SIGNAL(clicked()), this, SLOT(cancelClicked()) );
42
43 progressBar->hide();
44 Global::hideInputMethod();
45#ifdef QT_QWS_CUSTOM
46 QPushButton *sb = Shutdown::shutdown;
47 sb->hide();
48#endif
49}
50
51void ShutdownImpl::buttonClicked( int b )
52{
53 progress = 0;
54 switch ( b ) {
55 case 1:
56 operation = ShutdownSystem;
57 break;
58 case 2:
59 operation = RebootSystem;
60 break;
61 case 3:
62 operation = RestartDesktop;
63 break;
64 case 4:
65 operation = TerminateDesktop;
66 break;
67 }
68 info->hide();
69 progressBar->show();
70 timer->start( 300 );
71 timeout();
72}
73
74void ShutdownImpl::cancelClicked()
75{
76 progressBar->hide();
77 info->show();
78 if ( timer->isActive() )
79 timer->stop();
80 else
81 close();
82}
83
84void ShutdownImpl::timeout()
85{
86 if ( (progress+=2) > progressBar->totalSteps() ) {
87 progressBar->hide();
88 timer->stop();
89 emit shutdown( operation );
90 } else {
91 progressBar->setProgress( progress );
92 }
93}
94
95
diff --git a/core/launcher/shutdownimpl.h b/core/launcher/shutdownimpl.h
new file mode 100644
index 0000000..54668f3
--- a/dev/null
+++ b/core/launcher/shutdownimpl.h
@@ -0,0 +1,50 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#ifndef SHUTDOWNIMPL_H
21#define SHUTDOWNIMPL_H
22
23#include "shutdown.h"
24
25class QTimer;
26
27class ShutdownImpl : public Shutdown
28{
29 Q_OBJECT
30public:
31 ShutdownImpl( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
32
33 enum Type { ShutdownSystem, RebootSystem, RestartDesktop, TerminateDesktop };
34
35signals:
36 void shutdown( ShutdownImpl::Type );
37
38private slots:
39 void buttonClicked( int );
40 void cancelClicked();
41 void timeout();
42
43private:
44 QTimer *timer;
45 int progress;
46 Type operation;
47};
48
49#endif
50
diff --git a/core/launcher/sidething.cpp b/core/launcher/sidething.cpp
new file mode 100644
index 0000000..821c9d5
--- a/dev/null
+++ b/core/launcher/sidething.cpp
@@ -0,0 +1,75 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include "sidething.h"
22
23#include <qpe/resource.h>
24
25#include <qrect.h>
26#include <qpopupmenu.h>
27#include <qpainter.h>
28
29
30void PopupWithLaunchSideThing::setFrameRect( const QRect &r )
31{
32 fr = r;
33 QPopupMenu::setFrameRect( r );
34}
35
36
37void PopupWithLaunchSideThing::paintEvent( QPaintEvent *event )
38{
39 QPainter paint( this );
40
41 if ( !contentsRect().contains( event->rect() ) ) {
42
43 QPopupMenu::setFrameRect( fr );
44 int oldLW = lineWidth();
45 setUpdatesEnabled(FALSE);
46 setLineWidth(oldLW);
47 setUpdatesEnabled(TRUE);
48
49 paint.save();
50 paint.setClipRegion( event->region().intersect( frameRect() ) );
51 QPixmap pm( Resource::loadPixmap( sidePixmap ) );
52 paint.drawPixmap( 2, fr.height() - pm.height() - 2, pm );
53 //Need to draw a filled rectangle that extends the colour from the
54 //end of the pixmap up to the top of the popupmenu
55 //paint.fillRect();
56 drawFrame( &paint );
57 paint.restore();
58
59 }
60 if ( event->rect().intersects( contentsRect() ) /* &&
61 (fstyle & MShape) != HLine && (fstyle & MShape) != VLine */ ) {
62
63 QPopupMenu::setFrameRect( QRect(fr.left() + 21, fr.top(), fr.width() - 21, fr.height()) );
64 int oldLW = lineWidth();
65 setUpdatesEnabled(FALSE);
66 setLineWidth(oldLW);
67 setUpdatesEnabled(TRUE);
68
69 paint.setClipRegion( event->region().intersect( contentsRect() ) );
70 drawContents( &paint );
71 }
72
73}
74
75
diff --git a/core/launcher/sidething.h b/core/launcher/sidething.h
new file mode 100644
index 0000000..666a59d
--- a/dev/null
+++ b/core/launcher/sidething.h
@@ -0,0 +1,43 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#ifndef __SIDE_THING_H__
22#define __SIDE_THING_H__
23
24
25#include "startmenu.h"
26
27
28class PopupWithLaunchSideThing : public StartPopupMenu
29{
30Q_OBJECT
31public:
32 PopupWithLaunchSideThing( QWidget *parent, QString *pixmap ) : StartPopupMenu( parent ), sidePixmap(*pixmap) { }
33
34protected:
35 void setFrameRect( const QRect & );
36 void paintEvent( QPaintEvent *event );
37 QRect fr;
38 QString sidePixmap;
39};
40
41
42#endif // __SIDE_THING_H__
43
diff --git a/core/launcher/stabmon.cpp b/core/launcher/stabmon.cpp
new file mode 100644
index 0000000..2911a1c
--- a/dev/null
+++ b/core/launcher/stabmon.cpp
@@ -0,0 +1,92 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21
22#include "stabmon.h"
23
24#include <qpe/qcopenvelope_qws.h>
25
26#include <qfile.h>
27#include <qcstring.h>
28
29#include <sys/stat.h>
30#include <unistd.h>
31#include <stdlib.h>
32
33SysFileMonitor::SysFileMonitor(QObject* parent) :
34 QObject(parent)
35{
36 startTimer(2000);
37}
38
39const char * stab0 = "/var/run/stab";
40const char * stab1 = "/var/state/pcmcia/stab";
41const char * stab2 = "/var/lib/pcmcia/stab";
42
43void SysFileMonitor::timerEvent(QTimerEvent*)
44{
45 struct stat s;
46
47 static const char * tab [] = {
48 stab0,
49 stab1,
50 stab2
51 };
52 static const int nstab = sizeof(tab)/sizeof(const char *);
53 static int last[nstab];
54
55 bool ch = FALSE;
56 for ( int i=0; i<nstab; i++ ) {
57 if ( ::stat(tab[i], &s)==0 && (long)s.st_mtime != last[i] ) {
58 last[i] = (long)s.st_mtime;
59 ch=TRUE;
60 }
61 if ( ch ) {
62 QCopEnvelope("QPE/Card", "stabChanged()" );
63 break;
64 }
65 }
66
67 // st_size is no use, it's 0 for /proc/mounts too. Read it all.
68 static int mtabSize = 0;
69 QFile f( "/etc/mtab" );
70 if ( f.open(IO_ReadOnly) ) {
71#if 0
72 // readAll does not work correctly on sequential devices (as eg. /proc files)
73 QByteArray ba = f.readAll();
74 if ( (int)ba.size() != mtabSize ) {
75 mtabSize = (int)ba.size();
76 QCopEnvelope("QPE/Card", "mtabChanged()" );
77 }
78#else
79 QString s;
80 while( !f.atEnd() ) {
81 QString tmp;
82 f.readLine( tmp, 1024 );
83 s += tmp;
84 }
85 if ( (int)s.length() != mtabSize ) {
86 mtabSize = (int)s.length();
87 QCopEnvelope("QPE/Card", "mtabChanged()" );
88 }
89 #endif
90 }
91}
92
diff --git a/core/launcher/stabmon.h b/core/launcher/stabmon.h
new file mode 100644
index 0000000..10c79a3
--- a/dev/null
+++ b/core/launcher/stabmon.h
@@ -0,0 +1,34 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21
22#ifndef STABMON_H
23#define STABMON_H
24
25#include <qobject.h>
26
27class SysFileMonitor : public QObject {
28public:
29 SysFileMonitor(QObject* parent);
30protected:
31 void timerEvent(QTimerEvent*);
32};
33
34#endif
diff --git a/core/launcher/startmenu.cpp b/core/launcher/startmenu.cpp
new file mode 100644
index 0000000..54bdfcc
--- a/dev/null
+++ b/core/launcher/startmenu.cpp
@@ -0,0 +1,171 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include "startmenu.h"
22#include "sidething.h"
23#include "mrulist.h"
24#include "info.h"
25
26#include <qpe/qpeapplication.h>
27#include <qpe/config.h>
28#include <qpe/applnk.h>
29#include <qpe/global.h>
30#include <qpe/resource.h>
31
32#include <qdict.h>
33
34#include <stdlib.h>
35
36
37// #define USE_CONFIG_FILE
38
39
40StartMenu::StartMenu(QWidget *parent) : QLabel( parent )
41{
42 loadOptions();
43
44 setPixmap( Resource::loadPixmap( startButtonPixmap ) );
45 setFocusPolicy( NoFocus );
46 //setFlat( startButtonIsFlat );
47
48 apps = new AppLnkSet( QPEApplication::qpeDir() + "apps" );
49
50 createMenu();
51}
52
53
54void StartMenu::mousePressEvent( QMouseEvent * )
55{
56 launch();
57 if (desktopInfo)
58 desktopInfo->menuClicked();
59}
60
61
62StartMenu::~StartMenu()
63{
64 delete apps;
65}
66
67
68void StartMenu::loadOptions()
69{
70#ifdef USE_CONFIG_FILE
71 // Read configuration file
72 Config config("StartMenu");
73 config.setGroup( "StartMenu" );
74 QString tmpBoolString1 = config.readEntry( "UseWidePopupMenu", "FALSE" );
75 useWidePopupMenu = ( tmpBoolString1 == "TRUE" ) ? TRUE : FALSE;
76 QString tmpBoolString2 = config.readEntry( "StartButtonIsFlat", "TRUE" );
77 startButtonIsFlat = ( tmpBoolString2 == "TRUE" ) ? TRUE : FALSE;
78 QString tmpBoolString3 = config.readEntry( "UseMRUList", "TRUE" );
79 popupMenuSidePixmap = config.readEntry( "PopupMenuSidePixmap", "sidebar" );
80 startButtonPixmap = config.readEntry( "StartButtonPixmap", "go" );
81#else
82 // Basically just #include the .qpe_menu.conf file settings
83 useWidePopupMenu = FALSE;
84 popupMenuSidePixmap = "sidebar";
85 startButtonIsFlat = TRUE;
86 startButtonPixmap = "go";
87#endif
88}
89
90
91void StartMenu::createMenu()
92{
93 if ( useWidePopupMenu )
94 launchMenu = new PopupWithLaunchSideThing( this, &popupMenuSidePixmap );
95 else
96 launchMenu = new StartPopupMenu( this );
97
98 loadMenu( apps, launchMenu );
99
100}
101
102void StartMenu::itemSelected( int id )
103{
104 const AppLnk *app = apps->find( id );
105 if ( app )
106 app->execute();
107}
108
109bool StartMenu::loadMenu( AppLnkSet *folder, QPopupMenu *menu )
110{
111 bool result = FALSE;
112
113 QStringList typs = folder->types();
114 QDict<QPopupMenu> typpop;
115 for (QStringList::Iterator tit=typs.begin(); tit!=typs.end(); ++tit) {
116 if ( !(*tit).isEmpty() ) {
117 QPopupMenu *new_menu = new StartPopupMenu( menu );
118 typpop.insert(*tit, new_menu);
119 connect( new_menu, SIGNAL(activated(int)), SLOT(itemSelected(int)) );
120 menu->insertItem( folder->typePixmap(*tit), *tit, new_menu );
121 }
122 }
123
124 QListIterator<AppLnk> it( folder->children() );
125 for ( ; it.current(); ++it ) {
126 AppLnk *app = it.current();
127 if ( app->type() == "Separator" ) {
128 menu->insertSeparator();
129 } else {
130 QString t = app->type();
131 QPopupMenu* pmenu = typpop.find(t);
132 if ( !pmenu )
133 pmenu = menu;
134 pmenu->insertItem( app->pixmap(), app->name(), app->id() );
135 result=TRUE;
136 }
137 }
138
139 if ( result )
140 connect( menu, SIGNAL(activated(int)), SLOT(itemSelected(int)) );
141
142 return result;
143}
144
145
146void StartMenu::launch()
147{
148 int y = mapToGlobal( QPoint() ).y() - launchMenu->sizeHint().height();
149
150 if ( launchMenu->isVisible() )
151 launchMenu->hide();
152 else
153 launchMenu->popup( QPoint( 1, y ) );
154}
155
156const AppLnk* StartMenu::execToLink(const QString& appname)
157{
158 const AppLnk* a = apps->findExec( appname );
159 return a;
160}
161
162void StartPopupMenu::keyPressEvent( QKeyEvent *e )
163{
164 if ( e->key() == Key_F33 || e->key() == Key_Space ) {
165 // "OK" button, little hacky
166 QKeyEvent ke(QEvent::KeyPress, Key_Enter, 13, 0);
167 QPopupMenu::keyPressEvent( &ke );
168 } else {
169 QPopupMenu::keyPressEvent( e );
170 }
171}
diff --git a/core/launcher/startmenu.h b/core/launcher/startmenu.h
new file mode 100644
index 0000000..a02f39e
--- a/dev/null
+++ b/core/launcher/startmenu.h
@@ -0,0 +1,76 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#ifndef __START_MENU_H__
22#define __START_MENU_H__
23
24#include <qstring.h>
25#include <qlist.h>
26#include <qlabel.h>
27#include <qpopupmenu.h>
28
29
30class AppLnkSet;
31class AppLnk;
32
33class StartPopupMenu : public QPopupMenu
34{
35public:
36 StartPopupMenu( QWidget *parent ) : QPopupMenu( parent ) {}
37protected:
38 void keyPressEvent( QKeyEvent *e );
39};
40
41class StartMenu : public QLabel {
42 Q_OBJECT
43public:
44 StartMenu( QWidget * );
45 ~StartMenu();
46
47 const AppLnk* execToLink(const QString& appname);
48
49public:
50 StartPopupMenu *launchMenu;
51
52public slots:
53 void launch( );
54 void loadOptions( );
55 void createMenu( );
56
57protected slots:
58 void itemSelected( int id );
59
60protected:
61 virtual void mousePressEvent( QMouseEvent * );
62
63private:
64 bool loadMenu( AppLnkSet *folder, QPopupMenu *menu );
65
66private:
67 bool useWidePopupMenu;
68 QString popupMenuSidePixmap;
69
70 bool startButtonIsFlat;
71 QString startButtonPixmap;
72
73 AppLnkSet *apps;
74};
75
76#endif // __START_MENU_H__
diff --git a/core/launcher/syncdialog.ui b/core/launcher/syncdialog.ui
new file mode 100644
index 0000000..141f123
--- a/dev/null
+++ b/core/launcher/syncdialog.ui
@@ -0,0 +1,228 @@
1<!DOCTYPE UI><UI>
2<class>SyncDialog</class>
3<widget>
4 <class>QDialog</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>SyncDialog</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>210</width>
15 <height>244</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Syncing</string>
21 </property>
22 <property stdset="1">
23 <name>sizeGripEnabled</name>
24 <bool>true</bool>
25 </property>
26 <vbox>
27 <property stdset="1">
28 <name>margin</name>
29 <number>11</number>
30 </property>
31 <property stdset="1">
32 <name>spacing</name>
33 <number>6</number>
34 </property>
35 <spacer>
36 <property>
37 <name>name</name>
38 <cstring>Spacer10</cstring>
39 </property>
40 <property stdset="1">
41 <name>orientation</name>
42 <enum>Vertical</enum>
43 </property>
44 <property stdset="1">
45 <name>sizeType</name>
46 <enum>Expanding</enum>
47 </property>
48 <property>
49 <name>sizeHint</name>
50 <size>
51 <width>20</width>
52 <height>20</height>
53 </size>
54 </property>
55 </spacer>
56 <widget>
57 <class>QLayoutWidget</class>
58 <property stdset="1">
59 <name>name</name>
60 <cstring>Layout3</cstring>
61 </property>
62 <hbox>
63 <property stdset="1">
64 <name>margin</name>
65 <number>0</number>
66 </property>
67 <property stdset="1">
68 <name>spacing</name>
69 <number>6</number>
70 </property>
71 <widget>
72 <class>QLabel</class>
73 <property stdset="1">
74 <name>name</name>
75 <cstring>TextLabel1</cstring>
76 </property>
77 <property stdset="1">
78 <name>text</name>
79 <string>Syncing</string>
80 </property>
81 <property stdset="1">
82 <name>alignment</name>
83 <set>AlignCenter</set>
84 </property>
85 <property>
86 <name>hAlign</name>
87 </property>
88 </widget>
89 <widget>
90 <class>QLabel</class>
91 <property stdset="1">
92 <name>name</name>
93 <cstring>whatLabel</cstring>
94 </property>
95 <property stdset="1">
96 <name>text</name>
97 <string>&lt;b&gt;Contacts&lt;/b&gt;</string>
98 </property>
99 </widget>
100 </hbox>
101 </widget>
102 <spacer>
103 <property>
104 <name>name</name>
105 <cstring>Spacer11</cstring>
106 </property>
107 <property stdset="1">
108 <name>orientation</name>
109 <enum>Vertical</enum>
110 </property>
111 <property stdset="1">
112 <name>sizeType</name>
113 <enum>Expanding</enum>
114 </property>
115 <property>
116 <name>sizeHint</name>
117 <size>
118 <width>20</width>
119 <height>20</height>
120 </size>
121 </property>
122 </spacer>
123 <widget>
124 <class>QLayoutWidget</class>
125 <property stdset="1">
126 <name>name</name>
127 <cstring>Layout4</cstring>
128 </property>
129 <hbox>
130 <property stdset="1">
131 <name>margin</name>
132 <number>0</number>
133 </property>
134 <property stdset="1">
135 <name>spacing</name>
136 <number>6</number>
137 </property>
138 <spacer>
139 <property>
140 <name>name</name>
141 <cstring>Spacer4</cstring>
142 </property>
143 <property stdset="1">
144 <name>orientation</name>
145 <enum>Horizontal</enum>
146 </property>
147 <property stdset="1">
148 <name>sizeType</name>
149 <enum>Expanding</enum>
150 </property>
151 <property>
152 <name>sizeHint</name>
153 <size>
154 <width>20</width>
155 <height>20</height>
156 </size>
157 </property>
158 </spacer>
159 <widget>
160 <class>QPushButton</class>
161 <property stdset="1">
162 <name>name</name>
163 <cstring>buttonCancel</cstring>
164 </property>
165 <property stdset="1">
166 <name>text</name>
167 <string>&amp;Cancel</string>
168 </property>
169 <property stdset="1">
170 <name>autoDefault</name>
171 <bool>true</bool>
172 </property>
173 </widget>
174 <spacer>
175 <property>
176 <name>name</name>
177 <cstring>Spacer5</cstring>
178 </property>
179 <property stdset="1">
180 <name>orientation</name>
181 <enum>Horizontal</enum>
182 </property>
183 <property stdset="1">
184 <name>sizeType</name>
185 <enum>Expanding</enum>
186 </property>
187 <property>
188 <name>sizeHint</name>
189 <size>
190 <width>20</width>
191 <height>20</height>
192 </size>
193 </property>
194 </spacer>
195 </hbox>
196 </widget>
197 <spacer>
198 <property>
199 <name>name</name>
200 <cstring>Spacer12</cstring>
201 </property>
202 <property stdset="1">
203 <name>orientation</name>
204 <enum>Vertical</enum>
205 </property>
206 <property stdset="1">
207 <name>sizeType</name>
208 <enum>Expanding</enum>
209 </property>
210 <property>
211 <name>sizeHint</name>
212 <size>
213 <width>20</width>
214 <height>20</height>
215 </size>
216 </property>
217 </spacer>
218 </vbox>
219</widget>
220<connections>
221 <connection>
222 <sender>buttonCancel</sender>
223 <signal>clicked()</signal>
224 <receiver>SyncDialog</receiver>
225 <slot>reject()</slot>
226 </connection>
227</connections>
228</UI>
diff --git a/core/launcher/systray.cpp b/core/launcher/systray.cpp
new file mode 100644
index 0000000..ad1553f
--- a/dev/null
+++ b/core/launcher/systray.cpp
@@ -0,0 +1,107 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include <qpe/qpeapplication.h>
22#include <qpe/qlibrary.h>
23#include <qpe/config.h>
24
25#include <qlayout.h>
26#include <qdir.h>
27#include <qtranslator.h>
28
29#include "quicklauncher.h"
30#include "systray.h"
31
32#include <stdlib.h>
33
34#ifdef SINGLE_APP
35#include "clockappletimpl.h"
36#endif
37
38SysTray::SysTray( QWidget *parent ) : QFrame( parent ), layout(0)
39{
40 //setFrameStyle( QFrame::Panel | QFrame::Sunken );
41 loadApplets();
42}
43
44void SysTray::loadApplets()
45{
46#ifndef SINGLE_APP
47 QValueList<TaskbarApplet>::Iterator mit;
48 for ( mit = appletList.begin(); mit != appletList.end(); ++mit ) {
49 (*mit).iface->release();
50 (*mit).library->unload();
51 delete (*mit).library;
52 }
53 appletList.clear();
54 if ( layout )
55 delete layout;
56 layout = new QHBoxLayout( this );
57
58 QString path = QPEApplication::qpeDir() + "/plugins/applets";
59 QDir dir( path, "lib*.so" );
60 QStringList list = dir.entryList();
61 QStringList::Iterator it;
62 for ( it = list.begin(); it != list.end(); ++it ) {
63 TaskbarAppletInterface *iface = 0;
64 QLibrary *lib = new QLibrary( path + "/" + *it );
65 if ( lib->queryInterface( IID_TaskbarApplet, (QUnknownInterface**)&iface ) == QS_OK ) {
66 TaskbarApplet applet;
67 applet.library = lib;
68 applet.iface = iface;
69 applet.applet = applet.iface->applet( this );
70 positionApplet( applet );
71 QString lang = getenv( "LANG" );
72 QTranslator * trans = new QTranslator(qApp);
73 QString type = (*it).left( (*it).find(".") );
74 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm";
75 qDebug("tr fpr sysapplet: %s", tfn.latin1() );
76 if ( trans->load( tfn ))
77 qApp->installTranslator( trans );
78 else
79 delete trans;
80 } else {
81 delete lib;
82 }
83 }
84#else
85 layout = new QHBoxLayout( this );
86 TaskbarApplet applet;
87 applet.iface = new ClockAppletImpl();
88 applet.applet = applet.iface->applet( this );
89 positionApplet( applet );
90#endif
91}
92
93void SysTray::positionApplet( const TaskbarApplet &a )
94{
95 int p = 0;
96 QValueList<TaskbarApplet>::Iterator it;
97 for ( it = appletList.begin(); it != appletList.end(); ++it ) {
98 if ( (*it).iface->position() > a.iface->position() )
99 break;
100 p += 2;
101 }
102
103 appletList.insert( it, a );
104 layout->insertWidget( p, a.applet );
105 layout->insertSpacing( p, 1 );
106}
107
diff --git a/core/launcher/systray.h b/core/launcher/systray.h
new file mode 100644
index 0000000..0aed348
--- a/dev/null
+++ b/core/launcher/systray.h
@@ -0,0 +1,58 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#ifndef __SYSTRAY_H__
22#define __SYSTRAY_H__
23
24#include <qpe/taskbarappletinterface.h>
25
26#include <qframe.h>
27#include <qvaluelist.h>
28
29class QHBoxLayout;
30class QLibrary;
31
32struct TaskbarApplet
33{
34#ifndef QT_NO_COMPONENT
35 QLibrary *library;
36#endif
37 TaskbarAppletInterface *iface;
38 QWidget *applet;
39};
40
41class SysTray : public QFrame {
42 Q_OBJECT
43public:
44 SysTray( QWidget *parent );
45
46 void loadApplets();
47
48private:
49 void positionApplet( const TaskbarApplet &a );
50
51private:
52 QHBoxLayout *layout;
53 QValueList<TaskbarApplet> appletList;
54};
55
56
57#endif // __SYSTRAY_H__
58
diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp
new file mode 100644
index 0000000..d7f36bd
--- a/dev/null
+++ b/core/launcher/taskbar.cpp
@@ -0,0 +1,314 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include "startmenu.h"
22#include "inputmethods.h"
23#include "mrulist.h"
24#include "systray.h"
25#include "calibrate.h"
26#include "wait.h"
27#include "appicons.h"
28
29#include "taskbar.h"
30#include "desktop.h"
31
32#include <qpe/qpeapplication.h>
33#include <qpe/qcopenvelope_qws.h>
34#include <qpe/global.h>
35#ifdef QT_QWS_CUSTOM
36#include <qpe/custom.h>
37#endif
38
39#include <qlabel.h>
40#include <qlayout.h>
41#include <qtimer.h>
42#include <qwindowsystem_qws.h>
43#include <qwidgetstack.h>
44
45#if defined( Q_WS_QWS )
46#include <qwsdisplay_qws.h>
47#include <qgfx_qws.h>
48#endif
49
50
51#define FACTORY(T) \
52 static QWidget *new##T( bool maximized ) { \
53 QWidget *w = new T( 0, "test", QWidget::WDestructiveClose | QWidget::WGroupLeader ); \
54 if ( maximized ) { \
55 if ( qApp->desktop()->width() <= 350 ) { \
56 w->showMaximized(); \
57 } else { \
58 w->resize( QSize( 300, 300 ) ); \
59 } \
60 } \
61 w->show(); \
62 return w; \
63 }
64
65
66#ifdef SINGLE_APP
67#define APP(a,b,c,d) FACTORY(b)
68#include "../taskbar/apps.h"
69#undef APP
70#endif // SINGLE_APP
71
72static Global::Command builtins[] = {
73
74#ifdef SINGLE_APP
75#define APP(a,b,c,d) { a, new##b, c },
76#include "../taskbar/apps.h"
77#undef APP
78#endif
79
80#if defined(QT_QWS_IPAQ) || defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_EBX)
81 { "calibrate", TaskBar::calibrate,1, 0 },
82#endif
83#if !defined(QT_QWS_CASSIOPEIA)
84 { "shutdown", Global::shutdown, 1, 0 },
85 // { "run", run, 1, 0 },
86#endif
87
88 { 0, TaskBar::calibrate,0, 0 },
89};
90
91static bool initNumLock()
92{
93#ifdef QPE_INITIAL_NUMLOCK_STATE
94 QPE_INITIAL_NUMLOCK_STATE
95#endif
96 return FALSE;
97}
98
99class LockKeyState : public QWidget
100{
101public:
102 LockKeyState( QWidget *parent ) :
103 QWidget(parent),
104 nl(initNumLock()), cl(FALSE)
105 {
106 nl_pm = Resource::loadPixmap("numlock");
107 cl_pm = Resource::loadPixmap("capslock");
108 }
109 QSize sizeHint() const
110 {
111 return QSize(nl_pm.width()+2,nl_pm.width()+nl_pm.height()+1);
112 }
113 void toggleNumLockState()
114 {
115 nl = !nl; repaint();
116 }
117 void toggleCapsLockState()
118 {
119 cl = !cl; repaint();
120 }
121 void paintEvent( QPaintEvent * )
122 {
123 int y = (height()-sizeHint().height())/2;
124 QPainter p(this);
125 if ( nl )
126 p.drawPixmap(1,y,nl_pm);
127 if ( cl )
128 p.drawPixmap(1,y+nl_pm.height()+1,cl_pm);
129 }
130private:
131 QPixmap nl_pm, cl_pm;
132 bool nl, cl;
133};
134
135TaskBar::~TaskBar()
136{
137}
138
139
140TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader)
141{
142 Global::setBuiltinCommands(builtins);
143
144 sm = new StartMenu( this );
145
146 inputMethods = new InputMethods( this );
147 connect( inputMethods, SIGNAL(inputToggled(bool)),
148 this, SLOT(calcMaxWindowRect()) );
149 //new QuickLauncher( this );
150
151 stack = new QWidgetStack( this );
152 stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
153 label = new QLabel(stack);
154
155 mru = new MRUList( stack );
156 stack->raiseWidget( mru );
157
158 waitIcon = new Wait( this );
159 (void) new AppIcons( this );
160
161 sysTray = new SysTray( this );
162
163 // ## make customizable in some way?
164#ifdef QT_QWS_CUSTOM
165 lockState = new LockKeyState( this );
166#else
167 lockState = 0;
168#endif
169
170#if defined(Q_WS_QWS)
171#if !defined(QT_NO_COP)
172 QCopChannel *channel = new QCopChannel( "QPE/TaskBar", this );
173 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
174 this, SLOT(receive(const QCString&, const QByteArray&)) );
175#endif
176#endif
177 waitTimer = new QTimer( this );
178 connect( waitTimer, SIGNAL( timeout() ), this, SLOT( stopWait() ) );
179 clearer = new QTimer( this );
180 QObject::connect(clearer, SIGNAL(timeout()), SLOT(clearStatusBar()));
181 QObject::connect(clearer, SIGNAL(timeout()), sysTray, SLOT(show()));
182}
183
184void TaskBar::setStatusMessage( const QString &text )
185{
186 label->setText( text );
187 stack->raiseWidget( label );
188 if ( sysTray && ( label->fontMetrics().width( text ) > label->width() ) )
189 sysTray->hide();
190 clearer->start( 3000 );
191}
192
193void TaskBar::clearStatusBar()
194{
195 label->clear();
196 stack->raiseWidget( mru );
197}
198
199void TaskBar::startWait()
200{
201 waitIcon->setWaiting( true );
202 // a catchall stop after 10 seconds...
203 waitTimer->start( 10 * 1000, true );
204}
205
206void TaskBar::stopWait(const QString& app)
207{
208 waitTimer->stop();
209 mru->addTask(sm->execToLink(app));
210 waitIcon->setWaiting( false );
211}
212
213void TaskBar::stopWait()
214{
215 waitTimer->stop();
216 waitIcon->setWaiting( false );
217}
218
219void TaskBar::resizeEvent( QResizeEvent *e )
220{
221 QHBox::resizeEvent( e );
222 calcMaxWindowRect();
223}
224
225void TaskBar::styleChange( QStyle &s )
226{
227 QHBox::styleChange( s );
228 calcMaxWindowRect();
229}
230
231void TaskBar::calcMaxWindowRect()
232{
233#ifdef Q_WS_QWS
234 QRect wr;
235 int displayWidth = qApp->desktop()->width();
236 QRect ir = inputMethods->inputRect();
237 if ( ir.isValid() ) {
238 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 );
239 } else {
240 wr.setCoords( 0, 0, displayWidth-1, y()-1 );
241 }
242
243#if QT_VERSION < 300
244 QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr,
245 QSize(qt_screen->width(),qt_screen->height()))
246 );
247#else
248 QWSServer::setMaxWindowRect( wr );
249#endif
250#endif
251}
252
253void TaskBar::receive( const QCString &msg, const QByteArray &data )
254{
255 QDataStream stream( data, IO_ReadOnly );
256 if ( msg == "message(QString)" ) {
257 QString text;
258 stream >> text;
259 setStatusMessage( text );
260 } else if ( msg == "hideInputMethod()" ) {
261 inputMethods->hideInputMethod();
262 } else if ( msg == "showInputMethod()" ) {
263 inputMethods->showInputMethod();
264 } else if ( msg == "reloadInputMethods()" ) {
265 inputMethods->loadInputMethods();
266 } else if ( msg == "reloadApplets()" ) {
267 sysTray->loadApplets();
268 } else if ( msg == "soundAlarm()" ) {
269 Desktop::soundAlarm();
270 }
271#ifdef CUSTOM_LEDS
272 else if ( msg == "setLed(int,bool)" ) {
273 int led, status;
274 stream >> led >> status;
275 CUSTOM_LEDS( led, status );
276 }
277#endif
278}
279
280QWidget *TaskBar::calibrate(bool)
281{
282#ifdef Q_WS_QWS
283 Calibrate *c = new Calibrate;
284 c->show();
285 return c;
286#else
287 return 0;
288#endif
289}
290
291void TaskBar::toggleNumLockState()
292{
293 if ( lockState ) lockState->toggleNumLockState();
294}
295
296void TaskBar::toggleCapsLockState()
297{
298 if ( lockState ) lockState->toggleCapsLockState();
299}
300
301void TaskBar::toggleSymbolInput()
302{
303 if ( inputMethods->currentShown() == "Unicode" ) {
304 inputMethods->hideInputMethod();
305 } else {
306 inputMethods->showInputMethod("Unicode");
307 }
308}
309
310bool TaskBar::recoverMemory()
311{
312 return mru->quitOldApps();
313}
314
diff --git a/core/launcher/taskbar.h b/core/launcher/taskbar.h
new file mode 100644
index 0000000..cdeb3c7
--- a/dev/null
+++ b/core/launcher/taskbar.h
@@ -0,0 +1,86 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#ifndef __TASKBAR_H__
22#define __TASKBAR_H__
23
24#ifdef QT_QWS_CUSTOM
25#include <qpe/custom.h>
26#endif
27
28#include <qhbox.h>
29
30class QLabel;
31class QTimer;
32class InputMethods;
33class Wait;
34class SysTray;
35class MRUList;
36class QWidgetStack;
37class QTimer;
38class QLabel;
39class StartMenu;
40class LockKeyState;
41
42class TaskBar : public QHBox {
43 Q_OBJECT
44public:
45 TaskBar();
46 ~TaskBar();
47
48 static QWidget *calibrate( bool );
49
50 bool recoverMemory();
51
52 StartMenu *startMenu() const { return sm; }
53public slots:
54 void startWait();
55 void stopWait(const QString&);
56 void stopWait();
57 void clearStatusBar();
58 void toggleNumLockState();
59 void toggleCapsLockState();
60 void toggleSymbolInput();
61
62protected:
63 void resizeEvent( QResizeEvent * );
64 void styleChange( QStyle & );
65 void setStatusMessage( const QString &text );
66
67private slots:
68 void calcMaxWindowRect();
69 void receive( const QCString &msg, const QByteArray &data );
70
71private:
72
73 QTimer *waitTimer;
74 Wait *waitIcon;
75 InputMethods *inputMethods;
76 SysTray *sysTray;
77 MRUList *mru;
78 QWidgetStack *stack;
79 QTimer *clearer;
80 QLabel *label;
81 LockKeyState* lockState;
82 StartMenu *sm;
83};
84
85
86#endif // __TASKBAR_H__
diff --git a/core/launcher/transferserver.cpp b/core/launcher/transferserver.cpp
new file mode 100644
index 0000000..87a49eb
--- a/dev/null
+++ b/core/launcher/transferserver.cpp
@@ -0,0 +1,1245 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#define _XOPEN_SOURCE
21#include <pwd.h>
22#include <sys/types.h>
23#include <unistd.h>
24#include <stdlib.h>
25
26#if defined(_OS_LINUX_)
27#include <shadow.h>
28#endif
29
30#include <qdir.h>
31#include <qfile.h>
32#include <qtextstream.h>
33#include <qdatastream.h>
34#include <qmessagebox.h>
35#include <qstringlist.h>
36#include <qfileinfo.h>
37#include <qregexp.h>
38//#include <qpe/qcopchannel_qws.h>
39#include <qpe/qprocess.h>
40#include <qpe/process.h>
41#include <qpe/config.h>
42#include <qpe/qcopenvelope_qws.h>
43
44#include "transferserver.h"
45
46const int block_size = 51200;
47
48TransferServer::TransferServer( Q_UINT16 port, QObject *parent = 0,
49 const char* name = 0)
50 : QServerSocket( port, 1, parent, name )
51{
52 if ( !ok() )
53 qWarning( "Failed to bind to port %d", port );
54}
55
56TransferServer::~TransferServer()
57{
58
59}
60
61void TransferServer::newConnection( int socket )
62{
63 (void) new ServerPI( socket, this );
64}
65
66bool accessAuthorized(QHostAddress peeraddress)
67{
68 Config cfg("Security");
69 cfg.setGroup("Sync");
70 uint auth_peer = cfg.readNumEntry("auth_peer",0xc0a80100);
71 uint auth_peer_bits = cfg.readNumEntry("auth_peer_bits",24);
72 bool ok = (peeraddress.ip4Addr() & (((1<<auth_peer_bits)-1)<<(32-auth_peer_bits)))
73 == auth_peer;
74 /* Allows denial-of-service attack.
75 if ( !ok ) {
76 QMessageBox::warning(0,tr("Security"),
77 tr("<p>An attempt to access this device from %1 has been denied.")
78 .arg(peeraddress.toString()));
79 }
80 */
81 return ok;
82}
83
84ServerPI::ServerPI( int socket, QObject *parent = 0, const char* name = 0 )
85 : QSocket( parent, name ) , dtp( 0 ), serversocket( 0 ), waitsocket( 0 )
86{
87 state = Connected;
88
89 setSocket( socket );
90
91 peerport = peerPort();
92 peeraddress = peerAddress();
93
94#ifndef INSECURE
95 if ( !accessAuthorized(peeraddress) ) {
96 state = Forbidden;
97 startTimer( 0 );
98 } else
99 #endif
100 {
101 connect( this, SIGNAL( readyRead() ), SLOT( read() ) );
102 connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) );
103
104 passiv = FALSE;
105 for( int i = 0; i < 4; i++ )
106 wait[i] = FALSE;
107
108 send( "220 Qtopia transfer service ready!" );
109 state = Wait_USER;
110
111 dtp = new ServerDTP( this );
112 connect( dtp, SIGNAL( completed() ), SLOT( dtpCompleted() ) );
113 connect( dtp, SIGNAL( failed() ), SLOT( dtpFailed() ) );
114 connect( dtp, SIGNAL( error( int ) ), SLOT( dtpError( int ) ) );
115
116
117 directory = QDir::currentDirPath();
118
119 static int p = 1024;
120
121 while ( !serversocket || !serversocket->ok() ) {
122 delete serversocket;
123 serversocket = new ServerSocket( ++p, this );
124 }
125 connect( serversocket, SIGNAL( newIncomming( int ) ),
126 SLOT( newConnection( int ) ) );
127 }
128}
129
130ServerPI::~ServerPI()
131{
132
133}
134
135void ServerPI::connectionClosed()
136{
137 // qDebug( "Debug: Connection closed" );
138 delete this;
139}
140
141void ServerPI::send( const QString& msg )
142{
143 QTextStream os( this );
144 os << msg << endl;
145 //qDebug( "Reply: %s", msg.latin1() );
146}
147
148void ServerPI::read()
149{
150 while ( canReadLine() )
151 process( readLine().stripWhiteSpace() );
152}
153
154bool ServerPI::checkUser( const QString& user )
155{
156 if ( user.isEmpty() ) return FALSE;
157
158 struct passwd *pw;
159 pw = getpwuid( geteuid() );
160 QString euser = QString::fromLocal8Bit( pw->pw_name );
161 return user == euser;
162}
163
164bool ServerPI::checkPassword( const QString& /* password */ )
165{
166 // ### HACK for testing on local host
167 return true;
168
169 /*
170 struct passwd *pw = 0;
171 struct spwd *spw = 0;
172
173 pw = getpwuid( geteuid() );
174 spw = getspnam( pw->pw_name );
175
176 QString cpwd = QString::fromLocal8Bit( pw->pw_passwd );
177 if ( cpwd == "x" && spw )
178 cpwd = QString::fromLocal8Bit( spw->sp_pwdp );
179
180 QString cpassword = QString::fromLocal8Bit( crypt( password.local8Bit(), cpwd.local8Bit() ) );
181 return cpwd == cpassword;
182*/
183}
184
185bool ServerPI::checkReadFile( const QString& file )
186{
187 QString filename;
188
189 if ( file[0] != "/" )
190 filename = directory.path() + "/" + file;
191 else
192 filename = file;
193
194 QFileInfo fi( filename );
195 return ( fi.exists() && fi.isReadable() );
196}
197
198bool ServerPI::checkWriteFile( const QString& file )
199{
200 QString filename;
201
202 if ( file[0] != "/" )
203 filename = directory.path() + "/" + file;
204 else
205 filename = file;
206
207 QFileInfo fi( filename );
208
209 if ( fi.exists() )
210 if ( !QFile( filename ).remove() )
211 return FALSE;
212 return TRUE;
213}
214
215void ServerPI::process( const QString& message )
216{
217 //qDebug( "Command: %s", message.latin1() );
218
219 // split message using "," as separator
220 QStringList msg = QStringList::split( " ", message );
221 if ( msg.isEmpty() ) return;
222
223 // command token
224 QString cmd = msg[0].upper();
225
226 // argument token
227 QString arg;
228 if ( msg.count() >= 2 )
229 arg = msg[1];
230
231 // full argument string
232 QString args;
233 if ( msg.count() >= 2 ) {
234 QStringList copy( msg );
235 // FIXME: for Qt3
236 // copy.pop_front()
237 copy.remove( copy.begin() );
238 args = copy.join( " " );
239 }
240
241 //qDebug( "args: %s", args.latin1() );
242
243 // we always respond to QUIT, regardless of state
244 if ( cmd == "QUIT" ) {
245 send( "211 Good bye!" );
246 delete this;
247 return;
248 }
249
250 // connected to client
251 if ( Connected == state )
252 return;
253
254 // waiting for user name
255 if ( Wait_USER == state ) {
256
257 if ( cmd != "USER" || msg.count() < 2 || !checkUser( arg ) ) {
258 send( "530 Please login with USER and PASS" );
259 return;
260 }
261 send( "331 User name ok, need password" );
262 state = Wait_PASS;
263 return;
264 }
265
266 // waiting for password
267 if ( Wait_PASS == state ) {
268
269 if ( cmd != "PASS" || !checkPassword( arg ) ) {
270 //if ( cmd != "PASS" || msg.count() < 2 || !checkPassword( arg ) ) {
271 send( "530 Please login with USER and PASS" );
272 return;
273 }
274 send( "230 User logged in, proceed" );
275 state = Ready;
276 return;
277 }
278
279 // ACCESS CONTROL COMMANDS
280
281
282 // account (ACCT)
283 if ( cmd == "ACCT" ) {
284 // even wu-ftp does not support it
285 send( "502 Command not implemented" );
286 }
287
288 // change working directory (CWD)
289 else if ( cmd == "CWD" ) {
290
291 if ( !args.isEmpty() ) {
292 if ( directory.cd( args, TRUE ) )
293 send( "250 Requested file action okay, completed" );
294 else
295 send( "550 Requested action not taken" );
296 }
297 else
298 send( "500 Syntax error, command unrecognized" );
299 }
300
301 // change to parent directory (CDUP)
302 else if ( cmd == "CDUP" ) {
303 if ( directory.cdUp() )
304 send( "250 Requested file action okay, completed" );
305 else
306 send( "550 Requested action not taken" );
307 }
308
309 // structure mount (SMNT)
310 else if ( cmd == "SMNT" ) {
311 // even wu-ftp does not support it
312 send( "502 Command not implemented" );
313 }
314
315 // reinitialize (REIN)
316 else if ( cmd == "REIN" ) {
317 // even wu-ftp does not support it
318 send( "502 Command not implemented" );
319 }
320
321
322 // TRANSFER PARAMETER COMMANDS
323
324
325 // data port (PORT)
326 else if ( cmd == "PORT" ) {
327 if ( parsePort( arg ) )
328 send( "200 Command okay" );
329 else
330 send( "500 Syntax error, command unrecognized" );
331 }
332
333 // passive (PASV)
334 else if ( cmd == "PASV" ) {
335 passiv = TRUE;
336 send( "227 Entering Passive Mode ("
337 + address().toString().replace( QRegExp( "\\." ), "," ) + ","
338 + QString::number( ( serversocket->port() ) >> 8 ) + ","
339 + QString::number( ( serversocket->port() ) & 0xFF ) +")" );
340 }
341
342 // representation type (TYPE)
343 else if ( cmd == "TYPE" ) {
344 if ( arg.upper() == "A" || arg.upper() == "I" )
345 send( "200 Command okay" );
346 else
347 send( "504 Command not implemented for that parameter" );
348 }
349
350 // file structure (STRU)
351 else if ( cmd == "STRU" ) {
352 if ( arg.upper() == "F" )
353 send( "200 Command okay" );
354 else
355 send( "504 Command not implemented for that parameter" );
356 }
357
358 // transfer mode (MODE)
359 else if ( cmd == "MODE" ) {
360 if ( arg.upper() == "S" )
361 send( "200 Command okay" );
362 else
363 send( "504 Command not implemented for that parameter" );
364 }
365
366
367 // FTP SERVICE COMMANDS
368
369
370 // retrieve (RETR)
371 else if ( cmd == "RETR" )
372 if ( !args.isEmpty() && checkReadFile( absFilePath( args ) )
373 || backupRestoreGzip( absFilePath( args ) ) ) {
374 send( "150 File status okay" );
375 sendFile( absFilePath( args ) );
376 }
377 else {
378 qDebug("550 Requested action not taken");
379 send( "550 Requested action not taken" );
380 }
381
382 // store (STOR)
383 else if ( cmd == "STOR" )
384 if ( !args.isEmpty() && checkWriteFile( absFilePath( args ) ) ) {
385 send( "150 File status okay" );
386 retrieveFile( absFilePath( args ) );
387 }
388 else
389 send( "550 Requested action not taken" );
390
391 // store unique (STOU)
392 else if ( cmd == "STOU" ) {
393 send( "502 Command not implemented" );
394 }
395
396 // append (APPE)
397 else if ( cmd == "APPE" ) {
398 send( "502 Command not implemented" );
399 }
400
401 // allocate (ALLO)
402 else if ( cmd == "ALLO" ) {
403 send( "200 Command okay" );
404 }
405
406 // restart (REST)
407 else if ( cmd == "REST" ) {
408 send( "502 Command not implemented" );
409 }
410
411 // rename from (RNFR)
412 else if ( cmd == "RNFR" ) {
413 renameFrom = QString::null;
414 if ( args.isEmpty() )
415 send( "500 Syntax error, command unrecognized" );
416 else {
417 QFile file( absFilePath( args ) );
418 if ( file.exists() ) {
419 send( "350 File exists, ready for destination name" );
420 renameFrom = absFilePath( args );
421 }
422 else
423 send( "550 Requested action not taken" );
424 }
425 }
426
427 // rename to (RNTO)
428 else if ( cmd == "RNTO" ) {
429 if ( lastCommand != "RNFR" )
430 send( "503 Bad sequence of commands" );
431 else if ( args.isEmpty() )
432 send( "500 Syntax error, command unrecognized" );
433 else {
434 QDir dir( absFilePath( args ) );
435 if ( dir.rename( renameFrom, absFilePath( args ), TRUE ) )
436 send( "250 Requested file action okay, completed." );
437 else
438 send( "550 Requested action not taken" );
439 }
440 }
441
442 // abort (ABOR)
443 else if ( cmd.contains( "ABOR" ) ) {
444 dtp->close();
445 if ( dtp->dtpMode() != ServerDTP::Idle )
446 send( "426 Connection closed; transfer aborted" );
447 else
448 send( "226 Closing data connection" );
449 }
450
451 // delete (DELE)
452 else if ( cmd == "DELE" ) {
453 if ( args.isEmpty() )
454 send( "500 Syntax error, command unrecognized" );
455 else {
456 QFile file( absFilePath( args ) ) ;
457 if ( file.remove() )
458 send( "250 Requested file action okay, completed" );
459 else
460 send( "550 Requested action not taken" );
461 }
462 }
463
464 // remove directory (RMD)
465 else if ( cmd == "RMD" ) {
466 if ( args.isEmpty() )
467 send( "500 Syntax error, command unrecognized" );
468 else {
469 QDir dir;
470 if ( dir.rmdir( absFilePath( args ), TRUE ) )
471 send( "250 Requested file action okay, completed" );
472 else
473 send( "550 Requested action not taken" );
474 }
475 }
476
477 // make directory (MKD)
478 else if ( cmd == "MKD" ) {
479 if ( args.isEmpty() ) {
480 qDebug(" Error: no arg");
481 send( "500 Syntax error, command unrecognized" );
482 }
483 else {
484 QDir dir;
485 if ( dir.mkdir( absFilePath( args ), TRUE ) )
486 send( "250 Requested file action okay, completed." );
487 else
488 send( "550 Requested action not taken" );
489 }
490 }
491
492 // print working directory (PWD)
493 else if ( cmd == "PWD" ) {
494 send( "257 \"" + directory.path() +"\"" );
495 }
496
497 // list (LIST)
498 else if ( cmd == "LIST" ) {
499 if ( sendList( absFilePath( args ) ) )
500 send( "150 File status okay" );
501 else
502 send( "500 Syntax error, command unrecognized" );
503 }
504
505 // size (SIZE)
506 else if ( cmd == "SIZE" ) {
507 QString filePath = absFilePath( args );
508 QFileInfo fi( filePath );
509 bool gzipfile = backupRestoreGzip( filePath );
510 if ( !fi.exists() && !gzipfile )
511 send( "500 Syntax error, command unrecognized" );
512 else {
513 if ( !gzipfile )
514 send( "213 " + QString::number( fi.size() ) );
515 else {
516 Process duproc( QString("du") );
517 duproc.addArgument("-s");
518 QString in, out;
519 if ( !duproc.exec(in, out) ) {
520 qDebug("du process failed; just sending back 1K");
521 send( "213 1024");
522 }
523 else {
524 QString size = out.left( out.find("\t") );
525 int guess = size.toInt()/5;
526 if ( filePath.contains("doc") )
527 guess *= 1000;
528 qDebug("sending back gzip guess of %d", guess);
529 send( "213 " + QString::number(guess) );
530 }
531 }
532 }
533 }
534 // name list (NLST)
535 else if ( cmd == "NLST" ) {
536 send( "502 Command not implemented" );
537 }
538
539 // site parameters (SITE)
540 else if ( cmd == "SITE" ) {
541 send( "502 Command not implemented" );
542 }
543
544 // system (SYST)
545 else if ( cmd == "SYST" ) {
546 send( "215 UNIX Type: L8" );
547 }
548
549 // status (STAT)
550 else if ( cmd == "STAT" ) {
551 send( "502 Command not implemented" );
552 }
553
554 // help (HELP )
555 else if ( cmd == "HELP" ) {
556 send( "502 Command not implemented" );
557 }
558
559 // noop (NOOP)
560 else if ( cmd == "NOOP" ) {
561 send( "200 Command okay" );
562 }
563
564 // not implemented
565 else
566 send( "502 Command not implemented" );
567
568 lastCommand = cmd;
569}
570
571bool ServerPI::backupRestoreGzip( const QString &file )
572{
573 return (file.find( "backup" ) != -1 &&
574 file.findRev( ".tgz" ) == (int)file.length()-4 );
575}
576
577bool ServerPI::backupRestoreGzip( const QString &file, QStringList &targets )
578{
579 if ( file.find( "backup" ) != -1 &&
580 file.findRev( ".tgz" ) == (int)file.length()-4 ) {
581 QFileInfo info( file );
582 targets = info.dirPath( TRUE );
583 qDebug("ServerPI::backupRestoreGzip for %s = %s", file.latin1(),
584 targets.join(" ").latin1() );
585 return true;
586 }
587 return false;
588}
589
590void ServerPI::sendFile( const QString& file )
591{
592 if ( passiv ) {
593 wait[SendFile] = TRUE;
594 waitfile = file;
595 if ( waitsocket )
596 newConnection( waitsocket );
597 }
598 else {
599 QStringList targets;
600 if ( backupRestoreGzip( file, targets ) )
601 dtp->sendGzipFile( file, targets, peeraddress, peerport );
602 else dtp->sendFile( file, peeraddress, peerport );
603 }
604}
605
606void ServerPI::retrieveFile( const QString& file )
607{
608 if ( passiv ) {
609 wait[RetrieveFile] = TRUE;
610 waitfile = file;
611 if ( waitsocket )
612 newConnection( waitsocket );
613 }
614 else {
615 QStringList targets;
616 if ( backupRestoreGzip( file, targets ) )
617 dtp->retrieveGzipFile( file, peeraddress, peerport );
618 else
619 dtp->retrieveFile( file, peeraddress, peerport );
620 }
621}
622
623bool ServerPI::parsePort( const QString& pp )
624{
625 QStringList p = QStringList::split( ",", pp );
626 if ( p.count() != 6 ) return FALSE;
627
628 // h1,h2,h3,h4,p1,p2
629 peeraddress = QHostAddress( ( p[0].toInt() << 24 ) + ( p[1].toInt() << 16 ) +
630 ( p[2].toInt() << 8 ) + p[3].toInt() );
631 peerport = ( p[4].toInt() << 8 ) + p[5].toInt();
632 return TRUE;
633}
634
635void ServerPI::dtpCompleted()
636{
637 dtp->close();
638 waitsocket = 0;
639 send( "226 Closing data connection, file transfer successful" );
640}
641
642void ServerPI::dtpFailed()
643{
644 dtp->close();
645 waitsocket = 0;
646 send( "451 Requested action aborted: local error in processing" );
647}
648
649void ServerPI::dtpError( int )
650{
651 dtp->close();
652 waitsocket = 0;
653 send( "451 Requested action aborted: local error in processing" );
654}
655
656bool ServerPI::sendList( const QString& arg )
657{
658 QByteArray listing;
659 QBuffer buffer( listing );
660
661 if ( !buffer.open( IO_WriteOnly ) )
662 return FALSE;
663
664 QTextStream ts( &buffer );
665 QString fn = arg;
666
667 if ( fn.isEmpty() )
668 fn = directory.path();
669
670 QFileInfo fi( fn );
671 if ( !fi.exists() ) return FALSE;
672
673 // return file listing
674 if ( fi.isFile() ) {
675 ts << fileListing( &fi ) << endl;
676 }
677
678 // return directory listing
679 else if ( fi.isDir() ) {
680 QDir dir( fn );
681 const QFileInfoList *list = dir.entryInfoList( QDir::All | QDir::Hidden );
682
683 QFileInfoListIterator it( *list );
684 QFileInfo *info;
685
686 unsigned long total = 0;
687 while ( ( info = it.current() ) ) {
688 if ( info->fileName() != "." && info->fileName() != ".." )
689 total += info->size();
690 ++it;
691 }
692
693 ts << "total " << QString::number( total / 1024 ) << endl;
694
695 it.toFirst();
696 while ( ( info = it.current() ) ) {
697 if ( info->fileName() == "." || info->fileName() == ".." ) {
698 ++it;
699 continue;
700 }
701 ts << fileListing( info ) << endl;
702 ++it;
703 }
704 }
705
706 if ( passiv ) {
707 waitarray = buffer.buffer();
708 wait[SendByteArray] = TRUE;
709 if ( waitsocket )
710 newConnection( waitsocket );
711 }
712 else
713 dtp->sendByteArray( buffer.buffer(), peeraddress, peerport );
714 return TRUE;
715}
716
717QString ServerPI::fileListing( QFileInfo *info )
718{
719 if ( !info ) return QString::null;
720 QString s;
721
722 // type char
723 if ( info->isDir() )
724 s += "d";
725 else if ( info->isSymLink() )
726 s += "l";
727 else
728 s += "-";
729
730 // permisson string
731 s += permissionString( info ) + " ";
732
733 // number of hardlinks
734 int subdirs = 1;
735
736 if ( info->isDir() )
737 subdirs = 2;
738 // FIXME : this is to slow
739 //if ( info->isDir() )
740 //subdirs = QDir( info->absFilePath() ).entryList( QDir::Dirs ).count();
741
742 s += QString::number( subdirs ).rightJustify( 3, ' ', TRUE ) + " ";
743
744 // owner
745 s += info->owner().leftJustify( 8, ' ', TRUE ) + " ";
746
747 // group
748 s += info->group().leftJustify( 8, ' ', TRUE ) + " ";
749
750 // file size in bytes
751 s += QString::number( info->size() ).rightJustify( 9, ' ', TRUE ) + " ";
752
753 // last modified date
754 QDate date = info->lastModified().date();
755 QTime time = info->lastModified().time();
756 s += date.monthName( date.month() ) + " "
757 + QString::number( date.day() ).rightJustify( 2, ' ', TRUE ) + " "
758 + QString::number( time.hour() ).rightJustify( 2, '0', TRUE ) + ":"
759 + QString::number( time.minute() ).rightJustify( 2,'0', TRUE ) + " ";
760
761 // file name
762 s += info->fileName();
763
764 return s;
765}
766
767QString ServerPI::permissionString( QFileInfo *info )
768{
769 if ( !info ) return QString( "---------" );
770 QString s;
771
772 // user
773 if ( info->permission( QFileInfo::ReadUser ) ) s += "r";
774 else s += "-";
775 if ( info->permission( QFileInfo::WriteUser ) ) s += "w";
776 else s += "-";
777 if ( info->permission( QFileInfo::ExeUser ) ) s += "x";
778 else s += "-";
779
780 // group
781 if ( info->permission( QFileInfo::ReadGroup ) ) s += "r";
782 else s += "-";
783 if ( info->permission( QFileInfo::WriteGroup ) )s += "w";
784 else s += "-";
785 if ( info->permission( QFileInfo::ExeGroup ) ) s += "x";
786 else s += "-";
787
788 // exec
789 if ( info->permission( QFileInfo::ReadOther ) ) s += "r";
790 else s += "-";
791 if ( info->permission( QFileInfo::WriteOther ) ) s += "w";
792 else s += "-";
793 if ( info->permission( QFileInfo::ExeOther ) ) s += "x";
794 else s += "-";
795
796 return s;
797}
798
799void ServerPI::newConnection( int socket )
800{
801 //qDebug( "New incomming connection" );
802
803 if ( !passiv ) return;
804
805 if ( wait[SendFile] ) {
806 QStringList targets;
807 if ( backupRestoreGzip( waitfile, targets ) )
808 dtp->sendGzipFile( waitfile, targets );
809 else
810 dtp->sendFile( waitfile );
811 dtp->setSocket( socket );
812 }
813 else if ( wait[RetrieveFile] ) {
814 qDebug("check retrieve file");
815 if ( backupRestoreGzip( waitfile ) )
816 dtp->retrieveGzipFile( waitfile );
817 else
818 dtp->retrieveFile( waitfile );
819 dtp->setSocket( socket );
820 }
821 else if ( wait[SendByteArray] ) {
822 dtp->sendByteArray( waitarray );
823 dtp->setSocket( socket );
824 }
825 else if ( wait[RetrieveByteArray] ) {
826 qDebug("retrieve byte array");
827 dtp->retrieveByteArray();
828 dtp->setSocket( socket );
829 }
830 else
831 waitsocket = socket;
832
833 for( int i = 0; i < 4; i++ )
834 wait[i] = FALSE;
835}
836
837QString ServerPI::absFilePath( const QString& file )
838{
839 if ( file.isEmpty() ) return file;
840
841 QString filepath( file );
842 if ( file[0] != "/" )
843 filepath = directory.path() + "/" + file;
844
845 return filepath;
846}
847
848
849void ServerPI::timerEvent( QTimerEvent * )
850{
851 connectionClosed();
852}
853
854
855ServerDTP::ServerDTP( QObject *parent = 0, const char* name = 0)
856 : QSocket( parent, name ), mode( Idle ), createTargzProc( 0 ),
857retrieveTargzProc( 0 ), gzipProc( 0 )
858{
859
860 connect( this, SIGNAL( connected() ), SLOT( connected() ) );
861 connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) );
862 connect( this, SIGNAL( bytesWritten( int ) ), SLOT( bytesWritten( int ) ) );
863 connect( this, SIGNAL( readyRead() ), SLOT( readyRead() ) );
864
865 gzipProc = new QProcess( this, "gzipProc" );
866 gzipProc->setCommunication( QProcess::Stdin | QProcess::Stdout );
867
868 createTargzProc = new QProcess( QString("tar"), this, "createTargzProc");
869 createTargzProc->setCommunication( QProcess::Stdout );
870 createTargzProc->setWorkingDirectory( QDir::rootDirPath() );
871 connect( createTargzProc, SIGNAL( processExited() ), SLOT( targzDone() ) );
872
873 QStringList args = "tar";
874 args += "-xv";
875 retrieveTargzProc = new QProcess( args, this, "retrieveTargzProc" );
876 retrieveTargzProc->setCommunication( QProcess::Stdin );
877 retrieveTargzProc->setWorkingDirectory( QDir::rootDirPath() );
878 connect( retrieveTargzProc, SIGNAL( processExited() ),
879 SIGNAL( completed() ) );
880 connect( retrieveTargzProc, SIGNAL( processExited() ),
881 SLOT( extractTarDone() ) );
882}
883
884ServerDTP::~ServerDTP()
885{
886 buf.close();
887 file.close();
888 createTargzProc->kill();
889}
890
891void ServerDTP::extractTarDone()
892{
893 qDebug("extract done");
894 QCopEnvelope e( "QPE/Desktop", "restoreDone(QString)" );
895 e << file.name();
896}
897
898void ServerDTP::connected()
899{
900 // send file mode
901 switch ( mode ) {
902 case SendFile :
903 if ( !file.exists() || !file.open( IO_ReadOnly) ) {
904 emit failed();
905 mode = Idle;
906 return;
907 }
908
909 //qDebug( "Debug: Sending file '%s'", file.name().latin1() );
910
911 bytes_written = 0;
912 if ( file.size() == 0 ) {
913 //make sure it doesn't hang on empty files
914 file.close();
915 emit completed();
916 mode = Idle;
917 } else {
918
919 if( !file.atEnd() ) {
920 QCString s;
921 s.resize( block_size );
922 int bytes = file.readBlock( s.data(), block_size );
923 writeBlock( s.data(), bytes );
924 }
925 }
926 break;
927 case SendGzipFile:
928 if ( createTargzProc->isRunning() ) {
929 // SHOULDN'T GET HERE, BUT DOING A SAFETY CHECK ANYWAY
930 qWarning("Previous tar --gzip process is still running; killing it...");
931 createTargzProc->kill();
932 }
933
934 bytes_written = 0;
935 qDebug("==>start send tar process");
936 if ( !createTargzProc->start() )
937 qWarning("Error starting %s or %s",
938 createTargzProc->arguments().join(" ").latin1(),
939 gzipProc->arguments().join(" ").latin1() );
940 break;
941 case SendBuffer:
942 if ( !buf.open( IO_ReadOnly) ) {
943 emit failed();
944 mode = Idle;
945 return;
946 }
947
948 // qDebug( "Debug: Sending byte array" );
949 bytes_written = 0;
950 while( !buf.atEnd() )
951 putch( buf.getch() );
952 buf.close();
953 break;
954 case RetrieveFile:
955 // retrieve file mode
956 if ( file.exists() && !file.remove() ) {
957 emit failed();
958 mode = Idle;
959 return;
960 }
961
962 if ( !file.open( IO_WriteOnly) ) {
963 emit failed();
964 mode = Idle;
965 return;
966 }
967 // qDebug( "Debug: Retrieving file %s", file.name().latin1() );
968 break;
969 case RetrieveGzipFile:
970 qDebug("=-> starting tar process to receive .tgz file");
971 break;
972 case RetrieveBuffer:
973 // retrieve buffer mode
974 if ( !buf.open( IO_WriteOnly) ) {
975 emit failed();
976 mode = Idle;
977 return;
978 }
979 // qDebug( "Debug: Retrieving byte array" );
980 break;
981 case Idle:
982 qDebug("connection established but mode set to Idle; BUG!");
983 break;
984 }
985}
986
987void ServerDTP::connectionClosed()
988{
989 //qDebug( "Debug: Data connection closed %ld bytes written", bytes_written );
990
991 // send file mode
992 if ( SendFile == mode ) {
993 if ( bytes_written == file.size() )
994 emit completed();
995 else
996 emit failed();
997 }
998
999 // send buffer mode
1000 else if ( SendBuffer == mode ) {
1001 if ( bytes_written == buf.size() )
1002 emit completed();
1003 else
1004 emit failed();
1005 }
1006
1007 // retrieve file mode
1008 else if ( RetrieveFile == mode ) {
1009 file.close();
1010 emit completed();
1011 }
1012
1013 else if ( RetrieveGzipFile == mode ) {
1014 qDebug("Done writing ungzip file; closing input");
1015 gzipProc->flushStdin();
1016 gzipProc->closeStdin();
1017 }
1018
1019 // retrieve buffer mode
1020 else if ( RetrieveBuffer == mode ) {
1021 buf.close();
1022 emit completed();
1023 }
1024
1025 mode = Idle;
1026}
1027
1028void ServerDTP::bytesWritten( int bytes )
1029{
1030 bytes_written += bytes;
1031
1032 // send file mode
1033 if ( SendFile == mode ) {
1034
1035 if ( bytes_written == file.size() ) {
1036 // qDebug( "Debug: Sending complete: %d bytes", file.size() );
1037 file.close();
1038 emit completed();
1039 mode = Idle;
1040 }
1041 else if( !file.atEnd() ) {
1042 QCString s;
1043 s.resize( block_size );
1044 int bytes = file.readBlock( s.data(), block_size );
1045 writeBlock( s.data(), bytes );
1046 }
1047 }
1048
1049 // send buffer mode
1050 if ( SendBuffer == mode ) {
1051
1052 if ( bytes_written == buf.size() ) {
1053 // qDebug( "Debug: Sending complete: %d bytes", buf.size() );
1054 emit completed();
1055 mode = Idle;
1056 }
1057 }
1058}
1059
1060void ServerDTP::readyRead()
1061{
1062 // retrieve file mode
1063 if ( RetrieveFile == mode ) {
1064 QCString s;
1065 s.resize( bytesAvailable() );
1066 readBlock( s.data(), bytesAvailable() );
1067 file.writeBlock( s.data(), s.size() );
1068 }
1069 else if ( RetrieveGzipFile == mode ) {
1070 if ( !gzipProc->isRunning() )
1071 gzipProc->start();
1072
1073 QByteArray s;
1074 s.resize( bytesAvailable() );
1075 readBlock( s.data(), bytesAvailable() );
1076 gzipProc->writeToStdin( s );
1077 qDebug("wrote %d bytes to ungzip ", s.size() );
1078 }
1079 // retrieve buffer mode
1080 else if ( RetrieveBuffer == mode ) {
1081 QCString s;
1082 s.resize( bytesAvailable() );
1083 readBlock( s.data(), bytesAvailable() );
1084 buf.writeBlock( s.data(), s.size() );
1085 }
1086}
1087
1088void ServerDTP::writeTargzBlock()
1089{
1090 QByteArray block = gzipProc->readStdout();
1091 writeBlock( block.data(), block.size() );
1092 qDebug("writeTargzBlock %d", block.size());
1093 if ( !createTargzProc->isRunning() ) {
1094 qDebug("tar and gzip done");
1095 emit completed();
1096 mode = Idle;
1097 disconnect( gzipProc, SIGNAL( readyReadStdout() ),
1098 this, SLOT( writeTargzBlock() ) );
1099 }
1100}
1101
1102void ServerDTP::targzDone()
1103{
1104 //qDebug("targz done");
1105 disconnect( createTargzProc, SIGNAL( readyReadStdout() ),
1106 this, SLOT( gzipTarBlock() ) );
1107 gzipProc->closeStdin();
1108}
1109
1110void ServerDTP::gzipTarBlock()
1111{
1112 //qDebug("gzipTarBlock");
1113 if ( !gzipProc->isRunning() ) {
1114 //qDebug("auto start gzip proc");
1115 gzipProc->start();
1116 }
1117 gzipProc->writeToStdin( createTargzProc->readStdout() );
1118}
1119
1120void ServerDTP::sendFile( const QString fn, const QHostAddress& host, Q_UINT16 port )
1121{
1122 file.setName( fn );
1123 mode = SendFile;
1124 connectToHost( host.toString(), port );
1125}
1126
1127void ServerDTP::sendFile( const QString fn )
1128{
1129 file.setName( fn );
1130 mode = SendFile;
1131}
1132
1133void ServerDTP::sendGzipFile( const QString &fn,
1134 const QStringList &archiveTargets,
1135 const QHostAddress& host, Q_UINT16 port )
1136{
1137 sendGzipFile( fn, archiveTargets );
1138 connectToHost( host.toString(), port );
1139}
1140
1141void ServerDTP::sendGzipFile( const QString &fn,
1142 const QStringList &archiveTargets )
1143{
1144 mode = SendGzipFile;
1145 file.setName( fn );
1146
1147 QStringList args = "tar";
1148 args += "-cv";
1149 args += archiveTargets;
1150 qDebug("sendGzipFile %s", args.join(" ").latin1() );
1151 createTargzProc->setArguments( args );
1152 connect( createTargzProc,
1153 SIGNAL( readyReadStdout() ), SLOT( gzipTarBlock() ) );
1154
1155 gzipProc->setArguments( "gzip" );
1156 connect( gzipProc, SIGNAL( readyReadStdout() ),
1157 SLOT( writeTargzBlock() ) );
1158}
1159
1160void ServerDTP::gunzipDone()
1161{
1162 qDebug("gunzipDone");
1163 disconnect( gzipProc, SIGNAL( processExited() ),
1164 this, SLOT( gunzipDone() ) );
1165 retrieveTargzProc->closeStdin();
1166 disconnect( gzipProc, SIGNAL( readyReadStdout() ),
1167 this, SLOT( tarExtractBlock() ) );
1168}
1169
1170void ServerDTP::tarExtractBlock()
1171{
1172 qDebug("ungzipTarBlock");
1173 if ( !retrieveTargzProc->isRunning() ) {
1174 qDebug("auto start ungzip proc");
1175 if ( !retrieveTargzProc->start() )
1176 qWarning(" failed to start tar -x process");
1177 }
1178 retrieveTargzProc->writeToStdin( gzipProc->readStdout() );
1179}
1180
1181
1182void ServerDTP::retrieveFile( const QString fn, const QHostAddress& host, Q_UINT16 port )
1183{
1184 file.setName( fn );
1185 mode = RetrieveFile;
1186 connectToHost( host.toString(), port );
1187}
1188
1189void ServerDTP::retrieveFile( const QString fn )
1190{
1191 file.setName( fn );
1192 mode = RetrieveFile;
1193}
1194
1195void ServerDTP::retrieveGzipFile( const QString &fn )
1196{
1197 qDebug("retrieveGzipFile %s", fn.latin1());
1198 file.setName( fn );
1199 mode = RetrieveGzipFile;
1200
1201 gzipProc->setArguments( "gunzip" );
1202 connect( gzipProc, SIGNAL( readyReadStdout() ),
1203 SLOT( tarExtractBlock() ) );
1204 connect( gzipProc, SIGNAL( processExited() ),
1205 SLOT( gunzipDone() ) );
1206}
1207
1208void ServerDTP::retrieveGzipFile( const QString &fn, const QHostAddress& host, Q_UINT16 port )
1209{
1210 retrieveGzipFile( fn );
1211 connectToHost( host.toString(), port );
1212}
1213
1214void ServerDTP::sendByteArray( const QByteArray& array, const QHostAddress& host, Q_UINT16 port )
1215{
1216 buf.setBuffer( array );
1217 mode = SendBuffer;
1218 connectToHost( host.toString(), port );
1219}
1220
1221void ServerDTP::sendByteArray( const QByteArray& array )
1222{
1223 buf.setBuffer( array );
1224 mode = SendBuffer;
1225}
1226
1227void ServerDTP::retrieveByteArray( const QHostAddress& host, Q_UINT16 port )
1228{
1229 buf.setBuffer( QByteArray() );
1230 mode = RetrieveBuffer;
1231 connectToHost( host.toString(), port );
1232}
1233
1234void ServerDTP::retrieveByteArray()
1235{
1236 buf.setBuffer( QByteArray() );
1237 mode = RetrieveBuffer;
1238}
1239
1240void ServerDTP::setSocket( int socket )
1241{
1242 QSocket::setSocket( socket );
1243 connected();
1244}
1245
diff --git a/core/launcher/transferserver.h b/core/launcher/transferserver.h
new file mode 100644
index 0000000..076e460
--- a/dev/null
+++ b/core/launcher/transferserver.h
@@ -0,0 +1,168 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#include <qserversocket.h>
21#include <qsocket.h>
22#include <qdir.h>
23#include <qfile.h>
24#include <qbuffer.h>
25
26class QFileInfo;
27class QProcess;
28class TransferServer : public QServerSocket
29{
30 Q_OBJECT
31
32public:
33 TransferServer( Q_UINT16 port, QObject *parent = 0, const char* name = 0 );
34 virtual ~TransferServer();
35
36 void newConnection( int socket );
37};
38
39
40class ServerDTP : public QSocket
41{
42 Q_OBJECT
43
44public:
45 ServerDTP( QObject *parent = 0, const char* name = 0 );
46 ~ServerDTP();
47
48 enum Mode{ Idle = 0, SendFile, SendGzipFile, SendBuffer,
49 RetrieveFile, RetrieveGzipFile, RetrieveBuffer };
50
51 void sendFile( const QString fn );
52 void sendFile( const QString fn, const QHostAddress& host, Q_UINT16 port );
53 void sendGzipFile( const QString &fn, const QStringList &archiveTargets );
54 void sendGzipFile( const QString &fn, const QStringList &archiveTargets,
55 const QHostAddress& host, Q_UINT16 port );
56 void sendByteArray( const QByteArray& array );
57 void sendByteArray( const QByteArray& array, const QHostAddress& host, Q_UINT16 port );
58
59 void retrieveFile( const QString fn );
60 void retrieveFile( const QString fn, const QHostAddress& host, Q_UINT16 port );
61 void retrieveGzipFile( const QString &fn );
62 void retrieveGzipFile( const QString &fn, const QHostAddress& host, Q_UINT16 port );
63 void retrieveByteArray();
64 void retrieveByteArray( const QHostAddress& host, Q_UINT16 port );
65
66 Mode dtpMode() { return mode; }
67 QByteArray buffer() { return buf.buffer(); }
68
69 void setSocket( int socket );
70
71signals:
72 void completed();
73 void failed();
74
75private slots:
76 void connectionClosed();
77 void connected();
78 void bytesWritten( int bytes );
79 void readyRead();
80 void writeTargzBlock();
81 void targzDone();
82
83 void gzipTarBlock();
84 void tarExtractBlock();
85 void gunzipDone();
86 void extractTarDone();
87
88private:
89
90 unsigned long bytes_written;
91 Mode mode;
92 QFile file;
93 QBuffer buf;
94 QProcess *createTargzProc;
95 QProcess *retrieveTargzProc;
96 QProcess *gzipProc;
97};
98
99class ServerSocket : public QServerSocket
100{
101 Q_OBJECT
102
103public:
104 ServerSocket( Q_UINT16 port, QObject *parent = 0, const char* name = 0 )
105 : QServerSocket( port, 1, parent, name ) {}
106
107 void newConnection( int socket ) { emit newIncomming( socket ); }
108signals:
109 void newIncomming( int socket );
110};
111
112class ServerPI : public QSocket
113{
114 Q_OBJECT
115
116 enum State { Connected, Wait_USER, Wait_PASS, Ready, Forbidden };
117 enum Transfer { SendFile = 0, RetrieveFile = 1, SendByteArray = 2, RetrieveByteArray = 3 };
118
119public:
120 ServerPI( int socket, QObject *parent = 0, const char* name = 0 );
121 virtual ~ServerPI();
122
123protected slots:
124 void read();
125 void send( const QString& msg );
126 void process( const QString& command );
127 void connectionClosed();
128 void dtpCompleted();
129 void dtpFailed();
130 void dtpError( int );
131 void newConnection( int socket );
132
133protected:
134 bool checkUser( const QString& user );
135 bool checkPassword( const QString& pw );
136 bool checkReadFile( const QString& file );
137 bool checkWriteFile( const QString& file );
138 bool parsePort( const QString& pw );
139 bool backupRestoreGzip( const QString &file, QStringList &targets );
140 bool backupRestoreGzip( const QString &file );
141
142 bool sendList( const QString& arg );
143 void sendFile( const QString& file );
144 void retrieveFile( const QString& file );
145
146 QString permissionString( QFileInfo *info );
147 QString fileListing( QFileInfo *info );
148 QString absFilePath( const QString& file );
149
150 void timerEvent( QTimerEvent *e );
151
152private:
153 State state;
154 Q_UINT16 peerport;
155 QHostAddress peeraddress;
156 bool passiv;
157 bool wait[4];
158 ServerDTP *dtp;
159 ServerSocket *serversocket;
160 QString waitfile;
161 QDir directory;
162 QByteArray waitarray;
163 QString renameFrom;
164 QString lastCommand;
165 int waitsocket;
166};
167
168bool accessAuthorized(QHostAddress peeraddress);
diff --git a/core/launcher/wait.cpp b/core/launcher/wait.cpp
new file mode 100644
index 0000000..059e6f1
--- a/dev/null
+++ b/core/launcher/wait.cpp
@@ -0,0 +1,64 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include "wait.h"
22
23#include <qpe/resource.h>
24
25#include <qwidget.h>
26#include <qpixmap.h>
27#include <qpainter.h>
28
29
30Wait *lastWaitObject = NULL;
31
32
33Wait::Wait( QWidget *parent ) : QWidget( parent ),
34 pm( Resource::loadPixmap( "wait" ) ), waiting( FALSE )
35{
36 setFixedSize( pm.size() );
37 lastWaitObject = this;
38 hide();
39}
40
41
42Wait *Wait::getWaitObject()
43{
44 return lastWaitObject;
45}
46
47
48void Wait::setWaiting( bool w )
49{
50 waiting = w;
51 if ( w )
52 show();
53 else
54 hide();
55}
56
57
58void Wait::paintEvent( QPaintEvent * )
59{
60 QPainter p( this );
61 p.drawPixmap( 0, 0, pm );
62}
63
64
diff --git a/core/launcher/wait.h b/core/launcher/wait.h
new file mode 100644
index 0000000..519b654
--- a/dev/null
+++ b/core/launcher/wait.h
@@ -0,0 +1,45 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#ifndef __WAIT_H__
22#define __WAIT_H__
23
24#include <qpe/resource.h>
25
26#include <qwidget.h>
27#include <qpixmap.h>
28#include <qpainter.h>
29
30
31class Wait : public QWidget
32{
33public:
34 Wait( QWidget *parent );
35 void setWaiting( bool w );
36 void paintEvent( QPaintEvent * );
37 static Wait *getWaitObject();
38private:
39 QPixmap pm;
40 bool waiting;
41};
42
43
44#endif // __WAIT_H__
45