summaryrefslogtreecommitdiff
authorzecke <zecke>2003-08-25 15:00:50 (UTC)
committer zecke <zecke>2003-08-25 15:00:50 (UTC)
commitbf3c4abb9dff716e098f05852d9a3d8ac8cbcb44 (patch) (unidiff)
treef74d4765868000d27c45771573032515ac8db8be
parent292b097e7db25dd231381c5b09307a1fbe81a492 (diff)
downloadopie-bf3c4abb9dff716e098f05852d9a3d8ac8cbcb44.zip
opie-bf3c4abb9dff716e098f05852d9a3d8ac8cbcb44.tar.gz
opie-bf3c4abb9dff716e098f05852d9a3d8ac8cbcb44.tar.bz2
Initial revision
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/Makefile1085
-rw-r--r--core/launcher/applauncher.cpp705
-rw-r--r--core/launcher/applauncher.h82
-rw-r--r--core/launcher/documentlist.cpp646
-rw-r--r--core/launcher/documentlist.h77
-rw-r--r--core/launcher/firstuse.cpp517
-rw-r--r--core/launcher/firstuse.h84
-rw-r--r--core/launcher/launchertab.cpp284
-rw-r--r--core/launcher/launchertab.h90
-rw-r--r--core/launcher/qpe-de.ts324
-rw-r--r--core/launcher/qpe-en_GB.ts324
-rw-r--r--core/launcher/qpe-ja.ts352
-rw-r--r--core/launcher/qpe-no.ts329
-rw-r--r--core/launcher/server.cpp657
-rw-r--r--core/launcher/server.h94
-rw-r--r--core/launcher/server.pro118
-rw-r--r--core/launcher/serverapp.cpp617
-rw-r--r--core/launcher/serverapp.h116
-rw-r--r--core/launcher/serverinterface.cpp372
-rw-r--r--core/launcher/serverinterface.h72
-rw-r--r--core/launcher/specification.html213
-rw-r--r--core/launcher/suspendmonitor.cpp167
-rw-r--r--core/launcher/suspendmonitor.h56
-rw-r--r--core/launcher/syncdialog.cpp184
-rw-r--r--core/launcher/syncdialog.h58
25 files changed, 7623 insertions, 0 deletions
diff --git a/core/launcher/Makefile b/core/launcher/Makefile
new file mode 100644
index 0000000..a45dec8
--- a/dev/null
+++ b/core/launcher/Makefile
@@ -0,0 +1,1085 @@
1#############################################################################
2# Automatically generated from server/Makefile.in
3# Build options from
4#############################################################################
5
6default: all # package
7
8CONTROL = server/qpe-taskbar.control
9
10# Compiling
11 INTERFACE_DECL_PATH = .
12 SYSCONF_CXX = g++
13 SYSCONF_CC = gcc
14 DASHCROSS =
15
16# Compiling with support libraries
17 SYSCONF_CXXFLAGS_X11=
18 SYSCONF_CXXFLAGS_QT= -I$(QTDIR)/include
19 SYSCONF_CXXFLAGS_QTOPIA= -I$(QPEDIR)/include
20 SYSCONF_CFLAGS_QTOPIA= -I$(QPEDIR)/include
21 SYSCONF_CXXFLAGS_OPENGL= -I/usr/X11R6/include
22
23# Compiling YACC output
24SYSCONF_CXXFLAGS_YACC = -Wno-unused -Wno-parentheses
25
26# Linking with support libraries
27 SYSCONF_RPATH_X11=
28 SYSCONF_RPATH_QT= -Wl,-rpath,$(QTDIR)/lib
29 SYSCONF_RPATH_QTOPIA= -Wl,-rpath,$(QPEDIR)/lib
30 SYSCONF_RPATH_OPENGL= -Wl,-rpath,/usr/X11R6/lib
31
32# Linking with support libraries
33# X11
34 SYSCONF_LFLAGS_X11=
35 SYSCONF_LIBS_X11=
36# Qt, Qt+OpenGL
37 SYSCONF_LFLAGS_QT= -L$(QTDIR)/lib
38 SYSCONF_LFLAGS_QTOPIA= -L$(QPEDIR)/lib
39 SYSCONF_LIBS_QT = -lqte$(QT_THREAD_SUFFIX)
40 SYSCONF_LIBS_QT_OPENGL=
41 SYSCONF_LIBS_QTOPIA= -lqtopia
42# OpenGL
43 SYSCONF_LFLAGS_OPENGL= -L/usr/X11R6/lib
44 SYSCONF_LIBS_OPENGL=
45# Yacc
46 SYSCONF_LIBS_YACC=
47
48# Linking applications
49 SYSCONF_LINK = gcc
50 SYSCONF_LFLAGS =
51 SYSCONF_LIBS =
52
53# Link flags for shared objects
54 SYSCONF_LFLAGS_SHOBJ= -shared
55
56# Flags for threading
57 SYSCONF_CFLAGS_THREAD= -D_REENTRANT
58 SYSCONF_CXXFLAGS_THREAD= -D_REENTRANT
59 SYSCONF_LFLAGS_THREAD=
60 SYSCONF_LIBS_THREAD= -lpthread
61
62# Meta-object compiler
63 SYSCONF_MOC = $(QTDIR)/bin/moc
64
65# UI compiler
66 SYSCONF_UIC = $(QTDIR)/bin/uic
67
68# Linking shared libraries
69# - Build the $(TARGET) library, eg. lib$(TARGET).so.2.2.2
70# - Place target in $(DESTDIR) - which has a trailing /
71# - Usually needs to incorporate $(VER_MAJ), $(VER_MIN) and $(VER_PATCH)
72#
73 SYSCONF_LINK_SHLIB= gcc
74 SYSCONF_LINK_TARGET_SHARED= lib$(TARGET).so.$(VER_MAJ).$(VER_MIN).$(VER_PATCH)
75 SYSCONF_LINK_LIB_SHARED= $(SYSCONF_LINK_SHLIB) -shared -Wl,-soname,lib$(TARGET).so.$(VER_MAJ) \
76 $(LFLAGS) -o $(SYSCONF_LINK_TARGET_SHARED) \
77 $(OBJECTS) $(OBJMOC) $(LIBS) && \
78 mv $(SYSCONF_LINK_TARGET_SHARED) $(DESTDIR); \
79 cd $(DESTDIR) && \
80 rm -f lib$(TARGET).so lib$(TARGET).so.$(VER_MAJ) lib$(TARGET).so.$(VER_MAJ).$(VER_MIN); \
81 ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so; \
82 ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so.$(VER_MAJ); \
83 ln -s $(SYSCONF_LINK_TARGET_SHARED) lib$(TARGET).so.$(VER_MAJ).$(VER_MIN)
84
85# Linking static libraries
86# - Build the $(TARGET) library, eg. lib$(TARGET).a
87# - Place target in $(DESTDIR) - which has a trailing /
88#
89 SYSCONF_AR = ar cqs
90SYSCONF_LINK_TARGET_STATIC = lib$(TARGET).a
91 SYSCONF_LINK_LIB_STATIC= rm -f $(DESTDIR)$(SYSCONF_LINK_TARGET_STATIC) ; \
92 $(SYSCONF_AR) $(DESTDIR)$(SYSCONF_LINK_TARGET_STATIC) $(OBJECTS) $(OBJMOC)
93# Compiling application source
94 SYSCONF_CXXFLAGS= -pipe -DQWS -fno-exceptions -fno-rtti -g -Wall -W
95 SYSCONF_CFLAGS = -pipe -g -Wall -W
96# Default link type (static linking is still be used where required)
97 SYSCONF_LINK_LIB= $(SYSCONF_LINK_LIB_SHARED)
98 SYSCONF_LINK_TARGET= $(SYSCONF_LINK_TARGET_SHARED)
99# Compiling library source
100 SYSCONF_CXXFLAGS_LIB= -fPIC
101 SYSCONF_CFLAGS_LIB= -fPIC
102# Compiling shared-object source
103 SYSCONF_CXXFLAGS_SHOBJ= -fPIC
104 SYSCONF_CFLAGS_SHOBJ= -fPIC
105# Linking Qt
106 SYSCONF_LIBS_QTLIB= $(SYSCONF_LFLAGS_X11) $(QT_LIBS_MT) $(QT_LIBS_OPT)
107# Linking Qt applications
108 SYSCONF_LIBS_QTAPP=
109
110# Platform output directories
111MOC_DIR = .moc/linux-generic-g++/
112OBJECTS_DIR = .obj/linux-generic-g++/
113
114#############################################################################
115
116####### Compiler, tools and options
117
118 CXX =$(SYSCONF_CXX) $(QT_CXX_MT)
119 CXXFLAGS=$(SYSCONF_CXXFLAGS_QTOPIA) $(SYSCONF_CXXFLAGS_QT) $(SYSCONF_CXXFLAGS) -DQTOPIA_APP_INTERFACE
120 CC =$(SYSCONF_CC) $(QT_C_MT)
121 CFLAGS =$(SYSCONF_CFLAGS_QTOPIA) $(SYSCONF_CFLAGS) -DQTOPIA_APP_INTERFACE
122 INCPATH =-I$(MOC_DIR) -I$(QPEDIR)/src/settings/calibrate -I$(QPEDIR)/src/3rdparty/libraries/rsync
123 LFLAGS =$(SYSCONF_LFLAGS_QTOPIA) $(SYSCONF_RPATH_QTOPIA) $(SYSCONF_LFLAGS_QT) $(SYSCONF_RPATH_QT) $(SYSCONF_LFLAGS) $(QT_LFLAGS_MT)
124 LIBS =$(SUBLIBS) -ljpeg -Wl,-Bstatic -Wl,-whole-archive -Wl,-no-whole-archive -Wl,-Bdynamic -lcrypt -luuid -lqpe $(SYSCONF_LIBS_QTOPIA) $(SYSCONF_LIBS_QT) $(SYSCONF_LIBS) $(SYSCONF_LIBS_QTAPP)
125 MOC =$(SYSCONF_MOC)
126 UIC =$(SYSCONF_UIC)
127
128####### Target
129
130DESTDIR = $(QPEDIR)/bin/
131VER_MAJ = 1
132VER_MIN = 0
133VER_PATCH = 0
134 TARGET= qpe
135TARGET1 = lib$(TARGET).so.$(VER_MAJ)
136
137####### Files
138
139 HEADERS =server.h \
140 serverinterface.h \
141 launchertab.h \
142 documentlist.h \
143 suspendmonitor.h \
144 appicons.h \
145 taskbar.h \
146 runningappbar.h \
147 applauncher.h \
148 stabmon.h \
149 inputmethods.h \
150 systray.h \
151 wait.h \
152 shutdownimpl.h \
153 launcher.h \
154 launcherview.h \
155 $(QPEDIR)/src/settings/calibrate/calibrate.h \
156 startmenu.h \
157 transferserver.h \
158 qcopbridge.h \
159 packageslave.h \
160 irserver.h \
161 firstuse.h \
162 $(QPEDIR)/src/3rdparty/libraries/rsync/buf.h \
163 $(QPEDIR)/src/3rdparty/libraries/rsync/checksum.h \
164 $(QPEDIR)/src/3rdparty/libraries/rsync/command.h \
165 $(QPEDIR)/src/3rdparty/libraries/rsync/emit.h \
166 $(QPEDIR)/src/3rdparty/libraries/rsync/job.h \
167 $(QPEDIR)/src/3rdparty/libraries/rsync/netint.h \
168 $(QPEDIR)/src/3rdparty/libraries/rsync/protocol.h \
169 $(QPEDIR)/src/3rdparty/libraries/rsync/prototab.h \
170 $(QPEDIR)/src/3rdparty/libraries/rsync/rsync.h \
171 $(QPEDIR)/src/3rdparty/libraries/rsync/search.h \
172 $(QPEDIR)/src/3rdparty/libraries/rsync/stream.h \
173 $(QPEDIR)/src/3rdparty/libraries/rsync/sumset.h \
174 $(QPEDIR)/src/3rdparty/libraries/rsync/trace.h \
175 $(QPEDIR)/src/3rdparty/libraries/rsync/types.h \
176 $(QPEDIR)/src/3rdparty/libraries/rsync/util.h \
177 $(QPEDIR)/src/3rdparty/libraries/rsync/whole.h \
178 $(QPEDIR)/src/3rdparty/libraries/rsync/config_rsync.h \
179 $(QPEDIR)/src/3rdparty/libraries/rsync/qrsync.h \
180 syncdialog.h \
181 serverapp.h
182 SOURCES =server.cpp \
183 serverinterface.cpp \
184 launchertab.cpp \
185 documentlist.cpp \
186 suspendmonitor.cpp \
187 appicons.cpp \
188 taskbar.cpp \
189 runningappbar.cpp \
190 applauncher.cpp \
191 stabmon.cpp \
192 inputmethods.cpp \
193 systray.cpp \
194 wait.cpp \
195 shutdownimpl.cpp \
196 launcher.cpp \
197 launcherview.cpp \
198 $(QPEDIR)/src/settings/calibrate/calibrate.cpp \
199 transferserver.cpp \
200 packageslave.cpp \
201 irserver.cpp \
202 qcopbridge.cpp \
203 startmenu.cpp \
204 main.cpp \
205 firstuse.cpp \
206 $(QPEDIR)/src/3rdparty/libraries/rsync/base64.c \
207 $(QPEDIR)/src/3rdparty/libraries/rsync/buf.c \
208 $(QPEDIR)/src/3rdparty/libraries/rsync/checksum.c \
209 $(QPEDIR)/src/3rdparty/libraries/rsync/command.c \
210 $(QPEDIR)/src/3rdparty/libraries/rsync/delta.c \
211 $(QPEDIR)/src/3rdparty/libraries/rsync/emit.c \
212 $(QPEDIR)/src/3rdparty/libraries/rsync/hex.c \
213 $(QPEDIR)/src/3rdparty/libraries/rsync/job.c \
214 $(QPEDIR)/src/3rdparty/libraries/rsync/mdfour.c \
215 $(QPEDIR)/src/3rdparty/libraries/rsync/mksum.c \
216 $(QPEDIR)/src/3rdparty/libraries/rsync/msg.c \
217 $(QPEDIR)/src/3rdparty/libraries/rsync/netint.c \
218 $(QPEDIR)/src/3rdparty/libraries/rsync/patch.c \
219 $(QPEDIR)/src/3rdparty/libraries/rsync/prototab.c \
220 $(QPEDIR)/src/3rdparty/libraries/rsync/readsums.c \
221 $(QPEDIR)/src/3rdparty/libraries/rsync/scoop.c \
222 $(QPEDIR)/src/3rdparty/libraries/rsync/search.c \
223 $(QPEDIR)/src/3rdparty/libraries/rsync/stats.c \
224 $(QPEDIR)/src/3rdparty/libraries/rsync/stream.c \
225 $(QPEDIR)/src/3rdparty/libraries/rsync/sumset.c \
226 $(QPEDIR)/src/3rdparty/libraries/rsync/trace.c \
227 $(QPEDIR)/src/3rdparty/libraries/rsync/tube.c \
228 $(QPEDIR)/src/3rdparty/libraries/rsync/util.c \
229 $(QPEDIR)/src/3rdparty/libraries/rsync/version.c \
230 $(QPEDIR)/src/3rdparty/libraries/rsync/whole.c \
231 $(QPEDIR)/src/3rdparty/libraries/rsync/qrsync.cpp \
232 syncdialog.cpp \
233 serverapp.cpp
234 OBJECTS =$(OBJECTS_DIR)/server.o \
235 $(OBJECTS_DIR)/serverinterface.o \
236 $(OBJECTS_DIR)/launchertab.o \
237 $(OBJECTS_DIR)/documentlist.o \
238 $(OBJECTS_DIR)/suspendmonitor.o \
239 $(OBJECTS_DIR)/appicons.o \
240 $(OBJECTS_DIR)/taskbar.o \
241 $(OBJECTS_DIR)/runningappbar.o \
242 $(OBJECTS_DIR)/applauncher.o \
243 $(OBJECTS_DIR)/stabmon.o \
244 $(OBJECTS_DIR)/inputmethods.o \
245 $(OBJECTS_DIR)/systray.o \
246 $(OBJECTS_DIR)/wait.o \
247 $(OBJECTS_DIR)/shutdownimpl.o \
248 $(OBJECTS_DIR)/launcher.o \
249 $(OBJECTS_DIR)/launcherview.o \
250 $(OBJECTS_DIR)/calibrate.o \
251 $(OBJECTS_DIR)/transferserver.o \
252 $(OBJECTS_DIR)/packageslave.o \
253 $(OBJECTS_DIR)/irserver.o \
254 $(OBJECTS_DIR)/qcopbridge.o \
255 $(OBJECTS_DIR)/startmenu.o \
256 $(OBJECTS_DIR)/main.o \
257 $(OBJECTS_DIR)/firstuse.o \
258 $(OBJECTS_DIR)/base64.o \
259 $(OBJECTS_DIR)/buf.o \
260 $(OBJECTS_DIR)/checksum.o \
261 $(OBJECTS_DIR)/command.o \
262 $(OBJECTS_DIR)/delta.o \
263 $(OBJECTS_DIR)/emit.o \
264 $(OBJECTS_DIR)/hex.o \
265 $(OBJECTS_DIR)/job.o \
266 $(OBJECTS_DIR)/mdfour.o \
267 $(OBJECTS_DIR)/mksum.o \
268 $(OBJECTS_DIR)/msg.o \
269 $(OBJECTS_DIR)/netint.o \
270 $(OBJECTS_DIR)/patch.o \
271 $(OBJECTS_DIR)/prototab.o \
272 $(OBJECTS_DIR)/readsums.o \
273 $(OBJECTS_DIR)/scoop.o \
274 $(OBJECTS_DIR)/search.o \
275 $(OBJECTS_DIR)/stats.o \
276 $(OBJECTS_DIR)/stream.o \
277 $(OBJECTS_DIR)/sumset.o \
278 $(OBJECTS_DIR)/trace.o \
279 $(OBJECTS_DIR)/tube.o \
280 $(OBJECTS_DIR)/util.o \
281 $(OBJECTS_DIR)/version.o \
282 $(OBJECTS_DIR)/whole.o \
283 $(OBJECTS_DIR)/qrsync.o \
284 $(OBJECTS_DIR)/syncdialog.o \
285 $(OBJECTS_DIR)/serverapp.o \
286 $(OBJECTS_DIR)/shutdown.o
287INTERFACES = shutdown.ui
288UICDECLS = shutdown.h
289UICIMPLS = shutdown.cpp
290 SRCMOC =$(MOC_DIR)/moc_server.cpp \
291 $(MOC_DIR)/moc_launchertab.cpp \
292 $(MOC_DIR)/moc_documentlist.cpp \
293 $(MOC_DIR)/moc_suspendmonitor.cpp \
294 $(MOC_DIR)/moc_appicons.cpp \
295 $(MOC_DIR)/moc_taskbar.cpp \
296 $(MOC_DIR)/moc_runningappbar.cpp \
297 $(MOC_DIR)/moc_applauncher.cpp \
298 $(MOC_DIR)/moc_inputmethods.cpp \
299 $(MOC_DIR)/moc_systray.cpp \
300 $(MOC_DIR)/moc_shutdownimpl.cpp \
301 $(MOC_DIR)/moc_launcher.cpp \
302 $(MOC_DIR)/moc_launcherview.cpp \
303 $(MOC_DIR)/moc_calibrate.cpp \
304 $(MOC_DIR)/moc_startmenu.cpp \
305 $(MOC_DIR)/moc_transferserver.cpp \
306 $(MOC_DIR)/moc_qcopbridge.cpp \
307 $(MOC_DIR)/moc_packageslave.cpp \
308 $(MOC_DIR)/moc_irserver.cpp \
309 $(MOC_DIR)/moc_firstuse.cpp \
310 $(MOC_DIR)/moc_syncdialog.cpp \
311 $(MOC_DIR)/moc_serverapp.cpp \
312 $(MOC_DIR)/moc_shutdown.cpp \
313 $(MOC_DIR)/serverinterface.moc \
314 $(MOC_DIR)/documentlist.moc \
315 $(MOC_DIR)/appicons.moc \
316 $(MOC_DIR)/taskbar.moc \
317 $(MOC_DIR)/serverapp.moc
318 OBJMOC =$(OBJECTS_DIR)/moc_server.o \
319 $(OBJECTS_DIR)/moc_launchertab.o \
320 $(OBJECTS_DIR)/moc_documentlist.o \
321 $(OBJECTS_DIR)/moc_suspendmonitor.o \
322 $(OBJECTS_DIR)/moc_appicons.o \
323 $(OBJECTS_DIR)/moc_taskbar.o \
324 $(OBJECTS_DIR)/moc_runningappbar.o \
325 $(OBJECTS_DIR)/moc_applauncher.o \
326 $(OBJECTS_DIR)/moc_inputmethods.o \
327 $(OBJECTS_DIR)/moc_systray.o \
328 $(OBJECTS_DIR)/moc_shutdownimpl.o \
329 $(OBJECTS_DIR)/moc_launcher.o \
330 $(OBJECTS_DIR)/moc_launcherview.o \
331 $(OBJECTS_DIR)/moc_calibrate.o \
332 $(OBJECTS_DIR)/moc_startmenu.o \
333 $(OBJECTS_DIR)/moc_transferserver.o \
334 $(OBJECTS_DIR)/moc_qcopbridge.o \
335 $(OBJECTS_DIR)/moc_packageslave.o \
336 $(OBJECTS_DIR)/moc_irserver.o \
337 $(OBJECTS_DIR)/moc_firstuse.o \
338 $(OBJECTS_DIR)/moc_syncdialog.o \
339 $(OBJECTS_DIR)/moc_serverapp.o \
340 $(OBJECTS_DIR)/moc_shutdown.o
341
342
343####### Implicit rules
344
345.SUFFIXES: .cpp .cxx .cc .C .c
346
347.cpp.o:
348 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
349
350.cxx.o:
351 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
352
353.cc.o:
354 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
355
356.C.o:
357 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
358
359.c.o:
360 $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
361
362####### Build rules
363
364
365all: $(DESTDIR)$(TARGET)
366
367$(DESTDIR)$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS)
368 $(SYSCONF_LINK) $(LFLAGS) -o $(DESTDIR)$(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)
369
370moc: $(SRCMOC)
371
372tmake:
373 tmake server.pro
374
375clean:
376 -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS)
377 -rm -f *~ core
378 -rm -f allmoc.cpp
379
380####### Extension Modules
381
382listpromodules:
383 @echo
384
385listallmodules:
386 @echo
387
388listaddonpromodules:
389 @echo
390
391listaddonentmodules:
392 @echo
393
394
395REQUIRES=
396
397####### Sub-libraries
398
399
400###### Combined headers
401
402
403
404####### Compile
405
406$(OBJECTS_DIR)/server.o: server.cpp \
407 server.h \
408 serverapp.h \
409 shutdownimpl.h \
410 shutdown.h \
411 launcher.h \
412 launcherview.h \
413 launchertab.h \
414 serverinterface.h \
415 startmenu.h \
416 transferserver.h \
417 qcopbridge.h \
418 irserver.h \
419 packageslave.h \
420 $(QPEDIR)/src/settings/calibrate/calibrate.h \
421 $(QPEDIR)/src/3rdparty/libraries/rsync/qrsync.h \
422 syncdialog.h \
423 applauncher.h \
424 suspendmonitor.h \
425 documentlist.h \
426 apps.h \
427 ../applications/addressbook/addressbook.h \
428 ../applications/datebook/datebook.h \
429 ../applications/todo/mainwindow.h \
430 ../libraries/qtopiacalc/calculator.h \
431 ../applications/clock/clock.h \
432 ../applications/helpbrowser/helpbrowser.h \
433 ../applications/imageviewer/showimg.h \
434 ../applications/mediaplayer/maindocumentwidgetstack.h \
435 ../applications/textedit/textedit.h \
436 ../games/fifteen/fifteen.h \
437 ../games/mindbreaker/mindbreaker.h \
438 ../games/minesweep/minesweep.h \
439 ../games/qasteroids/toplevel.h \
440 ../games/snake/interface.h \
441 ../games/solitaire/canvascardwindow.h \
442 ../settings/systemtime/settime.h \
443 ../settings/appearance/appearance.h
444 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/server.o server.cpp
445
446$(OBJECTS_DIR)/serverinterface.o: serverinterface.cpp \
447 $(MOC_DIR)/serverinterface.moc \
448 serverinterface.h \
449 server.h \
450 documentlist.h
451 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/serverinterface.o serverinterface.cpp
452
453$(OBJECTS_DIR)/launchertab.o: launchertab.cpp \
454 launchertab.h
455 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/launchertab.o launchertab.cpp
456
457$(OBJECTS_DIR)/documentlist.o: documentlist.cpp \
458 $(MOC_DIR)/documentlist.moc \
459 documentlist.h \
460 serverinterface.h
461 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/documentlist.o documentlist.cpp
462
463$(OBJECTS_DIR)/suspendmonitor.o: suspendmonitor.cpp \
464 suspendmonitor.h
465 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/suspendmonitor.o suspendmonitor.cpp
466
467$(OBJECTS_DIR)/appicons.o: appicons.cpp \
468 $(MOC_DIR)/appicons.moc \
469 appicons.h
470 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/appicons.o appicons.cpp
471
472$(OBJECTS_DIR)/taskbar.o: taskbar.cpp \
473 $(MOC_DIR)/taskbar.moc \
474 startmenu.h \
475 inputmethods.h \
476 runningappbar.h \
477 systray.h \
478 wait.h \
479 appicons.h \
480 taskbar.h \
481 serverinterface.h \
482 server.h
483 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/taskbar.o taskbar.cpp
484
485$(OBJECTS_DIR)/runningappbar.o: runningappbar.cpp \
486 runningappbar.h \
487 serverinterface.h
488 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/runningappbar.o runningappbar.cpp
489
490$(OBJECTS_DIR)/applauncher.o: applauncher.cpp \
491 applauncher.h \
492 documentlist.h
493 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/applauncher.o applauncher.cpp
494
495$(OBJECTS_DIR)/stabmon.o: stabmon.cpp \
496 stabmon.h
497 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/stabmon.o stabmon.cpp
498
499$(OBJECTS_DIR)/inputmethods.o: inputmethods.cpp \
500 inputmethods.h \
501 ../plugins/inputmethods/handwriting/handwritingimpl.h \
502 ../plugins/inputmethods/keyboard/keyboardimpl.h \
503 ../3rdparty/plugins/inputmethods/pickboard/pickboardimpl.h
504 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/inputmethods.o inputmethods.cpp
505
506$(OBJECTS_DIR)/systray.o: systray.cpp \
507 systray.h \
508 ../plugins/applets/clockapplet/clockappletimpl.h
509 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/systray.o systray.cpp
510
511$(OBJECTS_DIR)/wait.o: wait.cpp \
512 wait.h
513 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/wait.o wait.cpp
514
515$(OBJECTS_DIR)/shutdownimpl.o: shutdownimpl.cpp \
516 shutdownimpl.h \
517 shutdown.h
518 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/shutdownimpl.o shutdownimpl.cpp
519
520$(OBJECTS_DIR)/launcher.o: launcher.cpp \
521 startmenu.h \
522 taskbar.h \
523 serverinterface.h \
524 launcherview.h \
525 launcher.h \
526 launchertab.h \
527 server.h
528 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/launcher.o launcher.cpp
529
530$(OBJECTS_DIR)/launcherview.o: launcherview.cpp \
531 launcherview.h
532 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/launcherview.o launcherview.cpp
533
534$(OBJECTS_DIR)/calibrate.o: $(QPEDIR)/src/settings/calibrate/calibrate.cpp \
535 $(QPEDIR)/src/settings/calibrate/calibrate.h
536 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/calibrate.o $(QPEDIR)/src/settings/calibrate/calibrate.cpp
537
538$(OBJECTS_DIR)/transferserver.o: transferserver.cpp \
539 transferserver.h
540 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/transferserver.o transferserver.cpp
541
542$(OBJECTS_DIR)/packageslave.o: packageslave.cpp \
543 packageslave.h
544 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/packageslave.o packageslave.cpp
545
546$(OBJECTS_DIR)/irserver.o: irserver.cpp \
547 irserver.h \
548 obexinterface.h
549 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/irserver.o irserver.cpp
550
551$(OBJECTS_DIR)/qcopbridge.o: qcopbridge.cpp \
552 qcopbridge.h \
553 transferserver.h
554 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/qcopbridge.o qcopbridge.cpp
555
556$(OBJECTS_DIR)/startmenu.o: startmenu.cpp \
557 startmenu.h
558 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/startmenu.o startmenu.cpp
559
560$(OBJECTS_DIR)/main.o: main.cpp \
561 server.h \
562 serverapp.h \
563 shutdownimpl.h \
564 shutdown.h \
565 taskbar.h \
566 serverinterface.h \
567 startmenu.h \
568 stabmon.h \
569 launcher.h \
570 launcherview.h \
571 launchertab.h \
572 firstuse.h \
573 $(QPEDIR)/src/settings/calibrate/../calibrate/calibrate.h
574 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/main.o main.cpp
575
576$(OBJECTS_DIR)/firstuse.o: firstuse.cpp \
577 firstuse.h \
578 inputmethods.h \
579 applauncher.h \
580 serverapp.h \
581 shutdownimpl.h \
582 shutdown.h \
583 ../settings/calibrate/calibrate.h \
584 documentlist.h
585 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/firstuse.o firstuse.cpp
586
587$(OBJECTS_DIR)/base64.o: $(QPEDIR)/src/3rdparty/libraries/rsync/base64.c \
588 $(QPEDIR)/src/3rdparty/libraries/rsync/config_rsync.h \
589 $(QPEDIR)/src/3rdparty/libraries/rsync/config_linux.h \
590 $(QPEDIR)/src/3rdparty/libraries/rsync/rsync.h
591 $(CC) -c $(CFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/base64.o $(QPEDIR)/src/3rdparty/libraries/rsync/base64.c
592
593$(OBJECTS_DIR)/buf.o: $(QPEDIR)/src/3rdparty/libraries/rsync/buf.c \
594 $(QPEDIR)/src/3rdparty/libraries/rsync/config_rsync.h \
595 $(QPEDIR)/src/3rdparty/libraries/rsync/config_linux.h \
596 $(QPEDIR)/src/3rdparty/libraries/rsync/rsync.h \
597 $(QPEDIR)/src/3rdparty/libraries/rsync/trace.h \
598 $(QPEDIR)/src/3rdparty/libraries/rsync/buf.h \
599 $(QPEDIR)/src/3rdparty/libraries/rsync/util.h
600 $(CC) -c $(CFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/buf.o $(QPEDIR)/src/3rdparty/libraries/rsync/buf.c
601
602$(OBJECTS_DIR)/checksum.o: $(QPEDIR)/src/3rdparty/libraries/rsync/checksum.c \
603 $(QPEDIR)/src/3rdparty/libraries/rsync/config_rsync.h \
604 $(QPEDIR)/src/3rdparty/libraries/rsync/config_linux.h \
605 $(QPEDIR)/src/3rdparty/libraries/rsync/rsync.h \
606 $(QPEDIR)/src/3rdparty/libraries/rsync/checksum.h
607 $(CC) -c $(CFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/checksum.o $(QPEDIR)/src/3rdparty/libraries/rsync/checksum.c
608
609$(OBJECTS_DIR)/command.o: $(QPEDIR)/src/3rdparty/libraries/rsync/command.c \
610 $(QPEDIR)/src/3rdparty/libraries/rsync/config_rsync.h \
611 $(QPEDIR)/src/3rdparty/libraries/rsync/config_linux.h \
612 $(QPEDIR)/src/3rdparty/libraries/rsync/rsync.h \
613 $(QPEDIR)/src/3rdparty/libraries/rsync/command.h
614 $(CC) -c $(CFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/command.o $(QPEDIR)/src/3rdparty/libraries/rsync/command.c
615
616$(OBJECTS_DIR)/delta.o: $(QPEDIR)/src/3rdparty/libraries/rsync/delta.c \
617 $(QPEDIR)/src/3rdparty/libraries/rsync/config_rsync.h \
618 $(QPEDIR)/src/3rdparty/libraries/rsync/config_linux.h \
619 $(QPEDIR)/src/3rdparty/libraries/rsync/rsync.h \
620 $(QPEDIR)/src/3rdparty/libraries/rsync/emit.h \
621 $(QPEDIR)/src/3rdparty/libraries/rsync/stream.h \
622 $(QPEDIR)/src/3rdparty/libraries/rsync/util.h \
623 $(QPEDIR)/src/3rdparty/libraries/rsync/sumset.h \
624 $(QPEDIR)/src/3rdparty/libraries/rsync/job.h \
625 $(QPEDIR)/src/3rdparty/libraries/rsync/trace.h \
626 $(QPEDIR)/src/3rdparty/libraries/rsync/checksum.h \
627 $(QPEDIR)/src/3rdparty/libraries/rsync/search.h \
628 $(QPEDIR)/src/3rdparty/libraries/rsync/types.h
629 $(CC) -c $(CFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/delta.o $(QPEDIR)/src/3rdparty/libraries/rsync/delta.c
630
631$(OBJECTS_DIR)/emit.o: $(QPEDIR)/src/3rdparty/libraries/rsync/emit.c \
632 $(QPEDIR)/src/3rdparty/libraries/rsync/config_rsync.h \
633 $(QPEDIR)/src/3rdparty/libraries/rsync/config_linux.h \
634 $(QPEDIR)/src/3rdparty/libraries/rsync/rsync.h \
635 $(QPEDIR)/src/3rdparty/libraries/rsync/command.h \
636 $(QPEDIR)/src/3rdparty/libraries/rsync/protocol.h \
637 $(QPEDIR)/src/3rdparty/libraries/rsync/trace.h \
638 $(QPEDIR)/src/3rdparty/libraries/rsync/emit.h \
639 $(QPEDIR)/src/3rdparty/libraries/rsync/prototab.h \
640 $(QPEDIR)/src/3rdparty/libraries/rsync/netint.h \
641 $(QPEDIR)/src/3rdparty/libraries/rsync/sumset.h \
642 $(QPEDIR)/src/3rdparty/libraries/rsync/job.h
643 $(CC) -c $(CFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/emit.o $(QPEDIR)/src/3rdparty/libraries/rsync/emit.c
644
645$(OBJECTS_DIR)/hex.o: $(QPEDIR)/src/3rdparty/libraries/rsync/hex.c \
646 $(QPEDIR)/src/3rdparty/libraries/rsync/config_rsync.h \
647 $(QPEDIR)/src/3rdparty/libraries/rsync/config_linux.h \
648 $(QPEDIR)/src/3rdparty/libraries/rsync/rsync.h
649 $(CC) -c $(CFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/hex.o $(QPEDIR)/src/3rdparty/libraries/rsync/hex.c
650
651$(OBJECTS_DIR)/job.o: $(QPEDIR)/src/3rdparty/libraries/rsync/job.c \
652 $(QPEDIR)/src/3rdparty/libraries/rsync/config_rsync.h \
653 $(QPEDIR)/src/3rdparty/libraries/rsync/config_linux.h \
654 $(QPEDIR)/src/3rdparty/libraries/rsync/rsync.h \
655 $(QPEDIR)/src/3rdparty/libraries/rsync/stream.h \
656 $(QPEDIR)/src/3rdparty/libraries/rsync/util.h \
657 $(QPEDIR)/src/3rdparty/libraries/rsync/sumset.h \
658 $(QPEDIR)/src/3rdparty/libraries/rsync/job.h \
659 $(QPEDIR)/src/3rdparty/libraries/rsync/trace.h
660 $(CC) -c $(CFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/job.o $(QPEDIR)/src/3rdparty/libraries/rsync/job.c
661
662$(OBJECTS_DIR)/mdfour.o: $(QPEDIR)/src/3rdparty/libraries/rsync/mdfour.c \
663 $(QPEDIR)/src/3rdparty/libraries/rsync/config_rsync.h \
664 $(QPEDIR)/src/3rdparty/libraries/rsync/config_linux.h \
665 $(QPEDIR)/src/3rdparty/libraries/rsync/rsync.h \
666 $(QPEDIR)/src/3rdparty/libraries/rsync/trace.h \
667 $(QPEDIR)/src/3rdparty/libraries/rsync/types.h
668 $(CC) -c $(CFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/mdfour.o $(QPEDIR)/src/3rdparty/libraries/rsync/mdfour.c
669
670$(OBJECTS_DIR)/mksum.o: $(QPEDIR)/src/3rdparty/libraries/rsync/mksum.c \
671 $(QPEDIR)/src/3rdparty/libraries/rsync/config_rsync.h \
672 $(QPEDIR)/src/3rdparty/libraries/rsync/config_linux.h \
673 $(QPEDIR)/src/3rdparty/libraries/rsync/rsync.h \
674 $(QPEDIR)/src/3rdparty/libraries/rsync/stream.h \
675 $(QPEDIR)/src/3rdparty/libraries/rsync/util.h \
676 $(QPEDIR)/src/3rdparty/libraries/rsync/sumset.h \
677 $(QPEDIR)/src/3rdparty/libraries/rsync/job.h \
678 $(QPEDIR)/src/3rdparty/libraries/rsync/protocol.h \
679 $(QPEDIR)/src/3rdparty/libraries/rsync/netint.h \
680 $(QPEDIR)/src/3rdparty/libraries/rsync/trace.h \
681 $(QPEDIR)/src/3rdparty/libraries/rsync/checksum.h
682 $(CC) -c $(CFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/mksum.o $(QPEDIR)/src/3rdparty/libraries/rsync/mksum.c
683
684$(OBJECTS_DIR)/msg.o: $(QPEDIR)/src/3rdparty/libraries/rsync/msg.c \
685 $(QPEDIR)/src/3rdparty/libraries/rsync/config_rsync.h \
686 $(QPEDIR)/src/3rdparty/libraries/rsync/config_linux.h \
687 $(QPEDIR)/src/3rdparty/libraries/rsync/rsync.h
688 $(CC) -c $(CFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/msg.o $(QPEDIR)/src/3rdparty/libraries/rsync/msg.c
689
690$(OBJECTS_DIR)/netint.o: $(QPEDIR)/src/3rdparty/libraries/rsync/netint.c \
691 $(QPEDIR)/src/3rdparty/libraries/rsync/config_rsync.h \
692 $(QPEDIR)/src/3rdparty/libraries/rsync/config_linux.h \
693 $(QPEDIR)/src/3rdparty/libraries/rsync/rsync.h \
694 $(QPEDIR)/src/3rdparty/libraries/rsync/job.h \
695 $(QPEDIR)/src/3rdparty/libraries/rsync/netint.h \
696 $(QPEDIR)/src/3rdparty/libraries/rsync/trace.h \
697 $(QPEDIR)/src/3rdparty/libraries/rsync/stream.h
698 $(CC) -c $(CFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/netint.o $(QPEDIR)/src/3rdparty/libraries/rsync/netint.c
699
700$(OBJECTS_DIR)/patch.o: $(QPEDIR)/src/3rdparty/libraries/rsync/patch.c \
701 $(QPEDIR)/src/3rdparty/libraries/rsync/config_rsync.h \
702 $(QPEDIR)/src/3rdparty/libraries/rsync/config_linux.h \
703 $(QPEDIR)/src/3rdparty/libraries/rsync/rsync.h \
704 $(QPEDIR)/src/3rdparty/libraries/rsync/util.h \
705 $(QPEDIR)/src/3rdparty/libraries/rsync/trace.h \
706 $(QPEDIR)/src/3rdparty/libraries/rsync/protocol.h \
707 $(QPEDIR)/src/3rdparty/libraries/rsync/netint.h \
708 $(QPEDIR)/src/3rdparty/libraries/rsync/command.h \
709 $(QPEDIR)/src/3rdparty/libraries/rsync/sumset.h \
710 $(QPEDIR)/src/3rdparty/libraries/rsync/prototab.h \
711 $(QPEDIR)/src/3rdparty/libraries/rsync/stream.h \
712 $(QPEDIR)/src/3rdparty/libraries/rsync/job.h
713 $(CC) -c $(CFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/patch.o $(QPEDIR)/src/3rdparty/libraries/rsync/patch.c
714
715$(OBJECTS_DIR)/prototab.o: $(QPEDIR)/src/3rdparty/libraries/rsync/prototab.c \
716 $(QPEDIR)/src/3rdparty/libraries/rsync/config_rsync.h \
717 $(QPEDIR)/src/3rdparty/libraries/rsync/config_linux.h \
718 $(QPEDIR)/src/3rdparty/libraries/rsync/rsync.h \
719 $(QPEDIR)/src/3rdparty/libraries/rsync/protocol.h \
720 $(QPEDIR)/src/3rdparty/libraries/rsync/command.h \
721 $(QPEDIR)/src/3rdparty/libraries/rsync/prototab.h
722 $(CC) -c $(CFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/prototab.o $(QPEDIR)/src/3rdparty/libraries/rsync/prototab.c
723
724$(OBJECTS_DIR)/readsums.o: $(QPEDIR)/src/3rdparty/libraries/rsync/readsums.c \
725 $(QPEDIR)/src/3rdparty/libraries/rsync/config_rsync.h \
726 $(QPEDIR)/src/3rdparty/libraries/rsync/config_linux.h \
727 $(QPEDIR)/src/3rdparty/libraries/rsync/rsync.h \
728 $(QPEDIR)/src/3rdparty/libraries/rsync/sumset.h \
729 $(QPEDIR)/src/3rdparty/libraries/rsync/job.h \
730 $(QPEDIR)/src/3rdparty/libraries/rsync/trace.h \
731 $(QPEDIR)/src/3rdparty/libraries/rsync/netint.h \
732 $(QPEDIR)/src/3rdparty/libraries/rsync/protocol.h \
733 $(QPEDIR)/src/3rdparty/libraries/rsync/util.h \
734 $(QPEDIR)/src/3rdparty/libraries/rsync/stream.h
735 $(CC) -c $(CFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/readsums.o $(QPEDIR)/src/3rdparty/libraries/rsync/readsums.c
736
737$(OBJECTS_DIR)/scoop.o: $(QPEDIR)/src/3rdparty/libraries/rsync/scoop.c \
738 $(QPEDIR)/src/3rdparty/libraries/rsync/config_rsync.h \
739 $(QPEDIR)/src/3rdparty/libraries/rsync/config_linux.h \
740 $(QPEDIR)/src/3rdparty/libraries/rsync/rsync.h \
741 $(QPEDIR)/src/3rdparty/libraries/rsync/job.h \
742 $(QPEDIR)/src/3rdparty/libraries/rsync/stream.h \
743 $(QPEDIR)/src/3rdparty/libraries/rsync/trace.h \
744 $(QPEDIR)/src/3rdparty/libraries/rsync/util.h
745 $(CC) -c $(CFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/scoop.o $(QPEDIR)/src/3rdparty/libraries/rsync/scoop.c
746
747$(OBJECTS_DIR)/search.o: $(QPEDIR)/src/3rdparty/libraries/rsync/search.c \
748 $(QPEDIR)/src/3rdparty/libraries/rsync/config_rsync.h \
749 $(QPEDIR)/src/3rdparty/libraries/rsync/config_linux.h \
750 $(QPEDIR)/src/3rdparty/libraries/rsync/rsync.h \
751 $(QPEDIR)/src/3rdparty/libraries/rsync/trace.h \
752 $(QPEDIR)/src/3rdparty/libraries/rsync/util.h \
753 $(QPEDIR)/src/3rdparty/libraries/rsync/sumset.h \
754 $(QPEDIR)/src/3rdparty/libraries/rsync/search.h \
755 $(QPEDIR)/src/3rdparty/libraries/rsync/checksum.h
756 $(CC) -c $(CFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/search.o $(QPEDIR)/src/3rdparty/libraries/rsync/search.c
757
758$(OBJECTS_DIR)/stats.o: $(QPEDIR)/src/3rdparty/libraries/rsync/stats.c \
759 $(QPEDIR)/src/3rdparty/libraries/rsync/config_rsync.h \
760 $(QPEDIR)/src/3rdparty/libraries/rsync/config_linux.h \
761 $(QPEDIR)/src/3rdparty/libraries/rsync/rsync.h \
762 $(QPEDIR)/src/3rdparty/libraries/rsync/trace.h
763 $(CC) -c $(CFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/stats.o $(QPEDIR)/src/3rdparty/libraries/rsync/stats.c
764
765$(OBJECTS_DIR)/stream.o: $(QPEDIR)/src/3rdparty/libraries/rsync/stream.c \
766 $(QPEDIR)/src/3rdparty/libraries/rsync/config_rsync.h \
767 $(QPEDIR)/src/3rdparty/libraries/rsync/config_linux.h \
768 $(QPEDIR)/src/3rdparty/libraries/rsync/rsync.h \
769 $(QPEDIR)/src/3rdparty/libraries/rsync/stream.h \
770 $(QPEDIR)/src/3rdparty/libraries/rsync/util.h \
771 $(QPEDIR)/src/3rdparty/libraries/rsync/trace.h
772 $(CC) -c $(CFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/stream.o $(QPEDIR)/src/3rdparty/libraries/rsync/stream.c
773
774$(OBJECTS_DIR)/sumset.o: $(QPEDIR)/src/3rdparty/libraries/rsync/sumset.c \
775 $(QPEDIR)/src/3rdparty/libraries/rsync/config_rsync.h \
776 $(QPEDIR)/src/3rdparty/libraries/rsync/config_linux.h \
777 $(QPEDIR)/src/3rdparty/libraries/rsync/rsync.h \
778 $(QPEDIR)/src/3rdparty/libraries/rsync/sumset.h \
779 $(QPEDIR)/src/3rdparty/libraries/rsync/util.h \
780 $(QPEDIR)/src/3rdparty/libraries/rsync/trace.h
781 $(CC) -c $(CFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/sumset.o $(QPEDIR)/src/3rdparty/libraries/rsync/sumset.c
782
783$(OBJECTS_DIR)/trace.o: $(QPEDIR)/src/3rdparty/libraries/rsync/trace.c \
784 $(QPEDIR)/src/3rdparty/libraries/rsync/config_rsync.h \
785 $(QPEDIR)/src/3rdparty/libraries/rsync/config_linux.h \
786 $(QPEDIR)/src/3rdparty/libraries/rsync/rsync.h \
787 $(QPEDIR)/src/3rdparty/libraries/rsync/util.h \
788 $(QPEDIR)/src/3rdparty/libraries/rsync/trace.h
789 $(CC) -c $(CFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/trace.o $(QPEDIR)/src/3rdparty/libraries/rsync/trace.c
790
791$(OBJECTS_DIR)/tube.o: $(QPEDIR)/src/3rdparty/libraries/rsync/tube.c \
792 $(QPEDIR)/src/3rdparty/libraries/rsync/config_rsync.h \
793 $(QPEDIR)/src/3rdparty/libraries/rsync/config_linux.h \
794 $(QPEDIR)/src/3rdparty/libraries/rsync/rsync.h \
795 $(QPEDIR)/src/3rdparty/libraries/rsync/trace.h \
796 $(QPEDIR)/src/3rdparty/libraries/rsync/util.h \
797 $(QPEDIR)/src/3rdparty/libraries/rsync/job.h \
798 $(QPEDIR)/src/3rdparty/libraries/rsync/stream.h
799 $(CC) -c $(CFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/tube.o $(QPEDIR)/src/3rdparty/libraries/rsync/tube.c
800
801$(OBJECTS_DIR)/util.o: $(QPEDIR)/src/3rdparty/libraries/rsync/util.c \
802 $(QPEDIR)/src/3rdparty/libraries/rsync/config_rsync.h \
803 $(QPEDIR)/src/3rdparty/libraries/rsync/config_linux.h \
804 $(QPEDIR)/src/3rdparty/libraries/rsync/util.h \
805 $(QPEDIR)/src/3rdparty/libraries/rsync/rsync.h \
806 $(QPEDIR)/src/3rdparty/libraries/rsync/trace.h
807 $(CC) -c $(CFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/util.o $(QPEDIR)/src/3rdparty/libraries/rsync/util.c
808
809$(OBJECTS_DIR)/version.o: $(QPEDIR)/src/3rdparty/libraries/rsync/version.c \
810 $(QPEDIR)/src/3rdparty/libraries/rsync/config_rsync.h \
811 $(QPEDIR)/src/3rdparty/libraries/rsync/config_linux.h \
812 $(QPEDIR)/src/3rdparty/libraries/rsync/rsync.h
813 $(CC) -c $(CFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/version.o $(QPEDIR)/src/3rdparty/libraries/rsync/version.c
814
815$(OBJECTS_DIR)/whole.o: $(QPEDIR)/src/3rdparty/libraries/rsync/whole.c \
816 $(QPEDIR)/src/3rdparty/libraries/rsync/config_rsync.h \
817 $(QPEDIR)/src/3rdparty/libraries/rsync/config_linux.h \
818 $(QPEDIR)/src/3rdparty/libraries/rsync/rsync.h \
819 $(QPEDIR)/src/3rdparty/libraries/rsync/trace.h \
820 $(QPEDIR)/src/3rdparty/libraries/rsync/fileutil.h \
821 $(QPEDIR)/src/3rdparty/libraries/rsync/sumset.h \
822 $(QPEDIR)/src/3rdparty/libraries/rsync/job.h \
823 $(QPEDIR)/src/3rdparty/libraries/rsync/buf.h \
824 $(QPEDIR)/src/3rdparty/libraries/rsync/whole.h \
825 $(QPEDIR)/src/3rdparty/libraries/rsync/util.h
826 $(CC) -c $(CFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/whole.o $(QPEDIR)/src/3rdparty/libraries/rsync/whole.c
827
828$(OBJECTS_DIR)/qrsync.o: $(QPEDIR)/src/3rdparty/libraries/rsync/qrsync.cpp \
829 $(QPEDIR)/src/3rdparty/libraries/rsync/qrsync.h \
830 $(QPEDIR)/src/3rdparty/libraries/rsync/rsync.h
831 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/qrsync.o $(QPEDIR)/src/3rdparty/libraries/rsync/qrsync.cpp
832
833$(OBJECTS_DIR)/syncdialog.o: syncdialog.cpp \
834 syncdialog.h
835 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/syncdialog.o syncdialog.cpp
836
837$(OBJECTS_DIR)/serverapp.o: serverapp.cpp \
838 $(MOC_DIR)/serverapp.moc \
839 serverapp.h \
840 shutdownimpl.h \
841 shutdown.h
842 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/serverapp.o serverapp.cpp
843
844shutdown.h: shutdown.ui
845 $(UIC) shutdown.ui -o $(INTERFACE_DECL_PATH)/shutdown.h
846
847shutdown.cpp: shutdown.ui
848 $(UIC) shutdown.ui -i shutdown.h -o shutdown.cpp
849
850$(OBJECTS_DIR)/shutdown.o: shutdown.cpp \
851 shutdown.h \
852 shutdown.ui
853 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/shutdown.o shutdown.cpp
854
855$(OBJECTS_DIR)/moc_server.o: $(MOC_DIR)/moc_server.cpp \
856 server.h
857 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/moc_server.o $(MOC_DIR)/moc_server.cpp
858
859$(OBJECTS_DIR)/moc_launchertab.o: $(MOC_DIR)/moc_launchertab.cpp \
860 launchertab.h
861 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/moc_launchertab.o $(MOC_DIR)/moc_launchertab.cpp
862
863$(OBJECTS_DIR)/moc_documentlist.o: $(MOC_DIR)/moc_documentlist.cpp \
864 documentlist.h
865 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/moc_documentlist.o $(MOC_DIR)/moc_documentlist.cpp
866
867$(OBJECTS_DIR)/moc_suspendmonitor.o: $(MOC_DIR)/moc_suspendmonitor.cpp \
868 suspendmonitor.h
869 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/moc_suspendmonitor.o $(MOC_DIR)/moc_suspendmonitor.cpp
870
871$(OBJECTS_DIR)/moc_appicons.o: $(MOC_DIR)/moc_appicons.cpp \
872 appicons.h
873 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/moc_appicons.o $(MOC_DIR)/moc_appicons.cpp
874
875$(OBJECTS_DIR)/moc_taskbar.o: $(MOC_DIR)/moc_taskbar.cpp \
876 taskbar.h \
877 serverinterface.h \
878 startmenu.h
879 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/moc_taskbar.o $(MOC_DIR)/moc_taskbar.cpp
880
881$(OBJECTS_DIR)/moc_runningappbar.o: $(MOC_DIR)/moc_runningappbar.cpp \
882 runningappbar.h
883 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/moc_runningappbar.o $(MOC_DIR)/moc_runningappbar.cpp
884
885$(OBJECTS_DIR)/moc_applauncher.o: $(MOC_DIR)/moc_applauncher.cpp \
886 applauncher.h
887 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/moc_applauncher.o $(MOC_DIR)/moc_applauncher.cpp
888
889$(OBJECTS_DIR)/moc_inputmethods.o: $(MOC_DIR)/moc_inputmethods.cpp \
890 inputmethods.h
891 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/moc_inputmethods.o $(MOC_DIR)/moc_inputmethods.cpp
892
893$(OBJECTS_DIR)/moc_systray.o: $(MOC_DIR)/moc_systray.cpp \
894 systray.h
895 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/moc_systray.o $(MOC_DIR)/moc_systray.cpp
896
897$(OBJECTS_DIR)/moc_shutdownimpl.o: $(MOC_DIR)/moc_shutdownimpl.cpp \
898 shutdownimpl.h \
899 shutdown.h
900 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/moc_shutdownimpl.o $(MOC_DIR)/moc_shutdownimpl.cpp
901
902$(OBJECTS_DIR)/moc_launcher.o: $(MOC_DIR)/moc_launcher.cpp \
903 launcher.h \
904 launcherview.h \
905 launchertab.h \
906 serverinterface.h
907 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/moc_launcher.o $(MOC_DIR)/moc_launcher.cpp
908
909$(OBJECTS_DIR)/moc_launcherview.o: $(MOC_DIR)/moc_launcherview.cpp \
910 launcherview.h
911 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/moc_launcherview.o $(MOC_DIR)/moc_launcherview.cpp
912
913$(OBJECTS_DIR)/moc_calibrate.o: $(MOC_DIR)/moc_calibrate.cpp \
914 $(QPEDIR)/src/settings/calibrate/calibrate.h
915 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/moc_calibrate.o $(MOC_DIR)/moc_calibrate.cpp
916
917$(OBJECTS_DIR)/moc_startmenu.o: $(MOC_DIR)/moc_startmenu.cpp \
918 startmenu.h
919 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/moc_startmenu.o $(MOC_DIR)/moc_startmenu.cpp
920
921$(OBJECTS_DIR)/moc_transferserver.o: $(MOC_DIR)/moc_transferserver.cpp \
922 transferserver.h
923 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/moc_transferserver.o $(MOC_DIR)/moc_transferserver.cpp
924
925$(OBJECTS_DIR)/moc_qcopbridge.o: $(MOC_DIR)/moc_qcopbridge.cpp \
926 qcopbridge.h
927 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/moc_qcopbridge.o $(MOC_DIR)/moc_qcopbridge.cpp
928
929$(OBJECTS_DIR)/moc_packageslave.o: $(MOC_DIR)/moc_packageslave.cpp \
930 packageslave.h
931 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/moc_packageslave.o $(MOC_DIR)/moc_packageslave.cpp
932
933$(OBJECTS_DIR)/moc_irserver.o: $(MOC_DIR)/moc_irserver.cpp \
934 irserver.h
935 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/moc_irserver.o $(MOC_DIR)/moc_irserver.cpp
936
937$(OBJECTS_DIR)/moc_firstuse.o: $(MOC_DIR)/moc_firstuse.cpp \
938 firstuse.h
939 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/moc_firstuse.o $(MOC_DIR)/moc_firstuse.cpp
940
941$(OBJECTS_DIR)/moc_syncdialog.o: $(MOC_DIR)/moc_syncdialog.cpp \
942 syncdialog.h
943 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/moc_syncdialog.o $(MOC_DIR)/moc_syncdialog.cpp
944
945$(OBJECTS_DIR)/moc_serverapp.o: $(MOC_DIR)/moc_serverapp.cpp \
946 serverapp.h \
947 shutdownimpl.h \
948 shutdown.h
949 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/moc_serverapp.o $(MOC_DIR)/moc_serverapp.cpp
950
951$(OBJECTS_DIR)/moc_shutdown.o: $(MOC_DIR)/moc_shutdown.cpp \
952 shutdown.h
953 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $(OBJECTS_DIR)/moc_shutdown.o $(MOC_DIR)/moc_shutdown.cpp
954
955$(MOC_DIR)/moc_server.cpp: server.h
956 $(MOC) server.h -o $(MOC_DIR)/moc_server.cpp
957
958$(MOC_DIR)/moc_launchertab.cpp: launchertab.h
959 $(MOC) launchertab.h -o $(MOC_DIR)/moc_launchertab.cpp
960
961$(MOC_DIR)/moc_documentlist.cpp: documentlist.h
962 $(MOC) documentlist.h -o $(MOC_DIR)/moc_documentlist.cpp
963
964$(MOC_DIR)/moc_suspendmonitor.cpp: suspendmonitor.h
965 $(MOC) suspendmonitor.h -o $(MOC_DIR)/moc_suspendmonitor.cpp
966
967$(MOC_DIR)/moc_appicons.cpp: appicons.h
968 $(MOC) appicons.h -o $(MOC_DIR)/moc_appicons.cpp
969
970$(MOC_DIR)/moc_taskbar.cpp: taskbar.h
971 $(MOC) taskbar.h -o $(MOC_DIR)/moc_taskbar.cpp
972
973$(MOC_DIR)/moc_runningappbar.cpp: runningappbar.h
974 $(MOC) runningappbar.h -o $(MOC_DIR)/moc_runningappbar.cpp
975
976$(MOC_DIR)/moc_applauncher.cpp: applauncher.h
977 $(MOC) applauncher.h -o $(MOC_DIR)/moc_applauncher.cpp
978
979$(MOC_DIR)/moc_inputmethods.cpp: inputmethods.h
980 $(MOC) inputmethods.h -o $(MOC_DIR)/moc_inputmethods.cpp
981
982$(MOC_DIR)/moc_systray.cpp: systray.h
983 $(MOC) systray.h -o $(MOC_DIR)/moc_systray.cpp
984
985$(MOC_DIR)/moc_shutdownimpl.cpp: shutdownimpl.h
986 $(MOC) shutdownimpl.h -o $(MOC_DIR)/moc_shutdownimpl.cpp
987
988$(MOC_DIR)/moc_launcher.cpp: launcher.h
989 $(MOC) launcher.h -o $(MOC_DIR)/moc_launcher.cpp
990
991$(MOC_DIR)/moc_launcherview.cpp: launcherview.h
992 $(MOC) launcherview.h -o $(MOC_DIR)/moc_launcherview.cpp
993
994$(MOC_DIR)/moc_calibrate.cpp: $(QPEDIR)/src/settings/calibrate/calibrate.h
995 $(MOC) $(QPEDIR)/src/settings/calibrate/calibrate.h -o $(MOC_DIR)/moc_calibrate.cpp
996
997$(MOC_DIR)/moc_startmenu.cpp: startmenu.h
998 $(MOC) startmenu.h -o $(MOC_DIR)/moc_startmenu.cpp
999
1000$(MOC_DIR)/moc_transferserver.cpp: transferserver.h
1001 $(MOC) transferserver.h -o $(MOC_DIR)/moc_transferserver.cpp
1002
1003$(MOC_DIR)/moc_qcopbridge.cpp: qcopbridge.h
1004 $(MOC) qcopbridge.h -o $(MOC_DIR)/moc_qcopbridge.cpp
1005
1006$(MOC_DIR)/moc_packageslave.cpp: packageslave.h
1007 $(MOC) packageslave.h -o $(MOC_DIR)/moc_packageslave.cpp
1008
1009$(MOC_DIR)/moc_irserver.cpp: irserver.h
1010 $(MOC) irserver.h -o $(MOC_DIR)/moc_irserver.cpp
1011
1012$(MOC_DIR)/moc_firstuse.cpp: firstuse.h
1013 $(MOC) firstuse.h -o $(MOC_DIR)/moc_firstuse.cpp
1014
1015$(MOC_DIR)/moc_syncdialog.cpp: syncdialog.h
1016 $(MOC) syncdialog.h -o $(MOC_DIR)/moc_syncdialog.cpp
1017
1018$(MOC_DIR)/moc_serverapp.cpp: serverapp.h
1019 $(MOC) serverapp.h -o $(MOC_DIR)/moc_serverapp.cpp
1020
1021$(MOC_DIR)/serverinterface.moc: serverinterface.cpp
1022 $(MOC) serverinterface.cpp -o $(MOC_DIR)/serverinterface.moc
1023
1024$(MOC_DIR)/documentlist.moc: documentlist.cpp
1025 $(MOC) documentlist.cpp -o $(MOC_DIR)/documentlist.moc
1026
1027$(MOC_DIR)/appicons.moc: appicons.cpp
1028 $(MOC) appicons.cpp -o $(MOC_DIR)/appicons.moc
1029
1030$(MOC_DIR)/taskbar.moc: taskbar.cpp
1031 $(MOC) taskbar.cpp -o $(MOC_DIR)/taskbar.moc
1032
1033$(MOC_DIR)/serverapp.moc: serverapp.cpp
1034 $(MOC) serverapp.cpp -o $(MOC_DIR)/serverapp.moc
1035
1036$(MOC_DIR)/moc_shutdown.cpp: shutdown.h
1037 $(MOC) shutdown.h -o $(MOC_DIR)/moc_shutdown.cpp
1038
1039
1040
1041lupdate-check:
1042 @sed -e '/$$$$QTOPIA1DIR[^ ]*/ d' \
1043 -e '/$$(.*/ d' \
1044 -e 's/^static:.*//' \
1045 <server.pro >t$$$$.pro && \
1046 rm -rf t$$$$&& \
1047 mkdir t$$$$ && \
1048 cp -a *.ts t$$$$ && \
1049 chmod +w *.ts && \
1050 lupdate t$$$$.pro && \
1051 rm t$$$$.pro && \
1052 for i in *.ts; \
1053 do \
1054 if cmp -s $$i t$$$$/$$i; \
1055 then \
1056 true; \
1057 else \
1058 echo out-of-date $$i; \
1059 fi; \
1060 rm $$i; \
1061 mv t$$$$/$$i $$i; \
1062 done && \
1063 rmdir t$$$$
1064
1065lupdate:
1066 sed -e '/$$$$QTOPIA1DIR[^ ]*/ d' \
1067 -e '/$$(.*/ d' \
1068 -e 's/^static:.*//' \
1069 <server.pro >t$$$$.pro && \
1070 lupdate t$$$$.pro && \
1071 rm t$$$$.pro
1072
1073lrelease:
1074 lrelease server.pro
1075 $(QPEDIR)/bin/qtopia-linstall server.pro
1076
1077
1078ipkg: $(DESTDIR)$(TARGET) # among other things...
1079 CTL="$(CONTROL)"; for ctrl in $$CTL; do cd $(QPEDIR)/ipkg; ../bin/mkipks -platform generic $(QPEDIR)/src/$$ctrl ; done
1080
1081package: ipkg
1082 cd $(QPEDIR)/ipkg; ../bin/mkPackages
1083
1084Makefile: server.pro
1085 cd $(QPEDIR)/src; ./configure -debug -make server
diff --git a/core/launcher/applauncher.cpp b/core/launcher/applauncher.cpp
new file mode 100644
index 0000000..50c1b71
--- a/dev/null
+++ b/core/launcher/applauncher.cpp
@@ -0,0 +1,705 @@
1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3**
4** This file is part of the 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 QTOPIA_INTERNAL_PRELOADACCESS
22#define QTOPIA_INTERNAL_PRELOADACCESS
23#endif
24#ifndef QTOPIA_INTERNAL_FILEOPERATIONS
25#define QTOPIA_INTERNAL_FILEOPERATIONS
26#endif
27#ifndef QTOPIA_PROGRAM_MONITOR
28#define QTOPIA_PROGRAM_MONITOR
29#endif
30#include <qtopia/qpeglobal.h>
31
32#ifndef Q_OS_WIN32
33#include <sys/stat.h>
34#include <sys/wait.h>
35#include <sys/file.h>
36#include <unistd.h>
37#include <sys/time.h>
38#include <sys/resource.h>
39#include <errno.h>
40#else
41#include <process.h>
42#include <windows.h>
43#include <winbase.h>
44#endif
45
46#include <signal.h>
47#include <sys/types.h>
48#include <stdlib.h>
49
50#include <qtimer.h>
51#include <qwindowsystem_qws.h>
52#include <qmessagebox.h>
53#include <qfile.h>
54#include <qfileinfo.h>
55
56#include <qtopia/qcopenvelope_qws.h>
57#include <qtopia/applnk.h>
58#include <qtopia/qpeapplication.h>
59#include <qtopia/config.h>
60#include <qtopia/global.h>
61
62#include "applauncher.h"
63#include "documentlist.h"
64
65const int AppLauncher::RAISE_TIMEOUT_MS = 5000;
66
67//---------------------------------------------------------------------------
68
69static AppLauncher* appLauncherPtr;
70
71const int appStopEventID = 1290;
72
73class AppStoppedEvent : public QCustomEvent
74{
75public:
76 AppStoppedEvent(int pid, int status)
77 : QCustomEvent( appStopEventID ), mPid(pid), mStatus(status) { }
78
79 int pid() { return mPid; }
80 int status() { return mStatus; }
81
82private:
83 int mPid, mStatus;
84};
85
86AppLauncher::AppLauncher(QObject *parent, const char *name)
87 : QObject(parent, name), qlPid(0), qlReady(FALSE),
88 appKillerBox(0)
89{
90 connect(qwsServer, SIGNAL(newChannel(const QString&)), this, SLOT(newQcopChannel(const QString&)));
91 connect(qwsServer, SIGNAL(removedChannel(const QString&)), this, SLOT(removedQcopChannel(const QString&)));
92 QCopChannel* channel = new QCopChannel( "QPE/System", this );
93 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
94 this, SLOT(received(const QCString&, const QByteArray&)) );
95
96 channel = new QCopChannel( "QPE/Server", this );
97 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
98 this, SLOT(received(const QCString&, const QByteArray&)) );
99
100#ifndef Q_OS_WIN32
101 signal(SIGCHLD, signalHandler);
102#else
103 runningAppsProc.setAutoDelete( TRUE );
104#endif
105 QString tmp = qApp->argv()[0];
106 int pos = tmp.findRev('/');
107 if ( pos > -1 )
108 tmp = tmp.mid(++pos);
109 runningApps[::getpid()] = tmp;
110
111 appLauncherPtr = this;
112
113 QTimer::singleShot( 1000, this, SLOT(createQuickLauncher()) );
114}
115
116AppLauncher::~AppLauncher()
117{
118 appLauncherPtr = 0;
119#ifndef Q_OS_WIN32
120 signal(SIGCHLD, SIG_DFL);
121#endif
122 if ( qlPid ) {
123 int status;
124 ::kill( qlPid, SIGTERM );
125 waitpid( qlPid, &status, 0 );
126 }
127}
128
129/* We use the QCopChannel of the app as an indicator of when it has been launched
130 so that we can disable the busy indicators */
131void AppLauncher::newQcopChannel(const QString& channelName)
132{
133// qDebug("channel %s added", channelName.data() );
134 QString prefix("QPE/Application/");
135 if (channelName.startsWith(prefix)) {
136 {
137 QCopEnvelope e("QPE/System", "newChannel(QString)");
138 e << channelName;
139 }
140 QString appName = channelName.mid(prefix.length());
141 if ( appName != "quicklauncher" ) {
142 emit connected( appName );
143 QCopEnvelope e("QPE/System", "notBusy(QString)");
144 e << appName;
145 }
146 } else if (channelName.startsWith("QPE/QuickLauncher-")) {
147 qDebug("Registered %s", channelName.latin1());
148 int pid = channelName.mid(18).toInt();
149 if (pid == qlPid)
150 qlReady = TRUE;
151 }
152}
153
154void AppLauncher::removedQcopChannel(const QString& channelName)
155{
156 if (channelName.startsWith("QPE/Application/")) {
157 QCopEnvelope e("QPE/System", "removedChannel(QString)");
158 e << channelName;
159 }
160}
161
162void AppLauncher::received(const QCString& msg, const QByteArray& data)
163{
164 QDataStream stream( data, IO_ReadOnly );
165 if ( msg == "execute(QString)" ) {
166 QString t;
167 stream >> t;
168 if ( !executeBuiltin( t, QString::null ) )
169 execute(t, QString::null);
170 } else if ( msg == "execute(QString,QString)" ) {
171 QString t,d;
172 stream >> t >> d;
173 if ( !executeBuiltin( t, d ) )
174 execute( t, d );
175 } else if ( msg == "processQCop(QString)" ) { // from QPE/Server
176 QString t;
177 stream >> t;
178 if ( !executeBuiltin( t, QString::null ) )
179 execute( t, QString::null, TRUE);
180 } else if ( msg == "raise(QString)" ) {
181 QString appName;
182 stream >> appName;
183
184 if ( !executeBuiltin( appName, QString::null ) ) {
185 if ( !waitingHeartbeat.contains( appName ) && appKillerName != appName ) {
186 //qDebug( "Raising: %s", appName.latin1() );
187 QCString channel = "QPE/Application/";
188 channel += appName.latin1();
189
190 // Need to lock it to avoid race conditions with QPEApplication::processQCopFile
191 QFile f("/tmp/qcop-msg-" + appName);
192 if ( f.open(IO_WriteOnly | IO_Append) ) {
193#ifndef Q_OS_WIN32
194 flock(f.handle(), LOCK_EX);
195#endif
196 QDataStream ds(&f);
197 QByteArray b;
198 QDataStream bstream(b, IO_WriteOnly);
199 ds << channel << QCString("raise()") << b;
200 f.flush();
201#ifndef Q_OS_WIN32
202 flock(f.handle(), LOCK_UN);
203#endif
204 f.close();
205 }
206 bool alreadyRunning = isRunning( appName );
207 if ( execute(appName, QString::null) ) {
208 int id = startTimer(RAISE_TIMEOUT_MS + alreadyRunning?2000:0);
209 waitingHeartbeat.insert( appName, id );
210 }
211 }
212 }
213 } else if ( msg == "sendRunningApps()" ) {
214 QStringList apps;
215 QMap<int,QString>::Iterator it;
216 for( it = runningApps.begin(); it != runningApps.end(); ++it )
217 apps.append( *it );
218 QCopEnvelope e( "QPE/Desktop", "runningApps(QStringList)" );
219 e << apps;
220 } else if ( msg == "appRaised(QString)" ) {
221 QString appName;
222 stream >> appName;
223 qDebug("Got a heartbeat from %s", appName.latin1());
224 QMap<QString,int>::Iterator it = waitingHeartbeat.find(appName);
225 if ( it != waitingHeartbeat.end() ) {
226 killTimer( *it );
227 waitingHeartbeat.remove(it);
228 }
229 // Check to make sure we're not waiting on user input...
230 if ( appKillerBox && appName == appKillerName ) {
231 // If we are, we kill the dialog box, and the code waiting on the result
232 // will clean us up (basically the user said "no").
233 delete appKillerBox;
234 appKillerBox = 0;
235 appKillerName = QString::null;
236 }
237 }
238}
239
240void AppLauncher::signalHandler(int)
241{
242#ifndef Q_OS_WIN32
243 int status;
244 pid_t pid = waitpid(-1, &status, WNOHANG);
245/* if (pid == 0 || &status == 0 ) {
246 qDebug("hmm, could not get return value from signal");
247 }
248*/
249 QApplication::postEvent(appLauncherPtr, new AppStoppedEvent(pid, status) );
250#else
251 qDebug("Unhandled signal see by AppLauncher::signalHandler(int)");
252#endif
253}
254
255bool AppLauncher::event(QEvent *e)
256{
257 if ( e->type() == appStopEventID ) {
258 AppStoppedEvent *ae = (AppStoppedEvent *) e;
259 sigStopped(ae->pid(), ae->status() );
260 return TRUE;
261 }
262
263 return QObject::event(e);
264}
265
266void AppLauncher::timerEvent( QTimerEvent *e )
267{
268 int id = e->timerId();
269 QMap<QString,int>::Iterator it;
270 for ( it = waitingHeartbeat.begin(); it != waitingHeartbeat.end(); ++it ) {
271 if ( *it == id ) {
272 if ( appKillerBox ) // we're already dealing with one
273 return;
274
275 appKillerName = it.key();
276 killTimer( id );
277 waitingHeartbeat.remove( it );
278
279 // qDebug("Checking in on %s", appKillerName.latin1());
280
281 // We store this incase the application responds while we're
282 // waiting for user input so we know not to delete ourselves.
283 appKillerBox = new QMessageBox(tr("Application Problem"),
284 tr("<p>%1 is not responding.</p>").arg(appKillerName) +
285 tr("<p>Would you like to force the application to exit?</p>"),
286 QMessageBox::Warning, QMessageBox::Yes,
287 QMessageBox::No | QMessageBox::Default,
288 QMessageBox::NoButton);
289 if (appKillerBox->exec() == QMessageBox::Yes) {
290 // qDebug("Killing the app!!! Bwuhahahaha!");
291 int pid = pidForName(appKillerName);
292 if ( pid > 0 )
293 kill( pid );
294 }
295 appKillerName = QString::null;
296 delete appKillerBox;
297 appKillerBox = 0;
298 return;
299 }
300 }
301
302 QObject::timerEvent( e );
303}
304
305#ifndef Q_OS_WIN32
306void AppLauncher::sigStopped(int sigPid, int sigStatus)
307{
308 int exitStatus = 0;
309
310 bool crashed = WIFSIGNALED(sigStatus);
311 if ( !crashed ) {
312 if ( WIFEXITED(sigStatus) )
313 exitStatus = WEXITSTATUS(sigStatus);
314 } else {
315 exitStatus = WTERMSIG(sigStatus);
316 }
317
318 QMap<int,QString>::Iterator it = runningApps.find( sigPid );
319 if ( it == runningApps.end() ) {
320 if ( sigPid == qlPid ) {
321 qDebug( "quicklauncher stopped" );
322 qlPid = 0;
323 qlReady = FALSE;
324 QFile::remove("/tmp/qcop-msg-quicklauncher" );
325 QTimer::singleShot( 2000, this, SLOT(createQuickLauncher()) );
326 }
327/*
328 if ( sigPid == -1 )
329 qDebug("non-qtopia application exited (disregarded)");
330 else
331 qDebug("==== no pid matching %d in list, definite bug", sigPid);
332*/
333 return;
334 }
335 QString appName = *it;
336 runningApps.remove(it);
337
338 QMap<QString,int>::Iterator hbit = waitingHeartbeat.find(appName);
339 if ( hbit != waitingHeartbeat.end() ) {
340 killTimer( *hbit );
341 waitingHeartbeat.remove( hbit );
342 }
343 if ( appName == appKillerName ) {
344 appKillerName = QString::null;
345 delete appKillerBox;
346 appKillerBox = 0;
347 }
348
349 /* we must disable preload for an app that crashes as the system logic relies on preloaded apps
350 actually being loaded. If eg. the crash happened in the constructor, we can't automatically reload
351 the app (withouth some timeout value for eg. 3 tries (which I think is a bad solution)
352 */
353 bool preloadDisabled = FALSE;
354 if ( !DocumentList::appLnkSet ) return;
355 const AppLnk* app = DocumentList::appLnkSet->findExec( appName );
356 if ( !app ) return; // QCop messages processed to slow?
357 if ( crashed && app->isPreloaded() ) {
358 Config cfg("Launcher");
359 cfg.setGroup("Preload");
360 QStringList apps = cfg.readListEntry("Apps",',');
361 QString exe = app->exec();
362 apps.remove(exe);
363 cfg.writeEntry("Apps",apps,',');
364 preloadDisabled = TRUE;
365 }
366
367 // clean up
368 if ( exitStatus ) {
369 QCopEnvelope e("QPE/System", "notBusy(QString)");
370 e << app->exec();
371 }
372/*
373 // debug info
374 for (it = runningApps.begin(); it != runningApps.end(); ++it) {
375 qDebug("running according to internal list: %s, with pid %d", (*it).data(), it.key() );
376 }
377*/
378
379#ifdef QTOPIA_PROGRAM_MONITOR
380 if ( crashed ) {
381 QString sig;
382 switch( exitStatus ) {
383 case SIGABRT: sig = "SIGABRT"; break;
384 case SIGALRM: sig = "SIGALRM"; break;
385 case SIGBUS: sig = "SIGBUS"; break;
386 case SIGFPE: sig = "SIGFPE"; break;
387 case SIGHUP: sig = "SIGHUP"; break;
388 case SIGILL: sig = "SIGILL"; break;
389 case SIGKILL: sig = "SIGKILL"; break;
390 case SIGPIPE: sig = "SIGPIPE"; break;
391 case SIGQUIT: sig = "SIGQUIT"; break;
392 case SIGSEGV: sig = "SIGSEGV"; break;
393 case SIGTERM: sig = "SIGTERM"; break;
394 case SIGTRAP: sig = "SIGTRAP"; break;
395 default: sig = QString("Unkown %1").arg(exitStatus);
396 }
397 if ( preloadDisabled )
398 sig += tr("<qt><p>Fast loading has been disabled for this application. Tap and hold the application icon to reenable it.</qt>");
399
400 QString str = tr("<qt><b>%1</b> was terminated due to signal code %2</qt>").arg( app->name() ).arg( sig );
401 QMessageBox::information(0, tr("Application terminated"), str );
402 } else {
403 if ( exitStatus == 255 ) { //could not find app (because global returns -1)
404 QMessageBox::information(0, tr("Application not found"), tr("<qt>Could not locate application <b>%1</b></qt>").arg( app->exec() ) );
405 } else {
406 QFileInfo fi(Global::tempDir() + "qcop-msg-" + appName);
407 if ( fi.exists() && fi.size() ) {
408 emit terminated(sigPid, appName);
409 execute( appName, QString::null );
410 return;
411 }
412 }
413 }
414
415#endif
416
417 emit terminated(sigPid, appName);
418}
419#else
420void AppLauncher::sigStopped(int sigPid, int sigStatus)
421{
422 qDebug("Unhandled signal : AppLauncher::sigStopped(int sigPid, int sigStatus)");
423}
424#endif // Q_OS_WIN32
425
426bool AppLauncher::isRunning(const QString &app)
427{
428 for (QMap<int,QString>::ConstIterator it = runningApps.begin(); it != runningApps.end(); ++it) {
429 if ( *it == app ) {
430#ifdef Q_OS_UNIX
431 pid_t t = ::__getpgid( it.key() );
432 if ( t == -1 ) {
433 qDebug("appLauncher bug, %s believed running, but pid %d is not existing", app.data(), it.key() );
434 runningApps.remove( it.key() );
435 return FALSE;
436 }
437#endif
438 return TRUE;
439 }
440 }
441
442 return FALSE;
443}
444
445bool AppLauncher::executeBuiltin(const QString &c, const QString &document)
446{
447 Global::Command* builtin = Global::builtinCommands();
448 QGuardedPtr<QWidget> *running = Global::builtinRunning();
449
450 // Attempt to execute the app using a builtin class for the app
451 if (builtin) {
452 for (int i = 0; builtin[i].file; i++) {
453 if ( builtin[i].file == c ) {
454 if ( running[i] ) {
455 if ( !document.isNull() && builtin[i].documentary )
456 Global::setDocument(running[i], document);
457 running[i]->raise();
458 running[i]->show();
459 running[i]->setActiveWindow();
460 } else {
461 running[i] = builtin[i].func( builtin[i].maximized );
462 }
463#ifndef QT_NO_COP
464 QCopEnvelope e("QPE/System", "notBusy(QString)" );
465 e << c; // that was quick ;-)
466#endif
467 return TRUE;
468 }
469 }
470 }
471
472 // Convert the command line in to a list of arguments
473 QStringList list = QStringList::split(QRegExp(" *"),c);
474 QString ap=list[0];
475
476 if ( ap == "suspend" ) { // No tr
477 QWSServer::processKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE );
478 return TRUE;
479 }
480
481 return FALSE;
482}
483
484bool AppLauncher::execute(const QString &c, const QString &docParam, bool noRaise)
485{
486 // Convert the command line in to a list of arguments
487 QStringList list = QStringList::split(QRegExp(" *"),c);
488 if ( !docParam.isEmpty() )
489 list.append( docParam );
490
491 QString appName = list[0];
492 if ( isRunning(appName) ) {
493 QCString channel = "QPE/Application/";
494 channel += appName.latin1();
495
496 // Need to lock it to avoid race conditions with QPEApplication::processQCopFile
497 QFile f(Global::tempDir() + "qcop-msg-" + appName);
498 if ( !noRaise && f.open(IO_WriteOnly | IO_Append) ) {
499#ifndef Q_OS_WIN32
500 flock(f.handle(), LOCK_EX);
501#endif
502
503 QDataStream ds(&f);
504 QByteArray b;
505 QDataStream bstream(b, IO_WriteOnly);
506 if ( !f.size() ) {
507 ds << channel << QCString("raise()") << b;
508 if ( !waitingHeartbeat.contains( appName ) && appKillerName != appName ) {
509 int id = startTimer(RAISE_TIMEOUT_MS);
510 waitingHeartbeat.insert( appName, id );
511 }
512 }
513 if ( !docParam.isEmpty() ) {
514 bstream << docParam;
515 ds << channel << QCString("setDocument(QString)") << b;
516 }
517
518 f.flush();
519#ifndef Q_OS_WIN32
520 flock(f.handle(), LOCK_UN);
521#endif
522 f.close();
523 }
524 if ( QCopChannel::isRegistered(channel) ) // avoid unnecessary warnings
525 QCopChannel::send(channel,"QPEProcessQCop()");
526
527 return TRUE;
528 }
529
530#ifdef QT_NO_QWS_MULTIPROCESS
531 QMessageBox::warning( 0, tr("Error"), tr("Could not find the application %1").arg(c),
532 tr("OK"), 0, 0, 0, 1 );
533#else
534
535 QStrList slist;
536 unsigned j;
537 for ( j = 0; j < list.count(); j++ )
538 slist.append( list[j].utf8() );
539
540 const char **args = new const char *[slist.count() + 1];
541 for ( j = 0; j < slist.count(); j++ )
542 args[j] = slist.at(j);
543 args[j] = NULL;
544
545#ifndef Q_OS_WIN32
546 if ( qlPid && qlReady && QFile::exists( QPEApplication::qpeDir()+"plugins/application/lib"+args[0] + ".so" ) ) {
547 qDebug( "Quick launching: %s", args[0] );
548 if ( getuid() == 0 )
549 setpriority( PRIO_PROCESS, qlPid, 0 );
550 QCString qlch("QPE/QuickLauncher-");
551 qlch += QString::number(qlPid);
552 QCopEnvelope env( qlch, "execute(QStrList)" );
553 env << slist;
554 runningApps[qlPid] = QString(args[0]);
555 emit launched(qlPid, QString(args[0]));
556 QCopEnvelope e("QPE/System", "busy()");
557 qlPid = 0;
558 qlReady = FALSE;
559 QTimer::singleShot( getuid() == 0 ? 800 : 1500, this, SLOT(createQuickLauncher()) );
560 } else {
561 int pid = ::vfork();
562 if ( !pid ) {
563 for ( int fd = 3; fd < 100; fd++ )
564 ::close( fd );
565 ::setpgid( ::getpid(), ::getppid() );
566 // Try bindir first, so that foo/bar works too
567 ::execv( QPEApplication::qpeDir()+"bin/"+args[0], (char * const *)args );
568 ::execvp( args[0], (char * const *)args );
569 _exit( -1 );
570 }
571
572 runningApps[pid] = QString(args[0]);
573 emit launched(pid, QString(args[0]));
574 QCopEnvelope e("QPE/System", "busy()");
575 }
576#else
577 QProcess *proc = new QProcess(this);
578 if (proc){
579 for (int i=0; i < slist.count(); i++)
580 proc->addArgument(args[i]);
581 connect(proc, SIGNAL(processExited()), this, SLOT(processExited()));
582 if (!proc->start()){
583 qDebug("Unable to start application %s", args[0]);
584 }else{
585 PROCESS_INFORMATION *procInfo = (PROCESS_INFORMATION *)proc->processIdentifier();
586 if (procInfo){
587 DWORD pid = procInfo->dwProcessId;
588 runningApps[pid] = QString(args[0]);
589 runningAppsProc.append(proc);
590 emit launched(pid, QString(args[0]));
591 QCopEnvelope e("QPE/System", "busy()");
592 }else{
593 qDebug("Unable to read process inforation #1 for %s", args[0]);
594 }
595 }
596 }else{
597 qDebug("Unable to create process for application %s", args[0]);
598 return FALSE;
599 }
600#endif
601#endif //QT_NO_QWS_MULTIPROCESS
602
603 delete [] args;
604 return TRUE;
605}
606
607void AppLauncher::kill( int pid )
608{
609#ifndef Q_OS_WIN32
610 ::kill( pid, SIGTERM );
611#else
612 for ( QProcess *proc = runningAppsProc.first(); proc; proc = runningAppsProc.next() ) {
613 if ( proc->processIdentifier() == pid ) {
614 proc->kill();
615 break;
616 }
617 }
618#endif
619}
620
621int AppLauncher::pidForName( const QString &appName )
622{
623 int pid = -1;
624
625 QMap<int, QString>::Iterator it;
626 for (it = runningApps.begin(); it!= runningApps.end(); ++it) {
627 if (*it == appName) {
628 pid = it.key();
629 break;
630 }
631 }
632
633 return pid;
634}
635
636void AppLauncher::createQuickLauncher()
637{
638 qlReady = FALSE;
639 qlPid = ::vfork();
640 if ( !qlPid ) {
641 char **args = new char *[2];
642 args[0] = "quicklauncher";
643 args[1] = 0;
644 for ( int fd = 3; fd < 100; fd++ )
645 ::close( fd );
646 ::setpgid( ::getpid(), ::getppid() );
647 // Try bindir first, so that foo/bar works too
648 setenv( "LD_BIND_NOW", "1", 1 );
649 ::execv( QPEApplication::qpeDir()+"bin/quicklauncher", args );
650 ::execvp( "quicklauncher", args );
651 _exit( -1 );
652 } else if ( qlPid == -1 ) {
653 qlPid = 0;
654 } else {
655 if ( getuid() == 0 )
656 setpriority( PRIO_PROCESS, qlPid, 19 );
657 }
658}
659
660// Used only by Win32
661void AppLauncher::processExited()
662{
663#ifdef Q_OS_WIN32
664 qDebug("AppLauncher::processExited()");
665 bool found = FALSE;
666 QProcess *proc = (QProcess *) sender();
667 if (!proc){
668 qDebug("Interanl error NULL proc");
669 return;
670 }
671
672 QString appName = proc->arguments()[0];
673 qDebug("Removing application %s", appName.latin1());
674 runningAppsProc.remove(proc);
675
676 QMap<QString,int>::Iterator hbit = waitingHeartbeat.find(appName);
677 if ( hbit != waitingHeartbeat.end() ) {
678 killTimer( *hbit );
679 waitingHeartbeat.remove( hbit );
680 }
681 if ( appName == appKillerName ) {
682 appKillerName = QString::null;
683 delete appKillerBox;
684 appKillerBox = 0;
685 }
686
687 // Search for the app to find its PID
688 QMap<int, QString>::Iterator it;
689 for (it = runningApps.begin(); it!= runningApps.end(); ++it){
690 if (it.data() == appName){
691 found = TRUE;
692 break;
693 }
694 }
695
696 if (found){
697 emit terminated(it.key(), it.data());
698 runningApps.remove(it.key());
699 }else{
700 qDebug("Internal error application %s not listed as running", appName.latin1());
701 }
702
703#endif
704}
705
diff --git a/core/launcher/applauncher.h b/core/launcher/applauncher.h
new file mode 100644
index 0000000..6a1e416
--- a/dev/null
+++ b/core/launcher/applauncher.h
@@ -0,0 +1,82 @@
1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3**
4** This file is part of the 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 APP_LAUNCHER_H
22#define APP_LAUNCHER_H
23
24#include <qtopia/qpeglobal.h>
25#include <qobject.h>
26#include <qmap.h>
27#ifdef Q_OS_WIN32
28#include <qtopia/qprocess.h>
29#include <qlist.h>
30#endif
31
32class QMessageBox;
33
34class AppLauncher : public QObject
35{
36 Q_OBJECT
37public:
38 AppLauncher(QObject *parent = 0, const char *name = 0);
39 ~AppLauncher();
40
41 bool isRunning(const QString &app);
42
43 static const int RAISE_TIMEOUT_MS;
44
45signals:
46 void launched(int pid, const QString &app);
47 void terminated(int pid, const QString &app);
48 void connected(const QString &app);
49
50protected slots:
51 void sigStopped(int sigPid, int sigStatus);
52 void received(const QCString& msg, const QByteArray& data);
53 void newQcopChannel(const QString& channel);
54 void removedQcopChannel(const QString& channel);
55 void createQuickLauncher();
56 void processExited();
57
58protected:
59 bool event(QEvent *);
60 void timerEvent( QTimerEvent * );
61
62private:
63 static void signalHandler(int sig);
64 bool executeBuiltin(const QString &c, const QString &document);
65 bool execute(const QString &c, const QString &document, bool noRaise = FALSE);
66 void kill( int pid );
67 int pidForName( const QString & );
68
69private:
70 QMap<int,QString> runningApps;
71 QMap<QString,int> waitingHeartbeat;
72#ifdef Q_OS_WIN32
73 QList<QProcess> runningAppsProc;
74#endif
75 int qlPid;
76 bool qlReady;
77 QMessageBox *appKillerBox;
78 QString appKillerName;
79};
80
81#endif
82
diff --git a/core/launcher/documentlist.cpp b/core/launcher/documentlist.cpp
new file mode 100644
index 0000000..033dd10
--- a/dev/null
+++ b/core/launcher/documentlist.cpp
@@ -0,0 +1,646 @@
1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3**
4** This file is part of the 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 "documentlist.h"
21#include "serverinterface.h"
22
23#include <qtopia/mimetype.h>
24#include <qtopia/resource.h>
25#include <qtopia/global.h>
26#include <qtopia/categories.h>
27#include <qtopia/qpeapplication.h>
28#include <qtopia/applnk.h>
29#include <qtopia/storage.h>
30#ifdef Q_WS_QWS
31#include <qtopia/qcopenvelope_qws.h>
32#endif
33
34#include <qtimer.h>
35#include <qfileinfo.h>
36#include <qtextstream.h>
37#include <qfile.h>
38#include <qdir.h>
39#include <qpainter.h>
40#include <qimage.h>
41#include <qcopchannel_qws.h>
42#include <qlistview.h>
43#include <qlist.h>
44#include <qpixmap.h>
45
46
47AppLnkSet *DocumentList::appLnkSet = 0;
48
49static const int MAX_SEARCH_DEPTH = 10;
50
51
52class DocumentListPrivate : public QObject {
53 Q_OBJECT
54public:
55 DocumentListPrivate( ServerInterface *gui );
56 ~DocumentListPrivate();
57
58 void initialize();
59
60 const QString nextFile();
61 const DocLnk *iterate();
62 bool store( DocLnk* dl );
63 void estimatedPercentScanned();
64
65 DocLnkSet dls;
66 QDict<void> reference;
67 QDictIterator<void> *dit;
68 enum { Find, RemoveKnownFiles, MakeUnknownFiles, Done } state;
69
70 QStringList docPaths;
71 unsigned int docPathsSearched;
72
73 int searchDepth;
74 QDir *listDirs[MAX_SEARCH_DEPTH];
75 const QFileInfoList *lists[MAX_SEARCH_DEPTH];
76 unsigned int listPositions[MAX_SEARCH_DEPTH];
77
78 StorageInfo *storage;
79
80 int tid;
81
82 ServerInterface *serverGui;
83
84 bool needToSendAllDocLinks;
85 bool sendAppLnks;
86 bool sendDocLnks;
87 bool scanDocs;
88};
89
90
91DocumentList::DocumentList( ServerInterface *serverGui, bool scanDocs,
92 QObject *parent, const char *name )
93 : QObject( parent, name )
94{
95 appLnkSet = new AppLnkSet( MimeType::appsFolderName() );
96 d = new DocumentListPrivate( serverGui );
97 d->scanDocs = scanDocs;
98 d->needToSendAllDocLinks = false;
99
100 QTimer::singleShot( 10, this, SLOT( startInitialScan() ) );
101}
102
103void DocumentList::startInitialScan()
104{
105 reloadAppLnks();
106 reloadDocLnks();
107}
108
109DocumentList::~DocumentList()
110{
111 delete appLnkSet;
112 delete d;
113}
114
115
116void DocumentList::add( const DocLnk& doc )
117{
118 if ( d->serverGui && QFile::exists( doc.file() ) )
119 d->serverGui->documentAdded( doc );
120}
121
122
123void DocumentList::start()
124{
125 resume();
126}
127
128
129void DocumentList::pause()
130{
131 //qDebug("pause %i", d->tid);
132 killTimer( d->tid );
133 d->tid = 0;
134}
135
136
137void DocumentList::resume()
138{
139 if ( d->tid == 0 ) {
140 d->tid = startTimer( 0 );
141 //qDebug("resumed %i", d->tid);
142 }
143}
144
145/*
146void DocumentList::resend()
147{
148 // Re-emits all the added items to the list (firstly letting everyone know to
149 // clear what they have as it is being sent again)
150 pause();
151 emit allRemoved();
152 QTimer::singleShot( 5, this, SLOT( resendWorker() ) );
153}
154
155
156void DocumentList::resendWorker()
157{
158 const QList<DocLnk> &list = d->dls.children();
159 for ( QListIterator<DocLnk> it( list ); it.current(); ++it )
160 add( *(*it) );
161 resume();
162}
163*/
164
165void DocumentList::rescan()
166{
167 //qDebug("rescan");
168 pause();
169 d->initialize();
170 resume();
171}
172
173
174void DocumentList::timerEvent( QTimerEvent *te )
175{
176 if ( te->timerId() == d->tid ) {
177 // Do 3 at a time
178 for (int i = 0; i < 3; i++ ) {
179 const DocLnk *lnk = d->iterate();
180 if ( lnk ) {
181 add( *lnk );
182 } else {
183 // stop when done
184 pause();
185 if ( d->serverGui )
186 d->serverGui->documentScanningProgress( 100 );
187 if ( d->needToSendAllDocLinks )
188 sendAllDocLinks();
189 break;
190 }
191 }
192 }
193}
194
195
196void DocumentList::reloadAppLnks()
197{
198 if ( d->sendAppLnks && d->serverGui ) {
199 d->serverGui->applicationScanningProgress( 0 );
200 d->serverGui->allApplicationsRemoved();
201 }
202
203 delete appLnkSet;
204 appLnkSet = new AppLnkSet( MimeType::appsFolderName() );
205
206 if ( d->sendAppLnks && d->serverGui ) {
207 static QStringList prevTypeList;
208 QStringList types = appLnkSet->types();
209 for ( QStringList::Iterator ittypes=types.begin(); ittypes!=types.end(); ++ittypes) {
210 if ( !(*ittypes).isEmpty() ) {
211 if ( !prevTypeList.contains(*ittypes) ) {
212 QString name = appLnkSet->typeName(*ittypes);
213 QPixmap pm = appLnkSet->typePixmap(*ittypes);
214 QPixmap bgPm = appLnkSet->typeBigPixmap(*ittypes);
215
216 if (pm.isNull()) {
217 QImage img( Resource::loadImage( "UnknownDocument" ) );
218 pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() );
219 bgPm = img.smoothScale( AppLnk::bigIconSize(), AppLnk::bigIconSize() );
220 }
221
222 //qDebug("adding type %s", (*ittypes).latin1());
223
224 // ### our current launcher expects docs tab to be last
225 d->serverGui->typeAdded( *ittypes, name.isNull() ? (*ittypes) : name, pm, bgPm );
226 }
227 prevTypeList.remove(*ittypes);
228 }
229 }
230 for ( QStringList::Iterator ittypes=prevTypeList.begin(); ittypes!=prevTypeList.end(); ++ittypes) {
231 //qDebug("removing type %s", (*ittypes).latin1());
232 d->serverGui->typeRemoved(*ittypes);
233 }
234 prevTypeList = types;
235 }
236
237 QListIterator<AppLnk> itapp( appLnkSet->children() );
238 AppLnk* l;
239 while ( (l=itapp.current()) ) {
240 ++itapp;
241 if ( d->sendAppLnks && d->serverGui )
242 d->serverGui->applicationAdded( l->type(), *l );
243 }
244
245 if ( d->sendAppLnks && d->serverGui )
246 d->serverGui->applicationScanningProgress( 100 );
247}
248
249void DocumentList::reloadDocLnks()
250{
251 if ( !d->scanDocs )
252 return;
253
254 if ( d->sendDocLnks && d->serverGui ) {
255 d->serverGui->documentScanningProgress( 0 );
256 d->serverGui->allDocumentsRemoved();
257 }
258
259 rescan();
260}
261
262void DocumentList::linkChanged( QString arg )
263{
264 //qDebug( "linkchanged( %s )", arg.latin1() );
265
266 if ( arg.isNull() || Global::isAppLnkFileName( arg ) ) {
267 reloadAppLnks();
268 } else {
269
270 const QList<DocLnk> &list = d->dls.children();
271 QListIterator<DocLnk> it( list );
272 while ( it.current() ) {
273 DocLnk *doc = it.current();
274 ++it;
275 if ( ( doc->linkFileKnown() && doc->linkFile() == arg )
276 || ( doc->fileKnown() && doc->file() == arg ) ) {
277 //qDebug( "found old link" );
278 DocLnk* dl = new DocLnk( arg );
279 // add new one if it exists and matches the mimetype
280 if ( d->store( dl ) ) {
281 // Existing link has been changed, send old link ref and a ref
282 // to the new link
283 //qDebug( "change case" );
284 if ( d->serverGui )
285 d->serverGui->documentChanged( *doc, *dl );
286
287 } else {
288 // Link has been removed or doesn't match the mimetypes any more
289 // so we aren't interested in it, so take it away from the list
290 //qDebug( "removal case" );
291 if ( d->serverGui )
292 d->serverGui->documentRemoved( *doc );
293
294 }
295 d->dls.remove( doc ); // remove old link from docLnkSet
296 delete doc;
297 return;
298 }
299 }
300 // Didn't find existing link, must be new
301 DocLnk* dl = new DocLnk( arg );
302 if ( d->store( dl ) ) {
303 // Add if it's a link we are interested in
304 //qDebug( "add case" );
305 add( *dl );
306 }
307
308 }
309}
310
311void DocumentList::restoreDone()
312{
313 reloadAppLnks();
314 reloadDocLnks();
315}
316
317void DocumentList::storageChanged()
318{
319 // ### can implement better
320 reloadAppLnks();
321 reloadDocLnks();
322 // ### Optimization opportunity
323 // Could be a bit more intelligent and somehow work out which
324 // mtab entry has changed and then only scan that and add and remove
325 // links appropriately.
326// rescan();
327}
328
329void DocumentList::sendAllDocLinks()
330{
331 if ( d->tid != 0 ) {
332 // We are in the middle of scanning, set a flag so
333 // we do this when we finish our scanning
334 d->needToSendAllDocLinks = true;
335 return;
336 }
337
338 QString contents;
339 Categories cats;
340 for ( QListIterator<DocLnk> it( d->dls.children() ); it.current(); ++it ) {
341 DocLnk *doc = it.current();
342 QFileInfo fi( doc->file() );
343 if ( !fi.exists() )
344 continue;
345
346 bool fake = !doc->linkFileKnown();
347 if ( !fake ) {
348 QFile f( doc->linkFile() );
349 if ( f.open( IO_ReadOnly ) ) {
350 QTextStream ts( &f );
351 ts.setEncoding( QTextStream::UnicodeUTF8 );
352 contents += ts.read();
353 f.close();
354 } else
355 fake = TRUE;
356 }
357 if (fake) {
358 contents += "[Desktop Entry]\n"; // No tr
359 contents += "Categories = " + // No tr
360 cats.labels("Document View",doc->categories()).join(";") + "\n"; // No tr
361 contents += "Name = "+doc->name()+"\n"; // No tr
362 contents += "Type = "+doc->type()+"\n"; // No tr
363 }
364 contents += "File = "+doc->file()+"\n"; // No tr // (resolves path)
365 contents += QString("Size = %1\n").arg( fi.size() ); // No tr
366 }
367
368 //qDebug( "sending length %d", contents.length() );
369#ifndef QT_NO_COP
370 QCopEnvelope e( "QPE/Desktop", "docLinks(QString)" );
371 e << contents;
372#endif
373 //qDebug( "================ \n\n%s\n\n===============", contents.latin1() );
374
375 d->needToSendAllDocLinks = false;
376}
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401DocumentListPrivate::DocumentListPrivate( ServerInterface *gui )
402{
403 storage = new StorageInfo( this );
404 serverGui = gui;
405 if ( serverGui ) {
406 sendAppLnks = serverGui->requiresApplications();
407 sendDocLnks = serverGui->requiresDocuments();
408 } else {
409 sendAppLnks = false;
410 sendDocLnks = false;
411 }
412 for ( int i = 0; i < MAX_SEARCH_DEPTH; i++ ) {
413 listDirs[i] = 0;
414 lists[i] = 0;
415 listPositions[i] = 0;
416 }
417 initialize();
418 tid = 0;
419}
420
421
422void DocumentListPrivate::initialize()
423{
424 // Reset
425 dls.clear();
426 docPaths.clear();
427 reference.clear();
428
429 QDir docDir( QPEApplication::documentDir() );
430 if ( docDir.exists() )
431 docPaths += QPEApplication::documentDir();
432 int i = 1;
433 const QList<FileSystem> &fs = storage->fileSystems();
434 QListIterator<FileSystem> it( fs );
435 for ( ; it.current(); ++it )
436 if ( (*it)->isRemovable() ) {
437 docPaths += (*it)->path();
438 i++;
439 }
440
441 for ( int i = 0; i < MAX_SEARCH_DEPTH; i++ ) {
442 if ( listDirs[i] ) {
443 delete listDirs[i];
444 listDirs[i] = 0;
445 }
446 lists[i] = 0;
447 listPositions[i] = 0;
448 }
449
450 docPathsSearched = 0;
451 searchDepth = -1;
452 state = Find;
453 dit = 0;
454}
455
456
457DocumentListPrivate::~DocumentListPrivate()
458{
459 for ( int i = 0; i < MAX_SEARCH_DEPTH; i++ )
460 if ( listDirs[i] )
461 delete listDirs[i];
462 delete dit;
463}
464
465
466void DocumentListPrivate::estimatedPercentScanned()
467{
468 double overallProgress = 0.0;
469 double levelWeight = 75.0;
470
471 int topCount = docPaths.count();
472 if ( topCount > 1 ) {
473 levelWeight = levelWeight / topCount;
474 overallProgress += (docPathsSearched - 1) * levelWeight;
475 }
476
477 for ( int d = 0; d <= searchDepth; d++ ) {
478 if ( listDirs[d] ) {
479 int items = lists[d]->count();
480 if ( items > 1 ) {
481 levelWeight = levelWeight / items;
482 // Take in to account "." and ".."
483 overallProgress += (listPositions[d] - 3) * levelWeight;
484 }
485 } else {
486 break;
487 }
488 }
489
490 // qDebug( "overallProgress: %f", overallProgress );
491
492 if ( serverGui )
493 serverGui->documentScanningProgress( (int)overallProgress );
494}
495
496
497const QString DocumentListPrivate::nextFile()
498{
499 while ( TRUE ) {
500 while ( searchDepth < 0 ) {
501 // go to next base path
502 if ( docPathsSearched >= docPaths.count() ) {
503 // end of base paths
504 return QString::null;
505 } else {
506 QDir dir( docPaths[docPathsSearched] );
507 // qDebug("now using base path: %s", docPaths[docPathsSearched].latin1() );
508 docPathsSearched++;
509 if ( !dir.exists( ".Qtopia-ignore" ) ) {
510 listDirs[0] = new QDir( dir );
511 lists[0] = listDirs[0]->entryInfoList();
512 listPositions[0] = 0;
513 searchDepth = 0;
514 }
515 }
516 }
517
518 const QFileInfoList *fil = lists[searchDepth];
519 QFileInfoList *fl = (QFileInfoList *)fil;
520 unsigned int pos = listPositions[searchDepth];
521
522 if ( pos >= fl->count() ) {
523 // go up a depth
524 delete listDirs[searchDepth];
525 listDirs[searchDepth] = 0;
526 lists[searchDepth] = 0;
527 listPositions[searchDepth] = 0;
528 searchDepth--;
529 } else {
530 const QFileInfo *fi = fl->at(pos);
531 listPositions[searchDepth]++;
532 QString bn = fi->fileName();
533 if ( bn[0] != '.' ) {
534 if ( fi->isDir() ) {
535 if ( bn != "CVS" && bn != "Qtopia" && bn != "QtPalmtop" ) {
536 // go down a depth
537 QDir dir( fi->filePath() );
538 // qDebug("now going in to path: %s", bn.latin1() );
539 if ( !dir.exists( ".Qtopia-ignore" ) ) {
540 if ( searchDepth < MAX_SEARCH_DEPTH - 1) {
541 searchDepth++;
542 listDirs[searchDepth] = new QDir( dir );
543 lists[searchDepth] = listDirs[searchDepth]->entryInfoList();
544 listPositions[searchDepth] = 0;
545 }
546 }
547 }
548 } else {
549 estimatedPercentScanned();
550 return fl->at(pos)->filePath();
551 }
552 }
553 }
554 }
555
556 return QString::null;
557}
558
559
560bool DocumentListPrivate::store( DocLnk* dl )
561{
562 // if ( dl->fileKnown() && !dl->file().isEmpty() ) {
563 if ( dl && dl->fileKnown() ) {
564 dls.add( dl ); // store
565 return TRUE;
566 }
567
568 // don't store - delete
569 delete dl;
570 return FALSE;
571}
572
573
574 #define MAGIC_NUMBER((void*)2)
575
576const DocLnk *DocumentListPrivate::iterate()
577{
578 if ( state == Find ) {
579 //qDebug("state Find");
580 QString file = nextFile();
581 while ( !file.isNull() ) {
582 if ( file.right(8) == ".desktop" ) { // No tr
583 DocLnk* dl = new DocLnk( file );
584 if ( store(dl) )
585 return dl;
586 } else {
587 reference.insert( file, MAGIC_NUMBER );
588 }
589 file = nextFile();
590 }
591 state = RemoveKnownFiles;
592
593 if ( serverGui )
594 serverGui->documentScanningProgress( 75 );
595 }
596
597 static int iterationI;
598 static int iterationCount;
599
600 if ( state == RemoveKnownFiles ) {
601 //qDebug("state RemoveKnownFiles");
602 const QList<DocLnk> &list = dls.children();
603 for ( QListIterator<DocLnk> it( list ); it.current(); ++it ) {
604 reference.remove( (*it)->file() );
605 // ### does this need to be deleted?
606 }
607 dit = new QDictIterator<void>(reference);
608 state = MakeUnknownFiles;
609
610 iterationI = 0;
611 iterationCount = dit->count();
612 }
613
614 if ( state == MakeUnknownFiles ) {
615 //qDebug("state MakeUnknownFiles");
616 for (void* c; (c=dit->current()); ++(*dit) ) {
617 if ( c == MAGIC_NUMBER ) {
618 DocLnk* dl = new DocLnk;
619 QFileInfo fi( dit->currentKey() );
620 dl->setFile( fi.filePath() );
621 dl->setName( fi.baseName() );
622 if ( store(dl) ) {
623 ++*dit;
624 iterationI++;
625 if ( serverGui )
626 serverGui->documentScanningProgress( 75 + (25*iterationI)/iterationCount );
627 return dl;
628 }
629 }
630 iterationI++;
631 }
632
633 delete dit;
634 dit = 0;
635 state = Done;
636 }
637
638 //qDebug("state Done");
639 return NULL;
640}
641
642
643#include "documentlist.moc"
644
645
646
diff --git a/core/launcher/documentlist.h b/core/launcher/documentlist.h
new file mode 100644
index 0000000..bd5c031
--- a/dev/null
+++ b/core/launcher/documentlist.h
@@ -0,0 +1,77 @@
1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3**
4** This file is part of the 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 DOCUMENT_LIST_H
21#define DOCUMENT_LIST_H
22
23
24#include <qobject.h>
25#include <qtopia/applnk.h>
26
27
28class DocumentListPrivate;
29class ServerInterface;
30
31class DocumentList : public QObject {
32 Q_OBJECT
33public:
34 DocumentList( ServerInterface *serverGui, bool scanDocs = TRUE,
35 QObject *parent = 0, const char *name = 0 );
36 ~DocumentList();
37
38 void linkChanged( QString link );
39 void restoreDone();
40 void storageChanged();
41 void sendAllDocLinks();
42
43 void reloadAppLnks();
44 void reloadDocLnks();
45
46// Orig DocList stuff
47 void start();
48 void pause();
49 void resume();
50 void rescan();
51
52 static AppLnkSet *appLnkSet;
53
54/*
55 void resend();
56signals:
57 void added( const DocLnk& doc );
58 void removed( const DocLnk& doc );
59 void changed( const DocLnk& oldDoc, const DocLnk& newDoc );
60 void allRemoved();
61 void doneForNow();
62private slots:
63 void resendWorker();
64*/
65private slots:
66 void startInitialScan();
67protected:
68 void timerEvent( QTimerEvent *te );
69private:
70 void add( const DocLnk& doc );
71 DocumentListPrivate *d;
72
73};
74
75
76#endif
77
diff --git a/core/launcher/firstuse.cpp b/core/launcher/firstuse.cpp
new file mode 100644
index 0000000..31b7923
--- a/dev/null
+++ b/core/launcher/firstuse.cpp
@@ -0,0 +1,517 @@
1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3**
4** This file is part of the 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// I need access to some things you don't normally get access to.
22
23#ifndef _MSC_VER
24 //### revise to allow removal of translators under MSVC
25#define private public
26#define protected public
27#endif
28#include "firstuse.h"
29#include "inputmethods.h"
30#include "applauncher.h"
31#include "serverapp.h"
32#include <qtopia/custom.h>
33#if defined(QPE_NEED_CALIBRATION)
34#include "../settings/calibrate/calibrate.h"
35#endif
36#include "documentlist.h"
37
38#include <qtopia/resource.h>
39#include <qtopia/qcopenvelope_qws.h>
40#include <qtopia/qpeapplication.h>
41#include <qtopia/config.h>
42#include <qtopia/applnk.h>
43#include <qtopia/mimetype.h>
44#include <qtopia/fontmanager.h>
45
46#include <qapplication.h>
47#include <qfile.h>
48#include <qpainter.h>
49#include <qcstring.h>
50#include <qsimplerichtext.h>
51#include <qcolor.h>
52#include <qpushbutton.h>
53#include <qhbox.h>
54#include <qlabel.h>
55#include <qtimer.h>
56
57#if defined( Q_WS_QWS )
58#include <qwsdisplay_qws.h>
59#include <qgfx_qws.h>
60#endif
61
62#include <qwindowsystem_qws.h>
63
64#include <stdlib.h>
65#include <sys/types.h>
66#if defined(Q_OS_LINUX) || defined(_OS_LINUX_)
67#include <unistd.h>
68#endif
69
70
71struct {
72 bool enabled;
73 const char *app;
74 const char *start;
75 const char *stop;
76 const char *desc;
77}
78settingsTable [] =
79{
80 { FALSE, "language", "raise()", "accept()", // No tr
81 QT_TR_NOOP("Language") },
82#ifndef Q_OS_WIN32
83 { FALSE, "systemtime", "raise()", "accept()", // No tr
84 QT_TR_NOOP("Time and Date") },
85#endif
86 { FALSE, "addressbook", "editPersonalAndClose()", "accept()", // No tr
87 QT_TR_NOOP("Personal Information") },
88 { FALSE, 0, 0, 0, 0 }
89};
90
91
92FirstUse::FirstUse(QWidget* parent, const char * name, WFlags wf) :
93 QDialog( parent, name, TRUE, wf),
94 transApp(0), transLib(0), needCalibrate(FALSE), currApp(-1),
95 waitForExit(-1), waitingForLaunch(FALSE), needRestart(FALSE)
96{
97 ServerApplication::allowRestart = FALSE;
98 // we force our height beyound the maximum (which we set anyway)
99 QRect desk = qApp->desktop()->geometry();
100 setGeometry( 0, 0, desk.width(), desk.height() );
101
102 connect(qwsServer, SIGNAL(newChannel(const QString&)),
103 this, SLOT(newQcopChannel(const QString&)));
104
105 // Create a DocumentList so appLauncher has appLnkSet to search
106 docList = new DocumentList( 0, FALSE );
107 appLauncher = new AppLauncher( this );
108 connect( appLauncher, SIGNAL(terminated(int, const QString&)),
109 this, SLOT(terminated(int, const QString&)) );
110
111 // more hackery
112 // I will be run as either the main server or as part of the main server
113 QWSServer::setScreenSaverIntervals(0);
114 loadPixmaps();
115
116 //check if there is a language program
117#ifndef Q_OS_WIN32
118 QString exeSuffix;
119#else
120 QString exeSuffix(".exe");
121#endif
122
123 for ( int i = 0; settingsTable[i].app; i++ ) {
124 QString file = QPEApplication::qpeDir() + "bin/";
125 file += settingsTable[i].app;
126 file += exeSuffix;
127 if ( QFile::exists(file) )
128 settingsTable[i].enabled = TRUE;
129 }
130
131 setFocusPolicy(NoFocus);
132
133 taskBar = new QWidget(0, 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop | WGroupLeader);
134
135 inputMethods = new InputMethods(taskBar);
136 connect(inputMethods, SIGNAL(inputToggled(bool)),
137 this, SLOT(calcMaxWindowRect()));
138
139 back = new QPushButton(tr("<< Back"), taskBar);
140 back->setFocusPolicy(NoFocus);
141 connect(back, SIGNAL(clicked()), this, SLOT(previousDialog()) );
142
143 next = new QPushButton(tr("Next >>"), taskBar);
144 next->setFocusPolicy(NoFocus);
145 connect(next, SIGNAL(clicked()), this, SLOT(nextDialog()) );
146
147 // need to set the geom to lower corner
148 QSize sz = inputMethods->sizeHint();
149 int buttonWidth = (width() - sz.width()) / 2;
150 int x = 0;
151
152 controlHeight = back->sizeHint().height();
153
154 inputMethods->setGeometry(0,0, sz.width(), controlHeight );
155 x += sz.width();
156
157 back->setGeometry(x, 0, buttonWidth, controlHeight);
158 x += buttonWidth;
159 next->setGeometry(x, 0, buttonWidth, controlHeight);
160
161 taskBar->setGeometry( 0, height() - controlHeight, desk.width(), controlHeight);
162 taskBar->hide();
163
164#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
165 qDebug("Setting up QCop to QPE/System");
166 QCopChannel* sysChannel = new QCopChannel( "QPE/System", this );
167 connect(sysChannel, SIGNAL(received(const QCString &, const QByteArray &)),
168 this, SLOT(message(const QCString &, const QByteArray &)) );
169#endif
170 calcMaxWindowRect();
171#if defined(QPE_NEED_CALIBRATION)
172 if ( !QFile::exists("/etc/pointercal") ) {
173 needCalibrate = TRUE;
174 grabMouse();
175 }
176#endif
177 Config config("locale");
178 config.setGroup( "Language");
179 lang = config.readEntry( "Language", "en");
180
181 defaultFont = font();
182
183 //###language/font hack; should look it up somewhere
184#ifdef Q_WS_QWS
185 if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) {
186 QFont fn = FontManager::unicodeFont( FontManager::Proportional );
187 qApp->setFont( fn, TRUE );
188 }
189#endif
190}
191
192FirstUse::~FirstUse()
193{
194 delete appLauncher;
195 delete docList;
196 delete taskBar;
197 ServerApplication::allowRestart = TRUE;
198}
199
200void FirstUse::calcMaxWindowRect()
201{
202#ifdef Q_WS_QWS
203 QRect wr;
204 int displayWidth = qApp->desktop()->width();
205 QRect ir = inputMethods->inputRect();
206 if ( ir.isValid() ) {
207 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 );
208 } else {
209 wr.setCoords( 0, 0, displayWidth-1,
210 qApp->desktop()->height() - controlHeight-1);
211 }
212
213#if QT_VERSION < 0x030000
214 QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr,
215 QSize(qt_screen->width(),qt_screen->height()))
216 );
217#else
218 QWSServer::setMaxWindowRect( wr );
219#endif
220#endif
221}
222
223/* cancel current dialog, and bring up next */
224void FirstUse::nextDialog()
225{
226 int prevApp = currApp;
227 do {
228 currApp++;
229 qDebug( "currApp = %d", currApp );
230 if ( settingsTable[currApp].app == 0 ) {
231 if ( prevApp >= 0 && appLauncher->isRunning(settingsTable[prevApp].app) ) {
232 // The last application is still running.
233 // Tell it to stop, and when its done we'll come back
234 // to nextDialog and exit.
235 qDebug( "Waiting for %s to exit", settingsTable[prevApp].app );
236 QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app,
237 settingsTable[prevApp].stop );
238 currApp = prevApp;
239 } else {
240 qDebug( "Done!" );
241 Config config( "qpe" );
242 config.setGroup( "Startup" );
243 config.writeEntry( "FirstUse", FALSE );
244 QPixmap pix = Resource::loadPixmap("bigwait");
245 QLabel *lblWait = new QLabel(0, "wait hack!", // No tr
246 QWidget::WStyle_Customize | QWidget::WDestructiveClose |
247 QWidget::WStyle_NoBorder | QWidget::WStyle_Tool |
248 QWidget::WStyle_StaysOnTop);
249 lblWait->setPixmap( pix );
250 lblWait->setAlignment( QWidget::AlignCenter );
251 lblWait->setGeometry( qApp->desktop()->geometry() );
252 lblWait->show();
253 qApp->processEvents();
254 QTimer::singleShot( 1000, lblWait, SLOT(close()) );
255 repaint();
256 close();
257 ServerApplication::allowRestart = TRUE;
258 }
259 return;
260 }
261 } while ( !settingsTable[currApp].enabled );
262
263 if ( prevApp >= 0 && appLauncher->isRunning(settingsTable[prevApp].app) ) {
264 qDebug( "Shutdown: %s", settingsTable[prevApp].app );
265 QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app,
266 settingsTable[prevApp].stop );
267 waitForExit = prevApp;
268 } else {
269 qDebug( "Startup: %s", settingsTable[currApp].app );
270 QCopEnvelope e(QCString("QPE/Application/") + settingsTable[currApp].app,
271 settingsTable[currApp].start );
272 waitingForLaunch = TRUE;
273 }
274
275 updateButtons();
276}
277
278/* accept current dialog and bring up previous */
279void FirstUse::previousDialog()
280{
281 int prevApp = currApp;
282 do {
283 currApp--;
284 if ( currApp < 0 ) {
285 currApp = prevApp;
286 return;
287 }
288 } while ( !settingsTable[currApp].enabled );
289
290 if ( prevApp >= 0 ) {
291 qDebug( "Shutdown: %s", settingsTable[prevApp].app );
292 QCopEnvelope e(QCString("QPE/Application/") + settingsTable[prevApp].app,
293 settingsTable[prevApp].stop );
294/*
295 if (settingsTable[prevApp].app == QString("systemtime"))
296 QCopEnvelope e("QPE/Application/citytime", "close()");
297*/
298 waitForExit = prevApp;
299 } else {
300 qDebug( "Startup: %s", settingsTable[currApp].app );
301 QCopEnvelope e(QCString("QPE/Application/") + settingsTable[currApp].app,
302 settingsTable[currApp].start );
303 waitingForLaunch = TRUE;
304 }
305
306 updateButtons();
307}
308
309void FirstUse::message(const QCString &msg, const QByteArray &data)
310{
311 QDataStream stream( data, IO_ReadOnly );
312 if ( msg == "timeChange(QString)" ) {
313 QString t;
314 stream >> t;
315 if ( t.isNull() )
316 unsetenv("TZ");
317 else
318 setenv( "TZ", t.latin1(), 1 );
319 }
320}
321
322void FirstUse::terminated( int, const QString &app )
323{
324 qDebug( "--- terminated: %s", app.latin1() );
325 if ( waitForExit != -1 && settingsTable[waitForExit].app == app ) {
326 qDebug( "Startup: %s", settingsTable[currApp].app );
327 if ( settingsTable[waitForExit].app == "language" ) { // No tr
328 Config config("locale");
329 config.setGroup( "Language");
330 QString l = config.readEntry( "Language", "en");
331 if ( l != lang ) {
332 reloadLanguages();
333 needRestart = TRUE;
334 lang = l;
335 }
336 }
337 QCopEnvelope e(QCString("QPE/Application/") + settingsTable[currApp].app,
338 settingsTable[currApp].start );
339 waitingForLaunch = TRUE;
340 updateButtons();
341 repaint();
342 waitForExit = -1;
343 } else if ( settingsTable[currApp].app == app ) {
344 nextDialog();
345 } else {
346 back->setEnabled(TRUE);
347 next->setEnabled(TRUE);
348 }
349}
350
351void FirstUse::newQcopChannel(const QString& channelName)
352{
353 qDebug("channel %s added", channelName.data() );
354 QString prefix("QPE/Application/");
355 if (channelName.startsWith(prefix)) {
356 QString appName = channelName.mid(prefix.length());
357 if ( currApp >= 0 && appName == settingsTable[currApp].app ) {
358 qDebug( "Application: %s started", settingsTable[currApp].app );
359 waitingForLaunch = FALSE;
360 updateButtons();
361 repaint();
362 } else if (appName != "quicklauncher") {
363 back->setEnabled(FALSE);
364 next->setEnabled(FALSE);
365 }
366 }
367}
368
369void FirstUse::reloadLanguages()
370{
371 // read language from config file. Waiting on QCop takes too long.
372 Config config("locale");
373 config.setGroup( "Language");
374 QString l = config.readEntry( "Language", "en");
375 QString cl = getenv("LANG");
376 qWarning("language message - " + l);
377 // setting anyway...
378 if (l.isNull() )
379 unsetenv( "LANG" );
380 else {
381 qWarning("and its not null");
382 setenv( "LANG", l.latin1(), 1 );
383 }
384#ifndef QT_NO_TRANSLATION
385 // clear old translators
386#ifndef _MSC_VER
387 //### revise to allow removal of translators under MSVC
388 if(qApp->translators) {
389 qApp->translators->setAutoDelete(TRUE);
390 delete (qApp->translators);
391 qApp->translators = 0;
392 }
393#endif
394
395 // load translation tables
396 transApp = new QTranslator(qApp);
397 QString tfn = QPEApplication::qpeDir() + "i18n/"+l+"/qpe.qm";
398 qWarning("loading " + tfn);
399 if ( transApp->load(tfn) ) {
400 qWarning("installing translator");
401 qApp->installTranslator( transApp );
402 } else {
403 delete transApp;
404 transApp = 0;
405 }
406
407 transLib = new QTranslator(qApp);
408 tfn = QPEApplication::qpeDir() + "i18n/"+l+"/libqpe.qm";
409 qWarning("loading " + tfn);
410 if ( transLib->load(tfn) ) {
411 qWarning("installing translator library");
412 qApp->installTranslator( transLib );
413 } else {
414 delete transLib;
415 transLib = 0;
416 }
417 loadPixmaps();
418 //###language/font hack; should look it up somewhere
419#ifdef Q_WS_QWS
420 if ( l == "ja" || l == "zh_CN" || l == "zh_TW" || l == "ko" ) {
421 QFont fn = FontManager::unicodeFont( FontManager::Proportional );
422 qApp->setFont( fn, TRUE );
423 } else {
424 qApp->setFont( defaultFont, TRUE );
425 }
426#endif
427#endif
428}
429
430void FirstUse::paintEvent( QPaintEvent * )
431{
432 QPainter p( this );
433
434 p.drawPixmap(0,0, splash);
435
436 QFont f = p.font();
437 f.setPointSize(15);
438 f.setItalic(FALSE);
439 f.setBold(FALSE);
440 p.setFont(f);
441
442 if ( currApp < 0 ) {
443 drawText(p, tr( "Tap anywhere on the screen to continue." ));
444 } else if ( settingsTable[currApp].app ) {
445 if ( waitingForLaunch )
446 drawText(p, tr("Please wait, loading %1 settings.").arg(tr(settingsTable[currApp].desc)) );
447 } else {
448 drawText(p, tr("Please wait..."));
449 }
450}
451
452void FirstUse::loadPixmaps()
453{
454 /* create background, tr so can change image with language.
455 images will likely contain text. */
456 splash.convertFromImage( Resource::loadImage(tr("FirstUseBackground"))
457 .smoothScale( width(), height() ) );
458
459 setBackgroundPixmap(splash);
460}
461
462void FirstUse::drawText(QPainter &p, const QString &text)
463{
464 QString altered = "<CENTER>" + text + "</CENTER>";
465
466 QSimpleRichText rt(altered, p.font());
467 rt.setWidth(width() - 20);
468
469 int h = (height() * 3) / 10; // start at 30%
470 if (rt.height() < height() / 2)
471 h += ((height() / 2) - rt.height()) / 2;
472 rt.draw(&p, 10, h, QRegion(0,0, width()-20, height()), palette());
473}
474
475void FirstUse::updateButtons()
476{
477 if ( currApp >= 0 ) {
478 taskBar->show();
479 }
480
481 int i = currApp-1;
482 while ( i >= 0 && !settingsTable[i].enabled )
483 i--;
484 back->setText(tr("<< Back"));
485 back->setEnabled( i >= 0 && !waitingForLaunch );
486
487 i = currApp+1;
488 while ( settingsTable[i].app && !settingsTable[i].enabled )
489 i++;
490 if ( !settingsTable[i].app )
491 next->setText(tr("Finish"));
492 else
493 next->setText(tr("Next >>"));
494 next->setEnabled( !waitingForLaunch );
495}
496
497void FirstUse::keyPressEvent( QKeyEvent *e )
498{
499 // Allow cancelling at first dialog, in case display is broken.
500 if ( e->key() == Key_Escape && currApp < 0 )
501 QDialog::keyPressEvent(e);
502}
503
504void FirstUse::mouseReleaseEvent( QMouseEvent * )
505{
506 if ( currApp < 0 ) {
507#if defined(QPE_NEED_CALIBRATION)
508 if ( needCalibrate ) {
509 releaseMouse();
510 Calibrate *cal = new Calibrate;
511 cal->exec();
512 delete cal;
513 }
514#endif
515 nextDialog();
516 }
517}
diff --git a/core/launcher/firstuse.h b/core/launcher/firstuse.h
new file mode 100644
index 0000000..44a95a8
--- a/dev/null
+++ b/core/launcher/firstuse.h
@@ -0,0 +1,84 @@
1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3**
4** This file is part of the 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 <qdialog.h>
22#include <qpixmap.h>
23
24class InputMethods;
25class QCString;
26class QPushButton;
27class QTranslator;
28class AppLauncher;
29class DocumentList;
30
31class FirstUse : public QDialog
32{
33 Q_OBJECT
34public:
35 FirstUse(QWidget* parent=0, const char * name=0, WFlags=0);
36 ~FirstUse();
37
38 bool restartNeeded() const { return needRestart; }
39
40private slots:
41 void message(const QCString &, const QByteArray &);
42 void calcMaxWindowRect();
43
44 void nextDialog();
45 void previousDialog();
46 void terminated( int, const QString & );
47 void newQcopChannel(const QString & );
48
49private:
50 void paintEvent( QPaintEvent * );
51 void mouseReleaseEvent( QMouseEvent * );
52 void keyPressEvent( QKeyEvent *e );
53
54 void loadPixmaps();
55
56 void reloadLanguages();
57 void drawText(QPainter &p, const QString &text);
58 void updateButtons();
59
60private:
61 QPixmap splash;
62 QPixmap buttons;
63
64 InputMethods *inputMethods;
65 QPushButton *back;
66 QPushButton *next;
67 int controlHeight;
68
69 QString lang;
70 QTranslator *transApp;
71 QTranslator *transLib;
72
73 bool needCalibrate;
74 DocumentList *docList;
75 AppLauncher *appLauncher;
76 QWidget *taskBar;
77
78 int currApp;
79 int waitForExit;
80 bool waitingForLaunch;
81 bool needRestart;
82
83 QFont defaultFont;
84};
diff --git a/core/launcher/launchertab.cpp b/core/launcher/launchertab.cpp
new file mode 100644
index 0000000..10cfd5f
--- a/dev/null
+++ b/core/launcher/launchertab.cpp
@@ -0,0 +1,284 @@
1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3**
4** This file is part of the 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 "launchertab.h"
21#include <qapplication.h>
22#include <qstyle.h>
23#include <qpainter.h>
24#include <qbitmap.h>
25
26
27LauncherTabBar::LauncherTabBar( QWidget *parent, const char *name )
28 : QTabBar( parent, name )
29{
30 setFocusPolicy( NoFocus );
31 connect( this, SIGNAL( selected(int) ), this, SLOT( layoutTabs() ) );
32}
33
34LauncherTabBar::~LauncherTabBar()
35{
36}
37
38void LauncherTabBar::insertTab( LauncherTab *t, int index )
39{
40 if ( index < 0 )
41 items.append( t );
42 else
43 items.insert( (uint)index, t );
44 tabs.insert( t->type, t );
45 QTabBar::insertTab( t, index );
46}
47
48void LauncherTabBar::removeTab( QTab *tab )
49{
50 LauncherTab *t = (LauncherTab *)tab;
51 tabs.remove( t->type );
52 items.remove( t );
53 QTabBar::removeTab( t );
54}
55
56void LauncherTabBar::prevTab()
57{
58 int n = count();
59 int tab = currentTab();
60 if ( tab >= 0 )
61 setCurrentTab( (tab - 1 + n)%n );
62}
63
64void LauncherTabBar::nextTab()
65{
66 int n = count();
67 int tab = currentTab();
68 setCurrentTab( (tab + 1)%n );
69}
70
71void LauncherTabBar::showTab( const QString& id )
72{
73 setCurrentTab( tabs[id] );
74}
75
76void LauncherTabBar::layoutTabs()
77{
78 if ( !count() )
79 return;
80
81 int available = width()-1;
82
83 QFontMetrics fm = fontMetrics();
84 int hiddenTabWidth = -12;
85 LauncherTab *current = currentLauncherTab();
86 int hframe, vframe, overlap;
87 style().tabbarMetrics( this, hframe, vframe, overlap );
88 int x = 0;
89 QRect r;
90 LauncherTab *t;
91 QListIterator< LauncherTab > it( items );
92 int required = 0;
93 int eventabwidth = (width()-1)/count();
94 enum Mode { HideBackText, Pack, Even } mode=Even;
95 for (it.toFirst(); it.current(); ++it ) {
96 t = it.current();
97 if ( !t )
98 continue;
99 int iw = fm.width( t->text() ) + hframe - overlap;
100 if ( t != current ) {
101 available -= hiddenTabWidth + hframe - overlap;
102 if ( t->iconSet() != 0 )
103 available -= t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width();
104 }
105 if ( t->iconSet() != 0 )
106 iw += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width();
107 required += iw;
108 // As space gets tight, packed looks better than even. "10" must be at least 0.
109 if ( iw >= eventabwidth-10 )
110 mode = Pack;
111 }
112 if ( mode == Pack && required > width()-1 )
113 mode = HideBackText;
114 for ( it.toFirst(); it.current(); ++it ) {
115 t = it.current();
116 if ( !t )
117 continue;
118 if ( mode != HideBackText ) {
119 int w = fm.width( t->text() );
120 int ih = 0;
121 if ( t->iconSet() != 0 ) {
122 w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width();
123 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height();
124 }
125 int h = QMAX( fm.height(), ih );
126 h = QMAX( h, QApplication::globalStrut().height() );
127
128 h += vframe;
129 w += hframe;
130
131 QRect totr(x, 0,
132 mode == Even ? eventabwidth : w * (width()-1)/required, h);
133 t->setRect(totr);
134 x += totr.width() - overlap;
135 r = r.unite(totr);
136 } else if ( t != current ) {
137 int w = hiddenTabWidth;
138 int ih = 0;
139 if ( t->iconSet() != 0 ) {
140 w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width();
141 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height();
142 }
143 int h = QMAX( fm.height(), ih );
144 h = QMAX( h, QApplication::globalStrut().height() );
145
146 h += vframe;
147 w += hframe;
148
149 t->setRect( QRect(x, 0, w, h) );
150 x += t->rect().width() - overlap;
151 r = r.unite( t->rect() );
152 } else {
153 int ih = 0;
154 if ( t->iconSet() != 0 ) {
155 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height();
156 }
157 int h = QMAX( fm.height(), ih );
158 h = QMAX( h, QApplication::globalStrut().height() );
159
160 h += vframe;
161
162 t->setRect( QRect(x, 0, available, h) );
163 x += t->rect().width() - overlap;
164 r = r.unite( t->rect() );
165 }
166 }
167
168 t = it.toLast();
169 if (t) {
170 QRect rr = t->rect();
171 rr.setRight(width()-1);
172 t->setRect( rr );
173 }
174
175 for (it.toFirst(); it.current(); ++it ) {
176 t = it.current();
177 QRect tr = t->rect();
178 tr.setHeight( r.height() );
179 t->setRect( tr );
180 }
181
182 update();
183}
184
185void LauncherTabBar::paint( QPainter * p, QTab * t, bool selected ) const
186{
187 LauncherTabBar *that = (LauncherTabBar *) this;
188 LauncherTab *ct = (LauncherTab *)t;
189 QPalette pal = palette();
190 bool setPal = FALSE;
191 if ( ct->bgColor.isValid() ) {
192 pal.setColor( QPalette::Active, QColorGroup::Background, ct->bgColor );
193 pal.setColor( QPalette::Active, QColorGroup::Button, ct->bgColor );
194 pal.setColor( QPalette::Inactive, QColorGroup::Background, ct->bgColor );
195 pal.setColor( QPalette::Inactive, QColorGroup::Button, ct->bgColor );
196 that->setUpdatesEnabled( FALSE );
197 that->setPalette( pal );
198 setPal = TRUE;
199 }
200#if QT_VERSION >= 0x030000
201 QStyle::SFlags flags = QStyle::Style_Default;
202 if ( selected )
203 flags |= QStyle::Style_Selected;
204 style().drawControl( QStyle::CE_TabBarTab, p, this, t->rect(),
205 colorGroup(), flags, QStyleOption(t) );
206#else
207 style().drawTab( p, this, t, selected );
208#endif
209
210 QRect r( t->rect() );
211 QFont f( font() );
212 if ( selected )
213 f.setBold( TRUE );
214 p->setFont( f );
215
216 if ( ct->fgColor.isValid() ) {
217 pal.setColor( QPalette::Active, QColorGroup::Foreground, ct->fgColor );
218 pal.setColor( QPalette::Inactive, QColorGroup::Foreground, ct->fgColor );
219 that->setUpdatesEnabled( FALSE );
220 that->setPalette( pal );
221 setPal = TRUE;
222 }
223 int iw = 0;
224 int ih = 0;
225 if ( t->iconSet() != 0 ) {
226 iw = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width() + 2;
227 ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height();
228 }
229 int w = iw + p->fontMetrics().width( t->text() ) + 4;
230 int h = QMAX(p->fontMetrics().height() + 4, ih );
231 paintLabel( p, QRect( r.left() + (r.width()-w)/2 - 3,
232 r.top() + (r.height()-h)/2, w, h ), t,
233#if QT_VERSION >= 0x030000
234 t->identifier() == keyboardFocusTab()
235#else
236 t->identitifer() == keyboardFocusTab()
237#endif
238 );
239 if ( setPal ) {
240 that->unsetPalette();
241 that->setUpdatesEnabled( TRUE );
242 }
243}
244
245void LauncherTabBar::paintLabel( QPainter* p, const QRect&,
246 QTab* t, bool has_focus ) const
247{
248 QRect r = t->rect();
249 // if ( t->id != currentTab() )
250 //r.moveBy( 1, 1 );
251 //
252 if ( t->iconSet() ) {
253 // the tab has an iconset, draw it in the right mode
254 QIconSet::Mode mode = (t->isEnabled() && isEnabled()) ? QIconSet::Normal : QIconSet::Disabled;
255 if ( mode == QIconSet::Normal && has_focus )
256 mode = QIconSet::Active;
257 QPixmap pixmap = t->iconSet()->pixmap( QIconSet::Small, mode );
258 int pixw = pixmap.width();
259 int pixh = pixmap.height();
260 p->drawPixmap( r.left() + 6, r.center().y() - pixh / 2 + 1, pixmap );
261 r.setLeft( r.left() + pixw + 5 );
262 }
263
264 QRect tr = r;
265
266 if ( r.width() < 20 )
267 return;
268
269 if ( t->isEnabled() && isEnabled() ) {
270#if defined(_WS_WIN32_)
271 if ( colorGroup().brush( QColorGroup::Button ) == colorGroup().brush( QColorGroup::Background ) )
272 p->setPen( colorGroup().buttonText() );
273 else
274 p->setPen( colorGroup().foreground() );
275#else
276 p->setPen( colorGroup().foreground() );
277#endif
278 p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() );
279 } else {
280 p->setPen( palette().disabled().foreground() );
281 p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() );
282 }
283}
284
diff --git a/core/launcher/launchertab.h b/core/launcher/launchertab.h
new file mode 100644
index 0000000..653919b
--- a/dev/null
+++ b/core/launcher/launchertab.h
@@ -0,0 +1,90 @@
1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3**
4** This file is part of the 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 LAUNCHERTAB_H
21#define LAUNCHERTAB_H
22
23#include <qcolor.h>
24#include <qstring.h>
25#include <qwidget.h>
26#include <qrect.h>
27#include <qiconset.h>
28#include <qlist.h>
29#include <qdict.h>
30#include <qtabbar.h>
31
32class LauncherView;
33
34class LauncherTab : public QTab
35{
36public:
37 LauncherTab( const QString &idStr, LauncherView *viewPtr,
38 const QIconSet &iconSet,
39 const QString &textStr=QString::null )
40 : QTab( iconSet, textStr )
41 {
42 type = idStr;
43 view = viewPtr;
44 }
45
46 QString type;
47 LauncherView *view;
48 QColor bgColor;
49 QColor fgColor;
50};
51
52class LauncherTabBar : public QTabBar
53{
54 Q_OBJECT
55public:
56 LauncherTabBar( QWidget *parent=0, const char *name=0 );
57 ~LauncherTabBar();
58
59 void insertTab( LauncherTab *, int index = -1 );
60 void removeTab( QTab * );
61
62 LauncherView *currentView() {
63 return currentLauncherTab()->view;
64 }
65
66 LauncherTab *currentLauncherTab() {
67 return (LauncherTab*) tab( currentTab() );
68 }
69
70 LauncherTab *launcherTab( const QString &id ) const { return tabs[id]; }
71
72 void nextTab();
73 void prevTab();
74
75public slots:
76 void showTab(const QString&);
77
78protected slots:
79 virtual void layoutTabs();
80
81protected:
82 virtual void paint( QPainter *p, QTab *t, bool f ) const;
83 void paintLabel( QPainter* p, const QRect& br, QTab* t, bool has_focus ) const;
84
85private:
86 QList<LauncherTab> items;
87 QDict<LauncherTab> tabs;
88};
89
90#endif
diff --git a/core/launcher/qpe-de.ts b/core/launcher/qpe-de.ts
new file mode 100644
index 0000000..50b55c8
--- a/dev/null
+++ b/core/launcher/qpe-de.ts
@@ -0,0 +1,324 @@
1<!DOCTYPE TS><TS>
2<context>
3 <name>@default</name>
4 <message>
5 <source>Language</source>
6 <translation type="unfinished"></translation>
7 </message>
8 <message>
9 <source>Time and Date</source>
10 <translation type="unfinished"></translation>
11 </message>
12 <message>
13 <source>Personal Information</source>
14 <translation type="unfinished"></translation>
15 </message>
16</context>
17<context>
18 <name>AppLauncher</name>
19 <message>
20 <source>&lt;qt&gt;&lt;p&gt;Fast loading has been disabled for this application. Tap and hold the application icon to reenable it.&lt;/qt&gt;</source>
21 <translation type="unfinished"></translation>
22 </message>
23 <message>
24 <source>Application terminated</source>
25 <translation type="unfinished"></translation>
26 </message>
27 <message>
28 <source>Application not found</source>
29 <translation type="unfinished"></translation>
30 </message>
31 <message>
32 <source>&lt;qt&gt;Could not locate application &lt;b&gt;%1&lt;/b&gt;&lt;/qt&gt;</source>
33 <translation type="unfinished"></translation>
34 </message>
35 <message>
36 <source>Error</source>
37 <translation type="unfinished"></translation>
38 </message>
39 <message>
40 <source>Could not find the application %1</source>
41 <translation type="unfinished"></translation>
42 </message>
43 <message>
44 <source>OK</source>
45 <translation type="unfinished"></translation>
46 </message>
47 <message>
48 <source>&lt;qt&gt;&lt;b&gt;%1&lt;/b&gt; was terminated due to signal code %2&lt;/qt&gt;</source>
49 <translation type="unfinished"></translation>
50 </message>
51</context>
52<context>
53 <name>AppMonitor</name>
54 <message>
55 <source>Application Problem</source>
56 <translation type="unfinished"></translation>
57 </message>
58 <message>
59 <source>&lt;p&gt;%1 is not responding.&lt;/p&gt;</source>
60 <translation type="unfinished"></translation>
61 </message>
62 <message>
63 <source>&lt;p&gt;Would you like to force the application to exit?&lt;/p&gt;</source>
64 <translation type="unfinished"></translation>
65 </message>
66</context>
67<context>
68 <name>CategoryTabWidget</name>
69 <message>
70 <source>Documents</source>
71 <translation type="unfinished"></translation>
72 </message>
73 <message>
74 <source>Icon View</source>
75 <translation type="unfinished"></translation>
76 </message>
77 <message>
78 <source>List View</source>
79 <translation type="unfinished"></translation>
80 </message>
81</context>
82<context>
83 <name>Desktop</name>
84 <message>
85 <source>Memory Status</source>
86 <translation type="unfinished"></translation>
87 </message>
88 <message>
89 <source>Memory Low
90Please save data.</source>
91 <translation type="unfinished"></translation>
92 </message>
93 <message>
94 <source>Critical Memory Shortage
95Please end this application
96immediately.</source>
97 <translation type="unfinished"></translation>
98 </message>
99</context>
100<context>
101 <name>DesktopApplication</name>
102 <message>
103 <source>Battery is running very low.</source>
104 <translation type="unfinished"></translation>
105 </message>
106 <message>
107 <source>The Back-up battery is very low.
108Please charge the back-up battery.</source>
109 <translation type="unfinished"></translation>
110 </message>
111 <message>
112 <source>Safe Mode</source>
113 <translation type="unfinished"></translation>
114 </message>
115 <message>
116 <source>&lt;P&gt;A system startup error occurred, and the system is now in Safe Mode. Plugins are not loaded in Safe Mode. You can use the Plugin Manager to disable plugins that cause system error.</source>
117 <translation type="unfinished"></translation>
118 </message>
119 <message>
120 <source>OK</source>
121 <translation type="unfinished"></translation>
122 </message>
123 <message>
124 <source>Plugin Manager...</source>
125 <translation type="unfinished"></translation>
126 </message>
127 <message>
128 <source>Battery level is critical!
129Please recharge the main battery!</source>
130 <translation type="unfinished"></translation>
131 </message>
132</context>
133<context>
134 <name>DesktopPowerAlerter</name>
135 <message>
136 <source>Battery Status</source>
137 <translation type="unfinished"></translation>
138 </message>
139 <message>
140 <source>Low Battery</source>
141 <translation type="unfinished"></translation>
142 </message>
143</context>
144<context>
145 <name>FirstUse</name>
146 <message>
147 <source>&lt;&lt; Back</source>
148 <translation type="unfinished">&lt;&lt; Zurück</translation>
149 </message>
150 <message>
151 <source>Next &gt;&gt;</source>
152 <translation type="unfinished">Nächstes &gt;&gt;</translation>
153 </message>
154 <message>
155 <source>Tap anywhere on the screen to continue.</source>
156 <translation type="unfinished">Berühren Sie den Bildschirm, um fortzufahren</translation>
157 </message>
158 <message>
159 <source>Please wait, loading %1 settings.</source>
160 <translation type="unfinished"></translation>
161 </message>
162 <message>
163 <source>Please wait...</source>
164 <translation type="unfinished">Bitte warten...</translation>
165 </message>
166 <message>
167 <source>FirstUseBackground</source>
168 <translation type="unfinished"></translation>
169 </message>
170 <message>
171 <source>Finish</source>
172 <translation type="unfinished">Fertig</translation>
173 </message>
174</context>
175<context>
176 <name>InputMethods</name>
177 <message>
178 <source>Unicode</source>
179 <translation type="unfinished"></translation>
180 </message>
181</context>
182<context>
183 <name>Launcher</name>
184 <message>
185 <source>Launcher</source>
186 <translation type="unfinished"></translation>
187 </message>
188 <message>
189 <source> - Launcher</source>
190 <translation type="unfinished"></translation>
191 </message>
192 <message>
193 <source>No application</source>
194 <translation type="unfinished"></translation>
195 </message>
196 <message>
197 <source>&lt;p&gt;No application is defined for this document.&lt;p&gt;Type is %1.</source>
198 <translation type="unfinished"></translation>
199 </message>
200 <message>
201 <source>OK</source>
202 <translation type="unfinished"></translation>
203 </message>
204 <message>
205 <source>View as text</source>
206 <translation type="unfinished"></translation>
207 </message>
208 <message>
209 <source>Finding documents...</source>
210 <translation type="unfinished"></translation>
211 </message>
212</context>
213<context>
214 <name>LauncherView</name>
215 <message>
216 <source>All types</source>
217 <translation type="unfinished"></translation>
218 </message>
219 <message>
220 <source>Document View</source>
221 <translation type="unfinished"></translation>
222 </message>
223</context>
224<context>
225 <name>SafeMode</name>
226 <message>
227 <source>Safe Mode</source>
228 <translation type="unfinished"></translation>
229 </message>
230 <message>
231 <source>Plugin Manager...</source>
232 <translation type="unfinished"></translation>
233 </message>
234 <message>
235 <source>Restart Qtopia</source>
236 <translation type="unfinished"></translation>
237 </message>
238 <message>
239 <source>Help...</source>
240 <translation type="unfinished"></translation>
241 </message>
242</context>
243<context>
244 <name>Shutdown</name>
245 <message>
246 <source>Shut down...</source>
247 <translation type="unfinished"></translation>
248 </message>
249 <message>
250 <source>Terminate</source>
251 <translation type="unfinished"></translation>
252 </message>
253 <message>
254 <source>Terminate Server</source>
255 <translation type="unfinished"></translation>
256 </message>
257 <message>
258 <source>Reboot</source>
259 <translation type="unfinished"></translation>
260 </message>
261 <message>
262 <source>Restart Server</source>
263 <translation type="unfinished"></translation>
264 </message>
265 <message>
266 <source>Shutdown</source>
267 <translation type="unfinished"></translation>
268 </message>
269 <message>
270 <source>&lt;p&gt;
271These termination options are provided primarily for use while developing and testing the Qtopia system. In a normal environment, these concepts are unnecessary.</source>
272 <translation type="unfinished"></translation>
273 </message>
274 <message>
275 <source>Cancel</source>
276 <translation type="unfinished"></translation>
277 </message>
278</context>
279<context>
280 <name>SyncAuthentication</name>
281 <message>
282 <source>Sync Connection</source>
283 <translation type="unfinished"></translation>
284 </message>
285 <message>
286 <source>&lt;p&gt;An unauthorized system is requesting access to this device.&lt;p&gt;If you are using a version of Qtopia Desktop older than 1.5.1, please upgrade.</source>
287 <translation type="unfinished"></translation>
288 </message>
289 <message>
290 <source>Deny</source>
291 <translation type="unfinished"></translation>
292 </message>
293 <message>
294 <source>&lt;p&gt;An unrecognized system is requesting access to this device.&lt;p&gt;If you have just initiated a Sync for the first time, this is normal.</source>
295 <translation type="unfinished"></translation>
296 </message>
297 <message>
298 <source>Allow</source>
299 <translation type="unfinished"></translation>
300 </message>
301</context>
302<context>
303 <name>SyncDialog</name>
304 <message>
305 <source>Abort</source>
306 <translation type="unfinished"></translation>
307 </message>
308 <message>
309 <source>Syncing:</source>
310 <translation type="unfinished"></translation>
311 </message>
312</context>
313<context>
314 <name>TempScreenSaverMonitor</name>
315 <message>
316 <source>&lt;qt&gt;The running applications disabled the screen saver for more than the allowed time (%1).&lt;p&gt;The system was forced to suspend&lt;/p&gt;&lt;/qt&gt;</source>
317 <translation type="unfinished"></translation>
318 </message>
319 <message>
320 <source>Forced suspend</source>
321 <translation type="unfinished"></translation>
322 </message>
323</context>
324</TS>
diff --git a/core/launcher/qpe-en_GB.ts b/core/launcher/qpe-en_GB.ts
new file mode 100644
index 0000000..03d1db4
--- a/dev/null
+++ b/core/launcher/qpe-en_GB.ts
@@ -0,0 +1,324 @@
1<!DOCTYPE TS><TS>
2<context>
3 <name>@default</name>
4 <message>
5 <source>Language</source>
6 <translation type="unfinished"></translation>
7 </message>
8 <message>
9 <source>Time and Date</source>
10 <translation type="unfinished"></translation>
11 </message>
12 <message>
13 <source>Personal Information</source>
14 <translation type="unfinished"></translation>
15 </message>
16</context>
17<context>
18 <name>AppLauncher</name>
19 <message>
20 <source>&lt;qt&gt;&lt;p&gt;Fast loading has been disabled for this application. Tap and hold the application icon to reenable it.&lt;/qt&gt;</source>
21 <translation type="unfinished"></translation>
22 </message>
23 <message>
24 <source>Application terminated</source>
25 <translation type="unfinished"></translation>
26 </message>
27 <message>
28 <source>Application not found</source>
29 <translation type="unfinished"></translation>
30 </message>
31 <message>
32 <source>&lt;qt&gt;Could not locate application &lt;b&gt;%1&lt;/b&gt;&lt;/qt&gt;</source>
33 <translation type="unfinished"></translation>
34 </message>
35 <message>
36 <source>Error</source>
37 <translation type="unfinished"></translation>
38 </message>
39 <message>
40 <source>Could not find the application %1</source>
41 <translation type="unfinished"></translation>
42 </message>
43 <message>
44 <source>OK</source>
45 <translation type="unfinished"></translation>
46 </message>
47 <message>
48 <source>&lt;qt&gt;&lt;b&gt;%1&lt;/b&gt; was terminated due to signal code %2&lt;/qt&gt;</source>
49 <translation type="unfinished"></translation>
50 </message>
51</context>
52<context>
53 <name>AppMonitor</name>
54 <message>
55 <source>Application Problem</source>
56 <translation type="unfinished"></translation>
57 </message>
58 <message>
59 <source>&lt;p&gt;%1 is not responding.&lt;/p&gt;</source>
60 <translation type="unfinished"></translation>
61 </message>
62 <message>
63 <source>&lt;p&gt;Would you like to force the application to exit?&lt;/p&gt;</source>
64 <translation type="unfinished"></translation>
65 </message>
66</context>
67<context>
68 <name>CategoryTabWidget</name>
69 <message>
70 <source>Documents</source>
71 <translation type="unfinished"></translation>
72 </message>
73 <message>
74 <source>Icon View</source>
75 <translation type="unfinished"></translation>
76 </message>
77 <message>
78 <source>List View</source>
79 <translation type="unfinished"></translation>
80 </message>
81</context>
82<context>
83 <name>Desktop</name>
84 <message>
85 <source>Memory Status</source>
86 <translation type="unfinished"></translation>
87 </message>
88 <message>
89 <source>Memory Low
90Please save data.</source>
91 <translation type="unfinished"></translation>
92 </message>
93 <message>
94 <source>Critical Memory Shortage
95Please end this application
96immediately.</source>
97 <translation type="unfinished"></translation>
98 </message>
99</context>
100<context>
101 <name>DesktopApplication</name>
102 <message>
103 <source>Battery is running very low.</source>
104 <translation type="unfinished"></translation>
105 </message>
106 <message>
107 <source>The Back-up battery is very low.
108Please charge the back-up battery.</source>
109 <translation type="unfinished"></translation>
110 </message>
111 <message>
112 <source>Safe Mode</source>
113 <translation type="unfinished"></translation>
114 </message>
115 <message>
116 <source>&lt;P&gt;A system startup error occurred, and the system is now in Safe Mode. Plugins are not loaded in Safe Mode. You can use the Plugin Manager to disable plugins that cause system error.</source>
117 <translation type="unfinished"></translation>
118 </message>
119 <message>
120 <source>OK</source>
121 <translation type="unfinished"></translation>
122 </message>
123 <message>
124 <source>Plugin Manager...</source>
125 <translation type="unfinished"></translation>
126 </message>
127 <message>
128 <source>Battery level is critical!
129Please recharge the main battery!</source>
130 <translation type="unfinished"></translation>
131 </message>
132</context>
133<context>
134 <name>DesktopPowerAlerter</name>
135 <message>
136 <source>Battery Status</source>
137 <translation type="unfinished"></translation>
138 </message>
139 <message>
140 <source>Low Battery</source>
141 <translation type="unfinished"></translation>
142 </message>
143</context>
144<context>
145 <name>FirstUse</name>
146 <message>
147 <source>&lt;&lt; Back</source>
148 <translation type="unfinished"></translation>
149 </message>
150 <message>
151 <source>Next &gt;&gt;</source>
152 <translation type="unfinished"></translation>
153 </message>
154 <message>
155 <source>Tap anywhere on the screen to continue.</source>
156 <translation type="unfinished"></translation>
157 </message>
158 <message>
159 <source>Please wait, loading %1 settings.</source>
160 <translation type="unfinished"></translation>
161 </message>
162 <message>
163 <source>Please wait...</source>
164 <translation type="unfinished"></translation>
165 </message>
166 <message>
167 <source>FirstUseBackground</source>
168 <translation type="unfinished"></translation>
169 </message>
170 <message>
171 <source>Finish</source>
172 <translation type="unfinished"></translation>
173 </message>
174</context>
175<context>
176 <name>InputMethods</name>
177 <message>
178 <source>Unicode</source>
179 <translation type="unfinished"></translation>
180 </message>
181</context>
182<context>
183 <name>Launcher</name>
184 <message>
185 <source>Launcher</source>
186 <translation type="unfinished"></translation>
187 </message>
188 <message>
189 <source> - Launcher</source>
190 <translation type="unfinished"></translation>
191 </message>
192 <message>
193 <source>No application</source>
194 <translation type="unfinished"></translation>
195 </message>
196 <message>
197 <source>&lt;p&gt;No application is defined for this document.&lt;p&gt;Type is %1.</source>
198 <translation type="unfinished"></translation>
199 </message>
200 <message>
201 <source>OK</source>
202 <translation type="unfinished"></translation>
203 </message>
204 <message>
205 <source>View as text</source>
206 <translation type="unfinished"></translation>
207 </message>
208 <message>
209 <source>Finding documents...</source>
210 <translation type="unfinished"></translation>
211 </message>
212</context>
213<context>
214 <name>LauncherView</name>
215 <message>
216 <source>All types</source>
217 <translation type="unfinished"></translation>
218 </message>
219 <message>
220 <source>Document View</source>
221 <translation type="unfinished"></translation>
222 </message>
223</context>
224<context>
225 <name>SafeMode</name>
226 <message>
227 <source>Safe Mode</source>
228 <translation type="unfinished"></translation>
229 </message>
230 <message>
231 <source>Plugin Manager...</source>
232 <translation type="unfinished"></translation>
233 </message>
234 <message>
235 <source>Restart Qtopia</source>
236 <translation type="unfinished"></translation>
237 </message>
238 <message>
239 <source>Help...</source>
240 <translation type="unfinished"></translation>
241 </message>
242</context>
243<context>
244 <name>Shutdown</name>
245 <message>
246 <source>Shut down...</source>
247 <translation type="unfinished"></translation>
248 </message>
249 <message>
250 <source>Terminate</source>
251 <translation type="unfinished"></translation>
252 </message>
253 <message>
254 <source>Terminate Server</source>
255 <translation type="unfinished"></translation>
256 </message>
257 <message>
258 <source>Reboot</source>
259 <translation type="unfinished"></translation>
260 </message>
261 <message>
262 <source>Restart Server</source>
263 <translation type="unfinished"></translation>
264 </message>
265 <message>
266 <source>Shutdown</source>
267 <translation type="unfinished"></translation>
268 </message>
269 <message>
270 <source>&lt;p&gt;
271These termination options are provided primarily for use while developing and testing the Qtopia system. In a normal environment, these concepts are unnecessary.</source>
272 <translation type="unfinished"></translation>
273 </message>
274 <message>
275 <source>Cancel</source>
276 <translation type="unfinished"></translation>
277 </message>
278</context>
279<context>
280 <name>SyncAuthentication</name>
281 <message>
282 <source>Sync Connection</source>
283 <translation type="unfinished"></translation>
284 </message>
285 <message>
286 <source>&lt;p&gt;An unauthorized system is requesting access to this device.&lt;p&gt;If you are using a version of Qtopia Desktop older than 1.5.1, please upgrade.</source>
287 <translation type="unfinished"></translation>
288 </message>
289 <message>
290 <source>Deny</source>
291 <translation type="unfinished"></translation>
292 </message>
293 <message>
294 <source>&lt;p&gt;An unrecognized system is requesting access to this device.&lt;p&gt;If you have just initiated a Sync for the first time, this is normal.</source>
295 <translation type="unfinished"></translation>
296 </message>
297 <message>
298 <source>Allow</source>
299 <translation type="unfinished"></translation>
300 </message>
301</context>
302<context>
303 <name>SyncDialog</name>
304 <message>
305 <source>Abort</source>
306 <translation type="unfinished"></translation>
307 </message>
308 <message>
309 <source>Syncing:</source>
310 <translation type="unfinished"></translation>
311 </message>
312</context>
313<context>
314 <name>TempScreenSaverMonitor</name>
315 <message>
316 <source>&lt;qt&gt;The running applications disabled the screen saver for more than the allowed time (%1).&lt;p&gt;The system was forced to suspend&lt;/p&gt;&lt;/qt&gt;</source>
317 <translation type="unfinished"></translation>
318 </message>
319 <message>
320 <source>Forced suspend</source>
321 <translation type="unfinished"></translation>
322 </message>
323</context>
324</TS>
diff --git a/core/launcher/qpe-ja.ts b/core/launcher/qpe-ja.ts
new file mode 100644
index 0000000..9f39f75
--- a/dev/null
+++ b/core/launcher/qpe-ja.ts
@@ -0,0 +1,352 @@
1<!DOCTYPE TS><TS>
2<context>
3 <name>@default</name>
4 <message>
5 <source>Language</source>
6 <translation>言語</translation>
7 </message>
8 <message>
9 <source>Time and Date</source>
10 <translation>時刻と日付</translation>
11 </message>
12 <message>
13 <source>Personal Information</source>
14 <translation>個人情報</translation>
15 </message>
16 <message>
17 <source>Security</source>
18 <translation type="obsolete">セキュリティ</translation>
19 </message>
20</context>
21<context>
22 <name>AppLauncher</name>
23 <message>
24 <source>&lt;qt&gt;&lt;p&gt;Fast loading has been disabled for this application. Tap and hold the application icon to reenable it.&lt;/qt&gt;</source>
25 <translation>&lt;qt&gt;&lt;p&gt;このアプリケーションは高速ロードが無効になっています。アプリケーションアイコンをしばらくタップしたままにして有効に設定し直します。&lt;/qt&gt;</translation>
26 </message>
27 <message>
28 <source>Application terminated</source>
29 <translation>アプリケーションは終了しました</translation>
30 </message>
31 <message>
32 <source>Application not found</source>
33 <translation>アプリケーションが見つかりません</translation>
34 </message>
35 <message>
36 <source>&lt;qt&gt;Could not locate application &lt;b&gt;%1&lt;/b&gt;&lt;/qt&gt;</source>
37 <translation>&lt;qt&gt;&lt;b&gt;%1&lt;/b&gt;のアプリケーションを検出できませんでした&lt;/qt&gt;</translation>
38 </message>
39 <message>
40 <source>Error</source>
41 <translation>エラー</translation>
42 </message>
43 <message>
44 <source>Could not find the application %1</source>
45 <translation>%1のアプリケーションが見つかりませんでした</translation>
46 </message>
47 <message>
48 <source>OK</source>
49 <translation>OK</translation>
50 </message>
51 <message>
52 <source>&lt;qt&gt;&lt;b&gt;%1&lt;/b&gt; was terminated due to signal code %2&lt;/qt&gt;</source>
53 <translation>&lt;qt&gt;シグナルコード%2のため&lt;b&gt;%1&lt;/b&gt;は終了しました&lt;/qt&gt;</translation>
54 </message>
55</context>
56<context>
57 <name>AppMonitor</name>
58 <message>
59 <source>Application Problem</source>
60 <translation>アプリケーションに関する問題</translation>
61 </message>
62 <message>
63 <source>&lt;p&gt;%1 is not responding.&lt;/p&gt;</source>
64 <translation>&lt;p&gt;%1が応答していません。&lt;/p&gt;</translation>
65 </message>
66 <message>
67 <source>&lt;p&gt;Would you like to force the application to exit?&lt;/p&gt;</source>
68 <translation>&lt;p&gt;アプリケーションを強制終了しますか?&lt;/p&gt;</translation>
69 </message>
70</context>
71<context>
72 <name>CategoryTabWidget</name>
73 <message>
74 <source>Documents</source>
75 <translation>ドキュメント</translation>
76 </message>
77 <message>
78 <source>Icon View</source>
79 <translation>アイコン表示</translation>
80 </message>
81 <message>
82 <source>List View</source>
83 <translation>一覧表示</translation>
84 </message>
85</context>
86<context>
87 <name>Desktop</name>
88 <message>
89 <source>Memory Status</source>
90 <translation>メモリーの状態</translation>
91 </message>
92 <message>
93 <source>Memory Low
94Please save data.</source>
95 <translation>メモリ残量が低
96データを保存してください。</translation>
97 </message>
98 <message>
99 <source>Critical Memory Shortage
100Please end this application
101immediately.</source>
102 <translation>メモリ残量がありません
103直ちにこのアプリケーションを
104終了してください。</translation>
105 </message>
106</context>
107<context>
108 <name>DesktopApplication</name>
109 <message>
110 <source>Battery is running very low.</source>
111 <translation>バッテリーの残量が少なくなっています。</translation>
112 </message>
113 <message>
114 <source>Battery level is critical!
115Keep power off until power restored!</source>
116 <translation type="obsolete">バッテリー残量がありません!
117電力が回復するまで電源を切っておいてください!</translation>
118 </message>
119 <message>
120 <source>The Back-up battery is very low.
121Please charge the back-up battery.</source>
122 <translation>バックアップのバッテリー残量が少なくなっています。
123バックアップのバッテリーを充電してください。</translation>
124 </message>
125 <message>
126 <source>Safe Mode</source>
127 <translation>セーフモード</translation>
128 </message>
129 <message>
130 <source>&lt;P&gt;A system startup error occurred, and the system is now in Safe Mode. Plugins are not loaded in Safe Mode. You can use the Plugin Manager to disable plugins that cause system error.</source>
131 <translation>&lt;P&gt;システムスタートアップのエラーが発生したため、システムは現在セーフモードです。セーフモードではプラグインはロードされません。プラグインマネージャを使用してシステムエラーの要因となるブラグインを無効にすることができます。</translation>
132 </message>
133 <message>
134 <source>OK</source>
135 <translation>OK</translation>
136 </message>
137 <message>
138 <source>Plugin Manager...</source>
139 <translation>プラグインマネージャ...</translation>
140 </message>
141 <message>
142 <source>Battery level is critical!
143Please recharge the main battery!</source>
144 <translation type="unfinished">バッテリー残量がありません!
145電力が回復するまで電源を切っておいてください!</translation>
146 </message>
147</context>
148<context>
149 <name>DesktopPowerAlerter</name>
150 <message>
151 <source>Battery Status</source>
152 <translation>バッテリーの状態</translation>
153 </message>
154 <message>
155 <source>Low Battery</source>
156 <translation>バッテリー残量が低</translation>
157 </message>
158</context>
159<context>
160 <name>FirstUse</name>
161 <message>
162 <source>&lt;&lt; Back</source>
163 <translation>&lt;&lt; 戻る</translation>
164 </message>
165 <message>
166 <source>Next &gt;&gt;</source>
167 <translation>進む &gt;&gt;</translation>
168 </message>
169 <message>
170 <source>Tap anywhere on the screen to continue.</source>
171 <translation>どこかスクリーンをタップして続ける</translation>
172 </message>
173 <message>
174 <source>Please wait, loading %1 settings.</source>
175 <translation>%1の設定をロード中、お待ちください。</translation>
176 </message>
177 <message>
178 <source>Please wait...</source>
179 <translation>お待ちください...</translation>
180 </message>
181 <message>
182 <source>FirstUseBackground</source>
183 <translation>初めて使う背景</translation>
184 </message>
185 <message>
186 <source>Finish</source>
187 <translation>完了</translation>
188 </message>
189</context>
190<context>
191 <name>InputMethods</name>
192 <message>
193 <source>Unicode</source>
194 <translation>ユニコード</translation>
195 </message>
196</context>
197<context>
198 <name>Launcher</name>
199 <message>
200 <source>Launcher</source>
201 <translation>ランチャー</translation>
202 </message>
203 <message>
204 <source> - Launcher</source>
205 <translation>- ランチャー</translation>
206 </message>
207 <message>
208 <source>No application</source>
209 <translation>アプリケーションがありません</translation>
210 </message>
211 <message>
212 <source>&lt;p&gt;No application is defined for this document.&lt;p&gt;Type is %1.</source>
213 <translation>&lt;p&gt;このドキュメント用にアプリケーションが決められていません。&lt;p&gt;タイプは%1です。</translation>
214 </message>
215 <message>
216 <source>OK</source>
217 <translation>OK</translation>
218 </message>
219 <message>
220 <source>View as text</source>
221 <translation>テキストとして表示</translation>
222 </message>
223 <message>
224 <source>Finding documents...</source>
225 <translation>ドキュメントの検索中...</translation>
226 </message>
227</context>
228<context>
229 <name>LauncherView</name>
230 <message>
231 <source>All types</source>
232 <translation>すべてのタイプ</translation>
233 </message>
234 <message>
235 <source>Document View</source>
236 <translation>ドキュメント表示</translation>
237 </message>
238</context>
239<context>
240 <name>SafeMode</name>
241 <message>
242 <source>Safe Mode</source>
243 <translation>セーフモード</translation>
244 </message>
245 <message>
246 <source>Plugin Manager...</source>
247 <translation>プラグインマネージャ...</translation>
248 </message>
249 <message>
250 <source>Restart Qtopia</source>
251 <translation>Qtopiaを再スタート</translation>
252 </message>
253 <message>
254 <source>Help...</source>
255 <translation>ヘルプ...</translation>
256 </message>
257</context>
258<context>
259 <name>Shutdown</name>
260 <message>
261 <source>Shut down...</source>
262 <translation>シャットダウン...</translation>
263 </message>
264 <message>
265 <source>Terminate</source>
266 <translation>終了</translation>
267 </message>
268 <message>
269 <source>Terminate Server</source>
270 <translation>サーバーを終了</translation>
271 </message>
272 <message>
273 <source>Reboot</source>
274 <translation>再起動</translation>
275 </message>
276 <message>
277 <source>Restart Server</source>
278 <translation>サーバーの再スタート</translation>
279 </message>
280 <message>
281 <source>Shutdown</source>
282 <translation>シャットダウン</translation>
283 </message>
284 <message>
285 <source>&lt;p&gt;
286These termination options are provided primarily for use while developing and testing the Qtopia system. In a normal environment, these concepts are unnecessary.</source>
287 <translation>&lt;p&gt;
288これらの終了オプションは、主としてQtopiaシステムのテスト中及び開発中に使用するため提供されています。通常の環境では、これらのコンセプトは不要です。</translation>
289 </message>
290 <message>
291 <source>Cancel</source>
292 <translation>取り消し</translation>
293 </message>
294</context>
295<context>
296 <name>SyncAuthentication</name>
297 <message>
298 <source>Sync Connection</source>
299 <translation>同期接続</translation>
300 </message>
301 <message>
302 <source>&lt;p&gt;An unauthorized system is requesting access to this device.&lt;p&gt;If you are using a version of Qtopia Desktop older than 1.5.1, please upgrade.</source>
303 <translation>&lt;p&gt;無許可のシステムがこのデバイスにアクセスを要請しています。&lt;p&gt;1.5.1より古いバージョンのQtopia Desktopをご使用の場合にはアップグレードを行なってください。</translation>
304 </message>
305 <message>
306 <source>Deny</source>
307 <translation>拒否</translation>
308 </message>
309 <message>
310 <source>&lt;p&gt;An unrecognized system is requesting access to this device.&lt;p&gt;If you have just initiated a Sync for the first time, this is normal.</source>
311 <translation>&lt;p&gt;未認可のシステムがこのデバイスにアクセスを要請しています。&lt;p&gt;はじめての同期を開始したばかりの場合には、これが標準です。</translation>
312 </message>
313 <message>
314 <source>Allow</source>
315 <translation>許可</translation>
316 </message>
317</context>
318<context>
319 <name>SyncDialog</name>
320 <message>
321 <source>Syncing</source>
322 <translation type="obsolete">同期中</translation>
323 </message>
324 <message>
325 <source>&lt;b&gt;Contacts&lt;/b&gt;</source>
326 <translation type="obsolete">&lt;b&gt;連絡先&lt;/b&gt;</translation>
327 </message>
328 <message>
329 <source>&amp;Cancel</source>
330 <translation type="obsolete">(&amp;C)取り消し</translation>
331 </message>
332 <message>
333 <source>Abort</source>
334 <translation>中断</translation>
335 </message>
336 <message>
337 <source>Syncing:</source>
338 <translation>同期中:</translation>
339 </message>
340</context>
341<context>
342 <name>TempScreenSaverMonitor</name>
343 <message>
344 <source>&lt;qt&gt;The running applications disabled the screen saver for more than the allowed time (%1).&lt;p&gt;The system was forced to suspend&lt;/p&gt;&lt;/qt&gt;</source>
345 <translation>&lt;qt&gt;実行中のアプリケーションが許可時間を越えてスクリーンセーバーを無効にしました(%1)。&lt;p&gt;システムは強制的に停止になりました。&lt;/p&gt;&lt;/qt&gt;</translation>
346 </message>
347 <message>
348 <source>Forced suspend</source>
349 <translation>強制停止</translation>
350 </message>
351</context>
352</TS>
diff --git a/core/launcher/qpe-no.ts b/core/launcher/qpe-no.ts
new file mode 100644
index 0000000..d02ff7f
--- a/dev/null
+++ b/core/launcher/qpe-no.ts
@@ -0,0 +1,329 @@
1<!DOCTYPE TS><TS>
2<context>
3 <name>@default</name>
4 <message>
5 <source>Language</source>
6 <translation type="unfinished">Språk</translation>
7 </message>
8 <message>
9 <source>Time and Date</source>
10 <translation type="unfinished">Tid og dato</translation>
11 </message>
12 <message>
13 <source>Personal Information</source>
14 <translation type="unfinished">Personlig informasjon</translation>
15 </message>
16</context>
17<context>
18 <name>AppLauncher</name>
19 <message>
20 <source>&lt;qt&gt;&lt;p&gt;Fast loading has been disabled for this application. Tap and hold the application icon to reenable it.&lt;/qt&gt;</source>
21 <translation type="unfinished">&lt;qt&gt;&lt;p&gt;Rask innlasting har blitt deaktivert for denne applikasjone. Trykk og hold på applikasjonsikonet for å reaktivere den.&lt;/qt&gt;</translation>
22 </message>
23 <message>
24 <source>Application terminated</source>
25 <translation type="unfinished">Applikasjonen avsluttet</translation>
26 </message>
27 <message>
28 <source>Application not found</source>
29 <translation type="unfinished">Applikasjonen ble ikke funnet</translation>
30 </message>
31 <message>
32 <source>&lt;qt&gt;Could not locate application &lt;b&gt;%1&lt;/b&gt;&lt;/qt&gt;</source>
33 <translation type="unfinished">&lt;qt&gt;Kunne ikke lokalisere applikasjonen &lt;b&gt;%1&lt;/b&gt;&lt;/qt&gt;</translation>
34 </message>
35 <message>
36 <source>Error</source>
37 <translation type="unfinished">Feil</translation>
38 </message>
39 <message>
40 <source>Could not find the application %1</source>
41 <translation type="unfinished">Kunne ikke finne applikasjonen %1</translation>
42 </message>
43 <message>
44 <source>OK</source>
45 <translation type="unfinished">OK</translation>
46 </message>
47 <message>
48 <source>&lt;qt&gt;&lt;b&gt;%1&lt;/b&gt; was terminated due to signal code %2&lt;/qt&gt;</source>
49 <translation type="unfinished">&lt;qt&gt;&lt;b&gt;%1&lt;/b&gt;ble avsluttet grunnet signal kode %2&lt;/qt&gt;</translation>
50 </message>
51</context>
52<context>
53 <name>AppMonitor</name>
54 <message>
55 <source>Application Problem</source>
56 <translation type="unfinished">Applikasjons problem</translation>
57 </message>
58 <message>
59 <source>&lt;p&gt;%1 is not responding.&lt;/p&gt;</source>
60 <translation type="unfinished">&lt;p&gt;%1 svarer ikke.&lt;/p&gt;</translation>
61 </message>
62 <message>
63 <source>&lt;p&gt;Would you like to force the application to exit?&lt;/p&gt;</source>
64 <translation type="unfinished">&lt;p&gt;Vil du tvinge applikasjonen til å avslutte?&lt;/p&gt;</translation>
65 </message>
66</context>
67<context>
68 <name>CategoryTabWidget</name>
69 <message>
70 <source>Documents</source>
71 <translation type="unfinished">Dokumenter</translation>
72 </message>
73 <message>
74 <source>Icon View</source>
75 <translation type="unfinished">Ikon visning</translation>
76 </message>
77 <message>
78 <source>List View</source>
79 <translation type="unfinished">Liste visning</translation>
80 </message>
81</context>
82<context>
83 <name>Desktop</name>
84 <message>
85 <source>Memory Status</source>
86 <translation type="unfinished">Minne status</translation>
87 </message>
88 <message>
89 <source>Memory Low
90Please save data.</source>
91 <translation type="unfinished">Lavt minne, vennligst lagre infomasjon.</translation>
92 </message>
93 <message>
94 <source>Critical Memory Shortage
95Please end this application
96immediately.</source>
97 <translation type="unfinished">Kritisk lavt minne
98Vennligst avslutt applikasjonen
99øyeblikkelig.</translation>
100 </message>
101</context>
102<context>
103 <name>DesktopApplication</name>
104 <message>
105 <source>Battery is running very low.</source>
106 <translation type="unfinished">Lite batteri igjen.</translation>
107 </message>
108 <message>
109 <source>The Back-up battery is very low.
110Please charge the back-up battery.</source>
111 <translation type="unfinished">Backup batteriet er meget lavt.
112Vennligst lad opp backup batteriet.</translation>
113 </message>
114 <message>
115 <source>Safe Mode</source>
116 <translation type="unfinished">Sikkerhetsmodus</translation>
117 </message>
118 <message>
119 <source>&lt;P&gt;A system startup error occurred, and the system is now in Safe Mode. Plugins are not loaded in Safe Mode. You can use the Plugin Manager to disable plugins that cause system error.</source>
120 <translation type="unfinished">&lt;P&gt;Det oppstod en startoppfeil på systemet, og systemet kjører derfor i sikkerhetsmodus. Plugins er ikke lastet i sikkerhetsmodus. Du kan bruke Plugin Manager for å slå av de plugins som forårsaker system feilen.</translation>
121 </message>
122 <message>
123 <source>OK</source>
124 <translation type="unfinished">OK</translation>
125 </message>
126 <message>
127 <source>Plugin Manager...</source>
128 <translation type="unfinished">Plugin Manager...</translation>
129 </message>
130 <message>
131 <source>Battery level is critical!
132Please recharge the main battery!</source>
133 <translation type="unfinished">Batteri nivå er kritisk lavt!
134Vennligst lad opp ditt hoved batteri!</translation>
135 </message>
136</context>
137<context>
138 <name>DesktopPowerAlerter</name>
139 <message>
140 <source>Battery Status</source>
141 <translation type="unfinished">Batteri status</translation>
142 </message>
143 <message>
144 <source>Low Battery</source>
145 <translation type="unfinished">Lavt batteri</translation>
146 </message>
147</context>
148<context>
149 <name>FirstUse</name>
150 <message>
151 <source>&lt;&lt; Back</source>
152 <translation type="unfinished">&lt;&lt; Tilbake</translation>
153 </message>
154 <message>
155 <source>Next &gt;&gt;</source>
156 <translation type="unfinished">Neste &gt;&gt;</translation>
157 </message>
158 <message>
159 <source>Tap anywhere on the screen to continue.</source>
160 <translation type="unfinished">Trykk hvor som helst på skjermen for å fortsette.</translation>
161 </message>
162 <message>
163 <source>Please wait, loading %1 settings.</source>
164 <translation type="unfinished">Vennligst vent, laster %1 innstillinger.</translation>
165 </message>
166 <message>
167 <source>Please wait...</source>
168 <translation type="unfinished">Vennligst vent...</translation>
169 </message>
170 <message>
171 <source>FirstUseBackground</source>
172 <translation type="unfinished">FirstUseBackground</translation>
173 </message>
174 <message>
175 <source>Finish</source>
176 <translation type="unfinished">Avslutt</translation>
177 </message>
178</context>
179<context>
180 <name>InputMethods</name>
181 <message>
182 <source>Unicode</source>
183 <translation type="unfinished">Unicode</translation>
184 </message>
185</context>
186<context>
187 <name>Launcher</name>
188 <message>
189 <source>Launcher</source>
190 <translation type="unfinished">Launcher</translation>
191 </message>
192 <message>
193 <source> - Launcher</source>
194 <translation type="unfinished">- Launcher</translation>
195 </message>
196 <message>
197 <source>No application</source>
198 <translation type="unfinished">Ingen applikasjoner</translation>
199 </message>
200 <message>
201 <source>&lt;p&gt;No application is defined for this document.&lt;p&gt;Type is %1.</source>
202 <translation type="unfinished">&lt;p&gt;Ingen applikasjoner er definert for dette dokumentet.&lt;p&gt;Type er %1.</translation>
203 </message>
204 <message>
205 <source>OK</source>
206 <translation type="unfinished">OK</translation>
207 </message>
208 <message>
209 <source>View as text</source>
210 <translation type="unfinished">Vis som tekst</translation>
211 </message>
212 <message>
213 <source>Finding documents...</source>
214 <translation type="unfinished">Finner dokumenter...</translation>
215 </message>
216</context>
217<context>
218 <name>LauncherView</name>
219 <message>
220 <source>All types</source>
221 <translation type="unfinished">Alle typer</translation>
222 </message>
223 <message>
224 <source>Document View</source>
225 <translation type="unfinished">Dokument visning</translation>
226 </message>
227</context>
228<context>
229 <name>SafeMode</name>
230 <message>
231 <source>Safe Mode</source>
232 <translation type="unfinished">Sikkerhetsmodus</translation>
233 </message>
234 <message>
235 <source>Plugin Manager...</source>
236 <translation type="unfinished">Plugin Manager...</translation>
237 </message>
238 <message>
239 <source>Restart Qtopia</source>
240 <translation type="unfinished">Restart Qtopia</translation>
241 </message>
242 <message>
243 <source>Help...</source>
244 <translation type="unfinished">Hjelp...</translation>
245 </message>
246</context>
247<context>
248 <name>Shutdown</name>
249 <message>
250 <source>Shut down...</source>
251 <translation type="unfinished">Steng av...</translation>
252 </message>
253 <message>
254 <source>Terminate</source>
255 <translation type="unfinished">Tvangsavslutt</translation>
256 </message>
257 <message>
258 <source>Terminate Server</source>
259 <translation type="unfinished">Tvangsavslutt tjener</translation>
260 </message>
261 <message>
262 <source>Reboot</source>
263 <translation type="unfinished">Omstart</translation>
264 </message>
265 <message>
266 <source>Restart Server</source>
267 <translation type="unfinished">Restart tjener</translation>
268 </message>
269 <message>
270 <source>Shutdown</source>
271 <translation type="unfinished">Steng av</translation>
272 </message>
273 <message>
274 <source>&lt;p&gt;
275These termination options are provided primarily for use while developing and testing the Qtopia system. In a normal environment, these concepts are unnecessary.</source>
276 <translation type="unfinished">&lt;p&gt;
277Disse avslutningsvalgene er i hovedsak tenkt for dem som utvikler og tester Qtopia systemet. Til normal bruk, er disse valgene unødvendige.</translation>
278 </message>
279 <message>
280 <source>Cancel</source>
281 <translation type="unfinished">Avbryt</translation>
282 </message>
283</context>
284<context>
285 <name>SyncAuthentication</name>
286 <message>
287 <source>Sync Connection</source>
288 <translation type="unfinished">Synkroniser forbindelse</translation>
289 </message>
290 <message>
291 <source>&lt;p&gt;An unauthorized system is requesting access to this device.&lt;p&gt;If you are using a version of Qtopia Desktop older than 1.5.1, please upgrade.</source>
292 <translation type="unfinished">&lt;p&gt;Et uautorisert system ber om tilgang til enheten.&lt;p&gt;Dersom du bruker en versjon av Qtopia Desktop eldre enn 1.5.1, vennligst oppgrader.</translation>
293 </message>
294 <message>
295 <source>Deny</source>
296 <translation type="unfinished">Nekt</translation>
297 </message>
298 <message>
299 <source>&lt;p&gt;An unrecognized system is requesting access to this device.&lt;p&gt;If you have just initiated a Sync for the first time, this is normal.</source>
300 <translation type="unfinished">Et uautorisert system ber om tilgang til denne enheten.&lt;p&gt;Dersom du nettopp har initiert en synkronisering for første gang, er dette normalt.</translation>
301 </message>
302 <message>
303 <source>Allow</source>
304 <translation type="unfinished">Tillatt</translation>
305 </message>
306</context>
307<context>
308 <name>SyncDialog</name>
309 <message>
310 <source>Abort</source>
311 <translation type="unfinished">Avbryt</translation>
312 </message>
313 <message>
314 <source>Syncing:</source>
315 <translation type="unfinished">Synkroniserer:</translation>
316 </message>
317</context>
318<context>
319 <name>TempScreenSaverMonitor</name>
320 <message>
321 <source>&lt;qt&gt;The running applications disabled the screen saver for more than the allowed time (%1).&lt;p&gt;The system was forced to suspend&lt;/p&gt;&lt;/qt&gt;</source>
322 <translation type="unfinished">&lt;qt&gt;De kjørende applikasjoner har slått av screensaveren for mer enn tillatt tid (%1).&lt;p&gt;Systemet var tvunget til hvilemodus&lt;/p&gt;&lt;/qt&gt;</translation>
323 </message>
324 <message>
325 <source>Forced suspend</source>
326 <translation type="unfinished">Tvunget hvilemodus</translation>
327 </message>
328</context>
329</TS>
diff --git a/core/launcher/server.cpp b/core/launcher/server.cpp
new file mode 100644
index 0000000..08baa8e
--- a/dev/null
+++ b/core/launcher/server.cpp
@@ -0,0 +1,657 @@
1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3**
4** This file is part of the 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 "server.h"
22#include "serverapp.h"
23#include "launcher.h"
24#include "startmenu.h"
25#include "transferserver.h"
26#include "qcopbridge.h"
27#include "irserver.h"
28#include "packageslave.h"
29#include "calibrate.h"
30#include "qrsync.h"
31#include "syncdialog.h"
32#include "launcher.h"
33#include "shutdownimpl.h"
34#include "applauncher.h"
35#include "suspendmonitor.h"
36#include "documentlist.h"
37
38#include <qtopia/applnk.h>
39#include <qtopia/categories.h>
40#include <qtopia/mimetype.h>
41#include <qtopia/config.h>
42#include <qtopia/services.h>
43#include <qtopia/devicebuttonmanager.h>
44#include <qtopia/pluginloader.h>
45#include <qtopia/resource.h>
46#include <qtopia/version.h>
47#include <qtopia/storage.h>
48
49#ifdef Q_WS_QWS
50#include <qtopia/qcopenvelope_qws.h>
51#include <qwindowsystem_qws.h>
52#include <qgfx_qws.h>
53#endif
54#include <qtopia/global.h>
55#include <qtopia/custom.h>
56
57#ifdef Q_OS_WIN32
58#include <io.h>
59#include <process.h>
60#else
61#include <unistd.h>
62#endif
63#include <qmainwindow.h>
64#include <qmessagebox.h>
65#include <qtimer.h>
66#include <qtextstream.h>
67
68#include <stdlib.h>
69
70extern QRect qt_maxWindowRect;
71
72static QWidget *calibrate(bool)
73{
74#ifdef Q_WS_QWS
75 Calibrate *c = new Calibrate;
76 c->show();
77 return c;
78#else
79 return 0;
80#endif
81}
82
83#define FACTORY(T) \
84 static QWidget *new##T( bool maximized ) { \
85 QWidget *w = new T( 0, 0, QWidget::WDestructiveClose | QWidget::WGroupLeader ); \
86 if ( maximized ) { \
87 if ( qApp->desktop()->width() <= 350 ) { \
88 w->showMaximized(); \
89 } else { \
90 w->resize( QSize( 300, 300 ) ); \
91 } \
92 } \
93 w->show(); \
94 return w; \
95 }
96
97
98#ifdef SINGLE_APP
99#define APP(a,b,c,d) FACTORY(b)
100#include "apps.h"
101#undef APP
102#endif // SINGLE_APP
103
104static Global::Command builtins[] = {
105
106#ifdef SINGLE_APP
107#define APP(a,b,c,d) { a, new##b, c, d },
108#include "apps.h"
109#undef APP
110#endif
111
112#if defined(QPE_NEED_CALIBRATION)
113 { "calibrate", calibrate,1, 0 }, // No tr
114#endif
115#if !defined(QT_QWS_CASSIOPEIA)
116 { "shutdown", Global::shutdown, 1, 0 }, // No tr
117 // { "run", run, 1, 0 }, // No tr
118#endif
119
120 { 0, calibrate,0, 0 },
121};
122
123
124//---------------------------------------------------------------------------
125
126
127//===========================================================================
128
129Server::Server() :
130 QWidget( 0, 0, WStyle_Tool | WStyle_Customize ),
131 qcopBridge( 0 ),
132 transferServer( 0 ),
133 packageHandler( 0 ),
134 syncDialog( 0 )
135{
136 Global::setBuiltinCommands(builtins);
137
138 tid_xfer = 0;
139 tid_today = startTimer(3600*2*1000);
140 last_today_show = QDate::currentDate();
141
142 tsmMonitor = new TempScreenSaverMonitor();
143 connect( tsmMonitor, SIGNAL(forceSuspend()), qApp, SIGNAL(power()) );
144
145 serverGui = new Launcher;
146 serverGui->createGUI();
147
148 docList = new DocumentList( serverGui );
149 appLauncher = new AppLauncher(this);
150 connect(appLauncher, SIGNAL(launched(int, const QString &)), this, SLOT(applicationLaunched(int, const QString &)) );
151 connect(appLauncher, SIGNAL(terminated(int, const QString &)), this, SLOT(applicationTerminated(int, const QString &)) );
152 connect(appLauncher, SIGNAL(connected(const QString &)), this, SLOT(applicationConnected(const QString &)) );
153
154 storage = new StorageInfo( this );
155 connect( storage, SIGNAL(disksChanged()), this, SLOT(storageChanged()) );
156
157 // start services
158 startTransferServer();
159 (void) new IrServer( this );
160
161 packageHandler = new PackageHandler( this );
162 connect(qApp, SIGNAL(activate(const DeviceButton*,bool)),this,SLOT(activate(const DeviceButton*,bool)));
163
164 setGeometry( -10, -10, 9, 9 );
165
166 QCopChannel *channel = new QCopChannel("QPE/System", this);
167 connect(channel, SIGNAL(received(const QCString &, const QByteArray &)),
168 this, SLOT(systemMsg(const QCString &, const QByteArray &)) );
169
170 QCopChannel *tbChannel = new QCopChannel( "QPE/TaskBar", this );
171 connect( tbChannel, SIGNAL(received(const QCString&, const QByteArray&)),
172 this, SLOT(receiveTaskBar(const QCString&, const QByteArray&)) );
173
174 connect( qApp, SIGNAL(prepareForRestart()), this, SLOT(terminateServers()) );
175 connect( qApp, SIGNAL(timeChanged()), this, SLOT(pokeTimeMonitors()) );
176
177 preloadApps();
178}
179
180void Server::show()
181{
182 ServerApplication::login(TRUE);
183 QWidget::show();
184}
185
186Server::~Server()
187{
188 serverGui->destroyGUI();
189 delete docList;
190 delete qcopBridge;
191 delete transferServer;
192 delete serverGui;
193 delete tsmMonitor;
194}
195
196static bool hasVisibleWindow(const QString& clientname, bool partial)
197{
198#ifdef QWS
199 const QList<QWSWindow> &list = qwsServer->clientWindows();
200 QWSWindow* w;
201 for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) {
202 if ( w->client()->identity() == clientname ) {
203 if ( partial && !w->isFullyObscured() )
204 return TRUE;
205 if ( !partial && !w->isFullyObscured() && !w->isPartiallyObscured() ) {
206# if QT_VERSION < 0x030000
207 QRect mwr = qt_screen->mapToDevice(qt_maxWindowRect,
208 QSize(qt_screen->width(),qt_screen->height()) );
209# else
210 QRect mwr = qt_maxWindowRect;
211# endif
212 if ( mwr.contains(w->requested().boundingRect()) )
213 return TRUE;
214 }
215 }
216 }
217#endif
218 return FALSE;
219}
220
221void Server::activate(const DeviceButton* button, bool held)
222{
223 Global::terminateBuiltin("calibrate"); // No tr
224 ServiceRequest sr;
225 if ( held ) {
226 sr = button->heldAction();
227 } else {
228 sr = button->pressedAction();
229 }
230 // A button with no action defined, will return a null ServiceRequest. Don't attempt
231 // to send/do anything with this as it will crash
232 if ( !sr.isNull() ) {
233 QString app = sr.app();
234 bool vis = hasVisibleWindow(app, app != "qpe");
235 if ( sr.message() == "raise()" && vis ) {
236 sr.setMessage("nextView()");
237 } else {
238 // "back door"
239 sr << (int)vis;
240 }
241
242 sr.send();
243 }
244}
245
246
247#ifdef Q_WS_QWS
248
249
250typedef struct KeyOverride {
251 ushort scan_code;
252 QWSServer::KeyMap map;
253};
254
255
256static const KeyOverride jp109keys[] = {
257 { 0x03, { Qt::Key_2, '2' , 0x22 , 0xffff } },
258 { 0x07, { Qt::Key_6, '6' , '&' , 0xffff } },
259 { 0x08, { Qt::Key_7, '7' , '\'' , 0xffff } },
260 { 0x09, { Qt::Key_8, '8' , '(' , 0xffff } },
261 { 0x0a, { Qt::Key_9, '9' , ')' , 0xffff } },
262 { 0x0b, { Qt::Key_0, '0' , 0xffff , 0xffff } },
263 { 0x0c, { Qt::Key_Minus, '-' , '=' , 0xffff } },
264 { 0x0d, { Qt::Key_AsciiCircum,'^' , '~' , '^' - 64 } },
265 { 0x1a, { Qt::Key_At, '@' , '`' , 0xffff } },
266 { 0x1b, { Qt::Key_BraceLeft, '[' , '{' , '[' - 64 } },
267 { 0x27, { Qt::Key_Semicolon, ';' , '+' , 0xffff } },
268 { 0x28, { Qt::Key_Colon, ':' , '*' , 0xffff } },
269 { 0x29, { Qt::Key_Zenkaku_Hankaku, 0xffff , 0xffff , 0xffff } },
270 { 0x2b, { Qt::Key_BraceRight, ']' , '}' , ']'-64 } },
271 { 0x70, { Qt::Key_Hiragana_Katakana, 0xffff , 0xffff , 0xffff } },
272 { 0x73, { Qt::Key_Backslash, '\\' , '_' , 0xffff } },
273 { 0x79, { Qt::Key_Henkan, 0xffff , 0xffff , 0xffff } },
274 { 0x7b, { Qt::Key_Muhenkan, 0xffff , 0xffff , 0xffff } },
275 { 0x7d, { Qt::Key_yen, 0x00a5 , '|' , 0xffff } },
276 { 0x00, { 0, 0xffff , 0xffff , 0xffff } }
277};
278
279bool Server::setKeyboardLayout( const QString &kb )
280{
281 //quick demo version that can be extended
282
283 QIntDict<QWSServer::KeyMap> *om = 0;
284 if ( kb == "us101" ) { // No tr
285 om = 0;
286 } else if ( kb == "jp109" ) {
287 om = new QIntDict<QWSServer::KeyMap>(37);
288 const KeyOverride *k = jp109keys;
289 while ( k->scan_code ) {
290 om->insert( k->scan_code, &k->map );
291 k++;
292 }
293 }
294 QWSServer::setOverrideKeys( om );
295
296 return TRUE;
297}
298
299#endif
300
301void Server::systemMsg(const QCString &msg, const QByteArray &data)
302{
303 QDataStream stream( data, IO_ReadOnly );
304
305 if ( msg == "securityChanged()" ) {
306 if ( transferServer )
307 transferServer->authorizeConnections();
308 if ( qcopBridge )
309 qcopBridge->authorizeConnections();
310 } else if ( msg == "setTempScreenSaverMode(int,int)" ) {
311 int mode, pid;
312 stream >> mode >> pid;
313 tsmMonitor->setTempMode(mode, pid);
314 } else if ( msg == "linkChanged(QString)" ) {
315 QString link;
316 stream >> link;
317 qDebug( "desktop.cpp systemMsg -> linkchanged( %s )", link.latin1() );
318 docList->linkChanged(link);
319 } else if ( msg == "serviceChanged(QString)" ) {
320 MimeType::updateApplications();
321 } else if ( msg == "mkdir(QString)" ) {
322 QString dir;
323 stream >> dir;
324 if ( !dir.isEmpty() )
325 mkdir( dir );
326 } else if ( msg == "rdiffGenSig(QString,QString)" ) {
327 QString baseFile, sigFile;
328 stream >> baseFile >> sigFile;
329 QRsync::generateSignature( baseFile, sigFile );
330 } else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) {
331 QString baseFile, sigFile, deltaFile;
332 stream >> baseFile >> sigFile >> deltaFile;
333 QRsync::generateDiff( baseFile, sigFile, deltaFile );
334 } else if ( msg == "rdiffApplyPatch(QString,QString)" ) {
335 QString baseFile, deltaFile;
336 stream >> baseFile >> deltaFile;
337 if ( !QFile::exists( baseFile ) ) {
338 QFile f( baseFile );
339 f.open( IO_WriteOnly );
340 f.close();
341 }
342 QRsync::applyDiff( baseFile, deltaFile );
343#ifndef QT_NO_COP
344 QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" );
345 e << baseFile;
346#endif
347 } else if ( msg == "rdiffCleanup()" ) {
348 mkdir( "/tmp/rdiff" );
349 QDir dir;
350 dir.setPath( "/tmp/rdiff" );
351 QStringList entries = dir.entryList();
352 for ( QStringList::Iterator it = entries.begin(); it != entries.end(); ++it )
353 dir.remove( *it );
354 } else if ( msg == "sendHandshakeInfo()" ) {
355 QString home = getenv( "HOME" );
356#ifndef QT_NO_COP
357 QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" );
358 e << home;
359 int locked = (int) ServerApplication::screenLocked();
360 e << locked;
361#endif
362
363 } else if ( msg == "sendVersionInfo()" ) {
364 QCopEnvelope e( "QPE/Desktop", "versionInfo(QString,QString)" );
365 QString v = QPE_VERSION;
366 e << Global::version() << Global::architecture();
367 } else if ( msg == "sendCardInfo()" ) {
368#ifndef QT_NO_COP
369 QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" );
370#endif
371 storage->update();
372 const QList<FileSystem> &fs = storage->fileSystems();
373 QListIterator<FileSystem> it ( fs );
374 QString s;
375 QString homeDir = getenv("HOME");
376 QString homeFs, homeFsPath;
377 for ( ; it.current(); ++it ) {
378 int k4 = (*it)->blockSize()/256;
379 if ( (*it)->isRemovable() ) {
380 s += (*it)->name() + "=" + (*it)->path() + "/Documents " // No tr
381 + QString::number( (*it)->availBlocks() * k4/4 )
382 + "K " + (*it)->options() + ";";
383 } else if ( homeDir.contains( (*it)->path() ) &&
384 (*it)->path().length() > homeFsPath.length() ) {
385 homeFsPath = (*it)->path();
386 homeFs =
387 (*it)->name() + "=" + homeDir + "/Documents " // No tr
388 + QString::number( (*it)->availBlocks() * k4/4 )
389 + "K " + (*it)->options() + ";";
390 }
391 }
392 if ( !homeFs.isEmpty() )
393 s += homeFs;
394
395#ifndef QT_NO_COP
396 e << s;
397#endif
398 } else if ( msg == "sendSyncDate(QString)" ) {
399 QString app;
400 stream >> app;
401 Config cfg( "qpe" );
402 cfg.setGroup("SyncDate");
403#ifndef QT_NO_COP
404 QCopEnvelope e( "QPE/Desktop", "syncDate(QString,QString)" );
405 e << app << cfg.readEntry( app );
406#endif
407 //qDebug("QPE/System sendSyncDate for %s: response %s", app.latin1(),
408 //cfg.readEntry( app ).latin1() );
409 } else if ( msg == "setSyncDate(QString,QString)" ) {
410 QString app, date;
411 stream >> app >> date;
412 Config cfg( "qpe" );
413 cfg.setGroup("SyncDate");
414 cfg.writeEntry( app, date );
415 //qDebug("setSyncDate(QString,QString) %s %s", app.latin1(), date.latin1());
416 } else if ( msg == "startSync(QString)" ) {
417 QString what;
418 stream >> what;
419 delete syncDialog;
420 syncDialog = new SyncDialog( this, what );
421 syncDialog->show();
422 connect( syncDialog, SIGNAL(cancel()), SLOT(cancelSync()) );
423 } else if ( msg == "stopSync()") {
424 delete syncDialog;
425 syncDialog = 0;
426 } else if (msg == "restoreDone(QString)") {
427 docList->restoreDone();
428 } else if ( msg == "getAllDocLinks()" ) {
429 docList->sendAllDocLinks();
430 }
431#ifdef Q_WS_QWS
432 else if ( msg == "setMouseProto(QString)" ) {
433 QString mice;
434 stream >> mice;
435 setenv("QWS_MOUSE_PROTO",mice.latin1(),1);
436 qwsServer->openMouse();
437 } else if ( msg == "setKeyboard(QString)" ) {
438 QString kb;
439 stream >> kb;
440 setenv("QWS_KEYBOARD",kb.latin1(),1);
441 qwsServer->openKeyboard();
442
443 } else if ( msg == "setKeyboardAutoRepeat(int,int)" ) {
444 int delay, period;
445 stream >> delay >> period;
446 qwsSetKeyboardAutoRepeat( delay, period );
447 Config cfg( "qpe" );
448 cfg.setGroup("Keyboard");
449 cfg.writeEntry( "RepeatDelay", delay );
450 cfg.writeEntry( "RepeatPeriod", period );
451 } else if ( msg == "setKeyboardLayout(QString)" ) {
452 QString kb;
453 stream >> kb;
454 setKeyboardLayout( kb );
455 Config cfg( "qpe" );
456 cfg.setGroup("Keyboard");
457 cfg.writeEntry( "Layout", kb );
458 }
459#endif
460}
461
462void Server::receiveTaskBar(const QCString &msg, const QByteArray &data)
463{
464 QDataStream stream( data, IO_ReadOnly );
465
466 if ( msg == "reloadApps()" ) {
467 docList->reloadAppLnks();
468 } else if ( msg == "soundAlarm()" ) {
469 soundAlarm();
470 }
471#ifdef CUSTOM_LEDS
472 else if ( msg == "setLed(int,bool)" ) {
473 int led, status;
474 stream >> led >> status;
475 CUSTOM_LEDS( led, status );
476 }
477#endif
478}
479
480void Server::cancelSync()
481{
482#ifndef QT_NO_COP
483 QCopEnvelope e( "QPE/Desktop", "cancelSync()" );
484#endif
485 delete syncDialog;
486 syncDialog = 0;
487}
488
489bool Server::mkdir(const QString &localPath)
490{
491 QDir fullDir(localPath);
492 if (fullDir.exists())
493 return true;
494
495 // at this point the directory doesn't exist
496 // go through the directory tree and start creating the direcotories
497 // that don't exist; if we can't create the directories, return false
498
499 QString dirSeps = "/";
500 int dirIndex = localPath.find(dirSeps);
501 QString checkedPath;
502
503 // didn't find any seps; weird, use the cur dir instead
504 if (dirIndex == -1) {
505 //qDebug("No seperators found in path %s", localPath.latin1());
506 checkedPath = QDir::currentDirPath();
507 }
508
509 while (checkedPath != localPath) {
510 // no more seperators found, use the local path
511 if (dirIndex == -1)
512 checkedPath = localPath;
513 else {
514 // the next directory to check
515 checkedPath = localPath.left(dirIndex) + "/";
516 // advance the iterator; the next dir seperator
517 dirIndex = localPath.find(dirSeps, dirIndex+1);
518 }
519
520 QDir checkDir(checkedPath);
521 if (!checkDir.exists()) {
522 //qDebug("mkdir making dir %s", checkedPath.latin1());
523
524 if (!checkDir.mkdir(checkedPath)) {
525 qDebug("Unable to make directory %s", checkedPath.latin1());
526 return FALSE;
527 }
528 }
529
530 }
531 return TRUE;
532}
533
534void Server::styleChange( QStyle &s )
535{
536 QWidget::styleChange( s );
537}
538
539void Server::startTransferServer()
540{
541 if ( !qcopBridge ) {
542 // start qcop bridge server
543 qcopBridge = new QCopBridge( 4243 );
544 if ( qcopBridge->ok() ) {
545 // ... OK
546 connect( qcopBridge, SIGNAL(connectionClosed(const QHostAddress &)),
547 this, SLOT(syncConnectionClosed(const QHostAddress &)) );
548 } else {
549 delete qcopBridge;
550 qcopBridge = 0;
551 }
552 }
553 if ( !transferServer ) {
554 // start transfer server
555 transferServer = new TransferServer( 4242 );
556 if ( transferServer->ok() ) {
557 // ... OK
558 } else {
559 delete transferServer;
560 transferServer = 0;
561 }
562 }
563 if ( !transferServer || !qcopBridge )
564 tid_xfer = startTimer( 2000 );
565}
566
567void Server::timerEvent( QTimerEvent *e )
568{
569 if ( e->timerId() == tid_xfer ) {
570 killTimer( tid_xfer );
571 tid_xfer = 0;
572 startTransferServer();
573 } else if ( e->timerId() == tid_today ) {
574 QDate today = QDate::currentDate();
575 if ( today != last_today_show ) {
576 last_today_show = today;
577 Config cfg("today");
578 cfg.setGroup("Start");
579#ifndef QPE_DEFAULT_TODAY_MODE
580#define QPE_DEFAULT_TODAY_MODE "Never"
581#endif
582 if ( cfg.readEntry("Mode",QPE_DEFAULT_TODAY_MODE) == "Daily" ) {
583 QCopEnvelope env(Service::channel("today"),"raise()");
584 }
585 }
586 }
587}
588
589void Server::terminateServers()
590{
591 delete transferServer;
592 delete qcopBridge;
593 transferServer = 0;
594 qcopBridge = 0;
595}
596
597void Server::syncConnectionClosed( const QHostAddress & )
598{
599 qDebug( "Lost sync connection" );
600 delete syncDialog;
601 syncDialog = 0;
602}
603
604void Server::pokeTimeMonitors()
605{
606 // inform all TimeMonitors
607 QStrList tms = Service::channels("TimeMonitor");
608 for (const char* ch = tms.first(); ch; ch=tms.next()) {
609 QString t = getenv("TZ");
610 QCopEnvelope e(ch, "timeChange(QString)");
611 e << t;
612 }
613}
614
615void Server::applicationLaunched(int, const QString &app)
616{
617 serverGui->applicationStateChanged( app, ServerInterface::Launching );
618}
619
620void Server::applicationTerminated(int pid, const QString &app)
621{
622 serverGui->applicationStateChanged( app, ServerInterface::Terminated );
623 tsmMonitor->applicationTerminated( pid );
624}
625
626void Server::applicationConnected(const QString &app)
627{
628 serverGui->applicationStateChanged( app, ServerInterface::Running );
629}
630
631void Server::storageChanged()
632{
633 system( "qtopia-update-symlinks" );
634 serverGui->storageChanged( storage->fileSystems() );
635 docList->storageChanged();
636}
637
638
639void Server::soundAlarm()
640{
641#ifdef CUSTOM_SOUND_ALARM
642 CUSTOM_SOUND_ALARM;
643#endif
644}
645
646void Server::preloadApps()
647{
648 Config cfg("Launcher");
649 cfg.setGroup("Preload");
650 QStringList apps = cfg.readListEntry("Apps",',');
651 for (QStringList::ConstIterator it=apps.begin(); it!=apps.end(); ++it) {
652#ifndef QT_NO_COP
653 QCopEnvelope e("QPE/Application/"+(*it).local8Bit(), "enablePreload()");
654#endif
655 }
656}
657
diff --git a/core/launcher/server.h b/core/launcher/server.h
new file mode 100644
index 0000000..21b03af
--- a/dev/null
+++ b/core/launcher/server.h
@@ -0,0 +1,94 @@
1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3**
4** This file is part of the 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 DESKTOP_H
21#define DESKTOP_H
22
23#include <qwidget.h>
24#include <qdatetime.h>
25
26//#include "qcopbridge.h"
27
28class QCopBridge;
29class QHostAddress;
30class TransferServer;
31class PackageHandler;
32class DeviceButton;
33class ServiceRequest;
34class TempScreenSaverMonitor;
35class AppLauncher;
36class AppLnkSet;
37class StorageInfo;
38class SyncDialog;
39class DocumentList;
40class ServerInterface;
41
42class Server : public QWidget {
43 Q_OBJECT
44public:
45 Server();
46 ~Server();
47
48 static bool mkdir(const QString &path);
49
50 void show();
51
52 static void soundAlarm();
53 static bool setKeyboardLayout( const QString &kb );
54
55public slots:
56 void systemMsg(const QCString &, const QByteArray &);
57 void receiveTaskBar(const QCString &msg, const QByteArray &data);
58 void terminateServers();
59 void pokeTimeMonitors();
60
61private slots:
62 void activate(const DeviceButton*,bool);
63 void syncConnectionClosed( const QHostAddress & );
64 void applicationLaunched(int pid, const QString &app);
65 void applicationTerminated(int pid, const QString &app);
66 void applicationConnected(const QString &app);
67 void storageChanged();
68 void cancelSync();
69
70protected:
71 void styleChange( QStyle & );
72 void timerEvent( QTimerEvent *e );
73
74private:
75 void startTransferServer();
76 void preloadApps();
77
78 QCopBridge *qcopBridge;
79 TransferServer *transferServer;
80 PackageHandler *packageHandler;
81 QDate last_today_show;
82 int tid_xfer;
83 int tid_today;
84 TempScreenSaverMonitor *tsmMonitor;
85 StorageInfo *storage;
86 SyncDialog *syncDialog;
87 AppLauncher *appLauncher;
88 DocumentList *docList;
89 ServerInterface *serverGui;
90};
91
92
93#endif // DESKTOP_H
94
diff --git a/core/launcher/server.pro b/core/launcher/server.pro
new file mode 100644
index 0000000..0fc6dae
--- a/dev/null
+++ b/core/launcher/server.pro
@@ -0,0 +1,118 @@
1 TEMPLATE= app
2
3 CONFIG += qtopia warn_on release
4win32:DEFINES += QTOPIA_DLL
5
6 DESTDIR = $(QPEDIR)/bin
7
8 HEADERS += server.h \
9 serverinterface.h \
10 launchertab.h \
11 documentlist.h \
12 suspendmonitor.h \
13 appicons.h \
14 taskbar.h \
15 runningappbar.h \
16 applauncher.h \
17 stabmon.h \
18 inputmethods.h \
19 systray.h \
20 wait.h \
21 shutdownimpl.h \
22 launcher.h \
23 launcherview.h \
24 $(QPEDIR)/src/settings/calibrate/calibrate.h \
25 startmenu.h \
26 transferserver.h \
27 qcopbridge.h \
28 packageslave.h \
29 irserver.h \
30 firstuse.h \
31 $(QPEDIR)/src/3rdparty/libraries/rsync/buf.h \
32 $(QPEDIR)/src/3rdparty/libraries/rsync/checksum.h \
33 $(QPEDIR)/src/3rdparty/libraries/rsync/command.h \
34 $(QPEDIR)/src/3rdparty/libraries/rsync/emit.h \
35 $(QPEDIR)/src/3rdparty/libraries/rsync/job.h \
36 $(QPEDIR)/src/3rdparty/libraries/rsync/netint.h \
37 $(QPEDIR)/src/3rdparty/libraries/rsync/protocol.h \
38 $(QPEDIR)/src/3rdparty/libraries/rsync/prototab.h \
39 $(QPEDIR)/src/3rdparty/libraries/rsync/rsync.h \
40 $(QPEDIR)/src/3rdparty/libraries/rsync/search.h \
41 $(QPEDIR)/src/3rdparty/libraries/rsync/stream.h \
42 $(QPEDIR)/src/3rdparty/libraries/rsync/sumset.h \
43 $(QPEDIR)/src/3rdparty/libraries/rsync/trace.h \
44 $(QPEDIR)/src/3rdparty/libraries/rsync/types.h \
45 $(QPEDIR)/src/3rdparty/libraries/rsync/util.h \
46 $(QPEDIR)/src/3rdparty/libraries/rsync/whole.h \
47 $(QPEDIR)/src/3rdparty/libraries/rsync/config_rsync.h \
48 $(QPEDIR)/src/3rdparty/libraries/rsync/qrsync.h \
49 syncdialog.h \
50 serverapp.h
51
52 SOURCES += server.cpp \
53 serverinterface.cpp \
54 launchertab.cpp \
55 documentlist.cpp \
56 suspendmonitor.cpp \
57 appicons.cpp \
58 taskbar.cpp \
59 runningappbar.cpp \
60 applauncher.cpp \
61 stabmon.cpp \
62 inputmethods.cpp \
63 systray.cpp \
64 wait.cpp \
65 shutdownimpl.cpp \
66 launcher.cpp \
67 launcherview.cpp \
68 $(QPEDIR)/src/settings/calibrate/calibrate.cpp \
69 transferserver.cpp \
70 packageslave.cpp \
71 irserver.cpp \
72 qcopbridge.cpp \
73 startmenu.cpp \
74 main.cpp \
75 firstuse.cpp \
76 $(QPEDIR)/src/3rdparty/libraries/rsync/base64.c \
77 $(QPEDIR)/src/3rdparty/libraries/rsync/buf.c \
78 $(QPEDIR)/src/3rdparty/libraries/rsync/checksum.c \
79 $(QPEDIR)/src/3rdparty/libraries/rsync/command.c \
80 $(QPEDIR)/src/3rdparty/libraries/rsync/delta.c \
81 $(QPEDIR)/src/3rdparty/libraries/rsync/emit.c \
82 $(QPEDIR)/src/3rdparty/libraries/rsync/hex.c \
83 $(QPEDIR)/src/3rdparty/libraries/rsync/job.c \
84 $(QPEDIR)/src/3rdparty/libraries/rsync/mdfour.c \
85 $(QPEDIR)/src/3rdparty/libraries/rsync/mksum.c \
86 $(QPEDIR)/src/3rdparty/libraries/rsync/msg.c \
87 $(QPEDIR)/src/3rdparty/libraries/rsync/netint.c \
88 $(QPEDIR)/src/3rdparty/libraries/rsync/patch.c \
89 $(QPEDIR)/src/3rdparty/libraries/rsync/prototab.c \
90 $(QPEDIR)/src/3rdparty/libraries/rsync/readsums.c \
91 $(QPEDIR)/src/3rdparty/libraries/rsync/scoop.c \
92 $(QPEDIR)/src/3rdparty/libraries/rsync/search.c \
93 $(QPEDIR)/src/3rdparty/libraries/rsync/stats.c \
94 $(QPEDIR)/src/3rdparty/libraries/rsync/stream.c \
95 $(QPEDIR)/src/3rdparty/libraries/rsync/sumset.c \
96 $(QPEDIR)/src/3rdparty/libraries/rsync/trace.c \
97 $(QPEDIR)/src/3rdparty/libraries/rsync/tube.c \
98 $(QPEDIR)/src/3rdparty/libraries/rsync/util.c \
99 $(QPEDIR)/src/3rdparty/libraries/rsync/version.c \
100 $(QPEDIR)/src/3rdparty/libraries/rsync/whole.c \
101 $(QPEDIR)/src/3rdparty/libraries/rsync/qrsync.cpp \
102 syncdialog.cpp \
103 serverapp.cpp
104
105 INTERFACES+= shutdown.ui
106
107INCLUDEPATH += $(QPEDIR)/src/settings/calibrate
108 DEPENDPATH+= $(QPEDIR)/src/settings/calibrate
109
110INCLUDEPATH += $(QPEDIR)/src/3rdparty/libraries/rsync
111 DEPENDPATH+= $(QPEDIR)/src/3rdparty/libraries/rsync
112
113 TARGET = qpe
114
115 unix:LIBS+= -lcrypt -luuid
116win32:LIBS +=
117
118TRANSLATIONS = qpe-en_GB.ts qpe-de.ts qpe-ja.ts qpe-no.ts
diff --git a/core/launcher/serverapp.cpp b/core/launcher/serverapp.cpp
new file mode 100644
index 0000000..6edaa21
--- a/dev/null
+++ b/core/launcher/serverapp.cpp
@@ -0,0 +1,617 @@
1/**********************************************************************
2** Copyright (C) 2000-2003 Trolltech AS. All rights reserved.
3**
4** This file is part of the 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 "serverapp.h"
22
23#include <qtopia/password.h>
24#include <qtopia/config.h>
25#include <qtopia/power.h>
26#include <qtopia/devicebuttonmanager.h>
27#include <qtopia/pluginloader.h>
28
29#ifdef Q_WS_QWS
30#include <qtopia/qcopenvelope_qws.h>
31#endif
32#include <qtopia/global.h>
33#include <qtopia/custom.h>
34
35#ifdef Q_WS_QWS
36#include <qgfx_qws.h>
37#endif
38#ifdef Q_OS_WIN32
39#include <io.h>
40#include <process.h>
41#else
42#include <unistd.h>
43#endif
44#include <qmessagebox.h>
45#include <qtimer.h>
46#include <qpainter.h>
47#include <qfile.h>
48#include <qpixmapcache.h>
49
50#include <stdlib.h>
51
52static ServerApplication *serverApp = 0;
53static int loggedin=0;
54
55
56
57/* Apply light/power settings for current power source */
58static void applyLightSettings(PowerStatus *p)
59{
60 int initbright, intervalDim, intervalLightOff, intervalSuspend;
61 bool dim, lightoff, suspend;
62
63 {
64 Config config("qpe");
65 bool defsus;
66 if ( p->acStatus() == PowerStatus::Online ) {
67 config.setGroup("ExternalPower");
68 defsus = FALSE;
69 } else {
70 config.setGroup("BatteryPower");
71 defsus = TRUE;
72 }
73
74 intervalDim = config.readNumEntry( "Interval_Dim", 20 );
75 intervalLightOff = config.readNumEntry("Interval_LightOff", 30);
76 intervalSuspend = config.readNumEntry("Interval", 240);
77 initbright = config.readNumEntry("Brightness", 255);
78 dim = config.readBoolEntry("Dim", TRUE);
79 lightoff = config.readBoolEntry("LightOff", FALSE );
80 suspend = config.readBoolEntry("Suspend", defsus );
81
82 /* For compability*/
83 config.setGroup("Screensaver");
84 config.writeEntry( "Dim", dim );
85 config.writeEntry( "LightOff", lightoff );
86 config.writeEntry( "Suspend", suspend );
87 config.writeEntry( "Interval_Dim", intervalDim );
88 config.writeEntry( "Interval_LightOff", intervalLightOff );
89 config.writeEntry( "Interval", intervalSuspend );
90 config.writeEntry( "Brightness", initbright );
91 }
92
93 int i_dim = (dim ? intervalDim : 0);
94 int i_lightoff = (lightoff ? intervalLightOff : 0);
95 int i_suspend = (suspend ? intervalSuspend : 0);
96
97#ifndef QT_NO_COP
98 QCopEnvelope eB("QPE/System", "setBacklight(int)" );
99 eB << initbright;
100
101 QCopEnvelope e("QPE/System", "setScreenSaverIntervals(int,int,int)" );
102 e << i_dim << i_lightoff << i_suspend;
103#endif
104}
105
106//---------------------------------------------------------------------------
107
108/*
109 Priority is number of alerts that are needed to pop up
110 alert.
111 */
112class DesktopPowerAlerter : public QMessageBox
113{
114 Q_OBJECT
115public:
116 DesktopPowerAlerter( QWidget *parent, const char *name = 0 )
117 : QMessageBox( tr("Battery Status"), tr("Low Battery"),
118 QMessageBox::Critical,
119 QMessageBox::Ok | QMessageBox::Default,
120 QMessageBox::NoButton, QMessageBox::NoButton,
121 parent, name, FALSE )
122 {
123 currentPriority = INT_MAX;
124 alertCount = 0;
125 }
126
127 void alert( const QString &text, int priority );
128 void hideEvent( QHideEvent * );
129private:
130 int currentPriority;
131 int alertCount;
132};
133
134void DesktopPowerAlerter::alert( const QString &text, int priority )
135{
136 alertCount++;
137 if ( alertCount < priority )
138 return;
139 if ( priority > currentPriority )
140 return;
141 currentPriority = priority;
142 setText( text );
143 show();
144}
145
146
147void DesktopPowerAlerter::hideEvent( QHideEvent *e )
148{
149 QMessageBox::hideEvent( e );
150 alertCount = 0;
151 currentPriority = INT_MAX;
152}
153
154//---------------------------------------------------------------------------
155
156KeyFilter::KeyFilter(QObject* parent) : QObject(parent), held_tid(0), heldButton(0)
157{
158 qwsServer->setKeyboardFilter(this);
159}
160
161void KeyFilter::timerEvent(QTimerEvent* e)
162{
163 if ( e->timerId() == held_tid ) {
164 killTimer(held_tid);
165 // button held
166 if ( heldButton ) {
167 emit activate(heldButton, TRUE);
168 heldButton = 0;
169 }
170 held_tid = 0;
171 }
172}
173
174bool KeyFilter::filter(int /*unicode*/, int keycode, int modifiers, bool press,
175 bool autoRepeat)
176{
177 if ( !loggedin
178 // Permitted keys
179 && keycode != Key_F34 // power
180 && keycode != Key_F30 // select
181 && keycode != Key_Enter
182 && keycode != Key_Return
183 && keycode != Key_Space
184 && keycode != Key_Left
185 && keycode != Key_Right
186 && keycode != Key_Up
187 && keycode != Key_Down )
188 return TRUE;
189 if ( !modifiers ) {
190 if ( !((ServerApplication*)qApp)->keyboardGrabbed() ) {
191 // First check to see if DeviceButtonManager knows something about this button:
192 const DeviceButton* button = DeviceButtonManager::instance().buttonForKeycode(keycode);
193 if (button && !autoRepeat) {
194 if ( held_tid ) {
195 killTimer(held_tid);
196 held_tid = 0;
197 }
198 if ( button->heldAction().isNull() ) {
199 if ( press )
200 emit activate(button, FALSE);
201 } else if ( press ) {
202 heldButton = button;
203 held_tid = startTimer(500);
204 } else if ( heldButton ) {
205 heldButton = 0;
206 emit activate(button, FALSE);
207 }
208 QWSServer::screenSaverActivate(FALSE);
209 return TRUE;
210 }
211 }
212 if ( keycode == Key_F34 ) {
213 if ( press ) emit power();
214 return TRUE;
215 }
216 if ( keycode == Key_F35 ) {
217 if ( press ) emit backlight();
218 return TRUE;
219 }
220 if ( keycode == Key_F32 ) {
221#ifndef QT_NO_COP
222 if ( press ) QCopEnvelope e( "QPE/Desktop", "startSync()" );
223#endif
224 return TRUE;
225 }
226 if ( keycode == Key_F31 ) {
227 if ( press ) emit symbol();
228 QWSServer::screenSaverActivate(FALSE);
229 return TRUE;
230 }
231 }
232 if ( keycode == Key_NumLock ) {
233 if ( press ) emit numLockStateToggle();
234 }
235 if ( keycode == Key_CapsLock ) {
236 if ( press ) emit capsLockStateToggle();
237 }
238 if ( serverApp )
239 serverApp->keyClick(keycode,press,autoRepeat);
240 return FALSE;
241}
242
243enum MemState { MemUnknown, MemVeryLow, MemLow, MemNormal } memstate=MemUnknown;
244
245#if defined(QPE_HAVE_MEMALERTER)
246QPE_MEMALERTER_IMPL
247#endif
248
249#if defined(CUSTOM_SOUND_IMPL)
250CUSTOM_SOUND_IMPL
251#endif
252
253//---------------------------------------------------------------------------
254
255bool ServerApplication::doRestart = FALSE;
256bool ServerApplication::allowRestart = TRUE;
257
258ServerApplication::ServerApplication( int& argc, char **argv, Type t )
259 : QPEApplication( argc, argv, t )
260{
261#ifdef CUSTOM_SOUND_INIT
262 CUSTOM_SOUND_INIT;
263#endif
264
265#if defined(QPE_HAVE_MEMALERTER)
266 initMemalerter();
267#endif
268
269 // We know we'll have lots of cached pixmaps due to App/DocLnks
270 QPixmapCache::setCacheLimit(512);
271
272 QTimer *timer = new QTimer( this );
273 connect( timer, SIGNAL(timeout()), this, SLOT(psTimeout()) );
274 timer->start( 10000 );
275 ps = new PowerStatus;
276 pa = new DesktopPowerAlerter( 0 );
277
278 applyLightSettings(ps);
279
280 if ( PluginLoader::inSafeMode() )
281 QTimer::singleShot(500, this, SLOT(showSafeMode()) );
282 QTimer::singleShot(20*1000, this, SLOT(clearSafeMode()) );
283
284 KeyFilter* kf = new KeyFilter(this);
285
286 connect( kf, SIGNAL(launch()), this, SIGNAL(launch()) );
287 connect( kf, SIGNAL(power()), this, SIGNAL(power()) );
288 connect( kf, SIGNAL(backlight()), this, SIGNAL(backlight()) );
289 connect( kf, SIGNAL(symbol()), this, SIGNAL(symbol()));
290 connect( kf, SIGNAL(numLockStateToggle()), this,SIGNAL(numLockStateToggle()));
291 connect( kf, SIGNAL(capsLockStateToggle()), this,SIGNAL(capsLockStateToggle()));
292 connect( kf, SIGNAL(activate(const DeviceButton*,bool)), this,SIGNAL(activate(const DeviceButton*,bool)));
293
294 connect( kf, SIGNAL(power()), this, SLOT(togglePower()) );
295 connect( kf, SIGNAL(backlight()), this, SLOT(toggleLight()) );
296
297 connect( this, SIGNAL(volumeChanged(bool)), this, SLOT(rereadVolumes()) );
298 rereadVolumes();
299
300 serverApp = this;
301}
302
303
304ServerApplication::~ServerApplication()
305{
306 delete ps;
307 delete pa;
308}
309
310bool ServerApplication::screenLocked()
311{
312 return loggedin == 0;
313}
314
315void ServerApplication::login(bool at_poweron)
316{
317 if ( !loggedin ) {
318 Global::terminateBuiltin("calibrate"); // No tr
319 Password::authenticate(at_poweron);
320 loggedin=1;
321#ifndef QT_NO_COP
322 QCopEnvelope e( "QPE/Desktop", "unlocked()" );
323#endif
324 }
325}
326
327#if defined(QPE_HAVE_TOGGLELIGHT)
328#include <qtopia/config.h>
329
330#include <sys/ioctl.h>
331#include <sys/types.h>
332#include <fcntl.h>
333#include <unistd.h>
334#include <errno.h>
335#include <linux/ioctl.h>
336#include <time.h>
337#endif
338
339static bool blanked=FALSE;
340
341static void blankScreen()
342{
343#ifdef QWS
344 QWidget w(0, 0, Qt::WStyle_Customize | Qt::WStyle_NoBorder | Qt::WStyle_Tool | Qt::WStyle_StaysOnTop | Qt::WPaintUnclipped);
345 w.resize( qt_screen->width(), qt_screen->height() );
346 w.move(0, 0);
347
348 QPainter p(&w);
349 p.fillRect(w.rect(), QBrush(QColor(255,255,255)) );
350 p.end();
351 w.repaint();
352
353 blanked = TRUE;
354#endif
355}
356
357static void darkScreen()
358{
359 qpe_setBacklight(0); // force off
360}
361
362
363void ServerApplication::togglePower()
364{
365 static int haveAPM = -1;
366 if ( haveAPM < 0 ) {
367 if ( QFile::exists( "/proc/apm" ) ) {
368 haveAPM = 1;
369 } else {
370 haveAPM = 0;
371 qWarning( "Cannot suspend - no APM support in kernel" );
372 }
373 }
374
375 if ( haveAPM ) {
376 bool wasloggedin = loggedin;
377 loggedin=0;
378 if ( wasloggedin ) {
379 Config cfg( QPEApplication::qpeDir()+"/etc/Security.conf", Config::File);
380 cfg.setGroup("Passcode");
381 QString passcode = cfg.readEntry("passcode");
382 if ( !passcode.isEmpty() && cfg.readNumEntry("passcode_poweron",0) )
383 blankScreen();
384 }
385
386 system("apm --suspend");
387
388#ifndef QT_NO_COP
389 QWSServer::screenSaverActivate( FALSE );
390 {
391 QCopEnvelope("QPE/Card", "mtabChanged()" ); // might have changed while asleep
392 QCopEnvelope e("QPE/System", "setBacklight(int)");
393 e << -3; // Force on
394 }
395#endif
396 if ( wasloggedin )
397 login(TRUE);
398 }
399
400 //qcopBridge->closeOpenConnections();
401 //qDebug("called togglePower()!!!!!!");
402}
403
404void ServerApplication::toggleLight()
405{
406#ifndef QT_NO_COP
407 QCopEnvelope e("QPE/System", "setBacklight(int)");
408 e << -2; // toggle
409#endif
410}
411
412
413#ifdef Q_WS_QWS
414bool ServerApplication::qwsEventFilter( QWSEvent *e )
415{
416 checkMemory();
417
418 if ( e->type == QWSEvent::Mouse ) {
419 QWSMouseEvent *me = (QWSMouseEvent *)e;
420 static bool up = TRUE;
421 if ( me->simpleData.state&LeftButton ) {
422 if ( up ) {
423 up = FALSE;
424 screenClick(TRUE);
425 }
426 } else if ( !up ) {
427 up = TRUE;
428 screenClick(FALSE);
429 }
430 }
431
432 return QPEApplication::qwsEventFilter( e );
433}
434#endif
435
436void ServerApplication::psTimeout()
437{
438 checkMemory(); // in case no events are being generated
439
440 PowerStatus::ACStatus oldStatus = ps->acStatus();
441
442 *ps = PowerStatusManager::readStatus();
443
444 if ( oldStatus != ps->acStatus() ) {
445 // power source changed, read settings applying to current powersource
446 applyLightSettings(ps);
447 }
448
449
450 if ( (ps->batteryStatus() == PowerStatus::VeryLow ) ) {
451 pa->alert( tr( "Battery is running very low." ), 6 );
452 }
453
454 if ( ps->batteryStatus() == PowerStatus::Critical ) {
455 pa->alert( tr( "Battery level is critical!\n"
456 "Please recharge the main battery!" ), 1 );
457 }
458
459 if ( ps->backupBatteryStatus() == PowerStatus::VeryLow ) {
460 pa->alert( tr( "The Back-up battery is very low.\nPlease charge the back-up battery." ), 3 );
461 }
462}
463
464void ServerApplication::showSafeMode()
465{
466 if ( QMessageBox::warning(0, tr("Safe Mode"), tr("<P>A system startup error occurred, "
467 "and the system is now in Safe Mode. "
468 "Plugins are not loaded in Safe Mode. "
469 "You can use the Plugin Manager to "
470 "disable plugins that cause system error."), tr("OK"), tr("Plugin Manager..."), 0) == 1 ) {
471 Global::execute( "pluginmanager" );
472 }
473}
474
475void ServerApplication::clearSafeMode()
476{
477 // If we've been running OK for a while then we won't bother going into
478 // safe mode immediately on the next crash.
479 Config cfg( "PluginLoader" );
480 cfg.setGroup( "Global" );
481 QString mode = cfg.readEntry( "Mode", "Normal" );
482 if ( mode == "MaybeSafe" ) {
483 cfg.writeEntry( "Mode", "Normal" );
484 }
485}
486
487void ServerApplication::shutdown()
488{
489 if ( type() != GuiServer )
490 return;
491 ShutdownImpl *sd = new ShutdownImpl( 0, 0, WDestructiveClose );
492 connect( sd, SIGNAL(shutdown(ShutdownImpl::Type)),
493 this, SLOT(shutdown(ShutdownImpl::Type)) );
494 sd->showMaximized();
495}
496
497void ServerApplication::shutdown( ShutdownImpl::Type t )
498{
499 switch ( t ) {
500 case ShutdownImpl::ShutdownSystem:
501#ifndef Q_OS_WIN32
502 execlp("shutdown", "shutdown", "-h", "now", (void*)0); // No tr
503#else
504 qDebug("ServerApplication::ShutdownSystem");
505 prepareForTermination(FALSE);
506 quit();
507#endif
508 break;
509
510 case ShutdownImpl::RebootSystem:
511#ifndef Q_OS_WIN32
512 execlp("shutdown", "shutdown", "-r", "now", (void*)0); // No tr
513#else
514 qDebug("ServerApplication::RebootSystem");
515 restart();
516#endif
517 break;
518
519 case ShutdownImpl::RestartDesktop:
520 restart();
521 break;
522
523 case ShutdownImpl::TerminateDesktop:
524 prepareForTermination(FALSE);
525 quit();
526 break;
527 }
528}
529
530void ServerApplication::restart()
531{
532 if ( allowRestart ) {
533 prepareForTermination(TRUE);
534 doRestart = TRUE;
535 quit();
536 }
537}
538
539void ServerApplication::rereadVolumes()
540{
541 Config cfg("Sound");
542 cfg.setGroup("System");
543 touchclick = cfg.readBoolEntry("Touch");
544 keyclick = cfg.readBoolEntry("Key");
545}
546
547
548void ServerApplication::checkMemory()
549{
550#if defined(QPE_HAVE_MEMALERTER)
551 static bool ignoreNormal=TRUE;
552 static bool existingMessage=FALSE;
553
554 if(existingMessage)
555 return; // don't show a second message while still on first
556
557 existingMessage = TRUE;
558 switch ( memstate ) {
559 case MemUnknown:
560 break;
561 case MemLow:
562 memstate = MemUnknown;
563 if ( !recoverMemory() ) {
564 QMessageBox::warning( 0 , tr("Memory Status"),
565 tr("Memory Low\nPlease save data.") );
566 ignoreNormal = FALSE;
567 }
568 break;
569 case MemNormal:
570 memstate = MemUnknown;
571 if ( !ignoreNormal ) {
572 ignoreNormal = TRUE;
573 QMessageBox::information ( 0 , tr("Memory Status"),
574 "Memory OK" );
575 }
576 break;
577 case MemVeryLow:
578 memstate = MemUnknown;
579 QMessageBox::critical( 0 , tr("Memory Status"),
580 tr("Critical Memory Shortage\n"
581 "Please end this application\n"
582 "immediately.") );
583 recoverMemory();
584 }
585 existingMessage = FALSE;
586#endif
587}
588
589bool ServerApplication::recoverMemory()
590{
591 return FALSE;
592}
593
594void ServerApplication::keyClick(int keycode, bool press, bool repeat)
595{
596#ifdef CUSTOM_SOUND_KEYCLICK
597 if ( keyclick )
598 CUSTOM_SOUND_KEYCLICK(keycode,press,repeat);
599#else
600 Q_UNUSED( keycode );
601 Q_UNUSED( press );
602 Q_UNUSED( repeat );
603#endif
604}
605
606void ServerApplication::screenClick(bool press)
607{
608#ifdef CUSTOM_SOUND_TOUCH
609 if ( touchclick )
610 CUSTOM_SOUND_TOUCH(press);
611#else
612 Q_UNUSED( press );
613#endif
614}
615
616
617#include "serverapp.moc"
diff --git a/core/launcher/serverapp.h b/core/launcher/serverapp.h
new file mode 100644
index 0000000..60d9c41
--- a/dev/null
+++ b/core/launcher/serverapp.h
@@ -0,0 +1,116 @@
1/**********************************************************************
2** Copyright (C) 2000-2003 Trolltech AS. All rights reserved.
3**
4** This file is part of the 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 SERVERAPP_H
22#define SERVERAPP_H
23
24#include <qtopia/qpeapplication.h>
25
26#include <qwidget.h>
27#ifdef QWS
28#include <qwindowsystem_qws.h>
29#endif
30
31#include "shutdownimpl.h"
32
33class PowerStatus;
34class DesktopPowerAlerter;
35class DeviceButton;
36
37class KeyFilter : public QObject, public QWSServer::KeyboardFilter {
38 Q_OBJECT
39public:
40 KeyFilter(QObject* parent);
41 bool filter(int unicode, int keycode, int modifiers, bool press,
42 bool autoRepeat);
43
44protected:
45 void timerEvent(QTimerEvent*);
46
47signals:
48 void launch();
49 void power();
50 void backlight();
51 void symbol();
52 void numLockStateToggle();
53 void capsLockStateToggle();
54 void activate(const DeviceButton*,bool);
55
56private:
57 int held_tid;
58 const DeviceButton* heldButton;
59};
60
61class ServerApplication : public QPEApplication
62{
63 Q_OBJECT
64public:
65 ServerApplication( int& argc, char **argv, Type t );
66 ~ServerApplication();
67
68 static bool doRestart;
69 static bool allowRestart;
70 static bool screenLocked();
71 static void login(bool at_poweron);
72
73 void restart();
74
75signals:
76 void home();
77 void launch();
78 void power();
79 void backlight();
80 void symbol();
81 void numLockStateToggle();
82 void capsLockStateToggle();
83 void prepareForRestart();
84 void activate(const DeviceButton*,bool);
85
86protected:
87#ifdef Q_WS_QWS
88 bool qwsEventFilter( QWSEvent * );
89#endif
90 void shutdown();
91 void checkMemory();
92 bool recoverMemory();
93 void keyClick(int keycode, bool press, bool repeat);
94 void screenClick(bool press);
95
96protected slots:
97 void shutdown(ShutdownImpl::Type);
98 void psTimeout();
99 void showSafeMode();
100 void clearSafeMode();
101 void togglePower();
102 void toggleLight();
103 void rereadVolumes();
104
105private:
106 DesktopPowerAlerter *pa;
107 PowerStatus *ps;
108 bool keyclick;
109 bool touchclick;
110
111 friend class KeyFilter;
112};
113
114
115#endif // SERVERAPP_H
116
diff --git a/core/launcher/serverinterface.cpp b/core/launcher/serverinterface.cpp
new file mode 100644
index 0000000..7002243
--- a/dev/null
+++ b/core/launcher/serverinterface.cpp
@@ -0,0 +1,372 @@
1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3**
4** This file is part of the 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 "serverinterface.h"
21#include "server.h"
22#include "documentlist.h"
23
24#include <qtopia/qpeapplication.h>
25#include <qwindowsystem_qws.h>
26#include <qgfx_qws.h>
27
28class LayoutManager : public QObject
29{
30 Q_OBJECT
31public:
32 LayoutManager();
33
34 void addDocked( QWidget *w, ServerInterface::DockArea placement );
35
36private:
37 struct Item {
38 QWidget *w;
39 ServerInterface::DockArea p;
40 };
41
42 bool eventFilter( QObject *object, QEvent *event );
43 void layout();
44 Item *findWidget( const QWidget *w ) const;
45
46 QList<Item> docked;
47};
48
49LayoutManager::LayoutManager()
50{
51 docked.setAutoDelete( TRUE );
52 qApp->desktop()->installEventFilter( this );
53}
54
55void LayoutManager::addDocked( QWidget *w, ServerInterface::DockArea placement )
56{
57 Item *i = new Item;
58 i->w = w;
59 i->p = placement;
60 w->installEventFilter( this );
61 docked.append(i);
62 layout();
63}
64
65bool LayoutManager::eventFilter( QObject *object, QEvent *event )
66{
67 if ( object == qApp->desktop() ) {
68 if ( event->type() == QEvent::Resize )
69 layout();
70 return QObject::eventFilter( object, event );
71 }
72
73 Item *item;
74
75 switch ( event->type() ) {
76 case QEvent::Destroy:
77 item = findWidget( (QWidget *)object );
78 if ( item ) {
79 docked.removeRef( item );
80 layout();
81 }
82 break;
83
84 case QEvent::Hide:
85 case QEvent::Show:
86 item = findWidget( (QWidget *)object );
87 if ( item )
88 layout();
89 break;
90
91 default:
92 break;
93 }
94
95 return QObject::eventFilter( object, event );
96}
97
98void LayoutManager::layout()
99{
100 QRect mwr( qApp->desktop()->geometry() );
101 QListIterator<Item> it( docked );
102 Item *item;
103 for ( ; (item = it.current()); ++it ) {
104 QWidget *w = item->w;
105 if ( !w->isVisible() )
106 continue;
107 switch ( item->p ) {
108 case ServerInterface::Top:
109 w->resize( mwr.width(), w->sizeHint().height() );
110 w->move( mwr.topLeft() );
111 mwr.setTop( w->geometry().bottom() + 1 );
112 break;
113 case ServerInterface::Bottom:
114 w->resize( mwr.width(), w->sizeHint().height() );
115 w->move( mwr.left(), mwr.bottom()-w->height()+1 );
116 mwr.setBottom( w->geometry().top() - 1 );
117 break;
118 case ServerInterface::Left:
119 w->resize( w->sizeHint().width(), mwr.height() );
120 w->move( mwr.topLeft() );
121 mwr.setLeft( w->geometry().right() + 1 );
122 break;
123 case ServerInterface::Right:
124 w->resize( w->sizeHint().width(), mwr.height() );
125 w->move( mwr.right()-w->width()+1, mwr.top() );
126 mwr.setRight( w->geometry().left() - 1 );
127 break;
128 }
129 }
130
131#ifdef Q_WS_QWS
132# if QT_VERSION < 0x030000
133 QWSServer::setMaxWindowRect( qt_screen->mapToDevice(mwr,
134 QSize(qt_screen->width(),qt_screen->height())) );
135# else
136 QWSServer::setMaxWindowRect( mwr );
137# endif
138#endif
139}
140
141LayoutManager::Item *LayoutManager::findWidget( const QWidget *w ) const
142{
143 QListIterator<Item> it( docked );
144 Item *item;
145 for ( ; (item = it.current()); ++it ) {
146 if ( item->w == w )
147 return item;
148 }
149
150 return 0;
151}
152
153//---------------------------------------------------------------------------
154
155/*! \class ServerInterface serverinterface.h
156 \brief The ServerInterface class provides an interface for Qtopia
157 custom launchers.
158
159 The ServerInterface allows the user interface of the launcher to be
160 customized to suit the device. For a PDA style device, the default
161 launcher is strongly recommended, however specialist devices may
162 choose to provide a launcher better suited to the application.
163
164 The launcher is fixed for any particular device and is not loaded
165 as a plugin. Launcher interfaces must
166 be compilied into the server by editing server.pro and server.cpp.
167*/
168
169/*!
170 \fn ServerInterface::createGUI()
171
172 Implement this function to create the custom launcher UI.
173*/
174
175/*!
176 \fn ServerInterface::destroyGUI()
177
178 Implement this function to destroy the custom launcher UI. All resources
179 allocated by createGUI() must be released.
180*/
181
182/*!
183 \enum ServerInterface::ApplicationState
184
185 The ApplicationState enum type specifies the state of an application.
186 The possible values are: <ul>
187
188 <li> \c Launching - the application has been requested, but is not yet running.
189 <li> \c Running - the application is running.
190 <li> \c Terminated - the application has been terminated.
191</ul>
192*/
193
194/*!
195 \fn ServerInterface::applicationStateChanged(const QString& name, ApplicationState state)
196
197 The application \a name has changed state to \a state. This can be used
198 to show launch notification and update a list of running applications.
199*/
200
201/*!
202 \fn ServerInterface::typeAdded(const QString& type, const QString& name, const QPixmap& pixmap, const QPixmap& bgPixmap)
203
204 An application category \a type has been added, for example "Games".
205 \a name is the translated name of the category. \a pixmap and
206 \a bgPixmap are small and large icons for the new type.
207
208 Types can be added or removed at any time, for example, when a storage
209 card containing a non-standard category is inserted or removed.
210
211 \sa typeRemoved()
212*/
213
214/*!
215 \fn ServerInterface::typeRemoved(const QString& type)
216
217 An application category \a type has been removed.
218
219 Types can be added or removed at any time, for example, when a storage
220 card containing a non-standard category is inserted or removed.
221
222 \sa typeAdded()
223*/
224
225/*!
226 \fn ServerInterface::applicationAdded(const QString& type, const AppLnk& app)
227
228 Add an application \a app of type \a type to the launcher.
229
230 \sa applicationRemoved()
231*/
232
233/*!
234 \fn ServerInterface::applicationRemoved(const QString& type, const AppLnk& app)
235
236 Remove an application \a app of type \a type from the launcher.
237
238 \sa applicationAdded()
239*/
240
241/*!
242 \fn ServerInterface::allApplicationsRemoved()
243
244 Remove all applications from the launcher.
245*/
246
247/*!
248 \fn const AppLnkSet &ServerInterface::appLnks()
249
250 Returns the current set of available applications.
251*/
252
253/*!
254 \fn ServerInterface::documentAdded(const DocLnk& doc)
255
256 Add a document \a doc to the launcher.
257
258 \sa documentRemoved()
259*/
260
261/*!
262 \fn ServerInterface::documentRemoved(const DocLnk& doc)
263
264 Remove a document \a doc to the launcher.
265
266 \sa documentAdded()
267*/
268
269/*!
270 \fn ServerInterface::documentChanged(const DocLnk& oldDoc, const DocLnk& newDoc)
271
272 Change document properties of existing document \a oldDoc to \a newDoc.
273*/
274
275/*!
276 \fn ServerInterface::allDocumentsRemoved()
277
278 Remove all documents from the launcher.
279*/
280
281/*!
282 \fn ServerInterface::storageChanged(const QList<FileSystem> &)
283
284 A filesystem has been added or removed.
285*/
286
287/*!
288 \fn ServerInterface::applicationScanningProgress(int percent)
289
290 The system is scanning for installed applications. \a percent
291 provides the percentage of the filesystems scanned. This function will
292 always be called with \a percent equal to zero when scanning starts,
293 and with \a percent equal to 100 when scanning is complete.
294*/
295
296/*!
297 \fn ServerInterface::documentScanningProgress(int percent)
298
299 The system is scanning for documents. \a percent
300 provides the percentage of the filesystems scanned. This function will
301 always be called with \a percent equal to zero when scanning starts,
302 and with \a percent equal to 100 when scanning is complete.
303*/
304
305/*!
306 \fn bool ServerInterface::requiresApplications() const
307
308 Return TRUE if the custom launcher requires the server to scan for
309 applications.
310*/
311
312/*!
313 \fn bool ServerInterface::requiresDocuments() const
314
315 Return TRUE if the custom launcher requires the server to scan for
316 documents.
317*/
318
319/*!
320 \enum ServerInterface::DockArea
321
322 The DockArea enum type defines the areas where widgets can be docked:
323 <ul>
324 <li> \c Top - the top of the screen.
325 <li> \c Bottom - the Bottom of the screen.
326 <li> \c Left - the Left of the screen.
327 <li> \c Right - the Right of the screen.
328 </ul>
329*/
330
331/*!
332 \fn ServerInterface::dockWidget(QWidget *w, DockArea placement)
333
334 Docks a top-level widget \a w on a side of the screen specified by
335 \a placement. The widget is placed
336 according to the order that it was docked, its sizeHint() and whether
337 previously docked widgets are visible. The desktop area available to
338 QWidget::showMaximized() will exclude any visible docked widgets.
339
340 For example, if a widget is
341 docked at the bottom of the screen, its sizeHint() will define its
342 height and it will use the full width of the screen. If a widget is
343 then docked to the right, its sizeHint() will define its width and
344 it will be as high as possible without covering
345 the widget docked at the bottom.
346
347 This function is useful for reserving system areas such as taskbars
348 and input methods that should not be covered by applications.
349*/
350
351
352ServerInterface::~ServerInterface()
353{
354}
355
356void ServerInterface::dockWidget( QWidget *w, DockArea placement )
357{
358 static LayoutManager *lm = 0;
359
360 if ( !lm )
361 lm = new LayoutManager;
362
363 lm->addDocked( w, placement );
364}
365
366const AppLnkSet& ServerInterface::appLnks()
367{
368 return *DocumentList::appLnkSet;
369}
370
371#include "serverinterface.moc"
372
diff --git a/core/launcher/serverinterface.h b/core/launcher/serverinterface.h
new file mode 100644
index 0000000..e57ea51
--- a/dev/null
+++ b/core/launcher/serverinterface.h
@@ -0,0 +1,72 @@
1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3**
4** This file is part of the 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 SERVER_INTERFACE_H
21#define SERVER_INTERFACE_H
22
23
24#include <qstring.h>
25#include <qpixmap.h>
26#include <qwidget.h>
27#include <qtopia/applnk.h>
28#include <qtopia/storage.h>
29
30
31class ServerInterface {
32public:
33 virtual ~ServerInterface();
34
35 virtual void createGUI() = 0;
36 virtual void destroyGUI() = 0;
37
38 // These notify of the application categories, like what is used in the current launcher tabs,
39 // for example "Applications", "Games" etc.
40 virtual void typeAdded( const QString& type, const QString& name, const QPixmap& pixmap, const QPixmap& bgPixmap ) = 0;
41 virtual void typeRemoved( const QString& type ) = 0;
42
43 // These functions notify when an application is added or removed and to which category it belongs
44 virtual void applicationAdded( const QString& type, const AppLnk& doc ) = 0;
45 virtual void applicationRemoved( const QString& type, const AppLnk& doc ) = 0;
46 virtual void allApplicationsRemoved() = 0;
47 // Useful for wait icons, or running application lists etc
48 enum ApplicationState { Launching, Running, Terminated };
49 virtual void applicationStateChanged( const QString& name, ApplicationState state ) = 0;
50 static const AppLnkSet& appLnks();
51
52 // These functions notify of adding, removal and changes of document links used in the documents tab for example
53 virtual void documentAdded( const DocLnk& doc ) = 0;
54 virtual void documentRemoved( const DocLnk& doc ) = 0;
55 virtual void allDocumentsRemoved() = 0;
56 virtual void documentChanged( const DocLnk& oldDoc, const DocLnk& newDoc ) = 0;
57
58 virtual void storageChanged( const QList<FileSystem> & ) = 0;
59
60 virtual void applicationScanningProgress( int percent ) = 0;
61 virtual void documentScanningProgress( int percent ) = 0;
62
63 // Tells the server if the GUI needs to be updated about documents or applnks
64 virtual bool requiresApplications() const = 0;
65 virtual bool requiresDocuments() const = 0;
66
67 enum DockArea { Top, Bottom, Left, Right };
68 static void dockWidget( QWidget *w, DockArea placement );
69};
70
71
72#endif // SERVER_INTERFACE_H
diff --git a/core/launcher/specification.html b/core/launcher/specification.html
new file mode 100644
index 0000000..8e24837
--- a/dev/null
+++ b/core/launcher/specification.html
@@ -0,0 +1,213 @@
1<html>
2<title>
3Launcher Specification
4</title>
5
6<body>
7
8<h1>Launcher Specification</h1>
9
10
11<!--
12<h2>Specification goals</h2>
13This specification:
14<ol>
15<li> Describes all of the end-user stories and interactions.
16 (eg. the user can view a slide show of images from a digital camera).
17<li> Lists all features, derived from end-user stories,
18 in enough detail to allow the definition of
19 tests for all features.
20<li> Defines contraints and limitations on the application.
21 (eg. can view image sizes as large as 1MB).
22<li>Aides the developer on focusing on the most important aspects of
23 the application and ensuring all important elements are completed.
24</ol>
25-->
26
27<a name=description>
28</a>
29<!-- A one-line description of what this application is and does.
30 This description is then duplicated in the .desktop Comment and
31 the .control file description.
32
33 (eg. The image viewer allows viewing and very minor editing of image files.)
34-->
35The Qtopia Launcher is the your "home" in Qtopia.
36<!-- A one-paragraph description of what this application is and does.
37 This description is then duplicated in the .desktop Comment and
38 the .control file description.
39
40 (eg. The image viewer allows viewing and very minor editing
41 of image files. It assists format conversion, beaming logos
42 to phones, captioning, etc.)
43-->
44<p>
45The Qtopia Launcher allows you to start installed Applications, Games, and Settings.
46It allows you to manage your documents. The launcher has a taskbar which shows current
47running programs and allows switching between them.
48The taskbar supports three plugin types: input
49methods, taskbar applets, and menu applets (also called accessories).
50The Launcher is also responsible for a number of system-level operations.
51</p>
52
53<p>
54Status: RT
55</p>
56
57<a name=usecases>
58<h2>Use Cases</h2>
59</a>
60<!-- Describe real-world stories. Implicit in these use cases is
61 "these things are easy to do".
62 (eg.
63 Roving News Reporter
64
65 The journalist/cameraman takes photos with a digital camera,
66 loads them into the PDAs via CF card, adjusts the contrast,
67 blacks-out a license plate, adds a copyright caption, and
68 emails the image and short story to Reuters.
69 )
70
71 Note: TITLEs may be used as identifiers in bug reports.
72 -->
73<ul>
74<li><b>Write a new text document</b>
75 <p>The user clicks on the Text Editor to create a new text document
76 (or to edit an existing text document).
77<li><b>Play a game</b>
78 <p>The user looks at available games and chooses one to play.
79<li><b>Tweak the system</b>
80 <p>The user changes the way the device looks, feels, and operates
81 by using the Settings programs.
82<li><b>Edit a text document</b>
83 <p>The user clicks on a text document to edit it.
84<li><b>Organizing documents</b>
85 <p>The user looks at all documents of a certain type (such as images),
86 or looks at all documents in a certain category (such as Business).
87<li><b>Beam</b>
88 <p>The user selects a document and beams it to a friend.
89<li><b>Desktop Computer user</b>
90 <p>The user is familiar with desktop computer systems where a menu
91 is used for starting applications. A familiar interface is available
92 in Qtopia (the Q menu).
93<li><b>Accessories</b>
94 <p>The user installs software that appears as an item in the Q menu,
95 for invoking occasional actions.
96<li><b>Input methods</b>
97 <p>The user chooses Handwriting Recognition for most text input,
98 but switches to the more traditional Keyboard input method when
99 using the Terminal.
100<li><b>Switch between applications</b>
101 <p>Bob is writing an email about an upcoming event. Without
102 quitting the Email application, he starts the Calendar, views the event,
103 and easily switches back and forth between the two applications while
104 writing the email.
105<li><b>Broken software</b>
106 <p>Betty installs a game she downloaded off the Internet. When she
107 scores more than 99999 points, the game freezes and stops responding
108 to all input. The system informs her that the program is not responding
109 and she chooses to terminate the game.
110<li><b>Status display</b>
111 <p>The user installs various applets that show the current time,
112 the state of the network, battery level, and inserted media cards.
113 The small displays also provide minor interactions such as
114 setting an alarm clock, starting/stopping the network, getting more
115 detailed information, and ejecting cards.
116<li><b>Frequently used operations</b>
117 <p>The user installs various applets that provide quick access
118 to frequently used operations such as cut and paste, backlight adjustment,
119 and volume control.
120<li><b>Shutdown</b>
121 <p>The user is storing his device for an extremely long period. To prevent
122 system corruption when the battery eventually drains, he shuts down the
123 device.
124<li><b>Calibration</b>
125 <p>The touchpanel on some devices may "drift" over time, or in different
126 environmental conditions. The user then "recalibrates" the display.
127</ul>
128
129<a name=features>
130<h2>Features</h2>
131</a>
132<!-- features are brief
133
134 (eg.
135 * Slide show: view multiple images in sequence
136 * Configurable delay between images.
137 * Hardware-button-controlled stepping between images.
138 * Big images: view larger-than-available-RAM images in some formats.
139 * Formats: view JPEG, PNG, GIF format images.
140 * Scribbling: draw black or white lines on images.
141 * Save: in JPEG, PNG formats.
142 )
143
144 Note: TITLEs may be used as identifiers in bug reports.
145-->
146
147<ul>
148<li>Games tab: games are grouped on their own tab because they are a well-defined
149 group of applications. Games are programs useful solely for
150 entertainment.
151<li>Settings tab: settings are grouped on their own tab because they are a well-defined
152 group of applications. Settings are programs that configure the
153 device without actually contributing to productivity.
154<li>Applications tab: all programs that are not games or settings are grouped
155 as applications, presumably contributing to productivity.
156<li>Documents tab: all user documents are accessible through this tab.
157<li>Invoke application: selecting a application icon starts the application
158 or raises the application if it is already started.
159<li>Invoke document: selecting a document invokes the application associated
160 with the type of document.
161<li>Document Categorization: documents can be members of various categories. The user
162 can filter the view to show just members of a vertain category.
163<li>Document Type: documents each have a single MIME type. The user
164 can filter the view to show just documents of a certain type.
165<li>Beam Document: documents can be sent to other devices (via IrDA).
166<li>Move Document: documents can be moved to different storage locations (eg. CF or SD card).
167<li>Copy Document: documents can be duplicated, with the copy optionally on a different storage location.
168<li>Delete Document: documents can be deleted.
169<li>Q Menu Tab Equivalents: the Application, Games, and Settings tabs can be
170 visible in the Q Menu.
171<li>Q Menu Accessories: plugins (applets) can add items to the Q Menu (eg. IR on/off control).
172<li>Input Method Plugins: pluggable input methods can produce text input to
173 applications using programmed interactions with the user.
174<li>Task Bar: currently running applications are shown as icons in the taskbar,
175 and clicking on these raises the application. If the application does not
176 respond, the user is given the option to terminate it forcefully.
177<li>Status Bar: the task bar doubles as a status bar for temporary messages
178 generated by applications.
179<li>Applets: pluggable applets can show small widgets in the right-hand side
180 of the taskbar. eg. there is a clock applet.
181<li>Shutdown: the device may be shutdown, or the Launcher may be terminated
182 or restarted. The exact meaning of these operations is device-specific.
183<li>Recalibrate: the device may be recalibrated by takling 5 input points from
184 the user and adjusting physical to pixel transformations.
185</ul>
186
187<a name=prerequisites>
188<h2>Prerequisites</h2>
189</a>
190<!--
191 Describes unresolved limitations that cannot
192 be shown within the features list.
193
194 Describes memory and other requirements quantitatively.
195
196 This is a short list, mainly intended as a "known bugs"
197 list for missing features.
198
199 (eg.
200 * Stylus: required for Scribbling.
201 * Memory: requires 250 bytes per event, plus content strings.
202 )
203
204 Note: TITLEs may be used as identifiers in bug reports.
205
206<ul>
207 <li>[PREREQUISITE TITLE]: [PREREQUISITE DETAILS]
208</ul>
209-->
210None.
211
212</body>
213</html>
diff --git a/core/launcher/suspendmonitor.cpp b/core/launcher/suspendmonitor.cpp
new file mode 100644
index 0000000..f555e84
--- a/dev/null
+++ b/core/launcher/suspendmonitor.cpp
@@ -0,0 +1,167 @@
1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3**
4** This file is part of the 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 <qtopia/qcopenvelope_qws.h>
21#include <qtopia/qpeapplication.h>
22#include "suspendmonitor.h"
23
24
25#ifdef QTOPIA_MAX_SCREEN_DISABLE_TIME
26#define QTOPIA_MIN_SCREEN_DISABLE_TIME ((int) 300) // min 5 minutes before forced suspend kicks in
27#endif
28
29
30TempScreenSaverMonitor::TempScreenSaverMonitor(QObject *parent, const char *name)
31 : QObject(parent, name)
32{
33 currentMode = QPEApplication::Enable;
34 timerId = 0;
35}
36
37void TempScreenSaverMonitor::setTempMode(int mode, int pid)
38{
39 removeOld(pid);
40 switch(mode) {
41 case QPEApplication::Disable:
42 sStatus[0].append(pid);
43 break;
44 case QPEApplication::DisableLightOff:
45 sStatus[1].append(pid);
46 break;
47 case QPEApplication::DisableSuspend:
48 sStatus[2].append(pid);
49 break;
50 case QPEApplication::Enable:
51 break;
52 default:
53 qWarning("Unrecognized temp power setting. Ignored");
54 return;
55 }
56 updateAll();
57}
58
59// Returns true if app had set a temp Mode earlier
60bool TempScreenSaverMonitor::removeOld(int pid)
61{
62 QValueList<int>::Iterator it;
63 for (int i = 0; i < 3; i++) {
64 it = sStatus[i].find(pid);
65 if ( it != sStatus[i].end() ) {
66 sStatus[i].remove( it );
67 return TRUE;
68 }
69 }
70 return FALSE;
71}
72
73void TempScreenSaverMonitor::updateAll()
74{
75 int mode = QPEApplication::Enable;
76 if ( sStatus[0].count() ) {
77 mode = QPEApplication::Disable;
78 } else if ( sStatus[1].count() ) {
79 mode = QPEApplication::DisableLightOff;
80 } else if ( sStatus[2].count() ) {
81 mode = QPEApplication::DisableSuspend;
82 }
83
84 if ( mode != currentMode ) {
85#ifdef QTOPIA_MAX_SCREEN_DISABLE_TIME
86 if ( currentMode == QPEApplication::Enable) {
87 int tid = timerValue();
88 if ( tid )
89 timerId = startTimer( tid * 1000 );
90 } else if ( mode == QPEApplication::Enable ) {
91 if ( timerId ) {
92 killTimer(timerId);
93 timerId = 0;
94 }
95 }
96#endif
97 currentMode = mode;
98 QCopEnvelope("QPE/System", "setScreenSaverMode(int)") << mode;
99 }
100}
101
102void TempScreenSaverMonitor::applicationTerminated(int pid)
103{
104 if ( removeOld(pid) )
105 updateAll();
106}
107
108int TempScreenSaverMonitor::timerValue()
109{
110 int tid = 0;
111#ifdef QTOPIA_MAX_SCREEN_DISABLE_TIME
112 tid = QTOPIA_MAX_SCREEN_DISABLE_TIME;
113
114 char *env = getenv("QTOPIA_DISABLED_APM_TIMEOUT");
115 if ( !env )
116 return tid;
117
118 QString strEnv = env;
119 bool ok = FALSE;
120 int envTime = strEnv.toInt(&ok);
121
122 if ( ok ) {
123 if ( envTime < 0 )
124 return 0;
125 else if ( envTime <= QTOPIA_MIN_SCREEN_DISABLE_TIME )
126 return tid;
127 else
128 return envTime;
129 }
130#endif
131
132 return tid;
133}
134
135void TempScreenSaverMonitor::timerEvent(QTimerEvent *t)
136{
137#ifdef QTOPIA_MAX_SCREEN_DISABLE_TIME
138 if ( timerId && (t->timerId() == timerId) ) {
139
140 /* Clean up*/
141 killTimer(timerId);
142 timerId = 0;
143 currentMode = QPEApplication::Enable;
144 QCopEnvelope("QPE/System", "setScreenSaverMode(int)") << currentMode;
145
146 // signal starts on a merry-go-round, which ends up in Desktop::togglePower()
147 emit forceSuspend();
148 // if we have apm we are asleep at this point, next line will be executed when we
149 // awake from suspend.
150 if ( QFile::exists( "/proc/apm" ) ) {
151 QTime t;
152 t = t.addSecs( timerValue() );
153 QString str = tr("<qt>The running applications disabled the screen saver for more than the allowed time (%1).<p>The system was forced to suspend</p></qt>").arg( t.toString() );
154 QMessageBox::information(0, tr("Forced suspend"), str);
155 }
156
157 // Reset all requests.
158 for (int i = 0; i < 3; i++)
159 sStatus[i].clear();
160
161 updateAll();
162 }
163#else
164 Q_UNUSED(t);
165#endif
166}
167
diff --git a/core/launcher/suspendmonitor.h b/core/launcher/suspendmonitor.h
new file mode 100644
index 0000000..553ad19
--- a/dev/null
+++ b/core/launcher/suspendmonitor.h
@@ -0,0 +1,56 @@
1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3**
4** This file is part of the 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 SUSPEND_MONITOR_H
21#define SUSPEND_MONITOR_H
22
23
24#include <qobject.h>
25#include <qvaluelist.h>
26
27
28class TempScreenSaverMonitor : public QObject
29{
30 Q_OBJECT
31public:
32 TempScreenSaverMonitor(QObject *parent = 0, const char *name = 0);
33
34 void setTempMode(int,int);
35 void applicationTerminated(int);
36
37signals:
38 void forceSuspend();
39
40protected:
41 void timerEvent(QTimerEvent *);
42
43private:
44 bool removeOld(int);
45 void updateAll();
46 int timerValue();
47
48private:
49 QValueList<int> sStatus[3];
50 int currentMode;
51 int timerId;
52};
53
54
55#endif // SUSPEND_MONITOR_H
56
diff --git a/core/launcher/syncdialog.cpp b/core/launcher/syncdialog.cpp
new file mode 100644
index 0000000..6f6c781
--- a/dev/null
+++ b/core/launcher/syncdialog.cpp
@@ -0,0 +1,184 @@
1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3**
4** This file is part of the 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 "syncdialog.h"
22
23#include <qtopia/resource.h>
24
25#include <qimage.h>
26#include <qpainter.h>
27#include <qapplication.h>
28#include <qpushbutton.h>
29#include <qfile.h>
30
31
32SyncDialog::SyncDialog( QWidget *parent, const QString &w )
33 : QDialog( parent, "SyncDialog", FALSE, WStyle_Tool | WStyle_Customize |
34 WStyle_StaysOnTop ), what(w), nextPt(0), rev(FALSE), hideDot(TRUE)
35{
36 QFont f( font() );
37 f.setPointSize( 16 );
38 setFont(f);
39
40 loadPath();
41
42 QSize ds = qApp->desktop()->size();
43 setGeometry( 0, 0, ds.width(), ds.height() );
44 img = Resource::loadImage( "SyncScreen" );
45 if ( img.width() > ds.width() || img.height() > ds.height() ) {
46 path = scalePath( path, ds.width(), img.width(), ds.height(), img.height() );
47 img = img.smoothScale( ds.width(), ds.height() );
48 }
49 dot = Resource::loadImage( "syncdot" );
50 setBackgroundColor( white );
51
52 QPushButton *pb = new QPushButton( tr("Abort"), this, "CancelSync" );
53 QSize bs = pb->sizeHint();
54 bs.rwidth() += 10;
55 bs.rheight() += 5;
56 pb->setGeometry( (ds.width()-bs.width())/2, 4*ds.height()/5,
57 bs.width(), bs.height() );
58 connect( pb, SIGNAL(clicked()), this, SIGNAL(cancel()) );
59
60 if ( path.count() >= 2 ) {
61 path = generatePath( path, 8 );
62 startTimer( 200 );
63 }
64}
65
66void SyncDialog::paintEvent( QPaintEvent *pe )
67{
68 QPainter p(this );
69 p.setClipRect( pe->rect() );
70 int ox = (width() - img.width())/2;
71 int oy = (height() - img.height())/2;
72
73 QRect ir = QRect(ox, oy, img.width(), img.height()) & pe->rect();
74
75 if ( ir.isValid() )
76 p.drawImage( ir.x(), ir.y(), img, ir.x()-ox, ir.y()-oy, ir.width(), ir.height() );
77
78 QString syncMsg = tr("Syncing:");
79 p.setPen( black );
80 QRect r( 0, 0, width()/2-5, QMAX(oy,80) );
81 p.drawText( r, AlignRight | AlignVCenter, syncMsg );
82 r.moveBy( width()/2, 0 );
83 QFont f( font() );
84 f.setWeight( QFont::Bold );
85 p.setFont( f );
86 p.drawText( r, AlignLeft | AlignVCenter, what );
87
88 if ( !hideDot )
89 p.drawImage( ox+path[nextPt].x()-dot.width()/2, oy+path[nextPt].y()-dot.height()/2, dot );
90}
91
92void SyncDialog::timerEvent( QTimerEvent * )
93{
94 int ox = (width() - img.width())/2;
95 int oy = (height() - img.height())/2;
96 int oldPt = nextPt;
97
98 if ( !rev ) {
99 nextPt++;
100 if ( nextPt == (int)path.count() ) {
101 nextPt -= 2;
102 rev = TRUE;
103 }
104 } else {
105 nextPt--;
106 if ( nextPt < 0 ) {
107 nextPt = 1;
108 rev = FALSE;
109 }
110 }
111
112 hideDot = FALSE;
113 repaint( ox+path[nextPt].x()-dot.width()/2, oy+path[nextPt].y()-dot.height()/2,
114 dot.width(), dot.height() );
115 hideDot = TRUE;
116 repaint( ox+path[oldPt].x()-dot.width()/2, oy+path[oldPt].y()-dot.height()/2,
117 dot.width(), dot.height() );
118}
119
120void SyncDialog::loadPath()
121{
122 QString pfile = Resource::findPixmap( "syncdot" );
123 if ( pfile.isEmpty() )
124 return;
125 int dp = pfile.findRev('.');
126 pfile.replace( dp, pfile.length()-dp, ".path" );
127
128 int count = 0;
129 QFile file( pfile );
130 if ( file.open( IO_ReadOnly ) ) {
131 QString line;
132 while ( file.readLine( line, 256 ) > 0 ) {
133 int x, y;
134 if ( sscanf( line.latin1(), "%d %d", &x, &y ) == 2 ) {
135 path.resize( count+1 );
136 path[count++] = QPoint(x, y);
137 }
138 }
139 }
140}
141
142QPointArray SyncDialog::scalePath( const QPointArray &pa, int xn, int xd, int yn, int yd )
143{
144 QPointArray sa( pa.size() );
145
146 for ( unsigned i = 0; i < pa.count(); i++ ) {
147 int x = xn * pa[int(i)].x() / xd;
148 int y = yn * pa[int(i)].y() / yd;
149 sa[int(i)] = QPoint( x, y );
150 }
151
152 return sa;
153}
154
155QPointArray SyncDialog::generatePath( const QPointArray &pa, int dist )
156{
157 if ( pa.count() < 2 )
158 return pa;
159
160 QPointArray fa;
161 int count = 0;
162 fa.resize( count+1 );
163 fa[count++] = pa[0];
164 for ( unsigned i = 0; i < pa.count()-1; i++ ) {
165 int x1 = pa[int(i)].x();
166 int y1 = pa[int(i)].y();
167 int x2 = pa[int(i+1)].x();
168 int y2 = pa[int(i+1)].y();
169 int dx = x2 - x1;
170 int dy = y2 - y1;
171 int pts = (QMAX(QABS(dx),QABS(dy)) + dist/2 )/dist;
172 for ( int j = 1; j < pts; j++ ) {
173 int x = j * dx / pts;
174 int y = j * dy / pts;
175 fa.resize( count+1 );
176 fa[count++] = pa[int(i)] + QPoint( x, y );
177 }
178 fa.resize( count+1 );
179 fa[count++] = pa[int(i+1)];
180 }
181
182 return fa;
183}
184
diff --git a/core/launcher/syncdialog.h b/core/launcher/syncdialog.h
new file mode 100644
index 0000000..36c01fc
--- a/dev/null
+++ b/core/launcher/syncdialog.h
@@ -0,0 +1,58 @@
1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3**
4** This file is part of the 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 SYNCDIALOG_H
22#define SYNCDIALOG_H
23
24#include <qdialog.h>
25#include <qimage.h>
26#include <qpointarray.h>
27
28
29class SyncDialog : public QDialog
30{
31 Q_OBJECT
32public:
33 SyncDialog( QWidget *parent, const QString & );
34
35signals:
36 void cancel();
37
38protected:
39 void paintEvent( QPaintEvent * );
40 void timerEvent( QTimerEvent * );
41
42 void loadPath();
43 QPointArray scalePath( const QPointArray &pa, int xn, int xd, int yn, int yd );
44 QPointArray generatePath( const QPointArray &pa, int dist );
45
46private:
47 QImage img;
48 QImage dot;
49 QString what;
50 QPointArray path;
51 int nextPt;
52 bool rev;
53 bool hideDot;
54};
55
56
57#endif
58