summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Vars.make3
-rw-r--r--config.in4
-rw-r--r--core/applets/batteryapplet/batteryapplet.pro2
-rw-r--r--core/applets/cardmon/cardmon.pro2
-rw-r--r--core/applets/clipboardapplet/clipboardapplet.pro2
-rw-r--r--core/applets/clockapplet/clockapplet.pro2
-rw-r--r--core/applets/homeapplet/homeapplet.pro2
-rw-r--r--core/applets/irdaapplet/irdaapplet.pro2
-rw-r--r--core/applets/logoutapplet/logoutapplet.pro2
-rw-r--r--core/applets/restartapplet/restartapplet.pro2
-rw-r--r--core/applets/restartapplet2/restartapplet.pro2
-rw-r--r--core/applets/rotateapplet/rotateapplet.pro2
-rw-r--r--core/applets/screenshotapplet/screenshotapplet.pro2
-rw-r--r--core/applets/suspendapplet/suspendapplet.pro2
-rw-r--r--core/applets/vmemo/vmemo.pro2
-rw-r--r--core/applets/volumeapplet/volumeapplet.pro2
-rw-r--r--core/launcher/applauncher.cpp4
-rw-r--r--core/launcher/inputmethods.cpp4
-rw-r--r--core/launcher/irserver.cpp4
-rw-r--r--core/launcher/main.cpp2
-rw-r--r--core/launcher/packageslave.cpp304
-rw-r--r--core/launcher/qprocess_unix.cpp3
-rw-r--r--core/launcher/server.pro7
-rw-r--r--core/launcher/startmenu.cpp4
-rw-r--r--core/launcher/systray.cpp5
-rw-r--r--core/launcher/transferserver.cpp3
-rw-r--r--core/multimedia/opieplayer/wavplugin/wavplugin.pro2
-rw-r--r--core/pim/today/plugins/addressbook/addressbook.pro2
-rw-r--r--core/pim/today/plugins/datebook/datebook.pro2
-rw-r--r--core/pim/today/plugins/mail/mail.pro2
-rw-r--r--core/pim/today/plugins/todolist/todolist.pro2
-rw-r--r--core/pim/today/today.cpp7
-rw-r--r--core/qws/transferserver.cpp31
-rw-r--r--core/settings/launcher/menusettings.cpp4
-rw-r--r--core/settings/launcher/taskbarsettings.cpp17
-rw-r--r--development/keyview/keyview.pro4
-rw-r--r--development/macosx/README_MACOSX91
-rw-r--r--development/macosx/config_macosx290
-rw-r--r--include.pro12
-rw-r--r--inputmethods/dasher/dasher.pro2
-rw-r--r--inputmethods/dvorak/dvorak.pro2
-rw-r--r--inputmethods/handwriting/handwriting.pro2
-rw-r--r--inputmethods/jumpx/jumpx.pro2
-rw-r--r--inputmethods/keyboard/keyboard.pro2
-rw-r--r--inputmethods/kjumpx/kjumpx.pro2
-rw-r--r--inputmethods/multikey/multikey.pro2
-rw-r--r--inputmethods/pickboard/pickboard.pro2
-rw-r--r--inputmethods/unikeyboard/unikeyboard.pro2
-rw-r--r--libopie/libopie.pro4
-rw-r--r--libopie/odevice.cpp2
-rw-r--r--library/filemanager.cpp67
-rw-r--r--library/fontdatabase.cpp4
-rw-r--r--library/global.cpp4
-rw-r--r--library/library.pro2
-rw-r--r--library/network.cpp4
-rw-r--r--library/qlibrary_unix.cpp113
-rw-r--r--library/qpeapplication.cpp29
-rw-r--r--library/qpedecoration_qws.cpp8
-rw-r--r--library/sound.cpp3
-rw-r--r--library/storage.cpp42
-rw-r--r--mkspecs/qws/macx-generic-g++/qmake.conf3
-rw-r--r--noncore/applets/networkapplet/networkapplet.pro2
-rw-r--r--noncore/applets/notesapplet/notesapplet.pro2
-rw-r--r--noncore/applets/wirelessapplet/wirelessapplet.pro2
-rw-r--r--noncore/decorations/flat/flat.pro2
-rw-r--r--noncore/decorations/liquid/liquid.pro2
-rw-r--r--noncore/decorations/polished/polished.pro2
-rw-r--r--noncore/net/opietooth/applet/applet.pro2
-rw-r--r--noncore/settings/networksettings/ppp/ppp.pro4
-rw-r--r--noncore/settings/networksettings/wlan/wlan.pro4
-rw-r--r--noncore/styles/flat/flat.pro2
-rw-r--r--noncore/styles/fresh/fresh.pro2
-rw-r--r--noncore/styles/liquid/liquid.pro2
-rw-r--r--noncore/styles/metal/metal.pro2
-rw-r--r--noncore/styles/theme/theme.pro2
-rw-r--r--noncore/todayplugins/fortune/fortune.pro2
-rw-r--r--noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro2
-rw-r--r--noncore/todayplugins/weather/weather.pro2
-rw-r--r--noncore/unsupported/mail2/bend/bend.pro2
-rw-r--r--plugins/Makefile6
-rw-r--r--qmake/include/qglobal.h9
-rw-r--r--qt/qt-2.3.7.patch/qte237-all-macosx.patch1161
-rw-r--r--rsync/config_linux.h2
-rw-r--r--rsync/trace.h40
-rw-r--r--scripts/kconfig/lkc_proto.h4
85 files changed, 2262 insertions, 144 deletions
diff --git a/Vars.make b/Vars.make
index ae54661..062094c 100644
--- a/Vars.make
+++ b/Vars.make
@@ -1,118 +1,121 @@
1ifndef QTDIR 1ifndef QTDIR
2$(error QTDIR not set) 2$(error QTDIR not set)
3endif 3endif
4 4
5prefix=/opt/QtPalmtop 5prefix=/opt/QtPalmtop
6 6
7ifeq ($(OPIEDIR),) 7ifeq ($(OPIEDIR),)
8 export OPIEDIR:=$(TOPDIR) 8 export OPIEDIR:=$(TOPDIR)
9endif 9endif
10ifeq ($(IPK_DIR),) 10ifeq ($(IPK_DIR),)
11 export IPK_DIR:=$(OPIEDIR) 11 export IPK_DIR:=$(OPIEDIR)
12endif 12endif
13 13
14ifneq ($(wildcard $(TOPDIR)/.config),) 14ifneq ($(wildcard $(TOPDIR)/.config),)
15 include $(TOPDIR)/.config 15 include $(TOPDIR)/.config
16endif 16endif
17 17
18ifdef CONFIG_TARGET_X86 18ifdef CONFIG_TARGET_X86
19 PLATFORM=x86-linux 19 PLATFORM=x86-linux
20endif 20endif
21ifdef CONFIG_TARGET_SHARP 21ifdef CONFIG_TARGET_SHARP
22 PLATFORM=sharp-linux 22 PLATFORM=sharp-linux
23endif 23endif
24ifdef CONFIG_TARGET_IPAQ 24ifdef CONFIG_TARGET_IPAQ
25 PLATFORM=ipaq-linux 25 PLATFORM=ipaq-linux
26endif 26endif
27ifdef CONFIG_TARGET_RAMSES 27ifdef CONFIG_TARGET_RAMSES
28 PLATFORM=ramses-linux 28 PLATFORM=ramses-linux
29endif 29endif
30ifdef CONFIG_TARGET_SIMPAD 30ifdef CONFIG_TARGET_SIMPAD
31 PLATFORM=simpad-linux 31 PLATFORM=simpad-linux
32endif 32endif
33 33
34ifdef CONFIG_TARGET_YOPY 34ifdef CONFIG_TARGET_YOPY
35 PLATFORM=yopy-linux 35 PLATFORM=yopy-linux
36endif 36endif
37ifdef CONFIG_TARGET_MACOSX
38 PLATFORM=macx-darwin
39endif
37 40
38export QMAKE:=$(OPIEDIR)/qmake/qmake 41export QMAKE:=$(OPIEDIR)/qmake/qmake
39export QMAKESPECSDIR=$(OPIEDIR)/mkspecs 42export QMAKESPECSDIR=$(OPIEDIR)/mkspecs
40 43
41ifeq ($(QPE_VERSION),) 44ifeq ($(QPE_VERSION),)
42 VERSION_MAJ:=$(shell echo $$(sed -n -e 's/.*QPE_VERSION "\([0-9]*\)\..*\..*".*/\1/p' <$(OPIEDIR)/library/version.h)) 45 VERSION_MAJ:=$(shell echo $$(sed -n -e 's/.*QPE_VERSION "\([0-9]*\)\..*\..*".*/\1/p' <$(OPIEDIR)/library/version.h))
43 VERSION_MIN:=$(shell echo $$(sed -n -e 's/.*QPE_VERSION ".*\.\([0-9]*\)\..*".*/\1/p' <$(OPIEDIR)/library/version.h)) 46 VERSION_MIN:=$(shell echo $$(sed -n -e 's/.*QPE_VERSION ".*\.\([0-9]*\)\..*".*/\1/p' <$(OPIEDIR)/library/version.h))
44 VERSION_PAT:=$(shell echo $$(sed -n -e 's/.*QPE_VERSION ".*\..*\.\([0-9]*\).*/\1/p' <$(OPIEDIR)/library/version.h)) 47 VERSION_PAT:=$(shell echo $$(sed -n -e 's/.*QPE_VERSION ".*\..*\.\([0-9]*\).*/\1/p' <$(OPIEDIR)/library/version.h))
45 QPE_VERSION:=$(VERSION_MAJ).$(VERSION_MIN).$(VERSION_PAT) 48 QPE_VERSION:=$(VERSION_MAJ).$(VERSION_MIN).$(VERSION_PAT)
46 49
47 ifeq ($(QPE_VERSION),..) 50 ifeq ($(QPE_VERSION),..)
48 QPE_VERSION=0.9.3 51 QPE_VERSION=0.9.3
49 endif 52 endif
50endif 53endif
51export QPE_VERSION 54export QPE_VERSION
52 55
53SUB_VERSION=$(shell echo $$(sed -n -e 's,.*SUB_VERSION \"\(.*\)\".*,\1,p' <$(OPIEDIR)/library/version.h)) 56SUB_VERSION=$(shell echo $$(sed -n -e 's,.*SUB_VERSION \"\(.*\)\".*,\1,p' <$(OPIEDIR)/library/version.h))
54ifeq ($(VERSION_CVS),) 57ifeq ($(VERSION_CVS),)
55 VERSION_CVS:=$(shell date +%Y%m%d) 58 VERSION_CVS:=$(shell date +%Y%m%d)
56endif 59endif
57ifneq ($(filter %snapshot",$(shell cat $(OPIEDIR)/library/version.h|grep QPE_VERSION)),) 60ifneq ($(filter %snapshot",$(shell cat $(OPIEDIR)/library/version.h|grep QPE_VERSION)),)
58 SUB_VERSION:=$(VERSION_CVS) 61 SUB_VERSION:=$(VERSION_CVS)
59endif 62endif
60export SUB_VERSION 63export SUB_VERSION
61 64
62ifneq ($(strip $(SUB_VERSION)),) 65ifneq ($(strip $(SUB_VERSION)),)
63EXTRAVERSION=-$(SUB_VERSION) 66EXTRAVERSION=-$(SUB_VERSION)
64endif 67endif
65 68
66ifeq ($(QTE_REVISION),) 69ifeq ($(QTE_REVISION),)
67 QTE_REVISION=5 70 QTE_REVISION=5
68endif 71endif
69export QTE_REVISION 72export QTE_REVISION
70 73
71export DEB_VERSION=2.0 74export DEB_VERSION=2.0
72 75
73ifeq ($(QTE_BASEVERSION),) 76ifeq ($(QTE_BASEVERSION),)
74 ifneq ($(shell ls $(QTDIR)/include/qglobal.h 2>/dev/null),) 77 ifneq ($(shell ls $(QTDIR)/include/qglobal.h 2>/dev/null),)
75 QTE_BASEVERSION:=$(shell cat $(QTDIR)/include/qglobal.h|grep '^\#define QT_VERSION'|grep -v STR|sed -e 's/\#define QT_VERSION\t*//; s/.*\([0-9]\)\([0-9]\)\([0-9]\).*/\1.\2.\3/;') 78 QTE_BASEVERSION:=$(shell cat $(QTDIR)/include/qglobal.h|grep '^\#define QT_VERSION'|grep -v STR|sed -e 's/\#define QT_VERSION\t*//; s/.*\([0-9]\)\([0-9]\)\([0-9]\).*/\1.\2.\3/;')
76 else 79 else
77 QTE_BASEVERSION=2.3.5 80 QTE_BASEVERSION=2.3.5
78 endif 81 endif
79endif 82endif
80export QTE_BASEVERSION 83export QTE_BASEVERSION
81 84
82ifeq ($(QTE_VERSION),) 85ifeq ($(QTE_VERSION),)
83 ifneq ($(shell ls $(QTDIR)/include/qglobal.h 2>/dev/null),) 86 ifneq ($(shell ls $(QTDIR)/include/qglobal.h 2>/dev/null),)
84 QTE_VERSION:=$(shell cat $(QTDIR)/include/qglobal.h|grep '^\#define QT_VERSION_STR'|sed -e 's/\#define QT_VERSION_STR\t*//;' -e 's/.*"\([^"]*\)".*/\1/;') 87 QTE_VERSION:=$(shell cat $(QTDIR)/include/qglobal.h|grep '^\#define QT_VERSION_STR'|sed -e 's/\#define QT_VERSION_STR\t*//;' -e 's/.*"\([^"]*\)".*/\1/;')
85 else 88 else
86 QTE_VERSION=2.3.5 89 QTE_VERSION=2.3.5
87 endif 90 endif
88endif 91endif
89export QTE_VERSION 92export QTE_VERSION
90 93
91export PATH:=$(OPIEDIR)/scripts:$(PATH) 94export PATH:=$(OPIEDIR)/scripts:$(PATH)
92export QMAKESPEC=$(QMAKESPECSDIR)/$(patsubst "%",%,$(CONFIG_SPECFILE)) 95export QMAKESPEC=$(QMAKESPECSDIR)/$(patsubst "%",%,$(CONFIG_SPECFILE))
93 96
94ifdef CONFIG_OPTIMIZATIONS 97ifdef CONFIG_OPTIMIZATIONS
95export CFLAGS_RELEASE=$(patsubst "%,%,$(CONFIG_OPTIMIZATIONS)) 98export CFLAGS_RELEASE=$(patsubst "%,%,$(CONFIG_OPTIMIZATIONS))
96export CFLAGS_RELEASE:=$(patsubst %",%,$(CFLAGS_RELEASE)) 99export CFLAGS_RELEASE:=$(patsubst %",%,$(CFLAGS_RELEASE))
97endif 100endif
98 101
99ifeq ($(STRIP),) 102ifeq ($(STRIP),)
100 ifneq ($(CONFIG_TARGET_X86),) 103 ifneq ($(CONFIG_TARGET_X86),)
101 STRIP=strip 104 STRIP=strip
102 endif 105 endif
103 ifneq ($(CONFIG_TARGET_IPAQ),) 106 ifneq ($(CONFIG_TARGET_IPAQ),)
104 STRIP=arm-linux-strip 107 STRIP=arm-linux-strip
105 endif 108 endif
106 ifneq ($(CONFIG_TARGET_SHARP),) 109 ifneq ($(CONFIG_TARGET_SHARP),)
107 STRIP=arm-linux-strip 110 STRIP=arm-linux-strip
108 endif 111 endif
109 ifneq ($(CONFIG_TARGET_RAMSES),) 112 ifneq ($(CONFIG_TARGET_RAMSES),)
110 STRIP=arm-linux-strip 113 STRIP=arm-linux-strip
111 endif 114 endif
112 ifneq ($(CONFIG_TARGET_SIMPAD),) 115 ifneq ($(CONFIG_TARGET_SIMPAD),)
113 STRIP=arm-linux-strip 116 STRIP=arm-linux-strip
114 endif 117 endif
115 ifneq ($(CONFIG_TARGET_YOPY),) 118 ifneq ($(CONFIG_TARGET_YOPY),)
116 STRIP=arm-linux-strip 119 STRIP=arm-linux-strip
117 endif 120 endif
118endif 121endif
diff --git a/config.in b/config.in
index 4db0204..20fcf56 100644
--- a/config.in
+++ b/config.in
@@ -1,190 +1,194 @@
1mainmenu "Opie Configuration" 1mainmenu "Opie Configuration"
2 2
3menu "Build Parameters" 3menu "Build Parameters"
4 4
5choice 5choice
6 prompt "Target Machine" 6 prompt "Target Machine"
7 default TARGET_X86 7 default TARGET_X86
8 help 8 help
9 Please select the architecture of the machine you will be 9 Please select the architecture of the machine you will be
10 building the OpenZaurus buildroot for. 10 building the OpenZaurus buildroot for.
11 11
12 config TARGET_X86 12 config TARGET_X86
13 boolean "Intel X86" 13 boolean "Intel X86"
14 14
15 config TARGET_MACOSX
16 boolean "Mac OS X (DARWIN)"
17
15 config TARGET_SHARP 18 config TARGET_SHARP
16 boolean "Sharp Zaurus" 19 boolean "Sharp Zaurus"
17 20
18 config TARGET_IPAQ 21 config TARGET_IPAQ
19 boolean "iPAQ" 22 boolean "iPAQ"
20 23
21 config TARGET_RAMSES 24 config TARGET_RAMSES
22 boolean "Ramses" 25 boolean "Ramses"
23 26
24 config TARGET_SIMPAD 27 config TARGET_SIMPAD
25 boolean "SIMpad" 28 boolean "SIMpad"
26 29
27 config TARGET_YOPY 30 config TARGET_YOPY
28 boolean "Yopy 3500/3700" 31 boolean "Yopy 3500/3700"
29 32
30endchoice 33endchoice
31 34
32config OPTIMIZE 35config OPTIMIZE
33 boolean "Use optimizations" 36 boolean "Use optimizations"
34 default "y" if ! TARGET_X86 37 default "y" if ! TARGET_X86
35 38
36config DEBUG 39config DEBUG
37 boolean "Enable debug builds" 40 boolean "Enable debug builds"
38 default n 41 default n
39config RELEASE 42config RELEASE
40 bool 43 bool
41 default y 44 default y
42 depends !DEBUG 45 depends !DEBUG
43 46
44config QUICK_LAUNCH 47config QUICK_LAUNCH
45 boolean "Enable Quick Launch" 48 boolean "Enable Quick Launch"
46 default n 49 default n
47 50
48config OPIE_NO_OVERRIDE_QT 51config OPIE_NO_OVERRIDE_QT
49 boolean "Build Opie against an unpatched version of Qt" 52 boolean "Build Opie against an unpatched version of Qt"
50 default n 53 default n
51 54
52config SPECFILE 55config SPECFILE
53 string 56 string
54 default "qws/linux-generic-g++" if TARGET_X86 && (! X11) 57 default "qws/linux-generic-g++" if TARGET_X86 && (! X11)
55 default "linux-g++" if TARGET_X86 && X11 58 default "linux-g++" if TARGET_X86 && X11
56 default "qws/linux-sharp-g++" if TARGET_SHARP && (! X11) 59 default "qws/linux-sharp-g++" if TARGET_SHARP && (! X11)
57 default "linux-g++" if TARGET_SHARP && X11 60 default "linux-g++" if TARGET_SHARP && X11
58 default "qws/linux-ipaq-g++" if TARGET_IPAQ && (! X11) 61 default "qws/linux-ipaq-g++" if TARGET_IPAQ && (! X11)
59 default "linux-g++" if TARGET_IPAQ && X11 62 default "linux-g++" if TARGET_IPAQ && X11
60 default "qws/linux-ramses-g++" if TARGET_RAMSES && (! X11) 63 default "qws/linux-ramses-g++" if TARGET_RAMSES && (! X11)
61 default "linux-g++" if TARGET_RAMSES && X11 64 default "linux-g++" if TARGET_RAMSES && X11
62 default "qws/linux-simpad-g++" if TARGET_SIMPAD && (! X11) 65 default "qws/linux-simpad-g++" if TARGET_SIMPAD && (! X11)
63 default "linux-g++" if TARGET_SIMPAD && X11 66 default "linux-g++" if TARGET_SIMPAD && X11
64 default "qws/linux-yopy-g++" if TARGET_YOPY && (! X11) 67 default "qws/linux-yopy-g++" if TARGET_YOPY && (! X11)
68 default "qws/macx-generic-g++" if TARGET_MACOSX && (! X11)
65 69
66config CUSTOMFILE 70config CUSTOMFILE
67 string 71 string
68 default "custom-ipaq.h" if TARGET_IPAQ 72 default "custom-ipaq.h" if TARGET_IPAQ
69 default "custom-sharp.h" if TARGET_SHARP 73 default "custom-sharp.h" if TARGET_SHARP
70 default "custom-ramses.h" if TARGET_RAMSES 74 default "custom-ramses.h" if TARGET_RAMSES
71 default "custom-ipaq.h" if TARGET_SIMPAD 75 default "custom-ipaq.h" if TARGET_SIMPAD
72 default "custom-yopy.h" if TARGET_YOPY 76 default "custom-yopy.h" if TARGET_YOPY
73 77
74config OPTIMIZATIONS 78config OPTIMIZATIONS
75 string "Optimization flags" 79 string "Optimization flags"
76 depends OPTIMIZE 80 depends OPTIMIZE
77 default "-march=armv4 -mtune=strongarm1100 -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_IPAQ 81 default "-march=armv4 -mtune=strongarm1100 -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_IPAQ
78 default "-march=armv4 -mtune=strongarm1100 -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_YOPY 82 default "-march=armv4 -mtune=strongarm1100 -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_YOPY
79 default "-march=armv4 -mtune=strongarm1100 -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_SHARP 83 default "-march=armv4 -mtune=strongarm1100 -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_SHARP
80 default "-march=armv4 -mtune=strongarm1100 -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_RAMSES 84 default "-march=armv4 -mtune=strongarm1100 -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_RAMSES
81 default "-march=armv4 -mtune=strongarm1100 -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_SIMPAD 85 default "-march=armv4 -mtune=strongarm1100 -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_SIMPAD
82 86
83config EXPERIMENTAL 87config EXPERIMENTAL
84 bool "Prompt for development and/or incomplete items" 88 bool "Prompt for development and/or incomplete items"
85 default y 89 default y
86 90
87endmenu 91endmenu
88 92
89menu "Base" 93menu "Base"
90 choice 94 choice
91 prompt "Qpe Library Selection" 95 prompt "Qpe Library Selection"
92 default LIBQPE 96 default LIBQPE
93 source library/config.in 97 source library/config.in
94 source x11/config.in 98 source x11/config.in
95 endchoice 99 endchoice
96 source libopie/config.in 100 source libopie/config.in
97 source core/opie-login/config.in 101 source core/opie-login/config.in
98 source core/opiealarm/config.in 102 source core/opiealarm/config.in
99 source core/launcher/config.in 103 source core/launcher/config.in
100 source core/qws/config.in 104 source core/qws/config.in
101endmenu 105endmenu
102 106
103comment "" 107comment ""
104 108
105menu "Applets" 109menu "Applets"
106 source core/applets/config.in 110 source core/applets/config.in
107 source noncore/applets/config.in 111 source noncore/applets/config.in
108endmenu 112endmenu
109 113
110menu "Apps" 114menu "Apps"
111 source core/apps/config.in 115 source core/apps/config.in
112 source noncore/apps/config.in 116 source noncore/apps/config.in
113endmenu 117endmenu
114 118
115menu "Communications and Networking" 119menu "Communications and Networking"
116 source noncore/comm/config.in 120 source noncore/comm/config.in
117 source noncore/mail/config.in 121 source noncore/mail/config.in
118 source noncore/net/config.in 122 source noncore/net/config.in
119endmenu 123endmenu
120 124
121menu "Games" 125menu "Games"
122 source noncore/games/config.in 126 source noncore/games/config.in
123endmenu 127endmenu
124 128
125menu "Graphics and Multimedia" 129menu "Graphics and Multimedia"
126 source freetype/config.in 130 source freetype/config.in
127 source noncore/graphics/config.in 131 source noncore/graphics/config.in
128 source core/multimedia/config.in 132 source core/multimedia/config.in
129 source noncore/multimedia/config.in 133 source noncore/multimedia/config.in
130endmenu 134endmenu
131 135
132menu "Input methods" 136menu "Input methods"
133 source inputmethods/config.in 137 source inputmethods/config.in
134endmenu 138endmenu
135 139
136menu "Pim" 140menu "Pim"
137 source core/pim/config.in 141 source core/pim/config.in
138 menu "Today Plugins" 142 menu "Today Plugins"
139 source noncore/todayplugins/config.in 143 source noncore/todayplugins/config.in
140 source core/pim/today/plugins/config.in 144 source core/pim/today/plugins/config.in
141 endmenu 145 endmenu
142endmenu 146endmenu
143 147
144menu "Settings" 148menu "Settings"
145 source core/settings/config.in 149 source core/settings/config.in
146 source noncore/settings/config.in 150 source noncore/settings/config.in
147endmenu 151endmenu
148 152
149menu "Theming" 153menu "Theming"
150 source noncore/decorations/config.in 154 source noncore/decorations/config.in
151 source noncore/styles/config.in 155 source noncore/styles/config.in
152endmenu 156endmenu
153 157
154menu "Tools" 158menu "Tools"
155 source noncore/tools/config.in 159 source noncore/tools/config.in
156endmenu 160endmenu
157 161
158menu "Development" 162menu "Development"
159 source development/keyview/config.in 163 source development/keyview/config.in
160 #source development/debugviewer/config.in 164 #source development/debugviewer/config.in
161endmenu 165endmenu
162 166
163menu "Examples" 167menu "Examples"
164 config EXAMPLES 168 config EXAMPLES
165 boolean "Compile Example Application" 169 boolean "Compile Example Application"
166 source examples/config.in 170 source examples/config.in
167endmenu 171endmenu
168 172
169comment "" 173comment ""
170 depends on EXPERIMENTAL 174 depends on EXPERIMENTAL
171menu "Experimental" 175menu "Experimental"
172 depends on EXPERIMENTAL 176 depends on EXPERIMENTAL
173 source libopie2/config.in 177 source libopie2/config.in
174 178
175 config SQL_PIM_BACKEND 179 config SQL_PIM_BACKEND
176 bool "Add SQL-Backend support (experimental)" 180 bool "Add SQL-Backend support (experimental)"
177 default n 181 default n
178 help 182 help
179 This adds the SQL-Support, using SQLite. Which database is used 183 This adds the SQL-Support, using SQLite. Which database is used
180 by the backends is defined by the file "pimaccess.conf" in the 184 by the backends is defined by the file "pimaccess.conf" in the
181 directory "Settings". 185 directory "Settings".
182 There currently do exist to groups "[contact]" and "[todo]". You can 186 There currently do exist to groups "[contact]" and "[todo]". You can
183 select the used backend by the variable "usebackend=<type>", where 187 select the used backend by the variable "usebackend=<type>", where
184 <type> is "sql" or "xml". "xml" is the default ! 188 <type> is "sql" or "xml". "xml" is the default !
185 Important: The SQLite-library "libsqlite.so" must be installed ! 189 Important: The SQLite-library "libsqlite.so" must be installed !
186 depends ( LIBOPIE2DB ) 190 depends ( LIBOPIE2DB )
187 191
188 comment "SQL-Support needs libopie2db!" 192 comment "SQL-Support needs libopie2db!"
189 depends !( LIBOPIE2DB ) 193 depends !( LIBOPIE2DB )
190endmenu 194endmenu
diff --git a/core/applets/batteryapplet/batteryapplet.pro b/core/applets/batteryapplet/batteryapplet.pro
index c68ceb7..1bc208b 100644
--- a/core/applets/batteryapplet/batteryapplet.pro
+++ b/core/applets/batteryapplet/batteryapplet.pro
@@ -1,33 +1,33 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt warn_on release 2 CONFIG += qt plugin warn_on release
3 HEADERS= battery.h batterystatus.h batteryappletimpl.h 3 HEADERS= battery.h batterystatus.h batteryappletimpl.h
4 SOURCES= battery.cpp batterystatus.cpp batteryappletimpl.cpp 4 SOURCES= battery.cpp batterystatus.cpp batteryappletimpl.cpp
5 TARGET = batteryapplet 5 TARGET = batteryapplet
6 DESTDIR = $(OPIEDIR)/plugins/applets 6 DESTDIR = $(OPIEDIR)/plugins/applets
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += ../$(OPIEDIR)/include .. 8DEPENDPATH += ../$(OPIEDIR)/include ..
9LIBS += -lqpe -lopie 9LIBS += -lqpe -lopie
10 VERSION = 1.0.0 10 VERSION = 1.0.0
11 11
12TRANSLATIONS = ../../../i18n/de/libbatteryapplet.ts \ 12TRANSLATIONS = ../../../i18n/de/libbatteryapplet.ts \
13 ../../../i18n/nl/libbatteryapplet.ts \ 13 ../../../i18n/nl/libbatteryapplet.ts \
14 ../../../i18n/da/libbatteryapplet.ts \ 14 ../../../i18n/da/libbatteryapplet.ts \
15 ../../../i18n/xx/libbatteryapplet.ts \ 15 ../../../i18n/xx/libbatteryapplet.ts \
16 ../../../i18n/en/libbatteryapplet.ts \ 16 ../../../i18n/en/libbatteryapplet.ts \
17 ../../../i18n/es/libbatteryapplet.ts \ 17 ../../../i18n/es/libbatteryapplet.ts \
18 ../../../i18n/fr/libbatteryapplet.ts \ 18 ../../../i18n/fr/libbatteryapplet.ts \
19 ../../../i18n/hu/libbatteryapplet.ts \ 19 ../../../i18n/hu/libbatteryapplet.ts \
20 ../../../i18n/ja/libbatteryapplet.ts \ 20 ../../../i18n/ja/libbatteryapplet.ts \
21 ../../../i18n/ko/libbatteryapplet.ts \ 21 ../../../i18n/ko/libbatteryapplet.ts \
22 ../../../i18n/no/libbatteryapplet.ts \ 22 ../../../i18n/no/libbatteryapplet.ts \
23 ../../../i18n/pl/libbatteryapplet.ts \ 23 ../../../i18n/pl/libbatteryapplet.ts \
24 ../../../i18n/pt/libbatteryapplet.ts \ 24 ../../../i18n/pt/libbatteryapplet.ts \
25 ../../../i18n/pt_BR/libbatteryapplet.ts \ 25 ../../../i18n/pt_BR/libbatteryapplet.ts \
26 ../../../i18n/sl/libbatteryapplet.ts \ 26 ../../../i18n/sl/libbatteryapplet.ts \
27 ../../../i18n/zh_CN/libbatteryapplet.ts \ 27 ../../../i18n/zh_CN/libbatteryapplet.ts \
28 ../../../i18n/zh_TW/libbatteryapplet.ts 28 ../../../i18n/zh_TW/libbatteryapplet.ts
29 29
30 30
31 31
32include ( $(OPIEDIR)/include.pro ) 32include ( $(OPIEDIR)/include.pro )
33target.path = $$prefix/plugins/applets 33target.path = $$prefix/plugins/applets
diff --git a/core/applets/cardmon/cardmon.pro b/core/applets/cardmon/cardmon.pro
index 3907aa4..75facde 100644
--- a/core/applets/cardmon/cardmon.pro
+++ b/core/applets/cardmon/cardmon.pro
@@ -1,33 +1,33 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt warn_on release 2 CONFIG += qt plugin warn_on release
3 HEADERS =cardmon.h cardmonimpl.h 3 HEADERS =cardmon.h cardmonimpl.h
4 SOURCES =cardmon.cpp cardmonimpl.cpp 4 SOURCES =cardmon.cpp cardmonimpl.cpp
5 TARGET = cardmonapplet 5 TARGET = cardmonapplet
6 DESTDIR = $(OPIEDIR)/plugins/applets 6 DESTDIR = $(OPIEDIR)/plugins/applets
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += $(OPIEDIR)/include ../launcher 8DEPENDPATH += $(OPIEDIR)/include ../launcher
9LIBS += -lqpe -lopie 9LIBS += -lqpe -lopie
10 VERSION = 1.0.0 10 VERSION = 1.0.0
11 11
12TRANSLATIONS = ../../../i18n/de/libcardmonapplet.ts \ 12TRANSLATIONS = ../../../i18n/de/libcardmonapplet.ts \
13 ../../../i18n/nl/libcardmonapplet.ts \ 13 ../../../i18n/nl/libcardmonapplet.ts \
14 ../../../i18n/da/libcardmonapplet.ts \ 14 ../../../i18n/da/libcardmonapplet.ts \
15 ../../../i18n/xx/libcardmonapplet.ts \ 15 ../../../i18n/xx/libcardmonapplet.ts \
16 ../../../i18n/en/libcardmonapplet.ts \ 16 ../../../i18n/en/libcardmonapplet.ts \
17 ../../../i18n/es/libcardmonapplet.ts \ 17 ../../../i18n/es/libcardmonapplet.ts \
18 ../../../i18n/fr/libcardmonapplet.ts \ 18 ../../../i18n/fr/libcardmonapplet.ts \
19 ../../../i18n/hu/libcardmonapplet.ts \ 19 ../../../i18n/hu/libcardmonapplet.ts \
20 ../../../i18n/ja/libcardmonapplet.ts \ 20 ../../../i18n/ja/libcardmonapplet.ts \
21 ../../../i18n/ko/libcardmonapplet.ts \ 21 ../../../i18n/ko/libcardmonapplet.ts \
22 ../../../i18n/no/libcardmonapplet.ts \ 22 ../../../i18n/no/libcardmonapplet.ts \
23 ../../../i18n/pl/libcardmonapplet.ts \ 23 ../../../i18n/pl/libcardmonapplet.ts \
24 ../../../i18n/pt/libcardmonapplet.ts \ 24 ../../../i18n/pt/libcardmonapplet.ts \
25 ../../../i18n/pt_BR/libcardmonapplet.ts \ 25 ../../../i18n/pt_BR/libcardmonapplet.ts \
26 ../../../i18n/sl/libcardmonapplet.ts \ 26 ../../../i18n/sl/libcardmonapplet.ts \
27 ../../../i18n/zh_CN/libcardmonapplet.ts \ 27 ../../../i18n/zh_CN/libcardmonapplet.ts \
28 ../../../i18n/zh_TW/libcardmonapplet.ts 28 ../../../i18n/zh_TW/libcardmonapplet.ts
29 29
30 30
31 31
32include ( $(OPIEDIR)/include.pro ) 32include ( $(OPIEDIR)/include.pro )
33target.path = $$prefix/plugins/applets 33target.path = $$prefix/plugins/applets
diff --git a/core/applets/clipboardapplet/clipboardapplet.pro b/core/applets/clipboardapplet/clipboardapplet.pro
index 1e9cc4f..358d658 100644
--- a/core/applets/clipboardapplet/clipboardapplet.pro
+++ b/core/applets/clipboardapplet/clipboardapplet.pro
@@ -1,33 +1,33 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt warn_on release 2 CONFIG += qt plugin warn_on release
3 HEADERS= clipboard.h clipboardappletimpl.h 3 HEADERS= clipboard.h clipboardappletimpl.h
4 SOURCES= clipboard.cpp clipboardappletimpl.cpp 4 SOURCES= clipboard.cpp clipboardappletimpl.cpp
5 TARGET = clipboardapplet 5 TARGET = clipboardapplet
6 DESTDIR = $(OPIEDIR)/plugins/applets 6 DESTDIR = $(OPIEDIR)/plugins/applets
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += ../$(OPIEDIR)/include 8DEPENDPATH += ../$(OPIEDIR)/include
9LIBS += -lqpe 9LIBS += -lqpe
10 VERSION = 1.0.0 10 VERSION = 1.0.0
11 11
12TRANSLATIONS = ../../../i18n/de/libclipboardapplet.ts \ 12TRANSLATIONS = ../../../i18n/de/libclipboardapplet.ts \
13 ../../../i18n/nl/libclipboardapplet.ts \ 13 ../../../i18n/nl/libclipboardapplet.ts \
14 ../../../i18n/da/libclipboardapplet.ts \ 14 ../../../i18n/da/libclipboardapplet.ts \
15 ../../../i18n/xx/libclipboardapplet.ts \ 15 ../../../i18n/xx/libclipboardapplet.ts \
16 ../../../i18n/en/libclipboardapplet.ts \ 16 ../../../i18n/en/libclipboardapplet.ts \
17 ../../../i18n/es/libclipboardapplet.ts \ 17 ../../../i18n/es/libclipboardapplet.ts \
18 ../../../i18n/fr/libclipboardapplet.ts \ 18 ../../../i18n/fr/libclipboardapplet.ts \
19 ../../../i18n/hu/libclipboardapplet.ts \ 19 ../../../i18n/hu/libclipboardapplet.ts \
20 ../../../i18n/ja/libclipboardapplet.ts \ 20 ../../../i18n/ja/libclipboardapplet.ts \
21 ../../../i18n/ko/libclipboardapplet.ts \ 21 ../../../i18n/ko/libclipboardapplet.ts \
22 ../../../i18n/no/libclipboardapplet.ts \ 22 ../../../i18n/no/libclipboardapplet.ts \
23 ../../../i18n/pl/libclipboardapplet.ts \ 23 ../../../i18n/pl/libclipboardapplet.ts \
24 ../../../i18n/pt/libclipboardapplet.ts \ 24 ../../../i18n/pt/libclipboardapplet.ts \
25 ../../../i18n/pt_BR/libclipboardapplet.ts \ 25 ../../../i18n/pt_BR/libclipboardapplet.ts \
26 ../../../i18n/sl/libclipboardapplet.ts \ 26 ../../../i18n/sl/libclipboardapplet.ts \
27 ../../../i18n/zh_CN/libclipboardapplet.ts \ 27 ../../../i18n/zh_CN/libclipboardapplet.ts \
28 ../../../i18n/zh_TW/libclipboardapplet.ts 28 ../../../i18n/zh_TW/libclipboardapplet.ts
29 29
30 30
31 31
32include ( $(OPIEDIR)/include.pro ) 32include ( $(OPIEDIR)/include.pro )
33target.path = $$prefix/plugins/applets 33target.path = $$prefix/plugins/applets
diff --git a/core/applets/clockapplet/clockapplet.pro b/core/applets/clockapplet/clockapplet.pro
index 22c7b55..88092f5 100644
--- a/core/applets/clockapplet/clockapplet.pro
+++ b/core/applets/clockapplet/clockapplet.pro
@@ -1,33 +1,33 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt warn_on release 2 CONFIG += qt plugin warn_on release
3 HEADERS= clock.h clockappletimpl.h 3 HEADERS= clock.h clockappletimpl.h
4 SOURCES= clock.cpp clockappletimpl.cpp 4 SOURCES= clock.cpp clockappletimpl.cpp
5 TARGET = clockapplet 5 TARGET = clockapplet
6 DESTDIR = $(OPIEDIR)/plugins/applets 6 DESTDIR = $(OPIEDIR)/plugins/applets
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += ../$(OPIEDIR)/include .. 8DEPENDPATH += ../$(OPIEDIR)/include ..
9LIBS += -lqpe 9LIBS += -lqpe
10 VERSION = 1.0.0 10 VERSION = 1.0.0
11 11
12TRANSLATIONS = ../../../i18n/de/libclockapplet.ts \ 12TRANSLATIONS = ../../../i18n/de/libclockapplet.ts \
13 ../../../i18n/nl/libclockapplet.ts \ 13 ../../../i18n/nl/libclockapplet.ts \
14 ../../../i18n/da/libclockapplet.ts \ 14 ../../../i18n/da/libclockapplet.ts \
15 ../../../i18n/xx/libclockapplet.ts \ 15 ../../../i18n/xx/libclockapplet.ts \
16 ../../../i18n/en/libclockapplet.ts \ 16 ../../../i18n/en/libclockapplet.ts \
17 ../../../i18n/es/libclockapplet.ts \ 17 ../../../i18n/es/libclockapplet.ts \
18 ../../../i18n/fr/libclockapplet.ts \ 18 ../../../i18n/fr/libclockapplet.ts \
19 ../../../i18n/hu/libclockapplet.ts \ 19 ../../../i18n/hu/libclockapplet.ts \
20 ../../../i18n/ja/libclockapplet.ts \ 20 ../../../i18n/ja/libclockapplet.ts \
21 ../../../i18n/ko/libclockapplet.ts \ 21 ../../../i18n/ko/libclockapplet.ts \
22 ../../../i18n/no/libclockapplet.ts \ 22 ../../../i18n/no/libclockapplet.ts \
23 ../../../i18n/pl/libclockapplet.ts \ 23 ../../../i18n/pl/libclockapplet.ts \
24 ../../../i18n/pt/libclockapplet.ts \ 24 ../../../i18n/pt/libclockapplet.ts \
25 ../../../i18n/pt_BR/libclockapplet.ts \ 25 ../../../i18n/pt_BR/libclockapplet.ts \
26 ../../../i18n/sl/libclockapplet.ts \ 26 ../../../i18n/sl/libclockapplet.ts \
27 ../../../i18n/zh_CN/libclockapplet.ts \ 27 ../../../i18n/zh_CN/libclockapplet.ts \
28 ../../../i18n/zh_TW/libclockapplet.ts 28 ../../../i18n/zh_TW/libclockapplet.ts
29 29
30 30
31 31
32include ( $(OPIEDIR)/include.pro ) 32include ( $(OPIEDIR)/include.pro )
33target.path = $$prefix/plugins/applets 33target.path = $$prefix/plugins/applets
diff --git a/core/applets/homeapplet/homeapplet.pro b/core/applets/homeapplet/homeapplet.pro
index ac7956b..854050f 100644
--- a/core/applets/homeapplet/homeapplet.pro
+++ b/core/applets/homeapplet/homeapplet.pro
@@ -1,33 +1,33 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on release 2CONFIG += qt plugin warn_on release
3HEADERS = home.h 3HEADERS = home.h
4SOURCES = home.cpp 4SOURCES = home.cpp
5TARGET = homeapplet 5TARGET = homeapplet
6DESTDIR = $(OPIEDIR)/plugins/applets 6DESTDIR = $(OPIEDIR)/plugins/applets
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += $(OPIEDIR)/include 8DEPENDPATH += $(OPIEDIR)/include
9LIBS += -lqpe 9LIBS += -lqpe
10VERSION = 1.0.0 10VERSION = 1.0.0
11 11
12TRANSLATIONS = ../../../i18n/de/libhomeapplet.ts \ 12TRANSLATIONS = ../../../i18n/de/libhomeapplet.ts \
13 ../../../i18n/nl/libhomeapplet.ts \ 13 ../../../i18n/nl/libhomeapplet.ts \
14 ../../../i18n/da/libhomeapplet.ts \ 14 ../../../i18n/da/libhomeapplet.ts \
15 ../../../i18n/xx/libhomeapplet.ts \ 15 ../../../i18n/xx/libhomeapplet.ts \
16 ../../../i18n/en/libhomeapplet.ts \ 16 ../../../i18n/en/libhomeapplet.ts \
17 ../../../i18n/es/libhomeapplet.ts \ 17 ../../../i18n/es/libhomeapplet.ts \
18 ../../../i18n/fr/libhomeapplet.ts \ 18 ../../../i18n/fr/libhomeapplet.ts \
19 ../../../i18n/hu/libhomeapplet.ts \ 19 ../../../i18n/hu/libhomeapplet.ts \
20 ../../../i18n/ja/libhomeapplet.ts \ 20 ../../../i18n/ja/libhomeapplet.ts \
21 ../../../i18n/ko/libhomeapplet.ts \ 21 ../../../i18n/ko/libhomeapplet.ts \
22 ../../../i18n/no/libhomeapplet.ts \ 22 ../../../i18n/no/libhomeapplet.ts \
23 ../../../i18n/pl/libhomeapplet.ts \ 23 ../../../i18n/pl/libhomeapplet.ts \
24 ../../../i18n/pt/libhomeapplet.ts \ 24 ../../../i18n/pt/libhomeapplet.ts \
25 ../../../i18n/pt_BR/libhomeapplet.ts \ 25 ../../../i18n/pt_BR/libhomeapplet.ts \
26 ../../../i18n/sl/libhomeapplet.ts \ 26 ../../../i18n/sl/libhomeapplet.ts \
27 ../../../i18n/zh_CN/libhomeapplet.ts \ 27 ../../../i18n/zh_CN/libhomeapplet.ts \
28 ../../../i18n/zh_TW/libhomeapplet.ts 28 ../../../i18n/zh_TW/libhomeapplet.ts
29 29
30 30
31 31
32include ( $(OPIEDIR)/include.pro ) 32include ( $(OPIEDIR)/include.pro )
33target.path = $$prefix/plugins/applets 33target.path = $$prefix/plugins/applets
diff --git a/core/applets/irdaapplet/irdaapplet.pro b/core/applets/irdaapplet/irdaapplet.pro
index 56632ed..be16bad 100644
--- a/core/applets/irdaapplet/irdaapplet.pro
+++ b/core/applets/irdaapplet/irdaapplet.pro
@@ -1,33 +1,33 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on release 2CONFIG += qt plugin warn_on release
3HEADERS = irda.h irdaappletimpl.h 3HEADERS = irda.h irdaappletimpl.h
4SOURCES = irda.cpp irdaappletimpl.cpp 4SOURCES = irda.cpp irdaappletimpl.cpp
5TARGET = irdaapplet 5TARGET = irdaapplet
6DESTDIR = $(OPIEDIR)/plugins/applets 6DESTDIR = $(OPIEDIR)/plugins/applets
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += ../$(OPIEDIR)/include 8DEPENDPATH += ../$(OPIEDIR)/include
9LIBS += -lqpe 9LIBS += -lqpe
10VERSION = 1.0.0 10VERSION = 1.0.0
11 11
12TRANSLATIONS = ../../../i18n/de/libirdaapplet.ts \ 12TRANSLATIONS = ../../../i18n/de/libirdaapplet.ts \
13 ../../../i18n/nl/libirdaapplet.ts \ 13 ../../../i18n/nl/libirdaapplet.ts \
14 ../../../i18n/da/libirdaapplet.ts \ 14 ../../../i18n/da/libirdaapplet.ts \
15 ../../../i18n/xx/libirdaapplet.ts \ 15 ../../../i18n/xx/libirdaapplet.ts \
16 ../../../i18n/en/libirdaapplet.ts \ 16 ../../../i18n/en/libirdaapplet.ts \
17 ../../../i18n/es/libirdaapplet.ts \ 17 ../../../i18n/es/libirdaapplet.ts \
18 ../../../i18n/fr/libirdaapplet.ts \ 18 ../../../i18n/fr/libirdaapplet.ts \
19 ../../../i18n/hu/libirdaapplet.ts \ 19 ../../../i18n/hu/libirdaapplet.ts \
20 ../../../i18n/ja/libirdaapplet.ts \ 20 ../../../i18n/ja/libirdaapplet.ts \
21 ../../../i18n/ko/libirdaapplet.ts \ 21 ../../../i18n/ko/libirdaapplet.ts \
22 ../../../i18n/no/libirdaapplet.ts \ 22 ../../../i18n/no/libirdaapplet.ts \
23 ../../../i18n/pl/libirdaapplet.ts \ 23 ../../../i18n/pl/libirdaapplet.ts \
24 ../../../i18n/pt/libirdaapplet.ts \ 24 ../../../i18n/pt/libirdaapplet.ts \
25 ../../../i18n/pt_BR/libirdaapplet.ts \ 25 ../../../i18n/pt_BR/libirdaapplet.ts \
26 ../../../i18n/sl/libirdaapplet.ts \ 26 ../../../i18n/sl/libirdaapplet.ts \
27 ../../../i18n/zh_CN/libirdaapplet.ts \ 27 ../../../i18n/zh_CN/libirdaapplet.ts \
28 ../../../i18n/zh_TW/libirdaapplet.ts 28 ../../../i18n/zh_TW/libirdaapplet.ts
29 29
30 30
31 31
32include ( $(OPIEDIR)/include.pro ) 32include ( $(OPIEDIR)/include.pro )
33target.path = $$prefix/plugins/applets 33target.path = $$prefix/plugins/applets
diff --git a/core/applets/logoutapplet/logoutapplet.pro b/core/applets/logoutapplet/logoutapplet.pro
index a019303..7826bb3 100644
--- a/core/applets/logoutapplet/logoutapplet.pro
+++ b/core/applets/logoutapplet/logoutapplet.pro
@@ -1,33 +1,33 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on release 2CONFIG += qt plugin warn_on release
3HEADERS = logout.h 3HEADERS = logout.h
4SOURCES = logout.cpp 4SOURCES = logout.cpp
5TARGET = logoutapplet 5TARGET = logoutapplet
6DESTDIR = $(OPIEDIR)/plugins/applets 6DESTDIR = $(OPIEDIR)/plugins/applets
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += $(OPIEDIR)/include 8DEPENDPATH += $(OPIEDIR)/include
9LIBS += -lqpe 9LIBS += -lqpe
10VERSION = 1.0.0 10VERSION = 1.0.0
11 11
12TRANSLATIONS = ../../../i18n/de/liblogoutapplet.ts \ 12TRANSLATIONS = ../../../i18n/de/liblogoutapplet.ts \
13 ../../../i18n/nl/liblogoutapplet.ts \ 13 ../../../i18n/nl/liblogoutapplet.ts \
14 ../../../i18n/da/liblogoutapplet.ts \ 14 ../../../i18n/da/liblogoutapplet.ts \
15 ../../../i18n/xx/liblogoutapplet.ts \ 15 ../../../i18n/xx/liblogoutapplet.ts \
16 ../../../i18n/en/liblogoutapplet.ts \ 16 ../../../i18n/en/liblogoutapplet.ts \
17 ../../../i18n/es/liblogoutapplet.ts \ 17 ../../../i18n/es/liblogoutapplet.ts \
18 ../../../i18n/fr/liblogoutapplet.ts \ 18 ../../../i18n/fr/liblogoutapplet.ts \
19 ../../../i18n/hu/liblogoutapplet.ts \ 19 ../../../i18n/hu/liblogoutapplet.ts \
20 ../../../i18n/ja/liblogoutapplet.ts \ 20 ../../../i18n/ja/liblogoutapplet.ts \
21 ../../../i18n/ko/liblogoutapplet.ts \ 21 ../../../i18n/ko/liblogoutapplet.ts \
22 ../../../i18n/no/liblogoutapplet.ts \ 22 ../../../i18n/no/liblogoutapplet.ts \
23 ../../../i18n/pl/liblogoutapplet.ts \ 23 ../../../i18n/pl/liblogoutapplet.ts \
24 ../../../i18n/pt/liblogoutapplet.ts \ 24 ../../../i18n/pt/liblogoutapplet.ts \
25 ../../../i18n/pt_BR/liblogoutapplet.ts \ 25 ../../../i18n/pt_BR/liblogoutapplet.ts \
26 ../../../i18n/sl/liblogoutapplet.ts \ 26 ../../../i18n/sl/liblogoutapplet.ts \
27 ../../../i18n/zh_CN/liblogoutapplet.ts \ 27 ../../../i18n/zh_CN/liblogoutapplet.ts \
28 ../../../i18n/zh_TW/liblogoutapplet.ts 28 ../../../i18n/zh_TW/liblogoutapplet.ts
29 29
30 30
31 31
32include ( $(OPIEDIR)/include.pro ) 32include ( $(OPIEDIR)/include.pro )
33target.path = $$prefix/plugins/applets 33target.path = $$prefix/plugins/applets
diff --git a/core/applets/restartapplet/restartapplet.pro b/core/applets/restartapplet/restartapplet.pro
index bd27b0a..368a0ea 100644
--- a/core/applets/restartapplet/restartapplet.pro
+++ b/core/applets/restartapplet/restartapplet.pro
@@ -1,17 +1,17 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on release 2CONFIG += qt plugin warn_on release
3HEADERS = restart.h restartappletimpl.h 3HEADERS = restart.h restartappletimpl.h
4SOURCES = restart.cpp restartappletimpl.cpp 4SOURCES = restart.cpp restartappletimpl.cpp
5TARGET = restartapplet 5TARGET = restartapplet
6DESTDIR = $(OPIEDIR)/plugins/applets 6DESTDIR = $(OPIEDIR)/plugins/applets
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += ../$(OPIEDIR)/include 8DEPENDPATH += ../$(OPIEDIR)/include
9LIBS += -lqpe 9LIBS += -lqpe
10VERSION = 1.0.0 10VERSION = 1.0.0
11MOC_DIR=opieobj 11MOC_DIR=opieobj
12OBJECTS_DIR=opieobj 12OBJECTS_DIR=opieobj
13 13
14 14
15 15
16include ( $(OPIEDIR)/include.pro ) 16include ( $(OPIEDIR)/include.pro )
17target.path = $$prefix/plugins/applets 17target.path = $$prefix/plugins/applets
diff --git a/core/applets/restartapplet2/restartapplet.pro b/core/applets/restartapplet2/restartapplet.pro
index 85a3b66..12a7922 100644
--- a/core/applets/restartapplet2/restartapplet.pro
+++ b/core/applets/restartapplet2/restartapplet.pro
@@ -1,17 +1,17 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on release 2CONFIG += qt plugin warn_on release
3HEADERS = restart.h 3HEADERS = restart.h
4SOURCES = restart.cpp 4SOURCES = restart.cpp
5TARGET = restartapplet 5TARGET = restartapplet
6DESTDIR = $(OPIEDIR)/plugins/applets 6DESTDIR = $(OPIEDIR)/plugins/applets
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += $(OPIEDIR)/include 8DEPENDPATH += $(OPIEDIR)/include
9LIBS += -lqpe 9LIBS += -lqpe
10VERSION = 1.0.0 10VERSION = 1.0.0
11MOC_DIR=opieobj 11MOC_DIR=opieobj
12OBJECTS_DIR=opieobj 12OBJECTS_DIR=opieobj
13 13
14 14
15 15
16include ( $(OPIEDIR)/include.pro ) 16include ( $(OPIEDIR)/include.pro )
17target.path = $$prefix/plugins/applets 17target.path = $$prefix/plugins/applets
diff --git a/core/applets/rotateapplet/rotateapplet.pro b/core/applets/rotateapplet/rotateapplet.pro
index 9b39dba..2c8de8d 100644
--- a/core/applets/rotateapplet/rotateapplet.pro
+++ b/core/applets/rotateapplet/rotateapplet.pro
@@ -1,31 +1,31 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on release 2CONFIG += qt plugn warn_on release
3HEADERS = rotate.h 3HEADERS = rotate.h
4SOURCES = rotate.cpp 4SOURCES = rotate.cpp
5TARGET = rotateapplet 5TARGET = rotateapplet
6DESTDIR = $(OPIEDIR)/plugins/applets 6DESTDIR = $(OPIEDIR)/plugins/applets
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += $(OPIEDIR)/include 8DEPENDPATH += $(OPIEDIR)/include
9LIBS += -lqpe 9LIBS += -lqpe
10VERSION = 1.0.0 10VERSION = 1.0.0
11 11
12TRANSLATIONS = ../../../i18n/de/librotateapplet.ts \ 12TRANSLATIONS = ../../../i18n/de/librotateapplet.ts \
13 ../../../i18n/nl/librotateapplet.ts \ 13 ../../../i18n/nl/librotateapplet.ts \
14 ../../../i18n/da/librotateapplet.ts \ 14 ../../../i18n/da/librotateapplet.ts \
15 ../../../i18n/xx/librotateapplet.ts \ 15 ../../../i18n/xx/librotateapplet.ts \
16 ../../../i18n/en/librotateapplet.ts \ 16 ../../../i18n/en/librotateapplet.ts \
17 ../../../i18n/es/librotateapplet.ts \ 17 ../../../i18n/es/librotateapplet.ts \
18 ../../../i18n/fr/librotateapplet.ts \ 18 ../../../i18n/fr/librotateapplet.ts \
19 ../../../i18n/hu/librotateapplet.ts \ 19 ../../../i18n/hu/librotateapplet.ts \
20 ../../../i18n/ja/librotateapplet.ts \ 20 ../../../i18n/ja/librotateapplet.ts \
21 ../../../i18n/ko/librotateapplet.ts \ 21 ../../../i18n/ko/librotateapplet.ts \
22 ../../../i18n/no/librotateapplet.ts \ 22 ../../../i18n/no/librotateapplet.ts \
23 ../../../i18n/pl/librotateapplet.ts \ 23 ../../../i18n/pl/librotateapplet.ts \
24 ../../../i18n/pt/librotateapplet.ts \ 24 ../../../i18n/pt/librotateapplet.ts \
25 ../../../i18n/pt_BR/librotateapplet.ts \ 25 ../../../i18n/pt_BR/librotateapplet.ts \
26 ../../../i18n/sl/librotateapplet.ts \ 26 ../../../i18n/sl/librotateapplet.ts \
27 ../../../i18n/zh_CN/librotateapplet.ts \ 27 ../../../i18n/zh_CN/librotateapplet.ts \
28 ../../../i18n/zh_TW/librotateapplet.ts 28 ../../../i18n/zh_TW/librotateapplet.ts
29 29
30include ( $(OPIEDIR)/include.pro ) 30include ( $(OPIEDIR)/include.pro )
31target.path = $$prefix/plugins/applets 31target.path = $$prefix/plugins/applets
diff --git a/core/applets/screenshotapplet/screenshotapplet.pro b/core/applets/screenshotapplet/screenshotapplet.pro
index fe7b299..a86eff2 100644
--- a/core/applets/screenshotapplet/screenshotapplet.pro
+++ b/core/applets/screenshotapplet/screenshotapplet.pro
@@ -1,35 +1,35 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on release 2CONFIG += qt plugin warn_on release
3HEADERS = screenshot.h inputDialog.h screenshotappletimpl.h 3HEADERS = screenshot.h inputDialog.h screenshotappletimpl.h
4SOURCES = screenshot.cpp inputDialog.cpp screenshotappletimpl.cpp 4SOURCES = screenshot.cpp inputDialog.cpp screenshotappletimpl.cpp
5TARGET = screenshotapplet 5TARGET = screenshotapplet
6DESTDIR = $(OPIEDIR)/plugins/applets 6DESTDIR = $(OPIEDIR)/plugins/applets
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += ../$(OPIEDIR)/include 8DEPENDPATH += ../$(OPIEDIR)/include
9LIBS += -lqpe 9LIBS += -lqpe
10VERSION = 1.0.0 10VERSION = 1.0.0
11MOC_DIR=opieobj 11MOC_DIR=opieobj
12OBJECTS_DIR=opieobj 12OBJECTS_DIR=opieobj
13 13
14TRANSLATIONS = ../../../i18n/de/libscreenshotapplet.ts \ 14TRANSLATIONS = ../../../i18n/de/libscreenshotapplet.ts \
15 ../../../i18n/nl/libscreenshotapplet.ts \ 15 ../../../i18n/nl/libscreenshotapplet.ts \
16 ../../../i18n/da/libscreenshotapplet.ts \ 16 ../../../i18n/da/libscreenshotapplet.ts \
17 ../../../i18n/xx/libscreenshotapplet.ts \ 17 ../../../i18n/xx/libscreenshotapplet.ts \
18 ../../../i18n/en/libscreenshotapplet.ts \ 18 ../../../i18n/en/libscreenshotapplet.ts \
19 ../../../i18n/es/libscreenshotapplet.ts \ 19 ../../../i18n/es/libscreenshotapplet.ts \
20 ../../../i18n/fr/libscreenshotapplet.ts \ 20 ../../../i18n/fr/libscreenshotapplet.ts \
21 ../../../i18n/hu/libscreenshotapplet.ts \ 21 ../../../i18n/hu/libscreenshotapplet.ts \
22 ../../../i18n/ja/libscreenshotapplet.ts \ 22 ../../../i18n/ja/libscreenshotapplet.ts \
23 ../../../i18n/ko/libscreenshotapplet.ts \ 23 ../../../i18n/ko/libscreenshotapplet.ts \
24 ../../../i18n/no/libscreenshotapplet.ts \ 24 ../../../i18n/no/libscreenshotapplet.ts \
25 ../../../i18n/pl/libscreenshotapplet.ts \ 25 ../../../i18n/pl/libscreenshotapplet.ts \
26 ../../../i18n/pt/libscreenshotapplet.ts \ 26 ../../../i18n/pt/libscreenshotapplet.ts \
27 ../../../i18n/pt_BR/libscreenshotapplet.ts \ 27 ../../../i18n/pt_BR/libscreenshotapplet.ts \
28 ../../../i18n/sl/libscreenshotapplet.ts \ 28 ../../../i18n/sl/libscreenshotapplet.ts \
29 ../../../i18n/zh_CN/libscreenshotapplet.ts \ 29 ../../../i18n/zh_CN/libscreenshotapplet.ts \
30 ../../../i18n/zh_TW/libscreenshotapplet.ts 30 ../../../i18n/zh_TW/libscreenshotapplet.ts
31 31
32 32
33 33
34include ( $(OPIEDIR)/include.pro ) 34include ( $(OPIEDIR)/include.pro )
35target.path = $$prefix/plugins/applets 35target.path = $$prefix/plugins/applets
diff --git a/core/applets/suspendapplet/suspendapplet.pro b/core/applets/suspendapplet/suspendapplet.pro
index 7635d32..f58de63 100644
--- a/core/applets/suspendapplet/suspendapplet.pro
+++ b/core/applets/suspendapplet/suspendapplet.pro
@@ -1,33 +1,33 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on release 2CONFIG += qt plugin warn_on release
3HEADERS = suspend.h 3HEADERS = suspend.h
4SOURCES = suspend.cpp 4SOURCES = suspend.cpp
5TARGET = suspendapplet 5TARGET = suspendapplet
6DESTDIR = $(OPIEDIR)/plugins/applets 6DESTDIR = $(OPIEDIR)/plugins/applets
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += $(OPIEDIR)/include 8DEPENDPATH += $(OPIEDIR)/include
9LIBS += -lqpe 9LIBS += -lqpe
10VERSION = 1.0.0 10VERSION = 1.0.0
11 11
12TRANSLATIONS = ../../../i18n/de/libsuspendapplet.ts \ 12TRANSLATIONS = ../../../i18n/de/libsuspendapplet.ts \
13 ../../../i18n/nl/libsuspendapplet.ts \ 13 ../../../i18n/nl/libsuspendapplet.ts \
14 ../../../i18n/da/libsuspendapplet.ts \ 14 ../../../i18n/da/libsuspendapplet.ts \
15 ../../../i18n/xx/libsuspendapplet.ts \ 15 ../../../i18n/xx/libsuspendapplet.ts \
16 ../../../i18n/en/libsuspendapplet.ts \ 16 ../../../i18n/en/libsuspendapplet.ts \
17 ../../../i18n/es/libsuspendapplet.ts \ 17 ../../../i18n/es/libsuspendapplet.ts \
18 ../../../i18n/fr/libsuspendapplet.ts \ 18 ../../../i18n/fr/libsuspendapplet.ts \
19 ../../../i18n/hu/libsuspendapplet.ts \ 19 ../../../i18n/hu/libsuspendapplet.ts \
20 ../../../i18n/ja/libsuspendapplet.ts \ 20 ../../../i18n/ja/libsuspendapplet.ts \
21 ../../../i18n/ko/libsuspendapplet.ts \ 21 ../../../i18n/ko/libsuspendapplet.ts \
22 ../../../i18n/no/libsuspendapplet.ts \ 22 ../../../i18n/no/libsuspendapplet.ts \
23 ../../../i18n/pl/libsuspendapplet.ts \ 23 ../../../i18n/pl/libsuspendapplet.ts \
24 ../../../i18n/pt/libsuspendapplet.ts \ 24 ../../../i18n/pt/libsuspendapplet.ts \
25 ../../../i18n/pt_BR/libsuspendapplet.ts \ 25 ../../../i18n/pt_BR/libsuspendapplet.ts \
26 ../../../i18n/sl/libsuspendapplet.ts \ 26 ../../../i18n/sl/libsuspendapplet.ts \
27 ../../../i18n/zh_CN/libsuspendapplet.ts \ 27 ../../../i18n/zh_CN/libsuspendapplet.ts \
28 ../../../i18n/zh_TW/libsuspendapplet.ts 28 ../../../i18n/zh_TW/libsuspendapplet.ts
29 29
30 30
31 31
32include ( $(OPIEDIR)/include.pro ) 32include ( $(OPIEDIR)/include.pro )
33target.path = $$prefix/plugins/applets 33target.path = $$prefix/plugins/applets
diff --git a/core/applets/vmemo/vmemo.pro b/core/applets/vmemo/vmemo.pro
index 8cf1f07..43cb767 100644
--- a/core/applets/vmemo/vmemo.pro
+++ b/core/applets/vmemo/vmemo.pro
@@ -1,33 +1,33 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on release 2CONFIG += qt plugin warn_on release
3HEADERS = vmemo.h vmemoimpl.h adpcm.h 3HEADERS = vmemo.h vmemoimpl.h adpcm.h
4SOURCES = vmemo.cpp vmemoimpl.cpp adpcm.c 4SOURCES = vmemo.cpp vmemoimpl.cpp adpcm.c
5TARGET = vmemoapplet 5TARGET = vmemoapplet
6DESTDIR =$(OPIEDIR)/plugins/applets 6DESTDIR =$(OPIEDIR)/plugins/applets
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += $(OPIEDIR)/include 8DEPENDPATH += $(OPIEDIR)/include
9LIBS += -lqpe 9LIBS += -lqpe
10VERSION = 1.0.0 10VERSION = 1.0.0
11 11
12TRANSLATIONS = ../../../i18n/de/libvmemoapplet.ts \ 12TRANSLATIONS = ../../../i18n/de/libvmemoapplet.ts \
13 ../../../i18n/nl/libvmemoapplet.ts \ 13 ../../../i18n/nl/libvmemoapplet.ts \
14 ../../../i18n/da/libvmemoapplet.ts \ 14 ../../../i18n/da/libvmemoapplet.ts \
15 ../../../i18n/xx/libvmemoapplet.ts \ 15 ../../../i18n/xx/libvmemoapplet.ts \
16 ../../../i18n/en/libvmemoapplet.ts \ 16 ../../../i18n/en/libvmemoapplet.ts \
17 ../../../i18n/es/libvmemoapplet.ts \ 17 ../../../i18n/es/libvmemoapplet.ts \
18 ../../../i18n/fr/libvmemoapplet.ts \ 18 ../../../i18n/fr/libvmemoapplet.ts \
19 ../../../i18n/hu/libvmemoapplet.ts \ 19 ../../../i18n/hu/libvmemoapplet.ts \
20 ../../../i18n/ja/libvmemoapplet.ts \ 20 ../../../i18n/ja/libvmemoapplet.ts \
21 ../../../i18n/ko/libvmemoapplet.ts \ 21 ../../../i18n/ko/libvmemoapplet.ts \
22 ../../../i18n/no/libvmemoapplet.ts \ 22 ../../../i18n/no/libvmemoapplet.ts \
23 ../../../i18n/pl/libvmemoapplet.ts \ 23 ../../../i18n/pl/libvmemoapplet.ts \
24 ../../../i18n/pt/libvmemoapplet.ts \ 24 ../../../i18n/pt/libvmemoapplet.ts \
25 ../../../i18n/pt_BR/libvmemoapplet.ts \ 25 ../../../i18n/pt_BR/libvmemoapplet.ts \
26 ../../../i18n/sl/libvmemoapplet.ts \ 26 ../../../i18n/sl/libvmemoapplet.ts \
27 ../../../i18n/zh_CN/libvmemoapplet.ts \ 27 ../../../i18n/zh_CN/libvmemoapplet.ts \
28 ../../../i18n/zh_TW/libvmemoapplet.ts 28 ../../../i18n/zh_TW/libvmemoapplet.ts
29 29
30 30
31 31
32include ( $(OPIEDIR)/include.pro ) 32include ( $(OPIEDIR)/include.pro )
33target.path = $$prefix/plugins/applets 33target.path = $$prefix/plugins/applets
diff --git a/core/applets/volumeapplet/volumeapplet.pro b/core/applets/volumeapplet/volumeapplet.pro
index d30567c..68d9eff 100644
--- a/core/applets/volumeapplet/volumeapplet.pro
+++ b/core/applets/volumeapplet/volumeapplet.pro
@@ -1,33 +1,33 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt warn_on release 2 CONFIG += qt plugin warn_on release
3 HEADERS= volume.h volumeappletimpl.h oledbox.h 3 HEADERS= volume.h volumeappletimpl.h oledbox.h
4 SOURCES= volume.cpp volumeappletimpl.cpp oledbox.cpp 4 SOURCES= volume.cpp volumeappletimpl.cpp oledbox.cpp
5 TARGET = volumeapplet 5 TARGET = volumeapplet
6 DESTDIR = $(OPIEDIR)/plugins/applets 6 DESTDIR = $(OPIEDIR)/plugins/applets
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += ../$(OPIEDIR)/include 8DEPENDPATH += ../$(OPIEDIR)/include
9LIBS += -lqpe 9LIBS += -lqpe
10 VERSION = 1.0.0 10 VERSION = 1.0.0
11 11
12TRANSLATIONS = ../../../i18n/de/libvolumeapplet.ts \ 12TRANSLATIONS = ../../../i18n/de/libvolumeapplet.ts \
13 ../../../i18n/nl/libvolumeapplet.ts \ 13 ../../../i18n/nl/libvolumeapplet.ts \
14 ../../../i18n/da/libvolumeapplet.ts \ 14 ../../../i18n/da/libvolumeapplet.ts \
15 ../../../i18n/xx/libvolumeapplet.ts \ 15 ../../../i18n/xx/libvolumeapplet.ts \
16 ../../../i18n/en/libvolumeapplet.ts \ 16 ../../../i18n/en/libvolumeapplet.ts \
17 ../../../i18n/es/libvolumeapplet.ts \ 17 ../../../i18n/es/libvolumeapplet.ts \
18 ../../../i18n/fr/libvolumeapplet.ts \ 18 ../../../i18n/fr/libvolumeapplet.ts \
19 ../../../i18n/hu/libvolumeapplet.ts \ 19 ../../../i18n/hu/libvolumeapplet.ts \
20 ../../../i18n/ja/libvolumeapplet.ts \ 20 ../../../i18n/ja/libvolumeapplet.ts \
21 ../../../i18n/ko/libvolumeapplet.ts \ 21 ../../../i18n/ko/libvolumeapplet.ts \
22 ../../../i18n/no/libvolumeapplet.ts \ 22 ../../../i18n/no/libvolumeapplet.ts \
23 ../../../i18n/pl/libvolumeapplet.ts \ 23 ../../../i18n/pl/libvolumeapplet.ts \
24 ../../../i18n/pt/libvolumeapplet.ts \ 24 ../../../i18n/pt/libvolumeapplet.ts \
25 ../../../i18n/pt_BR/libvolumeapplet.ts \ 25 ../../../i18n/pt_BR/libvolumeapplet.ts \
26 ../../../i18n/sl/libvolumeapplet.ts \ 26 ../../../i18n/sl/libvolumeapplet.ts \
27 ../../../i18n/zh_CN/libvolumeapplet.ts \ 27 ../../../i18n/zh_CN/libvolumeapplet.ts \
28 ../../../i18n/zh_TW/libvolumeapplet.ts 28 ../../../i18n/zh_TW/libvolumeapplet.ts
29 29
30 30
31 31
32include ( $(OPIEDIR)/include.pro ) 32include ( $(OPIEDIR)/include.pro )
33target.path = $$prefix/plugins/applets 33target.path = $$prefix/plugins/applets
diff --git a/core/launcher/applauncher.cpp b/core/launcher/applauncher.cpp
index d6f93da..0ac043b 100644
--- a/core/launcher/applauncher.cpp
+++ b/core/launcher/applauncher.cpp
@@ -1,714 +1,718 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#ifndef QTOPIA_INTERNAL_PRELOADACCESS 21#ifndef QTOPIA_INTERNAL_PRELOADACCESS
22#define QTOPIA_INTERNAL_PRELOADACCESS 22#define QTOPIA_INTERNAL_PRELOADACCESS
23#endif 23#endif
24#ifndef QTOPIA_INTERNAL_FILEOPERATIONS 24#ifndef QTOPIA_INTERNAL_FILEOPERATIONS
25#define QTOPIA_INTERNAL_FILEOPERATIONS 25#define QTOPIA_INTERNAL_FILEOPERATIONS
26#endif 26#endif
27#ifndef QTOPIA_PROGRAM_MONITOR 27#ifndef QTOPIA_PROGRAM_MONITOR
28#define QTOPIA_PROGRAM_MONITOR 28#define QTOPIA_PROGRAM_MONITOR
29#endif 29#endif
30#include <qtopia/global.h> 30#include <qtopia/global.h>
31 31
32#ifndef Q_OS_WIN32 32#ifndef Q_OS_WIN32
33#include <sys/stat.h> 33#include <sys/stat.h>
34#include <sys/wait.h> 34#include <sys/wait.h>
35#include <sys/file.h> 35#include <sys/file.h>
36#include <unistd.h> 36#include <unistd.h>
37#include <sys/time.h> 37#include <sys/time.h>
38#include <sys/resource.h> 38#include <sys/resource.h>
39#include <errno.h> 39#include <errno.h>
40#else 40#else
41#include <process.h> 41#include <process.h>
42#include <windows.h> 42#include <windows.h>
43#include <winbase.h> 43#include <winbase.h>
44#endif 44#endif
45 45
46#include <signal.h> 46#include <signal.h>
47#include <sys/types.h> 47#include <sys/types.h>
48#include <stdlib.h> 48#include <stdlib.h>
49 49
50#include <qtimer.h> 50#include <qtimer.h>
51#include <qwindowsystem_qws.h> 51#include <qwindowsystem_qws.h>
52#include <qmessagebox.h> 52#include <qmessagebox.h>
53#include <qfile.h> 53#include <qfile.h>
54#include <qfileinfo.h> 54#include <qfileinfo.h>
55 55
56#include <qtopia/qcopenvelope_qws.h> 56#include <qtopia/qcopenvelope_qws.h>
57#include <qtopia/applnk.h> 57#include <qtopia/applnk.h>
58#include <qtopia/qpeapplication.h> 58#include <qtopia/qpeapplication.h>
59#include <qtopia/config.h> 59#include <qtopia/config.h>
60#include <qtopia/global.h> 60#include <qtopia/global.h>
61 61
62#include "applauncher.h" 62#include "applauncher.h"
63#include "documentlist.h" 63#include "documentlist.h"
64#include "launcherglobal.h" 64#include "launcherglobal.h"
65 65
66const int AppLauncher::RAISE_TIMEOUT_MS = 5000; 66const int AppLauncher::RAISE_TIMEOUT_MS = 5000;
67 67
68//--------------------------------------------------------------------------- 68//---------------------------------------------------------------------------
69 69
70static AppLauncher* appLauncherPtr; 70static AppLauncher* appLauncherPtr;
71 71
72const int appStopEventID = 1290; 72const int appStopEventID = 1290;
73 73
74class AppStoppedEvent : public QCustomEvent 74class AppStoppedEvent : public QCustomEvent
75{ 75{
76public: 76public:
77 AppStoppedEvent(int pid, int status) 77 AppStoppedEvent(int pid, int status)
78 : QCustomEvent( appStopEventID ), mPid(pid), mStatus(status) { } 78 : QCustomEvent( appStopEventID ), mPid(pid), mStatus(status) { }
79 79
80 int pid() { return mPid; } 80 int pid() { return mPid; }
81 int status() { return mStatus; } 81 int status() { return mStatus; }
82 82
83private: 83private:
84 int mPid, mStatus; 84 int mPid, mStatus;
85}; 85};
86 86
87AppLauncher::AppLauncher(QObject *parent, const char *name) 87AppLauncher::AppLauncher(QObject *parent, const char *name)
88 : QObject(parent, name), qlPid(0), qlReady(FALSE), 88 : QObject(parent, name), qlPid(0), qlReady(FALSE),
89 appKillerBox(0) 89 appKillerBox(0)
90{ 90{
91 connect(qwsServer, SIGNAL(newChannel(const QString&)), this, SLOT(newQcopChannel(const QString&))); 91 connect(qwsServer, SIGNAL(newChannel(const QString&)), this, SLOT(newQcopChannel(const QString&)));
92 connect(qwsServer, SIGNAL(removedChannel(const QString&)), this, SLOT(removedQcopChannel(const QString&))); 92 connect(qwsServer, SIGNAL(removedChannel(const QString&)), this, SLOT(removedQcopChannel(const QString&)));
93 QCopChannel* channel = new QCopChannel( "QPE/System", this ); 93 QCopChannel* channel = new QCopChannel( "QPE/System", this );
94 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 94 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
95 this, SLOT(received(const QCString&, const QByteArray&)) ); 95 this, SLOT(received(const QCString&, const QByteArray&)) );
96 96
97 channel = new QCopChannel( "QPE/Server", this ); 97 channel = new QCopChannel( "QPE/Server", this );
98 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 98 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
99 this, SLOT(received(const QCString&, const QByteArray&)) ); 99 this, SLOT(received(const QCString&, const QByteArray&)) );
100 100
101#ifndef Q_OS_WIN32 101#ifndef Q_OS_WIN32
102 signal(SIGCHLD, signalHandler); 102 signal(SIGCHLD, signalHandler);
103#else 103#else
104 runningAppsProc.setAutoDelete( TRUE ); 104 runningAppsProc.setAutoDelete( TRUE );
105#endif 105#endif
106 QString tmp = qApp->argv()[0]; 106 QString tmp = qApp->argv()[0];
107 int pos = tmp.findRev('/'); 107 int pos = tmp.findRev('/');
108 if ( pos > -1 ) 108 if ( pos > -1 )
109 tmp = tmp.mid(++pos); 109 tmp = tmp.mid(++pos);
110 runningApps[::getpid()] = tmp; 110 runningApps[::getpid()] = tmp;
111 111
112 appLauncherPtr = this; 112 appLauncherPtr = this;
113 113
114 QTimer::singleShot( 1000, this, SLOT(createQuickLauncher()) ); 114 QTimer::singleShot( 1000, this, SLOT(createQuickLauncher()) );
115} 115}
116 116
117AppLauncher::~AppLauncher() 117AppLauncher::~AppLauncher()
118{ 118{
119 appLauncherPtr = 0; 119 appLauncherPtr = 0;
120#ifndef Q_OS_WIN32 120#ifndef Q_OS_WIN32
121 signal(SIGCHLD, SIG_DFL); 121 signal(SIGCHLD, SIG_DFL);
122#endif 122#endif
123 if ( qlPid ) { 123 if ( qlPid ) {
124 int status; 124 int status;
125 ::kill( qlPid, SIGTERM ); 125 ::kill( qlPid, SIGTERM );
126 waitpid( qlPid, &status, 0 ); 126 waitpid( qlPid, &status, 0 );
127 } 127 }
128} 128}
129 129
130/* We use the QCopChannel of the app as an indicator of when it has been launched 130/* We use the QCopChannel of the app as an indicator of when it has been launched
131 so that we can disable the busy indicators */ 131 so that we can disable the busy indicators */
132void AppLauncher::newQcopChannel(const QString& channelName) 132void AppLauncher::newQcopChannel(const QString& channelName)
133{ 133{
134// qDebug("channel %s added", channelName.data() ); 134// qDebug("channel %s added", channelName.data() );
135 QString prefix("QPE/Application/"); 135 QString prefix("QPE/Application/");
136 if (channelName.startsWith(prefix)) { 136 if (channelName.startsWith(prefix)) {
137 { 137 {
138 QCopEnvelope e("QPE/System", "newChannel(QString)"); 138 QCopEnvelope e("QPE/System", "newChannel(QString)");
139 e << channelName; 139 e << channelName;
140 } 140 }
141 QString appName = channelName.mid(prefix.length()); 141 QString appName = channelName.mid(prefix.length());
142 if ( appName != "quicklauncher" ) { 142 if ( appName != "quicklauncher" ) {
143 emit connected( appName ); 143 emit connected( appName );
144 QCopEnvelope e("QPE/System", "notBusy(QString)"); 144 QCopEnvelope e("QPE/System", "notBusy(QString)");
145 e << appName; 145 e << appName;
146 } 146 }
147 } else if (channelName.startsWith("QPE/QuickLauncher-")) { 147 } else if (channelName.startsWith("QPE/QuickLauncher-")) {
148 qDebug("Registered %s", channelName.latin1()); 148 qDebug("Registered %s", channelName.latin1());
149 int pid = channelName.mid(18).toInt(); 149 int pid = channelName.mid(18).toInt();
150 if (pid == qlPid) 150 if (pid == qlPid)
151 qlReady = TRUE; 151 qlReady = TRUE;
152 } 152 }
153} 153}
154 154
155void AppLauncher::removedQcopChannel(const QString& channelName) 155void AppLauncher::removedQcopChannel(const QString& channelName)
156{ 156{
157 if (channelName.startsWith("QPE/Application/")) { 157 if (channelName.startsWith("QPE/Application/")) {
158 QCopEnvelope e("QPE/System", "removedChannel(QString)"); 158 QCopEnvelope e("QPE/System", "removedChannel(QString)");
159 e << channelName; 159 e << channelName;
160 } 160 }
161} 161}
162 162
163void AppLauncher::received(const QCString& msg, const QByteArray& data) 163void AppLauncher::received(const QCString& msg, const QByteArray& data)
164{ 164{
165 QDataStream stream( data, IO_ReadOnly ); 165 QDataStream stream( data, IO_ReadOnly );
166 if ( msg == "execute(QString)" ) { 166 if ( msg == "execute(QString)" ) {
167 QString t; 167 QString t;
168 stream >> t; 168 stream >> t;
169 if ( !executeBuiltin( t, QString::null ) ) 169 if ( !executeBuiltin( t, QString::null ) )
170 execute(t, QString::null); 170 execute(t, QString::null);
171 } else if ( msg == "execute(QString,QString)" ) { 171 } else if ( msg == "execute(QString,QString)" ) {
172 QString t,d; 172 QString t,d;
173 stream >> t >> d; 173 stream >> t >> d;
174 if ( !executeBuiltin( t, d ) ) 174 if ( !executeBuiltin( t, d ) )
175 execute( t, d ); 175 execute( t, d );
176 } else if ( msg == "processQCop(QString)" ) { // from QPE/Server 176 } else if ( msg == "processQCop(QString)" ) { // from QPE/Server
177 QString t; 177 QString t;
178 stream >> t; 178 stream >> t;
179 if ( !executeBuiltin( t, QString::null ) ) 179 if ( !executeBuiltin( t, QString::null ) )
180 execute( t, QString::null, TRUE); 180 execute( t, QString::null, TRUE);
181 } else if ( msg == "raise(QString)" ) { 181 } else if ( msg == "raise(QString)" ) {
182 QString appName; 182 QString appName;
183 stream >> appName; 183 stream >> appName;
184 184
185 if ( !executeBuiltin( appName, QString::null ) ) { 185 if ( !executeBuiltin( appName, QString::null ) ) {
186 if ( !waitingHeartbeat.contains( appName ) && appKillerName != appName ) { 186 if ( !waitingHeartbeat.contains( appName ) && appKillerName != appName ) {
187 //qDebug( "Raising: %s", appName.latin1() ); 187 //qDebug( "Raising: %s", appName.latin1() );
188 QCString channel = "QPE/Application/"; 188 QCString channel = "QPE/Application/";
189 channel += appName.latin1(); 189 channel += appName.latin1();
190 190
191 // Need to lock it to avoid race conditions with QPEApplication::processQCopFile 191 // Need to lock it to avoid race conditions with QPEApplication::processQCopFile
192 QFile f("/tmp/qcop-msg-" + appName); 192 QFile f("/tmp/qcop-msg-" + appName);
193 if ( f.open(IO_WriteOnly | IO_Append) ) { 193 if ( f.open(IO_WriteOnly | IO_Append) ) {
194#ifndef Q_OS_WIN32 194#ifndef Q_OS_WIN32
195 flock(f.handle(), LOCK_EX); 195 flock(f.handle(), LOCK_EX);
196#endif 196#endif
197 QDataStream ds(&f); 197 QDataStream ds(&f);
198 QByteArray b; 198 QByteArray b;
199 QDataStream bstream(b, IO_WriteOnly); 199 QDataStream bstream(b, IO_WriteOnly);
200 ds << channel << QCString("raise()") << b; 200 ds << channel << QCString("raise()") << b;
201 f.flush(); 201 f.flush();
202#ifndef Q_OS_WIN32 202#ifndef Q_OS_WIN32
203 flock(f.handle(), LOCK_UN); 203 flock(f.handle(), LOCK_UN);
204#endif 204#endif
205 f.close(); 205 f.close();
206 } 206 }
207 bool alreadyRunning = isRunning( appName ); 207 bool alreadyRunning = isRunning( appName );
208 if ( execute(appName, QString::null) ) { 208 if ( execute(appName, QString::null) ) {
209 int id = startTimer(RAISE_TIMEOUT_MS + alreadyRunning?2000:0); 209 int id = startTimer(RAISE_TIMEOUT_MS + alreadyRunning?2000:0);
210 waitingHeartbeat.insert( appName, id ); 210 waitingHeartbeat.insert( appName, id );
211 } 211 }
212 } 212 }
213 } 213 }
214 } else if ( msg == "sendRunningApps()" ) { 214 } else if ( msg == "sendRunningApps()" ) {
215 QStringList apps; 215 QStringList apps;
216 QMap<int,QString>::Iterator it; 216 QMap<int,QString>::Iterator it;
217 for( it = runningApps.begin(); it != runningApps.end(); ++it ) 217 for( it = runningApps.begin(); it != runningApps.end(); ++it )
218 apps.append( *it ); 218 apps.append( *it );
219 QCopEnvelope e( "QPE/Desktop", "runningApps(QStringList)" ); 219 QCopEnvelope e( "QPE/Desktop", "runningApps(QStringList)" );
220 e << apps; 220 e << apps;
221 } else if ( msg == "appRaised(QString)" ) { 221 } else if ( msg == "appRaised(QString)" ) {
222 QString appName; 222 QString appName;
223 stream >> appName; 223 stream >> appName;
224 qDebug("Got a heartbeat from %s", appName.latin1()); 224 qDebug("Got a heartbeat from %s", appName.latin1());
225 QMap<QString,int>::Iterator it = waitingHeartbeat.find(appName); 225 QMap<QString,int>::Iterator it = waitingHeartbeat.find(appName);
226 if ( it != waitingHeartbeat.end() ) { 226 if ( it != waitingHeartbeat.end() ) {
227 killTimer( *it ); 227 killTimer( *it );
228 waitingHeartbeat.remove(it); 228 waitingHeartbeat.remove(it);
229 } 229 }
230 // Check to make sure we're not waiting on user input... 230 // Check to make sure we're not waiting on user input...
231 if ( appKillerBox && appName == appKillerName ) { 231 if ( appKillerBox && appName == appKillerName ) {
232 // If we are, we kill the dialog box, and the code waiting on the result 232 // If we are, we kill the dialog box, and the code waiting on the result
233 // will clean us up (basically the user said "no"). 233 // will clean us up (basically the user said "no").
234 delete appKillerBox; 234 delete appKillerBox;
235 appKillerBox = 0; 235 appKillerBox = 0;
236 appKillerName = QString::null; 236 appKillerName = QString::null;
237 } 237 }
238 } 238 }
239} 239}
240 240
241void AppLauncher::signalHandler(int) 241void AppLauncher::signalHandler(int)
242{ 242{
243#ifndef Q_OS_WIN32 243#ifndef Q_OS_WIN32
244 int status; 244 int status;
245 pid_t pid = waitpid(-1, &status, WNOHANG); 245 pid_t pid = waitpid(-1, &status, WNOHANG);
246/* if (pid == 0 || &status == 0 ) { 246/* if (pid == 0 || &status == 0 ) {
247 qDebug("hmm, could not get return value from signal"); 247 qDebug("hmm, could not get return value from signal");
248 } 248 }
249*/ 249*/
250 QApplication::postEvent(appLauncherPtr, new AppStoppedEvent(pid, status) ); 250 QApplication::postEvent(appLauncherPtr, new AppStoppedEvent(pid, status) );
251#else 251#else
252 qDebug("Unhandled signal see by AppLauncher::signalHandler(int)"); 252 qDebug("Unhandled signal see by AppLauncher::signalHandler(int)");
253#endif 253#endif
254} 254}
255 255
256bool AppLauncher::event(QEvent *e) 256bool AppLauncher::event(QEvent *e)
257{ 257{
258 if ( e->type() == appStopEventID ) { 258 if ( e->type() == appStopEventID ) {
259 AppStoppedEvent *ae = (AppStoppedEvent *) e; 259 AppStoppedEvent *ae = (AppStoppedEvent *) e;
260 sigStopped(ae->pid(), ae->status() ); 260 sigStopped(ae->pid(), ae->status() );
261 return TRUE; 261 return TRUE;
262 } 262 }
263 263
264 return QObject::event(e); 264 return QObject::event(e);
265} 265}
266 266
267void AppLauncher::timerEvent( QTimerEvent *e ) 267void AppLauncher::timerEvent( QTimerEvent *e )
268{ 268{
269 int id = e->timerId(); 269 int id = e->timerId();
270 QMap<QString,int>::Iterator it; 270 QMap<QString,int>::Iterator it;
271 for ( it = waitingHeartbeat.begin(); it != waitingHeartbeat.end(); ++it ) { 271 for ( it = waitingHeartbeat.begin(); it != waitingHeartbeat.end(); ++it ) {
272 if ( *it == id ) { 272 if ( *it == id ) {
273 if ( appKillerBox ) // we're already dealing with one 273 if ( appKillerBox ) // we're already dealing with one
274 return; 274 return;
275 275
276 appKillerName = it.key(); 276 appKillerName = it.key();
277 killTimer( id ); 277 killTimer( id );
278 waitingHeartbeat.remove( it ); 278 waitingHeartbeat.remove( it );
279 279
280 // qDebug("Checking in on %s", appKillerName.latin1()); 280 // qDebug("Checking in on %s", appKillerName.latin1());
281 281
282 // We store this incase the application responds while we're 282 // We store this incase the application responds while we're
283 // waiting for user input so we know not to delete ourselves. 283 // waiting for user input so we know not to delete ourselves.
284 appKillerBox = new QMessageBox(tr("Application Problem"), 284 appKillerBox = new QMessageBox(tr("Application Problem"),
285 tr("<p>%1 is not responding.</p>").arg(appKillerName) + 285 tr("<p>%1 is not responding.</p>").arg(appKillerName) +
286 tr("<p>Would you like to force the application to exit?</p>"), 286 tr("<p>Would you like to force the application to exit?</p>"),
287 QMessageBox::Warning, QMessageBox::Yes, 287 QMessageBox::Warning, QMessageBox::Yes,
288 QMessageBox::No | QMessageBox::Default, 288 QMessageBox::No | QMessageBox::Default,
289 QMessageBox::NoButton); 289 QMessageBox::NoButton);
290 if (appKillerBox->exec() == QMessageBox::Yes) { 290 if (appKillerBox->exec() == QMessageBox::Yes) {
291 // qDebug("Killing the app!!! Bwuhahahaha!"); 291 // qDebug("Killing the app!!! Bwuhahahaha!");
292 int pid = pidForName(appKillerName); 292 int pid = pidForName(appKillerName);
293 if ( pid > 0 ) 293 if ( pid > 0 )
294 kill( pid ); 294 kill( pid );
295 } 295 }
296 appKillerName = QString::null; 296 appKillerName = QString::null;
297 delete appKillerBox; 297 delete appKillerBox;
298 appKillerBox = 0; 298 appKillerBox = 0;
299 return; 299 return;
300 } 300 }
301 } 301 }
302 302
303 QObject::timerEvent( e ); 303 QObject::timerEvent( e );
304} 304}
305 305
306#ifndef Q_OS_WIN32 306#ifndef Q_OS_WIN32
307void AppLauncher::sigStopped(int sigPid, int sigStatus) 307void AppLauncher::sigStopped(int sigPid, int sigStatus)
308{ 308{
309 int exitStatus = 0; 309 int exitStatus = 0;
310 310
311 bool crashed = WIFSIGNALED(sigStatus); 311 bool crashed = WIFSIGNALED(sigStatus);
312 if ( !crashed ) { 312 if ( !crashed ) {
313 if ( WIFEXITED(sigStatus) ) 313 if ( WIFEXITED(sigStatus) )
314 exitStatus = WEXITSTATUS(sigStatus); 314 exitStatus = WEXITSTATUS(sigStatus);
315 } else { 315 } else {
316 exitStatus = WTERMSIG(sigStatus); 316 exitStatus = WTERMSIG(sigStatus);
317 } 317 }
318 318
319 QMap<int,QString>::Iterator it = runningApps.find( sigPid ); 319 QMap<int,QString>::Iterator it = runningApps.find( sigPid );
320 if ( it == runningApps.end() ) { 320 if ( it == runningApps.end() ) {
321 if ( sigPid == qlPid ) { 321 if ( sigPid == qlPid ) {
322 qDebug( "quicklauncher stopped" ); 322 qDebug( "quicklauncher stopped" );
323 qlPid = 0; 323 qlPid = 0;
324 qlReady = FALSE; 324 qlReady = FALSE;
325 QFile::remove("/tmp/qcop-msg-quicklauncher" ); 325 QFile::remove("/tmp/qcop-msg-quicklauncher" );
326 QTimer::singleShot( 2000, this, SLOT(createQuickLauncher()) ); 326 QTimer::singleShot( 2000, this, SLOT(createQuickLauncher()) );
327 } 327 }
328/* 328/*
329 if ( sigPid == -1 ) 329 if ( sigPid == -1 )
330 qDebug("non-qtopia application exited (disregarded)"); 330 qDebug("non-qtopia application exited (disregarded)");
331 else 331 else
332 qDebug("==== no pid matching %d in list, definite bug", sigPid); 332 qDebug("==== no pid matching %d in list, definite bug", sigPid);
333*/ 333*/
334 return; 334 return;
335 } 335 }
336 QString appName = *it; 336 QString appName = *it;
337 runningApps.remove(it); 337 runningApps.remove(it);
338 338
339 QMap<QString,int>::Iterator hbit = waitingHeartbeat.find(appName); 339 QMap<QString,int>::Iterator hbit = waitingHeartbeat.find(appName);
340 if ( hbit != waitingHeartbeat.end() ) { 340 if ( hbit != waitingHeartbeat.end() ) {
341 killTimer( *hbit ); 341 killTimer( *hbit );
342 waitingHeartbeat.remove( hbit ); 342 waitingHeartbeat.remove( hbit );
343 } 343 }
344 if ( appName == appKillerName ) { 344 if ( appName == appKillerName ) {
345 appKillerName = QString::null; 345 appKillerName = QString::null;
346 delete appKillerBox; 346 delete appKillerBox;
347 appKillerBox = 0; 347 appKillerBox = 0;
348 } 348 }
349 349
350 /* we must disable preload for an app that crashes as the system logic relies on preloaded apps 350 /* we must disable preload for an app that crashes as the system logic relies on preloaded apps
351 actually being loaded. If eg. the crash happened in the constructor, we can't automatically reload 351 actually being loaded. If eg. the crash happened in the constructor, we can't automatically reload
352 the app (withouth some timeout value for eg. 3 tries (which I think is a bad solution) 352 the app (withouth some timeout value for eg. 3 tries (which I think is a bad solution)
353 */ 353 */
354 bool preloadDisabled = FALSE; 354 bool preloadDisabled = FALSE;
355 if ( !DocumentList::appLnkSet ) return; 355 if ( !DocumentList::appLnkSet ) return;
356 const AppLnk* app = DocumentList::appLnkSet->findExec( appName ); 356 const AppLnk* app = DocumentList::appLnkSet->findExec( appName );
357 if ( !app ) return; // QCop messages processed to slow? 357 if ( !app ) return; // QCop messages processed to slow?
358 if ( crashed && app->isPreloaded() ) { 358 if ( crashed && app->isPreloaded() ) {
359 Config cfg("Launcher"); 359 Config cfg("Launcher");
360 cfg.setGroup("Preload"); 360 cfg.setGroup("Preload");
361 QStringList apps = cfg.readListEntry("Apps",','); 361 QStringList apps = cfg.readListEntry("Apps",',');
362 QString exe = app->exec(); 362 QString exe = app->exec();
363 apps.remove(exe); 363 apps.remove(exe);
364 cfg.writeEntry("Apps",apps,','); 364 cfg.writeEntry("Apps",apps,',');
365 preloadDisabled = TRUE; 365 preloadDisabled = TRUE;
366 } 366 }
367 367
368 // clean up 368 // clean up
369 if ( exitStatus ) { 369 if ( exitStatus ) {
370 QCopEnvelope e("QPE/System", "notBusy(QString)"); 370 QCopEnvelope e("QPE/System", "notBusy(QString)");
371 e << app->exec(); 371 e << app->exec();
372 } 372 }
373/* 373/*
374 // debug info 374 // debug info
375 for (it = runningApps.begin(); it != runningApps.end(); ++it) { 375 for (it = runningApps.begin(); it != runningApps.end(); ++it) {
376 qDebug("running according to internal list: %s, with pid %d", (*it).data(), it.key() ); 376 qDebug("running according to internal list: %s, with pid %d", (*it).data(), it.key() );
377 } 377 }
378*/ 378*/
379 379
380#ifdef QTOPIA_PROGRAM_MONITOR 380#ifdef QTOPIA_PROGRAM_MONITOR
381 if ( crashed ) { 381 if ( crashed ) {
382 QString sig; 382 QString sig;
383 switch( exitStatus ) { 383 switch( exitStatus ) {
384 case SIGABRT: sig = "SIGABRT"; break; 384 case SIGABRT: sig = "SIGABRT"; break;
385 case SIGALRM: sig = "SIGALRM"; break; 385 case SIGALRM: sig = "SIGALRM"; break;
386 case SIGBUS: sig = "SIGBUS"; break; 386 case SIGBUS: sig = "SIGBUS"; break;
387 case SIGFPE: sig = "SIGFPE"; break; 387 case SIGFPE: sig = "SIGFPE"; break;
388 case SIGHUP: sig = "SIGHUP"; break; 388 case SIGHUP: sig = "SIGHUP"; break;
389 case SIGILL: sig = "SIGILL"; break; 389 case SIGILL: sig = "SIGILL"; break;
390 case SIGKILL: sig = "SIGKILL"; break; 390 case SIGKILL: sig = "SIGKILL"; break;
391 case SIGPIPE: sig = "SIGPIPE"; break; 391 case SIGPIPE: sig = "SIGPIPE"; break;
392 case SIGQUIT: sig = "SIGQUIT"; break; 392 case SIGQUIT: sig = "SIGQUIT"; break;
393 case SIGSEGV: sig = "SIGSEGV"; break; 393 case SIGSEGV: sig = "SIGSEGV"; break;
394 case SIGTERM: sig = "SIGTERM"; break; 394 case SIGTERM: sig = "SIGTERM"; break;
395 case SIGTRAP: sig = "SIGTRAP"; break; 395 case SIGTRAP: sig = "SIGTRAP"; break;
396 default: sig = QString("Unkown %1").arg(exitStatus); 396 default: sig = QString("Unkown %1").arg(exitStatus);
397 } 397 }
398 if ( preloadDisabled ) 398 if ( preloadDisabled )
399 sig += tr("<qt><p>Fast loading has been disabled for this application. Tap and hold the application icon to reenable it.</qt>"); 399 sig += tr("<qt><p>Fast loading has been disabled for this application. Tap and hold the application icon to reenable it.</qt>");
400 400
401 QString str = tr("<qt><b>%1</b> was terminated due to signal code %2</qt>").arg( app->name() ).arg( sig ); 401 QString str = tr("<qt><b>%1</b> was terminated due to signal code %2</qt>").arg( app->name() ).arg( sig );
402 QMessageBox::information(0, tr("Application terminated"), str ); 402 QMessageBox::information(0, tr("Application terminated"), str );
403 } else { 403 } else {
404 if ( exitStatus == 255 ) { //could not find app (because global returns -1) 404 if ( exitStatus == 255 ) { //could not find app (because global returns -1)
405 QMessageBox::information(0, tr("Application not found"), tr("<qt>Could not locate application <b>%1</b></qt>").arg( app->exec() ) ); 405 QMessageBox::information(0, tr("Application not found"), tr("<qt>Could not locate application <b>%1</b></qt>").arg( app->exec() ) );
406 } else { 406 } else {
407 QFileInfo fi(Opie::Global::tempDir() + "qcop-msg-" + appName); 407 QFileInfo fi(Opie::Global::tempDir() + "qcop-msg-" + appName);
408 if ( fi.exists() && fi.size() ) { 408 if ( fi.exists() && fi.size() ) {
409 emit terminated(sigPid, appName); 409 emit terminated(sigPid, appName);
410 qWarning("Re executing obmitted for %s", appName.latin1() ); 410 qWarning("Re executing obmitted for %s", appName.latin1() );
411 // execute( appName, QString::null ); 411 // execute( appName, QString::null );
412 return; 412 return;
413 } 413 }
414 } 414 }
415 } 415 }
416 416
417#endif 417#endif
418 418
419 emit terminated(sigPid, appName); 419 emit terminated(sigPid, appName);
420} 420}
421#else 421#else
422void AppLauncher::sigStopped(int sigPid, int sigStatus) 422void AppLauncher::sigStopped(int sigPid, int sigStatus)
423{ 423{
424 qDebug("Unhandled signal : AppLauncher::sigStopped(int sigPid, int sigStatus)"); 424 qDebug("Unhandled signal : AppLauncher::sigStopped(int sigPid, int sigStatus)");
425} 425}
426#endif // Q_OS_WIN32 426#endif // Q_OS_WIN32
427 427
428bool AppLauncher::isRunning(const QString &app) 428bool AppLauncher::isRunning(const QString &app)
429{ 429{
430 for (QMap<int,QString>::ConstIterator it = runningApps.begin(); it != runningApps.end(); ++it) { 430 for (QMap<int,QString>::ConstIterator it = runningApps.begin(); it != runningApps.end(); ++it) {
431 if ( *it == app ) { 431 if ( *it == app ) {
432#ifdef Q_OS_UNIX 432#ifdef Q_OS_UNIX
433 pid_t t = ::__getpgid( it.key() ); 433 pid_t t = ::__getpgid( it.key() );
434 if ( t == -1 ) { 434 if ( t == -1 ) {
435 qDebug("appLauncher bug, %s believed running, but pid %d is not existing", app.data(), it.key() ); 435 qDebug("appLauncher bug, %s believed running, but pid %d is not existing", app.data(), it.key() );
436 runningApps.remove( it.key() ); 436 runningApps.remove( it.key() );
437 return FALSE; 437 return FALSE;
438 } 438 }
439#endif 439#endif
440 return TRUE; 440 return TRUE;
441 } 441 }
442 } 442 }
443 443
444 return FALSE; 444 return FALSE;
445} 445}
446 446
447bool AppLauncher::executeBuiltin(const QString &c, const QString &document) 447bool AppLauncher::executeBuiltin(const QString &c, const QString &document)
448{ 448{
449 Global::Command* builtin = Opie::Global::builtinCommands(); 449 Global::Command* builtin = Opie::Global::builtinCommands();
450 QGuardedPtr<QWidget> *running = Opie::Global::builtinRunning(); 450 QGuardedPtr<QWidget> *running = Opie::Global::builtinRunning();
451 451
452 // Attempt to execute the app using a builtin class for the app 452 // Attempt to execute the app using a builtin class for the app
453 if (builtin) { 453 if (builtin) {
454 for (int i = 0; builtin[i].file; i++) { 454 for (int i = 0; builtin[i].file; i++) {
455 if ( builtin[i].file == c ) { 455 if ( builtin[i].file == c ) {
456 if ( running[i] ) { 456 if ( running[i] ) {
457 if ( !document.isNull() && builtin[i].documentary ) 457 if ( !document.isNull() && builtin[i].documentary )
458 Global::setDocument(running[i], document); 458 Global::setDocument(running[i], document);
459 running[i]->raise(); 459 running[i]->raise();
460 running[i]->show(); 460 running[i]->show();
461 running[i]->setActiveWindow(); 461 running[i]->setActiveWindow();
462 } else { 462 } else {
463 running[i] = builtin[i].func( builtin[i].maximized ); 463 running[i] = builtin[i].func( builtin[i].maximized );
464 } 464 }
465#ifndef QT_NO_COP 465#ifndef QT_NO_COP
466 QCopEnvelope e("QPE/System", "notBusy(QString)" ); 466 QCopEnvelope e("QPE/System", "notBusy(QString)" );
467 e << c; // that was quick ;-) 467 e << c; // that was quick ;-)
468#endif 468#endif
469 return TRUE; 469 return TRUE;
470 } 470 }
471 } 471 }
472 } 472 }
473 473
474 // Convert the command line in to a list of arguments 474 // Convert the command line in to a list of arguments
475 QStringList list = QStringList::split(QRegExp(" *"),c); 475 QStringList list = QStringList::split(QRegExp(" *"),c);
476 QString ap=list[0]; 476 QString ap=list[0];
477 477
478 if ( ap == "suspend" ) { // No tr 478 if ( ap == "suspend" ) { // No tr
479 QWSServer::processKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE ); 479 QWSServer::processKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE );
480 return TRUE; 480 return TRUE;
481 } 481 }
482 482
483 return FALSE; 483 return FALSE;
484} 484}
485 485
486bool AppLauncher::execute(const QString &c, const QString &docParam, bool noRaise) 486bool AppLauncher::execute(const QString &c, const QString &docParam, bool noRaise)
487{ 487{
488 qWarning("AppLauncher::execute"); 488 qWarning("AppLauncher::execute");
489 // Convert the command line in to a list of arguments 489 // Convert the command line in to a list of arguments
490 QStringList list = QStringList::split(QRegExp(" *"),c); 490 QStringList list = QStringList::split(QRegExp(" *"),c);
491 if ( !docParam.isEmpty() ) 491 if ( !docParam.isEmpty() )
492 list.append( docParam ); 492 list.append( docParam );
493 493
494 QString appName = list[0]; 494 QString appName = list[0];
495 if ( isRunning(appName) ) { 495 if ( isRunning(appName) ) {
496 QCString channel = "QPE/Application/"; 496 QCString channel = "QPE/Application/";
497 channel += appName.latin1(); 497 channel += appName.latin1();
498 498
499 // Need to lock it to avoid race conditions with QPEApplication::processQCopFile 499 // Need to lock it to avoid race conditions with QPEApplication::processQCopFile
500 QFile f(Opie::Global::tempDir() + "qcop-msg-" + appName); 500 QFile f(Opie::Global::tempDir() + "qcop-msg-" + appName);
501 if ( !noRaise && f.open(IO_WriteOnly | IO_Append) ) { 501 if ( !noRaise && f.open(IO_WriteOnly | IO_Append) ) {
502#ifndef Q_OS_WIN32 502#ifndef Q_OS_WIN32
503 flock(f.handle(), LOCK_EX); 503 flock(f.handle(), LOCK_EX);
504#endif 504#endif
505 505
506 QDataStream ds(&f); 506 QDataStream ds(&f);
507 QByteArray b; 507 QByteArray b;
508 QDataStream bstream(b, IO_WriteOnly); 508 QDataStream bstream(b, IO_WriteOnly);
509 if ( !f.size() ) { 509 if ( !f.size() ) {
510 ds << channel << QCString("raise()") << b; 510 ds << channel << QCString("raise()") << b;
511 if ( !waitingHeartbeat.contains( appName ) && appKillerName != appName ) { 511 if ( !waitingHeartbeat.contains( appName ) && appKillerName != appName ) {
512 int id = startTimer(RAISE_TIMEOUT_MS); 512 int id = startTimer(RAISE_TIMEOUT_MS);
513 waitingHeartbeat.insert( appName, id ); 513 waitingHeartbeat.insert( appName, id );
514 } 514 }
515 } 515 }
516 if ( !docParam.isEmpty() ) { 516 if ( !docParam.isEmpty() ) {
517 bstream << docParam; 517 bstream << docParam;
518 ds << channel << QCString("setDocument(QString)") << b; 518 ds << channel << QCString("setDocument(QString)") << b;
519 } 519 }
520 520
521 f.flush(); 521 f.flush();
522#ifndef Q_OS_WIN32 522#ifndef Q_OS_WIN32
523 flock(f.handle(), LOCK_UN); 523 flock(f.handle(), LOCK_UN);
524#endif 524#endif
525 f.close(); 525 f.close();
526 } 526 }
527 if ( QCopChannel::isRegistered(channel) ) // avoid unnecessary warnings 527 if ( QCopChannel::isRegistered(channel) ) // avoid unnecessary warnings
528 QCopChannel::send(channel,"QPEProcessQCop()"); 528 QCopChannel::send(channel,"QPEProcessQCop()");
529 529
530 return TRUE; 530 return TRUE;
531 } 531 }
532 532
533#ifdef QT_NO_QWS_MULTIPROCESS 533#ifdef QT_NO_QWS_MULTIPROCESS
534 QMessageBox::warning( 0, tr("Error"), tr("<qt>Could not find the application %1</qt>").arg(c), 534 QMessageBox::warning( 0, tr("Error"), tr("<qt>Could not find the application %1</qt>").arg(c),
535 tr("OK"), 0, 0, 0, 1 ); 535 tr("OK"), 0, 0, 0, 1 );
536#else 536#else
537 537
538 QStrList slist; 538 QStrList slist;
539 unsigned j; 539 unsigned j;
540 for ( j = 0; j < list.count(); j++ ) 540 for ( j = 0; j < list.count(); j++ )
541 slist.append( list[j].utf8() ); 541 slist.append( list[j].utf8() );
542 542
543 const char **args = new const char *[slist.count() + 1]; 543 const char **args = new const char *[slist.count() + 1];
544 for ( j = 0; j < slist.count(); j++ ) 544 for ( j = 0; j < slist.count(); j++ )
545 args[j] = slist.at(j); 545 args[j] = slist.at(j);
546 args[j] = NULL; 546 args[j] = NULL;
547 547
548#ifndef Q_OS_WIN32 548#ifndef Q_OS_WIN32
549#ifdef Q_OS_MACX
550 if ( qlPid && qlReady && QFile::exists( QPEApplication::qpeDir()+"plugins/application/lib"+args[0] + ".dylib" ) ) {
551#else
549 if ( qlPid && qlReady && QFile::exists( QPEApplication::qpeDir()+"plugins/application/lib"+args[0] + ".so" ) ) { 552 if ( qlPid && qlReady && QFile::exists( QPEApplication::qpeDir()+"plugins/application/lib"+args[0] + ".so" ) ) {
553#endif /* Q_OS_MACX */
550 qDebug( "Quick launching: %s", args[0] ); 554 qDebug( "Quick launching: %s", args[0] );
551 if ( getuid() == 0 ) 555 if ( getuid() == 0 )
552 setpriority( PRIO_PROCESS, qlPid, 0 ); 556 setpriority( PRIO_PROCESS, qlPid, 0 );
553 QCString qlch("QPE/QuickLauncher-"); 557 QCString qlch("QPE/QuickLauncher-");
554 qlch += QString::number(qlPid); 558 qlch += QString::number(qlPid);
555 QCopEnvelope env( qlch, "execute(QStrList)" ); 559 QCopEnvelope env( qlch, "execute(QStrList)" );
556 env << slist; 560 env << slist;
557 runningApps[qlPid] = QString(args[0]); 561 runningApps[qlPid] = QString(args[0]);
558 emit launched(qlPid, QString(args[0])); 562 emit launched(qlPid, QString(args[0]));
559 QCopEnvelope e("QPE/System", "busy()"); 563 QCopEnvelope e("QPE/System", "busy()");
560 qlPid = 0; 564 qlPid = 0;
561 qlReady = FALSE; 565 qlReady = FALSE;
562 QTimer::singleShot( getuid() == 0 ? 800 : 1500, this, SLOT(createQuickLauncher()) ); 566 QTimer::singleShot( getuid() == 0 ? 800 : 1500, this, SLOT(createQuickLauncher()) );
563 } else { 567 } else {
564 int pid = ::vfork(); 568 int pid = ::vfork();
565 if ( !pid ) { 569 if ( !pid ) {
566 for ( int fd = 3; fd < 100; fd++ ) 570 for ( int fd = 3; fd < 100; fd++ )
567 ::close( fd ); 571 ::close( fd );
568 ::setpgid( ::getpid(), ::getppid() ); 572 ::setpgid( ::getpid(), ::getppid() );
569 // Try bindir first, so that foo/bar works too 573 // Try bindir first, so that foo/bar works too
570 ::execv( QPEApplication::qpeDir()+"bin/"+args[0], (char * const *)args ); 574 ::execv( QPEApplication::qpeDir()+"bin/"+args[0], (char * const *)args );
571 ::execvp( args[0], (char * const *)args ); 575 ::execvp( args[0], (char * const *)args );
572 _exit( -1 ); 576 _exit( -1 );
573 } 577 }
574 578
575 runningApps[pid] = QString(args[0]); 579 runningApps[pid] = QString(args[0]);
576 emit launched(pid, QString(args[0])); 580 emit launched(pid, QString(args[0]));
577 QCopEnvelope e("QPE/System", "busy()"); 581 QCopEnvelope e("QPE/System", "busy()");
578 } 582 }
579#else 583#else
580 QProcess *proc = new QProcess(this); 584 QProcess *proc = new QProcess(this);
581 if (proc){ 585 if (proc){
582 for (int i=0; i < slist.count(); i++) 586 for (int i=0; i < slist.count(); i++)
583 proc->addArgument(args[i]); 587 proc->addArgument(args[i]);
584 connect(proc, SIGNAL(processExited()), this, SLOT(processExited())); 588 connect(proc, SIGNAL(processExited()), this, SLOT(processExited()));
585 if (!proc->start()){ 589 if (!proc->start()){
586 qDebug("Unable to start application %s", args[0]); 590 qDebug("Unable to start application %s", args[0]);
587 }else{ 591 }else{
588 PROCESS_INFORMATION *procInfo = (PROCESS_INFORMATION *)proc->processIdentifier(); 592 PROCESS_INFORMATION *procInfo = (PROCESS_INFORMATION *)proc->processIdentifier();
589 if (procInfo){ 593 if (procInfo){
590 DWORD pid = procInfo->dwProcessId; 594 DWORD pid = procInfo->dwProcessId;
591 runningApps[pid] = QString(args[0]); 595 runningApps[pid] = QString(args[0]);
592 runningAppsProc.append(proc); 596 runningAppsProc.append(proc);
593 emit launched(pid, QString(args[0])); 597 emit launched(pid, QString(args[0]));
594 QCopEnvelope e("QPE/System", "busy()"); 598 QCopEnvelope e("QPE/System", "busy()");
595 }else{ 599 }else{
596 qDebug("Unable to read process inforation #1 for %s", args[0]); 600 qDebug("Unable to read process inforation #1 for %s", args[0]);
597 } 601 }
598 } 602 }
599 }else{ 603 }else{
600 qDebug("Unable to create process for application %s", args[0]); 604 qDebug("Unable to create process for application %s", args[0]);
601 return FALSE; 605 return FALSE;
602 } 606 }
603#endif 607#endif
604#endif //QT_NO_QWS_MULTIPROCESS 608#endif //QT_NO_QWS_MULTIPROCESS
605 609
606 delete [] args; 610 delete [] args;
607 return TRUE; 611 return TRUE;
608} 612}
609 613
610void AppLauncher::kill( int pid ) 614void AppLauncher::kill( int pid )
611{ 615{
612#ifndef Q_OS_WIN32 616#ifndef Q_OS_WIN32
613 ::kill( pid, SIGTERM ); 617 ::kill( pid, SIGTERM );
614#else 618#else
615 for ( QProcess *proc = runningAppsProc.first(); proc; proc = runningAppsProc.next() ) { 619 for ( QProcess *proc = runningAppsProc.first(); proc; proc = runningAppsProc.next() ) {
616 if ( proc->processIdentifier() == pid ) { 620 if ( proc->processIdentifier() == pid ) {
617 proc->kill(); 621 proc->kill();
618 break; 622 break;
619 } 623 }
620 } 624 }
621#endif 625#endif
622} 626}
623 627
624int AppLauncher::pidForName( const QString &appName ) 628int AppLauncher::pidForName( const QString &appName )
625{ 629{
626 int pid = -1; 630 int pid = -1;
627 631
628 QMap<int, QString>::Iterator it; 632 QMap<int, QString>::Iterator it;
629 for (it = runningApps.begin(); it!= runningApps.end(); ++it) { 633 for (it = runningApps.begin(); it!= runningApps.end(); ++it) {
630 if (*it == appName) { 634 if (*it == appName) {
631 pid = it.key(); 635 pid = it.key();
632 break; 636 break;
633 } 637 }
634 } 638 }
635 639
636 return pid; 640 return pid;
637} 641}
638 642
639void AppLauncher::createQuickLauncher() 643void AppLauncher::createQuickLauncher()
640{ 644{
641 static bool disabled = FALSE; 645 static bool disabled = FALSE;
642 if (disabled) 646 if (disabled)
643 return; 647 return;
644 648
645 qlReady = FALSE; 649 qlReady = FALSE;
646 qlPid = ::vfork(); 650 qlPid = ::vfork();
647 if ( !qlPid ) { 651 if ( !qlPid ) {
648 char **args = new char *[2]; 652 char **args = new char *[2];
649 args[0] = "quicklauncher"; 653 args[0] = "quicklauncher";
650 args[1] = 0; 654 args[1] = 0;
651 for ( int fd = 3; fd < 100; fd++ ) 655 for ( int fd = 3; fd < 100; fd++ )
652 ::close( fd ); 656 ::close( fd );
653 ::setpgid( ::getpid(), ::getppid() ); 657 ::setpgid( ::getpid(), ::getppid() );
654 // Try bindir first, so that foo/bar works too 658 // Try bindir first, so that foo/bar works too
655 setenv( "LD_BIND_NOW", "1", 1 ); 659 setenv( "LD_BIND_NOW", "1", 1 );
656 ::execv( QPEApplication::qpeDir()+"bin/quicklauncher", args ); 660 ::execv( QPEApplication::qpeDir()+"bin/quicklauncher", args );
657 ::execvp( "quicklauncher", args ); 661 ::execvp( "quicklauncher", args );
658 delete []args; 662 delete []args;
659 disabled = TRUE; 663 disabled = TRUE;
660 _exit( -1 ); 664 _exit( -1 );
661 } else if ( qlPid == -1 ) { 665 } else if ( qlPid == -1 ) {
662 qlPid = 0; 666 qlPid = 0;
663 } else { 667 } else {
664 if ( getuid() == 0 ) 668 if ( getuid() == 0 )
665 setpriority( PRIO_PROCESS, qlPid, 19 ); 669 setpriority( PRIO_PROCESS, qlPid, 19 );
666 } 670 }
667} 671}
668 672
669// Used only by Win32 673// Used only by Win32
670void AppLauncher::processExited() 674void AppLauncher::processExited()
671{ 675{
672#ifdef Q_OS_WIN32 676#ifdef Q_OS_WIN32
673 qDebug("AppLauncher::processExited()"); 677 qDebug("AppLauncher::processExited()");
674 bool found = FALSE; 678 bool found = FALSE;
675 QProcess *proc = (QProcess *) sender(); 679 QProcess *proc = (QProcess *) sender();
676 if (!proc){ 680 if (!proc){
677 qDebug("Interanl error NULL proc"); 681 qDebug("Interanl error NULL proc");
678 return; 682 return;
679 } 683 }
680 684
681 QString appName = proc->arguments()[0]; 685 QString appName = proc->arguments()[0];
682 qDebug("Removing application %s", appName.latin1()); 686 qDebug("Removing application %s", appName.latin1());
683 runningAppsProc.remove(proc); 687 runningAppsProc.remove(proc);
684 688
685 QMap<QString,int>::Iterator hbit = waitingHeartbeat.find(appName); 689 QMap<QString,int>::Iterator hbit = waitingHeartbeat.find(appName);
686 if ( hbit != waitingHeartbeat.end() ) { 690 if ( hbit != waitingHeartbeat.end() ) {
687 killTimer( *hbit ); 691 killTimer( *hbit );
688 waitingHeartbeat.remove( hbit ); 692 waitingHeartbeat.remove( hbit );
689 } 693 }
690 if ( appName == appKillerName ) { 694 if ( appName == appKillerName ) {
691 appKillerName = QString::null; 695 appKillerName = QString::null;
692 delete appKillerBox; 696 delete appKillerBox;
693 appKillerBox = 0; 697 appKillerBox = 0;
694 } 698 }
695 699
696 // Search for the app to find its PID 700 // Search for the app to find its PID
697 QMap<int, QString>::Iterator it; 701 QMap<int, QString>::Iterator it;
698 for (it = runningApps.begin(); it!= runningApps.end(); ++it){ 702 for (it = runningApps.begin(); it!= runningApps.end(); ++it){
699 if (it.data() == appName){ 703 if (it.data() == appName){
700 found = TRUE; 704 found = TRUE;
701 break; 705 break;
702 } 706 }
703 } 707 }
704 708
705 if (found){ 709 if (found){
706 emit terminated(it.key(), it.data()); 710 emit terminated(it.key(), it.data());
707 runningApps.remove(it.key()); 711 runningApps.remove(it.key());
708 }else{ 712 }else{
709 qDebug("Internal error application %s not listed as running", appName.latin1()); 713 qDebug("Internal error application %s not listed as running", appName.latin1());
710 } 714 }
711 715
712#endif 716#endif
713} 717}
714 718
diff --git a/core/launcher/inputmethods.cpp b/core/launcher/inputmethods.cpp
index 8f3e812..62e316c 100644
--- a/core/launcher/inputmethods.cpp
+++ b/core/launcher/inputmethods.cpp
@@ -1,626 +1,630 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#define QTOPIA_INTERNAL_LANGLIST 21#define QTOPIA_INTERNAL_LANGLIST
22#include "inputmethods.h" 22#include "inputmethods.h"
23 23
24#include <qtopia/config.h> 24#include <qtopia/config.h>
25#include <qtopia/qpeapplication.h> 25#include <qtopia/qpeapplication.h>
26#include <qtopia/inputmethodinterface.h> 26#include <qtopia/inputmethodinterface.h>
27#include <qtopia/global.h> 27#include <qtopia/global.h>
28 28
29#include <qpopupmenu.h> 29#include <qpopupmenu.h>
30#include <qpushbutton.h> 30#include <qpushbutton.h>
31#include <qtoolbutton.h> 31#include <qtoolbutton.h>
32#include <qwidgetstack.h> 32#include <qwidgetstack.h>
33#include <qwidget.h> 33#include <qwidget.h>
34#include <qlayout.h> 34#include <qlayout.h>
35#include <qtimer.h> 35#include <qtimer.h>
36#include <qdir.h> 36#include <qdir.h>
37#include <stdlib.h> 37#include <stdlib.h>
38#include <qtranslator.h> 38#include <qtranslator.h>
39#include <qtl.h> 39#include <qtl.h>
40 40
41#ifdef Q_WS_QWS 41#ifdef Q_WS_QWS
42#include <qwindowsystem_qws.h> 42#include <qwindowsystem_qws.h>
43#include <qwsevent_qws.h> 43#include <qwsevent_qws.h>
44#include <qcopchannel_qws.h> 44#include <qcopchannel_qws.h>
45#endif 45#endif
46 46
47/* ### SingleFloppy if someone is interested? */ 47/* ### SingleFloppy if someone is interested? */
48#if 0 48#if 0
49#ifdef QT_NO_COMPONENT 49#ifdef QT_NO_COMPONENT
50#include "../plugins/inputmethods/handwriting/handwritingimpl.h" 50#include "../plugins/inputmethods/handwriting/handwritingimpl.h"
51#include "../plugins/inputmethods/keyboard/keyboardimpl.h" 51#include "../plugins/inputmethods/keyboard/keyboardimpl.h"
52#include "../3rdparty/plugins/inputmethods/pickboard/pickboardimpl.h" 52#include "../3rdparty/plugins/inputmethods/pickboard/pickboardimpl.h"
53#endif 53#endif
54#endif 54#endif
55 55
56/* XPM */ 56/* XPM */
57static const char * tri_xpm[]={ 57static const char * tri_xpm[]={
58"9 9 2 1", 58"9 9 2 1",
59"a c #000000", 59"a c #000000",
60". c None", 60". c None",
61".........", 61".........",
62".........", 62".........",
63".........", 63".........",
64"....a....", 64"....a....",
65"...aaa...", 65"...aaa...",
66"..aaaaa..", 66"..aaaaa..",
67".aaaaaaa.", 67".aaaaaaa.",
68".........", 68".........",
69"........."}; 69"........."};
70 70
71int InputMethod::operator <(const InputMethod& o) const 71int InputMethod::operator <(const InputMethod& o) const
72{ 72{
73 return name() < o.name(); 73 return name() < o.name();
74} 74}
75int InputMethod::operator >(const InputMethod& o) const 75int InputMethod::operator >(const InputMethod& o) const
76{ 76{
77 return name() > o.name(); 77 return name() > o.name();
78} 78}
79int InputMethod::operator <=(const InputMethod& o) const 79int InputMethod::operator <=(const InputMethod& o) const
80{ 80{
81 return name() <= o.name(); 81 return name() <= o.name();
82} 82}
83 83
84 84
85/* 85/*
86 Slightly hacky: We use WStyle_Tool as a flag to say "this widget 86 Slightly hacky: We use WStyle_Tool as a flag to say "this widget
87 belongs to the IM system, so clicking it should not cause a reset". 87 belongs to the IM system, so clicking it should not cause a reset".
88 */ 88 */
89class IMToolButton : public QToolButton 89class IMToolButton : public QToolButton
90{ 90{
91public: 91public:
92 IMToolButton::IMToolButton( QWidget *parent ) : QToolButton( parent ) 92 IMToolButton::IMToolButton( QWidget *parent ) : QToolButton( parent )
93 { setWFlags( WStyle_Tool ); } 93 { setWFlags( WStyle_Tool ); }
94}; 94};
95 95
96 96
97InputMethods::InputMethods( QWidget *parent ) : 97InputMethods::InputMethods( QWidget *parent ) :
98 QWidget( parent, "InputMethods", WStyle_Tool | WStyle_Customize ), 98 QWidget( parent, "InputMethods", WStyle_Tool | WStyle_Customize ),
99 mkeyboard(0), imethod(0) 99 mkeyboard(0), imethod(0)
100{ 100{
101 Config cfg( "Launcher" ); 101 Config cfg( "Launcher" );
102 cfg.setGroup( "InputMethods" ); 102 cfg.setGroup( "InputMethods" );
103 inputWidgetStyle = QWidget::WStyle_Customize | QWidget::WStyle_StaysOnTop | QWidget::WGroupLeader | QWidget::WStyle_Tool; 103 inputWidgetStyle = QWidget::WStyle_Customize | QWidget::WStyle_StaysOnTop | QWidget::WGroupLeader | QWidget::WStyle_Tool;
104 inputWidgetStyle |= cfg.readBoolEntry( "Float", false ) ? QWidget::WStyle_DialogBorder : 0; 104 inputWidgetStyle |= cfg.readBoolEntry( "Float", false ) ? QWidget::WStyle_DialogBorder : 0;
105 inputWidgetWidth = cfg.readNumEntry( "Width", 100 ); 105 inputWidgetWidth = cfg.readNumEntry( "Width", 100 );
106 106
107 setBackgroundMode( PaletteBackground ); 107 setBackgroundMode( PaletteBackground );
108 QHBoxLayout *hbox = new QHBoxLayout( this ); 108 QHBoxLayout *hbox = new QHBoxLayout( this );
109 109
110 kbdButton = new IMToolButton( this); 110 kbdButton = new IMToolButton( this);
111 kbdButton->setFocusPolicy(NoFocus); 111 kbdButton->setFocusPolicy(NoFocus);
112 kbdButton->setToggleButton( TRUE ); 112 kbdButton->setToggleButton( TRUE );
113 if (parent->sizeHint().height() > 0) 113 if (parent->sizeHint().height() > 0)
114 kbdButton->setFixedHeight( parent->sizeHint().height() ); 114 kbdButton->setFixedHeight( parent->sizeHint().height() );
115 kbdButton->setFixedWidth( 32 ); 115 kbdButton->setFixedWidth( 32 );
116 kbdButton->setAutoRaise( TRUE ); 116 kbdButton->setAutoRaise( TRUE );
117 kbdButton->setUsesBigPixmap( TRUE ); 117 kbdButton->setUsesBigPixmap( TRUE );
118 hbox->addWidget( kbdButton ); 118 hbox->addWidget( kbdButton );
119 connect( kbdButton, SIGNAL(toggled(bool)), this, SLOT(showKbd(bool)) ); 119 connect( kbdButton, SIGNAL(toggled(bool)), this, SLOT(showKbd(bool)) );
120 120
121 kbdChoice = new IMToolButton( this ); 121 kbdChoice = new IMToolButton( this );
122 kbdChoice->setFocusPolicy(NoFocus); 122 kbdChoice->setFocusPolicy(NoFocus);
123 kbdChoice->setPixmap( QPixmap( (const char **)tri_xpm ) ); 123 kbdChoice->setPixmap( QPixmap( (const char **)tri_xpm ) );
124 if (parent->sizeHint().height() > 0) 124 if (parent->sizeHint().height() > 0)
125 kbdChoice->setFixedHeight( parent->sizeHint().height() ); 125 kbdChoice->setFixedHeight( parent->sizeHint().height() );
126 kbdChoice->setFixedWidth( 13 ); 126 kbdChoice->setFixedWidth( 13 );
127 kbdChoice->setAutoRaise( TRUE ); 127 kbdChoice->setAutoRaise( TRUE );
128 hbox->addWidget( kbdChoice ); 128 hbox->addWidget( kbdChoice );
129 connect( kbdChoice, SIGNAL(clicked()), this, SLOT(chooseKbd()) ); 129 connect( kbdChoice, SIGNAL(clicked()), this, SLOT(chooseKbd()) );
130 130
131 connect( (QPEApplication*)qApp, SIGNAL(clientMoused()), 131 connect( (QPEApplication*)qApp, SIGNAL(clientMoused()),
132 this, SLOT(resetStates()) ); 132 this, SLOT(resetStates()) );
133 133
134 134
135 imButton = new QWidgetStack( this ); // later a widget stack 135 imButton = new QWidgetStack( this ); // later a widget stack
136 imButton->setFocusPolicy(NoFocus); 136 imButton->setFocusPolicy(NoFocus);
137 if (parent->sizeHint().height() > 0) 137 if (parent->sizeHint().height() > 0)
138 imButton->setFixedHeight( parent->sizeHint().height() ); 138 imButton->setFixedHeight( parent->sizeHint().height() );
139 hbox->addWidget(imButton); 139 hbox->addWidget(imButton);
140 140
141 imChoice = new QToolButton( this ); 141 imChoice = new QToolButton( this );
142 imChoice->setFocusPolicy(NoFocus); 142 imChoice->setFocusPolicy(NoFocus);
143 imChoice->setPixmap( QPixmap( (const char **)tri_xpm ) ); 143 imChoice->setPixmap( QPixmap( (const char **)tri_xpm ) );
144 if (parent->sizeHint().height() > 0) 144 if (parent->sizeHint().height() > 0)
145 imChoice->setFixedHeight( parent->sizeHint().height() ); 145 imChoice->setFixedHeight( parent->sizeHint().height() );
146 imChoice->setFixedWidth( 13 ); 146 imChoice->setFixedWidth( 13 );
147 imChoice->setAutoRaise( TRUE ); 147 imChoice->setAutoRaise( TRUE );
148 hbox->addWidget( imChoice ); 148 hbox->addWidget( imChoice );
149 connect( imChoice, SIGNAL(clicked()), this, SLOT(chooseIm()) ); 149 connect( imChoice, SIGNAL(clicked()), this, SLOT(chooseIm()) );
150 150
151 loadInputMethods(); 151 loadInputMethods();
152 152
153 QCopChannel *channel = new QCopChannel( "QPE/IME", this ); 153 QCopChannel *channel = new QCopChannel( "QPE/IME", this );
154 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 154 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
155 this, SLOT(qcopReceive(const QCString&, const QByteArray&)) ); 155 this, SLOT(qcopReceive(const QCString&, const QByteArray&)) );
156} 156}
157 157
158InputMethods::~InputMethods() 158InputMethods::~InputMethods()
159{ 159{
160 Config cfg("qpe"); 160 Config cfg("qpe");
161 cfg.setGroup("InputMethod"); 161 cfg.setGroup("InputMethod");
162 if (imethod) 162 if (imethod)
163 cfg.writeEntry("im", imethod->name() ); 163 cfg.writeEntry("im", imethod->name() );
164 if (mkeyboard) 164 if (mkeyboard)
165 cfg.writeEntry("current", mkeyboard->name() ); 165 cfg.writeEntry("current", mkeyboard->name() );
166 166
167 unloadInputMethods(); 167 unloadInputMethods();
168} 168}
169 169
170void InputMethods::hideInputMethod() 170void InputMethods::hideInputMethod()
171{ 171{
172 kbdButton->setOn( FALSE ); 172 kbdButton->setOn( FALSE );
173} 173}
174 174
175void InputMethods::showInputMethod() 175void InputMethods::showInputMethod()
176{ 176{
177 kbdButton->setOn( TRUE ); 177 kbdButton->setOn( TRUE );
178} 178}
179 179
180void InputMethods::showInputMethod(const QString& name) 180void InputMethods::showInputMethod(const QString& name)
181{ 181{
182 int i = 0; 182 int i = 0;
183 QValueList<InputMethod>::Iterator it; 183 QValueList<InputMethod>::Iterator it;
184 InputMethod *im = 0; 184 InputMethod *im = 0;
185 for ( it = inputMethodList.begin(); it != inputMethodList.end(); ++it, i++ ) { 185 for ( it = inputMethodList.begin(); it != inputMethodList.end(); ++it, i++ ) {
186 QString lname = (*it).libName.mid((*it).libName.findRev('/') + 1); 186 QString lname = (*it).libName.mid((*it).libName.findRev('/') + 1);
187 if ( (*it).name() == name || lname == name ) { 187 if ( (*it).name() == name || lname == name ) {
188 im = &(*it); 188 im = &(*it);
189 break; 189 break;
190 } 190 }
191 } 191 }
192 if ( im ) 192 if ( im )
193 chooseKeyboard(im); 193 chooseKeyboard(im);
194} 194}
195 195
196void InputMethods::resetStates() 196void InputMethods::resetStates()
197{ 197{
198 if ( mkeyboard && !mkeyboard->newIM ) 198 if ( mkeyboard && !mkeyboard->newIM )
199 mkeyboard->interface->resetState(); 199 mkeyboard->interface->resetState();
200} 200}
201 201
202QRect InputMethods::inputRect() const 202QRect InputMethods::inputRect() const
203{ 203{
204 if ( !mkeyboard || !mkeyboard->widget || !mkeyboard->widget->isVisible() ) 204 if ( !mkeyboard || !mkeyboard->widget || !mkeyboard->widget->isVisible() )
205 return QRect(); 205 return QRect();
206 else 206 else
207 return mkeyboard->widget->geometry(); 207 return mkeyboard->widget->geometry();
208} 208}
209 209
210void InputMethods::unloadInputMethods() 210void InputMethods::unloadInputMethods()
211{ 211{
212 unloadMethod( inputMethodList ); 212 unloadMethod( inputMethodList );
213 unloadMethod( inputModifierList ); 213 unloadMethod( inputModifierList );
214 inputMethodList.clear(); 214 inputMethodList.clear();
215 inputModifierList.clear(); 215 inputModifierList.clear();
216 216
217} 217}
218 218
219void InputMethods::unloadMethod( QValueList<InputMethod>& list ) { 219void InputMethods::unloadMethod( QValueList<InputMethod>& list ) {
220 QValueList<InputMethod>::Iterator it; 220 QValueList<InputMethod>::Iterator it;
221 221
222 for (it = list.begin(); it != list.end(); ++it ) 222 for (it = list.begin(); it != list.end(); ++it )
223 (*it).releaseInterface(); 223 (*it).releaseInterface();
224 224
225} 225}
226 226
227 227
228QStringList InputMethods::plugins()const { 228QStringList InputMethods::plugins()const {
229 QString path = QPEApplication::qpeDir() + "/plugins/inputmethods"; 229 QString path = QPEApplication::qpeDir() + "/plugins/inputmethods";
230#ifdef Q_OS_MACX
231 QDir dir( path, "lib*.dylib" );
232#else
230 QDir dir( path, "lib*.so" ); 233 QDir dir( path, "lib*.so" );
234#endif /* Q_OS_MACX */
231 return dir.entryList(); 235 return dir.entryList();
232} 236}
233 237
234void InputMethods::installTranslator( const QString& type ) { 238void InputMethods::installTranslator( const QString& type ) {
235 QStringList langs = Global::languageList(); 239 QStringList langs = Global::languageList();
236 QStringList::ConstIterator lit; 240 QStringList::ConstIterator lit;
237 for ( lit= langs.begin(); lit!=langs.end(); ++lit) { 241 for ( lit= langs.begin(); lit!=langs.end(); ++lit) {
238 QString lang = *lit; 242 QString lang = *lit;
239 QTranslator * trans = new QTranslator(qApp); 243 QTranslator * trans = new QTranslator(qApp);
240 244
241 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; 245 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm";
242 246
243 if ( trans->load( tfn )) 247 if ( trans->load( tfn ))
244 qApp->installTranslator( trans ); 248 qApp->installTranslator( trans );
245 else 249 else
246 delete trans; 250 delete trans;
247 } 251 }
248} 252}
249 253
250void InputMethods::setPreferedHandlers() { 254void InputMethods::setPreferedHandlers() {
251 Config cfg("qpe"); 255 Config cfg("qpe");
252 cfg.setGroup("InputMethod"); 256 cfg.setGroup("InputMethod");
253 QString current = cfg.readEntry("current"); 257 QString current = cfg.readEntry("current");
254 QString im = cfg.readEntry("im"); 258 QString im = cfg.readEntry("im");
255 259
256 QValueList<InputMethod>::Iterator it; 260 QValueList<InputMethod>::Iterator it;
257 if (!inputModifierList.isEmpty() && !im.isEmpty() ) { 261 if (!inputModifierList.isEmpty() && !im.isEmpty() ) {
258 for (it = inputModifierList.begin(); it != inputModifierList.end(); ++it ) 262 for (it = inputModifierList.begin(); it != inputModifierList.end(); ++it )
259 if ( (*it).name() == im ) { 263 if ( (*it).name() == im ) {
260 imethod = &(*it); break; 264 imethod = &(*it); break;
261 } 265 }
262 266
263 } 267 }
264 if (!inputMethodList.isEmpty() && !current.isEmpty() ) { 268 if (!inputMethodList.isEmpty() && !current.isEmpty() ) {
265 for (it = inputMethodList.begin(); it != inputMethodList.end(); ++it ) 269 for (it = inputMethodList.begin(); it != inputMethodList.end(); ++it )
266 if ( (*it).name() == current ) { 270 if ( (*it).name() == current ) {
267 qWarning("preferred keyboard is %s", current.latin1() ); 271 qWarning("preferred keyboard is %s", current.latin1() );
268 mkeyboard = &(*it); 272 mkeyboard = &(*it);
269 kbdButton->setPixmap( *mkeyboard->icon() ); 273 kbdButton->setPixmap( *mkeyboard->icon() );
270 break; 274 break;
271 } 275 }
272 } 276 }
273 277
274} 278}
275 279
276void InputMethods::loadInputMethods() 280void InputMethods::loadInputMethods()
277{ 281{
278#ifndef QT_NO_COMPONENT 282#ifndef QT_NO_COMPONENT
279 hideInputMethod(); 283 hideInputMethod();
280 mkeyboard = 0; 284 mkeyboard = 0;
281 285
282 unloadInputMethods(); 286 unloadInputMethods();
283 287
284 QString path = QPEApplication::qpeDir() + "/plugins/inputmethods"; 288 QString path = QPEApplication::qpeDir() + "/plugins/inputmethods";
285 QStringList list = plugins(); 289 QStringList list = plugins();
286 QStringList::Iterator it; 290 QStringList::Iterator it;
287 for ( it = list.begin(); it != list.end(); ++it ) { 291 for ( it = list.begin(); it != list.end(); ++it ) {
288 InputMethodInterface *iface = 0; 292 InputMethodInterface *iface = 0;
289 ExtInputMethodInterface *eface = 0; 293 ExtInputMethodInterface *eface = 0;
290 QLibrary *lib = new QLibrary( path + "/" + *it ); 294 QLibrary *lib = new QLibrary( path + "/" + *it );
291 295
292 if ( lib->queryInterface( IID_InputMethod, (QUnknownInterface**)&iface ) == QS_OK ) { 296 if ( lib->queryInterface( IID_InputMethod, (QUnknownInterface**)&iface ) == QS_OK ) {
293 InputMethod input; 297 InputMethod input;
294 input.newIM = FALSE; 298 input.newIM = FALSE;
295 input.library = lib; 299 input.library = lib;
296 input.libName = *it; 300 input.libName = *it;
297 input.interface = iface; 301 input.interface = iface;
298 input.widget = input.interface->inputMethod( 0, inputWidgetStyle ); 302 input.widget = input.interface->inputMethod( 0, inputWidgetStyle );
299 input.interface->onKeyPress( this, SLOT(sendKey(ushort,ushort,ushort,bool,bool)) ); 303 input.interface->onKeyPress( this, SLOT(sendKey(ushort,ushort,ushort,bool,bool)) );
300 inputMethodList.append( input ); 304 inputMethodList.append( input );
301 } else if ( lib->queryInterface( IID_ExtInputMethod, (QUnknownInterface**)&eface ) == QS_OK ) { 305 } else if ( lib->queryInterface( IID_ExtInputMethod, (QUnknownInterface**)&eface ) == QS_OK ) {
302 InputMethod input; 306 InputMethod input;
303 input.newIM = TRUE; 307 input.newIM = TRUE;
304 input.library = lib; 308 input.library = lib;
305 input.libName = *it; 309 input.libName = *it;
306 input.extInterface = eface; 310 input.extInterface = eface;
307 input.widget = input.extInterface->keyboardWidget( 0, inputWidgetStyle ); 311 input.widget = input.extInterface->keyboardWidget( 0, inputWidgetStyle );
308 // may be either a simple, or advanced. 312 // may be either a simple, or advanced.
309 if (input.widget) { 313 if (input.widget) {
310 //qDebug("its a keyboard"); 314 //qDebug("its a keyboard");
311 inputMethodList.append( input ); 315 inputMethodList.append( input );
312 } else { 316 } else {
313 //qDebug("its a real im"); 317 //qDebug("its a real im");
314 input.widget = input.extInterface->statusWidget( 0, 0 ); 318 input.widget = input.extInterface->statusWidget( 0, 0 );
315 if (input.widget) { 319 if (input.widget) {
316 //qDebug("blah"); 320 //qDebug("blah");
317 inputModifierList.append( input ); 321 inputModifierList.append( input );
318 imButton->addWidget(input.widget, inputModifierList.count()); 322 imButton->addWidget(input.widget, inputModifierList.count());
319 } 323 }
320 } 324 }
321 }else{ 325 }else{
322 delete lib; 326 delete lib;
323 lib = 0l; 327 lib = 0l;
324 } 328 }
325 installTranslator( (*it).left( (*it).find(".") ) ); 329 installTranslator( (*it).left( (*it).find(".") ) );
326 } 330 }
327 qHeapSort( inputMethodList ); 331 qHeapSort( inputMethodList );
328#endif /* killed BUILT in cause they would not compile */ 332#endif /* killed BUILT in cause they would not compile */
329 333
330 QWSServer::setCurrentInputMethod( 0 ); 334 QWSServer::setCurrentInputMethod( 0 );
331 335
332 /* set the prefered IM + handler */ 336 /* set the prefered IM + handler */
333 setPreferedHandlers(); 337 setPreferedHandlers();
334 if ( !inputModifierList.isEmpty() ) { 338 if ( !inputModifierList.isEmpty() ) {
335 if (!imethod) 339 if (!imethod)
336 imethod = &inputModifierList[0]; 340 imethod = &inputModifierList[0];
337 imButton->raiseWidget(imethod->widget); 341 imButton->raiseWidget(imethod->widget);
338 QWSServer::setCurrentInputMethod( imethod->extInterface->inputMethod() ); 342 QWSServer::setCurrentInputMethod( imethod->extInterface->inputMethod() );
339 } else { 343 } else {
340 imethod = 0; 344 imethod = 0;
341 } 345 }
342 346
343 // we need to update keyboards afterwards, as some of them may not be compatible with 347 // we need to update keyboards afterwards, as some of them may not be compatible with
344 // the current input method 348 // the current input method
345 updateKeyboards(imethod); 349 updateKeyboards(imethod);
346 350
347 if ( !inputModifierList.isEmpty() ) 351 if ( !inputModifierList.isEmpty() )
348 imButton->show(); 352 imButton->show();
349 else 353 else
350 imButton->hide(); 354 imButton->hide();
351 355
352 if ( inputModifierList.count() > 1 ) 356 if ( inputModifierList.count() > 1 )
353 imChoice->show(); 357 imChoice->show();
354 else 358 else
355 imChoice->hide(); 359 imChoice->hide();
356} 360}
357 361
358void InputMethods::chooseKbd() 362void InputMethods::chooseKbd()
359{ 363{
360 QPopupMenu pop( this ); 364 QPopupMenu pop( this );
361 pop.setFocusPolicy( NoFocus ); //don't reset IM 365 pop.setFocusPolicy( NoFocus ); //don't reset IM
362 366
363 QString imname; 367 QString imname;
364 if (imethod) 368 if (imethod)
365 imname = imethod->libName.mid(imethod->libName.findRev('/') + 1); 369 imname = imethod->libName.mid(imethod->libName.findRev('/') + 1);
366 370
367 int i = 0; 371 int i = 0;
368 int firstDepKbd = 0; 372 int firstDepKbd = 0;
369 373
370 QValueList<InputMethod>::Iterator it; 374 QValueList<InputMethod>::Iterator it;
371 for ( it = inputMethodList.begin(); it != inputMethodList.end(); ++it, i++ ) { 375 for ( it = inputMethodList.begin(); it != inputMethodList.end(); ++it, i++ ) {
372 // add empty new items, all old items. 376 // add empty new items, all old items.
373 if (!(*it).newIM || (*it).extInterface->compatible().count() == 0 ) { 377 if (!(*it).newIM || (*it).extInterface->compatible().count() == 0 ) {
374 pop.insertItem( (*it).name(), i, firstDepKbd); 378 pop.insertItem( (*it).name(), i, firstDepKbd);
375 if ( mkeyboard == &(*it) ) 379 if ( mkeyboard == &(*it) )
376 pop.setItemChecked( i, TRUE ); 380 pop.setItemChecked( i, TRUE );
377 381
378 firstDepKbd++; 382 firstDepKbd++;
379 } else if ( (*it).extInterface->compatible().contains(imname)) { 383 } else if ( (*it).extInterface->compatible().contains(imname)) {
380 // check if we need to insert a sep. 384 // check if we need to insert a sep.
381 if (firstDepKbd == i) 385 if (firstDepKbd == i)
382 pop.insertSeparator(); 386 pop.insertSeparator();
383 pop.insertItem( (*it).name(), i, -1); 387 pop.insertItem( (*it).name(), i, -1);
384 if ( mkeyboard == &(*it) ) 388 if ( mkeyboard == &(*it) )
385 pop.setItemChecked( i, TRUE ); 389 pop.setItemChecked( i, TRUE );
386 } 390 }
387 } 391 }
388 392
389 QPoint pt = mapToGlobal(kbdChoice->geometry().topRight()); 393 QPoint pt = mapToGlobal(kbdChoice->geometry().topRight());
390 QSize s = pop.sizeHint(); 394 QSize s = pop.sizeHint();
391 pt.ry() -= s.height(); 395 pt.ry() -= s.height();
392 pt.rx() -= s.width(); 396 pt.rx() -= s.width();
393 i = pop.exec( pt ); 397 i = pop.exec( pt );
394 if ( i == -1 ) 398 if ( i == -1 )
395 return; 399 return;
396 InputMethod *im = &inputMethodList[i]; 400 InputMethod *im = &inputMethodList[i];
397 chooseKeyboard(im); 401 chooseKeyboard(im);
398} 402}
399 403
400void InputMethods::chooseIm() 404void InputMethods::chooseIm()
401{ 405{
402 QPopupMenu pop( this ); 406 QPopupMenu pop( this );
403 407
404 int i = 0; 408 int i = 0;
405 QValueList<InputMethod>::Iterator it; 409 QValueList<InputMethod>::Iterator it;
406 for ( it = inputModifierList.begin(); it != inputModifierList.end(); ++it, i++ ) { 410 for ( it = inputModifierList.begin(); it != inputModifierList.end(); ++it, i++ ) {
407 pop.insertItem( (*it).name(), i ); 411 pop.insertItem( (*it).name(), i );
408 if ( imethod == &(*it) ) 412 if ( imethod == &(*it) )
409 pop.setItemChecked( i, TRUE ); 413 pop.setItemChecked( i, TRUE );
410 } 414 }
411 415
412 QPoint pt = mapToGlobal(imChoice->geometry().topRight()); 416 QPoint pt = mapToGlobal(imChoice->geometry().topRight());
413 QSize s = pop.sizeHint(); 417 QSize s = pop.sizeHint();
414 pt.ry() -= s.height(); 418 pt.ry() -= s.height();
415 pt.rx() -= s.width(); 419 pt.rx() -= s.width();
416 i = pop.exec( pt ); 420 i = pop.exec( pt );
417 if ( i == -1 ) 421 if ( i == -1 )
418 return; 422 return;
419 InputMethod *im = &inputModifierList[i]; 423 InputMethod *im = &inputModifierList[i];
420 424
421 chooseMethod(im); 425 chooseMethod(im);
422} 426}
423 427
424void InputMethods::chooseKeyboard(InputMethod* im) 428void InputMethods::chooseKeyboard(InputMethod* im)
425{ 429{
426 if ( im != mkeyboard ) { 430 if ( im != mkeyboard ) {
427 if ( mkeyboard && mkeyboard->widget->isVisible() ) 431 if ( mkeyboard && mkeyboard->widget->isVisible() )
428 mkeyboard->widget->hide(); 432 mkeyboard->widget->hide();
429 mkeyboard = im; 433 mkeyboard = im;
430 kbdButton->setPixmap( *mkeyboard->icon() ); 434 kbdButton->setPixmap( *mkeyboard->icon() );
431 } 435 }
432 if ( !kbdButton->isOn() ) 436 if ( !kbdButton->isOn() )
433 kbdButton->setOn( TRUE ); 437 kbdButton->setOn( TRUE );
434 else 438 else
435 showKbd( TRUE ); 439 showKbd( TRUE );
436} 440}
437 441
438static bool keyboardCompatible(InputMethod *keyb, const QString &imname ) 442static bool keyboardCompatible(InputMethod *keyb, const QString &imname )
439{ 443{
440 if ( !keyb || !keyb->newIM || !keyb->extInterface->compatible().count() ) 444 if ( !keyb || !keyb->newIM || !keyb->extInterface->compatible().count() )
441 return TRUE; 445 return TRUE;
442 446
443 if ( keyb->extInterface->compatible().contains(imname) ) 447 if ( keyb->extInterface->compatible().contains(imname) )
444 return TRUE; 448 return TRUE;
445 449
446 return FALSE; 450 return FALSE;
447} 451}
448 452
449// Updates the display of the soft keyboards available to the current input method 453// Updates the display of the soft keyboards available to the current input method
450void InputMethods::updateKeyboards(InputMethod *im ) 454void InputMethods::updateKeyboards(InputMethod *im )
451{ 455{
452 uint count; 456 uint count;
453 457
454 if ( im ) { 458 if ( im ) {
455 QString imname = im->libName.mid(im->libName.findRev('/') + 1); 459 QString imname = im->libName.mid(im->libName.findRev('/') + 1);
456 460
457 if ( mkeyboard && !keyboardCompatible(mkeyboard, imname) ) { 461 if ( mkeyboard && !keyboardCompatible(mkeyboard, imname) ) {
458 kbdButton->setOn( FALSE ); 462 kbdButton->setOn( FALSE );
459 showKbd( FALSE ); 463 showKbd( FALSE );
460 mkeyboard = 0; 464 mkeyboard = 0;
461 } 465 }
462 466
463 count = 0; 467 count = 0;
464 468
465 QValueList<InputMethod>::Iterator it; 469 QValueList<InputMethod>::Iterator it;
466 for ( it = inputMethodList.begin(); it != inputMethodList.end(); ++it ) { 470 for ( it = inputMethodList.begin(); it != inputMethodList.end(); ++it ) {
467 if ( keyboardCompatible( &(*it), imname ) ) { 471 if ( keyboardCompatible( &(*it), imname ) ) {
468 if ( !mkeyboard ) { 472 if ( !mkeyboard ) {
469 mkeyboard = &(*it); 473 mkeyboard = &(*it);
470 kbdButton->setPixmap( *mkeyboard->icon() ); 474 kbdButton->setPixmap( *mkeyboard->icon() );
471 } 475 }
472 476
473 count++; 477 count++;
474 } 478 }
475 } 479 }
476 } else { 480 } else {
477 count = inputMethodList.count(); 481 count = inputMethodList.count();
478 if ( count && !mkeyboard ) { 482 if ( count && !mkeyboard ) {
479 mkeyboard = &inputMethodList[0]; 483 mkeyboard = &inputMethodList[0];
480 kbdButton->setPixmap( *mkeyboard->icon() ); 484 kbdButton->setPixmap( *mkeyboard->icon() );
481 } else if (!count){ 485 } else if (!count){
482 mkeyboard = 0; //might be redundant 486 mkeyboard = 0; //might be redundant
483 } 487 }
484 } 488 }
485 489
486 if ( count > 1 ) 490 if ( count > 1 )
487 kbdChoice->show(); 491 kbdChoice->show();
488 else 492 else
489 kbdChoice->hide(); 493 kbdChoice->hide();
490 494
491 if ( count ) 495 if ( count )
492 kbdButton->show(); 496 kbdButton->show();
493 else 497 else
494 kbdButton->hide(); 498 kbdButton->hide();
495} 499}
496 500
497void InputMethods::chooseMethod(InputMethod* im) 501void InputMethods::chooseMethod(InputMethod* im)
498{ 502{
499 if ( im != imethod ) { 503 if ( im != imethod ) {
500 updateKeyboards( im ); 504 updateKeyboards( im );
501 505
502 Config cfg("qpe"); 506 Config cfg("qpe");
503 cfg.setGroup("InputMethod"); 507 cfg.setGroup("InputMethod");
504 if (im ) 508 if (im )
505 cfg.writeEntry("im", im->name() ); 509 cfg.writeEntry("im", im->name() );
506 if (mkeyboard) 510 if (mkeyboard)
507 cfg.writeEntry("current", mkeyboard->name() ); 511 cfg.writeEntry("current", mkeyboard->name() );
508 512
509 QWSServer::setCurrentInputMethod( 0 ); 513 QWSServer::setCurrentInputMethod( 0 );
510 imethod = im; 514 imethod = im;
511 if ( imethod && imethod->newIM ) 515 if ( imethod && imethod->newIM )
512 QWSServer::setCurrentInputMethod( imethod->extInterface->inputMethod() ); 516 QWSServer::setCurrentInputMethod( imethod->extInterface->inputMethod() );
513 else 517 else
514 QWSServer::setCurrentInputMethod( 0 ); 518 QWSServer::setCurrentInputMethod( 0 );
515 519
516 if ( im ) 520 if ( im )
517 imButton->raiseWidget(im->widget); 521 imButton->raiseWidget(im->widget);
518 else 522 else
519 imButton->hide(); //### good UI? make sure it is shown again! 523 imButton->hide(); //### good UI? make sure it is shown again!
520 } 524 }
521} 525}
522 526
523void InputMethods::qcopReceive( const QCString &msg, const QByteArray &data ) 527void InputMethods::qcopReceive( const QCString &msg, const QByteArray &data )
524{ 528{
525 if ( imethod && imethod->newIM ) 529 if ( imethod && imethod->newIM )
526 imethod->extInterface->qcopReceive( msg, data ); 530 imethod->extInterface->qcopReceive( msg, data );
527} 531}
528 532
529 533
530void InputMethods::showKbd( bool on ) 534void InputMethods::showKbd( bool on )
531{ 535{
532 if ( !mkeyboard ) 536 if ( !mkeyboard )
533 return; 537 return;
534 538
535 if ( on ) 539 if ( on )
536 { 540 {
537 mkeyboard->resetState(); 541 mkeyboard->resetState();
538 542
539 int height = QMIN( mkeyboard->widget->sizeHint().height(), 134 ); 543 int height = QMIN( mkeyboard->widget->sizeHint().height(), 134 );
540 int width = qApp->desktop()->width() * (inputWidgetWidth*0.01); 544 int width = qApp->desktop()->width() * (inputWidgetWidth*0.01);
541 int left = 0; 545 int left = 0;
542 int top = mapToGlobal( QPoint() ).y() - height; 546 int top = mapToGlobal( QPoint() ).y() - height;
543 547
544 if ( inputWidgetStyle & QWidget::WStyle_DialogBorder ) 548 if ( inputWidgetStyle & QWidget::WStyle_DialogBorder )
545 { 549 {
546 qDebug( "InputMethods: reading geometry." ); 550 qDebug( "InputMethods: reading geometry." );
547 Config cfg( "Launcher" ); 551 Config cfg( "Launcher" );
548 cfg.setGroup( "InputMethods" ); 552 cfg.setGroup( "InputMethods" );
549 int l = cfg.readNumEntry( "absX", -1 ); 553 int l = cfg.readNumEntry( "absX", -1 );
550 int t = cfg.readNumEntry( "absY", -1 ); 554 int t = cfg.readNumEntry( "absY", -1 );
551 int w = cfg.readNumEntry( "absWidth", -1 ); 555 int w = cfg.readNumEntry( "absWidth", -1 );
552 int h = cfg.readNumEntry( "absHeight", -1 ); 556 int h = cfg.readNumEntry( "absHeight", -1 );
553 557
554 if ( l > -1 && t > -1 && w > -1 && h > -1 ) 558 if ( l > -1 && t > -1 && w > -1 && h > -1 )
555 { 559 {
556 qDebug( "InputMethods: config values ( %d, %d, %d, %d ) are ok.", l, t, w, h ); 560 qDebug( "InputMethods: config values ( %d, %d, %d, %d ) are ok.", l, t, w, h );
557 left = l; 561 left = l;
558 top = t; 562 top = t;
559 width = w; 563 width = w;
560 height = h; 564 height = h;
561 } 565 }
562 else 566 else
563 { 567 {
564 qDebug( "InputMethods: config values are new or not ok." ); 568 qDebug( "InputMethods: config values are new or not ok." );
565 } 569 }
566 } 570 }
567 else 571 else
568 { 572 {
569 qDebug( "InputMethods: no floating selected." ); 573 qDebug( "InputMethods: no floating selected." );
570 } 574 }
571 mkeyboard->widget->resize( width, height ); 575 mkeyboard->widget->resize( width, height );
572 mkeyboard->widget->move( left, top ); 576 mkeyboard->widget->move( left, top );
573 mkeyboard->widget->show(); 577 mkeyboard->widget->show();
574 mkeyboard->widget->installEventFilter( this ); 578 mkeyboard->widget->installEventFilter( this );
575 } 579 }
576 else 580 else
577 { 581 {
578 if ( inputWidgetStyle & QWidget::WStyle_DialogBorder ) 582 if ( inputWidgetStyle & QWidget::WStyle_DialogBorder )
579 { 583 {
580 QPoint pos = mkeyboard->widget->pos(); 584 QPoint pos = mkeyboard->widget->pos();
581 QSize siz = mkeyboard->widget->size(); 585 QSize siz = mkeyboard->widget->size();
582 qDebug( "InputMethods: saving geometry." ); 586 qDebug( "InputMethods: saving geometry." );
583 Config cfg( "Launcher" ); 587 Config cfg( "Launcher" );
584 cfg.setGroup( "InputMethods" ); 588 cfg.setGroup( "InputMethods" );
585 cfg.writeEntry( "absX", pos.x() ); 589 cfg.writeEntry( "absX", pos.x() );
586 cfg.writeEntry( "absY", pos.y() ); 590 cfg.writeEntry( "absY", pos.y() );
587 cfg.writeEntry( "absWidth", siz.width() ); 591 cfg.writeEntry( "absWidth", siz.width() );
588 cfg.writeEntry( "absHeight", siz.height() ); 592 cfg.writeEntry( "absHeight", siz.height() );
589 cfg.write(); 593 cfg.write();
590 mkeyboard->widget->hide(); 594 mkeyboard->widget->hide();
591 mkeyboard->widget->removeEventFilter( this ); 595 mkeyboard->widget->removeEventFilter( this );
592 } 596 }
593 } 597 }
594 598
595 emit inputToggled( on ); 599 emit inputToggled( on );
596} 600}
597 601
598bool InputMethods::shown() const 602bool InputMethods::shown() const
599{ 603{
600 return mkeyboard && mkeyboard->widget->isVisible(); 604 return mkeyboard && mkeyboard->widget->isVisible();
601} 605}
602 606
603QString InputMethods::currentShown() const 607QString InputMethods::currentShown() const
604{ 608{
605 return mkeyboard && mkeyboard->widget->isVisible() 609 return mkeyboard && mkeyboard->widget->isVisible()
606 ? mkeyboard->name() : QString::null; 610 ? mkeyboard->name() : QString::null;
607} 611}
608 612
609void InputMethods::sendKey( ushort unicode, ushort scancode, ushort mod, bool press, bool repeat ) 613void InputMethods::sendKey( ushort unicode, ushort scancode, ushort mod, bool press, bool repeat )
610{ 614{
611#if defined(Q_WS_QWS) 615#if defined(Q_WS_QWS)
612 QWSServer::sendKeyEvent( unicode, scancode, mod, press, repeat ); 616 QWSServer::sendKeyEvent( unicode, scancode, mod, press, repeat );
613#endif 617#endif
614} 618}
615 619
616bool InputMethods::eventFilter( QObject* o, QEvent* e ) 620bool InputMethods::eventFilter( QObject* o, QEvent* e )
617{ 621{
618 if ( e->type() == QEvent::Close ) 622 if ( e->type() == QEvent::Close )
619 { 623 {
620 ( (QCloseEvent*) e )->ignore(); 624 ( (QCloseEvent*) e )->ignore();
621 showKbd( false ); 625 showKbd( false );
622 kbdButton->setOn( false ); 626 kbdButton->setOn( false );
623 return true; 627 return true;
624 } 628 }
625 return false; 629 return false;
626} 630}
diff --git a/core/launcher/irserver.cpp b/core/launcher/irserver.cpp
index 579c78c..63f8d05 100644
--- a/core/launcher/irserver.cpp
+++ b/core/launcher/irserver.cpp
@@ -1,73 +1,77 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21 21
22#include "irserver.h" 22#include "irserver.h"
23 23
24#include <qtopia/qlibrary.h> 24#include <qtopia/qlibrary.h>
25#include <qtopia/qpeapplication.h> 25#include <qtopia/qpeapplication.h>
26 26
27#include <qtranslator.h> 27#include <qtranslator.h>
28 28
29#include "obexinterface.h" 29#include "obexinterface.h"
30 30
31#include <qdir.h> 31#include <qdir.h>
32 32
33IrServer::IrServer( QObject *parent, const char *name ) 33IrServer::IrServer( QObject *parent, const char *name )
34 : QObject( parent, name ), obexIface(0) 34 : QObject( parent, name ), obexIface(0)
35{ 35{
36 lib = 0; 36 lib = 0;
37 obexIface = 0; 37 obexIface = 0;
38 QString path = QPEApplication::qpeDir() + "/plugins/obex/"; 38 QString path = QPEApplication::qpeDir() + "/plugins/obex/";
39#ifdef Q_OS_MACX
40 QDir dir( path, "lib*.dylib" );
41#else
39 QDir dir( path, "lib*.so" ); 42 QDir dir( path, "lib*.so" );
43#endif /* Q_OS_MACX */
40 QStringList list = dir.entryList(); 44 QStringList list = dir.entryList();
41 QStringList::Iterator it; 45 QStringList::Iterator it;
42 for ( it = list.begin(); it != list.end(); ++it ) { 46 for ( it = list.begin(); it != list.end(); ++it ) {
43 QLibrary *trylib = new QLibrary( path + *it ); 47 QLibrary *trylib = new QLibrary( path + *it );
44 //qDebug("trying lib %s", (path + (*it)).latin1() ); 48 //qDebug("trying lib %s", (path + (*it)).latin1() );
45 if ( trylib->queryInterface( IID_ObexInterface, (QUnknownInterface**)&obexIface ) == QS_OK ) { 49 if ( trylib->queryInterface( IID_ObexInterface, (QUnknownInterface**)&obexIface ) == QS_OK ) {
46 lib = trylib; 50 lib = trylib;
47 //qDebug("found obex lib" ); 51 //qDebug("found obex lib" );
48 QString lang = getenv( "LANG" ); 52 QString lang = getenv( "LANG" );
49 QTranslator * trans = new QTranslator(qApp); 53 QTranslator * trans = new QTranslator(qApp);
50 QString type = (*it).left( (*it).find(".") ); 54 QString type = (*it).left( (*it).find(".") );
51 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; 55 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm";
52 //qDebug("tr fpr obex: %s", tfn.latin1() ); 56 //qDebug("tr fpr obex: %s", tfn.latin1() );
53 if ( trans->load( tfn )) 57 if ( trans->load( tfn ))
54 qApp->installTranslator( trans ); 58 qApp->installTranslator( trans );
55 else 59 else
56 delete trans; 60 delete trans;
57 61
58 break; 62 break;
59 } else { 63 } else {
60 delete lib; 64 delete lib;
61 } 65 }
62 } 66 }
63 if ( !lib ) 67 if ( !lib )
64 qDebug("could not load IR plugin" ); 68 qDebug("could not load IR plugin" );
65} 69}
66 70
67IrServer::~IrServer() 71IrServer::~IrServer()
68{ 72{
69 if ( obexIface ) 73 if ( obexIface )
70 obexIface->release(); 74 obexIface->release();
71 delete lib; 75 delete lib;
72} 76}
73 77
diff --git a/core/launcher/main.cpp b/core/launcher/main.cpp
index 74965df..5416d33 100644
--- a/core/launcher/main.cpp
+++ b/core/launcher/main.cpp
@@ -1,354 +1,356 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#ifndef QTOPIA_INTERNAL_FILEOPERATIONS 21#ifndef QTOPIA_INTERNAL_FILEOPERATIONS
22#define QTOPIA_INTERNAL_FILEOPERATIONS 22#define QTOPIA_INTERNAL_FILEOPERATIONS
23#endif 23#endif
24#include "server.h" 24#include "server.h"
25#include "serverapp.h" 25#include "serverapp.h"
26#include "taskbar.h" 26#include "taskbar.h"
27#include "stabmon.h" 27#include "stabmon.h"
28#include "launcher.h" 28#include "launcher.h"
29#include "firstuse.h" 29#include "firstuse.h"
30#include "launcherglobal.h" 30#include "launcherglobal.h"
31 31
32#include <qtopia/qpeapplication.h> 32#include <qtopia/qpeapplication.h>
33#include <qtopia/network.h> 33#include <qtopia/network.h>
34#include <qtopia/config.h> 34#include <qtopia/config.h>
35#include <qtopia/custom.h> 35#include <qtopia/custom.h>
36#include <qtopia/global.h> 36#include <qtopia/global.h>
37 37
38#include <qfile.h> 38#include <qfile.h>
39#include <qdir.h> 39#include <qdir.h>
40#ifdef QWS 40#ifdef QWS
41#include <qwindowsystem_qws.h> 41#include <qwindowsystem_qws.h>
42#include <qtopia/qcopenvelope_qws.h> 42#include <qtopia/qcopenvelope_qws.h>
43#endif 43#endif
44#include <qtopia/alarmserver.h> 44#include <qtopia/alarmserver.h>
45 45
46#include <stdlib.h> 46#include <stdlib.h>
47#include <stdio.h> 47#include <stdio.h>
48#include <signal.h> 48#include <signal.h>
49#ifndef Q_OS_WIN32 49#ifndef Q_OS_WIN32
50#include <unistd.h> 50#include <unistd.h>
51#else 51#else
52#include <process.h> 52#include <process.h>
53#endif 53#endif
54 54
55#include "calibrate.h" 55#include "calibrate.h"
56 56
57 57
58#ifdef QT_QWS_LOGIN 58#ifdef QT_QWS_LOGIN
59#include "../login/qdmdialogimpl.h" 59#include "../login/qdmdialogimpl.h"
60#endif 60#endif
61 61
62#ifdef Q_WS_QWS 62#ifdef Q_WS_QWS
63#include <qkeyboard_qws.h> 63#include <qkeyboard_qws.h>
64#endif 64#endif
65 65
66#include <qmessagebox.h> 66#include <qmessagebox.h>
67#include <opie/odevice.h> 67#include <opie/odevice.h>
68 68
69using namespace Opie; 69using namespace Opie;
70 70
71 71
72static void cleanup() 72static void cleanup()
73{ 73{
74 QDir dir( Opie::Global::tempDir(), "qcop-msg-*" ); 74 QDir dir( Opie::Global::tempDir(), "qcop-msg-*" );
75 75
76 QStringList stale = dir.entryList(); 76 QStringList stale = dir.entryList();
77 QStringList::Iterator it; 77 QStringList::Iterator it;
78 for ( it = stale.begin(); it != stale.end(); ++it ) { 78 for ( it = stale.begin(); it != stale.end(); ++it ) {
79 dir.remove( *it ); 79 dir.remove( *it );
80 } 80 }
81} 81}
82 82
83static void refreshTimeZoneConfig() 83static void refreshTimeZoneConfig()
84{ 84{
85 /* ### FIXME timezone handling */ 85 /* ### FIXME timezone handling */
86#if 0 86#if 0
87 // We need to help WorldTime in setting up its configuration for 87 // We need to help WorldTime in setting up its configuration for
88 // the current translation 88 // the current translation
89 // BEGIN no tr 89 // BEGIN no tr
90 const char *defaultTz[] = { 90 const char *defaultTz[] = {
91 "America/New_York", 91 "America/New_York",
92 "America/Los_Angeles", 92 "America/Los_Angeles",
93 "Europe/Oslo", 93 "Europe/Oslo",
94 "Asia/Tokyo", 94 "Asia/Tokyo",
95 "Asia/Hong_Kong", 95 "Asia/Hong_Kong",
96 "Australia/Brisbane", 96 "Australia/Brisbane",
97 0 97 0
98 }; 98 };
99 // END no tr 99 // END no tr
100 100
101 TimeZone curZone; 101 TimeZone curZone;
102 QString zoneID; 102 QString zoneID;
103 int zoneIndex; 103 int zoneIndex;
104 Config cfg = Config( "WorldTime" ); 104 Config cfg = Config( "WorldTime" );
105 cfg.setGroup( "TimeZones" ); 105 cfg.setGroup( "TimeZones" );
106 if (!cfg.hasKey( "Zone0" )){ 106 if (!cfg.hasKey( "Zone0" )){
107 // We have no existing timezones use the defaults which are untranslated strings 107 // We have no existing timezones use the defaults which are untranslated strings
108 QString currTz = TimeZone::current().id(); 108 QString currTz = TimeZone::current().id();
109 QStringList zoneDefaults; 109 QStringList zoneDefaults;
110 zoneDefaults.append( currTz ); 110 zoneDefaults.append( currTz );
111 for ( int i = 0; defaultTz[i] && zoneDefaults.count() < 6; i++ ) { 111 for ( int i = 0; defaultTz[i] && zoneDefaults.count() < 6; i++ ) {
112 if ( defaultTz[i] != currTz ) 112 if ( defaultTz[i] != currTz )
113 zoneDefaults.append( defaultTz[i] ); 113 zoneDefaults.append( defaultTz[i] );
114 } 114 }
115 zoneIndex = 0; 115 zoneIndex = 0;
116 for (QStringList::Iterator it = zoneDefaults.begin(); it != zoneDefaults.end() ; ++it){ 116 for (QStringList::Iterator it = zoneDefaults.begin(); it != zoneDefaults.end() ; ++it){
117 cfg.writeEntry( "Zone" + QString::number( zoneIndex ) , *it); 117 cfg.writeEntry( "Zone" + QString::number( zoneIndex ) , *it);
118 zoneIndex++; 118 zoneIndex++;
119 } 119 }
120 } 120 }
121 // We have an existing list of timezones refresh the 121 // We have an existing list of timezones refresh the
122 // translations of TimeZone name 122 // translations of TimeZone name
123 zoneIndex = 0; 123 zoneIndex = 0;
124 while (cfg.hasKey( "Zone"+ QString::number( zoneIndex ))){ 124 while (cfg.hasKey( "Zone"+ QString::number( zoneIndex ))){
125 zoneID = cfg.readEntry( "Zone" + QString::number( zoneIndex )); 125 zoneID = cfg.readEntry( "Zone" + QString::number( zoneIndex ));
126 curZone = TimeZone( zoneID ); 126 curZone = TimeZone( zoneID );
127 if ( !curZone.isValid() ){ 127 if ( !curZone.isValid() ){
128 qDebug( "initEnvironment() Invalid TimeZone %s", zoneID.latin1() ); 128 qDebug( "initEnvironment() Invalid TimeZone %s", zoneID.latin1() );
129 break; 129 break;
130 } 130 }
131 cfg.writeEntry( "ZoneName" + QString::number( zoneIndex ), curZone.city() ); 131 cfg.writeEntry( "ZoneName" + QString::number( zoneIndex ), curZone.city() );
132 zoneIndex++; 132 zoneIndex++;
133 } 133 }
134#endif 134#endif
135} 135}
136 136
137void initEnvironment() 137void initEnvironment()
138{ 138{
139#ifdef Q_OS_WIN32 139#ifdef Q_OS_WIN32
140 // Config file requires HOME dir which uses QDir which needs the winver 140 // Config file requires HOME dir which uses QDir which needs the winver
141 qt_init_winver(); 141 qt_init_winver();
142#endif 142#endif
143 Config config("locale"); 143 Config config("locale");
144 config.setGroup( "Location" ); 144 config.setGroup( "Location" );
145 QString tz = config.readEntry( "Timezone", getenv("TZ") ).stripWhiteSpace(); 145 QString tz = config.readEntry( "Timezone", getenv("TZ") ).stripWhiteSpace();
146 146
147 // if not timezone set, pick New York 147 // if not timezone set, pick New York
148 if (tz.isNull() || tz.isEmpty()) 148 if (tz.isNull() || tz.isEmpty())
149 tz = "America/New_York"; 149 tz = "America/New_York";
150 150
151 setenv( "TZ", tz, 1 ); 151 setenv( "TZ", tz, 1 );
152 config.writeEntry( "Timezone", tz); 152 config.writeEntry( "Timezone", tz);
153 153
154 config.setGroup( "Language" ); 154 config.setGroup( "Language" );
155 QString lang = config.readEntry( "Language", getenv("LANG") ).stripWhiteSpace(); 155 QString lang = config.readEntry( "Language", getenv("LANG") ).stripWhiteSpace();
156 if( lang.isNull() || lang.isEmpty()) 156 if( lang.isNull() || lang.isEmpty())
157 lang = "en_US"; 157 lang = "en_US";
158 158
159 setenv( "LANG", lang, 1 ); 159 setenv( "LANG", lang, 1 );
160 config.writeEntry("Language", lang); 160 config.writeEntry("Language", lang);
161 config.write(); 161 config.write();
162 162
163#if 0 163#if 0
164 setenv( "QWS_SIZE", "240x320", 0 ); 164 setenv( "QWS_SIZE", "240x320", 0 );
165#endif 165#endif
166 166
167 167
168 168
169 QString env(getenv("QWS_DISPLAY")); 169 QString env(getenv("QWS_DISPLAY"));
170 if (env.contains("Transformed")) { 170 if (env.contains("Transformed")) {
171 int rot; 171 int rot;
172 // transformed driver default rotation is controlled by the hardware. 172 // transformed driver default rotation is controlled by the hardware.
173 Config config("qpe"); 173 Config config("qpe");
174 config.setGroup( "Rotation" ); 174 config.setGroup( "Rotation" );
175 if ( ( rot = config.readNumEntry( "Rot", -1 ) ) == -1 ) 175 if ( ( rot = config.readNumEntry( "Rot", -1 ) ) == -1 )
176 rot = ODevice::inst ( )-> rotation ( ) * 90; 176 rot = ODevice::inst ( )-> rotation ( ) * 90;
177 177
178 setenv("QWS_DISPLAY", QString("Transformed:Rot%1:0").arg(rot), 1); 178 setenv("QWS_DISPLAY", QString("Transformed:Rot%1:0").arg(rot), 1);
179 QPEApplication::defaultRotation ( ); /* to ensure deforient matches reality */ 179 QPEApplication::defaultRotation ( ); /* to ensure deforient matches reality */
180 } 180 }
181} 181}
182 182
183static void initKeyboard() 183static void initKeyboard()
184{ 184{
185 Config config("qpe"); 185 Config config("qpe");
186 186
187 config.setGroup( "Keyboard" ); 187 config.setGroup( "Keyboard" );
188 188
189 int ard = config.readNumEntry( "RepeatDelay" ); 189 int ard = config.readNumEntry( "RepeatDelay" );
190 int arp = config.readNumEntry( "RepeatPeriod" ); 190 int arp = config.readNumEntry( "RepeatPeriod" );
191 if ( ard > 0 && arp > 0 ) 191 if ( ard > 0 && arp > 0 )
192 qwsSetKeyboardAutoRepeat( ard, arp ); 192 qwsSetKeyboardAutoRepeat( ard, arp );
193 193
194 QString layout = config.readEntry( "Layout", "us101" ); 194 QString layout = config.readEntry( "Layout", "us101" );
195 Server::setKeyboardLayout( layout ); 195 Server::setKeyboardLayout( layout );
196} 196}
197 197
198static bool firstUse() 198static bool firstUse()
199{ 199{
200 bool needFirstUse = FALSE; 200 bool needFirstUse = FALSE;
201 if ( QWSServer::mouseHandler() && 201 if ( QWSServer::mouseHandler() &&
202 QWSServer::mouseHandler() ->inherits("QCalibratedMouseHandler") ) { 202 QWSServer::mouseHandler() ->inherits("QCalibratedMouseHandler") ) {
203 if ( !QFile::exists( "/etc/pointercal" ) ) 203 if ( !QFile::exists( "/etc/pointercal" ) )
204 needFirstUse = TRUE; 204 needFirstUse = TRUE;
205 } 205 }
206 206
207 { 207 {
208 Config config( "qpe" ); 208 Config config( "qpe" );
209 config.setGroup( "Startup" ); 209 config.setGroup( "Startup" );
210 needFirstUse |= config.readBoolEntry( "FirstUse", TRUE ); 210 needFirstUse |= config.readBoolEntry( "FirstUse", TRUE );
211 } 211 }
212 212
213 if ( !needFirstUse ) 213 if ( !needFirstUse )
214 return FALSE; 214 return FALSE;
215 215
216 FirstUse *fu = new FirstUse(); 216 FirstUse *fu = new FirstUse();
217 fu->exec(); 217 fu->exec();
218 bool rs = fu->restartNeeded(); 218 bool rs = fu->restartNeeded();
219 delete fu; 219 delete fu;
220 return rs; 220 return rs;
221} 221}
222 222
223int initApplication( int argc, char ** argv ) 223int initApplication( int argc, char ** argv )
224{ 224{
225 cleanup(); 225 cleanup();
226 226
227 227
228 initEnvironment(); 228 initEnvironment();
229 229
230 //Don't flicker at startup: 230 //Don't flicker at startup:
231#ifdef QWS 231#ifdef QWS
232 QWSServer::setDesktopBackground( QImage() ); 232 QWSServer::setDesktopBackground( QImage() );
233#endif 233#endif
234 ServerApplication a( argc, argv, QApplication::GuiServer ); 234 ServerApplication a( argc, argv, QApplication::GuiServer );
235 235
236 refreshTimeZoneConfig(); 236 refreshTimeZoneConfig();
237 237
238 initKeyboard(); 238 initKeyboard();
239 239
240 // Don't use first use under Windows 240 // Don't use first use under Windows
241 if ( firstUse() ) { 241 if ( firstUse() ) {
242 a.restart(); 242 a.restart();
243 return 0; 243 return 0;
244 } 244 }
245 245
246 ODevice::inst ( )-> setSoftSuspend ( true ); 246 ODevice::inst ( )-> setSoftSuspend ( true );
247 247
248 { 248 {
249 QCopEnvelope e("QPE/System", "setBacklight(int)" ); 249 QCopEnvelope e("QPE/System", "setBacklight(int)" );
250 e << -3; // Forced on 250 e << -3; // Forced on
251 } 251 }
252 252
253 AlarmServer::initialize(); 253 AlarmServer::initialize();
254 254
255 255
256 256
257 Server *s = new Server(); 257 Server *s = new Server();
258 258
259 (void)new SysFileMonitor(s); 259 (void)new SysFileMonitor(s);
260#ifdef QWS 260#ifdef QWS
261 Network::createServer(s); 261 Network::createServer(s);
262#endif 262#endif
263 263
264 s->show(); 264 s->show();
265 265
266 /* THE ARM rtc has problem holdings the time on reset */ 266 /* THE ARM rtc has problem holdings the time on reset */
267 if ( QDate::currentDate ( ). year ( ) < 2000 ) { 267 if ( QDate::currentDate ( ). year ( ) < 2000 ) {
268 if ( QMessageBox::information ( 0, ServerApplication::tr( "Information" ), ServerApplication::tr( "<p>The system date doesn't seem to be valid.\n(%1)</p><p>Do you want to correct the clock ?</p>" ). arg( TimeString::dateString ( QDate::currentDate ( ))), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) { 268 if ( QMessageBox::information ( 0, ServerApplication::tr( "Information" ), ServerApplication::tr( "<p>The system date doesn't seem to be valid.\n(%1)</p><p>Do you want to correct the clock ?</p>" ). arg( TimeString::dateString ( QDate::currentDate ( ))), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) {
269 QCopEnvelope e ( "QPE/Application/systemtime", "setDocument(QString)" ); 269 QCopEnvelope e ( "QPE/Application/systemtime", "setDocument(QString)" );
270 e << QString ( ); 270 e << QString ( );
271 } 271 }
272 } 272 }
273 273
274 int rv = a.exec(); 274 int rv = a.exec();
275 275
276 qDebug("exiting..."); 276 qDebug("exiting...");
277 delete s; 277 delete s;
278 278
279#ifndef Q_OS_MACX
279 ODevice::inst()->setSoftSuspend( false ); 280 ODevice::inst()->setSoftSuspend( false );
281#endif
280 282
281 return rv; 283 return rv;
282} 284}
283 285
284static const char *pidfile_path = "/var/run/opie.pid"; 286static const char *pidfile_path = "/var/run/opie.pid";
285 287
286void create_pidfile ( ) 288void create_pidfile ( )
287{ 289{
288 FILE *f; 290 FILE *f;
289 291
290 if (( f = ::fopen ( pidfile_path, "w" ))) { 292 if (( f = ::fopen ( pidfile_path, "w" ))) {
291 ::fprintf ( f, "%d", getpid ( )); 293 ::fprintf ( f, "%d", getpid ( ));
292 ::fclose ( f ); 294 ::fclose ( f );
293 } 295 }
294} 296}
295 297
296void remove_pidfile ( ) 298void remove_pidfile ( )
297{ 299{
298 ::unlink ( pidfile_path ); 300 ::unlink ( pidfile_path );
299} 301}
300 302
301void handle_sigterm ( int /* sig */ ) 303void handle_sigterm ( int /* sig */ )
302{ 304{
303 if ( qApp ) 305 if ( qApp )
304 qApp-> quit ( ); 306 qApp-> quit ( );
305} 307}
306 308
307#ifndef Q_OS_WIN32 309#ifndef Q_OS_WIN32
308int main( int argc, char ** argv ) 310int main( int argc, char ** argv )
309{ 311{
310 312
311 ::signal ( SIGCHLD, SIG_IGN ); 313 ::signal ( SIGCHLD, SIG_IGN );
312 314
313 ::signal ( SIGTERM, handle_sigterm ); 315 ::signal ( SIGTERM, handle_sigterm );
314 ::signal ( SIGINT, handle_sigterm ); 316 ::signal ( SIGINT, handle_sigterm );
315 317
316 ::setsid ( ); 318 ::setsid ( );
317 ::setpgid ( 0, 0 ); 319 ::setpgid ( 0, 0 );
318 320
319 ::atexit ( remove_pidfile ); 321 ::atexit ( remove_pidfile );
320 create_pidfile ( ); 322 create_pidfile ( );
321 323
322 int retVal = initApplication( argc, argv ); 324 int retVal = initApplication( argc, argv );
323 325
324 // Have we been asked to restart? 326 // Have we been asked to restart?
325 if ( ServerApplication::doRestart ) { 327 if ( ServerApplication::doRestart ) {
326 for ( int fd = 3; fd < 100; fd++ ) 328 for ( int fd = 3; fd < 100; fd++ )
327 close( fd ); 329 close( fd );
328 330
329 execl( (QPEApplication::qpeDir()+"bin/qpe").latin1(), "qpe", 0 ); 331 execl( (QPEApplication::qpeDir()+"bin/qpe").latin1(), "qpe", 0 );
330 } 332 }
331 333
332 // Kill them. Kill them all. 334 // Kill them. Kill them all.
333 ::kill ( 0, SIGTERM ); 335 ::kill ( 0, SIGTERM );
334 ::sleep ( 1 ); 336 ::sleep ( 1 );
335 ::kill ( 0, SIGKILL ); 337 ::kill ( 0, SIGKILL );
336 338
337 return retVal; 339 return retVal;
338} 340}
339#else 341#else
340 342
341int main( int argc, char ** argv ) 343int main( int argc, char ** argv )
342{ 344{
343 int retVal = initApplication( argc, argv ); 345 int retVal = initApplication( argc, argv );
344 346
345 if ( DesktopApplication::doRestart ) { 347 if ( DesktopApplication::doRestart ) {
346 qDebug("Trying to restart"); 348 qDebug("Trying to restart");
347 execl( (QPEApplication::qpeDir()+"bin\\qpe").latin1(), "qpe", 0 ); 349 execl( (QPEApplication::qpeDir()+"bin\\qpe").latin1(), "qpe", 0 );
348 } 350 }
349 351
350 return retVal; 352 return retVal;
351} 353}
352 354
353#endif 355#endif
354 356
diff --git a/core/launcher/packageslave.cpp b/core/launcher/packageslave.cpp
index 4f149a5..bf34368 100644
--- a/core/launcher/packageslave.cpp
+++ b/core/launcher/packageslave.cpp
@@ -1,97 +1,341 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "packageslave.h" 21#include "packageslave.h"
22#include <qtopia/qprocess.h>
22 23
23#include <qpe/process.h> 24#ifdef Q_WS_QWS
24#include <qpe/qcopenvelope_qws.h> 25#include <qtopia/qcopenvelope_qws.h>
26#endif
25 27
26#include <qdatastream.h> 28#include <qdatastream.h>
29#ifdef Q_WS_QWS
27#include <qcopchannel_qws.h> 30#include <qcopchannel_qws.h>
31#endif
28 32
33#include <qtextstream.h>
34#include <qdir.h>
35
36#include <stdlib.h>
37#include <sys/stat.h> // mkdir()
38
39#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
29#include <unistd.h> 40#include <unistd.h>
41#include <sys/vfs.h>
42#include <mntent.h>
43#elif defined(Q_OS_WIN32)
44#include <windows.h>
45#include <winbase.h>
46#elif defined(Q_OS_MACX)
47#include <unistd.h>
48#endif
49
30 50
31PackageSlave::PackageSlave( QObject *parent, char* name ) 51PackageHandler::PackageHandler( QObject *parent, char* name )
32 : QObject( parent, name ), packageChannel( 0 ) 52 : QObject( parent, name ), packageChannel( 0 ), currentProcess( 0 ), mNoSpaceLeft( FALSE )
33{ 53{
34 // setup qcop channel 54 // setup qcop channel
55#ifndef QT_NO_COP
35 packageChannel = new QCopChannel( "QPE/Package", this ); 56 packageChannel = new QCopChannel( "QPE/Package", this );
36 connect( packageChannel, SIGNAL( received(const QCString &, const QByteArray &) ), 57 connect( packageChannel, SIGNAL( received(const QCString &, const QByteArray &) ),
37 this, SLOT( qcopMessage( const QCString &, const QByteArray &) ) ); 58 this, SLOT( qcopMessage( const QCString &, const QByteArray &) ) );
59#endif
38} 60}
39 61
40void PackageSlave::qcopMessage( const QCString &msg, const QByteArray &data ) 62void PackageHandler::qcopMessage( const QCString &msg, const QByteArray &data )
41{ 63{
42 QDataStream stream( data, IO_ReadOnly ); 64 QDataStream stream( data, IO_ReadOnly );
43 65
44 if ( msg == "installPackage(QString)" ) { 66 if ( msg == "installPackage(QString)" ) {
45 QString file; 67 QString file;
46 stream >> file; 68 stream >> file;
47 installPackage( file ); 69 installPackage( file );
48 } 70 } else if ( msg == "removePackage(QString)" ) {
49 else if ( msg == "removePackage(QString)" ) {
50 QString file; 71 QString file;
51 stream >> file; 72 stream >> file;
52 removePackage( file ); 73 removePackage( file );
74 } else if ( msg == "addPackageFiles(QString,QString)" ) {
75 QString location, listfile;
76 stream >> location >> listfile;
77 addPackageFiles( location, listfile);
78 } else if ( msg == "addPackages(QString)" ) {
79 QString location;
80 stream >> location;
81 addPackages( location );
82 } else if ( msg == "cleanupPackageFiles(QString)" ) {
83 QString listfile;
84 stream >> listfile;
85 cleanupPackageFiles( listfile );
86 } else if ( msg == "cleanupPackages(QString)" ) {
87 QString location;
88 stream >> location;
89 cleanupPackages( location );
90 } else if ( msg == "prepareInstall(QString,QString)" ) {
91 QString size, path;
92 stream >> size;
93 stream >> path;
94 prepareInstall( size, path );
53 } 95 }
54} 96}
55 97
56void PackageSlave::installPackage( const QString &package ) 98void PackageHandler::installPackage( const QString &package )
57{ 99{
58 Process proc( QStringList() << "ipkg" << "install" << package ); 100 if ( mNoSpaceLeft ) {
101 mNoSpaceLeft = FALSE;
102 // Don't emit that for now, I still couldn't test it (Wener)
103 //sendReply( "installFailed(QString)", package );
104 //return;
105 }
106
107 currentProcess = new QProcess( QStringList() << "ipkg" << "install" << package ); // No tr
108 connect( currentProcess, SIGNAL( processExited() ), SLOT( iProcessExited() ) );
109 connect( currentProcess, SIGNAL( readyReadStdout() ), SLOT( readyReadStdout() ) );
110 connect( currentProcess, SIGNAL( readyReadStderr() ), SLOT( readyReadStderr() ) );
111 currentPackage = package;
59 112
113 currentProcessError="";
60 sendReply( "installStarted(QString)", package ); 114 sendReply( "installStarted(QString)", package );
115 currentProcess->start();
116}
117
118void PackageHandler::removePackage( const QString &package )
119{
120 currentProcess = new QProcess( QStringList() << "ipkg" << "remove" << package ); // No tr
121 connect( currentProcess, SIGNAL( processExited() ), SLOT( rmProcessExited() ) );
122 connect( currentProcess, SIGNAL( readyReadStdout() ), SLOT( readyReadStdout() ) );
123 connect( currentProcess, SIGNAL( readyReadStderr() ), SLOT( readyReadStderr() ) );
124 currentPackage = package;
125
126 currentProcessError="";
127 sendReply( "removeStarted(QString)", package );
128 currentProcess->start();
129}
130
131void PackageHandler::sendReply( const QCString& msg, const QString& arg )
132{
133#ifndef QT_NO_COP
134 QCopEnvelope e( "QPE/Desktop", msg );
135 e << arg;
136#endif
137}
138
139void PackageHandler::addPackageFiles( const QString &location,
140 const QString &listfile )
141{
142 QFile f(listfile);
143#ifndef Q_OS_WIN32
144 //make a copy so we can remove the symlinks later
145 mkdir( ("/usr/lib/ipkg/info/"+location).ascii(), 0777 );
146 system(("cp " + f.name() + " /usr/lib/ipkg/info/"+location).ascii());
147#else
148 QDir d;
149 //#### revise
150 qDebug("Copy file at %s: %s", __FILE__, __LINE__ );
151 d.mkdir(("/usr/lib/ipkg/info/" + location).ascii());
152 system(("copy " + f.name() + " /usr/lib/ipkg/info/"+location).ascii());
153#endif
154
155
156 if ( f.open(IO_ReadOnly) ) {
157 QTextStream ts(&f);
158
159 QString s;
160 while ( !ts.eof() ) { // until end of file...
161 s = ts.readLine(); // line of text excluding '\n'
162 // for s, do link/mkdir.
163 if ( s.right(1) == "/" ) {
164 qDebug("do mkdir for %s", s.ascii());
165#ifndef Q_OS_WIN32
166 mkdir( s.ascii(), 0777 );
167 //possible optimization: symlink directories
168 //that don't exist already. -- Risky.
169#else
170 d.mkdir( s.ascii());
171#endif
172
173 } else {
174#ifndef Q_OS_WIN32
175 qDebug("do symlink for %s", s.ascii());
176 symlink( (location + s).ascii(), s.ascii() );
177#else
178 qDebug("Copy file instead of a symlink for WIN32");
179 if (!CopyFile((TCHAR*)qt_winTchar((location + s), TRUE), (TCHAR*)qt_winTchar(s, TRUE), FALSE))
180 qWarning("Unable to create symlinkfor %s",
181 (location + s).ascii());
182#endif
183 }
184 }
185 f.close();
186 }
187}
61 188
62 QString output; 189void PackageHandler::addPackages( const QString &location )
63 if ( proc.exec( "", output ) ) { 190{
64 sendReply( "installDone(QString)", package ); 191 // get list of *.list in location/usr/lib/ipkg/info/*.list
192 QDir dir(location + "/usr/lib/ipkg/info", "*.list", // No tr
193 QDir::Name, QDir::Files);
194 if ( !dir.exists() )
195 return;
196
197 QStringList packages = dir.entryList();
198 for ( QStringList::Iterator it = packages.begin();
199 it != packages.end(); ++it ) {
200 addPackageFiles( location, *it );
65 } 201 }
202}
203
204
205void PackageHandler::cleanupPackageFiles( const QString &listfile )
206{
207 QFile f(listfile);
208
209 if ( f.open(IO_ReadOnly) ) {
210 QTextStream ts(&f);
211
212 QString s;
213 while ( !ts.eof() ) { // until end of file...
214 s = ts.readLine(); // line of text excluding '\n'
215 // for s, do link/mkdir.
216 if ( s.right(1) == "/" ) {
217 //should rmdir if empty, after all files have been removed
218 } else {
219#ifndef Q_OS_WIN32
220 qDebug("remove symlink for %s", s.ascii());
221 //check if it is a symlink first (don't remove /etc/passwd...)
222 char buf[10]; //we don't care about the contents
223 if ( ::readlink( s.ascii(),buf, 10 >= 0 ) )
224 ::unlink( s.ascii() );
225 #else
226 // ### revise
227 qWarning("Unable to remove symlink %s:%s", __FILE__, __LINE__);
228#endif
229 }
230 }
231 f.close();
232
233 //remove the list file
234 ::unlink( listfile.ascii() );
235
236 }
237}
238
239void PackageHandler::cleanupPackages( const QString &location )
240{
241 // get list of *.list in location/usr/lib/ipkg/info/*.list
242 QDir dir( "/usr/lib/ipkg/info/"+location, "*.list", // No tr
243 QDir::Name, QDir::Files);
244 if ( !dir.exists() )
245 return;
246
247 QStringList packages = dir.entryList();
248 for ( QStringList::Iterator it = packages.begin();
249 it != packages.end(); ++it ) {
250 cleanupPackageFiles( *it );
251 }
252
253 //remove the backup directory
254 //###
255}
256
257void PackageHandler::prepareInstall( const QString& size, const QString& path )
258{
259 // Check whether there will be enough space to install the next package.
260 bool ok;
261 unsigned int s = size.toUInt( &ok );
262
263 if ( !ok )
264 return;
265
266 // Shamelessly stolen from the sysinfo application (Werner)
267#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
268 struct statfs fs;
269 if ( statfs( path.latin1(), &fs ) == 0 )
270 if ( s > fs.f_bsize * fs.f_bavail ) {
271 //qDebug("############### Not enough space left ###############");
272 mNoSpaceLeft = TRUE;
273 }
274#endif
275}
276
277void PackageHandler::iProcessExited()
278{
279 if ( currentProcess->normalExit() && currentProcess->exitStatus() == 0 )
280 sendReply( "installDone(QString)", currentPackage );
66 else { 281 else {
67 sendReply( "installFailed(QString)", package ); 282#ifndef QT_NO_COP
283 QCopEnvelope e( "QPE/Desktop", "installFailed(QString,int,QString)" );
284 e << currentPackage << currentProcess->exitStatus()
285 << currentProcessError;
286#endif
68 } 287 }
288
289 delete currentProcess;
290 currentProcess = 0;
291
292#ifndef QT_NO_COP
69 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 293 QCopEnvelope e("QPE/System", "linkChanged(QString)");
70 QString lf = QString::null; 294 QString lf = QString::null;
71 e << lf; 295 e << lf;
72 unlink( package ); 296#endif
297 unlink( currentPackage );
73} 298}
74 299
75void PackageSlave::removePackage( const QString &package ) 300void PackageHandler::rmProcessExited()
76{ 301{
77 Process proc( QStringList() << "ipkg" << "remove" << package ); 302 if ( currentProcess->normalExit() && currentProcess->exitStatus() == 0 )
303 sendReply( "removeDone(QString)", currentPackage );
304 else
305 sendReply( "removeFailed(QString)", currentPackage );
78 306
79 sendReply( "removeStarted(QString)", package ); 307#ifndef QT_NO_COP
80
81 QString output;
82 if ( proc.exec( "", output ) ) {
83 sendReply( "removeDone(QString)", package );
84 }
85 else {
86 sendReply( "removeFailed(QString)", package );
87 }
88 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 308 QCopEnvelope e("QPE/System", "linkChanged(QString)");
89 QString lf = QString::null; 309 QString lf = QString::null;
90 e << lf; 310 e << lf;
311#endif
91} 312}
92 313
93void PackageSlave::sendReply( const QCString& msg, const QString& arg ) 314void PackageHandler::readyReadStdout()
94{ 315{
95 QCopEnvelope e( "QPE/Desktop", msg ); 316 while ( currentProcess->canReadLineStdout() ) {
96 e << arg; 317 QString line = currentProcess->readLineStdout();
318 currentProcessError.append("OUT:"+line);
319 if ( line.contains( "Unpacking" ) ) // No tr
320 sendReply( "installStep(QString)", "one" ); // No tr
321 else if ( line.contains( "Configuring" ) ) // No tr
322 sendReply( "installStep(QString)", "two" ); // No tr
323 }
324}
325
326void PackageHandler::readyReadStderr()
327{
328 while ( currentProcess->canReadLineStderr() ) {
329 QString line = currentProcess->readLineStderr();
330 currentProcessError.append("ERR:"+line);
331 }
332}
333
334void PackageHandler::redoPackages()
335{
336 //get list of filesystems
337
338 //call cleanupPackages for the ones that have disappeared
339
340 //call addPackageFiles for the new ones
97} 341}
diff --git a/core/launcher/qprocess_unix.cpp b/core/launcher/qprocess_unix.cpp
index a07bf64..19a8c93 100644
--- a/core/launcher/qprocess_unix.cpp
+++ b/core/launcher/qprocess_unix.cpp
@@ -1,1171 +1,1174 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21//#include "qplatformdefs.h" 21//#include "qplatformdefs.h"
22 22
23// Solaris redefines connect -> __xnet_connect with _XOPEN_SOURCE_EXTENDED. 23// Solaris redefines connect -> __xnet_connect with _XOPEN_SOURCE_EXTENDED.
24#if defined(connect) 24#if defined(connect)
25#undef connect 25#undef connect
26#endif 26#endif
27 27
28#include "qprocess.h" 28#include "qprocess.h"
29 29
30#ifndef QT_NO_PROCESS 30#ifndef QT_NO_PROCESS
31 31
32#include "qapplication.h" 32#include "qapplication.h"
33#include "qqueue.h" 33#include "qqueue.h"
34#include "qlist.h" 34#include "qlist.h"
35#include "qsocketnotifier.h" 35#include "qsocketnotifier.h"
36#include "qtimer.h" 36#include "qtimer.h"
37#include "qregexp.h" 37#include "qregexp.h"
38 38
39#include "qcleanuphandler_p.h" 39#include "qcleanuphandler_p.h"
40 40
41#include <stdlib.h> 41#include <stdlib.h>
42 42
43// ### FOR Qt 2.3 compat 43// ### FOR Qt 2.3 compat
44#include <unistd.h> 44#include <unistd.h>
45#include <signal.h> 45#include <signal.h>
46#include <sys/socket.h> 46#include <sys/socket.h>
47#include <sys/ioctl.h> 47#include <sys/ioctl.h>
48#include <sys/wait.h> 48#include <sys/wait.h>
49#include <sys/fcntl.h> 49#include <sys/fcntl.h>
50 50
51#include <errno.h> 51#include <errno.h>
52 52
53#ifdef Q_OS_MACX
54#include <sys/time.h>
55#endif
53#include <sys/resource.h> 56#include <sys/resource.h>
54 57
55#ifdef __MIPSEL__ 58#ifdef __MIPSEL__
56# ifndef SOCK_DGRAM 59# ifndef SOCK_DGRAM
57# define SOCK_DGRAM 1 60# define SOCK_DGRAM 1
58# endif 61# endif
59# ifndef SOCK_STREAM 62# ifndef SOCK_STREAM
60# define SOCK_STREAM 2 63# define SOCK_STREAM 2
61# endif 64# endif
62#endif 65#endif
63 66
64//#define QT_QPROCESS_DEBUG 67//#define QT_QPROCESS_DEBUG
65 68
66 69
67#ifdef Q_C_CALLBACKS 70#ifdef Q_C_CALLBACKS
68extern "C" { 71extern "C" {
69#endif // Q_C_CALLBACKS 72#endif // Q_C_CALLBACKS
70 73
71#define QT_SIGNAL_RETTYPE void 74#define QT_SIGNAL_RETTYPE void
72#define QT_SIGNAL_ARGS int 75#define QT_SIGNAL_ARGS int
73#define QT_SIGNAL_IGNORE SIG_IGN 76#define QT_SIGNAL_IGNORE SIG_IGN
74 77
75 QT_SIGNAL_RETTYPE qt_C_sigchldHnd(QT_SIGNAL_ARGS); 78 QT_SIGNAL_RETTYPE qt_C_sigchldHnd(QT_SIGNAL_ARGS);
76 QT_SIGNAL_RETTYPE qt_C_sigpipeHnd(QT_SIGNAL_ARGS); 79 QT_SIGNAL_RETTYPE qt_C_sigpipeHnd(QT_SIGNAL_ARGS);
77 80
78#ifdef Q_C_CALLBACKS 81#ifdef Q_C_CALLBACKS
79} 82}
80#endif // Q_C_CALLBACKS 83#endif // Q_C_CALLBACKS
81 84
82 85
83class QProc; 86class QProc;
84class QProcessManager; 87class QProcessManager;
85class QProcessPrivate 88class QProcessPrivate
86{ 89{
87public: 90public:
88 QProcessPrivate(); 91 QProcessPrivate();
89 ~QProcessPrivate(); 92 ~QProcessPrivate();
90 93
91 void closeOpenSocketsForChild(); 94 void closeOpenSocketsForChild();
92 void newProc( pid_t pid, QProcess *process ); 95 void newProc( pid_t pid, QProcess *process );
93 96
94 QByteArray bufStdout; 97 QByteArray bufStdout;
95 QByteArray bufStderr; 98 QByteArray bufStderr;
96 99
97 QQueue<QByteArray> stdinBuf; 100 QQueue<QByteArray> stdinBuf;
98 101
99 QSocketNotifier *notifierStdin; 102 QSocketNotifier *notifierStdin;
100 QSocketNotifier *notifierStdout; 103 QSocketNotifier *notifierStdout;
101 QSocketNotifier *notifierStderr; 104 QSocketNotifier *notifierStderr;
102 105
103 ssize_t stdinBufRead; 106 ssize_t stdinBufRead;
104 QProc *proc; 107 QProc *proc;
105 108
106 bool exitValuesCalculated; 109 bool exitValuesCalculated;
107 bool socketReadCalled; 110 bool socketReadCalled;
108 111
109 static QProcessManager *procManager; 112 static QProcessManager *procManager;
110}; 113};
111 114
112 115
113/*********************************************************************** 116/***********************************************************************
114 * 117 *
115 * QProc 118 * QProc
116 * 119 *
117 **********************************************************************/ 120 **********************************************************************/
118/* 121/*
119 The class QProcess does not necessarily map exactly to the running 122 The class QProcess does not necessarily map exactly to the running
120 child processes: if the process is finished, the QProcess class may still be 123 child processes: if the process is finished, the QProcess class may still be
121 there; furthermore a user can use QProcess to start more than one process. 124 there; furthermore a user can use QProcess to start more than one process.
122 125
123 The helper-class QProc has the semantics that one instance of this class maps 126 The helper-class QProc has the semantics that one instance of this class maps
124 directly to a running child process. 127 directly to a running child process.
125*/ 128*/
126class QProc 129class QProc
127{ 130{
128public: 131public:
129 QProc( pid_t p, QProcess *proc=0 ) : pid(p), process(proc) 132 QProc( pid_t p, QProcess *proc=0 ) : pid(p), process(proc)
130 { 133 {
131#if defined(QT_QPROCESS_DEBUG) 134#if defined(QT_QPROCESS_DEBUG)
132 qDebug( "QProc: Constructor for pid %d and QProcess %p", pid, process ); 135 qDebug( "QProc: Constructor for pid %d and QProcess %p", pid, process );
133#endif 136#endif
134 socketStdin = 0; 137 socketStdin = 0;
135 socketStdout = 0; 138 socketStdout = 0;
136 socketStderr = 0; 139 socketStderr = 0;
137 } 140 }
138 ~QProc() 141 ~QProc()
139 { 142 {
140#if defined(QT_QPROCESS_DEBUG) 143#if defined(QT_QPROCESS_DEBUG)
141 qDebug( "QProc: Destructor for pid %d and QProcess %p", pid, process ); 144 qDebug( "QProc: Destructor for pid %d and QProcess %p", pid, process );
142#endif 145#endif
143 if ( process != 0 ) { 146 if ( process != 0 ) {
144 if ( process->d->notifierStdin ) 147 if ( process->d->notifierStdin )
145 process->d->notifierStdin->setEnabled( FALSE ); 148 process->d->notifierStdin->setEnabled( FALSE );
146 if ( process->d->notifierStdout ) 149 if ( process->d->notifierStdout )
147 process->d->notifierStdout->setEnabled( FALSE ); 150 process->d->notifierStdout->setEnabled( FALSE );
148 if ( process->d->notifierStderr ) 151 if ( process->d->notifierStderr )
149 process->d->notifierStderr->setEnabled( FALSE ); 152 process->d->notifierStderr->setEnabled( FALSE );
150 process->d->proc = 0; 153 process->d->proc = 0;
151 } 154 }
152 if( socketStdin != 0 ) 155 if( socketStdin != 0 )
153 ::close( socketStdin ); 156 ::close( socketStdin );
154 // ### close these sockets even on parent exit or is it better only on 157 // ### close these sockets even on parent exit or is it better only on
155 // sigchld (but what do I have to do with them on exit then)? 158 // sigchld (but what do I have to do with them on exit then)?
156 if( socketStdout != 0 ) 159 if( socketStdout != 0 )
157 ::close( socketStdout ); 160 ::close( socketStdout );
158 if( socketStderr != 0 ) 161 if( socketStderr != 0 )
159 ::close( socketStderr ); 162 ::close( socketStderr );
160 } 163 }
161 164
162 pid_t pid; 165 pid_t pid;
163 int socketStdin; 166 int socketStdin;
164 int socketStdout; 167 int socketStdout;
165 int socketStderr; 168 int socketStderr;
166 QProcess *process; 169 QProcess *process;
167}; 170};
168 171
169/*********************************************************************** 172/***********************************************************************
170 * 173 *
171 * QProcessManager 174 * QProcessManager
172 * 175 *
173 **********************************************************************/ 176 **********************************************************************/
174class QProcessManager : public QObject 177class QProcessManager : public QObject
175{ 178{
176 Q_OBJECT 179 Q_OBJECT
177 180
178public: 181public:
179 QProcessManager(); 182 QProcessManager();
180 ~QProcessManager(); 183 ~QProcessManager();
181 184
182 void append( QProc *p ); 185 void append( QProc *p );
183 void remove( QProc *p ); 186 void remove( QProc *p );
184 187
185 void cleanup(); 188 void cleanup();
186 189
187public slots: 190public slots:
188 void removeMe(); 191 void removeMe();
189 void sigchldHnd( int ); 192 void sigchldHnd( int );
190 193
191public: 194public:
192 struct sigaction oldactChld; 195 struct sigaction oldactChld;
193 struct sigaction oldactPipe; 196 struct sigaction oldactPipe;
194 QList<QProc> *procList; 197 QList<QProc> *procList;
195 int sigchldFd[2]; 198 int sigchldFd[2];
196}; 199};
197 200
198QCleanupHandler<QProcessManager> qprocess_cleanup_procmanager; 201QCleanupHandler<QProcessManager> qprocess_cleanup_procmanager;
199 202
200QProcessManager::QProcessManager() 203QProcessManager::QProcessManager()
201{ 204{
202 procList = new QList<QProc>; 205 procList = new QList<QProc>;
203 procList->setAutoDelete( TRUE ); 206 procList->setAutoDelete( TRUE );
204 207
205 // The SIGCHLD handler writes to a socket to tell the manager that 208 // The SIGCHLD handler writes to a socket to tell the manager that
206 // something happened. This is done to get the processing in sync with the 209 // something happened. This is done to get the processing in sync with the
207 // event reporting. 210 // event reporting.
208 if ( ::socketpair( AF_UNIX, SOCK_STREAM, 0, sigchldFd ) ) { 211 if ( ::socketpair( AF_UNIX, SOCK_STREAM, 0, sigchldFd ) ) {
209 sigchldFd[0] = 0; 212 sigchldFd[0] = 0;
210 sigchldFd[1] = 0; 213 sigchldFd[1] = 0;
211 } else { 214 } else {
212#if defined(QT_QPROCESS_DEBUG) 215#if defined(QT_QPROCESS_DEBUG)
213 qDebug( "QProcessManager: install socket notifier (%d)", sigchldFd[1] ); 216 qDebug( "QProcessManager: install socket notifier (%d)", sigchldFd[1] );
214#endif 217#endif
215 QSocketNotifier *sn = new QSocketNotifier( sigchldFd[1], 218 QSocketNotifier *sn = new QSocketNotifier( sigchldFd[1],
216 QSocketNotifier::Read, this ); 219 QSocketNotifier::Read, this );
217 connect( sn, SIGNAL(activated(int)), 220 connect( sn, SIGNAL(activated(int)),
218 this, SLOT(sigchldHnd(int)) ); 221 this, SLOT(sigchldHnd(int)) );
219 sn->setEnabled( TRUE ); 222 sn->setEnabled( TRUE );
220 } 223 }
221 224
222 // install a SIGCHLD handler and ignore SIGPIPE 225 // install a SIGCHLD handler and ignore SIGPIPE
223 struct sigaction act; 226 struct sigaction act;
224 227
225#if defined(QT_QPROCESS_DEBUG) 228#if defined(QT_QPROCESS_DEBUG)
226 qDebug( "QProcessManager: install a SIGCHLD handler" ); 229 qDebug( "QProcessManager: install a SIGCHLD handler" );
227#endif 230#endif
228 act.sa_handler = qt_C_sigchldHnd; 231 act.sa_handler = qt_C_sigchldHnd;
229 sigemptyset( &(act.sa_mask) ); 232 sigemptyset( &(act.sa_mask) );
230 sigaddset( &(act.sa_mask), SIGCHLD ); 233 sigaddset( &(act.sa_mask), SIGCHLD );
231 act.sa_flags = SA_NOCLDSTOP; 234 act.sa_flags = SA_NOCLDSTOP;
232#if defined(SA_RESTART) 235#if defined(SA_RESTART)
233 act.sa_flags |= SA_RESTART; 236 act.sa_flags |= SA_RESTART;
234#endif 237#endif
235 if ( sigaction( SIGCHLD, &act, &oldactChld ) != 0 ) 238 if ( sigaction( SIGCHLD, &act, &oldactChld ) != 0 )
236 qWarning( "Error installing SIGCHLD handler" ); 239 qWarning( "Error installing SIGCHLD handler" );
237 240
238#if defined(QT_QPROCESS_DEBUG) 241#if defined(QT_QPROCESS_DEBUG)
239 qDebug( "QProcessManager: install a SIGPIPE handler (SIG_IGN)" ); 242 qDebug( "QProcessManager: install a SIGPIPE handler (SIG_IGN)" );
240#endif 243#endif
241 /* 244 /*
242 Using qt_C_sigpipeHnd rather than SIG_IGN is a workaround 245 Using qt_C_sigpipeHnd rather than SIG_IGN is a workaround
243 for a strange problem where GNU tar (called by backuprestore) 246 for a strange problem where GNU tar (called by backuprestore)
244 would hang on filesystem-full. Strangely, the qt_C_sigpipeHnd 247 would hang on filesystem-full. Strangely, the qt_C_sigpipeHnd
245 is never even called, yet this avoids the hang. 248 is never even called, yet this avoids the hang.
246 */ 249 */
247 act.sa_handler = qt_C_sigpipeHnd; 250 act.sa_handler = qt_C_sigpipeHnd;
248 sigemptyset( &(act.sa_mask) ); 251 sigemptyset( &(act.sa_mask) );
249 sigaddset( &(act.sa_mask), SIGPIPE ); 252 sigaddset( &(act.sa_mask), SIGPIPE );
250 act.sa_flags = 0; 253 act.sa_flags = 0;
251 if ( sigaction( SIGPIPE, &act, &oldactPipe ) != 0 ) 254 if ( sigaction( SIGPIPE, &act, &oldactPipe ) != 0 )
252 qWarning( "Error installing SIGPIPE handler" ); 255 qWarning( "Error installing SIGPIPE handler" );
253} 256}
254 257
255QProcessManager::~QProcessManager() 258QProcessManager::~QProcessManager()
256{ 259{
257 delete procList; 260 delete procList;
258 261
259 if ( sigchldFd[0] != 0 ) 262 if ( sigchldFd[0] != 0 )
260 ::close( sigchldFd[0] ); 263 ::close( sigchldFd[0] );
261 if ( sigchldFd[1] != 0 ) 264 if ( sigchldFd[1] != 0 )
262 ::close( sigchldFd[1] ); 265 ::close( sigchldFd[1] );
263 266
264 // restore SIGCHLD handler 267 // restore SIGCHLD handler
265#if defined(QT_QPROCESS_DEBUG) 268#if defined(QT_QPROCESS_DEBUG)
266 qDebug( "QProcessManager: restore old sigchild handler" ); 269 qDebug( "QProcessManager: restore old sigchild handler" );
267#endif 270#endif
268 if ( sigaction( SIGCHLD, &oldactChld, 0 ) != 0 ) 271 if ( sigaction( SIGCHLD, &oldactChld, 0 ) != 0 )
269 qWarning( "Error restoring SIGCHLD handler" ); 272 qWarning( "Error restoring SIGCHLD handler" );
270 273
271#if defined(QT_QPROCESS_DEBUG) 274#if defined(QT_QPROCESS_DEBUG)
272 qDebug( "QProcessManager: restore old sigpipe handler" ); 275 qDebug( "QProcessManager: restore old sigpipe handler" );
273#endif 276#endif
274 if ( sigaction( SIGPIPE, &oldactPipe, 0 ) != 0 ) 277 if ( sigaction( SIGPIPE, &oldactPipe, 0 ) != 0 )
275 qWarning( "Error restoring SIGPIPE handler" ); 278 qWarning( "Error restoring SIGPIPE handler" );
276} 279}
277 280
278void QProcessManager::append( QProc *p ) 281void QProcessManager::append( QProc *p )
279{ 282{
280 procList->append( p ); 283 procList->append( p );
281#if defined(QT_QPROCESS_DEBUG) 284#if defined(QT_QPROCESS_DEBUG)
282 qDebug( "QProcessManager: append process (procList.count(): %d)", procList->count() ); 285 qDebug( "QProcessManager: append process (procList.count(): %d)", procList->count() );
283#endif 286#endif
284} 287}
285 288
286void QProcessManager::remove( QProc *p ) 289void QProcessManager::remove( QProc *p )
287{ 290{
288 procList->remove( p ); 291 procList->remove( p );
289#if defined(QT_QPROCESS_DEBUG) 292#if defined(QT_QPROCESS_DEBUG)
290 qDebug( "QProcessManager: remove process (procList.count(): %d)", procList->count() ); 293 qDebug( "QProcessManager: remove process (procList.count(): %d)", procList->count() );
291#endif 294#endif
292 cleanup(); 295 cleanup();
293} 296}
294 297
295void QProcessManager::cleanup() 298void QProcessManager::cleanup()
296{ 299{
297 if ( procList->count() == 0 ) { 300 if ( procList->count() == 0 ) {
298 QTimer::singleShot( 0, this, SLOT(removeMe()) ); 301 QTimer::singleShot( 0, this, SLOT(removeMe()) );
299 } 302 }
300} 303}
301 304
302void QProcessManager::removeMe() 305void QProcessManager::removeMe()
303{ 306{
304 if ( procList->count() == 0 ) { 307 if ( procList->count() == 0 ) {
305 qprocess_cleanup_procmanager.remove( &QProcessPrivate::procManager ); 308 qprocess_cleanup_procmanager.remove( &QProcessPrivate::procManager );
306 QProcessPrivate::procManager = 0; 309 QProcessPrivate::procManager = 0;
307 delete this; 310 delete this;
308 } 311 }
309} 312}
310 313
311void QProcessManager::sigchldHnd( int fd ) 314void QProcessManager::sigchldHnd( int fd )
312{ 315{
313 char tmp; 316 char tmp;
314 ::read( fd, &tmp, sizeof(tmp) ); 317 ::read( fd, &tmp, sizeof(tmp) );
315#if defined(QT_QPROCESS_DEBUG) 318#if defined(QT_QPROCESS_DEBUG)
316 qDebug( "QProcessManager::sigchldHnd()" ); 319 qDebug( "QProcessManager::sigchldHnd()" );
317#endif 320#endif
318 QProc *proc; 321 QProc *proc;
319 QProcess *process; 322 QProcess *process;
320 bool removeProc; 323 bool removeProc;
321 proc = procList->first(); 324 proc = procList->first();
322 while ( proc != 0 ) { 325 while ( proc != 0 ) {
323 removeProc = FALSE; 326 removeProc = FALSE;
324 process = proc->process; 327 process = proc->process;
325 QProcess *process_exit_notify=0; 328 QProcess *process_exit_notify=0;
326 if ( process != 0 ) { 329 if ( process != 0 ) {
327 if ( !process->isRunning() ) { 330 if ( !process->isRunning() ) {
328#if defined(QT_QPROCESS_DEBUG) 331#if defined(QT_QPROCESS_DEBUG)
329 qDebug( "QProcessManager::sigchldHnd() (PID: %d): process exited (QProcess available)", proc->pid ); 332 qDebug( "QProcessManager::sigchldHnd() (PID: %d): process exited (QProcess available)", proc->pid );
330#endif 333#endif
331 // read pending data 334 // read pending data
332 int nbytes = 0; 335 int nbytes = 0;
333 if ( ::ioctl(proc->socketStdout, FIONREAD, (char*)&nbytes)==0 && nbytes>0 ) { 336 if ( ::ioctl(proc->socketStdout, FIONREAD, (char*)&nbytes)==0 && nbytes>0 ) {
334#if defined(QT_QPROCESS_DEBUG) 337#if defined(QT_QPROCESS_DEBUG)
335 qDebug( "QProcessManager::sigchldHnd() (PID: %d): reading %d bytes of pending data on stdout", proc->pid, nbytes ); 338 qDebug( "QProcessManager::sigchldHnd() (PID: %d): reading %d bytes of pending data on stdout", proc->pid, nbytes );
336#endif 339#endif
337 process->socketRead( proc->socketStdout ); 340 process->socketRead( proc->socketStdout );
338 } 341 }
339 nbytes = 0; 342 nbytes = 0;
340 if ( ::ioctl(proc->socketStderr, FIONREAD, (char*)&nbytes)==0 && nbytes>0 ) { 343 if ( ::ioctl(proc->socketStderr, FIONREAD, (char*)&nbytes)==0 && nbytes>0 ) {
341#if defined(QT_QPROCESS_DEBUG) 344#if defined(QT_QPROCESS_DEBUG)
342 qDebug( "QProcessManager::sigchldHnd() (PID: %d): reading %d bytes of pending data on stderr", proc->pid, nbytes ); 345 qDebug( "QProcessManager::sigchldHnd() (PID: %d): reading %d bytes of pending data on stderr", proc->pid, nbytes );
343#endif 346#endif
344 process->socketRead( proc->socketStderr ); 347 process->socketRead( proc->socketStderr );
345 } 348 }
346 349
347 if ( process->notifyOnExit ) 350 if ( process->notifyOnExit )
348 process_exit_notify = process; 351 process_exit_notify = process;
349 352
350 removeProc = TRUE; 353 removeProc = TRUE;
351 } 354 }
352 } else { 355 } else {
353 int status; 356 int status;
354 if ( ::waitpid( proc->pid, &status, WNOHANG ) == proc->pid ) { 357 if ( ::waitpid( proc->pid, &status, WNOHANG ) == proc->pid ) {
355#if defined(QT_QPROCESS_DEBUG) 358#if defined(QT_QPROCESS_DEBUG)
356 qDebug( "QProcessManager::sigchldHnd() (PID: %d): process exited (QProcess not available)", proc->pid ); 359 qDebug( "QProcessManager::sigchldHnd() (PID: %d): process exited (QProcess not available)", proc->pid );
357#endif 360#endif
358 removeProc = TRUE; 361 removeProc = TRUE;
359 } 362 }
360 } 363 }
361 if ( removeProc ) { 364 if ( removeProc ) {
362 QProc *oldproc = proc; 365 QProc *oldproc = proc;
363 proc = procList->next(); 366 proc = procList->next();
364 remove( oldproc ); 367 remove( oldproc );
365 } else { 368 } else {
366 proc = procList->next(); 369 proc = procList->next();
367 } 370 }
368 if ( process_exit_notify ) 371 if ( process_exit_notify )
369 emit process_exit_notify->processExited(); 372 emit process_exit_notify->processExited();
370 } 373 }
371} 374}
372 375
373#include "qprocess_unix.moc" 376#include "qprocess_unix.moc"
374 377
375 378
376/*********************************************************************** 379/***********************************************************************
377 * 380 *
378 * QProcessPrivate 381 * QProcessPrivate
379 * 382 *
380 **********************************************************************/ 383 **********************************************************************/
381QProcessManager *QProcessPrivate::procManager = 0; 384QProcessManager *QProcessPrivate::procManager = 0;
382 385
383QProcessPrivate::QProcessPrivate() 386QProcessPrivate::QProcessPrivate()
384{ 387{
385#if defined(QT_QPROCESS_DEBUG) 388#if defined(QT_QPROCESS_DEBUG)
386 qDebug( "QProcessPrivate: Constructor" ); 389 qDebug( "QProcessPrivate: Constructor" );
387#endif 390#endif
388 stdinBufRead = 0; 391 stdinBufRead = 0;
389 392
390 notifierStdin = 0; 393 notifierStdin = 0;
391 notifierStdout = 0; 394 notifierStdout = 0;
392 notifierStderr = 0; 395 notifierStderr = 0;
393 396
394 exitValuesCalculated = FALSE; 397 exitValuesCalculated = FALSE;
395 socketReadCalled = FALSE; 398 socketReadCalled = FALSE;
396 399
397 proc = 0; 400 proc = 0;
398} 401}
399 402
400QProcessPrivate::~QProcessPrivate() 403QProcessPrivate::~QProcessPrivate()
401{ 404{
402#if defined(QT_QPROCESS_DEBUG) 405#if defined(QT_QPROCESS_DEBUG)
403 qDebug( "QProcessPrivate: Destructor" ); 406 qDebug( "QProcessPrivate: Destructor" );
404#endif 407#endif
405 408
406 if ( proc != 0 ) { 409 if ( proc != 0 ) {
407 if ( proc->socketStdin != 0 ) { 410 if ( proc->socketStdin != 0 ) {
408 ::close( proc->socketStdin ); 411 ::close( proc->socketStdin );
409 proc->socketStdin = 0; 412 proc->socketStdin = 0;
410 } 413 }
411 proc->process = 0; 414 proc->process = 0;
412 } 415 }
413 416
414 while ( !stdinBuf.isEmpty() ) { 417 while ( !stdinBuf.isEmpty() ) {
415 delete stdinBuf.dequeue(); 418 delete stdinBuf.dequeue();
416 } 419 }
417 delete notifierStdin; 420 delete notifierStdin;
418 delete notifierStdout; 421 delete notifierStdout;
419 delete notifierStderr; 422 delete notifierStderr;
420} 423}
421 424
422/* 425/*
423 Closes all open sockets in the child process that are not needed by the child 426 Closes all open sockets in the child process that are not needed by the child
424 process. Otherwise one child may have an open socket on standard input, etc. 427 process. Otherwise one child may have an open socket on standard input, etc.
425 of another child. 428 of another child.
426*/ 429*/
427void QProcessPrivate::closeOpenSocketsForChild() 430void QProcessPrivate::closeOpenSocketsForChild()
428{ 431{
429 if ( procManager != 0 ) { 432 if ( procManager != 0 ) {
430 if ( procManager->sigchldFd[0] != 0 ) 433 if ( procManager->sigchldFd[0] != 0 )
431 ::close( procManager->sigchldFd[0] ); 434 ::close( procManager->sigchldFd[0] );
432 if ( procManager->sigchldFd[1] != 0 ) 435 if ( procManager->sigchldFd[1] != 0 )
433 ::close( procManager->sigchldFd[1] ); 436 ::close( procManager->sigchldFd[1] );
434 437
435 // close also the sockets from other QProcess instances 438 // close also the sockets from other QProcess instances
436 QProc *proc; 439 QProc *proc;
437 for ( proc=procManager->procList->first(); proc!=0; proc=procManager->procList->next() ) { 440 for ( proc=procManager->procList->first(); proc!=0; proc=procManager->procList->next() ) {
438 ::close( proc->socketStdin ); 441 ::close( proc->socketStdin );
439 ::close( proc->socketStdout ); 442 ::close( proc->socketStdout );
440 ::close( proc->socketStderr ); 443 ::close( proc->socketStderr );
441 } 444 }
442 } 445 }
443} 446}
444 447
445void QProcessPrivate::newProc( pid_t pid, QProcess *process ) 448void QProcessPrivate::newProc( pid_t pid, QProcess *process )
446{ 449{
447 proc = new QProc( pid, process ); 450 proc = new QProc( pid, process );
448 if ( procManager == 0 ) { 451 if ( procManager == 0 ) {
449 procManager = new QProcessManager; 452 procManager = new QProcessManager;
450 qprocess_cleanup_procmanager.add( &procManager ); 453 qprocess_cleanup_procmanager.add( &procManager );
451 } 454 }
452 // the QProcessManager takes care of deleting the QProc instances 455 // the QProcessManager takes care of deleting the QProc instances
453 procManager->append( proc ); 456 procManager->append( proc );
454} 457}
455 458
456/*********************************************************************** 459/***********************************************************************
457 * 460 *
458 * sigchld handler callback 461 * sigchld handler callback
459 * 462 *
460 **********************************************************************/ 463 **********************************************************************/
461QT_SIGNAL_RETTYPE qt_C_sigchldHnd( QT_SIGNAL_ARGS ) 464QT_SIGNAL_RETTYPE qt_C_sigchldHnd( QT_SIGNAL_ARGS )
462{ 465{
463 if ( QProcessPrivate::procManager == 0 ) 466 if ( QProcessPrivate::procManager == 0 )
464 return; 467 return;
465 if ( QProcessPrivate::procManager->sigchldFd[0] == 0 ) 468 if ( QProcessPrivate::procManager->sigchldFd[0] == 0 )
466 return; 469 return;
467 470
468 char a = 1; 471 char a = 1;
469 ::write( QProcessPrivate::procManager->sigchldFd[0], &a, sizeof(a) ); 472 ::write( QProcessPrivate::procManager->sigchldFd[0], &a, sizeof(a) );
470} 473}
471QT_SIGNAL_RETTYPE qt_C_sigpipeHnd( QT_SIGNAL_ARGS ) 474QT_SIGNAL_RETTYPE qt_C_sigpipeHnd( QT_SIGNAL_ARGS )
472{ 475{
473 // Ignore (but in a way somehow different to SIG_IGN). 476 // Ignore (but in a way somehow different to SIG_IGN).
474} 477}
475 478
476 479
477/*********************************************************************** 480/***********************************************************************
478 * 481 *
479 * QProcess 482 * QProcess
480 * 483 *
481 **********************************************************************/ 484 **********************************************************************/
482/*! 485/*!
483 This private class does basic initialization. 486 This private class does basic initialization.
484*/ 487*/
485void QProcess::init() 488void QProcess::init()
486{ 489{
487 d = new QProcessPrivate(); 490 d = new QProcessPrivate();
488 exitStat = 0; 491 exitStat = 0;
489 exitNormal = FALSE; 492 exitNormal = FALSE;
490} 493}
491 494
492/*! 495/*!
493 This private class resets the process variables, etc. so that it can be used 496 This private class resets the process variables, etc. so that it can be used
494 for another process to start. 497 for another process to start.
495*/ 498*/
496void QProcess::reset() 499void QProcess::reset()
497{ 500{
498 delete d; 501 delete d;
499 d = new QProcessPrivate(); 502 d = new QProcessPrivate();
500 exitStat = 0; 503 exitStat = 0;
501 exitNormal = FALSE; 504 exitNormal = FALSE;
502 d->bufStdout.resize( 0 ); 505 d->bufStdout.resize( 0 );
503 d->bufStderr.resize( 0 ); 506 d->bufStderr.resize( 0 );
504} 507}
505 508
506QByteArray* QProcess::bufStdout() 509QByteArray* QProcess::bufStdout()
507{ 510{
508 if ( d->proc && d->proc->socketStdout ) { 511 if ( d->proc && d->proc->socketStdout ) {
509 // ### can this cause a blocking behaviour (maybe do a ioctl() to see 512 // ### can this cause a blocking behaviour (maybe do a ioctl() to see
510 // if data is available)? 513 // if data is available)?
511 socketRead( d->proc->socketStdout ); 514 socketRead( d->proc->socketStdout );
512 } 515 }
513 return &d->bufStdout; 516 return &d->bufStdout;
514} 517}
515 518
516QByteArray* QProcess::bufStderr() 519QByteArray* QProcess::bufStderr()
517{ 520{
518 if ( d->proc && d->proc->socketStderr ) { 521 if ( d->proc && d->proc->socketStderr ) {
519 // ### can this cause a blocking behaviour (maybe do a ioctl() to see 522 // ### can this cause a blocking behaviour (maybe do a ioctl() to see
520 // if data is available)? 523 // if data is available)?
521 socketRead( d->proc->socketStderr ); 524 socketRead( d->proc->socketStderr );
522 } 525 }
523 return &d->bufStderr; 526 return &d->bufStderr;
524} 527}
525 528
526void QProcess::consumeBufStdout( int consume ) 529void QProcess::consumeBufStdout( int consume )
527{ 530{
528 uint n = d->bufStdout.size(); 531 uint n = d->bufStdout.size();
529 if ( consume==-1 || (uint)consume >= n ) { 532 if ( consume==-1 || (uint)consume >= n ) {
530 d->bufStdout.resize( 0 ); 533 d->bufStdout.resize( 0 );
531 } else { 534 } else {
532 QByteArray tmp( n - consume ); 535 QByteArray tmp( n - consume );
533 memcpy( tmp.data(), d->bufStdout.data()+consume, n-consume ); 536 memcpy( tmp.data(), d->bufStdout.data()+consume, n-consume );
534 d->bufStdout = tmp; 537 d->bufStdout = tmp;
535 } 538 }
536} 539}
537 540
538void QProcess::consumeBufStderr( int consume ) 541void QProcess::consumeBufStderr( int consume )
539{ 542{
540 uint n = d->bufStderr.size(); 543 uint n = d->bufStderr.size();
541 if ( consume==-1 || (uint)consume >= n ) { 544 if ( consume==-1 || (uint)consume >= n ) {
542 d->bufStderr.resize( 0 ); 545 d->bufStderr.resize( 0 );
543 } else { 546 } else {
544 QByteArray tmp( n - consume ); 547 QByteArray tmp( n - consume );
545 memcpy( tmp.data(), d->bufStderr.data()+consume, n-consume ); 548 memcpy( tmp.data(), d->bufStderr.data()+consume, n-consume );
546 d->bufStderr = tmp; 549 d->bufStderr = tmp;
547 } 550 }
548} 551}
549 552
550/*! 553/*!
551 Destroys the class. 554 Destroys the class.
552 555
553 If the process is running, it is NOT terminated! Standard input, standard 556 If the process is running, it is NOT terminated! Standard input, standard
554 output and standard error of the process are closed. 557 output and standard error of the process are closed.
555 558
556 You can connect the destroyed() signal to the kill() slot, if you want the 559 You can connect the destroyed() signal to the kill() slot, if you want the
557 process to be terminated automatically when the class is destroyed. 560 process to be terminated automatically when the class is destroyed.
558 561
559 \sa tryTerminate() kill() 562 \sa tryTerminate() kill()
560*/ 563*/
561QProcess::~QProcess() 564QProcess::~QProcess()
562{ 565{
563 delete d; 566 delete d;
564} 567}
565 568
566/*! 569/*!
567 Tries to run a process for the command and arguments that were specified with 570 Tries to run a process for the command and arguments that were specified with
568 setArguments(), addArgument() or that were specified in the constructor. The 571 setArguments(), addArgument() or that were specified in the constructor. The
569 command is searched in the path for executable programs; you can also use an 572 command is searched in the path for executable programs; you can also use an
570 absolute path to the command. 573 absolute path to the command.
571 574
572 If \a env is null, then the process is started with the same environment as 575 If \a env is null, then the process is started with the same environment as
573 the starting process. If \a env is non-null, then the values in the 576 the starting process. If \a env is non-null, then the values in the
574 stringlist are interpreted as environment setttings of the form \c 577 stringlist are interpreted as environment setttings of the form \c
575 {key=value} and the process is started in these environment settings. For 578 {key=value} and the process is started in these environment settings. For
576 convenience, there is a small exception to this rule: under Unix, if \a env 579 convenience, there is a small exception to this rule: under Unix, if \a env
577 does not contain any settings for the environment variable \c 580 does not contain any settings for the environment variable \c
578 LD_LIBRARY_PATH, then this variable is inherited from the starting process; 581 LD_LIBRARY_PATH, then this variable is inherited from the starting process;
579 under Windows the same applies for the enverionment varialbe \c PATH. 582 under Windows the same applies for the enverionment varialbe \c PATH.
580 583
581 Returns TRUE if the process could be started, otherwise FALSE. 584 Returns TRUE if the process could be started, otherwise FALSE.
582 585
583 You can write data to standard input of the process with 586 You can write data to standard input of the process with
584 writeToStdin(), you can close standard input with closeStdin() and you can 587 writeToStdin(), you can close standard input with closeStdin() and you can
585 terminate the process tryTerminate() resp. kill(). 588 terminate the process tryTerminate() resp. kill().
586 589
587 You can call this function even when there already is a running 590 You can call this function even when there already is a running
588 process in this object. In this case, QProcess closes standard input 591 process in this object. In this case, QProcess closes standard input
589 of the old process and deletes pending data, i.e., you loose all 592 of the old process and deletes pending data, i.e., you loose all
590 control over that process, but the process is not terminated. This applies 593 control over that process, but the process is not terminated. This applies
591 also if the process could not be started. (On operating systems that have 594 also if the process could not be started. (On operating systems that have
592 zombie processes, Qt will also wait() on the old process.) 595 zombie processes, Qt will also wait() on the old process.)
593 596
594 \sa launch() closeStdin() 597 \sa launch() closeStdin()
595*/ 598*/
596bool QProcess::start( QStringList *env ) 599bool QProcess::start( QStringList *env )
597{ 600{
598#if defined(QT_QPROCESS_DEBUG) 601#if defined(QT_QPROCESS_DEBUG)
599 qDebug( "QProcess::start()" ); 602 qDebug( "QProcess::start()" );
600#endif 603#endif
601 reset(); 604 reset();
602 605
603 int sStdin[2]; 606 int sStdin[2];
604 int sStdout[2]; 607 int sStdout[2];
605 int sStderr[2]; 608 int sStderr[2];
606 609
607 // open sockets for piping 610 // open sockets for piping
608 if ( (comms & Stdin) && ::socketpair( AF_UNIX, SOCK_STREAM, 0, sStdin ) == -1 ) { 611 if ( (comms & Stdin) && ::socketpair( AF_UNIX, SOCK_STREAM, 0, sStdin ) == -1 ) {
609 return FALSE; 612 return FALSE;
610 } 613 }
611 if ( (comms & Stderr) && ::socketpair( AF_UNIX, SOCK_STREAM, 0, sStderr ) == -1 ) { 614 if ( (comms & Stderr) && ::socketpair( AF_UNIX, SOCK_STREAM, 0, sStderr ) == -1 ) {
612 return FALSE; 615 return FALSE;
613 } 616 }
614 if ( (comms & Stdout) && ::socketpair( AF_UNIX, SOCK_STREAM, 0, sStdout ) == -1 ) { 617 if ( (comms & Stdout) && ::socketpair( AF_UNIX, SOCK_STREAM, 0, sStdout ) == -1 ) {
615 return FALSE; 618 return FALSE;
616 } 619 }
617 620
618 // the following pipe is only used to determine if the process could be 621 // the following pipe is only used to determine if the process could be
619 // started 622 // started
620 int fd[2]; 623 int fd[2];
621 if ( pipe( fd ) < 0 ) { 624 if ( pipe( fd ) < 0 ) {
622 // non critical error, go on 625 // non critical error, go on
623 fd[0] = 0; 626 fd[0] = 0;
624 fd[1] = 0; 627 fd[1] = 0;
625 } 628 }
626 629
627 // construct the arguments for exec 630 // construct the arguments for exec
628 QCString *arglistQ = new QCString[ _arguments.count() + 1 ]; 631 QCString *arglistQ = new QCString[ _arguments.count() + 1 ];
629 const char** arglist = new const char*[ _arguments.count() + 1 ]; 632 const char** arglist = new const char*[ _arguments.count() + 1 ];
630 int i = 0; 633 int i = 0;
631 for ( QStringList::Iterator it = _arguments.begin(); it != _arguments.end(); ++it ) { 634 for ( QStringList::Iterator it = _arguments.begin(); it != _arguments.end(); ++it ) {
632 arglistQ[i] = (*it).local8Bit(); 635 arglistQ[i] = (*it).local8Bit();
633 arglist[i] = arglistQ[i]; 636 arglist[i] = arglistQ[i];
634#if defined(QT_QPROCESS_DEBUG) 637#if defined(QT_QPROCESS_DEBUG)
635 qDebug( "QProcess::start(): arg %d = %s", i, arglist[i] ); 638 qDebug( "QProcess::start(): arg %d = %s", i, arglist[i] );
636#endif 639#endif
637 i++; 640 i++;
638 } 641 }
639 arglist[i] = 0; 642 arglist[i] = 0;
640 643
641 // Must make sure signal handlers are installed before exec'ing 644 // Must make sure signal handlers are installed before exec'ing
642 // in case the process exits quickly. 645 // in case the process exits quickly.
643 if ( d->procManager == 0 ) { 646 if ( d->procManager == 0 ) {
644 d->procManager = new QProcessManager; 647 d->procManager = new QProcessManager;
645 qprocess_cleanup_procmanager.add( &d->procManager ); 648 qprocess_cleanup_procmanager.add( &d->procManager );
646 } 649 }
647 650
648 // fork and exec 651 // fork and exec
649 QApplication::flushX(); 652 QApplication::flushX();
650 pid_t pid = fork(); 653 pid_t pid = fork();
651 if ( pid == 0 ) { 654 if ( pid == 0 ) {
652 // child 655 // child
653 d->closeOpenSocketsForChild(); 656 d->closeOpenSocketsForChild();
654 if ( comms & Stdin ) { 657 if ( comms & Stdin ) {
655 ::close( sStdin[1] ); 658 ::close( sStdin[1] );
656 ::dup2( sStdin[0], STDIN_FILENO ); 659 ::dup2( sStdin[0], STDIN_FILENO );
657 } 660 }
658 if ( comms & Stdout ) { 661 if ( comms & Stdout ) {
659 ::close( sStdout[0] ); 662 ::close( sStdout[0] );
660 ::dup2( sStdout[1], STDOUT_FILENO ); 663 ::dup2( sStdout[1], STDOUT_FILENO );
661 } 664 }
662 if ( comms & Stderr ) { 665 if ( comms & Stderr ) {
663 ::close( sStderr[0] ); 666 ::close( sStderr[0] );
664 ::dup2( sStderr[1], STDERR_FILENO ); 667 ::dup2( sStderr[1], STDERR_FILENO );
665 } 668 }
666 if ( comms & DupStderr ) { 669 if ( comms & DupStderr ) {
667 ::dup2( STDOUT_FILENO, STDERR_FILENO ); 670 ::dup2( STDOUT_FILENO, STDERR_FILENO );
668 } 671 }
669#ifndef QT_NO_DIR 672#ifndef QT_NO_DIR
670 ::chdir( workingDir.absPath().latin1() ); 673 ::chdir( workingDir.absPath().latin1() );
671#endif 674#endif
672 if ( fd[0] ) 675 if ( fd[0] )
673 ::close( fd[0] ); 676 ::close( fd[0] );
674 if ( fd[1] ) 677 if ( fd[1] )
675 ::fcntl( fd[1], F_SETFD, FD_CLOEXEC ); // close on exec shows sucess 678 ::fcntl( fd[1], F_SETFD, FD_CLOEXEC ); // close on exec shows sucess
676 679
677 if ( env == 0 ) { // inherit environment and start process 680 if ( env == 0 ) { // inherit environment and start process
678 ::execvp( arglist[0], (char*const*)arglist ); // ### cast not nice 681 ::execvp( arglist[0], (char*const*)arglist ); // ### cast not nice
679 } else { // start process with environment settins as specified in env 682 } else { // start process with environment settins as specified in env
680 // construct the environment for exec 683 // construct the environment for exec
681 int numEntries = env->count(); 684 int numEntries = env->count();
682 bool setLibraryPath = 685 bool setLibraryPath =
683 env->grep( QRegExp( "^LD_LIBRARY_PATH=" ) ).isEmpty() && 686 env->grep( QRegExp( "^LD_LIBRARY_PATH=" ) ).isEmpty() &&
684 getenv( "LD_LIBRARY_PATH" ) != 0; 687 getenv( "LD_LIBRARY_PATH" ) != 0;
685 if ( setLibraryPath ) 688 if ( setLibraryPath )
686 numEntries++; 689 numEntries++;
687 QCString *envlistQ = new QCString[ numEntries + 1 ]; 690 QCString *envlistQ = new QCString[ numEntries + 1 ];
688 const char** envlist = new const char*[ numEntries + 1 ]; 691 const char** envlist = new const char*[ numEntries + 1 ];
689 int i = 0; 692 int i = 0;
690 if ( setLibraryPath ) { 693 if ( setLibraryPath ) {
691 envlistQ[i] = QString( "LD_LIBRARY_PATH=%1" ).arg( getenv( "LD_LIBRARY_PATH" ) ).local8Bit(); 694 envlistQ[i] = QString( "LD_LIBRARY_PATH=%1" ).arg( getenv( "LD_LIBRARY_PATH" ) ).local8Bit();
692 envlist[i] = envlistQ[i]; 695 envlist[i] = envlistQ[i];
693 i++; 696 i++;
694 } 697 }
695 for ( QStringList::Iterator it = env->begin(); it != env->end(); ++it ) { 698 for ( QStringList::Iterator it = env->begin(); it != env->end(); ++it ) {
696 envlistQ[i] = (*it).local8Bit(); 699 envlistQ[i] = (*it).local8Bit();
697 envlist[i] = envlistQ[i]; 700 envlist[i] = envlistQ[i];
698 i++; 701 i++;
699 } 702 }
700 envlist[i] = 0; 703 envlist[i] = 0;
701 704
702 // look for the executable in the search path 705 // look for the executable in the search path
703 if ( _arguments.count()>0 && getenv("PATH")!=0 ) { 706 if ( _arguments.count()>0 && getenv("PATH")!=0 ) {
704 QString command = _arguments[0]; 707 QString command = _arguments[0];
705 if ( !command.contains( '/' ) ) { 708 if ( !command.contains( '/' ) ) {
706 QStringList pathList = QStringList::split( ':', getenv( "PATH" ) ); 709 QStringList pathList = QStringList::split( ':', getenv( "PATH" ) );
707 for (QStringList::Iterator it = pathList.begin(); it != pathList.end(); ++it ) { 710 for (QStringList::Iterator it = pathList.begin(); it != pathList.end(); ++it ) {
708 QString dir = *it; 711 QString dir = *it;
709#ifdef Q_OS_MACX 712#ifdef Q_OS_MACX
710 if(QFile::exists(dir + "/" + command + ".app")) //look in a bundle 713 if(QFile::exists(dir + "/" + command + ".app")) //look in a bundle
711 dir += "/" + command + ".app/Contents/MacOS"; 714 dir += "/" + command + ".app/Contents/MacOS";
712#endif 715#endif
713#ifndef QT_NO_DIR 716#ifndef QT_NO_DIR
714 QFileInfo fileInfo( dir, command ); 717 QFileInfo fileInfo( dir, command );
715#else 718#else
716 QFileInfo fileInfo( dir + "/" + command ); 719 QFileInfo fileInfo( dir + "/" + command );
717#endif 720#endif
718 if ( fileInfo.isExecutable() ) { 721 if ( fileInfo.isExecutable() ) {
719 arglistQ[0] = fileInfo.filePath().local8Bit(); 722 arglistQ[0] = fileInfo.filePath().local8Bit();
720 arglist[0] = arglistQ[0]; 723 arglist[0] = arglistQ[0];
721 break; 724 break;
722 } 725 }
723 } 726 }
724 } 727 }
725 } 728 }
726 ::execve( arglist[0], (char*const*)arglist, (char*const*)envlist ); // ### casts not nice 729 ::execve( arglist[0], (char*const*)arglist, (char*const*)envlist ); // ### casts not nice
727 } 730 }
728 if ( fd[1] ) { 731 if ( fd[1] ) {
729 char buf = 0; 732 char buf = 0;
730 ::write( fd[1], &buf, 1 ); 733 ::write( fd[1], &buf, 1 );
731 ::close( fd[1] ); 734 ::close( fd[1] );
732 } 735 }
733 ::exit( -1 ); 736 ::exit( -1 );
734 } else if ( pid == -1 ) { 737 } else if ( pid == -1 ) {
735 // error forking 738 // error forking
736 goto error; 739 goto error;
737 } 740 }
738 741
739 // test if exec was successful 742 // test if exec was successful
740 if ( fd[1] ) 743 if ( fd[1] )
741 ::close( fd[1] ); 744 ::close( fd[1] );
742 if ( fd[0] ) { 745 if ( fd[0] ) {
743 char buf; 746 char buf;
744 for ( ;; ) { 747 for ( ;; ) {
745 int n = ::read( fd[0], &buf, 1 ); 748 int n = ::read( fd[0], &buf, 1 );
746 if ( n==1 ) { 749 if ( n==1 ) {
747 // socket was not closed => error 750 // socket was not closed => error
748 d->proc = 0; 751 d->proc = 0;
749 goto error; 752 goto error;
750 } else if ( n==-1 ) { 753 } else if ( n==-1 ) {
751 if ( errno==EAGAIN || errno==EINTR ) 754 if ( errno==EAGAIN || errno==EINTR )
752 // try it again 755 // try it again
753 continue; 756 continue;
754 } 757 }
755 break; 758 break;
756 } 759 }
757 ::close( fd[0] ); 760 ::close( fd[0] );
758 } 761 }
759 762
760 d->newProc( pid, this ); 763 d->newProc( pid, this );
761 764
762 if ( comms & Stdin ) { 765 if ( comms & Stdin ) {
763 ::close( sStdin[0] ); 766 ::close( sStdin[0] );
764 d->proc->socketStdin = sStdin[1]; 767 d->proc->socketStdin = sStdin[1];
765 d->notifierStdin = new QSocketNotifier( sStdin[1], QSocketNotifier::Write ); 768 d->notifierStdin = new QSocketNotifier( sStdin[1], QSocketNotifier::Write );
766 connect( d->notifierStdin, SIGNAL(activated(int)), 769 connect( d->notifierStdin, SIGNAL(activated(int)),
767 this, SLOT(socketWrite(int)) ); 770 this, SLOT(socketWrite(int)) );
768 // setup notifiers for the sockets 771 // setup notifiers for the sockets
769 if ( !d->stdinBuf.isEmpty() ) { 772 if ( !d->stdinBuf.isEmpty() ) {
770 d->notifierStdin->setEnabled( TRUE ); 773 d->notifierStdin->setEnabled( TRUE );
771 } 774 }
772 } 775 }
773 if ( comms & Stdout ) { 776 if ( comms & Stdout ) {
774 ::close( sStdout[1] ); 777 ::close( sStdout[1] );
775 d->proc->socketStdout = sStdout[0]; 778 d->proc->socketStdout = sStdout[0];
776 d->notifierStdout = new QSocketNotifier( sStdout[0], QSocketNotifier::Read ); 779 d->notifierStdout = new QSocketNotifier( sStdout[0], QSocketNotifier::Read );
777 connect( d->notifierStdout, SIGNAL(activated(int)), 780 connect( d->notifierStdout, SIGNAL(activated(int)),
778 this, SLOT(socketRead(int)) ); 781 this, SLOT(socketRead(int)) );
779 if ( ioRedirection ) 782 if ( ioRedirection )
780 d->notifierStdout->setEnabled( TRUE ); 783 d->notifierStdout->setEnabled( TRUE );
781 } 784 }
782 if ( comms & Stderr ) { 785 if ( comms & Stderr ) {
783 ::close( sStderr[1] ); 786 ::close( sStderr[1] );
784 d->proc->socketStderr = sStderr[0]; 787 d->proc->socketStderr = sStderr[0];
785 d->notifierStderr = new QSocketNotifier( sStderr[0], QSocketNotifier::Read ); 788 d->notifierStderr = new QSocketNotifier( sStderr[0], QSocketNotifier::Read );
786 connect( d->notifierStderr, SIGNAL(activated(int)), 789 connect( d->notifierStderr, SIGNAL(activated(int)),
787 this, SLOT(socketRead(int)) ); 790 this, SLOT(socketRead(int)) );
788 if ( ioRedirection ) 791 if ( ioRedirection )
789 d->notifierStderr->setEnabled( TRUE ); 792 d->notifierStderr->setEnabled( TRUE );
790 } 793 }
791 794
792 // cleanup and return 795 // cleanup and return
793 delete[] arglistQ; 796 delete[] arglistQ;
794 delete[] arglist; 797 delete[] arglist;
795 return TRUE; 798 return TRUE;
796 799
797error: 800error:
798#if defined(QT_QPROCESS_DEBUG) 801#if defined(QT_QPROCESS_DEBUG)
799 qDebug( "QProcess::start(): error starting process" ); 802 qDebug( "QProcess::start(): error starting process" );
800#endif 803#endif
801 if ( d->procManager ) 804 if ( d->procManager )
802 d->procManager->cleanup(); 805 d->procManager->cleanup();
803 if ( comms & Stdin ) { 806 if ( comms & Stdin ) {
804 ::close( sStdin[1] ); 807 ::close( sStdin[1] );
805 ::close( sStdin[0] ); 808 ::close( sStdin[0] );
806 } 809 }
807 if ( comms & Stdout ) { 810 if ( comms & Stdout ) {
808 ::close( sStdout[0] ); 811 ::close( sStdout[0] );
809 ::close( sStdout[1] ); 812 ::close( sStdout[1] );
810 } 813 }
811 if ( comms & Stderr ) { 814 if ( comms & Stderr ) {
812 ::close( sStderr[0] ); 815 ::close( sStderr[0] );
813 ::close( sStderr[1] ); 816 ::close( sStderr[1] );
814 } 817 }
815 ::close( fd[0] ); 818 ::close( fd[0] );
816 ::close( fd[1] ); 819 ::close( fd[1] );
817 delete[] arglistQ; 820 delete[] arglistQ;
818 delete[] arglist; 821 delete[] arglist;
819 return FALSE; 822 return FALSE;
820} 823}
821 824
822 825
823/*! 826/*!
824 Asks the process to terminate. Processes can ignore this wish. If you want to 827 Asks the process to terminate. Processes can ignore this wish. If you want to
825 be sure that the process really terminates, you must use kill() instead. 828 be sure that the process really terminates, you must use kill() instead.
826 829
827 The slot returns immediately: it does not wait until the process has 830 The slot returns immediately: it does not wait until the process has
828 finished. When the process really exited, the signal processExited() is 831 finished. When the process really exited, the signal processExited() is
829 emitted. 832 emitted.
830 833
831 \sa kill() processExited() 834 \sa kill() processExited()
832*/ 835*/
833void QProcess::tryTerminate() const 836void QProcess::tryTerminate() const
834{ 837{
835 if ( d->proc != 0 ) 838 if ( d->proc != 0 )
836 ::kill( d->proc->pid, SIGTERM ); 839 ::kill( d->proc->pid, SIGTERM );
837} 840}
838 841
839/*! 842/*!
840 Terminates the process. This is not a safe way to end a process since the 843 Terminates the process. This is not a safe way to end a process since the
841 process will not be able to do cleanup. tryTerminate() is a safer way to do 844 process will not be able to do cleanup. tryTerminate() is a safer way to do
842 it, but processes might ignore a tryTerminate(). 845 it, but processes might ignore a tryTerminate().
843 846
844 The nice way to end a process and to be sure that it is finished, is doing 847 The nice way to end a process and to be sure that it is finished, is doing
845 something like this: 848 something like this:
846 \code 849 \code
847 process->tryTerminate(); 850 process->tryTerminate();
848 QTimer::singleShot( 5000, process, SLOT( kill() ) ); 851 QTimer::singleShot( 5000, process, SLOT( kill() ) );
849 \endcode 852 \endcode
850 853
851 This tries to terminate the process the nice way. If the process is still 854 This tries to terminate the process the nice way. If the process is still
852 running after 5 seconds, it terminates the process the hard way. The timeout 855 running after 5 seconds, it terminates the process the hard way. The timeout
853 should be chosen depending on the time the process needs to do all the 856 should be chosen depending on the time the process needs to do all the
854 cleanup: use a higher value if the process is likely to do heavy computation 857 cleanup: use a higher value if the process is likely to do heavy computation
855 on cleanup. 858 on cleanup.
856 859
857 The slot returns immediately: it does not wait until the process has 860 The slot returns immediately: it does not wait until the process has
858 finished. When the process really exited, the signal processExited() is 861 finished. When the process really exited, the signal processExited() is
859 emitted. 862 emitted.
860 863
861 \sa tryTerminate() processExited() 864 \sa tryTerminate() processExited()
862*/ 865*/
863void QProcess::kill() const 866void QProcess::kill() const
864{ 867{
865 if ( d->proc != 0 ) 868 if ( d->proc != 0 )
866 ::kill( d->proc->pid, SIGKILL ); 869 ::kill( d->proc->pid, SIGKILL );
867} 870}
868 871
869/*! 872/*!
870 Returns TRUE if the process is running, otherwise FALSE. 873 Returns TRUE if the process is running, otherwise FALSE.
871 874
872 \sa normalExit() exitStatus() processExited() 875 \sa normalExit() exitStatus() processExited()
873*/ 876*/
874bool QProcess::isRunning() const 877bool QProcess::isRunning() const
875{ 878{
876 if ( d->exitValuesCalculated ) { 879 if ( d->exitValuesCalculated ) {
877#if defined(QT_QPROCESS_DEBUG) 880#if defined(QT_QPROCESS_DEBUG)
878 qDebug( "QProcess::isRunning(): FALSE (already computed)" ); 881 qDebug( "QProcess::isRunning(): FALSE (already computed)" );
879#endif 882#endif
880 return FALSE; 883 return FALSE;
881 } 884 }
882 if ( d->proc == 0 ) 885 if ( d->proc == 0 )
883 return FALSE; 886 return FALSE;
884 int status; 887 int status;
885 if ( ::waitpid( d->proc->pid, &status, WNOHANG ) == d->proc->pid ) 888 if ( ::waitpid( d->proc->pid, &status, WNOHANG ) == d->proc->pid )
886 { 889 {
887 // compute the exit values 890 // compute the exit values
888 QProcess *that = (QProcess*)this; // mutable 891 QProcess *that = (QProcess*)this; // mutable
889 that->exitNormal = WIFEXITED( status ) != 0; 892 that->exitNormal = WIFEXITED( status ) != 0;
890 if ( exitNormal ) { 893 if ( exitNormal ) {
891 that->exitStat = (char)WEXITSTATUS( status ); 894 that->exitStat = (char)WEXITSTATUS( status );
892 } 895 }
893 d->exitValuesCalculated = TRUE; 896 d->exitValuesCalculated = TRUE;
894#if defined(QT_QPROCESS_DEBUG) 897#if defined(QT_QPROCESS_DEBUG)
895 qDebug( "QProcess::isRunning() (PID: %d): FALSE", d->proc->pid ); 898 qDebug( "QProcess::isRunning() (PID: %d): FALSE", d->proc->pid );
896#endif 899#endif
897 return FALSE; 900 return FALSE;
898 } 901 }
899#if defined(QT_QPROCESS_DEBUG) 902#if defined(QT_QPROCESS_DEBUG)
900 qDebug( "QProcess::isRunning() (PID: %d): TRUE", d->proc->pid ); 903 qDebug( "QProcess::isRunning() (PID: %d): TRUE", d->proc->pid );
901#endif 904#endif
902 return TRUE; 905 return TRUE;
903} 906}
904 907
905/*! 908/*!
906 Writes the data \a buf to the standard input of the process. The process may 909 Writes the data \a buf to the standard input of the process. The process may
907 or may not read this data. 910 or may not read this data.
908 911
909 This function returns immediately; the QProcess class might write the data at 912 This function returns immediately; the QProcess class might write the data at
910 a later point (you have to enter the event loop for that). When all the data 913 a later point (you have to enter the event loop for that). When all the data
911 is written to the process, the signal wroteToStdin() is emitted. This does 914 is written to the process, the signal wroteToStdin() is emitted. This does
912 not mean that the process really read the data, since this class only detects 915 not mean that the process really read the data, since this class only detects
913 when it was able to write the data to the operating system. 916 when it was able to write the data to the operating system.
914 917
915 \sa wroteToStdin() closeStdin() readStdout() readStderr() 918 \sa wroteToStdin() closeStdin() readStdout() readStderr()
916*/ 919*/
917void QProcess::writeToStdin( const QByteArray& buf ) 920void QProcess::writeToStdin( const QByteArray& buf )
918{ 921{
919#if defined(QT_QPROCESS_DEBUG) 922#if defined(QT_QPROCESS_DEBUG)
920// qDebug( "QProcess::writeToStdin(): write to stdin (%d)", d->socketStdin ); 923// qDebug( "QProcess::writeToStdin(): write to stdin (%d)", d->socketStdin );
921#endif 924#endif
922 d->stdinBuf.enqueue( new QByteArray(buf) ); 925 d->stdinBuf.enqueue( new QByteArray(buf) );
923 if ( d->notifierStdin != 0 ) 926 if ( d->notifierStdin != 0 )
924 d->notifierStdin->setEnabled( TRUE ); 927 d->notifierStdin->setEnabled( TRUE );
925} 928}
926 929
927 930
928/*! 931/*!
929 Closes standard input of the process. 932 Closes standard input of the process.
930 933
931 This function also deletes pending data that is not written to standard input 934 This function also deletes pending data that is not written to standard input
932 yet. 935 yet.
933 936
934 \sa wroteToStdin() 937 \sa wroteToStdin()
935*/ 938*/
936void QProcess::closeStdin() 939void QProcess::closeStdin()
937{ 940{
938 if ( d->proc == 0 ) 941 if ( d->proc == 0 )
939 return; 942 return;
940 if ( d->proc->socketStdin !=0 ) { 943 if ( d->proc->socketStdin !=0 ) {
941 while ( !d->stdinBuf.isEmpty() ) { 944 while ( !d->stdinBuf.isEmpty() ) {
942 delete d->stdinBuf.dequeue(); 945 delete d->stdinBuf.dequeue();
943 } 946 }
944 delete d->notifierStdin; 947 delete d->notifierStdin;
945 d->notifierStdin = 0; 948 d->notifierStdin = 0;
946 if ( ::close( d->proc->socketStdin ) != 0 ) { 949 if ( ::close( d->proc->socketStdin ) != 0 ) {
947 qWarning( "Could not close stdin of child process" ); 950 qWarning( "Could not close stdin of child process" );
948 } 951 }
949#if defined(QT_QPROCESS_DEBUG) 952#if defined(QT_QPROCESS_DEBUG)
950 qDebug( "QProcess::closeStdin(): stdin (%d) closed", d->proc->socketStdin ); 953 qDebug( "QProcess::closeStdin(): stdin (%d) closed", d->proc->socketStdin );
951#endif 954#endif
952 d->proc->socketStdin = 0; 955 d->proc->socketStdin = 0;
953 } 956 }
954} 957}
955 958
956 959
957/* 960/*
958 This private slot is called when the process has outputted data to either 961 This private slot is called when the process has outputted data to either
959 standard output or standard error. 962 standard output or standard error.
960*/ 963*/
961void QProcess::socketRead( int fd ) 964void QProcess::socketRead( int fd )
962{ 965{
963 if ( d->socketReadCalled ) { 966 if ( d->socketReadCalled ) {
964 // the slots that are connected to the readyRead...() signals might 967 // the slots that are connected to the readyRead...() signals might
965 // trigger a recursive call of socketRead(). Avoid this since you get a 968 // trigger a recursive call of socketRead(). Avoid this since you get a
966 // blocking read otherwise. 969 // blocking read otherwise.
967 return; 970 return;
968 } 971 }
969#if defined(QT_QPROCESS_DEBUG) 972#if defined(QT_QPROCESS_DEBUG)
970 qDebug( "QProcess::socketRead(): %d", fd ); 973 qDebug( "QProcess::socketRead(): %d", fd );
971#endif 974#endif
972 if ( fd == 0 ) 975 if ( fd == 0 )
973 return; 976 return;
974 const int bufsize = 4096; 977 const int bufsize = 4096;
975 QByteArray *buffer = 0; 978 QByteArray *buffer = 0;
976 uint oldSize; 979 uint oldSize;
977 int n; 980 int n;
978 if ( fd == d->proc->socketStdout ) { 981 if ( fd == d->proc->socketStdout ) {
979 buffer = &d->bufStdout; 982 buffer = &d->bufStdout;
980 } else if ( fd == d->proc->socketStderr ) { 983 } else if ( fd == d->proc->socketStderr ) {
981 buffer = &d->bufStderr; 984 buffer = &d->bufStderr;
982 } else { 985 } else {
983 // this case should never happen, but just to be safe 986 // this case should never happen, but just to be safe
984 return; 987 return;
985 } 988 }
986 989
987 // read data 990 // read data
988 oldSize = buffer->size(); 991 oldSize = buffer->size();
989 buffer->resize( oldSize + bufsize ); 992 buffer->resize( oldSize + bufsize );
990 n = ::read( fd, buffer->data()+oldSize, bufsize ); 993 n = ::read( fd, buffer->data()+oldSize, bufsize );
991 if ( n > 0 ) 994 if ( n > 0 )
992 buffer->resize( oldSize + n ); 995 buffer->resize( oldSize + n );
993 else 996 else
994 buffer->resize( oldSize ); 997 buffer->resize( oldSize );
995 // eof or error? 998 // eof or error?
996 if ( n == 0 || n == -1 ) { 999 if ( n == 0 || n == -1 ) {
997 if ( fd == d->proc->socketStdout ) { 1000 if ( fd == d->proc->socketStdout ) {
998#if defined(QT_QPROCESS_DEBUG) 1001#if defined(QT_QPROCESS_DEBUG)
999 qDebug( "QProcess::socketRead(): stdout (%d) closed", fd ); 1002 qDebug( "QProcess::socketRead(): stdout (%d) closed", fd );
1000#endif 1003#endif
1001 d->notifierStdout->setEnabled( FALSE ); 1004 d->notifierStdout->setEnabled( FALSE );
1002 delete d->notifierStdout; 1005 delete d->notifierStdout;
1003 d->notifierStdout = 0; 1006 d->notifierStdout = 0;
1004 ::close( d->proc->socketStdout ); 1007 ::close( d->proc->socketStdout );
1005 d->proc->socketStdout = 0; 1008 d->proc->socketStdout = 0;
1006 return; 1009 return;
1007 } else if ( fd == d->proc->socketStderr ) { 1010 } else if ( fd == d->proc->socketStderr ) {
1008#if defined(QT_QPROCESS_DEBUG) 1011#if defined(QT_QPROCESS_DEBUG)
1009 qDebug( "QProcess::socketRead(): stderr (%d) closed", fd ); 1012 qDebug( "QProcess::socketRead(): stderr (%d) closed", fd );
1010#endif 1013#endif
1011 d->notifierStderr->setEnabled( FALSE ); 1014 d->notifierStderr->setEnabled( FALSE );
1012 delete d->notifierStderr; 1015 delete d->notifierStderr;
1013 d->notifierStderr = 0; 1016 d->notifierStderr = 0;
1014 ::close( d->proc->socketStderr ); 1017 ::close( d->proc->socketStderr );
1015 d->proc->socketStderr = 0; 1018 d->proc->socketStderr = 0;
1016 return; 1019 return;
1017 } 1020 }
1018 } 1021 }
1019 // read all data that is available 1022 // read all data that is available
1020 while ( n == bufsize ) { 1023 while ( n == bufsize ) {
1021 oldSize = buffer->size(); 1024 oldSize = buffer->size();
1022 buffer->resize( oldSize + bufsize ); 1025 buffer->resize( oldSize + bufsize );
1023 n = ::read( fd, buffer->data()+oldSize, bufsize ); 1026 n = ::read( fd, buffer->data()+oldSize, bufsize );
1024 if ( n > 0 ) 1027 if ( n > 0 )
1025 buffer->resize( oldSize + n ); 1028 buffer->resize( oldSize + n );
1026 else 1029 else
1027 buffer->resize( oldSize ); 1030 buffer->resize( oldSize );
1028 } 1031 }
1029 1032
1030 d->socketReadCalled = TRUE; 1033 d->socketReadCalled = TRUE;
1031 if ( fd == d->proc->socketStdout ) { 1034 if ( fd == d->proc->socketStdout ) {
1032#if defined(QT_QPROCESS_DEBUG) 1035#if defined(QT_QPROCESS_DEBUG)
1033 qDebug( "QProcess::socketRead(): %d bytes read from stdout (%d)", 1036 qDebug( "QProcess::socketRead(): %d bytes read from stdout (%d)",
1034 buffer->size()-oldSize, fd ); 1037 buffer->size()-oldSize, fd );
1035#endif 1038#endif
1036 emit readyReadStdout(); 1039 emit readyReadStdout();
1037 } else if ( fd == d->proc->socketStderr ) { 1040 } else if ( fd == d->proc->socketStderr ) {
1038#if defined(QT_QPROCESS_DEBUG) 1041#if defined(QT_QPROCESS_DEBUG)
1039 qDebug( "QProcess::socketRead(): %d bytes read from stderr (%d)", 1042 qDebug( "QProcess::socketRead(): %d bytes read from stderr (%d)",
1040 buffer->size()-oldSize, fd ); 1043 buffer->size()-oldSize, fd );
1041#endif 1044#endif
1042 emit readyReadStderr(); 1045 emit readyReadStderr();
1043 } 1046 }
1044 d->socketReadCalled = FALSE; 1047 d->socketReadCalled = FALSE;
1045} 1048}
1046 1049
1047 1050
1048/* 1051/*
1049 This private slot is called when the process tries to read data from standard 1052 This private slot is called when the process tries to read data from standard
1050 input. 1053 input.
1051*/ 1054*/
1052void QProcess::socketWrite( int fd ) 1055void QProcess::socketWrite( int fd )
1053{ 1056{
1054 if ( fd != d->proc->socketStdin || d->proc->socketStdin == 0 ) 1057 if ( fd != d->proc->socketStdin || d->proc->socketStdin == 0 )
1055 return; 1058 return;
1056 if ( d->stdinBuf.isEmpty() ) { 1059 if ( d->stdinBuf.isEmpty() ) {
1057 d->notifierStdin->setEnabled( FALSE ); 1060 d->notifierStdin->setEnabled( FALSE );
1058 return; 1061 return;
1059 } 1062 }
1060#if defined(QT_QPROCESS_DEBUG) 1063#if defined(QT_QPROCESS_DEBUG)
1061 qDebug( "QProcess::socketWrite(): write to stdin (%d)", fd ); 1064 qDebug( "QProcess::socketWrite(): write to stdin (%d)", fd );
1062#endif 1065#endif
1063 ssize_t ret = ::write( fd, 1066 ssize_t ret = ::write( fd,
1064 d->stdinBuf.head()->data() + d->stdinBufRead, 1067 d->stdinBuf.head()->data() + d->stdinBufRead,
1065 d->stdinBuf.head()->size() - d->stdinBufRead ); 1068 d->stdinBuf.head()->size() - d->stdinBufRead );
1066 if ( ret > 0 ) 1069 if ( ret > 0 )
1067 d->stdinBufRead += ret; 1070 d->stdinBufRead += ret;
1068 if ( d->stdinBufRead == (ssize_t)d->stdinBuf.head()->size() ) { 1071 if ( d->stdinBufRead == (ssize_t)d->stdinBuf.head()->size() ) {
1069 d->stdinBufRead = 0; 1072 d->stdinBufRead = 0;
1070 delete d->stdinBuf.dequeue(); 1073 delete d->stdinBuf.dequeue();
1071 if ( wroteToStdinConnected && d->stdinBuf.isEmpty() ) 1074 if ( wroteToStdinConnected && d->stdinBuf.isEmpty() )
1072 emit wroteToStdin(); 1075 emit wroteToStdin();
1073 socketWrite( fd ); 1076 socketWrite( fd );
1074 } 1077 }
1075} 1078}
1076 1079
1077/*! 1080/*!
1078 \internal 1081 \internal
1079 Flushes standard input. This is useful if you want to use QProcess in a 1082 Flushes standard input. This is useful if you want to use QProcess in a
1080 synchronous manner. 1083 synchronous manner.
1081 1084
1082 This function should probably go into the public API. 1085 This function should probably go into the public API.
1083*/ 1086*/
1084void QProcess::flushStdin() 1087void QProcess::flushStdin()
1085{ 1088{
1086 socketWrite( d->proc->socketStdin ); 1089 socketWrite( d->proc->socketStdin );
1087} 1090}
1088 1091
1089/* 1092/*
1090 This private slot is only used under Windows (but moc does not know about #if 1093 This private slot is only used under Windows (but moc does not know about #if
1091 defined()). 1094 defined()).
1092*/ 1095*/
1093void QProcess::timeout() 1096void QProcess::timeout()
1094{ 1097{
1095} 1098}
1096 1099
1097 1100
1098/* 1101/*
1099 This private function is used by connectNotify() and disconnectNotify() to 1102 This private function is used by connectNotify() and disconnectNotify() to
1100 change the value of ioRedirection (and related behaviour) 1103 change the value of ioRedirection (and related behaviour)
1101*/ 1104*/
1102void QProcess::setIoRedirection( bool value ) 1105void QProcess::setIoRedirection( bool value )
1103{ 1106{
1104 ioRedirection = value; 1107 ioRedirection = value;
1105 if ( ioRedirection ) { 1108 if ( ioRedirection ) {
1106 if ( d->notifierStdout ) 1109 if ( d->notifierStdout )
1107 d->notifierStdout->setEnabled( TRUE ); 1110 d->notifierStdout->setEnabled( TRUE );
1108 if ( d->notifierStderr ) 1111 if ( d->notifierStderr )
1109 d->notifierStderr->setEnabled( TRUE ); 1112 d->notifierStderr->setEnabled( TRUE );
1110 } else { 1113 } else {
1111 if ( d->notifierStdout ) 1114 if ( d->notifierStdout )
1112 d->notifierStdout->setEnabled( FALSE ); 1115 d->notifierStdout->setEnabled( FALSE );
1113 if ( d->notifierStderr ) 1116 if ( d->notifierStderr )
1114 d->notifierStderr->setEnabled( FALSE ); 1117 d->notifierStderr->setEnabled( FALSE );
1115 } 1118 }
1116} 1119}
1117 1120
1118/* 1121/*
1119 This private function is used by connectNotify() and 1122 This private function is used by connectNotify() and
1120 disconnectNotify() to change the value of notifyOnExit (and related 1123 disconnectNotify() to change the value of notifyOnExit (and related
1121 behaviour) 1124 behaviour)
1122*/ 1125*/
1123void QProcess::setNotifyOnExit( bool value ) 1126void QProcess::setNotifyOnExit( bool value )
1124{ 1127{
1125 notifyOnExit = value; 1128 notifyOnExit = value;
1126} 1129}
1127 1130
1128/* 1131/*
1129 This private function is used by connectNotify() and disconnectNotify() to 1132 This private function is used by connectNotify() and disconnectNotify() to
1130 change the value of wroteToStdinConnected (and related behaviour) 1133 change the value of wroteToStdinConnected (and related behaviour)
1131*/ 1134*/
1132void QProcess::setWroteStdinConnected( bool value ) 1135void QProcess::setWroteStdinConnected( bool value )
1133{ 1136{
1134 wroteToStdinConnected = value; 1137 wroteToStdinConnected = value;
1135} 1138}
1136 1139
1137/*! \enum QProcess::PID 1140/*! \enum QProcess::PID
1138 \internal 1141 \internal
1139*/ 1142*/
1140/*! 1143/*!
1141 Returns platform dependent information about the process. This can be used 1144 Returns platform dependent information about the process. This can be used
1142 together with platform specific system calls. 1145 together with platform specific system calls.
1143 1146
1144 Under Unix the return value is the PID of the process, or -1 if no process is 1147 Under Unix the return value is the PID of the process, or -1 if no process is
1145 belonging to this object. 1148 belonging to this object.
1146 1149
1147 Under Windows it is a pointer to the \c PROCESS_INFORMATION struct, or 0 if 1150 Under Windows it is a pointer to the \c PROCESS_INFORMATION struct, or 0 if
1148 no process is belonging to this object. 1151 no process is belonging to this object.
1149*/ 1152*/
1150QProcess::PID QProcess::processIdentifier() 1153QProcess::PID QProcess::processIdentifier()
1151{ 1154{
1152 if ( d->proc == 0 ) 1155 if ( d->proc == 0 )
1153 return -1; 1156 return -1;
1154 return d->proc->pid; 1157 return d->proc->pid;
1155} 1158}
1156 1159
1157int QProcess::priority() const 1160int QProcess::priority() const
1158{ 1161{
1159 if ( d->proc ) 1162 if ( d->proc )
1160 return getpriority(PRIO_PROCESS,d->proc->pid); 1163 return getpriority(PRIO_PROCESS,d->proc->pid);
1161 return 0; 1164 return 0;
1162} 1165}
1163 1166
1164void QProcess::setPriority(int p) 1167void QProcess::setPriority(int p)
1165{ 1168{
1166 if ( d->proc ) 1169 if ( d->proc )
1167 setpriority(PRIO_PROCESS,d->proc->pid,p); 1170 setpriority(PRIO_PROCESS,d->proc->pid,p);
1168} 1171}
1169 1172
1170 1173
1171#endif // QT_NO_PROCESS 1174#endif // QT_NO_PROCESS
diff --git a/core/launcher/server.pro b/core/launcher/server.pro
index 93baeb4..0513536 100644
--- a/core/launcher/server.pro
+++ b/core/launcher/server.pro
@@ -1,120 +1,125 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 2
3 CONFIG += qtopia warn_on release 3 CONFIG += qtopia warn_on release
4 4
5 DESTDIR = $$(OPIEDIR)/bin 5 DESTDIR = $$(OPIEDIR)/bin
6 6
7 HEADERS += server.h \ 7 HEADERS += server.h \
8 serverinterface.h \ 8 serverinterface.h \
9 launchertab.h \ 9 launchertab.h \
10 documentlist.h \ 10 documentlist.h \
11 appicons.h \ 11 appicons.h \
12 taskbar.h \ 12 taskbar.h \
13 runningappbar.h \ 13 runningappbar.h \
14 applauncher.h \ 14 applauncher.h \
15 stabmon.h \ 15 stabmon.h \
16 inputmethods.h \ 16 inputmethods.h \
17 systray.h \ 17 systray.h \
18 wait.h \ 18 wait.h \
19 shutdownimpl.h \ 19 shutdownimpl.h \
20 launcher.h \ 20 launcher.h \
21 launcherview.h \ 21 launcherview.h \
22 $$(OPIEDIR)/core/apps/calibrate/calibrate.h \ 22 $$(OPIEDIR)/core/apps/calibrate/calibrate.h \
23 startmenu.h \ 23 startmenu.h \
24 transferserver.h \ 24 transferserver.h \
25 qcopbridge.h \ 25 qcopbridge.h \
26 packageslave.h \ 26 packageslave.h \
27 irserver.h \ 27 irserver.h \
28 firstuse.h \ 28 firstuse.h \
29 $$(OPIEDIR)/rsync/buf.h \ 29 $$(OPIEDIR)/rsync/buf.h \
30 $$(OPIEDIR)/rsync/checksum.h \ 30 $$(OPIEDIR)/rsync/checksum.h \
31 $$(OPIEDIR)/rsync/command.h \ 31 $$(OPIEDIR)/rsync/command.h \
32 $$(OPIEDIR)/rsync/emit.h \ 32 $$(OPIEDIR)/rsync/emit.h \
33 $$(OPIEDIR)/rsync/job.h \ 33 $$(OPIEDIR)/rsync/job.h \
34 $$(OPIEDIR)/rsync/netint.h \ 34 $$(OPIEDIR)/rsync/netint.h \
35 $$(OPIEDIR)/rsync/protocol.h \ 35 $$(OPIEDIR)/rsync/protocol.h \
36 $$(OPIEDIR)/rsync/prototab.h \ 36 $$(OPIEDIR)/rsync/prototab.h \
37 $$(OPIEDIR)/rsync/rsync.h \ 37 $$(OPIEDIR)/rsync/rsync.h \
38 $$(OPIEDIR)/rsync/search.h \ 38 $$(OPIEDIR)/rsync/search.h \
39 $$(OPIEDIR)/rsync/stream.h \ 39 $$(OPIEDIR)/rsync/stream.h \
40 $$(OPIEDIR)/rsync/sumset.h \ 40 $$(OPIEDIR)/rsync/sumset.h \
41 $$(OPIEDIR)/rsync/trace.h \ 41 $$(OPIEDIR)/rsync/trace.h \
42 $$(OPIEDIR)/rsync/types.h \ 42 $$(OPIEDIR)/rsync/types.h \
43 $$(OPIEDIR)/rsync/util.h \ 43 $$(OPIEDIR)/rsync/util.h \
44 $$(OPIEDIR)/rsync/whole.h \ 44 $$(OPIEDIR)/rsync/whole.h \
45 $$(OPIEDIR)/rsync/config_rsync.h \ 45 $$(OPIEDIR)/rsync/config_rsync.h \
46 $$(OPIEDIR)/rsync/qrsync.h \ 46 $$(OPIEDIR)/rsync/qrsync.h \
47 syncdialog.h \ 47 syncdialog.h \
48 serverapp.h \ 48 serverapp.h \
49 launcherglobal.h \ 49 launcherglobal.h \
50 qprocess.h \ 50 qprocess.h \
51 screensaver.h 51 screensaver.h
52 52
53 SOURCES += server.cpp \ 53 SOURCES += server.cpp \
54 serverinterface.cpp \ 54 serverinterface.cpp \
55 launchertab.cpp \ 55 launchertab.cpp \
56 documentlist.cpp \ 56 documentlist.cpp \
57 appicons.cpp \ 57 appicons.cpp \
58 taskbar.cpp \ 58 taskbar.cpp \
59 runningappbar.cpp \ 59 runningappbar.cpp \
60 applauncher.cpp \ 60 applauncher.cpp \
61 stabmon.cpp \ 61 stabmon.cpp \
62 inputmethods.cpp \ 62 inputmethods.cpp \
63 systray.cpp \ 63 systray.cpp \
64 wait.cpp \ 64 wait.cpp \
65 shutdownimpl.cpp \ 65 shutdownimpl.cpp \
66 launcher.cpp \ 66 launcher.cpp \
67 launcherview.cpp \ 67 launcherview.cpp \
68 $$(OPIEDIR)/core/apps/calibrate/calibrate.cpp \ 68 $$(OPIEDIR)/core/apps/calibrate/calibrate.cpp \
69 transferserver.cpp \ 69 transferserver.cpp \
70 packageslave.cpp \ 70 packageslave.cpp \
71 irserver.cpp \ 71 irserver.cpp \
72 qcopbridge.cpp \ 72 qcopbridge.cpp \
73 startmenu.cpp \ 73 startmenu.cpp \
74 main.cpp \ 74 main.cpp \
75 firstuse.cpp \ 75 firstuse.cpp \
76 $$(OPIEDIR)/rsync/base64.c \ 76 $$(OPIEDIR)/rsync/base64.c \
77 $$(OPIEDIR)/rsync/buf.c \ 77 $$(OPIEDIR)/rsync/buf.c \
78 $$(OPIEDIR)/rsync/checksum.c \ 78 $$(OPIEDIR)/rsync/checksum.c \
79 $$(OPIEDIR)/rsync/command.c \ 79 $$(OPIEDIR)/rsync/command.c \
80 $$(OPIEDIR)/rsync/delta.c \ 80 $$(OPIEDIR)/rsync/delta.c \
81 $$(OPIEDIR)/rsync/emit.c \ 81 $$(OPIEDIR)/rsync/emit.c \
82 $$(OPIEDIR)/rsync/hex.c \ 82 $$(OPIEDIR)/rsync/hex.c \
83 $$(OPIEDIR)/rsync/job.c \ 83 $$(OPIEDIR)/rsync/job.c \
84 $$(OPIEDIR)/rsync/mdfour.c \ 84 $$(OPIEDIR)/rsync/mdfour.c \
85 $$(OPIEDIR)/rsync/mksum.c \ 85 $$(OPIEDIR)/rsync/mksum.c \
86 $$(OPIEDIR)/rsync/msg.c \ 86 $$(OPIEDIR)/rsync/msg.c \
87 $$(OPIEDIR)/rsync/netint.c \ 87 $$(OPIEDIR)/rsync/netint.c \
88 $$(OPIEDIR)/rsync/patch.c \ 88 $$(OPIEDIR)/rsync/patch.c \
89 $$(OPIEDIR)/rsync/prototab.c \ 89 $$(OPIEDIR)/rsync/prototab.c \
90 $$(OPIEDIR)/rsync/readsums.c \ 90 $$(OPIEDIR)/rsync/readsums.c \
91 $$(OPIEDIR)/rsync/scoop.c \ 91 $$(OPIEDIR)/rsync/scoop.c \
92 $$(OPIEDIR)/rsync/search.c \ 92 $$(OPIEDIR)/rsync/search.c \
93 $$(OPIEDIR)/rsync/stats.c \ 93 $$(OPIEDIR)/rsync/stats.c \
94 $$(OPIEDIR)/rsync/stream.c \ 94 $$(OPIEDIR)/rsync/stream.c \
95 $$(OPIEDIR)/rsync/sumset.c \ 95 $$(OPIEDIR)/rsync/sumset.c \
96 $$(OPIEDIR)/rsync/trace.c \ 96 $$(OPIEDIR)/rsync/trace.c \
97 $$(OPIEDIR)/rsync/tube.c \ 97 $$(OPIEDIR)/rsync/tube.c \
98 $$(OPIEDIR)/rsync/util.c \ 98 $$(OPIEDIR)/rsync/util.c \
99 $$(OPIEDIR)/rsync/version.c \ 99 $$(OPIEDIR)/rsync/version.c \
100 $$(OPIEDIR)/rsync/whole.c \ 100 $$(OPIEDIR)/rsync/whole.c \
101 $$(OPIEDIR)/rsync/qrsync.cpp \ 101 $$(OPIEDIR)/rsync/qrsync.cpp \
102 syncdialog.cpp \ 102 syncdialog.cpp \
103 serverapp.cpp \ 103 serverapp.cpp \
104 launcherglobal.cpp \ 104 launcherglobal.cpp \
105 qprocess.cpp \ 105 qprocess.cpp \
106 qprocess_unix.cpp \ 106 qprocess_unix.cpp \
107 screensaver.cpp 107 screensaver.cpp
108 108
109 109
110INCLUDEPATH += $(OPIEDIR)/core/apps/calibrate 110INCLUDEPATH += $(OPIEDIR)/core/apps/calibrate
111 DEPENDPATH+= $(OPIEDIR)/core/apps/calibrate 111 DEPENDPATH+= $(OPIEDIR)/core/apps/calibrate
112 112
113INCLUDEPATH += $(OPIEDIR)/include $(OPIEDIR)/rsync 113INCLUDEPATH += $(OPIEDIR)/include $(OPIEDIR)/rsync
114 DEPENDPATH+= $(OPIEDIR)/rsync 114 DEPENDPATH+= $(OPIEDIR)/rsync
115 115
116 TARGET = qpe 116 TARGET = qpe
117 117
118 LIBS+= -lcrypt -lqpe -lopie 118CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX )
119contains( CONFTEST, y ){
120 LIBS += -lqpe -lopie
121}else{
122 LIBS+= -lcrypt -lqpe -lopie
123}
119 124
120include ( $(OPIEDIR)/include.pro ) 125include ( $(OPIEDIR)/include.pro )
diff --git a/core/launcher/startmenu.cpp b/core/launcher/startmenu.cpp
index 014418d..08ae885 100644
--- a/core/launcher/startmenu.cpp
+++ b/core/launcher/startmenu.cpp
@@ -1,333 +1,337 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#define INCLUDE_MENUITEM_DEF 21#define INCLUDE_MENUITEM_DEF
22 22
23#include "startmenu.h" 23#include "startmenu.h"
24 24
25#include <qtopia/qpeapplication.h> 25#include <qtopia/qpeapplication.h>
26#include <qtopia/config.h> 26#include <qtopia/config.h>
27#include <qtopia/applnk.h> 27#include <qtopia/applnk.h>
28#include <qtopia/global.h> 28#include <qtopia/global.h>
29#include <qtopia/resource.h> 29#include <qtopia/resource.h>
30#include <qtopia/mimetype.h> 30#include <qtopia/mimetype.h>
31#include <qtopia/qlibrary.h> 31#include <qtopia/qlibrary.h>
32 32
33#include <qdict.h> 33#include <qdict.h>
34#include <qdir.h> 34#include <qdir.h>
35#include <qpainter.h> 35#include <qpainter.h>
36 36
37#include <stdlib.h> 37#include <stdlib.h>
38 38
39 39
40void StartPopupMenu::keyPressEvent( QKeyEvent *e ) 40void StartPopupMenu::keyPressEvent( QKeyEvent *e )
41{ 41{
42 if ( e->key() == Key_F33 || e->key() == Key_Space ) { 42 if ( e->key() == Key_F33 || e->key() == Key_Space ) {
43 // "OK" button, little hacky 43 // "OK" button, little hacky
44 QKeyEvent ke(QEvent::KeyPress, Key_Enter, 13, 0); 44 QKeyEvent ke(QEvent::KeyPress, Key_Enter, 13, 0);
45 QPopupMenu::keyPressEvent( &ke ); 45 QPopupMenu::keyPressEvent( &ke );
46 } else { 46 } else {
47 QPopupMenu::keyPressEvent( e ); 47 QPopupMenu::keyPressEvent( e );
48 } 48 }
49} 49}
50 50
51//--------------------------------------------------------------------------- 51//---------------------------------------------------------------------------
52 52
53StartMenu::StartMenu(QWidget *parent) : QLabel( parent ) 53StartMenu::StartMenu(QWidget *parent) : QLabel( parent )
54{ 54{
55 startButtonPixmap = "go"; // No tr 55 startButtonPixmap = "go"; // No tr
56 56
57 int sz = AppLnk::smallIconSize()+3; 57 int sz = AppLnk::smallIconSize()+3;
58 QPixmap pm; 58 QPixmap pm;
59 pm.convertFromImage(Resource::loadImage(startButtonPixmap).smoothScale(sz,sz)); 59 pm.convertFromImage(Resource::loadImage(startButtonPixmap).smoothScale(sz,sz));
60 setPixmap(pm); 60 setPixmap(pm);
61 setFocusPolicy( NoFocus ); 61 setFocusPolicy( NoFocus );
62 62
63 launchMenu = 0; 63 launchMenu = 0;
64 refreshMenu(); 64 refreshMenu();
65} 65}
66 66
67 67
68void StartMenu::mousePressEvent( QMouseEvent * ) 68void StartMenu::mousePressEvent( QMouseEvent * )
69{ 69{
70 launch(); 70 launch();
71} 71}
72 72
73 73
74StartMenu::~StartMenu() 74StartMenu::~StartMenu()
75{ 75{
76 clearApplets(); 76 clearApplets();
77} 77}
78 78
79void StartMenu::createMenu() 79void StartMenu::createMenu()
80{ 80{
81 clearApplets(); 81 clearApplets();
82 delete launchMenu; 82 delete launchMenu;
83 83
84 launchMenu = new StartPopupMenu( this ); 84 launchMenu = new StartPopupMenu( this );
85 loadMenu( launchMenu ); 85 loadMenu( launchMenu );
86 loadApplets(); 86 loadApplets();
87 87
88 bool result = nother || ntabs || m_applets.count(); 88 bool result = nother || ntabs || m_applets.count();
89 if ( result ) 89 if ( result )
90 connect( launchMenu, SIGNAL(activated(int)), SLOT(itemSelected(int)) ); 90 connect( launchMenu, SIGNAL(activated(int)), SLOT(itemSelected(int)) );
91 91
92} 92}
93 93
94void StartMenu::refreshMenu() 94void StartMenu::refreshMenu()
95{ 95{
96 Config cfg("Taskbar"); 96 Config cfg("Taskbar");
97 cfg.setGroup("Menu"); 97 cfg.setGroup("Menu");
98 bool ltabs = cfg.readBoolEntry("LauncherTabs",TRUE); 98 bool ltabs = cfg.readBoolEntry("LauncherTabs",TRUE);
99 bool lot = cfg.readBoolEntry("LauncherOther",TRUE); 99 bool lot = cfg.readBoolEntry("LauncherOther",TRUE);
100 bool lt = ltabs || lot; 100 bool lt = ltabs || lot;
101 if ( launchMenu && !lt ) 101 if ( launchMenu && !lt )
102 return; // nothing to do 102 return; // nothing to do
103 103
104 if ( launchMenu ) { 104 if ( launchMenu ) {
105 int i; 105 int i;
106 /* find the first entry we want to remove */ 106 /* find the first entry we want to remove */
107 for (i=0; i<(int)launchMenu->count(); i++) { 107 for (i=0; i<(int)launchMenu->count(); i++) {
108 QMenuItem* item = launchMenu->findItem(launchMenu->idAt(i)); 108 QMenuItem* item = launchMenu->findItem(launchMenu->idAt(i));
109 if ( item && item->id() >= 0 && item->id() < ntabs ) { 109 if ( item && item->id() >= 0 && item->id() < ntabs ) {
110 break; 110 break;
111 } 111 }
112 if ( item && item->isSeparator() ) { 112 if ( item && item->isSeparator() ) {
113 i++; 113 i++;
114 break; 114 break;
115 } 115 }
116 } 116 }
117 /* remove them */ 117 /* remove them */
118 while (i<(int)launchMenu->count()) 118 while (i<(int)launchMenu->count())
119 launchMenu->removeItemAt(i); 119 launchMenu->removeItemAt(i);
120 loadMenu(launchMenu); 120 loadMenu(launchMenu);
121 addApplets(launchMenu); 121 addApplets(launchMenu);
122 } else { 122 } else {
123 createMenu(); 123 createMenu();
124 } 124 }
125} 125}
126 126
127void StartMenu::itemSelected( int id ) 127void StartMenu::itemSelected( int id )
128{ 128{
129 if ( id >= 0 && id < ntabs ) { 129 if ( id >= 0 && id < ntabs ) {
130 emit tabSelected(tabs[id]); 130 emit tabSelected(tabs[id]);
131 } else if ( id >= 20 && id < 20+nother ) { 131 } else if ( id >= 20 && id < 20+nother ) {
132 other.at(id-20)->execute(); 132 other.at(id-20)->execute();
133 }else { 133 }else {
134 MenuApplet *applet = m_applets.find ( id ); 134 MenuApplet *applet = m_applets.find ( id );
135 if ( applet ) { 135 if ( applet ) {
136 qWarning("activated"); 136 qWarning("activated");
137 applet-> iface-> activated(); 137 applet-> iface-> activated();
138 } 138 }
139 } 139 }
140} 140}
141 141
142bool StartMenu::loadMenu( QPopupMenu *menu ) 142bool StartMenu::loadMenu( QPopupMenu *menu )
143{ 143{
144 Config cfg("Taskbar"); 144 Config cfg("Taskbar");
145 cfg.setGroup("Menu"); 145 cfg.setGroup("Menu");
146 146
147 bool ltabs = cfg.readBoolEntry("LauncherTabs",TRUE); 147 bool ltabs = cfg.readBoolEntry("LauncherTabs",TRUE);
148 bool lot = cfg.readBoolEntry("LauncherOther",TRUE); 148 bool lot = cfg.readBoolEntry("LauncherOther",TRUE);
149 bool sepfirst = !ltabs && !lot; 149 bool sepfirst = !ltabs && !lot;
150 150
151 tabs.clear(); 151 tabs.clear();
152 other.setAutoDelete(TRUE); 152 other.setAutoDelete(TRUE);
153 other.clear(); 153 other.clear();
154 ntabs = 0; 154 ntabs = 0;
155 nother = 0; 155 nother = 0;
156 156
157 bool f=TRUE; 157 bool f=TRUE;
158 if ( ltabs || lot ) { 158 if ( ltabs || lot ) {
159 QDir dir( MimeType::appsFolderName(), QString::null, QDir::Name ); 159 QDir dir( MimeType::appsFolderName(), QString::null, QDir::Name );
160 for (int i=0; i<(int)dir.count(); i++) { 160 for (int i=0; i<(int)dir.count(); i++) {
161 QString d = dir[i]; 161 QString d = dir[i];
162 Config cfg(dir.path()+"/"+d+"/.directory",Config::File); 162 Config cfg(dir.path()+"/"+d+"/.directory",Config::File);
163 if ( cfg.isValid() ) { 163 if ( cfg.isValid() ) {
164 QString nm = cfg.readEntry("Name"); 164 QString nm = cfg.readEntry("Name");
165 QString ic = cfg.readEntry("Icon"); 165 QString ic = cfg.readEntry("Icon");
166 if ( !!nm && !!ic ) { 166 if ( !!nm && !!ic ) {
167 tabs.append(d); 167 tabs.append(d);
168 menu->insertItem( Resource::loadIconSet(ic), nm, ntabs++ ); 168 menu->insertItem( Resource::loadIconSet(ic), nm, ntabs++ );
169 } 169 }
170 } else if ( lot && d.right(8)==".desktop") { 170 } else if ( lot && d.right(8)==".desktop") {
171 AppLnk* applnk = new AppLnk(dir.path()+"/"+d); 171 AppLnk* applnk = new AppLnk(dir.path()+"/"+d);
172 if ( applnk->isValid() ) { 172 if ( applnk->isValid() ) {
173 if ( applnk->type() == "Separator" ) { // No tr 173 if ( applnk->type() == "Separator" ) { // No tr
174 if ( lot ) { 174 if ( lot ) {
175 menu->insertSeparator(); 175 menu->insertSeparator();
176 sepfirst = f && !ltabs; 176 sepfirst = f && !ltabs;
177 } 177 }
178 delete applnk; 178 delete applnk;
179 } else { 179 } else {
180 f = FALSE; 180 f = FALSE;
181 other.append(applnk); 181 other.append(applnk);
182 menu->insertItem( Resource::loadIconSet(applnk->icon()), 182 menu->insertItem( Resource::loadIconSet(applnk->icon()),
183 applnk->name(), 20+nother++ ); 183 applnk->name(), 20+nother++ );
184 } 184 }
185 } else { 185 } else {
186 delete applnk; 186 delete applnk;
187 } 187 }
188 } 188 }
189 } 189 }
190 190
191 if ( !menu->count() ) 191 if ( !menu->count() )
192 sepfirst = TRUE; 192 sepfirst = TRUE;
193 } 193 }
194 194
195 launchMenu->setName(sepfirst ? "accessories" : "accessories_need_sep"); // No tr 195 launchMenu->setName(sepfirst ? "accessories" : "accessories_need_sep"); // No tr
196 196
197 return (nother || ntabs ); 197 return (nother || ntabs );
198} 198}
199 199
200 200
201void StartMenu::launch() 201void StartMenu::launch()
202{ 202{
203 int y = mapToGlobal( QPoint() ).y() - launchMenu->sizeHint().height(); 203 int y = mapToGlobal( QPoint() ).y() - launchMenu->sizeHint().height();
204 204
205 if ( launchMenu->isVisible() ) 205 if ( launchMenu->isVisible() )
206 launchMenu->hide(); 206 launchMenu->hide();
207 else 207 else
208 launchMenu->popup( QPoint( 1, y ) ); 208 launchMenu->popup( QPoint( 1, y ) );
209} 209}
210 210
211 211
212 212
213 213
214static int compareAppletPositions(const void *a, const void *b) 214static int compareAppletPositions(const void *a, const void *b)
215{ 215{
216 const MenuApplet* aa = *(const MenuApplet**)a; 216 const MenuApplet* aa = *(const MenuApplet**)a;
217 const MenuApplet* ab = *(const MenuApplet**)b; 217 const MenuApplet* ab = *(const MenuApplet**)b;
218 int d = aa->iface->position() - ab->iface->position(); 218 int d = aa->iface->position() - ab->iface->position();
219 if ( d ) return d; 219 if ( d ) return d;
220 return QString::compare(aa->library->library(),ab->library->library()); 220 return QString::compare(aa->library->library(),ab->library->library());
221} 221}
222 222
223void StartMenu::clearApplets() 223void StartMenu::clearApplets()
224{ 224{
225 if (launchMenu ) 225 if (launchMenu )
226 launchMenu-> hide(); 226 launchMenu-> hide();
227 227
228 for ( QIntDictIterator<MenuApplet> it ( m_applets ); it. current ( ); ++it ) { 228 for ( QIntDictIterator<MenuApplet> it ( m_applets ); it. current ( ); ++it ) {
229 MenuApplet *applet = it. current ( ); 229 MenuApplet *applet = it. current ( );
230 if ( launchMenu ) { 230 if ( launchMenu ) {
231 launchMenu-> removeItem ( applet-> id ); 231 launchMenu-> removeItem ( applet-> id );
232 delete applet-> popup; 232 delete applet-> popup;
233 } 233 }
234 234
235 applet-> iface-> release(); 235 applet-> iface-> release();
236 applet-> library-> unload(); 236 applet-> library-> unload();
237 delete applet-> library; 237 delete applet-> library;
238 } 238 }
239 m_applets.clear(); 239 m_applets.clear();
240} 240}
241 241
242 242
243 243
244 244
245void StartMenu::loadApplets() 245void StartMenu::loadApplets()
246{ 246{
247 Config cfg( "StartMenu" ); 247 Config cfg( "StartMenu" );
248 cfg.setGroup( "Applets" ); 248 cfg.setGroup( "Applets" );
249 249
250 // SafeMode causes too much problems, so we disable it for now -- 250 // SafeMode causes too much problems, so we disable it for now --
251 // maybe we should reenable it for OPIE 1.0 - sandman 26.09.02 251 // maybe we should reenable it for OPIE 1.0 - sandman 26.09.02
252 // removed in the remerge PluginManager could handle it 252 // removed in the remerge PluginManager could handle it
253 // we don't currently use it -zecke 253 // we don't currently use it -zecke
254 254
255 QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' ); 255 QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' );
256 256
257 QString lang = getenv( "LANG" ); 257 QString lang = getenv( "LANG" );
258 QString path = QPEApplication::qpeDir() + "/plugins/applets"; 258 QString path = QPEApplication::qpeDir() + "/plugins/applets";
259#ifdef Q_OS_MACX
260 QDir dir( path, "lib*.dylib" );
261#else
259 QDir dir( path, "lib*.so" ); 262 QDir dir( path, "lib*.so" );
263#endif /* Q_OS_MACX */
260 QStringList list = dir.entryList(); 264 QStringList list = dir.entryList();
261 QStringList::Iterator it; 265 QStringList::Iterator it;
262 int napplets=0; 266 int napplets=0;
263 MenuApplet* *xapplets = new MenuApplet*[list.count()]; 267 MenuApplet* *xapplets = new MenuApplet*[list.count()];
264 for ( it = list.begin(); it != list.end(); ++it ) { 268 for ( it = list.begin(); it != list.end(); ++it ) {
265 if ( exclude.find( *it ) != exclude.end() ) 269 if ( exclude.find( *it ) != exclude.end() )
266 continue; 270 continue;
267 MenuAppletInterface *iface = 0; 271 MenuAppletInterface *iface = 0;
268 QLibrary *lib = new QLibrary( path + "/" + *it ); 272 QLibrary *lib = new QLibrary( path + "/" + *it );
269 if (( lib->queryInterface( IID_MenuApplet, (QUnknownInterface**)&iface ) == QS_OK ) && iface ) { 273 if (( lib->queryInterface( IID_MenuApplet, (QUnknownInterface**)&iface ) == QS_OK ) && iface ) {
270 MenuApplet *applet = new MenuApplet; 274 MenuApplet *applet = new MenuApplet;
271 xapplets[napplets++] = applet; 275 xapplets[napplets++] = applet;
272 applet->library = lib; 276 applet->library = lib;
273 applet->iface = iface; 277 applet->iface = iface;
274 278
275 QTranslator *trans = new QTranslator(qApp); 279 QTranslator *trans = new QTranslator(qApp);
276 QString type = (*it).left( (*it).find(".") ); 280 QString type = (*it).left( (*it).find(".") );
277 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; 281 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm";
278 if ( trans->load( tfn )) 282 if ( trans->load( tfn ))
279 qApp->installTranslator( trans ); 283 qApp->installTranslator( trans );
280 else 284 else
281 delete trans; 285 delete trans;
282 } else { 286 } else {
283 exclude += *it; 287 exclude += *it;
284 delete lib; 288 delete lib;
285 } 289 }
286 } 290 }
287 cfg.writeEntry( "ExcludeApplets", exclude, ',' ); 291 cfg.writeEntry( "ExcludeApplets", exclude, ',' );
288 qsort(xapplets,napplets,sizeof(m_applets[0]),compareAppletPositions); 292 qsort(xapplets,napplets,sizeof(m_applets[0]),compareAppletPositions);
289 293
290 294
291 int foo = ( launchMenu-> count ( )) ? launchMenu-> insertSeparator ( ) : 0; 295 int foo = ( launchMenu-> count ( )) ? launchMenu-> insertSeparator ( ) : 0;
292 296
293 while (napplets--) { 297 while (napplets--) {
294 MenuApplet *applet = xapplets[napplets]; 298 MenuApplet *applet = xapplets[napplets];
295 299
296 applet-> popup = applet-> iface-> popup ( this ); 300 applet-> popup = applet-> iface-> popup ( this );
297 301
298 if ( applet-> popup ) 302 if ( applet-> popup )
299 applet-> id = launchMenu-> insertItem ( applet-> iface-> icon ( ), applet-> iface-> text ( ), applet-> popup ); 303 applet-> id = launchMenu-> insertItem ( applet-> iface-> icon ( ), applet-> iface-> text ( ), applet-> popup );
300 else 304 else
301 applet-> id = launchMenu-> insertItem ( applet-> iface-> icon ( ), applet-> iface-> text ( ) ); 305 applet-> id = launchMenu-> insertItem ( applet-> iface-> icon ( ), applet-> iface-> text ( ) );
302 306
303 307
304 m_applets.insert ( applet-> id, new MenuApplet(*applet)); 308 m_applets.insert ( applet-> id, new MenuApplet(*applet));
305 } 309 }
306 delete [] xapplets; 310 delete [] xapplets;
307 311
308} 312}
309 313
310 314
311/* 315/*
312 * Launcher calls loadMenu too often fix that 316 * Launcher calls loadMenu too often fix that
313 */ 317 */
314void StartMenu::addApplets(QPopupMenu* pop) { 318void StartMenu::addApplets(QPopupMenu* pop) {
315 QIntDict<MenuApplet> dict; 319 QIntDict<MenuApplet> dict;
316 if( pop-> count ( )) 320 if( pop-> count ( ))
317 pop-> insertSeparator ( ); 321 pop-> insertSeparator ( );
318 322
319 for ( QIntDictIterator<MenuApplet> it ( m_applets ); it. current ( ); ++it ) { 323 for ( QIntDictIterator<MenuApplet> it ( m_applets ); it. current ( ); ++it ) {
320 MenuApplet *applet = it. current ( ); 324 MenuApplet *applet = it. current ( );
321 if ( applet-> popup ) 325 if ( applet-> popup )
322 applet-> id = pop-> insertItem ( applet-> iface-> icon ( ), applet-> iface-> text ( ), applet-> popup ); 326 applet-> id = pop-> insertItem ( applet-> iface-> icon ( ), applet-> iface-> text ( ), applet-> popup );
323 else 327 else
324 applet-> id = pop-> insertItem ( applet-> iface-> icon ( ), applet-> iface-> text ( ) ); 328 applet-> id = pop-> insertItem ( applet-> iface-> icon ( ), applet-> iface-> text ( ) );
325 329
326 dict.insert( applet->id, new MenuApplet(*applet) ); 330 dict.insert( applet->id, new MenuApplet(*applet) );
327 } 331 }
328 /* need to update the key */ 332 /* need to update the key */
329 m_applets.setAutoDelete( true ); 333 m_applets.setAutoDelete( true );
330 m_applets.clear(); 334 m_applets.clear();
331 m_applets.setAutoDelete( false ); 335 m_applets.setAutoDelete( false );
332 m_applets = dict; 336 m_applets = dict;
333} 337}
diff --git a/core/launcher/systray.cpp b/core/launcher/systray.cpp
index 6122770..691f6b8 100644
--- a/core/launcher/systray.cpp
+++ b/core/launcher/systray.cpp
@@ -1,149 +1,154 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include <qtopia/qpeapplication.h> 21#include <qtopia/qpeapplication.h>
22#include <qtopia/qlibrary.h> 22#include <qtopia/qlibrary.h>
23#include <qtopia/config.h> 23#include <qtopia/config.h>
24 24
25#include <qlayout.h> 25#include <qlayout.h>
26#include <qdir.h> 26#include <qdir.h>
27#include <qmessagebox.h> 27#include <qmessagebox.h>
28#include <qtranslator.h> 28#include <qtranslator.h>
29 29
30#include "systray.h" 30#include "systray.h"
31 31
32#include <stdlib.h> 32#include <stdlib.h>
33 33
34/* ### Single build floppies ### */ 34/* ### Single build floppies ### */
35#if 0 35#if 0
36#ifdef QT_NO_COMPONENTS 36#ifdef QT_NO_COMPONENTS
37#include "../plugins/applets/clockapplet/clockappletimpl.h" 37#include "../plugins/applets/clockapplet/clockappletimpl.h"
38#endif 38#endif
39#endif 39#endif
40 40
41SysTray::SysTray( QWidget *parent ) : QFrame( parent ), layout(0) 41SysTray::SysTray( QWidget *parent ) : QFrame( parent ), layout(0)
42{ 42{
43 //setFrameStyle( QFrame::Panel | QFrame::Sunken ); 43 //setFrameStyle( QFrame::Panel | QFrame::Sunken );
44 loadApplets(); 44 loadApplets();
45} 45}
46 46
47SysTray::~SysTray() 47SysTray::~SysTray()
48{ 48{
49 clearApplets(); 49 clearApplets();
50} 50}
51 51
52static int compareAppletPositions(const void *a, const void *b) 52static int compareAppletPositions(const void *a, const void *b)
53{ 53{
54 const TaskbarApplet* aa = *(const TaskbarApplet**)a; 54 const TaskbarApplet* aa = *(const TaskbarApplet**)a;
55 const TaskbarApplet* ab = *(const TaskbarApplet**)b; 55 const TaskbarApplet* ab = *(const TaskbarApplet**)b;
56 int d = ab->iface->position() - aa->iface->position(); 56 int d = ab->iface->position() - aa->iface->position();
57 if ( d ) return d; 57 if ( d ) return d;
58 return QString::compare(ab->name,aa->name); 58 return QString::compare(ab->name,aa->name);
59} 59}
60 60
61void SysTray::loadApplets() 61void SysTray::loadApplets()
62{ 62{
63 hide(); 63 hide();
64 clearApplets(); 64 clearApplets();
65 addApplets(); 65 addApplets();
66} 66}
67 67
68void SysTray::clearApplets() 68void SysTray::clearApplets()
69{ 69{
70#ifndef QT_NO_COMPONENTS 70#ifndef QT_NO_COMPONENTS
71 71
72 /* 72 /*
73 * Note on clearing. SOme applets delete their 73 * Note on clearing. SOme applets delete their
74 * applets themselves some don't do it 74 * applets themselves some don't do it
75 * and on restart this can crash. If we delete it 75 * and on restart this can crash. If we delete it
76 * here we might end up in a double deletion. We could 76 * here we might end up in a double deletion. We could
77 * use QGuardedPtr but that would be one QOBject 77 * use QGuardedPtr but that would be one QOBject
78 * for every applet more but only useful for restart 78 * for every applet more but only useful for restart
79 */ 79 */
80 QValueList<TaskbarApplet>::Iterator mit; 80 QValueList<TaskbarApplet>::Iterator mit;
81 for ( mit = appletList.begin(); mit != appletList.end(); ++mit ) { 81 for ( mit = appletList.begin(); mit != appletList.end(); ++mit ) {
82 (*mit).iface->release(); 82 (*mit).iface->release();
83 (*mit).library->unload(); 83 (*mit).library->unload();
84 delete (*mit).library; 84 delete (*mit).library;
85 } 85 }
86 86
87#endif 87#endif
88 appletList.clear(); 88 appletList.clear();
89 if ( layout ) 89 if ( layout )
90 delete layout; 90 delete layout;
91 layout = new QHBoxLayout( this, 0, 1 ); 91 layout = new QHBoxLayout( this, 0, 1 );
92 layout->setAutoAdd(TRUE); 92 layout->setAutoAdd(TRUE);
93} 93}
94 94
95void SysTray::addApplets() 95void SysTray::addApplets()
96{ 96{
97 hide(); 97 hide();
98#ifndef QT_NO_COMPONENTS 98#ifndef QT_NO_COMPONENTS
99 Config cfg( "Taskbar" ); 99 Config cfg( "Taskbar" );
100 cfg.setGroup( "Applets" ); 100 cfg.setGroup( "Applets" );
101 QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' ); 101 QStringList exclude = cfg.readListEntry( "ExcludeApplets", ',' );
102 102
103 QString lang = getenv( "LANG" ); 103 QString lang = getenv( "LANG" );
104 QString path = QPEApplication::qpeDir() + "/plugins/applets"; 104 QString path = QPEApplication::qpeDir() + "/plugins/applets";
105#ifdef Q_OS_MACX
106 QDir dir( path, "lib*.dylib" );
107#else
105 QDir dir( path, "lib*.so" ); 108 QDir dir( path, "lib*.so" );
109#endif /* Q_OS_MACX */
106 QStringList list = dir.entryList(); 110 QStringList list = dir.entryList();
107 QStringList::Iterator it; 111 QStringList::Iterator it;
108 int napplets=0; 112 int napplets=0;
109 TaskbarApplet* *applets = new TaskbarApplet*[list.count()]; 113 TaskbarApplet* *applets = new TaskbarApplet*[list.count()];
110 for ( it = list.begin(); it != list.end(); ++it ) { 114 for ( it = list.begin(); it != list.end(); ++it ) {
111 if ( exclude.find( *it ) != exclude.end() ) 115 if ( exclude.find( *it ) != exclude.end() )
112 continue; 116 continue;
117 qWarning( "Found Applet: %s", (*it).latin1() );
113 TaskbarAppletInterface *iface = 0; 118 TaskbarAppletInterface *iface = 0;
114 QLibrary *lib = new QLibrary( path + "/" + *it ); 119 QLibrary *lib = new QLibrary( path + "/" + *it );
115 if (( lib->queryInterface( IID_TaskbarApplet, (QUnknownInterface**)&iface ) == QS_OK ) && iface ) { 120 if (( lib->queryInterface( IID_TaskbarApplet, (QUnknownInterface**)&iface ) == QS_OK ) && iface ) {
116 TaskbarApplet *applet = new TaskbarApplet; 121 TaskbarApplet *applet = new TaskbarApplet;
117 applets[napplets++] = applet; 122 applets[napplets++] = applet;
118 applet->library = lib; 123 applet->library = lib;
119 applet->iface = iface; 124 applet->iface = iface;
120 125
121 QTranslator *trans = new QTranslator(qApp); 126 QTranslator *trans = new QTranslator(qApp);
122 QString type = (*it).left( (*it).find(".") ); 127 QString type = (*it).left( (*it).find(".") );
123 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; 128 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm";
124 if ( trans->load( tfn )) 129 if ( trans->load( tfn ))
125 qApp->installTranslator( trans ); 130 qApp->installTranslator( trans );
126 else 131 else
127 delete trans; 132 delete trans;
128 } else { 133 } else {
129 exclude += *it; 134 exclude += *it;
130 delete lib; 135 delete lib;
131 } 136 }
132 } 137 }
133 cfg.writeEntry( "ExcludeApplets", exclude, ',' ); 138 cfg.writeEntry( "ExcludeApplets", exclude, ',' );
134 qsort(applets,napplets,sizeof(applets[0]),compareAppletPositions); 139 qsort(applets,napplets,sizeof(applets[0]),compareAppletPositions);
135 while (napplets--) { 140 while (napplets--) {
136 TaskbarApplet *applet = applets[napplets]; 141 TaskbarApplet *applet = applets[napplets];
137 applet->applet = applet->iface->applet( this ); 142 applet->applet = applet->iface->applet( this );
138 appletList.append(*applet); 143 appletList.append(*applet);
139 } 144 }
140 delete [] applets; 145 delete [] applets;
141#else /* ## FIXME single app */ 146#else /* ## FIXME single app */
142 TaskbarApplet * const applet = new TaskbarApplet(); 147 TaskbarApplet * const applet = new TaskbarApplet();
143 applet->iface = new ClockAppletImpl(); 148 applet->iface = new ClockAppletImpl();
144 applet->applet = applet->iface->applet( this ); 149 applet->applet = applet->iface->applet( this );
145 appletList.append( applet ); 150 appletList.append( applet );
146#endif 151#endif
147 show(); 152 show();
148} 153}
149 154
diff --git a/core/launcher/transferserver.cpp b/core/launcher/transferserver.cpp
index c69df2d..439e110 100644
--- a/core/launcher/transferserver.cpp
+++ b/core/launcher/transferserver.cpp
@@ -1,1419 +1,1422 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20//#define _XOPEN_SOURCE 20//#define _XOPEN_SOURCE
21 21
22#include <qtopia/global.h> 22#include <qtopia/global.h>
23#include <qtopia/qpeapplication.h> 23#include <qtopia/qpeapplication.h>
24 24
25#ifndef Q_OS_WIN32 25#ifndef Q_OS_WIN32
26#include <pwd.h> 26#include <pwd.h>
27#include <sys/types.h> 27#include <sys/types.h>
28#include <unistd.h> 28#include <unistd.h>
29#include <stdlib.h> 29#include <stdlib.h>
30#include <time.h> 30#include <time.h>
31
32#ifndef Q_OS_MACX
31#include <shadow.h> 33#include <shadow.h>
32#include <crypt.h> 34#include <crypt.h>
35#endif /* Q_OS_MACX */
33 36
34#else 37#else
35#include <stdlib.h> 38#include <stdlib.h>
36#include <time.h> 39#include <time.h>
37#endif 40#endif
38 41
39 42
40#if defined(_OS_LINUX_) 43#if defined(_OS_LINUX_)
41#include <shadow.h> 44#include <shadow.h>
42#endif 45#endif
43 46
44#include <qdir.h> 47#include <qdir.h>
45#include <qfile.h> 48#include <qfile.h>
46#include <qtextstream.h> 49#include <qtextstream.h>
47#include <qdatastream.h> 50#include <qdatastream.h>
48#include <qmessagebox.h> 51#include <qmessagebox.h>
49#include <qstringlist.h> 52#include <qstringlist.h>
50#include <qfileinfo.h> 53#include <qfileinfo.h>
51#include <qregexp.h> 54#include <qregexp.h>
52//#include <qtopia/qcopchannel_qws.h> 55//#include <qtopia/qcopchannel_qws.h>
53#include <qtopia/process.h> 56#include <qtopia/process.h>
54#include <qtopia/global.h> 57#include <qtopia/global.h>
55#include <qtopia/config.h> 58#include <qtopia/config.h>
56#include <qtopia/private/contact.h> 59#include <qtopia/private/contact.h>
57#include <qtopia/quuid.h> 60#include <qtopia/quuid.h>
58#include <qtopia/version.h> 61#include <qtopia/version.h>
59#ifdef Q_WS_QWS 62#ifdef Q_WS_QWS
60#include <qtopia/qcopenvelope_qws.h> 63#include <qtopia/qcopenvelope_qws.h>
61#endif 64#endif
62 65
63#include "launcherglobal.h" 66#include "launcherglobal.h"
64 67
65#include "transferserver.h" 68#include "transferserver.h"
66#include <qtopia/qprocess.h> 69#include <qtopia/qprocess.h>
67 70
68const int block_size = 51200; 71const int block_size = 51200;
69 72
70TransferServer::TransferServer( Q_UINT16 port, QObject *parent, 73TransferServer::TransferServer( Q_UINT16 port, QObject *parent,
71 const char* name) 74 const char* name)
72 : QServerSocket( port, 1, parent, name ) 75 : QServerSocket( port, 1, parent, name )
73{ 76{
74 connections.setAutoDelete( TRUE ); 77 connections.setAutoDelete( TRUE );
75 if ( !ok() ) 78 if ( !ok() )
76 qWarning( "Failed to bind to port %d", port ); 79 qWarning( "Failed to bind to port %d", port );
77} 80}
78 81
79void TransferServer::authorizeConnections() 82void TransferServer::authorizeConnections()
80{ 83{
81 QListIterator<ServerPI> it(connections); 84 QListIterator<ServerPI> it(connections);
82 while ( it.current() ) { 85 while ( it.current() ) {
83 if ( !it.current()->verifyAuthorised() ) { 86 if ( !it.current()->verifyAuthorised() ) {
84 disconnect( it.current(), SIGNAL(connectionClosed(ServerPI *)), this, SLOT( closed(ServerPI *)) ); 87 disconnect( it.current(), SIGNAL(connectionClosed(ServerPI *)), this, SLOT( closed(ServerPI *)) );
85 connections.removeRef( it.current() ); 88 connections.removeRef( it.current() );
86 } else 89 } else
87 ++it; 90 ++it;
88 } 91 }
89} 92}
90 93
91void TransferServer::closed(ServerPI *item) 94void TransferServer::closed(ServerPI *item)
92{ 95{
93 connections.removeRef(item); 96 connections.removeRef(item);
94} 97}
95 98
96TransferServer::~TransferServer() 99TransferServer::~TransferServer()
97{ 100{
98} 101}
99 102
100void TransferServer::newConnection( int socket ) 103void TransferServer::newConnection( int socket )
101{ 104{
102 ServerPI *ptr = new ServerPI( socket, this ); 105 ServerPI *ptr = new ServerPI( socket, this );
103 connect( ptr, SIGNAL(connectionClosed(ServerPI *)), this, SLOT( closed(ServerPI *)) ); 106 connect( ptr, SIGNAL(connectionClosed(ServerPI *)), this, SLOT( closed(ServerPI *)) );
104 connections.append( ptr ); 107 connections.append( ptr );
105} 108}
106 109
107QString SyncAuthentication::serverId() 110QString SyncAuthentication::serverId()
108{ 111{
109 Config cfg("Security"); 112 Config cfg("Security");
110 cfg.setGroup("Sync"); 113 cfg.setGroup("Sync");
111 QString r = cfg.readEntry("serverid"); 114 QString r = cfg.readEntry("serverid");
112 115
113 if ( r.isEmpty() ) { 116 if ( r.isEmpty() ) {
114 r = Opie::Global::uuid(); 117 r = Opie::Global::uuid();
115 cfg.writeEntry("serverid", r ); 118 cfg.writeEntry("serverid", r );
116 } 119 }
117 return r; 120 return r;
118} 121}
119 122
120QString SyncAuthentication::ownerName() 123QString SyncAuthentication::ownerName()
121{ 124{
122 QString vfilename = Global::applicationFileName("addressbook", 125 QString vfilename = Global::applicationFileName("addressbook",
123 "businesscard.vcf"); 126 "businesscard.vcf");
124 if (QFile::exists(vfilename)) { 127 if (QFile::exists(vfilename)) {
125 Contact c; 128 Contact c;
126 c = Contact::readVCard( vfilename )[0]; 129 c = Contact::readVCard( vfilename )[0];
127 return c.fullName(); 130 return c.fullName();
128 } 131 }
129 132
130 return QString::null; 133 return QString::null;
131} 134}
132 135
133QString SyncAuthentication::loginName() 136QString SyncAuthentication::loginName()
134{ 137{
135 struct passwd *pw = 0L; 138 struct passwd *pw = 0L;
136#ifndef Q_OS_WIN32 139#ifndef Q_OS_WIN32
137 pw = getpwuid( geteuid() ); 140 pw = getpwuid( geteuid() );
138 return QString::fromLocal8Bit( pw->pw_name ); 141 return QString::fromLocal8Bit( pw->pw_name );
139#else 142#else
140 //### revise 143 //### revise
141 return QString(); 144 return QString();
142#endif 145#endif
143} 146}
144 147
145int SyncAuthentication::isAuthorized(QHostAddress peeraddress) 148int SyncAuthentication::isAuthorized(QHostAddress peeraddress)
146{ 149{
147 Config cfg("Security"); 150 Config cfg("Security");
148 cfg.setGroup("Sync"); 151 cfg.setGroup("Sync");
149 // QString allowedstr = cfg.readEntry("auth_peer","192.168.1.0"); 152 // QString allowedstr = cfg.readEntry("auth_peer","192.168.1.0");
150 uint auth_peer = cfg.readNumEntry("auth_peer", 0xc0a80100); 153 uint auth_peer = cfg.readNumEntry("auth_peer", 0xc0a80100);
151 154
152 // QHostAddress allowed; 155 // QHostAddress allowed;
153 // allowed.setAddress(allowedstr); 156 // allowed.setAddress(allowedstr);
154 // uint auth_peer = allowed.ip4Addr(); 157 // uint auth_peer = allowed.ip4Addr();
155 uint auth_peer_bits = cfg.readNumEntry("auth_peer_bits", 24); 158 uint auth_peer_bits = cfg.readNumEntry("auth_peer_bits", 24);
156 uint mask = auth_peer_bits >= 32 // shifting by 32 is not defined 159 uint mask = auth_peer_bits >= 32 // shifting by 32 is not defined
157 ? 0xffffffff : (((1 << auth_peer_bits) - 1) << (32 - auth_peer_bits)); 160 ? 0xffffffff : (((1 << auth_peer_bits) - 1) << (32 - auth_peer_bits));
158 161
159 return (peeraddress.ip4Addr() & mask) == auth_peer; 162 return (peeraddress.ip4Addr() & mask) == auth_peer;
160} 163}
161 164
162bool SyncAuthentication::checkUser( const QString& user ) 165bool SyncAuthentication::checkUser( const QString& user )
163{ 166{
164 if ( user.isEmpty() ) return FALSE; 167 if ( user.isEmpty() ) return FALSE;
165 QString euser = loginName(); 168 QString euser = loginName();
166 return user == euser; 169 return user == euser;
167} 170}
168 171
169bool SyncAuthentication::checkPassword( const QString& password ) 172bool SyncAuthentication::checkPassword( const QString& password )
170{ 173{
171#ifdef ALLOW_UNIX_USER_FTP 174#ifdef ALLOW_UNIX_USER_FTP
172 // First, check system password... 175 // First, check system password...
173 176
174 struct passwd *pw = 0; 177 struct passwd *pw = 0;
175 struct spwd *spw = 0; 178 struct spwd *spw = 0;
176 179
177 pw = getpwuid( geteuid() ); 180 pw = getpwuid( geteuid() );
178 spw = getspnam( pw->pw_name ); 181 spw = getspnam( pw->pw_name );
179 182
180 QString cpwd = QString::fromLocal8Bit( pw->pw_passwd ); 183 QString cpwd = QString::fromLocal8Bit( pw->pw_passwd );
181 if ( cpwd == "x" && spw ) 184 if ( cpwd == "x" && spw )
182 cpwd = QString::fromLocal8Bit( spw->sp_pwdp ); 185 cpwd = QString::fromLocal8Bit( spw->sp_pwdp );
183 186
184 // Note: some systems use more than crypt for passwords. 187 // Note: some systems use more than crypt for passwords.
185 QString cpassword = QString::fromLocal8Bit( crypt( password.local8Bit(), cpwd.local8Bit() ) ); 188 QString cpassword = QString::fromLocal8Bit( crypt( password.local8Bit(), cpwd.local8Bit() ) );
186 if ( cpwd == cpassword ) 189 if ( cpwd == cpassword )
187 return TRUE; 190 return TRUE;
188#endif 191#endif
189 192
190 static int lastdenial=0; 193 static int lastdenial=0;
191 static int denials=0; 194 static int denials=0;
192 int now = time(0); 195 int now = time(0);
193 196
194 // Detect old Qtopia Desktop (no password) 197 // Detect old Qtopia Desktop (no password)
195 if ( password.isEmpty() ) { 198 if ( password.isEmpty() ) {
196 if ( denials < 1 || now > lastdenial+600 ) { 199 if ( denials < 1 || now > lastdenial+600 ) {
197 QMessageBox unauth( 200 QMessageBox unauth(
198 tr("Sync Connection"), 201 tr("Sync Connection"),
199 tr("<p>An unauthorized system is requesting access to this device." 202 tr("<p>An unauthorized system is requesting access to this device."
200 "<p>If you are using a version of Qtopia Desktop older than 1.5.1, " 203 "<p>If you are using a version of Qtopia Desktop older than 1.5.1, "
201 "please upgrade."), 204 "please upgrade."),
202 QMessageBox::Warning, 205 QMessageBox::Warning,
203 QMessageBox::Cancel, QMessageBox::NoButton, QMessageBox::NoButton, 206 QMessageBox::Cancel, QMessageBox::NoButton, QMessageBox::NoButton,
204 0, QString::null, TRUE, WStyle_StaysOnTop); 207 0, QString::null, TRUE, WStyle_StaysOnTop);
205 unauth.setButtonText(QMessageBox::Cancel, tr("Deny")); 208 unauth.setButtonText(QMessageBox::Cancel, tr("Deny"));
206 unauth.exec(); 209 unauth.exec();
207 210
208 denials++; 211 denials++;
209 lastdenial=now; 212 lastdenial=now;
210 } 213 }
211 return FALSE; 214 return FALSE;
212 } 215 }
213 216
214 // Second, check sync password... 217 // Second, check sync password...
215 218
216 static int lock=0; 219 static int lock=0;
217 if ( lock ) return FALSE; 220 if ( lock ) return FALSE;
218 221
219 ++lock; 222 ++lock;
220 223
221 /* 224 /*
222 * we need to support old Sync software and QtopiaDesktop 225 * we need to support old Sync software and QtopiaDesktop
223 */ 226 */
224 if ( password.left(6) == "Qtopia" || password.left(6) == "rootme" ) { 227 if ( password.left(6) == "Qtopia" || password.left(6) == "rootme" ) {
225 Config cfg( "Security" ); 228 Config cfg( "Security" );
226 cfg.setGroup("Sync"); 229 cfg.setGroup("Sync");
227 QStringList pwds = cfg.readListEntry("Passwords",' '); 230 QStringList pwds = cfg.readListEntry("Passwords",' ');
228 for (QStringList::ConstIterator it=pwds.begin(); it!=pwds.end(); ++it) { 231 for (QStringList::ConstIterator it=pwds.begin(); it!=pwds.end(); ++it) {
229#ifndef Q_OS_WIN32 232#ifndef Q_OS_WIN32
230 QString cpassword = QString::fromLocal8Bit( 233 QString cpassword = QString::fromLocal8Bit(
231 crypt( password.mid(8).local8Bit(), (*it).left(2).latin1() ) ); 234 crypt( password.mid(8).local8Bit(), (*it).left(2).latin1() ) );
232#else 235#else
233 // ### revise 236 // ### revise
234 QString cpassword(""); 237 QString cpassword("");
235#endif 238#endif
236 if ( *it == cpassword ) { 239 if ( *it == cpassword ) {
237 lock--; 240 lock--;
238 return TRUE; 241 return TRUE;
239 } 242 }
240 } 243 }
241 244
242 // Unrecognized system. Be careful... 245 // Unrecognized system. Be careful...
243 QMessageBox unrecbox( 246 QMessageBox unrecbox(
244 tr("Sync Connection"), 247 tr("Sync Connection"),
245 tr("<p>An unrecognized system is requesting access to this device." 248 tr("<p>An unrecognized system is requesting access to this device."
246 "<p>If you have just initiated a Sync for the first time, this is normal."), 249 "<p>If you have just initiated a Sync for the first time, this is normal."),
247 QMessageBox::Warning, 250 QMessageBox::Warning,
248 QMessageBox::Cancel, QMessageBox::Yes, QMessageBox::NoButton, 251 QMessageBox::Cancel, QMessageBox::Yes, QMessageBox::NoButton,
249 0, QString::null, TRUE, WStyle_StaysOnTop); 252 0, QString::null, TRUE, WStyle_StaysOnTop);
250 unrecbox.setButtonText(QMessageBox::Cancel, tr("Deny")); 253 unrecbox.setButtonText(QMessageBox::Cancel, tr("Deny"));
251 unrecbox.setButtonText(QMessageBox::Yes, tr("Allow")); 254 unrecbox.setButtonText(QMessageBox::Yes, tr("Allow"));
252 255
253 if ( (denials > 2 && now < lastdenial+600) 256 if ( (denials > 2 && now < lastdenial+600)
254 || unrecbox.exec() != QMessageBox::Yes) 257 || unrecbox.exec() != QMessageBox::Yes)
255 { 258 {
256 denials++; 259 denials++;
257 lastdenial=now; 260 lastdenial=now;
258 lock--; 261 lock--;
259 return FALSE; 262 return FALSE;
260 } else { 263 } else {
261 const char salty[]="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/."; 264 const char salty[]="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/.";
262 char salt[2]; 265 char salt[2];
263 salt[0]= salty[rand() % (sizeof(salty)-1)]; 266 salt[0]= salty[rand() % (sizeof(salty)-1)];
264 salt[1]= salty[rand() % (sizeof(salty)-1)]; 267 salt[1]= salty[rand() % (sizeof(salty)-1)];
265#ifndef Q_OS_WIN32 268#ifndef Q_OS_WIN32
266 QString cpassword = QString::fromLocal8Bit( 269 QString cpassword = QString::fromLocal8Bit(
267 crypt( password.mid(8).local8Bit(), salt ) ); 270 crypt( password.mid(8).local8Bit(), salt ) );
268#else 271#else
269 //### revise 272 //### revise
270 QString cpassword(""); 273 QString cpassword("");
271#endif 274#endif
272 denials=0; 275 denials=0;
273 pwds.prepend(cpassword); 276 pwds.prepend(cpassword);
274 cfg.writeEntry("Passwords",pwds,' '); 277 cfg.writeEntry("Passwords",pwds,' ');
275 lock--; 278 lock--;
276 return TRUE; 279 return TRUE;
277 } 280 }
278 } 281 }
279 lock--; 282 lock--;
280 283
281 return FALSE; 284 return FALSE;
282} 285}
283 286
284 287
285ServerPI::ServerPI( int socket, QObject *parent, const char* name ) 288ServerPI::ServerPI( int socket, QObject *parent, const char* name )
286 : QSocket( parent, name ) , dtp( 0 ), serversocket( 0 ), waitsocket( 0 ), 289 : QSocket( parent, name ) , dtp( 0 ), serversocket( 0 ), waitsocket( 0 ),
287 storFileSize(-1) 290 storFileSize(-1)
288{ 291{
289 state = Connected; 292 state = Connected;
290 293
291 setSocket( socket ); 294 setSocket( socket );
292 295
293 peerport = peerPort(); 296 peerport = peerPort();
294 peeraddress = peerAddress(); 297 peeraddress = peerAddress();
295 298
296#ifndef INSECURE 299#ifndef INSECURE
297 if ( !SyncAuthentication::isAuthorized(peeraddress) ) { 300 if ( !SyncAuthentication::isAuthorized(peeraddress) ) {
298 state = Forbidden; 301 state = Forbidden;
299 startTimer( 0 ); 302 startTimer( 0 );
300 } else 303 } else
301#endif 304#endif
302 { 305 {
303 connect( this, SIGNAL( readyRead() ), SLOT( read() ) ); 306 connect( this, SIGNAL( readyRead() ), SLOT( read() ) );
304 connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) ); 307 connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) );
305 308
306 passiv = FALSE; 309 passiv = FALSE;
307 for( int i = 0; i < 4; i++ ) 310 for( int i = 0; i < 4; i++ )
308 wait[i] = FALSE; 311 wait[i] = FALSE;
309 312
310 send( "220 Qtopia " QPE_VERSION " FTP Server" ); // No tr 313 send( "220 Qtopia " QPE_VERSION " FTP Server" ); // No tr
311 state = Wait_USER; 314 state = Wait_USER;
312 315
313 dtp = new ServerDTP( this ); 316 dtp = new ServerDTP( this );
314 connect( dtp, SIGNAL( completed() ), SLOT( dtpCompleted() ) ); 317 connect( dtp, SIGNAL( completed() ), SLOT( dtpCompleted() ) );
315 connect( dtp, SIGNAL( failed() ), SLOT( dtpFailed() ) ); 318 connect( dtp, SIGNAL( failed() ), SLOT( dtpFailed() ) );
316 connect( dtp, SIGNAL( error( int ) ), SLOT( dtpError( int ) ) ); 319 connect( dtp, SIGNAL( error( int ) ), SLOT( dtpError( int ) ) );
317 320
318 321
319 directory = QDir::currentDirPath(); 322 directory = QDir::currentDirPath();
320 323
321 static int p = 1024; 324 static int p = 1024;
322 325
323 while ( !serversocket || !serversocket->ok() ) { 326 while ( !serversocket || !serversocket->ok() ) {
324 delete serversocket; 327 delete serversocket;
325 serversocket = new ServerSocket( ++p, this ); 328 serversocket = new ServerSocket( ++p, this );
326 } 329 }
327 connect( serversocket, SIGNAL( newIncomming( int ) ), 330 connect( serversocket, SIGNAL( newIncomming( int ) ),
328 SLOT( newConnection( int ) ) ); 331 SLOT( newConnection( int ) ) );
329 } 332 }
330} 333}
331 334
332ServerPI::~ServerPI() 335ServerPI::~ServerPI()
333{ 336{
334 close(); 337 close();
335 dtp->close(); 338 dtp->close();
336 delete dtp; 339 delete dtp;
337 delete serversocket; 340 delete serversocket;
338} 341}
339 342
340bool ServerPI::verifyAuthorised() 343bool ServerPI::verifyAuthorised()
341{ 344{
342 if ( !SyncAuthentication::isAuthorized(peerAddress()) ) { 345 if ( !SyncAuthentication::isAuthorized(peerAddress()) ) {
343 state = Forbidden; 346 state = Forbidden;
344 return FALSE; 347 return FALSE;
345 } 348 }
346 return TRUE; 349 return TRUE;
347} 350}
348 351
349void ServerPI::connectionClosed() 352void ServerPI::connectionClosed()
350{ 353{
351 // qDebug( "Debug: Connection closed" ); 354 // qDebug( "Debug: Connection closed" );
352 emit connectionClosed(this); 355 emit connectionClosed(this);
353} 356}
354 357
355void ServerPI::send( const QString& msg ) 358void ServerPI::send( const QString& msg )
356{ 359{
357 QTextStream os( this ); 360 QTextStream os( this );
358 os << msg << endl; 361 os << msg << endl;
359 //qDebug( "Reply: %s", msg.latin1() ); 362 //qDebug( "Reply: %s", msg.latin1() );
360} 363}
361 364
362void ServerPI::read() 365void ServerPI::read()
363{ 366{
364 while ( canReadLine() ) 367 while ( canReadLine() )
365 process( readLine().stripWhiteSpace() ); 368 process( readLine().stripWhiteSpace() );
366} 369}
367 370
368bool ServerPI::checkReadFile( const QString& file ) 371bool ServerPI::checkReadFile( const QString& file )
369{ 372{
370 QString filename; 373 QString filename;
371 374
372 if ( file[0] != "/" ) 375 if ( file[0] != "/" )
373 filename = directory.path() + "/" + file; 376 filename = directory.path() + "/" + file;
374 else 377 else
375 filename = file; 378 filename = file;
376 379
377 QFileInfo fi( filename ); 380 QFileInfo fi( filename );
378 return ( fi.exists() && fi.isReadable() ); 381 return ( fi.exists() && fi.isReadable() );
379} 382}
380 383
381bool ServerPI::checkWriteFile( const QString& file ) 384bool ServerPI::checkWriteFile( const QString& file )
382{ 385{
383 QString filename; 386 QString filename;
384 387
385 if ( file[0] != "/" ) 388 if ( file[0] != "/" )
386 filename = directory.path() + "/" + file; 389 filename = directory.path() + "/" + file;
387 else 390 else
388 filename = file; 391 filename = file;
389 392
390 QFileInfo fi( filename ); 393 QFileInfo fi( filename );
391 394
392 if ( fi.exists() ) 395 if ( fi.exists() )
393 if ( !QFile( filename ).remove() ) 396 if ( !QFile( filename ).remove() )
394 return FALSE; 397 return FALSE;
395 return TRUE; 398 return TRUE;
396} 399}
397 400
398void ServerPI::process( const QString& message ) 401void ServerPI::process( const QString& message )
399{ 402{
400 //qDebug( "Command: %s", message.latin1() ); 403 //qDebug( "Command: %s", message.latin1() );
401 404
402 // split message using "," as separator 405 // split message using "," as separator
403 QStringList msg = QStringList::split( " ", message ); 406 QStringList msg = QStringList::split( " ", message );
404 if ( msg.isEmpty() ) return; 407 if ( msg.isEmpty() ) return;
405 408
406 // command token 409 // command token
407 QString cmd = msg[0].upper(); 410 QString cmd = msg[0].upper();
408 411
409 // argument token 412 // argument token
410 QString arg; 413 QString arg;
411 if ( msg.count() >= 2 ) 414 if ( msg.count() >= 2 )
412 arg = msg[1]; 415 arg = msg[1];
413 416
414 // full argument string 417 // full argument string
415 QString args; 418 QString args;
416 if ( msg.count() >= 2 ) { 419 if ( msg.count() >= 2 ) {
417 QStringList copy( msg ); 420 QStringList copy( msg );
418 // FIXME: for Qt3 421 // FIXME: for Qt3
419 // copy.pop_front() 422 // copy.pop_front()
420 copy.remove( copy.begin() ); 423 copy.remove( copy.begin() );
421 args = copy.join( " " ); 424 args = copy.join( " " );
422 } 425 }
423 426
424 //qDebug( "args: %s", args.latin1() ); 427 //qDebug( "args: %s", args.latin1() );
425 428
426 // we always respond to QUIT, regardless of state 429 // we always respond to QUIT, regardless of state
427 if ( cmd == "QUIT" ) { 430 if ( cmd == "QUIT" ) {
428 send( "211 Good bye!" ); // No tr 431 send( "211 Good bye!" ); // No tr
429 close(); 432 close();
430 return; 433 return;
431 } 434 }
432 435
433 // connected to client 436 // connected to client
434 if ( Connected == state ) 437 if ( Connected == state )
435 return; 438 return;
436 439
437 // waiting for user name 440 // waiting for user name
438 if ( Wait_USER == state ) { 441 if ( Wait_USER == state ) {
439 442
440 if ( cmd != "USER" || msg.count() < 2 || !SyncAuthentication::checkUser( arg ) ) { 443 if ( cmd != "USER" || msg.count() < 2 || !SyncAuthentication::checkUser( arg ) ) {
441 send( "530 Please login with USER and PASS" ); // No tr 444 send( "530 Please login with USER and PASS" ); // No tr
442 return; 445 return;
443 } 446 }
444 send( "331 User name ok, need password" ); // No tr 447 send( "331 User name ok, need password" ); // No tr
445 state = Wait_PASS; 448 state = Wait_PASS;
446 return; 449 return;
447 } 450 }
448 451
449 // waiting for password 452 // waiting for password
450 if ( Wait_PASS == state ) { 453 if ( Wait_PASS == state ) {
451 454
452 if ( cmd != "PASS" || !SyncAuthentication::checkPassword( arg ) ) { 455 if ( cmd != "PASS" || !SyncAuthentication::checkPassword( arg ) ) {
453 send( "530 Please login with USER and PASS" ); // No tr 456 send( "530 Please login with USER and PASS" ); // No tr
454 return; 457 return;
455 } 458 }
456 send( "230 User logged in, proceed" ); // No tr 459 send( "230 User logged in, proceed" ); // No tr
457 state = Ready; 460 state = Ready;
458 return; 461 return;
459 } 462 }
460 463
461 // ACCESS CONTROL COMMANDS 464 // ACCESS CONTROL COMMANDS
462 465
463 // Only an ALLO sent immediately before STOR is valid. 466 // Only an ALLO sent immediately before STOR is valid.
464 if ( cmd != "STOR" ) 467 if ( cmd != "STOR" )
465 storFileSize = -1; 468 storFileSize = -1;
466 469
467 // account (ACCT) 470 // account (ACCT)
468 if ( cmd == "ACCT" ) { 471 if ( cmd == "ACCT" ) {
469 // even wu-ftp does not support it 472 // even wu-ftp does not support it
470 send( "502 Command not implemented" ); // No tr 473 send( "502 Command not implemented" ); // No tr
471 } 474 }
472 475
473 // change working directory (CWD) 476 // change working directory (CWD)
474 else if ( cmd == "CWD" ) { 477 else if ( cmd == "CWD" ) {
475 478
476 if ( !args.isEmpty() ) { 479 if ( !args.isEmpty() ) {
477 if ( directory.cd( args, TRUE ) ) 480 if ( directory.cd( args, TRUE ) )
478 send( "250 Requested file action okay, completed" ); // No tr 481 send( "250 Requested file action okay, completed" ); // No tr
479 else 482 else
480 send( "550 Requested action not taken" ); // No tr 483 send( "550 Requested action not taken" ); // No tr
481 } 484 }
482 else 485 else
483 send( "500 Syntax error, command unrecognized" ); // No tr 486 send( "500 Syntax error, command unrecognized" ); // No tr
484 } 487 }
485 488
486 // change to parent directory (CDUP) 489 // change to parent directory (CDUP)
487 else if ( cmd == "CDUP" ) { 490 else if ( cmd == "CDUP" ) {
488 if ( directory.cdUp() ) 491 if ( directory.cdUp() )
489 send( "250 Requested file action okay, completed" ); // No tr 492 send( "250 Requested file action okay, completed" ); // No tr
490 else 493 else
491 send( "550 Requested action not taken" ); // No tr 494 send( "550 Requested action not taken" ); // No tr
492 } 495 }
493 496
494 // structure mount (SMNT) 497 // structure mount (SMNT)
495 else if ( cmd == "SMNT" ) { 498 else if ( cmd == "SMNT" ) {
496 // even wu-ftp does not support it 499 // even wu-ftp does not support it
497 send( "502 Command not implemented" ); // No tr 500 send( "502 Command not implemented" ); // No tr
498 } 501 }
499 502
500 // reinitialize (REIN) 503 // reinitialize (REIN)
501 else if ( cmd == "REIN" ) { 504 else if ( cmd == "REIN" ) {
502 // even wu-ftp does not support it 505 // even wu-ftp does not support it
503 send( "502 Command not implemented" ); // No tr 506 send( "502 Command not implemented" ); // No tr
504 } 507 }
505 508
506 509
507 // TRANSFER PARAMETER COMMANDS 510 // TRANSFER PARAMETER COMMANDS
508 511
509 512
510 // data port (PORT) 513 // data port (PORT)
511 else if ( cmd == "PORT" ) { 514 else if ( cmd == "PORT" ) {
512 if ( parsePort( arg ) ) 515 if ( parsePort( arg ) )
513 send( "200 Command okay" ); // No tr 516 send( "200 Command okay" ); // No tr
514 else 517 else
515 send( "500 Syntax error, command unrecognized" ); // No tr 518 send( "500 Syntax error, command unrecognized" ); // No tr
516 } 519 }
517 520
518 // passive (PASV) 521 // passive (PASV)
519 else if ( cmd == "PASV" ) { 522 else if ( cmd == "PASV" ) {
520 passiv = TRUE; 523 passiv = TRUE;
521 send( "227 Entering Passive Mode (" // No tr 524 send( "227 Entering Passive Mode (" // No tr
522 + address().toString().replace( QRegExp( "\\." ), "," ) + "," 525 + address().toString().replace( QRegExp( "\\." ), "," ) + ","
523 + QString::number( ( serversocket->port() ) >> 8 ) + "," 526 + QString::number( ( serversocket->port() ) >> 8 ) + ","
524 + QString::number( ( serversocket->port() ) & 0xFF ) +")" ); 527 + QString::number( ( serversocket->port() ) & 0xFF ) +")" );
525 } 528 }
526 529
527 // representation type (TYPE) 530 // representation type (TYPE)
528 else if ( cmd == "TYPE" ) { 531 else if ( cmd == "TYPE" ) {
529 if ( arg.upper() == "A" || arg.upper() == "I" ) 532 if ( arg.upper() == "A" || arg.upper() == "I" )
530 send( "200 Command okay" ); // No tr 533 send( "200 Command okay" ); // No tr
531 else 534 else
532 send( "504 Command not implemented for that parameter" ); // No tr 535 send( "504 Command not implemented for that parameter" ); // No tr
533 } 536 }
534 537
535 // file structure (STRU) 538 // file structure (STRU)
536 else if ( cmd == "STRU" ) { 539 else if ( cmd == "STRU" ) {
537 if ( arg.upper() == "F" ) 540 if ( arg.upper() == "F" )
538 send( "200 Command okay" ); // No tr 541 send( "200 Command okay" ); // No tr
539 else 542 else
540 send( "504 Command not implemented for that parameter" ); // No tr 543 send( "504 Command not implemented for that parameter" ); // No tr
541 } 544 }
542 545
543 // transfer mode (MODE) 546 // transfer mode (MODE)
544 else if ( cmd == "MODE" ) { 547 else if ( cmd == "MODE" ) {
545 if ( arg.upper() == "S" ) 548 if ( arg.upper() == "S" )
546 send( "200 Command okay" ); // No tr 549 send( "200 Command okay" ); // No tr
547 else 550 else
548 send( "504 Command not implemented for that parameter" ); // No tr 551 send( "504 Command not implemented for that parameter" ); // No tr
549 } 552 }
550 553
551 554
552 // FTP SERVICE COMMANDS 555 // FTP SERVICE COMMANDS
553 556
554 557
555 // retrieve (RETR) 558 // retrieve (RETR)
556 else if ( cmd == "RETR" ) 559 else if ( cmd == "RETR" )
557 if ( !args.isEmpty() && checkReadFile( absFilePath( args ) ) 560 if ( !args.isEmpty() && checkReadFile( absFilePath( args ) )
558 || backupRestoreGzip( absFilePath( args ) ) ) { 561 || backupRestoreGzip( absFilePath( args ) ) ) {
559 send( "150 File status okay" ); // No tr 562 send( "150 File status okay" ); // No tr
560 sendFile( absFilePath( args ) ); 563 sendFile( absFilePath( args ) );
561 } 564 }
562 else { 565 else {
563 qDebug("550 Requested action not taken"); 566 qDebug("550 Requested action not taken");
564 send( "550 Requested action not taken" ); // No tr 567 send( "550 Requested action not taken" ); // No tr
565 } 568 }
566 569
567 // store (STOR) 570 // store (STOR)
568 else if ( cmd == "STOR" ) 571 else if ( cmd == "STOR" )
569 if ( !args.isEmpty() && checkWriteFile( absFilePath( args ) ) ) { 572 if ( !args.isEmpty() && checkWriteFile( absFilePath( args ) ) ) {
570 send( "150 File status okay" ); // No tr 573 send( "150 File status okay" ); // No tr
571 retrieveFile( absFilePath( args ) ); 574 retrieveFile( absFilePath( args ) );
572 } 575 }
573 else 576 else
574 send( "550 Requested action not taken" ); // No tr 577 send( "550 Requested action not taken" ); // No tr
575 578
576 // store unique (STOU) 579 // store unique (STOU)
577 else if ( cmd == "STOU" ) { 580 else if ( cmd == "STOU" ) {
578 send( "502 Command not implemented" ); // No tr 581 send( "502 Command not implemented" ); // No tr
579 } 582 }
580 583
581 // append (APPE) 584 // append (APPE)
582 else if ( cmd == "APPE" ) { 585 else if ( cmd == "APPE" ) {
583 send( "502 Command not implemented" ); // No tr 586 send( "502 Command not implemented" ); // No tr
584 } 587 }
585 588
586 // allocate (ALLO) 589 // allocate (ALLO)
587 else if ( cmd == "ALLO" ) { 590 else if ( cmd == "ALLO" ) {
588 storFileSize = args.toInt(); 591 storFileSize = args.toInt();
589 send( "200 Command okay" ); // No tr 592 send( "200 Command okay" ); // No tr
590 } 593 }
591 594
592 // restart (REST) 595 // restart (REST)
593 else if ( cmd == "REST" ) { 596 else if ( cmd == "REST" ) {
594 send( "502 Command not implemented" ); // No tr 597 send( "502 Command not implemented" ); // No tr
595 } 598 }
596 599
597 // rename from (RNFR) 600 // rename from (RNFR)
598 else if ( cmd == "RNFR" ) { 601 else if ( cmd == "RNFR" ) {
599 renameFrom = QString::null; 602 renameFrom = QString::null;
600 if ( args.isEmpty() ) 603 if ( args.isEmpty() )
601 send( "500 Syntax error, command unrecognized" ); // No tr 604 send( "500 Syntax error, command unrecognized" ); // No tr
602 else { 605 else {
603 QFile file( absFilePath( args ) ); 606 QFile file( absFilePath( args ) );
604 if ( file.exists() ) { 607 if ( file.exists() ) {
605 send( "350 File exists, ready for destination name" ); // No tr 608 send( "350 File exists, ready for destination name" ); // No tr
606 renameFrom = absFilePath( args ); 609 renameFrom = absFilePath( args );
607 } 610 }
608 else 611 else
609 send( "550 Requested action not taken" ); // No tr 612 send( "550 Requested action not taken" ); // No tr
610 } 613 }
611 } 614 }
612 615
613 // rename to (RNTO) 616 // rename to (RNTO)
614 else if ( cmd == "RNTO" ) { 617 else if ( cmd == "RNTO" ) {
615 if ( lastCommand != "RNFR" ) 618 if ( lastCommand != "RNFR" )
616 send( "503 Bad sequence of commands" ); // No tr 619 send( "503 Bad sequence of commands" ); // No tr
617 else if ( args.isEmpty() ) 620 else if ( args.isEmpty() )
618 send( "500 Syntax error, command unrecognized" ); // No tr 621 send( "500 Syntax error, command unrecognized" ); // No tr
619 else { 622 else {
620 QDir dir( absFilePath( args ) ); 623 QDir dir( absFilePath( args ) );
621 if ( dir.rename( renameFrom, absFilePath( args ), TRUE ) ) 624 if ( dir.rename( renameFrom, absFilePath( args ), TRUE ) )
622 send( "250 Requested file action okay, completed." ); // No tr 625 send( "250 Requested file action okay, completed." ); // No tr
623 else 626 else
624 send( "550 Requested action not taken" ); // No tr 627 send( "550 Requested action not taken" ); // No tr
625 } 628 }
626 } 629 }
627 630
628 // abort (ABOR) 631 // abort (ABOR)
629 else if ( cmd.contains( "ABOR" ) ) { 632 else if ( cmd.contains( "ABOR" ) ) {
630 dtp->close(); 633 dtp->close();
631 if ( dtp->dtpMode() != ServerDTP::Idle ) 634 if ( dtp->dtpMode() != ServerDTP::Idle )
632 send( "426 Connection closed; transfer aborted" ); // No tr 635 send( "426 Connection closed; transfer aborted" ); // No tr
633 else 636 else
634 send( "226 Closing data connection" ); // No tr 637 send( "226 Closing data connection" ); // No tr
635 } 638 }
636 639
637 // delete (DELE) 640 // delete (DELE)
638 else if ( cmd == "DELE" ) { 641 else if ( cmd == "DELE" ) {
639 if ( args.isEmpty() ) 642 if ( args.isEmpty() )
640 send( "500 Syntax error, command unrecognized" ); // No tr 643 send( "500 Syntax error, command unrecognized" ); // No tr
641 else { 644 else {
642 QFile file( absFilePath( args ) ) ; 645 QFile file( absFilePath( args ) ) ;
643 if ( file.remove() ) { 646 if ( file.remove() ) {
644 send( "250 Requested file action okay, completed" ); // No tr 647 send( "250 Requested file action okay, completed" ); // No tr
645 QCopEnvelope e("QPE/System", "linkChanged(QString)" ); 648 QCopEnvelope e("QPE/System", "linkChanged(QString)" );
646 e << file.name(); 649 e << file.name();
647 } else { 650 } else {
648 send( "550 Requested action not taken" ); // No tr 651 send( "550 Requested action not taken" ); // No tr
649 } 652 }
650 } 653 }
651 } 654 }
652 655
653 // remove directory (RMD) 656 // remove directory (RMD)
654 else if ( cmd == "RMD" ) { 657 else if ( cmd == "RMD" ) {
655 if ( args.isEmpty() ) 658 if ( args.isEmpty() )
656 send( "500 Syntax error, command unrecognized" ); // No tr 659 send( "500 Syntax error, command unrecognized" ); // No tr
657 else { 660 else {
658 QDir dir; 661 QDir dir;
659 if ( dir.rmdir( absFilePath( args ), TRUE ) ) 662 if ( dir.rmdir( absFilePath( args ), TRUE ) )
660 send( "250 Requested file action okay, completed" ); // No tr 663 send( "250 Requested file action okay, completed" ); // No tr
661 else 664 else
662 send( "550 Requested action not taken" ); // No tr 665 send( "550 Requested action not taken" ); // No tr
663 } 666 }
664 } 667 }
665 668
666 // make directory (MKD) 669 // make directory (MKD)
667 else if ( cmd == "MKD" ) { 670 else if ( cmd == "MKD" ) {
668 if ( args.isEmpty() ) { 671 if ( args.isEmpty() ) {
669 qDebug(" Error: no arg"); 672 qDebug(" Error: no arg");
670 send( "500 Syntax error, command unrecognized" ); // No tr 673 send( "500 Syntax error, command unrecognized" ); // No tr
671 } 674 }
672 else { 675 else {
673 QDir dir; 676 QDir dir;
674 if ( dir.mkdir( absFilePath( args ), TRUE ) ) 677 if ( dir.mkdir( absFilePath( args ), TRUE ) )
675 send( "250 Requested file action okay, completed." ); // No tr 678 send( "250 Requested file action okay, completed." ); // No tr
676 else 679 else
677 send( "550 Requested action not taken" ); // No tr 680 send( "550 Requested action not taken" ); // No tr
678 } 681 }
679 } 682 }
680 683
681 // print working directory (PWD) 684 // print working directory (PWD)
682 else if ( cmd == "PWD" ) { 685 else if ( cmd == "PWD" ) {
683 send( "257 \"" + directory.path() +"\"" ); 686 send( "257 \"" + directory.path() +"\"" );
684 } 687 }
685 688
686 // list (LIST) 689 // list (LIST)
687 else if ( cmd == "LIST" ) { 690 else if ( cmd == "LIST" ) {
688 if ( sendList( absFilePath( args ) ) ) 691 if ( sendList( absFilePath( args ) ) )
689 send( "150 File status okay" ); // No tr 692 send( "150 File status okay" ); // No tr
690 else 693 else
691 send( "500 Syntax error, command unrecognized" ); // No tr 694 send( "500 Syntax error, command unrecognized" ); // No tr
692 } 695 }
693 696
694 // size (SIZE) 697 // size (SIZE)
695 else if ( cmd == "SIZE" ) { 698 else if ( cmd == "SIZE" ) {
696 QString filePath = absFilePath( args ); 699 QString filePath = absFilePath( args );
697 QFileInfo fi( filePath ); 700 QFileInfo fi( filePath );
698 bool gzipfile = backupRestoreGzip( filePath ); 701 bool gzipfile = backupRestoreGzip( filePath );
699 if ( !fi.exists() && !gzipfile ) 702 if ( !fi.exists() && !gzipfile )
700 send( "500 Syntax error, command unrecognized" ); // No tr 703 send( "500 Syntax error, command unrecognized" ); // No tr
701 else { 704 else {
702 if ( !gzipfile ) 705 if ( !gzipfile )
703 send( "213 " + QString::number( fi.size() ) ); 706 send( "213 " + QString::number( fi.size() ) );
704 else { 707 else {
705 Process duproc( QString("du") ); 708 Process duproc( QString("du") );
706 duproc.addArgument("-s"); 709 duproc.addArgument("-s");
707 QString in, out; 710 QString in, out;
708 if ( !duproc.exec(in, out) ) { 711 if ( !duproc.exec(in, out) ) {
709 qDebug("du process failed; just sending back 1K"); 712 qDebug("du process failed; just sending back 1K");
710 send( "213 1024"); 713 send( "213 1024");
711 } 714 }
712 else { 715 else {
713 QString size = out.left( out.find("\t") ); 716 QString size = out.left( out.find("\t") );
714 int guess = size.toInt()/5; 717 int guess = size.toInt()/5;
715 if ( filePath.contains("doc") ) // No tr 718 if ( filePath.contains("doc") ) // No tr
716 guess *= 1000; 719 guess *= 1000;
717 qDebug("sending back gzip guess of %d", guess); 720 qDebug("sending back gzip guess of %d", guess);
718 send( "213 " + QString::number(guess) ); 721 send( "213 " + QString::number(guess) );
719 } 722 }
720 } 723 }
721 } 724 }
722 } 725 }
723 // name list (NLST) 726 // name list (NLST)
724 else if ( cmd == "NLST" ) { 727 else if ( cmd == "NLST" ) {
725 send( "502 Command not implemented" ); // No tr 728 send( "502 Command not implemented" ); // No tr
726 } 729 }
727 730
728 // site parameters (SITE) 731 // site parameters (SITE)
729 else if ( cmd == "SITE" ) { 732 else if ( cmd == "SITE" ) {
730 send( "502 Command not implemented" ); // No tr 733 send( "502 Command not implemented" ); // No tr
731 } 734 }
732 735
733 // system (SYST) 736 // system (SYST)
734 else if ( cmd == "SYST" ) { 737 else if ( cmd == "SYST" ) {
735 send( "215 UNIX Type: L8" ); // No tr 738 send( "215 UNIX Type: L8" ); // No tr
736 } 739 }
737 740
738 // status (STAT) 741 // status (STAT)
739 else if ( cmd == "STAT" ) { 742 else if ( cmd == "STAT" ) {
740 send( "502 Command not implemented" ); // No tr 743 send( "502 Command not implemented" ); // No tr
741 } 744 }
742 745
743 // help (HELP ) 746 // help (HELP )
744 else if ( cmd == "HELP" ) { 747 else if ( cmd == "HELP" ) {
745 send( "502 Command not implemented" ); // No tr 748 send( "502 Command not implemented" ); // No tr
746 } 749 }
747 750
748 // noop (NOOP) 751 // noop (NOOP)
749 else if ( cmd == "NOOP" ) { 752 else if ( cmd == "NOOP" ) {
750 send( "200 Command okay" ); // No tr 753 send( "200 Command okay" ); // No tr
751 } 754 }
752 755
753 // not implemented 756 // not implemented
754 else 757 else
755 send( "502 Command not implemented" ); // No tr 758 send( "502 Command not implemented" ); // No tr
756 759
757 lastCommand = cmd; 760 lastCommand = cmd;
758} 761}
759 762
760bool ServerPI::backupRestoreGzip( const QString &file ) 763bool ServerPI::backupRestoreGzip( const QString &file )
761{ 764{
762 return (file.find( "backup" ) != -1 && // No tr 765 return (file.find( "backup" ) != -1 && // No tr
763 file.findRev( ".tgz" ) == (int)file.length()-4 ); 766 file.findRev( ".tgz" ) == (int)file.length()-4 );
764} 767}
765 768
766bool ServerPI::backupRestoreGzip( const QString &file, QStringList &targets ) 769bool ServerPI::backupRestoreGzip( const QString &file, QStringList &targets )
767{ 770{
768 if ( file.find( "backup" ) != -1 && // No tr 771 if ( file.find( "backup" ) != -1 && // No tr
769 file.findRev( ".tgz" ) == (int)file.length()-4 ) { 772 file.findRev( ".tgz" ) == (int)file.length()-4 ) {
770 QFileInfo info( file ); 773 QFileInfo info( file );
771 targets = info.dirPath( TRUE ); 774 targets = info.dirPath( TRUE );
772 qDebug("ServerPI::backupRestoreGzip for %s = %s", file.latin1(), 775 qDebug("ServerPI::backupRestoreGzip for %s = %s", file.latin1(),
773 targets.join(" ").latin1() ); 776 targets.join(" ").latin1() );
774 return true; 777 return true;
775 } 778 }
776 return false; 779 return false;
777} 780}
778 781
779void ServerPI::sendFile( const QString& file ) 782void ServerPI::sendFile( const QString& file )
780{ 783{
781 if ( passiv ) { 784 if ( passiv ) {
782 wait[SendFile] = TRUE; 785 wait[SendFile] = TRUE;
783 waitfile = file; 786 waitfile = file;
784 if ( waitsocket ) 787 if ( waitsocket )
785 newConnection( waitsocket ); 788 newConnection( waitsocket );
786 } 789 }
787 else { 790 else {
788 QStringList targets; 791 QStringList targets;
789 if ( backupRestoreGzip( file, targets ) ) 792 if ( backupRestoreGzip( file, targets ) )
790 dtp->sendGzipFile( file, targets, peeraddress, peerport ); 793 dtp->sendGzipFile( file, targets, peeraddress, peerport );
791 else dtp->sendFile( file, peeraddress, peerport ); 794 else dtp->sendFile( file, peeraddress, peerport );
792 } 795 }
793} 796}
794 797
795void ServerPI::retrieveFile( const QString& file ) 798void ServerPI::retrieveFile( const QString& file )
796{ 799{
797 if ( passiv ) { 800 if ( passiv ) {
798 wait[RetrieveFile] = TRUE; 801 wait[RetrieveFile] = TRUE;
799 waitfile = file; 802 waitfile = file;
800 if ( waitsocket ) 803 if ( waitsocket )
801 newConnection( waitsocket ); 804 newConnection( waitsocket );
802 } 805 }
803 else { 806 else {
804 QStringList targets; 807 QStringList targets;
805 if ( backupRestoreGzip( file, targets ) ) 808 if ( backupRestoreGzip( file, targets ) )
806 dtp->retrieveGzipFile( file, peeraddress, peerport ); 809 dtp->retrieveGzipFile( file, peeraddress, peerport );
807 else 810 else
808 dtp->retrieveFile( file, peeraddress, peerport, storFileSize ); 811 dtp->retrieveFile( file, peeraddress, peerport, storFileSize );
809 } 812 }
810} 813}
811 814
812bool ServerPI::parsePort( const QString& pp ) 815bool ServerPI::parsePort( const QString& pp )
813{ 816{
814 QStringList p = QStringList::split( ",", pp ); 817 QStringList p = QStringList::split( ",", pp );
815 if ( p.count() != 6 ) return FALSE; 818 if ( p.count() != 6 ) return FALSE;
816 819
817 // h1,h2,h3,h4,p1,p2 820 // h1,h2,h3,h4,p1,p2
818 peeraddress = QHostAddress( ( p[0].toInt() << 24 ) + ( p[1].toInt() << 16 ) + 821 peeraddress = QHostAddress( ( p[0].toInt() << 24 ) + ( p[1].toInt() << 16 ) +
819 ( p[2].toInt() << 8 ) + p[3].toInt() ); 822 ( p[2].toInt() << 8 ) + p[3].toInt() );
820 peerport = ( p[4].toInt() << 8 ) + p[5].toInt(); 823 peerport = ( p[4].toInt() << 8 ) + p[5].toInt();
821 return TRUE; 824 return TRUE;
822} 825}
823 826
824void ServerPI::dtpCompleted() 827void ServerPI::dtpCompleted()
825{ 828{
826 send( "226 Closing data connection, file transfer successful" ); // No tr 829 send( "226 Closing data connection, file transfer successful" ); // No tr
827 if ( dtp->dtpMode() == ServerDTP::RetrieveFile ) { 830 if ( dtp->dtpMode() == ServerDTP::RetrieveFile ) {
828 QString fn = dtp->fileName(); 831 QString fn = dtp->fileName();
829 if ( fn.right(8)==".desktop" && fn.find("/Documents/")>=0 ) { 832 if ( fn.right(8)==".desktop" && fn.find("/Documents/")>=0 ) {
830 QCopEnvelope e("QPE/System", "linkChanged(QString)" ); 833 QCopEnvelope e("QPE/System", "linkChanged(QString)" );
831 e << fn; 834 e << fn;
832 } 835 }
833 } 836 }
834 waitsocket = 0; 837 waitsocket = 0;
835 dtp->close(); 838 dtp->close();
836 storFileSize = -1; 839 storFileSize = -1;
837} 840}
838 841
839void ServerPI::dtpFailed() 842void ServerPI::dtpFailed()
840{ 843{
841 dtp->close(); 844 dtp->close();
842 waitsocket = 0; 845 waitsocket = 0;
843 send( "451 Requested action aborted: local error in processing" ); // No tr 846 send( "451 Requested action aborted: local error in processing" ); // No tr
844 storFileSize = -1; 847 storFileSize = -1;
845} 848}
846 849
847void ServerPI::dtpError( int ) 850void ServerPI::dtpError( int )
848{ 851{
849 dtp->close(); 852 dtp->close();
850 waitsocket = 0; 853 waitsocket = 0;
851 send( "451 Requested action aborted: local error in processing" ); // No tr 854 send( "451 Requested action aborted: local error in processing" ); // No tr
852 storFileSize = -1; 855 storFileSize = -1;
853} 856}
854 857
855bool ServerPI::sendList( const QString& arg ) 858bool ServerPI::sendList( const QString& arg )
856{ 859{
857 QByteArray listing; 860 QByteArray listing;
858 QBuffer buffer( listing ); 861 QBuffer buffer( listing );
859 862
860 if ( !buffer.open( IO_WriteOnly ) ) 863 if ( !buffer.open( IO_WriteOnly ) )
861 return FALSE; 864 return FALSE;
862 865
863 QTextStream ts( &buffer ); 866 QTextStream ts( &buffer );
864 QString fn = arg; 867 QString fn = arg;
865 868
866 if ( fn.isEmpty() ) 869 if ( fn.isEmpty() )
867 fn = directory.path(); 870 fn = directory.path();
868 871
869 QFileInfo fi( fn ); 872 QFileInfo fi( fn );
870 if ( !fi.exists() ) return FALSE; 873 if ( !fi.exists() ) return FALSE;
871 874
872 // return file listing 875 // return file listing
873 if ( fi.isFile() ) { 876 if ( fi.isFile() ) {
874 ts << fileListing( &fi ) << endl; 877 ts << fileListing( &fi ) << endl;
875 } 878 }
876 879
877 // return directory listing 880 // return directory listing
878 else if ( fi.isDir() ) { 881 else if ( fi.isDir() ) {
879 QDir dir( fn ); 882 QDir dir( fn );
880 const QFileInfoList *list = dir.entryInfoList( QDir::All | QDir::Hidden ); 883 const QFileInfoList *list = dir.entryInfoList( QDir::All | QDir::Hidden );
881 884
882 QFileInfoListIterator it( *list ); 885 QFileInfoListIterator it( *list );
883 QFileInfo *info; 886 QFileInfo *info;
884 887
885 unsigned long total = 0; 888 unsigned long total = 0;
886 while ( ( info = it.current() ) ) { 889 while ( ( info = it.current() ) ) {
887 if ( info->fileName() != "." && info->fileName() != ".." ) 890 if ( info->fileName() != "." && info->fileName() != ".." )
888 total += info->size(); 891 total += info->size();
889 ++it; 892 ++it;
890 } 893 }
891 894
892 ts << "total " << QString::number( total / 1024 ) << endl; // No tr 895 ts << "total " << QString::number( total / 1024 ) << endl; // No tr
893 896
894 it.toFirst(); 897 it.toFirst();
895 while ( ( info = it.current() ) ) { 898 while ( ( info = it.current() ) ) {
896 if ( info->fileName() == "." || info->fileName() == ".." ) { 899 if ( info->fileName() == "." || info->fileName() == ".." ) {
897 ++it; 900 ++it;
898 continue; 901 continue;
899 } 902 }
900 ts << fileListing( info ) << endl; 903 ts << fileListing( info ) << endl;
901 ++it; 904 ++it;
902 } 905 }
903 } 906 }
904 907
905 if ( passiv ) { 908 if ( passiv ) {
906 waitarray = buffer.buffer(); 909 waitarray = buffer.buffer();
907 wait[SendByteArray] = TRUE; 910 wait[SendByteArray] = TRUE;
908 if ( waitsocket ) 911 if ( waitsocket )
909 newConnection( waitsocket ); 912 newConnection( waitsocket );
910 } 913 }
911 else 914 else
912 dtp->sendByteArray( buffer.buffer(), peeraddress, peerport ); 915 dtp->sendByteArray( buffer.buffer(), peeraddress, peerport );
913 return TRUE; 916 return TRUE;
914} 917}
915 918
916QString ServerPI::fileListing( QFileInfo *info ) 919QString ServerPI::fileListing( QFileInfo *info )
917{ 920{
918 if ( !info ) return QString::null; 921 if ( !info ) return QString::null;
919 QString s; 922 QString s;
920 923
921 // type char 924 // type char
922 if ( info->isDir() ) 925 if ( info->isDir() )
923 s += "d"; 926 s += "d";
924 else if ( info->isSymLink() ) 927 else if ( info->isSymLink() )
925 s += "l"; 928 s += "l";
926 else 929 else
927 s += "-"; 930 s += "-";
928 931
929 // permisson string 932 // permisson string
930 s += permissionString( info ) + " "; 933 s += permissionString( info ) + " ";
931 934
932 // number of hardlinks 935 // number of hardlinks
933 int subdirs = 1; 936 int subdirs = 1;
934 937
935 if ( info->isDir() ) 938 if ( info->isDir() )
936 subdirs = 2; 939 subdirs = 2;
937 // FIXME : this is to slow 940 // FIXME : this is to slow
938 //if ( info->isDir() ) 941 //if ( info->isDir() )
939 //subdirs = QDir( info->absFilePath() ).entryList( QDir::Dirs ).count(); 942 //subdirs = QDir( info->absFilePath() ).entryList( QDir::Dirs ).count();
940 943
941 s += QString::number( subdirs ).rightJustify( 3, ' ', TRUE ) + " "; 944 s += QString::number( subdirs ).rightJustify( 3, ' ', TRUE ) + " ";
942 945
943 // owner 946 // owner
944 QString o = info->owner(); 947 QString o = info->owner();
945 if ( o.isEmpty() ) 948 if ( o.isEmpty() )
946 o = QString::number(info->ownerId()); 949 o = QString::number(info->ownerId());
947 s += o.leftJustify( 8, ' ', TRUE ) + " "; 950 s += o.leftJustify( 8, ' ', TRUE ) + " ";
948 951
949 // group 952 // group
950 QString g = info->group(); 953 QString g = info->group();
951 if ( g.isEmpty() ) 954 if ( g.isEmpty() )
952 g = QString::number(info->groupId()); 955 g = QString::number(info->groupId());
953 s += g.leftJustify( 8, ' ', TRUE ) + " "; 956 s += g.leftJustify( 8, ' ', TRUE ) + " ";
954 957
955 // file size in bytes 958 // file size in bytes
956 s += QString::number( info->size() ).rightJustify( 9, ' ', TRUE ) + " "; 959 s += QString::number( info->size() ).rightJustify( 9, ' ', TRUE ) + " ";
957 960
958 // last modified date 961 // last modified date
959 QDate date = info->lastModified().date(); 962 QDate date = info->lastModified().date();
960 QTime time = info->lastModified().time(); 963 QTime time = info->lastModified().time();
961 s += date.monthName( date.month() ) + " " 964 s += date.monthName( date.month() ) + " "
962 + QString::number( date.day() ).rightJustify( 2, ' ', TRUE ) + " " 965 + QString::number( date.day() ).rightJustify( 2, ' ', TRUE ) + " "
963 + QString::number( time.hour() ).rightJustify( 2, '0', TRUE ) + ":" 966 + QString::number( time.hour() ).rightJustify( 2, '0', TRUE ) + ":"
964 + QString::number( time.minute() ).rightJustify( 2,'0', TRUE ) + " "; 967 + QString::number( time.minute() ).rightJustify( 2,'0', TRUE ) + " ";
965 968
966 // file name 969 // file name
967 s += info->fileName(); 970 s += info->fileName();
968 971
969 return s; 972 return s;
970} 973}
971 974
972QString ServerPI::permissionString( QFileInfo *info ) 975QString ServerPI::permissionString( QFileInfo *info )
973{ 976{
974 if ( !info ) return QString( "---------" ); 977 if ( !info ) return QString( "---------" );
975 QString s; 978 QString s;
976 979
977 // user 980 // user
978 if ( info->permission( QFileInfo::ReadUser ) ) s += "r"; 981 if ( info->permission( QFileInfo::ReadUser ) ) s += "r";
979 else s += "-"; 982 else s += "-";
980 if ( info->permission( QFileInfo::WriteUser ) ) s += "w"; 983 if ( info->permission( QFileInfo::WriteUser ) ) s += "w";
981 else s += "-"; 984 else s += "-";
982 if ( info->permission( QFileInfo::ExeUser ) ) s += "x"; 985 if ( info->permission( QFileInfo::ExeUser ) ) s += "x";
983 else s += "-"; 986 else s += "-";
984 987
985 // group 988 // group
986 if ( info->permission( QFileInfo::ReadGroup ) ) s += "r"; 989 if ( info->permission( QFileInfo::ReadGroup ) ) s += "r";
987 else s += "-"; 990 else s += "-";
988 if ( info->permission( QFileInfo::WriteGroup ) )s += "w"; 991 if ( info->permission( QFileInfo::WriteGroup ) )s += "w";
989 else s += "-"; 992 else s += "-";
990 if ( info->permission( QFileInfo::ExeGroup ) ) s += "x"; 993 if ( info->permission( QFileInfo::ExeGroup ) ) s += "x";
991 else s += "-"; 994 else s += "-";
992 995
993 // exec 996 // exec
994 if ( info->permission( QFileInfo::ReadOther ) ) s += "r"; 997 if ( info->permission( QFileInfo::ReadOther ) ) s += "r";
995 else s += "-"; 998 else s += "-";
996 if ( info->permission( QFileInfo::WriteOther ) ) s += "w"; 999 if ( info->permission( QFileInfo::WriteOther ) ) s += "w";
997 else s += "-"; 1000 else s += "-";
998 if ( info->permission( QFileInfo::ExeOther ) ) s += "x"; 1001 if ( info->permission( QFileInfo::ExeOther ) ) s += "x";
999 else s += "-"; 1002 else s += "-";
1000 1003
1001 return s; 1004 return s;
1002} 1005}
1003 1006
1004void ServerPI::newConnection( int socket ) 1007void ServerPI::newConnection( int socket )
1005{ 1008{
1006 //qDebug( "New incomming connection" ); 1009 //qDebug( "New incomming connection" );
1007 1010
1008 if ( !passiv ) return; 1011 if ( !passiv ) return;
1009 1012
1010 if ( wait[SendFile] ) { 1013 if ( wait[SendFile] ) {
1011 QStringList targets; 1014 QStringList targets;
1012 if ( backupRestoreGzip( waitfile, targets ) ) 1015 if ( backupRestoreGzip( waitfile, targets ) )
1013 dtp->sendGzipFile( waitfile, targets ); 1016 dtp->sendGzipFile( waitfile, targets );
1014 else 1017 else
1015 dtp->sendFile( waitfile ); 1018 dtp->sendFile( waitfile );
1016 dtp->setSocket( socket ); 1019 dtp->setSocket( socket );
1017 } 1020 }
1018 else if ( wait[RetrieveFile] ) { 1021 else if ( wait[RetrieveFile] ) {
1019 qDebug("check retrieve file"); 1022 qDebug("check retrieve file");
1020 if ( backupRestoreGzip( waitfile ) ) 1023 if ( backupRestoreGzip( waitfile ) )
1021 dtp->retrieveGzipFile( waitfile ); 1024 dtp->retrieveGzipFile( waitfile );
1022 else 1025 else
1023 dtp->retrieveFile( waitfile, storFileSize ); 1026 dtp->retrieveFile( waitfile, storFileSize );
1024 dtp->setSocket( socket ); 1027 dtp->setSocket( socket );
1025 } 1028 }
1026 else if ( wait[SendByteArray] ) { 1029 else if ( wait[SendByteArray] ) {
1027 dtp->sendByteArray( waitarray ); 1030 dtp->sendByteArray( waitarray );
1028 dtp->setSocket( socket ); 1031 dtp->setSocket( socket );
1029 } 1032 }
1030 else if ( wait[RetrieveByteArray] ) { 1033 else if ( wait[RetrieveByteArray] ) {
1031 qDebug("retrieve byte array"); 1034 qDebug("retrieve byte array");
1032 dtp->retrieveByteArray(); 1035 dtp->retrieveByteArray();
1033 dtp->setSocket( socket ); 1036 dtp->setSocket( socket );
1034 } 1037 }
1035 else 1038 else
1036 waitsocket = socket; 1039 waitsocket = socket;
1037 1040
1038 for( int i = 0; i < 4; i++ ) 1041 for( int i = 0; i < 4; i++ )
1039 wait[i] = FALSE; 1042 wait[i] = FALSE;
1040} 1043}
1041 1044
1042QString ServerPI::absFilePath( const QString& file ) 1045QString ServerPI::absFilePath( const QString& file )
1043{ 1046{
1044 if ( file.isEmpty() ) return file; 1047 if ( file.isEmpty() ) return file;
1045 1048
1046 QString filepath( file ); 1049 QString filepath( file );
1047 if ( file[0] != "/" ) 1050 if ( file[0] != "/" )
1048 filepath = directory.path() + "/" + file; 1051 filepath = directory.path() + "/" + file;
1049 1052
1050 return filepath; 1053 return filepath;
1051} 1054}
1052 1055
1053 1056
1054void ServerPI::timerEvent( QTimerEvent * ) 1057void ServerPI::timerEvent( QTimerEvent * )
1055{ 1058{
1056 connectionClosed(); 1059 connectionClosed();
1057} 1060}
1058 1061
1059 1062
1060ServerDTP::ServerDTP( QObject *parent, const char* name) 1063ServerDTP::ServerDTP( QObject *parent, const char* name)
1061 : QSocket( parent, name ), mode( Idle ), createTargzProc( 0 ), 1064 : QSocket( parent, name ), mode( Idle ), createTargzProc( 0 ),
1062 retrieveTargzProc( 0 ) 1065 retrieveTargzProc( 0 )
1063{ 1066{
1064 1067
1065 connect( this, SIGNAL( connected() ), SLOT( connected() ) ); 1068 connect( this, SIGNAL( connected() ), SLOT( connected() ) );
1066 connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) ); 1069 connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) );
1067 connect( this, SIGNAL( bytesWritten( int ) ), SLOT( bytesWritten( int ) ) ); 1070 connect( this, SIGNAL( bytesWritten( int ) ), SLOT( bytesWritten( int ) ) );
1068 connect( this, SIGNAL( readyRead() ), SLOT( readyRead() ) ); 1071 connect( this, SIGNAL( readyRead() ), SLOT( readyRead() ) );
1069 1072
1070 createTargzProc = new QProcess( QString("tar"), this, "createTargzProc"); // No tr 1073 createTargzProc = new QProcess( QString("tar"), this, "createTargzProc"); // No tr
1071 createTargzProc->setCommunication( QProcess::Stdout ); 1074 createTargzProc->setCommunication( QProcess::Stdout );
1072 createTargzProc->setWorkingDirectory( QDir::rootDirPath() ); 1075 createTargzProc->setWorkingDirectory( QDir::rootDirPath() );
1073 connect( createTargzProc, SIGNAL( processExited() ), SLOT( targzDone() ) ); 1076 connect( createTargzProc, SIGNAL( processExited() ), SLOT( targzDone() ) );
1074 1077
1075 retrieveTargzProc = new QProcess( this, "retrieveTargzProc" ); 1078 retrieveTargzProc = new QProcess( this, "retrieveTargzProc" );
1076 retrieveTargzProc->setCommunication( QProcess::Stdin ); 1079 retrieveTargzProc->setCommunication( QProcess::Stdin );
1077 retrieveTargzProc->setWorkingDirectory( QDir::rootDirPath() ); 1080 retrieveTargzProc->setWorkingDirectory( QDir::rootDirPath() );
1078 connect( retrieveTargzProc, SIGNAL( processExited() ), 1081 connect( retrieveTargzProc, SIGNAL( processExited() ),
1079 SIGNAL( completed() ) ); 1082 SIGNAL( completed() ) );
1080 connect( retrieveTargzProc, SIGNAL( processExited() ), 1083 connect( retrieveTargzProc, SIGNAL( processExited() ),
1081 SLOT( extractTarDone() ) ); 1084 SLOT( extractTarDone() ) );
1082} 1085}
1083 1086
1084ServerDTP::~ServerDTP() 1087ServerDTP::~ServerDTP()
1085{ 1088{
1086 buf.close(); 1089 buf.close();
1087 if ( RetrieveFile == mode && file.isOpen() ) { 1090 if ( RetrieveFile == mode && file.isOpen() ) {
1088 // We're being shutdown before the client closed. 1091 // We're being shutdown before the client closed.
1089 file.close(); 1092 file.close();
1090 if ( recvFileSize >= 0 && (int)file.size() != recvFileSize ) { 1093 if ( recvFileSize >= 0 && (int)file.size() != recvFileSize ) {
1091 qDebug( "STOR incomplete" ); 1094 qDebug( "STOR incomplete" );
1092 file.remove(); 1095 file.remove();
1093 } 1096 }
1094 } else { 1097 } else {
1095 file.close(); 1098 file.close();
1096 } 1099 }
1097 createTargzProc->kill(); 1100 createTargzProc->kill();
1098} 1101}
1099 1102
1100void ServerDTP::extractTarDone() 1103void ServerDTP::extractTarDone()
1101{ 1104{
1102 qDebug("extract done"); 1105 qDebug("extract done");
1103#ifndef QT_NO_COP 1106#ifndef QT_NO_COP
1104 QCopEnvelope e( "QPE/System", "restoreDone(QString)" ); 1107 QCopEnvelope e( "QPE/System", "restoreDone(QString)" );
1105 e << file.name(); 1108 e << file.name();
1106#endif 1109#endif
1107} 1110}
1108 1111
1109void ServerDTP::connected() 1112void ServerDTP::connected()
1110{ 1113{
1111 // send file mode 1114 // send file mode
1112 switch ( mode ) { 1115 switch ( mode ) {
1113 case SendFile : 1116 case SendFile :
1114 if ( !file.exists() || !file.open( IO_ReadOnly) ) { 1117 if ( !file.exists() || !file.open( IO_ReadOnly) ) {
1115 emit failed(); 1118 emit failed();
1116 mode = Idle; 1119 mode = Idle;
1117 return; 1120 return;
1118 } 1121 }
1119 1122
1120 //qDebug( "Debug: Sending file '%s'", file.name().latin1() ); 1123 //qDebug( "Debug: Sending file '%s'", file.name().latin1() );
1121 1124
1122 bytes_written = 0; 1125 bytes_written = 0;
1123 if ( file.size() == 0 ) { 1126 if ( file.size() == 0 ) {
1124 //make sure it doesn't hang on empty files 1127 //make sure it doesn't hang on empty files
1125 file.close(); 1128 file.close();
1126 emit completed(); 1129 emit completed();
1127 mode = Idle; 1130 mode = Idle;
1128 } else { 1131 } else {
1129 // Don't write more if there is plenty buffered already. 1132 // Don't write more if there is plenty buffered already.
1130 if ( bytesToWrite() <= block_size && !file.atEnd() ) { 1133 if ( bytesToWrite() <= block_size && !file.atEnd() ) {
1131 QCString s; 1134 QCString s;
1132 s.resize( block_size ); 1135 s.resize( block_size );
1133 int bytes = file.readBlock( s.data(), block_size ); 1136 int bytes = file.readBlock( s.data(), block_size );
1134 writeBlock( s.data(), bytes ); 1137 writeBlock( s.data(), bytes );
1135 } 1138 }
1136 } 1139 }
1137 break; 1140 break;
1138 case SendGzipFile: 1141 case SendGzipFile:
1139 if ( createTargzProc->isRunning() ) { 1142 if ( createTargzProc->isRunning() ) {
1140 // SHOULDN'T GET HERE, BUT DOING A SAFETY CHECK ANYWAY 1143 // SHOULDN'T GET HERE, BUT DOING A SAFETY CHECK ANYWAY
1141 qWarning("Previous tar --gzip process is still running; killing it..."); 1144 qWarning("Previous tar --gzip process is still running; killing it...");
1142 createTargzProc->kill(); 1145 createTargzProc->kill();
1143 } 1146 }
1144 1147
1145 bytes_written = 0; 1148 bytes_written = 0;
1146 qDebug("==>start send tar process"); 1149 qDebug("==>start send tar process");
1147 if ( !createTargzProc->start() ) 1150 if ( !createTargzProc->start() )
1148 qWarning("Error starting %s", 1151 qWarning("Error starting %s",
1149 createTargzProc->arguments().join(" ").latin1()); 1152 createTargzProc->arguments().join(" ").latin1());
1150 break; 1153 break;
1151 case SendBuffer: 1154 case SendBuffer:
1152 if ( !buf.open( IO_ReadOnly) ) { 1155 if ( !buf.open( IO_ReadOnly) ) {
1153 emit failed(); 1156 emit failed();
1154 mode = Idle; 1157 mode = Idle;
1155 return; 1158 return;
1156 } 1159 }
1157 1160
1158 // qDebug( "Debug: Sending byte array" ); 1161 // qDebug( "Debug: Sending byte array" );
1159 bytes_written = 0; 1162 bytes_written = 0;
1160 while( !buf.atEnd() ) 1163 while( !buf.atEnd() )
1161 putch( buf.getch() ); 1164 putch( buf.getch() );
1162 buf.close(); 1165 buf.close();
1163 break; 1166 break;
1164 case RetrieveFile: 1167 case RetrieveFile:
1165 // retrieve file mode 1168 // retrieve file mode
1166 if ( file.exists() && !file.remove() ) { 1169 if ( file.exists() && !file.remove() ) {
1167 emit failed(); 1170 emit failed();
1168 mode = Idle; 1171 mode = Idle;
1169 return; 1172 return;
1170 } 1173 }
1171 1174
1172 if ( !file.open( IO_WriteOnly) ) { 1175 if ( !file.open( IO_WriteOnly) ) {
1173 emit failed(); 1176 emit failed();
1174 mode = Idle; 1177 mode = Idle;
1175 return; 1178 return;
1176 } 1179 }
1177 // qDebug( "Debug: Retrieving file %s", file.name().latin1() ); 1180 // qDebug( "Debug: Retrieving file %s", file.name().latin1() );
1178 break; 1181 break;
1179 case RetrieveGzipFile: 1182 case RetrieveGzipFile:
1180 qDebug("=-> starting tar process to receive .tgz file"); 1183 qDebug("=-> starting tar process to receive .tgz file");
1181 break; 1184 break;
1182 case RetrieveBuffer: 1185 case RetrieveBuffer:
1183 // retrieve buffer mode 1186 // retrieve buffer mode
1184 if ( !buf.open( IO_WriteOnly) ) { 1187 if ( !buf.open( IO_WriteOnly) ) {
1185 emit failed(); 1188 emit failed();
1186 mode = Idle; 1189 mode = Idle;
1187 return; 1190 return;
1188 } 1191 }
1189 // qDebug( "Debug: Retrieving byte array" ); 1192 // qDebug( "Debug: Retrieving byte array" );
1190 break; 1193 break;
1191 case Idle: 1194 case Idle:
1192 qDebug("connection established but mode set to Idle; BUG!"); 1195 qDebug("connection established but mode set to Idle; BUG!");
1193 break; 1196 break;
1194 } 1197 }
1195} 1198}
1196 1199
1197void ServerDTP::connectionClosed() 1200void ServerDTP::connectionClosed()
1198{ 1201{
1199 //qDebug( "Debug: Data connection closed %ld bytes written", bytes_written ); 1202 //qDebug( "Debug: Data connection closed %ld bytes written", bytes_written );
1200 1203
1201 // send file mode 1204 // send file mode
1202 if ( SendFile == mode ) { 1205 if ( SendFile == mode ) {
1203 if ( bytes_written == file.size() ) 1206 if ( bytes_written == file.size() )
1204 emit completed(); 1207 emit completed();
1205 else 1208 else
1206 emit failed(); 1209 emit failed();
1207 } 1210 }
1208 1211
1209 // send buffer mode 1212 // send buffer mode
1210 else if ( SendBuffer == mode ) { 1213 else if ( SendBuffer == mode ) {
1211 if ( bytes_written == buf.size() ) 1214 if ( bytes_written == buf.size() )
1212 emit completed(); 1215 emit completed();
1213 else 1216 else
1214 emit failed(); 1217 emit failed();
1215 } 1218 }
1216 1219
1217 // retrieve file mode 1220 // retrieve file mode
1218 else if ( RetrieveFile == mode ) { 1221 else if ( RetrieveFile == mode ) {
1219 file.close(); 1222 file.close();
1220 if ( recvFileSize >= 0 && (int)file.size() != recvFileSize ) { 1223 if ( recvFileSize >= 0 && (int)file.size() != recvFileSize ) {
1221 qDebug( "STOR incomplete" ); 1224 qDebug( "STOR incomplete" );
1222 file.remove(); 1225 file.remove();
1223 emit failed(); 1226 emit failed();
1224 } else { 1227 } else {
1225 emit completed(); 1228 emit completed();
1226 } 1229 }
1227 } 1230 }
1228 1231
1229 else if ( RetrieveGzipFile == mode ) { 1232 else if ( RetrieveGzipFile == mode ) {
1230 qDebug("Done writing ungzip file; closing input"); 1233 qDebug("Done writing ungzip file; closing input");
1231 retrieveTargzProc->flushStdin(); 1234 retrieveTargzProc->flushStdin();
1232 retrieveTargzProc->closeStdin(); 1235 retrieveTargzProc->closeStdin();
1233 } 1236 }
1234 1237
1235 // retrieve buffer mode 1238 // retrieve buffer mode
1236 else if ( RetrieveBuffer == mode ) { 1239 else if ( RetrieveBuffer == mode ) {
1237 buf.close(); 1240 buf.close();
1238 emit completed(); 1241 emit completed();
1239 } 1242 }
1240 1243
1241 mode = Idle; 1244 mode = Idle;
1242} 1245}
1243 1246
1244void ServerDTP::bytesWritten( int bytes ) 1247void ServerDTP::bytesWritten( int bytes )
1245{ 1248{
1246 bytes_written += bytes; 1249 bytes_written += bytes;
1247 1250
1248 // send file mode 1251 // send file mode
1249 if ( SendFile == mode ) { 1252 if ( SendFile == mode ) {
1250 1253
1251 if ( bytes_written == file.size() ) { 1254 if ( bytes_written == file.size() ) {
1252 // qDebug( "Debug: Sending complete: %d bytes", file.size() ); 1255 // qDebug( "Debug: Sending complete: %d bytes", file.size() );
1253 file.close(); 1256 file.close();
1254 emit completed(); 1257 emit completed();
1255 mode = Idle; 1258 mode = Idle;
1256 } 1259 }
1257 else if( !file.atEnd() ) { 1260 else if( !file.atEnd() ) {
1258 QCString s; 1261 QCString s;
1259 s.resize( block_size ); 1262 s.resize( block_size );
1260 int bytes = file.readBlock( s.data(), block_size ); 1263 int bytes = file.readBlock( s.data(), block_size );
1261 writeBlock( s.data(), bytes ); 1264 writeBlock( s.data(), bytes );
1262 } 1265 }
1263 } 1266 }
1264 1267
1265 // send buffer mode 1268 // send buffer mode
1266 if ( SendBuffer == mode ) { 1269 if ( SendBuffer == mode ) {
1267 1270
1268 if ( bytes_written == buf.size() ) { 1271 if ( bytes_written == buf.size() ) {
1269 // qDebug( "Debug: Sending complete: %d bytes", buf.size() ); 1272 // qDebug( "Debug: Sending complete: %d bytes", buf.size() );
1270 emit completed(); 1273 emit completed();
1271 mode = Idle; 1274 mode = Idle;
1272 } 1275 }
1273 } 1276 }
1274} 1277}
1275 1278
1276void ServerDTP::readyRead() 1279void ServerDTP::readyRead()
1277{ 1280{
1278 // retrieve file mode 1281 // retrieve file mode
1279 if ( RetrieveFile == mode ) { 1282 if ( RetrieveFile == mode ) {
1280 QCString s; 1283 QCString s;
1281 s.resize( bytesAvailable() ); 1284 s.resize( bytesAvailable() );
1282 readBlock( s.data(), bytesAvailable() ); 1285 readBlock( s.data(), bytesAvailable() );
1283 file.writeBlock( s.data(), s.size() ); 1286 file.writeBlock( s.data(), s.size() );
1284 } 1287 }
1285 else if ( RetrieveGzipFile == mode ) { 1288 else if ( RetrieveGzipFile == mode ) {
1286 if ( !retrieveTargzProc->isRunning() ) 1289 if ( !retrieveTargzProc->isRunning() )
1287 retrieveTargzProc->start(); 1290 retrieveTargzProc->start();
1288 1291
1289 QByteArray s; 1292 QByteArray s;
1290 s.resize( bytesAvailable() ); 1293 s.resize( bytesAvailable() );
1291 readBlock( s.data(), bytesAvailable() ); 1294 readBlock( s.data(), bytesAvailable() );
1292 retrieveTargzProc->writeToStdin( s ); 1295 retrieveTargzProc->writeToStdin( s );
1293 qDebug("wrote %d bytes to ungzip ", s.size() ); 1296 qDebug("wrote %d bytes to ungzip ", s.size() );
1294 } 1297 }
1295 // retrieve buffer mode 1298 // retrieve buffer mode
1296 else if ( RetrieveBuffer == mode ) { 1299 else if ( RetrieveBuffer == mode ) {
1297 QCString s; 1300 QCString s;
1298 s.resize( bytesAvailable() ); 1301 s.resize( bytesAvailable() );
1299 readBlock( s.data(), bytesAvailable() ); 1302 readBlock( s.data(), bytesAvailable() );
1300 buf.writeBlock( s.data(), s.size() ); 1303 buf.writeBlock( s.data(), s.size() );
1301 } 1304 }
1302} 1305}
1303 1306
1304void ServerDTP::writeTargzBlock() 1307void ServerDTP::writeTargzBlock()
1305{ 1308{
1306 QByteArray block = createTargzProc->readStdout(); 1309 QByteArray block = createTargzProc->readStdout();
1307 writeBlock( block.data(), block.size() ); 1310 writeBlock( block.data(), block.size() );
1308 qDebug("writeTargzBlock %d", block.size()); 1311 qDebug("writeTargzBlock %d", block.size());
1309} 1312}
1310 1313
1311void ServerDTP::targzDone() 1314void ServerDTP::targzDone()
1312{ 1315{
1313 qDebug("tar and gzip done"); 1316 qDebug("tar and gzip done");
1314 emit completed(); 1317 emit completed();
1315 mode = Idle; 1318 mode = Idle;
1316 disconnect( createTargzProc, SIGNAL( readyReadStdout() ), 1319 disconnect( createTargzProc, SIGNAL( readyReadStdout() ),
1317 this, SLOT( writeTargzBlock() ) ); 1320 this, SLOT( writeTargzBlock() ) );
1318} 1321}
1319 1322
1320void ServerDTP::sendFile( const QString fn, const QHostAddress& host, Q_UINT16 port ) 1323void ServerDTP::sendFile( const QString fn, const QHostAddress& host, Q_UINT16 port )
1321{ 1324{
1322 file.setName( fn ); 1325 file.setName( fn );
1323 mode = SendFile; 1326 mode = SendFile;
1324 connectToHost( host.toString(), port ); 1327 connectToHost( host.toString(), port );
1325} 1328}
1326 1329
1327void ServerDTP::sendFile( const QString fn ) 1330void ServerDTP::sendFile( const QString fn )
1328{ 1331{
1329 file.setName( fn ); 1332 file.setName( fn );
1330 mode = SendFile; 1333 mode = SendFile;
1331} 1334}
1332 1335
1333void ServerDTP::sendGzipFile( const QString &fn, 1336void ServerDTP::sendGzipFile( const QString &fn,
1334 const QStringList &archiveTargets, 1337 const QStringList &archiveTargets,
1335 const QHostAddress& host, Q_UINT16 port ) 1338 const QHostAddress& host, Q_UINT16 port )
1336{ 1339{
1337 sendGzipFile( fn, archiveTargets ); 1340 sendGzipFile( fn, archiveTargets );
1338 connectToHost( host.toString(), port ); 1341 connectToHost( host.toString(), port );
1339} 1342}
1340 1343
1341void ServerDTP::sendGzipFile( const QString &fn, 1344void ServerDTP::sendGzipFile( const QString &fn,
1342 const QStringList &archiveTargets ) 1345 const QStringList &archiveTargets )
1343{ 1346{
1344 mode = SendGzipFile; 1347 mode = SendGzipFile;
1345 file.setName( fn ); 1348 file.setName( fn );
1346 1349
1347 QStringList args = "targzip"; 1350 QStringList args = "targzip";
1348 //args += "-cv"; 1351 //args += "-cv";
1349 args += archiveTargets; 1352 args += archiveTargets;
1350 qDebug("sendGzipFile %s", args.join(" ").latin1() ); 1353 qDebug("sendGzipFile %s", args.join(" ").latin1() );
1351 createTargzProc->setArguments( args ); 1354 createTargzProc->setArguments( args );
1352 connect( createTargzProc, 1355 connect( createTargzProc,
1353 SIGNAL( readyReadStdout() ), SLOT( writeTargzBlock() ) ); 1356 SIGNAL( readyReadStdout() ), SLOT( writeTargzBlock() ) );
1354} 1357}
1355 1358
1356void ServerDTP::retrieveFile( const QString fn, const QHostAddress& host, Q_UINT16 port, int fileSize ) 1359void ServerDTP::retrieveFile( const QString fn, const QHostAddress& host, Q_UINT16 port, int fileSize )
1357{ 1360{
1358 recvFileSize = fileSize; 1361 recvFileSize = fileSize;
1359 file.setName( fn ); 1362 file.setName( fn );
1360 mode = RetrieveFile; 1363 mode = RetrieveFile;
1361 connectToHost( host.toString(), port ); 1364 connectToHost( host.toString(), port );
1362} 1365}
1363 1366
1364void ServerDTP::retrieveFile( const QString fn, int fileSize ) 1367void ServerDTP::retrieveFile( const QString fn, int fileSize )
1365{ 1368{
1366 recvFileSize = fileSize; 1369 recvFileSize = fileSize;
1367 file.setName( fn ); 1370 file.setName( fn );
1368 mode = RetrieveFile; 1371 mode = RetrieveFile;
1369} 1372}
1370 1373
1371void ServerDTP::retrieveGzipFile( const QString &fn ) 1374void ServerDTP::retrieveGzipFile( const QString &fn )
1372{ 1375{
1373 qDebug("retrieveGzipFile %s", fn.latin1()); 1376 qDebug("retrieveGzipFile %s", fn.latin1());
1374 file.setName( fn ); 1377 file.setName( fn );
1375 mode = RetrieveGzipFile; 1378 mode = RetrieveGzipFile;
1376 1379
1377 retrieveTargzProc->setArguments( "targunzip" ); 1380 retrieveTargzProc->setArguments( "targunzip" );
1378 connect( retrieveTargzProc, SIGNAL( processExited() ), 1381 connect( retrieveTargzProc, SIGNAL( processExited() ),
1379 SLOT( extractTarDone() ) ); 1382 SLOT( extractTarDone() ) );
1380} 1383}
1381 1384
1382void ServerDTP::retrieveGzipFile( const QString &fn, const QHostAddress& host, Q_UINT16 port ) 1385void ServerDTP::retrieveGzipFile( const QString &fn, const QHostAddress& host, Q_UINT16 port )
1383{ 1386{
1384 retrieveGzipFile( fn ); 1387 retrieveGzipFile( fn );
1385 connectToHost( host.toString(), port ); 1388 connectToHost( host.toString(), port );
1386} 1389}
1387 1390
1388void ServerDTP::sendByteArray( const QByteArray& array, const QHostAddress& host, Q_UINT16 port ) 1391void ServerDTP::sendByteArray( const QByteArray& array, const QHostAddress& host, Q_UINT16 port )
1389{ 1392{
1390 buf.setBuffer( array ); 1393 buf.setBuffer( array );
1391 mode = SendBuffer; 1394 mode = SendBuffer;
1392 connectToHost( host.toString(), port ); 1395 connectToHost( host.toString(), port );
1393} 1396}
1394 1397
1395void ServerDTP::sendByteArray( const QByteArray& array ) 1398void ServerDTP::sendByteArray( const QByteArray& array )
1396{ 1399{
1397 buf.setBuffer( array ); 1400 buf.setBuffer( array );
1398 mode = SendBuffer; 1401 mode = SendBuffer;
1399} 1402}
1400 1403
1401void ServerDTP::retrieveByteArray( const QHostAddress& host, Q_UINT16 port ) 1404void ServerDTP::retrieveByteArray( const QHostAddress& host, Q_UINT16 port )
1402{ 1405{
1403 buf.setBuffer( QByteArray() ); 1406 buf.setBuffer( QByteArray() );
1404 mode = RetrieveBuffer; 1407 mode = RetrieveBuffer;
1405 connectToHost( host.toString(), port ); 1408 connectToHost( host.toString(), port );
1406} 1409}
1407 1410
1408void ServerDTP::retrieveByteArray() 1411void ServerDTP::retrieveByteArray()
1409{ 1412{
1410 buf.setBuffer( QByteArray() ); 1413 buf.setBuffer( QByteArray() );
1411 mode = RetrieveBuffer; 1414 mode = RetrieveBuffer;
1412} 1415}
1413 1416
1414void ServerDTP::setSocket( int socket ) 1417void ServerDTP::setSocket( int socket )
1415{ 1418{
1416 QSocket::setSocket( socket ); 1419 QSocket::setSocket( socket );
1417 connected(); 1420 connected();
1418} 1421}
1419 1422
diff --git a/core/multimedia/opieplayer/wavplugin/wavplugin.pro b/core/multimedia/opieplayer/wavplugin/wavplugin.pro
index 0366542..db41ad4 100644
--- a/core/multimedia/opieplayer/wavplugin/wavplugin.pro
+++ b/core/multimedia/opieplayer/wavplugin/wavplugin.pro
@@ -1,32 +1,32 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt warn_on release 2 CONFIG += qt plugin warn_on release
3 HEADERS = wavplugin.h wavpluginimpl.h 3 HEADERS = wavplugin.h wavpluginimpl.h
4 SOURCES = wavplugin.cpp wavpluginimpl.cpp 4 SOURCES = wavplugin.cpp wavpluginimpl.cpp
5 TARGET = wavplugin 5 TARGET = wavplugin
6 DESTDIR = $(OPIEDIR)/plugins/codecs 6 DESTDIR = $(OPIEDIR)/plugins/codecs
7INCLUDEPATH += $(OPIEDIR)/include .. 7INCLUDEPATH += $(OPIEDIR)/include ..
8DEPENDPATH += ../$(OPIEDIR)/include .. 8DEPENDPATH += ../$(OPIEDIR)/include ..
9LIBS += -lqpe 9LIBS += -lqpe
10 VERSION = 1.0.0 10 VERSION = 1.0.0
11 11
12TRANSLATIONS = ../../../../i18n/de/libwavplugin.ts \ 12TRANSLATIONS = ../../../../i18n/de/libwavplugin.ts \
13 ../../../../i18n/nl/libwavplugin.ts \ 13 ../../../../i18n/nl/libwavplugin.ts \
14 ../../../../i18n/da/libwavplugin.ts \ 14 ../../../../i18n/da/libwavplugin.ts \
15 ../../../../i18n/xx/libwavplugin.ts \ 15 ../../../../i18n/xx/libwavplugin.ts \
16 ../../../../i18n/en/libwavplugin.ts \ 16 ../../../../i18n/en/libwavplugin.ts \
17 ../../../../i18n/es/libwavplugin.ts \ 17 ../../../../i18n/es/libwavplugin.ts \
18 ../../../../i18n/fr/libwavplugin.ts \ 18 ../../../../i18n/fr/libwavplugin.ts \
19 ../../../../i18n/hu/libwavplugin.ts \ 19 ../../../../i18n/hu/libwavplugin.ts \
20 ../../../../i18n/ja/libwavplugin.ts \ 20 ../../../../i18n/ja/libwavplugin.ts \
21 ../../../../i18n/ko/libwavplugin.ts \ 21 ../../../../i18n/ko/libwavplugin.ts \
22 ../../../../i18n/no/libwavplugin.ts \ 22 ../../../../i18n/no/libwavplugin.ts \
23 ../../../../i18n/pl/libwavplugin.ts \ 23 ../../../../i18n/pl/libwavplugin.ts \
24 ../../../../i18n/pt/libwavplugin.ts \ 24 ../../../../i18n/pt/libwavplugin.ts \
25 ../../../../i18n/pt_BR/libwavplugin.ts \ 25 ../../../../i18n/pt_BR/libwavplugin.ts \
26 ../../../../i18n/sl/libwavplugin.ts \ 26 ../../../../i18n/sl/libwavplugin.ts \
27 ../../../../i18n/zh_CN/libwavplugin.ts \ 27 ../../../../i18n/zh_CN/libwavplugin.ts \
28 ../../../../i18n/zh_TW/libwavplugin.ts 28 ../../../../i18n/zh_TW/libwavplugin.ts
29 29
30 30
31 31
32include ( $(OPIEDIR)/include.pro ) 32include ( $(OPIEDIR)/include.pro )
diff --git a/core/pim/today/plugins/addressbook/addressbook.pro b/core/pim/today/plugins/addressbook/addressbook.pro
index 4ebbc9e..54aaff2 100644
--- a/core/pim/today/plugins/addressbook/addressbook.pro
+++ b/core/pim/today/plugins/addressbook/addressbook.pro
@@ -1,43 +1,43 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG -= moc 2CONFIG -= moc
3CONFIG += qt release 3CONFIG += qt plugin release
4 4
5# Input 5# Input
6HEADERS = addressplugin.h addresspluginimpl.h addresspluginconfig.h \ 6HEADERS = addressplugin.h addresspluginimpl.h addresspluginconfig.h \
7 addresspluginwidget.h 7 addresspluginwidget.h
8SOURCES = addressplugin.cpp addresspluginimpl.cpp addresspluginconfig.cpp \ 8SOURCES = addressplugin.cpp addresspluginimpl.cpp addresspluginconfig.cpp \
9 addresspluginwidget.cpp 9 addresspluginwidget.cpp
10 10
11INCLUDEPATH += $(OPIEDIR)/include \ 11INCLUDEPATH += $(OPIEDIR)/include \
12 ../ ../library 12 ../ ../library
13DEPENDPATH += $(OPIEDIR)/include \ 13DEPENDPATH += $(OPIEDIR)/include \
14 ../ ../library 14 ../ ../library
15 15
16LIBS+= -lqpe -lopie 16LIBS+= -lqpe -lopie
17 17
18DESTDIR = $(OPIEDIR)/plugins/today 18DESTDIR = $(OPIEDIR)/plugins/today
19TARGET = todayaddressbookplugin 19TARGET = todayaddressbookplugin
20 20
21TRANSLATIONS = ../../../../../i18n/de/libtodayaddressbookplugin.ts \ 21TRANSLATIONS = ../../../../../i18n/de/libtodayaddressbookplugin.ts \
22 ../../../../../i18n/nl/libtodayaddressbookplugin.ts \ 22 ../../../../../i18n/nl/libtodayaddressbookplugin.ts \
23 ../../../../../i18n/xx/libtodayaddressbookplugin.ts \ 23 ../../../../../i18n/xx/libtodayaddressbookplugin.ts \
24 ../../../../../i18n/en/libtodayaddressbookplugin.ts \ 24 ../../../../../i18n/en/libtodayaddressbookplugin.ts \
25 ../../../../../i18n/es/libtodayaddressbookplugin.ts \ 25 ../../../../../i18n/es/libtodayaddressbookplugin.ts \
26 ../../../../../i18n/fr/libtodayaddressbookplugin.ts \ 26 ../../../../../i18n/fr/libtodayaddressbookplugin.ts \
27 ../../../../../i18n/hu/libtodayaddressbookplugin.ts \ 27 ../../../../../i18n/hu/libtodayaddressbookplugin.ts \
28 ../../../../../i18n/ja/libtodayaddressbookplugin.ts \ 28 ../../../../../i18n/ja/libtodayaddressbookplugin.ts \
29 ../../../../../i18n/ko/libtodayaddressbookplugin.ts \ 29 ../../../../../i18n/ko/libtodayaddressbookplugin.ts \
30 ../../../../../i18n/no/libtodayaddressbookplugin.ts \ 30 ../../../../../i18n/no/libtodayaddressbookplugin.ts \
31 ../../../../../i18n/pl/libtodayaddressbookplugin.ts \ 31 ../../../../../i18n/pl/libtodayaddressbookplugin.ts \
32 ../../../../../i18n/pt/libtodayaddressbookplugin.ts \ 32 ../../../../../i18n/pt/libtodayaddressbookplugin.ts \
33 ../../../../../i18n/pt_BR/libtodayaddressbookplugin.ts \ 33 ../../../../../i18n/pt_BR/libtodayaddressbookplugin.ts \
34 ../../../../../i18n/sl/libtodayaddressbookplugin.ts \ 34 ../../../../../i18n/sl/libtodayaddressbookplugin.ts \
35 ../../../../../i18n/zh_CN/libtodayaddressbookplugin.ts \ 35 ../../../../../i18n/zh_CN/libtodayaddressbookplugin.ts \
36 ../../../../../i18n/zh_TW/libtodayaddressbookplugin.ts \ 36 ../../../../../i18n/zh_TW/libtodayaddressbookplugin.ts \
37 ../../../../../i18n/it/libtodayaddressbookplugin.ts \ 37 ../../../../../i18n/it/libtodayaddressbookplugin.ts \
38 ../../../../../i18n/da/libtodayaddressbookplugin.ts 38 ../../../../../i18n/da/libtodayaddressbookplugin.ts
39 39
40 40
41 41
42 42
43include ( $(OPIEDIR)/include.pro ) 43include ( $(OPIEDIR)/include.pro )
diff --git a/core/pim/today/plugins/datebook/datebook.pro b/core/pim/today/plugins/datebook/datebook.pro
index e0a1dcb..2139f63 100644
--- a/core/pim/today/plugins/datebook/datebook.pro
+++ b/core/pim/today/plugins/datebook/datebook.pro
@@ -1,39 +1,39 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG -= moc 2CONFIG -= moc
3CONFIG += qt release 3CONFIG += qt plugin release
4# Input 4# Input
5HEADERS = datebookplugin.h datebookpluginimpl.h datebookpluginconfig.h \ 5HEADERS = datebookplugin.h datebookpluginimpl.h datebookpluginconfig.h \
6 datebookevent.h datebookpluginwidget.h 6 datebookevent.h datebookpluginwidget.h
7SOURCES = datebookplugin.cpp datebookpluginimpl.cpp datebookpluginconfig.cpp \ 7SOURCES = datebookplugin.cpp datebookpluginimpl.cpp datebookpluginconfig.cpp \
8 datebookevent.cpp datebookpluginwidget.cpp 8 datebookevent.cpp datebookpluginwidget.cpp
9 9
10INCLUDEPATH += $(OPIEDIR)/include \ 10INCLUDEPATH += $(OPIEDIR)/include \
11 ../ ../library 11 ../ ../library
12DEPENDPATH += $(OPIEDIR)/include \ 12DEPENDPATH += $(OPIEDIR)/include \
13 ../ ../library 13 ../ ../library
14 14
15LIBS+= -lqpe -lopie 15LIBS+= -lqpe -lopie
16 16
17DESTDIR = $(OPIEDIR)/plugins/today 17DESTDIR = $(OPIEDIR)/plugins/today
18TARGET = todaydatebookplugin 18TARGET = todaydatebookplugin
19 19
20TRANSLATIONS = ../../../../../i18n/de/libtodaydatebookplugin.ts \ 20TRANSLATIONS = ../../../../../i18n/de/libtodaydatebookplugin.ts \
21 ../../../../../i18n/nl/libtodaydatebookplugin.ts \ 21 ../../../../../i18n/nl/libtodaydatebookplugin.ts \
22 ../../../../../i18n/xx/libtodaydatebookplugin.ts \ 22 ../../../../../i18n/xx/libtodaydatebookplugin.ts \
23 ../../../../../i18n/en/libtodaydatebookplugin.ts \ 23 ../../../../../i18n/en/libtodaydatebookplugin.ts \
24 ../../../../../i18n/es/libtodaydatebookplugin.ts \ 24 ../../../../../i18n/es/libtodaydatebookplugin.ts \
25 ../../../../../i18n/fr/libtodaydatebookplugin.ts \ 25 ../../../../../i18n/fr/libtodaydatebookplugin.ts \
26 ../../../../../i18n/hu/libtodaydatebookplugin.ts \ 26 ../../../../../i18n/hu/libtodaydatebookplugin.ts \
27 ../../../../../i18n/ja/libtodaydatebookplugin.ts \ 27 ../../../../../i18n/ja/libtodaydatebookplugin.ts \
28 ../../../../../i18n/ko/libtodaydatebookplugin.ts \ 28 ../../../../../i18n/ko/libtodaydatebookplugin.ts \
29 ../../../../../i18n/no/libtodaydatebookplugin.ts \ 29 ../../../../../i18n/no/libtodaydatebookplugin.ts \
30 ../../../../../i18n/pl/libtodaydatebookplugin.ts \ 30 ../../../../../i18n/pl/libtodaydatebookplugin.ts \
31 ../../../../../i18n/pt/libtodaydatebookplugin.ts \ 31 ../../../../../i18n/pt/libtodaydatebookplugin.ts \
32 ../../../../../i18n/pt_BR/libtodaydatebookplugin.ts \ 32 ../../../../../i18n/pt_BR/libtodaydatebookplugin.ts \
33 ../../../../../i18n/sl/libtodaydatebookplugin.ts \ 33 ../../../../../i18n/sl/libtodaydatebookplugin.ts \
34 ../../../../../i18n/zh_CN/libtodaydatebookplugin.ts \ 34 ../../../../../i18n/zh_CN/libtodaydatebookplugin.ts \
35 ../../../../../i18n/zh_TW/libtodaydatebookplugin.ts \ 35 ../../../../../i18n/zh_TW/libtodaydatebookplugin.ts \
36 ../../../../../i18n/it/libtodaydatebookplugin.ts \ 36 ../../../../../i18n/it/libtodaydatebookplugin.ts \
37 ../../../../../i18n/da/libtodaydatebookplugin.ts 37 ../../../../../i18n/da/libtodaydatebookplugin.ts
38 38
39include ( $(OPIEDIR)/include.pro ) 39include ( $(OPIEDIR)/include.pro )
diff --git a/core/pim/today/plugins/mail/mail.pro b/core/pim/today/plugins/mail/mail.pro
index 70c484d..421b3a5 100644
--- a/core/pim/today/plugins/mail/mail.pro
+++ b/core/pim/today/plugins/mail/mail.pro
@@ -1,37 +1,37 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG -= moc 2CONFIG -= moc
3CONFIG += qt release 3CONFIG += qt plugin release
4 4
5# Input 5# Input
6HEADERS = mailplugin.h mailpluginimpl.h mailpluginwidget.h 6HEADERS = mailplugin.h mailpluginimpl.h mailpluginwidget.h
7SOURCES = mailplugin.cpp mailpluginimpl.cpp mailpluginwidget.cpp 7SOURCES = mailplugin.cpp mailpluginimpl.cpp mailpluginwidget.cpp
8 8
9INCLUDEPATH += $(OPIEDIR)/include \ 9INCLUDEPATH += $(OPIEDIR)/include \
10 ../ ../library 10 ../ ../library
11DEPENDPATH += $(OPIEDIR)/include \ 11DEPENDPATH += $(OPIEDIR)/include \
12 ../ ../library 12 ../ ../library
13 13
14LIBS+= -lqpe -lopie 14LIBS+= -lqpe -lopie
15 15
16DESTDIR = $(OPIEDIR)/plugins/today 16DESTDIR = $(OPIEDIR)/plugins/today
17TARGET = todaymailplugin 17TARGET = todaymailplugin
18 18
19TRANSLATIONS = ../../../../../i18n/de/libtodaymailplugin.ts \ 19TRANSLATIONS = ../../../../../i18n/de/libtodaymailplugin.ts \
20 ../../../../../i18n/nl/libtodaymailplugin.ts \ 20 ../../../../../i18n/nl/libtodaymailplugin.ts \
21 ../../../../../i18n/xx/libtodaymailplugin.ts \ 21 ../../../../../i18n/xx/libtodaymailplugin.ts \
22 ../../../../../i18n/en/libtodaymailplugin.ts \ 22 ../../../../../i18n/en/libtodaymailplugin.ts \
23 ../../../../../i18n/es/libtodaymailplugin.ts \ 23 ../../../../../i18n/es/libtodaymailplugin.ts \
24 ../../../../../i18n/fr/libtodaymailplugin.ts \ 24 ../../../../../i18n/fr/libtodaymailplugin.ts \
25 ../../../../../i18n/hu/libtodaymailplugin.ts \ 25 ../../../../../i18n/hu/libtodaymailplugin.ts \
26 ../../../../../i18n/ja/libtodaymailplugin.ts \ 26 ../../../../../i18n/ja/libtodaymailplugin.ts \
27 ../../../../../i18n/ko/libtodaymailplugin.ts \ 27 ../../../../../i18n/ko/libtodaymailplugin.ts \
28 ../../../../../i18n/no/libtodaymailplugin.ts \ 28 ../../../../../i18n/no/libtodaymailplugin.ts \
29 ../../../../../i18n/pl/libtodaymailplugin.ts \ 29 ../../../../../i18n/pl/libtodaymailplugin.ts \
30 ../../../../../i18n/pt/libtodaymailplugin.ts \ 30 ../../../../../i18n/pt/libtodaymailplugin.ts \
31 ../../../../../i18n/pt_BR/libtodaymailplugin.ts \ 31 ../../../../../i18n/pt_BR/libtodaymailplugin.ts \
32 ../../../../../i18n/sl/libtodaymailplugin.ts \ 32 ../../../../../i18n/sl/libtodaymailplugin.ts \
33 ../../../../../i18n/zh_CN/libtodaymailplugin.ts \ 33 ../../../../../i18n/zh_CN/libtodaymailplugin.ts \
34 ../../../../../i18n/zh_TW/libtodaymailplugin.ts \ 34 ../../../../../i18n/zh_TW/libtodaymailplugin.ts \
35 ../../../../../i18n/it/libtodaymailplugin.ts \ 35 ../../../../../i18n/it/libtodaymailplugin.ts \
36 ../../../../../i18n/da/libtodaymailplugin.ts 36 ../../../../../i18n/da/libtodaymailplugin.ts
37include ( $(OPIEDIR)/include.pro ) 37include ( $(OPIEDIR)/include.pro )
diff --git a/core/pim/today/plugins/todolist/todolist.pro b/core/pim/today/plugins/todolist/todolist.pro
index 31a6a27..c8730bb 100644
--- a/core/pim/today/plugins/todolist/todolist.pro
+++ b/core/pim/today/plugins/todolist/todolist.pro
@@ -1,40 +1,40 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG -= moc 2CONFIG -= moc
3CONFIG += qt release 3CONFIG += qt plugin release
4 4
5# Input 5# Input
6HEADERS = todoplugin.h todopluginimpl.h todopluginconfig.h \ 6HEADERS = todoplugin.h todopluginimpl.h todopluginconfig.h \
7 todopluginwidget.h 7 todopluginwidget.h
8SOURCES = todoplugin.cpp todopluginimpl.cpp todopluginconfig.cpp \ 8SOURCES = todoplugin.cpp todopluginimpl.cpp todopluginconfig.cpp \
9 todopluginwidget.cpp 9 todopluginwidget.cpp
10 10
11INCLUDEPATH += $(OPIEDIR)/include \ 11INCLUDEPATH += $(OPIEDIR)/include \
12 ../ ../library 12 ../ ../library
13DEPENDPATH += $(OPIEDIR)/include \ 13DEPENDPATH += $(OPIEDIR)/include \
14 ../ ../library 14 ../ ../library
15 15
16LIBS+= -lqpe -lopie 16LIBS+= -lqpe -lopie
17 17
18DESTDIR = $(OPIEDIR)/plugins/today 18DESTDIR = $(OPIEDIR)/plugins/today
19TARGET = todaytodolistplugin 19TARGET = todaytodolistplugin
20 20
21TRANSLATIONS = ../../../../../i18n/de/libtodaytodolistplugin.ts \ 21TRANSLATIONS = ../../../../../i18n/de/libtodaytodolistplugin.ts \
22 ../../../../../i18n/nl/libtodaytodolistplugin.ts \ 22 ../../../../../i18n/nl/libtodaytodolistplugin.ts \
23 ../../../../../i18n/xx/libtodaytodolistplugin.ts \ 23 ../../../../../i18n/xx/libtodaytodolistplugin.ts \
24 ../../../../../i18n/en/libtodaytodolistplugin.ts \ 24 ../../../../../i18n/en/libtodaytodolistplugin.ts \
25 ../../../../../i18n/es/libtodaytodolistplugin.ts \ 25 ../../../../../i18n/es/libtodaytodolistplugin.ts \
26 ../../../../../i18n/fr/libtodaytodolistplugin.ts \ 26 ../../../../../i18n/fr/libtodaytodolistplugin.ts \
27 ../../../../../i18n/hu/libtodaytodolistplugin.ts \ 27 ../../../../../i18n/hu/libtodaytodolistplugin.ts \
28 ../../../../../i18n/ja/libtodaytodolistplugin.ts \ 28 ../../../../../i18n/ja/libtodaytodolistplugin.ts \
29 ../../../../../i18n/ko/libtodaytodolistplugin.ts \ 29 ../../../../../i18n/ko/libtodaytodolistplugin.ts \
30 ../../../../../i18n/no/libtodaytodolistplugin.ts \ 30 ../../../../../i18n/no/libtodaytodolistplugin.ts \
31 ../../../../../i18n/pl/libtodaytodolistplugin.ts \ 31 ../../../../../i18n/pl/libtodaytodolistplugin.ts \
32 ../../../../../i18n/pt/libtodaytodolistplugin.ts \ 32 ../../../../../i18n/pt/libtodaytodolistplugin.ts \
33 ../../../../../i18n/pt_BR/libtodaytodolistplugin.ts \ 33 ../../../../../i18n/pt_BR/libtodaytodolistplugin.ts \
34 ../../../../../i18n/sl/libtodaytodolistplugin.ts \ 34 ../../../../../i18n/sl/libtodaytodolistplugin.ts \
35 ../../../../../i18n/zh_CN/libtodaytodolistplugin.ts \ 35 ../../../../../i18n/zh_CN/libtodaytodolistplugin.ts \
36 ../../../../../i18n/zh_TW/libtodaytodolistplugin.ts \ 36 ../../../../../i18n/zh_TW/libtodaytodolistplugin.ts \
37 ../../../../../i18n/it/libtodaytodolistplugin.ts \ 37 ../../../../../i18n/it/libtodaytodolistplugin.ts \
38 ../../../../../i18n/da/libtodaytodolistplugin.ts 38 ../../../../../i18n/da/libtodaytodolistplugin.ts
39 39
40include ( $(OPIEDIR)/include.pro ) 40include ( $(OPIEDIR)/include.pro )
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index f213943..cb18c1c 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -1,402 +1,409 @@
1/* 1/*
2 * today.cpp 2 * today.cpp
3 * 3 *
4 * copyright : (c) 2002,2003 by Maximilian Reiß 4 * copyright : (c) 2002,2003 by Maximilian Reiß
5 * email : harlekin@handhelds.org 5 * email : harlekin@handhelds.org
6 * 6 *
7 */ 7 */
8/*************************************************************************** 8/***************************************************************************
9 * * 9 * *
10 * This program is free software; you can redistribute it and/or modify * 10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by * 11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or * 12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. * 13 * (at your option) any later version. *
14 * * 14 * *
15 ***************************************************************************/ 15 ***************************************************************************/
16 16
17 17
18 18
19#define QTOPIA_INTERNAL_LANGLIST 19#define QTOPIA_INTERNAL_LANGLIST
20 20
21#include "today.h" 21#include "today.h"
22 22
23#include <qpe/config.h> 23#include <qpe/config.h>
24#include <qpe/qcopenvelope_qws.h> 24#include <qpe/qcopenvelope_qws.h>
25#include <qpe/resource.h> 25#include <qpe/resource.h>
26#include <qpe/global.h> 26#include <qpe/global.h>
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28#include <qpe/contact.h> 28#include <qpe/contact.h>
29#include <qpe/timestring.h> 29#include <qpe/timestring.h>
30 30
31#include <qdir.h> 31#include <qdir.h>
32#include <qfile.h> 32#include <qfile.h>
33#include <qtimer.h> 33#include <qtimer.h>
34#include <qwhatsthis.h> 34#include <qwhatsthis.h>
35#include <qtranslator.h> 35#include <qtranslator.h>
36 36
37struct TodayPlugin { 37struct TodayPlugin {
38 TodayPlugin() : library( 0 ), iface( 0 ), guiPart( 0 ), guiBox( 0 ) {} 38 TodayPlugin() : library( 0 ), iface( 0 ), guiPart( 0 ), guiBox( 0 ) {}
39 QLibrary *library; 39 QLibrary *library;
40 QInterfacePtr<TodayPluginInterface> iface; 40 QInterfacePtr<TodayPluginInterface> iface;
41 TodayPluginObject *guiPart; 41 TodayPluginObject *guiPart;
42 QWidget *guiBox; 42 QWidget *guiBox;
43 QString name; 43 QString name;
44 bool active; 44 bool active;
45 bool excludeRefresh; 45 bool excludeRefresh;
46 int pos; 46 int pos;
47}; 47};
48 48
49static QValueList<TodayPlugin> pluginList; 49static QValueList<TodayPlugin> pluginList;
50 50
51Today::Today( QWidget* parent, const char* name, WFlags fl ) 51Today::Today( QWidget* parent, const char* name, WFlags fl )
52 : TodayBase( parent, name, fl ) { 52 : TodayBase( parent, name, fl ) {
53 53
54 QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); 54 QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) );
55 QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); 55 QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) );
56 56
57#if defined(Q_WS_QWS) 57#if defined(Q_WS_QWS)
58#if !defined(QT_NO_COP) 58#if !defined(QT_NO_COP)
59 QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); 59 QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this );
60 connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ), 60 connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ),
61 this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); 61 this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) );
62#endif 62#endif
63#endif 63#endif
64 64
65 setOwnerField(); 65 setOwnerField();
66 m_refreshTimer = new QTimer( this ); 66 m_refreshTimer = new QTimer( this );
67 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 67 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
68 m_refreshTimer->start( 15000 ); 68 m_refreshTimer->start( 15000 );
69 //init(); 69 //init();
70 loadPlugins(); 70 loadPlugins();
71 showMaximized(); 71 showMaximized();
72} 72}
73 73
74/** 74/**
75 * Qcop receive method. 75 * Qcop receive method.
76 */ 76 */
77void Today::channelReceived( const QCString &msg, const QByteArray & data ) { 77void Today::channelReceived( const QCString &msg, const QByteArray & data ) {
78 QDataStream stream( data, IO_ReadOnly ); 78 QDataStream stream( data, IO_ReadOnly );
79 if ( msg == "message(QString)" ) { 79 if ( msg == "message(QString)" ) {
80 QString message; 80 QString message;
81 stream >> message; 81 stream >> message;
82 setOwnerField( message ); 82 setOwnerField( message );
83 } 83 }
84} 84}
85 85
86void Today::setRefreshTimer( int interval ) { 86void Today::setRefreshTimer( int interval ) {
87 87
88 disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 88 disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
89 89
90 // 0 is "never" case 90 // 0 is "never" case
91 if ( !interval == 0 ) { 91 if ( !interval == 0 ) {
92 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 92 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
93 m_refreshTimer->changeInterval( interval ); 93 m_refreshTimer->changeInterval( interval );
94 } 94 }
95} 95}
96 96
97 97
98/** 98/**
99 * Initialises the owner field with the default value, the username 99 * Initialises the owner field with the default value, the username
100 */ 100 */
101void Today::setOwnerField() { 101void Today::setOwnerField() {
102 QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" ); 102 QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" );
103 if ( QFile::exists( file ) ) { 103 if ( QFile::exists( file ) ) {
104 Contact cont = Contact::readVCard( file )[0]; 104 Contact cont = Contact::readVCard( file )[0];
105 QString returnString = cont.fullName(); 105 QString returnString = cont.fullName();
106 OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" ); 106 OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" );
107 } else { 107 } else {
108 OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" ); 108 OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" );
109 } 109 }
110} 110}
111 111
112/** 112/**
113 * Set the owner field with a given QString, for example per qcop. 113 * Set the owner field with a given QString, for example per qcop.
114 */ 114 */
115void Today::setOwnerField( QString &message ) { 115void Today::setOwnerField( QString &message ) {
116 if ( !message.isEmpty() ) { 116 if ( !message.isEmpty() ) {
117 OwnerField->setText( "<b>" + message + "</b>" ); 117 OwnerField->setText( "<b>" + message + "</b>" );
118 } 118 }
119} 119}
120 120
121/** 121/**
122 * Init stuff needed for today. Reads the config file. 122 * Init stuff needed for today. Reads the config file.
123 */ 123 */
124void Today::init() { 124void Today::init() {
125 // read config 125 // read config
126 Config cfg( "today" ); 126 Config cfg( "today" );
127 127
128 cfg.setGroup( "Plugins" ); 128 cfg.setGroup( "Plugins" );
129 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); 129 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' );
130 m_allApplets = cfg.readListEntry( "AllApplets", ',' ); 130 m_allApplets = cfg.readListEntry( "AllApplets", ',' );
131 131
132 cfg.setGroup( "General" ); 132 cfg.setGroup( "General" );
133 m_iconSize = cfg.readNumEntry( "IconSize", 18 ); 133 m_iconSize = cfg.readNumEntry( "IconSize", 18 );
134 m_hideBanner = cfg.readNumEntry( "HideBanner", 0 ); 134 m_hideBanner = cfg.readNumEntry( "HideBanner", 0 );
135 setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) ); 135 setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) );
136 136
137 // set the date in top label 137 // set the date in top label
138 QDate date = QDate::currentDate(); 138 QDate date = QDate::currentDate();
139 DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( date ) + "</font>" ) ); 139 DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( date ) + "</font>" ) );
140 140
141 if ( layout ) { 141 if ( layout ) {
142 delete layout; 142 delete layout;
143 } 143 }
144 144
145 if ( m_hideBanner ) { 145 if ( m_hideBanner ) {
146 Opiezilla->hide(); 146 Opiezilla->hide();
147 TodayLabel->hide(); 147 TodayLabel->hide();
148 } else { 148 } else {
149 Opiezilla->show(); 149 Opiezilla->show();
150 TodayLabel->show(); 150 TodayLabel->show();
151 } 151 }
152 152
153 layout = new QVBoxLayout( this ); 153 layout = new QVBoxLayout( this );
154 layout->addWidget( Frame ); 154 layout->addWidget( Frame );
155 layout->addWidget( OwnerField ); 155 layout->addWidget( OwnerField );
156} 156}
157 157
158/** 158/**
159 * Load the plugins 159 * Load the plugins
160 */ 160 */
161void Today::loadPlugins() { 161void Today::loadPlugins() {
162 162
163 init(); 163 init();
164 QValueList<TodayPlugin>::Iterator tit; 164 QValueList<TodayPlugin>::Iterator tit;
165 if ( !pluginList.isEmpty() ) { 165 if ( !pluginList.isEmpty() ) {
166 for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { 166 for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) {
167 (*tit).guiBox->hide(); 167 (*tit).guiBox->hide();
168 (*tit).guiBox->reparent( 0, QPoint( 0, 0 ) ); 168 (*tit).guiBox->reparent( 0, QPoint( 0, 0 ) );
169 delete (*tit).guiBox; 169 delete (*tit).guiBox;
170 (*tit).library->unload(); 170 (*tit).library->unload();
171 delete (*tit).library; 171 delete (*tit).library;
172 } 172 }
173 pluginList.clear(); 173 pluginList.clear();
174 } 174 }
175 175
176 QString path = QPEApplication::qpeDir() + "/plugins/today"; 176 QString path = QPEApplication::qpeDir() + "/plugins/today";
177 qWarning("Searching for Plugins in: %s", path.latin1());
178#ifdef Q_OS_MACX
179 QDir dir( path, "lib*.dylib" );
180#else
177 QDir dir( path, "lib*.so" ); 181 QDir dir( path, "lib*.so" );
182#endif
178 183
179 QStringList list = dir.entryList(); 184 QStringList list = dir.entryList();
180 QStringList::Iterator it; 185 QStringList::Iterator it;
181 186
187 qWarning("Found: %d entries !", list.count() );
188
182 QMap<QString, TodayPlugin> tempList; 189 QMap<QString, TodayPlugin> tempList;
183 190
184 for ( it = list.begin(); it != list.end(); ++it ) { 191 for ( it = list.begin(); it != list.end(); ++it ) {
185 QInterfacePtr<TodayPluginInterface> iface; 192 QInterfacePtr<TodayPluginInterface> iface;
186 QLibrary *lib = new QLibrary( path + "/" + *it ); 193 QLibrary *lib = new QLibrary( path + "/" + *it );
187 194
188 qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); 195 qDebug( "querying: %s", QString( path + "/" + *it ).latin1() );
189 if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { 196 if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) {
190 qDebug( "accepted: %s", QString( path + "/" + *it ).latin1() ); 197 qDebug( "accepted: %s", QString( path + "/" + *it ).latin1() );
191 qDebug( QString(*it) ); 198 qDebug( QString(*it) );
192 199
193 TodayPlugin plugin; 200 TodayPlugin plugin;
194 plugin.library = lib; 201 plugin.library = lib;
195 plugin.iface = iface; 202 plugin.iface = iface;
196 plugin.name = QString(*it); 203 plugin.name = QString(*it);
197 204
198 QString type = (*it).left( (*it).find(".") ); 205 QString type = (*it).left( (*it).find(".") );
199 206
200 // grr, sharp rom does not know Global::languageList(); 207 // grr, sharp rom does not know Global::languageList();
201 // QStringList langs = Global::languageList(); 208 // QStringList langs = Global::languageList();
202 QString tfn = QPEApplication::qpeDir() + "/i18n/"; 209 QString tfn = QPEApplication::qpeDir() + "/i18n/";
203 QDir langDir = tfn; 210 QDir langDir = tfn;
204 QStringList langs = langDir.entryList("*", QDir::Dirs ); 211 QStringList langs = langDir.entryList("*", QDir::Dirs );
205 212
206 for (QStringList::ConstIterator lit = langs.begin(); lit!=langs.end(); ++lit) { 213 for (QStringList::ConstIterator lit = langs.begin(); lit!=langs.end(); ++lit) {
207 QString lang = *lit; 214 QString lang = *lit;
208 qDebug( "Languages: " + lang ); 215 qDebug( "Languages: " + lang );
209 QTranslator * trans = new QTranslator( qApp ); 216 QTranslator * trans = new QTranslator( qApp );
210 QString tfn = QPEApplication::qpeDir()+"/i18n/" + lang + "/" + type + ".qm"; 217 QString tfn = QPEApplication::qpeDir()+"/i18n/" + lang + "/" + type + ".qm";
211 if ( trans->load( tfn ) ) { 218 if ( trans->load( tfn ) ) {
212 qApp->installTranslator( trans ); 219 qApp->installTranslator( trans );
213 } else { 220 } else {
214 delete trans; 221 delete trans;
215 } 222 }
216 } 223 }
217 224
218 // find out if plugins should be shown 225 // find out if plugins should be shown
219 if ( m_excludeApplets.grep( *it ).isEmpty() ) { 226 if ( m_excludeApplets.grep( *it ).isEmpty() ) {
220 plugin.active = true; 227 plugin.active = true;
221 } else { 228 } else {
222 plugin.active = false; 229 plugin.active = false;
223 } 230 }
224 231
225 plugin.guiPart = plugin.iface->guiPart(); 232 plugin.guiPart = plugin.iface->guiPart();
226 plugin.excludeRefresh = plugin.guiPart->excludeFromRefresh(); 233 plugin.excludeRefresh = plugin.guiPart->excludeFromRefresh();
227 234
228 // package the whole thing into a qwidget so it can be shown and hidden 235 // package the whole thing into a qwidget so it can be shown and hidden
229 plugin.guiBox = new QWidget( this ); 236 plugin.guiBox = new QWidget( this );
230 QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); 237 QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox );
231 QPixmap plugPix; 238 QPixmap plugPix;
232 plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( m_iconSize, m_iconSize ), 0 ); 239 plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( m_iconSize, m_iconSize ), 0 );
233 OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); 240 OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox );
234 plugIcon->setPixmap( plugPix ); 241 plugIcon->setPixmap( plugPix );
235 QWhatsThis::add( plugIcon, tr("Click here to launch the associated app") ); 242 QWhatsThis::add( plugIcon, tr("Click here to launch the associated app") );
236 plugIcon->setName( plugin.guiPart->appName() ); 243 plugIcon->setName( plugin.guiPart->appName() );
237 connect( plugIcon, SIGNAL( clicked() ), this, SLOT( startApplication() ) ); 244 connect( plugIcon, SIGNAL( clicked() ), this, SLOT( startApplication() ) );
238 // a scrollview for each plugin 245 // a scrollview for each plugin
239 QScrollView* sv = new QScrollView( plugin.guiBox ); 246 QScrollView* sv = new QScrollView( plugin.guiBox );
240 QWidget *plugWidget = plugin.guiPart->widget( sv->viewport() ); 247 QWidget *plugWidget = plugin.guiPart->widget( sv->viewport() );
241 // not sure if that is good .-) 248 // not sure if that is good .-)
242 sv->setMinimumHeight( 12 ); 249 sv->setMinimumHeight( 12 );
243 sv->setResizePolicy( QScrollView::AutoOneFit ); 250 sv->setResizePolicy( QScrollView::AutoOneFit );
244 sv->setHScrollBarMode( QScrollView::AlwaysOff ); 251 sv->setHScrollBarMode( QScrollView::AlwaysOff );
245 sv->setFrameShape( QFrame::NoFrame ); 252 sv->setFrameShape( QFrame::NoFrame );
246 sv->addChild( plugWidget ); 253 sv->addChild( plugWidget );
247 // make sure the icon is on the top alligned 254 // make sure the icon is on the top alligned
248 boxLayout->addWidget( plugIcon, 0, AlignTop ); 255 boxLayout->addWidget( plugIcon, 0, AlignTop );
249 boxLayout->addWidget( sv, 0, AlignTop ); 256 boxLayout->addWidget( sv, 0, AlignTop );
250 boxLayout->setStretchFactor( plugIcon, 1 ); 257 boxLayout->setStretchFactor( plugIcon, 1 );
251 boxLayout->setStretchFactor( sv, 9 ); 258 boxLayout->setStretchFactor( sv, 9 );
252 // "prebuffer" it in one more list, to get the sorting done 259 // "prebuffer" it in one more list, to get the sorting done
253 tempList.insert( plugin.name, plugin ); 260 tempList.insert( plugin.name, plugin );
254 261
255 // on first start the list is off course empty 262 // on first start the list is off course empty
256 if ( m_allApplets.isEmpty() ) { 263 if ( m_allApplets.isEmpty() ) {
257 layout->addWidget( plugin.guiBox ); 264 layout->addWidget( plugin.guiBox );
258 pluginList.append( plugin ); 265 pluginList.append( plugin );
259 } 266 }
260 267
261 // if plugin is not yet in the list, add it to the layout too 268 // if plugin is not yet in the list, add it to the layout too
262 else if ( !m_allApplets.contains( plugin.name ) ) { 269 else if ( !m_allApplets.contains( plugin.name ) ) {
263 layout->addWidget( plugin.guiBox ); 270 layout->addWidget( plugin.guiBox );
264 pluginList.append( plugin ); 271 pluginList.append( plugin );
265 } 272 }
266 } else { 273 } else {
267 qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() ); 274 qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() );
268 delete lib; 275 delete lib;
269 } 276 }
270 } 277 }
271 278
272 if ( !m_allApplets.isEmpty() ) { 279 if ( !m_allApplets.isEmpty() ) {
273 TodayPlugin tempPlugin; 280 TodayPlugin tempPlugin;
274 QStringList::Iterator stringit; 281 QStringList::Iterator stringit;
275 282
276 for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) { 283 for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) {
277 tempPlugin = ( tempList.find( *stringit ) ).data(); 284 tempPlugin = ( tempList.find( *stringit ) ).data();
278 if ( !( (tempPlugin.name).isEmpty() ) ) { 285 if ( !( (tempPlugin.name).isEmpty() ) ) {
279 layout->addWidget( tempPlugin.guiBox ); 286 layout->addWidget( tempPlugin.guiBox );
280 pluginList.append( tempPlugin ); 287 pluginList.append( tempPlugin );
281 } 288 }
282 } 289 }
283 } 290 }
284 draw(); 291 draw();
285} 292}
286 293
287 294
288/** 295/**
289 * Repaint method. Reread all fields. 296 * Repaint method. Reread all fields.
290 */ 297 */
291void Today::draw() { 298void Today::draw() {
292 299
293 if ( pluginList.count() == 0 ) { 300 if ( pluginList.count() == 0 ) {
294 QLabel *noPlugins = new QLabel( this ); 301 QLabel *noPlugins = new QLabel( this );
295 noPlugins->setText( tr( "No plugins found" ) ); 302 noPlugins->setText( tr( "No plugins found" ) );
296 layout->addWidget( noPlugins ); 303 layout->addWidget( noPlugins );
297 return; 304 return;
298 } 305 }
299 306
300 uint count = 0; 307 uint count = 0;
301 TodayPlugin plugin; 308 TodayPlugin plugin;
302 for ( uint i = 0; i < pluginList.count(); i++ ) { 309 for ( uint i = 0; i < pluginList.count(); i++ ) {
303 plugin = pluginList[i]; 310 plugin = pluginList[i];
304 311
305 if ( plugin.active ) { 312 if ( plugin.active ) {
306 // qDebug( plugin.name + " is ACTIVE " ); 313 // qDebug( plugin.name + " is ACTIVE " );
307 plugin.guiBox->show(); 314 plugin.guiBox->show();
308 } else { 315 } else {
309 // qDebug( plugin.name + " is INACTIVE" ); 316 // qDebug( plugin.name + " is INACTIVE" );
310 plugin.guiBox->hide(); 317 plugin.guiBox->hide();
311 } 318 }
312 count++; 319 count++;
313 } 320 }
314 321
315 if ( count == 0 ) { 322 if ( count == 0 ) {
316 QLabel *noPluginsActive = new QLabel( this ); 323 QLabel *noPluginsActive = new QLabel( this );
317 noPluginsActive->setText( tr( "No plugins activated" ) ); 324 noPluginsActive->setText( tr( "No plugins activated" ) );
318 layout->addWidget( noPluginsActive ); 325 layout->addWidget( noPluginsActive );
319 } 326 }
320 layout->addStretch(0); 327 layout->addStretch(0);
321} 328}
322 329
323 330
324/** 331/**
325 * The method for the configuration dialog. 332 * The method for the configuration dialog.
326 */ 333 */
327void Today::startConfig() { 334void Today::startConfig() {
328 335
329 // disconnect timer to prevent problems while being on config dialog 336 // disconnect timer to prevent problems while being on config dialog
330 disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 337 disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
331 m_refreshTimer->stop( ); 338 m_refreshTimer->stop( );
332 339
333 TodayConfig conf( this, "dialog", true ); 340 TodayConfig conf( this, "dialog", true );
334 341
335 TodayPlugin plugin; 342 TodayPlugin plugin;
336 QList<TodayConfigWidget> configWidgetList; 343 QList<TodayConfigWidget> configWidgetList;
337 344
338 for ( int i = pluginList.count() - 1; i >= 0; i-- ) { 345 for ( int i = pluginList.count() - 1; i >= 0; i-- ) {
339 plugin = pluginList[i]; 346 plugin = pluginList[i];
340 347
341 // load the config widgets in the tabs 348 // load the config widgets in the tabs
342 if ( plugin.guiPart->configWidget( this ) != 0l ) { 349 if ( plugin.guiPart->configWidget( this ) != 0l ) {
343 TodayConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 ); 350 TodayConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 );
344 configWidgetList.append( widget ); 351 configWidgetList.append( widget );
345 conf.TabWidget3->addTab( widget, plugin.guiPart->pixmapNameConfig() 352 conf.TabWidget3->addTab( widget, plugin.guiPart->pixmapNameConfig()
346 , plugin.guiPart->appName() ); 353 , plugin.guiPart->appName() );
347 } 354 }
348 // set the order/activate tab 355 // set the order/activate tab
349 conf.pluginManagement( plugin.name, plugin.guiPart->pluginName(), 356 conf.pluginManagement( plugin.name, plugin.guiPart->pluginName(),
350 Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) ); 357 Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) );
351 } 358 }
352 359
353 if ( conf.exec() == QDialog::Accepted ) { 360 if ( conf.exec() == QDialog::Accepted ) {
354 conf.writeConfig(); 361 conf.writeConfig();
355 TodayConfigWidget *confWidget; 362 TodayConfigWidget *confWidget;
356 for ( confWidget = configWidgetList.first(); confWidget != 0; 363 for ( confWidget = configWidgetList.first(); confWidget != 0;
357 confWidget = configWidgetList.next() ) { 364 confWidget = configWidgetList.next() ) {
358 confWidget->writeConfig(); 365 confWidget->writeConfig();
359 } 366 }
360 loadPlugins(); 367 loadPlugins();
361 } else { 368 } else {
362 // since refresh is not called in that case , reconnect the signal 369 // since refresh is not called in that case , reconnect the signal
363 m_refreshTimer->start( 15000 ); // get the config value in here later 370 m_refreshTimer->start( 15000 ); // get the config value in here later
364 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 371 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
365 } 372 }
366} 373}
367 374
368 375
369/** 376/**
370 * Refresh for the view. Reload all applets 377 * Refresh for the view. Reload all applets
371 * 378 *
372 */ 379 */
373void Today::refresh() { 380void Today::refresh() {
374 381
375 init(); 382 init();
376 383
377 QValueList<TodayPlugin>::Iterator it; 384 QValueList<TodayPlugin>::Iterator it;
378 for ( it = pluginList.begin(); it != pluginList.end(); ++it ) { 385 for ( it = pluginList.begin(); it != pluginList.end(); ++it ) {
379 if ( !(*it).excludeRefresh ) { 386 if ( !(*it).excludeRefresh ) {
380 (*it).guiPart->refresh(); 387 (*it).guiPart->refresh();
381 layout->addWidget( (*it).guiBox ); 388 layout->addWidget( (*it).guiBox );
382 qDebug( "refresh" ); 389 qDebug( "refresh" );
383 } 390 }
384 } 391 }
385 layout->addStretch(0); 392 layout->addStretch(0);
386} 393}
387 394
388void Today::startApplication() { 395void Today::startApplication() {
389 QCopEnvelope e( "QPE/System", "execute(QString)" ); 396 QCopEnvelope e( "QPE/System", "execute(QString)" );
390 e << QString( sender()->name() ); 397 e << QString( sender()->name() );
391} 398}
392 399
393/** 400/**
394 * launch addressbook (personal card) 401 * launch addressbook (personal card)
395 */ 402 */
396void Today::editCard() { 403void Today::editCard() {
397 QCopEnvelope env( "QPE/Application/addressbook", "editPersonalAndClose()" ); 404 QCopEnvelope env( "QPE/Application/addressbook", "editPersonalAndClose()" );
398} 405}
399 406
400Today::~Today() { 407Today::~Today() {
401} 408}
402 409
diff --git a/core/qws/transferserver.cpp b/core/qws/transferserver.cpp
index 0337a94..239c824 100644
--- a/core/qws/transferserver.cpp
+++ b/core/qws/transferserver.cpp
@@ -1,1424 +1,1443 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#define _XOPEN_SOURCE 20#define _XOPEN_SOURCE
21#include <pwd.h> 21#include <pwd.h>
22#include <sys/types.h> 22#include <sys/types.h>
23#include <unistd.h> 23#include <unistd.h>
24#include <stdlib.h> 24#include <stdlib.h>
25#include <time.h> 25#include <time.h>
26
27#ifndef Q_OS_MACX
26#include <shadow.h> 28#include <shadow.h>
29#endif /* Q_OS_MACX */
27 30
28/* we need the _OS_LINUX stuff first ! */ 31/* we need the _OS_LINUX stuff first ! */
29#include <qglobal.h> 32#include <qglobal.h>
30 33
31#ifndef _OS_LINUX_ 34#ifndef _OS_LINUX_
35// Is anybody able to review this ? The include "uuid/uuid.h" couldn't be found
36// anywhere ? Therfore I removed it completely..
37// I think it should be made permanentyl !? (eilers)
38#warning "Where should uuid/uuid.h be found ? Removed this part .. (eilers)"
39#if 0
32 40
33extern "C" 41extern "C"
34{ 42{
35#include <uuid/uuid.h> 43#include <uuid/uuid.h>
36#define UUID_H_INCLUDED 44#define UUID_H_INCLUDED
37} 45}
38 46
47#endif
48
39#endif // not defined linux 49#endif // not defined linux
40 50
41#if defined(_OS_LINUX_) 51#if defined(_OS_LINUX_)
42#include <shadow.h> 52#include <shadow.h>
53#elif defined(Q_OS_MACX)
54#include <stdlib.h>
43#endif 55#endif
44 56
45#include <qdir.h> 57#include <qdir.h>
46#include <qfile.h> 58#include <qfile.h>
47#include <qtextstream.h> 59#include <qtextstream.h>
48#include <qdatastream.h> 60#include <qdatastream.h>
49#include <qmessagebox.h> 61#include <qmessagebox.h>
50#include <qstringlist.h> 62#include <qstringlist.h>
51#include <qfileinfo.h> 63#include <qfileinfo.h>
52#include <qregexp.h> 64#include <qregexp.h>
53//#include <qpe/qcopchannel_qws.h> 65//#include <qpe/qcopchannel_qws.h>
54#include <qpe/process.h> 66#include <qpe/process.h>
55#include <qpe/global.h> 67#include <qpe/global.h>
56#include <qpe/config.h> 68#include <qpe/config.h>
57#include <qpe/contact.h> 69#include <qpe/contact.h>
58#include <qpe/quuid.h> 70#include <qpe/quuid.h>
59#include <qpe/version.h> 71#include <qpe/version.h>
60#include <qpe/qcopenvelope_qws.h> 72#include <qpe/qcopenvelope_qws.h>
61 73
62#include "transferserver.h" 74#include "transferserver.h"
63#include <opie/oprocess.h> 75#include <opie/oprocess.h>
64 76
65const int block_size = 51200; 77const int block_size = 51200;
66 78
67TransferServer::TransferServer( Q_UINT16 port, QObject *parent , 79TransferServer::TransferServer( Q_UINT16 port, QObject *parent ,
68 const char* name ) 80 const char* name )
69 : QServerSocket( port, 1, parent, name ) 81 : QServerSocket( port, 1, parent, name )
70{ 82{
71 if ( !ok() ) 83 if ( !ok() )
72 qWarning( "Failed to bind to port %d", port ); 84 qWarning( "Failed to bind to port %d", port );
73} 85}
74 86
75TransferServer::~TransferServer() 87TransferServer::~TransferServer()
76{ 88{
77} 89}
78 90
79void TransferServer::newConnection( int socket ) 91void TransferServer::newConnection( int socket )
80{ 92{
81 (void) new ServerPI( socket, this ); 93 (void) new ServerPI( socket, this );
82} 94}
83 95
84/* 96/*
85 * small class in anonymous namespace 97 * small class in anonymous namespace
86 * to generate a QUUid for us 98 * to generate a QUUid for us
87 */ 99 */
88namespace 100namespace
89{ 101{
90struct UidGen 102struct UidGen
91{ 103{
92 QString uuid(); 104 QString uuid();
93}; 105};
94#if !defined(_OS_LINUX_) 106#if defined(Q_OS_MACX)
95
96QString UidGen::uuid() 107QString UidGen::uuid()
97{ 108{
98 uuid_t uuid; 109 srandom( random() );
99 uuid_generate( uuid ); 110 QString numStr = QString::number( random() );
100 return QUUid( uuid ).toString(); 111
112 return "{" + numStr + "}";
101} 113}
102#else 114#elif defined(_OS_LINUX_)
103/* 115/*
104* linux got a /proc/sys/kernel/random/uuid file 116* linux got a /proc/sys/kernel/random/uuid file
105* it'll generate the uuids for us 117* it'll generate the uuids for us
106*/ 118*/
107QString UidGen::uuid() 119QString UidGen::uuid()
108{ 120{
109 QFile file( "/proc/sys/kernel/random/uuid" ); 121 QFile file( "/proc/sys/kernel/random/uuid" );
110 if (!file.open(IO_ReadOnly ) ) 122 if (!file.open(IO_ReadOnly ) )
111 return QString::null; 123 return QString::null;
112 124
113 QTextStream stream(&file); 125 QTextStream stream(&file);
114 126
115 return "{" + stream.read().stripWhiteSpace() + "}"; 127 return "{" + stream.read().stripWhiteSpace() + "}";
116} 128}
129#else
130QString UidGen::uuid()
131{
132 uuid_t uuid;
133 ::uuid_generate( uuid );
134 return QUUid( uuid ).toString();
135}
117#endif 136#endif
118} 137}
119 138
120QString SyncAuthentication::serverId() 139QString SyncAuthentication::serverId()
121{ 140{
122 Config cfg("Security"); 141 Config cfg("Security");
123 cfg.setGroup("Sync"); 142 cfg.setGroup("Sync");
124 QString r = cfg.readEntry("serverid"); 143 QString r = cfg.readEntry("serverid");
125 if ( r.isEmpty() ) { 144 if ( r.isEmpty() ) {
126 UidGen gen; 145 UidGen gen;
127 r = gen.uuid(); 146 r = gen.uuid();
128 cfg.writeEntry("serverid", r ); 147 cfg.writeEntry("serverid", r );
129 } 148 }
130 return r; 149 return r;
131} 150}
132 151
133QString SyncAuthentication::ownerName() 152QString SyncAuthentication::ownerName()
134{ 153{
135 QString vfilename = Global::applicationFileName("addressbook", 154 QString vfilename = Global::applicationFileName("addressbook",
136 "businesscard.vcf"); 155 "businesscard.vcf");
137 if (QFile::exists(vfilename)) { 156 if (QFile::exists(vfilename)) {
138 Contact c; 157 Contact c;
139 c = Contact::readVCard( vfilename )[0]; 158 c = Contact::readVCard( vfilename )[0];
140 return c.fullName(); 159 return c.fullName();
141 } 160 }
142 161
143 return ""; 162 return "";
144} 163}
145 164
146QString SyncAuthentication::loginName() 165QString SyncAuthentication::loginName()
147{ 166{
148 struct passwd *pw; 167 struct passwd *pw;
149 pw = getpwuid( geteuid() ); 168 pw = getpwuid( geteuid() );
150 return QString::fromLocal8Bit( pw->pw_name ); 169 return QString::fromLocal8Bit( pw->pw_name );
151} 170}
152 171
153int SyncAuthentication::isAuthorized(QHostAddress peeraddress) 172int SyncAuthentication::isAuthorized(QHostAddress peeraddress)
154{ 173{
155 Config cfg("Security"); 174 Config cfg("Security");
156 cfg.setGroup("Sync"); 175 cfg.setGroup("Sync");
157 // QString allowedstr = cfg.readEntry("auth_peer","192.168.1.0"); 176 // QString allowedstr = cfg.readEntry("auth_peer","192.168.1.0");
158 uint auth_peer = cfg.readNumEntry("auth_peer", 0xc0a80100); 177 uint auth_peer = cfg.readNumEntry("auth_peer", 0xc0a80100);
159 178
160 // QHostAddress allowed; 179 // QHostAddress allowed;
161 // allowed.setAddress(allowedstr); 180 // allowed.setAddress(allowedstr);
162 // uint auth_peer = allowed.ip4Addr(); 181 // uint auth_peer = allowed.ip4Addr();
163 uint auth_peer_bits = cfg.readNumEntry("auth_peer_bits", 24); 182 uint auth_peer_bits = cfg.readNumEntry("auth_peer_bits", 24);
164 uint mask = auth_peer_bits >= 32 // shifting by 32 is not defined 183 uint mask = auth_peer_bits >= 32 // shifting by 32 is not defined
165 ? 0xffffffff : (((1 << auth_peer_bits) - 1) << (32 - auth_peer_bits)); 184 ? 0xffffffff : (((1 << auth_peer_bits) - 1) << (32 - auth_peer_bits));
166 return (peeraddress.ip4Addr() & mask) == auth_peer; 185 return (peeraddress.ip4Addr() & mask) == auth_peer;
167} 186}
168 187
169bool SyncAuthentication::checkUser( const QString& user ) 188bool SyncAuthentication::checkUser( const QString& user )
170{ 189{
171 if ( user.isEmpty() ) 190 if ( user.isEmpty() )
172 return FALSE; 191 return FALSE;
173 QString euser = loginName(); 192 QString euser = loginName();
174 return user == euser; 193 return user == euser;
175} 194}
176 195
177bool SyncAuthentication::checkPassword( const QString& password ) 196bool SyncAuthentication::checkPassword( const QString& password )
178{ 197{
179#ifdef ALLOW_UNIX_USER_FTP 198#ifdef ALLOW_UNIX_USER_FTP
180 // First, check system password... 199 // First, check system password...
181 200
182 struct passwd *pw = 0; 201 struct passwd *pw = 0;
183 struct spwd *spw = 0; 202 struct spwd *spw = 0;
184 203
185 pw = getpwuid( geteuid() ); 204 pw = getpwuid( geteuid() );
186 spw = getspnam( pw->pw_name ); 205 spw = getspnam( pw->pw_name );
187 206
188 QString cpwd = QString::fromLocal8Bit( pw->pw_passwd ); 207 QString cpwd = QString::fromLocal8Bit( pw->pw_passwd );
189 if ( cpwd == "x" && spw ) 208 if ( cpwd == "x" && spw )
190 cpwd = QString::fromLocal8Bit( spw->sp_pwdp ); 209 cpwd = QString::fromLocal8Bit( spw->sp_pwdp );
191 210
192 // Note: some systems use more than crypt for passwords. 211 // Note: some systems use more than crypt for passwords.
193 QString cpassword = QString::fromLocal8Bit( crypt( password.local8Bit(), cpwd.local8Bit() ) ); 212 QString cpassword = QString::fromLocal8Bit( crypt( password.local8Bit(), cpwd.local8Bit() ) );
194 if ( cpwd == cpassword ) 213 if ( cpwd == cpassword )
195 return TRUE; 214 return TRUE;
196#endif 215#endif
197 216
198 static int lastdenial = 0; 217 static int lastdenial = 0;
199 static int denials = 0; 218 static int denials = 0;
200 int now = time(0); 219 int now = time(0);
201 220
202 // Detect old Qtopia Desktop (no password) 221 // Detect old Qtopia Desktop (no password)
203 if ( password.isEmpty() ) { 222 if ( password.isEmpty() ) {
204 if ( denials < 1 || now > lastdenial + 600 ) { 223 if ( denials < 1 || now > lastdenial + 600 ) {
205 QMessageBox::warning( 0, tr("Sync Connection"), 224 QMessageBox::warning( 0, tr("Sync Connection"),
206 tr("<p>An unauthorized system is requesting access to this device." 225 tr("<p>An unauthorized system is requesting access to this device."
207 "<p>If you are using a version of Qtopia Desktop older than 1.5.1, " 226 "<p>If you are using a version of Qtopia Desktop older than 1.5.1, "
208 "please upgrade."), 227 "please upgrade."),
209 tr("Deny") ); 228 tr("Deny") );
210 denials++; 229 denials++;
211 lastdenial = now; 230 lastdenial = now;
212 } 231 }
213 return FALSE; 232 return FALSE;
214 } 233 }
215 234
216 // Second, check sync password... 235 // Second, check sync password...
217 QString pass = password.left(6); 236 QString pass = password.left(6);
218 /* old QtopiaDesktops are sending 237 /* old QtopiaDesktops are sending
219 * rootme newer versions got a Qtopia 238 * rootme newer versions got a Qtopia
220 * prefixed. Qtopia prefix will suceed 239 * prefixed. Qtopia prefix will suceed
221 * until the sync software syncs up 240 * until the sync software syncs up
222 * FIXME 241 * FIXME
223 */ 242 */
224 if ( pass == "rootme" || pass == "Qtopia") { 243 if ( pass == "rootme" || pass == "Qtopia") {
225 244
226 QString cpassword = QString::fromLocal8Bit( crypt( password.mid(8).local8Bit(), "qp" ) ); 245 QString cpassword = QString::fromLocal8Bit( crypt( password.mid(8).local8Bit(), "qp" ) );
227 Config cfg("Security"); 246 Config cfg("Security");
228 cfg.setGroup("Sync"); 247 cfg.setGroup("Sync");
229 QString pwds = cfg.readEntry("Passwords"); 248 QString pwds = cfg.readEntry("Passwords");
230 if ( QStringList::split(QChar(' '), pwds).contains(cpassword) ) 249 if ( QStringList::split(QChar(' '), pwds).contains(cpassword) )
231 return TRUE; 250 return TRUE;
232 251
233 // Unrecognized system. Be careful... 252 // Unrecognized system. Be careful...
234 253
235 if ( (denials > 2 && now < lastdenial + 600) 254 if ( (denials > 2 && now < lastdenial + 600)
236 || QMessageBox::warning(0, tr("Sync Connection"), 255 || QMessageBox::warning(0, tr("Sync Connection"),
237 tr("<p>An unrecognized system is requesting access to this device." 256 tr("<p>An unrecognized system is requesting access to this device."
238 "<p>If you have just initiated a Sync for the first time, this is normal."), 257 "<p>If you have just initiated a Sync for the first time, this is normal."),
239 tr("Allow"), tr("Deny"), 0, 1, 1 ) == 1 ) { 258 tr("Allow"), tr("Deny"), 0, 1, 1 ) == 1 ) {
240 denials++; 259 denials++;
241 lastdenial = now; 260 lastdenial = now;
242 return FALSE; 261 return FALSE;
243 } 262 }
244 else { 263 else {
245 denials = 0; 264 denials = 0;
246 cfg.writeEntry("Passwords", pwds + " " + cpassword); 265 cfg.writeEntry("Passwords", pwds + " " + cpassword);
247 return TRUE; 266 return TRUE;
248 } 267 }
249 } 268 }
250 269
251 return FALSE; 270 return FALSE;
252} 271}
253 272
254ServerPI::ServerPI( int socket, QObject *parent , const char* name ) 273ServerPI::ServerPI( int socket, QObject *parent , const char* name )
255 : QSocket( parent, name ) , dtp( 0 ), serversocket( 0 ), waitsocket( 0 ) 274 : QSocket( parent, name ) , dtp( 0 ), serversocket( 0 ), waitsocket( 0 )
256{ 275{
257 state = Connected; 276 state = Connected;
258 277
259 setSocket( socket ); 278 setSocket( socket );
260 279
261 peerport = peerPort(); 280 peerport = peerPort();
262 peeraddress = peerAddress(); 281 peeraddress = peerAddress();
263 282
264#ifndef INSECURE 283#ifndef INSECURE
265 284
266 if ( !SyncAuthentication::isAuthorized(peeraddress) ) { 285 if ( !SyncAuthentication::isAuthorized(peeraddress) ) {
267 state = Forbidden; 286 state = Forbidden;
268 startTimer( 0 ); 287 startTimer( 0 );
269 } 288 }
270 else 289 else
271#endif 290#endif
272 { 291 {
273 connect( this, SIGNAL( readyRead() ), SLOT( read() ) ); 292 connect( this, SIGNAL( readyRead() ), SLOT( read() ) );
274 connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) ); 293 connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) );
275 294
276 passiv = FALSE; 295 passiv = FALSE;
277 for ( int i = 0; i < 4; i++ ) 296 for ( int i = 0; i < 4; i++ )
278 wait[i] = FALSE; 297 wait[i] = FALSE;
279 298
280 send( "220 Qtopia " QPE_VERSION " FTP Server" ); 299 send( "220 Qtopia " QPE_VERSION " FTP Server" );
281 state = Wait_USER; 300 state = Wait_USER;
282 301
283 dtp = new ServerDTP( this ); 302 dtp = new ServerDTP( this );
284 connect( dtp, SIGNAL( completed() ), SLOT( dtpCompleted() ) ); 303 connect( dtp, SIGNAL( completed() ), SLOT( dtpCompleted() ) );
285 connect( dtp, SIGNAL( failed() ), SLOT( dtpFailed() ) ); 304 connect( dtp, SIGNAL( failed() ), SLOT( dtpFailed() ) );
286 connect( dtp, SIGNAL( error( int ) ), SLOT( dtpError( int ) ) ); 305 connect( dtp, SIGNAL( error( int ) ), SLOT( dtpError( int ) ) );
287 306
288 307
289 directory = QDir::currentDirPath(); 308 directory = QDir::currentDirPath();
290 309
291 static int p = 1024; 310 static int p = 1024;
292 311
293 while ( !serversocket || !serversocket->ok() ) { 312 while ( !serversocket || !serversocket->ok() ) {
294 delete serversocket; 313 delete serversocket;
295 serversocket = new ServerSocket( ++p, this ); 314 serversocket = new ServerSocket( ++p, this );
296 } 315 }
297 connect( serversocket, SIGNAL( newIncomming( int ) ), 316 connect( serversocket, SIGNAL( newIncomming( int ) ),
298 SLOT( newConnection( int ) ) ); 317 SLOT( newConnection( int ) ) );
299 } 318 }
300} 319}
301 320
302ServerPI::~ServerPI() 321ServerPI::~ServerPI()
303{ 322{
304} 323}
305 324
306void ServerPI::connectionClosed() 325void ServerPI::connectionClosed()
307{ 326{
308 // qDebug( "Debug: Connection closed" ); 327 // qDebug( "Debug: Connection closed" );
309 delete this; 328 delete this;
310} 329}
311 330
312void ServerPI::send( const QString& msg ) 331void ServerPI::send( const QString& msg )
313{ 332{
314 QTextStream os( this ); 333 QTextStream os( this );
315 os << msg << endl; 334 os << msg << endl;
316 //qDebug( "Reply: %s", msg.latin1() ); 335 //qDebug( "Reply: %s", msg.latin1() );
317} 336}
318 337
319void ServerPI::read() 338void ServerPI::read()
320{ 339{
321 while ( canReadLine() ) 340 while ( canReadLine() )
322 process( readLine().stripWhiteSpace() ); 341 process( readLine().stripWhiteSpace() );
323} 342}
324 343
325bool ServerPI::checkReadFile( const QString& file ) 344bool ServerPI::checkReadFile( const QString& file )
326{ 345{
327 QString filename; 346 QString filename;
328 347
329 if ( file[0] != "/" ) 348 if ( file[0] != "/" )
330 filename = directory.path() + "/" + file; 349 filename = directory.path() + "/" + file;
331 else 350 else
332 filename = file; 351 filename = file;
333 352
334 QFileInfo fi( filename ); 353 QFileInfo fi( filename );
335 return ( fi.exists() && fi.isReadable() ); 354 return ( fi.exists() && fi.isReadable() );
336} 355}
337 356
338bool ServerPI::checkWriteFile( const QString& file ) 357bool ServerPI::checkWriteFile( const QString& file )
339{ 358{
340 QString filename; 359 QString filename;
341 360
342 if ( file[0] != "/" ) 361 if ( file[0] != "/" )
343 filename = directory.path() + "/" + file; 362 filename = directory.path() + "/" + file;
344 else 363 else
345 filename = file; 364 filename = file;
346 365
347 QFileInfo fi( filename ); 366 QFileInfo fi( filename );
348 367
349 if ( fi.exists() ) 368 if ( fi.exists() )
350 if ( !QFile( filename ).remove() ) 369 if ( !QFile( filename ).remove() )
351 return FALSE; 370 return FALSE;
352 return TRUE; 371 return TRUE;
353} 372}
354 373
355void ServerPI::process( const QString& message ) 374void ServerPI::process( const QString& message )
356{ 375{
357 //qDebug( "Command: %s", message.latin1() ); 376 //qDebug( "Command: %s", message.latin1() );
358 377
359 // split message using "," as separator 378 // split message using "," as separator
360 QStringList msg = QStringList::split( " ", message ); 379 QStringList msg = QStringList::split( " ", message );
361 if ( msg.isEmpty() ) 380 if ( msg.isEmpty() )
362 return ; 381 return ;
363 382
364 // command token 383 // command token
365 QString cmd = msg[0].upper(); 384 QString cmd = msg[0].upper();
366 385
367 // argument token 386 // argument token
368 QString arg; 387 QString arg;
369 if ( msg.count() >= 2 ) 388 if ( msg.count() >= 2 )
370 arg = msg[1]; 389 arg = msg[1];
371 390
372 // full argument string 391 // full argument string
373 QString args; 392 QString args;
374 if ( msg.count() >= 2 ) { 393 if ( msg.count() >= 2 ) {
375 QStringList copy( msg ); 394 QStringList copy( msg );
376 // FIXME: for Qt3 395 // FIXME: for Qt3
377 // copy.pop_front() 396 // copy.pop_front()
378 copy.remove( copy.begin() ); 397 copy.remove( copy.begin() );
379 args = copy.join( " " ); 398 args = copy.join( " " );
380 } 399 }
381 400
382 //qDebug( "args: %s", args.latin1() ); 401 //qDebug( "args: %s", args.latin1() );
383 402
384 // we always respond to QUIT, regardless of state 403 // we always respond to QUIT, regardless of state
385 if ( cmd == "QUIT" ) { 404 if ( cmd == "QUIT" ) {
386 send( "211 Good bye!" ); 405 send( "211 Good bye!" );
387 delete this; 406 delete this;
388 return ; 407 return ;
389 } 408 }
390 409
391 // connected to client 410 // connected to client
392 if ( Connected == state ) 411 if ( Connected == state )
393 return ; 412 return ;
394 413
395 // waiting for user name 414 // waiting for user name
396 if ( Wait_USER == state ) { 415 if ( Wait_USER == state ) {
397 416
398 if ( cmd != "USER" || msg.count() < 2 || !SyncAuthentication::checkUser( arg ) ) { 417 if ( cmd != "USER" || msg.count() < 2 || !SyncAuthentication::checkUser( arg ) ) {
399 send( "530 Please login with USER and PASS" ); 418 send( "530 Please login with USER and PASS" );
400 return ; 419 return ;
401 } 420 }
402 send( "331 User name ok, need password" ); 421 send( "331 User name ok, need password" );
403 state = Wait_PASS; 422 state = Wait_PASS;
404 return ; 423 return ;
405 } 424 }
406 425
407 // waiting for password 426 // waiting for password
408 if ( Wait_PASS == state ) { 427 if ( Wait_PASS == state ) {
409 428
410 if ( cmd != "PASS" || !SyncAuthentication::checkPassword( arg ) ) { 429 if ( cmd != "PASS" || !SyncAuthentication::checkPassword( arg ) ) {
411 send( "530 Please login with USER and PASS" ); 430 send( "530 Please login with USER and PASS" );
412 return ; 431 return ;
413 } 432 }
414 send( "230 User logged in, proceed" ); 433 send( "230 User logged in, proceed" );
415 state = Ready; 434 state = Ready;
416 return ; 435 return ;
417 } 436 }
418 437
419 // ACCESS CONTROL COMMANDS 438 // ACCESS CONTROL COMMANDS
420 439
421 440
422 // account (ACCT) 441 // account (ACCT)
423 if ( cmd == "ACCT" ) { 442 if ( cmd == "ACCT" ) {
424 // even wu-ftp does not support it 443 // even wu-ftp does not support it
425 send( "502 Command not implemented" ); 444 send( "502 Command not implemented" );
426 } 445 }
427 446
428 // change working directory (CWD) 447 // change working directory (CWD)
429 else if ( cmd == "CWD" ) { 448 else if ( cmd == "CWD" ) {
430 449
431 if ( !args.isEmpty() ) { 450 if ( !args.isEmpty() ) {
432 if ( directory.cd( args, TRUE ) ) 451 if ( directory.cd( args, TRUE ) )
433 send( "250 Requested file action okay, completed" ); 452 send( "250 Requested file action okay, completed" );
434 else 453 else
435 send( "550 Requested action not taken" ); 454 send( "550 Requested action not taken" );
436 } 455 }
437 else 456 else
438 send( "500 Syntax error, command unrecognized" ); 457 send( "500 Syntax error, command unrecognized" );
439 } 458 }
440 459
441 // change to parent directory (CDUP) 460 // change to parent directory (CDUP)
442 else if ( cmd == "CDUP" ) { 461 else if ( cmd == "CDUP" ) {
443 if ( directory.cdUp() ) 462 if ( directory.cdUp() )
444 send( "250 Requested file action okay, completed" ); 463 send( "250 Requested file action okay, completed" );
445 else 464 else
446 send( "550 Requested action not taken" ); 465 send( "550 Requested action not taken" );
447 } 466 }
448 467
449 // structure mount (SMNT) 468 // structure mount (SMNT)
450 else if ( cmd == "SMNT" ) { 469 else if ( cmd == "SMNT" ) {
451 // even wu-ftp does not support it 470 // even wu-ftp does not support it
452 send( "502 Command not implemented" ); 471 send( "502 Command not implemented" );
453 } 472 }
454 473
455 // reinitialize (REIN) 474 // reinitialize (REIN)
456 else if ( cmd == "REIN" ) { 475 else if ( cmd == "REIN" ) {
457 // even wu-ftp does not support it 476 // even wu-ftp does not support it
458 send( "502 Command not implemented" ); 477 send( "502 Command not implemented" );
459 } 478 }
460 479
461 480
462 // TRANSFER PARAMETER COMMANDS 481 // TRANSFER PARAMETER COMMANDS
463 482
464 483
465 // data port (PORT) 484 // data port (PORT)
466 else if ( cmd == "PORT" ) { 485 else if ( cmd == "PORT" ) {
467 if ( parsePort( arg ) ) 486 if ( parsePort( arg ) )
468 send( "200 Command okay" ); 487 send( "200 Command okay" );
469 else 488 else
470 send( "500 Syntax error, command unrecognized" ); 489 send( "500 Syntax error, command unrecognized" );
471 } 490 }
472 491
473 // passive (PASV) 492 // passive (PASV)
474 else if ( cmd == "PASV" ) { 493 else if ( cmd == "PASV" ) {
475 passiv = TRUE; 494 passiv = TRUE;
476 send( "227 Entering Passive Mode (" 495 send( "227 Entering Passive Mode ("
477 + address().toString().replace( QRegExp( "\\." ), "," ) + "," 496 + address().toString().replace( QRegExp( "\\." ), "," ) + ","
478 + QString::number( ( serversocket->port() ) >> 8 ) + "," 497 + QString::number( ( serversocket->port() ) >> 8 ) + ","
479 + QString::number( ( serversocket->port() ) & 0xFF ) + ")" ); 498 + QString::number( ( serversocket->port() ) & 0xFF ) + ")" );
480 } 499 }
481 500
482 // representation type (TYPE) 501 // representation type (TYPE)
483 else if ( cmd == "TYPE" ) { 502 else if ( cmd == "TYPE" ) {
484 if ( arg.upper() == "A" || arg.upper() == "I" ) 503 if ( arg.upper() == "A" || arg.upper() == "I" )
485 send( "200 Command okay" ); 504 send( "200 Command okay" );
486 else 505 else
487 send( "504 Command not implemented for that parameter" ); 506 send( "504 Command not implemented for that parameter" );
488 } 507 }
489 508
490 // file structure (STRU) 509 // file structure (STRU)
491 else if ( cmd == "STRU" ) { 510 else if ( cmd == "STRU" ) {
492 if ( arg.upper() == "F" ) 511 if ( arg.upper() == "F" )
493 send( "200 Command okay" ); 512 send( "200 Command okay" );
494 else 513 else
495 send( "504 Command not implemented for that parameter" ); 514 send( "504 Command not implemented for that parameter" );
496 } 515 }
497 516
498 // transfer mode (MODE) 517 // transfer mode (MODE)
499 else if ( cmd == "MODE" ) { 518 else if ( cmd == "MODE" ) {
500 if ( arg.upper() == "S" ) 519 if ( arg.upper() == "S" )
501 send( "200 Command okay" ); 520 send( "200 Command okay" );
502 else 521 else
503 send( "504 Command not implemented for that parameter" ); 522 send( "504 Command not implemented for that parameter" );
504 } 523 }
505 524
506 525
507 // FTP SERVICE COMMANDS 526 // FTP SERVICE COMMANDS
508 527
509 528
510 // retrieve (RETR) 529 // retrieve (RETR)
511 else if ( cmd == "RETR" ) 530 else if ( cmd == "RETR" )
512 if ( !args.isEmpty() && checkReadFile( absFilePath( args ) ) 531 if ( !args.isEmpty() && checkReadFile( absFilePath( args ) )
513 || backupRestoreGzip( absFilePath( args ) ) ) { 532 || backupRestoreGzip( absFilePath( args ) ) ) {
514 send( "150 File status okay" ); 533 send( "150 File status okay" );
515 sendFile( absFilePath( args ) ); 534 sendFile( absFilePath( args ) );
516 } 535 }
517 else { 536 else {
518 qDebug("550 Requested action not taken"); 537 qDebug("550 Requested action not taken");
519 send( "550 Requested action not taken" ); 538 send( "550 Requested action not taken" );
520 } 539 }
521 540
522 // store (STOR) 541 // store (STOR)
523 else if ( cmd == "STOR" ) 542 else if ( cmd == "STOR" )
524 if ( !args.isEmpty() && checkWriteFile( absFilePath( args ) ) ) { 543 if ( !args.isEmpty() && checkWriteFile( absFilePath( args ) ) ) {
525 send( "150 File status okay" ); 544 send( "150 File status okay" );
526 retrieveFile( absFilePath( args ) ); 545 retrieveFile( absFilePath( args ) );
527 } 546 }
528 else 547 else
529 send( "550 Requested action not taken" ); 548 send( "550 Requested action not taken" );
530 549
531 // store unique (STOU) 550 // store unique (STOU)
532 else if ( cmd == "STOU" ) { 551 else if ( cmd == "STOU" ) {
533 send( "502 Command not implemented" ); 552 send( "502 Command not implemented" );
534 } 553 }
535 554
536 // append (APPE) 555 // append (APPE)
537 else if ( cmd == "APPE" ) { 556 else if ( cmd == "APPE" ) {
538 send( "502 Command not implemented" ); 557 send( "502 Command not implemented" );
539 } 558 }
540 559
541 // allocate (ALLO) 560 // allocate (ALLO)
542 else if ( cmd == "ALLO" ) { 561 else if ( cmd == "ALLO" ) {
543 send( "200 Command okay" ); 562 send( "200 Command okay" );
544 } 563 }
545 564
546 // restart (REST) 565 // restart (REST)
547 else if ( cmd == "REST" ) { 566 else if ( cmd == "REST" ) {
548 send( "502 Command not implemented" ); 567 send( "502 Command not implemented" );
549 } 568 }
550 569
551 // rename from (RNFR) 570 // rename from (RNFR)
552 else if ( cmd == "RNFR" ) { 571 else if ( cmd == "RNFR" ) {
553 renameFrom = QString::null; 572 renameFrom = QString::null;
554 if ( args.isEmpty() ) 573 if ( args.isEmpty() )
555 send( "500 Syntax error, command unrecognized" ); 574 send( "500 Syntax error, command unrecognized" );
556 else { 575 else {
557 QFile file( absFilePath( args ) ); 576 QFile file( absFilePath( args ) );
558 if ( file.exists() ) { 577 if ( file.exists() ) {
559 send( "350 File exists, ready for destination name" ); 578 send( "350 File exists, ready for destination name" );
560 renameFrom = absFilePath( args ); 579 renameFrom = absFilePath( args );
561 } 580 }
562 else 581 else
563 send( "550 Requested action not taken" ); 582 send( "550 Requested action not taken" );
564 } 583 }
565 } 584 }
566 585
567 // rename to (RNTO) 586 // rename to (RNTO)
568 else if ( cmd == "RNTO" ) { 587 else if ( cmd == "RNTO" ) {
569 if ( lastCommand != "RNFR" ) 588 if ( lastCommand != "RNFR" )
570 send( "503 Bad sequence of commands" ); 589 send( "503 Bad sequence of commands" );
571 else if ( args.isEmpty() ) 590 else if ( args.isEmpty() )
572 send( "500 Syntax error, command unrecognized" ); 591 send( "500 Syntax error, command unrecognized" );
573 else { 592 else {
574 QDir dir( absFilePath( args ) ); 593 QDir dir( absFilePath( args ) );
575 if ( dir.rename( renameFrom, absFilePath( args ), TRUE ) ) 594 if ( dir.rename( renameFrom, absFilePath( args ), TRUE ) )
576 send( "250 Requested file action okay, completed." ); 595 send( "250 Requested file action okay, completed." );
577 else 596 else
578 send( "550 Requested action not taken" ); 597 send( "550 Requested action not taken" );
579 } 598 }
580 } 599 }
581 600
582 // abort (ABOR) 601 // abort (ABOR)
583 else if ( cmd.contains( "ABOR" ) ) { 602 else if ( cmd.contains( "ABOR" ) ) {
584 dtp->close(); 603 dtp->close();
585 if ( dtp->dtpMode() != ServerDTP::Idle ) 604 if ( dtp->dtpMode() != ServerDTP::Idle )
586 send( "426 Connection closed; transfer aborted" ); 605 send( "426 Connection closed; transfer aborted" );
587 else 606 else
588 send( "226 Closing data connection" ); 607 send( "226 Closing data connection" );
589 } 608 }
590 609
591 // delete (DELE) 610 // delete (DELE)
592 else if ( cmd == "DELE" ) { 611 else if ( cmd == "DELE" ) {
593 if ( args.isEmpty() ) 612 if ( args.isEmpty() )
594 send( "500 Syntax error, command unrecognized" ); 613 send( "500 Syntax error, command unrecognized" );
595 else { 614 else {
596 QFile file( absFilePath( args ) ) ; 615 QFile file( absFilePath( args ) ) ;
597 if ( file.remove() ) { 616 if ( file.remove() ) {
598 send( "250 Requested file action okay, completed" ); 617 send( "250 Requested file action okay, completed" );
599 QCopEnvelope e("QPE/System", "linkChanged(QString)" ); 618 QCopEnvelope e("QPE/System", "linkChanged(QString)" );
600 e << file.name(); 619 e << file.name();
601 } 620 }
602 else { 621 else {
603 send( "550 Requested action not taken" ); 622 send( "550 Requested action not taken" );
604 } 623 }
605 } 624 }
606 } 625 }
607 626
608 // remove directory (RMD) 627 // remove directory (RMD)
609 else if ( cmd == "RMD" ) { 628 else if ( cmd == "RMD" ) {
610 if ( args.isEmpty() ) 629 if ( args.isEmpty() )
611 send( "500 Syntax error, command unrecognized" ); 630 send( "500 Syntax error, command unrecognized" );
612 else { 631 else {
613 QDir dir; 632 QDir dir;
614 if ( dir.rmdir( absFilePath( args ), TRUE ) ) 633 if ( dir.rmdir( absFilePath( args ), TRUE ) )
615 send( "250 Requested file action okay, completed" ); 634 send( "250 Requested file action okay, completed" );
616 else 635 else
617 send( "550 Requested action not taken" ); 636 send( "550 Requested action not taken" );
618 } 637 }
619 } 638 }
620 639
621 // make directory (MKD) 640 // make directory (MKD)
622 else if ( cmd == "MKD" ) { 641 else if ( cmd == "MKD" ) {
623 if ( args.isEmpty() ) { 642 if ( args.isEmpty() ) {
624 qDebug(" Error: no arg"); 643 qDebug(" Error: no arg");
625 send( "500 Syntax error, command unrecognized" ); 644 send( "500 Syntax error, command unrecognized" );
626 } 645 }
627 else { 646 else {
628 QDir dir; 647 QDir dir;
629 if ( dir.mkdir( absFilePath( args ), TRUE ) ) 648 if ( dir.mkdir( absFilePath( args ), TRUE ) )
630 send( "250 Requested file action okay, completed." ); 649 send( "250 Requested file action okay, completed." );
631 else 650 else
632 send( "550 Requested action not taken" ); 651 send( "550 Requested action not taken" );
633 } 652 }
634 } 653 }
635 654
636 // print working directory (PWD) 655 // print working directory (PWD)
637 else if ( cmd == "PWD" ) { 656 else if ( cmd == "PWD" ) {
638 send( "257 \"" + directory.path() + "\"" ); 657 send( "257 \"" + directory.path() + "\"" );
639 } 658 }
640 659
641 // list (LIST) 660 // list (LIST)
642 else if ( cmd == "LIST" ) { 661 else if ( cmd == "LIST" ) {
643 if ( sendList( absFilePath( args ) ) ) 662 if ( sendList( absFilePath( args ) ) )
644 send( "150 File status okay" ); 663 send( "150 File status okay" );
645 else 664 else
646 send( "500 Syntax error, command unrecognized" ); 665 send( "500 Syntax error, command unrecognized" );
647 } 666 }
648 667
649 // size (SIZE) 668 // size (SIZE)
650 else if ( cmd == "SIZE" ) { 669 else if ( cmd == "SIZE" ) {
651 QString filePath = absFilePath( args ); 670 QString filePath = absFilePath( args );
652 QFileInfo fi( filePath ); 671 QFileInfo fi( filePath );
653 bool gzipfile = backupRestoreGzip( filePath ); 672 bool gzipfile = backupRestoreGzip( filePath );
654 if ( !fi.exists() && !gzipfile ) 673 if ( !fi.exists() && !gzipfile )
655 send( "500 Syntax error, command unrecognized" ); 674 send( "500 Syntax error, command unrecognized" );
656 else { 675 else {
657 if ( !gzipfile ) 676 if ( !gzipfile )
658 send( "213 " + QString::number( fi.size() ) ); 677 send( "213 " + QString::number( fi.size() ) );
659 else { 678 else {
660 Process duproc( QString("du") ); 679 Process duproc( QString("du") );
661 duproc.addArgument("-s"); 680 duproc.addArgument("-s");
662 QString in, out; 681 QString in, out;
663 if ( !duproc.exec(in, out) ) { 682 if ( !duproc.exec(in, out) ) {
664 qDebug("du process failed; just sending back 1K"); 683 qDebug("du process failed; just sending back 1K");
665 send( "213 1024"); 684 send( "213 1024");
666 } 685 }
667 else { 686 else {
668 QString size = out.left( out.find("\t") ); 687 QString size = out.left( out.find("\t") );
669 int guess = size.toInt() / 5; 688 int guess = size.toInt() / 5;
670 if ( filePath.contains("doc") ) 689 if ( filePath.contains("doc") )
671 guess *= 1000; 690 guess *= 1000;
672 qDebug("sending back gzip guess of %d", guess); 691 qDebug("sending back gzip guess of %d", guess);
673 send( "213 " + QString::number(guess) ); 692 send( "213 " + QString::number(guess) );
674 } 693 }
675 } 694 }
676 } 695 }
677 } 696 }
678 // name list (NLST) 697 // name list (NLST)
679 else if ( cmd == "NLST" ) { 698 else if ( cmd == "NLST" ) {
680 send( "502 Command not implemented" ); 699 send( "502 Command not implemented" );
681 } 700 }
682 701
683 // site parameters (SITE) 702 // site parameters (SITE)
684 else if ( cmd == "SITE" ) { 703 else if ( cmd == "SITE" ) {
685 send( "502 Command not implemented" ); 704 send( "502 Command not implemented" );
686 } 705 }
687 706
688 // system (SYST) 707 // system (SYST)
689 else if ( cmd == "SYST" ) { 708 else if ( cmd == "SYST" ) {
690 send( "215 UNIX Type: L8" ); 709 send( "215 UNIX Type: L8" );
691 } 710 }
692 711
693 // status (STAT) 712 // status (STAT)
694 else if ( cmd == "STAT" ) { 713 else if ( cmd == "STAT" ) {
695 send( "502 Command not implemented" ); 714 send( "502 Command not implemented" );
696 } 715 }
697 716
698 // help (HELP ) 717 // help (HELP )
699 else if ( cmd == "HELP" ) { 718 else if ( cmd == "HELP" ) {
700 send( "502 Command not implemented" ); 719 send( "502 Command not implemented" );
701 } 720 }
702 721
703 // noop (NOOP) 722 // noop (NOOP)
704 else if ( cmd == "NOOP" ) { 723 else if ( cmd == "NOOP" ) {
705 send( "200 Command okay" ); 724 send( "200 Command okay" );
706 } 725 }
707 726
708 // not implemented 727 // not implemented
709 else 728 else
710 send( "502 Command not implemented" ); 729 send( "502 Command not implemented" );
711 730
712 lastCommand = cmd; 731 lastCommand = cmd;
713} 732}
714 733
715bool ServerPI::backupRestoreGzip( const QString &file ) 734bool ServerPI::backupRestoreGzip( const QString &file )
716{ 735{
717 return (file.find( "backup" ) != -1 && 736 return (file.find( "backup" ) != -1 &&
718 file.findRev( ".tgz" ) == (int)file.length() - 4 ); 737 file.findRev( ".tgz" ) == (int)file.length() - 4 );
719} 738}
720 739
721bool ServerPI::backupRestoreGzip( const QString &file, QStringList &targets ) 740bool ServerPI::backupRestoreGzip( const QString &file, QStringList &targets )
722{ 741{
723 if ( file.find( "backup" ) != -1 && 742 if ( file.find( "backup" ) != -1 &&
724 file.findRev( ".tgz" ) == (int)file.length() - 4 ) { 743 file.findRev( ".tgz" ) == (int)file.length() - 4 ) {
725 QFileInfo info( file ); 744 QFileInfo info( file );
726 targets = info.dirPath( TRUE ); 745 targets = info.dirPath( TRUE );
727 qDebug("ServerPI::backupRestoreGzip for %s = %s", file.latin1(), 746 qDebug("ServerPI::backupRestoreGzip for %s = %s", file.latin1(),
728 targets.join(" ").latin1() ); 747 targets.join(" ").latin1() );
729 return true; 748 return true;
730 } 749 }
731 return false; 750 return false;
732} 751}
733 752
734void ServerPI::sendFile( const QString& file ) 753void ServerPI::sendFile( const QString& file )
735{ 754{
736 if ( passiv ) { 755 if ( passiv ) {
737 wait[SendFile] = TRUE; 756 wait[SendFile] = TRUE;
738 waitfile = file; 757 waitfile = file;
739 if ( waitsocket ) 758 if ( waitsocket )
740 newConnection( waitsocket ); 759 newConnection( waitsocket );
741 } 760 }
742 else { 761 else {
743 QStringList targets; 762 QStringList targets;
744 if ( backupRestoreGzip( file, targets ) ) 763 if ( backupRestoreGzip( file, targets ) )
745 dtp->sendGzipFile( file, targets, peeraddress, peerport ); 764 dtp->sendGzipFile( file, targets, peeraddress, peerport );
746 else 765 else
747 dtp->sendFile( file, peeraddress, peerport ); 766 dtp->sendFile( file, peeraddress, peerport );
748 } 767 }
749} 768}
750 769
751void ServerPI::retrieveFile( const QString& file ) 770void ServerPI::retrieveFile( const QString& file )
752{ 771{
753 if ( passiv ) { 772 if ( passiv ) {
754 wait[RetrieveFile] = TRUE; 773 wait[RetrieveFile] = TRUE;
755 waitfile = file; 774 waitfile = file;
756 if ( waitsocket ) 775 if ( waitsocket )
757 newConnection( waitsocket ); 776 newConnection( waitsocket );
758 } 777 }
759 else { 778 else {
760 QStringList targets; 779 QStringList targets;
761 if ( backupRestoreGzip( file, targets ) ) 780 if ( backupRestoreGzip( file, targets ) )
762 dtp->retrieveGzipFile( file, peeraddress, peerport ); 781 dtp->retrieveGzipFile( file, peeraddress, peerport );
763 else 782 else
764 dtp->retrieveFile( file, peeraddress, peerport ); 783 dtp->retrieveFile( file, peeraddress, peerport );
765 } 784 }
766} 785}
767 786
768bool ServerPI::parsePort( const QString& pp ) 787bool ServerPI::parsePort( const QString& pp )
769{ 788{
770 QStringList p = QStringList::split( ",", pp ); 789 QStringList p = QStringList::split( ",", pp );
771 if ( p.count() != 6 ) 790 if ( p.count() != 6 )
772 return FALSE; 791 return FALSE;
773 792
774 // h1,h2,h3,h4,p1,p2 793 // h1,h2,h3,h4,p1,p2
775 peeraddress = QHostAddress( ( p[0].toInt() << 24 ) + ( p[1].toInt() << 16 ) + 794 peeraddress = QHostAddress( ( p[0].toInt() << 24 ) + ( p[1].toInt() << 16 ) +
776 ( p[2].toInt() << 8 ) + p[3].toInt() ); 795 ( p[2].toInt() << 8 ) + p[3].toInt() );
777 peerport = ( p[4].toInt() << 8 ) + p[5].toInt(); 796 peerport = ( p[4].toInt() << 8 ) + p[5].toInt();
778 return TRUE; 797 return TRUE;
779} 798}
780 799
781void ServerPI::dtpCompleted() 800void ServerPI::dtpCompleted()
782{ 801{
783 send( "226 Closing data connection, file transfer successful" ); 802 send( "226 Closing data connection, file transfer successful" );
784 if ( dtp->dtpMode() == ServerDTP::RetrieveFile ) { 803 if ( dtp->dtpMode() == ServerDTP::RetrieveFile ) {
785 QString fn = dtp->fileName(); 804 QString fn = dtp->fileName();
786 if ( fn.right(8) == ".desktop" && fn.find("/Documents/") >= 0 ) { 805 if ( fn.right(8) == ".desktop" && fn.find("/Documents/") >= 0 ) {
787 QCopEnvelope e("QPE/System", "linkChanged(QString)" ); 806 QCopEnvelope e("QPE/System", "linkChanged(QString)" );
788 e << fn; 807 e << fn;
789 } 808 }
790 } 809 }
791 waitsocket = 0; 810 waitsocket = 0;
792 dtp->close(); 811 dtp->close();
793} 812}
794 813
795void ServerPI::dtpFailed() 814void ServerPI::dtpFailed()
796{ 815{
797 dtp->close(); 816 dtp->close();
798 waitsocket = 0; 817 waitsocket = 0;
799 send( "451 Requested action aborted: local error in processing" ); 818 send( "451 Requested action aborted: local error in processing" );
800} 819}
801 820
802void ServerPI::dtpError( int ) 821void ServerPI::dtpError( int )
803{ 822{
804 dtp->close(); 823 dtp->close();
805 waitsocket = 0; 824 waitsocket = 0;
806 send( "451 Requested action aborted: local error in processing" ); 825 send( "451 Requested action aborted: local error in processing" );
807} 826}
808 827
809bool ServerPI::sendList( const QString& arg ) 828bool ServerPI::sendList( const QString& arg )
810{ 829{
811 QByteArray listing; 830 QByteArray listing;
812 QBuffer buffer( listing ); 831 QBuffer buffer( listing );
813 832
814 if ( !buffer.open( IO_WriteOnly ) ) 833 if ( !buffer.open( IO_WriteOnly ) )
815 return FALSE; 834 return FALSE;
816 835
817 QTextStream ts( &buffer ); 836 QTextStream ts( &buffer );
818 QString fn = arg; 837 QString fn = arg;
819 838
820 if ( fn.isEmpty() ) 839 if ( fn.isEmpty() )
821 fn = directory.path(); 840 fn = directory.path();
822 841
823 QFileInfo fi( fn ); 842 QFileInfo fi( fn );
824 if ( !fi.exists() ) 843 if ( !fi.exists() )
825 return FALSE; 844 return FALSE;
826 845
827 // return file listing 846 // return file listing
828 if ( fi.isFile() ) { 847 if ( fi.isFile() ) {
829 ts << fileListing( &fi ) << endl; 848 ts << fileListing( &fi ) << endl;
830 } 849 }
831 850
832 // return directory listing 851 // return directory listing
833 else if ( fi.isDir() ) { 852 else if ( fi.isDir() ) {
834 QDir dir( fn ); 853 QDir dir( fn );
835 const QFileInfoList *list = dir.entryInfoList( QDir::All | QDir::Hidden ); 854 const QFileInfoList *list = dir.entryInfoList( QDir::All | QDir::Hidden );
836 855
837 QFileInfoListIterator it( *list ); 856 QFileInfoListIterator it( *list );
838 QFileInfo *info; 857 QFileInfo *info;
839 858
840 unsigned long total = 0; 859 unsigned long total = 0;
841 while ( ( info = it.current() ) ) { 860 while ( ( info = it.current() ) ) {
842 if ( info->fileName() != "." && info->fileName() != ".." ) 861 if ( info->fileName() != "." && info->fileName() != ".." )
843 total += info->size(); 862 total += info->size();
844 ++it; 863 ++it;
845 } 864 }
846 865
847 ts << "total " << QString::number( total / 1024 ) << endl; 866 ts << "total " << QString::number( total / 1024 ) << endl;
848 867
849 it.toFirst(); 868 it.toFirst();
850 while ( ( info = it.current() ) ) { 869 while ( ( info = it.current() ) ) {
851 if ( info->fileName() == "." || info->fileName() == ".." ) { 870 if ( info->fileName() == "." || info->fileName() == ".." ) {
852 ++it; 871 ++it;
853 continue; 872 continue;
854 } 873 }
855 ts << fileListing( info ) << endl; 874 ts << fileListing( info ) << endl;
856 ++it; 875 ++it;
857 } 876 }
858 } 877 }
859 878
860 if ( passiv ) { 879 if ( passiv ) {
861 waitarray = buffer.buffer(); 880 waitarray = buffer.buffer();
862 wait[SendByteArray] = TRUE; 881 wait[SendByteArray] = TRUE;
863 if ( waitsocket ) 882 if ( waitsocket )
864 newConnection( waitsocket ); 883 newConnection( waitsocket );
865 } 884 }
866 else 885 else
867 dtp->sendByteArray( buffer.buffer(), peeraddress, peerport ); 886 dtp->sendByteArray( buffer.buffer(), peeraddress, peerport );
868 return TRUE; 887 return TRUE;
869} 888}
870 889
871QString ServerPI::fileListing( QFileInfo *info ) 890QString ServerPI::fileListing( QFileInfo *info )
872{ 891{
873 if ( !info ) 892 if ( !info )
874 return QString::null; 893 return QString::null;
875 QString s; 894 QString s;
876 895
877 // type char 896 // type char
878 if ( info->isDir() ) 897 if ( info->isDir() )
879 s += "d"; 898 s += "d";
880 else if ( info->isSymLink() ) 899 else if ( info->isSymLink() )
881 s += "l"; 900 s += "l";
882 else 901 else
883 s += "-"; 902 s += "-";
884 903
885 // permisson string 904 // permisson string
886 s += permissionString( info ) + " "; 905 s += permissionString( info ) + " ";
887 906
888 // number of hardlinks 907 // number of hardlinks
889 int subdirs = 1; 908 int subdirs = 1;
890 909
891 if ( info->isDir() ) 910 if ( info->isDir() )
892 subdirs = 2; 911 subdirs = 2;
893 // FIXME : this is to slow 912 // FIXME : this is to slow
894 //if ( info->isDir() ) 913 //if ( info->isDir() )
895 //subdirs = QDir( info->absFilePath() ).entryList( QDir::Dirs ).count(); 914 //subdirs = QDir( info->absFilePath() ).entryList( QDir::Dirs ).count();
896 915
897 s += QString::number( subdirs ).rightJustify( 3, ' ', TRUE ) + " "; 916 s += QString::number( subdirs ).rightJustify( 3, ' ', TRUE ) + " ";
898 917
899 // owner 918 // owner
900 s += info->owner().leftJustify( 8, ' ', TRUE ) + " "; 919 s += info->owner().leftJustify( 8, ' ', TRUE ) + " ";
901 920
902 // group 921 // group
903 s += info->group().leftJustify( 8, ' ', TRUE ) + " "; 922 s += info->group().leftJustify( 8, ' ', TRUE ) + " ";
904 923
905 // file size in bytes 924 // file size in bytes
906 s += QString::number( info->size() ).rightJustify( 9, ' ', TRUE ) + " "; 925 s += QString::number( info->size() ).rightJustify( 9, ' ', TRUE ) + " ";
907 926
908 // last modified date 927 // last modified date
909 QDate date = info->lastModified().date(); 928 QDate date = info->lastModified().date();
910 QTime time = info->lastModified().time(); 929 QTime time = info->lastModified().time();
911 s += date.monthName( date.month() ) + " " 930 s += date.monthName( date.month() ) + " "
912 + QString::number( date.day() ).rightJustify( 2, ' ', TRUE ) + " " 931 + QString::number( date.day() ).rightJustify( 2, ' ', TRUE ) + " "
913 + QString::number( time.hour() ).rightJustify( 2, '0', TRUE ) + ":" 932 + QString::number( time.hour() ).rightJustify( 2, '0', TRUE ) + ":"
914 + QString::number( time.minute() ).rightJustify( 2, '0', TRUE ) + " "; 933 + QString::number( time.minute() ).rightJustify( 2, '0', TRUE ) + " ";
915 934
916 // file name 935 // file name
917 s += info->fileName(); 936 s += info->fileName();
918 937
919 return s; 938 return s;
920} 939}
921 940
922QString ServerPI::permissionString( QFileInfo *info ) 941QString ServerPI::permissionString( QFileInfo *info )
923{ 942{
924 if ( !info ) 943 if ( !info )
925 return QString( "---------" ); 944 return QString( "---------" );
926 QString s; 945 QString s;
927 946
928 // user 947 // user
929 if ( info->permission( QFileInfo::ReadUser ) ) 948 if ( info->permission( QFileInfo::ReadUser ) )
930 s += "r"; 949 s += "r";
931 else 950 else
932 s += "-"; 951 s += "-";
933 if ( info->permission( QFileInfo::WriteUser ) ) 952 if ( info->permission( QFileInfo::WriteUser ) )
934 s += "w"; 953 s += "w";
935 else 954 else
936 s += "-"; 955 s += "-";
937 if ( info->permission( QFileInfo::ExeUser ) ) 956 if ( info->permission( QFileInfo::ExeUser ) )
938 s += "x"; 957 s += "x";
939 else 958 else
940 s += "-"; 959 s += "-";
941 960
942 // group 961 // group
943 if ( info->permission( QFileInfo::ReadGroup ) ) 962 if ( info->permission( QFileInfo::ReadGroup ) )
944 s += "r"; 963 s += "r";
945 else 964 else
946 s += "-"; 965 s += "-";
947 if ( info->permission( QFileInfo::WriteGroup ) ) 966 if ( info->permission( QFileInfo::WriteGroup ) )
948 s += "w"; 967 s += "w";
949 else 968 else
950 s += "-"; 969 s += "-";
951 if ( info->permission( QFileInfo::ExeGroup ) ) 970 if ( info->permission( QFileInfo::ExeGroup ) )
952 s += "x"; 971 s += "x";
953 else 972 else
954 s += "-"; 973 s += "-";
955 974
956 // exec 975 // exec
957 if ( info->permission( QFileInfo::ReadOther ) ) 976 if ( info->permission( QFileInfo::ReadOther ) )
958 s += "r"; 977 s += "r";
959 else 978 else
960 s += "-"; 979 s += "-";
961 if ( info->permission( QFileInfo::WriteOther ) ) 980 if ( info->permission( QFileInfo::WriteOther ) )
962 s += "w"; 981 s += "w";
963 else 982 else
964 s += "-"; 983 s += "-";
965 if ( info->permission( QFileInfo::ExeOther ) ) 984 if ( info->permission( QFileInfo::ExeOther ) )
966 s += "x"; 985 s += "x";
967 else 986 else
968 s += "-"; 987 s += "-";
969 988
970 return s; 989 return s;
971} 990}
972 991
973void ServerPI::newConnection( int socket ) 992void ServerPI::newConnection( int socket )
974{ 993{
975 //qDebug( "New incomming connection" ); 994 //qDebug( "New incomming connection" );
976 995
977 if ( !passiv ) 996 if ( !passiv )
978 return ; 997 return ;
979 998
980 if ( wait[SendFile] ) { 999 if ( wait[SendFile] ) {
981 QStringList targets; 1000 QStringList targets;
982 if ( backupRestoreGzip( waitfile, targets ) ) 1001 if ( backupRestoreGzip( waitfile, targets ) )
983 dtp->sendGzipFile( waitfile, targets ); 1002 dtp->sendGzipFile( waitfile, targets );
984 else 1003 else
985 dtp->sendFile( waitfile ); 1004 dtp->sendFile( waitfile );
986 dtp->setSocket( socket ); 1005 dtp->setSocket( socket );
987 } 1006 }
988 else if ( wait[RetrieveFile] ) { 1007 else if ( wait[RetrieveFile] ) {
989 qDebug("check retrieve file"); 1008 qDebug("check retrieve file");
990 if ( backupRestoreGzip( waitfile ) ) 1009 if ( backupRestoreGzip( waitfile ) )
991 dtp->retrieveGzipFile( waitfile ); 1010 dtp->retrieveGzipFile( waitfile );
992 else 1011 else
993 dtp->retrieveFile( waitfile ); 1012 dtp->retrieveFile( waitfile );
994 dtp->setSocket( socket ); 1013 dtp->setSocket( socket );
995 } 1014 }
996 else if ( wait[SendByteArray] ) { 1015 else if ( wait[SendByteArray] ) {
997 dtp->sendByteArray( waitarray ); 1016 dtp->sendByteArray( waitarray );
998 dtp->setSocket( socket ); 1017 dtp->setSocket( socket );
999 } 1018 }
1000 else if ( wait[RetrieveByteArray] ) { 1019 else if ( wait[RetrieveByteArray] ) {
1001 qDebug("retrieve byte array"); 1020 qDebug("retrieve byte array");
1002 dtp->retrieveByteArray(); 1021 dtp->retrieveByteArray();
1003 dtp->setSocket( socket ); 1022 dtp->setSocket( socket );
1004 } 1023 }
1005 else 1024 else
1006 waitsocket = socket; 1025 waitsocket = socket;
1007 1026
1008 for ( int i = 0; i < 4; i++ ) 1027 for ( int i = 0; i < 4; i++ )
1009 wait[i] = FALSE; 1028 wait[i] = FALSE;
1010} 1029}
1011 1030
1012QString ServerPI::absFilePath( const QString& file ) 1031QString ServerPI::absFilePath( const QString& file )
1013{ 1032{
1014 if ( file.isEmpty() ) 1033 if ( file.isEmpty() )
1015 return file; 1034 return file;
1016 1035
1017 QString filepath( file ); 1036 QString filepath( file );
1018 if ( file[0] != "/" ) 1037 if ( file[0] != "/" )
1019 filepath = directory.path() + "/" + file; 1038 filepath = directory.path() + "/" + file;
1020 1039
1021 return filepath; 1040 return filepath;
1022} 1041}
1023 1042
1024 1043
1025void ServerPI::timerEvent( QTimerEvent * ) 1044void ServerPI::timerEvent( QTimerEvent * )
1026{ 1045{
1027 connectionClosed(); 1046 connectionClosed();
1028} 1047}
1029 1048
1030 1049
1031ServerDTP::ServerDTP( QObject *parent, const char* name) 1050ServerDTP::ServerDTP( QObject *parent, const char* name)
1032 : QSocket( parent, name ), mode( Idle ), createTargzProc( 0 ), 1051 : QSocket( parent, name ), mode( Idle ), createTargzProc( 0 ),
1033 retrieveTargzProc( 0 ), gzipProc( 0 ) 1052 retrieveTargzProc( 0 ), gzipProc( 0 )
1034{ 1053{
1035 1054
1036 connect( this, SIGNAL( connected() ), SLOT( connected() ) ); 1055 connect( this, SIGNAL( connected() ), SLOT( connected() ) );
1037 connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) ); 1056 connect( this, SIGNAL( connectionClosed() ), SLOT( connectionClosed() ) );
1038 connect( this, SIGNAL( bytesWritten( int ) ), SLOT( bytesWritten( int ) ) ); 1057 connect( this, SIGNAL( bytesWritten( int ) ), SLOT( bytesWritten( int ) ) );
1039 connect( this, SIGNAL( readyRead() ), SLOT( readyRead() ) ); 1058 connect( this, SIGNAL( readyRead() ), SLOT( readyRead() ) );
1040 1059
1041 gzipProc = new OProcess( this, "gzipProc" ); 1060 gzipProc = new OProcess( this, "gzipProc" );
1042 1061
1043 createTargzProc = new OProcess( QString("tar"), this, "createTargzProc"); 1062 createTargzProc = new OProcess( QString("tar"), this, "createTargzProc");
1044 createTargzProc->setWorkingDirectory( QDir::rootDirPath() ); 1063 createTargzProc->setWorkingDirectory( QDir::rootDirPath() );
1045 connect( createTargzProc, SIGNAL( processExited(OProcess *) ), SLOT( targzDone() ) ); 1064 connect( createTargzProc, SIGNAL( processExited(OProcess *) ), SLOT( targzDone() ) );
1046 1065
1047 QStringList args = "tar"; 1066 QStringList args = "tar";
1048 args += "-xv"; 1067 args += "-xv";
1049 retrieveTargzProc = new OProcess( args, this, "retrieveTargzProc" ); 1068 retrieveTargzProc = new OProcess( args, this, "retrieveTargzProc" );
1050 retrieveTargzProc->setWorkingDirectory( QDir::rootDirPath() ); 1069 retrieveTargzProc->setWorkingDirectory( QDir::rootDirPath() );
1051 connect( retrieveTargzProc, SIGNAL( processExited(OProcess *) ), 1070 connect( retrieveTargzProc, SIGNAL( processExited(OProcess *) ),
1052 SIGNAL( completed() ) ); 1071 SIGNAL( completed() ) );
1053 connect( retrieveTargzProc, SIGNAL( processExited(OProcess *) ), 1072 connect( retrieveTargzProc, SIGNAL( processExited(OProcess *) ),
1054 SLOT( extractTarDone() ) ); 1073 SLOT( extractTarDone() ) );
1055} 1074}
1056 1075
1057ServerDTP::~ServerDTP() 1076ServerDTP::~ServerDTP()
1058{ 1077{
1059 buf.close(); 1078 buf.close();
1060 file.close(); 1079 file.close();
1061 createTargzProc->kill(); 1080 createTargzProc->kill();
1062} 1081}
1063 1082
1064void ServerDTP::extractTarDone() 1083void ServerDTP::extractTarDone()
1065{ 1084{
1066 qDebug("extract done"); 1085 qDebug("extract done");
1067#ifndef QT_NO_COP 1086#ifndef QT_NO_COP
1068 1087
1069 QCopEnvelope e( "QPE/Desktop", "restoreDone(QString)" ); 1088 QCopEnvelope e( "QPE/Desktop", "restoreDone(QString)" );
1070 e << file.name(); 1089 e << file.name();
1071#endif 1090#endif
1072} 1091}
1073 1092
1074void ServerDTP::connected() 1093void ServerDTP::connected()
1075{ 1094{
1076 // send file mode 1095 // send file mode
1077 switch ( mode ) { 1096 switch ( mode ) {
1078 case SendFile : 1097 case SendFile :
1079 if ( !file.exists() || !file.open( IO_ReadOnly) ) { 1098 if ( !file.exists() || !file.open( IO_ReadOnly) ) {
1080 emit failed(); 1099 emit failed();
1081 mode = Idle; 1100 mode = Idle;
1082 return ; 1101 return ;
1083 } 1102 }
1084 1103
1085 //qDebug( "Debug: Sending file '%s'", file.name().latin1() ); 1104 //qDebug( "Debug: Sending file '%s'", file.name().latin1() );
1086 1105
1087 bytes_written = 0; 1106 bytes_written = 0;
1088 if ( file.size() == 0 ) { 1107 if ( file.size() == 0 ) {
1089 //make sure it doesn't hang on empty files 1108 //make sure it doesn't hang on empty files
1090 file.close(); 1109 file.close();
1091 emit completed(); 1110 emit completed();
1092 mode = Idle; 1111 mode = Idle;
1093 } 1112 }
1094 else { 1113 else {
1095 1114
1096 if ( !file.atEnd() ) { 1115 if ( !file.atEnd() ) {
1097 QCString s; 1116 QCString s;
1098 s.resize( block_size ); 1117 s.resize( block_size );
1099 int bytes = file.readBlock( s.data(), block_size ); 1118 int bytes = file.readBlock( s.data(), block_size );
1100 writeBlock( s.data(), bytes ); 1119 writeBlock( s.data(), bytes );
1101 } 1120 }
1102 } 1121 }
1103 break; 1122 break;
1104 case SendGzipFile: 1123 case SendGzipFile:
1105 if ( createTargzProc->isRunning() ) { 1124 if ( createTargzProc->isRunning() ) {
1106 // SHOULDN'T GET HERE, BUT DOING A SAFETY CHECK ANYWAY 1125 // SHOULDN'T GET HERE, BUT DOING A SAFETY CHECK ANYWAY
1107 qWarning("Previous tar --gzip process is still running; killing it..."); 1126 qWarning("Previous tar --gzip process is still running; killing it...");
1108 createTargzProc->kill(); 1127 createTargzProc->kill();
1109 } 1128 }
1110 1129
1111 bytes_written = 0; 1130 bytes_written = 0;
1112 qDebug("==>start send tar process"); 1131 qDebug("==>start send tar process");
1113 if ( !createTargzProc->start(OProcess::NotifyOnExit, OProcess::Stdout) ) 1132 if ( !createTargzProc->start(OProcess::NotifyOnExit, OProcess::Stdout) )
1114 qWarning("Error starting %s or %s", 1133 qWarning("Error starting %s or %s",
1115 createTargzProc->args()[0].data(), 1134 createTargzProc->args()[0].data(),
1116 gzipProc->args()[0].data()); 1135 gzipProc->args()[0].data());
1117 break; 1136 break;
1118 case SendBuffer: 1137 case SendBuffer:
1119 if ( !buf.open( IO_ReadOnly) ) { 1138 if ( !buf.open( IO_ReadOnly) ) {
1120 emit failed(); 1139 emit failed();
1121 mode = Idle; 1140 mode = Idle;
1122 return ; 1141 return ;
1123 } 1142 }
1124 1143
1125 // qDebug( "Debug: Sending byte array" ); 1144 // qDebug( "Debug: Sending byte array" );
1126 bytes_written = 0; 1145 bytes_written = 0;
1127 while ( !buf.atEnd() ) 1146 while ( !buf.atEnd() )
1128 putch( buf.getch() ); 1147 putch( buf.getch() );
1129 buf.close(); 1148 buf.close();
1130 break; 1149 break;
1131 case RetrieveFile: 1150 case RetrieveFile:
1132 // retrieve file mode 1151 // retrieve file mode
1133 if ( file.exists() && !file.remove() ) { 1152 if ( file.exists() && !file.remove() ) {
1134 emit failed(); 1153 emit failed();
1135 mode = Idle; 1154 mode = Idle;
1136 return ; 1155 return ;
1137 } 1156 }
1138 1157
1139 if ( !file.open( IO_WriteOnly) ) { 1158 if ( !file.open( IO_WriteOnly) ) {
1140 emit failed(); 1159 emit failed();
1141 mode = Idle; 1160 mode = Idle;
1142 return ; 1161 return ;
1143 } 1162 }
1144 // qDebug( "Debug: Retrieving file %s", file.name().latin1() ); 1163 // qDebug( "Debug: Retrieving file %s", file.name().latin1() );
1145 break; 1164 break;
1146 case RetrieveGzipFile: 1165 case RetrieveGzipFile:
1147 qDebug("=-> starting tar process to receive .tgz file"); 1166 qDebug("=-> starting tar process to receive .tgz file");
1148 break; 1167 break;
1149 case RetrieveBuffer: 1168 case RetrieveBuffer:
1150 // retrieve buffer mode 1169 // retrieve buffer mode
1151 if ( !buf.open( IO_WriteOnly) ) { 1170 if ( !buf.open( IO_WriteOnly) ) {
1152 emit failed(); 1171 emit failed();
1153 mode = Idle; 1172 mode = Idle;
1154 return ; 1173 return ;
1155 } 1174 }
1156 // qDebug( "Debug: Retrieving byte array" ); 1175 // qDebug( "Debug: Retrieving byte array" );
1157 break; 1176 break;
1158 case Idle: 1177 case Idle:
1159 qDebug("connection established but mode set to Idle; BUG!"); 1178 qDebug("connection established but mode set to Idle; BUG!");
1160 break; 1179 break;
1161 } 1180 }
1162} 1181}
1163 1182
1164void ServerDTP::connectionClosed() 1183void ServerDTP::connectionClosed()
1165{ 1184{
1166 //qDebug( "Debug: Data connection closed %ld bytes written", bytes_written ); 1185 //qDebug( "Debug: Data connection closed %ld bytes written", bytes_written );
1167 1186
1168 // send file mode 1187 // send file mode
1169 if ( SendFile == mode ) { 1188 if ( SendFile == mode ) {
1170 if ( bytes_written == file.size() ) 1189 if ( bytes_written == file.size() )
1171 emit completed(); 1190 emit completed();
1172 else 1191 else
1173 emit failed(); 1192 emit failed();
1174 } 1193 }
1175 1194
1176 // send buffer mode 1195 // send buffer mode
1177 else if ( SendBuffer == mode ) { 1196 else if ( SendBuffer == mode ) {
1178 if ( bytes_written == buf.size() ) 1197 if ( bytes_written == buf.size() )
1179 emit completed(); 1198 emit completed();
1180 else 1199 else
1181 emit failed(); 1200 emit failed();
1182 } 1201 }
1183 1202
1184 // retrieve file mode 1203 // retrieve file mode
1185 else if ( RetrieveFile == mode ) { 1204 else if ( RetrieveFile == mode ) {
1186 file.close(); 1205 file.close();
1187 emit completed(); 1206 emit completed();
1188 } 1207 }
1189 1208
1190 else if ( RetrieveGzipFile == mode ) { 1209 else if ( RetrieveGzipFile == mode ) {
1191 qDebug("Done writing ungzip file; closing input"); 1210 qDebug("Done writing ungzip file; closing input");
1192 gzipProc->flushStdin(); 1211 gzipProc->flushStdin();
1193 gzipProc->closeStdin(); 1212 gzipProc->closeStdin();
1194 } 1213 }
1195 1214
1196 // retrieve buffer mode 1215 // retrieve buffer mode
1197 else if ( RetrieveBuffer == mode ) { 1216 else if ( RetrieveBuffer == mode ) {
1198 buf.close(); 1217 buf.close();
1199 emit completed(); 1218 emit completed();
1200 } 1219 }
1201 1220
1202 mode = Idle; 1221 mode = Idle;
1203} 1222}
1204 1223
1205void ServerDTP::bytesWritten( int bytes ) 1224void ServerDTP::bytesWritten( int bytes )
1206{ 1225{
1207 bytes_written += bytes; 1226 bytes_written += bytes;
1208 1227
1209 // send file mode 1228 // send file mode
1210 if ( SendFile == mode ) { 1229 if ( SendFile == mode ) {
1211 1230
1212 if ( bytes_written == file.size() ) { 1231 if ( bytes_written == file.size() ) {
1213 // qDebug( "Debug: Sending complete: %d bytes", file.size() ); 1232 // qDebug( "Debug: Sending complete: %d bytes", file.size() );
1214 file.close(); 1233 file.close();
1215 emit completed(); 1234 emit completed();
1216 mode = Idle; 1235 mode = Idle;
1217 } 1236 }
1218 else if ( !file.atEnd() ) { 1237 else if ( !file.atEnd() ) {
1219 QCString s; 1238 QCString s;
1220 s.resize( block_size ); 1239 s.resize( block_size );
1221 int bytes = file.readBlock( s.data(), block_size ); 1240 int bytes = file.readBlock( s.data(), block_size );
1222 writeBlock( s.data(), bytes ); 1241 writeBlock( s.data(), bytes );
1223 } 1242 }
1224 } 1243 }
1225 1244
1226 // send buffer mode 1245 // send buffer mode
1227 if ( SendBuffer == mode ) { 1246 if ( SendBuffer == mode ) {
1228 1247
1229 if ( bytes_written == buf.size() ) { 1248 if ( bytes_written == buf.size() ) {
1230 // qDebug( "Debug: Sending complete: %d bytes", buf.size() ); 1249 // qDebug( "Debug: Sending complete: %d bytes", buf.size() );
1231 emit completed(); 1250 emit completed();
1232 mode = Idle; 1251 mode = Idle;
1233 } 1252 }
1234 } 1253 }
1235} 1254}
1236 1255
1237void ServerDTP::readyRead() 1256void ServerDTP::readyRead()
1238{ 1257{
1239 // retrieve file mode 1258 // retrieve file mode
1240 if ( RetrieveFile == mode ) { 1259 if ( RetrieveFile == mode ) {
1241 QCString s; 1260 QCString s;
1242 s.resize( bytesAvailable() ); 1261 s.resize( bytesAvailable() );
1243 readBlock( s.data(), bytesAvailable() ); 1262 readBlock( s.data(), bytesAvailable() );
1244 file.writeBlock( s.data(), s.size() ); 1263 file.writeBlock( s.data(), s.size() );
1245 } 1264 }
1246 else if ( RetrieveGzipFile == mode ) { 1265 else if ( RetrieveGzipFile == mode ) {
1247 if ( !gzipProc->isRunning() ) 1266 if ( !gzipProc->isRunning() )
1248 gzipProc->start(OProcess::NotifyOnExit, (OProcess::Communication) ( OProcess::Stdin | OProcess::Stdout )); 1267 gzipProc->start(OProcess::NotifyOnExit, (OProcess::Communication) ( OProcess::Stdin | OProcess::Stdout ));
1249 1268
1250 QByteArray s; 1269 QByteArray s;
1251 s.resize( bytesAvailable() ); 1270 s.resize( bytesAvailable() );
1252 readBlock( s.data(), bytesAvailable() ); 1271 readBlock( s.data(), bytesAvailable() );
1253 gzipProc->writeStdin( s.data(), s.size() ); 1272 gzipProc->writeStdin( s.data(), s.size() );
1254 qDebug("wrote %d bytes to ungzip ", s.size() ); 1273 qDebug("wrote %d bytes to ungzip ", s.size() );
1255 } 1274 }
1256 // retrieve buffer mode 1275 // retrieve buffer mode
1257 else if ( RetrieveBuffer == mode ) { 1276 else if ( RetrieveBuffer == mode ) {
1258 QCString s; 1277 QCString s;
1259 s.resize( bytesAvailable() ); 1278 s.resize( bytesAvailable() );
1260 readBlock( s.data(), bytesAvailable() ); 1279 readBlock( s.data(), bytesAvailable() );
1261 buf.writeBlock( s.data(), s.size() ); 1280 buf.writeBlock( s.data(), s.size() );
1262 } 1281 }
1263} 1282}
1264 1283
1265void ServerDTP::writeTargzBlock(OProcess *, char *buffer, int buflen) 1284void ServerDTP::writeTargzBlock(OProcess *, char *buffer, int buflen)
1266{ 1285{
1267 writeBlock( buffer, buflen ); 1286 writeBlock( buffer, buflen );
1268 qDebug("writeTargzBlock %d", buflen); 1287 qDebug("writeTargzBlock %d", buflen);
1269 if ( !createTargzProc->isRunning() ) { 1288 if ( !createTargzProc->isRunning() ) {
1270 qDebug("tar and gzip done"); 1289 qDebug("tar and gzip done");
1271 emit completed(); 1290 emit completed();
1272 mode = Idle; 1291 mode = Idle;
1273 disconnect( gzipProc, SIGNAL( receivedStdout(OProcess *, char *, int ) ), 1292 disconnect( gzipProc, SIGNAL( receivedStdout(OProcess *, char *, int ) ),
1274 this, SLOT( writeTargzBlock(OProcess *, char *, int) ) ); 1293 this, SLOT( writeTargzBlock(OProcess *, char *, int) ) );
1275 } 1294 }
1276} 1295}
1277 1296
1278void ServerDTP::targzDone() 1297void ServerDTP::targzDone()
1279{ 1298{
1280 //qDebug("targz done"); 1299 //qDebug("targz done");
1281 disconnect( createTargzProc, SIGNAL( receivedStdout(OProcess *, char *, int) ), 1300 disconnect( createTargzProc, SIGNAL( receivedStdout(OProcess *, char *, int) ),
1282 this, SLOT( gzipTarBlock(OProcess *, char *, int) ) ); 1301 this, SLOT( gzipTarBlock(OProcess *, char *, int) ) );
1283 gzipProc->closeStdin(); 1302 gzipProc->closeStdin();
1284} 1303}
1285 1304
1286void ServerDTP::gzipTarBlock(OProcess *, char *buffer, int buflen) 1305void ServerDTP::gzipTarBlock(OProcess *, char *buffer, int buflen)
1287{ 1306{
1288 //qDebug("gzipTarBlock"); 1307 //qDebug("gzipTarBlock");
1289 if ( !gzipProc->isRunning() ) { 1308 if ( !gzipProc->isRunning() ) {
1290 //qDebug("auto start gzip proc"); 1309 //qDebug("auto start gzip proc");
1291 gzipProc->start(OProcess::NotifyOnExit, (OProcess::Communication) ( OProcess::Stdin | OProcess::Stdout )); 1310 gzipProc->start(OProcess::NotifyOnExit, (OProcess::Communication) ( OProcess::Stdin | OProcess::Stdout ));
1292 } 1311 }
1293 gzipProc->writeStdin( buffer, buflen ); 1312 gzipProc->writeStdin( buffer, buflen );
1294} 1313}
1295 1314
1296void ServerDTP::sendFile( const QString fn, const QHostAddress& host, Q_UINT16 port ) 1315void ServerDTP::sendFile( const QString fn, const QHostAddress& host, Q_UINT16 port )
1297{ 1316{
1298 file.setName( fn ); 1317 file.setName( fn );
1299 mode = SendFile; 1318 mode = SendFile;
1300 connectToHost( host.toString(), port ); 1319 connectToHost( host.toString(), port );
1301} 1320}
1302 1321
1303void ServerDTP::sendFile( const QString fn ) 1322void ServerDTP::sendFile( const QString fn )
1304{ 1323{
1305 file.setName( fn ); 1324 file.setName( fn );
1306 mode = SendFile; 1325 mode = SendFile;
1307} 1326}
1308 1327
1309void ServerDTP::sendGzipFile( const QString &fn, 1328void ServerDTP::sendGzipFile( const QString &fn,
1310 const QStringList &archiveTargets, 1329 const QStringList &archiveTargets,
1311 const QHostAddress& host, Q_UINT16 port ) 1330 const QHostAddress& host, Q_UINT16 port )
1312{ 1331{
1313 sendGzipFile( fn, archiveTargets ); 1332 sendGzipFile( fn, archiveTargets );
1314 connectToHost( host.toString(), port ); 1333 connectToHost( host.toString(), port );
1315} 1334}
1316 1335
1317void ServerDTP::sendGzipFile( const QString &fn, 1336void ServerDTP::sendGzipFile( const QString &fn,
1318 const QStringList &archiveTargets ) 1337 const QStringList &archiveTargets )
1319{ 1338{
1320 mode = SendGzipFile; 1339 mode = SendGzipFile;
1321 file.setName( fn ); 1340 file.setName( fn );
1322 1341
1323 QStringList args = "tar"; 1342 QStringList args = "tar";
1324 args += "-cv"; 1343 args += "-cv";
1325 args += archiveTargets; 1344 args += archiveTargets;
1326 qDebug("sendGzipFile %s", args.join(" ").latin1() ); 1345 qDebug("sendGzipFile %s", args.join(" ").latin1() );
1327 createTargzProc->clearArguments( ); 1346 createTargzProc->clearArguments( );
1328 *createTargzProc << args; 1347 *createTargzProc << args;
1329 connect( createTargzProc, 1348 connect( createTargzProc,
1330 SIGNAL( receivedStdout(OProcess *, char *, int) ), SLOT( gzipTarBlock(OProcess *, char *, int) ) ); 1349 SIGNAL( receivedStdout(OProcess *, char *, int) ), SLOT( gzipTarBlock(OProcess *, char *, int) ) );
1331 1350
1332 gzipProc->clearArguments( ); 1351 gzipProc->clearArguments( );
1333 *gzipProc << "gzip"; 1352 *gzipProc << "gzip";
1334 connect( gzipProc, SIGNAL( receivedStdout(OProcess *, char *, int) ), 1353 connect( gzipProc, SIGNAL( receivedStdout(OProcess *, char *, int) ),
1335 SLOT( writeTargzBlock(OProcess *, char *, int) ) ); 1354 SLOT( writeTargzBlock(OProcess *, char *, int) ) );
1336} 1355}
1337 1356
1338void ServerDTP::gunzipDone() 1357void ServerDTP::gunzipDone()
1339{ 1358{
1340 qDebug("gunzipDone"); 1359 qDebug("gunzipDone");
1341 disconnect( gzipProc, SIGNAL( processExited() ), 1360 disconnect( gzipProc, SIGNAL( processExited() ),
1342 this, SLOT( gunzipDone() ) ); 1361 this, SLOT( gunzipDone() ) );
1343 retrieveTargzProc->closeStdin(); 1362 retrieveTargzProc->closeStdin();
1344 disconnect( gzipProc, SIGNAL( receivedStdout(OProcess *, char *, int) ), 1363 disconnect( gzipProc, SIGNAL( receivedStdout(OProcess *, char *, int) ),
1345 this, SLOT( tarExtractBlock(OProcess *, char *, int) ) ); 1364 this, SLOT( tarExtractBlock(OProcess *, char *, int) ) );
1346} 1365}
1347 1366
1348void ServerDTP::tarExtractBlock(OProcess *, char *buffer, int buflen) 1367void ServerDTP::tarExtractBlock(OProcess *, char *buffer, int buflen)
1349{ 1368{
1350 qDebug("tarExtractBlock"); 1369 qDebug("tarExtractBlock");
1351 if ( !retrieveTargzProc->isRunning() ) { 1370 if ( !retrieveTargzProc->isRunning() ) {
1352 qDebug("auto start ungzip proc"); 1371 qDebug("auto start ungzip proc");
1353 if ( !retrieveTargzProc->start(OProcess::NotifyOnExit, OProcess::Stdin) ) 1372 if ( !retrieveTargzProc->start(OProcess::NotifyOnExit, OProcess::Stdin) )
1354 qWarning(" failed to start tar -x process"); 1373 qWarning(" failed to start tar -x process");
1355 } 1374 }
1356 retrieveTargzProc->writeStdin( buffer, buflen ); 1375 retrieveTargzProc->writeStdin( buffer, buflen );
1357} 1376}
1358 1377
1359 1378
1360void ServerDTP::retrieveFile( const QString fn, const QHostAddress& host, Q_UINT16 port ) 1379void ServerDTP::retrieveFile( const QString fn, const QHostAddress& host, Q_UINT16 port )
1361{ 1380{
1362 file.setName( fn ); 1381 file.setName( fn );
1363 mode = RetrieveFile; 1382 mode = RetrieveFile;
1364 connectToHost( host.toString(), port ); 1383 connectToHost( host.toString(), port );
1365} 1384}
1366 1385
1367void ServerDTP::retrieveFile( const QString fn ) 1386void ServerDTP::retrieveFile( const QString fn )
1368{ 1387{
1369 file.setName( fn ); 1388 file.setName( fn );
1370 mode = RetrieveFile; 1389 mode = RetrieveFile;
1371} 1390}
1372 1391
1373void ServerDTP::retrieveGzipFile( const QString &fn ) 1392void ServerDTP::retrieveGzipFile( const QString &fn )
1374{ 1393{
1375 qDebug("retrieveGzipFile %s", fn.latin1()); 1394 qDebug("retrieveGzipFile %s", fn.latin1());
1376 file.setName( fn ); 1395 file.setName( fn );
1377 mode = RetrieveGzipFile; 1396 mode = RetrieveGzipFile;
1378 1397
1379 gzipProc->clearArguments(); 1398 gzipProc->clearArguments();
1380 *gzipProc << "gunzip"; 1399 *gzipProc << "gunzip";
1381 connect( gzipProc, SIGNAL( readyReadStdout() ), 1400 connect( gzipProc, SIGNAL( readyReadStdout() ),
1382 SLOT( tarExtractBlock() ) ); 1401 SLOT( tarExtractBlock() ) );
1383 connect( gzipProc, SIGNAL( processExited() ), 1402 connect( gzipProc, SIGNAL( processExited() ),
1384 SLOT( gunzipDone() ) ); 1403 SLOT( gunzipDone() ) );
1385} 1404}
1386 1405
1387void ServerDTP::retrieveGzipFile( const QString &fn, const QHostAddress& host, Q_UINT16 port ) 1406void ServerDTP::retrieveGzipFile( const QString &fn, const QHostAddress& host, Q_UINT16 port )
1388{ 1407{
1389 retrieveGzipFile( fn ); 1408 retrieveGzipFile( fn );
1390 connectToHost( host.toString(), port ); 1409 connectToHost( host.toString(), port );
1391} 1410}
1392 1411
1393void ServerDTP::sendByteArray( const QByteArray& array, const QHostAddress& host, Q_UINT16 port ) 1412void ServerDTP::sendByteArray( const QByteArray& array, const QHostAddress& host, Q_UINT16 port )
1394{ 1413{
1395 buf.setBuffer( array ); 1414 buf.setBuffer( array );
1396 mode = SendBuffer; 1415 mode = SendBuffer;
1397 connectToHost( host.toString(), port ); 1416 connectToHost( host.toString(), port );
1398} 1417}
1399 1418
1400void ServerDTP::sendByteArray( const QByteArray& array ) 1419void ServerDTP::sendByteArray( const QByteArray& array )
1401{ 1420{
1402 buf.setBuffer( array ); 1421 buf.setBuffer( array );
1403 mode = SendBuffer; 1422 mode = SendBuffer;
1404} 1423}
1405 1424
1406void ServerDTP::retrieveByteArray( const QHostAddress& host, Q_UINT16 port ) 1425void ServerDTP::retrieveByteArray( const QHostAddress& host, Q_UINT16 port )
1407{ 1426{
1408 buf.setBuffer( QByteArray() ); 1427 buf.setBuffer( QByteArray() );
1409 mode = RetrieveBuffer; 1428 mode = RetrieveBuffer;
1410 connectToHost( host.toString(), port ); 1429 connectToHost( host.toString(), port );
1411} 1430}
1412 1431
1413void ServerDTP::retrieveByteArray() 1432void ServerDTP::retrieveByteArray()
1414{ 1433{
1415 buf.setBuffer( QByteArray() ); 1434 buf.setBuffer( QByteArray() );
1416 mode = RetrieveBuffer; 1435 mode = RetrieveBuffer;
1417} 1436}
1418 1437
1419void ServerDTP::setSocket( int socket ) 1438void ServerDTP::setSocket( int socket )
1420{ 1439{
1421 QSocket::setSocket( socket ); 1440 QSocket::setSocket( socket );
1422 connected(); 1441 connected();
1423} 1442}
1424 1443
diff --git a/core/settings/launcher/menusettings.cpp b/core/settings/launcher/menusettings.cpp
index 5a9fada..6fca621 100644
--- a/core/settings/launcher/menusettings.cpp
+++ b/core/settings/launcher/menusettings.cpp
@@ -1,159 +1,163 @@
1/* 1/*
2                This file is part of the OPIE Project 2                This file is part of the OPIE Project
3 =. Copyright (c) 2002 Trolltech AS <info@trolltech.com> 3 =. Copyright (c) 2002 Trolltech AS <info@trolltech.com>
4             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 4             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
5           .>+-= 5           .>+-=
6 _;:,     .>    :=|. This file is free software; you can 6 _;:,     .>    :=|. This file is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU General Public 8:`=1 )Y*s>-.--   : the terms of the GNU General Public
9.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License, 10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version. 11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_. 12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This file is distributed in the hope that 13    .i_,=:_.      -<s. This file is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of 15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Public License for more details. 18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .: 19++=   -.     .`     .:
20 :     =  ...= . :.=- You should have received a copy of the GNU 20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file; 21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the 22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc., 23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330, 24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include "menusettings.h" 29#include "menusettings.h"
30 30
31#include <qpe/config.h> 31#include <qpe/config.h>
32#include <qpe/qlibrary.h> 32#include <qpe/qlibrary.h>
33#include <qpe/qpeapplication.h> 33#include <qpe/qpeapplication.h>
34#include <qpe/menuappletinterface.h> 34#include <qpe/menuappletinterface.h>
35#include <qpe/qcopenvelope_qws.h> 35#include <qpe/qcopenvelope_qws.h>
36 36
37#include <qdir.h> 37#include <qdir.h>
38#include <qlistview.h> 38#include <qlistview.h>
39#include <qcheckbox.h> 39#include <qcheckbox.h>
40#include <qheader.h> 40#include <qheader.h>
41#include <qlayout.h> 41#include <qlayout.h>
42#include <qlabel.h> 42#include <qlabel.h>
43#include <qwhatsthis.h> 43#include <qwhatsthis.h>
44 44
45#include <stdlib.h> 45#include <stdlib.h>
46 46
47 47
48MenuSettings::MenuSettings ( QWidget *parent, const char *name ) 48MenuSettings::MenuSettings ( QWidget *parent, const char *name )
49 : QWidget ( parent, name ) 49 : QWidget ( parent, name )
50{ 50{
51 m_applets_changed = false; 51 m_applets_changed = false;
52 52
53 QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); 53 QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 );
54 54
55 QLabel *l = new QLabel ( tr( "Load applets in O-Menu:" ), this ); 55 QLabel *l = new QLabel ( tr( "Load applets in O-Menu:" ), this );
56 lay-> addWidget ( l ); 56 lay-> addWidget ( l );
57 57
58 m_list = new QListView ( this ); 58 m_list = new QListView ( this );
59 m_list-> addColumn ( "foobar" ); 59 m_list-> addColumn ( "foobar" );
60 m_list-> header ( )-> hide ( ); 60 m_list-> header ( )-> hide ( );
61 61
62 lay-> addWidget ( m_list ); 62 lay-> addWidget ( m_list );
63 63
64 m_menutabs = new QCheckBox ( tr( "Show Launcher tabs in O-Menu" ), this ); 64 m_menutabs = new QCheckBox ( tr( "Show Launcher tabs in O-Menu" ), this );
65 lay-> addWidget ( m_menutabs ); 65 lay-> addWidget ( m_menutabs );
66 66
67 QWhatsThis::add ( m_list, tr( "Check the applets that you want to have included in the O-Menu." )); 67 QWhatsThis::add ( m_list, tr( "Check the applets that you want to have included in the O-Menu." ));
68 QWhatsThis::add ( m_menutabs, tr( "Adds the contents of the Launcher Tabs as menus in the O-Menu." )); 68 QWhatsThis::add ( m_menutabs, tr( "Adds the contents of the Launcher Tabs as menus in the O-Menu." ));
69 69
70 connect ( m_list, SIGNAL( clicked ( QListViewItem * )), this, SLOT( appletChanged ( ))); 70 connect ( m_list, SIGNAL( clicked ( QListViewItem * )), this, SLOT( appletChanged ( )));
71 71
72 init ( ); 72 init ( );
73} 73}
74 74
75void MenuSettings::init ( ) 75void MenuSettings::init ( )
76{ 76{
77 Config cfg ( "StartMenu" ); 77 Config cfg ( "StartMenu" );
78 cfg. setGroup ( "Applets" ); 78 cfg. setGroup ( "Applets" );
79 QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' ); 79 QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' );
80 80
81 QString path = QPEApplication::qpeDir ( ) + "/plugins/applets"; 81 QString path = QPEApplication::qpeDir ( ) + "/plugins/applets";
82#ifdef Q_OS_MACX
83 QStringList list = QDir ( path, "lib*.dylib" ). entryList ( );
84#else
82 QStringList list = QDir ( path, "lib*.so" ). entryList ( ); 85 QStringList list = QDir ( path, "lib*.so" ). entryList ( );
86#endif /* Q_OS_MACX */
83 87
84 for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) { 88 for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) {
85 QString name; 89 QString name;
86 QPixmap icon; 90 QPixmap icon;
87 MenuAppletInterface *iface = 0; 91 MenuAppletInterface *iface = 0;
88 92
89 QLibrary *lib = new QLibrary ( path + "/" + *it ); 93 QLibrary *lib = new QLibrary ( path + "/" + *it );
90 lib-> queryInterface ( IID_MenuApplet, (QUnknownInterface**) &iface ); 94 lib-> queryInterface ( IID_MenuApplet, (QUnknownInterface**) &iface );
91 if ( iface ) { 95 if ( iface ) {
92 QString lang = getenv( "LANG" ); 96 QString lang = getenv( "LANG" );
93 QTranslator *trans = new QTranslator ( qApp ); 97 QTranslator *trans = new QTranslator ( qApp );
94 QString type = (*it). left ((*it). find (".")); 98 QString type = (*it). left ((*it). find ("."));
95 QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm"; 99 QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm";
96 if ( trans-> load ( tfn )) 100 if ( trans-> load ( tfn ))
97 qApp-> installTranslator ( trans ); 101 qApp-> installTranslator ( trans );
98 else 102 else
99 delete trans; 103 delete trans;
100 name = iface-> name ( ); 104 name = iface-> name ( );
101 icon = iface-> icon ( ). pixmap ( QIconSet::Small, QIconSet::Normal ); 105 icon = iface-> icon ( ). pixmap ( QIconSet::Small, QIconSet::Normal );
102 iface-> release ( ); 106 iface-> release ( );
103 lib-> unload ( ); 107 lib-> unload ( );
104 108
105 QCheckListItem *item; 109 QCheckListItem *item;
106 item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); 110 item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox );
107 if ( !icon. isNull ( )) 111 if ( !icon. isNull ( ))
108 item-> setPixmap ( 0, icon ); 112 item-> setPixmap ( 0, icon );
109 item-> setOn ( exclude. find ( *it ) == exclude. end ( )); 113 item-> setOn ( exclude. find ( *it ) == exclude. end ( ));
110 m_applets [*it] = item; 114 m_applets [*it] = item;
111 } else { 115 } else {
112 delete lib; 116 delete lib;
113 } 117 }
114 } 118 }
115 119
116 cfg. setGroup ( "Menu" ); 120 cfg. setGroup ( "Menu" );
117 m_menutabs-> setChecked ( cfg. readBoolEntry ( "LauncherTabs", true )); 121 m_menutabs-> setChecked ( cfg. readBoolEntry ( "LauncherTabs", true ));
118} 122}
119 123
120void MenuSettings::appletChanged() 124void MenuSettings::appletChanged()
121{ 125{
122 m_applets_changed = true; 126 m_applets_changed = true;
123} 127}
124 128
125void MenuSettings::accept ( ) 129void MenuSettings::accept ( )
126{ 130{
127 bool apps_changed = false; 131 bool apps_changed = false;
128 132
129 Config cfg ( "StartMenu" ); 133 Config cfg ( "StartMenu" );
130 cfg. setGroup ( "Applets" ); 134 cfg. setGroup ( "Applets" );
131 if ( m_applets_changed ) { 135 if ( m_applets_changed ) {
132 QStringList exclude; 136 QStringList exclude;
133 QMap <QString, QCheckListItem *>::Iterator it; 137 QMap <QString, QCheckListItem *>::Iterator it;
134 for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) { 138 for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) {
135 if ( !(*it)-> isOn ( )) 139 if ( !(*it)-> isOn ( ))
136 exclude << it. key ( ); 140 exclude << it. key ( );
137 } 141 }
138 cfg. writeEntry ( "ExcludeApplets", exclude, ',' ); 142 cfg. writeEntry ( "ExcludeApplets", exclude, ',' );
139 } 143 }
140 cfg. writeEntry ( "SafeMode", false ); 144 cfg. writeEntry ( "SafeMode", false );
141 145
142 cfg. setGroup ( "Menu" ); 146 cfg. setGroup ( "Menu" );
143 147
144 if ( m_menutabs-> isChecked ( ) != cfg. readBoolEntry ( "LauncherTabs", true )) { 148 if ( m_menutabs-> isChecked ( ) != cfg. readBoolEntry ( "LauncherTabs", true )) {
145 apps_changed = true; 149 apps_changed = true;
146 cfg. writeEntry ( "LauncherTabs", m_menutabs-> isChecked ( )); 150 cfg. writeEntry ( "LauncherTabs", m_menutabs-> isChecked ( ));
147 } 151 }
148 152
149 cfg. write ( ); 153 cfg. write ( );
150 154
151 if ( m_applets_changed ) { 155 if ( m_applets_changed ) {
152 QCopEnvelope ( "QPE/TaskBar", "reloadApplets()" ); 156 QCopEnvelope ( "QPE/TaskBar", "reloadApplets()" );
153 m_applets_changed = false; 157 m_applets_changed = false;
154 } 158 }
155 if ( apps_changed ) { 159 if ( apps_changed ) {
156 QCopEnvelope ( "QPE/TaskBar", "reloadApps()" ); 160 QCopEnvelope ( "QPE/TaskBar", "reloadApps()" );
157 } 161 }
158} 162}
159 163
diff --git a/core/settings/launcher/taskbarsettings.cpp b/core/settings/launcher/taskbarsettings.cpp
index b3e302a..d03ea49 100644
--- a/core/settings/launcher/taskbarsettings.cpp
+++ b/core/settings/launcher/taskbarsettings.cpp
@@ -1,156 +1,173 @@
1/* 1/*
2                This file is part of the OPIE Project 2                This file is part of the OPIE Project
3 =. Copyright (c) 2002 Trolltech AS <info@trolltech.com> 3 =. Copyright (c) 2002 Trolltech AS <info@trolltech.com>
4             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> 4             .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org>
5           .>+-= 5           .>+-=
6 _;:,     .>    :=|. This file is free software; you can 6 _;:,     .>    :=|. This file is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU General Public 8:`=1 )Y*s>-.--   : the terms of the GNU General Public
9.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License, 10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version. 11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_. 12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This file is distributed in the hope that 13    .i_,=:_.      -<s. This file is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of 15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Public License for more details. 18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .: 19++=   -.     .`     .:
20 :     =  ...= . :.=- You should have received a copy of the GNU 20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file; 21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the 22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc., 23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330, 24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include "taskbarsettings.h" 29#include "taskbarsettings.h"
30 30
31#include <qpe/config.h> 31#include <qpe/config.h>
32#include <qpe/qlibrary.h> 32#include <qpe/qlibrary.h>
33#include <qpe/qpeapplication.h> 33#include <qpe/qpeapplication.h>
34#include <qpe/taskbarappletinterface.h> 34#include <qpe/taskbarappletinterface.h>
35#include <qpe/qcopenvelope_qws.h> 35#include <qpe/qcopenvelope_qws.h>
36 36
37#include <qdir.h> 37#include <qdir.h>
38#include <qlistview.h> 38#include <qlistview.h>
39#include <qcheckbox.h> 39#include <qcheckbox.h>
40#include <qheader.h> 40#include <qheader.h>
41#include <qlayout.h> 41#include <qlayout.h>
42#include <qlabel.h> 42#include <qlabel.h>
43#include <qwhatsthis.h> 43#include <qwhatsthis.h>
44 44
45#include <stdlib.h> 45#include <stdlib.h>
46 46
47 47
48TaskbarSettings::TaskbarSettings ( QWidget *parent, const char *name ) 48TaskbarSettings::TaskbarSettings ( QWidget *parent, const char *name )
49 : QWidget ( parent, name ) 49 : QWidget ( parent, name )
50{ 50{
51 m_applets_changed = false; 51 m_applets_changed = false;
52 52
53 QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 ); 53 QBoxLayout *lay = new QVBoxLayout ( this, 4, 4 );
54 54
55 QLabel *l = new QLabel ( tr( "Load applets in Taskbar:" ), this ); 55 QLabel *l = new QLabel ( tr( "Load applets in Taskbar:" ), this );
56 lay-> addWidget ( l ); 56 lay-> addWidget ( l );
57 57
58 m_list = new QListView ( this ); 58 m_list = new QListView ( this );
59 m_list-> addColumn ( "foobar" ); 59 m_list-> addColumn ( "foobar" );
60 m_list-> header ( )-> hide ( ); 60 m_list-> header ( )-> hide ( );
61 61
62 lay-> addWidget ( m_list ); 62 lay-> addWidget ( m_list );
63 63
64 QWhatsThis::add ( m_list, tr( "Check the applets that you want displayed in the Taskbar." )); 64 QWhatsThis::add ( m_list, tr( "Check the applets that you want displayed in the Taskbar." ));
65 65
66 connect ( m_list, SIGNAL( clicked ( QListViewItem * )), this, SLOT( appletChanged ( ))); 66 connect ( m_list, SIGNAL( clicked ( QListViewItem * )), this, SLOT( appletChanged ( )));
67 67
68 init ( ); 68 init ( );
69} 69}
70 70
71void TaskbarSettings::init ( ) 71void TaskbarSettings::init ( )
72{ 72{
73 Config cfg ( "Taskbar" ); 73 Config cfg ( "Taskbar" );
74 cfg. setGroup ( "Applets" ); 74 cfg. setGroup ( "Applets" );
75 QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' ); 75 QStringList exclude = cfg. readListEntry ( "ExcludeApplets", ',' );
76 76
77 QString path = QPEApplication::qpeDir ( ) + "/plugins/applets"; 77 QString path = QPEApplication::qpeDir ( ) + "/plugins/applets";
78#ifdef Q_OS_MACX
79 QStringList list = QDir ( path, "lib*.dylib" ). entryList ( );
80#else
78 QStringList list = QDir ( path, "lib*.so" ). entryList ( ); 81 QStringList list = QDir ( path, "lib*.so" ). entryList ( );
82#endif /* Q_OS_MACX */
79 83
80 for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) { 84 for ( QStringList::Iterator it = list. begin ( ); it != list. end ( ); ++it ) {
81 QString name; 85 QString name;
82 QPixmap icon; 86 QPixmap icon;
83 TaskbarNamedAppletInterface *iface = 0; 87 TaskbarNamedAppletInterface *iface = 0;
84 88
89 qWarning("Load applet: %s", (*it).latin1() );
85 QLibrary *lib = new QLibrary ( path + "/" + *it ); 90 QLibrary *lib = new QLibrary ( path + "/" + *it );
86 lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**) &iface ); 91 lib-> queryInterface ( IID_TaskbarNamedApplet, (QUnknownInterface**) &iface );
92 qWarning("<1>");
87 if ( iface ) { 93 if ( iface ) {
94 qWarning("<2>");
88 QString lang = getenv( "LANG" ); 95 QString lang = getenv( "LANG" );
89 QTranslator *trans = new QTranslator ( qApp ); 96 QTranslator *trans = new QTranslator ( qApp );
90 QString type = (*it). left ((*it). find (".")); 97 QString type = (*it). left ((*it). find ("."));
91 QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm"; 98 QString tfn = QPEApplication::qpeDir ( ) + "/i18n/" + lang + "/" + type + ".qm";
92 if ( trans-> load ( tfn )) 99 if ( trans-> load ( tfn ))
93 qApp-> installTranslator ( trans ); 100 qApp-> installTranslator ( trans );
94 else 101 else
95 delete trans; 102 delete trans;
96 name = iface-> name ( ); 103 name = iface-> name ( );
97 icon = iface-> icon ( ); 104 icon = iface-> icon ( );
98 iface-> release ( ); 105 iface-> release ( );
99 } 106 }
107 qWarning("<3>");
100 if ( !iface ) { 108 if ( !iface ) {
109 qWarning("<4>");
101 lib-> queryInterface ( IID_TaskbarApplet, (QUnknownInterface**) &iface ); 110 lib-> queryInterface ( IID_TaskbarApplet, (QUnknownInterface**) &iface );
102 111
103 if ( iface ) { 112 if ( iface ) {
113 qWarning("<5>");
104 name = (*it). mid ( 3 ); 114 name = (*it). mid ( 3 );
115 qWarning("Found applet: %s", name.latin1() );
116#ifdef Q_OS_MACX
117 int sep = name. find( ".dylib" );
118#else
105 int sep = name. find( ".so" ); 119 int sep = name. find( ".so" );
120#endif /* Q_OS_MACX */
106 if ( sep > 0 ) 121 if ( sep > 0 )
107 name. truncate ( sep ); 122 name. truncate ( sep );
108 sep = name. find ( "applet" ); 123 sep = name. find ( "applet" );
109 if ( sep == (int) name.length ( ) - 6 ) 124 if ( sep == (int) name.length ( ) - 6 )
110 name. truncate ( sep ); 125 name. truncate ( sep );
111 name[0] = name[0]. upper ( ); 126 name[0] = name[0]. upper ( );
112 iface-> release ( ); 127 iface-> release ( );
113 } 128 }
114 } 129 }
130 qWarning("<6>");
115 131
116 if ( iface ) { 132 if ( iface ) {
133 qWarning("<7>");
117 QCheckListItem *item; 134 QCheckListItem *item;
118 item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox ); 135 item = new QCheckListItem ( m_list, name, QCheckListItem::CheckBox );
119 if ( !icon. isNull ( )) 136 if ( !icon. isNull ( ))
120 item-> setPixmap ( 0, icon ); 137 item-> setPixmap ( 0, icon );
121 item-> setOn ( exclude. find ( *it ) == exclude. end ( )); 138 item-> setOn ( exclude. find ( *it ) == exclude. end ( ));
122 m_applets [*it] = item; 139 m_applets [*it] = item;
123 } 140 }
124 lib-> unload ( ); 141 lib-> unload ( );
125 delete lib; 142 delete lib;
126 } 143 }
127} 144}
128 145
129void TaskbarSettings::appletChanged() 146void TaskbarSettings::appletChanged()
130{ 147{
131 m_applets_changed = true; 148 m_applets_changed = true;
132} 149}
133 150
134void TaskbarSettings::accept ( ) 151void TaskbarSettings::accept ( )
135{ 152{
136 Config cfg ( "Taskbar" ); 153 Config cfg ( "Taskbar" );
137 cfg. setGroup ( "Applets" ); 154 cfg. setGroup ( "Applets" );
138 155
139 if ( m_applets_changed ) { 156 if ( m_applets_changed ) {
140 QStringList exclude; 157 QStringList exclude;
141 QMap <QString, QCheckListItem *>::Iterator it; 158 QMap <QString, QCheckListItem *>::Iterator it;
142 for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) { 159 for ( it = m_applets. begin ( ); it != m_applets. end ( ); ++it ) {
143 if ( !(*it)-> isOn ( )) 160 if ( !(*it)-> isOn ( ))
144 exclude << it. key ( ); 161 exclude << it. key ( );
145 } 162 }
146 cfg. writeEntry ( "ExcludeApplets", exclude, ',' ); 163 cfg. writeEntry ( "ExcludeApplets", exclude, ',' );
147 } 164 }
148 cfg. writeEntry ( "SafeMode", false ); 165 cfg. writeEntry ( "SafeMode", false );
149 cfg. write ( ); 166 cfg. write ( );
150 167
151 if ( m_applets_changed ) { 168 if ( m_applets_changed ) {
152 QCopEnvelope e ( "QPE/TaskBar", "reloadApplets()" ); 169 QCopEnvelope e ( "QPE/TaskBar", "reloadApplets()" );
153 m_applets_changed = false; 170 m_applets_changed = false;
154 } 171 }
155} 172}
156 173
diff --git a/development/keyview/keyview.pro b/development/keyview/keyview.pro
index 70cc171..ca657bd 100644
--- a/development/keyview/keyview.pro
+++ b/development/keyview/keyview.pro
@@ -1,33 +1,33 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 #CONFIG = qt warn_on debug 2 #CONFIG = qt plugin warn_on debug
3 CONFIG = qt warn_on release 3 CONFIG = qt plugin warn_on release
4 HEADERS = keyview.h keyboardimpl.h 4 HEADERS = keyview.h keyboardimpl.h
5 SOURCES = keyview.cpp keyboardimpl.cpp 5 SOURCES = keyview.cpp keyboardimpl.cpp
6 INCLUDEPATH+= $(OPIEDIR)/include 6 INCLUDEPATH+= $(OPIEDIR)/include
7 DEPENDPATH+= $(OPIEDIR)/include ../../launcher 7 DEPENDPATH+= $(OPIEDIR)/include ../../launcher
8LIBS += -lqpe 8LIBS += -lqpe
9 INTERFACES= 9 INTERFACES=
10 TARGET = keyview 10 TARGET = keyview
11DESTDIR = $(OPIEDIR)/plugins/inputmethods 11DESTDIR = $(OPIEDIR)/plugins/inputmethods
12 12
13TRANSLATIONS = ../i18n/de/keyview.ts \ 13TRANSLATIONS = ../i18n/de/keyview.ts \
14 ../i18n/nl/keyview.ts \ 14 ../i18n/nl/keyview.ts \
15 ../i18n/da/keyview.ts \ 15 ../i18n/da/keyview.ts \
16 ../i18n/xx/keyview.ts \ 16 ../i18n/xx/keyview.ts \
17 ../i18n/en/keyview.ts \ 17 ../i18n/en/keyview.ts \
18 ../i18n/es/keyview.ts \ 18 ../i18n/es/keyview.ts \
19 ../i18n/fr/keyview.ts \ 19 ../i18n/fr/keyview.ts \
20 ../i18n/hu/keyview.ts \ 20 ../i18n/hu/keyview.ts \
21 ../i18n/ja/keyview.ts \ 21 ../i18n/ja/keyview.ts \
22 ../i18n/ko/keyview.ts \ 22 ../i18n/ko/keyview.ts \
23 ../i18n/no/keyview.ts \ 23 ../i18n/no/keyview.ts \
24 ../i18n/pl/keyview.ts \ 24 ../i18n/pl/keyview.ts \
25 ../i18n/pt/keyview.ts \ 25 ../i18n/pt/keyview.ts \
26 ../i18n/pt_BR/keyview.ts \ 26 ../i18n/pt_BR/keyview.ts \
27 ../i18n/sl/keyview.ts \ 27 ../i18n/sl/keyview.ts \
28 ../i18n/zh_CN/keyview.ts \ 28 ../i18n/zh_CN/keyview.ts \
29 ../i18n/zh_TW/keyview.ts 29 ../i18n/zh_TW/keyview.ts
30 30
31 31
32 32
33include ( $(OPIEDIR)/include.pro ) 33include ( $(OPIEDIR)/include.pro )
diff --git a/development/macosx/README_MACOSX b/development/macosx/README_MACOSX
new file mode 100644
index 0000000..e2ed15f
--- a/dev/null
+++ b/development/macosx/README_MACOSX
@@ -0,0 +1,91 @@
1Information about porting Opie to MacOS-X (eilers)
2==================================================
3
4Credits:
5--------
6
7Special thanks to xxxx for its patches for qt-X11 (2.3.2), QT/E (2.3.5) and qtopia (1.6.1).
8Without them, I wouldn't be able to provide the port for OPIE to MacOS-X that fast..
9
10Status:
11-------
12The basic system works quite well. But a lot of applications and plugins,
13which are platform specific, need some work to be compileable.
14
15What is ready:
16
17libqpe
18libopie1
19pim-applications (addressbook, todolist, datebook, today)
20A lot of applications and plugins which are not platform specific.
21
22What will follow soon:
23
24libopie2
25
26Remember: A lot of configuration-settings are not tested (as for instance
27the quicklauncher) and might fail to compile.
28If you want to avoid misconfigurations, you may want to start with
29the config-file in this directory. Just copy "config_macosx" to $OPIEDIR/.config
30to get a working configuration to start with.
31
32(The missing apps/plugins will be ported on demand.)
33
34How to compile Opie for MacOS-X:
35-------------------------------
36
37Before compiling for MacOS-X, you need the following:
38
391. X11-Server (Provided by Apple)
402. QT-2.3.2 for X11
413. QT/E-2.3.7
424. Patches for QT-2.3.2 for MacOSX
435. Patches for QT/E-2.3.7 for MacOSX
44
45Please follow the instructions by xxxx how to create a buildsystem
46for your Mac.
47What is different to the previous desciption:
48You don't need Qtopia !
49It is recommended to use QT/E in version 2.3.7 instead of 2.3.5 as described.
50The Patch for QT/E for Opie, including all other opie-patches is available in the
51qt-directory ($OPIEDIR/qt) and is called "qte237-all-macosx.patch"
52
53If your buildsystem is working correctly, you should be able to build
54opie. You have to enter "make menuconfig" and set
55"Build Parameters"->"Target Machine"->"Mac OS X (DARWIN)"
56activate the platform specific changes.
57
58You will see that a lot of applications and plugins/applets will not compile
59successfully, due to the fact that they are not ported to this platform.
60You may disable them to be able to compile the rest.
61
62
63Information for Developers:
64---------------------------
65
661. Platform specific code should be surrounded by
67#ifdef Q_OS_MACX
68MACOS-X CODE
69#else
70OTHER-CODE
71#endif
72
732. The Plugin-Handling by MacOS-X is different than it is by Linux.
74On linux-systems, shared libraries are not different to dynamic loaded libraries
75(aka plugins). They just are different whether they are loaded automatically
76at startup or manually by any application.
77On MacOS-X, the plugins are loaded by a special mechanism and must be in a special
78binary format. Therefore you have to add the term "plugin" to the CONFIG-clause, as
79for instance:
80
81TEMPLATE=lib
82CONFIG += qt plugin release
83
84If you don't add "plugin" you will get a shared library which is not loadable
85(Error-Code: NSObjectFileImageInappropriateFile (2))!
86
87
88
89For problems, help and flames, feel free to contact me at
90
91eilers.stefan@epost.de \ No newline at end of file
diff --git a/development/macosx/config_macosx b/development/macosx/config_macosx
new file mode 100644
index 0000000..eb0792f
--- a/dev/null
+++ b/development/macosx/config_macosx
@@ -0,0 +1,290 @@
1#
2# Automatically generated make config: don't edit
3#
4
5#
6# Build Parameters
7#
8# CONFIG_TARGET_X86 is not set
9CONFIG_TARGET_MACOSX=y
10# CONFIG_TARGET_SHARP is not set
11# CONFIG_TARGET_IPAQ is not set
12# CONFIG_TARGET_RAMSES is not set
13# CONFIG_TARGET_SIMPAD is not set
14# CONFIG_TARGET_YOPY is not set
15# CONFIG_OPTIMIZE is not set
16CONFIG_DEBUG=y
17CONFIG_QUICK_LAUNCH=y
18# CONFIG_OPIE_NO_OVERRIDE_QT is not set
19CONFIG_SPECFILE="qws/macx-generic-g++"
20CONFIG_EXPERIMENTAL=y
21
22#
23# Base
24#
25CONFIG_LIBQPE=y
26# CONFIG_X11 is not set
27CONFIG_LIBOPIE=y
28# CONFIG_OPIE-LOGIN is not set
29# CONFIG_OPIEALARM is not set
30CONFIG_LAUNCHER=y
31CONFIG_PRELOAD=y
32CONFIG_LAUNCHER_CORE=y
33CONFIG_QWS=y
34
35#
36#
37#
38
39#
40# Applets
41#
42CONFIG_BATTERYAPPLET=y
43# CONFIG_CARDMON is not set
44CONFIG_CLIPBOARDAPPLET=y
45CONFIG_CLOCKAPPLET=y
46CONFIG_HOMEAPPLET=y
47# CONFIG_IRDAAPPLET is not set
48# CONFIG_LOGOUTAPPLET is not set
49# CONFIG_OBEXAPPLET is not set
50# CONFIG_OBEX is not set
51# CONFIG_RESTARTAPPLET is not set
52# CONFIG_ROTATEAPPLET is not set
53# CONFIG_SCREENSHOTAPPLET is not set
54# CONFIG_SUSPENDAPPLET is not set
55# CONFIG_VMEMO is not set
56# CONFIG_VOLUMEAPPLET is not set
57# CONFIG_VTAPPLET is not set
58
59#
60# Network applet needs a libqpe and libopie2 (core, ui, net)
61#
62CONFIG_NOTESAPPLET=y
63# CONFIG_WIRELESSAPPLET is not set
64
65#
66# Apps
67#
68# CONFIG_CALIBRATE is not set
69# CONFIG_EMBEDDEDKONSOLE is not set
70CONFIG_FILEBROWSER=y
71CONFIG_HELPBROWSER=y
72# CONFIG_OAPP is not set
73CONFIG_OIPKG=y
74CONFIG_QCOP=y
75CONFIG_TEXTEDIT=y
76# CONFIG_ADVANCEDFM is not set
77# CONFIG_AQPKG is not set
78CONFIG_CHECKBOOK=y
79# CONFIG_ODICT is not set
80# CONFIG_BARTENDER is not set
81# CONFIG_OPIE-CONSOLE is not set
82# CONFIG_OPIE-READER is not set
83CONFIG_OPIE-SHEET=y
84CONFIG_OPIE-WRITE=y
85CONFIG_OXYGEN=y
86CONFIG_SYSINFO=y
87CONFIG_TABLEVIEWER=y
88CONFIG_TINYKATE=y
89CONFIG_LIBKATE=y
90# CONFIG_ZSAFE is not set
91
92#
93# Communications and Networking
94#
95# CONFIG_GSMTOOL is not set
96# CONFIG_KEYPEBBLE is not set
97# CONFIG_MOBILEMSG is not set
98# CONFIG_MAIL is not set
99# CONFIG_FTPLIB is not set
100# CONFIG_MAILIT is not set
101# CONFIG_OPIEIRC is not set
102# CONFIG_OPIE-RDESKTOP is not set
103# CONFIG_UBROWSER is not set
104
105#
106# wellenreiter needs libqpe, libopie1 and libopie2 (core+net+ui)
107#
108
109#
110# Games
111#
112CONFIG_BACKGAMMON=y
113CONFIG_BOUNCE=y
114CONFIG_BUZZWORD=y
115CONFIG_FIFTEEN=y
116CONFIG_GO=y
117CONFIG_KBILL=y
118CONFIG_KCHECKERS=y
119CONFIG_KPACMAN=y
120CONFIG_MINDBREAKER=y
121CONFIG_MINESWEEP=y
122# CONFIG_WORDGAME is not set
123CONFIG_PARASHOOT=y
124CONFIG_QASTEROIDS=y
125# CONFIG_SFCAVE is not set
126# CONFIG_SFCAVE-SDL is not set
127# CONFIG_SNAKE is not set
128CONFIG_SOLITAIRE=y
129# CONFIG_TETRIX is not set
130# CONFIG_TICTAC is not set
131
132#
133# Graphics and Multimedia
134#
135# CONFIG_FREETYPE is not set
136CONFIG_DRAWPAD=y
137# CONFIG_QPDF is not set
138# CONFIG_OPIEPLAYER is not set
139
140#
141# opie-camera needs a libqpe, libopie and libopie2core
142#
143# CONFIG_OPIEPLAYER2 is not set
144# CONFIG_OPIEREC is not set
145CONFIG_SHOWIMG=y
146
147#
148# Input methods
149#
150# CONFIG_DASHER is not set
151# CONFIG_DVORAK is not set
152CONFIG_HANDWRITING=y
153
154#
155# opie-handwriting-classicset automatically selected
156#
157
158#
159# opie-handwriting-graffitiset automatically selected
160#
161CONFIG_JUMPX=y
162# CONFIG_KEYBOARD is not set
163CONFIG_KJUMPX=y
164# CONFIG_MULTIKEY is not set
165CONFIG_PICKBOARD=y
166CONFIG_UNIKEYBOARD=y
167
168#
169# Pim
170#
171CONFIG_ADDRESSBOOK=y
172CONFIG_DATEBOOK=y
173CONFIG_OSEARCH=y
174CONFIG_TODAY=y
175CONFIG_TODO=y
176
177#
178# Today Plugins
179#
180# CONFIG_TODAY_FORTUNE is not set
181# CONFIG_TODAY_STOCKTICKER is not set
182# CONFIG_TODAY_WEATHER is not set
183CONFIG_TODAY_ADDRESSBOOK=y
184CONFIG_TODAY_DATEBOOK=y
185CONFIG_TODAY_MAIL=y
186CONFIG_TODAY_TODOLIST=y
187
188#
189# Settings
190#
191CONFIG_BUTTON-SETTINGS=y
192CONFIG_CITYTIME=y
193CONFIG_LAUNCHER-SETTINGS=y
194CONFIG_LIGHT-AND-POWER=y
195CONFIG_SECURITY=y
196CONFIG_APPEARANCE2=y
197CONFIG_BACKUP=y
198CONFIG_LANGUAGE=y
199CONFIG_MEDIUMMOUNT=y
200CONFIG_NETSYSTEMTIME=y
201# CONFIG_NETWORKSETUP is not set
202# CONFIG_SOUND is not set
203# CONFIG_SSHKEYS is not set
204CONFIG_TABMANAGER=y
205# CONFIG_USERMANAGER is not set
206
207#
208# Theming
209#
210
211#
212# Decorations
213#
214CONFIG_DECO_FLAT=y
215CONFIG_DECO_LIQUID=y
216CONFIG_DECO_POLISHED=y
217
218#
219# Styles
220#
221CONFIG_FLAT=y
222CONFIG_FRESH=y
223CONFIG_LIQUID=y
224CONFIG_METAL=y
225CONFIG_THEME=y
226
227#
228# Tools
229#
230CONFIG_CALCULATOR=y
231CONFIG_CLOCK=y
232CONFIG_EUROCONV=y
233# CONFIG_FORMATTER is not set
234CONFIG_OPIE-SH=y
235# CONFIG_REMOTE is not set
236
237#
238# Development
239#
240# CONFIG_KEYVIEW is not set
241
242#
243# Examples
244#
245# CONFIG_EXAMPLES is not set
246
247#
248#
249#
250
251#
252# Experimental
253#
254
255#
256# libopie2
257#
258# CONFIG_LIBOPIE2CORE is not set
259
260#
261# libopie2db needs a libqpe and libopie2core
262#
263
264#
265# libopie2net needs a libqpe and libopie2core
266#
267
268#
269# libopie2pim needs a libqpe and libopie2core
270#
271
272#
273# libopie2ui needs a libqpe and libopie2core
274#
275
276#
277# libopie2mm needs a libqpe and libopie2core
278#
279
280#
281#
282#
283
284#
285# the examples need a libqpe, libopie2core, libopie2db, libopie2net, libopie2pim, libopie2ui and libopie2mm
286#
287
288#
289# SQL-Support needs libopie2db!
290#
diff --git a/include.pro b/include.pro
index 70ed731..4bdcaa7 100644
--- a/include.pro
+++ b/include.pro
@@ -1,105 +1,115 @@
1include ( $(OPIEDIR)/gen.pro ) 1include ( $(OPIEDIR)/gen.pro )
2 2
3# base opie install path 3# base opie install path
4prefix = /opt/QtPalmtop 4# prefix = /opt/QtPalmtop ??? Why here (eilers) ???
5prefix = $(OPIEDIR)
5 6
6contains( CONFIG, quick-app-lib ) { 7contains( CONFIG, quick-app-lib ) {
7 TEMPLATE = lib 8 TEMPLATE = lib
8 DESTDIR = $(OPIEDIR)/plugins/application 9 DESTDIR = $(OPIEDIR)/plugins/application
9 DEFINES += OPIE_APP_INTERFACE 10 DEFINES += OPIE_APP_INTERFACE
10 !contains( TARGET, launcher ) { 11 !contains( TARGET, launcher ) {
11 message( Linking $$TARGET to quicklauncher ) 12 message( Linking $$TARGET to quicklauncher )
12 system( rm -f $$(OPIEDIR)/bin/$$TARGET ) 13 system( rm -f $$(OPIEDIR)/bin/$$TARGET )
13 system( ln -s quicklauncher $$(OPIEDIR)/bin/$$TARGET ) 14 system( ln -s quicklauncher $$(OPIEDIR)/bin/$$TARGET )
14 } 15 }
15} 16}
16 17
17contains ( CONFIG, quick-app-bin ) { 18contains ( CONFIG, quick-app-bin ) {
18 TEMPLATE = app 19 TEMPLATE = app
19 DESTDIR = $(OPIEDIR)/bin 20 DESTDIR = $(OPIEDIR)/bin
20 DEFINES -= OPIE_APP_INTERFACE 21 DEFINES -= OPIE_APP_INTERFACE
21 message( Touching plugins/application/lib$${TARGET}.so ) 22 message( Touching plugins/application/lib$${TARGET}.so )
22 system( touch $$(OPIEDIR)/plugins/application/lib$${TARGET}.so ) 23 system( touch $$(OPIEDIR)/plugins/application/lib$${TARGET}.so )
23} 24}
24 25
25 26
26contains( TEMPLATE, lib ) { 27contains( TEMPLATE, lib ) {
27 target.path = $$prefix/lib 28 target.path = $$prefix/lib
28} 29}
29!contains( TEMPLATE, lib ) { 30!contains( TEMPLATE, lib ) {
30 target.path = $$prefix/bin 31 target.path = $$prefix/bin
31} 32}
32INSTALLS += target 33INSTALLS += target
33 34
34# ipkg control files 35# ipkg control files
35control.path = /CONTROL 36control.path = /CONTROL
36control.files = control postinst prerm postrm preinst conffiles 37control.files = control postinst prerm postrm preinst conffiles
37INSTALLS += control 38INSTALLS += control
38 39
39# images, default is $$prefix/pics/$$TARGET 40# images, default is $$prefix/pics/$$TARGET
40pics.path = $$prefix/pics/$$TARGET 41pics.path = $$prefix/pics/$$TARGET
41pics.files = pics/* 42pics.files = pics/*
42INSTALLS += pics 43INSTALLS += pics
43 44
44# sounds, default path is $$prefix/sounds/$$TARGET 45# sounds, default path is $$prefix/sounds/$$TARGET
45sounds.path = $$prefix/sounds/$$TARGET 46sounds.path = $$prefix/sounds/$$TARGET
46sounds.files = sounds/* 47sounds.files = sounds/*
47INSTALLS += sounds 48INSTALLS += sounds
48 49
49# init scripts, default path is /etc/init.d 50# init scripts, default path is /etc/init.d
50init.path = /etc/init.d 51init.path = /etc/init.d
51init.files = init.d/* 52init.files = init.d/*
52INSTALLS += init 53INSTALLS += init
53 54
54# data, default path is /usr/share/$$TARGET 55# data, default path is /usr/share/$$TARGET
55data.path = /usr/share/$$TARGET 56data.path = /usr/share/$$TARGET
56data.files = share/* 57data.files = share/*
57INSTALLS += data 58INSTALLS += data
58 59
59etc.path = $$prefix/etc/ 60etc.path = $$prefix/etc/
60etc.files = etc/* 61etc.files = etc/*
61INSTALLS += etc 62INSTALLS += etc
62 63
63apps.path = $$prefix/apps/ 64apps.path = $$prefix/apps/
64apps.files = apps/* 65apps.files = apps/*
65INSTALLS += apps 66INSTALLS += apps
66 67
67# sounds, default path is $$prefix/sounds/$$TARGET 68# sounds, default path is $$prefix/sounds/$$TARGET
68sounds.path = $$prefix/sounds/$$TARGET 69sounds.path = $$prefix/sounds/$$TARGET
69sounds.files = sounds/* 70sounds.files = sounds/*
70INSTALLS += sounds 71INSTALLS += sounds
71 72
72# anything in nonstandard paths 73# anything in nonstandard paths
73root.path = / 74root.path = /
74root.files = root/* 75root.files = root/*
75INSTALLS += root 76INSTALLS += root
76 77
77# new targets 78# new targets
78opie-lupdate.target = opie-lupdate 79opie-lupdate.target = opie-lupdate
79opie-lupdate.commands = opie-lupdate $(PRO) 80opie-lupdate.commands = opie-lupdate $(PRO)
80 81
81opie-lrelease.target = opie-lrelease 82opie-lrelease.target = opie-lrelease
82opie-lrelease.commands = opie-lrelease $(PRO) 83opie-lrelease.commands = opie-lrelease $(PRO)
83 84
84lupdate.target = lupdate 85lupdate.target = lupdate
85lupdate.commands = lupdate -noobsolete $(PRO) 86lupdate.commands = lupdate -noobsolete $(PRO)
86 87
87lrelease.target = lrelease 88lrelease.target = lrelease
88lrelease.commands = lrelease $(PRO) 89lrelease.commands = lrelease $(PRO)
89 90
90# new message target to get all strings from the apps with and without tr 91# new message target to get all strings from the apps with and without tr
91messages.target = messages 92messages.target = messages
92messages.commands = xgettext -C -n -ktr -kQT_TRANSLATE_NOOP $$HEADERS $$SOURCES -o '$(OPIEDIR)/messages-$(QMAKE_TARGET)-tr.po' && xgettext -C -n -a $$HEADERS $$SOURCES -o '$(OPIEDIR)/messages-$(QMAKE_TARGET)-allstrings.po' 93messages.commands = xgettext -C -n -ktr -kQT_TRANSLATE_NOOP $$HEADERS $$SOURCES -o '$(OPIEDIR)/messages-$(QMAKE_TARGET)-tr.po' && xgettext -C -n -a $$HEADERS $$SOURCES -o '$(OPIEDIR)/messages-$(QMAKE_TARGET)-allstrings.po'
93 94
94ipk.target = ipk 95ipk.target = ipk
95ipk.commands = tmp=`mktemp -d /tmp/ipkg-opie.XXXXXXXXXX` && ( $(MAKE) INSTALL_ROOT="$$$$tmp" install && ipkg-build $$$$tmp; rm -rf $$$$tmp; ) 96ipk.commands = tmp=`mktemp -d /tmp/ipkg-opie.XXXXXXXXXX` && ( $(MAKE) INSTALL_ROOT="$$$$tmp" install && ipkg-build $$$$tmp; rm -rf $$$$tmp; )
96 97
97QMAKE_EXTRA_UNIX_TARGETS += lupdate lrelease ipk opie-lupdate opie-lrelease messages 98QMAKE_EXTRA_UNIX_TARGETS += lupdate lrelease ipk opie-lupdate opie-lrelease messages
99CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX )
100contains( CONFTEST, y ){
101QMAKE_LFLAGS += -Wl
102}
103else {
98QMAKE_LFLAGS += -Wl,-rpath=$$prefix/lib 104QMAKE_LFLAGS += -Wl,-rpath=$$prefix/lib
105# I am not sure whether it is a good idea to change the way plugins is build
106# on linux. Therefore I remove the "plugin" term, which is needed by MacOS-X
107CONFIG -= plugin
108}
99QMAKE_LIBDIR += $(OPIEDIR)/lib 109QMAKE_LIBDIR += $(OPIEDIR)/lib
100 110
101MOC_DIR=.moc/$(PLATFORM) 111MOC_DIR=.moc/$(PLATFORM)
102OBJECTS_DIR=.obj/$(PLATFORM) 112OBJECTS_DIR=.obj/$(PLATFORM)
103 113
104#was here now at thetop 114#was here now at thetop
105#include ( $(OPIEDIR)/gen.pro ) 115#include ( $(OPIEDIR)/gen.pro )
diff --git a/inputmethods/dasher/dasher.pro b/inputmethods/dasher/dasher.pro
index 7b6def9..b7669a4 100644
--- a/inputmethods/dasher/dasher.pro
+++ b/inputmethods/dasher/dasher.pro
@@ -1,57 +1,57 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt warn_on release 2 CONFIG += qt plugin warn_on release
3 3
4HEADERS = Alphabet.h \ 4HEADERS = Alphabet.h \
5 DasherModel.h \ 5 DasherModel.h \
6 FrameRate.h \ 6 FrameRate.h \
7 AlphabetMap.h \ 7 AlphabetMap.h \
8 DasherNode.h \ 8 DasherNode.h \
9 LanguageModel.h \ 9 LanguageModel.h \
10 AlphIO.h \ 10 AlphIO.h \
11 DasherScreen.h \ 11 DasherScreen.h \
12 PPMLanguageModel.h \ 12 PPMLanguageModel.h \
13 Context.h \ 13 Context.h \
14 DasherSettingsInterface.h \ 14 DasherSettingsInterface.h \
15 QtDasherImpl.h \ 15 QtDasherImpl.h \
16 CustomAlphabet.h \ 16 CustomAlphabet.h \
17 DasherTypes.h \ 17 DasherTypes.h \
18 QtDasherPlugin.h \ 18 QtDasherPlugin.h \
19 DashEdit.h \ 19 DashEdit.h \
20 DasherView.h \ 20 DasherView.h \
21 QtDasherScreen.h \ 21 QtDasherScreen.h \
22 DasherAppInterface.h \ 22 DasherAppInterface.h \
23 DasherViewSquare.h \ 23 DasherViewSquare.h \
24 SettingsStore.h \ 24 SettingsStore.h \
25 DasherInterface.h \ 25 DasherInterface.h \
26 DasherWidgetInterface.h 26 DasherWidgetInterface.h
27SOURCES = Alphabet.cpp \ 27SOURCES = Alphabet.cpp \
28 DasherModel.cpp \ 28 DasherModel.cpp \
29 LanguageModel.cpp \ 29 LanguageModel.cpp \
30 AlphabetMap.cpp \ 30 AlphabetMap.cpp \
31 DasherNode.cpp \ 31 DasherNode.cpp \
32 PPMLanguageModel.cpp \ 32 PPMLanguageModel.cpp \
33 AlphIO.cpp \ 33 AlphIO.cpp \
34 DasherSettingsInterface.cpp \ 34 DasherSettingsInterface.cpp \
35 SettingsStore.cpp \ 35 SettingsStore.cpp \
36 CustomAlphabet.cpp \ 36 CustomAlphabet.cpp \
37 DasherView.cpp \ 37 DasherView.cpp \
38 DasherInterface.cpp \ 38 DasherInterface.cpp \
39 DasherViewSquare.cpp \ 39 DasherViewSquare.cpp \
40 QtDasherImpl.cc \ 40 QtDasherImpl.cc \
41 QtDasherPlugin.cc \ 41 QtDasherPlugin.cc \
42 QtDasherScreen.cc 42 QtDasherScreen.cc
43 TARGET = qdasher 43 TARGET = qdasher
44 DESTDIR = ../../plugins/inputmethods 44 DESTDIR = ../../plugins/inputmethods
45INCLUDEPATH += $(OPIEDIR)/include 45INCLUDEPATH += $(OPIEDIR)/include
46DEPENDPATH += ../$(OPIEDIR)/include ../../launcher 46DEPENDPATH += ../$(OPIEDIR)/include ../../launcher
47LIBS += -lqpe 47LIBS += -lqpe
48 QMAKE_LFLAGS+= -Wl,-rpath,/opt/QtPalmtop/plugins/inputmethods 48 QMAKE_LFLAGS+= -Wl,-rpath,/opt/QtPalmtop/plugins/inputmethods
49 VERSION = 1.0.0 49 VERSION = 1.0.0
50 SUBDIRS = DasherCore 50 SUBDIRS = DasherCore
51 51
52 52
53include ( $(OPIEDIR)/include.pro ) 53include ( $(OPIEDIR)/include.pro )
54target.path = $$prefix/plugins/inputmethods 54target.path = $$prefix/plugins/inputmethods
55 55
56 56
57 57
diff --git a/inputmethods/dvorak/dvorak.pro b/inputmethods/dvorak/dvorak.pro
index cd30aa2..67fe4e6 100644
--- a/inputmethods/dvorak/dvorak.pro
+++ b/inputmethods/dvorak/dvorak.pro
@@ -1,36 +1,36 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt warn_on release 2 CONFIG += qt plugin warn_on release
3 HEADERS= dvorak.h \ 3 HEADERS= dvorak.h \
4 dvorakimpl.h 4 dvorakimpl.h
5 SOURCES= dvorak.cpp \ 5 SOURCES= dvorak.cpp \
6 dvorakimpl.cpp 6 dvorakimpl.cpp
7 TARGET = qdvorak 7 TARGET = qdvorak
8 DESTDIR = ../../plugins/inputmethods 8 DESTDIR = ../../plugins/inputmethods
9INCLUDEPATH += $(OPIEDIR)/include 9INCLUDEPATH += $(OPIEDIR)/include
10DEPENDPATH += ../$(OPIEDIR)/include ../../launcher 10DEPENDPATH += ../$(OPIEDIR)/include ../../launcher
11LIBS += -lqpe -L$(OPIEDIR)/plugins/inputmethods -lqpickboard 11LIBS += -lqpe -L$(OPIEDIR)/plugins/inputmethods -lqpickboard
12 QMAKE_LFLAGS+= -Wl,-rpath,/opt/QtPalmtop/plugins/inputmethods 12 QMAKE_LFLAGS+= -Wl,-rpath,/opt/QtPalmtop/plugins/inputmethods
13 VERSION = 1.0.0 13 VERSION = 1.0.0
14 14
15TRANSLATIONS = ../../i18n/de/libqdvorak.ts \ 15TRANSLATIONS = ../../i18n/de/libqdvorak.ts \
16 ../../i18n/nl/libqdvorak.ts \ 16 ../../i18n/nl/libqdvorak.ts \
17 ../../i18n/da/libqdvorak.ts \ 17 ../../i18n/da/libqdvorak.ts \
18 ../../i18n/xx/libqdvorak.ts \ 18 ../../i18n/xx/libqdvorak.ts \
19 ../../i18n/en/libqdvorak.ts \ 19 ../../i18n/en/libqdvorak.ts \
20 ../../i18n/es/libqdvorak.ts \ 20 ../../i18n/es/libqdvorak.ts \
21 ../../i18n/fr/libqdvorak.ts \ 21 ../../i18n/fr/libqdvorak.ts \
22 ../../i18n/hu/libqdvorak.ts \ 22 ../../i18n/hu/libqdvorak.ts \
23 ../../i18n/ja/libqdvorak.ts \ 23 ../../i18n/ja/libqdvorak.ts \
24 ../../i18n/ko/libqdvorak.ts \ 24 ../../i18n/ko/libqdvorak.ts \
25 ../../i18n/no/libqdvorak.ts \ 25 ../../i18n/no/libqdvorak.ts \
26 ../../i18n/pl/libqdvorak.ts \ 26 ../../i18n/pl/libqdvorak.ts \
27 ../../i18n/pt/libqdvorak.ts \ 27 ../../i18n/pt/libqdvorak.ts \
28 ../../i18n/pt_BR/libqdvorak.ts \ 28 ../../i18n/pt_BR/libqdvorak.ts \
29 ../../i18n/sl/libqdvorak.ts \ 29 ../../i18n/sl/libqdvorak.ts \
30 ../../i18n/zh_CN/libqdvorak.ts \ 30 ../../i18n/zh_CN/libqdvorak.ts \
31 ../../i18n/zh_TW/libqdvorak.ts 31 ../../i18n/zh_TW/libqdvorak.ts
32 32
33 33
34 34
35include ( $(OPIEDIR)/include.pro ) 35include ( $(OPIEDIR)/include.pro )
36target.path = $$prefix/plugins/inputmethods 36target.path = $$prefix/plugins/inputmethods
diff --git a/inputmethods/handwriting/handwriting.pro b/inputmethods/handwriting/handwriting.pro
index 4ec5932..7a22208 100644
--- a/inputmethods/handwriting/handwriting.pro
+++ b/inputmethods/handwriting/handwriting.pro
@@ -1,54 +1,54 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt warn_on release 2 CONFIG += qt plugin warn_on release
3 HEADERS= qimpenchar.h \ 3 HEADERS= qimpenchar.h \
4 qimpenprofile.h \ 4 qimpenprofile.h \
5 qimpencombining.h \ 5 qimpencombining.h \
6 qimpenhelp.h \ 6 qimpenhelp.h \
7 qimpeninput.h \ 7 qimpeninput.h \
8 qimpenmatch.h \ 8 qimpenmatch.h \
9 qimpensetup.h \ 9 qimpensetup.h \
10 qimpenstroke.h \ 10 qimpenstroke.h \
11 qimpenwidget.h \ 11 qimpenwidget.h \
12 qimpenwordpick.h \ 12 qimpenwordpick.h \
13 handwritingimpl.h 13 handwritingimpl.h
14 SOURCES= qimpenchar.cpp \ 14 SOURCES= qimpenchar.cpp \
15 qimpenprofile.cpp \ 15 qimpenprofile.cpp \
16 qimpencombining.cpp \ 16 qimpencombining.cpp \
17 qimpenhelp.cpp \ 17 qimpenhelp.cpp \
18 qimpeninput.cpp \ 18 qimpeninput.cpp \
19 qimpenmatch.cpp \ 19 qimpenmatch.cpp \
20 qimpensetup.cpp \ 20 qimpensetup.cpp \
21 qimpenstroke.cpp \ 21 qimpenstroke.cpp \
22 qimpenwidget.cpp \ 22 qimpenwidget.cpp \
23 qimpenwordpick.cpp \ 23 qimpenwordpick.cpp \
24 handwritingimpl.cpp 24 handwritingimpl.cpp
25INTERFACES = qimpenprefbase.ui 25INTERFACES = qimpenprefbase.ui
26 TARGET = qhandwriting 26 TARGET = qhandwriting
27 DESTDIR = ../../plugins/inputmethods 27 DESTDIR = ../../plugins/inputmethods
28INCLUDEPATH += $(OPIEDIR)/include 28INCLUDEPATH += $(OPIEDIR)/include
29DEPENDPATH += ../$(OPIEDIR)/include ../../launcher 29DEPENDPATH += ../$(OPIEDIR)/include ../../launcher
30LIBS += -lqpe 30LIBS += -lqpe
31 VERSION = 1.0.0 31 VERSION = 1.0.0
32 32
33TRANSLATIONS = ../../i18n/de/libqhandwriting.ts \ 33TRANSLATIONS = ../../i18n/de/libqhandwriting.ts \
34 ../../i18n/nl/libqhandwriting.ts \ 34 ../../i18n/nl/libqhandwriting.ts \
35 ../../i18n/da/libqhandwriting.ts \ 35 ../../i18n/da/libqhandwriting.ts \
36 ../../i18n/xx/libqhandwriting.ts \ 36 ../../i18n/xx/libqhandwriting.ts \
37 ../../i18n/en/libqhandwriting.ts \ 37 ../../i18n/en/libqhandwriting.ts \
38 ../../i18n/es/libqhandwriting.ts \ 38 ../../i18n/es/libqhandwriting.ts \
39 ../../i18n/fr/libqhandwriting.ts \ 39 ../../i18n/fr/libqhandwriting.ts \
40 ../../i18n/hu/libqhandwriting.ts \ 40 ../../i18n/hu/libqhandwriting.ts \
41 ../../i18n/ja/libqhandwriting.ts \ 41 ../../i18n/ja/libqhandwriting.ts \
42 ../../i18n/ko/libqhandwriting.ts \ 42 ../../i18n/ko/libqhandwriting.ts \
43 ../../i18n/no/libqhandwriting.ts \ 43 ../../i18n/no/libqhandwriting.ts \
44 ../../i18n/pl/libqhandwriting.ts \ 44 ../../i18n/pl/libqhandwriting.ts \
45 ../../i18n/pt/libqhandwriting.ts \ 45 ../../i18n/pt/libqhandwriting.ts \
46 ../../i18n/pt_BR/libqhandwriting.ts \ 46 ../../i18n/pt_BR/libqhandwriting.ts \
47 ../../i18n/sl/libqhandwriting.ts \ 47 ../../i18n/sl/libqhandwriting.ts \
48 ../../i18n/zh_CN/libqhandwriting.ts \ 48 ../../i18n/zh_CN/libqhandwriting.ts \
49 ../../i18n/zh_TW/libqhandwriting.ts 49 ../../i18n/zh_TW/libqhandwriting.ts
50 50
51 51
52 52
53include ( $(OPIEDIR)/include.pro ) 53include ( $(OPIEDIR)/include.pro )
54target.path = $$prefix/plugins/inputmethods 54target.path = $$prefix/plugins/inputmethods
diff --git a/inputmethods/jumpx/jumpx.pro b/inputmethods/jumpx/jumpx.pro
index eff4563..a75ffd5 100644
--- a/inputmethods/jumpx/jumpx.pro
+++ b/inputmethods/jumpx/jumpx.pro
@@ -1,35 +1,35 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on release 2CONFIG += qt plugin warn_on release
3HEADERS = keyboard.h \ 3HEADERS = keyboard.h \
4 keyboardimpl.h 4 keyboardimpl.h
5SOURCES = keyboard.cpp \ 5SOURCES = keyboard.cpp \
6 keyboardimpl.cpp 6 keyboardimpl.cpp
7TARGET = qjumpx 7TARGET = qjumpx
8DESTDIR = ../../plugins/inputmethods 8DESTDIR = ../../plugins/inputmethods
9INCLUDEPATH += $(OPIEDIR)/include 9INCLUDEPATH += $(OPIEDIR)/include
10DEPENDPATH += $(OPIEDIR)/include 10DEPENDPATH += $(OPIEDIR)/include
11LIBS += -lqpe 11LIBS += -lqpe
12VERSION = 1.0.0 12VERSION = 1.0.0
13 13
14TRANSLATIONS = ../../i18n/de/libqjumpx.ts \ 14TRANSLATIONS = ../../i18n/de/libqjumpx.ts \
15 ../../i18n/nl/libqjumpx.ts \ 15 ../../i18n/nl/libqjumpx.ts \
16 ../../i18n/da/libqjumpx.ts \ 16 ../../i18n/da/libqjumpx.ts \
17 ../../i18n/xx/libqjumpx.ts \ 17 ../../i18n/xx/libqjumpx.ts \
18 ../../i18n/en/libqjumpx.ts \ 18 ../../i18n/en/libqjumpx.ts \
19 ../../i18n/es/libqjumpx.ts \ 19 ../../i18n/es/libqjumpx.ts \
20 ../../i18n/fr/libqjumpx.ts \ 20 ../../i18n/fr/libqjumpx.ts \
21 ../../i18n/hu/libqjumpx.ts \ 21 ../../i18n/hu/libqjumpx.ts \
22 ../../i18n/ja/libqjumpx.ts \ 22 ../../i18n/ja/libqjumpx.ts \
23 ../../i18n/ko/libqjumpx.ts \ 23 ../../i18n/ko/libqjumpx.ts \
24 ../../i18n/no/libqjumpx.ts \ 24 ../../i18n/no/libqjumpx.ts \
25 ../../i18n/pl/libqjumpx.ts \ 25 ../../i18n/pl/libqjumpx.ts \
26 ../../i18n/pt/libqjumpx.ts \ 26 ../../i18n/pt/libqjumpx.ts \
27 ../../i18n/pt_BR/libqjumpx.ts \ 27 ../../i18n/pt_BR/libqjumpx.ts \
28 ../../i18n/sl/libqjumpx.ts \ 28 ../../i18n/sl/libqjumpx.ts \
29 ../../i18n/zh_CN/libqjumpx.ts \ 29 ../../i18n/zh_CN/libqjumpx.ts \
30 ../../i18n/zh_TW/libqjumpx.ts 30 ../../i18n/zh_TW/libqjumpx.ts
31 31
32 32
33 33
34include ( $(OPIEDIR)/include.pro ) 34include ( $(OPIEDIR)/include.pro )
35target.path = $$prefix/plugins/inputmethods 35target.path = $$prefix/plugins/inputmethods
diff --git a/inputmethods/keyboard/keyboard.pro b/inputmethods/keyboard/keyboard.pro
index 5ca97f1..56e35b9 100644
--- a/inputmethods/keyboard/keyboard.pro
+++ b/inputmethods/keyboard/keyboard.pro
@@ -1,36 +1,36 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt warn_on release 2 CONFIG += qt plugin warn_on release
3 HEADERS= keyboard.h \ 3 HEADERS= keyboard.h \
4 keyboardimpl.h 4 keyboardimpl.h
5 SOURCES= keyboard.cpp \ 5 SOURCES= keyboard.cpp \
6 keyboardimpl.cpp 6 keyboardimpl.cpp
7 TARGET = qkeyboard 7 TARGET = qkeyboard
8 DESTDIR = ../../plugins/inputmethods 8 DESTDIR = ../../plugins/inputmethods
9INCLUDEPATH += $(OPIEDIR)/include 9INCLUDEPATH += $(OPIEDIR)/include
10DEPENDPATH += ../$(OPIEDIR)/include ../../launcher 10DEPENDPATH += ../$(OPIEDIR)/include ../../launcher
11LIBS += -lqpe -L$(OPIEDIR)/plugins/inputmethods -lqpickboard 11LIBS += -lqpe -L$(OPIEDIR)/plugins/inputmethods -lqpickboard
12 QMAKE_LFLAGS+= -Wl,-rpath,/opt/QtPalmtop/plugins/inputmethods 12 QMAKE_LFLAGS+= -Wl,-rpath,/opt/QtPalmtop/plugins/inputmethods
13 VERSION = 1.0.0 13 VERSION = 1.0.0
14 14
15TRANSLATIONS = ../../i18n/de/libqkeyboard.ts \ 15TRANSLATIONS = ../../i18n/de/libqkeyboard.ts \
16 ../../i18n/nl/libqkeyboard.ts \ 16 ../../i18n/nl/libqkeyboard.ts \
17 ../../i18n/da/libqkeyboard.ts \ 17 ../../i18n/da/libqkeyboard.ts \
18 ../../i18n/xx/libqkeyboard.ts \ 18 ../../i18n/xx/libqkeyboard.ts \
19 ../../i18n/en/libqkeyboard.ts \ 19 ../../i18n/en/libqkeyboard.ts \
20 ../../i18n/es/libqkeyboard.ts \ 20 ../../i18n/es/libqkeyboard.ts \
21 ../../i18n/fr/libqkeyboard.ts \ 21 ../../i18n/fr/libqkeyboard.ts \
22 ../../i18n/hu/libqkeyboard.ts \ 22 ../../i18n/hu/libqkeyboard.ts \
23 ../../i18n/ja/libqkeyboard.ts \ 23 ../../i18n/ja/libqkeyboard.ts \
24 ../../i18n/ko/libqkeyboard.ts \ 24 ../../i18n/ko/libqkeyboard.ts \
25 ../../i18n/no/libqkeyboard.ts \ 25 ../../i18n/no/libqkeyboard.ts \
26 ../../i18n/pl/libqkeyboard.ts \ 26 ../../i18n/pl/libqkeyboard.ts \
27 ../../i18n/pt/libqkeyboard.ts \ 27 ../../i18n/pt/libqkeyboard.ts \
28 ../../i18n/pt_BR/libqkeyboard.ts \ 28 ../../i18n/pt_BR/libqkeyboard.ts \
29 ../../i18n/sl/libqkeyboard.ts \ 29 ../../i18n/sl/libqkeyboard.ts \
30 ../../i18n/zh_CN/libqkeyboard.ts \ 30 ../../i18n/zh_CN/libqkeyboard.ts \
31 ../../i18n/zh_TW/libqkeyboard.ts 31 ../../i18n/zh_TW/libqkeyboard.ts
32 32
33 33
34 34
35include ( $(OPIEDIR)/include.pro ) 35include ( $(OPIEDIR)/include.pro )
36target.path = $$prefix/plugins/inputmethods 36target.path = $$prefix/plugins/inputmethods
diff --git a/inputmethods/kjumpx/kjumpx.pro b/inputmethods/kjumpx/kjumpx.pro
index 0624583..2dd6ddf 100644
--- a/inputmethods/kjumpx/kjumpx.pro
+++ b/inputmethods/kjumpx/kjumpx.pro
@@ -1,35 +1,35 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on release 2CONFIG += qt plugin warn_on release
3HEADERS = keyboard.h \ 3HEADERS = keyboard.h \
4 keyboardimpl.h 4 keyboardimpl.h
5SOURCES = keyboard.cpp \ 5SOURCES = keyboard.cpp \
6 keyboardimpl.cpp 6 keyboardimpl.cpp
7TARGET = qkjumpx 7TARGET = qkjumpx
8DESTDIR = ../../plugins/inputmethods 8DESTDIR = ../../plugins/inputmethods
9INCLUDEPATH += $(OPIEDIR)/include 9INCLUDEPATH += $(OPIEDIR)/include
10DEPENDPATH += $(OPIEDIR)/include 10DEPENDPATH += $(OPIEDIR)/include
11LIBS += -lqpe 11LIBS += -lqpe
12VERSION = 1.0.0 12VERSION = 1.0.0
13 13
14TRANSLATIONS = ../../i18n/de/libqkjumpx.ts \ 14TRANSLATIONS = ../../i18n/de/libqkjumpx.ts \
15 ../../i18n/nl/libqkjumpx.ts \ 15 ../../i18n/nl/libqkjumpx.ts \
16 ../../i18n/da/libqkjumpx.ts \ 16 ../../i18n/da/libqkjumpx.ts \
17 ../../i18n/xx/libqkjumpx.ts \ 17 ../../i18n/xx/libqkjumpx.ts \
18 ../../i18n/en/libqkjumpx.ts \ 18 ../../i18n/en/libqkjumpx.ts \
19 ../../i18n/es/libqkjumpx.ts \ 19 ../../i18n/es/libqkjumpx.ts \
20 ../../i18n/fr/libqkjumpx.ts \ 20 ../../i18n/fr/libqkjumpx.ts \
21 ../../i18n/hu/libqkjumpx.ts \ 21 ../../i18n/hu/libqkjumpx.ts \
22 ../../i18n/ja/libqkjumpx.ts \ 22 ../../i18n/ja/libqkjumpx.ts \
23 ../../i18n/ko/libqkjumpx.ts \ 23 ../../i18n/ko/libqkjumpx.ts \
24 ../../i18n/no/libqkjumpx.ts \ 24 ../../i18n/no/libqkjumpx.ts \
25 ../../i18n/pl/libqkjumpx.ts \ 25 ../../i18n/pl/libqkjumpx.ts \
26 ../../i18n/pt/libqkjumpx.ts \ 26 ../../i18n/pt/libqkjumpx.ts \
27 ../../i18n/pt_BR/libqkjumpx.ts \ 27 ../../i18n/pt_BR/libqkjumpx.ts \
28 ../../i18n/sl/libqkjumpx.ts \ 28 ../../i18n/sl/libqkjumpx.ts \
29 ../../i18n/zh_CN/libqkjumpx.ts \ 29 ../../i18n/zh_CN/libqkjumpx.ts \
30 ../../i18n/zh_TW/libqkjumpx.ts 30 ../../i18n/zh_TW/libqkjumpx.ts
31 31
32 32
33 33
34include ( $(OPIEDIR)/include.pro ) 34include ( $(OPIEDIR)/include.pro )
35target.path = $$prefix/plugins/inputmethods 35target.path = $$prefix/plugins/inputmethods
diff --git a/inputmethods/multikey/multikey.pro b/inputmethods/multikey/multikey.pro
index 424c000..82dcb94 100644
--- a/inputmethods/multikey/multikey.pro
+++ b/inputmethods/multikey/multikey.pro
@@ -1,36 +1,36 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt warn_on release 2 CONFIG += qt plugin warn_on release
3 HEADERS= keyboard.h \ 3 HEADERS= keyboard.h \
4 configdlg.h \ 4 configdlg.h \
5 keyboardimpl.h 5 keyboardimpl.h
6 SOURCES= keyboard.cpp \ 6 SOURCES= keyboard.cpp \
7 configdlg.cpp \ 7 configdlg.cpp \
8 keyboardimpl.cpp 8 keyboardimpl.cpp
9 TARGET = qmultikey 9 TARGET = qmultikey
10 DESTDIR = $(OPIEDIR)/plugins/inputmethods 10 DESTDIR = $(OPIEDIR)/plugins/inputmethods
11INCLUDEPATH += $(OPIEDIR)/include 11INCLUDEPATH += $(OPIEDIR)/include
12DEPENDPATH += ../$(OPIEDIR)/include ../../launcher 12DEPENDPATH += ../$(OPIEDIR)/include ../../launcher
13LIBS += -lqpe -L$(OPIEDIR)/plugins/inputmethods -lqpickboard 13LIBS += -lqpe -L$(OPIEDIR)/plugins/inputmethods -lqpickboard
14 QMAKE_LFLAGS+= -Wl,-rpath,/opt/QtPalmtop/plugins/inputmethods 14 QMAKE_LFLAGS+= -Wl,-rpath,/opt/QtPalmtop/plugins/inputmethods
15 VERSION = 1.0.0 15 VERSION = 1.0.0
16 16
17TRANSLATIONS = ../../i18n/pt_BR/libqmultikey.ts \ 17TRANSLATIONS = ../../i18n/pt_BR/libqmultikey.ts \
18 ../../i18n/nl/libqmultikey.ts \ 18 ../../i18n/nl/libqmultikey.ts \
19 ../../i18n/de/libqmultikey.ts \ 19 ../../i18n/de/libqmultikey.ts \
20 ../../i18n/xx/libqmultikey.ts \ 20 ../../i18n/xx/libqmultikey.ts \
21 ../../i18n/en/libqmultikey.ts \ 21 ../../i18n/en/libqmultikey.ts \
22 ../../i18n/hu/libqmultikey.ts \ 22 ../../i18n/hu/libqmultikey.ts \
23 ../../i18n/sl/libqmultikey.ts \ 23 ../../i18n/sl/libqmultikey.ts \
24 ../../i18n/ja/libqmultikey.ts \ 24 ../../i18n/ja/libqmultikey.ts \
25 ../../i18n/ko/libqmultikey.ts \ 25 ../../i18n/ko/libqmultikey.ts \
26 ../../i18n/pl/libqmultikey.ts \ 26 ../../i18n/pl/libqmultikey.ts \
27 ../../i18n/no/libqmultikey.ts \ 27 ../../i18n/no/libqmultikey.ts \
28 ../../i18n/zh_CN/libqmultikey.ts \ 28 ../../i18n/zh_CN/libqmultikey.ts \
29 ../../i18n/zh_TW/libqmultikey.ts \ 29 ../../i18n/zh_TW/libqmultikey.ts \
30 ../../i18n/fr/libqmultikey.ts \ 30 ../../i18n/fr/libqmultikey.ts \
31 ../../i18n/da/libqmultikey.ts 31 ../../i18n/da/libqmultikey.ts
32 32
33 33
34 34
35include ( $(OPIEDIR)/include.pro ) 35include ( $(OPIEDIR)/include.pro )
36target.path = $$prefix/plugins/inputmethods 36target.path = $$prefix/plugins/inputmethods
diff --git a/inputmethods/pickboard/pickboard.pro b/inputmethods/pickboard/pickboard.pro
index 53ff8f0..b86c069 100644
--- a/inputmethods/pickboard/pickboard.pro
+++ b/inputmethods/pickboard/pickboard.pro
@@ -1,33 +1,33 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt warn_on release 2 CONFIG += qt plugin warn_on release
3 HEADERS= pickboard.h pickboardcfg.h pickboardimpl.h pickboardpicks.h 3 HEADERS= pickboard.h pickboardcfg.h pickboardimpl.h pickboardpicks.h
4 SOURCES= pickboard.cpp pickboardcfg.cpp pickboardimpl.cpp pickboardpicks.cpp 4 SOURCES= pickboard.cpp pickboardcfg.cpp pickboardimpl.cpp pickboardpicks.cpp
5 TARGET = qpickboard 5 TARGET = qpickboard
6 DESTDIR = ../../plugins/inputmethods 6 DESTDIR = ../../plugins/inputmethods
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += ../$(OPIEDIR)/include ../../launcher 8DEPENDPATH += ../$(OPIEDIR)/include ../../launcher
9LIBS += -lqpe 9LIBS += -lqpe
10 VERSION = 1.0.0 10 VERSION = 1.0.0
11 11
12TRANSLATIONS = ../../i18n/de/libqpickboard.ts \ 12TRANSLATIONS = ../../i18n/de/libqpickboard.ts \
13 ../../i18n/nl/libqpickboard.ts \ 13 ../../i18n/nl/libqpickboard.ts \
14 ../../i18n/da/libqpickboard.ts \ 14 ../../i18n/da/libqpickboard.ts \
15 ../../i18n/xx/libqpickboard.ts \ 15 ../../i18n/xx/libqpickboard.ts \
16 ../../i18n/en/libqpickboard.ts \ 16 ../../i18n/en/libqpickboard.ts \
17 ../../i18n/es/libqpickboard.ts \ 17 ../../i18n/es/libqpickboard.ts \
18 ../../i18n/fr/libqpickboard.ts \ 18 ../../i18n/fr/libqpickboard.ts \
19 ../../i18n/hu/libqpickboard.ts \ 19 ../../i18n/hu/libqpickboard.ts \
20 ../../i18n/ja/libqpickboard.ts \ 20 ../../i18n/ja/libqpickboard.ts \
21 ../../i18n/ko/libqpickboard.ts \ 21 ../../i18n/ko/libqpickboard.ts \
22 ../../i18n/no/libqpickboard.ts \ 22 ../../i18n/no/libqpickboard.ts \
23 ../../i18n/pl/libqpickboard.ts \ 23 ../../i18n/pl/libqpickboard.ts \
24 ../../i18n/pt/libqpickboard.ts \ 24 ../../i18n/pt/libqpickboard.ts \
25 ../../i18n/pt_BR/libqpickboard.ts \ 25 ../../i18n/pt_BR/libqpickboard.ts \
26 ../../i18n/sl/libqpickboard.ts \ 26 ../../i18n/sl/libqpickboard.ts \
27 ../../i18n/zh_CN/libqpickboard.ts \ 27 ../../i18n/zh_CN/libqpickboard.ts \
28 ../../i18n/zh_TW/libqpickboard.ts 28 ../../i18n/zh_TW/libqpickboard.ts
29 29
30 30
31 31
32include ( $(OPIEDIR)/include.pro ) 32include ( $(OPIEDIR)/include.pro )
33target.path = $$prefix/plugins/inputmethods 33target.path = $$prefix/plugins/inputmethods
diff --git a/inputmethods/unikeyboard/unikeyboard.pro b/inputmethods/unikeyboard/unikeyboard.pro
index 0732dc8..678f575 100644
--- a/inputmethods/unikeyboard/unikeyboard.pro
+++ b/inputmethods/unikeyboard/unikeyboard.pro
@@ -1,33 +1,33 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt warn_on release 2 CONFIG += qt plugin warn_on release
3 HEADERS= unikeyboard.h unikeyboardimpl.h 3 HEADERS= unikeyboard.h unikeyboardimpl.h
4 SOURCES= unikeyboard.cpp unikeyboardimpl.cpp 4 SOURCES= unikeyboard.cpp unikeyboardimpl.cpp
5 TARGET = qunikeyboard 5 TARGET = qunikeyboard
6 DESTDIR = ../../plugins/inputmethods 6 DESTDIR = ../../plugins/inputmethods
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += ../$(OPIEDIR)/include ../../launcher 8DEPENDPATH += ../$(OPIEDIR)/include ../../launcher
9LIBS += -lqpe 9LIBS += -lqpe
10 VERSION = 1.0.0 10 VERSION = 1.0.0
11 11
12TRANSLATIONS = ../../i18n/de/libqunikeyboard.ts \ 12TRANSLATIONS = ../../i18n/de/libqunikeyboard.ts \
13 ../../i18n/nl/libqunikeyboard.ts \ 13 ../../i18n/nl/libqunikeyboard.ts \
14 ../../i18n/da/libqunikeyboard.ts \ 14 ../../i18n/da/libqunikeyboard.ts \
15 ../../i18n/xx/libqunikeyboard.ts \ 15 ../../i18n/xx/libqunikeyboard.ts \
16 ../../i18n/en/libqunikeyboard.ts \ 16 ../../i18n/en/libqunikeyboard.ts \
17 ../../i18n/es/libqunikeyboard.ts \ 17 ../../i18n/es/libqunikeyboard.ts \
18 ../../i18n/fr/libqunikeyboard.ts \ 18 ../../i18n/fr/libqunikeyboard.ts \
19 ../../i18n/hu/libqunikeyboard.ts \ 19 ../../i18n/hu/libqunikeyboard.ts \
20 ../../i18n/ja/libqunikeyboard.ts \ 20 ../../i18n/ja/libqunikeyboard.ts \
21 ../../i18n/ko/libqunikeyboard.ts \ 21 ../../i18n/ko/libqunikeyboard.ts \
22 ../../i18n/no/libqunikeyboard.ts \ 22 ../../i18n/no/libqunikeyboard.ts \
23 ../../i18n/pl/libqunikeyboard.ts \ 23 ../../i18n/pl/libqunikeyboard.ts \
24 ../../i18n/pt/libqunikeyboard.ts \ 24 ../../i18n/pt/libqunikeyboard.ts \
25 ../../i18n/pt_BR/libqunikeyboard.ts \ 25 ../../i18n/pt_BR/libqunikeyboard.ts \
26 ../../i18n/sl/libqunikeyboard.ts \ 26 ../../i18n/sl/libqunikeyboard.ts \
27 ../../i18n/zh_CN/libqunikeyboard.ts \ 27 ../../i18n/zh_CN/libqunikeyboard.ts \
28 ../../i18n/zh_TW/libqunikeyboard.ts 28 ../../i18n/zh_TW/libqunikeyboard.ts
29 29
30 30
31 31
32include ( $(OPIEDIR)/include.pro ) 32include ( $(OPIEDIR)/include.pro )
33target.path = $$prefix/plugins/inputmethods 33target.path = $$prefix/plugins/inputmethods
diff --git a/libopie/libopie.pro b/libopie/libopie.pro
index 0398775..bf6b78f 100644
--- a/libopie/libopie.pro
+++ b/libopie/libopie.pro
@@ -1,136 +1,132 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qte warn_on release 2CONFIG += qte warn_on release
3HEADERS = ofontmenu.h \ 3HEADERS = ofontmenu.h \
4 ocolorbutton.h \ 4 ocolorbutton.h \
5 ofiledialog.h ofileselector.h \ 5 ofiledialog.h ofileselector.h \
6 ofileselector_p.h \ 6 ofileselector_p.h \
7 ocheckitem.h \ 7 ocheckitem.h \
8 xmltree.h \ 8 xmltree.h \
9 colordialog.h colorpopupmenu.h \ 9 colordialog.h colorpopupmenu.h \
10 oclickablelabel.h oprocctrl.h \ 10 oclickablelabel.h oprocctrl.h \
11 oprocess.h odevice.h odevicebutton.h \ 11 oprocess.h odevice.h odevicebutton.h \
12 otimepicker.h otabwidget.h \ 12 otimepicker.h otabwidget.h \
13 otabbar.h otabinfo.h \ 13 otabbar.h otabinfo.h \
14 ofontselector.h \ 14 ofontselector.h \
15 pim/opimrecord.h \ 15 pim/opimrecord.h \
16 pim/otodo.h \ 16 pim/otodo.h \
17 pim/orecordlist.h \ 17 pim/orecordlist.h \
18 pim/opimaccesstemplate.h \ 18 pim/opimaccesstemplate.h \
19 pim/opimaccessbackend.h \ 19 pim/opimaccessbackend.h \
20 pim/otodoaccess.h \ 20 pim/otodoaccess.h \
21 pim/otodoaccessbackend.h \ 21 pim/otodoaccessbackend.h \
22 pim/oconversion.h \ 22 pim/oconversion.h \
23 pim/ocontact.h \ 23 pim/ocontact.h \
24 pim/ocontactfields.h \ 24 pim/ocontactfields.h \
25 pim/ocontactaccess.h \ 25 pim/ocontactaccess.h \
26 pim/ocontactaccessbackend.h \ 26 pim/ocontactaccessbackend.h \
27 pim/ocontactaccessbackend_xml.h \ 27 pim/ocontactaccessbackend_xml.h \
28 pim/ocontactaccessbackend_vcard.h \ 28 pim/ocontactaccessbackend_vcard.h \
29 pim/obackendfactory.h \ 29 pim/obackendfactory.h \
30 pim/opimcache.h \ 30 pim/opimcache.h \
31 pim/otodoaccessvcal.h \ 31 pim/otodoaccessvcal.h \
32 pim/orecur.h \ 32 pim/orecur.h \
33 pim/opimstate.h \ 33 pim/opimstate.h \
34 pim/opimxrefpartner.h \ 34 pim/opimxrefpartner.h \
35 pim/opimxref.h \ 35 pim/opimxref.h \
36 pim/opimxrefmanager.h \ 36 pim/opimxrefmanager.h \
37 pim/opimmaintainer.h \ 37 pim/opimmaintainer.h \
38 pim/opimnotify.h \ 38 pim/opimnotify.h \
39 pim/opimnotifymanager.h \ 39 pim/opimnotifymanager.h \
40 pim/opimmainwindow.h \ 40 pim/opimmainwindow.h \
41 pim/opimresolver.h \ 41 pim/opimresolver.h \
42 pim/oevent.h \ 42 pim/oevent.h \
43 pim/otimezone.h \ 43 pim/otimezone.h \
44 pim/odatebookaccess.h \ 44 pim/odatebookaccess.h \
45 pim/odatebookaccessbackend.h \ 45 pim/odatebookaccessbackend.h \
46 pim/odatebookaccessbackend_xml.h \ 46 pim/odatebookaccessbackend_xml.h \
47 orecurrancewidget.h \ 47 orecurrancewidget.h \
48 oticker.h owait.h 48 oticker.h owait.h
49 49
50SOURCES = ofontmenu.cc \ 50SOURCES = ofontmenu.cc \
51 ocolorbutton.cpp \ 51 ocolorbutton.cpp \
52 sharp_compat.cpp \ 52 sharp_compat.cpp \
53 xmltree.cc \ 53 xmltree.cc \
54 ofiledialog.cc ofileselector.cpp \ 54 ofiledialog.cc ofileselector.cpp \
55 ocheckitem.cpp \ 55 ocheckitem.cpp \
56 colordialog.cpp \ 56 colordialog.cpp \
57 colorpopupmenu.cpp oclickablelabel.cpp \ 57 colorpopupmenu.cpp oclickablelabel.cpp \
58 oprocctrl.cpp oprocess.cpp \ 58 oprocctrl.cpp oprocess.cpp \
59 odevice.cpp odevicebutton.cpp otimepicker.cpp \ 59 odevice.cpp odevicebutton.cpp otimepicker.cpp \
60 otabwidget.cpp otabbar.cpp \ 60 otabwidget.cpp otabbar.cpp \
61 ofontselector.cpp \ 61 ofontselector.cpp \
62 pim/otodo.cpp \ 62 pim/otodo.cpp \
63 pim/opimrecord.cpp \ 63 pim/opimrecord.cpp \
64 pim/otodoaccess.cpp \ 64 pim/otodoaccess.cpp \
65 pim/otodoaccessbackend.cpp \ 65 pim/otodoaccessbackend.cpp \
66 pim/otodoaccessxml.cpp \ 66 pim/otodoaccessxml.cpp \
67 pim/oconversion.cpp \ 67 pim/oconversion.cpp \
68 pim/ocontact.cpp \ 68 pim/ocontact.cpp \
69 pim/ocontactfields.cpp \ 69 pim/ocontactfields.cpp \
70 pim/ocontactaccess.cpp \ 70 pim/ocontactaccess.cpp \
71 pim/ocontactaccessbackend_vcard.cpp \ 71 pim/ocontactaccessbackend_vcard.cpp \
72 pim/ocontactaccessbackend_xml.cpp \ 72 pim/ocontactaccessbackend_xml.cpp \
73 pim/otodoaccessvcal.cpp \ 73 pim/otodoaccessvcal.cpp \
74 pim/orecur.cpp \ 74 pim/orecur.cpp \
75 pim/opimstate.cpp \ 75 pim/opimstate.cpp \
76 pim/opimxrefpartner.cpp \ 76 pim/opimxrefpartner.cpp \
77 pim/opimxref.cpp \ 77 pim/opimxref.cpp \
78 pim/opimxrefmanager.cpp \ 78 pim/opimxrefmanager.cpp \
79 pim/opimmaintainer.cpp \ 79 pim/opimmaintainer.cpp \
80 pim/opimnotify.cpp \ 80 pim/opimnotify.cpp \
81 pim/opimnotifymanager.cpp \ 81 pim/opimnotifymanager.cpp \
82 pim/opimmainwindow.cpp \ 82 pim/opimmainwindow.cpp \
83 pim/opimresolver.cpp \ 83 pim/opimresolver.cpp \
84 pim/oevent.cpp \ 84 pim/oevent.cpp \
85 pim/otimezone.cpp \ 85 pim/otimezone.cpp \
86 pim/odatebookaccess.cpp \ 86 pim/odatebookaccess.cpp \
87 pim/odatebookaccessbackend.cpp \ 87 pim/odatebookaccessbackend.cpp \
88 pim/odatebookaccessbackend_xml.cpp \ 88 pim/odatebookaccessbackend_xml.cpp \
89 orecurrancewidget.cpp \ 89 orecurrancewidget.cpp \
90 oticker.cpp owait.cpp 90 oticker.cpp owait.cpp
91 91
92TARGET = opie 92TARGET = opie
93INCLUDEPATH += $(OPIEDIR)/include 93INCLUDEPATH += $(OPIEDIR)/include
94DESTDIR = $(OPIEDIR)/lib$(PROJMAK) 94DESTDIR = $(OPIEDIR)/lib$(PROJMAK)
95 95
96# The following is just for my Notebook !
97# It should never be committed !! (eilers)
98# QMAKE_CXXFLAGS += -DQT_NO_SOUND
99
100LIBS += -lqpe 96LIBS += -lqpe
101 97
102# Add SQL-Support if selected by config (eilers) 98# Add SQL-Support if selected by config (eilers)
103CONFTEST = $$system( echo $CONFIG_SQL_PIM_BACKEND ) 99CONFTEST = $$system( echo $CONFIG_SQL_PIM_BACKEND )
104contains( CONFTEST, y ){ 100contains( CONFTEST, y ){
105 101
106DEFINES += __USE_SQL 102DEFINES += __USE_SQL
107LIBS += -lopiedb2 -lsqlite 103LIBS += -lopiedb2 -lsqlite
108HEADERS += pim/otodoaccesssql.h pim/ocontactaccessbackend_sql.h 104HEADERS += pim/otodoaccesssql.h pim/ocontactaccessbackend_sql.h
109SOURCES += pim/otodoaccesssql.cpp pim/ocontactaccessbackend_sql.cpp 105SOURCES += pim/otodoaccesssql.cpp pim/ocontactaccessbackend_sql.cpp
110 106
111} 107}
112 108
113INTERFACES = otimepickerbase.ui orecurrancebase.ui 109INTERFACES = otimepickerbase.ui orecurrancebase.ui
114TARGET = opie 110TARGET = opie
115 111
116TRANSLATIONS = ../i18n/de/libopie.ts \ 112TRANSLATIONS = ../i18n/de/libopie.ts \
117 ../i18n/nl/libopie.ts \ 113 ../i18n/nl/libopie.ts \
118 ../i18n/xx/libopie.ts \ 114 ../i18n/xx/libopie.ts \
119 ../i18n/en/libopie.ts \ 115 ../i18n/en/libopie.ts \
120 ../i18n/es/libopie.ts \ 116 ../i18n/es/libopie.ts \
121 ../i18n/fr/libopie.ts \ 117 ../i18n/fr/libopie.ts \
122 ../i18n/hu/libopie.ts \ 118 ../i18n/hu/libopie.ts \
123 ../i18n/ja/libopie.ts \ 119 ../i18n/ja/libopie.ts \
124 ../i18n/ko/libopie.ts \ 120 ../i18n/ko/libopie.ts \
125 ../i18n/no/libopie.ts \ 121 ../i18n/no/libopie.ts \
126 ../i18n/pl/libopie.ts \ 122 ../i18n/pl/libopie.ts \
127 ../i18n/pt/libopie.ts \ 123 ../i18n/pt/libopie.ts \
128 ../i18n/pt_BR/libopie.ts \ 124 ../i18n/pt_BR/libopie.ts \
129 ../i18n/sl/libopie.ts \ 125 ../i18n/sl/libopie.ts \
130 ../i18n/zh_CN/libopie.ts \ 126 ../i18n/zh_CN/libopie.ts \
131 ../i18n/zh_TW/libopie.ts \ 127 ../i18n/zh_TW/libopie.ts \
132 ../i18n/da/libopie.ts 128 ../i18n/da/libopie.ts
133 129
134include ( big-screen/big-screen.pro ) 130include ( big-screen/big-screen.pro )
135 131
136include ( $(OPIEDIR)/include.pro ) 132include ( $(OPIEDIR)/include.pro )
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index 3edf8e7..fef623a 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -1,2598 +1,2600 @@
1/* This file is part of the OPIE libraries 1/* This file is part of the OPIE libraries
2 Copyright (C) 2002 Robert Griebl (sandman@handhelds.org) 2 Copyright (C) 2002 Robert Griebl (sandman@handhelds.org)
3 3
4 This library is free software; you can redistribute it and/or 4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public 5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either 6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version. 7 version 2 of the License, or (at your option) any later version.
8 8
9 This library is distributed in the hope that it will be useful, 9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details. 12 Library General Public License for more details.
13 13
14 You should have received a copy of the GNU Library General Public License 14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to 15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. 17 Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#include <stdlib.h> 20#include <stdlib.h>
21#include <unistd.h> 21#include <unistd.h>
22#include <fcntl.h> 22#include <fcntl.h>
23#include <sys/ioctl.h> 23#include <sys/ioctl.h>
24#include <signal.h> 24#include <signal.h>
25#include <sys/time.h> 25#include <sys/time.h>
26#ifndef QT_NO_SOUND
26#include <linux/soundcard.h> 27#include <linux/soundcard.h>
28#endif
27#include <math.h> 29#include <math.h>
28 30
29#include <qapplication.h> 31#include <qapplication.h>
30 32
31#include <qfile.h> 33#include <qfile.h>
32#include <qtextstream.h> 34#include <qtextstream.h>
33#include <qpe/sound.h> 35#include <qpe/sound.h>
34#include <qpe/resource.h> 36#include <qpe/resource.h>
35#include <qpe/config.h> 37#include <qpe/config.h>
36#include <qpe/qcopenvelope_qws.h> 38#include <qpe/qcopenvelope_qws.h>
37 39
38#include "odevice.h" 40#include "odevice.h"
39 41
40#include <qwindowsystem_qws.h> 42#include <qwindowsystem_qws.h>
41 43
42#ifndef ARRAY_SIZE 44#ifndef ARRAY_SIZE
43#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 45#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
44#endif 46#endif
45 47
46// _IO and friends are only defined in kernel headers ... 48// _IO and friends are only defined in kernel headers ...
47 49
48#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 )) 50#define OD_IOC(dir,type,number,size) (( dir << 30 ) | ( type << 8 ) | ( number ) | ( size << 16 ))
49 51
50#define OD_IO(type,number) OD_IOC(0,type,number,0) 52#define OD_IO(type,number) OD_IOC(0,type,number,0)
51#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size)) 53#define OD_IOW(type,number,size) OD_IOC(1,type,number,sizeof(size))
52#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size)) 54#define OD_IOR(type,number,size) OD_IOC(2,type,number,sizeof(size))
53#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size)) 55#define OD_IORW(type,number,size) OD_IOC(3,type,number,sizeof(size))
54 56
55using namespace Opie; 57using namespace Opie;
56 58
57class ODeviceData { 59class ODeviceData {
58public: 60public:
59 QString m_vendorstr; 61 QString m_vendorstr;
60 OVendor m_vendor; 62 OVendor m_vendor;
61 63
62 QString m_modelstr; 64 QString m_modelstr;
63 OModel m_model; 65 OModel m_model;
64 66
65 QString m_systemstr; 67 QString m_systemstr;
66 OSystem m_system; 68 OSystem m_system;
67 69
68 QString m_sysverstr; 70 QString m_sysverstr;
69 71
70 Transformation m_rotation; 72 Transformation m_rotation;
71 ODirection m_direction; 73 ODirection m_direction;
72 74
73 QValueList <ODeviceButton> *m_buttons; 75 QValueList <ODeviceButton> *m_buttons;
74 uint m_holdtime; 76 uint m_holdtime;
75 QStrList *m_cpu_frequencies; 77 QStrList *m_cpu_frequencies;
76}; 78};
77 79
78class iPAQ : public ODevice, public QWSServer::KeyboardFilter { 80class iPAQ : public ODevice, public QWSServer::KeyboardFilter {
79protected: 81protected:
80 virtual void init ( ); 82 virtual void init ( );
81 virtual void initButtons ( ); 83 virtual void initButtons ( );
82 84
83public: 85public:
84 virtual bool setSoftSuspend ( bool soft ); 86 virtual bool setSoftSuspend ( bool soft );
85 87
86 virtual bool setDisplayBrightness ( int b ); 88 virtual bool setDisplayBrightness ( int b );
87 virtual int displayBrightnessResolution ( ) const; 89 virtual int displayBrightnessResolution ( ) const;
88 90
89 virtual void alarmSound ( ); 91 virtual void alarmSound ( );
90 92
91 virtual QValueList <OLed> ledList ( ) const; 93 virtual QValueList <OLed> ledList ( ) const;
92 virtual QValueList <OLedState> ledStateList ( OLed led ) const; 94 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
93 virtual OLedState ledState ( OLed led ) const; 95 virtual OLedState ledState ( OLed led ) const;
94 virtual bool setLedState ( OLed led, OLedState st ); 96 virtual bool setLedState ( OLed led, OLedState st );
95 97
96 virtual bool hasLightSensor ( ) const; 98 virtual bool hasLightSensor ( ) const;
97 virtual int readLightSensor ( ); 99 virtual int readLightSensor ( );
98 virtual int lightSensorResolution ( ) const; 100 virtual int lightSensorResolution ( ) const;
99 101
100protected: 102protected:
101 virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); 103 virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
102 virtual void timerEvent ( QTimerEvent *te ); 104 virtual void timerEvent ( QTimerEvent *te );
103 105
104 int m_power_timer; 106 int m_power_timer;
105 107
106 OLedState m_leds [2]; 108 OLedState m_leds [2];
107}; 109};
108 110
109class Jornada : public ODevice { 111class Jornada : public ODevice {
110protected: 112protected:
111 virtual void init ( ); 113 virtual void init ( );
112 //virtual void initButtons ( ); 114 //virtual void initButtons ( );
113public: 115public:
114 virtual bool setSoftSuspend ( bool soft ); 116 virtual bool setSoftSuspend ( bool soft );
115 virtual bool setDisplayBrightness ( int b ); 117 virtual bool setDisplayBrightness ( int b );
116 virtual int displayBrightnessResolution ( ) const; 118 virtual int displayBrightnessResolution ( ) const;
117 static bool isJornada(); 119 static bool isJornada();
118 120
119}; 121};
120 122
121class Zaurus : public ODevice { 123class Zaurus : public ODevice {
122protected: 124protected:
123 virtual void init ( ); 125 virtual void init ( );
124 virtual void initButtons ( ); 126 virtual void initButtons ( );
125 127
126public: 128public:
127 virtual bool setSoftSuspend ( bool soft ); 129 virtual bool setSoftSuspend ( bool soft );
128 130
129 virtual bool setDisplayBrightness ( int b ); 131 virtual bool setDisplayBrightness ( int b );
130 virtual int displayBrightnessResolution ( ) const; 132 virtual int displayBrightnessResolution ( ) const;
131 133
132 virtual void alarmSound ( ); 134 virtual void alarmSound ( );
133 virtual void keySound ( ); 135 virtual void keySound ( );
134 virtual void touchSound ( ); 136 virtual void touchSound ( );
135 137
136 virtual QValueList <OLed> ledList ( ) const; 138 virtual QValueList <OLed> ledList ( ) const;
137 virtual QValueList <OLedState> ledStateList ( OLed led ) const; 139 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
138 virtual OLedState ledState ( OLed led ) const; 140 virtual OLedState ledState ( OLed led ) const;
139 virtual bool setLedState ( OLed led, OLedState st ); 141 virtual bool setLedState ( OLed led, OLedState st );
140 142
141 static bool isZaurus(); 143 static bool isZaurus();
142 144
143protected: 145protected:
144 virtual void buzzer ( int snd ); 146 virtual void buzzer ( int snd );
145 147
146 OLedState m_leds [1]; 148 OLedState m_leds [1];
147 bool m_embedix; 149 bool m_embedix;
148}; 150};
149 151
150class SIMpad : public ODevice, public QWSServer::KeyboardFilter { 152class SIMpad : public ODevice, public QWSServer::KeyboardFilter {
151protected: 153protected:
152 virtual void init ( ); 154 virtual void init ( );
153 virtual void initButtons ( ); 155 virtual void initButtons ( );
154 156
155public: 157public:
156 virtual bool setSoftSuspend ( bool soft ); 158 virtual bool setSoftSuspend ( bool soft );
157 virtual bool suspend(); 159 virtual bool suspend();
158 160
159 virtual bool setDisplayStatus( bool on ); 161 virtual bool setDisplayStatus( bool on );
160 virtual bool setDisplayBrightness ( int b ); 162 virtual bool setDisplayBrightness ( int b );
161 virtual int displayBrightnessResolution ( ) const; 163 virtual int displayBrightnessResolution ( ) const;
162 164
163 virtual void alarmSound ( ); 165 virtual void alarmSound ( );
164 166
165 virtual QValueList <OLed> ledList ( ) const; 167 virtual QValueList <OLed> ledList ( ) const;
166 virtual QValueList <OLedState> ledStateList ( OLed led ) const; 168 virtual QValueList <OLedState> ledStateList ( OLed led ) const;
167 virtual OLedState ledState ( OLed led ) const; 169 virtual OLedState ledState ( OLed led ) const;
168 virtual bool setLedState ( OLed led, OLedState st ); 170 virtual bool setLedState ( OLed led, OLedState st );
169 171
170protected: 172protected:
171 virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); 173 virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
172 virtual void timerEvent ( QTimerEvent *te ); 174 virtual void timerEvent ( QTimerEvent *te );
173 175
174 int m_power_timer; 176 int m_power_timer;
175 177
176 OLedState m_leds [1]; //FIXME check if really only one 178 OLedState m_leds [1]; //FIXME check if really only one
177}; 179};
178 180
179class Ramses : public ODevice, public QWSServer::KeyboardFilter { 181class Ramses : public ODevice, public QWSServer::KeyboardFilter {
180protected: 182protected:
181 virtual void init ( ); 183 virtual void init ( );
182 184
183public: 185public:
184 virtual bool setSoftSuspend ( bool soft ); 186 virtual bool setSoftSuspend ( bool soft );
185 virtual bool suspend ( ); 187 virtual bool suspend ( );
186 188
187 virtual bool setDisplayStatus( bool on ); 189 virtual bool setDisplayStatus( bool on );
188 virtual bool setDisplayBrightness ( int b ); 190 virtual bool setDisplayBrightness ( int b );
189 virtual int displayBrightnessResolution ( ) const; 191 virtual int displayBrightnessResolution ( ) const;
190 virtual bool setDisplayContrast ( int b ); 192 virtual bool setDisplayContrast ( int b );
191 virtual int displayContrastResolution ( ) const; 193 virtual int displayContrastResolution ( ) const;
192 194
193protected: 195protected:
194 virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ); 196 virtual bool filter ( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat );
195 virtual void timerEvent ( QTimerEvent *te ); 197 virtual void timerEvent ( QTimerEvent *te );
196 198
197 int m_power_timer; 199 int m_power_timer;
198}; 200};
199 201
200struct i_button { 202struct i_button {
201 uint model; 203 uint model;
202 Qt::Key code; 204 Qt::Key code;
203 char *utext; 205 char *utext;
204 char *pix; 206 char *pix;
205 char *fpressedservice; 207 char *fpressedservice;
206 char *fpressedaction; 208 char *fpressedaction;
207 char *fheldservice; 209 char *fheldservice;
208 char *fheldaction; 210 char *fheldaction;
209} ipaq_buttons [] = { 211} ipaq_buttons [] = {
210 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, 212 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx,
211 Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 213 Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
212 "devicebuttons/ipaq_calendar", 214 "devicebuttons/ipaq_calendar",
213 "datebook", "nextView()", 215 "datebook", "nextView()",
214 "today", "raise()" }, 216 "today", "raise()" },
215 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, 217 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx,
216 Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 218 Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
217 "devicebuttons/ipaq_contact", 219 "devicebuttons/ipaq_contact",
218 "addressbook", "raise()", 220 "addressbook", "raise()",
219 "addressbook", "beamBusinessCard()" }, 221 "addressbook", "beamBusinessCard()" },
220 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx, 222 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx,
221 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 223 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
222 "devicebuttons/ipaq_menu", 224 "devicebuttons/ipaq_menu",
223 "QPE/TaskBar", "toggleMenu()", 225 "QPE/TaskBar", "toggleMenu()",
224 "QPE/TaskBar", "toggleStartMenu()" }, 226 "QPE/TaskBar", "toggleStartMenu()" },
225 { Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, 227 { Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx,
226 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 228 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
227 "devicebuttons/ipaq_mail", 229 "devicebuttons/ipaq_mail",
228 "mail", "raise()", 230 "mail", "raise()",
229 "mail", "newMail()" }, 231 "mail", "newMail()" },
230 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, 232 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx,
231 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 233 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
232 "devicebuttons/ipaq_home", 234 "devicebuttons/ipaq_home",
233 "QPE/Launcher", "home()", 235 "QPE/Launcher", "home()",
234 "buttonsettings", "raise()" }, 236 "buttonsettings", "raise()" },
235 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx, 237 { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx | Model_iPAQ_H5xxx,
236 Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"), 238 Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"),
237 "devicebuttons/ipaq_record", 239 "devicebuttons/ipaq_record",
238 "QPE/VMemo", "toggleRecord()", 240 "QPE/VMemo", "toggleRecord()",
239 "sound", "raise()" }, 241 "sound", "raise()" },
240}; 242};
241 243
242struct z_button { 244struct z_button {
243 Qt::Key code; 245 Qt::Key code;
244 char *utext; 246 char *utext;
245 char *pix; 247 char *pix;
246 char *fpressedservice; 248 char *fpressedservice;
247 char *fpressedaction; 249 char *fpressedaction;
248 char *fheldservice; 250 char *fheldservice;
249 char *fheldaction; 251 char *fheldaction;
250} z_buttons [] = { 252} z_buttons [] = {
251 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 253 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
252 "devicebuttons/z_calendar", 254 "devicebuttons/z_calendar",
253 "datebook", "nextView()", 255 "datebook", "nextView()",
254 "today", "raise()" }, 256 "today", "raise()" },
255 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 257 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
256 "devicebuttons/z_contact", 258 "devicebuttons/z_contact",
257 "addressbook", "raise()", 259 "addressbook", "raise()",
258 "addressbook", "beamBusinessCard()" }, 260 "addressbook", "beamBusinessCard()" },
259 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 261 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
260 "devicebuttons/z_home", 262 "devicebuttons/z_home",
261 "QPE/Launcher", "home()", 263 "QPE/Launcher", "home()",
262 "buttonsettings", "raise()" }, 264 "buttonsettings", "raise()" },
263 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 265 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
264 "devicebuttons/z_menu", 266 "devicebuttons/z_menu",
265 "QPE/TaskBar", "toggleMenu()", 267 "QPE/TaskBar", "toggleMenu()",
266 "QPE/TaskBar", "toggleStartMenu()" }, 268 "QPE/TaskBar", "toggleStartMenu()" },
267 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), 269 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"),
268 "devicebuttons/z_mail", 270 "devicebuttons/z_mail",
269 "mail", "raise()", 271 "mail", "raise()",
270 "mail", "newMail()" }, 272 "mail", "newMail()" },
271}; 273};
272 274
273struct z_button z_buttons_c700 [] = { 275struct z_button z_buttons_c700 [] = {
274 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), 276 { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"),
275 "devicebuttons/z_calendar", 277 "devicebuttons/z_calendar",
276 "datebook", "nextView()", 278 "datebook", "nextView()",
277 "today", "raise()" }, 279 "today", "raise()" },
278 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), 280 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"),
279 "devicebuttons/z_contact", 281 "devicebuttons/z_contact",
280 "addressbook", "raise()", 282 "addressbook", "raise()",
281 "addressbook", "beamBusinessCard()" }, 283 "addressbook", "beamBusinessCard()" },
282 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 284 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
283 "devicebuttons/z_home", 285 "devicebuttons/z_home",
284 "QPE/Launcher", "home()", 286 "QPE/Launcher", "home()",
285 "buttonsettings", "raise()" }, 287 "buttonsettings", "raise()" },
286 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 288 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
287 "devicebuttons/z_menu", 289 "devicebuttons/z_menu",
288 "QPE/TaskBar", "toggleMenu()", 290 "QPE/TaskBar", "toggleMenu()",
289 "QPE/TaskBar", "toggleStartMenu()" }, 291 "QPE/TaskBar", "toggleStartMenu()" },
290 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Display Rotate"), 292 { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Display Rotate"),
291 "", 293 "",
292 "QPE/Rotation", "flip()", 294 "QPE/Rotation", "flip()",
293 "QPE/Rotation", "flip()" }, 295 "QPE/Rotation", "flip()" },
294}; 296};
295 297
296struct s_button { 298struct s_button {
297 uint model; 299 uint model;
298 Qt::Key code; 300 Qt::Key code;
299 char *utext; 301 char *utext;
300 char *pix; 302 char *pix;
301 char *fpressedservice; 303 char *fpressedservice;
302 char *fpressedaction; 304 char *fpressedaction;
303 char *fheldservice; 305 char *fheldservice;
304 char *fheldaction; 306 char *fheldaction;
305} simpad_buttons [] = { 307} simpad_buttons [] = {
306 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 308 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
307 Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Lower+Up"), 309 Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Lower+Up"),
308 "devicebuttons/simpad_lower_up", 310 "devicebuttons/simpad_lower_up",
309 "datebook", "nextView()", 311 "datebook", "nextView()",
310 "today", "raise()" }, 312 "today", "raise()" },
311 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 313 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
312 Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Lower+Down"), 314 Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Lower+Down"),
313 "devicebuttons/simpad_lower_down", 315 "devicebuttons/simpad_lower_down",
314 "addressbook", "raise()", 316 "addressbook", "raise()",
315 "addressbook", "beamBusinessCard()" }, 317 "addressbook", "beamBusinessCard()" },
316 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 318 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
317 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Lower+Right"), 319 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Lower+Right"),
318 "devicebuttons/simpad_lower_right", 320 "devicebuttons/simpad_lower_right",
319 "QPE/TaskBar", "toggleMenu()", 321 "QPE/TaskBar", "toggleMenu()",
320 "QPE/TaskBar", "toggleStartMenu()" }, 322 "QPE/TaskBar", "toggleStartMenu()" },
321 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 323 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
322 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Lower+Left"), 324 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Lower+Left"),
323 "devicebuttons/simpad_lower_left", 325 "devicebuttons/simpad_lower_left",
324 "mail", "raise()", 326 "mail", "raise()",
325 "mail", "newMail()" }, 327 "mail", "newMail()" },
326 328
327 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 329 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
328 Qt::Key_F5, QT_TRANSLATE_NOOP("Button", "Upper+Up"), 330 Qt::Key_F5, QT_TRANSLATE_NOOP("Button", "Upper+Up"),
329 "devicebuttons/simpad_upper_up", 331 "devicebuttons/simpad_upper_up",
330 "QPE/Launcher", "home()", 332 "QPE/Launcher", "home()",
331 "buttonsettings", "raise()" }, 333 "buttonsettings", "raise()" },
332 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 334 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
333 Qt::Key_F6, QT_TRANSLATE_NOOP("Button", "Upper+Down"), 335 Qt::Key_F6, QT_TRANSLATE_NOOP("Button", "Upper+Down"),
334 "devicebuttons/simpad_upper_down", 336 "devicebuttons/simpad_upper_down",
335 "addressbook", "raise()", 337 "addressbook", "raise()",
336 "addressbook", "beamBusinessCard()" }, 338 "addressbook", "beamBusinessCard()" },
337 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 339 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
338 Qt::Key_F7, QT_TRANSLATE_NOOP("Button", "Upper+Right"), 340 Qt::Key_F7, QT_TRANSLATE_NOOP("Button", "Upper+Right"),
339 "devicebuttons/simpad_upper_right", 341 "devicebuttons/simpad_upper_right",
340 "QPE/TaskBar", "toggleMenu()", 342 "QPE/TaskBar", "toggleMenu()",
341 "QPE/TaskBar", "toggleStartMenu()" }, 343 "QPE/TaskBar", "toggleStartMenu()" },
342 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 344 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
343 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Upper+Left"), 345 Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Upper+Left"),
344 "devicebuttons/simpad_upper_left", 346 "devicebuttons/simpad_upper_left",
345 "QPE/Rotation", "flip()", 347 "QPE/Rotation", "flip()",
346 "QPE/Rotation", "flip()" }, 348 "QPE/Rotation", "flip()" },
347 /* 349 /*
348 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 350 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
349 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"), 351 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"),
350 "devicebuttons/simpad_lower_upper", 352 "devicebuttons/simpad_lower_upper",
351 "QPE/Launcher", "home()", 353 "QPE/Launcher", "home()",
352 "buttonsettings", "raise()" }, 354 "buttonsettings", "raise()" },
353 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, 355 { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus,
354 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"), 356 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"),
355 "devicebuttons/simpad_upper_lower", 357 "devicebuttons/simpad_upper_lower",
356 "QPE/Launcher", "home()", 358 "QPE/Launcher", "home()",
357 "buttonsettings", "raise()" }, 359 "buttonsettings", "raise()" },
358 */ 360 */
359}; 361};
360 362
361struct r_button { 363struct r_button {
362 uint model; 364 uint model;
363 Qt::Key code; 365 Qt::Key code;
364 char *utext; 366 char *utext;
365 char *pix; 367 char *pix;
366 char *fpressedservice; 368 char *fpressedservice;
367 char *fpressedaction; 369 char *fpressedaction;
368 char *fheldservice; 370 char *fheldservice;
369 char *fheldaction; 371 char *fheldaction;
370} ramses_buttons [] = { 372} ramses_buttons [] = {
371 { Model_Ramses_MNCI, 373 { Model_Ramses_MNCI,
372 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), 374 Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"),
373 "devicebuttons/z_menu", 375 "devicebuttons/z_menu",
374 "QPE/TaskBar", "toggleMenu()", 376 "QPE/TaskBar", "toggleMenu()",
375 "QPE/TaskBar", "toggleStartMenu()" }, 377 "QPE/TaskBar", "toggleStartMenu()" },
376 { Model_Ramses_MNCI, 378 { Model_Ramses_MNCI,
377 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), 379 Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"),
378 "devicebuttons/ipaq_home", 380 "devicebuttons/ipaq_home",
379 "QPE/Launcher", "home()", 381 "QPE/Launcher", "home()",
380 "buttonsettings", "raise()" }, 382 "buttonsettings", "raise()" },
381}; 383};
382 384
383class Yopy : public ODevice { 385class Yopy : public ODevice {
384protected: 386protected:
385 virtual void init ( ); 387 virtual void init ( );
386 virtual void initButtons ( ); 388 virtual void initButtons ( );
387 389
388public: 390public:
389 virtual bool suspend ( ); 391 virtual bool suspend ( );
390 392
391 virtual bool setDisplayBrightness ( int b ); 393 virtual bool setDisplayBrightness ( int b );
392 virtual int displayBrightnessResolution ( ) const; 394 virtual int displayBrightnessResolution ( ) const;
393 395
394 static bool isYopy ( ); 396 static bool isYopy ( );
395}; 397};
396 398
397struct yopy_button { 399struct yopy_button {
398 Qt::Key code; 400 Qt::Key code;
399 char *utext; 401 char *utext;
400 char *pix; 402 char *pix;
401 char *fpressedservice; 403 char *fpressedservice;
402 char *fpressedaction; 404 char *fpressedaction;
403 char *fheldservice; 405 char *fheldservice;
404 char *fheldaction; 406 char *fheldaction;
405} yopy_buttons [] = { 407} yopy_buttons [] = {
406 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Action Button"), 408 { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Action Button"),
407 "devicebuttons/yopy_action", 409 "devicebuttons/yopy_action",
408 "datebook", "nextView()", 410 "datebook", "nextView()",
409 "today", "raise()" }, 411 "today", "raise()" },
410 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "OK Button"), 412 { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "OK Button"),
411 "devicebuttons/yopy_ok", 413 "devicebuttons/yopy_ok",
412 "addressbook", "raise()", 414 "addressbook", "raise()",
413 "addressbook", "beamBusinessCard()" }, 415 "addressbook", "beamBusinessCard()" },
414 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "End Button"), 416 { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "End Button"),
415 "devicebuttons/yopy_end", 417 "devicebuttons/yopy_end",
416 "QPE/Launcher", "home()", 418 "QPE/Launcher", "home()",
417 "buttonsettings", "raise()" }, 419 "buttonsettings", "raise()" },
418}; 420};
419 421
420static QCString makeChannel ( const char *str ) 422static QCString makeChannel ( const char *str )
421{ 423{
422 if ( str && !::strchr ( str, '/' )) 424 if ( str && !::strchr ( str, '/' ))
423 return QCString ( "QPE/Application/" ) + str; 425 return QCString ( "QPE/Application/" ) + str;
424 else 426 else
425 return str; 427 return str;
426} 428}
427 429
428static inline bool isQWS() 430static inline bool isQWS()
429{ 431{
430 return qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; 432 return qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false;
431} 433}
432 434
433ODevice *ODevice::inst ( ) 435ODevice *ODevice::inst ( )
434{ 436{
435 static ODevice *dev = 0; 437 static ODevice *dev = 0;
436 438
437 if ( !dev ) { 439 if ( !dev ) {
438 if ( QFile::exists ( "/proc/hal/model" )) 440 if ( QFile::exists ( "/proc/hal/model" ))
439 dev = new iPAQ ( ); 441 dev = new iPAQ ( );
440 else if ( Zaurus::isZaurus() ) 442 else if ( Zaurus::isZaurus() )
441 dev = new Zaurus ( ); 443 dev = new Zaurus ( );
442 else if ( QFile::exists ( "/proc/ucb1x00" ) && QFile::exists ( "/proc/cs3" )) 444 else if ( QFile::exists ( "/proc/ucb1x00" ) && QFile::exists ( "/proc/cs3" ))
443 dev = new SIMpad ( ); 445 dev = new SIMpad ( );
444 else if ( QFile::exists ( "/proc/sys/board/name" )) 446 else if ( QFile::exists ( "/proc/sys/board/name" ))
445 dev = new Ramses ( ); 447 dev = new Ramses ( );
446 else if ( Yopy::isYopy() ) 448 else if ( Yopy::isYopy() )
447 dev = new Yopy ( ); 449 dev = new Yopy ( );
448 else if ( Jornada::isJornada() ) 450 else if ( Jornada::isJornada() )
449 dev = new Jornada ( ); 451 dev = new Jornada ( );
450 else 452 else
451 dev = new ODevice ( ); 453 dev = new ODevice ( );
452 dev-> init ( ); 454 dev-> init ( );
453 } 455 }
454 return dev; 456 return dev;
455} 457}
456 458
457 459
458/************************************************** 460/**************************************************
459 * 461 *
460 * common 462 * common
461 * 463 *
462 **************************************************/ 464 **************************************************/
463 465
464 466
465ODevice::ODevice ( ) 467ODevice::ODevice ( )
466{ 468{
467 d = new ODeviceData; 469 d = new ODeviceData;
468 470
469 d-> m_modelstr = "Unknown"; 471 d-> m_modelstr = "Unknown";
470 d-> m_model = Model_Unknown; 472 d-> m_model = Model_Unknown;
471 d-> m_vendorstr = "Unknown"; 473 d-> m_vendorstr = "Unknown";
472 d-> m_vendor = Vendor_Unknown; 474 d-> m_vendor = Vendor_Unknown;
473 d-> m_systemstr = "Unknown"; 475 d-> m_systemstr = "Unknown";
474 d-> m_system = System_Unknown; 476 d-> m_system = System_Unknown;
475 d-> m_sysverstr = "0.0"; 477 d-> m_sysverstr = "0.0";
476 d-> m_rotation = Rot0; 478 d-> m_rotation = Rot0;
477 d-> m_direction = CW; 479 d-> m_direction = CW;
478 480
479 d-> m_holdtime = 1000; // 1000ms 481 d-> m_holdtime = 1000; // 1000ms
480 d-> m_buttons = 0; 482 d-> m_buttons = 0;
481 d-> m_cpu_frequencies = new QStrList; 483 d-> m_cpu_frequencies = new QStrList;
482} 484}
483 485
484void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) 486void ODevice::systemMessage ( const QCString &msg, const QByteArray & )
485{ 487{
486 if ( msg == "deviceButtonMappingChanged()" ) { 488 if ( msg == "deviceButtonMappingChanged()" ) {
487 reloadButtonMapping ( ); 489 reloadButtonMapping ( );
488 } 490 }
489} 491}
490 492
491void ODevice::init ( ) 493void ODevice::init ( )
492{ 494{
493} 495}
494 496
495/** 497/**
496 * This method initialises the button mapping 498 * This method initialises the button mapping
497 */ 499 */
498void ODevice::initButtons ( ) 500void ODevice::initButtons ( )
499{ 501{
500 if ( d-> m_buttons ) 502 if ( d-> m_buttons )
501 return; 503 return;
502 504
503 // Simulation uses iPAQ 3660 device buttons 505 // Simulation uses iPAQ 3660 device buttons
504 506
505 qDebug ( "init Buttons" ); 507 qDebug ( "init Buttons" );
506 d-> m_buttons = new QValueList <ODeviceButton>; 508 d-> m_buttons = new QValueList <ODeviceButton>;
507 509
508 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { 510 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) {
509 i_button *ib = ipaq_buttons + i; 511 i_button *ib = ipaq_buttons + i;
510 ODeviceButton b; 512 ODeviceButton b;
511 513
512 if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { 514 if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) {
513 b. setKeycode ( ib-> code ); 515 b. setKeycode ( ib-> code );
514 b. setUserText ( QObject::tr ( "Button", ib-> utext )); 516 b. setUserText ( QObject::tr ( "Button", ib-> utext ));
515 b. setPixmap ( Resource::loadPixmap ( ib-> pix )); 517 b. setPixmap ( Resource::loadPixmap ( ib-> pix ));
516 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); 518 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction ));
517 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); 519 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction ));
518 d-> m_buttons-> append ( b ); 520 d-> m_buttons-> append ( b );
519 } 521 }
520 } 522 }
521 reloadButtonMapping ( ); 523 reloadButtonMapping ( );
522 524
523 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 525 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
524 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); 526 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & )));
525} 527}
526 528
527ODevice::~ODevice ( ) 529ODevice::~ODevice ( )
528{ 530{
529// we leak m_devicebuttons and m_cpu_frequency 531// we leak m_devicebuttons and m_cpu_frequency
530// but it's a singleton and it is not so importantant 532// but it's a singleton and it is not so importantant
531// -zecke 533// -zecke
532 delete d; 534 delete d;
533} 535}
534 536
535bool ODevice::setSoftSuspend ( bool /*soft*/ ) 537bool ODevice::setSoftSuspend ( bool /*soft*/ )
536{ 538{
537 return false; 539 return false;
538} 540}
539 541
540//#include <linux/apm_bios.h> 542//#include <linux/apm_bios.h>
541 543
542#define APM_IOC_SUSPEND OD_IO( 'A', 2 ) 544#define APM_IOC_SUSPEND OD_IO( 'A', 2 )
543 545
544/** 546/**
545 * This method will try to suspend the device 547 * This method will try to suspend the device
546 * It only works if the user is the QWS Server and the apm application 548 * It only works if the user is the QWS Server and the apm application
547 * is installed. 549 * is installed.
548 * It tries to suspend and then waits some time cause some distributions 550 * It tries to suspend and then waits some time cause some distributions
549 * do have asynchronus apm implementations. 551 * do have asynchronus apm implementations.
550 * This method will either fail and return false or it'll suspend the 552 * This method will either fail and return false or it'll suspend the
551 * device and return once the device got woken up 553 * device and return once the device got woken up
552 * 554 *
553 * @return if the device got suspended 555 * @return if the device got suspended
554 */ 556 */
555bool ODevice::suspend ( ) 557bool ODevice::suspend ( )
556{ 558{
557 qDebug("ODevice::suspend"); 559 qDebug("ODevice::suspend");
558 if ( !isQWS( ) ) // only qwsserver is allowed to suspend 560 if ( !isQWS( ) ) // only qwsserver is allowed to suspend
559 return false; 561 return false;
560 562
561 if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices 563 if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices
562 return false; 564 return false;
563 565
564 bool res = false; 566 bool res = false;
565 567
566 struct timeval tvs, tvn; 568 struct timeval tvs, tvn;
567 ::gettimeofday ( &tvs, 0 ); 569 ::gettimeofday ( &tvs, 0 );
568 570
569 ::sync ( ); // flush fs caches 571 ::sync ( ); // flush fs caches
570 res = ( ::system ( "apm --suspend" ) == 0 ); 572 res = ( ::system ( "apm --suspend" ) == 0 );
571 573
572 // This is needed because the iPAQ apm implementation is asynchronous and we 574 // This is needed because the iPAQ apm implementation is asynchronous and we
573 // can not be sure when exactly the device is really suspended 575 // can not be sure when exactly the device is really suspended
574 // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. 576 // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists.
575 577
576 if ( res ) { 578 if ( res ) {
577 do { // wait at most 1.5 sec: either suspend didn't work or the device resumed 579 do { // wait at most 1.5 sec: either suspend didn't work or the device resumed
578 ::usleep ( 200 * 1000 ); 580 ::usleep ( 200 * 1000 );
579 ::gettimeofday ( &tvn, 0 ); 581 ::gettimeofday ( &tvn, 0 );
580 } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 ); 582 } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 );
581 } 583 }
582 584
583 return res; 585 return res;
584} 586}
585 587
586//#include <linux/fb.h> better not rely on kernel headers in userspace ... 588//#include <linux/fb.h> better not rely on kernel headers in userspace ...
587 589
588#define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611 590#define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611
589 591
590/* VESA Blanking Levels */ 592/* VESA Blanking Levels */
591#define VESA_NO_BLANKING 0 593#define VESA_NO_BLANKING 0
592#define VESA_VSYNC_SUSPEND 1 594#define VESA_VSYNC_SUSPEND 1
593#define VESA_HSYNC_SUSPEND 2 595#define VESA_HSYNC_SUSPEND 2
594#define VESA_POWERDOWN 3 596#define VESA_POWERDOWN 3
595 597
596/** 598/**
597 * This sets the display on or off 599 * This sets the display on or off
598 */ 600 */
599bool ODevice::setDisplayStatus ( bool on ) 601bool ODevice::setDisplayStatus ( bool on )
600{ 602{
601 qDebug("ODevice::setDisplayStatus(%d)", on); 603 qDebug("ODevice::setDisplayStatus(%d)", on);
602 604
603 if ( d-> m_model == Model_Unknown ) 605 if ( d-> m_model == Model_Unknown )
604 return false; 606 return false;
605 607
606 bool res = false; 608 bool res = false;
607 int fd; 609 int fd;
608 610
609 if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { 611 if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) {
610 res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 ); 612 res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 );
611 ::close ( fd ); 613 ::close ( fd );
612 } 614 }
613 return res; 615 return res;
614} 616}
615 617
616/** 618/**
617 * This sets the display brightness 619 * This sets the display brightness
618 * 620 *
619 * @param p The brightness to be set on a scale from 0 to 255 621 * @param p The brightness to be set on a scale from 0 to 255
620 * @return success or failure 622 * @return success or failure
621 */ 623 */
622bool ODevice::setDisplayBrightness ( int p) 624bool ODevice::setDisplayBrightness ( int p)
623{ 625{
624 Q_UNUSED( p ) 626 Q_UNUSED( p )
625 return false; 627 return false;
626} 628}
627 629
628/** 630/**
629 * @return returns the number of steppings on the brightness slider 631 * @return returns the number of steppings on the brightness slider
630 * in the Light-'n-Power settings. 632 * in the Light-'n-Power settings.
631 */ 633 */
632int ODevice::displayBrightnessResolution ( ) const 634int ODevice::displayBrightnessResolution ( ) const
633{ 635{
634 return 16; 636 return 16;
635} 637}
636 638
637/** 639/**
638 * This sets the display contrast 640 * This sets the display contrast
639 * @param p The contrast to be set on a scale from 0 to 255 641 * @param p The contrast to be set on a scale from 0 to 255
640 * @return success or failure 642 * @return success or failure
641 */ 643 */
642bool ODevice::setDisplayContrast ( int p) 644bool ODevice::setDisplayContrast ( int p)
643{ 645{
644 Q_UNUSED( p ) 646 Q_UNUSED( p )
645 return false; 647 return false;
646} 648}
647 649
648/** 650/**
649 * @return return the max value for the brightness settings slider 651 * @return return the max value for the brightness settings slider
650 * or 0 if the device doesn't support setting of a contrast 652 * or 0 if the device doesn't support setting of a contrast
651 */ 653 */
652int ODevice::displayContrastResolution ( ) const 654int ODevice::displayContrastResolution ( ) const
653{ 655{
654 return 0; 656 return 0;
655} 657}
656 658
657/** 659/**
658 * This returns the vendor as string 660 * This returns the vendor as string
659 * @return Vendor as QString 661 * @return Vendor as QString
660 */ 662 */
661QString ODevice::vendorString ( ) const 663QString ODevice::vendorString ( ) const
662{ 664{
663 return d-> m_vendorstr; 665 return d-> m_vendorstr;
664} 666}
665 667
666/** 668/**
667 * This returns the vendor as one of the values of OVendor 669 * This returns the vendor as one of the values of OVendor
668 * @return OVendor 670 * @return OVendor
669 */ 671 */
670OVendor ODevice::vendor ( ) const 672OVendor ODevice::vendor ( ) const
671{ 673{
672 return d-> m_vendor; 674 return d-> m_vendor;
673} 675}
674 676
675/** 677/**
676 * This returns the model as a string 678 * This returns the model as a string
677 * @return A string representing the model 679 * @return A string representing the model
678 */ 680 */
679QString ODevice::modelString ( ) const 681QString ODevice::modelString ( ) const
680{ 682{
681 return d-> m_modelstr; 683 return d-> m_modelstr;
682} 684}
683 685
684/** 686/**
685 * This does return the OModel used 687 * This does return the OModel used
686 */ 688 */
687OModel ODevice::model ( ) const 689OModel ODevice::model ( ) const
688{ 690{
689 return d-> m_model; 691 return d-> m_model;
690} 692}
691 693
692/** 694/**
693 * This does return the systen name 695 * This does return the systen name
694 */ 696 */
695QString ODevice::systemString ( ) const 697QString ODevice::systemString ( ) const
696{ 698{
697 return d-> m_systemstr; 699 return d-> m_systemstr;
698} 700}
699 701
700/** 702/**
701 * Return System as OSystem value 703 * Return System as OSystem value
702 */ 704 */
703OSystem ODevice::system ( ) const 705OSystem ODevice::system ( ) const
704{ 706{
705 return d-> m_system; 707 return d-> m_system;
706} 708}
707 709
708/** 710/**
709 * @return the version string of the base system 711 * @return the version string of the base system
710 */ 712 */
711QString ODevice::systemVersionString ( ) const 713QString ODevice::systemVersionString ( ) const
712{ 714{
713 return d-> m_sysverstr; 715 return d-> m_sysverstr;
714} 716}
715 717
716/** 718/**
717 * @return the current Transformation 719 * @return the current Transformation
718 */ 720 */
719Transformation ODevice::rotation ( ) const 721Transformation ODevice::rotation ( ) const
720{ 722{
721 return d-> m_rotation; 723 return d-> m_rotation;
722} 724}
723 725
724/** 726/**
725 * @return the current rotation direction 727 * @return the current rotation direction
726 */ 728 */
727ODirection ODevice::direction ( ) const 729ODirection ODevice::direction ( ) const
728{ 730{
729 return d-> m_direction; 731 return d-> m_direction;
730} 732}
731 733
732/** 734/**
733 * This plays an alarmSound 735 * This plays an alarmSound
734 */ 736 */
735void ODevice::alarmSound ( ) 737void ODevice::alarmSound ( )
736{ 738{
737#ifndef QT_NO_SOUND 739#ifndef QT_NO_SOUND
738 static Sound snd ( "alarm" ); 740 static Sound snd ( "alarm" );
739 741
740 if ( snd. isFinished ( )) 742 if ( snd. isFinished ( ))
741 snd. play ( ); 743 snd. play ( );
742#endif 744#endif
743} 745}
744 746
745/** 747/**
746 * This plays a key sound 748 * This plays a key sound
747 */ 749 */
748void ODevice::keySound ( ) 750void ODevice::keySound ( )
749{ 751{
750#ifndef QT_NO_SOUND 752#ifndef QT_NO_SOUND
751 static Sound snd ( "keysound" ); 753 static Sound snd ( "keysound" );
752 754
753 if ( snd. isFinished ( )) 755 if ( snd. isFinished ( ))
754 snd. play ( ); 756 snd. play ( );
755#endif 757#endif
756} 758}
757 759
758/** 760/**
759 * This plays a touch sound 761 * This plays a touch sound
760 */ 762 */
761void ODevice::touchSound ( ) 763void ODevice::touchSound ( )
762{ 764{
763#ifndef QT_NO_SOUND 765#ifndef QT_NO_SOUND
764 static Sound snd ( "touchsound" ); 766 static Sound snd ( "touchsound" );
765 767
766 if ( snd. isFinished ( )) 768 if ( snd. isFinished ( ))
767 snd. play ( ); 769 snd. play ( );
768#endif 770#endif
769} 771}
770 772
771/** 773/**
772 * This method will return a list of leds 774 * This method will return a list of leds
773 * available on this device 775 * available on this device
774 * @return a list of LEDs. 776 * @return a list of LEDs.
775 */ 777 */
776QValueList <OLed> ODevice::ledList ( ) const 778QValueList <OLed> ODevice::ledList ( ) const
777{ 779{
778 return QValueList <OLed> ( ); 780 return QValueList <OLed> ( );
779} 781}
780 782
781/** 783/**
782 * This does return the state of the LEDs 784 * This does return the state of the LEDs
783 */ 785 */
784QValueList <OLedState> ODevice::ledStateList ( OLed /*which*/ ) const 786QValueList <OLedState> ODevice::ledStateList ( OLed /*which*/ ) const
785{ 787{
786 return QValueList <OLedState> ( ); 788 return QValueList <OLedState> ( );
787} 789}
788 790
789/** 791/**
790 * @return the state for a given OLed 792 * @return the state for a given OLed
791 */ 793 */
792OLedState ODevice::ledState ( OLed /*which*/ ) const 794OLedState ODevice::ledState ( OLed /*which*/ ) const
793{ 795{
794 return Led_Off; 796 return Led_Off;
795} 797}
796 798
797/** 799/**
798 * Set the state for a LED 800 * Set the state for a LED
799 * @param which Which OLed to use 801 * @param which Which OLed to use
800 * @param st The state to set 802 * @param st The state to set
801 * @return success or failure 803 * @return success or failure
802 */ 804 */
803bool ODevice::setLedState ( OLed which, OLedState st ) 805bool ODevice::setLedState ( OLed which, OLedState st )
804{ 806{
805 Q_UNUSED( which ) 807 Q_UNUSED( which )
806 Q_UNUSED( st ) 808 Q_UNUSED( st )
807 return false; 809 return false;
808} 810}
809 811
810/** 812/**
811 * @return if the device has a light sensor 813 * @return if the device has a light sensor
812 */ 814 */
813bool ODevice::hasLightSensor ( ) const 815bool ODevice::hasLightSensor ( ) const
814{ 816{
815 return false; 817 return false;
816} 818}
817 819
818/** 820/**
819 * @return a value from the light senso 821 * @return a value from the light senso
820 */ 822 */
821int ODevice::readLightSensor ( ) 823int ODevice::readLightSensor ( )
822{ 824{
823 return -1; 825 return -1;
824} 826}
825 827
826/** 828/**
827 * @return the light sensor resolution whatever that is ;) 829 * @return the light sensor resolution whatever that is ;)
828 */ 830 */
829int ODevice::lightSensorResolution ( ) const 831int ODevice::lightSensorResolution ( ) const
830{ 832{
831 return 0; 833 return 0;
832} 834}
833 835
834/** 836/**
835 * @return a list with CPU frequencies supported by the hardware 837 * @return a list with CPU frequencies supported by the hardware
836 */ 838 */
837const QStrList &ODevice::allowedCpuFrequencies ( ) const 839const QStrList &ODevice::allowedCpuFrequencies ( ) const
838{ 840{
839 return *d->m_cpu_frequencies; 841 return *d->m_cpu_frequencies;
840} 842}
841 843
842 844
843/** 845/**
844 * Set desired CPU frequency 846 * Set desired CPU frequency
845 * 847 *
846 * @param index index into d->m_cpu_frequencies of the frequency to be set 848 * @param index index into d->m_cpu_frequencies of the frequency to be set
847 */ 849 */
848bool ODevice::setCurrentCpuFrequency(uint index) 850bool ODevice::setCurrentCpuFrequency(uint index)
849{ 851{
850 if (index >= d->m_cpu_frequencies->count()) 852 if (index >= d->m_cpu_frequencies->count())
851 return false; 853 return false;
852 854
853 char *freq = d->m_cpu_frequencies->at(index); 855 char *freq = d->m_cpu_frequencies->at(index);
854 qWarning("set freq to %s", freq); 856 qWarning("set freq to %s", freq);
855 857
856 int fd; 858 int fd;
857 859
858 if ((fd = ::open("/proc/sys/cpu/0/speed", O_WRONLY)) >= 0) { 860 if ((fd = ::open("/proc/sys/cpu/0/speed", O_WRONLY)) >= 0) {
859 char writeCommand[50]; 861 char writeCommand[50];
860 const int count = sprintf(writeCommand, "%s\n", freq); 862 const int count = sprintf(writeCommand, "%s\n", freq);
861 int res = (::write(fd, writeCommand, count) != -1); 863 int res = (::write(fd, writeCommand, count) != -1);
862 ::close(fd); 864 ::close(fd);
863 return res; 865 return res;
864 } 866 }
865 867
866 return false; 868 return false;
867} 869}
868 870
869 871
870/** 872/**
871 * @return a list of hardware buttons 873 * @return a list of hardware buttons
872 */ 874 */
873const QValueList <ODeviceButton> &ODevice::buttons ( ) 875const QValueList <ODeviceButton> &ODevice::buttons ( )
874{ 876{
875 initButtons ( ); 877 initButtons ( );
876 878
877 return *d-> m_buttons; 879 return *d-> m_buttons;
878} 880}
879 881
880/** 882/**
881 * @return The amount of time that would count as a hold 883 * @return The amount of time that would count as a hold
882 */ 884 */
883uint ODevice::buttonHoldTime ( ) const 885uint ODevice::buttonHoldTime ( ) const
884{ 886{
885 return d-> m_holdtime; 887 return d-> m_holdtime;
886} 888}
887 889
888/** 890/**
889 * This method return a ODeviceButton for a key code 891 * This method return a ODeviceButton for a key code
890 * or 0 if no special hardware button is available for the device 892 * or 0 if no special hardware button is available for the device
891 * 893 *
892 * @return The devicebutton or 0l 894 * @return The devicebutton or 0l
893 * @see ODeviceButton 895 * @see ODeviceButton
894 */ 896 */
895const ODeviceButton *ODevice::buttonForKeycode ( ushort code ) 897const ODeviceButton *ODevice::buttonForKeycode ( ushort code )
896{ 898{
897 initButtons ( ); 899 initButtons ( );
898 900
899 for ( QValueListConstIterator<ODeviceButton> it = d-> m_buttons-> begin ( ); it != d-> m_buttons-> end ( ); ++it ) { 901 for ( QValueListConstIterator<ODeviceButton> it = d-> m_buttons-> begin ( ); it != d-> m_buttons-> end ( ); ++it ) {
900 if ( (*it). keycode ( ) == code ) 902 if ( (*it). keycode ( ) == code )
901 return &(*it); 903 return &(*it);
902 } 904 }
903 return 0; 905 return 0;
904} 906}
905 907
906void ODevice::reloadButtonMapping ( ) 908void ODevice::reloadButtonMapping ( )
907{ 909{
908 initButtons ( ); 910 initButtons ( );
909 911
910 Config cfg ( "ButtonSettings" ); 912 Config cfg ( "ButtonSettings" );
911 913
912 for ( uint i = 0; i < d-> m_buttons-> count ( ); i++ ) { 914 for ( uint i = 0; i < d-> m_buttons-> count ( ); i++ ) {
913 ODeviceButton &b = ( *d-> m_buttons ) [i]; 915 ODeviceButton &b = ( *d-> m_buttons ) [i];
914 QString group = "Button" + QString::number ( i ); 916 QString group = "Button" + QString::number ( i );
915 917
916 QCString pch, hch; 918 QCString pch, hch;
917 QCString pm, hm; 919 QCString pm, hm;
918 QByteArray pdata, hdata; 920 QByteArray pdata, hdata;
919 921
920 if ( cfg. hasGroup ( group )) { 922 if ( cfg. hasGroup ( group )) {
921 cfg. setGroup ( group ); 923 cfg. setGroup ( group );
922 pch = cfg. readEntry ( "PressedActionChannel" ). latin1 ( ); 924 pch = cfg. readEntry ( "PressedActionChannel" ). latin1 ( );
923 pm = cfg. readEntry ( "PressedActionMessage" ). latin1 ( ); 925 pm = cfg. readEntry ( "PressedActionMessage" ). latin1 ( );
924 // pdata = decodeBase64 ( buttonFile. readEntry ( "PressedActionArgs" )); 926 // pdata = decodeBase64 ( buttonFile. readEntry ( "PressedActionArgs" ));
925 927
926 hch = cfg. readEntry ( "HeldActionChannel" ). latin1 ( ); 928 hch = cfg. readEntry ( "HeldActionChannel" ). latin1 ( );
927 hm = cfg. readEntry ( "HeldActionMessage" ). latin1 ( ); 929 hm = cfg. readEntry ( "HeldActionMessage" ). latin1 ( );
928 // hdata = decodeBase64 ( buttonFile. readEntry ( "HeldActionArgs" )); 930 // hdata = decodeBase64 ( buttonFile. readEntry ( "HeldActionArgs" ));
929 } 931 }
930 932
931 b. setPressedAction ( OQCopMessage ( pch, pm, pdata )); 933 b. setPressedAction ( OQCopMessage ( pch, pm, pdata ));
932 934
933 b. setHeldAction ( OQCopMessage ( hch, hm, hdata )); 935 b. setHeldAction ( OQCopMessage ( hch, hm, hdata ));
934 } 936 }
935} 937}
936 938
937void ODevice::remapPressedAction ( int button, const OQCopMessage &action ) 939void ODevice::remapPressedAction ( int button, const OQCopMessage &action )
938{ 940{
939 initButtons ( ); 941 initButtons ( );
940 942
941 QString mb_chan; 943 QString mb_chan;
942 944
943 if ( button >= (int) d-> m_buttons-> count ( )) 945 if ( button >= (int) d-> m_buttons-> count ( ))
944 return; 946 return;
945 947
946 ODeviceButton &b = ( *d-> m_buttons ) [button]; 948 ODeviceButton &b = ( *d-> m_buttons ) [button];
947 b. setPressedAction ( action ); 949 b. setPressedAction ( action );
948 950
949 mb_chan=b. pressedAction ( ). channel ( ); 951 mb_chan=b. pressedAction ( ). channel ( );
950 952
951 Config buttonFile ( "ButtonSettings" ); 953 Config buttonFile ( "ButtonSettings" );
952 buttonFile. setGroup ( "Button" + QString::number ( button )); 954 buttonFile. setGroup ( "Button" + QString::number ( button ));
953 buttonFile. writeEntry ( "PressedActionChannel", (const char*) mb_chan); 955 buttonFile. writeEntry ( "PressedActionChannel", (const char*) mb_chan);
954 buttonFile. writeEntry ( "PressedActionMessage", (const char*) b. pressedAction ( ). message ( )); 956 buttonFile. writeEntry ( "PressedActionMessage", (const char*) b. pressedAction ( ). message ( ));
955 957
956 //buttonFile. writeEntry ( "PressedActionArgs", encodeBase64 ( b. pressedAction ( ). data ( ))); 958 //buttonFile. writeEntry ( "PressedActionArgs", encodeBase64 ( b. pressedAction ( ). data ( )));
957 959
958 QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); 960 QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" );
959} 961}
960 962
961void ODevice::remapHeldAction ( int button, const OQCopMessage &action ) 963void ODevice::remapHeldAction ( int button, const OQCopMessage &action )
962{ 964{
963 initButtons ( ); 965 initButtons ( );
964 966
965 if ( button >= (int) d-> m_buttons-> count ( )) 967 if ( button >= (int) d-> m_buttons-> count ( ))
966 return; 968 return;
967 969
968 ODeviceButton &b = ( *d-> m_buttons ) [button]; 970 ODeviceButton &b = ( *d-> m_buttons ) [button];
969 b. setHeldAction ( action ); 971 b. setHeldAction ( action );
970 972
971 Config buttonFile ( "ButtonSettings" ); 973 Config buttonFile ( "ButtonSettings" );
972 buttonFile. setGroup ( "Button" + QString::number ( button )); 974 buttonFile. setGroup ( "Button" + QString::number ( button ));
973 buttonFile. writeEntry ( "HeldActionChannel", (const char *) b. heldAction ( ). channel ( )); 975 buttonFile. writeEntry ( "HeldActionChannel", (const char *) b. heldAction ( ). channel ( ));
974 buttonFile. writeEntry ( "HeldActionMessage", (const char *) b. heldAction ( ). message ( )); 976 buttonFile. writeEntry ( "HeldActionMessage", (const char *) b. heldAction ( ). message ( ));
975 977
976 //buttonFile. writeEntry ( "HeldActionArgs", decodeBase64 ( b. heldAction ( ). data ( ))); 978 //buttonFile. writeEntry ( "HeldActionArgs", decodeBase64 ( b. heldAction ( ). data ( )));
977 979
978 QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" ); 980 QCopEnvelope ( "QPE/System", "deviceButtonMappingChanged()" );
979} 981}
980void ODevice::virtual_hook(int, void* ){ 982void ODevice::virtual_hook(int, void* ){
981 983
982} 984}
983 985
984/************************************************** 986/**************************************************
985 * 987 *
986 * Yopy 3500/3700 988 * Yopy 3500/3700
987 * 989 *
988 **************************************************/ 990 **************************************************/
989 991
990bool Yopy::isYopy ( ) 992bool Yopy::isYopy ( )
991{ 993{
992 QFile f( "/proc/cpuinfo" ); 994 QFile f( "/proc/cpuinfo" );
993 if ( f. open ( IO_ReadOnly ) ) { 995 if ( f. open ( IO_ReadOnly ) ) {
994 QTextStream ts ( &f ); 996 QTextStream ts ( &f );
995 QString line; 997 QString line;
996 while( line = ts. readLine ( ) ) { 998 while( line = ts. readLine ( ) ) {
997 if ( line. left ( 8 ) == "Hardware" ) { 999 if ( line. left ( 8 ) == "Hardware" ) {
998 int loc = line. find ( ":" ); 1000 int loc = line. find ( ":" );
999 if ( loc != -1 ) { 1001 if ( loc != -1 ) {
1000 QString model = 1002 QString model =
1001 line. mid ( loc + 2 ). simplifyWhiteSpace( ); 1003 line. mid ( loc + 2 ). simplifyWhiteSpace( );
1002 return ( model == "Yopy" ); 1004 return ( model == "Yopy" );
1003 } 1005 }
1004 } 1006 }
1005 } 1007 }
1006 } 1008 }
1007 return false; 1009 return false;
1008} 1010}
1009 1011
1010void Yopy::init ( ) 1012void Yopy::init ( )
1011{ 1013{
1012 d-> m_vendorstr = "G.Mate"; 1014 d-> m_vendorstr = "G.Mate";
1013 d-> m_vendor = Vendor_GMate; 1015 d-> m_vendor = Vendor_GMate;
1014 d-> m_modelstr = "Yopy3700"; 1016 d-> m_modelstr = "Yopy3700";
1015 d-> m_model = Model_Yopy_3700; 1017 d-> m_model = Model_Yopy_3700;
1016 d-> m_rotation = Rot0; 1018 d-> m_rotation = Rot0;
1017 1019
1018 d-> m_systemstr = "Linupy"; 1020 d-> m_systemstr = "Linupy";
1019 d-> m_system = System_Linupy; 1021 d-> m_system = System_Linupy;
1020 1022
1021 QFile f ( "/etc/issue" ); 1023 QFile f ( "/etc/issue" );
1022 if ( f. open ( IO_ReadOnly )) { 1024 if ( f. open ( IO_ReadOnly )) {
1023 QTextStream ts ( &f ); 1025 QTextStream ts ( &f );
1024 ts.readLine(); 1026 ts.readLine();
1025 d-> m_sysverstr = ts. readLine ( ); 1027 d-> m_sysverstr = ts. readLine ( );
1026 f. close ( ); 1028 f. close ( );
1027 } 1029 }
1028} 1030}
1029 1031
1030void Yopy::initButtons ( ) 1032void Yopy::initButtons ( )
1031{ 1033{
1032 if ( d-> m_buttons ) 1034 if ( d-> m_buttons )
1033 return; 1035 return;
1034 1036
1035 d-> m_buttons = new QValueList <ODeviceButton>; 1037 d-> m_buttons = new QValueList <ODeviceButton>;
1036 1038
1037 for (uint i = 0; i < ( sizeof( yopy_buttons ) / sizeof(yopy_button)); i++) { 1039 for (uint i = 0; i < ( sizeof( yopy_buttons ) / sizeof(yopy_button)); i++) {
1038 1040
1039 yopy_button *ib = yopy_buttons + i; 1041 yopy_button *ib = yopy_buttons + i;
1040 1042
1041 ODeviceButton b; 1043 ODeviceButton b;
1042 1044
1043 b. setKeycode ( ib-> code ); 1045 b. setKeycode ( ib-> code );
1044 b. setUserText ( QObject::tr ( "Button", ib-> utext )); 1046 b. setUserText ( QObject::tr ( "Button", ib-> utext ));
1045 b. setPixmap ( Resource::loadPixmap ( ib-> pix )); 1047 b. setPixmap ( Resource::loadPixmap ( ib-> pix ));
1046 b. setFactoryPresetPressedAction 1048 b. setFactoryPresetPressedAction
1047 (OQCopMessage(makeChannel(ib->fpressedservice), ib->fpressedaction)); 1049 (OQCopMessage(makeChannel(ib->fpressedservice), ib->fpressedaction));
1048 b. setFactoryPresetHeldAction 1050 b. setFactoryPresetHeldAction
1049 (OQCopMessage(makeChannel(ib->fheldservice), ib->fheldaction)); 1051 (OQCopMessage(makeChannel(ib->fheldservice), ib->fheldaction));
1050 1052
1051 d-> m_buttons-> append ( b ); 1053 d-> m_buttons-> append ( b );
1052 } 1054 }
1053 reloadButtonMapping ( ); 1055 reloadButtonMapping ( );
1054 1056
1055 QCopChannel *sysch = new QCopChannel("QPE/System", this); 1057 QCopChannel *sysch = new QCopChannel("QPE/System", this);
1056 connect(sysch, SIGNAL(received(const QCString &, const QByteArray & )), 1058 connect(sysch, SIGNAL(received(const QCString &, const QByteArray & )),
1057 this, SLOT(systemMessage(const QCString &, const QByteArray & ))); 1059 this, SLOT(systemMessage(const QCString &, const QByteArray & )));
1058} 1060}
1059 1061
1060bool Yopy::suspend() 1062bool Yopy::suspend()
1061{ 1063{
1062 /* Opie for Yopy does not implement its own power management at the 1064 /* Opie for Yopy does not implement its own power management at the
1063 moment. The public version runs parallel to X, and relies on the 1065 moment. The public version runs parallel to X, and relies on the
1064 existing power management features. */ 1066 existing power management features. */
1065 return false; 1067 return false;
1066} 1068}
1067 1069
1068bool Yopy::setDisplayBrightness(int bright) 1070bool Yopy::setDisplayBrightness(int bright)
1069{ 1071{
1070 /* The code here works, but is disabled as the current version runs 1072 /* The code here works, but is disabled as the current version runs
1071 parallel to X, and relies on the existing backlight demon. */ 1073 parallel to X, and relies on the existing backlight demon. */
1072#if 0 1074#if 0
1073 if ( QFile::exists("/proc/sys/pm/light") ) { 1075 if ( QFile::exists("/proc/sys/pm/light") ) {
1074 int fd = ::open("/proc/sys/pm/light", O_WRONLY); 1076 int fd = ::open("/proc/sys/pm/light", O_WRONLY);
1075 if (fd >= 0 ) { 1077 if (fd >= 0 ) {
1076 if (bright) 1078 if (bright)
1077 ::write(fd, "1\n", 2); 1079 ::write(fd, "1\n", 2);
1078 else 1080 else
1079 ::write(fd, "0\n", 2); 1081 ::write(fd, "0\n", 2);
1080 ::close(fd); 1082 ::close(fd);
1081 return true; 1083 return true;
1082 } 1084 }
1083 } 1085 }
1084#endif 1086#endif
1085 return false; 1087 return false;
1086} 1088}
1087 1089
1088int Yopy::displayBrightnessResolution() const 1090int Yopy::displayBrightnessResolution() const
1089{ 1091{
1090 return 2; 1092 return 2;
1091} 1093}
1092 1094
1093/************************************************** 1095/**************************************************
1094 * 1096 *
1095 * iPAQ 1097 * iPAQ
1096 * 1098 *
1097 **************************************************/ 1099 **************************************************/
1098 1100
1099void iPAQ::init ( ) 1101void iPAQ::init ( )
1100{ 1102{
1101 d-> m_vendorstr = "HP"; 1103 d-> m_vendorstr = "HP";
1102 d-> m_vendor = Vendor_HP; 1104 d-> m_vendor = Vendor_HP;
1103 1105
1104 QFile f ( "/proc/hal/model" ); 1106 QFile f ( "/proc/hal/model" );
1105 1107
1106 if ( f. open ( IO_ReadOnly )) { 1108 if ( f. open ( IO_ReadOnly )) {
1107 QTextStream ts ( &f ); 1109 QTextStream ts ( &f );
1108 1110
1109 d-> m_modelstr = "H" + ts. readLine ( ); 1111 d-> m_modelstr = "H" + ts. readLine ( );
1110 1112
1111 if ( d-> m_modelstr == "H3100" ) 1113 if ( d-> m_modelstr == "H3100" )
1112 d-> m_model = Model_iPAQ_H31xx; 1114 d-> m_model = Model_iPAQ_H31xx;
1113 else if ( d-> m_modelstr == "H3600" ) 1115 else if ( d-> m_modelstr == "H3600" )
1114 d-> m_model = Model_iPAQ_H36xx; 1116 d-> m_model = Model_iPAQ_H36xx;
1115 else if ( d-> m_modelstr == "H3700" ) 1117 else if ( d-> m_modelstr == "H3700" )
1116 d-> m_model = Model_iPAQ_H37xx; 1118 d-> m_model = Model_iPAQ_H37xx;
1117 else if ( d-> m_modelstr == "H3800" ) 1119 else if ( d-> m_modelstr == "H3800" )
1118 d-> m_model = Model_iPAQ_H38xx; 1120 d-> m_model = Model_iPAQ_H38xx;
1119 else if ( d-> m_modelstr == "H3900" ) 1121 else if ( d-> m_modelstr == "H3900" )
1120 d-> m_model = Model_iPAQ_H39xx; 1122 d-> m_model = Model_iPAQ_H39xx;
1121 else if ( d-> m_modelstr == "H5400" ) 1123 else if ( d-> m_modelstr == "H5400" )
1122 d-> m_model = Model_iPAQ_H5xxx; 1124 d-> m_model = Model_iPAQ_H5xxx;
1123 else 1125 else
1124 d-> m_model = Model_Unknown; 1126 d-> m_model = Model_Unknown;
1125 1127
1126 f. close ( ); 1128 f. close ( );
1127 } 1129 }
1128 1130
1129 switch ( d-> m_model ) { 1131 switch ( d-> m_model ) {
1130 case Model_iPAQ_H31xx: 1132 case Model_iPAQ_H31xx:
1131 case Model_iPAQ_H38xx: 1133 case Model_iPAQ_H38xx:
1132 d-> m_rotation = Rot90; 1134 d-> m_rotation = Rot90;
1133 break; 1135 break;
1134 case Model_iPAQ_H36xx: 1136 case Model_iPAQ_H36xx:
1135 case Model_iPAQ_H37xx: 1137 case Model_iPAQ_H37xx:
1136 case Model_iPAQ_H39xx: 1138 case Model_iPAQ_H39xx:
1137 default: 1139 default:
1138 d-> m_rotation = Rot270; 1140 d-> m_rotation = Rot270;
1139 break; 1141 break;
1140 case Model_iPAQ_H5xxx: 1142 case Model_iPAQ_H5xxx:
1141 d-> m_rotation = Rot0; 1143 d-> m_rotation = Rot0;
1142 } 1144 }
1143 1145
1144 f. setName ( "/etc/familiar-version" ); 1146 f. setName ( "/etc/familiar-version" );
1145 if ( f. open ( IO_ReadOnly )) { 1147 if ( f. open ( IO_ReadOnly )) {
1146 d-> m_systemstr = "Familiar"; 1148 d-> m_systemstr = "Familiar";
1147 d-> m_system = System_Familiar; 1149 d-> m_system = System_Familiar;
1148 1150
1149 QTextStream ts ( &f ); 1151 QTextStream ts ( &f );
1150 d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); 1152 d-> m_sysverstr = ts. readLine ( ). mid ( 10 );
1151 1153
1152 f. close ( ); 1154 f. close ( );
1153 } else { 1155 } else {
1154 f. setName ( "/etc/oz_version" ); 1156 f. setName ( "/etc/oz_version" );
1155 1157
1156 if ( f. open ( IO_ReadOnly )) { 1158 if ( f. open ( IO_ReadOnly )) {
1157 d-> m_systemstr = "OpenEmbedded/iPaq"; 1159 d-> m_systemstr = "OpenEmbedded/iPaq";
1158 d-> m_system = System_Familiar; 1160 d-> m_system = System_Familiar;
1159 1161
1160 QTextStream ts ( &f ); 1162 QTextStream ts ( &f );
1161 ts.setDevice ( &f ); 1163 ts.setDevice ( &f );
1162 d-> m_sysverstr = ts. readLine ( ); 1164 d-> m_sysverstr = ts. readLine ( );
1163 f. close ( ); 1165 f. close ( );
1164 } 1166 }
1165 } 1167 }
1166 1168
1167 1169
1168 1170
1169 1171
1170 1172
1171 m_leds [0] = m_leds [1] = Led_Off; 1173 m_leds [0] = m_leds [1] = Led_Off;
1172 1174
1173 m_power_timer = 0; 1175 m_power_timer = 0;
1174 1176
1175} 1177}
1176 1178
1177void iPAQ::initButtons ( ) 1179void iPAQ::initButtons ( )
1178{ 1180{
1179 if ( d-> m_buttons ) 1181 if ( d-> m_buttons )
1180 return; 1182 return;
1181 1183
1182 if ( isQWS( ) ) 1184 if ( isQWS( ) )
1183 QWSServer::setKeyboardFilter ( this ); 1185 QWSServer::setKeyboardFilter ( this );
1184 1186
1185 d-> m_buttons = new QValueList <ODeviceButton>; 1187 d-> m_buttons = new QValueList <ODeviceButton>;
1186 1188
1187 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { 1189 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) {
1188 i_button *ib = ipaq_buttons + i; 1190 i_button *ib = ipaq_buttons + i;
1189 ODeviceButton b; 1191 ODeviceButton b;
1190 1192
1191 if (( ib-> model & d-> m_model ) == d-> m_model ) { 1193 if (( ib-> model & d-> m_model ) == d-> m_model ) {
1192 b. setKeycode ( ib-> code ); 1194 b. setKeycode ( ib-> code );
1193 b. setUserText ( QObject::tr ( "Button", ib-> utext )); 1195 b. setUserText ( QObject::tr ( "Button", ib-> utext ));
1194 b. setPixmap ( Resource::loadPixmap ( ib-> pix )); 1196 b. setPixmap ( Resource::loadPixmap ( ib-> pix ));
1195 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); 1197 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction ));
1196 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); 1198 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction ));
1197 1199
1198 d-> m_buttons-> append ( b ); 1200 d-> m_buttons-> append ( b );
1199 } 1201 }
1200 } 1202 }
1201 reloadButtonMapping ( ); 1203 reloadButtonMapping ( );
1202 1204
1203 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 1205 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
1204 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); 1206 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & )));
1205} 1207}
1206 1208
1207 1209
1208//#include <linux/h3600_ts.h> // including kernel headers is evil ... 1210//#include <linux/h3600_ts.h> // including kernel headers is evil ...
1209 1211
1210typedef struct { 1212typedef struct {
1211 unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */ 1213 unsigned char OffOnBlink; /* 0=off 1=on 2=Blink */
1212 unsigned char TotalTime; /* Units of 5 seconds */ 1214 unsigned char TotalTime; /* Units of 5 seconds */
1213 unsigned char OnTime; /* units of 100m/s */ 1215 unsigned char OnTime; /* units of 100m/s */
1214 unsigned char OffTime; /* units of 100m/s */ 1216 unsigned char OffTime; /* units of 100m/s */
1215} LED_IN; 1217} LED_IN;
1216 1218
1217typedef struct { 1219typedef struct {
1218 unsigned char mode; 1220 unsigned char mode;
1219 unsigned char pwr; 1221 unsigned char pwr;
1220 unsigned char brightness; 1222 unsigned char brightness;
1221} FLITE_IN; 1223} FLITE_IN;
1222 1224
1223#define LED_ON OD_IOW( 'f', 5, LED_IN ) 1225#define LED_ON OD_IOW( 'f', 5, LED_IN )
1224#define FLITE_ON OD_IOW( 'f', 7, FLITE_IN ) 1226#define FLITE_ON OD_IOW( 'f', 7, FLITE_IN )
1225 1227
1226 1228
1227QValueList <OLed> iPAQ::ledList ( ) const 1229QValueList <OLed> iPAQ::ledList ( ) const
1228{ 1230{
1229 QValueList <OLed> vl; 1231 QValueList <OLed> vl;
1230 vl << Led_Power; 1232 vl << Led_Power;
1231 1233
1232 if ( d-> m_model == Model_iPAQ_H38xx ) 1234 if ( d-> m_model == Model_iPAQ_H38xx )
1233 vl << Led_BlueTooth; 1235 vl << Led_BlueTooth;
1234 return vl; 1236 return vl;
1235} 1237}
1236 1238
1237QValueList <OLedState> iPAQ::ledStateList ( OLed l ) const 1239QValueList <OLedState> iPAQ::ledStateList ( OLed l ) const
1238{ 1240{
1239 QValueList <OLedState> vl; 1241 QValueList <OLedState> vl;
1240 1242
1241 if ( l == Led_Power ) 1243 if ( l == Led_Power )
1242 vl << Led_Off << Led_On << Led_BlinkSlow << Led_BlinkFast; 1244 vl << Led_Off << Led_On << Led_BlinkSlow << Led_BlinkFast;
1243 else if ( l == Led_BlueTooth && d-> m_model == Model_iPAQ_H38xx ) 1245 else if ( l == Led_BlueTooth && d-> m_model == Model_iPAQ_H38xx )
1244 vl << Led_Off; // << Led_On << ??? 1246 vl << Led_Off; // << Led_On << ???
1245 1247
1246 return vl; 1248 return vl;
1247} 1249}
1248 1250
1249OLedState iPAQ::ledState ( OLed l ) const 1251OLedState iPAQ::ledState ( OLed l ) const
1250{ 1252{
1251 switch ( l ) { 1253 switch ( l ) {
1252 case Led_Power: 1254 case Led_Power:
1253 return m_leds [0]; 1255 return m_leds [0];
1254 case Led_BlueTooth: 1256 case Led_BlueTooth:
1255 return m_leds [1]; 1257 return m_leds [1];
1256 default: 1258 default:
1257 return Led_Off; 1259 return Led_Off;
1258 } 1260 }
1259} 1261}
1260 1262
1261bool iPAQ::setLedState ( OLed l, OLedState st ) 1263bool iPAQ::setLedState ( OLed l, OLedState st )
1262{ 1264{
1263 static int fd = ::open ( "/dev/touchscreen/0", O_RDWR | O_NONBLOCK ); 1265 static int fd = ::open ( "/dev/touchscreen/0", O_RDWR | O_NONBLOCK );
1264 1266
1265 if ( l == Led_Power ) { 1267 if ( l == Led_Power ) {
1266 if ( fd >= 0 ) { 1268 if ( fd >= 0 ) {
1267 LED_IN leds; 1269 LED_IN leds;
1268 ::memset ( &leds, 0, sizeof( leds )); 1270 ::memset ( &leds, 0, sizeof( leds ));
1269 leds. TotalTime = 0; 1271 leds. TotalTime = 0;
1270 leds. OnTime = 0; 1272 leds. OnTime = 0;
1271 leds. OffTime = 1; 1273 leds. OffTime = 1;
1272 leds. OffOnBlink = 2; 1274 leds. OffOnBlink = 2;
1273 1275
1274 switch ( st ) { 1276 switch ( st ) {
1275 case Led_Off : leds. OffOnBlink = 0; break; 1277 case Led_Off : leds. OffOnBlink = 0; break;
1276 case Led_On : leds. OffOnBlink = 1; break; 1278 case Led_On : leds. OffOnBlink = 1; break;
1277 case Led_BlinkSlow: leds. OnTime = 10; leds. OffTime = 10; break; 1279 case Led_BlinkSlow: leds. OnTime = 10; leds. OffTime = 10; break;
1278 case Led_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break; 1280 case Led_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break;
1279 } 1281 }
1280 1282
1281 if ( ::ioctl ( fd, LED_ON, &leds ) >= 0 ) { 1283 if ( ::ioctl ( fd, LED_ON, &leds ) >= 0 ) {
1282 m_leds [0] = st; 1284 m_leds [0] = st;
1283 return true; 1285 return true;
1284 } 1286 }
1285 } 1287 }
1286 } 1288 }
1287 return false; 1289 return false;
1288} 1290}
1289 1291
1290 1292
1291bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) 1293bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat )
1292{ 1294{
1293 int newkeycode = keycode; 1295 int newkeycode = keycode;
1294 1296
1295 switch ( keycode ) { 1297 switch ( keycode ) {
1296 // H38xx/H39xx have no "Q" key anymore - this is now the Mail key 1298 // H38xx/H39xx have no "Q" key anymore - this is now the Mail key
1297 case HardKey_Menu: { 1299 case HardKey_Menu: {
1298 if (( d-> m_model == Model_iPAQ_H38xx ) || 1300 if (( d-> m_model == Model_iPAQ_H38xx ) ||
1299 ( d-> m_model == Model_iPAQ_H39xx ) || 1301 ( d-> m_model == Model_iPAQ_H39xx ) ||
1300 ( d-> m_model == Model_iPAQ_H5xxx)) { 1302 ( d-> m_model == Model_iPAQ_H5xxx)) {
1301 newkeycode = HardKey_Mail; 1303 newkeycode = HardKey_Mail;
1302 } 1304 }
1303 break; 1305 break;
1304 } 1306 }
1305 1307
1306 // Rotate cursor keys 180° 1308 // Rotate cursor keys 180°
1307 case Key_Left : 1309 case Key_Left :
1308 case Key_Right: 1310 case Key_Right:
1309 case Key_Up : 1311 case Key_Up :
1310 case Key_Down : { 1312 case Key_Down : {
1311 if (( d-> m_model == Model_iPAQ_H31xx ) || 1313 if (( d-> m_model == Model_iPAQ_H31xx ) ||
1312 ( d-> m_model == Model_iPAQ_H38xx )) { 1314 ( d-> m_model == Model_iPAQ_H38xx )) {
1313 newkeycode = Key_Left + ( keycode - Key_Left + 2 ) % 4; 1315 newkeycode = Key_Left + ( keycode - Key_Left + 2 ) % 4;
1314 } 1316 }
1315 break; 1317 break;
1316 } 1318 }
1317 1319
1318 // map Power Button short/long press to F34/F35 1320 // map Power Button short/long press to F34/F35
1319 case Key_SysReq: { 1321 case Key_SysReq: {
1320 if ( isPress ) { 1322 if ( isPress ) {
1321 if ( m_power_timer ) 1323 if ( m_power_timer )
1322 killTimer ( m_power_timer ); 1324 killTimer ( m_power_timer );
1323 m_power_timer = startTimer ( 500 ); 1325 m_power_timer = startTimer ( 500 );
1324 } 1326 }
1325 else if ( m_power_timer ) { 1327 else if ( m_power_timer ) {
1326 killTimer ( m_power_timer ); 1328 killTimer ( m_power_timer );
1327 m_power_timer = 0; 1329 m_power_timer = 0;
1328 QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false ); 1330 QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, true, false );
1329 QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false ); 1331 QWSServer::sendKeyEvent ( -1, HardKey_Suspend, 0, false, false );
1330 } 1332 }
1331 newkeycode = Key_unknown; 1333 newkeycode = Key_unknown;
1332 break; 1334 break;
1333 } 1335 }
1334 } 1336 }
1335 1337
1336 if ( newkeycode != keycode ) { 1338 if ( newkeycode != keycode ) {
1337 if ( newkeycode != Key_unknown ) 1339 if ( newkeycode != Key_unknown )
1338 QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat ); 1340 QWSServer::sendKeyEvent ( -1, newkeycode, modifiers, isPress, autoRepeat );
1339 return true; 1341 return true;
1340 } 1342 }
1341 else 1343 else
1342 return false; 1344 return false;
1343} 1345}
1344 1346
1345void iPAQ::timerEvent ( QTimerEvent * ) 1347void iPAQ::timerEvent ( QTimerEvent * )
1346{ 1348{
1347 killTimer ( m_power_timer ); 1349 killTimer ( m_power_timer );
1348 m_power_timer = 0; 1350 m_power_timer = 0;
1349 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); 1351 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false );
1350 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); 1352 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false );
1351} 1353}
1352 1354
1353 1355
1354void iPAQ::alarmSound ( ) 1356void iPAQ::alarmSound ( )
1355{ 1357{
1356#ifndef QT_NO_SOUND 1358#ifndef QT_NO_SOUND
1357 static Sound snd ( "alarm" ); 1359 static Sound snd ( "alarm" );
1358 int fd; 1360 int fd;
1359 int vol; 1361 int vol;
1360 bool vol_reset = false; 1362 bool vol_reset = false;
1361 1363
1362 if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { 1364 if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) {
1363 if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { 1365 if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) {
1364 Config cfg ( "qpe" ); 1366 Config cfg ( "qpe" );
1365 cfg. setGroup ( "Volume" ); 1367 cfg. setGroup ( "Volume" );
1366 1368
1367 int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); 1369 int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 );
1368 if ( volalarm < 0 ) 1370 if ( volalarm < 0 )
1369 volalarm = 0; 1371 volalarm = 0;
1370 else if ( volalarm > 100 ) 1372 else if ( volalarm > 100 )
1371 volalarm = 100; 1373 volalarm = 100;
1372 volalarm |= ( volalarm << 8 ); 1374 volalarm |= ( volalarm << 8 );
1373 1375
1374 if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) 1376 if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 )
1375 vol_reset = true; 1377 vol_reset = true;
1376 } 1378 }
1377 } 1379 }
1378 1380
1379 snd. play ( ); 1381 snd. play ( );
1380 while ( !snd. isFinished ( )) 1382 while ( !snd. isFinished ( ))
1381 qApp-> processEvents ( ); 1383 qApp-> processEvents ( );
1382 1384
1383 if ( fd >= 0 ) { 1385 if ( fd >= 0 ) {
1384 if ( vol_reset ) 1386 if ( vol_reset )
1385 ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); 1387 ::ioctl ( fd, MIXER_WRITE( 0 ), &vol );
1386 ::close ( fd ); 1388 ::close ( fd );
1387 } 1389 }
1388#endif 1390#endif
1389} 1391}
1390 1392
1391 1393
1392bool iPAQ::setSoftSuspend ( bool soft ) 1394bool iPAQ::setSoftSuspend ( bool soft )
1393{ 1395{
1394 bool res = false; 1396 bool res = false;
1395 int fd; 1397 int fd;
1396 1398
1397 if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { 1399 if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) {
1398 if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 ) 1400 if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 )
1399 res = true; 1401 res = true;
1400 else 1402 else
1401 ::perror ( "write to /proc/sys/ts/suspend_button_mode" ); 1403 ::perror ( "write to /proc/sys/ts/suspend_button_mode" );
1402 1404
1403 ::close ( fd ); 1405 ::close ( fd );
1404 } 1406 }
1405 else 1407 else
1406 ::perror ( "/proc/sys/ts/suspend_button_mode" ); 1408 ::perror ( "/proc/sys/ts/suspend_button_mode" );
1407 1409
1408 return res; 1410 return res;
1409} 1411}
1410 1412
1411 1413
1412bool iPAQ::setDisplayBrightness ( int bright ) 1414bool iPAQ::setDisplayBrightness ( int bright )
1413{ 1415{
1414 bool res = false; 1416 bool res = false;
1415 int fd; 1417 int fd;
1416 1418
1417 if ( bright > 255 ) 1419 if ( bright > 255 )
1418 bright = 255; 1420 bright = 255;
1419 if ( bright < 0 ) 1421 if ( bright < 0 )
1420 bright = 0; 1422 bright = 0;
1421 1423
1422 if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { 1424 if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) {
1423 FLITE_IN bl; 1425 FLITE_IN bl;
1424 bl. mode = 1; 1426 bl. mode = 1;
1425 bl. pwr = bright ? 1 : 0; 1427 bl. pwr = bright ? 1 : 0;
1426 bl. brightness = ( bright * ( displayBrightnessResolution ( ) - 1 ) + 127 ) / 255; 1428 bl. brightness = ( bright * ( displayBrightnessResolution ( ) - 1 ) + 127 ) / 255;
1427 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); 1429 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 );
1428 ::close ( fd ); 1430 ::close ( fd );
1429 } 1431 }
1430 return res; 1432 return res;
1431} 1433}
1432 1434
1433int iPAQ::displayBrightnessResolution ( ) const 1435int iPAQ::displayBrightnessResolution ( ) const
1434{ 1436{
1435 switch ( model ( )) { 1437 switch ( model ( )) {
1436 case Model_iPAQ_H31xx: 1438 case Model_iPAQ_H31xx:
1437 case Model_iPAQ_H36xx: 1439 case Model_iPAQ_H36xx:
1438 case Model_iPAQ_H37xx: 1440 case Model_iPAQ_H37xx:
1439 return 128; // really 256, but >128 could damage the LCD 1441 return 128; // really 256, but >128 could damage the LCD
1440 1442
1441 case Model_iPAQ_H38xx: 1443 case Model_iPAQ_H38xx:
1442 case Model_iPAQ_H39xx: 1444 case Model_iPAQ_H39xx:
1443 return 64; 1445 return 64;
1444 case Model_iPAQ_H5xxx: 1446 case Model_iPAQ_H5xxx:
1445 return 255; 1447 return 255;
1446 1448
1447 default: 1449 default:
1448 return 2; 1450 return 2;
1449 } 1451 }
1450} 1452}
1451 1453
1452 1454
1453bool iPAQ::hasLightSensor ( ) const 1455bool iPAQ::hasLightSensor ( ) const
1454{ 1456{
1455 return true; 1457 return true;
1456} 1458}
1457 1459
1458int iPAQ::readLightSensor ( ) 1460int iPAQ::readLightSensor ( )
1459{ 1461{
1460 int fd; 1462 int fd;
1461 int val = -1; 1463 int val = -1;
1462 1464
1463 if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) { 1465 if (( fd = ::open ( "/proc/hal/light_sensor", O_RDONLY )) >= 0 ) {
1464 char buffer [8]; 1466 char buffer [8];
1465 1467
1466 if ( ::read ( fd, buffer, 5 ) == 5 ) { 1468 if ( ::read ( fd, buffer, 5 ) == 5 ) {
1467 char *endptr; 1469 char *endptr;
1468 1470
1469 buffer [4] = 0; 1471 buffer [4] = 0;
1470 val = ::strtol ( buffer + 2, &endptr, 16 ); 1472 val = ::strtol ( buffer + 2, &endptr, 16 );
1471 1473
1472 if ( *endptr != 0 ) 1474 if ( *endptr != 0 )
1473 val = -1; 1475 val = -1;
1474 } 1476 }
1475 ::close ( fd ); 1477 ::close ( fd );
1476 } 1478 }
1477 1479
1478 return val; 1480 return val;
1479} 1481}
1480 1482
1481int iPAQ::lightSensorResolution ( ) const 1483int iPAQ::lightSensorResolution ( ) const
1482{ 1484{
1483 return 256; 1485 return 256;
1484} 1486}
1485 1487
1486/************************************************** 1488/**************************************************
1487 * 1489 *
1488 * Zaurus 1490 * Zaurus
1489 * 1491 *
1490 **************************************************/ 1492 **************************************************/
1491 1493
1492// Check whether this device is the sharp zaurus.. 1494// Check whether this device is the sharp zaurus..
1493bool Zaurus::isZaurus() 1495bool Zaurus::isZaurus()
1494{ 1496{
1495 1497
1496 // If the special devices by embedix exist, it is quite simple: it is a Zaurus ! 1498 // If the special devices by embedix exist, it is quite simple: it is a Zaurus !
1497 if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" ) ){ 1499 if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" ) ){
1498 return true; 1500 return true;
1499 } 1501 }
1500 1502
1501 // On non-embedix kenrnels, we have too look closer. 1503 // On non-embedix kenrnels, we have too look closer.
1502 bool is_zaurus = false; 1504 bool is_zaurus = false;
1503 QFile f ( "/proc/cpuinfo" ); 1505 QFile f ( "/proc/cpuinfo" );
1504 if ( f. open ( IO_ReadOnly ) ) { 1506 if ( f. open ( IO_ReadOnly ) ) {
1505 QString model; 1507 QString model;
1506 QFile f ( "/proc/cpuinfo" ); 1508 QFile f ( "/proc/cpuinfo" );
1507 1509
1508 QTextStream ts ( &f ); 1510 QTextStream ts ( &f );
1509 QString line; 1511 QString line;
1510 while( line = ts. readLine ( ) ) { 1512 while( line = ts. readLine ( ) ) {
1511 if ( line. left ( 8 ) == "Hardware" ) 1513 if ( line. left ( 8 ) == "Hardware" )
1512 break; 1514 break;
1513 } 1515 }
1514 int loc = line. find ( ":" ); 1516 int loc = line. find ( ":" );
1515 if ( loc != -1 ) 1517 if ( loc != -1 )
1516 model = line. mid ( loc + 2 ). simplifyWhiteSpace( ); 1518 model = line. mid ( loc + 2 ). simplifyWhiteSpace( );
1517 1519
1518 if ( model == "Sharp-Collie" 1520 if ( model == "Sharp-Collie"
1519 || model == "Collie" 1521 || model == "Collie"
1520 || model == "SHARP Corgi" 1522 || model == "SHARP Corgi"
1521 || model == "SHARP Shepherd" 1523 || model == "SHARP Shepherd"
1522 || model == "SHARP Poodle" 1524 || model == "SHARP Poodle"
1523 ) 1525 )
1524 is_zaurus = true; 1526 is_zaurus = true;
1525 1527
1526 } 1528 }
1527 return is_zaurus; 1529 return is_zaurus;
1528} 1530}
1529 1531
1530 1532
1531void Zaurus::init ( ) 1533void Zaurus::init ( )
1532{ 1534{
1533 d-> m_vendorstr = "Sharp"; 1535 d-> m_vendorstr = "Sharp";
1534 d-> m_vendor = Vendor_Sharp; 1536 d-> m_vendor = Vendor_Sharp;
1535 m_embedix = true; // Not openzaurus means: It has an embedix kernel ! 1537 m_embedix = true; // Not openzaurus means: It has an embedix kernel !
1536 1538
1537 // QFile f ( "/proc/filesystems" ); 1539 // QFile f ( "/proc/filesystems" );
1538 QString model; 1540 QString model;
1539 1541
1540 // It isn't a good idea to check the system configuration to 1542 // It isn't a good idea to check the system configuration to
1541 // detect the distribution ! 1543 // detect the distribution !
1542 // Otherwise it may happen that any other distribution is detected as openzaurus, just 1544 // Otherwise it may happen that any other distribution is detected as openzaurus, just
1543 // because it uses a jffs2 filesystem.. 1545 // because it uses a jffs2 filesystem..
1544 // (eilers) 1546 // (eilers)
1545 // if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) { 1547 // if ( f. open ( IO_ReadOnly ) && ( QTextStream ( &f ). read ( ). find ( "\tjffs2\n" ) >= 0 )) {
1546 QFile f ("/etc/oz_version"); 1548 QFile f ("/etc/oz_version");
1547 if ( f.exists() ){ 1549 if ( f.exists() ){
1548 d-> m_vendorstr = "OpenZaurus Team"; 1550 d-> m_vendorstr = "OpenZaurus Team";
1549 d-> m_systemstr = "OpenZaurus"; 1551 d-> m_systemstr = "OpenZaurus";
1550 d-> m_system = System_OpenZaurus; 1552 d-> m_system = System_OpenZaurus;
1551 1553
1552 if ( f. open ( IO_ReadOnly )) { 1554 if ( f. open ( IO_ReadOnly )) {
1553 QTextStream ts ( &f ); 1555 QTextStream ts ( &f );
1554 d-> m_sysverstr = ts. readLine ( );//. mid ( 10 ); 1556 d-> m_sysverstr = ts. readLine ( );//. mid ( 10 );
1555 f. close ( ); 1557 f. close ( );
1556 } 1558 }
1557 1559
1558 // Openzaurus sometimes uses the embedix kernel! 1560 // Openzaurus sometimes uses the embedix kernel!
1559 // => Check whether this is an embedix kernel 1561 // => Check whether this is an embedix kernel
1560 FILE *uname = popen("uname -r", "r"); 1562 FILE *uname = popen("uname -r", "r");
1561 QString line; 1563 QString line;
1562 if ( f.open(IO_ReadOnly, uname) ) { 1564 if ( f.open(IO_ReadOnly, uname) ) {
1563 QTextStream ts ( &f ); 1565 QTextStream ts ( &f );
1564 line = ts. readLine ( ); 1566 line = ts. readLine ( );
1565 int loc = line. find ( "embedix" ); 1567 int loc = line. find ( "embedix" );
1566 if ( loc != -1 ) 1568 if ( loc != -1 )
1567 m_embedix = true; 1569 m_embedix = true;
1568 else 1570 else
1569 m_embedix = false; 1571 m_embedix = false;
1570 f. close ( ); 1572 f. close ( );
1571 } 1573 }
1572 pclose(uname); 1574 pclose(uname);
1573 } 1575 }
1574 else { 1576 else {
1575 d-> m_systemstr = "Zaurus"; 1577 d-> m_systemstr = "Zaurus";
1576 d-> m_system = System_Zaurus; 1578 d-> m_system = System_Zaurus;
1577 } 1579 }
1578 1580
1579 f. setName ( "/proc/cpuinfo" ); 1581 f. setName ( "/proc/cpuinfo" );
1580 if ( f. open ( IO_ReadOnly ) ) { 1582 if ( f. open ( IO_ReadOnly ) ) {
1581 QTextStream ts ( &f ); 1583 QTextStream ts ( &f );
1582 QString line; 1584 QString line;
1583 while( line = ts. readLine ( ) ) { 1585 while( line = ts. readLine ( ) ) {
1584 if ( line. left ( 8 ) == "Hardware" ) 1586 if ( line. left ( 8 ) == "Hardware" )
1585 break; 1587 break;
1586 } 1588 }
1587 int loc = line. find ( ":" ); 1589 int loc = line. find ( ":" );
1588 if ( loc != -1 ) 1590 if ( loc != -1 )
1589 model = line. mid ( loc + 2 ). simplifyWhiteSpace( ); 1591 model = line. mid ( loc + 2 ). simplifyWhiteSpace( );
1590 } 1592 }
1591 1593
1592 if ( model == "SHARP Corgi" ) { 1594 if ( model == "SHARP Corgi" ) {
1593 d-> m_model = Model_Zaurus_SLC700; 1595 d-> m_model = Model_Zaurus_SLC700;
1594 d-> m_modelstr = "Zaurus SL-C700"; 1596 d-> m_modelstr = "Zaurus SL-C700";
1595 } else if ( model == "SHARP Shepherd" ) { 1597 } else if ( model == "SHARP Shepherd" ) {
1596 d-> m_model = Model_Zaurus_SLC700; // Do we need a special type for the C750 ? (eilers) 1598 d-> m_model = Model_Zaurus_SLC700; // Do we need a special type for the C750 ? (eilers)
1597 d-> m_modelstr = "Zaurus SL-C750"; 1599 d-> m_modelstr = "Zaurus SL-C750";
1598 } else if ( model == "SHARP Poodle" ) { 1600 } else if ( model == "SHARP Poodle" ) {
1599 d-> m_model = Model_Zaurus_SLB600; 1601 d-> m_model = Model_Zaurus_SLB600;
1600 d-> m_modelstr = "Zaurus SL-B500 or SL-5600"; 1602 d-> m_modelstr = "Zaurus SL-B500 or SL-5600";
1601 } else if ( model == "Sharp-Collie" || model == "Collie" ) { 1603 } else if ( model == "Sharp-Collie" || model == "Collie" ) {
1602 d-> m_model = Model_Zaurus_SL5500; 1604 d-> m_model = Model_Zaurus_SL5500;
1603 d-> m_modelstr = "Zaurus SL-5500 or SL-5000d"; 1605 d-> m_modelstr = "Zaurus SL-5500 or SL-5000d";
1604 } else { 1606 } else {
1605 d-> m_model = Model_Zaurus_SL5500; 1607 d-> m_model = Model_Zaurus_SL5500;
1606 d-> m_modelstr = "Zaurus (Model unknown)"; 1608 d-> m_modelstr = "Zaurus (Model unknown)";
1607 } 1609 }
1608 1610
1609 bool flipstate = false; 1611 bool flipstate = false;
1610 switch ( d-> m_model ) { 1612 switch ( d-> m_model ) {
1611 case Model_Zaurus_SLA300: 1613 case Model_Zaurus_SLA300:
1612 d-> m_rotation = Rot0; 1614 d-> m_rotation = Rot0;
1613 break; 1615 break;
1614 case Model_Zaurus_SLC700: 1616 case Model_Zaurus_SLC700:
1615 // Note: need to 1) set flipstate based on physical screen orientation 1617 // Note: need to 1) set flipstate based on physical screen orientation
1616 // and 2) check to see if the user overrode the rotation direction 1618 // and 2) check to see if the user overrode the rotation direction
1617 // using appearance, and if so, remove that item from the Config to 1619 // using appearance, and if so, remove that item from the Config to
1618 // ensure the rotate applet flips us back to the previous state. 1620 // ensure the rotate applet flips us back to the previous state.
1619 if ( flipstate ) { 1621 if ( flipstate ) {
1620 // 480x640 1622 // 480x640
1621 d-> m_rotation = Rot0; 1623 d-> m_rotation = Rot0;
1622 d-> m_direction = CW; 1624 d-> m_direction = CW;
1623 } else { 1625 } else {
1624 // 640x480 1626 // 640x480
1625 d-> m_rotation = Rot270; 1627 d-> m_rotation = Rot270;
1626 d-> m_direction = CCW; 1628 d-> m_direction = CCW;
1627 } 1629 }
1628 break; 1630 break;
1629 case Model_Zaurus_SLB600: 1631 case Model_Zaurus_SLB600:
1630 case Model_Zaurus_SL5500: 1632 case Model_Zaurus_SL5500:
1631 case Model_Zaurus_SL5000: 1633 case Model_Zaurus_SL5000:
1632 default: 1634 default:
1633 d-> m_rotation = Rot270; 1635 d-> m_rotation = Rot270;
1634 break; 1636 break;
1635 } 1637 }
1636 m_leds [0] = Led_Off; 1638 m_leds [0] = Led_Off;
1637} 1639}
1638 1640
1639void Zaurus::initButtons ( ) 1641void Zaurus::initButtons ( )
1640{ 1642{
1641 if ( d-> m_buttons ) 1643 if ( d-> m_buttons )
1642 return; 1644 return;
1643 1645
1644 d-> m_buttons = new QValueList <ODeviceButton>; 1646 d-> m_buttons = new QValueList <ODeviceButton>;
1645 1647
1646 struct z_button * pz_buttons; 1648 struct z_button * pz_buttons;
1647 int buttoncount; 1649 int buttoncount;
1648 switch ( d-> m_model ) { 1650 switch ( d-> m_model ) {
1649 case Model_Zaurus_SLC700: 1651 case Model_Zaurus_SLC700:
1650 pz_buttons = z_buttons_c700; 1652 pz_buttons = z_buttons_c700;
1651 buttoncount = ARRAY_SIZE(z_buttons_c700); 1653 buttoncount = ARRAY_SIZE(z_buttons_c700);
1652 break; 1654 break;
1653 default: 1655 default:
1654 pz_buttons = z_buttons; 1656 pz_buttons = z_buttons;
1655 buttoncount = ARRAY_SIZE(z_buttons); 1657 buttoncount = ARRAY_SIZE(z_buttons);
1656 break; 1658 break;
1657 } 1659 }
1658 1660
1659 for ( int i = 0; i < buttoncount; i++ ) { 1661 for ( int i = 0; i < buttoncount; i++ ) {
1660 struct z_button *zb = pz_buttons + i; 1662 struct z_button *zb = pz_buttons + i;
1661 ODeviceButton b; 1663 ODeviceButton b;
1662 1664
1663 b. setKeycode ( zb-> code ); 1665 b. setKeycode ( zb-> code );
1664 b. setUserText ( QObject::tr ( "Button", zb-> utext )); 1666 b. setUserText ( QObject::tr ( "Button", zb-> utext ));
1665 b. setPixmap ( Resource::loadPixmap ( zb-> pix )); 1667 b. setPixmap ( Resource::loadPixmap ( zb-> pix ));
1666 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb-> fpressedservice ), 1668 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb-> fpressedservice ),
1667 zb-> fpressedaction )); 1669 zb-> fpressedaction ));
1668 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb-> fheldservice ), 1670 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb-> fheldservice ),
1669 zb-> fheldaction )); 1671 zb-> fheldaction ));
1670 1672
1671 d-> m_buttons-> append ( b ); 1673 d-> m_buttons-> append ( b );
1672 } 1674 }
1673 1675
1674 reloadButtonMapping ( ); 1676 reloadButtonMapping ( );
1675 1677
1676 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 1678 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
1677 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), 1679 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )),
1678 this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); 1680 this, SLOT( systemMessage ( const QCString &, const QByteArray & )));
1679} 1681}
1680 1682
1681#include <unistd.h> 1683#include <unistd.h>
1682#include <fcntl.h> 1684#include <fcntl.h>
1683#include <sys/ioctl.h> 1685#include <sys/ioctl.h>
1684 1686
1685//#include <asm/sharp_char.h> // including kernel headers is evil ... 1687//#include <asm/sharp_char.h> // including kernel headers is evil ...
1686 1688
1687#define SHARP_DEV_IOCTL_COMMAND_START 0x5680 1689#define SHARP_DEV_IOCTL_COMMAND_START 0x5680
1688 1690
1689 #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 1691 #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
1690#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) 1692#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START)
1691 1693
1692#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ 1694#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */
1693#define SHARP_BUZ_KEYSOUND 2 /* key sound */ 1695#define SHARP_BUZ_KEYSOUND 2 /* key sound */
1694#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ 1696#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */
1695 1697
1696/* --- for SHARP_BUZZER device --- */ 1698/* --- for SHARP_BUZZER device --- */
1697 1699
1698 //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 1700 //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
1699//#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) 1701//#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START)
1700 1702
1701#define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) 1703#define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1)
1702#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) 1704#define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2)
1703#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) 1705#define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3)
1704#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) 1706#define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4)
1705#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) 1707#define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5)
1706 1708
1707//#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ 1709//#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */
1708//#define SHARP_BUZ_KEYSOUND 2 /* key sound */ 1710//#define SHARP_BUZ_KEYSOUND 2 /* key sound */
1709 1711
1710//#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ 1712//#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */
1711//#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ 1713//#define SHARP_PDA_WARNSOUND 4 /* warning occurred */
1712//#define SHARP_PDA_ERRORSOUND 5 /* error occurred */ 1714//#define SHARP_PDA_ERRORSOUND 5 /* error occurred */
1713//#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ 1715//#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */
1714//#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ 1716//#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */
1715//#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ 1717//#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */
1716//#define SHARP_PDA_APPSTART 9 /* application start */ 1718//#define SHARP_PDA_APPSTART 9 /* application start */
1717//#define SHARP_PDA_APPQUIT 10 /* application ends */ 1719//#define SHARP_PDA_APPQUIT 10 /* application ends */
1718 1720
1719//#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ 1721//#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */
1720//#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ 1722//#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */
1721//#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ 1723//#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */
1722//#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ 1724//#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */
1723// 1725//
1724 1726
1725 #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) 1727 #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START)
1726#define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) 1728#define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1)
1727 1729
1728typedef struct sharp_led_status { 1730typedef struct sharp_led_status {
1729 int which; /* select which LED status is wanted. */ 1731 int which; /* select which LED status is wanted. */
1730 int status; /* set new led status if you call SHARP_LED_SETSTATUS */ 1732 int status; /* set new led status if you call SHARP_LED_SETSTATUS */
1731} sharp_led_status; 1733} sharp_led_status;
1732 1734
1733#define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ 1735#define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */
1734 1736
1735#define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */ 1737#define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */
1736#define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */ 1738#define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */
1737#define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */ 1739#define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */
1738 1740
1739// #include <asm/sharp_apm.h> // including kernel headers is evil ... 1741// #include <asm/sharp_apm.h> // including kernel headers is evil ...
1740 1742
1741#define APM_IOCGEVTSRC OD_IOR( 'A', 203, int ) 1743#define APM_IOCGEVTSRC OD_IOR( 'A', 203, int )
1742#define APM_IOCSEVTSRC OD_IORW( 'A', 204, int ) 1744#define APM_IOCSEVTSRC OD_IORW( 'A', 204, int )
1743#define APM_EVT_POWER_BUTTON (1 << 0) 1745#define APM_EVT_POWER_BUTTON (1 << 0)
1744 1746
1745#define FL_IOCTL_STEP_CONTRAST 100 1747#define FL_IOCTL_STEP_CONTRAST 100
1746 1748
1747 1749
1748void Zaurus::buzzer ( int sound ) 1750void Zaurus::buzzer ( int sound )
1749{ 1751{
1750#ifndef QT_NO_SOUND 1752#ifndef QT_NO_SOUND
1751 QString soundname; 1753 QString soundname;
1752 1754
1753 // Not all devices have real sound. But I expect 1755 // Not all devices have real sound. But I expect
1754 // that Openzaurus now has a sound driver which 1756 // that Openzaurus now has a sound driver which
1755 // I will use instead the buzzer... 1757 // I will use instead the buzzer...
1756 if ( ( d->m_model == Model_Zaurus_SLC700 ) 1758 if ( ( d->m_model == Model_Zaurus_SLC700 )
1757 || d->m_system == System_OpenZaurus ){ 1759 || d->m_system == System_OpenZaurus ){
1758 1760
1759 switch ( sound ){ 1761 switch ( sound ){
1760 case SHARP_BUZ_SCHEDULE_ALARM: 1762 case SHARP_BUZ_SCHEDULE_ALARM:
1761 soundname = "alarm"; 1763 soundname = "alarm";
1762 break; 1764 break;
1763 case SHARP_BUZ_TOUCHSOUND: 1765 case SHARP_BUZ_TOUCHSOUND:
1764 soundname = "touchsound"; 1766 soundname = "touchsound";
1765 break; 1767 break;
1766 case SHARP_BUZ_KEYSOUND: 1768 case SHARP_BUZ_KEYSOUND:
1767 soundname = "keysound"; 1769 soundname = "keysound";
1768 break; 1770 break;
1769 default: 1771 default:
1770 soundname = "alarm"; 1772 soundname = "alarm";
1771 1773
1772 } 1774 }
1773 } 1775 }
1774 1776
1775 // If a soundname is defined, we expect that this device has 1777 // If a soundname is defined, we expect that this device has
1776 // sound capabilities.. Otherwise we expect to have the buzzer 1778 // sound capabilities.. Otherwise we expect to have the buzzer
1777 // device.. 1779 // device..
1778 if ( !soundname.isEmpty() ){ 1780 if ( !soundname.isEmpty() ){
1779 int fd; 1781 int fd;
1780 int vol; 1782 int vol;
1781 bool vol_reset = false; 1783 bool vol_reset = false;
1782 1784
1783 Sound snd ( soundname ); 1785 Sound snd ( soundname );
1784 1786
1785 if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { 1787 if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) {
1786 if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { 1788 if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) {
1787 Config cfg ( "qpe" ); 1789 Config cfg ( "qpe" );
1788 cfg. setGroup ( "Volume" ); 1790 cfg. setGroup ( "Volume" );
1789 1791
1790 int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); 1792 int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 );
1791 if ( volalarm < 0 ) 1793 if ( volalarm < 0 )
1792 volalarm = 0; 1794 volalarm = 0;
1793 else if ( volalarm > 100 ) 1795 else if ( volalarm > 100 )
1794 volalarm = 100; 1796 volalarm = 100;
1795 volalarm |= ( volalarm << 8 ); 1797 volalarm |= ( volalarm << 8 );
1796 1798
1797 if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) 1799 if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 )
1798 vol_reset = true; 1800 vol_reset = true;
1799 } 1801 }
1800 } 1802 }
1801 1803
1802 snd. play ( ); 1804 snd. play ( );
1803 while ( !snd. isFinished ( )) 1805 while ( !snd. isFinished ( ))
1804 qApp-> processEvents ( ); 1806 qApp-> processEvents ( );
1805 1807
1806 if ( fd >= 0 ) { 1808 if ( fd >= 0 ) {
1807 if ( vol_reset ) 1809 if ( vol_reset )
1808 ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); 1810 ::ioctl ( fd, MIXER_WRITE( 0 ), &vol );
1809 ::close ( fd ); 1811 ::close ( fd );
1810 } 1812 }
1811 } else { 1813 } else {
1812 int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); 1814 int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK );
1813 1815
1814 if ( fd >= 0 ) { 1816 if ( fd >= 0 ) {
1815 ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); 1817 ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound );
1816 ::close ( fd ); 1818 ::close ( fd );
1817 } 1819 }
1818 1820
1819 } 1821 }
1820#endif 1822#endif
1821} 1823}
1822 1824
1823 1825
1824void Zaurus::alarmSound ( ) 1826void Zaurus::alarmSound ( )
1825{ 1827{
1826 buzzer ( SHARP_BUZ_SCHEDULE_ALARM ); 1828 buzzer ( SHARP_BUZ_SCHEDULE_ALARM );
1827} 1829}
1828 1830
1829void Zaurus::touchSound ( ) 1831void Zaurus::touchSound ( )
1830{ 1832{
1831 buzzer ( SHARP_BUZ_TOUCHSOUND ); 1833 buzzer ( SHARP_BUZ_TOUCHSOUND );
1832} 1834}
1833 1835
1834void Zaurus::keySound ( ) 1836void Zaurus::keySound ( )
1835{ 1837{
1836 buzzer ( SHARP_BUZ_KEYSOUND ); 1838 buzzer ( SHARP_BUZ_KEYSOUND );
1837} 1839}
1838 1840
1839 1841
1840QValueList <OLed> Zaurus::ledList ( ) const 1842QValueList <OLed> Zaurus::ledList ( ) const
1841{ 1843{
1842 QValueList <OLed> vl; 1844 QValueList <OLed> vl;
1843 vl << Led_Mail; 1845 vl << Led_Mail;
1844 return vl; 1846 return vl;
1845} 1847}
1846 1848
1847QValueList <OLedState> Zaurus::ledStateList ( OLed l ) const 1849QValueList <OLedState> Zaurus::ledStateList ( OLed l ) const
1848{ 1850{
1849 QValueList <OLedState> vl; 1851 QValueList <OLedState> vl;
1850 1852
1851 if ( l == Led_Mail ) 1853 if ( l == Led_Mail )
1852 vl << Led_Off << Led_On << Led_BlinkSlow; 1854 vl << Led_Off << Led_On << Led_BlinkSlow;
1853 return vl; 1855 return vl;
1854} 1856}
1855 1857
1856OLedState Zaurus::ledState ( OLed which ) const 1858OLedState Zaurus::ledState ( OLed which ) const
1857{ 1859{
1858 if ( which == Led_Mail ) 1860 if ( which == Led_Mail )
1859 return m_leds [0]; 1861 return m_leds [0];
1860 else 1862 else
1861 return Led_Off; 1863 return Led_Off;
1862} 1864}
1863 1865
1864bool Zaurus::setLedState ( OLed which, OLedState st ) 1866bool Zaurus::setLedState ( OLed which, OLedState st )
1865{ 1867{
1866 if (!m_embedix) // Currently not supported on non_embedix kernels 1868 if (!m_embedix) // Currently not supported on non_embedix kernels
1867 return false; 1869 return false;
1868 1870
1869 static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK ); 1871 static int fd = ::open ( "/dev/sharp_led", O_RDWR|O_NONBLOCK );
1870 1872
1871 if ( which == Led_Mail ) { 1873 if ( which == Led_Mail ) {
1872 if ( fd >= 0 ) { 1874 if ( fd >= 0 ) {
1873 struct sharp_led_status leds; 1875 struct sharp_led_status leds;
1874 ::memset ( &leds, 0, sizeof( leds )); 1876 ::memset ( &leds, 0, sizeof( leds ));
1875 leds. which = SHARP_LED_MAIL_EXISTS; 1877 leds. which = SHARP_LED_MAIL_EXISTS;
1876 bool ok = true; 1878 bool ok = true;
1877 1879
1878 switch ( st ) { 1880 switch ( st ) {
1879 case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break; 1881 case Led_Off : leds. status = LED_MAIL_NO_UNREAD_MAIL; break;
1880 case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break; 1882 case Led_On : leds. status = LED_MAIL_NEWMAIL_EXISTS; break;
1881 case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break; 1883 case Led_BlinkSlow: leds. status = LED_MAIL_UNREAD_MAIL_EX; break;
1882 default : ok = false; 1884 default : ok = false;
1883 } 1885 }
1884 1886
1885 if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) { 1887 if ( ok && ( ::ioctl ( fd, SHARP_LED_SETSTATUS, &leds ) >= 0 )) {
1886 m_leds [0] = st; 1888 m_leds [0] = st;
1887 return true; 1889 return true;
1888 } 1890 }
1889 } 1891 }
1890 } 1892 }
1891 return false; 1893 return false;
1892} 1894}
1893 1895
1894bool Zaurus::setSoftSuspend ( bool soft ) 1896bool Zaurus::setSoftSuspend ( bool soft )
1895{ 1897{
1896 if (!m_embedix) { 1898 if (!m_embedix) {
1897 /* non-Embedix kernels dont have kernel autosuspend */ 1899 /* non-Embedix kernels dont have kernel autosuspend */
1898 return ODevice::setSoftSuspend( soft ); 1900 return ODevice::setSoftSuspend( soft );
1899 } 1901 }
1900 1902
1901 bool res = false; 1903 bool res = false;
1902 int fd; 1904 int fd;
1903 1905
1904 if ((( fd = ::open ( "/dev/apm_bios", O_RDWR )) >= 0 ) || 1906 if ((( fd = ::open ( "/dev/apm_bios", O_RDWR )) >= 0 ) ||
1905 (( fd = ::open ( "/dev/misc/apm_bios",O_RDWR )) >= 0 )) { 1907 (( fd = ::open ( "/dev/misc/apm_bios",O_RDWR )) >= 0 )) {
1906 1908
1907 int sources = ::ioctl ( fd, APM_IOCGEVTSRC, 0 ); // get current event sources 1909 int sources = ::ioctl ( fd, APM_IOCGEVTSRC, 0 ); // get current event sources
1908 1910
1909 if ( sources >= 0 ) { 1911 if ( sources >= 0 ) {
1910 if ( soft ) 1912 if ( soft )
1911 sources &= ~APM_EVT_POWER_BUTTON; 1913 sources &= ~APM_EVT_POWER_BUTTON;
1912 else 1914 else
1913 sources |= APM_EVT_POWER_BUTTON; 1915 sources |= APM_EVT_POWER_BUTTON;
1914 1916
1915 if ( ::ioctl ( fd, APM_IOCSEVTSRC, sources ) >= 0 ) // set new event sources 1917 if ( ::ioctl ( fd, APM_IOCSEVTSRC, sources ) >= 0 ) // set new event sources
1916 res = true; 1918 res = true;
1917 else 1919 else
1918 perror ( "APM_IOCGEVTSRC" ); 1920 perror ( "APM_IOCGEVTSRC" );
1919 } 1921 }
1920 else 1922 else
1921 perror ( "APM_IOCGEVTSRC" ); 1923 perror ( "APM_IOCGEVTSRC" );
1922 1924
1923 ::close ( fd ); 1925 ::close ( fd );
1924 } 1926 }
1925 else 1927 else
1926 perror ( "/dev/apm_bios or /dev/misc/apm_bios" ); 1928 perror ( "/dev/apm_bios or /dev/misc/apm_bios" );
1927 1929
1928 return res; 1930 return res;
1929} 1931}
1930 1932
1931 1933
1932bool Zaurus::setDisplayBrightness ( int bright ) 1934bool Zaurus::setDisplayBrightness ( int bright )
1933{ 1935{
1934 bool res = false; 1936 bool res = false;
1935 int fd; 1937 int fd;
1936 1938
1937 if ( bright > 255 ) 1939 if ( bright > 255 )
1938 bright = 255; 1940 bright = 255;
1939 if ( bright < 0 ) 1941 if ( bright < 0 )
1940 bright = 0; 1942 bright = 0;
1941 1943
1942 if (m_embedix) { 1944 if (m_embedix) {
1943 if (( fd = ::open ( "/dev/fl", O_WRONLY )) >= 0 ) { 1945 if (( fd = ::open ( "/dev/fl", O_WRONLY )) >= 0 ) {
1944 int bl = ( bright * 4 + 127 ) / 255; // only 4 steps on zaurus 1946 int bl = ( bright * 4 + 127 ) / 255; // only 4 steps on zaurus
1945 if ( bright && !bl ) 1947 if ( bright && !bl )
1946 bl = 1; 1948 bl = 1;
1947 res = ( ::ioctl ( fd, FL_IOCTL_STEP_CONTRAST, bl ) == 0 ); 1949 res = ( ::ioctl ( fd, FL_IOCTL_STEP_CONTRAST, bl ) == 0 );
1948 ::close ( fd ); 1950 ::close ( fd );
1949 } 1951 }
1950 } else { 1952 } else {
1951#define FB_BACKLIGHT_SET_BRIGHTNESS _IOW('F', 1, u_int) /* set brightness */ 1953#define FB_BACKLIGHT_SET_BRIGHTNESS _IOW('F', 1, u_int) /* set brightness */
1952 if (( fd = ::open ( "/dev/fb0", O_WRONLY )) >= 0 ) { 1954 if (( fd = ::open ( "/dev/fb0", O_WRONLY )) >= 0 ) {
1953 res = ( ::ioctl ( fd , FB_BACKLIGHT_SET_BRIGHTNESS, bright ) == 0 ); 1955 res = ( ::ioctl ( fd , FB_BACKLIGHT_SET_BRIGHTNESS, bright ) == 0 );
1954 ::close ( fd ); 1956 ::close ( fd );
1955 } 1957 }
1956 } 1958 }
1957 return res; 1959 return res;
1958} 1960}
1959 1961
1960 1962
1961int Zaurus::displayBrightnessResolution ( ) const 1963int Zaurus::displayBrightnessResolution ( ) const
1962{ 1964{
1963 if (m_embedix) 1965 if (m_embedix)
1964 return 5; 1966 return 5;
1965 else 1967 else
1966 return 256; 1968 return 256;
1967} 1969}
1968 1970
1969/************************************************** 1971/**************************************************
1970 * 1972 *
1971 * SIMpad 1973 * SIMpad
1972 * 1974 *
1973 **************************************************/ 1975 **************************************************/
1974 1976
1975void SIMpad::init ( ) 1977void SIMpad::init ( )
1976{ 1978{
1977 d-> m_vendorstr = "SIEMENS"; 1979 d-> m_vendorstr = "SIEMENS";
1978 d-> m_vendor = Vendor_SIEMENS; 1980 d-> m_vendor = Vendor_SIEMENS;
1979 1981
1980 QFile f ( "/proc/hal/model" ); 1982 QFile f ( "/proc/hal/model" );
1981 1983
1982 //TODO Implement model checking 1984 //TODO Implement model checking
1983 //FIXME For now we assume an SL4 1985 //FIXME For now we assume an SL4
1984 1986
1985 d-> m_modelstr = "SL4"; 1987 d-> m_modelstr = "SL4";
1986 d-> m_model = Model_SIMpad_SL4; 1988 d-> m_model = Model_SIMpad_SL4;
1987 1989
1988 switch ( d-> m_model ) { 1990 switch ( d-> m_model ) {
1989 default: 1991 default:
1990 d-> m_rotation = Rot0; 1992 d-> m_rotation = Rot0;
1991 d-> m_direction = CCW; 1993 d-> m_direction = CCW;
1992 d-> m_holdtime = 1000; // 1000ms 1994 d-> m_holdtime = 1000; // 1000ms
1993 1995
1994 break; 1996 break;
1995 } 1997 }
1996 1998
1997 f. setName ( "/etc/familiar-version" ); 1999 f. setName ( "/etc/familiar-version" );
1998 if ( f. open ( IO_ReadOnly )) { 2000 if ( f. open ( IO_ReadOnly )) {
1999 d-> m_systemstr = "Familiar"; 2001 d-> m_systemstr = "Familiar";
2000 d-> m_system = System_Familiar; 2002 d-> m_system = System_Familiar;
2001 2003
2002 QTextStream ts ( &f ); 2004 QTextStream ts ( &f );
2003 d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); 2005 d-> m_sysverstr = ts. readLine ( ). mid ( 10 );
2004 2006
2005 f. close ( ); 2007 f. close ( );
2006 } else { 2008 } else {
2007 f. setName ( "/etc/oz_version" ); 2009 f. setName ( "/etc/oz_version" );
2008 2010
2009 if ( f. open ( IO_ReadOnly )) { 2011 if ( f. open ( IO_ReadOnly )) {
2010 d-> m_systemstr = "OpenEmbedded/SIMpad"; 2012 d-> m_systemstr = "OpenEmbedded/SIMpad";
2011 d-> m_system = System_OpenZaurus; 2013 d-> m_system = System_OpenZaurus;
2012 2014
2013 QTextStream ts ( &f ); 2015 QTextStream ts ( &f );
2014 ts.setDevice ( &f ); 2016 ts.setDevice ( &f );
2015 d-> m_sysverstr = ts. readLine ( ); 2017 d-> m_sysverstr = ts. readLine ( );
2016 f. close ( ); 2018 f. close ( );
2017 } 2019 }
2018 } 2020 }
2019 2021
2020 m_leds [0] = m_leds [1] = Led_Off; 2022 m_leds [0] = m_leds [1] = Led_Off;
2021 2023
2022 m_power_timer = 0; 2024 m_power_timer = 0;
2023 2025
2024} 2026}
2025 2027
2026void SIMpad::initButtons ( ) 2028void SIMpad::initButtons ( )
2027{ 2029{
2028 if ( d-> m_buttons ) 2030 if ( d-> m_buttons )
2029 return; 2031 return;
2030 2032
2031 if ( isQWS( ) ) 2033 if ( isQWS( ) )
2032 QWSServer::setKeyboardFilter ( this ); 2034 QWSServer::setKeyboardFilter ( this );
2033 2035
2034 d-> m_buttons = new QValueList <ODeviceButton>; 2036 d-> m_buttons = new QValueList <ODeviceButton>;
2035 2037
2036 for ( uint i = 0; i < ( sizeof( simpad_buttons ) / sizeof( s_button )); i++ ) { 2038 for ( uint i = 0; i < ( sizeof( simpad_buttons ) / sizeof( s_button )); i++ ) {
2037 s_button *sb = simpad_buttons + i; 2039 s_button *sb = simpad_buttons + i;
2038 ODeviceButton b; 2040 ODeviceButton b;
2039 2041
2040 if (( sb-> model & d-> m_model ) == d-> m_model ) { 2042 if (( sb-> model & d-> m_model ) == d-> m_model ) {
2041 b. setKeycode ( sb-> code ); 2043 b. setKeycode ( sb-> code );
2042 b. setUserText ( QObject::tr ( "Button", sb-> utext )); 2044 b. setUserText ( QObject::tr ( "Button", sb-> utext ));
2043 b. setPixmap ( Resource::loadPixmap ( sb-> pix )); 2045 b. setPixmap ( Resource::loadPixmap ( sb-> pix ));
2044 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( sb-> fpressedservice ), sb-> fpressedaction )); 2046 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( sb-> fpressedservice ), sb-> fpressedaction ));
2045 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( sb-> fheldservice ), sb-> fheldaction )); 2047 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( sb-> fheldservice ), sb-> fheldaction ));
2046 2048
2047 d-> m_buttons-> append ( b ); 2049 d-> m_buttons-> append ( b );
2048 } 2050 }
2049 } 2051 }
2050 reloadButtonMapping ( ); 2052 reloadButtonMapping ( );
2051 2053
2052 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 2054 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
2053 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); 2055 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & )));
2054} 2056}
2055 2057
2056// SIMpad boardcontrol register CS3 2058// SIMpad boardcontrol register CS3
2057#define SIMPAD_BOARDCONTROL "/proc/cs3" 2059#define SIMPAD_BOARDCONTROL "/proc/cs3"
2058#define SIMPAD_VCC_5V_EN 0x0001 // For 5V PCMCIA 2060#define SIMPAD_VCC_5V_EN 0x0001 // For 5V PCMCIA
2059#define SIMPAD_VCC_3V_EN 0x0002 // FOR 3.3V PCMCIA 2061#define SIMPAD_VCC_3V_EN 0x0002 // FOR 3.3V PCMCIA
2060#define SIMPAD_EN1 0x0004 // This is only for EPROM's 2062#define SIMPAD_EN1 0x0004 // This is only for EPROM's
2061#define SIMPAD_EN0 0x0008 // Both should be enable for 3.3V or 5V 2063#define SIMPAD_EN0 0x0008 // Both should be enable for 3.3V or 5V
2062#define SIMPAD_DISPLAY_ON 0x0010 2064#define SIMPAD_DISPLAY_ON 0x0010
2063#define SIMPAD_PCMCIA_BUFF_DIS 0x0020 2065#define SIMPAD_PCMCIA_BUFF_DIS 0x0020
2064#define SIMPAD_MQ_RESET 0x0040 2066#define SIMPAD_MQ_RESET 0x0040
2065#define SIMPAD_PCMCIA_RESET 0x0080 2067#define SIMPAD_PCMCIA_RESET 0x0080
2066#define SIMPAD_DECT_POWER_ON 0x0100 2068#define SIMPAD_DECT_POWER_ON 0x0100
2067#define SIMPAD_IRDA_SD 0x0200 // Shutdown for powersave 2069#define SIMPAD_IRDA_SD 0x0200 // Shutdown for powersave
2068#define SIMPAD_RS232_ON 0x0400 2070#define SIMPAD_RS232_ON 0x0400
2069#define SIMPAD_SD_MEDIAQ 0x0800 // Shutdown for powersave 2071#define SIMPAD_SD_MEDIAQ 0x0800 // Shutdown for powersave
2070#define SIMPAD_LED2_ON 0x1000 2072#define SIMPAD_LED2_ON 0x1000
2071#define SIMPAD_IRDA_MODE 0x2000 // Fast/Slow IrDA mode 2073#define SIMPAD_IRDA_MODE 0x2000 // Fast/Slow IrDA mode
2072#define SIMPAD_ENABLE_5V 0x4000 // Enable 5V circuit 2074#define SIMPAD_ENABLE_5V 0x4000 // Enable 5V circuit
2073#define SIMPAD_RESET_SIMCARD 0x8000 2075#define SIMPAD_RESET_SIMCARD 0x8000
2074 2076
2075//SIMpad touchscreen backlight strength control 2077//SIMpad touchscreen backlight strength control
2076#define SIMPAD_BACKLIGHT_CONTROL "/proc/driver/mq200/registers/PWM_CONTROL" 2078#define SIMPAD_BACKLIGHT_CONTROL "/proc/driver/mq200/registers/PWM_CONTROL"
2077#define SIMPAD_BACKLIGHT_MASK 0x00a10044 2079#define SIMPAD_BACKLIGHT_MASK 0x00a10044
2078 2080
2079QValueList <OLed> SIMpad::ledList ( ) const 2081QValueList <OLed> SIMpad::ledList ( ) const
2080{ 2082{
2081 QValueList <OLed> vl; 2083 QValueList <OLed> vl;
2082 vl << Led_Power; //FIXME which LED is LED2 ? The green one or the amber one? 2084 vl << Led_Power; //FIXME which LED is LED2 ? The green one or the amber one?
2083 //vl << Led_Mail; //TODO find out if LED1 is accessible anyway 2085 //vl << Led_Mail; //TODO find out if LED1 is accessible anyway
2084 return vl; 2086 return vl;
2085} 2087}
2086 2088
2087QValueList <OLedState> SIMpad::ledStateList ( OLed l ) const 2089QValueList <OLedState> SIMpad::ledStateList ( OLed l ) const
2088{ 2090{
2089 QValueList <OLedState> vl; 2091 QValueList <OLedState> vl;
2090 2092
2091 if ( l == Led_Power ) //FIXME which LED is LED2 ? The green one or the amber one? 2093 if ( l == Led_Power ) //FIXME which LED is LED2 ? The green one or the amber one?
2092 vl << Led_Off << Led_On; 2094 vl << Led_Off << Led_On;
2093 //else if ( l == Led_Mail ) //TODO find out if LED1 is accessible anyway 2095 //else if ( l == Led_Mail ) //TODO find out if LED1 is accessible anyway
2094 //vl << Led_Off; 2096 //vl << Led_Off;
2095 return vl; 2097 return vl;
2096} 2098}
2097 2099
2098OLedState SIMpad::ledState ( OLed l ) const 2100OLedState SIMpad::ledState ( OLed l ) const
2099{ 2101{
2100 switch ( l ) { 2102 switch ( l ) {
2101 case Led_Power: 2103 case Led_Power:
2102 return m_leds [0]; 2104 return m_leds [0];
2103 //case Led_Mail: 2105 //case Led_Mail:
2104 //return m_leds [1]; 2106 //return m_leds [1];
2105 default: 2107 default:
2106 return Led_Off; 2108 return Led_Off;
2107 } 2109 }
2108} 2110}
2109 2111
2110bool SIMpad::setLedState ( OLed l, OLedState st ) 2112bool SIMpad::setLedState ( OLed l, OLedState st )
2111{ 2113{
2112 static int fd = ::open ( SIMPAD_BOARDCONTROL, O_RDWR | O_NONBLOCK ); 2114 static int fd = ::open ( SIMPAD_BOARDCONTROL, O_RDWR | O_NONBLOCK );
2113 2115
2114 if ( l == Led_Power ) { 2116 if ( l == Led_Power ) {
2115 if ( fd >= 0 ) { 2117 if ( fd >= 0 ) {
2116 LED_IN leds; 2118 LED_IN leds;
2117 ::memset ( &leds, 0, sizeof( leds )); 2119 ::memset ( &leds, 0, sizeof( leds ));
2118 leds. TotalTime = 0; 2120 leds. TotalTime = 0;
2119 leds. OnTime = 0; 2121 leds. OnTime = 0;
2120 leds. OffTime = 1; 2122 leds. OffTime = 1;
2121 leds. OffOnBlink = 2; 2123 leds. OffOnBlink = 2;
2122 2124
2123 switch ( st ) { 2125 switch ( st ) {
2124 case Led_Off : leds. OffOnBlink = 0; break; 2126 case Led_Off : leds. OffOnBlink = 0; break;
2125 case Led_On : leds. OffOnBlink = 1; break; 2127 case Led_On : leds. OffOnBlink = 1; break;
2126 case Led_BlinkSlow: leds. OnTime = 10; leds. OffTime = 10; break; 2128 case Led_BlinkSlow: leds. OnTime = 10; leds. OffTime = 10; break;
2127 case Led_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break; 2129 case Led_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break;
2128 } 2130 }
2129 2131
2130 { 2132 {
2131 /*TODO Implement this like that: 2133 /*TODO Implement this like that:
2132 read from cs3 2134 read from cs3
2133 && with SIMPAD_LED2_ON 2135 && with SIMPAD_LED2_ON
2134 write to cs3 */ 2136 write to cs3 */
2135 m_leds [0] = st; 2137 m_leds [0] = st;
2136 return true; 2138 return true;
2137 } 2139 }
2138 } 2140 }
2139 } 2141 }
2140 return false; 2142 return false;
2141} 2143}
2142 2144
2143 2145
2144bool SIMpad::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) 2146bool SIMpad::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat )
2145{ 2147{
2146 //TODO 2148 //TODO
2147 return false; 2149 return false;
2148} 2150}
2149 2151
2150void SIMpad::timerEvent ( QTimerEvent * ) 2152void SIMpad::timerEvent ( QTimerEvent * )
2151{ 2153{
2152 killTimer ( m_power_timer ); 2154 killTimer ( m_power_timer );
2153 m_power_timer = 0; 2155 m_power_timer = 0;
2154 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); 2156 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false );
2155 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); 2157 QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false );
2156} 2158}
2157 2159
2158 2160
2159void SIMpad::alarmSound ( ) 2161void SIMpad::alarmSound ( )
2160{ 2162{
2161#ifndef QT_NO_SOUND 2163#ifndef QT_NO_SOUND
2162 static Sound snd ( "alarm" ); 2164 static Sound snd ( "alarm" );
2163 int fd; 2165 int fd;
2164 int vol; 2166 int vol;
2165 bool vol_reset = false; 2167 bool vol_reset = false;
2166 2168
2167 if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) { 2169 if (( fd = ::open ( "/dev/sound/mixer", O_RDWR )) >= 0 ) {
2168 if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) { 2170 if ( ::ioctl ( fd, MIXER_READ( 0 ), &vol ) >= 0 ) {
2169 Config cfg ( "qpe" ); 2171 Config cfg ( "qpe" );
2170 cfg. setGroup ( "Volume" ); 2172 cfg. setGroup ( "Volume" );
2171 2173
2172 int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 ); 2174 int volalarm = cfg. readNumEntry ( "AlarmPercent", 50 );
2173 if ( volalarm < 0 ) 2175 if ( volalarm < 0 )
2174 volalarm = 0; 2176 volalarm = 0;
2175 else if ( volalarm > 100 ) 2177 else if ( volalarm > 100 )
2176 volalarm = 100; 2178 volalarm = 100;
2177 volalarm |= ( volalarm << 8 ); 2179 volalarm |= ( volalarm << 8 );
2178 2180
2179 if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 ) 2181 if ( ::ioctl ( fd, MIXER_WRITE( 0 ), &volalarm ) >= 0 )
2180 vol_reset = true; 2182 vol_reset = true;
2181 } 2183 }
2182 } 2184 }
2183 2185
2184 snd. play ( ); 2186 snd. play ( );
2185 while ( !snd. isFinished ( )) 2187 while ( !snd. isFinished ( ))
2186 qApp-> processEvents ( ); 2188 qApp-> processEvents ( );
2187 2189
2188 if ( fd >= 0 ) { 2190 if ( fd >= 0 ) {
2189 if ( vol_reset ) 2191 if ( vol_reset )
2190 ::ioctl ( fd, MIXER_WRITE( 0 ), &vol ); 2192 ::ioctl ( fd, MIXER_WRITE( 0 ), &vol );
2191 ::close ( fd ); 2193 ::close ( fd );
2192 } 2194 }
2193#endif 2195#endif
2194} 2196}
2195 2197
2196 2198
2197bool SIMpad::suspend ( ) // Must override because SIMpad does NOT have apm 2199bool SIMpad::suspend ( ) // Must override because SIMpad does NOT have apm
2198{ 2200{
2199 qDebug( "ODevice for SIMpad: suspend()" ); 2201 qDebug( "ODevice for SIMpad: suspend()" );
2200 if ( !isQWS( ) ) // only qwsserver is allowed to suspend 2202 if ( !isQWS( ) ) // only qwsserver is allowed to suspend
2201 return false; 2203 return false;
2202 2204
2203 bool res = false; 2205 bool res = false;
2204 2206
2205 struct timeval tvs, tvn; 2207 struct timeval tvs, tvn;
2206 ::gettimeofday ( &tvs, 0 ); 2208 ::gettimeofday ( &tvs, 0 );
2207 2209
2208 ::sync ( ); // flush fs caches 2210 ::sync ( ); // flush fs caches
2209 res = ( ::system ( "cat /dev/fb/0 >/tmp/.buffer; echo > /proc/sys/pm/suspend; cat /tmp/.buffer >/dev/fb/0" ) == 0 ); //TODO make better :) 2211 res = ( ::system ( "cat /dev/fb/0 >/tmp/.buffer; echo > /proc/sys/pm/suspend; cat /tmp/.buffer >/dev/fb/0" ) == 0 ); //TODO make better :)
2210 2212
2211 return res; 2213 return res;
2212} 2214}
2213 2215
2214 2216
2215bool SIMpad::setSoftSuspend ( bool soft ) 2217bool SIMpad::setSoftSuspend ( bool soft )
2216{ 2218{
2217 qDebug( "ODevice for SIMpad: UNHANDLED setSoftSuspend(%s)", soft? "on" : "off" ); 2219 qDebug( "ODevice for SIMpad: UNHANDLED setSoftSuspend(%s)", soft? "on" : "off" );
2218 return false; 2220 return false;
2219} 2221}
2220 2222
2221 2223
2222bool SIMpad::setDisplayStatus ( bool on ) 2224bool SIMpad::setDisplayStatus ( bool on )
2223{ 2225{
2224 qDebug( "ODevice for SIMpad: setDisplayStatus(%s)", on? "on" : "off" ); 2226 qDebug( "ODevice for SIMpad: setDisplayStatus(%s)", on? "on" : "off" );
2225 2227
2226 bool res = false; 2228 bool res = false;
2227 int fd; 2229 int fd;
2228 2230
2229 QString cmdline = QString().sprintf( "echo %s > /proc/cs3", on ? "0xd41a" : "0xd40a" ); //TODO make better :) 2231 QString cmdline = QString().sprintf( "echo %s > /proc/cs3", on ? "0xd41a" : "0xd40a" ); //TODO make better :)
2230 2232
2231 res = ( ::system( (const char*) cmdline ) == 0 ); 2233 res = ( ::system( (const char*) cmdline ) == 0 );
2232 2234
2233 return res; 2235 return res;
2234} 2236}
2235 2237
2236 2238
2237bool SIMpad::setDisplayBrightness ( int bright ) 2239bool SIMpad::setDisplayBrightness ( int bright )
2238{ 2240{
2239 qDebug( "ODevice for SIMpad: setDisplayBrightness( %d )", bright ); 2241 qDebug( "ODevice for SIMpad: setDisplayBrightness( %d )", bright );
2240 bool res = false; 2242 bool res = false;
2241 int fd; 2243 int fd;
2242 2244
2243 if ( bright > 255 ) 2245 if ( bright > 255 )
2244 bright = 255; 2246 bright = 255;
2245 if ( bright < 1 ) 2247 if ( bright < 1 )
2246 bright = 0; 2248 bright = 0;
2247 2249
2248 if (( fd = ::open ( SIMPAD_BACKLIGHT_CONTROL, O_WRONLY )) >= 0 ) { 2250 if (( fd = ::open ( SIMPAD_BACKLIGHT_CONTROL, O_WRONLY )) >= 0 ) {
2249 int value = 255 - bright; 2251 int value = 255 - bright;
2250 const int mask = SIMPAD_BACKLIGHT_MASK; 2252 const int mask = SIMPAD_BACKLIGHT_MASK;
2251 value = value << 8; 2253 value = value << 8;
2252 value += mask; 2254 value += mask;
2253 char writeCommand[100]; 2255 char writeCommand[100];
2254 const int count = sprintf( writeCommand, "0x%x\n", value ); 2256 const int count = sprintf( writeCommand, "0x%x\n", value );
2255 res = ( ::write ( fd, writeCommand, count ) != -1 ); 2257 res = ( ::write ( fd, writeCommand, count ) != -1 );
2256 ::close ( fd ); 2258 ::close ( fd );
2257 } 2259 }
2258 return res; 2260 return res;
2259} 2261}
2260 2262
2261 2263
2262int SIMpad::displayBrightnessResolution ( ) const 2264int SIMpad::displayBrightnessResolution ( ) const
2263{ 2265{
2264 return 255; // All SIMpad models share the same display 2266 return 255; // All SIMpad models share the same display
2265} 2267}
2266 2268
2267/************************************************** 2269/**************************************************
2268 * 2270 *
2269 * Ramses 2271 * Ramses
2270 * 2272 *
2271 **************************************************/ 2273 **************************************************/
2272 2274
2273void Ramses::init() 2275void Ramses::init()
2274{ 2276{
2275 d->m_vendorstr = "M und N"; 2277 d->m_vendorstr = "M und N";
2276 d->m_vendor = Vendor_MundN; 2278 d->m_vendor = Vendor_MundN;
2277 2279
2278 QFile f("/proc/sys/board/ramses"); 2280 QFile f("/proc/sys/board/ramses");
2279 2281
2280 d->m_modelstr = "Ramses"; 2282 d->m_modelstr = "Ramses";
2281 d->m_model = Model_Ramses_MNCI; 2283 d->m_model = Model_Ramses_MNCI;
2282 2284
2283 d->m_rotation = Rot0; 2285 d->m_rotation = Rot0;
2284 d->m_holdtime = 1000; 2286 d->m_holdtime = 1000;
2285 2287
2286 f.setName("/etc/oz_version"); 2288 f.setName("/etc/oz_version");
2287 2289
2288 if (f.open(IO_ReadOnly)) { 2290 if (f.open(IO_ReadOnly)) {
2289 d->m_systemstr = "OpenEmbedded/Ramses"; 2291 d->m_systemstr = "OpenEmbedded/Ramses";
2290 d->m_system = System_OpenZaurus; 2292 d->m_system = System_OpenZaurus;
2291 2293
2292 QTextStream ts(&f); 2294 QTextStream ts(&f);
2293 ts.setDevice(&f); 2295 ts.setDevice(&f);
2294 d->m_sysverstr = ts.readLine(); 2296 d->m_sysverstr = ts.readLine();
2295 f.close(); 2297 f.close();
2296 } 2298 }
2297 2299
2298 m_power_timer = 0; 2300 m_power_timer = 0;
2299 2301
2300#ifdef QT_QWS_ALLOW_OVERCLOCK 2302#ifdef QT_QWS_ALLOW_OVERCLOCK
2301#warning *** Overclocking enabled - this may fry your hardware - you have been warned *** 2303#warning *** Overclocking enabled - this may fry your hardware - you have been warned ***
2302#define OC(x...) x 2304#define OC(x...) x
2303#else 2305#else
2304#define OC(x...) 2306#define OC(x...)
2305#endif 2307#endif
2306 2308
2307 2309
2308 // This table is true for a Intel XScale PXA 255 2310 // This table is true for a Intel XScale PXA 255
2309 2311
2310 d->m_cpu_frequencies->append("99000"); // mem= 99, run= 99, turbo= 99, PXbus= 50 2312 d->m_cpu_frequencies->append("99000"); // mem= 99, run= 99, turbo= 99, PXbus= 50
2311 OC(d->m_cpu_frequencies->append("118000"); ) // mem=118, run=118, turbo=118, PXbus= 59 OC'd mem 2313 OC(d->m_cpu_frequencies->append("118000"); ) // mem=118, run=118, turbo=118, PXbus= 59 OC'd mem
2312 d->m_cpu_frequencies->append("199100"); // mem= 99, run=199, turbo=199, PXbus= 99 2314 d->m_cpu_frequencies->append("199100"); // mem= 99, run=199, turbo=199, PXbus= 99
2313 OC(d->m_cpu_frequencies->append("236000"); ) // mem=118, run=236, turbo=236, PXbus=118 OC'd mem 2315 OC(d->m_cpu_frequencies->append("236000"); ) // mem=118, run=236, turbo=236, PXbus=118 OC'd mem
2314 d->m_cpu_frequencies->append("298600"); // mem= 99, run=199, turbo=298, PXbus= 99 2316 d->m_cpu_frequencies->append("298600"); // mem= 99, run=199, turbo=298, PXbus= 99
2315 OC(d->m_cpu_frequencies->append("354000"); ) // mem=118, run=236, turbo=354, PXbus=118 OC'd mem 2317 OC(d->m_cpu_frequencies->append("354000"); ) // mem=118, run=236, turbo=354, PXbus=118 OC'd mem
2316 d->m_cpu_frequencies->append("398099"); // mem= 99, run=199, turbo=398, PXbus= 99 2318 d->m_cpu_frequencies->append("398099"); // mem= 99, run=199, turbo=398, PXbus= 99
2317 d->m_cpu_frequencies->append("398100"); // mem= 99, run=398, turbo=398, PXbus=196 2319 d->m_cpu_frequencies->append("398100"); // mem= 99, run=398, turbo=398, PXbus=196
2318 OC(d->m_cpu_frequencies->append("471000"); ) // mem=118, run=471, turbo=471, PXbus=236 OC'd mem/core/bus 2320 OC(d->m_cpu_frequencies->append("471000"); ) // mem=118, run=471, turbo=471, PXbus=236 OC'd mem/core/bus
2319 2321
2320} 2322}
2321 2323
2322bool Ramses::filter(int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat) 2324bool Ramses::filter(int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat)
2323{ 2325{
2324 Q_UNUSED( keycode ); 2326 Q_UNUSED( keycode );
2325 Q_UNUSED( modifiers ); 2327 Q_UNUSED( modifiers );
2326 Q_UNUSED( isPress ); 2328 Q_UNUSED( isPress );
2327 Q_UNUSED( autoRepeat ); 2329 Q_UNUSED( autoRepeat );
2328 return false; 2330 return false;
2329} 2331}
2330 2332
2331void Ramses::timerEvent(QTimerEvent *) 2333void Ramses::timerEvent(QTimerEvent *)
2332{ 2334{
2333 killTimer(m_power_timer); 2335 killTimer(m_power_timer);
2334 m_power_timer = 0; 2336 m_power_timer = 0;
2335 QWSServer::sendKeyEvent(-1, HardKey_Backlight, 0, true, false); 2337 QWSServer::sendKeyEvent(-1, HardKey_Backlight, 0, true, false);
2336 QWSServer::sendKeyEvent(-1, HardKey_Backlight, 0, false, false); 2338 QWSServer::sendKeyEvent(-1, HardKey_Backlight, 0, false, false);
2337} 2339}
2338 2340
2339 2341
2340bool Ramses::setSoftSuspend(bool soft) 2342bool Ramses::setSoftSuspend(bool soft)
2341{ 2343{
2342 qDebug("Ramses::setSoftSuspend(%d)", soft); 2344 qDebug("Ramses::setSoftSuspend(%d)", soft);
2343#if 0 2345#if 0
2344 bool res = false; 2346 bool res = false;
2345 int fd; 2347 int fd;
2346 2348
2347 if (((fd = ::open("/dev/apm_bios", O_RDWR)) >= 0) || 2349 if (((fd = ::open("/dev/apm_bios", O_RDWR)) >= 0) ||
2348 ((fd = ::open("/dev/misc/apm_bios",O_RDWR)) >= 0)) { 2350 ((fd = ::open("/dev/misc/apm_bios",O_RDWR)) >= 0)) {
2349 2351
2350 int sources = ::ioctl(fd, APM_IOCGEVTSRC, 0); // get current event sources 2352 int sources = ::ioctl(fd, APM_IOCGEVTSRC, 0); // get current event sources
2351 2353
2352 if (sources >= 0) { 2354 if (sources >= 0) {
2353 if (soft) 2355 if (soft)
2354 sources &= ~APM_EVT_POWER_BUTTON; 2356 sources &= ~APM_EVT_POWER_BUTTON;
2355 else 2357 else
2356 sources |= APM_EVT_POWER_BUTTON; 2358 sources |= APM_EVT_POWER_BUTTON;
2357 2359
2358 if (::ioctl(fd, APM_IOCSEVTSRC, sources) >= 0) // set new event sources 2360 if (::ioctl(fd, APM_IOCSEVTSRC, sources) >= 0) // set new event sources
2359 res = true; 2361 res = true;
2360 else 2362 else
2361 perror("APM_IOCGEVTSRC"); 2363 perror("APM_IOCGEVTSRC");
2362 } 2364 }
2363 else 2365 else
2364 perror("APM_IOCGEVTSRC"); 2366 perror("APM_IOCGEVTSRC");
2365 2367
2366 ::close(fd); 2368 ::close(fd);
2367 } 2369 }
2368 else 2370 else
2369 perror("/dev/apm_bios or /dev/misc/apm_bios"); 2371 perror("/dev/apm_bios or /dev/misc/apm_bios");
2370 2372
2371 return res; 2373 return res;
2372#else 2374#else
2373 return true; 2375 return true;
2374#endif 2376#endif
2375} 2377}
2376 2378
2377bool Ramses::suspend ( ) 2379bool Ramses::suspend ( )
2378{ 2380{
2379 qDebug("Ramses::suspend"); 2381 qDebug("Ramses::suspend");
2380 return false; 2382 return false;
2381} 2383}
2382 2384
2383/** 2385/**
2384 * This sets the display on or off 2386 * This sets the display on or off
2385 */ 2387 */
2386bool Ramses::setDisplayStatus(bool on) 2388bool Ramses::setDisplayStatus(bool on)
2387{ 2389{
2388 qDebug("Ramses::setDisplayStatus(%d)", on); 2390 qDebug("Ramses::setDisplayStatus(%d)", on);
2389#if 0 2391#if 0
2390 bool res = false; 2392 bool res = false;
2391 int fd; 2393 int fd;
2392 2394
2393 if ((fd = ::open ("/dev/fb/0", O_RDWR)) >= 0) { 2395 if ((fd = ::open ("/dev/fb/0", O_RDWR)) >= 0) {
2394 res = (::ioctl(fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN) == 0); 2396 res = (::ioctl(fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN) == 0);
2395 ::close(fd); 2397 ::close(fd);
2396 } 2398 }
2397 return res; 2399 return res;
2398#else 2400#else
2399 return true; 2401 return true;
2400#endif 2402#endif
2401} 2403}
2402 2404
2403 2405
2404/* 2406/*
2405 * We get something between 0..255 into us 2407 * We get something between 0..255 into us
2406*/ 2408*/
2407bool Ramses::setDisplayBrightness(int bright) 2409bool Ramses::setDisplayBrightness(int bright)
2408{ 2410{
2409 qDebug("Ramses::setDisplayBrightness(%d)", bright); 2411 qDebug("Ramses::setDisplayBrightness(%d)", bright);
2410 bool res = false; 2412 bool res = false;
2411 int fd; 2413 int fd;
2412 2414
2413 // pwm1 brighness: 20 steps 500..0 (dunkel->hell) 2415 // pwm1 brighness: 20 steps 500..0 (dunkel->hell)
2414 2416
2415 if (bright > 255 ) 2417 if (bright > 255 )
2416 bright = 255; 2418 bright = 255;
2417 if (bright < 0) 2419 if (bright < 0)
2418 bright = 0; 2420 bright = 0;
2419 2421
2420 // Turn backlight completely off 2422 // Turn backlight completely off
2421 if ((fd = ::open("/proc/sys/board/lcd_backlight", O_WRONLY)) >= 0) { 2423 if ((fd = ::open("/proc/sys/board/lcd_backlight", O_WRONLY)) >= 0) {
2422 char writeCommand[10]; 2424 char writeCommand[10];
2423 const int count = sprintf(writeCommand, "%d\n", bright ? 1 : 0); 2425 const int count = sprintf(writeCommand, "%d\n", bright ? 1 : 0);
2424 res = (::write(fd, writeCommand, count) != -1); 2426 res = (::write(fd, writeCommand, count) != -1);
2425 ::close(fd); 2427 ::close(fd);
2426 } 2428 }
2427 2429
2428 // scale backlight brightness to hardware 2430 // scale backlight brightness to hardware
2429 bright = 500-(bright * 500 / 255); 2431 bright = 500-(bright * 500 / 255);
2430 if ((fd = ::open("/proc/sys/board/pwm1", O_WRONLY)) >= 0) { 2432 if ((fd = ::open("/proc/sys/board/pwm1", O_WRONLY)) >= 0) {
2431 qDebug(" %d -> pwm1", bright); 2433 qDebug(" %d -> pwm1", bright);
2432 char writeCommand[100]; 2434 char writeCommand[100];
2433 const int count = sprintf(writeCommand, "%d\n", bright); 2435 const int count = sprintf(writeCommand, "%d\n", bright);
2434 res = (::write(fd, writeCommand, count) != -1); 2436 res = (::write(fd, writeCommand, count) != -1);
2435 ::close(fd); 2437 ::close(fd);
2436 } 2438 }
2437 return res; 2439 return res;
2438} 2440}
2439 2441
2440 2442
2441int Ramses::displayBrightnessResolution() const 2443int Ramses::displayBrightnessResolution() const
2442{ 2444{
2443 return 32; 2445 return 32;
2444} 2446}
2445 2447
2446bool Ramses::setDisplayContrast(int contr) 2448bool Ramses::setDisplayContrast(int contr)
2447{ 2449{
2448 qDebug("Ramses::setDisplayContrast(%d)", contr); 2450 qDebug("Ramses::setDisplayContrast(%d)", contr);
2449 bool res = false; 2451 bool res = false;
2450 int fd; 2452 int fd;
2451 2453
2452 // pwm0 contrast: 20 steps 79..90 (dunkel->hell) 2454 // pwm0 contrast: 20 steps 79..90 (dunkel->hell)
2453 2455
2454 if (contr > 255 ) 2456 if (contr > 255 )
2455 contr = 255; 2457 contr = 255;
2456 if (contr < 0) 2458 if (contr < 0)
2457 contr = 0; 2459 contr = 0;
2458 contr = 90 - (contr * 20 / 255); 2460 contr = 90 - (contr * 20 / 255);
2459 2461
2460 if ((fd = ::open("/proc/sys/board/pwm0", O_WRONLY)) >= 0) { 2462 if ((fd = ::open("/proc/sys/board/pwm0", O_WRONLY)) >= 0) {
2461 qDebug(" %d -> pwm0", contr); 2463 qDebug(" %d -> pwm0", contr);
2462 char writeCommand[100]; 2464 char writeCommand[100];
2463 const int count = sprintf(writeCommand, "%d\n", contr); 2465 const int count = sprintf(writeCommand, "%d\n", contr);
2464 res = (::write(fd, writeCommand, count) != -1); 2466 res = (::write(fd, writeCommand, count) != -1);
2465 res = true; 2467 res = true;
2466 ::close(fd); 2468 ::close(fd);
2467 } 2469 }
2468 return res; 2470 return res;
2469} 2471}
2470 2472
2471 2473
2472int Ramses::displayContrastResolution() const 2474int Ramses::displayContrastResolution() const
2473{ 2475{
2474 return 20; 2476 return 20;
2475} 2477}
2476 2478
2477 2479
2478/************************************************** 2480/**************************************************
2479 * * 2481 * *
2480 * Jornada * 2482 * Jornada *
2481 * * 2483 * *
2482 **************************************************/ 2484 **************************************************/
2483 2485
2484 2486
2485bool Jornada::isJornada ( ) 2487bool Jornada::isJornada ( )
2486{ 2488{
2487 QFile f( "/proc/cpuinfo" ); 2489 QFile f( "/proc/cpuinfo" );
2488 if ( f. open ( IO_ReadOnly ) ) { 2490 if ( f. open ( IO_ReadOnly ) ) {
2489 QTextStream ts ( &f ); 2491 QTextStream ts ( &f );
2490 QString line; 2492 QString line;
2491 while( line = ts. readLine ( ) ) { 2493 while( line = ts. readLine ( ) ) {
2492 if ( line. left ( 8 ) == "Hardware" ) { 2494 if ( line. left ( 8 ) == "Hardware" ) {
2493 int loc = line. find ( ":" ); 2495 int loc = line. find ( ":" );
2494 if ( loc != -1 ) { 2496 if ( loc != -1 ) {
2495 QString model = 2497 QString model =
2496 line. mid ( loc + 2 ). simplifyWhiteSpace( ); 2498 line. mid ( loc + 2 ). simplifyWhiteSpace( );
2497 return ( model == "HP Jornada 56x" ); 2499 return ( model == "HP Jornada 56x" );
2498 } 2500 }
2499 } 2501 }
2500 } 2502 }
2501 } 2503 }
2502 return false; 2504 return false;
2503} 2505}
2504 2506
2505void Jornada::init ( ) 2507void Jornada::init ( )
2506{ 2508{
2507 d-> m_vendorstr = "HP"; 2509 d-> m_vendorstr = "HP";
2508 d-> m_vendor = Vendor_HP; 2510 d-> m_vendor = Vendor_HP;
2509 d-> m_modelstr = "Jornada 56x"; 2511 d-> m_modelstr = "Jornada 56x";
2510 d-> m_model = Model_Jornada_56x; 2512 d-> m_model = Model_Jornada_56x;
2511 d-> m_systemstr = "Familiar"; 2513 d-> m_systemstr = "Familiar";
2512 d-> m_system = System_Familiar; 2514 d-> m_system = System_Familiar;
2513 d-> m_rotation = Rot0; 2515 d-> m_rotation = Rot0;
2514 2516
2515 QFile f ( "/etc/familiar-version" ); 2517 QFile f ( "/etc/familiar-version" );
2516 f. setName ( "/etc/familiar-version" ); 2518 f. setName ( "/etc/familiar-version" );
2517 if ( f. open ( IO_ReadOnly )) { 2519 if ( f. open ( IO_ReadOnly )) {
2518 2520
2519 QTextStream ts ( &f ); 2521 QTextStream ts ( &f );
2520 d-> m_sysverstr = ts. readLine ( ). mid ( 10 ); 2522 d-> m_sysverstr = ts. readLine ( ). mid ( 10 );
2521 2523
2522 f. close ( ); 2524 f. close ( );
2523 } 2525 }
2524} 2526}
2525 2527
2526#if 0 2528#if 0
2527void Jornada::initButtons ( ) 2529void Jornada::initButtons ( )
2528{ 2530{
2529 if ( d-> m_buttons ) 2531 if ( d-> m_buttons )
2530 return; 2532 return;
2531 2533
2532 // Simulation uses iPAQ 3660 device buttons 2534 // Simulation uses iPAQ 3660 device buttons
2533 2535
2534 qDebug ( "init Buttons" ); 2536 qDebug ( "init Buttons" );
2535 d-> m_buttons = new QValueList <ODeviceButton>; 2537 d-> m_buttons = new QValueList <ODeviceButton>;
2536 2538
2537 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { 2539 for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) {
2538 i_button *ib = ipaq_buttons + i; 2540 i_button *ib = ipaq_buttons + i;
2539 ODeviceButton b; 2541 ODeviceButton b;
2540 2542
2541 if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { 2543 if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) {
2542 b. setKeycode ( ib-> code ); 2544 b. setKeycode ( ib-> code );
2543 b. setUserText ( QObject::tr ( "Button", ib-> utext )); 2545 b. setUserText ( QObject::tr ( "Button", ib-> utext ));
2544 b. setPixmap ( Resource::loadPixmap ( ib-> pix )); 2546 b. setPixmap ( Resource::loadPixmap ( ib-> pix ));
2545 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); 2547 b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction ));
2546 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); 2548 b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction ));
2547 d-> m_buttons-> append ( b ); 2549 d-> m_buttons-> append ( b );
2548 } 2550 }
2549 } 2551 }
2550 reloadButtonMapping ( ); 2552 reloadButtonMapping ( );
2551 2553
2552 QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); 2554 QCopChannel *sysch = new QCopChannel ( "QPE/System", this );
2553 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); 2555 connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & )));
2554} 2556}
2555#endif 2557#endif
2556int Jornada::displayBrightnessResolution ( ) const 2558int Jornada::displayBrightnessResolution ( ) const
2557{ 2559{
2558} 2560}
2559 2561
2560bool Jornada::setDisplayBrightness ( int bright ) 2562bool Jornada::setDisplayBrightness ( int bright )
2561{ 2563{
2562 bool res = false; 2564 bool res = false;
2563 int fd; 2565 int fd;
2564 2566
2565 if ( bright > 255 ) 2567 if ( bright > 255 )
2566 bright = 255; 2568 bright = 255;
2567 if ( bright < 0 ) 2569 if ( bright < 0 )
2568 bright = 0; 2570 bright = 0;
2569 2571
2570 if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) { 2572 if (( fd = ::open ( "/dev/touchscreen/0", O_WRONLY )) >= 0 ) {
2571 FLITE_IN bl; 2573 FLITE_IN bl;
2572 bl. mode = 1; 2574 bl. mode = 1;
2573 bl. pwr = bright ? 1 : 0; 2575 bl. pwr = bright ? 1 : 0;
2574 bl. brightness = ( bright * ( displayBrightnessResolution ( ) - 1 ) + 127 ) / 255; 2576 bl. brightness = ( bright * ( displayBrightnessResolution ( ) - 1 ) + 127 ) / 255;
2575 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 ); 2577 res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 );
2576 ::close ( fd ); 2578 ::close ( fd );
2577 } 2579 }
2578 return res; 2580 return res;
2579} 2581}
2580 2582
2581bool Jornada::setSoftSuspend ( bool soft ) 2583bool Jornada::setSoftSuspend ( bool soft )
2582{ 2584{
2583 bool res = false; 2585 bool res = false;
2584 int fd; 2586 int fd;
2585 2587
2586 if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) { 2588 if (( fd = ::open ( "/proc/sys/ts/suspend_button_mode", O_WRONLY )) >= 0 ) {
2587 if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 ) 2589 if ( ::write ( fd, soft ? "1" : "0", 1 ) == 1 )
2588 res = true; 2590 res = true;
2589 else 2591 else
2590 ::perror ( "write to /proc/sys/ts/suspend_button_mode" ); 2592 ::perror ( "write to /proc/sys/ts/suspend_button_mode" );
2591 2593
2592 ::close ( fd ); 2594 ::close ( fd );
2593 } 2595 }
2594 else 2596 else
2595 ::perror ( "/proc/sys/ts/suspend_button_mode" ); 2597 ::perror ( "/proc/sys/ts/suspend_button_mode" );
2596 2598
2597 return res; 2599 return res;
2598} 2600}
diff --git a/library/filemanager.cpp b/library/filemanager.cpp
index cc657fa..91986a0 100644
--- a/library/filemanager.cpp
+++ b/library/filemanager.cpp
@@ -1,341 +1,384 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "filemanager.h" 20#include "filemanager.h"
21#include "applnk.h" 21#include "applnk.h"
22 22
23#include <qdir.h> 23#include <qdir.h>
24#include <qfile.h> 24#include <qfile.h>
25#include <qfileinfo.h> 25#include <qfileinfo.h>
26#include <qtextstream.h> 26#include <qtextstream.h>
27#include <qtextcodec.h> 27#include <qtextcodec.h>
28 28
29#include <errno.h> 29#include <errno.h>
30#include <stdlib.h> 30#include <stdlib.h>
31#include <unistd.h> 31#include <unistd.h>
32#include <sys/stat.h> 32#include <sys/stat.h>
33#include <dirent.h> 33#include <dirent.h>
34#include <sys/sendfile.h> 34#ifdef Q_OS_MACX
35// MacOS X does not have sendfile.. :(
36// But maybe in the future.. !?
37# ifdef SENDFILE
38# include <sys/types.h>
39# include <sys/socket.h>
40# endif
41#else
42# include <sys/sendfile.h>
43#endif /* Q_OS_MACX */
35#include <fcntl.h> 44#include <fcntl.h>
36 45
37/*! 46/*!
38 \class FileManager 47 \class FileManager
39 \brief The FileManager class assists with AppLnk input/output. 48 \brief The FileManager class assists with AppLnk input/output.
40*/ 49*/
41 50
42/*! 51/*!
43 Constructs a FileManager. 52 Constructs a FileManager.
44*/ 53*/
45FileManager::FileManager() 54FileManager::FileManager()
46{ 55{
47} 56}
48 57
49/*! 58/*!
50 Destroys a FileManager. 59 Destroys a FileManager.
51*/ 60*/
52FileManager::~FileManager() 61FileManager::~FileManager()
53{ 62{
54 63
55} 64}
56 65
57/*! 66/*!
58 Saves \a data as the document specified by \a f. 67 Saves \a data as the document specified by \a f.
59 68
60 Returns whether the operation succeeded. 69 Returns whether the operation succeeded.
61*/ 70*/
62bool FileManager::saveFile( const DocLnk &f, const QByteArray &data ) 71bool FileManager::saveFile( const DocLnk &f, const QByteArray &data )
63{ 72{
64 QString fn = f.file() + ".new"; 73 QString fn = f.file() + ".new";
65 ensurePathExists( fn ); 74 ensurePathExists( fn );
66 QFile fl( fn ); 75 QFile fl( fn );
67 if ( !fl.open( IO_WriteOnly|IO_Raw ) ) { 76 if ( !fl.open( IO_WriteOnly|IO_Raw ) ) {
68 qWarning("open failed"); 77 qWarning("open failed");
69 return FALSE; 78 return FALSE;
70 } 79 }
71 int total_written = fl.writeBlock( data ); 80 int total_written = fl.writeBlock( data );
72 fl.close(); 81 fl.close();
73 if ( total_written != int(data.size()) || !f.writeLink() ) { 82 if ( total_written != int(data.size()) || !f.writeLink() ) {
74 QFile::remove( fn ); 83 QFile::remove( fn );
75 return FALSE; 84 return FALSE;
76 } 85 }
77 qDebug("total written %d out of %d", total_written, data.size()); 86 qDebug("total written %d out of %d", total_written, data.size());
78 // else rename the file... 87 // else rename the file...
79 if ( !renameFile( fn.latin1(), f.file().latin1() ) ) { 88 if ( !renameFile( fn.latin1(), f.file().latin1() ) ) {
80 qWarning( "problem renaming file %s to %s, errno: %d", fn.latin1(), 89 qWarning( "problem renaming file %s to %s, errno: %d", fn.latin1(),
81 f.file().latin1(), errno ); 90 f.file().latin1(), errno );
82 // remove the file... 91 // remove the file...
83 } 92 }
84 return TRUE; 93 return TRUE;
85} 94}
86 95
87/*! 96/*!
88 Saves \a text as the document specified by \a f. 97 Saves \a text as the document specified by \a f.
89 98
90 The text is saved in UTF8 format. 99 The text is saved in UTF8 format.
91 100
92 Returns whether the operation succeeded. 101 Returns whether the operation succeeded.
93*/ 102*/
94bool FileManager::saveFile( const DocLnk &f, const QString &text ) 103bool FileManager::saveFile( const DocLnk &f, const QString &text )
95{ 104{
96 QString fn = f.file() + ".new"; 105 QString fn = f.file() + ".new";
97 ensurePathExists( fn ); 106 ensurePathExists( fn );
98 QFile fl( fn ); 107 QFile fl( fn );
99 if ( !fl.open( IO_WriteOnly|IO_Raw ) ) { 108 if ( !fl.open( IO_WriteOnly|IO_Raw ) ) {
100 qWarning("open failed"); 109 qWarning("open failed");
101 return FALSE; 110 return FALSE;
102 } 111 }
103 112
104 QCString cstr = text.utf8(); 113 QCString cstr = text.utf8();
105 int total_written; 114 int total_written;
106 total_written = fl.writeBlock( cstr.data(), cstr.length() ); 115 total_written = fl.writeBlock( cstr.data(), cstr.length() );
107 fl.close(); 116 fl.close();
108 if ( total_written != int(cstr.length()) || !f.writeLink() ) { 117 if ( total_written != int(cstr.length()) || !f.writeLink() ) {
109 QFile::remove( fn ); 118 QFile::remove( fn );
110 return FALSE; 119 return FALSE;
111 } 120 }
112 // okay now rename the file.. 121 // okay now rename the file..
113 if ( !renameFile( fn.latin1(), f.file().latin1() ) ) { 122 if ( !renameFile( fn.latin1(), f.file().latin1() ) ) {
114 qWarning( "problem renaming file %s to %s, errno: %d", fn.latin1(), 123 qWarning( "problem renaming file %s to %s, errno: %d", fn.latin1(),
115 f.file().latin1(), errno ); 124 f.file().latin1(), errno );
116 125
117 } 126 }
118 return TRUE; 127 return TRUE;
119} 128}
120 129
121 130
122/*! 131/*!
123 Loads \a text from the document specified by \a f. 132 Loads \a text from the document specified by \a f.
124 133
125 The text is required to be in UTF8 format. 134 The text is required to be in UTF8 format.
126 135
127 Returns whether the operation succeeded. 136 Returns whether the operation succeeded.
128*/ 137*/
129bool FileManager::loadFile( const DocLnk &f, QString &text ) 138bool FileManager::loadFile( const DocLnk &f, QString &text )
130{ 139{
131 QString fn = f.file(); 140 QString fn = f.file();
132 QFile fl( fn ); 141 QFile fl( fn );
133 if ( !fl.open( IO_ReadOnly ) ) 142 if ( !fl.open( IO_ReadOnly ) )
134 return FALSE; 143 return FALSE;
135 QTextStream ts( &fl ); 144 QTextStream ts( &fl );
136#if QT_VERSION <= 230 && defined(QT_NO_CODECS) 145#if QT_VERSION <= 230 && defined(QT_NO_CODECS)
137 // The below should work, but doesn't in Qt 2.3.0 146 // The below should work, but doesn't in Qt 2.3.0
138 ts.setCodec( QTextCodec::codecForMib( 106 ) ); 147 ts.setCodec( QTextCodec::codecForMib( 106 ) );
139#else 148#else
140 ts.setEncoding( QTextStream::UnicodeUTF8 ); 149 ts.setEncoding( QTextStream::UnicodeUTF8 );
141#endif 150#endif
142 text = ts.read(); 151 text = ts.read();
143 fl.close(); 152 fl.close();
144 return TRUE; 153 return TRUE;
145} 154}
146 155
147 156
148/*! 157/*!
149 Loads \a ba from the document specified by \a f. 158 Loads \a ba from the document specified by \a f.
150 159
151 Returns whether the operation succeeded. 160 Returns whether the operation succeeded.
152*/ 161*/
153bool FileManager::loadFile( const DocLnk &f, QByteArray &ba ) 162bool FileManager::loadFile( const DocLnk &f, QByteArray &ba )
154{ 163{
155 QString fn = f.file(); 164 QString fn = f.file();
156 QFile fl( fn ); 165 QFile fl( fn );
157 if ( !fl.open( IO_ReadOnly ) ) 166 if ( !fl.open( IO_ReadOnly ) )
158 return FALSE; 167 return FALSE;
159 ba.resize( fl.size() ); 168 ba.resize( fl.size() );
160 if ( fl.size() > 0 ) 169 if ( fl.size() > 0 )
161 fl.readBlock( ba.data(), fl.size() ); 170 fl.readBlock( ba.data(), fl.size() );
162 fl.close(); 171 fl.close();
163 return TRUE; 172 return TRUE;
164} 173}
165 174
166/*! 175/*!
167 Copies the document specified by \a src to the document specified 176 Copies the document specified by \a src to the document specified
168 by \a dest. 177 by \a dest.
169 178
170 Returns whether the operation succeeded. 179 Returns whether the operation succeeded.
171*/ 180*/
172bool FileManager::copyFile( const AppLnk &src, const AppLnk &dest ) 181bool FileManager::copyFile( const AppLnk &src, const AppLnk &dest )
173{ 182{
174 QFile sf( src.file() ); 183 QFile sf( src.file() );
175 if ( !sf.open( IO_ReadOnly ) ) 184 if ( !sf.open( IO_ReadOnly ) )
176 return FALSE; 185 return FALSE;
177 186
178 QString fn = dest.file() + ".new"; 187 QString fn = dest.file() + ".new";
179 ensurePathExists( fn ); 188 ensurePathExists( fn );
180 QFile df( fn ); 189 QFile df( fn );
181 if ( !df.open( IO_WriteOnly|IO_Raw ) ) 190 if ( !df.open( IO_WriteOnly|IO_Raw ) )
182 return FALSE; 191 return FALSE;
183 192
184 const int bufsize = 16384; 193 const int bufsize = 16384;
185 char buffer[bufsize]; 194 char buffer[bufsize];
186 bool ok = TRUE; 195 bool ok = TRUE;
187 int bytesRead = 0; 196 int bytesRead = 0;
188 while ( ok && !sf.atEnd() ) { 197 while ( ok && !sf.atEnd() ) {
189 bytesRead = sf.readBlock( buffer, bufsize ); 198 bytesRead = sf.readBlock( buffer, bufsize );
190 if ( bytesRead < 0 ) 199 if ( bytesRead < 0 )
191 ok = FALSE; 200 ok = FALSE;
192 while ( ok && bytesRead > 0 ) { 201 while ( ok && bytesRead > 0 ) {
193 int bytesWritten = df.writeBlock( buffer, bytesRead ); 202 int bytesWritten = df.writeBlock( buffer, bytesRead );
194 if ( bytesWritten < 0 ) 203 if ( bytesWritten < 0 )
195 ok = FALSE; 204 ok = FALSE;
196 else 205 else
197 bytesRead -= bytesWritten; 206 bytesRead -= bytesWritten;
198 } 207 }
199 } 208 }
200 209
201 if ( ok ) 210 if ( ok )
202 ok = dest.writeLink(); 211 ok = dest.writeLink();
203 212
204 if ( ok ) { 213 if ( ok ) {
205 // okay now rename the file... 214 // okay now rename the file...
206 if ( !renameFile( fn.latin1(), dest.file().latin1() ) ) { 215 if ( !renameFile( fn.latin1(), dest.file().latin1() ) ) {
207 qWarning( "problem renaming file %s to %s, errno: %d", fn.latin1(), 216 qWarning( "problem renaming file %s to %s, errno: %d", fn.latin1(),
208 dest.file().latin1(), errno ); 217 dest.file().latin1(), errno );
209 // remove the tmp file, otherwise, it will just lay around... 218 // remove the tmp file, otherwise, it will just lay around...
210 QFile::remove( fn.latin1() ); 219 QFile::remove( fn.latin1() );
211 } 220 }
212 } else { 221 } else {
213 QFile::remove( fn.latin1() ); 222 QFile::remove( fn.latin1() );
214 } 223 }
215 224
216 return ok; 225 return ok;
217} 226}
218 227
228
229
219bool FileManager::copyFile( const QString & src, const QString & dest ) { 230bool FileManager::copyFile( const QString & src, const QString & dest ) {
220 bool success = true; 231 bool success = true;
221 struct stat status; 232 struct stat status;
222 int read_fd=0; 233 int read_fd=0;
223 int write_fd=0; 234 int write_fd=0;
224 struct stat stat_buf; 235 struct stat stat_buf;
225 off_t offset = 0; 236 off_t offset = 0;
226 QFile srcFile(src); 237 QFile srcFile(src);
227 QFile destFile(dest); 238 QFile destFile(dest);
228 239
229 if(!srcFile.open( IO_ReadOnly|IO_Raw)) { 240 if(!srcFile.open( IO_ReadOnly|IO_Raw)) {
230 return success = false; 241 return success = false;
231 } 242 }
232 read_fd = srcFile.handle(); 243 read_fd = srcFile.handle();
233 if(read_fd != -1) { 244 if(read_fd != -1) {
234 fstat (read_fd, &stat_buf); 245 fstat (read_fd, &stat_buf);
235 if( !destFile.open( IO_WriteOnly|IO_Raw ) ) 246 if( !destFile.open( IO_WriteOnly|IO_Raw ) )
236 return success = false; 247 return success = false;
237 write_fd = destFile.handle(); 248 write_fd = destFile.handle();
238 if(write_fd != -1) { 249 if(write_fd != -1) {
239 int err=0; 250 int err=0;
240 QString msg; 251 QString msg;
241 err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size); 252#ifdef Q_OS_MACX
242 if( err == -1) { 253#ifdef SENDMAIL
243 switch(err) { 254 /* FreeBSD does support a different kind of
244 case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. "; 255 * sendfile. (eilers)
245 case EINVAL: msg = "Descriptor is not valid or locked. "; 256 * I took this from Very Secure FTPd
246 case ENOMEM: msg = "Insufficient memory to read from in_fd."; 257 * Licence: GPL
247 case EIO: msg = "Unspecified error while reading from in_fd."; 258 * Author: Chris Evans
248 }; 259 * sysdeputil.c
249 success = false; 260 */
250 } 261 /* XXX - start_pos will truncate on 32-bit machines - can we
251 } else { 262 * say "start from current pos"?
263 */
264 off_t written = 0;
265 int retval = 0;
266 retval = sendfile(read_fd, write_fd, offset, stat_buf.st_size, NULL,
267 &written, 0);
268 /* Translate to Linux-like retval */
269 if (written > 0)
270 {
271 err = (int) written;
272 }
273#else /* SENDMAIL */
274 err == -1;
275 msg = "FAILURE: Using unsupported function \"sendfile()\" Need Workaround !!";
276 success = false;
277# warning "Need workaround for sendfile!!(eilers)"
278#endif /* SENDMAIL */
279
280#else
281 err = sendfile(write_fd, read_fd, &offset, stat_buf.st_size);
282 if( err == -1) {
283 switch(err) {
284 case EBADF : msg = "The input file was not opened for reading or the output file was not opened for writing. ";
285 case EINVAL: msg = "Descriptor is not valid or locked. ";
286 case ENOMEM: msg = "Insufficient memory to read from in_fd.";
287 case EIO: msg = "Unspecified error while reading from in_fd.";
288 };
289 success = false;
290 }
291#endif /* Q_OS_MACX */
292 if( !success )
293 qWarning( msg );
294 } else {
252 qWarning("open write failed %s, %s",src.latin1(), dest.latin1()); 295 qWarning("open write failed %s, %s",src.latin1(), dest.latin1());
253 success = false; 296 success = false;
254 } 297 }
255 } else { 298 } else {
256 qWarning("open read failed %s, %s",src.latin1(), dest.latin1()); 299 qWarning("open read failed %s, %s",src.latin1(), dest.latin1());
257 success = false; 300 success = false;
258 } 301 }
259 srcFile.close(); 302 srcFile.close();
260 destFile.close(); 303 destFile.close();
261 // Set file permissions 304 // Set file permissions
262 if( stat( (const char *) src, &status ) == 0 ) { 305 if( stat( (const char *) src, &status ) == 0 ) {
263 chmod( (const char *) dest, status.st_mode ); 306 chmod( (const char *) dest, status.st_mode );
264 } 307 }
265 308
266 return success; 309 return success;
267} 310}
268 311
269 312
270bool FileManager::renameFile( const QString & src, const QString & dest ) { 313bool FileManager::renameFile( const QString & src, const QString & dest ) {
271 if(copyFile( src, dest )) { 314 if(copyFile( src, dest )) {
272 if(QFile::remove(src) ) { 315 if(QFile::remove(src) ) {
273 return true; 316 return true;
274 } 317 }
275 } 318 }
276 return false; 319 return false;
277} 320}
278 321
279 322
280/*! 323/*!
281 Opens the document specified by \a f as a readable QIODevice. 324 Opens the document specified by \a f as a readable QIODevice.
282 The caller must delete the return value. 325 The caller must delete the return value.
283 326
284 Returns 0 if the operation fails. 327 Returns 0 if the operation fails.
285*/ 328*/
286QIODevice* FileManager::openFile( const DocLnk& f ) 329QIODevice* FileManager::openFile( const DocLnk& f )
287{ 330{
288 QString fn = f.file(); 331 QString fn = f.file();
289 QFile* fl = new QFile( fn ); 332 QFile* fl = new QFile( fn );
290 if ( !fl->open( IO_ReadOnly ) ) { 333 if ( !fl->open( IO_ReadOnly ) ) {
291 delete fl; 334 delete fl;
292 fl = 0; 335 fl = 0;
293 } 336 }
294 return fl; 337 return fl;
295} 338}
296 339
297/*! 340/*!
298 Opens the document specified by \a f as a writable QIODevice. 341 Opens the document specified by \a f as a writable QIODevice.
299 The caller must delete the return value. 342 The caller must delete the return value.
300 343
301 Returns 0 if the operation fails. 344 Returns 0 if the operation fails.
302*/ 345*/
303QIODevice* FileManager::saveFile( const DocLnk& f ) 346QIODevice* FileManager::saveFile( const DocLnk& f )
304{ 347{
305 QString fn = f.file(); 348 QString fn = f.file();
306 ensurePathExists( fn ); 349 ensurePathExists( fn );
307 QFile* fl = new QFile( fn ); 350 QFile* fl = new QFile( fn );
308 if ( fl->open( IO_WriteOnly ) ) { 351 if ( fl->open( IO_WriteOnly ) ) {
309 f.writeLink(); 352 f.writeLink();
310 } else { 353 } else {
311 delete fl; 354 delete fl;
312 fl = 0; 355 fl = 0;
313 } 356 }
314 return fl; 357 return fl;
315} 358}
316 359
317/*! 360/*!
318 Returns whether the document specified by \a f current exists 361 Returns whether the document specified by \a f current exists
319 as a file on disk. 362 as a file on disk.
320*/ 363*/
321bool FileManager::exists( const DocLnk &f ) 364bool FileManager::exists( const DocLnk &f )
322{ 365{
323 return QFile::exists(f.file()); 366 return QFile::exists(f.file());
324} 367}
325 368
326 369
327/*! 370/*!
328 Ensures that the path \a fn exists, by creating required directories. 371 Ensures that the path \a fn exists, by creating required directories.
329 Returns TRUE if successful. 372 Returns TRUE if successful.
330*/ 373*/
331bool FileManager::ensurePathExists( const QString &fn ) 374bool FileManager::ensurePathExists( const QString &fn )
332{ 375{
333 QFileInfo fi(fn); 376 QFileInfo fi(fn);
334 fi.setFile( fi.dirPath(TRUE) ); 377 fi.setFile( fi.dirPath(TRUE) );
335 if ( !fi.exists() ) { 378 if ( !fi.exists() ) {
336 if ( system(("mkdir -p "+fi.filePath())) ) 379 if ( system(("mkdir -p "+fi.filePath())) )
337 return FALSE; 380 return FALSE;
338 } 381 }
339 382
340 return TRUE; 383 return TRUE;
341} 384}
diff --git a/library/fontdatabase.cpp b/library/fontdatabase.cpp
index c7a5211..2ad8e95 100644
--- a/library/fontdatabase.cpp
+++ b/library/fontdatabase.cpp
@@ -1,249 +1,253 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include <qpe/qpeapplication.h> 21#include <qpe/qpeapplication.h>
22#include "fontfactoryinterface.h" 22#include "fontfactoryinterface.h"
23#include "fontdatabase.h" 23#include "fontdatabase.h"
24 24
25#include <qpe/qlibrary.h> 25#include <qpe/qlibrary.h>
26 26
27#include <qfontmanager_qws.h> 27#include <qfontmanager_qws.h>
28#include <qdir.h> 28#include <qdir.h>
29#include <qdict.h> 29#include <qdict.h>
30#include <stdio.h> 30#include <stdio.h>
31#include <stdlib.h> 31#include <stdlib.h>
32 32
33static QString fontDir() 33static QString fontDir()
34{ 34{
35 QString qtdir = getenv("QTDIR"); 35 QString qtdir = getenv("QTDIR");
36 if ( qtdir.isEmpty() ) qtdir = "/usr/local/qt-embedded"; 36 if ( qtdir.isEmpty() ) qtdir = "/usr/local/qt-embedded";
37 return qtdir+"/lib/fonts/"; 37 return qtdir+"/lib/fonts/";
38} 38}
39 39
40#ifdef QT_NO_FONTDATABASE 40#ifdef QT_NO_FONTDATABASE
41static QString fontFamily( const QString& key ) 41static QString fontFamily( const QString& key )
42{ 42{
43 int u0 = key.find('_'); 43 int u0 = key.find('_');
44 int u1 = key.find('_',u0+1); 44 int u1 = key.find('_',u0+1);
45 int u2 = key.find('_',u1+1); 45 int u2 = key.find('_',u1+1);
46 QString family = key.left(u0); 46 QString family = key.left(u0);
47 //int pointSize = key.mid(u0+1,u1-u0-1).toInt(); 47 //int pointSize = key.mid(u0+1,u1-u0-1).toInt();
48 //int weight = key.mid(u1+1,u2-u1-1).toInt(); 48 //int weight = key.mid(u1+1,u2-u1-1).toInt();
49 //bool italic = key.mid(u2-1,1) == "i"; 49 //bool italic = key.mid(u2-1,1) == "i";
50 // #### ignores _t and _I fields 50 // #### ignores _t and _I fields
51 return family; 51 return family;
52} 52}
53#endif 53#endif
54 54
55 55
56QValueList<FontFactory> *FontDatabase::factoryList = 0; 56QValueList<FontFactory> *FontDatabase::factoryList = 0;
57/*! 57/*!
58 \class FontDatabase fontdatabase.h 58 \class FontDatabase fontdatabase.h
59 \brief The FontDatabase class provides information about available fonts. 59 \brief The FontDatabase class provides information about available fonts.
60 60
61 Most often you will simply want to query the database for the 61 Most often you will simply want to query the database for the
62 available font families(). 62 available font families().
63 63
64 Use FontDatabase rather than QFontDatabase when you may need access 64 Use FontDatabase rather than QFontDatabase when you may need access
65 to fonts that are not normally available. For example, if the 65 to fonts that are not normally available. For example, if the
66 freetype library and the Qtopia freetype plugin are installed, 66 freetype library and the Qtopia freetype plugin are installed,
67 TrueType fonts will be available to your application. Font renderer 67 TrueType fonts will be available to your application. Font renderer
68 plugins have greater resource requirements than system fonts so they 68 plugins have greater resource requirements than system fonts so they
69 should be used only when necessary. You can force the loading of 69 should be used only when necessary. You can force the loading of
70 font renderer plugins with loadRenderers(). 70 font renderer plugins with loadRenderers().
71 71
72 \ingroup qtopiaemb 72 \ingroup qtopiaemb
73*/ 73*/
74 74
75/*! 75/*!
76 Constructs a FontDatabase object. 76 Constructs a FontDatabase object.
77*/ 77*/
78FontDatabase::FontDatabase() 78FontDatabase::FontDatabase()
79#ifndef QT_NO_FONTDATABASE 79#ifndef QT_NO_FONTDATABASE
80 : QFontDatabase() 80 : QFontDatabase()
81#endif 81#endif
82{ 82{
83 if ( !factoryList ) 83 if ( !factoryList )
84 loadRenderers(); 84 loadRenderers();
85} 85}
86 86
87/*! 87/*!
88 Returns a list of names of all the available font families. 88 Returns a list of names of all the available font families.
89*/ 89*/
90QStringList FontDatabase::families() const 90QStringList FontDatabase::families() const
91{ 91{
92#ifndef QT_NO_FONTDATABASE 92#ifndef QT_NO_FONTDATABASE
93 return QFontDatabase::families(); 93 return QFontDatabase::families();
94#else 94#else
95 95
96#ifndef QWS 96#ifndef QWS
97 QStringList list; 97 QStringList list;
98 return list; 98 return list;
99#else 99#else
100 QStringList list; 100 QStringList list;
101 QDict<void> familyDict; 101 QDict<void> familyDict;
102 QDiskFont *qdf; 102 QDiskFont *qdf;
103 for ( qdf=qt_fontmanager->diskfonts.first(); qdf!=0; 103 for ( qdf=qt_fontmanager->diskfonts.first(); qdf!=0;
104 qdf=qt_fontmanager->diskfonts.next()) { 104 qdf=qt_fontmanager->diskfonts.next()) {
105 QString familyname = qdf->name; 105 QString familyname = qdf->name;
106 if ( !familyDict.find( familyname ) ) { 106 if ( !familyDict.find( familyname ) ) {
107 familyDict.insert( familyname, (void *)1 ); 107 familyDict.insert( familyname, (void *)1 );
108 list.append( familyname ); 108 list.append( familyname );
109 } 109 }
110 } 110 }
111 111
112 QDir dir(fontDir(),"*.qpf"); 112 QDir dir(fontDir(),"*.qpf");
113 for (int i=0; i<(int)dir.count(); i++) { 113 for (int i=0; i<(int)dir.count(); i++) {
114 QString familyname = fontFamily(dir[i]); 114 QString familyname = fontFamily(dir[i]);
115 if ( !familyDict.find( familyname ) ) { 115 if ( !familyDict.find( familyname ) ) {
116 familyDict.insert( familyname, (void *)1 ); 116 familyDict.insert( familyname, (void *)1 );
117 list.append( familyname ); 117 list.append( familyname );
118 } 118 }
119 } 119 }
120 120
121 return list; 121 return list;
122#endif 122#endif
123#endif 123#endif
124} 124}
125 125
126#ifdef QT_NO_FONTDATABASE 126#ifdef QT_NO_FONTDATABASE
127/*! 127/*!
128 Returns a list of standard fontsizes. 128 Returns a list of standard fontsizes.
129*/ 129*/
130QValueList<int> FontDatabase::standardSizes() 130QValueList<int> FontDatabase::standardSizes()
131{ 131{
132 static int s[]={ 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 132 static int s[]={ 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28,
133 36, 48, 72, 0 }; 133 36, 48, 72, 0 };
134 static bool first = TRUE; 134 static bool first = TRUE;
135 static QValueList<int> sList; 135 static QValueList<int> sList;
136 if ( first ) { 136 if ( first ) {
137 first = FALSE; 137 first = FALSE;
138 int i = 0; 138 int i = 0;
139 while( s[i] ) 139 while( s[i] )
140 sList.append( s[i++] ); 140 sList.append( s[i++] );
141 } 141 }
142 return sList; 142 return sList;
143} 143}
144 144
145#endif 145#endif
146 146
147/*! 147/*!
148 Load any font renderer plugins that are available and make the fonts 148 Load any font renderer plugins that are available and make the fonts
149 that the plugins can read available. 149 that the plugins can read available.
150*/ 150*/
151void FontDatabase::loadRenderers() 151void FontDatabase::loadRenderers()
152{ 152{
153#ifndef QWS 153#ifndef QWS
154 return; 154 return;
155#else 155#else
156 156
157#ifndef QT_NO_COMPONENT 157#ifndef QT_NO_COMPONENT
158 if ( !factoryList ) 158 if ( !factoryList )
159 factoryList = new QValueList<FontFactory>; 159 factoryList = new QValueList<FontFactory>;
160 160
161 QValueList<FontFactory>::Iterator mit; 161 QValueList<FontFactory>::Iterator mit;
162 for ( mit = factoryList->begin(); mit != factoryList->end(); ++mit ) { 162 for ( mit = factoryList->begin(); mit != factoryList->end(); ++mit ) {
163 qt_fontmanager->factories.setAutoDelete( false ); 163 qt_fontmanager->factories.setAutoDelete( false );
164 qt_fontmanager->factories.removeRef( (*mit).factory ); 164 qt_fontmanager->factories.removeRef( (*mit).factory );
165 qt_fontmanager->factories.setAutoDelete( true ); 165 qt_fontmanager->factories.setAutoDelete( true );
166 (*mit).interface->release(); 166 (*mit).interface->release();
167 (*mit).library->unload(); 167 (*mit).library->unload();
168 delete (*mit).library; 168 delete (*mit).library;
169 } 169 }
170 factoryList->clear(); 170 factoryList->clear();
171 171
172 QString path = QPEApplication::qpeDir() + "/plugins/fontfactories"; 172 QString path = QPEApplication::qpeDir() + "/plugins/fontfactories";
173#ifdef Q_OS_MACX
174 QDir dir( path, "lib*.dylib" );
175#else
173 QDir dir( path, "lib*.so" ); 176 QDir dir( path, "lib*.so" );
177#endif
174 178
175 if ( !dir.exists()) 179 if ( !dir.exists())
176 return; 180 return;
177 181
178 QStringList list = dir.entryList(); 182 QStringList list = dir.entryList();
179 QStringList::Iterator it; 183 QStringList::Iterator it;
180 for ( it = list.begin(); it != list.end(); ++it ) { 184 for ( it = list.begin(); it != list.end(); ++it ) {
181 FontFactoryInterface *iface = 0; 185 FontFactoryInterface *iface = 0;
182 QLibrary *lib = new QLibrary( path + "/" + *it ); 186 QLibrary *lib = new QLibrary( path + "/" + *it );
183 if ( lib->queryInterface( IID_FontFactory, (QUnknownInterface**)&iface ) == QS_OK ) { 187 if ( lib->queryInterface( IID_FontFactory, (QUnknownInterface**)&iface ) == QS_OK ) {
184 FontFactory factory; 188 FontFactory factory;
185 factory.library = lib; 189 factory.library = lib;
186 factory.interface = iface; 190 factory.interface = iface;
187 factory.factory = factory.interface->fontFactory(); 191 factory.factory = factory.interface->fontFactory();
188 factoryList->append( factory ); 192 factoryList->append( factory );
189 qt_fontmanager->factories.append( factory.factory ); 193 qt_fontmanager->factories.append( factory.factory );
190 readFonts( factory.factory ); 194 readFonts( factory.factory );
191 } else { 195 } else {
192 delete lib; 196 delete lib;
193 } 197 }
194 } 198 }
195#endif 199#endif
196#endif 200#endif
197} 201}
198 202
199/*! 203/*!
200 \internal 204 \internal
201*/ 205*/
202void FontDatabase::readFonts( QFontFactory *factory ) 206void FontDatabase::readFonts( QFontFactory *factory )
203{ 207{
204#ifndef QWS 208#ifndef QWS
205return; 209return;
206#else 210#else
207 // Load in font definition file 211 // Load in font definition file
208 QString fn = fontDir() + "fontdir"; 212 QString fn = fontDir() + "fontdir";
209 FILE* fontdef=fopen(fn.local8Bit(),"r"); 213 FILE* fontdef=fopen(fn.local8Bit(),"r");
210 if(!fontdef) { 214 if(!fontdef) {
211 QCString temp=fn.local8Bit(); 215 QCString temp=fn.local8Bit();
212 qWarning("Cannot find font definition file %s - is $QTDIR set correctly?", 216 qWarning("Cannot find font definition file %s - is $QTDIR set correctly?",
213 temp.data()); 217 temp.data());
214 return; 218 return;
215 } 219 }
216 char buf[200]=""; 220 char buf[200]="";
217 char name[200]=""; 221 char name[200]="";
218 char render[200]=""; 222 char render[200]="";
219 char file[200]=""; 223 char file[200]="";
220 char flags[200]=""; 224 char flags[200]="";
221 char isitalic[10]=""; 225 char isitalic[10]="";
222 fgets(buf,200,fontdef); 226 fgets(buf,200,fontdef);
223 while(!feof(fontdef)) { 227 while(!feof(fontdef)) {
224 if ( buf[0] != '#' ) { 228 if ( buf[0] != '#' ) {
225 int weight=50; 229 int weight=50;
226 int size=0; 230 int size=0;
227 flags[0]=0; 231 flags[0]=0;
228 sscanf(buf,"%s %s %s %s %d %d %s",name,file,render,isitalic,&weight,&size,flags); 232 sscanf(buf,"%s %s %s %s %d %d %s",name,file,render,isitalic,&weight,&size,flags);
229 QString filename; 233 QString filename;
230 if ( file[0] != '/' ) 234 if ( file[0] != '/' )
231 filename = fontDir(); 235 filename = fontDir();
232 filename += file; 236 filename += file;
233 if ( QFile::exists(filename) ) { 237 if ( QFile::exists(filename) ) {
234 if( factory->name() == render ) { 238 if( factory->name() == render ) {
235 QDiskFont * qdf=new QDiskFont(factory,name,isitalic[0]=='y', 239 QDiskFont * qdf=new QDiskFont(factory,name,isitalic[0]=='y',
236 weight,size,flags,filename); 240 weight,size,flags,filename);
237 qt_fontmanager->diskfonts.append(qdf); 241 qt_fontmanager->diskfonts.append(qdf);
238#if QT_VERSION >= 232 242#if QT_VERSION >= 232
239 QFontDatabase::qwsAddDiskFont( qdf ); 243 QFontDatabase::qwsAddDiskFont( qdf );
240#endif 244#endif
241 } 245 }
242 } 246 }
243 } 247 }
244 fgets(buf,200,fontdef); 248 fgets(buf,200,fontdef);
245 } 249 }
246 fclose(fontdef); 250 fclose(fontdef);
247#endif 251#endif
248} 252}
249 253
diff --git a/library/global.cpp b/library/global.cpp
index 90954fe..05d23ac 100644
--- a/library/global.cpp
+++ b/library/global.cpp
@@ -1,814 +1,818 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#define QTOPIA_INTERNAL_LANGLIST 20#define QTOPIA_INTERNAL_LANGLIST
21#include <qpe/qpedebug.h> 21#include <qpe/qpedebug.h>
22#include <qpe/global.h> 22#include <qpe/global.h>
23#include <qpe/qdawg.h> 23#include <qpe/qdawg.h>
24#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25#include <qpe/resource.h> 25#include <qpe/resource.h>
26#include <qpe/storage.h> 26#include <qpe/storage.h>
27#include <qpe/applnk.h> 27#include <qpe/applnk.h>
28#include <qpe/qcopenvelope_qws.h> 28#include <qpe/qcopenvelope_qws.h>
29 29
30#include <qfile.h> 30#include <qfile.h>
31#include <qlabel.h> 31#include <qlabel.h>
32#include <qtimer.h> 32#include <qtimer.h>
33#include <qmap.h> 33#include <qmap.h>
34#include <qdict.h> 34#include <qdict.h>
35#include <qdir.h> 35#include <qdir.h>
36#include <qmessagebox.h> 36#include <qmessagebox.h>
37#include <qregexp.h> 37#include <qregexp.h>
38 38
39#include <stdlib.h> 39#include <stdlib.h>
40#include <sys/stat.h> 40#include <sys/stat.h>
41#include <sys/wait.h> 41#include <sys/wait.h>
42#include <sys/types.h> 42#include <sys/types.h>
43#include <fcntl.h> 43#include <fcntl.h>
44#include <unistd.h> 44#include <unistd.h>
45#include <errno.h> 45#include <errno.h>
46 46
47#include <qwindowsystem_qws.h> // for qwsServer 47#include <qwindowsystem_qws.h> // for qwsServer
48#include <qdatetime.h> 48#include <qdatetime.h>
49 49
50#include <qfile.h> 50#include <qfile.h>
51 51
52namespace { 52namespace {
53 // checks if the storage should be searched 53 // checks if the storage should be searched
54 bool checkStorage(const QString &path ){ // this is a small Config replacement cause config is too limited -zecke 54 bool checkStorage(const QString &path ){ // this is a small Config replacement cause config is too limited -zecke
55 QFile file(path ); 55 QFile file(path );
56 if(!file.open(IO_ReadOnly ) ) 56 if(!file.open(IO_ReadOnly ) )
57 return true; 57 return true;
58 58
59 QByteArray array = file.readAll(); 59 QByteArray array = file.readAll();
60 QStringList list = QStringList::split('\n', QString( array ) ); 60 QStringList list = QStringList::split('\n', QString( array ) );
61 for(QStringList::Iterator it = list.begin(); it != list.end(); ++it ){ 61 for(QStringList::Iterator it = list.begin(); it != list.end(); ++it ){
62 if( (*it).startsWith("autocheck = 0" ) ){ 62 if( (*it).startsWith("autocheck = 0" ) ){
63 return false; 63 return false;
64 }else if( (*it).startsWith("autocheck = 1" ) ){ 64 }else if( (*it).startsWith("autocheck = 1" ) ){
65 return true; 65 return true;
66 } 66 }
67 } 67 }
68 return true; 68 return true;
69 } 69 }
70} 70}
71 71
72//#include "quickexec_p.h" 72//#include "quickexec_p.h"
73 73
74class Emitter : public QObject { 74class Emitter : public QObject {
75 Q_OBJECT 75 Q_OBJECT
76public: 76public:
77 Emitter( QWidget* receiver, const QString& document ) 77 Emitter( QWidget* receiver, const QString& document )
78 { 78 {
79 connect(this, SIGNAL(setDocument(const QString&)), 79 connect(this, SIGNAL(setDocument(const QString&)),
80 receiver, SLOT(setDocument(const QString&))); 80 receiver, SLOT(setDocument(const QString&)));
81 emit setDocument(document); 81 emit setDocument(document);
82 disconnect(this, SIGNAL(setDocument(const QString&)), 82 disconnect(this, SIGNAL(setDocument(const QString&)),
83 receiver, SLOT(setDocument(const QString&))); 83 receiver, SLOT(setDocument(const QString&)));
84 } 84 }
85 85
86signals: 86signals:
87 void setDocument(const QString&); 87 void setDocument(const QString&);
88}; 88};
89 89
90 90
91class StartingAppList : public QObject { 91class StartingAppList : public QObject {
92 Q_OBJECT 92 Q_OBJECT
93public: 93public:
94 static void add( const QString& name ); 94 static void add( const QString& name );
95 static bool isStarting( const QString name ); 95 static bool isStarting( const QString name );
96private slots: 96private slots:
97 void handleNewChannel( const QString &); 97 void handleNewChannel( const QString &);
98private: 98private:
99 StartingAppList( QObject *parent=0, const char* name=0 ) ; 99 StartingAppList( QObject *parent=0, const char* name=0 ) ;
100 100
101 QDict<QTime> dict; 101 QDict<QTime> dict;
102 static StartingAppList *appl; 102 static StartingAppList *appl;
103}; 103};
104 104
105StartingAppList* StartingAppList::appl = 0; 105StartingAppList* StartingAppList::appl = 0;
106 106
107StartingAppList::StartingAppList( QObject *parent, const char* name ) 107StartingAppList::StartingAppList( QObject *parent, const char* name )
108 :QObject( parent, name ) 108 :QObject( parent, name )
109{ 109{
110#if QT_VERSION >= 232 && defined(QWS) 110#if QT_VERSION >= 232 && defined(QWS)
111 connect( qwsServer, SIGNAL( newChannel(const QString&)), 111 connect( qwsServer, SIGNAL( newChannel(const QString&)),
112 this, SLOT( handleNewChannel(const QString&)) ); 112 this, SLOT( handleNewChannel(const QString&)) );
113#endif 113#endif
114 dict.setAutoDelete( TRUE ); 114 dict.setAutoDelete( TRUE );
115} 115}
116 116
117void StartingAppList::add( const QString& name ) 117void StartingAppList::add( const QString& name )
118{ 118{
119#if QT_VERSION >= 232 && !defined(QT_NO_COP) 119#if QT_VERSION >= 232 && !defined(QT_NO_COP)
120 if ( !appl ) 120 if ( !appl )
121 appl = new StartingAppList; 121 appl = new StartingAppList;
122 QTime *t = new QTime; 122 QTime *t = new QTime;
123 t->start(); 123 t->start();
124 appl->dict.insert( "QPE/Application/" + name, t ); 124 appl->dict.insert( "QPE/Application/" + name, t );
125#endif 125#endif
126} 126}
127 127
128bool StartingAppList::isStarting( const QString name ) 128bool StartingAppList::isStarting( const QString name )
129{ 129{
130#if QT_VERSION >= 232 && !defined(QT_NO_COP) 130#if QT_VERSION >= 232 && !defined(QT_NO_COP)
131 if ( appl ) { 131 if ( appl ) {
132 QTime *t = appl->dict.find( "QPE/Application/" + name ); 132 QTime *t = appl->dict.find( "QPE/Application/" + name );
133 if ( !t ) 133 if ( !t )
134 return FALSE; 134 return FALSE;
135 if ( t->elapsed() > 10000 ) { 135 if ( t->elapsed() > 10000 ) {
136 // timeout in case of crash or something 136 // timeout in case of crash or something
137 appl->dict.remove( "QPE/Application/" + name ); 137 appl->dict.remove( "QPE/Application/" + name );
138 return FALSE; 138 return FALSE;
139 } 139 }
140 return TRUE; 140 return TRUE;
141 } 141 }
142#endif 142#endif
143 return FALSE; 143 return FALSE;
144} 144}
145 145
146void StartingAppList::handleNewChannel( const QString & name ) 146void StartingAppList::handleNewChannel( const QString & name )
147{ 147{
148#if QT_VERSION >= 232 && !defined(QT_NO_COP) 148#if QT_VERSION >= 232 && !defined(QT_NO_COP)
149 dict.remove( name ); 149 dict.remove( name );
150#endif 150#endif
151} 151}
152 152
153static bool docDirCreated = FALSE; 153static bool docDirCreated = FALSE;
154static QDawg* fixed_dawg = 0; 154static QDawg* fixed_dawg = 0;
155static QDict<QDawg> *named_dawg = 0; 155static QDict<QDawg> *named_dawg = 0;
156 156
157static QString qpeDir() 157static QString qpeDir()
158{ 158{
159 QString dir = getenv("OPIEDIR"); 159 QString dir = getenv("OPIEDIR");
160 if ( dir.isEmpty() ) dir = ".."; 160 if ( dir.isEmpty() ) dir = "..";
161 return dir; 161 return dir;
162} 162}
163 163
164static QString dictDir() 164static QString dictDir()
165{ 165{
166 return qpeDir() + "/etc/dict"; 166 return qpeDir() + "/etc/dict";
167} 167}
168 168
169/*! 169/*!
170 \class Global global.h 170 \class Global global.h
171 \brief The Global class provides application-wide global functions. 171 \brief The Global class provides application-wide global functions.
172 172
173 The Global functions are grouped as follows: 173 The Global functions are grouped as follows:
174 \tableofcontents 174 \tableofcontents
175 175
176 \section1 User Interface 176 \section1 User Interface
177 177
178 The statusMessage() function provides short-duration messages to the 178 The statusMessage() function provides short-duration messages to the
179 user. The showInputMethod() function shows the current input method, 179 user. The showInputMethod() function shows the current input method,
180 and hideInputMethod() hides the input method. 180 and hideInputMethod() hides the input method.
181 181
182 \section1 Document related 182 \section1 Document related
183 183
184 The findDocuments() function creates a set of \link doclnk.html 184 The findDocuments() function creates a set of \link doclnk.html
185 DocLnk\endlink objects in a particular folder. 185 DocLnk\endlink objects in a particular folder.
186 186
187 \section1 Filesystem related 187 \section1 Filesystem related
188 188
189 Global provides an applicationFileName() function that returns the 189 Global provides an applicationFileName() function that returns the
190 full path of an application-specific file. 190 full path of an application-specific file.
191 191
192 The execute() function runs an application. 192 The execute() function runs an application.
193 193
194 \section1 Word list related 194 \section1 Word list related
195 195
196 A list of words relevant to the current locale is maintained by the 196 A list of words relevant to the current locale is maintained by the
197 system. The list is held in a \link qdawg.html DAWG\endlink 197 system. The list is held in a \link qdawg.html DAWG\endlink
198 (implemented by the QDawg class). This list is used, for example, by 198 (implemented by the QDawg class). This list is used, for example, by
199 the pickboard input method. 199 the pickboard input method.
200 200
201 The global QDawg is returned by fixedDawg(); this cannot be updated. 201 The global QDawg is returned by fixedDawg(); this cannot be updated.
202 An updatable copy of the global QDawg is returned by addedDawg(). 202 An updatable copy of the global QDawg is returned by addedDawg().
203 Applications may have their own word lists stored in \l{QDawg}s 203 Applications may have their own word lists stored in \l{QDawg}s
204 which are returned by dawg(). Use addWords() to add words to the 204 which are returned by dawg(). Use addWords() to add words to the
205 updateable copy of the global QDawg or to named application 205 updateable copy of the global QDawg or to named application
206 \l{QDawg}s. 206 \l{QDawg}s.
207 207
208 \section1 Quoting 208 \section1 Quoting
209 209
210 The shellQuote() function quotes a string suitable for passing to a 210 The shellQuote() function quotes a string suitable for passing to a
211 shell. The stringQuote() function backslash escapes '\' and '"' 211 shell. The stringQuote() function backslash escapes '\' and '"'
212 characters. 212 characters.
213 213
214 \section1 Hardware 214 \section1 Hardware
215 215
216 The implementation of the writeHWClock() function depends on the AlarmServer 216 The implementation of the writeHWClock() function depends on the AlarmServer
217 implementation. If the AlarmServer is using atd the clock will be synced to 217 implementation. If the AlarmServer is using atd the clock will be synced to
218 hardware. If opie-alarm is used the hardware clock will be synced before 218 hardware. If opie-alarm is used the hardware clock will be synced before
219 suspending the device. opie-alarm is used by iPAQ and Zaurii implementation 219 suspending the device. opie-alarm is used by iPAQ and Zaurii implementation
220 220
221 \ingroup qtopiaemb 221 \ingroup qtopiaemb
222*/ 222*/
223 223
224/*! 224/*!
225 \internal 225 \internal
226*/ 226*/
227Global::Global() 227Global::Global()
228{ 228{
229} 229}
230 230
231/*! 231/*!
232 Returns the unchangeable QDawg that contains general 232 Returns the unchangeable QDawg that contains general
233 words for the current locale. 233 words for the current locale.
234 234
235 \sa addedDawg() 235 \sa addedDawg()
236*/ 236*/
237const QDawg& Global::fixedDawg() 237const QDawg& Global::fixedDawg()
238{ 238{
239 if ( !fixed_dawg ) { 239 if ( !fixed_dawg ) {
240 if ( !docDirCreated ) 240 if ( !docDirCreated )
241 createDocDir(); 241 createDocDir();
242 242
243 fixed_dawg = new QDawg; 243 fixed_dawg = new QDawg;
244 QString dawgfilename = dictDir() + "/dawg"; 244 QString dawgfilename = dictDir() + "/dawg";
245 QString words_lang; 245 QString words_lang;
246 QStringList langs = Global::languageList(); 246 QStringList langs = Global::languageList();
247 for (QStringList::ConstIterator it = langs.begin(); it!=langs.end(); ++it) { 247 for (QStringList::ConstIterator it = langs.begin(); it!=langs.end(); ++it) {
248 QString lang = *it; 248 QString lang = *it;
249 words_lang = dictDir() + "/words." + lang; 249 words_lang = dictDir() + "/words." + lang;
250 QString dawgfilename_lang = dawgfilename + "." + lang; 250 QString dawgfilename_lang = dawgfilename + "." + lang;
251 if ( QFile::exists(dawgfilename_lang) || 251 if ( QFile::exists(dawgfilename_lang) ||
252 QFile::exists(words_lang) ) { 252 QFile::exists(words_lang) ) {
253 dawgfilename = dawgfilename_lang; 253 dawgfilename = dawgfilename_lang;
254 break; 254 break;
255 } 255 }
256 } 256 }
257 QFile dawgfile(dawgfilename); 257 QFile dawgfile(dawgfilename);
258 258
259 if ( !dawgfile.exists() ) { 259 if ( !dawgfile.exists() ) {
260 QString fn = dictDir() + "/words"; 260 QString fn = dictDir() + "/words";
261 if ( QFile::exists(words_lang) ) 261 if ( QFile::exists(words_lang) )
262 fn = words_lang; 262 fn = words_lang;
263 QFile in(fn); 263 QFile in(fn);
264 if ( in.open(IO_ReadOnly) ) { 264 if ( in.open(IO_ReadOnly) ) {
265 fixed_dawg->createFromWords(&in); 265 fixed_dawg->createFromWords(&in);
266 dawgfile.open(IO_WriteOnly); 266 dawgfile.open(IO_WriteOnly);
267 fixed_dawg->write(&dawgfile); 267 fixed_dawg->write(&dawgfile);
268 dawgfile.close(); 268 dawgfile.close();
269 } 269 }
270 } else { 270 } else {
271 fixed_dawg->readFile(dawgfilename); 271 fixed_dawg->readFile(dawgfilename);
272 } 272 }
273 } 273 }
274 274
275 return *fixed_dawg; 275 return *fixed_dawg;
276} 276}
277 277
278/*! 278/*!
279 Returns the changeable QDawg that contains general 279 Returns the changeable QDawg that contains general
280 words for the current locale. 280 words for the current locale.
281 281
282 \sa fixedDawg() 282 \sa fixedDawg()
283*/ 283*/
284const QDawg& Global::addedDawg() 284const QDawg& Global::addedDawg()
285{ 285{
286 return dawg("local"); 286 return dawg("local");
287} 287}
288 288
289/*! 289/*!
290 Returns the QDawg with the given \a name. 290 Returns the QDawg with the given \a name.
291 This is an application-specific word list. 291 This is an application-specific word list.
292 292
293 \a name should not contain "/". 293 \a name should not contain "/".
294*/ 294*/
295const QDawg& Global::dawg(const QString& name) 295const QDawg& Global::dawg(const QString& name)
296{ 296{
297 createDocDir(); 297 createDocDir();
298 if ( !named_dawg ) 298 if ( !named_dawg )
299 named_dawg = new QDict<QDawg>; 299 named_dawg = new QDict<QDawg>;
300 QDawg* r = named_dawg->find(name); 300 QDawg* r = named_dawg->find(name);
301 if ( !r ) { 301 if ( !r ) {
302 r = new QDawg; 302 r = new QDawg;
303 named_dawg->insert(name,r); 303 named_dawg->insert(name,r);
304 QString dawgfilename = applicationFileName("Dictionary", name ) + ".dawg"; 304 QString dawgfilename = applicationFileName("Dictionary", name ) + ".dawg";
305 QFile dawgfile(dawgfilename); 305 QFile dawgfile(dawgfilename);
306 if ( dawgfile.open(IO_ReadOnly) ) 306 if ( dawgfile.open(IO_ReadOnly) )
307 r->readFile(dawgfilename); 307 r->readFile(dawgfilename);
308 } 308 }
309 return *r; 309 return *r;
310} 310}
311 311
312/*! 312/*!
313 \overload 313 \overload
314 Adds \a wordlist to the addedDawg(). 314 Adds \a wordlist to the addedDawg().
315 315
316 Note that the addition of words persists between program executions 316 Note that the addition of words persists between program executions
317 (they are saved in the dictionary files), so you should confirm the 317 (they are saved in the dictionary files), so you should confirm the
318 words with the user before adding them. 318 words with the user before adding them.
319*/ 319*/
320void Global::addWords(const QStringList& wordlist) 320void Global::addWords(const QStringList& wordlist)
321{ 321{
322 addWords("local",wordlist); 322 addWords("local",wordlist);
323} 323}
324 324
325/*! 325/*!
326 \overload 326 \overload
327 Adds \a wordlist to the addedDawg(). 327 Adds \a wordlist to the addedDawg().
328 328
329 Note that the addition of words persists between program executions 329 Note that the addition of words persists between program executions
330 (they are saved in the dictionary files), so you should confirm the 330 (they are saved in the dictionary files), so you should confirm the
331 words with the user before adding them. 331 words with the user before adding them.
332*/ 332*/
333void Global::addWords(const QString& dictname, const QStringList& wordlist) 333void Global::addWords(const QString& dictname, const QStringList& wordlist)
334{ 334{
335 QDawg& d = (QDawg&)dawg(dictname); 335 QDawg& d = (QDawg&)dawg(dictname);
336 QStringList all = d.allWords() + wordlist; 336 QStringList all = d.allWords() + wordlist;
337 d.createFromWords(all); 337 d.createFromWords(all);
338 338
339 QString dawgfilename = applicationFileName("Dictionary", dictname) + ".dawg"; 339 QString dawgfilename = applicationFileName("Dictionary", dictname) + ".dawg";
340 QFile dawgfile(dawgfilename); 340 QFile dawgfile(dawgfilename);
341 if ( dawgfile.open(IO_WriteOnly) ) { 341 if ( dawgfile.open(IO_WriteOnly) ) {
342 d.write(&dawgfile); 342 d.write(&dawgfile);
343 dawgfile.close(); 343 dawgfile.close();
344 } 344 }
345 345
346 // #### Re-read the dawg here if we use mmap(). 346 // #### Re-read the dawg here if we use mmap().
347 347
348 // #### Signal other processes to re-read. 348 // #### Signal other processes to re-read.
349} 349}
350 350
351 351
352/*! 352/*!
353 Returns the full path for the application called \a appname, with the 353 Returns the full path for the application called \a appname, with the
354 given \a filename. Returns QString::null if there was a problem creating 354 given \a filename. Returns QString::null if there was a problem creating
355 the directory tree for \a appname. 355 the directory tree for \a appname.
356 If \a filename contains "/", it is the caller's responsibility to 356 If \a filename contains "/", it is the caller's responsibility to
357 ensure that those directories exist. 357 ensure that those directories exist.
358*/ 358*/
359QString Global::applicationFileName(const QString& appname, const QString& filename) 359QString Global::applicationFileName(const QString& appname, const QString& filename)
360{ 360{
361 QDir d; 361 QDir d;
362 QString r = getenv("HOME"); 362 QString r = getenv("HOME");
363 r += "/Applications/"; 363 r += "/Applications/";
364 if ( !QFile::exists( r ) ) 364 if ( !QFile::exists( r ) )
365 if ( d.mkdir(r) == false ) 365 if ( d.mkdir(r) == false )
366 return QString::null; 366 return QString::null;
367 r += appname; 367 r += appname;
368 if ( !QFile::exists( r ) ) 368 if ( !QFile::exists( r ) )
369 if ( d.mkdir(r) == false ) 369 if ( d.mkdir(r) == false )
370 return QString::null; 370 return QString::null;
371 r += "/"; r += filename; 371 r += "/"; r += filename;
372 return r; 372 return r;
373} 373}
374 374
375/*! 375/*!
376 \internal 376 \internal
377*/ 377*/
378void Global::createDocDir() 378void Global::createDocDir()
379{ 379{
380 if ( !docDirCreated ) { 380 if ( !docDirCreated ) {
381 docDirCreated = TRUE; 381 docDirCreated = TRUE;
382 mkdir( QPEApplication::documentDir().latin1(), 0755 ); 382 mkdir( QPEApplication::documentDir().latin1(), 0755 );
383 } 383 }
384} 384}
385 385
386 386
387/*! 387/*!
388 Displays a status \a message to the user. This usually appears 388 Displays a status \a message to the user. This usually appears
389 in the taskbar for a short amount of time, then disappears. 389 in the taskbar for a short amount of time, then disappears.
390*/ 390*/
391void Global::statusMessage(const QString& message) 391void Global::statusMessage(const QString& message)
392{ 392{
393#if !defined(QT_NO_COP) 393#if !defined(QT_NO_COP)
394 QCopEnvelope e( "QPE/TaskBar", "message(QString)" ); 394 QCopEnvelope e( "QPE/TaskBar", "message(QString)" );
395 e << message; 395 e << message;
396#endif 396#endif
397} 397}
398 398
399/*! 399/*!
400 \internal 400 \internal
401*/ 401*/
402void Global::applyStyle() 402void Global::applyStyle()
403{ 403{
404#if !defined(QT_NO_COP) 404#if !defined(QT_NO_COP)
405 QCopChannel::send( "QPE/System", "applyStyle()" ); 405 QCopChannel::send( "QPE/System", "applyStyle()" );
406#else 406#else
407 ((QPEApplication *)qApp)->applyStyle(); // apply without needing QCop for floppy version 407 ((QPEApplication *)qApp)->applyStyle(); // apply without needing QCop for floppy version
408#endif 408#endif
409} 409}
410 410
411/*! 411/*!
412 \internal 412 \internal
413*/ 413*/
414QWidget *Global::shutdown( bool ) 414QWidget *Global::shutdown( bool )
415{ 415{
416#if !defined(QT_NO_COP) 416#if !defined(QT_NO_COP)
417 QCopChannel::send( "QPE/System", "shutdown()" ); 417 QCopChannel::send( "QPE/System", "shutdown()" );
418#endif 418#endif
419 return 0; 419 return 0;
420} 420}
421 421
422/*! 422/*!
423 \internal 423 \internal
424*/ 424*/
425QWidget *Global::restart( bool ) 425QWidget *Global::restart( bool )
426{ 426{
427#if !defined(QT_NO_COP) 427#if !defined(QT_NO_COP)
428 QCopChannel::send( "QPE/System", "restart()" ); 428 QCopChannel::send( "QPE/System", "restart()" );
429#endif 429#endif
430 return 0; 430 return 0;
431} 431}
432 432
433/*! 433/*!
434 Explicitly show the current input method. 434 Explicitly show the current input method.
435 435
436 Input methods are indicated in the taskbar by a small icon. If the 436 Input methods are indicated in the taskbar by a small icon. If the
437 input method is activated (shown) then it takes up some proportion 437 input method is activated (shown) then it takes up some proportion
438 of the bottom of the screen, to allow the user to interact (input 438 of the bottom of the screen, to allow the user to interact (input
439 characters) with it. 439 characters) with it.
440 440
441 \sa hideInputMethod() 441 \sa hideInputMethod()
442*/ 442*/
443void Global::showInputMethod() 443void Global::showInputMethod()
444{ 444{
445#if !defined(QT_NO_COP) 445#if !defined(QT_NO_COP)
446 QCopChannel::send( "QPE/TaskBar", "showInputMethod()" ); 446 QCopChannel::send( "QPE/TaskBar", "showInputMethod()" );
447#endif 447#endif
448} 448}
449 449
450/*! 450/*!
451 Explicitly hide the current input method. 451 Explicitly hide the current input method.
452 452
453 The current input method is still indicated in the taskbar, but no 453 The current input method is still indicated in the taskbar, but no
454 longer takes up screen space, and can no longer be interacted with. 454 longer takes up screen space, and can no longer be interacted with.
455 455
456 \sa showInputMethod() 456 \sa showInputMethod()
457*/ 457*/
458void Global::hideInputMethod() 458void Global::hideInputMethod()
459{ 459{
460#if !defined(QT_NO_COP) 460#if !defined(QT_NO_COP)
461 QCopChannel::send( "QPE/TaskBar", "hideInputMethod()" ); 461 QCopChannel::send( "QPE/TaskBar", "hideInputMethod()" );
462#endif 462#endif
463} 463}
464 464
465 465
466/*! 466/*!
467 \internal 467 \internal
468*/ 468*/
469bool Global::isBuiltinCommand( const QString &name ) 469bool Global::isBuiltinCommand( const QString &name )
470{ 470{
471 if(!builtin) 471 if(!builtin)
472 return FALSE; // yes, it can happen 472 return FALSE; // yes, it can happen
473 for (int i = 0; builtin[i].file; i++) { 473 for (int i = 0; builtin[i].file; i++) {
474 if ( builtin[i].file == name ) { 474 if ( builtin[i].file == name ) {
475 return TRUE; 475 return TRUE;
476 } 476 }
477 } 477 }
478 return FALSE; 478 return FALSE;
479} 479}
480 480
481Global::Command* Global::builtin=0; 481Global::Command* Global::builtin=0;
482QGuardedPtr<QWidget> *Global::running=0; 482QGuardedPtr<QWidget> *Global::running=0;
483 483
484/*! 484/*!
485 \class Global::Command 485 \class Global::Command
486 \brief The Global::Command class is internal. 486 \brief The Global::Command class is internal.
487 \internal 487 \internal
488*/ 488*/
489 489
490/*! 490/*!
491 \internal 491 \internal
492*/ 492*/
493void Global::setBuiltinCommands( Command* list ) 493void Global::setBuiltinCommands( Command* list )
494{ 494{
495 if ( running ) 495 if ( running )
496 delete [] running; 496 delete [] running;
497 497
498 builtin = list; 498 builtin = list;
499 int count = 0; 499 int count = 0;
500 if (!builtin) 500 if (!builtin)
501 return; 501 return;
502 while ( builtin[count].file ) 502 while ( builtin[count].file )
503 count++; 503 count++;
504 504
505 running = new QGuardedPtr<QWidget> [ count ]; 505 running = new QGuardedPtr<QWidget> [ count ];
506} 506}
507 507
508/*! 508/*!
509 \internal 509 \internal
510*/ 510*/
511void Global::setDocument( QWidget* receiver, const QString& document ) 511void Global::setDocument( QWidget* receiver, const QString& document )
512{ 512{
513 Emitter emitter(receiver,document); 513 Emitter emitter(receiver,document);
514} 514}
515 515
516/*! 516/*!
517 \internal 517 \internal
518*/ 518*/
519bool Global::terminateBuiltin( const QString& n ) 519bool Global::terminateBuiltin( const QString& n )
520{ 520{
521 if (!builtin) 521 if (!builtin)
522 return FALSE; 522 return FALSE;
523 for (int i = 0; builtin[i].file; i++) { 523 for (int i = 0; builtin[i].file; i++) {
524 if ( builtin[i].file == n ) { 524 if ( builtin[i].file == n ) {
525 delete running[i]; 525 delete running[i];
526 return TRUE; 526 return TRUE;
527 } 527 }
528 } 528 }
529 return FALSE; 529 return FALSE;
530} 530}
531 531
532/*! 532/*!
533 \internal 533 \internal
534*/ 534*/
535void Global::terminate( const AppLnk* app ) 535void Global::terminate( const AppLnk* app )
536{ 536{
537 //if ( terminateBuiltin(app->exec()) ) return; // maybe? haven't tried this 537 //if ( terminateBuiltin(app->exec()) ) return; // maybe? haven't tried this
538 538
539#ifndef QT_NO_COP 539#ifndef QT_NO_COP
540 QCString channel = "QPE/Application/" + app->exec().utf8(); 540 QCString channel = "QPE/Application/" + app->exec().utf8();
541 if ( QCopChannel::isRegistered(channel) ) { 541 if ( QCopChannel::isRegistered(channel) ) {
542 QCopEnvelope e(channel, "quit()"); 542 QCopEnvelope e(channel, "quit()");
543 } 543 }
544#endif 544#endif
545} 545}
546 546
547/*! 547/*!
548 Low-level function to run command \a c. 548 Low-level function to run command \a c.
549 549
550 \warning Do not use this function. Use execute instead. 550 \warning Do not use this function. Use execute instead.
551 551
552 \sa execute() 552 \sa execute()
553*/ 553*/
554void Global::invoke(const QString &c) 554void Global::invoke(const QString &c)
555{ 555{
556 // Convert the command line in to a list of arguments 556 // Convert the command line in to a list of arguments
557 QStringList list = QStringList::split(QRegExp(" *"),c); 557 QStringList list = QStringList::split(QRegExp(" *"),c);
558 558
559#if !defined(QT_NO_COP) 559#if !defined(QT_NO_COP)
560 QString ap=list[0]; 560 QString ap=list[0];
561 // see if the application is already running 561 // see if the application is already running
562 // XXX should lock file /tmp/qcop-msg-ap 562 // XXX should lock file /tmp/qcop-msg-ap
563 if ( QCopChannel::isRegistered( ("QPE/Application/" + ap).latin1() ) ) { 563 if ( QCopChannel::isRegistered( ("QPE/Application/" + ap).latin1() ) ) {
564 // If the channel is already register, the app is already running, so show it. 564 // If the channel is already register, the app is already running, so show it.
565 { QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "raise()" ); } 565 { QCopEnvelope env( ("QPE/Application/" + ap).latin1(), "raise()" ); }
566 566
567 //QCopEnvelope e("QPE/System", "notBusy(QString)" ); 567 //QCopEnvelope e("QPE/System", "notBusy(QString)" );
568 //e << ap; 568 //e << ap;
569 return; 569 return;
570 } 570 }
571 // XXX should unlock file /tmp/qcop-msg-ap 571 // XXX should unlock file /tmp/qcop-msg-ap
572 //see if it is being started 572 //see if it is being started
573 if ( StartingAppList::isStarting( ap ) ) { 573 if ( StartingAppList::isStarting( ap ) ) {
574 // FIXME take it out for now, since it leads to a much to short showing of wait if 574 // FIXME take it out for now, since it leads to a much to short showing of wait if
575 // some entry is clicked. 575 // some entry is clicked.
576 // Real cause is that ::execute is called twice for document tab. But it would need some larger changes 576 // Real cause is that ::execute is called twice for document tab. But it would need some larger changes
577 // to fix that, and with future syncs with qtopia 1.6 it will change anyway big time since somebody there 577 // to fix that, and with future syncs with qtopia 1.6 it will change anyway big time since somebody there
578 // had the idea that an apploader belongs to the launcher ... 578 // had the idea that an apploader belongs to the launcher ...
579 //QCopEnvelope e("QPE/System", "notBusy(QString)" ); 579 //QCopEnvelope e("QPE/System", "notBusy(QString)" );
580 //e << ap; 580 //e << ap;
581 return; 581 return;
582 } 582 }
583 583
584#endif 584#endif
585 585
586#ifdef QT_NO_QWS_MULTIPROCESS 586#ifdef QT_NO_QWS_MULTIPROCESS
587 QMessageBox::warning( 0, "Error", "Could not find the application " + c, "Ok", 0, 0, 0, 1 ); 587 QMessageBox::warning( 0, "Error", "Could not find the application " + c, "Ok", 0, 0, 0, 1 );
588#else 588#else
589 589
590 QStrList slist; 590 QStrList slist;
591 unsigned int j; 591 unsigned int j;
592 for ( j = 0; j < list.count(); j++ ) 592 for ( j = 0; j < list.count(); j++ )
593 slist.append( list[j].utf8() ); 593 slist.append( list[j].utf8() );
594 594
595 const char **args = new (const char *)[slist.count() + 1]; 595 const char **args = new (const char *)[slist.count() + 1];
596 for ( j = 0; j < slist.count(); j++ ) 596 for ( j = 0; j < slist.count(); j++ )
597 args[j] = slist.at(j); 597 args[j] = slist.at(j);
598 args[j] = NULL; 598 args[j] = NULL;
599 599
600#if !defined(QT_NO_COP) 600#if !defined(QT_NO_COP)
601 // an attempt to show a wait... 601 // an attempt to show a wait...
602 // more logic should be used, but this will be fine for the moment... 602 // more logic should be used, but this will be fine for the moment...
603 QCopEnvelope ( "QPE/System", "busy()" ); 603 QCopEnvelope ( "QPE/System", "busy()" );
604#endif 604#endif
605 605
606#ifdef HAVE_QUICKEXEC 606#ifdef HAVE_QUICKEXEC
607#ifdef Q_OS_MACX
608 QString libexe = qpeDir()+"/binlib/lib"+args[0] + ".dylib";
609#else
607 QString libexe = qpeDir()+"/binlib/lib"+args[0] + ".so"; 610 QString libexe = qpeDir()+"/binlib/lib"+args[0] + ".so";
611#endif
608 qDebug("libfile = %s", libexe.latin1() ); 612 qDebug("libfile = %s", libexe.latin1() );
609 if ( QFile::exists( libexe ) ) { 613 if ( QFile::exists( libexe ) ) {
610 qDebug("calling quickexec %s", libexe.latin1() ); 614 qDebug("calling quickexec %s", libexe.latin1() );
611 quickexecv( libexe.utf8().data(), (const char **)args ); 615 quickexecv( libexe.utf8().data(), (const char **)args );
612 } else 616 } else
613#endif 617#endif
614 { 618 {
615 bool success = false; 619 bool success = false;
616 int pfd [2]; 620 int pfd [2];
617 if ( ::pipe ( pfd ) < 0 ) 621 if ( ::pipe ( pfd ) < 0 )
618 pfd [0] = pfd [1] = -1; 622 pfd [0] = pfd [1] = -1;
619 623
620 pid_t pid = ::fork ( ); 624 pid_t pid = ::fork ( );
621 625
622 if ( pid == 0 ) { // child 626 if ( pid == 0 ) { // child
623 for ( int fd = 3; fd < 100; fd++ ) { 627 for ( int fd = 3; fd < 100; fd++ ) {
624 if ( fd != pfd [1] ) 628 if ( fd != pfd [1] )
625 ::close ( fd ); 629 ::close ( fd );
626 } 630 }
627 ::setpgid ( ::getpid ( ), ::getppid ( )); 631 ::setpgid ( ::getpid ( ), ::getppid ( ));
628 632
629 // Closing of fd[1] indicates that the execvp succeeded! 633 // Closing of fd[1] indicates that the execvp succeeded!
630 if ( pfd [1] >= 0 ) 634 if ( pfd [1] >= 0 )
631 ::fcntl ( pfd [1], F_SETFD, FD_CLOEXEC ); 635 ::fcntl ( pfd [1], F_SETFD, FD_CLOEXEC );
632 636
633 // Try bindir first, so that foo/bar works too 637 // Try bindir first, so that foo/bar works too
634 ::execv ( qpeDir ( ) + "/bin/" + args [0], (char * const *) args ); 638 ::execv ( qpeDir ( ) + "/bin/" + args [0], (char * const *) args );
635 ::execvp ( args [0], (char * const *) args ); 639 ::execvp ( args [0], (char * const *) args );
636 640
637 char resultByte = 1; 641 char resultByte = 1;
638 if ( pfd [1] >= 0 ) 642 if ( pfd [1] >= 0 )
639 ::write ( pfd [1], &resultByte, 1 ); 643 ::write ( pfd [1], &resultByte, 1 );
640 ::_exit ( -1 ); 644 ::_exit ( -1 );
641 } 645 }
642 else if ( pid > 0 ) { 646 else if ( pid > 0 ) {
643 success = true; 647 success = true;
644 648
645 if ( pfd [1] >= 0 ) 649 if ( pfd [1] >= 0 )
646 ::close ( pfd [1] ); 650 ::close ( pfd [1] );
647 if ( pfd [0] >= 0 ) { 651 if ( pfd [0] >= 0 ) {
648 while ( true ) { 652 while ( true ) {
649 char resultByte; 653 char resultByte;
650 int n = ::read ( pfd [0], &resultByte, 1 ); 654 int n = ::read ( pfd [0], &resultByte, 1 );
651 if ( n == 1 ) { 655 if ( n == 1 ) {
652 success = false; 656 success = false;
653 break; 657 break;
654 } 658 }
655 if (( n == -1 ) && (( errno == ECHILD ) || ( errno == EINTR ))) 659 if (( n == -1 ) && (( errno == ECHILD ) || ( errno == EINTR )))
656 continue; 660 continue;
657 661
658 break; // success 662 break; // success
659 } 663 }
660 ::close ( pfd [0] ); 664 ::close ( pfd [0] );
661 } 665 }
662 } 666 }
663 if ( success ) 667 if ( success )
664 StartingAppList::add( list[0] ); 668 StartingAppList::add( list[0] );
665 else 669 else
666 QMessageBox::warning( 0, "Error", "Could not start the application " + c, "Ok", 0, 0, 0, 1 ); 670 QMessageBox::warning( 0, "Error", "Could not start the application " + c, "Ok", 0, 0, 0, 1 );
667 } 671 }
668#endif //QT_NO_QWS_MULTIPROCESS 672#endif //QT_NO_QWS_MULTIPROCESS
669} 673}
670 674
671 675
672/*! 676/*!
673 Executes the application identfied by \a c, passing \a 677 Executes the application identfied by \a c, passing \a
674 document if it isn't null. 678 document if it isn't null.
675 679
676 Note that a better approach might be to send a QCop message to the 680 Note that a better approach might be to send a QCop message to the
677 application's QPE/Application/\e{appname} channel. 681 application's QPE/Application/\e{appname} channel.
678*/ 682*/
679void Global::execute( const QString &c, const QString& document ) 683void Global::execute( const QString &c, const QString& document )
680{ 684{
681 // ask the server to do the work 685 // ask the server to do the work
682#if !defined(QT_NO_COP) 686#if !defined(QT_NO_COP)
683 if ( document.isNull() ) { 687 if ( document.isNull() ) {
684 QCopEnvelope e( "QPE/System", "execute(QString)" ); 688 QCopEnvelope e( "QPE/System", "execute(QString)" );
685 e << c; 689 e << c;
686 } else { 690 } else {
687 QCopEnvelope e( "QPE/System", "execute(QString,QString)" ); 691 QCopEnvelope e( "QPE/System", "execute(QString,QString)" );
688 e << c << document; 692 e << c << document;
689 } 693 }
690#endif 694#endif
691 return; 695 return;
692} 696}
693 697
694/*! 698/*!
695 Returns the string \a s with the characters '\', '"', and '$' quoted 699 Returns the string \a s with the characters '\', '"', and '$' quoted
696 by a preceeding '\'. 700 by a preceeding '\'.
697 701
698 \sa stringQuote() 702 \sa stringQuote()
699*/ 703*/
700QString Global::shellQuote(const QString& s) 704QString Global::shellQuote(const QString& s)
701{ 705{
702 QString r="\""; 706 QString r="\"";
703 for (int i=0; i<(int)s.length(); i++) { 707 for (int i=0; i<(int)s.length(); i++) {
704 char c = s[i].latin1(); 708 char c = s[i].latin1();
705 switch (c) { 709 switch (c) {
706 case '\\': case '"': case '$': 710 case '\\': case '"': case '$':
707 r+="\\"; 711 r+="\\";
708 } 712 }
709 r += s[i]; 713 r += s[i];
710 } 714 }
711 r += "\""; 715 r += "\"";
712 return r; 716 return r;
713} 717}
714 718
715/*! 719/*!
716 Returns the string \a s with the characters '\' and '"' quoted by a 720 Returns the string \a s with the characters '\' and '"' quoted by a
717 preceeding '\'. 721 preceeding '\'.
718 722
719 \sa shellQuote() 723 \sa shellQuote()
720*/ 724*/
721QString Global::stringQuote(const QString& s) 725QString Global::stringQuote(const QString& s)
722{ 726{
723 QString r="\""; 727 QString r="\"";
724 for (int i=0; i<(int)s.length(); i++) { 728 for (int i=0; i<(int)s.length(); i++) {
725 char c = s[i].latin1(); 729 char c = s[i].latin1();
726 switch (c) { 730 switch (c) {
727 case '\\': case '"': 731 case '\\': case '"':
728 r+="\\"; 732 r+="\\";
729 } 733 }
730 r += s[i]; 734 r += s[i];
731 } 735 }
732 r += "\""; 736 r += "\"";
733 return r; 737 return r;
734} 738}
735 739
736/*! 740/*!
737 Finds all documents on the system's document directories which 741 Finds all documents on the system's document directories which
738 match the filter \a mimefilter, and appends the resulting DocLnk 742 match the filter \a mimefilter, and appends the resulting DocLnk
739 objects to \a folder. 743 objects to \a folder.
740*/ 744*/
741void Global::findDocuments(DocLnkSet* folder, const QString &mimefilter) 745void Global::findDocuments(DocLnkSet* folder, const QString &mimefilter)
742{ 746{
743 QString homedocs = QString(getenv("HOME")) + "/Documents"; 747 QString homedocs = QString(getenv("HOME")) + "/Documents";
744 DocLnkSet d(homedocs,mimefilter); 748 DocLnkSet d(homedocs,mimefilter);
745 folder->appendFrom(d); 749 folder->appendFrom(d);
746 /** let's do intellegint way of searching these files 750 /** let's do intellegint way of searching these files
747 * a) the user don't want to check mediums global 751 * a) the user don't want to check mediums global
748 * b) the user wants to check but use the global options for it 752 * b) the user wants to check but use the global options for it
749 * c) the user wants to check it but not this medium 753 * c) the user wants to check it but not this medium
750 * d) the user wants to check and this medium as well 754 * d) the user wants to check and this medium as well
751 * 755 *
752 * In all cases we need to apply a different mimefilter to 756 * In all cases we need to apply a different mimefilter to
753 * the medium. 757 * the medium.
754 * a) mimefilter.isEmpty() we need to apply the responding filter 758 * a) mimefilter.isEmpty() we need to apply the responding filter
755 * either the global or the one on the medium 759 * either the global or the one on the medium
756 * 760 *
757 * b) mimefilter is set to an application we need to find out if the 761 * b) mimefilter is set to an application we need to find out if the
758 * mimetypes are included in the mime mask of the medium 762 * mimetypes are included in the mime mask of the medium
759 */ 763 */
760 StorageInfo storage; 764 StorageInfo storage;
761 const QList<FileSystem> &fs = storage.fileSystems(); 765 const QList<FileSystem> &fs = storage.fileSystems();
762 QListIterator<FileSystem> it ( fs ); 766 QListIterator<FileSystem> it ( fs );
763 for ( ; it.current(); ++it ) { 767 for ( ; it.current(); ++it ) {
764 if ( (*it)->isRemovable() ) { // let's find out if we should search on it 768 if ( (*it)->isRemovable() ) { // let's find out if we should search on it
765 // this is a candidate look at the cf and see if we should search on it 769 // this is a candidate look at the cf and see if we should search on it
766 QString path = (*it)->path(); 770 QString path = (*it)->path();
767 if( !checkStorage((*it)->path() + "/.opiestorage.cf" ) ) 771 if( !checkStorage((*it)->path() + "/.opiestorage.cf" ) )
768 continue; 772 continue;
769 DocLnkSet ide( path, mimefilter ); 773 DocLnkSet ide( path, mimefilter );
770 folder->appendFrom(ide); 774 folder->appendFrom(ide);
771 } else if ( (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs" ) { 775 } else if ( (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs" ) {
772 QString path = (*it)->path() + "/Documents"; 776 QString path = (*it)->path() + "/Documents";
773 DocLnkSet ide( path, mimefilter ); 777 DocLnkSet ide( path, mimefilter );
774 folder->appendFrom(ide); 778 folder->appendFrom(ide);
775 } 779 }
776 } 780 }
777} 781}
778 782
779QStringList Global::languageList() 783QStringList Global::languageList()
780{ 784{
781 QString lang = getenv("LANG"); 785 QString lang = getenv("LANG");
782 QStringList langs; 786 QStringList langs;
783 langs.append(lang); 787 langs.append(lang);
784 int i = lang.find("."); 788 int i = lang.find(".");
785 if ( i > 0 ) 789 if ( i > 0 )
786 lang = lang.left( i ); 790 lang = lang.left( i );
787 i = lang.find( "_" ); 791 i = lang.find( "_" );
788 if ( i > 0 ) 792 if ( i > 0 )
789 langs.append(lang.left(i)); 793 langs.append(lang.left(i));
790 return langs; 794 return langs;
791} 795}
792 796
793QStringList Global::helpPath() 797QStringList Global::helpPath()
794{ 798{
795 QString qpeDir = QPEApplication::qpeDir(); 799 QString qpeDir = QPEApplication::qpeDir();
796 QStringList path; 800 QStringList path;
797 QStringList langs = Global::languageList(); 801 QStringList langs = Global::languageList();
798 for (QStringList::ConstIterator it = langs.fromLast(); it!=langs.end(); --it) { 802 for (QStringList::ConstIterator it = langs.fromLast(); it!=langs.end(); --it) {
799 QString lang = *it; 803 QString lang = *it;
800 if ( !lang.isEmpty() ) 804 if ( !lang.isEmpty() )
801 path += qpeDir + "/help/" + lang + "/html"; 805 path += qpeDir + "/help/" + lang + "/html";
802 } 806 }
803 path += qpeDir + "/pics"; 807 path += qpeDir + "/pics";
804 path += qpeDir + "/help/html"; 808 path += qpeDir + "/help/html";
805 /* we even put english into the en dir so try it as fallback as well for opie */ 809 /* we even put english into the en dir so try it as fallback as well for opie */
806 path += qpeDir + "/help/en/html"; 810 path += qpeDir + "/help/en/html";
807 path += qpeDir + "/docs"; 811 path += qpeDir + "/docs";
808 812
809 813
810 return path; 814 return path;
811} 815}
812 816
813 817
814#include "global.moc" 818#include "global.moc"
diff --git a/library/library.pro b/library/library.pro
index ab1f451..5acfc0c 100644
--- a/library/library.pro
+++ b/library/library.pro
@@ -1,157 +1,157 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 #CONFIG += qt warn_on release 2 #CONFIG += qt warn_on release
3 CONFIG += qt warn_on debug 3 CONFIG += qt warn_on debug
4 HEADERS= calendar.h \ 4 HEADERS= calendar.h \
5 global.h \ 5 global.h \
6 resource.h \ 6 resource.h \
7 xmlreader.h \ 7 xmlreader.h \
8 mimetype.h \ 8 mimetype.h \
9 menubutton.h \ 9 menubutton.h \
10 network.h \ 10 network.h \
11 networkinterface.h \ 11 networkinterface.h \
12 filemanager.h \ 12 filemanager.h \
13 fontmanager.h \ 13 fontmanager.h \
14 qdawg.h \ 14 qdawg.h \
15 datebookmonth.h \ 15 datebookmonth.h \
16 fileselector.h \ 16 fileselector.h \
17 fileselector_p.h \ 17 fileselector_p.h \
18 imageedit.h \ 18 imageedit.h \
19 qcopenvelope_qws.h \ 19 qcopenvelope_qws.h \
20 qpedecoration_qws.h \ 20 qpedecoration_qws.h \
21 qpeapplication.h \ 21 qpeapplication.h \
22 qpestyle.h \ 22 qpestyle.h \
23 qpedialog.h \ 23 qpedialog.h \
24 lightstyle.h \ 24 lightstyle.h \
25 config.h \ 25 config.h \
26 applnk.h \ 26 applnk.h \
27 sound.h \ 27 sound.h \
28 tzselect.h \ 28 tzselect.h \
29 qmath.h \ 29 qmath.h \
30 datebookdb.h \ 30 datebookdb.h \
31 alarmserver.h \ 31 alarmserver.h \
32 process.h \ 32 process.h \
33 password.h \ 33 password.h \
34 timestring.h \ 34 timestring.h \
35 fontfactoryinterface.h \ 35 fontfactoryinterface.h \
36 fontdatabase.h \ 36 fontdatabase.h \
37 power.h \ 37 power.h \
38 storage.h \ 38 storage.h \
39 qpemessagebox.h \ 39 qpemessagebox.h \
40 timeconversion.h \ 40 timeconversion.h \
41 qpedebug.h \ 41 qpedebug.h \
42 qpemenubar.h \ 42 qpemenubar.h \
43 qpetoolbar.h \ 43 qpetoolbar.h \
44 backend/categories.h \ 44 backend/categories.h \
45 stringutil.h \ 45 stringutil.h \
46 backend/palmtoprecord.h \ 46 backend/palmtoprecord.h \
47 backend/task.h \ 47 backend/task.h \
48 backend/event.h \ 48 backend/event.h \
49 backend/contact.h\ 49 backend/contact.h\
50 categorymenu.h \ 50 categorymenu.h \
51 categoryedit_p.h \ 51 categoryedit_p.h \
52 categoryselect.h \ 52 categoryselect.h \
53 categorywidget.h \ 53 categorywidget.h \
54 ir.h \ 54 ir.h \
55 backend/vobject_p.h \ 55 backend/vobject_p.h \
56 findwidget_p.h \ 56 findwidget_p.h \
57 finddialog.h \ 57 finddialog.h \
58 lnkproperties.h \ 58 lnkproperties.h \
59 windowdecorationinterface.h \ 59 windowdecorationinterface.h \
60 textcodecinterface.h \ 60 textcodecinterface.h \
61 imagecodecinterface.h \ 61 imagecodecinterface.h \
62 qt_override_p.h 62 qt_override_p.h
63 63
64 SOURCES= calendar.cpp \ 64 SOURCES= calendar.cpp \
65 global.cpp \ 65 global.cpp \
66 xmlreader.cpp \ 66 xmlreader.cpp \
67 mimetype.cpp \ 67 mimetype.cpp \
68 menubutton.cpp \ 68 menubutton.cpp \
69 network.cpp \ 69 network.cpp \
70 networkinterface.cpp \ 70 networkinterface.cpp \
71 filemanager.cpp \ 71 filemanager.cpp \
72 fontmanager.cpp \ 72 fontmanager.cpp \
73 qdawg.cpp \ 73 qdawg.cpp \
74 datebookmonth.cpp \ 74 datebookmonth.cpp \
75 fileselector.cpp \ 75 fileselector.cpp \
76 imageedit.cpp \ 76 imageedit.cpp \
77 resource.cpp \ 77 resource.cpp \
78 qpedecoration_qws.cpp \ 78 qpedecoration_qws.cpp \
79 qcopenvelope_qws.cpp \ 79 qcopenvelope_qws.cpp \
80 qpeapplication.cpp \ 80 qpeapplication.cpp \
81 qpestyle.cpp \ 81 qpestyle.cpp \
82 qpedialog.cpp \ 82 qpedialog.cpp \
83 lightstyle.cpp \ 83 lightstyle.cpp \
84 config.cpp \ 84 config.cpp \
85 applnk.cpp \ 85 applnk.cpp \
86 sound.cpp \ 86 sound.cpp \
87 tzselect.cpp \ 87 tzselect.cpp \
88 qmath.c \ 88 qmath.c \
89 datebookdb.cpp \ 89 datebookdb.cpp \
90 alarmserver.cpp \ 90 alarmserver.cpp \
91 password.cpp \ 91 password.cpp \
92 process.cpp \ 92 process.cpp \
93 process_unix.cpp \ 93 process_unix.cpp \
94 timestring.cpp \ 94 timestring.cpp \
95 fontdatabase.cpp \ 95 fontdatabase.cpp \
96 power.cpp \ 96 power.cpp \
97 storage.cpp \ 97 storage.cpp \
98 qpemessagebox.cpp \ 98 qpemessagebox.cpp \
99 backend/timeconversion.cpp \ 99 backend/timeconversion.cpp \
100 qpedebug.cpp \ 100 qpedebug.cpp \
101 qpemenubar.cpp \ 101 qpemenubar.cpp \
102 qpetoolbar.cpp \ 102 qpetoolbar.cpp \
103 backend/categories.cpp \ 103 backend/categories.cpp \
104 backend/stringutil.cpp \ 104 backend/stringutil.cpp \
105 backend/palmtoprecord.cpp \ 105 backend/palmtoprecord.cpp \
106 backend/task.cpp \ 106 backend/task.cpp \
107 backend/event.cpp \ 107 backend/event.cpp \
108 backend/contact.cpp \ 108 backend/contact.cpp \
109 categorymenu.cpp \ 109 categorymenu.cpp \
110 categoryedit_p.cpp \ 110 categoryedit_p.cpp \
111 categoryselect.cpp \ 111 categoryselect.cpp \
112 categorywidget.cpp \ 112 categorywidget.cpp \
113 ir.cpp \ 113 ir.cpp \
114 backend/vcc_yacc.cpp \ 114 backend/vcc_yacc.cpp \
115 backend/vobject.cpp \ 115 backend/vobject.cpp \
116 findwidget_p.cpp \ 116 findwidget_p.cpp \
117 finddialog.cpp \ 117 finddialog.cpp \
118 lnkproperties.cpp \ 118 lnkproperties.cpp \
119 qt_override.cpp 119 qt_override.cpp
120 120
121 121
122 122
123# Qt 3 compatibility 123# Qt 3 compatibility
124HEADERS += quuid.h qcom.h qlibrary.h qlibrary_p.h 124HEADERS += quuid.h qcom.h qlibrary.h qlibrary_p.h
125SOURCES += quuid.cpp qlibrary.cpp qlibrary_unix.cpp 125SOURCES += quuid.cpp qlibrary.cpp qlibrary_unix.cpp
126INCLUDEPATH += $(OPIEDIR)/include backend 126INCLUDEPATH += $(OPIEDIR)/include backend
127 LIBS += -ldl -lcrypt -lm 127 # LIBS += -ldl -lcrypt -lm
128INTERFACES = passwordbase_p.ui categoryeditbase_p.ui findwidgetbase_p.ui lnkpropertiesbase_p.ui 128INTERFACES = passwordbase_p.ui categoryeditbase_p.ui findwidgetbase_p.ui lnkpropertiesbase_p.ui
129 TARGET = qpe 129 TARGET = qpe
130 DESTDIR = $(OPIEDIR)/lib$(PROJMAK) 130 DESTDIR = $(OPIEDIR)/lib$(PROJMAK)
131 VERSION = 1.5.0.1 131 VERSION = 1.5.0.1
132 132
133TRANSLATIONS = ../i18n/de/libqpe.ts \ 133TRANSLATIONS = ../i18n/de/libqpe.ts \
134 ../i18n/nl/libqpe.ts \ 134 ../i18n/nl/libqpe.ts \
135 ../i18n/xx/libqpe.ts \ 135 ../i18n/xx/libqpe.ts \
136 ../i18n/en/libqpe.ts \ 136 ../i18n/en/libqpe.ts \
137 ../i18n/es/libqpe.ts \ 137 ../i18n/es/libqpe.ts \
138 ../i18n/fr/libqpe.ts \ 138 ../i18n/fr/libqpe.ts \
139 ../i18n/hu/libqpe.ts \ 139 ../i18n/hu/libqpe.ts \
140 ../i18n/ja/libqpe.ts \ 140 ../i18n/ja/libqpe.ts \
141 ../i18n/ko/libqpe.ts \ 141 ../i18n/ko/libqpe.ts \
142 ../i18n/no/libqpe.ts \ 142 ../i18n/no/libqpe.ts \
143 ../i18n/pl/libqpe.ts \ 143 ../i18n/pl/libqpe.ts \
144 ../i18n/pt/libqpe.ts \ 144 ../i18n/pt/libqpe.ts \
145 ../i18n/pt_BR/libqpe.ts \ 145 ../i18n/pt_BR/libqpe.ts \
146 ../i18n/sl/libqpe.ts \ 146 ../i18n/sl/libqpe.ts \
147 ../i18n/zh_CN/libqpe.ts \ 147 ../i18n/zh_CN/libqpe.ts \
148 ../i18n/it/libqpe.ts \ 148 ../i18n/it/libqpe.ts \
149 ../i18n/zh_TW/libqpe.ts \ 149 ../i18n/zh_TW/libqpe.ts \
150 ../i18n/da/libqpe.ts 150 ../i18n/da/libqpe.ts
151 151
152 152
153include ( $(OPIEDIR)/include.pro ) 153include ( $(OPIEDIR)/include.pro )
154 154
155contains( CONFIG, no-override ){ 155contains( CONFIG, no-override ){
156 DEFINES += OPIE_NO_OVERRIDE_QT 156 DEFINES += OPIE_NO_OVERRIDE_QT
157} 157}
diff --git a/library/network.cpp b/library/network.cpp
index 3568809..991e11a 100644
--- a/library/network.cpp
+++ b/library/network.cpp
@@ -1,444 +1,448 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#define QTOPIA_INTERNAL_LANGLIST 21#define QTOPIA_INTERNAL_LANGLIST
22#include "qpe/network.h" 22#include "qpe/network.h"
23#include "qpe/networkinterface.h" 23#include "qpe/networkinterface.h"
24#include "qpe/global.h" 24#include "qpe/global.h"
25#include "qpe/config.h" 25#include "qpe/config.h"
26#include "qpe/resource.h" 26#include "qpe/resource.h"
27#include "qpe/qpeapplication.h" 27#include "qpe/qpeapplication.h"
28#include <qpe/qcopenvelope_qws.h> 28#include <qpe/qcopenvelope_qws.h>
29#include <qpe/qlibrary.h> 29#include <qpe/qlibrary.h>
30 30
31#include <qlistbox.h> 31#include <qlistbox.h>
32#include <qdir.h> 32#include <qdir.h>
33#include <qlayout.h> 33#include <qlayout.h>
34#include <qdict.h> 34#include <qdict.h>
35#include <qtranslator.h> 35#include <qtranslator.h>
36 36
37#include <stdlib.h> 37#include <stdlib.h>
38 38
39#ifndef QT_NO_COP 39#ifndef QT_NO_COP
40class NetworkEmitter : public QCopChannel { 40class NetworkEmitter : public QCopChannel {
41 Q_OBJECT 41 Q_OBJECT
42public: 42public:
43 NetworkEmitter() : QCopChannel("QPE/Network",qApp) 43 NetworkEmitter() : QCopChannel("QPE/Network",qApp)
44 { 44 {
45 } 45 }
46 46
47 void receive(const QCString &msg, const QByteArray&) 47 void receive(const QCString &msg, const QByteArray&)
48 { 48 {
49 if ( msg == "choicesChanged()" ) 49 if ( msg == "choicesChanged()" )
50 emit changed(); 50 emit changed();
51 } 51 }
52 52
53signals: 53signals:
54 void changed(); 54 void changed();
55}; 55};
56 56
57/*! 57/*!
58 \internal 58 \internal
59 59
60 Requests that the service \a choice be started. The \a password is 60 Requests that the service \a choice be started. The \a password is
61 the password to use if required. 61 the password to use if required.
62*/ 62*/
63void Network::start(const QString& choice, const QString& password) 63void Network::start(const QString& choice, const QString& password)
64{ 64{
65 QCopEnvelope e("QPE/Network", "start(QString,QString)"); 65 QCopEnvelope e("QPE/Network", "start(QString,QString)");
66 e << choice << password; 66 e << choice << password;
67} 67}
68 68
69/*! 69/*!
70 \class Network network.h 70 \class Network network.h
71 \brief The Network class provides network access functionality. 71 \brief The Network class provides network access functionality.
72 \internal 72 \internal
73*/ 73*/
74 74
75// copy the proxy settings of the active config over to the Proxies.conf file 75// copy the proxy settings of the active config over to the Proxies.conf file
76/*! 76/*!
77 \internal 77 \internal
78*/ 78*/
79void Network::writeProxySettings( Config &cfg ) 79void Network::writeProxySettings( Config &cfg )
80{ 80{
81 Config proxy( Network::settingsDir() + "/Proxies.conf", Config::File ); 81 Config proxy( Network::settingsDir() + "/Proxies.conf", Config::File );
82 proxy.setGroup("Properties"); 82 proxy.setGroup("Properties");
83 cfg.setGroup("Proxy"); 83 cfg.setGroup("Proxy");
84 proxy.writeEntry("type", cfg.readEntry("type") ); 84 proxy.writeEntry("type", cfg.readEntry("type") );
85 proxy.writeEntry("autoconfig", cfg.readEntry("autoconfig") ); 85 proxy.writeEntry("autoconfig", cfg.readEntry("autoconfig") );
86 proxy.writeEntry("httphost", cfg.readEntry("httphost") ); 86 proxy.writeEntry("httphost", cfg.readEntry("httphost") );
87 proxy.writeEntry("httpport", cfg.readEntry("httpport") ); 87 proxy.writeEntry("httpport", cfg.readEntry("httpport") );
88 proxy.writeEntry("ftphost", cfg.readEntry("ftphost") ); 88 proxy.writeEntry("ftphost", cfg.readEntry("ftphost") );
89 proxy.writeEntry("ftpport", cfg.readEntry("ftpport") ); 89 proxy.writeEntry("ftpport", cfg.readEntry("ftpport") );
90 proxy.writeEntry("noproxies", cfg.readEntry("noproxies") ); 90 proxy.writeEntry("noproxies", cfg.readEntry("noproxies") );
91 cfg.setGroup("Properties"); 91 cfg.setGroup("Properties");
92} 92}
93 93
94 94
95 95
96/*! 96/*!
97 \internal 97 \internal
98 98
99 Stops the current network service. 99 Stops the current network service.
100*/ 100*/
101void Network::stop() 101void Network::stop()
102{ 102{
103 QCopEnvelope e("QPE/Network", "stop()"); 103 QCopEnvelope e("QPE/Network", "stop()");
104} 104}
105 105
106static NetworkEmitter *emitter = 0; 106static NetworkEmitter *emitter = 0;
107 107
108/*! 108/*!
109 \internal 109 \internal
110*/ 110*/
111void Network::connectChoiceChange(QObject* receiver, const char* slot) 111void Network::connectChoiceChange(QObject* receiver, const char* slot)
112{ 112{
113 if ( !emitter ) 113 if ( !emitter )
114 emitter = new NetworkEmitter; 114 emitter = new NetworkEmitter;
115 QObject::connect(emitter,SIGNAL(changed()),receiver,slot); 115 QObject::connect(emitter,SIGNAL(changed()),receiver,slot);
116} 116}
117 117
118 #endif// QT_NO_COP 118 #endif// QT_NO_COP
119/*! 119/*!
120 \internal 120 \internal
121*/ 121*/
122QString Network::settingsDir() 122QString Network::settingsDir()
123{ 123{
124 return Global::applicationFileName("Network", "modules"); 124 return Global::applicationFileName("Network", "modules");
125} 125}
126 126
127#ifndef QT_NO_COP 127#ifndef QT_NO_COP
128/*! 128/*!
129 \internal 129 \internal
130*/ 130*/
131QStringList Network::choices(QListBox* lb, const QString& dir) 131QStringList Network::choices(QListBox* lb, const QString& dir)
132{ 132{
133 QStringList list; 133 QStringList list;
134 134
135 if ( lb ) 135 if ( lb )
136 lb->clear(); 136 lb->clear();
137 137
138 QString adir = dir.isEmpty() ? settingsDir() : dir; 138 QString adir = dir.isEmpty() ? settingsDir() : dir;
139 QDir settingsdir(adir); 139 QDir settingsdir(adir);
140 settingsdir.mkdir(adir); 140 settingsdir.mkdir(adir);
141 141
142 QStringList files = settingsdir.entryList("*.conf"); 142 QStringList files = settingsdir.entryList("*.conf");
143 for (QStringList::ConstIterator it=files.begin(); it!=files.end(); ++it ) { 143 for (QStringList::ConstIterator it=files.begin(); it!=files.end(); ++it ) {
144 QString filename = settingsdir.filePath(*it); 144 QString filename = settingsdir.filePath(*it);
145 Config cfg(filename, Config::File); 145 Config cfg(filename, Config::File);
146 cfg.setGroup("Info"); 146 cfg.setGroup("Info");
147 if ( lb ) 147 if ( lb )
148 lb->insertItem(Resource::loadPixmap("Network/" + cfg.readEntry("Type")), 148 lb->insertItem(Resource::loadPixmap("Network/" + cfg.readEntry("Type")),
149 cfg.readEntry("Name")); 149 cfg.readEntry("Name"));
150 list.append(filename); 150 list.append(filename);
151 } 151 }
152 152
153 return list; 153 return list;
154} 154}
155 155
156class NetworkServer : public QCopChannel { 156class NetworkServer : public QCopChannel {
157 Q_OBJECT 157 Q_OBJECT
158public: 158public:
159 NetworkServer(QObject* parent) : QCopChannel("QPE/Network",parent), wait(0) 159 NetworkServer(QObject* parent) : QCopChannel("QPE/Network",parent), wait(0)
160 { 160 {
161 up = FALSE; 161 up = FALSE;
162 examineNetworks( TRUE ); 162 examineNetworks( TRUE );
163 QCopChannel* card = new QCopChannel("QPE/Card",parent); 163 QCopChannel* card = new QCopChannel("QPE/Card",parent);
164 connect(card,SIGNAL(received(const QCString &, const QByteArray&)), 164 connect(card,SIGNAL(received(const QCString &, const QByteArray&)),
165 this,SLOT(cardMessage(const QCString &, const QByteArray&))); 165 this,SLOT(cardMessage(const QCString &, const QByteArray&)));
166 } 166 }
167 167
168 ~NetworkServer() 168 ~NetworkServer()
169 { 169 {
170 stop(); 170 stop();
171 } 171 }
172 172
173 bool networkOnline() const 173 bool networkOnline() const
174 { 174 {
175 return up; 175 return up;
176 } 176 }
177 177
178private: 178private:
179 void receive(const QCString &msg, const QByteArray& data) 179 void receive(const QCString &msg, const QByteArray& data)
180 { 180 {
181 if ( msg == "start(QString,QString)" ) { 181 if ( msg == "start(QString,QString)" ) {
182 QDataStream stream(data,IO_ReadOnly); 182 QDataStream stream(data,IO_ReadOnly);
183 QString file,password; 183 QString file,password;
184 stream >> file >> password; 184 stream >> file >> password;
185 if ( file.isEmpty() ) { 185 if ( file.isEmpty() ) {
186 QStringList l = Network::choices(); 186 QStringList l = Network::choices();
187 for (QStringList::ConstIterator i=l.begin(); i!=l.end(); ++i) { 187 for (QStringList::ConstIterator i=l.begin(); i!=l.end(); ++i) {
188 Config cfg(*i,Config::File); 188 Config cfg(*i,Config::File);
189 cfg.setGroup("Info"); 189 cfg.setGroup("Info");
190 QString type = cfg.readEntry("Type"); 190 QString type = cfg.readEntry("Type");
191 NetworkInterface* plugin = Network::loadPlugin(type); 191 NetworkInterface* plugin = Network::loadPlugin(type);
192 cfg.setGroup("Properties"); 192 cfg.setGroup("Properties");
193 if ( plugin && plugin->isAvailable(cfg) ) { 193 if ( plugin && plugin->isAvailable(cfg) ) {
194 file = *i; 194 file = *i;
195 break; 195 break;
196 } 196 }
197 } 197 }
198 if ( file.isEmpty() ) { 198 if ( file.isEmpty() ) {
199 QCopEnvelope("QPE/Network", "failed()"); 199 QCopEnvelope("QPE/Network", "failed()");
200 return; 200 return;
201 } 201 }
202 } 202 }
203 start(file,password); 203 start(file,password);
204 } else if ( msg == "stop()" ) { 204 } else if ( msg == "stop()" ) {
205 stop(); 205 stop();
206 } else if ( msg == "choicesChanged()" ) { 206 } else if ( msg == "choicesChanged()" ) {
207 examineNetworks(); 207 examineNetworks();
208 } 208 }
209 } 209 }
210 210
211private slots: 211private slots:
212 void cardMessage(const QCString &msg, const QByteArray&) 212 void cardMessage(const QCString &msg, const QByteArray&)
213 { 213 {
214 if ( msg == "stabChanged()" ) 214 if ( msg == "stabChanged()" )
215 examineNetworks(); 215 examineNetworks();
216 } 216 }
217 217
218private: 218private:
219 void examineNetworks( bool firstStart = FALSE ) 219 void examineNetworks( bool firstStart = FALSE )
220 { 220 {
221 QStringList l = Network::choices(); 221 QStringList l = Network::choices();
222 bool wasup = up; up=FALSE; 222 bool wasup = up; up=FALSE;
223 QStringList pavailable = available; 223 QStringList pavailable = available;
224 available.clear(); 224 available.clear();
225 for (QStringList::ConstIterator it=l.begin(); it!=l.end(); ++it) { 225 for (QStringList::ConstIterator it=l.begin(); it!=l.end(); ++it) {
226 Config cfg(*it,Config::File); 226 Config cfg(*it,Config::File);
227 cfg.setGroup("Info"); 227 cfg.setGroup("Info");
228 QString type = cfg.readEntry("Type"); 228 QString type = cfg.readEntry("Type");
229 NetworkInterface* plugin = Network::loadPlugin(type); 229 NetworkInterface* plugin = Network::loadPlugin(type);
230 cfg.setGroup("Properties"); 230 cfg.setGroup("Properties");
231 if ( plugin ) { 231 if ( plugin ) {
232 if ( plugin->isActive(cfg) ) { 232 if ( plugin->isActive(cfg) ) {
233 up = TRUE; 233 up = TRUE;
234 if ( firstStart ) 234 if ( firstStart )
235 plugin->start( cfg ); 235 plugin->start( cfg );
236 } 236 }
237 if ( plugin->isAvailable(cfg) ) 237 if ( plugin->isAvailable(cfg) )
238 available.append(*it); 238 available.append(*it);
239 } 239 }
240 } 240 }
241 241
242 // Try to work around unreproducible bug whereby 242 // Try to work around unreproducible bug whereby
243 // the netmon applet shows wrong state. 243 // the netmon applet shows wrong state.
244 bool reannounce = wait<0; 244 bool reannounce = wait<0;
245 245
246 if ( available != pavailable || reannounce ) { 246 if ( available != pavailable || reannounce ) {
247 QCopEnvelope e("QPE/Network", "available(QStringList)"); 247 QCopEnvelope e("QPE/Network", "available(QStringList)");
248 e << available; 248 e << available;
249 } 249 }
250 if ( up != wasup || reannounce ) { 250 if ( up != wasup || reannounce ) {
251 QCopEnvelope("QPE/Network", up ? "up()" : "down()"); 251 QCopEnvelope("QPE/Network", up ? "up()" : "down()");
252 } 252 }
253 } 253 }
254 254
255 void start( const QString& file, const QString& password ) 255 void start( const QString& file, const QString& password )
256 { 256 {
257 if ( !current.isEmpty() ) 257 if ( !current.isEmpty() )
258 stop(); 258 stop();
259 current = QString::null; 259 current = QString::null;
260 Config cfg(file, Config::File); 260 Config cfg(file, Config::File);
261 cfg.setGroup("Info"); 261 cfg.setGroup("Info");
262 QString type = cfg.readEntry("Type"); 262 QString type = cfg.readEntry("Type");
263 NetworkInterface* plugin = Network::loadPlugin(type); 263 NetworkInterface* plugin = Network::loadPlugin(type);
264 bool started = FALSE; 264 bool started = FALSE;
265 if ( plugin ) { 265 if ( plugin ) {
266 cfg.setGroup("Properties"); 266 cfg.setGroup("Properties");
267 if ( plugin->start(cfg,password) ) { 267 if ( plugin->start(cfg,password) ) {
268 Network::writeProxySettings( cfg ); 268 Network::writeProxySettings( cfg );
269 current = file; 269 current = file;
270 wait=0; 270 wait=0;
271 startTimer(400); 271 startTimer(400);
272 started = TRUE; 272 started = TRUE;
273 } 273 }
274 } 274 }
275 if ( !started ) { 275 if ( !started ) {
276 QCopEnvelope("QPE/Network", "failed()"); 276 QCopEnvelope("QPE/Network", "failed()");
277 } 277 }
278 } 278 }
279 279
280 void stop() 280 void stop()
281 { 281 {
282 bool stopped = FALSE; 282 bool stopped = FALSE;
283 if ( !current.isEmpty() ) { 283 if ( !current.isEmpty() ) {
284 Config cfg(current, Config::File); 284 Config cfg(current, Config::File);
285 cfg.setGroup("Info"); 285 cfg.setGroup("Info");
286 QString type = cfg.readEntry("Type"); 286 QString type = cfg.readEntry("Type");
287 NetworkInterface* plugin = Network::loadPlugin(type); 287 NetworkInterface* plugin = Network::loadPlugin(type);
288 if ( plugin ) { 288 if ( plugin ) {
289 cfg.setGroup("Properties"); 289 cfg.setGroup("Properties");
290 if ( plugin->stop(cfg) ) { 290 if ( plugin->stop(cfg) ) {
291 current = QString::null; 291 current = QString::null;
292 wait=0; 292 wait=0;
293 startTimer(400); 293 startTimer(400);
294 stopped = TRUE; 294 stopped = TRUE;
295 } 295 }
296 } 296 }
297 } 297 }
298 if ( !stopped ) { 298 if ( !stopped ) {
299 QCopEnvelope("QPE/Network", "failed()"); 299 QCopEnvelope("QPE/Network", "failed()");
300 } 300 }
301 } 301 }
302 302
303 void timerEvent(QTimerEvent*) 303 void timerEvent(QTimerEvent*)
304 { 304 {
305 examineNetworks(); 305 examineNetworks();
306 if ( wait >= 0 ) { 306 if ( wait >= 0 ) {
307 if ( up == !current.isNull() ) { 307 if ( up == !current.isNull() ) {
308 // done 308 // done
309 killTimers(); 309 killTimers();
310 if ( up ) { 310 if ( up ) {
311 startTimer(3000); // monitor link 311 startTimer(3000); // monitor link
312 wait = -1; 312 wait = -1;
313 } 313 }
314 } else { 314 } else {
315 wait++; 315 wait++;
316 if ( wait == 600 ) { 316 if ( wait == 600 ) {
317 killTimers(); // forget about it after 240 s 317 killTimers(); // forget about it after 240 s
318 QCopEnvelope("QPE/Network", "failed()"); 318 QCopEnvelope("QPE/Network", "failed()");
319 up = !current.isNull(); 319 up = !current.isNull();
320 } 320 }
321 } 321 }
322 } else if ( !up ) { 322 } else if ( !up ) {
323 killTimers(); 323 killTimers();
324 } 324 }
325 } 325 }
326 326
327private: 327private:
328 QStringList available; 328 QStringList available;
329 QString current; 329 QString current;
330 bool up; 330 bool up;
331 int wait; 331 int wait;
332}; 332};
333 333
334static NetworkServer* ns=0; 334static NetworkServer* ns=0;
335 335
336/*! 336/*!
337 \internal 337 \internal
338*/ 338*/
339QString Network::serviceName(const QString& service) 339QString Network::serviceName(const QString& service)
340{ 340{
341 Config cfg(service, Config::File); 341 Config cfg(service, Config::File);
342 cfg.setGroup("Info"); 342 cfg.setGroup("Info");
343 return cfg.readEntry("Name"); 343 return cfg.readEntry("Name");
344} 344}
345 345
346/*! 346/*!
347 \internal 347 \internal
348*/ 348*/
349QString Network::serviceType(const QString& service) 349QString Network::serviceType(const QString& service)
350{ 350{
351 Config cfg(service, Config::File); 351 Config cfg(service, Config::File);
352 cfg.setGroup("Info"); 352 cfg.setGroup("Info");
353 return cfg.readEntry("Type"); 353 return cfg.readEntry("Type");
354} 354}
355 355
356/*! 356/*!
357 \internal 357 \internal
358*/ 358*/
359bool Network::serviceNeedsPassword(const QString& service) 359bool Network::serviceNeedsPassword(const QString& service)
360{ 360{
361 Config cfg(service,Config::File); 361 Config cfg(service,Config::File);
362 cfg.setGroup("Info"); 362 cfg.setGroup("Info");
363 QString type = cfg.readEntry("Type"); 363 QString type = cfg.readEntry("Type");
364 NetworkInterface* plugin = Network::loadPlugin(type); 364 NetworkInterface* plugin = Network::loadPlugin(type);
365 cfg.setGroup("Properties"); 365 cfg.setGroup("Properties");
366 return plugin ? plugin->needPassword(cfg) : FALSE; 366 return plugin ? plugin->needPassword(cfg) : FALSE;
367} 367}
368 368
369/*! 369/*!
370 \internal 370 \internal
371*/ 371*/
372bool Network::networkOnline() 372bool Network::networkOnline()
373{ 373{
374 return ns && ns->networkOnline(); 374 return ns && ns->networkOnline();
375} 375}
376 376
377/*! 377/*!
378 \internal 378 \internal
379*/ 379*/
380void Network::createServer(QObject* parent) 380void Network::createServer(QObject* parent)
381{ 381{
382 ns = new NetworkServer(parent); 382 ns = new NetworkServer(parent);
383} 383}
384 384
385/*! 385/*!
386 \internal 386 \internal
387*/ 387*/
388int Network::addStateWidgets(QWidget* parent) 388int Network::addStateWidgets(QWidget* parent)
389{ 389{
390 int n=0; 390 int n=0;
391 QStringList l = Network::choices(); 391 QStringList l = Network::choices();
392 QVBoxLayout* vb = new QVBoxLayout(parent); 392 QVBoxLayout* vb = new QVBoxLayout(parent);
393 for (QStringList::ConstIterator it=l.begin(); it!=l.end(); ++it) { 393 for (QStringList::ConstIterator it=l.begin(); it!=l.end(); ++it) {
394 Config cfg(*it,Config::File); 394 Config cfg(*it,Config::File);
395 cfg.setGroup("Info"); 395 cfg.setGroup("Info");
396 QString type = cfg.readEntry("Type"); 396 QString type = cfg.readEntry("Type");
397 NetworkInterface* plugin = Network::loadPlugin(type); 397 NetworkInterface* plugin = Network::loadPlugin(type);
398 cfg.setGroup("Properties"); 398 cfg.setGroup("Properties");
399 if ( plugin ) { 399 if ( plugin ) {
400 QWidget* w; 400 QWidget* w;
401 if ( (w=plugin->addStateWidget(parent,cfg)) ) { 401 if ( (w=plugin->addStateWidget(parent,cfg)) ) {
402 n++; 402 n++;
403 vb->addWidget(w); 403 vb->addWidget(w);
404 } 404 }
405 } 405 }
406 } 406 }
407 return n; 407 return n;
408} 408}
409 409
410static QDict<NetworkInterface> *ifaces; 410static QDict<NetworkInterface> *ifaces;
411 411
412/*! 412/*!
413 \internal 413 \internal
414*/ 414*/
415NetworkInterface* Network::loadPlugin(const QString& type) 415NetworkInterface* Network::loadPlugin(const QString& type)
416{ 416{
417#ifndef QT_NO_COMPONENT 417#ifndef QT_NO_COMPONENT
418 if ( !ifaces ) ifaces = new QDict<NetworkInterface>; 418 if ( !ifaces ) ifaces = new QDict<NetworkInterface>;
419 NetworkInterface *iface = ifaces->find(type); 419 NetworkInterface *iface = ifaces->find(type);
420 if ( !iface ) { 420 if ( !iface ) {
421#ifdef Q_OS_MACX
422 QString libfile = QPEApplication::qpeDir() + "/plugins/network/lib" + type + ".dylib";
423#else
421 QString libfile = QPEApplication::qpeDir() + "/plugins/network/lib" + type + ".so"; 424 QString libfile = QPEApplication::qpeDir() + "/plugins/network/lib" + type + ".so";
425#endif
422 QLibrary lib(libfile); 426 QLibrary lib(libfile);
423 if ( !lib.queryInterface( IID_Network, (QUnknownInterface**)&iface ) == QS_OK ) 427 if ( !lib.queryInterface( IID_Network, (QUnknownInterface**)&iface ) == QS_OK )
424 return 0; 428 return 0;
425 ifaces->insert(type,iface); 429 ifaces->insert(type,iface);
426 QStringList langs = Global::languageList(); 430 QStringList langs = Global::languageList();
427 for (QStringList::ConstIterator it = langs.begin(); it!=langs.end(); ++it) { 431 for (QStringList::ConstIterator it = langs.begin(); it!=langs.end(); ++it) {
428 QString lang = *it; 432 QString lang = *it;
429 QTranslator * trans = new QTranslator(qApp); 433 QTranslator * trans = new QTranslator(qApp);
430 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/lib"+type+".qm"; 434 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/lib"+type+".qm";
431 if ( trans->load( tfn )) 435 if ( trans->load( tfn ))
432 qApp->installTranslator( trans ); 436 qApp->installTranslator( trans );
433 else 437 else
434 delete trans; 438 delete trans;
435 } 439 }
436 } 440 }
437 return iface; 441 return iface;
438#else 442#else
439 return 0; 443 return 0;
440#endif 444#endif
441} 445}
442 446
443#include "network.moc" 447#include "network.moc"
444 #endif// QT_NO_COP 448 #endif// QT_NO_COP
diff --git a/library/qlibrary_unix.cpp b/library/qlibrary_unix.cpp
index 7740321..0229b7b 100644
--- a/library/qlibrary_unix.cpp
+++ b/library/qlibrary_unix.cpp
@@ -1,132 +1,243 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "qlibrary_p.h" 21#include "qlibrary_p.h"
22 22
23#ifndef QT_NO_COMPONENT 23#ifndef QT_NO_COMPONENT
24 24
25/* 25/*
26 The platform dependent implementations of 26 The platform dependent implementations of
27 - loadLibrary 27 - loadLibrary
28 - freeLibrary 28 - freeLibrary
29 - resolveSymbol 29 - resolveSymbol
30 30
31 It's not too hard to guess what the functions do. 31 It's not too hard to guess what the functions do.
32*/ 32*/
33#if defined(Q_OS_HPUX) 33#if defined(Q_OS_HPUX)
34// for HP-UX < 11.x and 32 bit 34// for HP-UX < 11.x and 32 bit
35#include <dl.h> 35#include <dl.h>
36 36
37bool QLibraryPrivate::loadLibrary() 37bool QLibraryPrivate::loadLibrary()
38{ 38{
39 if ( pHnd ) 39 if ( pHnd )
40 return TRUE; 40 return TRUE;
41 41
42 QString filename = library->library(); 42 QString filename = library->library();
43 43
44 pHnd = (void*)shl_load( filename.latin1(), BIND_DEFERRED | BIND_NONFATAL | DYNAMIC_PATH, 0 ); 44 pHnd = (void*)shl_load( filename.latin1(), BIND_DEFERRED | BIND_NONFATAL | DYNAMIC_PATH, 0 );
45#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) 45#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT)
46 if ( !pHnd ) 46 if ( !pHnd )
47 qDebug( "Failed to load library %s!", filename.latin1() ); 47 qDebug( "Failed to load library %s!", filename.latin1() );
48#endif 48#endif
49 return pHnd != 0; 49 return pHnd != 0;
50} 50}
51 51
52bool QLibraryPrivate::freeLibrary() 52bool QLibraryPrivate::freeLibrary()
53{ 53{
54 if ( !pHnd ) 54 if ( !pHnd )
55 return TRUE; 55 return TRUE;
56 56
57 if ( !shl_unload( (shl_t)pHnd ) ) { 57 if ( !shl_unload( (shl_t)pHnd ) ) {
58 pHnd = 0; 58 pHnd = 0;
59 return TRUE; 59 return TRUE;
60 } 60 }
61 return FALSE; 61 return FALSE;
62} 62}
63 63
64void* QLibraryPrivate::resolveSymbol( const char* symbol ) 64void* QLibraryPrivate::resolveSymbol( const char* symbol )
65{ 65{
66 if ( !pHnd ) 66 if ( !pHnd )
67 return 0; 67 return 0;
68 68
69 void* address = 0; 69 void* address = 0;
70 if ( shl_findsym( (shl_t*)&pHnd, symbol, TYPE_UNDEFINED, address ) < 0 ) { 70 if ( shl_findsym( (shl_t*)&pHnd, symbol, TYPE_UNDEFINED, address ) < 0 ) {
71#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) 71#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT)
72 qDebug( "Couldn't resolve symbol \"%s\"", symbol ); 72 qDebug( "Couldn't resolve symbol \"%s\"", symbol );
73#endif 73#endif
74 return 0; 74 return 0;
75 } 75 }
76 return address; 76 return address;
77} 77}
78 78
79#else // Q_OS_HPUX 79#elif defined(_NULL_LIB_)
80
81bool QLibraryPrivate::loadLibrary()
82{
83 //qDebug("QLibraryPrivate::loadLibrary\n");
84 return FALSE;
85}
86bool QLibraryPrivate::freeLibrary()
87{
88 //qDebug("QLibraryPrivate::freeLibrary\n");
89 return FALSE;
90}
91void* QLibraryPrivate::resolveSymbol( const char* symbol )
92{
93 //qDebug("QLibraryPrivate::resolveSymbol\n");
94 return FALSE;
95}
96
97#elif defined(Q_OS_MACX)
98
99#define ENUM_DYLD_BOOL
100enum DYLD_BOOL {
101 DYLD_FALSE,
102 DYLD_TRUE
103};
104#include <mach-o/dyld.h>
105typedef struct {
106 NSObjectFileImage img;
107 NSModule mod;
108} DyldLibDesc;
109
110bool QLibraryPrivate::loadLibrary()
111{
112 // qDebug("QLibraryPrivate::loadLibrary\n");
113 // return FALSE;
114 if ( pHnd )
115 return TRUE;
116
117 QString filename = library->library();
118
119 NSObjectFileImage img = 0;
120 NSModule mod = 0;
121 NSObjectFileImageReturnCode ret = NSCreateObjectFileImageFromFile( filename.latin1() , &img );
122 if ( ret != NSObjectFileImageSuccess ) {
123 qWarning( "Error in NSCreateObjectFileImageFromFile(): %d; Filename: %s", ret, filename.latin1() );
124 if (ret == NSObjectFileImageAccess) {
125 qWarning ("(NSObjectFileImageAccess)" );
126 }
127 } else {
128 mod = NSLinkModule(img, filename.latin1(), NSLINKMODULE_OPTION_BINDNOW |
129 NSLINKMODULE_OPTION_PRIVATE |
130 NSLINKMODULE_OPTION_RETURN_ON_ERROR);
131 if (mod == 0) {
132 qWarning( "Error in NSLinkModule()" );
133 NSDestroyObjectFileImage(img);
134 }
135 }
136 DyldLibDesc* desc = 0;
137 if (img != 0 && mod != 0) {
138 desc = new DyldLibDesc;
139 desc->img = img;
140 desc->mod = mod;
141 }
142 pHnd = desc;
143 return pHnd != 0;
144}
145
146bool QLibraryPrivate::freeLibrary()
147{
148 //qDebug("QLibraryPrivate::freeLibrary\n");
149 //return FALSE;
150 if ( !pHnd )
151 return TRUE;
152
153 DyldLibDesc* desc = (DyldLibDesc*) pHnd;
154 NSModule mod = desc->mod;
155 NSObjectFileImage img = desc->img;
156 DYLD_BOOL success = NSUnLinkModule(mod, NSUNLINKMODULE_OPTION_NONE);
157 if ( success ) {
158 NSDestroyObjectFileImage(img);
159 delete desc;
160 pHnd = 0;
161 }
162#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT)
163 else {
164 qWarning( "Error in NSUnLinkModule(): %d", ret );
165 }
166#endif
167 return pHnd == 0;
168}
169
170void* QLibraryPrivate::resolveSymbol( const char* symbol )
171{
172 //qDebug("QLibraryPrivate::resolveSymbol\n");
173 //return FALSE;
174 if ( !pHnd )
175 return 0;
176
177 DyldLibDesc* desc = (DyldLibDesc*) pHnd;
178 NSSymbol sym = NSLookupSymbolInModule(desc->mod, symbol);
179 void* address = 0;
180 if (sym != 0) {
181 address = NSAddressOfSymbol(sym);
182 }
183#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT)
184 if ( address == 0 )
185 qWarning( "Cannot find symbol: %s", symbol );
186#endif
187 return address;
188}
189
190#else
80// Something else, assuming POSIX 191// Something else, assuming POSIX
81#include <dlfcn.h> 192#include <dlfcn.h>
82 193
83bool QLibraryPrivate::loadLibrary() 194bool QLibraryPrivate::loadLibrary()
84{ 195{
85 if ( pHnd ) 196 if ( pHnd )
86 return TRUE; 197 return TRUE;
87 198
88 QString filename = library->library(); 199 QString filename = library->library();
89 200
90 pHnd = dlopen( filename.latin1() , RTLD_LAZY ); 201 pHnd = dlopen( filename.latin1() , RTLD_LAZY );
91#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) 202#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT)
92 if ( !pHnd ) 203 if ( !pHnd )
93 qWarning( "%s", dlerror() ); 204 qWarning( "%s", dlerror() );
94#endif 205#endif
95 return pHnd != 0; 206 return pHnd != 0;
96} 207}
97 208
98bool QLibraryPrivate::freeLibrary() 209bool QLibraryPrivate::freeLibrary()
99{ 210{
100 if ( !pHnd ) 211 if ( !pHnd )
101 return TRUE; 212 return TRUE;
102 213
103 int ec = dlclose( pHnd ); 214 int ec = dlclose( pHnd );
104 if ( !ec ) 215 if ( !ec )
105 pHnd = 0; 216 pHnd = 0;
106#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) 217#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT)
107 else { 218 else {
108 const char* error = dlerror(); 219 const char* error = dlerror();
109 if ( error ) 220 if ( error )
110 qWarning( "%s", error ); 221 qWarning( "%s", error );
111 } 222 }
112#endif 223#endif
113 return pHnd == 0; 224 return pHnd == 0;
114} 225}
115 226
116void* QLibraryPrivate::resolveSymbol( const char* f ) 227void* QLibraryPrivate::resolveSymbol( const char* f )
117{ 228{
118 if ( !pHnd ) 229 if ( !pHnd )
119 return 0; 230 return 0;
120 231
121 void* address = dlsym( pHnd, f ); 232 void* address = dlsym( pHnd, f );
122#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) 233#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT)
123 const char* error = dlerror(); 234 const char* error = dlerror();
124 if ( error ) 235 if ( error )
125 qWarning( "%s", error ); 236 qWarning( "%s", error );
126#endif 237#endif
127 return address; 238 return address;
128} 239}
129 240
130#endif // POSIX 241#endif // POSIX
131 242
132#endif // QT_NO_COMPONENT 243#endif // QT_NO_COMPONENT
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index d4734ae..a97efc0 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -1,2074 +1,2099 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19*/ 19*/
20#define QTOPIA_INTERNAL_LANGLIST 20#define QTOPIA_INTERNAL_LANGLIST
21#include <stdlib.h> 21#include <stdlib.h>
22#include <unistd.h> 22#include <unistd.h>
23#ifndef Q_OS_MACX
23#include <linux/limits.h> // needed for some toolchains (PATH_MAX) 24#include <linux/limits.h> // needed for some toolchains (PATH_MAX)
25#endif
24#include <qfile.h> 26#include <qfile.h>
25#include <qqueue.h> 27#include <qqueue.h>
26#ifdef Q_WS_QWS 28#ifdef Q_WS_QWS
27#ifndef QT_NO_COP 29#ifndef QT_NO_COP
28#if QT_VERSION <= 231 30#if QT_VERSION <= 231
29#define private public 31#define private public
30#define sendLocally processEvent 32#define sendLocally processEvent
31#include "qcopenvelope_qws.h" 33#include "qcopenvelope_qws.h"
32#undef private 34#undef private
33#else 35#else
34#include "qcopenvelope_qws.h" 36#include "qcopenvelope_qws.h"
35#endif 37#endif
36#endif 38#endif
37#include <qwindowsystem_qws.h> 39#include <qwindowsystem_qws.h>
38#endif 40#endif
39#include <qtextstream.h> 41#include <qtextstream.h>
40#include <qpalette.h> 42#include <qpalette.h>
41#include <qbuffer.h> 43#include <qbuffer.h>
42#include <qptrdict.h> 44#include <qptrdict.h>
43#include <qregexp.h> 45#include <qregexp.h>
44#include <qdir.h> 46#include <qdir.h>
45#include <qlabel.h> 47#include <qlabel.h>
46#include <qdialog.h> 48#include <qdialog.h>
47#include <qdragobject.h> 49#include <qdragobject.h>
48#include <qtextcodec.h> 50#include <qtextcodec.h>
49#include <qevent.h> 51#include <qevent.h>
50#include <qtooltip.h> 52#include <qtooltip.h>
51#include <qsignal.h> 53#include <qsignal.h>
52#include <qmainwindow.h> 54#include <qmainwindow.h>
53#include <qwidgetlist.h> 55#include <qwidgetlist.h>
54#include <qpixmapcache.h> 56#include <qpixmapcache.h>
55 57
56#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 58#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
57#define QTOPIA_INTERNAL_INITAPP 59#define QTOPIA_INTERNAL_INITAPP
58#include "qpeapplication.h" 60#include "qpeapplication.h"
59#include "qpestyle.h" 61#include "qpestyle.h"
60#include "styleinterface.h" 62#include "styleinterface.h"
61#if QT_VERSION >= 300 63#if QT_VERSION >= 300
62#include <qstylefactory.h> 64#include <qstylefactory.h>
63#else 65#else
64#include <qplatinumstyle.h> 66#include <qplatinumstyle.h>
65#include <qwindowsstyle.h> 67#include <qwindowsstyle.h>
66#include <qmotifstyle.h> 68#include <qmotifstyle.h>
67#include <qmotifplusstyle.h> 69#include <qmotifplusstyle.h>
68#include "lightstyle.h" 70#include "lightstyle.h"
69 71
70#include <qpe/qlibrary.h> 72#include <qpe/qlibrary.h>
71#endif 73#endif
72#include "global.h" 74#include "global.h"
73#include "resource.h" 75#include "resource.h"
74#if QT_VERSION <= 230 && defined(QT_NO_CODECS) 76#if QT_VERSION <= 230 && defined(QT_NO_CODECS)
75#include "qutfcodec.h" 77#include "qutfcodec.h"
76#endif 78#endif
77#include "config.h" 79#include "config.h"
78#include "network.h" 80#include "network.h"
79#ifdef QWS 81#ifdef QWS
80#include "fontmanager.h" 82#include "fontmanager.h"
81#endif 83#endif
82 84
83#include "alarmserver.h" 85#include "alarmserver.h"
84#include "applnk.h" 86#include "applnk.h"
85#include "qpemenubar.h" 87#include "qpemenubar.h"
86#include "textcodecinterface.h" 88#include "textcodecinterface.h"
87#include "imagecodecinterface.h" 89#include "imagecodecinterface.h"
88 90
89#include <unistd.h> 91#include <unistd.h>
90#include <sys/file.h> 92#include <sys/file.h>
91#include <sys/ioctl.h> 93#include <sys/ioctl.h>
94#ifndef QT_NO_SOUND
92#include <sys/soundcard.h> 95#include <sys/soundcard.h>
93 96#endif
94#include "qt_override_p.h" 97#include "qt_override_p.h"
95 98
96 99
97class QPEApplicationData 100class QPEApplicationData
98{ 101{
99public: 102public:
100 QPEApplicationData ( ) 103 QPEApplicationData ( )
101 : presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ), 104 : presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ),
102 notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ), 105 notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ),
103 keep_running( true ), qcopQok( false ), qpe_main_widget( 0 ) 106 keep_running( true ), qcopQok( false ), qpe_main_widget( 0 )
104 107
105 {} 108 {}
106 109
107 int presstimer; 110 int presstimer;
108 QWidget* presswidget; 111 QWidget* presswidget;
109 QPoint presspos; 112 QPoint presspos;
110 113
111 bool rightpressed : 1; 114 bool rightpressed : 1;
112 bool kbgrabbed : 1; 115 bool kbgrabbed : 1;
113 bool notbusysent : 1; 116 bool notbusysent : 1;
114 bool preloaded : 1; 117 bool preloaded : 1;
115 bool forceshow : 1; 118 bool forceshow : 1;
116 bool nomaximize : 1; 119 bool nomaximize : 1;
117 bool keep_running : 1; 120 bool keep_running : 1;
118 bool qcopQok : 1; 121 bool qcopQok : 1;
119 122
120 123
121 QStringList langs; 124 QStringList langs;
122 QString appName; 125 QString appName;
123 struct QCopRec 126 struct QCopRec
124 { 127 {
125 QCopRec( const QCString &ch, const QCString &msg, 128 QCopRec( const QCString &ch, const QCString &msg,
126 const QByteArray &d ) : 129 const QByteArray &d ) :
127 channel( ch ), message( msg ), data( d ) 130 channel( ch ), message( msg ), data( d )
128 { } 131 { }
129 132
130 QCString channel; 133 QCString channel;
131 QCString message; 134 QCString message;
132 QByteArray data; 135 QByteArray data;
133 }; 136 };
134 QWidget* qpe_main_widget; 137 QWidget* qpe_main_widget;
135 QGuardedPtr<QWidget> lastraised; 138 QGuardedPtr<QWidget> lastraised;
136 QQueue<QCopRec> qcopq; 139 QQueue<QCopRec> qcopq;
137 QString styleName; 140 QString styleName;
138 QString decorationName; 141 QString decorationName;
139 142
140 void enqueueQCop( const QCString &ch, const QCString &msg, 143 void enqueueQCop( const QCString &ch, const QCString &msg,
141 const QByteArray &data ) 144 const QByteArray &data )
142 { 145 {
143 qcopq.enqueue( new QCopRec( ch, msg, data ) ); 146 qcopq.enqueue( new QCopRec( ch, msg, data ) );
144 } 147 }
145 void sendQCopQ() 148 void sendQCopQ()
146 { 149 {
147 if (!qcopQok ) 150 if (!qcopQok )
148 return; 151 return;
149 152
150 QCopRec * r; 153 QCopRec * r;
151 154
152 while((r=qcopq.dequeue())) { 155 while((r=qcopq.dequeue())) {
153 // remove from queue before sending... 156 // remove from queue before sending...
154 // event loop can come around again before getting 157 // event loop can come around again before getting
155 // back from sendLocally 158 // back from sendLocally
156#ifndef QT_NO_COP 159#ifndef QT_NO_COP
157 QCopChannel::sendLocally( r->channel, r->message, r->data ); 160 QCopChannel::sendLocally( r->channel, r->message, r->data );
158#endif 161#endif
159 162
160 delete r; 163 delete r;
161 } 164 }
162 } 165 }
163 static void show_mx(QWidget* mw, bool nomaximize, const QString & = QString::null ) 166 static void show_mx(QWidget* mw, bool nomaximize, const QString & = QString::null )
164 { 167 {
165 168
166 // ugly hack, remove that later after finding a sane solution 169 // ugly hack, remove that later after finding a sane solution
167 // Addendum: Only Sharp currently has models with high resolution but (physically) small displays, 170 // Addendum: Only Sharp currently has models with high resolution but (physically) small displays,
168 // so this is only useful if QT_QWS_SIMPAD is NOT defined. E.g. SIMpad has 800x600 but has 171 // so this is only useful if QT_QWS_SIMPAD is NOT defined. E.g. SIMpad has 800x600 but has
169 // a (physically) large enough display to use the small icons 172 // a (physically) large enough display to use the small icons
170#if defined(OPIE_HIGH_RES_SMALL_PHY) 173#if defined(OPIE_HIGH_RES_SMALL_PHY)
171 if ( QPEApplication::desktop() ->width() >= 600 && ( mw->inherits("QMainWindow") || mw->isA("QMainWindow") ) ) { 174 if ( QPEApplication::desktop() ->width() >= 600 && ( mw->inherits("QMainWindow") || mw->isA("QMainWindow") ) ) {
172 ( ( QMainWindow* ) mw )->setUsesBigPixmaps( true ); 175 ( ( QMainWindow* ) mw )->setUsesBigPixmaps( true );
173 } 176 }
174#endif 177#endif
175 178
176 if ( mw->layout() && mw->inherits("QDialog") ) { 179 if ( mw->layout() && mw->inherits("QDialog") ) {
177 QPEApplication::showDialog((QDialog*)mw, nomaximize); 180 QPEApplication::showDialog((QDialog*)mw, nomaximize);
178 } 181 }
179 else { 182 else {
180#ifdef Q_WS_QWS 183#ifdef Q_WS_QWS
181 if ( !nomaximize ) 184 if ( !nomaximize )
182 mw->showMaximized(); 185 mw->showMaximized();
183 else 186 else
184#endif 187#endif
185 188
186 mw->show(); 189 mw->show();
187 } 190 }
188 } 191 }
189 static bool setWidgetCaptionFromAppName( QWidget* /*mw*/, const QString& /*appName*/, const QString& /*appsPath*/ ) 192 static bool setWidgetCaptionFromAppName( QWidget* /*mw*/, const QString& /*appName*/, const QString& /*appsPath*/ )
190 { 193 {
191 /* 194 /*
192 // This works but disable it for now until it is safe to apply 195 // This works but disable it for now until it is safe to apply
193 // What is does is scan the .desktop files of all the apps for 196 // What is does is scan the .desktop files of all the apps for
194 // the applnk that has the corresponding argv[0] as this program 197 // the applnk that has the corresponding argv[0] as this program
195 // then it uses the name stored in the .desktop file as the caption 198 // then it uses the name stored in the .desktop file as the caption
196 // for the main widget. This saves duplicating translations for 199 // for the main widget. This saves duplicating translations for
197 // the app name in the program and in the .desktop files. 200 // the app name in the program and in the .desktop files.
198 201
199 AppLnkSet apps( appsPath ); 202 AppLnkSet apps( appsPath );
200 203
201 QList<AppLnk> appsList = apps.children(); 204 QList<AppLnk> appsList = apps.children();
202 for ( QListIterator<AppLnk> it(appsList); it.current(); ++it ) { 205 for ( QListIterator<AppLnk> it(appsList); it.current(); ++it ) {
203 if ( (*it)->exec() == appName ) { 206 if ( (*it)->exec() == appName ) {
204 mw->setCaption( (*it)->name() ); 207 mw->setCaption( (*it)->name() );
205 return TRUE; 208 return TRUE;
206 } 209 }
207 } 210 }
208 */ 211 */
209 return FALSE; 212 return FALSE;
210 } 213 }
211 214
212 215
213 void show(QWidget* mw, bool nomax) 216 void show(QWidget* mw, bool nomax)
214 { 217 {
215 setWidgetCaptionFromAppName( mw, appName, QPEApplication::qpeDir() + "apps" ); 218 setWidgetCaptionFromAppName( mw, appName, QPEApplication::qpeDir() + "apps" );
216 nomaximize = nomax; 219 nomaximize = nomax;
217 qpe_main_widget = mw; 220 qpe_main_widget = mw;
218 qcopQok = TRUE; 221 qcopQok = TRUE;
219#ifndef QT_NO_COP 222#ifndef QT_NO_COP
220 223
221 sendQCopQ(); 224 sendQCopQ();
222#endif 225#endif
223 226
224 if ( preloaded ) { 227 if ( preloaded ) {
225 if (forceshow) 228 if (forceshow)
226 show_mx(mw, nomax); 229 show_mx(mw, nomax);
227 } 230 }
228 else if ( keep_running ) { 231 else if ( keep_running ) {
229 show_mx(mw, nomax); 232 show_mx(mw, nomax);
230 } 233 }
231 } 234 }
232 235
233 void loadTextCodecs() 236 void loadTextCodecs()
234 { 237 {
235 QString path = QPEApplication::qpeDir() + "/plugins/textcodecs"; 238 QString path = QPEApplication::qpeDir() + "/plugins/textcodecs";
239#ifdef Q_OS_MACX
240 QDir dir( path, "lib*.dylib" );
241#else
236 QDir dir( path, "lib*.so" ); 242 QDir dir( path, "lib*.so" );
243#endif
237 QStringList list; 244 QStringList list;
238 if ( dir. exists ( )) 245 if ( dir. exists ( ))
239 list = dir.entryList(); 246 list = dir.entryList();
240 QStringList::Iterator it; 247 QStringList::Iterator it;
241 for ( it = list.begin(); it != list.end(); ++it ) { 248 for ( it = list.begin(); it != list.end(); ++it ) {
242 TextCodecInterface *iface = 0; 249 TextCodecInterface *iface = 0;
243 QLibrary *lib = new QLibrary( path + "/" + *it ); 250 QLibrary *lib = new QLibrary( path + "/" + *it );
244 if ( lib->queryInterface( IID_QtopiaTextCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { 251 if ( lib->queryInterface( IID_QtopiaTextCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) {
245 QValueList<int> mibs = iface->mibEnums(); 252 QValueList<int> mibs = iface->mibEnums();
246 for (QValueList<int>::ConstIterator i = mibs.begin(); i != mibs.end(); ++i) { 253 for (QValueList<int>::ConstIterator i = mibs.begin(); i != mibs.end(); ++i) {
247 (void)iface->createForMib(*i); 254 (void)iface->createForMib(*i);
248 // ### it exists now; need to remember if we can delete it 255 // ### it exists now; need to remember if we can delete it
249 } 256 }
250 } 257 }
251 else { 258 else {
252 lib->unload(); 259 lib->unload();
253 delete lib; 260 delete lib;
254 } 261 }
255 } 262 }
256 } 263 }
257 264
258 void loadImageCodecs() 265 void loadImageCodecs()
259 { 266 {
260 QString path = QPEApplication::qpeDir() + "/plugins/imagecodecs"; 267 QString path = QPEApplication::qpeDir() + "/plugins/imagecodecs";
268#ifdef Q_OS_MACX
269 QDir dir( path, "lib*.dylib" );
270#else
261 QDir dir( path, "lib*.so" ); 271 QDir dir( path, "lib*.so" );
272#endif
262 QStringList list; 273 QStringList list;
263 if ( dir. exists ( )) 274 if ( dir. exists ( ))
264 list = dir.entryList(); 275 list = dir.entryList();
265 QStringList::Iterator it; 276 QStringList::Iterator it;
266 for ( it = list.begin(); it != list.end(); ++it ) { 277 for ( it = list.begin(); it != list.end(); ++it ) {
267 ImageCodecInterface *iface = 0; 278 ImageCodecInterface *iface = 0;
268 QLibrary *lib = new QLibrary( path + "/" + *it ); 279 QLibrary *lib = new QLibrary( path + "/" + *it );
269 if ( lib->queryInterface( IID_QtopiaImageCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { 280 if ( lib->queryInterface( IID_QtopiaImageCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) {
270 QStringList formats = iface->keys(); 281 QStringList formats = iface->keys();
271 for (QStringList::ConstIterator i = formats.begin(); i != formats.end(); ++i) { 282 for (QStringList::ConstIterator i = formats.begin(); i != formats.end(); ++i) {
272 (void)iface->installIOHandler(*i); 283 (void)iface->installIOHandler(*i);
273 // ### it exists now; need to remember if we can delete it 284 // ### it exists now; need to remember if we can delete it
274 } 285 }
275 } 286 }
276 else { 287 else {
277 lib->unload(); 288 lib->unload();
278 delete lib; 289 delete lib;
279 } 290 }
280 } 291 }
281 } 292 }
282}; 293};
283 294
284class ResourceMimeFactory : public QMimeSourceFactory 295class ResourceMimeFactory : public QMimeSourceFactory
285{ 296{
286public: 297public:
287 ResourceMimeFactory() : resImage( 0 ) 298 ResourceMimeFactory() : resImage( 0 )
288 { 299 {
289 setFilePath( Global::helpPath() ); 300 setFilePath( Global::helpPath() );
290 setExtensionType( "html", "text/html;charset=UTF-8" ); 301 setExtensionType( "html", "text/html;charset=UTF-8" );
291 } 302 }
292 ~ResourceMimeFactory() { 303 ~ResourceMimeFactory() {
293 delete resImage; 304 delete resImage;
294 } 305 }
295 306
296 const QMimeSource* data( const QString& abs_name ) const 307 const QMimeSource* data( const QString& abs_name ) const
297 { 308 {
298 const QMimeSource * r = QMimeSourceFactory::data( abs_name ); 309 const QMimeSource * r = QMimeSourceFactory::data( abs_name );
299 if ( !r ) { 310 if ( !r ) {
300 int sl = abs_name.length(); 311 int sl = abs_name.length();
301 do { 312 do {
302 sl = abs_name.findRev( '/', sl - 1 ); 313 sl = abs_name.findRev( '/', sl - 1 );
303 QString name = sl >= 0 ? abs_name.mid( sl + 1 ) : abs_name; 314 QString name = sl >= 0 ? abs_name.mid( sl + 1 ) : abs_name;
304 int dot = name.findRev( '.' ); 315 int dot = name.findRev( '.' );
305 if ( dot >= 0 ) 316 if ( dot >= 0 )
306 name = name.left( dot ); 317 name = name.left( dot );
307 QImage img = Resource::loadImage( name ); 318 QImage img = Resource::loadImage( name );
308 if ( !img.isNull() ) { 319 if ( !img.isNull() ) {
309 delete resImage; 320 delete resImage;
310 resImage = new QImageDrag( img ); 321 resImage = new QImageDrag( img );
311 r = resImage; 322 r = resImage;
312 } 323 }
313 } 324 }
314 while ( !r && sl > 0 ); 325 while ( !r && sl > 0 );
315 } 326 }
316 return r; 327 return r;
317 } 328 }
318private: 329private:
319 mutable QImageDrag *resImage; 330 mutable QImageDrag *resImage;
320}; 331};
321 332
322static int& hack(int& i) 333static int& hack(int& i)
323{ 334{
324#if QT_VERSION <= 230 && defined(QT_NO_CODECS) 335#if QT_VERSION <= 230 && defined(QT_NO_CODECS)
325 // These should be created, but aren't in Qt 2.3.0 336 // These should be created, but aren't in Qt 2.3.0
326 (void)new QUtf8Codec; 337 (void)new QUtf8Codec;
327 (void)new QUtf16Codec; 338 (void)new QUtf16Codec;
328#endif 339#endif
329 return i; 340 return i;
330} 341}
331 342
332static int muted = 0; 343static int muted = 0;
333static int micMuted = 0; 344static int micMuted = 0;
334 345
335static void setVolume( int t = 0, int percent = -1 ) 346static void setVolume( int t = 0, int percent = -1 )
336{ 347{
337 switch ( t ) { 348 switch ( t ) {
338 case 0: { 349 case 0: {
339 Config cfg( "qpe" ); 350 Config cfg( "qpe" );
340 cfg.setGroup( "Volume" ); 351 cfg.setGroup( "Volume" );
341 if ( percent < 0 ) 352 if ( percent < 0 )
342 percent = cfg.readNumEntry( "VolumePercent", 50 ); 353 percent = cfg.readNumEntry( "VolumePercent", 50 );
354#ifndef QT_NO_SOUND
343 int fd = 0; 355 int fd = 0;
344 if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { 356 if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) {
345 int vol = muted ? 0 : percent; 357 int vol = muted ? 0 : percent;
346 // set both channels to same volume 358 // set both channels to same volume
347 vol |= vol << 8; 359 vol |= vol << 8;
348 ioctl( fd, MIXER_WRITE( 0 ), &vol ); 360 ioctl( fd, MIXER_WRITE( 0 ), &vol );
349 ::close( fd ); 361 ::close( fd );
350 } 362 }
363#endif
351 } 364 }
352 break; 365 break;
353 } 366 }
354} 367}
355 368
356static void setMic( int t = 0, int percent = -1 ) 369static void setMic( int t = 0, int percent = -1 )
357{ 370{
358 switch ( t ) { 371 switch ( t ) {
359 case 0: { 372 case 0: {
360 Config cfg( "qpe" ); 373 Config cfg( "qpe" );
361 cfg.setGroup( "Volume" ); 374 cfg.setGroup( "Volume" );
362 if ( percent < 0 ) 375 if ( percent < 0 )
363 percent = cfg.readNumEntry( "Mic", 50 ); 376 percent = cfg.readNumEntry( "Mic", 50 );
364 377
378#ifndef QT_NO_SOUND
365 int fd = 0; 379 int fd = 0;
366 int mic = micMuted ? 0 : percent; 380 int mic = micMuted ? 0 : percent;
367 if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { 381 if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) {
368 ioctl( fd, MIXER_WRITE( SOUND_MIXER_MIC ), &mic ); 382 ioctl( fd, MIXER_WRITE( SOUND_MIXER_MIC ), &mic );
369 ::close( fd ); 383 ::close( fd );
370 } 384 }
385#endif
371 } 386 }
372 break; 387 break;
373 } 388 }
374} 389}
375 390
376 391
377static void setBass( int t = 0, int percent = -1 ) 392static void setBass( int t = 0, int percent = -1 )
378{ 393{
379 switch ( t ) { 394 switch ( t ) {
380 case 0: { 395 case 0: {
381 Config cfg( "qpe" ); 396 Config cfg( "qpe" );
382 cfg.setGroup( "Volume" ); 397 cfg.setGroup( "Volume" );
383 if ( percent < 0 ) 398 if ( percent < 0 )
384 percent = cfg.readNumEntry( "BassPercent", 50 ); 399 percent = cfg.readNumEntry( "BassPercent", 50 );
385 400
401#ifndef QT_NO_SOUND
386 int fd = 0; 402 int fd = 0;
387 int bass = percent; 403 int bass = percent;
388 if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { 404 if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) {
389 ioctl( fd, MIXER_WRITE( SOUND_MIXER_BASS ), &bass ); 405 ioctl( fd, MIXER_WRITE( SOUND_MIXER_BASS ), &bass );
390 ::close( fd ); 406 ::close( fd );
391 } 407 }
408#endif
392 } 409 }
393 break; 410 break;
394 } 411 }
395} 412}
396 413
397 414
398static void setTreble( int t = 0, int percent = -1 ) 415static void setTreble( int t = 0, int percent = -1 )
399{ 416{
400 switch ( t ) { 417 switch ( t ) {
401 case 0: { 418 case 0: {
402 Config cfg( "qpe" ); 419 Config cfg( "qpe" );
403 cfg.setGroup( "Volume" ); 420 cfg.setGroup( "Volume" );
404 if ( percent < 0 ) 421 if ( percent < 0 )
405 percent = cfg.readNumEntry( "TreblePercent", 50 ); 422 percent = cfg.readNumEntry( "TreblePercent", 50 );
406 423
424#ifndef QT_NO_SOUND
407 int fd = 0; 425 int fd = 0;
408 int treble = percent; 426 int treble = percent;
409 if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { 427 if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) {
410 ioctl( fd, MIXER_WRITE( SOUND_MIXER_TREBLE ), &treble ); 428 ioctl( fd, MIXER_WRITE( SOUND_MIXER_TREBLE ), &treble );
411 ::close( fd ); 429 ::close( fd );
412 } 430 }
431#endif
413 } 432 }
414 break; 433 break;
415 } 434 }
416} 435}
417 436
418 437
419/*! 438/*!
420 \class QPEApplication qpeapplication.h 439 \class QPEApplication qpeapplication.h
421 \brief The QPEApplication class implements various system services 440 \brief The QPEApplication class implements various system services
422 that are available to all Qtopia applications. 441 that are available to all Qtopia applications.
423 442
424 Simply by using QPEApplication instead of QApplication, a standard Qt 443 Simply by using QPEApplication instead of QApplication, a standard Qt
425 application becomes a Qtopia application. It automatically follows 444 application becomes a Qtopia application. It automatically follows
426 style changes, quits and raises, and in the 445 style changes, quits and raises, and in the
427 case of \link docwidget.html document-oriented\endlink applications, 446 case of \link docwidget.html document-oriented\endlink applications,
428 changes the currently displayed document in response to the environment. 447 changes the currently displayed document in response to the environment.
429 448
430 To create a \link docwidget.html document-oriented\endlink 449 To create a \link docwidget.html document-oriented\endlink
431 application use showMainDocumentWidget(); to create a 450 application use showMainDocumentWidget(); to create a
432 non-document-oriented application use showMainWidget(). The 451 non-document-oriented application use showMainWidget(). The
433 keepRunning() function indicates whether the application will 452 keepRunning() function indicates whether the application will
434 continue running after it's processed the last \link qcop.html 453 continue running after it's processed the last \link qcop.html
435 QCop\endlink message. This can be changed using setKeepRunning(). 454 QCop\endlink message. This can be changed using setKeepRunning().
436 455
437 A variety of signals are emitted when certain events occur, for 456 A variety of signals are emitted when certain events occur, for
438 example, timeChanged(), clockChanged(), weekChanged(), 457 example, timeChanged(), clockChanged(), weekChanged(),
439 dateFormatChanged() and volumeChanged(). If the application receives 458 dateFormatChanged() and volumeChanged(). If the application receives
440 a \link qcop.html QCop\endlink message on the application's 459 a \link qcop.html QCop\endlink message on the application's
441 QPE/Application/\e{appname} channel, the appMessage() signal is 460 QPE/Application/\e{appname} channel, the appMessage() signal is
442 emitted. There are also flush() and reload() signals, which 461 emitted. There are also flush() and reload() signals, which
443 are emitted when synching begins and ends respectively - upon these 462 are emitted when synching begins and ends respectively - upon these
444 signals, the application should save and reload any data 463 signals, the application should save and reload any data
445 files that are involved in synching. Most of these signals will initially 464 files that are involved in synching. Most of these signals will initially
446 be received and unfiltered through the appMessage() signal. 465 be received and unfiltered through the appMessage() signal.
447 466
448 This class also provides a set of useful static functions. The 467 This class also provides a set of useful static functions. The
449 qpeDir() and documentDir() functions return the respective paths. 468 qpeDir() and documentDir() functions return the respective paths.
450 The grabKeyboard() and ungrabKeyboard() functions are used to 469 The grabKeyboard() and ungrabKeyboard() functions are used to
451 control whether the application takes control of the device's 470 control whether the application takes control of the device's
452 physical buttons (e.g. application launch keys). The stylus' mode of 471 physical buttons (e.g. application launch keys). The stylus' mode of
453 operation is set with setStylusOperation() and retrieved with 472 operation is set with setStylusOperation() and retrieved with
454 stylusOperation(). There are also setInputMethodHint() and 473 stylusOperation(). There are also setInputMethodHint() and
455 inputMethodHint() functions. 474 inputMethodHint() functions.
456 475
457 \ingroup qtopiaemb 476 \ingroup qtopiaemb
458*/ 477*/
459 478
460/*! 479/*!
461 \fn void QPEApplication::clientMoused() 480 \fn void QPEApplication::clientMoused()
462 481
463 \internal 482 \internal
464*/ 483*/
465 484
466/*! 485/*!
467 \fn void QPEApplication::timeChanged(); 486 \fn void QPEApplication::timeChanged();
468 This signal is emitted when the time changes outside the normal 487 This signal is emitted when the time changes outside the normal
469 passage of time, i.e. if the time is set backwards or forwards. 488 passage of time, i.e. if the time is set backwards or forwards.
470*/ 489*/
471 490
472/*! 491/*!
473 \fn void QPEApplication::clockChanged( bool ampm ); 492 \fn void QPEApplication::clockChanged( bool ampm );
474 493
475 This signal is emitted when the user changes the clock's style. If 494 This signal is emitted when the user changes the clock's style. If
476 \a ampm is TRUE, the user wants a 12-hour AM/PM clock, otherwise, 495 \a ampm is TRUE, the user wants a 12-hour AM/PM clock, otherwise,
477 they want a 24-hour clock. 496 they want a 24-hour clock.
478*/ 497*/
479 498
480/*! 499/*!
481 \fn void QPEApplication::volumeChanged( bool muted ) 500 \fn void QPEApplication::volumeChanged( bool muted )
482 501
483 This signal is emitted whenever the mute state is changed. If \a 502 This signal is emitted whenever the mute state is changed. If \a
484 muted is TRUE, then sound output has been muted. 503 muted is TRUE, then sound output has been muted.
485*/ 504*/
486 505
487/*! 506/*!
488 \fn void QPEApplication::weekChanged( bool startOnMonday ) 507 \fn void QPEApplication::weekChanged( bool startOnMonday )
489 508
490 This signal is emitted if the week start day is changed. If \a 509 This signal is emitted if the week start day is changed. If \a
491 startOnMonday is TRUE then the first day of the week is Monday; if 510 startOnMonday is TRUE then the first day of the week is Monday; if
492 \a startOnMonday is FALSE then the first day of the week is 511 \a startOnMonday is FALSE then the first day of the week is
493 Sunday. 512 Sunday.
494*/ 513*/
495 514
496/*! 515/*!
497 \fn void QPEApplication::dateFormatChanged(DateFormat) 516 \fn void QPEApplication::dateFormatChanged(DateFormat)
498 517
499 This signal is emitted whenever the date format is changed. 518 This signal is emitted whenever the date format is changed.
500*/ 519*/
501 520
502/*! 521/*!
503 \fn void QPEApplication::flush() 522 \fn void QPEApplication::flush()
504 523
505 ### 524 ###
506*/ 525*/
507 526
508/*! 527/*!
509 \fn void QPEApplication::reload() 528 \fn void QPEApplication::reload()
510 529
511*/ 530*/
512 531
513 532
514 533
515void QPEApplication::processQCopFile() 534void QPEApplication::processQCopFile()
516{ 535{
517 QString qcopfn("/tmp/qcop-msg-"); 536 QString qcopfn("/tmp/qcop-msg-");
518 qcopfn += d->appName; // append command name 537 qcopfn += d->appName; // append command name
519 538
520 QFile f(qcopfn); 539 QFile f(qcopfn);
521 if ( f.open(IO_ReadWrite) ) { 540 if ( f.open(IO_ReadWrite) ) {
522#ifndef Q_OS_WIN32 541#ifndef Q_OS_WIN32
523 flock(f.handle(), LOCK_EX); 542 flock(f.handle(), LOCK_EX);
524#endif 543#endif
525 QDataStream ds(&f); 544 QDataStream ds(&f);
526 QCString channel, message; 545 QCString channel, message;
527 QByteArray data; 546 QByteArray data;
528 while(!ds.atEnd()) { 547 while(!ds.atEnd()) {
529 ds >> channel >> message >> data; 548 ds >> channel >> message >> data;
530 d->enqueueQCop(channel,message,data); 549 d->enqueueQCop(channel,message,data);
531 } 550 }
532 ::ftruncate(f.handle(), 0); 551 ::ftruncate(f.handle(), 0);
533#ifndef Q_OS_WIN32 552#ifndef Q_OS_WIN32
534 f.flush(); 553 f.flush();
535 flock(f.handle(), LOCK_UN); 554 flock(f.handle(), LOCK_UN);
536#endif 555#endif
537 } 556 }
538#endif 557#endif
539} 558}
540 559
541 560
542/*! 561/*!
543 \fn void QPEApplication::appMessage( const QCString& msg, const QByteArray& data ) 562 \fn void QPEApplication::appMessage( const QCString& msg, const QByteArray& data )
544 563
545 This signal is emitted when a message is received on this 564 This signal is emitted when a message is received on this
546 application's QPE/Application/<i>appname</i> \link qcop.html 565 application's QPE/Application/<i>appname</i> \link qcop.html
547 QCop\endlink channel. 566 QCop\endlink channel.
548 567
549 The slot to which you connect this signal uses \a msg and \a data 568 The slot to which you connect this signal uses \a msg and \a data
550 in the following way: 569 in the following way:
551 570
552\code 571\code
553 void MyWidget::receive( const QCString& msg, const QByteArray& data ) 572 void MyWidget::receive( const QCString& msg, const QByteArray& data )
554 { 573 {
555 QDataStream stream( data, IO_ReadOnly ); 574 QDataStream stream( data, IO_ReadOnly );
556 if ( msg == "someMessage(int,int,int)" ) { 575 if ( msg == "someMessage(int,int,int)" ) {
557 int a,b,c; 576 int a,b,c;
558 stream >> a >> b >> c; 577 stream >> a >> b >> c;
559 ... 578 ...
560 } else if ( msg == "otherMessage(QString)" ) { 579 } else if ( msg == "otherMessage(QString)" ) {
561 ... 580 ...
562 } 581 }
563 } 582 }
564\endcode 583\endcode
565 584
566 \sa qcop.html 585 \sa qcop.html
567 Note that messages received here may be processed by qpe application 586 Note that messages received here may be processed by qpe application
568 and emitted as signals, such as flush() and reload(). 587 and emitted as signals, such as flush() and reload().
569*/ 588*/
570 589
571/*! 590/*!
572 Constructs a QPEApplication just as you would construct 591 Constructs a QPEApplication just as you would construct
573 a QApplication, passing \a argc, \a argv, and \a t. 592 a QApplication, passing \a argc, \a argv, and \a t.
574 593
575 For applications, \a t should be the default, GuiClient. Only 594 For applications, \a t should be the default, GuiClient. Only
576 the Qtopia server passes GuiServer. 595 the Qtopia server passes GuiServer.
577*/ 596*/
578QPEApplication::QPEApplication( int & argc, char **argv, Type t ) 597QPEApplication::QPEApplication( int & argc, char **argv, Type t )
579 : QApplication( hack(argc), argv, t ), pidChannel( 0 ) 598 : QApplication( hack(argc), argv, t ), pidChannel( 0 )
580{ 599{
581 QPixmapCache::setCacheLimit(256); // sensible default for smaller devices. 600 QPixmapCache::setCacheLimit(256); // sensible default for smaller devices.
582 601
583 d = new QPEApplicationData; 602 d = new QPEApplicationData;
584 d->loadTextCodecs(); 603 d->loadTextCodecs();
585 d->loadImageCodecs(); 604 d->loadImageCodecs();
586 int dw = desktop() ->width(); 605 int dw = desktop() ->width();
587 606
588 if ( dw < 200 ) { 607 if ( dw < 200 ) {
589 setFont( QFont( "vera", 8 ) ); 608 setFont( QFont( "vera", 8 ) );
590 AppLnk::setSmallIconSize( 10 ); 609 AppLnk::setSmallIconSize( 10 );
591 AppLnk::setBigIconSize( 28 ); 610 AppLnk::setBigIconSize( 28 );
592 } 611 }
593#if defined(OPIE_HIGH_RES_SMALL_PHY) 612#if defined(OPIE_HIGH_RES_SMALL_PHY)
594 else if ( dw > 600 ) { 613 else if ( dw > 600 ) {
595 setFont( QFont( "vera", 16 ) ); 614 setFont( QFont( "vera", 16 ) );
596 AppLnk::setSmallIconSize( 24 ); 615 AppLnk::setSmallIconSize( 24 );
597 AppLnk::setBigIconSize( 48 ); 616 AppLnk::setBigIconSize( 48 );
598 } 617 }
599#endif 618#endif
600 else if ( dw > 200 ) { 619 else if ( dw > 200 ) {
601 setFont( QFont( "vera", 10 ) ); 620 setFont( QFont( "vera", 10 ) );
602 AppLnk::setSmallIconSize( 14 ); 621 AppLnk::setSmallIconSize( 14 );
603 AppLnk::setBigIconSize( 32 ); 622 AppLnk::setBigIconSize( 32 );
604 } 623 }
605 624
606 QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); 625 QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory );
607 626
608 connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) ); 627 connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) );
609 628
610 629
611 sysChannel = new QCopChannel( "QPE/System", this ); 630 sysChannel = new QCopChannel( "QPE/System", this );
612 connect( sysChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), 631 connect( sysChannel, SIGNAL( received( const QCString &, const QByteArray & ) ),
613 this, SLOT( systemMessage( const QCString &, const QByteArray & ) ) ); 632 this, SLOT( systemMessage( const QCString &, const QByteArray & ) ) );
614 633
615/* COde now in initapp */ 634/* COde now in initapp */
616#if 0 635#if 0
617#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 636#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
618 637
619 QString qcopfn( "/tmp/qcop-msg-" ); 638 QString qcopfn( "/tmp/qcop-msg-" );
620 qcopfn += QString( argv[ 0 ] ); // append command name 639 qcopfn += QString( argv[ 0 ] ); // append command name
621 640
622 QFile f( qcopfn ); 641 QFile f( qcopfn );
623 if ( f.open( IO_ReadOnly ) ) { 642 if ( f.open( IO_ReadOnly ) ) {
624 flock( f.handle(), LOCK_EX ); 643 flock( f.handle(), LOCK_EX );
625 } 644 }
626 645
627 646
628 647
629 QCString channel = QCString( argv[ 0 ] ); 648 QCString channel = QCString( argv[ 0 ] );
630 channel.replace( QRegExp( ".*/" ), "" ); 649 channel.replace( QRegExp( ".*/" ), "" );
631 d->appName = channel; 650 d->appName = channel;
632 channel = "QPE/Application/" + channel; 651 channel = "QPE/Application/" + channel;
633 pidChannel = new QCopChannel( channel, this ); 652 pidChannel = new QCopChannel( channel, this );
634 connect( pidChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), 653 connect( pidChannel, SIGNAL( received( const QCString &, const QByteArray & ) ),
635 this, SLOT( pidMessage( const QCString &, const QByteArray & ) ) ); 654 this, SLOT( pidMessage( const QCString &, const QByteArray & ) ) );
636 655
637 if ( f.isOpen() ) { 656 if ( f.isOpen() ) {
638 d->keep_running = FALSE; 657 d->keep_running = FALSE;
639 QDataStream ds( &f ); 658 QDataStream ds( &f );
640 QCString channel, message; 659 QCString channel, message;
641 QByteArray data; 660 QByteArray data;
642 while ( !ds.atEnd() ) { 661 while ( !ds.atEnd() ) {
643 ds >> channel >> message >> data; 662 ds >> channel >> message >> data;
644 d->enqueueQCop( channel, message, data ); 663 d->enqueueQCop( channel, message, data );
645 } 664 }
646 665
647 flock( f.handle(), LOCK_UN ); 666 flock( f.handle(), LOCK_UN );
648 f.close(); 667 f.close();
649 f.remove(); 668 f.remove();
650 } 669 }
651 670
652 for ( int a = 0; a < argc; a++ ) { 671 for ( int a = 0; a < argc; a++ ) {
653 if ( qstrcmp( argv[ a ], "-preload" ) == 0 ) { 672 if ( qstrcmp( argv[ a ], "-preload" ) == 0 ) {
654 argv[ a ] = argv[ a + 1 ]; 673 argv[ a ] = argv[ a + 1 ];
655 a++; 674 a++;
656 d->preloaded = TRUE; 675 d->preloaded = TRUE;
657 argc -= 1; 676 argc -= 1;
658 } 677 }
659 else if ( qstrcmp( argv[ a ], "-preload-show" ) == 0 ) { 678 else if ( qstrcmp( argv[ a ], "-preload-show" ) == 0 ) {
660 argv[ a ] = argv[ a + 1 ]; 679 argv[ a ] = argv[ a + 1 ];
661 a++; 680 a++;
662 d->preloaded = TRUE; 681 d->preloaded = TRUE;
663 d->forceshow = TRUE; 682 d->forceshow = TRUE;
664 argc -= 1; 683 argc -= 1;
665 } 684 }
666 } 685 }
667 686
668 /* overide stored arguments */ 687 /* overide stored arguments */
669 setArgs( argc, argv ); 688 setArgs( argc, argv );
670 689
671#endif 690#endif
672#else 691#else
673 initApp( argc, argv ); 692 initApp( argc, argv );
674#endif 693#endif
675 // qwsSetDecoration( new QPEDecoration() ); 694 // qwsSetDecoration( new QPEDecoration() );
676 695
677#ifndef QT_NO_TRANSLATION 696#ifndef QT_NO_TRANSLATION
678 697
679 d->langs = Global::languageList(); 698 d->langs = Global::languageList();
680 for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) { 699 for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) {
681 QString lang = *it; 700 QString lang = *it;
682 701
683 installTranslation( lang + "/libopie.qm"); 702 installTranslation( lang + "/libopie.qm");
684 installTranslation( lang + "/libqpe.qm" ); 703 installTranslation( lang + "/libqpe.qm" );
685 installTranslation( lang + "/" + d->appName + ".qm" ); 704 installTranslation( lang + "/" + d->appName + ".qm" );
686 705
687 706
688 //###language/font hack; should look it up somewhere 707 //###language/font hack; should look it up somewhere
689#ifdef QWS 708#ifdef QWS
690 709
691 if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { 710 if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) {
692 QFont fn = FontManager::unicodeFont( FontManager::Proportional ); 711 QFont fn = FontManager::unicodeFont( FontManager::Proportional );
693 setFont( fn ); 712 setFont( fn );
694 } 713 }
695#endif 714#endif
696 } 715 }
697#endif 716#endif
698 717
699 applyStyle(); 718 applyStyle();
700 719
701 if ( type() == GuiServer ) { 720 if ( type() == GuiServer ) {
702 setVolume(); 721 setVolume();
703 } 722 }
704 723
705 installEventFilter( this ); 724 installEventFilter( this );
706 725
707 QPEMenuToolFocusManager::initialize(); 726 QPEMenuToolFocusManager::initialize();
708 727
709#ifdef QT_NO_QWS_CURSOR 728#ifdef QT_NO_QWS_CURSOR
710 // if we have no cursor, probably don't want tooltips 729 // if we have no cursor, probably don't want tooltips
711 QToolTip::setEnabled( FALSE ); 730 QToolTip::setEnabled( FALSE );
712#endif 731#endif
713} 732}
714 733
715 734
716#ifdef QTOPIA_INTERNAL_INITAPP 735#ifdef QTOPIA_INTERNAL_INITAPP
717void QPEApplication::initApp( int argc, char **argv ) 736void QPEApplication::initApp( int argc, char **argv )
718{ 737{
719 bool initial = pidChannel; // was set to 0 in the initializer 738 bool initial = pidChannel; // was set to 0 in the initializer
720 delete pidChannel; 739 delete pidChannel;
721 d->keep_running = TRUE; 740 d->keep_running = TRUE;
722 d->preloaded = FALSE; 741 d->preloaded = FALSE;
723 d->forceshow = FALSE; 742 d->forceshow = FALSE;
724 743
725 QCString channel = QCString(argv[0]); 744 QCString channel = QCString(argv[0]);
726 745
727 channel.replace(QRegExp(".*/"),""); 746 channel.replace(QRegExp(".*/"),"");
728 d->appName = channel; 747 d->appName = channel;
729 748
730 #if QT_VERSION > 235 749 #if QT_VERSION > 235
731 qt_fbdpy->setIdentity( channel ); // In Qt/E 2.3.6 750 qt_fbdpy->setIdentity( channel ); // In Qt/E 2.3.6
732 #endif 751 #endif
733 752
734 channel = "QPE/Application/" + channel; 753 channel = "QPE/Application/" + channel;
735 pidChannel = new QCopChannel( channel, this); 754 pidChannel = new QCopChannel( channel, this);
736 connect( pidChannel, SIGNAL(received(const QCString &, const QByteArray &)), 755 connect( pidChannel, SIGNAL(received(const QCString &, const QByteArray &)),
737 this, SLOT(pidMessage(const QCString &, const QByteArray &))); 756 this, SLOT(pidMessage(const QCString &, const QByteArray &)));
738 757
739 if (!initial) { 758 if (!initial) {
740 processQCopFile(); 759 processQCopFile();
741 d->keep_running = d->qcopq.isEmpty(); 760 d->keep_running = d->qcopq.isEmpty();
742 } 761 }
743 762
744 for (int a=0; a<argc; a++) { 763 for (int a=0; a<argc; a++) {
745 if ( qstrcmp(argv[a],"-preload")==0 ) { 764 if ( qstrcmp(argv[a],"-preload")==0 ) {
746 argv[a] = argv[a+1]; 765 argv[a] = argv[a+1];
747 a++; 766 a++;
748 d->preloaded = TRUE; 767 d->preloaded = TRUE;
749 argc-=1; 768 argc-=1;
750 } else if ( qstrcmp(argv[a],"-preload-show")==0 ) { 769 } else if ( qstrcmp(argv[a],"-preload-show")==0 ) {
751 argv[a] = argv[a+1]; 770 argv[a] = argv[a+1];
752 a++; 771 a++;
753 d->preloaded = TRUE; 772 d->preloaded = TRUE;
754 d->forceshow = TRUE; 773 d->forceshow = TRUE;
755 argc-=1; 774 argc-=1;
756 } 775 }
757 } 776 }
758 777
759 /* overide stored arguments */ 778 /* overide stored arguments */
760 setArgs(argc, argv); 779 setArgs(argc, argv);
761 780
762 /* install translation here */ 781 /* install translation here */
763 for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) 782 for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it )
764 installTranslation( (*it) + "/" + d->appName + ".qm" ); 783 installTranslation( (*it) + "/" + d->appName + ".qm" );
765} 784}
766#endif 785#endif
767 786
768 787
769static QPtrDict<void>* inputMethodDict = 0; 788static QPtrDict<void>* inputMethodDict = 0;
770static void createInputMethodDict() 789static void createInputMethodDict()
771{ 790{
772 if ( !inputMethodDict ) 791 if ( !inputMethodDict )
773 inputMethodDict = new QPtrDict<void>; 792 inputMethodDict = new QPtrDict<void>;
774} 793}
775 794
776/*! 795/*!
777 Returns the currently set hint to the system as to whether 796 Returns the currently set hint to the system as to whether
778 widget \a w has any use for text input methods. 797 widget \a w has any use for text input methods.
779 798
780 799
781 \sa setInputMethodHint() InputMethodHint 800 \sa setInputMethodHint() InputMethodHint
782*/ 801*/
783QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget * w ) 802QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget * w )
784{ 803{
785 if ( inputMethodDict && w ) 804 if ( inputMethodDict && w )
786 return ( InputMethodHint ) ( int ) inputMethodDict->find( w ); 805 return ( InputMethodHint ) ( int ) inputMethodDict->find( w );
787 return Normal; 806 return Normal;
788} 807}
789 808
790/*! 809/*!
791 \enum QPEApplication::InputMethodHint 810 \enum QPEApplication::InputMethodHint
792 811
793 \value Normal the application sometimes needs text input (the default). 812 \value Normal the application sometimes needs text input (the default).
794 \value AlwaysOff the application never needs text input. 813 \value AlwaysOff the application never needs text input.
795 \value AlwaysOn the application always needs text input. 814 \value AlwaysOn the application always needs text input.
796*/ 815*/
797 816
798/*! 817/*!
799 Hints to the system that widget \a w has use for text input methods 818 Hints to the system that widget \a w has use for text input methods
800 as specified by \a mode. 819 as specified by \a mode.
801 820
802 \sa inputMethodHint() InputMethodHint 821 \sa inputMethodHint() InputMethodHint
803*/ 822*/
804void QPEApplication::setInputMethodHint( QWidget * w, InputMethodHint mode ) 823void QPEApplication::setInputMethodHint( QWidget * w, InputMethodHint mode )
805{ 824{
806 createInputMethodDict(); 825 createInputMethodDict();
807 if ( mode == Normal ) { 826 if ( mode == Normal ) {
808 inputMethodDict->remove 827 inputMethodDict->remove
809 ( w ); 828 ( w );
810 } 829 }
811 else { 830 else {
812 inputMethodDict->insert( w, ( void* ) mode ); 831 inputMethodDict->insert( w, ( void* ) mode );
813 } 832 }
814} 833}
815 834
816class HackDialog : public QDialog 835class HackDialog : public QDialog
817{ 836{
818public: 837public:
819 void acceptIt() 838 void acceptIt()
820 { 839 {
821 accept(); 840 accept();
822 } 841 }
823 void rejectIt() 842 void rejectIt()
824 { 843 {
825 reject(); 844 reject();
826 } 845 }
827}; 846};
828 847
829 848
830void QPEApplication::mapToDefaultAction( QWSKeyEvent * ke, int key ) 849void QPEApplication::mapToDefaultAction( QWSKeyEvent * ke, int key )
831{ 850{
832 // specialised actions for certain widgets. May want to 851 // specialised actions for certain widgets. May want to
833 // add more stuff here. 852 // add more stuff here.
834 if ( activePopupWidget() && activePopupWidget() ->inherits( "QListBox" ) 853 if ( activePopupWidget() && activePopupWidget() ->inherits( "QListBox" )
835 && activePopupWidget() ->parentWidget() 854 && activePopupWidget() ->parentWidget()
836 && activePopupWidget() ->parentWidget() ->inherits( "QComboBox" ) ) 855 && activePopupWidget() ->parentWidget() ->inherits( "QComboBox" ) )
837 key = Qt::Key_Return; 856 key = Qt::Key_Return;
838 857
839 if ( activePopupWidget() && activePopupWidget() ->inherits( "QPopupMenu" ) ) 858 if ( activePopupWidget() && activePopupWidget() ->inherits( "QPopupMenu" ) )
840 key = Qt::Key_Return; 859 key = Qt::Key_Return;
841 860
842#ifdef QWS 861#ifdef QWS
843 862
844 ke->simpleData.keycode = key; 863 ke->simpleData.keycode = key;
845#endif 864#endif
846} 865}
847 866
848class HackWidget : public QWidget 867class HackWidget : public QWidget
849{ 868{
850public: 869public:
851 bool needsOk() 870 bool needsOk()
852 { 871 {
853 return ( getWState() & WState_Reserved1 ); 872 return ( getWState() & WState_Reserved1 );
854 } 873 }
855}; 874};
856 875
857/*! 876/*!
858 \internal 877 \internal
859*/ 878*/
860 879
861#ifdef QWS 880#ifdef QWS
862bool QPEApplication::qwsEventFilter( QWSEvent * e ) 881bool QPEApplication::qwsEventFilter( QWSEvent * e )
863{ 882{
864 if ( !d->notbusysent && e->type == QWSEvent::Focus ) { 883 if ( !d->notbusysent && e->type == QWSEvent::Focus ) {
865 if ( qApp->type() != QApplication::GuiServer ) { 884 if ( qApp->type() != QApplication::GuiServer ) {
866 QCopEnvelope e( "QPE/System", "notBusy(QString)" ); 885 QCopEnvelope e( "QPE/System", "notBusy(QString)" );
867 e << d->appName; 886 e << d->appName;
868 } 887 }
869 d->notbusysent = TRUE; 888 d->notbusysent = TRUE;
870 } 889 }
871 if ( type() == GuiServer ) { 890 if ( type() == GuiServer ) {
872 switch ( e->type ) { 891 switch ( e->type ) {
873 case QWSEvent::Mouse: 892 case QWSEvent::Mouse:
874 if ( e->asMouse() ->simpleData.state && !QWidget::find( e->window() ) ) 893 if ( e->asMouse() ->simpleData.state && !QWidget::find( e->window() ) )
875 emit clientMoused(); 894 emit clientMoused();
876 break; 895 break;
877 default: 896 default:
878 break; 897 break;
879 } 898 }
880 } 899 }
881 if ( e->type == QWSEvent::Key ) { 900 if ( e->type == QWSEvent::Key ) {
882 QWSKeyEvent *ke = ( QWSKeyEvent * ) e; 901 QWSKeyEvent *ke = ( QWSKeyEvent * ) e;
883 if ( ke->simpleData.keycode == Qt::Key_F33 ) { 902 if ( ke->simpleData.keycode == Qt::Key_F33 ) {
884 // Use special "OK" key to press "OK" on top level widgets 903 // Use special "OK" key to press "OK" on top level widgets
885 QWidget * active = activeWindow(); 904 QWidget * active = activeWindow();
886 QWidget *popup = 0; 905 QWidget *popup = 0;
887 if ( active && active->isPopup() ) { 906 if ( active && active->isPopup() ) {
888 popup = active; 907 popup = active;
889 active = active->parentWidget(); 908 active = active->parentWidget();
890 } 909 }
891 if ( active && ( int ) active->winId() == ke->simpleData.window && 910 if ( active && ( int ) active->winId() == ke->simpleData.window &&
892 !active->testWFlags( WStyle_Customize | WType_Popup | WType_Desktop ) ) { 911 !active->testWFlags( WStyle_Customize | WType_Popup | WType_Desktop ) ) {
893 if ( ke->simpleData.is_press ) { 912 if ( ke->simpleData.is_press ) {
894 if ( popup ) 913 if ( popup )
895 popup->close(); 914 popup->close();
896 if ( active->inherits( "QDialog" ) ) { 915 if ( active->inherits( "QDialog" ) ) {
897 HackDialog * d = ( HackDialog * ) active; 916 HackDialog * d = ( HackDialog * ) active;
898 d->acceptIt(); 917 d->acceptIt();
899 return TRUE; 918 return TRUE;
900 } 919 }
901 else if ( ( ( HackWidget * ) active ) ->needsOk() ) { 920 else if ( ( ( HackWidget * ) active ) ->needsOk() ) {
902 QSignal s; 921 QSignal s;
903 s.connect( active, SLOT( accept() ) ); 922 s.connect( active, SLOT( accept() ) );
904 s.activate(); 923 s.activate();
905 } 924 }
906 else { 925 else {
907 // do the same as with the select key: Map to the default action of the widget: 926 // do the same as with the select key: Map to the default action of the widget:
908 mapToDefaultAction( ke, Qt::Key_Return ); 927 mapToDefaultAction( ke, Qt::Key_Return );
909 } 928 }
910 } 929 }
911 } 930 }
912 } 931 }
913 else if ( ke->simpleData.keycode == Qt::Key_F30 ) { 932 else if ( ke->simpleData.keycode == Qt::Key_F30 ) {
914 // Use special "select" key to do whatever default action a widget has 933 // Use special "select" key to do whatever default action a widget has
915 mapToDefaultAction( ke, Qt::Key_Space ); 934 mapToDefaultAction( ke, Qt::Key_Space );
916 } 935 }
917 else if ( ke->simpleData.keycode == Qt::Key_Escape && 936 else if ( ke->simpleData.keycode == Qt::Key_Escape &&
918 ke->simpleData.is_press ) { 937 ke->simpleData.is_press ) {
919 // Escape key closes app if focus on toplevel 938 // Escape key closes app if focus on toplevel
920 QWidget * active = activeWindow(); 939 QWidget * active = activeWindow();
921 if ( active && active->testWFlags( WType_TopLevel ) && 940 if ( active && active->testWFlags( WType_TopLevel ) &&
922 ( int ) active->winId() == ke->simpleData.window && 941 ( int ) active->winId() == ke->simpleData.window &&
923 !active->testWFlags( WStyle_Dialog | WStyle_Customize | WType_Popup | WType_Desktop ) ) { 942 !active->testWFlags( WStyle_Dialog | WStyle_Customize | WType_Popup | WType_Desktop ) ) {
924 if ( active->inherits( "QDialog" ) ) { 943 if ( active->inherits( "QDialog" ) ) {
925 HackDialog * d = ( HackDialog * ) active; 944 HackDialog * d = ( HackDialog * ) active;
926 d->rejectIt(); 945 d->rejectIt();
927 return TRUE; 946 return TRUE;
928 } 947 }
929 else if ( strcmp( argv() [ 0 ], "embeddedkonsole" ) != 0 ) { 948 else if ( strcmp( argv() [ 0 ], "embeddedkonsole" ) != 0 ) {
930 active->close(); 949 active->close();
931 } 950 }
932 } 951 }
933 } 952 }
934 else if ( ke->simpleData.keycode >= Qt::Key_F1 && ke->simpleData.keycode <= Qt::Key_F29 ) { 953 else if ( ke->simpleData.keycode >= Qt::Key_F1 && ke->simpleData.keycode <= Qt::Key_F29 ) {
935 // this should be if ( ODevice::inst ( )-> buttonForKeycode ( ... )) 954 // this should be if ( ODevice::inst ( )-> buttonForKeycode ( ... ))
936 // but we cannot access libopie function within libqpe :( 955 // but we cannot access libopie function within libqpe :(
937 956
938 QWidget * active = activeWindow ( ); 957 QWidget * active = activeWindow ( );
939 if ( active && ((int) active-> winId ( ) == ke-> simpleData.window )) { 958 if ( active && ((int) active-> winId ( ) == ke-> simpleData.window )) {
940 if ( d-> kbgrabbed ) { // we grabbed the keyboard 959 if ( d-> kbgrabbed ) { // we grabbed the keyboard
941 QChar ch ( ke-> simpleData.unicode ); 960 QChar ch ( ke-> simpleData.unicode );
942 QKeyEvent qke ( ke-> simpleData. is_press ? QEvent::KeyPress : QEvent::KeyRelease, 961 QKeyEvent qke ( ke-> simpleData. is_press ? QEvent::KeyPress : QEvent::KeyRelease,
943 ke-> simpleData.keycode, 962 ke-> simpleData.keycode,
944 ch. latin1 ( ), 963 ch. latin1 ( ),
945 ke-> simpleData.modifiers, 964 ke-> simpleData.modifiers,
946 QString ( ch ), 965 QString ( ch ),
947 ke-> simpleData.is_auto_repeat, 1 ); 966 ke-> simpleData.is_auto_repeat, 1 );
948 967
949 QObject *which = QWidget::keyboardGrabber ( ); 968 QObject *which = QWidget::keyboardGrabber ( );
950 if ( !which ) 969 if ( !which )
951 which = QApplication::focusWidget ( ); 970 which = QApplication::focusWidget ( );
952 if ( !which ) 971 if ( !which )
953 which = QApplication::activeWindow ( ); 972 which = QApplication::activeWindow ( );
954 if ( !which ) 973 if ( !which )
955 which = qApp; 974 which = qApp;
956 975
957 QApplication::sendEvent ( which, &qke ); 976 QApplication::sendEvent ( which, &qke );
958 } 977 }
959 else { // we didn't grab the keyboard, so send the event to the launcher 978 else { // we didn't grab the keyboard, so send the event to the launcher
960 QCopEnvelope e ( "QPE/Launcher", "deviceButton(int,int,int)" ); 979 QCopEnvelope e ( "QPE/Launcher", "deviceButton(int,int,int)" );
961 e << int( ke-> simpleData.keycode ) << int( ke-> simpleData. is_press ) << int( ke-> simpleData.is_auto_repeat ); 980 e << int( ke-> simpleData.keycode ) << int( ke-> simpleData. is_press ) << int( ke-> simpleData.is_auto_repeat );
962 } 981 }
963 } 982 }
964 return true; 983 return true;
965 } 984 }
966 } 985 }
967 if ( e->type == QWSEvent::Focus ) { 986 if ( e->type == QWSEvent::Focus ) {
968 QWSFocusEvent * fe = ( QWSFocusEvent* ) e; 987 QWSFocusEvent * fe = ( QWSFocusEvent* ) e;
969 if ( !fe->simpleData.get_focus ) { 988 if ( !fe->simpleData.get_focus ) {
970 QWidget * active = activeWindow(); 989 QWidget * active = activeWindow();
971 while ( active && active->isPopup() ) { 990 while ( active && active->isPopup() ) {
972 active->close(); 991 active->close();
973 active = activeWindow(); 992 active = activeWindow();
974 } 993 }
975 } 994 }
976 else { 995 else {
977 // make sure our modal widget is ALWAYS on top 996 // make sure our modal widget is ALWAYS on top
978 QWidget *topm = activeModalWidget(); 997 QWidget *topm = activeModalWidget();
979 if ( topm ) { 998 if ( topm ) {
980 topm->raise(); 999 topm->raise();
981 } 1000 }
982 } 1001 }
983 if ( fe->simpleData.get_focus && inputMethodDict ) { 1002 if ( fe->simpleData.get_focus && inputMethodDict ) {
984 InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) ); 1003 InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) );
985 if ( m == AlwaysOff ) 1004 if ( m == AlwaysOff )
986 Global::hideInputMethod(); 1005 Global::hideInputMethod();
987 if ( m == AlwaysOn ) 1006 if ( m == AlwaysOn )
988 Global::showInputMethod(); 1007 Global::showInputMethod();
989 } 1008 }
990 } 1009 }
991 1010
992 1011
993 return QApplication::qwsEventFilter( e ); 1012 return QApplication::qwsEventFilter( e );
994} 1013}
995#endif 1014#endif
996 1015
997/*! 1016/*!
998 Destroys the QPEApplication. 1017 Destroys the QPEApplication.
999*/ 1018*/
1000QPEApplication::~QPEApplication() 1019QPEApplication::~QPEApplication()
1001{ 1020{
1002 ungrabKeyboard(); 1021 ungrabKeyboard();
1003#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 1022#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
1004 // Need to delete QCopChannels early, since the display will 1023 // Need to delete QCopChannels early, since the display will
1005 // be gone by the time we get to ~QObject(). 1024 // be gone by the time we get to ~QObject().
1006 delete sysChannel; 1025 delete sysChannel;
1007 delete pidChannel; 1026 delete pidChannel;
1008#endif 1027#endif
1009 1028
1010 delete d; 1029 delete d;
1011} 1030}
1012 1031
1013/*! 1032/*!
1014 Returns <tt>$OPIEDIR/</tt>. 1033 Returns <tt>$OPIEDIR/</tt>.
1015*/ 1034*/
1016QString QPEApplication::qpeDir() 1035QString QPEApplication::qpeDir()
1017{ 1036{
1018 const char * base = getenv( "OPIEDIR" ); 1037 const char * base = getenv( "OPIEDIR" );
1019 if ( base ) 1038 if ( base )
1020 return QString( base ) + "/"; 1039 return QString( base ) + "/";
1021 1040
1022 return QString( "../" ); 1041 return QString( "../" );
1023} 1042}
1024 1043
1025/*! 1044/*!
1026 Returns the user's current Document directory. There is a trailing "/". 1045 Returns the user's current Document directory. There is a trailing "/".
1027 .. well, it does now,, and there's no trailing '/' 1046 .. well, it does now,, and there's no trailing '/'
1028*/ 1047*/
1029QString QPEApplication::documentDir() 1048QString QPEApplication::documentDir()
1030{ 1049{
1031 const char* base = getenv( "HOME"); 1050 const char* base = getenv( "HOME");
1032 if ( base ) 1051 if ( base )
1033 return QString( base ) + "/Documents"; 1052 return QString( base ) + "/Documents";
1034 1053
1035 return QString( "../Documents" ); 1054 return QString( "../Documents" );
1036} 1055}
1037 1056
1038static int deforient = -1; 1057static int deforient = -1;
1039 1058
1040/*! 1059/*!
1041 \internal 1060 \internal
1042*/ 1061*/
1043int QPEApplication::defaultRotation() 1062int QPEApplication::defaultRotation()
1044{ 1063{
1045 if ( deforient < 0 ) { 1064 if ( deforient < 0 ) {
1046 QString d = getenv( "QWS_DISPLAY" ); 1065 QString d = getenv( "QWS_DISPLAY" );
1047 if ( d.contains( "Rot90" ) ) { 1066 if ( d.contains( "Rot90" ) ) {
1048 deforient = 90; 1067 deforient = 90;
1049 } 1068 }
1050 else if ( d.contains( "Rot180" ) ) { 1069 else if ( d.contains( "Rot180" ) ) {
1051 deforient = 180; 1070 deforient = 180;
1052 } 1071 }
1053 else if ( d.contains( "Rot270" ) ) { 1072 else if ( d.contains( "Rot270" ) ) {
1054 deforient = 270; 1073 deforient = 270;
1055 } 1074 }
1056 else { 1075 else {
1057 deforient = 0; 1076 deforient = 0;
1058 } 1077 }
1059 } 1078 }
1060 return deforient; 1079 return deforient;
1061} 1080}
1062 1081
1063/*! 1082/*!
1064 \internal 1083 \internal
1065*/ 1084*/
1066void QPEApplication::setDefaultRotation( int r ) 1085void QPEApplication::setDefaultRotation( int r )
1067{ 1086{
1068 if ( qApp->type() == GuiServer ) { 1087 if ( qApp->type() == GuiServer ) {
1069 deforient = r; 1088 deforient = r;
1070 setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); 1089 setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 );
1071 Config config("qpe"); 1090 Config config("qpe");
1072 config.setGroup( "Rotation" ); 1091 config.setGroup( "Rotation" );
1073 config.writeEntry( "Rot", r ); 1092 config.writeEntry( "Rot", r );
1074 } 1093 }
1075 else { 1094 else {
1076#ifndef QT_NO_COP 1095#ifndef QT_NO_COP
1077 { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); 1096 { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" );
1078 e << r; 1097 e << r;
1079 } 1098 }
1080#endif 1099#endif
1081 1100
1082 } 1101 }
1083} 1102}
1084 1103
1085#include <qgfx_qws.h> 1104#include <qgfx_qws.h>
1086#include <qwindowsystem_qws.h> 1105#include <qwindowsystem_qws.h>
1087#include <qpixmapcache.h> 1106#include <qpixmapcache.h>
1088 1107
1089extern void qws_clearLoadedFonts(); 1108extern void qws_clearLoadedFonts();
1090 1109
1091void QPEApplication::setCurrentMode( int x, int y, int depth ) 1110void QPEApplication::setCurrentMode( int x, int y, int depth )
1092{ 1111{
1093 // Reset the caches 1112 // Reset the caches
1094 qws_clearLoadedFonts(); 1113 qws_clearLoadedFonts();
1095 QPixmapCache::clear(); 1114 QPixmapCache::clear();
1096 1115
1097 // Change the screen mode 1116 // Change the screen mode
1098 qt_screen->setMode(x, y, depth); 1117 qt_screen->setMode(x, y, depth);
1099 1118
1100 if ( qApp->type() == GuiServer ) { 1119 if ( qApp->type() == GuiServer ) {
1101 // Reconfigure the GuiServer 1120 // Reconfigure the GuiServer
1102 qwsServer->beginDisplayReconfigure(); 1121 qwsServer->beginDisplayReconfigure();
1103 qwsServer->endDisplayReconfigure(); 1122 qwsServer->endDisplayReconfigure();
1104 1123
1105 // Get all the running apps to reset 1124 // Get all the running apps to reset
1106 QCopEnvelope env( "QPE/System", "reset()" ); 1125 QCopEnvelope env( "QPE/System", "reset()" );
1107 } 1126 }
1108} 1127}
1109 1128
1110void QPEApplication::reset() { 1129void QPEApplication::reset() {
1111 // Reconnect to the screen 1130 // Reconnect to the screen
1112 qt_screen->disconnect(); 1131 qt_screen->disconnect();
1113 qt_screen->connect( QString::null ); 1132 qt_screen->connect( QString::null );
1114 1133
1115 // Redraw everything 1134 // Redraw everything
1116 applyStyle(); 1135 applyStyle();
1117} 1136}
1118 1137
1119/*! 1138/*!
1120 \internal 1139 \internal
1121*/ 1140*/
1122void QPEApplication::applyStyle() 1141void QPEApplication::applyStyle()
1123{ 1142{
1124 Config config( "qpe" ); 1143 Config config( "qpe" );
1125 config.setGroup( "Appearance" ); 1144 config.setGroup( "Appearance" );
1126 1145
1127#if QT_VERSION > 233 1146#if QT_VERSION > 233
1128#if !defined(OPIE_NO_OVERRIDE_QT) 1147#if !defined(OPIE_NO_OVERRIDE_QT)
1129 // don't block ourselves ... 1148 // don't block ourselves ...
1130 Opie::force_appearance = 0; 1149 Opie::force_appearance = 0;
1131 1150
1132 static QString appname = Opie::binaryName ( ); 1151 static QString appname = Opie::binaryName ( );
1133 1152
1134 QStringList ex = config. readListEntry ( "NoStyle", ';' ); 1153 QStringList ex = config. readListEntry ( "NoStyle", ';' );
1135 int nostyle = 0; 1154 int nostyle = 0;
1136 for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) { 1155 for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) {
1137 if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) { 1156 if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) {
1138 nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 ); 1157 nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 );
1139 break; 1158 break;
1140 } 1159 }
1141 } 1160 }
1142#else 1161#else
1143 int nostyle = 0; 1162 int nostyle = 0;
1144#endif 1163#endif
1145 1164
1146 // Widget style 1165 // Widget style
1147 QString style = config.readEntry( "Style", "FlatStyle" ); 1166 QString style = config.readEntry( "Style", "FlatStyle" );
1148 1167
1149 // don't set a custom style 1168 // don't set a custom style
1150 if ( nostyle & Opie::Force_Style ) 1169 if ( nostyle & Opie::Force_Style )
1151 style = "FlatStyle"; 1170 style = "FlatStyle";
1152 1171
1153 internalSetStyle ( style ); 1172 internalSetStyle ( style );
1154 1173
1155 // Colors - from /etc/colors/Liquid.scheme 1174 // Colors - from /etc/colors/Liquid.scheme
1156 QColor bgcolor( config.readEntry( "Background", "#E0E0E0" ) ); 1175 QColor bgcolor( config.readEntry( "Background", "#E0E0E0" ) );
1157 QColor btncolor( config.readEntry( "Button", "#96c8fa" ) ); 1176 QColor btncolor( config.readEntry( "Button", "#96c8fa" ) );
1158 QPalette pal( btncolor, bgcolor ); 1177 QPalette pal( btncolor, bgcolor );
1159 QString color = config.readEntry( "Highlight", "#73adef" ); 1178 QString color = config.readEntry( "Highlight", "#73adef" );
1160 pal.setColor( QColorGroup::Highlight, QColor( color ) ); 1179 pal.setColor( QColorGroup::Highlight, QColor( color ) );
1161 color = config.readEntry( "HighlightedText", "#FFFFFF" ); 1180 color = config.readEntry( "HighlightedText", "#FFFFFF" );
1162 pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); 1181 pal.setColor( QColorGroup::HighlightedText, QColor( color ) );
1163 color = config.readEntry( "Text", "#000000" ); 1182 color = config.readEntry( "Text", "#000000" );
1164 pal.setColor( QColorGroup::Text, QColor( color ) ); 1183 pal.setColor( QColorGroup::Text, QColor( color ) );
1165 color = config.readEntry( "ButtonText", "#000000" ); 1184 color = config.readEntry( "ButtonText", "#000000" );
1166 pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); 1185 pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) );
1167 color = config.readEntry( "Base", "#FFFFFF" ); 1186 color = config.readEntry( "Base", "#FFFFFF" );
1168 pal.setColor( QColorGroup::Base, QColor( color ) ); 1187 pal.setColor( QColorGroup::Base, QColor( color ) );
1169 1188
1170 pal.setColor( QPalette::Disabled, QColorGroup::Text, 1189 pal.setColor( QPalette::Disabled, QColorGroup::Text,
1171 pal.color( QPalette::Active, QColorGroup::Background ).dark() ); 1190 pal.color( QPalette::Active, QColorGroup::Background ).dark() );
1172 1191
1173 setPalette( pal, TRUE ); 1192 setPalette( pal, TRUE );
1174 1193
1175 // Window Decoration 1194 // Window Decoration
1176 QString dec = config.readEntry( "Decoration", "Flat" ); 1195 QString dec = config.readEntry( "Decoration", "Flat" );
1177 1196
1178 // don't set a custom deco 1197 // don't set a custom deco
1179 if ( nostyle & Opie::Force_Decoration ) 1198 if ( nostyle & Opie::Force_Decoration )
1180 dec = ""; 1199 dec = "";
1181 1200
1182 //qDebug ( "Setting Deco: %s -- old %s (%d)", dec.latin1(), d-> decorationName.latin1(), nostyle); 1201 //qDebug ( "Setting Deco: %s -- old %s (%d)", dec.latin1(), d-> decorationName.latin1(), nostyle);
1183 1202
1184 if ( dec != d->decorationName ) { 1203 if ( dec != d->decorationName ) {
1185 qwsSetDecoration( new QPEDecoration( dec ) ); 1204 qwsSetDecoration( new QPEDecoration( dec ) );
1186 d->decorationName = dec; 1205 d->decorationName = dec;
1187 } 1206 }
1188 1207
1189 // Font 1208 // Font
1190 QString ff = config.readEntry( "FontFamily", font().family() ); 1209 QString ff = config.readEntry( "FontFamily", font().family() );
1191 int fs = config.readNumEntry( "FontSize", font().pointSize() ); 1210 int fs = config.readNumEntry( "FontSize", font().pointSize() );
1192 1211
1193 // don't set a custom font 1212 // don't set a custom font
1194 if ( nostyle & Opie::Force_Font ) { 1213 if ( nostyle & Opie::Force_Font ) {
1195 ff = "Vera"; 1214 ff = "Vera";
1196 fs = 10; 1215 fs = 10;
1197 } 1216 }
1198 1217
1199 setFont ( QFont ( ff, fs ), true ); 1218 setFont ( QFont ( ff, fs ), true );
1200 1219
1201#if !defined(OPIE_NO_OVERRIDE_QT) 1220#if !defined(OPIE_NO_OVERRIDE_QT)
1202 // revert to global blocking policy ... 1221 // revert to global blocking policy ...
1203 Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None; 1222 Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None;
1204 Opie::force_appearance &= ~nostyle; 1223 Opie::force_appearance &= ~nostyle;
1205#endif 1224#endif
1206#endif 1225#endif
1207} 1226}
1208 1227
1209void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) 1228void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data )
1210{ 1229{
1211#ifdef Q_WS_QWS 1230#ifdef Q_WS_QWS
1212 QDataStream stream( data, IO_ReadOnly ); 1231 QDataStream stream( data, IO_ReadOnly );
1213 if ( msg == "applyStyle()" ) { 1232 if ( msg == "applyStyle()" ) {
1214 applyStyle(); 1233 applyStyle();
1215 } 1234 }
1216 else if ( msg == "toggleApplicationMenu()" ) { 1235 else if ( msg == "toggleApplicationMenu()" ) {
1217 QWidget *active = activeWindow ( ); 1236 QWidget *active = activeWindow ( );
1218 1237
1219 if ( active ) { 1238 if ( active ) {
1220 QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( ); 1239 QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( );
1221 bool oldactive = man-> isActive ( ); 1240 bool oldactive = man-> isActive ( );
1222 1241
1223 man-> setActive( !man-> isActive() ); 1242 man-> setActive( !man-> isActive() );
1224 1243
1225 if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu 1244 if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu
1226 QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" ); 1245 QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" );
1227 } 1246 }
1228 } 1247 }
1229 } 1248 }
1230 else if ( msg == "setDefaultRotation(int)" ) { 1249 else if ( msg == "setDefaultRotation(int)" ) {
1231 if ( type() == GuiServer ) { 1250 if ( type() == GuiServer ) {
1232 int r; 1251 int r;
1233 stream >> r; 1252 stream >> r;
1234 setDefaultRotation( r ); 1253 setDefaultRotation( r );
1235 } 1254 }
1236 } 1255 }
1237 else if ( msg == "setCurrentMode(int,int,int)" ) { // Added: 2003-06-11 by Tim Ansell <mithro@mithis.net> 1256 else if ( msg == "setCurrentMode(int,int,int)" ) { // Added: 2003-06-11 by Tim Ansell <mithro@mithis.net>
1238 if ( type() == GuiServer ) { 1257 if ( type() == GuiServer ) {
1239 int x, y, depth; 1258 int x, y, depth;
1240 stream >> x; 1259 stream >> x;
1241 stream >> y; 1260 stream >> y;
1242 stream >> depth; 1261 stream >> depth;
1243 setCurrentMode( x, y, depth ); 1262 setCurrentMode( x, y, depth );
1244 } 1263 }
1245 } 1264 }
1246 else if ( msg == "reset()" ) { 1265 else if ( msg == "reset()" ) {
1247 if ( type() != GuiServer ) 1266 if ( type() != GuiServer )
1248 reset(); 1267 reset();
1249 } 1268 }
1250 else if ( msg == "setCurrentRotation(int)" ) { 1269 else if ( msg == "setCurrentRotation(int)" ) {
1251 int r; 1270 int r;
1252 stream >> r; 1271 stream >> r;
1253 setCurrentRotation( r ); 1272 setCurrentRotation( r );
1254 } 1273 }
1255 else if ( msg == "shutdown()" ) { 1274 else if ( msg == "shutdown()" ) {
1256 if ( type() == GuiServer ) 1275 if ( type() == GuiServer )
1257 shutdown(); 1276 shutdown();
1258 } 1277 }
1259 else if ( msg == "quit()" ) { 1278 else if ( msg == "quit()" ) {
1260 if ( type() != GuiServer ) 1279 if ( type() != GuiServer )
1261 tryQuit(); 1280 tryQuit();
1262 } 1281 }
1263 else if ( msg == "forceQuit()" ) { 1282 else if ( msg == "forceQuit()" ) {
1264 if ( type() != GuiServer ) 1283 if ( type() != GuiServer )
1265 quit(); 1284 quit();
1266 } 1285 }
1267 else if ( msg == "restart()" ) { 1286 else if ( msg == "restart()" ) {
1268 if ( type() == GuiServer ) 1287 if ( type() == GuiServer )
1269 restart(); 1288 restart();
1270 } 1289 }
1271 else if ( msg == "language(QString)" ) { 1290 else if ( msg == "language(QString)" ) {
1272 if ( type() == GuiServer ) { 1291 if ( type() == GuiServer ) {
1273 QString l; 1292 QString l;
1274 stream >> l; 1293 stream >> l;
1275 QString cl = getenv( "LANG" ); 1294 QString cl = getenv( "LANG" );
1276 if ( cl != l ) { 1295 if ( cl != l ) {
1277 if ( l.isNull() ) 1296 if ( l.isNull() )
1278 unsetenv( "LANG" ); 1297 unsetenv( "LANG" );
1279 else 1298 else
1280 setenv( "LANG", l.latin1(), 1 ); 1299 setenv( "LANG", l.latin1(), 1 );
1281 restart(); 1300 restart();
1282 } 1301 }
1283 } 1302 }
1284 } 1303 }
1285 else if ( msg == "timeChange(QString)" ) { 1304 else if ( msg == "timeChange(QString)" ) {
1286 QString t; 1305 QString t;
1287 stream >> t; 1306 stream >> t;
1288 if ( t.isNull() ) 1307 if ( t.isNull() )
1289 unsetenv( "TZ" ); 1308 unsetenv( "TZ" );
1290 else 1309 else
1291 setenv( "TZ", t.latin1(), 1 ); 1310 setenv( "TZ", t.latin1(), 1 );
1292 // emit the signal so everyone else knows... 1311 // emit the signal so everyone else knows...
1293 emit timeChanged(); 1312 emit timeChanged();
1294 } 1313 }
1295 else if ( msg == "addAlarm(QDateTime,QCString,QCString,int)" ) { 1314 else if ( msg == "addAlarm(QDateTime,QCString,QCString,int)" ) {
1296 if ( type() == GuiServer ) { 1315 if ( type() == GuiServer ) {
1297 QDateTime when; 1316 QDateTime when;
1298 QCString channel, message; 1317 QCString channel, message;
1299 int data; 1318 int data;
1300 stream >> when >> channel >> message >> data; 1319 stream >> when >> channel >> message >> data;
1301 AlarmServer::addAlarm( when, channel, message, data ); 1320 AlarmServer::addAlarm( when, channel, message, data );
1302 } 1321 }
1303 } 1322 }
1304 else if ( msg == "deleteAlarm(QDateTime,QCString,QCString,int)" ) { 1323 else if ( msg == "deleteAlarm(QDateTime,QCString,QCString,int)" ) {
1305 if ( type() == GuiServer ) { 1324 if ( type() == GuiServer ) {
1306 QDateTime when; 1325 QDateTime when;
1307 QCString channel, message; 1326 QCString channel, message;
1308 int data; 1327 int data;
1309 stream >> when >> channel >> message >> data; 1328 stream >> when >> channel >> message >> data;
1310 AlarmServer::deleteAlarm( when, channel, message, data ); 1329 AlarmServer::deleteAlarm( when, channel, message, data );
1311 } 1330 }
1312 } 1331 }
1313 else if ( msg == "clockChange(bool)" ) { 1332 else if ( msg == "clockChange(bool)" ) {
1314 int tmp; 1333 int tmp;
1315 stream >> tmp; 1334 stream >> tmp;
1316 emit clockChanged( tmp ); 1335 emit clockChanged( tmp );
1317 } 1336 }
1318 else if ( msg == "weekChange(bool)" ) { 1337 else if ( msg == "weekChange(bool)" ) {
1319 int tmp; 1338 int tmp;
1320 stream >> tmp; 1339 stream >> tmp;
1321 emit weekChanged( tmp ); 1340 emit weekChanged( tmp );
1322 } 1341 }
1323 else if ( msg == "setDateFormat(DateFormat)" ) { 1342 else if ( msg == "setDateFormat(DateFormat)" ) {
1324 DateFormat tmp; 1343 DateFormat tmp;
1325 stream >> tmp; 1344 stream >> tmp;
1326 emit dateFormatChanged( tmp ); 1345 emit dateFormatChanged( tmp );
1327 } 1346 }
1328 else if ( msg == "setVolume(int,int)" ) { 1347 else if ( msg == "setVolume(int,int)" ) {
1329 int t, v; 1348 int t, v;
1330 stream >> t >> v; 1349 stream >> t >> v;
1331 setVolume( t, v ); 1350 setVolume( t, v );
1332 emit volumeChanged( muted ); 1351 emit volumeChanged( muted );
1333 } 1352 }
1334 else if ( msg == "volumeChange(bool)" ) { 1353 else if ( msg == "volumeChange(bool)" ) {
1335 stream >> muted; 1354 stream >> muted;
1336 setVolume(); 1355 setVolume();
1337 emit volumeChanged( muted ); 1356 emit volumeChanged( muted );
1338 } 1357 }
1339 else if ( msg == "setMic(int,int)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com> 1358 else if ( msg == "setMic(int,int)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com>
1340 int t, v; 1359 int t, v;
1341 stream >> t >> v; 1360 stream >> t >> v;
1342 setMic( t, v ); 1361 setMic( t, v );
1343 emit micChanged( micMuted ); 1362 emit micChanged( micMuted );
1344 } 1363 }
1345 else if ( msg == "micChange(bool)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com> 1364 else if ( msg == "micChange(bool)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com>
1346 stream >> micMuted; 1365 stream >> micMuted;
1347 setMic(); 1366 setMic();
1348 emit micChanged( micMuted ); 1367 emit micChanged( micMuted );
1349 } 1368 }
1350 else if ( msg == "setBass(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> 1369 else if ( msg == "setBass(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org>
1351 int t, v; 1370 int t, v;
1352 stream >> t >> v; 1371 stream >> t >> v;
1353 setBass( t, v ); 1372 setBass( t, v );
1354 } 1373 }
1355 else if ( msg == "bassChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> 1374 else if ( msg == "bassChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org>
1356 setBass(); 1375 setBass();
1357 } 1376 }
1358 else if ( msg == "setTreble(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> 1377 else if ( msg == "setTreble(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org>
1359 int t, v; 1378 int t, v;
1360 stream >> t >> v; 1379 stream >> t >> v;
1361 setTreble( t, v ); 1380 setTreble( t, v );
1362 } 1381 }
1363 else if ( msg == "trebleChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> 1382 else if ( msg == "trebleChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org>
1364 setTreble(); 1383 setTreble();
1365 } else if ( msg == "getMarkedText()" ) { 1384 } else if ( msg == "getMarkedText()" ) {
1366 if ( type() == GuiServer ) { 1385 if ( type() == GuiServer ) {
1367 const ushort unicode = 'C'-'@'; 1386 const ushort unicode = 'C'-'@';
1368 const int scan = Key_C; 1387 const int scan = Key_C;
1369 qwsServer->processKeyEvent( unicode, scan, ControlButton, TRUE, FALSE ); 1388 qwsServer->processKeyEvent( unicode, scan, ControlButton, TRUE, FALSE );
1370 qwsServer->processKeyEvent( unicode, scan, ControlButton, FALSE, FALSE ); 1389 qwsServer->processKeyEvent( unicode, scan, ControlButton, FALSE, FALSE );
1371 } 1390 }
1372 } else if ( msg == "newChannel(QString)") { 1391 } else if ( msg == "newChannel(QString)") {
1373 QString myChannel = "QPE/Application/" + d->appName; 1392 QString myChannel = "QPE/Application/" + d->appName;
1374 QString channel; 1393 QString channel;
1375 stream >> channel; 1394 stream >> channel;
1376 if (channel == myChannel) { 1395 if (channel == myChannel) {
1377 processQCopFile(); 1396 processQCopFile();
1378 d->sendQCopQ(); 1397 d->sendQCopQ();
1379 } 1398 }
1380 } 1399 }
1381 1400
1382 1401
1383#endif 1402#endif
1384} 1403}
1385 1404
1386 1405
1387 1406
1388 1407
1389 1408
1390/*! 1409/*!
1391 \internal 1410 \internal
1392*/ 1411*/
1393bool QPEApplication::raiseAppropriateWindow() 1412bool QPEApplication::raiseAppropriateWindow()
1394{ 1413{
1395 bool r=FALSE; 1414 bool r=FALSE;
1396 1415
1397 // 1. Raise the main widget 1416 // 1. Raise the main widget
1398 QWidget *top = d->qpe_main_widget; 1417 QWidget *top = d->qpe_main_widget;
1399 if ( !top ) top = mainWidget(); 1418 if ( !top ) top = mainWidget();
1400 1419
1401 if ( top && d->keep_running ) { 1420 if ( top && d->keep_running ) {
1402 if ( top->isVisible() ) 1421 if ( top->isVisible() )
1403 r = TRUE; 1422 r = TRUE;
1404 else if (d->preloaded) { 1423 else if (d->preloaded) {
1405 // We are preloaded and not visible.. pretend we just started.. 1424 // We are preloaded and not visible.. pretend we just started..
1406#ifndef QT_NO_COP 1425#ifndef QT_NO_COP
1407 QCopEnvelope e("QPE/System", "fastAppShowing(QString)"); 1426 QCopEnvelope e("QPE/System", "fastAppShowing(QString)");
1408 e << d->appName; 1427 e << d->appName;
1409#endif 1428#endif
1410 } 1429 }
1411 1430
1412 d->show_mx(top,d->nomaximize, d->appName); 1431 d->show_mx(top,d->nomaximize, d->appName);
1413 top->raise(); 1432 top->raise();
1414 } 1433 }
1415 1434
1416 QWidget *topm = activeModalWidget(); 1435 QWidget *topm = activeModalWidget();
1417 1436
1418 // 2. Raise any parentless widgets (except top and topm, as they 1437 // 2. Raise any parentless widgets (except top and topm, as they
1419 // are raised before and after this loop). Order from most 1438 // are raised before and after this loop). Order from most
1420 // recently raised as deepest to least recently as top, so 1439 // recently raised as deepest to least recently as top, so
1421 // that repeated calls cycle through widgets. 1440 // that repeated calls cycle through widgets.
1422 QWidgetList *list = topLevelWidgets(); 1441 QWidgetList *list = topLevelWidgets();
1423 if ( list ) { 1442 if ( list ) {
1424 bool foundlast = FALSE; 1443 bool foundlast = FALSE;
1425 QWidget* topsub = 0; 1444 QWidget* topsub = 0;
1426 if ( d->lastraised ) { 1445 if ( d->lastraised ) {
1427 for (QWidget* w = list->first(); w; w = list->next()) { 1446 for (QWidget* w = list->first(); w; w = list->next()) {
1428 if ( !w->parentWidget() && w != topm && w->isVisible() && !w->isDesktop() ) { 1447 if ( !w->parentWidget() && w != topm && w->isVisible() && !w->isDesktop() ) {
1429 if ( w == d->lastraised ) 1448 if ( w == d->lastraised )
1430 foundlast = TRUE; 1449 foundlast = TRUE;
1431 if ( foundlast ) { 1450 if ( foundlast ) {
1432 w->raise(); 1451 w->raise();
1433 topsub = w; 1452 topsub = w;
1434 } 1453 }
1435 } 1454 }
1436 } 1455 }
1437 } 1456 }
1438 for (QWidget* w = list->first(); w; w = list->next()) { 1457 for (QWidget* w = list->first(); w; w = list->next()) {
1439 if ( !w->parentWidget() && w != topm && w->isVisible() && !w->isDesktop() ) { 1458 if ( !w->parentWidget() && w != topm && w->isVisible() && !w->isDesktop() ) {
1440 if ( w == d->lastraised ) 1459 if ( w == d->lastraised )
1441 break; 1460 break;
1442 w->raise(); 1461 w->raise();
1443 topsub = w; 1462 topsub = w;
1444 } 1463 }
1445 } 1464 }
1446 d->lastraised = topsub; 1465 d->lastraised = topsub;
1447 delete list; 1466 delete list;
1448 } 1467 }
1449 1468
1450 // 3. Raise the active modal widget. 1469 // 3. Raise the active modal widget.
1451 if ( topm && topm != top ) { 1470 if ( topm && topm != top ) {
1452 topm->show(); 1471 topm->show();
1453 topm->raise(); 1472 topm->raise();
1454 // If we haven't already handled the fastAppShowing message 1473 // If we haven't already handled the fastAppShowing message
1455 if (!top && d->preloaded) { 1474 if (!top && d->preloaded) {
1456#ifndef QT_NO_COP 1475#ifndef QT_NO_COP
1457 QCopEnvelope e("QPE/System", "fastAppShowing(QString)"); 1476 QCopEnvelope e("QPE/System", "fastAppShowing(QString)");
1458 e << d->appName; 1477 e << d->appName;
1459#endif 1478#endif
1460 } 1479 }
1461 r = FALSE; 1480 r = FALSE;
1462 } 1481 }
1463 1482
1464 return r; 1483 return r;
1465} 1484}
1466 1485
1467 1486
1468void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data) 1487void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data)
1469{ 1488{
1470#ifdef Q_WS_QWS 1489#ifdef Q_WS_QWS
1471 1490
1472 if ( msg == "quit()" ) { 1491 if ( msg == "quit()" ) {
1473 tryQuit(); 1492 tryQuit();
1474 } 1493 }
1475 else if ( msg == "quitIfInvisible()" ) { 1494 else if ( msg == "quitIfInvisible()" ) {
1476 if ( d->qpe_main_widget && !d->qpe_main_widget->isVisible() ) 1495 if ( d->qpe_main_widget && !d->qpe_main_widget->isVisible() )
1477 quit(); 1496 quit();
1478 } 1497 }
1479 else if ( msg == "close()" ) { 1498 else if ( msg == "close()" ) {
1480 hideOrQuit(); 1499 hideOrQuit();
1481 } 1500 }
1482 else if ( msg == "disablePreload()" ) { 1501 else if ( msg == "disablePreload()" ) {
1483 d->preloaded = FALSE; 1502 d->preloaded = FALSE;
1484 d->keep_running = TRUE; 1503 d->keep_running = TRUE;
1485 /* so that quit will quit */ 1504 /* so that quit will quit */
1486 } 1505 }
1487 else if ( msg == "enablePreload()" ) { 1506 else if ( msg == "enablePreload()" ) {
1488 if (d->qpe_main_widget) 1507 if (d->qpe_main_widget)
1489 d->preloaded = TRUE; 1508 d->preloaded = TRUE;
1490 d->keep_running = TRUE; 1509 d->keep_running = TRUE;
1491 /* so next quit won't quit */ 1510 /* so next quit won't quit */
1492 } 1511 }
1493 else if ( msg == "raise()" ) { 1512 else if ( msg == "raise()" ) {
1494 d->keep_running = TRUE; 1513 d->keep_running = TRUE;
1495 d->notbusysent = FALSE; 1514 d->notbusysent = FALSE;
1496 raiseAppropriateWindow(); 1515 raiseAppropriateWindow();
1497 // Tell the system we're still chugging along... 1516 // Tell the system we're still chugging along...
1498 QCopEnvelope e("QPE/System", "appRaised(QString)"); 1517 QCopEnvelope e("QPE/System", "appRaised(QString)");
1499 e << d->appName; 1518 e << d->appName;
1500 } 1519 }
1501 else if ( msg == "flush()" ) { 1520 else if ( msg == "flush()" ) {
1502 emit flush(); 1521 emit flush();
1503 // we need to tell the desktop 1522 // we need to tell the desktop
1504 QCopEnvelope e( "QPE/Desktop", "flushDone(QString)" ); 1523 QCopEnvelope e( "QPE/Desktop", "flushDone(QString)" );
1505 e << d->appName; 1524 e << d->appName;
1506 } 1525 }
1507 else if ( msg == "reload()" ) { 1526 else if ( msg == "reload()" ) {
1508 emit reload(); 1527 emit reload();
1509 } 1528 }
1510 else if ( msg == "setDocument(QString)" ) { 1529 else if ( msg == "setDocument(QString)" ) {
1511 d->keep_running = TRUE; 1530 d->keep_running = TRUE;
1512 QDataStream stream( data, IO_ReadOnly ); 1531 QDataStream stream( data, IO_ReadOnly );
1513 QString doc; 1532 QString doc;
1514 stream >> doc; 1533 stream >> doc;
1515 QWidget *mw = mainWidget(); 1534 QWidget *mw = mainWidget();
1516 if ( !mw ) 1535 if ( !mw )
1517 mw = d->qpe_main_widget; 1536 mw = d->qpe_main_widget;
1518 if ( mw ) 1537 if ( mw )
1519 Global::setDocument( mw, doc ); 1538 Global::setDocument( mw, doc );
1520 1539
1521 } else if ( msg == "QPEProcessQCop()" ) { 1540 } else if ( msg == "QPEProcessQCop()" ) {
1522 processQCopFile(); 1541 processQCopFile();
1523 d->sendQCopQ(); 1542 d->sendQCopQ();
1524 }else 1543 }else
1525 { 1544 {
1526 bool p = d->keep_running; 1545 bool p = d->keep_running;
1527 d->keep_running = FALSE; 1546 d->keep_running = FALSE;
1528 emit appMessage( msg, data); 1547 emit appMessage( msg, data);
1529 if ( d->keep_running ) { 1548 if ( d->keep_running ) {
1530 d->notbusysent = FALSE; 1549 d->notbusysent = FALSE;
1531 raiseAppropriateWindow(); 1550 raiseAppropriateWindow();
1532 if ( !p ) { 1551 if ( !p ) {
1533 // Tell the system we're still chugging along... 1552 // Tell the system we're still chugging along...
1534#ifndef QT_NO_COP 1553#ifndef QT_NO_COP
1535 QCopEnvelope e("QPE/System", "appRaised(QString)"); 1554 QCopEnvelope e("QPE/System", "appRaised(QString)");
1536 e << d->appName; 1555 e << d->appName;
1537#endif 1556#endif
1538 } 1557 }
1539 } 1558 }
1540 if ( p ) 1559 if ( p )
1541 d->keep_running = p; 1560 d->keep_running = p;
1542 } 1561 }
1543#endif 1562#endif
1544} 1563}
1545 1564
1546 1565
1547/*! 1566/*!
1548 Sets widget \a mw as the mainWidget() and shows it. For small windows, 1567 Sets widget \a mw as the mainWidget() and shows it. For small windows,
1549 consider passing TRUE for \a nomaximize rather than the default FALSE. 1568 consider passing TRUE for \a nomaximize rather than the default FALSE.
1550 1569
1551 \sa showMainDocumentWidget() 1570 \sa showMainDocumentWidget()
1552*/ 1571*/
1553void QPEApplication::showMainWidget( QWidget* mw, bool nomaximize ) 1572void QPEApplication::showMainWidget( QWidget* mw, bool nomaximize )
1554{ 1573{
1555 d->show(mw, nomaximize ); 1574 d->show(mw, nomaximize );
1556} 1575}
1557 1576
1558/*! 1577/*!
1559 Sets widget \a mw as the mainWidget() and shows it. For small windows, 1578 Sets widget \a mw as the mainWidget() and shows it. For small windows,
1560 consider passing TRUE for \a nomaximize rather than the default FALSE. 1579 consider passing TRUE for \a nomaximize rather than the default FALSE.
1561 1580
1562 This calls designates the application as 1581 This calls designates the application as
1563 a \link docwidget.html document-oriented\endlink application. 1582 a \link docwidget.html document-oriented\endlink application.
1564 1583
1565 The \a mw widget \e must have this slot: setDocument(const QString&). 1584 The \a mw widget \e must have this slot: setDocument(const QString&).
1566 1585
1567 \sa showMainWidget() 1586 \sa showMainWidget()
1568*/ 1587*/
1569void QPEApplication::showMainDocumentWidget( QWidget* mw, bool nomaximize ) 1588void QPEApplication::showMainDocumentWidget( QWidget* mw, bool nomaximize )
1570{ 1589{
1571 if ( mw && argc() == 2 ) 1590 if ( mw && argc() == 2 )
1572 Global::setDocument( mw, QString::fromUtf8(argv()[1]) ); 1591 Global::setDocument( mw, QString::fromUtf8(argv()[1]) );
1573 1592
1574 1593
1575 d->show(mw, nomaximize ); 1594 d->show(mw, nomaximize );
1576} 1595}
1577 1596
1578 1597
1579/*! 1598/*!
1580 If an application is started via a \link qcop.html QCop\endlink 1599 If an application is started via a \link qcop.html QCop\endlink
1581 message, the application will process the \link qcop.html 1600 message, the application will process the \link qcop.html
1582 QCop\endlink message and then quit. If the application calls this 1601 QCop\endlink message and then quit. If the application calls this
1583 function while processing a \link qcop.html QCop\endlink message, 1602 function while processing a \link qcop.html QCop\endlink message,
1584 after processing its outstanding \link qcop.html QCop\endlink 1603 after processing its outstanding \link qcop.html QCop\endlink
1585 messages the application will start 'properly' and show itself. 1604 messages the application will start 'properly' and show itself.
1586 1605
1587 \sa keepRunning() 1606 \sa keepRunning()
1588*/ 1607*/
1589void QPEApplication::setKeepRunning() 1608void QPEApplication::setKeepRunning()
1590{ 1609{
1591 if ( qApp && qApp->inherits( "QPEApplication" ) ) { 1610 if ( qApp && qApp->inherits( "QPEApplication" ) ) {
1592 QPEApplication * qpeApp = ( QPEApplication* ) qApp; 1611 QPEApplication * qpeApp = ( QPEApplication* ) qApp;
1593 qpeApp->d->keep_running = TRUE; 1612 qpeApp->d->keep_running = TRUE;
1594 } 1613 }
1595} 1614}
1596 1615
1597/*! 1616/*!
1598 Returns TRUE if the application will quit after processing the 1617 Returns TRUE if the application will quit after processing the
1599 current list of qcop messages; otherwise returns FALSE. 1618 current list of qcop messages; otherwise returns FALSE.
1600 1619
1601 \sa setKeepRunning() 1620 \sa setKeepRunning()
1602*/ 1621*/
1603bool QPEApplication::keepRunning() const 1622bool QPEApplication::keepRunning() const
1604{ 1623{
1605 return d->keep_running; 1624 return d->keep_running;
1606} 1625}
1607 1626
1608/*! 1627/*!
1609 \internal 1628 \internal
1610*/ 1629*/
1611void QPEApplication::internalSetStyle( const QString &style ) 1630void QPEApplication::internalSetStyle( const QString &style )
1612{ 1631{
1613#if QT_VERSION >= 300 1632#if QT_VERSION >= 300
1614 if ( style == "QPE" ) { 1633 if ( style == "QPE" ) {
1615 setStyle( new QPEStyle ); 1634 setStyle( new QPEStyle );
1616 } 1635 }
1617 else { 1636 else {
1618 QStyle *s = QStyleFactory::create( style ); 1637 QStyle *s = QStyleFactory::create( style );
1619 if ( s ) 1638 if ( s )
1620 setStyle( s ); 1639 setStyle( s );
1621 } 1640 }
1622#else 1641#else
1623 if ( style == "Windows" ) { 1642 if ( style == "Windows" ) {
1624 setStyle( new QWindowsStyle ); 1643 setStyle( new QWindowsStyle );
1625 } 1644 }
1626 else if ( style == "QPE" ) { 1645 else if ( style == "QPE" ) {
1627 setStyle( new QPEStyle ); 1646 setStyle( new QPEStyle );
1628 } 1647 }
1629 else if ( style == "Light" ) { 1648 else if ( style == "Light" ) {
1630 setStyle( new LightStyle ); 1649 setStyle( new LightStyle );
1631 } 1650 }
1632#ifndef QT_NO_STYLE_PLATINUM 1651#ifndef QT_NO_STYLE_PLATINUM
1633 else if ( style == "Platinum" ) { 1652 else if ( style == "Platinum" ) {
1634 setStyle( new QPlatinumStyle ); 1653 setStyle( new QPlatinumStyle );
1635 } 1654 }
1636#endif 1655#endif
1637#ifndef QT_NO_STYLE_MOTIF 1656#ifndef QT_NO_STYLE_MOTIF
1638 else if ( style == "Motif" ) { 1657 else if ( style == "Motif" ) {
1639 setStyle( new QMotifStyle ); 1658 setStyle( new QMotifStyle );
1640 } 1659 }
1641#endif 1660#endif
1642#ifndef QT_NO_STYLE_MOTIFPLUS 1661#ifndef QT_NO_STYLE_MOTIFPLUS
1643 else if ( style == "MotifPlus" ) { 1662 else if ( style == "MotifPlus" ) {
1644 setStyle( new QMotifPlusStyle ); 1663 setStyle( new QMotifPlusStyle );
1645 } 1664 }
1646#endif 1665#endif
1647 1666
1648 else { 1667 else {
1649 QStyle *sty = 0; 1668 QStyle *sty = 0;
1650 QString path = QPEApplication::qpeDir ( ) + "/plugins/styles/"; 1669 QString path = QPEApplication::qpeDir ( ) + "/plugins/styles/";
1651 1670
1671#ifdef Q_OS_MACX
1672 if ( style. find ( ".dylib" ) > 0 )
1673 path += style;
1674 else
1675 path = path + "lib" + style. lower ( ) + ".dylib"; // compatibility
1676#else
1652 if ( style. find ( ".so" ) > 0 ) 1677 if ( style. find ( ".so" ) > 0 )
1653 path += style; 1678 path += style;
1654 else 1679 else
1655 path = path + "lib" + style. lower ( ) + ".so"; // compatibility 1680 path = path + "lib" + style. lower ( ) + ".so"; // compatibility
1656 1681#endif
1657 static QLibrary *lastlib = 0; 1682 static QLibrary *lastlib = 0;
1658 static StyleInterface *lastiface = 0; 1683 static StyleInterface *lastiface = 0;
1659 1684
1660 QLibrary *lib = new QLibrary ( path ); 1685 QLibrary *lib = new QLibrary ( path );
1661 StyleInterface *iface = 0; 1686 StyleInterface *iface = 0;
1662 1687
1663 if (( lib-> queryInterface ( IID_Style, ( QUnknownInterface ** ) &iface ) == QS_OK ) && iface ) 1688 if (( lib-> queryInterface ( IID_Style, ( QUnknownInterface ** ) &iface ) == QS_OK ) && iface )
1664 sty = iface-> style ( ); 1689 sty = iface-> style ( );
1665 1690
1666 if ( sty ) { 1691 if ( sty ) {
1667 setStyle ( sty ); 1692 setStyle ( sty );
1668 1693
1669 if ( lastiface ) 1694 if ( lastiface )
1670 lastiface-> release ( ); 1695 lastiface-> release ( );
1671 lastiface = iface; 1696 lastiface = iface;
1672 1697
1673 if ( lastlib ) { 1698 if ( lastlib ) {
1674 lastlib-> unload ( ); 1699 lastlib-> unload ( );
1675 delete lastlib; 1700 delete lastlib;
1676 } 1701 }
1677 lastlib = lib; 1702 lastlib = lib;
1678 } 1703 }
1679 else { 1704 else {
1680 if ( iface ) 1705 if ( iface )
1681 iface-> release ( ); 1706 iface-> release ( );
1682 delete lib; 1707 delete lib;
1683 1708
1684 setStyle ( new LightStyle ( )); 1709 setStyle ( new LightStyle ( ));
1685 } 1710 }
1686 } 1711 }
1687#endif 1712#endif
1688} 1713}
1689 1714
1690/*! 1715/*!
1691 \internal 1716 \internal
1692*/ 1717*/
1693void QPEApplication::prepareForTermination( bool willrestart ) 1718void QPEApplication::prepareForTermination( bool willrestart )
1694{ 1719{
1695 if ( willrestart ) { 1720 if ( willrestart ) {
1696 // Draw a big wait icon, the image can be altered in later revisions 1721 // Draw a big wait icon, the image can be altered in later revisions
1697 // QWidget *d = QApplication::desktop(); 1722 // QWidget *d = QApplication::desktop();
1698 QImage img = Resource::loadImage( "launcher/new_wait" ); 1723 QImage img = Resource::loadImage( "launcher/new_wait" );
1699 QPixmap pix; 1724 QPixmap pix;
1700 pix.convertFromImage( img.smoothScale( 1 * img.width(), 1 * img.height() ) ); 1725 pix.convertFromImage( img.smoothScale( 1 * img.width(), 1 * img.height() ) );
1701 QLabel *lblWait = new QLabel( 0, "wait hack!", QWidget::WStyle_Customize | 1726 QLabel *lblWait = new QLabel( 0, "wait hack!", QWidget::WStyle_Customize |
1702 QWidget::WStyle_NoBorder | QWidget::WStyle_Tool ); 1727 QWidget::WStyle_NoBorder | QWidget::WStyle_Tool );
1703 lblWait->setPixmap( pix ); 1728 lblWait->setPixmap( pix );
1704 lblWait->setAlignment( QWidget::AlignCenter ); 1729 lblWait->setAlignment( QWidget::AlignCenter );
1705 lblWait->show(); 1730 lblWait->show();
1706 lblWait->showMaximized(); 1731 lblWait->showMaximized();
1707 } 1732 }
1708#ifndef SINGLE_APP 1733#ifndef SINGLE_APP
1709 { QCopEnvelope envelope( "QPE/System", "forceQuit()" ); 1734 { QCopEnvelope envelope( "QPE/System", "forceQuit()" );
1710 } 1735 }
1711 processEvents(); // ensure the message goes out. 1736 processEvents(); // ensure the message goes out.
1712 sleep( 1 ); // You have 1 second to comply. 1737 sleep( 1 ); // You have 1 second to comply.
1713#endif 1738#endif
1714} 1739}
1715 1740
1716/*! 1741/*!
1717 \internal 1742 \internal
1718*/ 1743*/
1719void QPEApplication::shutdown() 1744void QPEApplication::shutdown()
1720{ 1745{
1721 // Implement in server's QPEApplication subclass 1746 // Implement in server's QPEApplication subclass
1722} 1747}
1723 1748
1724/*! 1749/*!
1725 \internal 1750 \internal
1726*/ 1751*/
1727void QPEApplication::restart() 1752void QPEApplication::restart()
1728{ 1753{
1729 // Implement in server's QPEApplication subclass 1754 // Implement in server's QPEApplication subclass
1730} 1755}
1731 1756
1732static QPtrDict<void>* stylusDict = 0; 1757static QPtrDict<void>* stylusDict = 0;
1733static void createDict() 1758static void createDict()
1734{ 1759{
1735 if ( !stylusDict ) 1760 if ( !stylusDict )
1736 stylusDict = new QPtrDict<void>; 1761 stylusDict = new QPtrDict<void>;
1737} 1762}
1738 1763
1739/*! 1764/*!
1740 Returns the current StylusMode for widget \a w. 1765 Returns the current StylusMode for widget \a w.
1741 1766
1742 \sa setStylusOperation() StylusMode 1767 \sa setStylusOperation() StylusMode
1743*/ 1768*/
1744QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w ) 1769QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w )
1745{ 1770{
1746 if ( stylusDict ) 1771 if ( stylusDict )
1747 return ( StylusMode ) ( int ) stylusDict->find( w ); 1772 return ( StylusMode ) ( int ) stylusDict->find( w );
1748 return LeftOnly; 1773 return LeftOnly;
1749} 1774}
1750 1775
1751/*! 1776/*!
1752 \enum QPEApplication::StylusMode 1777 \enum QPEApplication::StylusMode
1753 1778
1754 \value LeftOnly the stylus only generates LeftButton 1779 \value LeftOnly the stylus only generates LeftButton
1755 events (the default). 1780 events (the default).
1756 \value RightOnHold the stylus generates RightButton events 1781 \value RightOnHold the stylus generates RightButton events
1757 if the user uses the press-and-hold gesture. 1782 if the user uses the press-and-hold gesture.
1758 1783
1759 \sa setStylusOperation() stylusOperation() 1784 \sa setStylusOperation() stylusOperation()
1760*/ 1785*/
1761 1786
1762/*! 1787/*!
1763 Causes widget \a w to receive mouse events according to the stylus 1788 Causes widget \a w to receive mouse events according to the stylus
1764 \a mode. 1789 \a mode.
1765 1790
1766 \sa stylusOperation() StylusMode 1791 \sa stylusOperation() StylusMode
1767*/ 1792*/
1768void QPEApplication::setStylusOperation( QWidget * w, StylusMode mode ) 1793void QPEApplication::setStylusOperation( QWidget * w, StylusMode mode )
1769{ 1794{
1770 createDict(); 1795 createDict();
1771 if ( mode == LeftOnly ) { 1796 if ( mode == LeftOnly ) {
1772 stylusDict->remove 1797 stylusDict->remove
1773 ( w ); 1798 ( w );
1774 w->removeEventFilter( qApp ); 1799 w->removeEventFilter( qApp );
1775 } 1800 }
1776 else { 1801 else {
1777 stylusDict->insert( w, ( void* ) mode ); 1802 stylusDict->insert( w, ( void* ) mode );
1778 connect( w, SIGNAL( destroyed() ), qApp, SLOT( removeSenderFromStylusDict() ) ); 1803 connect( w, SIGNAL( destroyed() ), qApp, SLOT( removeSenderFromStylusDict() ) );
1779 w->installEventFilter( qApp ); 1804 w->installEventFilter( qApp );
1780 } 1805 }
1781} 1806}
1782 1807
1783 1808
1784/*! 1809/*!
1785 \reimp 1810 \reimp
1786*/ 1811*/
1787bool QPEApplication::eventFilter( QObject *o, QEvent *e ) 1812bool QPEApplication::eventFilter( QObject *o, QEvent *e )
1788{ 1813{
1789 if ( !o->isWidgetType() ) 1814 if ( !o->isWidgetType() )
1790 return FALSE; 1815 return FALSE;
1791 1816
1792 if ( stylusDict && e->type() >= QEvent::MouseButtonPress && e->type() <= QEvent::MouseMove ) { 1817 if ( stylusDict && e->type() >= QEvent::MouseButtonPress && e->type() <= QEvent::MouseMove ) {
1793 QMouseEvent * me = ( QMouseEvent* ) e; 1818 QMouseEvent * me = ( QMouseEvent* ) e;
1794 StylusMode mode = (StylusMode)(int)stylusDict->find(o); 1819 StylusMode mode = (StylusMode)(int)stylusDict->find(o);
1795 switch (mode) { 1820 switch (mode) {
1796 case RightOnHold: 1821 case RightOnHold:
1797 switch ( me->type() ) { 1822 switch ( me->type() ) {
1798 case QEvent::MouseButtonPress: 1823 case QEvent::MouseButtonPress:
1799 if ( me->button() == LeftButton ) { 1824 if ( me->button() == LeftButton ) {
1800 if (!d->presstimer ) 1825 if (!d->presstimer )
1801 d->presstimer = startTimer(500); // #### pref. 1826 d->presstimer = startTimer(500); // #### pref.
1802 d->presswidget = (QWidget*)o; 1827 d->presswidget = (QWidget*)o;
1803 d->presspos = me->pos(); 1828 d->presspos = me->pos();
1804 d->rightpressed = FALSE; 1829 d->rightpressed = FALSE;
1805 } 1830 }
1806 break; 1831 break;
1807 case QEvent::MouseMove: 1832 case QEvent::MouseMove:
1808 if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) { 1833 if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) {
1809 killTimer(d->presstimer); 1834 killTimer(d->presstimer);
1810 d->presstimer = 0; 1835 d->presstimer = 0;
1811 } 1836 }
1812 break; 1837 break;
1813 case QEvent::MouseButtonRelease: 1838 case QEvent::MouseButtonRelease:
1814 if ( me->button() == LeftButton ) { 1839 if ( me->button() == LeftButton ) {
1815 if ( d->presstimer ) { 1840 if ( d->presstimer ) {
1816 killTimer(d->presstimer); 1841 killTimer(d->presstimer);
1817 d->presstimer = 0; 1842 d->presstimer = 0;
1818 } 1843 }
1819 if ( d->rightpressed && d->presswidget ) { 1844 if ( d->rightpressed && d->presswidget ) {
1820 // Right released 1845 // Right released
1821 postEvent( d->presswidget, 1846 postEvent( d->presswidget,
1822 new QMouseEvent( QEvent::MouseButtonRelease, me->pos(), 1847 new QMouseEvent( QEvent::MouseButtonRelease, me->pos(),
1823 RightButton, LeftButton + RightButton ) ); 1848 RightButton, LeftButton + RightButton ) );
1824 // Left released, off-widget 1849 // Left released, off-widget
1825 postEvent( d->presswidget, 1850 postEvent( d->presswidget,
1826 new QMouseEvent( QEvent::MouseMove, QPoint( -1, -1), 1851 new QMouseEvent( QEvent::MouseMove, QPoint( -1, -1),
1827 LeftButton, LeftButton ) ); 1852 LeftButton, LeftButton ) );
1828 postEvent( d->presswidget, 1853 postEvent( d->presswidget,
1829 new QMouseEvent( QEvent::MouseButtonRelease, QPoint( -1, -1), 1854 new QMouseEvent( QEvent::MouseButtonRelease, QPoint( -1, -1),
1830 LeftButton, LeftButton ) ); 1855 LeftButton, LeftButton ) );
1831 d->rightpressed = FALSE; 1856 d->rightpressed = FALSE;
1832 return TRUE; // don't send the real Left release 1857 return TRUE; // don't send the real Left release
1833 } 1858 }
1834 } 1859 }
1835 break; 1860 break;
1836 default: 1861 default:
1837 break; 1862 break;
1838 } 1863 }
1839 break; 1864 break;
1840 default: 1865 default:
1841 ; 1866 ;
1842 } 1867 }
1843 } 1868 }
1844 else if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { 1869 else if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) {
1845 QKeyEvent *ke = (QKeyEvent *)e; 1870 QKeyEvent *ke = (QKeyEvent *)e;
1846 if ( ke->key() == Key_Enter ) { 1871 if ( ke->key() == Key_Enter ) {
1847 if ( o->isA( "QRadioButton" ) || o->isA( "QCheckBox" ) ) { 1872 if ( o->isA( "QRadioButton" ) || o->isA( "QCheckBox" ) ) {
1848 postEvent( o, new QKeyEvent( e->type(), Key_Space, ' ', 1873 postEvent( o, new QKeyEvent( e->type(), Key_Space, ' ',
1849 ke->state(), " ", ke->isAutoRepeat(), ke->count() ) ); 1874 ke->state(), " ", ke->isAutoRepeat(), ke->count() ) );
1850 return TRUE; 1875 return TRUE;
1851 } 1876 }
1852 } 1877 }
1853 } 1878 }
1854 return FALSE; 1879 return FALSE;
1855} 1880}
1856 1881
1857/*! 1882/*!
1858 \reimp 1883 \reimp
1859*/ 1884*/
1860void QPEApplication::timerEvent( QTimerEvent *e ) 1885void QPEApplication::timerEvent( QTimerEvent *e )
1861{ 1886{
1862 if ( e->timerId() == d->presstimer && d->presswidget ) { 1887 if ( e->timerId() == d->presstimer && d->presswidget ) {
1863 // Right pressed 1888 // Right pressed
1864 postEvent( d->presswidget, 1889 postEvent( d->presswidget,
1865 new QMouseEvent( QEvent::MouseButtonPress, d->presspos, 1890 new QMouseEvent( QEvent::MouseButtonPress, d->presspos,
1866 RightButton, LeftButton ) ); 1891 RightButton, LeftButton ) );
1867 killTimer( d->presstimer ); 1892 killTimer( d->presstimer );
1868 d->presstimer = 0; 1893 d->presstimer = 0;
1869 d->rightpressed = TRUE; 1894 d->rightpressed = TRUE;
1870 } 1895 }
1871} 1896}
1872 1897
1873void QPEApplication::removeSenderFromStylusDict() 1898void QPEApplication::removeSenderFromStylusDict()
1874{ 1899{
1875 stylusDict->remove 1900 stylusDict->remove
1876 ( ( void* ) sender() ); 1901 ( ( void* ) sender() );
1877 if ( d->presswidget == sender() ) 1902 if ( d->presswidget == sender() )
1878 d->presswidget = 0; 1903 d->presswidget = 0;
1879} 1904}
1880 1905
1881/*! 1906/*!
1882 \internal 1907 \internal
1883*/ 1908*/
1884bool QPEApplication::keyboardGrabbed() const 1909bool QPEApplication::keyboardGrabbed() const
1885{ 1910{
1886 return d->kbgrabbed; 1911 return d->kbgrabbed;
1887} 1912}
1888 1913
1889 1914
1890/*! 1915/*!
1891 Reverses the effect of grabKeyboard(). This is called automatically 1916 Reverses the effect of grabKeyboard(). This is called automatically
1892 on program exit. 1917 on program exit.
1893*/ 1918*/
1894void QPEApplication::ungrabKeyboard() 1919void QPEApplication::ungrabKeyboard()
1895{ 1920{
1896 ((QPEApplication *) qApp )-> d-> kbgrabbed = false; 1921 ((QPEApplication *) qApp )-> d-> kbgrabbed = false;
1897} 1922}
1898 1923
1899/*! 1924/*!
1900 Grabs the physical keyboard keys, e.g. the application's launching 1925 Grabs the physical keyboard keys, e.g. the application's launching
1901 keys. Instead of launching applications when these keys are pressed 1926 keys. Instead of launching applications when these keys are pressed
1902 the signals emitted are sent to this application instead. Some games 1927 the signals emitted are sent to this application instead. Some games
1903 programs take over the launch keys in this way to make interaction 1928 programs take over the launch keys in this way to make interaction
1904 easier. 1929 easier.
1905 1930
1906 \sa ungrabKeyboard() 1931 \sa ungrabKeyboard()
1907*/ 1932*/
1908void QPEApplication::grabKeyboard() 1933void QPEApplication::grabKeyboard()
1909{ 1934{
1910 ((QPEApplication *) qApp )-> d-> kbgrabbed = true; 1935 ((QPEApplication *) qApp )-> d-> kbgrabbed = true;
1911} 1936}
1912 1937
1913/*! 1938/*!
1914 \reimp 1939 \reimp
1915*/ 1940*/
1916int QPEApplication::exec() 1941int QPEApplication::exec()
1917{ 1942{
1918 d->qcopQok = true; 1943 d->qcopQok = true;
1919#ifndef QT_NO_COP 1944#ifndef QT_NO_COP
1920 d->sendQCopQ(); 1945 d->sendQCopQ();
1921 if ( !d->keep_running ) 1946 if ( !d->keep_running )
1922 processEvents(); // we may have received QCop messages in the meantime. 1947 processEvents(); // we may have received QCop messages in the meantime.
1923#endif 1948#endif
1924 1949
1925 if ( d->keep_running ) 1950 if ( d->keep_running )
1926 //|| d->qpe_main_widget && d->qpe_main_widget->isVisible() ) 1951 //|| d->qpe_main_widget && d->qpe_main_widget->isVisible() )
1927 return QApplication::exec(); 1952 return QApplication::exec();
1928 1953
1929#ifndef QT_NO_COP 1954#ifndef QT_NO_COP
1930 1955
1931 { 1956 {
1932 QCopEnvelope e( "QPE/System", "closing(QString)" ); 1957 QCopEnvelope e( "QPE/System", "closing(QString)" );
1933 e << d->appName; 1958 e << d->appName;
1934 } 1959 }
1935#endif 1960#endif
1936 processEvents(); 1961 processEvents();
1937 return 0; 1962 return 0;
1938} 1963}
1939 1964
1940/*! 1965/*!
1941 \internal 1966 \internal
1942 External request for application to quit. Quits if possible without 1967 External request for application to quit. Quits if possible without
1943 loosing state. 1968 loosing state.
1944*/ 1969*/
1945void QPEApplication::tryQuit() 1970void QPEApplication::tryQuit()
1946{ 1971{
1947 if ( activeModalWidget() || strcmp( argv() [ 0 ], "embeddedkonsole" ) == 0 ) 1972 if ( activeModalWidget() || strcmp( argv() [ 0 ], "embeddedkonsole" ) == 0 )
1948 return ; // Inside modal loop or konsole. Too hard to save state. 1973 return ; // Inside modal loop or konsole. Too hard to save state.
1949#ifndef QT_NO_COP 1974#ifndef QT_NO_COP
1950 1975
1951 { 1976 {
1952 QCopEnvelope e( "QPE/System", "closing(QString)" ); 1977 QCopEnvelope e( "QPE/System", "closing(QString)" );
1953 e << d->appName; 1978 e << d->appName;
1954 } 1979 }
1955#endif 1980#endif
1956 processEvents(); 1981 processEvents();
1957 1982
1958 quit(); 1983 quit();
1959} 1984}
1960 1985
1961/*! 1986/*!
1962 \internal 1987 \internal
1963*/ 1988*/
1964void QPEApplication::installTranslation( const QString& baseName ) { 1989void QPEApplication::installTranslation( const QString& baseName ) {
1965 QTranslator* trans = new QTranslator(this); 1990 QTranslator* trans = new QTranslator(this);
1966 QString tfn = qpeDir() + "/i18n/"+baseName; 1991 QString tfn = qpeDir() + "/i18n/"+baseName;
1967 if ( trans->load( tfn ) ) 1992 if ( trans->load( tfn ) )
1968 installTranslator( trans ); 1993 installTranslator( trans );
1969 else 1994 else
1970 delete trans; 1995 delete trans;
1971} 1996}
1972 1997
1973/*! 1998/*!
1974 \internal 1999 \internal
1975 User initiated quit. Makes the window 'Go Away'. If preloaded this means 2000 User initiated quit. Makes the window 'Go Away'. If preloaded this means
1976 hiding the window. If not it means quitting the application. 2001 hiding the window. If not it means quitting the application.
1977 As this is user initiated we don't need to check state. 2002 As this is user initiated we don't need to check state.
1978*/ 2003*/
1979void QPEApplication::hideOrQuit() 2004void QPEApplication::hideOrQuit()
1980{ 2005{
1981 processEvents(); 2006 processEvents();
1982 2007
1983 // If we are a preloaded application we don't actually quit, so emit 2008 // If we are a preloaded application we don't actually quit, so emit
1984 // a System message indicating we're quasi-closing. 2009 // a System message indicating we're quasi-closing.
1985 if ( d->preloaded && d->qpe_main_widget ) 2010 if ( d->preloaded && d->qpe_main_widget )
1986#ifndef QT_NO_COP 2011#ifndef QT_NO_COP
1987 2012
1988 { 2013 {
1989 QCopEnvelope e("QPE/System", "fastAppHiding(QString)" ); 2014 QCopEnvelope e("QPE/System", "fastAppHiding(QString)" );
1990 e << d->appName; 2015 e << d->appName;
1991 d->qpe_main_widget->hide(); 2016 d->qpe_main_widget->hide();
1992 } 2017 }
1993#endif 2018#endif
1994 else 2019 else
1995 quit(); 2020 quit();
1996} 2021}
1997 2022
1998#if (__GNUC__ > 2 ) 2023#if (__GNUC__ > 2 )
1999extern "C" void __cxa_pure_virtual(); 2024extern "C" void __cxa_pure_virtual();
2000 2025
2001void __cxa_pure_virtual() 2026void __cxa_pure_virtual()
2002{ 2027{
2003 fprintf( stderr, "Pure virtual called\n"); 2028 fprintf( stderr, "Pure virtual called\n");
2004 abort(); 2029 abort();
2005 2030
2006} 2031}
2007 2032
2008#endif 2033#endif
2009 2034
2010 2035
2011#if defined(OPIE_NEW_MALLOC) 2036#if defined(OPIE_NEW_MALLOC)
2012 2037
2013// The libraries with the skiff package (and possibly others) have 2038// The libraries with the skiff package (and possibly others) have
2014// completely useless implementations of builtin new and delete that 2039// completely useless implementations of builtin new and delete that
2015// use about 50% of your CPU. Here we revert to the simple libc 2040// use about 50% of your CPU. Here we revert to the simple libc
2016// functions. 2041// functions.
2017 2042
2018void* operator new[]( size_t size ) 2043void* operator new[]( size_t size )
2019{ 2044{
2020 return malloc( size ); 2045 return malloc( size );
2021} 2046}
2022 2047
2023void* operator new( size_t size ) 2048void* operator new( size_t size )
2024{ 2049{
2025 return malloc( size ); 2050 return malloc( size );
2026} 2051}
2027 2052
2028void operator delete[]( void* p ) 2053void operator delete[]( void* p )
2029{ 2054{
2030 free( p ); 2055 free( p );
2031} 2056}
2032 2057
2033void operator delete[]( void* p, size_t /*size*/ ) 2058void operator delete[]( void* p, size_t /*size*/ )
2034{ 2059{
2035 free( p ); 2060 free( p );
2036} 2061}
2037 2062
2038 2063
2039void operator delete( void* p ) 2064void operator delete( void* p )
2040{ 2065{
2041 free( p ); 2066 free( p );
2042} 2067}
2043 2068
2044void operator delete( void* p, size_t /*size*/ ) 2069void operator delete( void* p, size_t /*size*/ )
2045{ 2070{
2046 free( p ); 2071 free( p );
2047} 2072}
2048 2073
2049#endif 2074#endif
2050 2075
2051#if ( QT_VERSION <= 230 ) && !defined(SINGLE_APP) 2076#if ( QT_VERSION <= 230 ) && !defined(SINGLE_APP)
2052#include <qwidgetlist.h> 2077#include <qwidgetlist.h>
2053#ifdef QWS 2078#ifdef QWS
2054#include <qgfx_qws.h> 2079#include <qgfx_qws.h>
2055extern QRect qt_maxWindowRect; 2080extern QRect qt_maxWindowRect;
2056void qt_setMaxWindowRect(const QRect& r ) 2081void qt_setMaxWindowRect(const QRect& r )
2057{ 2082{
2058 qt_maxWindowRect = qt_screen->mapFromDevice( r, 2083 qt_maxWindowRect = qt_screen->mapFromDevice( r,
2059 qt_screen->mapToDevice( QSize( qt_screen->width(), qt_screen->height() ) ) ); 2084 qt_screen->mapToDevice( QSize( qt_screen->width(), qt_screen->height() ) ) );
2060 // Re-resize any maximized windows 2085 // Re-resize any maximized windows
2061 QWidgetList* l = QApplication::topLevelWidgets(); 2086 QWidgetList* l = QApplication::topLevelWidgets();
2062 if ( l ) { 2087 if ( l ) {
2063 QWidget * w = l->first(); 2088 QWidget * w = l->first();
2064 while ( w ) { 2089 while ( w ) {
2065 if ( w->isVisible() && w->isMaximized() ) { 2090 if ( w->isVisible() && w->isMaximized() ) {
2066 w->showMaximized(); 2091 w->showMaximized();
2067 } 2092 }
2068 w = l->next(); 2093 w = l->next();
2069 } 2094 }
2070 delete l; 2095 delete l;
2071 } 2096 }
2072} 2097}
2073#endif 2098#endif
2074#endif 2099#endif
diff --git a/library/qpedecoration_qws.cpp b/library/qpedecoration_qws.cpp
index 933542d..bac1a75 100644
--- a/library/qpedecoration_qws.cpp
+++ b/library/qpedecoration_qws.cpp
@@ -1,918 +1,926 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#define QTOPIA_INTERNAL_LANGLIST 20#define QTOPIA_INTERNAL_LANGLIST
21#include <qapplication.h> 21#include <qapplication.h>
22#include <qstyle.h> 22#include <qstyle.h>
23#include <qwidget.h> 23#include <qwidget.h>
24#include <qpainter.h> 24#include <qpainter.h>
25#include <qtimer.h> 25#include <qtimer.h>
26#include <qwhatsthis.h> 26#include <qwhatsthis.h>
27#include "qcopenvelope_qws.h" 27#include "qcopenvelope_qws.h"
28#include "qpedecoration_qws.h" 28#include "qpedecoration_qws.h"
29#include <qdialog.h> 29#include <qdialog.h>
30#include <qdrawutil.h> 30#include <qdrawutil.h>
31#include <qgfx_qws.h> 31#include <qgfx_qws.h>
32#include "qpeapplication.h" 32#include "qpeapplication.h"
33#include "resource.h" 33#include "resource.h"
34#include "global.h" 34#include "global.h"
35#include "qlibrary.h" 35#include "qlibrary.h"
36#include "windowdecorationinterface.h" 36#include "windowdecorationinterface.h"
37#include <qfile.h> 37#include <qfile.h>
38#include <qsignal.h> 38#include <qsignal.h>
39 39
40#include <stdlib.h> 40#include <stdlib.h>
41 41
42extern QRect qt_maxWindowRect; 42extern QRect qt_maxWindowRect;
43 43
44#define WHATSTHIS_MODE 44#define WHATSTHIS_MODE
45 45
46#ifndef QT_NO_QWS_QPE_WM_STYLE 46#ifndef QT_NO_QWS_QPE_WM_STYLE
47 47
48#ifndef QT_NO_IMAGEIO_XPM 48#ifndef QT_NO_IMAGEIO_XPM
49 49
50/* XPM */ 50/* XPM */
51static const char * const qpe_close_xpm[] = { 51static const char * const qpe_close_xpm[] = {
52"16 16 3 1", 52"16 16 3 1",
53" c None", 53" c None",
54". c #FFFFFF", 54". c #FFFFFF",
55"+ c #000000", 55"+ c #000000",
56" ", 56" ",
57" ", 57" ",
58" ..... ", 58" ..... ",
59" ..+++++.. ", 59" ..+++++.. ",
60" .+++++++++. ", 60" .+++++++++. ",
61" .+..+++..+. ", 61" .+..+++..+. ",
62" .++...+...++. ", 62" .++...+...++. ",
63" .+++.....+++. ", 63" .+++.....+++. ",
64" .++++...++++. ", 64" .++++...++++. ",
65" .+++.....+++. ", 65" .+++.....+++. ",
66" .++...+...++. ", 66" .++...+...++. ",
67" .+..+++..+. ", 67" .+..+++..+. ",
68" .+++++++++. ", 68" .+++++++++. ",
69" ..+++++.. ", 69" ..+++++.. ",
70" ..... ", 70" ..... ",
71" "}; 71" "};
72 72
73/* XPM */ 73/* XPM */
74static const char * const qpe_accept_xpm[] = { 74static const char * const qpe_accept_xpm[] = {
75"16 16 3 1", 75"16 16 3 1",
76" c None", 76" c None",
77". c #FFFFFF", 77". c #FFFFFF",
78"+ c #000000", 78"+ c #000000",
79" ", 79" ",
80" ", 80" ",
81" ..... ", 81" ..... ",
82" ..+++++.. ", 82" ..+++++.. ",
83" .+++++++++. ", 83" .+++++++++. ",
84" .+++++++++. ", 84" .+++++++++. ",
85" .+++++++..++. ", 85" .+++++++..++. ",
86" .++.+++...++. ", 86" .++.+++...++. ",
87" .+...+...+++. ", 87" .+...+...+++. ",
88" .+......++++. ", 88" .+......++++. ",
89" .++....+++++. ", 89" .++....+++++. ",
90" .++..+++++. ", 90" .++..+++++. ",
91" .+++++++++. ", 91" .+++++++++. ",
92" ..+++++.. ", 92" ..+++++.. ",
93" ..... ", 93" ..... ",
94" "}; 94" "};
95 95
96#endif // QT_NO_IMAGEIO_XPM 96#endif // QT_NO_IMAGEIO_XPM
97 97
98class HackWidget : public QWidget 98class HackWidget : public QWidget
99{ 99{
100public: 100public:
101 bool needsOk() { 101 bool needsOk() {
102 return (getWState() & WState_Reserved1 ) || 102 return (getWState() & WState_Reserved1 ) ||
103 (inherits( "QDialog" ) && !inherits( "QMessageBox" ) ); 103 (inherits( "QDialog" ) && !inherits( "QMessageBox" ) );
104 } 104 }
105}; 105};
106 106
107static QImage scaleButton( const QImage &img, int height ) 107static QImage scaleButton( const QImage &img, int height )
108{ 108{
109 if ( img.height() != 0 && img.height() != height ) { 109 if ( img.height() != 0 && img.height() != height ) {
110 return img.smoothScale( img.width()*height/img.height(), height ); 110 return img.smoothScale( img.width()*height/img.height(), height );
111 } else { 111 } else {
112 return img; 112 return img;
113 } 113 }
114} 114}
115 115
116class TLWidget : public QWidget 116class TLWidget : public QWidget
117{ 117{
118public: 118public:
119 QWSManager *manager() 119 QWSManager *manager()
120 { 120 {
121 return topData()->qwsManager; 121 return topData()->qwsManager;
122 } 122 }
123 123
124 QTLWExtra *topExtra() 124 QTLWExtra *topExtra()
125 { 125 {
126 return topData(); 126 return topData();
127 } 127 }
128 128
129 void setWState( uint s ) { QWidget::setWState( s ); } 129 void setWState( uint s ) { QWidget::setWState( s ); }
130 void clearWState( uint s ) { QWidget::clearWState( s ); } 130 void clearWState( uint s ) { QWidget::clearWState( s ); }
131}; 131};
132 132
133 133
134QPEManager::QPEManager( QPEDecoration *d, QObject *parent ) 134QPEManager::QPEManager( QPEDecoration *d, QObject *parent )
135 : QObject( parent ), decoration( d ), helpState(0), inWhatsThis(FALSE) 135 : QObject( parent ), decoration( d ), helpState(0), inWhatsThis(FALSE)
136{ 136{
137 wtTimer = new QTimer( this ); 137 wtTimer = new QTimer( this );
138 connect( wtTimer, SIGNAL(timeout()), this, SLOT(whatsThisTimeout()) ); 138 connect( wtTimer, SIGNAL(timeout()), this, SLOT(whatsThisTimeout()) );
139} 139}
140 140
141 141
142void QPEManager::updateActive() 142void QPEManager::updateActive()
143{ 143{
144 QWidget *newActive = qApp->activeWindow(); 144 QWidget *newActive = qApp->activeWindow();
145 if ( newActive && (QWidget*)active == newActive ) 145 if ( newActive && (QWidget*)active == newActive )
146 return; 146 return;
147 147
148 if ( active && (!newActive || ((TLWidget *)newActive)->manager()) ) { 148 if ( active && (!newActive || ((TLWidget *)newActive)->manager()) ) {
149 ((TLWidget *)(QWidget*)active)->manager()->removeEventFilter( this ); 149 ((TLWidget *)(QWidget*)active)->manager()->removeEventFilter( this );
150 } 150 }
151 151
152 if ( newActive && ((TLWidget *)newActive)->manager() ) { 152 if ( newActive && ((TLWidget *)newActive)->manager() ) {
153 active = newActive; 153 active = newActive;
154 ((TLWidget *)(QWidget*)active)->manager()->installEventFilter( this ); 154 ((TLWidget *)(QWidget*)active)->manager()->installEventFilter( this );
155 } else if ( !newActive ) { 155 } else if ( !newActive ) {
156 active = 0; 156 active = 0;
157 } 157 }
158} 158}
159 159
160int QPEManager::pointInQpeRegion( QWidget *w, const QPoint &p ) 160int QPEManager::pointInQpeRegion( QWidget *w, const QPoint &p )
161{ 161{
162 QRect rect(w->geometry()); 162 QRect rect(w->geometry());
163 163
164 if ( decoration->region( w, rect, 164 if ( decoration->region( w, rect,
165 (QWSDecoration::Region)QPEDecoration::Help ).contains(p) ) 165 (QWSDecoration::Region)QPEDecoration::Help ).contains(p) )
166 return QPEDecoration::Help; 166 return QPEDecoration::Help;
167 167
168 for (int i = QWSDecoration::LastRegion; i >= QWSDecoration::Title; i--) { 168 for (int i = QWSDecoration::LastRegion; i >= QWSDecoration::Title; i--) {
169 if (decoration->region(w, rect, (QWSDecoration::Region)i).contains(p)) 169 if (decoration->region(w, rect, (QWSDecoration::Region)i).contains(p))
170 return (QWSDecoration::Region)i; 170 return (QWSDecoration::Region)i;
171 } 171 }
172 172
173 return QWSDecoration::None; 173 return QWSDecoration::None;
174} 174}
175 175
176bool QPEManager::eventFilter( QObject *o, QEvent *e ) 176bool QPEManager::eventFilter( QObject *o, QEvent *e )
177{ 177{
178 QWSManager *mgr = (QWSManager *)o; 178 QWSManager *mgr = (QWSManager *)o;
179 QWidget *w = mgr->widget(); 179 QWidget *w = mgr->widget();
180 switch ( e->type() ) { 180 switch ( e->type() ) {
181 case QEvent::MouseButtonPress: 181 case QEvent::MouseButtonPress:
182 { 182 {
183 pressTime = QTime::currentTime(); 183 pressTime = QTime::currentTime();
184 QPoint p = ((QMouseEvent*)e)->globalPos(); 184 QPoint p = ((QMouseEvent*)e)->globalPos();
185 int inRegion = pointInQpeRegion( w, p ); 185 int inRegion = pointInQpeRegion( w, p );
186#ifdef WHATSTHIS_MODE 186#ifdef WHATSTHIS_MODE
187 if ( !w->geometry().contains(p) && QWhatsThis::inWhatsThisMode() ) { 187 if ( !w->geometry().contains(p) && QWhatsThis::inWhatsThisMode() ) {
188 QString text; 188 QString text;
189 switch ( inRegion ) { 189 switch ( inRegion ) {
190 case QWSDecoration::Close: 190 case QWSDecoration::Close:
191 if ( ((HackWidget*)w)->needsOk() ) 191 if ( ((HackWidget*)w)->needsOk() )
192 text = QObject::tr("Click to close this window, discarding changes."); 192 text = QObject::tr("Click to close this window, discarding changes.");
193 else 193 else
194 text = QObject::tr("Click to close this window."); 194 text = QObject::tr("Click to close this window.");
195 break; 195 break;
196 case QWSDecoration::Minimize: 196 case QWSDecoration::Minimize:
197 text = QObject::tr("Click to close this window and apply changes."); 197 text = QObject::tr("Click to close this window and apply changes.");
198 break; 198 break;
199 case QWSDecoration::Maximize: 199 case QWSDecoration::Maximize:
200 if ( w->isMaximized() ) 200 if ( w->isMaximized() )
201 text = QObject::tr("Click to make this window moveable."); 201 text = QObject::tr("Click to make this window moveable.");
202 else 202 else
203 text = QObject::tr("Click to make this window use all available screen area."); 203 text = QObject::tr("Click to make this window use all available screen area.");
204 break; 204 break;
205 default: 205 default:
206 break; 206 break;
207 } 207 }
208 QWhatsThis::leaveWhatsThisMode( text ); 208 QWhatsThis::leaveWhatsThisMode( text );
209 whatsThisTimeout(); 209 whatsThisTimeout();
210 helpState = 0; 210 helpState = 0;
211 return true; 211 return true;
212 } 212 }
213#endif 213#endif
214 if ( inRegion == QPEDecoration::Help ) { 214 if ( inRegion == QPEDecoration::Help ) {
215#ifdef WHATSTHIS_MODE 215#ifdef WHATSTHIS_MODE
216 wtTimer->start( 400, TRUE ); 216 wtTimer->start( 400, TRUE );
217#endif 217#endif
218 helpState = QWSButton::Clicked|QWSButton::MouseOver; 218 helpState = QWSButton::Clicked|QWSButton::MouseOver;
219 drawButton( w, QPEDecoration::Help, helpState ); 219 drawButton( w, QPEDecoration::Help, helpState );
220 return true; 220 return true;
221 } 221 }
222 } 222 }
223 break; 223 break;
224 case QEvent::MouseButtonRelease: 224 case QEvent::MouseButtonRelease:
225 if ( helpState & QWSButton::Clicked ) { 225 if ( helpState & QWSButton::Clicked ) {
226 wtTimer->stop(); 226 wtTimer->stop();
227 helpState = 0; 227 helpState = 0;
228 drawButton( w, QPEDecoration::Help, helpState ); 228 drawButton( w, QPEDecoration::Help, helpState );
229 QPoint p = ((QMouseEvent*)e)->globalPos(); 229 QPoint p = ((QMouseEvent*)e)->globalPos();
230 if ( pointInQpeRegion( w, p ) == QPEDecoration::Help ) { 230 if ( pointInQpeRegion( w, p ) == QPEDecoration::Help ) {
231 decoration->help( w ); 231 decoration->help( w );
232 } 232 }
233 return true; 233 return true;
234 } 234 }
235 break; 235 break;
236 case QEvent::MouseMove: 236 case QEvent::MouseMove:
237 if ( helpState & QWSButton::Clicked ) { 237 if ( helpState & QWSButton::Clicked ) {
238 int oldState = helpState; 238 int oldState = helpState;
239 QPoint p = ((QMouseEvent*)e)->globalPos(); 239 QPoint p = ((QMouseEvent*)e)->globalPos();
240 if ( pointInQpeRegion( w, p ) == QPEDecoration::Help ) { 240 if ( pointInQpeRegion( w, p ) == QPEDecoration::Help ) {
241 helpState = QWSButton::Clicked|QWSButton::MouseOver; 241 helpState = QWSButton::Clicked|QWSButton::MouseOver;
242 } else { 242 } else {
243 helpState = 0; 243 helpState = 0;
244 } 244 }
245 if ( helpState != oldState ) 245 if ( helpState != oldState )
246 drawButton( w, QPEDecoration::Help, helpState ); 246 drawButton( w, QPEDecoration::Help, helpState );
247 } 247 }
248 break; 248 break;
249 default: 249 default:
250 break; 250 break;
251 } 251 }
252 return QObject::eventFilter( o, e ); 252 return QObject::eventFilter( o, e );
253} 253}
254 254
255void QPEManager::drawButton( QWidget *w, QPEDecoration::QPERegion r, int state ) 255void QPEManager::drawButton( QWidget *w, QPEDecoration::QPERegion r, int state )
256{ 256{
257 QPainter painter(w); 257 QPainter painter(w);
258 QRegion rgn = ((TLWidget *)w)->topExtra()->decor_allocated_region; 258 QRegion rgn = ((TLWidget *)w)->topExtra()->decor_allocated_region;
259 painter.internalGfx()->setWidgetDeviceRegion( rgn ); 259 painter.internalGfx()->setWidgetDeviceRegion( rgn );
260 painter.setClipRegion(decoration->region(w, w->rect(),QWSDecoration::All)); 260 painter.setClipRegion(decoration->region(w, w->rect(),QWSDecoration::All));
261 decoration->paintButton( &painter, w, (QWSDecoration::Region)r, state ); 261 decoration->paintButton( &painter, w, (QWSDecoration::Region)r, state );
262} 262}
263 263
264void QPEManager::drawTitle( QWidget *w ) 264void QPEManager::drawTitle( QWidget *w )
265{ 265{
266 QPainter painter(w); 266 QPainter painter(w);
267 QRegion rgn = ((TLWidget *)w)->topExtra()->decor_allocated_region; 267 QRegion rgn = ((TLWidget *)w)->topExtra()->decor_allocated_region;
268 painter.internalGfx()->setWidgetDeviceRegion( rgn ); 268 painter.internalGfx()->setWidgetDeviceRegion( rgn );
269 painter.setClipRegion(decoration->region(w, w->rect(),QWSDecoration::All)); 269 painter.setClipRegion(decoration->region(w, w->rect(),QWSDecoration::All));
270 decoration->paint( &painter, w ); 270 decoration->paint( &painter, w );
271 decoration->paintButton(&painter, w, QWSDecoration::Menu, 0); 271 decoration->paintButton(&painter, w, QWSDecoration::Menu, 0);
272 decoration->paintButton(&painter, w, QWSDecoration::Close, 0); 272 decoration->paintButton(&painter, w, QWSDecoration::Close, 0);
273 decoration->paintButton(&painter, w, QWSDecoration::Minimize, 0); 273 decoration->paintButton(&painter, w, QWSDecoration::Minimize, 0);
274 decoration->paintButton(&painter, w, QWSDecoration::Maximize, 0); 274 decoration->paintButton(&painter, w, QWSDecoration::Maximize, 0);
275} 275}
276 276
277void QPEManager::whatsThisTimeout() 277void QPEManager::whatsThisTimeout()
278{ 278{
279 if ( !QWhatsThis::inWhatsThisMode() ) { 279 if ( !QWhatsThis::inWhatsThisMode() ) {
280 if ( inWhatsThis ) { 280 if ( inWhatsThis ) {
281 if ( whatsThis ) { 281 if ( whatsThis ) {
282 QWidget *w = whatsThis; 282 QWidget *w = whatsThis;
283 whatsThis = 0; 283 whatsThis = 0;
284 drawTitle( w ); 284 drawTitle( w );
285 } 285 }
286 wtTimer->stop(); 286 wtTimer->stop();
287 } else { 287 } else {
288 QWhatsThis::enterWhatsThisMode(); 288 QWhatsThis::enterWhatsThisMode();
289 helpState = 0; 289 helpState = 0;
290 updateActive(); 290 updateActive();
291 if ( active ) { 291 if ( active ) {
292 whatsThis = active; 292 whatsThis = active;
293 drawTitle( active ); 293 drawTitle( active );
294 // check periodically to see if we've left whats this mode 294 // check periodically to see if we've left whats this mode
295 wtTimer->start( 250 ); 295 wtTimer->start( 250 );
296 } 296 }
297 } 297 }
298 inWhatsThis = !inWhatsThis; 298 inWhatsThis = !inWhatsThis;
299 } 299 }
300} 300}
301 301
302//=========================================================================== 302//===========================================================================
303 303
304static QImage *okImage( int th ) 304static QImage *okImage( int th )
305{ 305{
306 static QImage *i = 0; 306 static QImage *i = 0;
307 if ( !i || i->height() != th ) { 307 if ( !i || i->height() != th ) {
308 delete i; 308 delete i;
309 i = new QImage(scaleButton(Resource::loadImage("OKButton"),th)); 309 i = new QImage(scaleButton(Resource::loadImage("OKButton"),th));
310 } 310 }
311 return i; 311 return i;
312} 312}
313 313
314static QImage *closeImage( int th ) 314static QImage *closeImage( int th )
315{ 315{
316 static QImage *i = 0; 316 static QImage *i = 0;
317 if ( !i || i->height() != th ) { 317 if ( !i || i->height() != th ) {
318 delete i; 318 delete i;
319 i = new QImage(scaleButton(Resource::loadImage("CloseButton"),th)); 319 i = new QImage(scaleButton(Resource::loadImage("CloseButton"),th));
320 } 320 }
321 return i; 321 return i;
322} 322}
323 323
324static QImage *helpImage( int th ) 324static QImage *helpImage( int th )
325{ 325{
326 static QImage *i = 0; 326 static QImage *i = 0;
327 if ( !i || i->height() != th ) { 327 if ( !i || i->height() != th ) {
328 delete i; 328 delete i;
329 i = new QImage(scaleButton(Resource::loadImage("HelpButton"),th)); 329 i = new QImage(scaleButton(Resource::loadImage("HelpButton"),th));
330 } 330 }
331 return i; 331 return i;
332} 332}
333 333
334static QImage *maximizeImage( int th ) 334static QImage *maximizeImage( int th )
335{ 335{
336 static QImage *i = 0; 336 static QImage *i = 0;
337 if ( !i || i->height() != th ) { 337 if ( !i || i->height() != th ) {
338 delete i; 338 delete i;
339 i = new QImage(scaleButton(Resource::loadImage("MaximizeButton"),th)); 339 i = new QImage(scaleButton(Resource::loadImage("MaximizeButton"),th));
340 } 340 }
341 return i; 341 return i;
342} 342}
343 343
344int WindowDecorationInterface::metric( Metric m, const WindowData *wd ) const 344int WindowDecorationInterface::metric( Metric m, const WindowData *wd ) const
345{ 345{
346 switch ( m ) { 346 switch ( m ) {
347 case TitleHeight: 347 case TitleHeight:
348 if ( QApplication::desktop()->height() > 320 ) 348 if ( QApplication::desktop()->height() > 320 )
349 return 19; 349 return 19;
350 else 350 else
351 return 15; 351 return 15;
352 case LeftBorder: 352 case LeftBorder:
353 case RightBorder: 353 case RightBorder:
354 case TopBorder: 354 case TopBorder:
355 case BottomBorder: 355 case BottomBorder:
356 return 4; 356 return 4;
357 case OKWidth: 357 case OKWidth:
358 return okImage(metric(TitleHeight,wd))->width(); 358 return okImage(metric(TitleHeight,wd))->width();
359 case CloseWidth: 359 case CloseWidth:
360 return closeImage(metric(TitleHeight,wd))->width(); 360 return closeImage(metric(TitleHeight,wd))->width();
361 case HelpWidth: 361 case HelpWidth:
362 return helpImage(metric(TitleHeight,wd))->width(); 362 return helpImage(metric(TitleHeight,wd))->width();
363 case MaximizeWidth: 363 case MaximizeWidth:
364 return maximizeImage(metric(TitleHeight,wd))->width(); 364 return maximizeImage(metric(TitleHeight,wd))->width();
365 case CornerGrabSize: 365 case CornerGrabSize:
366 return 16; 366 return 16;
367 } 367 }
368 368
369 return 0; 369 return 0;
370} 370}
371 371
372void WindowDecorationInterface::drawArea( Area a, QPainter *p, const WindowData *wd ) const 372void WindowDecorationInterface::drawArea( Area a, QPainter *p, const WindowData *wd ) const
373{ 373{
374 int th = metric( TitleHeight, wd ); 374 int th = metric( TitleHeight, wd );
375 QRect r = wd->rect; 375 QRect r = wd->rect;
376 376
377 switch ( a ) { 377 switch ( a ) {
378 case Border: 378 case Border:
379 { 379 {
380 const QColorGroup &cg = wd->palette.active(); 380 const QColorGroup &cg = wd->palette.active();
381 qDrawWinPanel(p, r.x()-metric(LeftBorder,wd), 381 qDrawWinPanel(p, r.x()-metric(LeftBorder,wd),
382 r.y()-th-metric(TopBorder,wd), 382 r.y()-th-metric(TopBorder,wd),
383 r.width()+metric(LeftBorder,wd)+metric(RightBorder,wd), 383 r.width()+metric(LeftBorder,wd)+metric(RightBorder,wd),
384 r.height()+th+metric(TopBorder,wd)+metric(BottomBorder,wd), 384 r.height()+th+metric(TopBorder,wd)+metric(BottomBorder,wd),
385 cg, FALSE, &cg.brush(QColorGroup::Background)); 385 cg, FALSE, &cg.brush(QColorGroup::Background));
386 } 386 }
387 break; 387 break;
388 case Title: 388 case Title:
389 { 389 {
390 const QColorGroup &cg = wd->palette.active(); 390 const QColorGroup &cg = wd->palette.active();
391 QBrush titleBrush; 391 QBrush titleBrush;
392 QPen titleLines; 392 QPen titleLines;
393 393
394 if ( wd->flags & WindowData::Active ) { 394 if ( wd->flags & WindowData::Active ) {
395 titleBrush = cg.brush(QColorGroup::Highlight); 395 titleBrush = cg.brush(QColorGroup::Highlight);
396 titleLines = titleBrush.color().dark(); 396 titleLines = titleBrush.color().dark();
397 } else { 397 } else {
398 titleBrush = cg.brush(QColorGroup::Background); 398 titleBrush = cg.brush(QColorGroup::Background);
399 titleLines = titleBrush.color(); 399 titleLines = titleBrush.color();
400 } 400 }
401 401
402 p->fillRect( r.x(), r.y()-th, r.width(), th, titleBrush); 402 p->fillRect( r.x(), r.y()-th, r.width(), th, titleBrush);
403 403
404 p->setPen( titleLines ); 404 p->setPen( titleLines );
405 for ( int i = r.y()-th; i < r.y(); i += 2 ) 405 for ( int i = r.y()-th; i < r.y(); i += 2 )
406 p->drawLine( r.left(), i, r.right(), i ); 406 p->drawLine( r.left(), i, r.right(), i );
407 } 407 }
408 break; 408 break;
409 case TitleText: 409 case TitleText:
410 p->drawText( r.x()+3+metric(HelpWidth,wd), r.top()-th, 410 p->drawText( r.x()+3+metric(HelpWidth,wd), r.top()-th,
411 r.width()-metric(OKWidth,wd)-metric(CloseWidth,wd), 411 r.width()-metric(OKWidth,wd)-metric(CloseWidth,wd),
412 th, QPainter::AlignVCenter, wd->caption); 412 th, QPainter::AlignVCenter, wd->caption);
413 break; 413 break;
414 } 414 }
415} 415}
416 416
417void WindowDecorationInterface::drawButton( Button b, QPainter *p, const WindowData *wd, int x, int y, int, int, QWSButton::State state ) const 417void WindowDecorationInterface::drawButton( Button b, QPainter *p, const WindowData *wd, int x, int y, int, int, QWSButton::State state ) const
418{ 418{
419 QImage *img = 0; 419 QImage *img = 0;
420 switch ( b ) { 420 switch ( b ) {
421 case OK: 421 case OK:
422 img = okImage(metric(TitleHeight,wd)); 422 img = okImage(metric(TitleHeight,wd));
423 break; 423 break;
424 case Close: 424 case Close:
425 img = closeImage(metric(TitleHeight,wd)); 425 img = closeImage(metric(TitleHeight,wd));
426 break; 426 break;
427 case Help: 427 case Help:
428 img = helpImage(metric(TitleHeight,wd)); 428 img = helpImage(metric(TitleHeight,wd));
429 break; 429 break;
430 case Maximize: 430 case Maximize:
431 img = maximizeImage(metric(TitleHeight,wd)); 431 img = maximizeImage(metric(TitleHeight,wd));
432 break; 432 break;
433 } 433 }
434 434
435 if ( img ) { 435 if ( img ) {
436 if ((state & QWSButton::MouseOver) && (state & QWSButton::Clicked)) 436 if ((state & QWSButton::MouseOver) && (state & QWSButton::Clicked))
437 p->drawImage(x+2, y+2, *img); 437 p->drawImage(x+2, y+2, *img);
438 else 438 else
439 p->drawImage(x+1, y+1, *img); 439 p->drawImage(x+1, y+1, *img);
440 } 440 }
441} 441}
442 442
443QRegion WindowDecorationInterface::mask( const WindowData *wd ) const 443QRegion WindowDecorationInterface::mask( const WindowData *wd ) const
444{ 444{
445 int th = metric(TitleHeight,wd); 445 int th = metric(TitleHeight,wd);
446 QRect rect( wd->rect ); 446 QRect rect( wd->rect );
447 QRect r(rect.left() - metric(LeftBorder,wd), 447 QRect r(rect.left() - metric(LeftBorder,wd),
448 rect.top() - th - metric(TopBorder,wd), 448 rect.top() - th - metric(TopBorder,wd),
449 rect.width() + metric(LeftBorder,wd) + metric(RightBorder,wd), 449 rect.width() + metric(LeftBorder,wd) + metric(RightBorder,wd),
450 rect.height() + th + metric(TopBorder,wd) + metric(BottomBorder,wd)); 450 rect.height() + th + metric(TopBorder,wd) + metric(BottomBorder,wd));
451 return QRegion(r) - rect; 451 return QRegion(r) - rect;
452} 452}
453 453
454class DefaultWindowDecoration : public WindowDecorationInterface 454class DefaultWindowDecoration : public WindowDecorationInterface
455{ 455{
456public: 456public:
457 DefaultWindowDecoration() : ref(0) {} 457 DefaultWindowDecoration() : ref(0) {}
458 QString name() const { 458 QString name() const {
459 return "Default"; 459 return "Default";
460 } 460 }
461 QPixmap icon() const { 461 QPixmap icon() const {
462 return QPixmap(); 462 return QPixmap();
463 } 463 }
464 QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { 464 QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) {
465 *iface = 0; 465 *iface = 0;
466 if ( uuid == IID_QUnknown ) 466 if ( uuid == IID_QUnknown )
467 *iface = this; 467 *iface = this;
468 else if ( uuid == IID_WindowDecoration ) 468 else if ( uuid == IID_WindowDecoration )
469 *iface = this; 469 *iface = this;
470 470
471 if ( *iface ) 471 if ( *iface )
472 (*iface)->addRef(); 472 (*iface)->addRef();
473 return QS_OK; 473 return QS_OK;
474 } 474 }
475 Q_REFCOUNT 475 Q_REFCOUNT
476 476
477private: 477private:
478 ulong ref; 478 ulong ref;
479}; 479};
480 480
481static WindowDecorationInterface *wdiface = 0; 481static WindowDecorationInterface *wdiface = 0;
482static QLibrary *wdlib = 0; 482static QLibrary *wdlib = 0;
483static QString libname; 483static QString libname;
484 484
485//=========================================================================== 485//===========================================================================
486 486
487QPEDecoration::QPEDecoration() 487QPEDecoration::QPEDecoration()
488 : QWSDefaultDecoration() 488 : QWSDefaultDecoration()
489{ 489{
490 init ( libname ); 490 init ( libname );
491} 491}
492 492
493QPEDecoration::QPEDecoration( const QString &plugin ) 493QPEDecoration::QPEDecoration( const QString &plugin )
494 : QWSDefaultDecoration() 494 : QWSDefaultDecoration()
495{ 495{
496 init ( plugin ); 496 init ( plugin );
497} 497}
498 498
499void QPEDecoration::init ( const QString &plugin ) 499void QPEDecoration::init ( const QString &plugin )
500{ 500{
501 libname = plugin; 501 libname = plugin;
502 502
503 if ( wdlib ) { 503 if ( wdlib ) {
504 wdiface->release(); 504 wdiface->release();
505 wdlib->unload(); 505 wdlib->unload();
506 delete wdlib; 506 delete wdlib;
507 wdlib = 0; 507 wdlib = 0;
508 } else { 508 } else {
509 delete wdiface; 509 delete wdiface;
510 } 510 }
511 511
512 WindowDecorationInterface *iface = 0; 512 WindowDecorationInterface *iface = 0;
513 QString path = QPEApplication::qpeDir() + "/plugins/decorations/"; 513 QString path = QPEApplication::qpeDir() + "/plugins/decorations/";
514 514
515#ifdef Q_OS_MACX
516 if ( plugin.find( ".dylib" ) > 0 ) {
517#else
515 if ( plugin.find( ".so" ) > 0 ) { 518 if ( plugin.find( ".so" ) > 0 ) {
519#endif
516 // full library name supplied 520 // full library name supplied
517 path += plugin; 521 path += plugin;
518 } else { 522 } else {
523#ifdef Q_OS_MACX
524 path += "lib" + plugin.lower() + ".dylib"; // compatibility
525#else
519 path += "lib" + plugin.lower() + ".so"; // compatibility 526 path += "lib" + plugin.lower() + ".so"; // compatibility
527#endif
520 } 528 }
521 529
522 QLibrary *lib = new QLibrary( path ); 530 QLibrary *lib = new QLibrary( path );
523 if ( lib->queryInterface( IID_WindowDecoration, (QUnknownInterface**)&iface ) == QS_OK && iface ) { 531 if ( lib->queryInterface( IID_WindowDecoration, (QUnknownInterface**)&iface ) == QS_OK && iface ) {
524 wdiface = iface; 532 wdiface = iface;
525 wdlib = lib; 533 wdlib = lib;
526 } else { 534 } else {
527 delete lib; 535 delete lib;
528 wdiface = new DefaultWindowDecoration; 536 wdiface = new DefaultWindowDecoration;
529 } 537 }
530 538
531 helpFile = QString(qApp->argv()[0]) + ".html"; 539 helpFile = QString(qApp->argv()[0]) + ".html";
532 QStringList helpPath = Global::helpPath(); 540 QStringList helpPath = Global::helpPath();
533 helpExists = FALSE; 541 helpExists = FALSE;
534 for (QStringList::ConstIterator it=helpPath.begin(); it!=helpPath.end() && !helpExists; ++it) { 542 for (QStringList::ConstIterator it=helpPath.begin(); it!=helpPath.end() && !helpExists; ++it) {
535 helpExists = QFile::exists( *it + "/" + helpFile ); 543 helpExists = QFile::exists( *it + "/" + helpFile );
536 //qDebug ( "Checking %s/%s for help: %d", (*it).latin1(), helpFile.latin1(),helpExists); 544 //qDebug ( "Checking %s/%s for help: %d", (*it).latin1(), helpFile.latin1(),helpExists);
537 } 545 }
538 qpeManager = new QPEManager( this ); 546 qpeManager = new QPEManager( this );
539 547
540 // Qtopia 1.5 compatibility 548 // Qtopia 1.5 compatibility
541 imageOk = *okImage ( 15 ); 549 imageOk = *okImage ( 15 );
542 imageClose = *closeImage ( 15 ); 550 imageClose = *closeImage ( 15 );
543 imageHelp = *helpImage ( 15 ); 551 imageHelp = *helpImage ( 15 );
544} 552}
545 553
546QPEDecoration::~QPEDecoration() 554QPEDecoration::~QPEDecoration()
547{ 555{
548 delete qpeManager; 556 delete qpeManager;
549} 557}
550 558
551const char **QPEDecoration::menuPixmap() 559const char **QPEDecoration::menuPixmap()
552{ 560{
553 return (const char **)0; 561 return (const char **)0;
554} 562}
555 563
556const char **QPEDecoration::closePixmap() 564const char **QPEDecoration::closePixmap()
557{ 565{
558 return (const char **)qpe_close_xpm; 566 return (const char **)qpe_close_xpm;
559} 567}
560 568
561const char **QPEDecoration::minimizePixmap() 569const char **QPEDecoration::minimizePixmap()
562{ 570{
563 return (const char **)qpe_accept_xpm; 571 return (const char **)qpe_accept_xpm;
564} 572}
565 573
566const char **QPEDecoration::maximizePixmap() 574const char **QPEDecoration::maximizePixmap()
567{ 575{
568 return (const char **)0; 576 return (const char **)0;
569} 577}
570 578
571const char **QPEDecoration::normalizePixmap() 579const char **QPEDecoration::normalizePixmap()
572{ 580{
573 return (const char **)0; 581 return (const char **)0;
574} 582}
575 583
576int QPEDecoration::getTitleHeight( const QWidget *w ) 584int QPEDecoration::getTitleHeight( const QWidget *w )
577{ 585{
578 WindowDecorationInterface::WindowData wd; 586 WindowDecorationInterface::WindowData wd;
579 windowData( w, wd ); 587 windowData( w, wd );
580 return wdiface->metric(WindowDecorationInterface::TitleHeight,&wd); 588 return wdiface->metric(WindowDecorationInterface::TitleHeight,&wd);
581} 589}
582 590
583/* 591/*
584 If rect is empty, no frame is added. (a hack, really) 592 If rect is empty, no frame is added. (a hack, really)
585*/ 593*/
586QRegion QPEDecoration::region(const QWidget *widget, const QRect &rect, QWSDecoration::Region type) 594QRegion QPEDecoration::region(const QWidget *widget, const QRect &rect, QWSDecoration::Region type)
587{ 595{
588 qpeManager->updateActive(); 596 qpeManager->updateActive();
589 597
590 WindowDecorationInterface::WindowData wd; 598 WindowDecorationInterface::WindowData wd;
591 windowData( widget, wd ); 599 windowData( widget, wd );
592 wd.rect = rect; 600 wd.rect = rect;
593 601
594 int titleHeight = wdiface->metric(WindowDecorationInterface::TitleHeight,&wd); 602 int titleHeight = wdiface->metric(WindowDecorationInterface::TitleHeight,&wd);
595 int okWidth = wdiface->metric(WindowDecorationInterface::OKWidth,&wd); 603 int okWidth = wdiface->metric(WindowDecorationInterface::OKWidth,&wd);
596 int closeWidth = wdiface->metric(WindowDecorationInterface::CloseWidth,&wd); 604 int closeWidth = wdiface->metric(WindowDecorationInterface::CloseWidth,&wd);
597 int helpWidth = wdiface->metric(WindowDecorationInterface::HelpWidth,&wd); 605 int helpWidth = wdiface->metric(WindowDecorationInterface::HelpWidth,&wd);
598 int grab = wdiface->metric(WindowDecorationInterface::CornerGrabSize,&wd); 606 int grab = wdiface->metric(WindowDecorationInterface::CornerGrabSize,&wd);
599 607
600 QRegion region; 608 QRegion region;
601 609
602 switch ((int)type) { 610 switch ((int)type) {
603 case Menu: 611 case Menu:
604 break; 612 break;
605 case Maximize: 613 case Maximize:
606 if ( !widget->inherits( "QDialog" ) && qApp->desktop()->width() > 350 ) { 614 if ( !widget->inherits( "QDialog" ) && qApp->desktop()->width() > 350 ) {
607 int maximizeWidth = wdiface->metric(WindowDecorationInterface::MaximizeWidth,&wd); 615 int maximizeWidth = wdiface->metric(WindowDecorationInterface::MaximizeWidth,&wd);
608 int left = rect.right() - maximizeWidth - closeWidth; 616 int left = rect.right() - maximizeWidth - closeWidth;
609 if ( ((HackWidget *)widget)->needsOk() ) 617 if ( ((HackWidget *)widget)->needsOk() )
610 left -= okWidth; 618 left -= okWidth;
611 QRect r(left, rect.top() - titleHeight, closeWidth, titleHeight); 619 QRect r(left, rect.top() - titleHeight, closeWidth, titleHeight);
612 region = r; 620 region = r;
613 } 621 }
614 break; 622 break;
615 case Minimize: 623 case Minimize:
616 if ( ((HackWidget *)widget)->needsOk() ) { 624 if ( ((HackWidget *)widget)->needsOk() ) {
617 QRect r(rect.right() - okWidth, 625 QRect r(rect.right() - okWidth,
618 rect.top() - titleHeight, okWidth, titleHeight); 626 rect.top() - titleHeight, okWidth, titleHeight);
619 if (r.left() > rect.left() + titleHeight) 627 if (r.left() > rect.left() + titleHeight)
620 region = r; 628 region = r;
621 } 629 }
622 break; 630 break;
623 case Close: 631 case Close:
624 { 632 {
625 int left = rect.right() - closeWidth; 633 int left = rect.right() - closeWidth;
626 if ( ((HackWidget *)widget)->needsOk() ) 634 if ( ((HackWidget *)widget)->needsOk() )
627 left -= okWidth; 635 left -= okWidth;
628 QRect r(left, rect.top() - titleHeight, closeWidth, titleHeight); 636 QRect r(left, rect.top() - titleHeight, closeWidth, titleHeight);
629 region = r; 637 region = r;
630 } 638 }
631 break; 639 break;
632 case Title: 640 case Title:
633 if ( !widget->isMaximized() ) { 641 if ( !widget->isMaximized() ) {
634 int width = rect.width() - helpWidth - closeWidth; 642 int width = rect.width() - helpWidth - closeWidth;
635 if ( ((HackWidget *)widget)->needsOk() ) 643 if ( ((HackWidget *)widget)->needsOk() )
636 width -= okWidth; 644 width -= okWidth;
637 QRect r(rect.left()+helpWidth, rect.top() - titleHeight, 645 QRect r(rect.left()+helpWidth, rect.top() - titleHeight,
638 width, titleHeight); 646 width, titleHeight);
639 if (r.width() > 0) 647 if (r.width() > 0)
640 region = r; 648 region = r;
641 } 649 }
642 break; 650 break;
643 case Help: 651 case Help:
644 if ( helpExists || widget->testWFlags(Qt::WStyle_ContextHelp) ) { 652 if ( helpExists || widget->testWFlags(Qt::WStyle_ContextHelp) ) {
645 QRect r(rect.left(), rect.top() - titleHeight, 653 QRect r(rect.left(), rect.top() - titleHeight,
646 helpWidth, titleHeight); 654 helpWidth, titleHeight);
647 region = r; 655 region = r;
648 } 656 }
649 break; 657 break;
650 case Top: 658 case Top:
651 if ( !widget->isMaximized() ) { 659 if ( !widget->isMaximized() ) {
652 QRegion m = wdiface->mask(&wd); 660 QRegion m = wdiface->mask(&wd);
653 QRect br = m.boundingRect(); 661 QRect br = m.boundingRect();
654 int b = wdiface->metric(WindowDecorationInterface::TopBorder,&wd); 662 int b = wdiface->metric(WindowDecorationInterface::TopBorder,&wd);
655 region = m & QRect( br.left()+grab, br.top(), 663 region = m & QRect( br.left()+grab, br.top(),
656 br.width()-2*grab, b ); 664 br.width()-2*grab, b );
657 } 665 }
658 break; 666 break;
659 case Left: 667 case Left:
660 if ( !widget->isMaximized() ) { 668 if ( !widget->isMaximized() ) {
661 QRegion m = wdiface->mask(&wd); 669 QRegion m = wdiface->mask(&wd);
662 QRect br = m.boundingRect(); 670 QRect br = m.boundingRect();
663 int b = wdiface->metric(WindowDecorationInterface::LeftBorder,&wd); 671 int b = wdiface->metric(WindowDecorationInterface::LeftBorder,&wd);
664 region = m & QRect( br.left(), br.top()+grab, 672 region = m & QRect( br.left(), br.top()+grab,
665 b, br.height()-2*grab ); 673 b, br.height()-2*grab );
666 } 674 }
667 break; 675 break;
668 case Right: 676 case Right:
669 if ( !widget->isMaximized() ) { 677 if ( !widget->isMaximized() ) {
670 QRegion m = wdiface->mask(&wd); 678 QRegion m = wdiface->mask(&wd);
671 QRect br = m.boundingRect(); 679 QRect br = m.boundingRect();
672 int b = wdiface->metric(WindowDecorationInterface::RightBorder,&wd); 680 int b = wdiface->metric(WindowDecorationInterface::RightBorder,&wd);
673 region = m & QRect( rect.right(), br.top()+grab, 681 region = m & QRect( rect.right(), br.top()+grab,
674 b, br.height()-2*grab ); 682 b, br.height()-2*grab );
675 } 683 }
676 break; 684 break;
677 case Bottom: 685 case Bottom:
678 if ( !widget->isMaximized() ) { 686 if ( !widget->isMaximized() ) {
679 QRegion m = wdiface->mask(&wd); 687 QRegion m = wdiface->mask(&wd);
680 QRect br = m.boundingRect(); 688 QRect br = m.boundingRect();
681 int b = wdiface->metric(WindowDecorationInterface::BottomBorder,&wd); 689 int b = wdiface->metric(WindowDecorationInterface::BottomBorder,&wd);
682 region = m & QRect( br.left()+grab, rect.bottom(), 690 region = m & QRect( br.left()+grab, rect.bottom(),
683 br.width()-2*grab, b ); 691 br.width()-2*grab, b );
684 } 692 }
685 break; 693 break;
686 case TopLeft: 694 case TopLeft:
687 if ( !widget->isMaximized() ) { 695 if ( !widget->isMaximized() ) {
688 QRegion m = wdiface->mask(&wd); 696 QRegion m = wdiface->mask(&wd);
689 QRect br = m.boundingRect(); 697 QRect br = m.boundingRect();
690 int tb = wdiface->metric(WindowDecorationInterface::TopBorder,&wd); 698 int tb = wdiface->metric(WindowDecorationInterface::TopBorder,&wd);
691 int lb = wdiface->metric(WindowDecorationInterface::LeftBorder,&wd); 699 int lb = wdiface->metric(WindowDecorationInterface::LeftBorder,&wd);
692 QRegion crgn( br.left(), br.top(), grab, tb ); 700 QRegion crgn( br.left(), br.top(), grab, tb );
693 crgn |= QRect( br.left(), br.top(), lb, grab ); 701 crgn |= QRect( br.left(), br.top(), lb, grab );
694 region = m & crgn; 702 region = m & crgn;
695 } 703 }
696 break; 704 break;
697 case TopRight: 705 case TopRight:
698 if ( !widget->isMaximized() ) { 706 if ( !widget->isMaximized() ) {
699 QRegion m = wdiface->mask(&wd); 707 QRegion m = wdiface->mask(&wd);
700 QRect br = m.boundingRect(); 708 QRect br = m.boundingRect();
701 int tb = wdiface->metric(WindowDecorationInterface::TopBorder,&wd); 709 int tb = wdiface->metric(WindowDecorationInterface::TopBorder,&wd);
702 int rb = wdiface->metric(WindowDecorationInterface::RightBorder,&wd); 710 int rb = wdiface->metric(WindowDecorationInterface::RightBorder,&wd);
703 QRegion crgn( br.right()-grab, br.top(), grab, tb ); 711 QRegion crgn( br.right()-grab, br.top(), grab, tb );
704 crgn |= QRect( br.right()-rb, br.top(), rb, grab ); 712 crgn |= QRect( br.right()-rb, br.top(), rb, grab );
705 region = m & crgn; 713 region = m & crgn;
706 } 714 }
707 break; 715 break;
708 case BottomLeft: 716 case BottomLeft:
709 if ( !widget->isMaximized() ) { 717 if ( !widget->isMaximized() ) {
710 QRegion m = wdiface->mask(&wd); 718 QRegion m = wdiface->mask(&wd);
711 QRect br = m.boundingRect(); 719 QRect br = m.boundingRect();
712 region = m & QRect( br.left(), br.bottom()-grab, grab, grab ); 720 region = m & QRect( br.left(), br.bottom()-grab, grab, grab );
713 } 721 }
714 break; 722 break;
715 case BottomRight: 723 case BottomRight:
716 if ( !widget->isMaximized() ) { 724 if ( !widget->isMaximized() ) {
717 QRegion m = wdiface->mask(&wd); 725 QRegion m = wdiface->mask(&wd);
718 QRect br = m.boundingRect(); 726 QRect br = m.boundingRect();
719 region = m & QRect( br.right()-grab, br.bottom()-grab, grab, grab ); 727 region = m & QRect( br.right()-grab, br.bottom()-grab, grab, grab );
720 } 728 }
721 break; 729 break;
722 case All: 730 case All:
723 if ( widget->isMaximized() ) 731 if ( widget->isMaximized() )
724 region = QWSDefaultDecoration::region(widget, rect, type); 732 region = QWSDefaultDecoration::region(widget, rect, type);
725 else 733 else
726 region = wdiface->mask(&wd) - rect; 734 region = wdiface->mask(&wd) - rect;
727 break; 735 break;
728 default: 736 default:
729 region = QWSDefaultDecoration::region(widget, rect, type); 737 region = QWSDefaultDecoration::region(widget, rect, type);
730 break; 738 break;
731 } 739 }
732 740
733 return region; 741 return region;
734} 742}
735 743
736void QPEDecoration::paint(QPainter *painter, const QWidget *widget) 744void QPEDecoration::paint(QPainter *painter, const QWidget *widget)
737{ 745{
738 WindowDecorationInterface::WindowData wd; 746 WindowDecorationInterface::WindowData wd;
739 windowData( widget, wd ); 747 windowData( widget, wd );
740 748
741 int titleWidth = getTitleWidth(widget); 749 int titleWidth = getTitleWidth(widget);
742 int titleHeight = wdiface->metric(WindowDecorationInterface::TitleHeight,&wd); 750 int titleHeight = wdiface->metric(WindowDecorationInterface::TitleHeight,&wd);
743 751
744 QRect rect(widget->rect()); 752 QRect rect(widget->rect());
745 753
746 // title bar rect 754 // title bar rect
747 QRect tr( rect.left(), rect.top() - titleHeight, rect.width(), titleHeight ); 755 QRect tr( rect.left(), rect.top() - titleHeight, rect.width(), titleHeight );
748 756
749#ifndef QT_NO_PALETTE 757#ifndef QT_NO_PALETTE
750 QRegion oldClip = painter->clipRegion(); 758 QRegion oldClip = painter->clipRegion();
751 painter->setClipRegion( oldClip - QRegion( tr ) );// reduce flicker 759 painter->setClipRegion( oldClip - QRegion( tr ) );// reduce flicker
752 wdiface->drawArea( WindowDecorationInterface::Border, painter, &wd ); 760 wdiface->drawArea( WindowDecorationInterface::Border, painter, &wd );
753 painter->setClipRegion( oldClip ); 761 painter->setClipRegion( oldClip );
754 762
755 if (titleWidth > 0) { 763 if (titleWidth > 0) {
756 const QColorGroup &cg = widget->palette().active(); 764 const QColorGroup &cg = widget->palette().active();
757 QBrush titleBrush; 765 QBrush titleBrush;
758 QPen titlePen; 766 QPen titlePen;
759 767
760 if ( wd.flags & WindowDecorationInterface::WindowData::Active ) { 768 if ( wd.flags & WindowDecorationInterface::WindowData::Active ) {
761 titleBrush = cg.brush(QColorGroup::Highlight); 769 titleBrush = cg.brush(QColorGroup::Highlight);
762 titlePen = cg.color(QColorGroup::HighlightedText); 770 titlePen = cg.color(QColorGroup::HighlightedText);
763 } else { 771 } else {
764 titleBrush = cg.brush(QColorGroup::Background); 772 titleBrush = cg.brush(QColorGroup::Background);
765 titlePen = cg.color(QColorGroup::Text); 773 titlePen = cg.color(QColorGroup::Text);
766 } 774 }
767 775
768 wdiface->drawArea( WindowDecorationInterface::Title, painter, &wd ); 776 wdiface->drawArea( WindowDecorationInterface::Title, painter, &wd );
769 777
770 // Draw caption 778 // Draw caption
771 painter->setPen(titlePen); 779 painter->setPen(titlePen);
772 QFont f( QApplication::font() ); 780 QFont f( QApplication::font() );
773 f.setWeight( QFont::Bold ); 781 f.setWeight( QFont::Bold );
774 painter->setFont(f); 782 painter->setFont(f);
775 wdiface->drawArea( WindowDecorationInterface::TitleText, painter, &wd ); 783 wdiface->drawArea( WindowDecorationInterface::TitleText, painter, &wd );
776 } 784 }
777#endif //QT_NO_PALETTE 785#endif //QT_NO_PALETTE
778 786
779 paintButton( painter, widget, (QWSDecoration::Region)Help, 0 ); 787 paintButton( painter, widget, (QWSDecoration::Region)Help, 0 );
780} 788}
781 789
782void QPEDecoration::paintButton(QPainter *painter, const QWidget *w, 790void QPEDecoration::paintButton(QPainter *painter, const QWidget *w,
783 QWSDecoration::Region type, int state) 791 QWSDecoration::Region type, int state)
784{ 792{
785 WindowDecorationInterface::Button b; 793 WindowDecorationInterface::Button b;
786 switch ((int)type) { 794 switch ((int)type) {
787 case Close: 795 case Close:
788 b = WindowDecorationInterface::Close; 796 b = WindowDecorationInterface::Close;
789 break; 797 break;
790 case Minimize: 798 case Minimize:
791 if ( ((HackWidget *)w)->needsOk() ) 799 if ( ((HackWidget *)w)->needsOk() )
792 b = WindowDecorationInterface::OK; 800 b = WindowDecorationInterface::OK;
793 else if ( helpExists ) 801 else if ( helpExists )
794 b = WindowDecorationInterface::Help; 802 b = WindowDecorationInterface::Help;
795 else 803 else
796 return; 804 return;
797 break; 805 break;
798 case Help: 806 case Help:
799 b = WindowDecorationInterface::Help; 807 b = WindowDecorationInterface::Help;
800 break; 808 break;
801 case Maximize: 809 case Maximize:
802 b = WindowDecorationInterface::Maximize; 810 b = WindowDecorationInterface::Maximize;
803 break; 811 break;
804 default: 812 default:
805 return; 813 return;
806 } 814 }
807 815
808 WindowDecorationInterface::WindowData wd; 816 WindowDecorationInterface::WindowData wd;
809 windowData( w, wd ); 817 windowData( w, wd );
810 818
811 int titleHeight = wdiface->metric(WindowDecorationInterface::TitleHeight,&wd); 819 int titleHeight = wdiface->metric(WindowDecorationInterface::TitleHeight,&wd);
812 QRect rect(w->rect()); 820 QRect rect(w->rect());
813 QRect tr( rect.left(), rect.top() - titleHeight, rect.width(), titleHeight ); 821 QRect tr( rect.left(), rect.top() - titleHeight, rect.width(), titleHeight );
814 QRect brect(region(w, w->rect(), type).boundingRect()); 822 QRect brect(region(w, w->rect(), type).boundingRect());
815 823
816 const QColorGroup &cg = w->palette().active(); 824 const QColorGroup &cg = w->palette().active();
817 if ( wd.flags & WindowDecorationInterface::WindowData::Active ) 825 if ( wd.flags & WindowDecorationInterface::WindowData::Active )
818 painter->setPen( cg.color(QColorGroup::HighlightedText) ); 826 painter->setPen( cg.color(QColorGroup::HighlightedText) );
819 else 827 else
820 painter->setPen( cg.color(QColorGroup::Text) ); 828 painter->setPen( cg.color(QColorGroup::Text) );
821 829
822 QRegion oldClip = painter->clipRegion(); 830 QRegion oldClip = painter->clipRegion();
823 painter->setClipRegion( QRect(brect.x(), tr.y(), brect.width(), tr.height()) ); // reduce flicker 831 painter->setClipRegion( QRect(brect.x(), tr.y(), brect.width(), tr.height()) ); // reduce flicker
824 wdiface->drawArea( WindowDecorationInterface::Title, painter, &wd ); 832 wdiface->drawArea( WindowDecorationInterface::Title, painter, &wd );
825 wdiface->drawButton( b, painter, &wd, brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)state ); 833 wdiface->drawButton( b, painter, &wd, brect.x(), brect.y(), brect.width(), brect.height(), (QWSButton::State)state );
826 painter->setClipRegion( oldClip ); 834 painter->setClipRegion( oldClip );
827} 835}
828 836
829//#define QPE_DONT_SHOW_TITLEBAR 837//#define QPE_DONT_SHOW_TITLEBAR
830 838
831void QPEDecoration::maximize( QWidget *widget ) 839void QPEDecoration::maximize( QWidget *widget )
832{ 840{
833#ifdef QPE_DONT_SHOW_TITLEBAR 841#ifdef QPE_DONT_SHOW_TITLEBAR
834 if ( !widget->inherits( "QDialog" ) ) { 842 if ( !widget->inherits( "QDialog" ) ) {
835 widget->setGeometry( qt_maxWindowRect ); 843 widget->setGeometry( qt_maxWindowRect );
836 } else 844 } else
837#endif 845#endif
838 { 846 {
839 QWSDecoration::maximize( widget ); 847 QWSDecoration::maximize( widget );
840 } 848 }
841} 849}
842 850
843#ifndef QT_NO_DIALOG 851#ifndef QT_NO_DIALOG
844class HackDialog : public QDialog 852class HackDialog : public QDialog
845{ 853{
846public: 854public:
847 void acceptIt() { 855 void acceptIt() {
848 if ( isA( "QMessageBox" ) ) 856 if ( isA( "QMessageBox" ) )
849 qApp->postEvent( this, new QKeyEvent( QEvent::KeyPress, Key_Enter, '\n', 0, "\n" ) ); 857 qApp->postEvent( this, new QKeyEvent( QEvent::KeyPress, Key_Enter, '\n', 0, "\n" ) );
850 else 858 else
851 accept(); 859 accept();
852 } 860 }
853}; 861};
854#endif 862#endif
855 863
856 864
857void QPEDecoration::minimize( QWidget *widget ) 865void QPEDecoration::minimize( QWidget *widget )
858{ 866{
859#ifndef QT_NO_DIALOG 867#ifndef QT_NO_DIALOG
860 // We use the minimize button as an "accept" button. 868 // We use the minimize button as an "accept" button.
861 if ( widget->inherits( "QDialog" ) ) { 869 if ( widget->inherits( "QDialog" ) ) {
862 HackDialog *d = (HackDialog *)widget; 870 HackDialog *d = (HackDialog *)widget;
863 d->acceptIt(); 871 d->acceptIt();
864 } 872 }
865#endif 873#endif
866 else if ( ((HackWidget *)widget)->needsOk() ) { 874 else if ( ((HackWidget *)widget)->needsOk() ) {
867 QSignal s; 875 QSignal s;
868 s.connect( widget, SLOT( accept() ) ); 876 s.connect( widget, SLOT( accept() ) );
869 s.activate(); 877 s.activate();
870 } else { 878 } else {
871 help( widget ); 879 help( widget );
872 } 880 }
873} 881}
874 882
875void QPEDecoration::help( QWidget *w ) 883void QPEDecoration::help( QWidget *w )
876{ 884{
877 if ( helpExists ) { 885 if ( helpExists ) {
878 Global::execute( "helpbrowser", helpFile ); 886 Global::execute( "helpbrowser", helpFile );
879 } else if ( w && w->testWFlags(Qt::WStyle_ContextHelp) ) { 887 } else if ( w && w->testWFlags(Qt::WStyle_ContextHelp) ) {
880 QWhatsThis::enterWhatsThisMode(); 888 QWhatsThis::enterWhatsThisMode();
881 QWhatsThis::leaveWhatsThisMode( QObject::tr( 889 QWhatsThis::leaveWhatsThisMode( QObject::tr(
882 "<Qt>Comprehensive help is not available for this application, " 890 "<Qt>Comprehensive help is not available for this application, "
883 "however there is context-sensitive help.<p>To use context-sensitive help:<p>" 891 "however there is context-sensitive help.<p>To use context-sensitive help:<p>"
884 "<ol><li>click and hold the help button." 892 "<ol><li>click and hold the help button."
885 "<li>when the title bar shows <b>What's this...</b>, " 893 "<li>when the title bar shows <b>What's this...</b>, "
886 "click on any control.</ol></Qt>" ) ); 894 "click on any control.</ol></Qt>" ) );
887 } 895 }
888} 896}
889 897
890void QPEDecoration::windowData( const QWidget *w, WindowDecorationInterface::WindowData &wd ) const 898void QPEDecoration::windowData( const QWidget *w, WindowDecorationInterface::WindowData &wd ) const
891{ 899{
892 wd.rect = w->rect(); 900 wd.rect = w->rect();
893 if ( qpeManager->whatsThisWidget() == w ) 901 if ( qpeManager->whatsThisWidget() == w )
894 wd.caption = QObject::tr("What's this..." ); 902 wd.caption = QObject::tr("What's this..." );
895 else 903 else
896 wd.caption = w->caption(); 904 wd.caption = w->caption();
897 wd.palette = qApp->palette(); 905 wd.palette = qApp->palette();
898 wd.flags = 0; 906 wd.flags = 0;
899 wd.flags |= w->isMaximized() ? WindowDecorationInterface::WindowData::Maximized : 0; 907 wd.flags |= w->isMaximized() ? WindowDecorationInterface::WindowData::Maximized : 0;
900 wd.flags |= w->testWFlags(Qt::WStyle_Dialog) ? WindowDecorationInterface::WindowData::Dialog : 0; 908 wd.flags |= w->testWFlags(Qt::WStyle_Dialog) ? WindowDecorationInterface::WindowData::Dialog : 0;
901 const QWidget *active = qpeManager->activeWidget(); 909 const QWidget *active = qpeManager->activeWidget();
902 wd.flags |= w == active ? WindowDecorationInterface::WindowData::Active : 0; 910 wd.flags |= w == active ? WindowDecorationInterface::WindowData::Active : 0;
903 wd.reserved = 1; 911 wd.reserved = 1;
904} 912}
905 913
906/* 914/*
907#ifndef QT_NO_POPUPMENU 915#ifndef QT_NO_POPUPMENU
908QPopupMenu *QPEDecoration::menu(QWSManager*, const QWidget*, const QPoint&) 916QPopupMenu *QPEDecoration::menu(QWSManager*, const QWidget*, const QPoint&)
909{ 917{
910 return 0; 918 return 0;
911} 919}
912#endif 920#endif
913*/ 921*/
914 922
915 923
916 924
917 925
918#endif // QT_NO_QWS_QPE_WM_STYLE 926#endif // QT_NO_QWS_QPE_WM_STYLE
diff --git a/library/sound.cpp b/library/sound.cpp
index c8704f9..5b67995 100644
--- a/library/sound.cpp
+++ b/library/sound.cpp
@@ -1,221 +1,224 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include <qpe/resource.h> 21#include <qpe/resource.h>
22#include <qpe/sound.h> 22#include <qpe/sound.h>
23#include <qpe/qcopenvelope_qws.h> 23#include <qpe/qcopenvelope_qws.h>
24 24
25#include <qsound.h> 25#include <qsound.h>
26#include <qfile.h> 26#include <qfile.h>
27 27
28#include <unistd.h> 28#include <unistd.h>
29#include <fcntl.h> 29#include <fcntl.h>
30#include <sys/ioctl.h> 30#include <sys/ioctl.h>
31
32#ifndef QT_NO_SOUND
31#include <sys/soundcard.h> 33#include <sys/soundcard.h>
34#endif
32 35
33#include "config.h" 36#include "config.h"
34#include <qmessagebox.h> 37#include <qmessagebox.h>
35#ifndef QT_NO_SOUND 38#ifndef QT_NO_SOUND
36static int WAVsoundDuration(const QString& filename) 39static int WAVsoundDuration(const QString& filename)
37{ 40{
38 // bad solution 41 // bad solution
39 42
40 // most of this is copied from qsoundqss.cpp 43 // most of this is copied from qsoundqss.cpp
41 44
42 QFile input(filename); 45 QFile input(filename);
43 if ( !input.open(IO_ReadOnly) ) 46 if ( !input.open(IO_ReadOnly) )
44 return 0; 47 return 0;
45 48
46 struct QRiffChunk { 49 struct QRiffChunk {
47 char id[4]; 50 char id[4];
48 Q_UINT32 size; 51 Q_UINT32 size;
49 char data[4/*size*/]; 52 char data[4/*size*/];
50 } chunk; 53 } chunk;
51 54
52 struct { 55 struct {
53 Q_INT16 formatTag; 56 Q_INT16 formatTag;
54 Q_INT16 channels; 57 Q_INT16 channels;
55 Q_INT32 samplesPerSec; 58 Q_INT32 samplesPerSec;
56 Q_INT32 avgBytesPerSec; 59 Q_INT32 avgBytesPerSec;
57 Q_INT16 blockAlign; 60 Q_INT16 blockAlign;
58 Q_INT16 wBitsPerSample; 61 Q_INT16 wBitsPerSample;
59 } chunkdata; 62 } chunkdata;
60 63
61 int total = 0; 64 int total = 0;
62 65
63 while(1) { 66 while(1) {
64 // Keep reading chunks... 67 // Keep reading chunks...
65 const int n = sizeof(chunk)-sizeof(chunk.data); 68 const int n = sizeof(chunk)-sizeof(chunk.data);
66 if ( input.readBlock((char*)&chunk,n) != n ) 69 if ( input.readBlock((char*)&chunk,n) != n )
67 break; 70 break;
68 if ( qstrncmp(chunk.id,"data",4) == 0 ) { 71 if ( qstrncmp(chunk.id,"data",4) == 0 ) {
69 total += chunkdata.avgBytesPerSec ? 72 total += chunkdata.avgBytesPerSec ?
70 chunk.size * 1000 / chunkdata.avgBytesPerSec : 0; 73 chunk.size * 1000 / chunkdata.avgBytesPerSec : 0;
71//qDebug("%d bytes of PCM (%dms)", chunk.size,chunkdata.avgBytesPerSec ? chunk.size * 1000 / chunkdata.avgBytesPerSec : 0); 74//qDebug("%d bytes of PCM (%dms)", chunk.size,chunkdata.avgBytesPerSec ? chunk.size * 1000 / chunkdata.avgBytesPerSec : 0);
72 input.at(input.at()+chunk.size-4); 75 input.at(input.at()+chunk.size-4);
73 } else if ( qstrncmp(chunk.id,"RIFF",4) == 0 ) { 76 } else if ( qstrncmp(chunk.id,"RIFF",4) == 0 ) {
74 char d[4]; 77 char d[4];
75 if ( input.readBlock(d,4) != 4 ) 78 if ( input.readBlock(d,4) != 4 )
76 return 0; 79 return 0;
77 if ( qstrncmp(d,"WAVE",4) != 0 ) { 80 if ( qstrncmp(d,"WAVE",4) != 0 ) {
78 // skip 81 // skip
79//qDebug("skip %.4s RIFF chunk",d); 82//qDebug("skip %.4s RIFF chunk",d);
80 if ( chunk.size < 10000000 ) 83 if ( chunk.size < 10000000 )
81 (void)input.at(input.at()+chunk.size-4); 84 (void)input.at(input.at()+chunk.size-4);
82 } 85 }
83 } else if ( qstrncmp(chunk.id,"fmt ",4) == 0 ) { 86 } else if ( qstrncmp(chunk.id,"fmt ",4) == 0 ) {
84 if ( input.readBlock((char*)&chunkdata,sizeof(chunkdata)) != sizeof(chunkdata) ) 87 if ( input.readBlock((char*)&chunkdata,sizeof(chunkdata)) != sizeof(chunkdata) )
85 return 0; 88 return 0;
86#define WAVE_FORMAT_PCM 1 89#define WAVE_FORMAT_PCM 1
87 if ( chunkdata.formatTag != WAVE_FORMAT_PCM ) { 90 if ( chunkdata.formatTag != WAVE_FORMAT_PCM ) {
88 //qDebug("WAV file: UNSUPPORTED FORMAT %d",chunkdata.formatTag); 91 //qDebug("WAV file: UNSUPPORTED FORMAT %d",chunkdata.formatTag);
89 return 0; 92 return 0;
90 } 93 }
91 } else { 94 } else {
92//qDebug("skip %.4s chunk",chunk.id); 95//qDebug("skip %.4s chunk",chunk.id);
93 // ignored chunk 96 // ignored chunk
94 if ( chunk.size < 10000000 ) 97 if ( chunk.size < 10000000 )
95 (void)input.at(input.at()+chunk.size); 98 (void)input.at(input.at()+chunk.size);
96 } 99 }
97 } 100 }
98 101
99//qDebug("%dms",total); 102//qDebug("%dms",total);
100 return total; 103 return total;
101} 104}
102 105
103class SoundData : public QSound { 106class SoundData : public QSound {
104public: 107public:
105 SoundData ( const QString& name ) : 108 SoundData ( const QString& name ) :
106 QSound ( Resource::findSound ( name )), 109 QSound ( Resource::findSound ( name )),
107 filename ( Resource::findSound ( name )) 110 filename ( Resource::findSound ( name ))
108 { 111 {
109 loopsleft=0; 112 loopsleft=0;
110 ms = WAVsoundDuration(filename); 113 ms = WAVsoundDuration(filename);
111 } 114 }
112 115
113 void playLoop ( int loopcnt = -1 ) 116 void playLoop ( int loopcnt = -1 )
114 { 117 {
115 // needs server support 118 // needs server support
116 loopsleft = loopcnt; 119 loopsleft = loopcnt;
117 120
118 if ( ms ) 121 if ( ms )
119 startTimer ( ms > 50 ? ms-50 : 0 ); // 50 for latency 122 startTimer ( ms > 50 ? ms-50 : 0 ); // 50 for latency
120 play ( ); 123 play ( );
121 } 124 }
122 125
123 void timerEvent ( QTimerEvent *e ) 126 void timerEvent ( QTimerEvent *e )
124 { 127 {
125 if ( loopsleft >= 0 ) { 128 if ( loopsleft >= 0 ) {
126 if ( --loopsleft <= 0 ) { 129 if ( --loopsleft <= 0 ) {
127 killTimer ( e-> timerId ( )); 130 killTimer ( e-> timerId ( ));
128 loopsleft = 0; 131 loopsleft = 0;
129 return; 132 return;
130 } 133 }
131 } 134 }
132 play(); 135 play();
133 } 136 }
134 137
135 bool isFinished ( ) const 138 bool isFinished ( ) const
136 { 139 {
137 return ( loopsleft == 0 ); 140 return ( loopsleft == 0 );
138 } 141 }
139 142
140private: 143private:
141 QString filename; 144 QString filename;
142 int loopsleft; 145 int loopsleft;
143 int ms; 146 int ms;
144}; 147};
145 148
146#endif 149#endif
147 150
148/*! Opens a wave sound file \a name for playing 151/*! Opens a wave sound file \a name for playing
149 * Resource is used for finding the file 152 * Resource is used for finding the file
150 **/ 153 **/
151Sound::Sound(const QString& name) 154Sound::Sound(const QString& name)
152{ 155{
153#ifndef QT_NO_SOUND 156#ifndef QT_NO_SOUND
154 d = new SoundData(name); 157 d = new SoundData(name);
155#endif 158#endif
156} 159}
157 160
158/*! Destroys the sound */ 161/*! Destroys the sound */
159Sound::~Sound() 162Sound::~Sound()
160{ 163{
161#ifndef QT_NO_SOUND 164#ifndef QT_NO_SOUND
162 delete d; 165 delete d;
163#endif 166#endif
164} 167}
165 168
166/*! Play the sound once */ 169/*! Play the sound once */
167void Sound::play() 170void Sound::play()
168{ 171{
169#ifndef QT_NO_SOUND 172#ifndef QT_NO_SOUND
170 d->playLoop(1); 173 d->playLoop(1);
171#endif 174#endif
172} 175}
173 176
174/*! Play the sound, repeatedly until stop() is called */ 177/*! Play the sound, repeatedly until stop() is called */
175void Sound::playLoop() 178void Sound::playLoop()
176{ 179{
177#ifndef QT_NO_SOUND 180#ifndef QT_NO_SOUND
178 d->killTimers(); 181 d->killTimers();
179 d->playLoop(); 182 d->playLoop();
180#endif 183#endif
181} 184}
182 185
183/*! Do not repeat the sound after it finishes. This will end a playLoop() */ 186/*! Do not repeat the sound after it finishes. This will end a playLoop() */
184void Sound::stop() 187void Sound::stop()
185{ 188{
186#ifndef QT_NO_SOUND 189#ifndef QT_NO_SOUND
187 d->killTimers(); 190 d->killTimers();
188#endif 191#endif
189} 192}
190 193
191bool Sound::isFinished() const 194bool Sound::isFinished() const
192{ 195{
193#ifndef QT_NO_SOUND 196#ifndef QT_NO_SOUND
194 return d->isFinished(); 197 return d->isFinished();
195#else 198#else
196 return true; 199 return true;
197#endif 200#endif
198} 201}
199 202
200/*! Sounds the audible system alarm. This is used for applications such 203/*! Sounds the audible system alarm. This is used for applications such
201 as Calendar when it needs to alarm the user of an event. 204 as Calendar when it needs to alarm the user of an event.
202*/ 205*/
203void Sound::soundAlarm() 206void Sound::soundAlarm()
204{ 207{
205#ifndef QT_NO_COP 208#ifndef QT_NO_COP
206 QCopEnvelope( "QPE/TaskBar", "soundAlarm()" ); 209 QCopEnvelope( "QPE/TaskBar", "soundAlarm()" );
207#endif 210#endif
208} 211}
209 212
210 213
211/*! \class Sound 214/*! \class Sound
212 \brief The Sound class plays WAVE sound files and can invoke the audible alarm. 215 \brief The Sound class plays WAVE sound files and can invoke the audible alarm.
213 216
214 The Sound class is constructed with the .wav music file name. The Sound 217 The Sound class is constructed with the .wav music file name. The Sound
215 class retrieves the sound file from the shared Resource class. This class 218 class retrieves the sound file from the shared Resource class. This class
216 ties together QSound and the available sound resources. 219 ties together QSound and the available sound resources.
217 220
218 To sound an audible system alarm, call the static method soundAlarm() 221 To sound an audible system alarm, call the static method soundAlarm()
219 222
220 \ingroup qtopiaemb 223 \ingroup qtopiaemb
221*/ 224*/
diff --git a/library/storage.cpp b/library/storage.cpp
index dc5cc22..f8b75d0 100644
--- a/library/storage.cpp
+++ b/library/storage.cpp
@@ -1,344 +1,376 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) Holger 'zecke' Freyther <freyther@kde.org> 2** Copyright (C) Holger 'zecke' Freyther <freyther@kde.org>
3** Copyright (C) Lorn Potter <llornkcor@handhelds.org> 3** Copyright (C) Lorn Potter <llornkcor@handhelds.org>
4** Copyright (C) 2000 Trolltech AS. All rights reserved. 4** Copyright (C) 2000 Trolltech AS. All rights reserved.
5** 5**
6** This file is part of Opie Environment. 6** This file is part of Opie Environment.
7** 7**
8** This file may be distributed and/or modified under the terms of the 8** This file may be distributed and/or modified under the terms of the
9** GNU General Public License version 2 as published by the Free Software 9** GNU General Public License version 2 as published by the Free Software
10** Foundation and appearing in the file LICENSE.GPL included in the 10** Foundation and appearing in the file LICENSE.GPL included in the
11** packaging of this file. 11** packaging of this file.
12** 12**
13** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 13** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
14** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 14** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15** 15**
16** See http://www.trolltech.com/gpl/ for GPL licensing information. 16** See http://www.trolltech.com/gpl/ for GPL licensing information.
17** 17**
18** Contact info@trolltech.com if any conditions of this licensing are 18** Contact info@trolltech.com if any conditions of this licensing are
19** not clear to you. 19** not clear to you.
20** 20**
21**********************************************************************/ 21**********************************************************************/
22 22
23#include <qpe/storage.h> 23#include <qpe/storage.h>
24#include <qpe/custom.h> 24#include <qpe/custom.h>
25 25
26#include <qfile.h> 26#include <qfile.h>
27#include <qtimer.h> 27#include <qtimer.h>
28#include <qcopchannel_qws.h> 28#include <qcopchannel_qws.h>
29 29
30#include <stdio.h> 30#include <stdio.h>
31 31
32#if defined(_OS_LINUX_) || defined(Q_OS_LINUX) 32#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
33#include <sys/vfs.h> 33#include <sys/vfs.h>
34#include <mntent.h> 34#include <mntent.h>
35#endif 35#endif
36 36
37#ifdef Q_OS_MACX
38# include <sys/param.h>
39# include <sys/ucred.h>
40# include <sys/mount.h>
41# include <stdio.h> // For strerror()
42# include <errno.h>
43#endif /* Q_OS_MACX */
44
37#include <qstringlist.h> 45#include <qstringlist.h>
38 46
39#include <sys/vfs.h> 47// Shouldn't be here ! (eilers)
40#include <mntent.h> 48// #include <sys/vfs.h>
49// #include <mntent.h>
41 50
42 51
43static bool isCF(const QString& m) 52static bool isCF(const QString& m)
44{ 53{
54
55#ifndef Q_OS_MACX
45 FILE* f = fopen("/var/run/stab", "r"); 56 FILE* f = fopen("/var/run/stab", "r");
46 if (!f) f = fopen("/var/state/pcmcia/stab", "r"); 57 if (!f) f = fopen("/var/state/pcmcia/stab", "r");
47 if (!f) f = fopen("/var/lib/pcmcia/stab", "r"); 58 if (!f) f = fopen("/var/lib/pcmcia/stab", "r");
48 if ( f ) { 59 if ( f ) {
49 char line[1024]; 60 char line[1024];
50 char devtype[80]; 61 char devtype[80];
51 char devname[80]; 62 char devname[80];
52 while ( fgets( line, 1024, f ) ) { 63 while ( fgets( line, 1024, f ) ) {
53 // 0 ide ide-cs 0 hda 3 0 64 // 0 ide ide-cs 0 hda 3 0
54 if ( sscanf(line,"%*d %s %*s %*s %s", devtype, devname )==2 ) 65 if ( sscanf(line,"%*d %s %*s %*s %s", devtype, devname )==2 )
55 { 66 {
56 if ( QString(devtype) == "ide" && m.find(devname)>0 ) { 67 if ( QString(devtype) == "ide" && m.find(devname)>0 ) {
57 fclose(f); 68 fclose(f);
58 return TRUE; 69 return TRUE;
59 } 70 }
60 } 71 }
61 } 72 }
62 fclose(f); 73 fclose(f);
63 } 74 }
75#endif /* Q_OS_MACX */
64 return FALSE; 76 return FALSE;
65} 77}
66 78
67/*! \class StorageInfo storage.h 79/*! \class StorageInfo storage.h
68 \brief The StorageInfo class describes the disks mounted on the file system. 80 \brief The StorageInfo class describes the disks mounted on the file system.
69 81
70 This class provides access to the mount information for the Linux 82 This class provides access to the mount information for the Linux
71 filesystem. Each mount point is represented by the FileSystem class. 83 filesystem. Each mount point is represented by the FileSystem class.
72 To ensure this class has the most up to date size information, call 84 To ensure this class has the most up to date size information, call
73 the update() method. Note that this will automatically be signaled 85 the update() method. Note that this will automatically be signaled
74 by the operating system when a disk has been mounted or unmounted. 86 by the operating system when a disk has been mounted or unmounted.
75 87
76 \ingroup qtopiaemb 88 \ingroup qtopiaemb
77*/ 89*/
78 90
79/*! Constructor that determines the current mount points of the filesystem. 91/*! Constructor that determines the current mount points of the filesystem.
80 The standard \a parent parameters is passed on to QObject. 92 The standard \a parent parameters is passed on to QObject.
81 */ 93 */
82StorageInfo::StorageInfo( QObject *parent ) 94StorageInfo::StorageInfo( QObject *parent )
83 : QObject( parent ) 95 : QObject( parent )
84{ 96{
85 mFileSystems.setAutoDelete( TRUE ); 97 mFileSystems.setAutoDelete( TRUE );
86 channel = new QCopChannel( "QPE/Card", this ); 98 channel = new QCopChannel( "QPE/Card", this );
87 connect( channel, SIGNAL(received(const QCString &, const QByteArray &)), 99 connect( channel, SIGNAL(received(const QCString &, const QByteArray &)),
88 this, SLOT(cardMessage( const QCString &, const QByteArray &)) ); 100 this, SLOT(cardMessage( const QCString &, const QByteArray &)) );
89 update(); 101 update();
90} 102}
91 103
92/*! Returns the longest matching FileSystem that starts with the 104/*! Returns the longest matching FileSystem that starts with the
93 same prefix as \a filename as its mount point. 105 same prefix as \a filename as its mount point.
94*/ 106*/
95const FileSystem *StorageInfo::fileSystemOf( const QString &filename ) 107const FileSystem *StorageInfo::fileSystemOf( const QString &filename )
96{ 108{
97 for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i) { 109 for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i) {
98 if ( filename.startsWith( (*i)->path() ) ) 110 if ( filename.startsWith( (*i)->path() ) )
99 return (*i); 111 return (*i);
100 } 112 }
101 return 0; 113 return 0;
102} 114}
103 115
104 116
105void StorageInfo::cardMessage( const QCString& msg, const QByteArray& ) 117void StorageInfo::cardMessage( const QCString& msg, const QByteArray& )
106{ 118{
107 if ( msg == "mtabChanged()" ) 119 if ( msg == "mtabChanged()" )
108 update(); 120 update();
109} 121}
110 122
111 123
112/*! Updates the mount and free space available information for each mount 124/*! Updates the mount and free space available information for each mount
113 point. This method is automatically called when a disk is mounted or 125 point. This method is automatically called when a disk is mounted or
114 unmounted. 126 unmounted.
115*/ 127*/
116// cause of the lack of a d pointer we need 128// cause of the lack of a d pointer we need
117// to store informations in a config file :( 129// to store informations in a config file :(
118void StorageInfo::update() 130void StorageInfo::update()
119{ 131{
120 //qDebug("StorageInfo::updating"); 132 //qDebug("StorageInfo::updating");
121#if defined(_OS_LINUX_) || defined(Q_OS_LINUX) 133#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
122 struct mntent *me; 134 struct mntent *me;
123 FILE *mntfp = setmntent( "/etc/mtab", "r" ); 135 FILE *mntfp = setmntent( "/etc/mtab", "r" );
124 136
125 QStringList curdisks; 137 QStringList curdisks;
126 QStringList curopts; 138 QStringList curopts;
127 QStringList curfs; 139 QStringList curfs;
128 bool rebuild = FALSE; 140 bool rebuild = FALSE;
129 int n=0; 141 int n=0;
130 if ( mntfp ) { 142 if ( mntfp ) {
131 while ( (me = getmntent( mntfp )) != 0 ) { 143 while ( (me = getmntent( mntfp )) != 0 ) {
132 QString fs = me->mnt_fsname; 144 QString fs = me->mnt_fsname;
133 if ( fs.left(7)=="/dev/hd" || fs.left(7)=="/dev/sd" 145 if ( fs.left(7)=="/dev/hd" || fs.left(7)=="/dev/sd"
134 || fs.left(8)=="/dev/mtd" || fs.left(9) == "/dev/mmcd" 146 || fs.left(8)=="/dev/mtd" || fs.left(9) == "/dev/mmcd"
135 || fs.left( 14 ) == "/dev/mmc/part1" 147 || fs.left( 14 ) == "/dev/mmc/part1"
136 || fs.left(5)=="tmpfs" || fs.left(9)=="/dev/root" ) 148 || fs.left(5)=="tmpfs" || fs.left(9)=="/dev/root" )
137 { 149 {
138 n++; 150 n++;
139 curdisks.append(fs); 151 curdisks.append(fs);
140 curopts.append( me->mnt_opts ); 152 curopts.append( me->mnt_opts );
141 //qDebug("-->fs %s opts %s", fs.latin1(), me->mnt_opts ); 153 //qDebug("-->fs %s opts %s", fs.latin1(), me->mnt_opts );
142 curfs.append( me->mnt_dir ); 154 curfs.append( me->mnt_dir );
143 bool found = FALSE; 155 bool found = FALSE;
144 for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i) { 156 for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i) {
145 if ( (*i)->disk() == fs ) { 157 if ( (*i)->disk() == fs ) {
146 found = TRUE; 158 found = TRUE;
147 break; 159 break;
148 } 160 }
149 } 161 }
150 if ( !found ) 162 if ( !found )
151 rebuild = TRUE; 163 rebuild = TRUE;
152 } 164 }
153 } 165 }
154 endmntent( mntfp ); 166 endmntent( mntfp );
155 } 167 }
156 if ( rebuild || n != (int)mFileSystems.count() ) { 168 if ( rebuild || n != (int)mFileSystems.count() ) {
157 mFileSystems.clear(); 169 mFileSystems.clear();
158 QStringList::ConstIterator it=curdisks.begin(); 170 QStringList::ConstIterator it=curdisks.begin();
159 QStringList::ConstIterator fsit=curfs.begin(); 171 QStringList::ConstIterator fsit=curfs.begin();
160 QStringList::ConstIterator optsIt=curopts.begin(); 172 QStringList::ConstIterator optsIt=curopts.begin();
161 for (; it!=curdisks.end(); ++it, ++fsit, ++optsIt) { 173 for (; it!=curdisks.end(); ++it, ++fsit, ++optsIt) {
162 QString opts = *optsIt; 174 QString opts = *optsIt;
163 175
164 QString disk = *it; 176 QString disk = *it;
165 QString humanname; 177 QString humanname;
166 bool removable = FALSE; 178 bool removable = FALSE;
167 if ( isCF(disk) ) { 179 if ( isCF(disk) ) {
168 humanname = tr("CF Card"); 180 humanname = tr("CF Card");
169 removable = TRUE; 181 removable = TRUE;
170 } else if ( disk == "/dev/hda1" ) { 182 } else if ( disk == "/dev/hda1" ) {
171 humanname = tr("Hard Disk"); 183 humanname = tr("Hard Disk");
172 } else if ( disk.left(9) == "/dev/mmcd" ) { 184 } else if ( disk.left(9) == "/dev/mmcd" ) {
173 humanname = tr("SD Card"); 185 humanname = tr("SD Card");
174 removable = TRUE; 186 removable = TRUE;
175 } else if ( disk.left( 14 ) == "/dev/mmc/part1" ) { 187 } else if ( disk.left( 14 ) == "/dev/mmc/part1" ) {
176 humanname = tr("MMC Card"); 188 humanname = tr("MMC Card");
177 removable = TRUE; 189 removable = TRUE;
178 } else if ( disk.left(7) == "/dev/hd" ) 190 } else if ( disk.left(7) == "/dev/hd" )
179 humanname = tr("Hard Disk") + " " + disk; 191 humanname = tr("Hard Disk") + " " + disk;
180 else if ( disk.left(7) == "/dev/sd" ) 192 else if ( disk.left(7) == "/dev/sd" )
181 humanname = tr("SCSI Hard Disk") + " " + disk; 193 humanname = tr("SCSI Hard Disk") + " " + disk;
182 else if ( disk.left(14) == "/dev/mtdblock6" ) //openzaurus ramfs 194 else if ( disk.left(14) == "/dev/mtdblock6" ) //openzaurus ramfs
183 humanname = tr("Internal Memory"); 195 humanname = tr("Internal Memory");
184 else if ( disk == "/dev/mtdblock1" || humanname == "/dev/mtdblock/1" ) 196 else if ( disk == "/dev/mtdblock1" || humanname == "/dev/mtdblock/1" )
185 humanname = tr("Internal Storage"); 197 humanname = tr("Internal Storage");
186 else if ( disk.left(14) == "/dev/mtdblock/" ) 198 else if ( disk.left(14) == "/dev/mtdblock/" )
187 humanname = tr("Internal Storage") + " " + disk; 199 humanname = tr("Internal Storage") + " " + disk;
188 else if ( disk.left(13) == "/dev/mtdblock" ) 200 else if ( disk.left(13) == "/dev/mtdblock" )
189 humanname = tr("Internal Storage") + " " + disk; 201 humanname = tr("Internal Storage") + " " + disk;
190 else if ( disk.left(9) == "/dev/root" ) 202 else if ( disk.left(9) == "/dev/root" )
191 humanname = tr("Internal Storage") + " " + disk; 203 humanname = tr("Internal Storage") + " " + disk;
192 else if ( disk.left(5) == "tmpfs" ) //ipaqs /mnt/ramfs 204 else if ( disk.left(5) == "tmpfs" ) //ipaqs /mnt/ramfs
193 humanname = tr("Internal Memory"); 205 humanname = tr("Internal Memory");
194 FileSystem *fs = new FileSystem( disk, *fsit, humanname, removable, opts ); 206 FileSystem *fs = new FileSystem( disk, *fsit, humanname, removable, opts );
195 mFileSystems.append( fs ); 207 mFileSystems.append( fs );
196 } 208 }
197 emit disksChanged(); 209 emit disksChanged();
198 } else { 210 } else {
199 // just update them 211 // just update them
200 for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i) 212 for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i)
201 i.current()->update(); 213 i.current()->update();
202 } 214 }
203#endif 215#endif
204} 216}
205 217
206bool deviceTab( const char *device) { 218bool deviceTab( const char *device) {
207 QString name = device; 219 QString name = device;
208 bool hasDevice=false; 220 bool hasDevice=false;
221
222#ifdef Q_OS_MACX
223 // Darwin (MacOS X)
224 struct statfs** mntbufp;
225 int count = 0;
226 if ( ( count = getmntinfo( mntbufp, MNT_WAIT ) ) == 0 ){
227 qWarning("deviceTab: Error in getmntinfo(): %s",strerror( errno ) );
228 hasDevice = false;
229 }
230 for( int i = 0; i < count; i++ ){
231 QString deviceName = mntbufp[i]->f_mntfromname;
232 qDebug(deviceName);
233 if( deviceName.left( name.length() ) == name )
234 hasDevice = true;
235 }
236#else
237 // Linux
209 struct mntent *me; 238 struct mntent *me;
210 FILE *mntfp = setmntent( "/etc/mtab", "r" ); 239 FILE *mntfp = setmntent( "/etc/mtab", "r" );
211 if ( mntfp ) { 240 if ( mntfp ) {
212 while ( (me = getmntent( mntfp )) != 0 ) { 241 while ( (me = getmntent( mntfp )) != 0 ) {
213 QString deviceName = me->mnt_fsname; 242 QString deviceName = me->mnt_fsname;
214// qDebug(deviceName); 243// qDebug(deviceName);
215 if( deviceName.left(name.length()) == name) { 244 if( deviceName.left(name.length()) == name) {
216 hasDevice = true; 245 hasDevice = true;
217 } 246 }
218 } 247 }
219 } 248 }
220 endmntent( mntfp ); 249 endmntent( mntfp );
250#endif /* Q_OS_MACX */
251
252
221 return hasDevice; 253 return hasDevice;
222} 254}
223 255
224/*! 256/*!
225 * @fn static bool StorageInfo::hasCf() 257 * @fn static bool StorageInfo::hasCf()
226 * @brief returns whether device has Cf mounted 258 * @brief returns whether device has Cf mounted
227 * 259 *
228 */ 260 */
229bool StorageInfo::hasCf() 261bool StorageInfo::hasCf()
230{ 262{
231 return deviceTab("/dev/hd"); 263 return deviceTab("/dev/hd");
232} 264}
233 265
234/*! 266/*!
235 * @fn static bool StorageInfo::hasSd() 267 * @fn static bool StorageInfo::hasSd()
236 * @brief returns whether device has SD mounted 268 * @brief returns whether device has SD mounted
237 * 269 *
238 */ 270 */
239bool StorageInfo::hasSd() 271bool StorageInfo::hasSd()
240{ 272{
241 return deviceTab("/dev/mmcd"); 273 return deviceTab("/dev/mmcd");
242} 274}
243 275
244/*! 276/*!
245 * @fn static bool StorageInfo::hasMmc() 277 * @fn static bool StorageInfo::hasMmc()
246 * @brief reutrns whether device has mmc mounted 278 * @brief reutrns whether device has mmc mounted
247 * 279 *
248 */ 280 */
249bool StorageInfo::hasMmc() 281bool StorageInfo::hasMmc()
250{ 282{
251 bool hasMmc=false; 283 bool hasMmc=false;
252 if( deviceTab("/dev/mmc/part")) 284 if( deviceTab("/dev/mmc/part"))
253 hasMmc=true; 285 hasMmc=true;
254 if( deviceTab("/dev/mmcd")) 286 if( deviceTab("/dev/mmcd"))
255 hasMmc=true; 287 hasMmc=true;
256 return hasMmc; 288 return hasMmc;
257} 289}
258 290
259/*! \fn const QList<FileSystem> &StorageInfo::fileSystems() const 291/*! \fn const QList<FileSystem> &StorageInfo::fileSystems() const
260 Returns a list of all available mounted file systems. 292 Returns a list of all available mounted file systems.
261 293
262 \warning This may change in Qtopia 3.x to return only relevant Qtopia file systems (and ignore mount points such as /tmp) 294 \warning This may change in Qtopia 3.x to return only relevant Qtopia file systems (and ignore mount points such as /tmp)
263*/ 295*/
264 296
265/*! \fn void StorageInfo::disksChanged() 297/*! \fn void StorageInfo::disksChanged()
266 Gets emitted when a disk has been mounted or unmounted, such as when 298 Gets emitted when a disk has been mounted or unmounted, such as when
267 a CF c 299 a CF c
268*/ 300*/
269//--------------------------------------------------------------------------- 301//---------------------------------------------------------------------------
270 302
271FileSystem::FileSystem( const QString &disk, const QString &path, const QString &name, bool rem, const QString &o ) 303FileSystem::FileSystem( const QString &disk, const QString &path, const QString &name, bool rem, const QString &o )
272 : fsdisk( disk ), fspath( path ), humanname( name ), blkSize(512), totalBlks(0), availBlks(0), removable( rem ), opts( o ) 304 : fsdisk( disk ), fspath( path ), humanname( name ), blkSize(512), totalBlks(0), availBlks(0), removable( rem ), opts( o )
273{ 305{
274 update(); 306 update();
275} 307}
276 308
277void FileSystem::update() 309void FileSystem::update()
278{ 310{
279#if defined(_OS_LINUX_) || defined(Q_OS_LINUX) 311#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
280 struct statfs fs; 312 struct statfs fs;
281 if ( !statfs( fspath.latin1(), &fs ) ) { 313 if ( !statfs( fspath.latin1(), &fs ) ) {
282 blkSize = fs.f_bsize; 314 blkSize = fs.f_bsize;
283 totalBlks = fs.f_blocks; 315 totalBlks = fs.f_blocks;
284 availBlks = fs.f_bavail; 316 availBlks = fs.f_bavail;
285 } else { 317 } else {
286 blkSize = 0; 318 blkSize = 0;
287 totalBlks = 0; 319 totalBlks = 0;
288 availBlks = 0; 320 availBlks = 0;
289 } 321 }
290#endif 322#endif
291} 323}
292 324
293/*! \class FileSystem storage.h 325/*! \class FileSystem storage.h
294 \brief The FileSystem class describes a single mount point. 326 \brief The FileSystem class describes a single mount point.
295 327
296 This class simply returns information about a mount point, including 328 This class simply returns information about a mount point, including
297 file system name, mount point, human readable name, size information 329 file system name, mount point, human readable name, size information
298 and mount options information. 330 and mount options information.
299 \ingroup qtopiaemb 331 \ingroup qtopiaemb
300 332
301 \sa StorageInfo 333 \sa StorageInfo
302*/ 334*/
303 335
304/*! \fn const QString &FileSystem::disk() const 336/*! \fn const QString &FileSystem::disk() const
305 Returns the file system name, such as /dev/hda3 337 Returns the file system name, such as /dev/hda3
306*/ 338*/
307 339
308/*! \fn const QString &FileSystem::path() const 340/*! \fn const QString &FileSystem::path() const
309 Returns the mount path, such as /home 341 Returns the mount path, such as /home
310*/ 342*/
311 343
312/*! \fn const QString &FileSystem::name() const 344/*! \fn const QString &FileSystem::name() const
313 Returns the translated, human readable name for the mount directory. 345 Returns the translated, human readable name for the mount directory.
314*/ 346*/
315 347
316/*! \fn const QString &FileSystem::options() const 348/*! \fn const QString &FileSystem::options() const
317 Returns the mount options 349 Returns the mount options
318*/ 350*/
319 351
320/*! \fn long FileSystem::blockSize() const 352/*! \fn long FileSystem::blockSize() const
321 Returns the size of each block on the file system. 353 Returns the size of each block on the file system.
322*/ 354*/
323 355
324/*! \fn long FileSystem::totalBlocks() const 356/*! \fn long FileSystem::totalBlocks() const
325 Returns the total number of blocks on the file system 357 Returns the total number of blocks on the file system
326*/ 358*/
327 359
328/*! \fn long FileSystem::availBlocks() const 360/*! \fn long FileSystem::availBlocks() const
329 Returns the number of available blocks on the file system 361 Returns the number of available blocks on the file system
330 */ 362 */
331 363
332/*! \fn bool FileSystem::isRemovable() const 364/*! \fn bool FileSystem::isRemovable() const
333 Returns flag whether the file system can be removed, such as a CF card 365 Returns flag whether the file system can be removed, such as a CF card
334 would be removable, but the internal memory wouldn't 366 would be removable, but the internal memory wouldn't
335*/ 367*/
336 368
337/*! \fn bool FileSystem::isWritable() const 369/*! \fn bool FileSystem::isWritable() const
338 Returns flag whether the file system is mounted as writable or read-only. 370 Returns flag whether the file system is mounted as writable or read-only.
339 Returns FALSE if read-only, TRUE if read and write. 371 Returns FALSE if read-only, TRUE if read and write.
340*/ 372*/
341 373
342/*! \fn QStringList StorageInfo::fileSystemNames() const 374/*! \fn QStringList StorageInfo::fileSystemNames() const
343 Returns a list of filesystem names. 375 Returns a list of filesystem names.
344*/ 376*/
diff --git a/mkspecs/qws/macx-generic-g++/qmake.conf b/mkspecs/qws/macx-generic-g++/qmake.conf
index 3460a40..04f1c8b 100644
--- a/mkspecs/qws/macx-generic-g++/qmake.conf
+++ b/mkspecs/qws/macx-generic-g++/qmake.conf
@@ -1,80 +1,81 @@
1# 1#
2# $Id$ 2# $Id$
3# 3#
4# qmake configuration for macx-g++ with Qt/Embedded 4# qmake configuration for macx-g++ with Qt/Embedded
5# 5#
6 6
7 MAKEFILE_GENERATOR= UNIX 7 MAKEFILE_GENERATOR= UNIX
8 TEMPLATE = app 8 TEMPLATE = app
9 CONFIG += qt warn_on release 9 CONFIG += qt warn_on release
10 QMAKE_EXTENSION_SHLIB= dylib 10 QMAKE_EXTENSION_SHLIB= dylib
11 11
12 QMAKE_CC = $(TB)cc 12 QMAKE_CC = $(TB)cc
13 QMAKE_LEX = flex 13 QMAKE_LEX = flex
14 QMAKE_LEXFLAGS = 14 QMAKE_LEXFLAGS =
15 QMAKE_YACC = yacc 15 QMAKE_YACC = yacc
16 QMAKE_YACCFLAGS = -d 16 QMAKE_YACCFLAGS = -d
17 QMAKE_CFLAGS = -pipe $(CFLAGS_EXTRA) 17 QMAKE_CFLAGS = -pipe $(CFLAGS_EXTRA)
18 QMAKE_CFLAGS_WARN_ON= -Wall -W 18 QMAKE_CFLAGS_WARN_ON= -Wall -W
19 QMAKE_CFLAGS_WARN_OFF= 19 QMAKE_CFLAGS_WARN_OFF=
20 QMAKE_CFLAGS_RELEASE= $(if $(CFLAGS_RELEASE),$(CFLAGS_RELEASE), -O2 -fno-default-inline) 20 QMAKE_CFLAGS_RELEASE= $(if $(CFLAGS_RELEASE),$(CFLAGS_RELEASE), -O2 -fno-default-inline)
21 QMAKE_CFLAGS_DEBUG= -g 21 QMAKE_CFLAGS_DEBUG= -g
22 QMAKE_CFLAGS_SHLIB= -fPIC 22 QMAKE_CFLAGS_SHLIB= -fPIC
23 QMAKE_CFLAGS_YACC= -Wno-unused -Wno-parentheses 23 QMAKE_CFLAGS_YACC= -Wno-unused -Wno-parentheses
24 QMAKE_CFLAGS_THREAD= -D_REENTRANT 24 QMAKE_CFLAGS_THREAD= -D_REENTRANT
25 25
26 QMAKE_CXX = $(TB)c++ 26 QMAKE_CXX = $(TB)c++
27 QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -DQT_NO_QWS_TRANSFORMED -DQWS -fno-exceptions -fno-rtti $(CXXFLAGS_EXTRA) 27 QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -DQT_NO_QWS_TRANSFORMED -DQWS -fno-exceptions -fno-rtti $(CXXFLAGS_EXTRA) -DQ_OS_MACX -DQT_NO_SOUND -DOPIE_NO_OVERRIDE_QT
28 QMAKE_CXXFLAGS_WARN_ON= $$QMAKE_CFLAGS_WARN_ON 28 QMAKE_CXXFLAGS_WARN_ON= $$QMAKE_CFLAGS_WARN_ON
29 QMAKE_CXXFLAGS_WARN_OFF= $$QMAKE_CFLAGS_WARN_OFF 29 QMAKE_CXXFLAGS_WARN_OFF= $$QMAKE_CFLAGS_WARN_OFF
30 QMAKE_CXXFLAGS_RELEASE= $$QMAKE_CFLAGS_RELEASE 30 QMAKE_CXXFLAGS_RELEASE= $$QMAKE_CFLAGS_RELEASE
31 QMAKE_CXXFLAGS_DEBUG= $$QMAKE_CFLAGS_DEBUG 31 QMAKE_CXXFLAGS_DEBUG= $$QMAKE_CFLAGS_DEBUG
32 QMAKE_CXXFLAGS_SHLIB= $$QMAKE_CFLAGS_SHLIB 32 QMAKE_CXXFLAGS_SHLIB= $$QMAKE_CFLAGS_SHLIB
33 QMAKE_CXXFLAGS_YACC= $$QMAKE_CFLAGS_YACC 33 QMAKE_CXXFLAGS_YACC= $$QMAKE_CFLAGS_YACC
34 QMAKE_CXXFLAGS_THREAD= $$QMAKE_CFLAGS_THREAD 34 QMAKE_CXXFLAGS_THREAD= $$QMAKE_CFLAGS_THREAD
35 35
36 QMAKE_INCDIR = 36 QMAKE_INCDIR =
37 QMAKE_LIBDIR = 37 QMAKE_LIBDIR =
38 QMAKE_INCDIR_X11= 38 QMAKE_INCDIR_X11=
39 QMAKE_LIBDIR_X11= 39 QMAKE_LIBDIR_X11=
40 QMAKE_INCDIR_QT = $(QTDIR)/include 40 QMAKE_INCDIR_QT = $(QTDIR)/include
41 QMAKE_LIBDIR_QT = $(QTDIR)/lib 41 QMAKE_LIBDIR_QT = $(QTDIR)/lib
42 QMAKE_INCDIR_OPENGL= /usr/X11R6/include 42 QMAKE_INCDIR_OPENGL= /usr/X11R6/include
43 QMAKE_LIBDIR_OPENGL= /usr/X11R6/lib 43 QMAKE_LIBDIR_OPENGL= /usr/X11R6/lib
44 44
45 QMAKE_LINK = $$QMAKE_CXX 45 QMAKE_LINK = $$QMAKE_CXX
46 QMAKE_LINK_SHLIB= $$QMAKE_CXX 46 QMAKE_LINK_SHLIB= $$QMAKE_CXX
47 QMAKE_LFLAGS = $(LFLAGS_EXTRA) 47 QMAKE_LFLAGS = $(LFLAGS_EXTRA)
48 QMAKE_LFLAGS_RELEASE= 48 QMAKE_LFLAGS_RELEASE=
49 QMAKE_LFLAGS_DEBUG= 49 QMAKE_LFLAGS_DEBUG=
50 QMAKE_LFLAGS_SHLIB= -dynamiclib 50 QMAKE_LFLAGS_SHLIB= -dynamiclib
51QMAKE_LFLAGS_INCREMENTAL = -undefined suppress -flat_namespace 51QMAKE_LFLAGS_INCREMENTAL = -undefined suppress -flat_namespace
52 QMAKE_LFLAGS_PLUGIN= -bundle 52 QMAKE_LFLAGS_PLUGIN= -bundle
53 QMAKE_LFLAGS_SONAME= 53 QMAKE_LFLAGS_SONAME=
54 QMAKE_LFLAGS_THREAD= 54 QMAKE_LFLAGS_THREAD=
55 QMAKE_RPATH = 55 QMAKE_RPATH =
56 56
57 QMAKE_LIBS = $(LIBS_EXTRA) 57 QMAKE_LIBS = $(LIBS_EXTRA)
58 QMAKE_LIBS_X11 = 58 QMAKE_LIBS_X11 =
59 QMAKE_LIBS_X11SM= 59 QMAKE_LIBS_X11SM=
60 QMAKE_LIBS_QT = -lqte 60 QMAKE_LIBS_QT = -lqte
61 #QMAKE_LIBS_QT = libqte.dylib
61 QMAKE_LIBS_QT_THREAD= -lqte-mt 62 QMAKE_LIBS_QT_THREAD= -lqte-mt
62 QMAKE_LIBS_QT_OPENGL= -lqgl 63 QMAKE_LIBS_QT_OPENGL= -lqgl
63 QMAKE_LIBS_THREAD= 64 QMAKE_LIBS_THREAD=
64 65
65 QMAKE_MOC = $(QTDIR)/bin/moc 66 QMAKE_MOC = $(QTDIR)/bin/moc
66 QMAKE_UIC = $(QTDIR)/bin/uic 67 QMAKE_UIC = $(QTDIR)/bin/uic
67 68
68 QMAKE_AR = ar cqs 69 QMAKE_AR = ar cqs
69 QMAKE_RANLIB = 70 QMAKE_RANLIB =
70 71
71 QMAKE_TAR = tar -cf 72 QMAKE_TAR = tar -cf
72 QMAKE_GZIP = gzip -9f 73 QMAKE_GZIP = gzip -9f
73 74
74 QMAKE_COPY = cp -f 75 QMAKE_COPY = cp -f
75 QMAKE_MOVE = mv -f 76 QMAKE_MOVE = mv -f
76 QMAKE_DEL_FILE = rm -f 77 QMAKE_DEL_FILE = rm -f
77 QMAKE_DEL_DIR = rmdir 78 QMAKE_DEL_DIR = rmdir
78 79
79 80
80 81
diff --git a/noncore/applets/networkapplet/networkapplet.pro b/noncore/applets/networkapplet/networkapplet.pro
index ec58455..368f80e 100644
--- a/noncore/applets/networkapplet/networkapplet.pro
+++ b/noncore/applets/networkapplet/networkapplet.pro
@@ -1,15 +1,15 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on release 2CONFIG += qt plugin warn_on release
3HEADERS = networkapplet.h 3HEADERS = networkapplet.h
4SOURCES = networkapplet.cpp 4SOURCES = networkapplet.cpp
5TARGET = networkapplet 5TARGET = networkapplet
6DESTDIR = $(OPIEDIR)/plugins/applets 6DESTDIR = $(OPIEDIR)/plugins/applets
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += $(OPIEDIR)/include 8DEPENDPATH += $(OPIEDIR)/include
9LIBS += -lqpe -lopiecore2 -lopieui2 -lopienet2 9LIBS += -lqpe -lopiecore2 -lopieui2 -lopienet2
10VERSION = 0.1.0 10VERSION = 0.1.0
11MOC_DIR = moc 11MOC_DIR = moc
12OBJECTS_DIR = obj 12OBJECTS_DIR = obj
13 13
14 14
15include ( $(OPIEDIR)/include.pro ) 15include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/applets/notesapplet/notesapplet.pro b/noncore/applets/notesapplet/notesapplet.pro
index e4558f7..3075948 100644
--- a/noncore/applets/notesapplet/notesapplet.pro
+++ b/noncore/applets/notesapplet/notesapplet.pro
@@ -1,16 +1,16 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on release 2CONFIG += qt plugin warn_on release
3HEADERS = notes.h notesappletimpl.h 3HEADERS = notes.h notesappletimpl.h
4SOURCES = notes.cpp notesappletimpl.cpp 4SOURCES = notes.cpp notesappletimpl.cpp
5TARGET = notesapplet 5TARGET = notesapplet
6DESTDIR = $(OPIEDIR)/plugins/applets 6DESTDIR = $(OPIEDIR)/plugins/applets
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += $(OPIEDIR)/include 8DEPENDPATH += $(OPIEDIR)/include
9LIBS += -lqpe 9LIBS += -lqpe
10VERSION = 1.0.0 10VERSION = 1.0.0
11MOC_DIR=opieobj 11MOC_DIR=opieobj
12OBJECTS_DIR=opieobj 12OBJECTS_DIR=opieobj
13 13
14 14
15 15
16include ( $(OPIEDIR)/include.pro ) 16include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/applets/wirelessapplet/wirelessapplet.pro b/noncore/applets/wirelessapplet/wirelessapplet.pro
index 501327d..aee89d7 100644
--- a/noncore/applets/wirelessapplet/wirelessapplet.pro
+++ b/noncore/applets/wirelessapplet/wirelessapplet.pro
@@ -1,33 +1,33 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on release 2CONFIG += qt plugin warn_on release
3HEADERS = wireless.h wirelessappletimpl.h networkinfo.h mgraph.h advancedconfig.h 3HEADERS = wireless.h wirelessappletimpl.h networkinfo.h mgraph.h advancedconfig.h
4SOURCES = wireless.cpp wirelessappletimpl.cpp networkinfo.cpp mgraph.cpp advancedconfig.cpp 4SOURCES = wireless.cpp wirelessappletimpl.cpp networkinfo.cpp mgraph.cpp advancedconfig.cpp
5INTERFACES = advancedconfigbase.ui 5INTERFACES = advancedconfigbase.ui
6TARGET = wirelessapplet 6TARGET = wirelessapplet
7DESTDIR = $(OPIEDIR)/plugins/applets 7DESTDIR = $(OPIEDIR)/plugins/applets
8INCLUDEPATH += $(OPIEDIR)/include 8INCLUDEPATH += $(OPIEDIR)/include
9DEPENDPATH += ../$(OPIEDIR)/include 9DEPENDPATH += ../$(OPIEDIR)/include
10LIBS += -lqpe 10LIBS += -lqpe
11VERSION = 0.1.0 11VERSION = 0.1.0
12 12
13TRANSLATIONS = ../../../i18n/de/libwirelessapplet.ts \ 13TRANSLATIONS = ../../../i18n/de/libwirelessapplet.ts \
14 ../../../i18n/nl/libwirelessapplet.ts \ 14 ../../../i18n/nl/libwirelessapplet.ts \
15 ../../../i18n/da/libwirelessapplet.ts \ 15 ../../../i18n/da/libwirelessapplet.ts \
16 ../../../i18n/xx/libwirelessapplet.ts \ 16 ../../../i18n/xx/libwirelessapplet.ts \
17 ../../../i18n/en/libwirelessapplet.ts \ 17 ../../../i18n/en/libwirelessapplet.ts \
18 ../../../i18n/es/libwirelessapplet.ts \ 18 ../../../i18n/es/libwirelessapplet.ts \
19 ../../../i18n/fr/libwirelessapplet.ts \ 19 ../../../i18n/fr/libwirelessapplet.ts \
20 ../../../i18n/hu/libwirelessapplet.ts \ 20 ../../../i18n/hu/libwirelessapplet.ts \
21 ../../../i18n/ja/libwirelessapplet.ts \ 21 ../../../i18n/ja/libwirelessapplet.ts \
22 ../../../i18n/ko/libwirelessapplet.ts \ 22 ../../../i18n/ko/libwirelessapplet.ts \
23 ../../../i18n/no/libwirelessapplet.ts \ 23 ../../../i18n/no/libwirelessapplet.ts \
24 ../../../i18n/pl/libwirelessapplet.ts \ 24 ../../../i18n/pl/libwirelessapplet.ts \
25 ../../../i18n/pt/libwirelessapplet.ts \ 25 ../../../i18n/pt/libwirelessapplet.ts \
26 ../../../i18n/pt_BR/libwirelessapplet.ts \ 26 ../../../i18n/pt_BR/libwirelessapplet.ts \
27 ../../../i18n/sl/libwirelessapplet.ts \ 27 ../../../i18n/sl/libwirelessapplet.ts \
28 ../../../i18n/zh_CN/libwirelessapplet.ts \ 28 ../../../i18n/zh_CN/libwirelessapplet.ts \
29 ../../../i18n/zh_TW/libwirelessapplet.ts 29 ../../../i18n/zh_TW/libwirelessapplet.ts
30 30
31 31
32 32
33include ( $(OPIEDIR)/include.pro ) 33include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/decorations/flat/flat.pro b/noncore/decorations/flat/flat.pro
index e691339..f3d63ea 100644
--- a/noncore/decorations/flat/flat.pro
+++ b/noncore/decorations/flat/flat.pro
@@ -1,15 +1,15 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt warn_on release 2 CONFIG += qt plugin warn_on release
3 HEADERS = flat.h 3 HEADERS = flat.h
4 SOURCES = flat.cpp 4 SOURCES = flat.cpp
5 TARGET = flat 5 TARGET = flat
6 DESTDIR = $(OPIEDIR)/plugins/decorations 6 DESTDIR = $(OPIEDIR)/plugins/decorations
7 INCLUDEPATH+= $(OPIEDIR)/include 7 INCLUDEPATH+= $(OPIEDIR)/include
8DEPENDPATH += $(OPIEDIR)/include 8DEPENDPATH += $(OPIEDIR)/include
9LIBS += -lqpe 9LIBS += -lqpe
10 VERSION = 1.0.0 10 VERSION = 1.0.0
11 11
12 12
13 13
14 14
15include ( $(OPIEDIR)/include.pro ) 15include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/decorations/liquid/liquid.pro b/noncore/decorations/liquid/liquid.pro
index 7c310a6..2afed26 100644
--- a/noncore/decorations/liquid/liquid.pro
+++ b/noncore/decorations/liquid/liquid.pro
@@ -1,14 +1,14 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG = qt embedded release warn_on 2CONFIG = qt plugin embedded release warn_on
3SOURCES = liquid.cpp 3SOURCES = liquid.cpp
4HEADERS = liquid.h 4HEADERS = liquid.h
5LIBS += -lqpe 5LIBS += -lqpe
6INCLUDEPATH += $(OPIEDIR)/include 6INCLUDEPATH += $(OPIEDIR)/include
7DESTDIR = $(OPIEDIR)/plugins/decorations 7DESTDIR = $(OPIEDIR)/plugins/decorations
8TARGET = liquid 8TARGET = liquid
9VERSION = 1.0.0 9VERSION = 1.0.0
10 10
11 11
12 12
13 13
14include ( $(OPIEDIR)/include.pro ) 14include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/decorations/polished/polished.pro b/noncore/decorations/polished/polished.pro
index 1ee940e..d3f3dcc 100644
--- a/noncore/decorations/polished/polished.pro
+++ b/noncore/decorations/polished/polished.pro
@@ -1,15 +1,15 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt warn_on release 2 CONFIG += qt plugin warn_on release
3 HEADERS = polished.h 3 HEADERS = polished.h
4 SOURCES = polished.cpp 4 SOURCES = polished.cpp
5 TARGET = polished 5 TARGET = polished
6 DESTDIR = $(OPIEDIR)/plugins/decorations 6 DESTDIR = $(OPIEDIR)/plugins/decorations
7 INCLUDEPATH+= $(OPIEDIR)/include 7 INCLUDEPATH+= $(OPIEDIR)/include
8DEPENDPATH += $(OPIEDIR)/include 8DEPENDPATH += $(OPIEDIR)/include
9LIBS += -lqpe 9LIBS += -lqpe
10 VERSION = 1.0.0 10 VERSION = 1.0.0
11 11
12 12
13 13
14 14
15include ( $(OPIEDIR)/include.pro ) 15include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/net/opietooth/applet/applet.pro b/noncore/net/opietooth/applet/applet.pro
index 23c1d0a..4efcb42 100644
--- a/noncore/net/opietooth/applet/applet.pro
+++ b/noncore/net/opietooth/applet/applet.pro
@@ -1,33 +1,33 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on release 2CONFIG += qt plugin warn_on release
3HEADERS = bluezapplet.h bluezappletimpl.h 3HEADERS = bluezapplet.h bluezappletimpl.h
4SOURCES = bluezapplet.cpp bluezappletimpl.cpp 4SOURCES = bluezapplet.cpp bluezappletimpl.cpp
5TARGET = bluetoothapplet 5TARGET = bluetoothapplet
6DESTDIR = $(OPIEDIR)/plugins/applets 6DESTDIR = $(OPIEDIR)/plugins/applets
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib 8INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib
9DEPENDPATH += $(OPIEDIR)/include 9DEPENDPATH += $(OPIEDIR)/include
10LIBS += -lqpe -lopietooth 10LIBS += -lqpe -lopietooth
11VERSION = 0.0.3 11VERSION = 0.0.3
12 12
13TRANSLATIONS = ../../../../i18n/de/libbluetoothapplet.ts \ 13TRANSLATIONS = ../../../../i18n/de/libbluetoothapplet.ts \
14 ../../../../i18n/nl/libbluetoothapplet.ts \ 14 ../../../../i18n/nl/libbluetoothapplet.ts \
15 ../../../../i18n/da/libbluetoothapplet.ts \ 15 ../../../../i18n/da/libbluetoothapplet.ts \
16 ../../../../i18n/xx/libbluetoothapplet.ts \ 16 ../../../../i18n/xx/libbluetoothapplet.ts \
17 ../../../../i18n/en/libbluetoothapplet.ts \ 17 ../../../../i18n/en/libbluetoothapplet.ts \
18 ../../../../i18n/es/libbluetoothapplet.ts \ 18 ../../../../i18n/es/libbluetoothapplet.ts \
19 ../../../../i18n/fr/libbluetoothapplet.ts \ 19 ../../../../i18n/fr/libbluetoothapplet.ts \
20 ../../../../i18n/hu/libbluetoothapplet.ts \ 20 ../../../../i18n/hu/libbluetoothapplet.ts \
21 ../../../../i18n/ja/libbluetoothapplet.ts \ 21 ../../../../i18n/ja/libbluetoothapplet.ts \
22 ../../../../i18n/ko/libbluetoothapplet.ts \ 22 ../../../../i18n/ko/libbluetoothapplet.ts \
23 ../../../../i18n/no/libbluetoothapplet.ts \ 23 ../../../../i18n/no/libbluetoothapplet.ts \
24 ../../../../i18n/pl/libbluetoothapplet.ts \ 24 ../../../../i18n/pl/libbluetoothapplet.ts \
25 ../../../../i18n/pt/libbluetoothapplet.ts \ 25 ../../../../i18n/pt/libbluetoothapplet.ts \
26 ../../../../i18n/pt_BR/libbluetoothapplet.ts \ 26 ../../../../i18n/pt_BR/libbluetoothapplet.ts \
27 ../../../../i18n/sl/libbluetoothapplet.ts \ 27 ../../../../i18n/sl/libbluetoothapplet.ts \
28 ../../../../i18n/zh_CN/libbluetoothapplet.ts \ 28 ../../../../i18n/zh_CN/libbluetoothapplet.ts \
29 ../../../../i18n/zh_TW/libbluetoothapplet.ts 29 ../../../../i18n/zh_TW/libbluetoothapplet.ts
30 30
31 31
32 32
33include ( $(OPIEDIR)/include.pro ) 33include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings/ppp/ppp.pro b/noncore/settings/networksettings/ppp/ppp.pro
index 84acd0e..dc78eb1 100644
--- a/noncore/settings/networksettings/ppp/ppp.pro
+++ b/noncore/settings/networksettings/ppp/ppp.pro
@@ -1,17 +1,17 @@
1#TEMPLATE = app 1#TEMPLATE = app
2# 2#
3TEMPLATE = lib 3TEMPLATE = lib
4#CONFIG += qt warn_on release 4#CONFIG += qt plugin warn_on release
5 CONFIG += qt warn_on debug 5 CONFIG += qt plugin warn_on debug
6DESTDIR = $(OPIEDIR)/plugins/networksettings 6DESTDIR = $(OPIEDIR)/plugins/networksettings
7 HEADERS = pppmodule.h modem.h modeminfo.h pppdata.h kpppconfig.h pppdata.h runtests.h general.h modemcmds.h conwindow.h accounts.h connect.h edit.h scriptedit.h pppdargs.h iplined.h pwentry.h pppconfig.h interfaceinformationppp.h interfaceppp.h authwidget.h chooserwidget.h devices.h 7 HEADERS = pppmodule.h modem.h modeminfo.h pppdata.h kpppconfig.h pppdata.h runtests.h general.h modemcmds.h conwindow.h accounts.h connect.h edit.h scriptedit.h pppdargs.h iplined.h pwentry.h pppconfig.h interfaceinformationppp.h interfaceppp.h authwidget.h chooserwidget.h devices.h
8 SOURCES = pppmodule.cpp modem.cpp modeminfo.cpp pppdata.cpp runtests.cpp general.cpp modemcmds.cpp conwindow.cpp accounts.cpp connect.cpp edit.cpp scriptedit.cpp pppdargs.cpp iplined.cpp pwentry.cpp pppconfig.cpp interfaceinformationppp.cpp interfaceppp.cpp authwidget.cpp chooserwidget.cpp devices.cpp 8 SOURCES = pppmodule.cpp modem.cpp modeminfo.cpp pppdata.cpp runtests.cpp general.cpp modemcmds.cpp conwindow.cpp accounts.cpp connect.cpp edit.cpp scriptedit.cpp pppdargs.cpp iplined.cpp pwentry.cpp pppconfig.cpp interfaceinformationppp.cpp interfaceppp.cpp authwidget.cpp chooserwidget.cpp devices.cpp
9 INCLUDEPATH+= $(OPIEDIR)/include ../ ../interfaces/ 9 INCLUDEPATH+= $(OPIEDIR)/include ../ ../interfaces/
10 DEPENDPATH+= $(OPIEDIR)/include 10 DEPENDPATH+= $(OPIEDIR)/include
11LIBS += -lqpe -L../interfaces/ -linterfaces 11LIBS += -lqpe -L../interfaces/ -linterfaces
12 TARGET = kppp 12 TARGET = kppp
13 VERSION = 1.0.0 13 VERSION = 1.0.0
14 14
15 15
16 16
17include ( $(OPIEDIR)/include.pro ) 17include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/networksettings/wlan/wlan.pro b/noncore/settings/networksettings/wlan/wlan.pro
index 82a5b2f..098ad1d 100644
--- a/noncore/settings/networksettings/wlan/wlan.pro
+++ b/noncore/settings/networksettings/wlan/wlan.pro
@@ -1,28 +1,28 @@
1# 1#
2TEMPLATE = lib 2TEMPLATE = lib
3#TEMPLATE = app 3#TEMPLATE = app
4CONFIG += qt warn_on release 4CONFIG += qt plugin warn_on release
5 #CONFIG += qt warn_on debug 5 #CONFIG += qt plugin warn_on debug
6DESTDIR = $(OPIEDIR)/plugins/networksettings 6DESTDIR = $(OPIEDIR)/plugins/networksettings
7 HEADERS = infoimp.h wlanmodule.h wextensions.h keyedit.h 7 HEADERS = infoimp.h wlanmodule.h wextensions.h keyedit.h
8 SOURCES = infoimp.cpp wlanmodule.cpp wextensions.cpp keyedit.cpp 8 SOURCES = infoimp.cpp wlanmodule.cpp wextensions.cpp keyedit.cpp
9 INCLUDEPATH+= $(OPIEDIR)/include ../ ../interfaces/ 9 INCLUDEPATH+= $(OPIEDIR)/include ../ ../interfaces/
10 DEPENDPATH+= $(OPIEDIR)/include 10 DEPENDPATH+= $(OPIEDIR)/include
11LIBS += -lqpe -L../interfaces/ -linterfaces -lopienet2 11LIBS += -lqpe -L../interfaces/ -linterfaces -lopienet2
12 INTERFACES= wlan.ui info.ui 12 INTERFACES= wlan.ui info.ui
13 TARGET = wlan 13 TARGET = wlan
14 VERSION = 1.0.0 14 VERSION = 1.0.0
15 15
16#CONFIG += wirelessopts 16#CONFIG += wirelessopts
17 17
18wirelessopts { 18wirelessopts {
19 HEADERS+= wlanimp.h 19 HEADERS+= wlanimp.h
20 SOURCES+= wlanimp.cpp 20 SOURCES+= wlanimp.cpp
21} 21}
22 22
23! wirelessopts { 23! wirelessopts {
24 HEADERS+= wlanimp2.h 24 HEADERS+= wlanimp2.h
25 SOURCES += wlanimp2.cpp 25 SOURCES += wlanimp2.cpp
26} 26}
27 27
28include ( $(OPIEDIR)/include.pro ) 28include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/styles/flat/flat.pro b/noncore/styles/flat/flat.pro
index ed25d5c..2721e14 100644
--- a/noncore/styles/flat/flat.pro
+++ b/noncore/styles/flat/flat.pro
@@ -1,15 +1,15 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt warn_on release 2 CONFIG += qt plugin warn_on release
3 HEADERS = flat.h 3 HEADERS = flat.h
4 SOURCES = flat.cpp 4 SOURCES = flat.cpp
5 TARGET = flatstyle 5 TARGET = flatstyle
6 DESTDIR = $(OPIEDIR)/plugins/styles 6 DESTDIR = $(OPIEDIR)/plugins/styles
7 INCLUDEPATH+= $(OPIEDIR)/include 7 INCLUDEPATH+= $(OPIEDIR)/include
8DEPENDPATH += $(OPIEDIR)/include 8DEPENDPATH += $(OPIEDIR)/include
9LIBS += -lqpe 9LIBS += -lqpe
10 VERSION = 1.0.0 10 VERSION = 1.0.0
11 11
12 12
13 13
14 14
15include ( $(OPIEDIR)/include.pro ) 15include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/styles/fresh/fresh.pro b/noncore/styles/fresh/fresh.pro
index 88a8de3..564c5cd 100644
--- a/noncore/styles/fresh/fresh.pro
+++ b/noncore/styles/fresh/fresh.pro
@@ -1,15 +1,15 @@
1 TEMPLATE= lib 1 TEMPLATE= lib
2 CONFIG += qt warn_on release 2 CONFIG += qt plugin warn_on release
3 HEADERS = fresh.h 3 HEADERS = fresh.h
4 SOURCES = fresh.cpp 4 SOURCES = fresh.cpp
5 TARGET = freshstyle 5 TARGET = freshstyle
6 DESTDIR = $(OPIEDIR)/plugins/styles 6 DESTDIR = $(OPIEDIR)/plugins/styles
7 INCLUDEPATH+= $(OPIEDIR)/include 7 INCLUDEPATH+= $(OPIEDIR)/include
8DEPENDPATH += $(OPIEDIR)/include 8DEPENDPATH += $(OPIEDIR)/include
9LIBS += -lqpe 9LIBS += -lqpe
10 VERSION = 1.0.0 10 VERSION = 1.0.0
11 11
12 12
13 13
14 14
15include ( $(OPIEDIR)/include.pro ) 15include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/styles/liquid/liquid.pro b/noncore/styles/liquid/liquid.pro
index 9241eba..4e1c575 100644
--- a/noncore/styles/liquid/liquid.pro
+++ b/noncore/styles/liquid/liquid.pro
@@ -1,39 +1,39 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG = qt embedded release warn_on 2CONFIG = qt plugin embedded release warn_on
3SOURCES = liquid.cpp \ 3SOURCES = liquid.cpp \
4 effects.cpp \ 4 effects.cpp \
5 liquidset.cpp \ 5 liquidset.cpp \
6 plugin.cpp 6 plugin.cpp
7 7
8HEADERS = liquid.h \ 8HEADERS = liquid.h \
9 effects.h \ 9 effects.h \
10 liquidset.h \ 10 liquidset.h \
11 plugin.h 11 plugin.h
12 12
13LIBS += -lqpe -lopie 13LIBS += -lqpe -lopie
14INCLUDEPATH += $(OPIEDIR)/include 14INCLUDEPATH += $(OPIEDIR)/include
15DESTDIR = $(OPIEDIR)/plugins/styles 15DESTDIR = $(OPIEDIR)/plugins/styles
16TARGET = liquid 16TARGET = liquid
17VERSION = 1.0.0 17VERSION = 1.0.0
18 18
19TRANSLATIONS = ../../../i18n/de/libliquid.ts \ 19TRANSLATIONS = ../../../i18n/de/libliquid.ts \
20 ../../../i18n/nl/libliquid.ts \ 20 ../../../i18n/nl/libliquid.ts \
21 ../../../i18n/da/libliquid.ts \ 21 ../../../i18n/da/libliquid.ts \
22 ../../../i18n/xx/libliquid.ts \ 22 ../../../i18n/xx/libliquid.ts \
23 ../../../i18n/en/libliquid.ts \ 23 ../../../i18n/en/libliquid.ts \
24 ../../../i18n/es/libliquid.ts \ 24 ../../../i18n/es/libliquid.ts \
25 ../../../i18n/fr/libliquid.ts \ 25 ../../../i18n/fr/libliquid.ts \
26 ../../../i18n/hu/libliquid.ts \ 26 ../../../i18n/hu/libliquid.ts \
27 ../../../i18n/ja/libliquid.ts \ 27 ../../../i18n/ja/libliquid.ts \
28 ../../../i18n/ko/libliquid.ts \ 28 ../../../i18n/ko/libliquid.ts \
29 ../../../i18n/no/libliquid.ts \ 29 ../../../i18n/no/libliquid.ts \
30 ../../../i18n/pl/libliquid.ts \ 30 ../../../i18n/pl/libliquid.ts \
31 ../../../i18n/pt/libliquid.ts \ 31 ../../../i18n/pt/libliquid.ts \
32 ../../../i18n/pt_BR/libliquid.ts \ 32 ../../../i18n/pt_BR/libliquid.ts \
33 ../../../i18n/sl/libliquid.ts \ 33 ../../../i18n/sl/libliquid.ts \
34 ../../../i18n/zh_CN/libliquid.ts \ 34 ../../../i18n/zh_CN/libliquid.ts \
35 ../../../i18n/zh_TW/libliquid.ts 35 ../../../i18n/zh_TW/libliquid.ts
36 36
37 37
38 38
39include ( $(OPIEDIR)/include.pro ) 39include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/styles/metal/metal.pro b/noncore/styles/metal/metal.pro
index 3bb376d..8633284 100644
--- a/noncore/styles/metal/metal.pro
+++ b/noncore/styles/metal/metal.pro
@@ -1,32 +1,32 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG = qt embedded release warn_on 2CONFIG = qt plugin embedded release warn_on
3SOURCES = metal.cpp plugin.cpp 3SOURCES = metal.cpp plugin.cpp
4 4
5HEADERS = metal.h plugin.h 5HEADERS = metal.h plugin.h
6LIBS += -lqpe 6LIBS += -lqpe
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8DESTDIR = $(OPIEDIR)/plugins/styles 8DESTDIR = $(OPIEDIR)/plugins/styles
9TARGET = metal 9TARGET = metal
10VERSION = 1.0.0 10VERSION = 1.0.0
11 11
12TRANSLATIONS = ../../../i18n/de/libmetal.ts \ 12TRANSLATIONS = ../../../i18n/de/libmetal.ts \
13 ../../../i18n/nl/libmetal.ts \ 13 ../../../i18n/nl/libmetal.ts \
14 ../../../i18n/da/libmetal.ts \ 14 ../../../i18n/da/libmetal.ts \
15 ../../../i18n/xx/libmetal.ts \ 15 ../../../i18n/xx/libmetal.ts \
16 ../../../i18n/en/libmetal.ts \ 16 ../../../i18n/en/libmetal.ts \
17 ../../../i18n/es/libmetal.ts \ 17 ../../../i18n/es/libmetal.ts \
18 ../../../i18n/fr/libmetal.ts \ 18 ../../../i18n/fr/libmetal.ts \
19 ../../../i18n/hu/libmetal.ts \ 19 ../../../i18n/hu/libmetal.ts \
20 ../../../i18n/ja/libmetal.ts \ 20 ../../../i18n/ja/libmetal.ts \
21 ../../../i18n/ko/libmetal.ts \ 21 ../../../i18n/ko/libmetal.ts \
22 ../../../i18n/no/libmetal.ts \ 22 ../../../i18n/no/libmetal.ts \
23 ../../../i18n/pl/libmetal.ts \ 23 ../../../i18n/pl/libmetal.ts \
24 ../../../i18n/pt/libmetal.ts \ 24 ../../../i18n/pt/libmetal.ts \
25 ../../../i18n/pt_BR/libmetal.ts \ 25 ../../../i18n/pt_BR/libmetal.ts \
26 ../../../i18n/sl/libmetal.ts \ 26 ../../../i18n/sl/libmetal.ts \
27 ../../../i18n/zh_CN/libmetal.ts \ 27 ../../../i18n/zh_CN/libmetal.ts \
28 ../../../i18n/zh_TW/libmetal.ts 28 ../../../i18n/zh_TW/libmetal.ts
29 29
30 30
31 31
32include ( $(OPIEDIR)/include.pro ) 32include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/styles/theme/theme.pro b/noncore/styles/theme/theme.pro
index f7ed324..4f84f3f 100644
--- a/noncore/styles/theme/theme.pro
+++ b/noncore/styles/theme/theme.pro
@@ -1,42 +1,42 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG = qt embedded debug warn_on 2CONFIG = qt plugin embedded debug warn_on
3SOURCES = ogfxeffect.cpp \ 3SOURCES = ogfxeffect.cpp \
4 othemestyle.cpp \ 4 othemestyle.cpp \
5 othemebase.cpp \ 5 othemebase.cpp \
6 themeset.cpp \ 6 themeset.cpp \
7 plugin.cpp 7 plugin.cpp
8 8
9HEADERS = ogfxeffect.h \ 9HEADERS = ogfxeffect.h \
10 othemebase.h \ 10 othemebase.h \
11 othemestyle.h \ 11 othemestyle.h \
12 themeset.h \ 12 themeset.h \
13 plugin.h 13 plugin.h
14 14
15 15
16LIBS += -lqpe 16LIBS += -lqpe
17INCLUDEPATH += $(OPIEDIR)/include 17INCLUDEPATH += $(OPIEDIR)/include
18DESTDIR = $(OPIEDIR)/plugins/styles 18DESTDIR = $(OPIEDIR)/plugins/styles
19TARGET = theme 19TARGET = theme
20VERSION = 1.0.0 20VERSION = 1.0.0
21 21
22TRANSLATIONS = ../../../i18n/de/libtheme.ts \ 22TRANSLATIONS = ../../../i18n/de/libtheme.ts \
23 ../../../i18n/nl/libtheme.ts \ 23 ../../../i18n/nl/libtheme.ts \
24 ../../../i18n/da/libtheme.ts \ 24 ../../../i18n/da/libtheme.ts \
25 ../../../i18n/xx/libtheme.ts \ 25 ../../../i18n/xx/libtheme.ts \
26 ../../../i18n/en/libtheme.ts \ 26 ../../../i18n/en/libtheme.ts \
27 ../../../i18n/es/libtheme.ts \ 27 ../../../i18n/es/libtheme.ts \
28 ../../../i18n/fr/libtheme.ts \ 28 ../../../i18n/fr/libtheme.ts \
29 ../../../i18n/hu/libtheme.ts \ 29 ../../../i18n/hu/libtheme.ts \
30 ../../../i18n/ja/libtheme.ts \ 30 ../../../i18n/ja/libtheme.ts \
31 ../../../i18n/ko/libtheme.ts \ 31 ../../../i18n/ko/libtheme.ts \
32 ../../../i18n/no/libtheme.ts \ 32 ../../../i18n/no/libtheme.ts \
33 ../../../i18n/pl/libtheme.ts \ 33 ../../../i18n/pl/libtheme.ts \
34 ../../../i18n/pt/libtheme.ts \ 34 ../../../i18n/pt/libtheme.ts \
35 ../../../i18n/pt_BR/libtheme.ts \ 35 ../../../i18n/pt_BR/libtheme.ts \
36 ../../../i18n/sl/libtheme.ts \ 36 ../../../i18n/sl/libtheme.ts \
37 ../../../i18n/zh_CN/libtheme.ts \ 37 ../../../i18n/zh_CN/libtheme.ts \
38 ../../../i18n/zh_TW/libtheme.ts 38 ../../../i18n/zh_TW/libtheme.ts
39 39
40 40
41 41
42include ( $(OPIEDIR)/include.pro ) 42include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/todayplugins/fortune/fortune.pro b/noncore/todayplugins/fortune/fortune.pro
index 0a0d5b9..ac503c3 100644
--- a/noncore/todayplugins/fortune/fortune.pro
+++ b/noncore/todayplugins/fortune/fortune.pro
@@ -1,41 +1,41 @@
1TEMPLATE = lib 1TEMPLATE = lib
2#CONFIG -= moc 2#CONFIG -= moc
3CONFIG += qt release 3CONFIG += qt plugin release
4 4
5# Input 5# Input
6HEADERS = fortuneplugin.h fortunepluginimpl.h \ 6HEADERS = fortuneplugin.h fortunepluginimpl.h \
7 fortunepluginwidget.h 7 fortunepluginwidget.h
8SOURCES = fortuneplugin.cpp fortunepluginimpl.cpp \ 8SOURCES = fortuneplugin.cpp fortunepluginimpl.cpp \
9 fortunepluginwidget.cpp 9 fortunepluginwidget.cpp
10 10
11INCLUDEPATH += $(OPIEDIR)/include \ 11INCLUDEPATH += $(OPIEDIR)/include \
12 ../ ../library 12 ../ ../library
13DEPENDPATH += $(OPIEDIR)/include \ 13DEPENDPATH += $(OPIEDIR)/include \
14 ../ ../library 14 ../ ../library
15 15
16LIBS+= -lqpe -lopie 16LIBS+= -lqpe -lopie
17 17
18DESTDIR = $(OPIEDIR)/plugins/today 18DESTDIR = $(OPIEDIR)/plugins/today
19TARGET = todayfortuneplugin 19TARGET = todayfortuneplugin
20 20
21TRANSLATIONS = ../../../i18n/de/libtodayfortuneplugin.ts \ 21TRANSLATIONS = ../../../i18n/de/libtodayfortuneplugin.ts \
22 ../../../i18n/nl/libtodayfortuneplugin.ts \ 22 ../../../i18n/nl/libtodayfortuneplugin.ts \
23 ../../../i18n/xx/libtodayfortuneplugin.ts \ 23 ../../../i18n/xx/libtodayfortuneplugin.ts \
24 ../../../i18n/en/libtodayfortuneplugin.ts \ 24 ../../../i18n/en/libtodayfortuneplugin.ts \
25 ../../../i18n/es/libtodayfortuneplugin.ts \ 25 ../../../i18n/es/libtodayfortuneplugin.ts \
26 ../../../i18n/fr/libtodayfortuneplugin.ts \ 26 ../../../i18n/fr/libtodayfortuneplugin.ts \
27 ../../../i18n/hu/libtodayfortuneplugin.ts \ 27 ../../../i18n/hu/libtodayfortuneplugin.ts \
28 ../../../i18n/ja/libtodayfortuneplugin.ts \ 28 ../../../i18n/ja/libtodayfortuneplugin.ts \
29 ../../../i18n/ko/libtodayfortuneplugin.ts \ 29 ../../../i18n/ko/libtodayfortuneplugin.ts \
30 ../../../i18n/no/libtodayfortuneplugin.ts \ 30 ../../../i18n/no/libtodayfortuneplugin.ts \
31 ../../../i18n/pl/libtodayfortuneplugin.ts \ 31 ../../../i18n/pl/libtodayfortuneplugin.ts \
32 ../../../i18n/pt/libtodayfortuneplugin.ts \ 32 ../../../i18n/pt/libtodayfortuneplugin.ts \
33 ../../../i18n/pt_BR/libtodayfortuneplugin.ts \ 33 ../../../i18n/pt_BR/libtodayfortuneplugin.ts \
34 ../../../i18n/sl/libtodayfortuneplugin.ts \ 34 ../../../i18n/sl/libtodayfortuneplugin.ts \
35 ../../../i18n/zh_CN/libtodayfortuneplugin.ts \ 35 ../../../i18n/zh_CN/libtodayfortuneplugin.ts \
36 ../../../i18n/zh_TW/libtodayfortuneplugin.ts \ 36 ../../../i18n/zh_TW/libtodayfortuneplugin.ts \
37 ../../../i18n/it/libtodayfortuneplugin.ts \ 37 ../../../i18n/it/libtodayfortuneplugin.ts \
38 ../../../i18n/da/libtodayfortuneplugin.ts 38 ../../../i18n/da/libtodayfortuneplugin.ts
39 39
40 40
41include ( $(OPIEDIR)/include.pro ) 41include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro
index c34be33..490a8f9 100644
--- a/noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro
+++ b/noncore/todayplugins/stockticker/stocktickerlib/stocktickerlib.pro
@@ -1,48 +1,48 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG -= moc 2CONFIG -= moc
3CONFIG += qt release 3CONFIG += qt plugin release
4 4
5HEADERS = stocktickerplugin.h stocktickerpluginimpl.h stocktickerpluginwidget.h stocktickerconfig.h \ 5HEADERS = stocktickerplugin.h stocktickerpluginimpl.h stocktickerpluginwidget.h stocktickerconfig.h \
6 ../libstocks/csv.h \ 6 ../libstocks/csv.h \
7 ../libstocks/http.h \ 7 ../libstocks/http.h \
8 ../libstocks/lists.h \ 8 ../libstocks/lists.h \
9 ../libstocks/stocks.h 9 ../libstocks/stocks.h
10SOURCES = stocktickerplugin.cpp stocktickerpluginimpl.cpp stocktickerpluginwidget.cpp stocktickerconfig.cpp \ 10SOURCES = stocktickerplugin.cpp stocktickerpluginimpl.cpp stocktickerpluginwidget.cpp stocktickerconfig.cpp \
11 ../libstocks/csv.c \ 11 ../libstocks/csv.c \
12 ../libstocks/currency.c \ 12 ../libstocks/currency.c \
13 ../libstocks/history.c \ 13 ../libstocks/history.c \
14 ../libstocks/http.c \ 14 ../libstocks/http.c \
15 ../libstocks/lists.c \ 15 ../libstocks/lists.c \
16 ../libstocks/stocks.c 16 ../libstocks/stocks.c
17 17
18INCLUDEPATH += $(OPIEDIR)/include \ 18INCLUDEPATH += $(OPIEDIR)/include \
19 ../ ../library 19 ../ ../library
20DEPENDPATH += $(OPIEDIR)/include \ 20DEPENDPATH += $(OPIEDIR)/include \
21 ../ ../library 21 ../ ../library
22 22
23LIBS+= -lqpe -lopie -lpthread 23LIBS+= -lqpe -lopie -lpthread
24TMAKE_CFLAGS += -D__UNIX__ 24TMAKE_CFLAGS += -D__UNIX__
25 25
26DESTDIR = $(OPIEDIR)/plugins/today 26DESTDIR = $(OPIEDIR)/plugins/today
27TARGET = todaystocktickerplugin 27TARGET = todaystocktickerplugin
28 28
29TRANSLATIONS = ../../../../i18n/de/libtodaystocktickerplugin.ts \ 29TRANSLATIONS = ../../../../i18n/de/libtodaystocktickerplugin.ts \
30 ../../../../i18n/nl/libtodaystocktickerplugin.ts \ 30 ../../../../i18n/nl/libtodaystocktickerplugin.ts \
31 ../../../../i18n/xx/libtodaystocktickerplugin.ts \ 31 ../../../../i18n/xx/libtodaystocktickerplugin.ts \
32 ../../../../i18n/en/libtodaystocktickerplugin.ts \ 32 ../../../../i18n/en/libtodaystocktickerplugin.ts \
33 ../../../../i18n/es/libtodaystocktickerplugin.ts \ 33 ../../../../i18n/es/libtodaystocktickerplugin.ts \
34 ../../../../i18n/fr/libtodaystocktickerplugin.ts \ 34 ../../../../i18n/fr/libtodaystocktickerplugin.ts \
35 ../../../../i18n/hu/libtodaystocktickerplugin.ts \ 35 ../../../../i18n/hu/libtodaystocktickerplugin.ts \
36 ../../../../i18n/ja/libtodaystocktickerplugin.ts \ 36 ../../../../i18n/ja/libtodaystocktickerplugin.ts \
37 ../../../../i18n/ko/libtodaystocktickerplugin.ts \ 37 ../../../../i18n/ko/libtodaystocktickerplugin.ts \
38 ../../../../i18n/no/libtodaystocktickerplugin.ts \ 38 ../../../../i18n/no/libtodaystocktickerplugin.ts \
39 ../../../../i18n/pl/libtodaystocktickerplugin.ts \ 39 ../../../../i18n/pl/libtodaystocktickerplugin.ts \
40 ../../../../i18n/pt/libtodaystocktickerplugin.ts \ 40 ../../../../i18n/pt/libtodaystocktickerplugin.ts \
41 ../../../../i18n/pt_BR/libtodaystocktickerplugin.ts \ 41 ../../../../i18n/pt_BR/libtodaystocktickerplugin.ts \
42 ../../../../i18n/sl/libtodaystocktickerplugin.ts \ 42 ../../../../i18n/sl/libtodaystocktickerplugin.ts \
43 ../../../../i18n/zh_CN/libtodaystocktickerplugin.ts \ 43 ../../../../i18n/zh_CN/libtodaystocktickerplugin.ts \
44 ../../../../i18n/zh_TW/libtodaystocktickerplugin.ts \ 44 ../../../../i18n/zh_TW/libtodaystocktickerplugin.ts \
45 ../../../../i18n/it/libtodaystocktickerplugin.ts \ 45 ../../../../i18n/it/libtodaystocktickerplugin.ts \
46 ../../../../i18n/da/libtodaystocktickerplugin.ts 46 ../../../../i18n/da/libtodaystocktickerplugin.ts
47 47
48include ( $(OPIEDIR)/include.pro ) 48include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/todayplugins/weather/weather.pro b/noncore/todayplugins/weather/weather.pro
index 2833e88..bd4b565 100644
--- a/noncore/todayplugins/weather/weather.pro
+++ b/noncore/todayplugins/weather/weather.pro
@@ -1,43 +1,43 @@
1TEMPLATE = lib 1TEMPLATE = lib
2#CONFIG -= moc 2#CONFIG -= moc
3CONFIG += qt release 3CONFIG += qt plugin release
4 4
5HEADERS = weatherplugin.h \ 5HEADERS = weatherplugin.h \
6 weatherpluginimpl.h \ 6 weatherpluginimpl.h \
7 weatherpluginwidget.h \ 7 weatherpluginwidget.h \
8 weatherconfig.h 8 weatherconfig.h
9 9
10SOURCES = weatherplugin.cpp \ 10SOURCES = weatherplugin.cpp \
11 weatherpluginimpl.cpp \ 11 weatherpluginimpl.cpp \
12 weatherpluginwidget.cpp \ 12 weatherpluginwidget.cpp \
13 weatherconfig.cpp 13 weatherconfig.cpp
14 14
15INCLUDEPATH += $(OPIEDIR)/include \ 15INCLUDEPATH += $(OPIEDIR)/include \
16 ../ ../library 16 ../ ../library
17DEPENDPATH += $(OPIEDIR)/include \ 17DEPENDPATH += $(OPIEDIR)/include \
18 ../ ../library 18 ../ ../library
19 19
20LIBS+= -lqpe -lopie 20LIBS+= -lqpe -lopie
21 21
22DESTDIR = $(OPIEDIR)/plugins/today 22DESTDIR = $(OPIEDIR)/plugins/today
23TARGET = todayweatherplugin 23TARGET = todayweatherplugin
24 24
25TRANSLATIONS = ../../../i18n/de/libtodayweatherplugin.ts \ 25TRANSLATIONS = ../../../i18n/de/libtodayweatherplugin.ts \
26 ../../../i18n/nl/libtodayweatherplugin.ts \ 26 ../../../i18n/nl/libtodayweatherplugin.ts \
27 ../../../i18n/xx/libtodayweatherplugin.ts \ 27 ../../../i18n/xx/libtodayweatherplugin.ts \
28 ../../../i18n/en/libtodayweatherplugin.ts \ 28 ../../../i18n/en/libtodayweatherplugin.ts \
29 ../../../i18n/es/libtodayweatherplugin.ts \ 29 ../../../i18n/es/libtodayweatherplugin.ts \
30 ../../../i18n/fr/libtodayweatherplugin.ts \ 30 ../../../i18n/fr/libtodayweatherplugin.ts \
31 ../../../i18n/hu/libtodayweatherplugin.ts \ 31 ../../../i18n/hu/libtodayweatherplugin.ts \
32 ../../../i18n/ja/libtodayweatherplugin.ts \ 32 ../../../i18n/ja/libtodayweatherplugin.ts \
33 ../../../i18n/ko/libtodayweatherplugin.ts \ 33 ../../../i18n/ko/libtodayweatherplugin.ts \
34 ../../../i18n/no/libtodayweatherplugin.ts \ 34 ../../../i18n/no/libtodayweatherplugin.ts \
35 ../../../i18n/pl/libtodayweatherplugin.ts \ 35 ../../../i18n/pl/libtodayweatherplugin.ts \
36 ../../../i18n/pt/libtodayweatherplugin.ts \ 36 ../../../i18n/pt/libtodayweatherplugin.ts \
37 ../../../i18n/pt_BR/libtodayweatherplugin.ts \ 37 ../../../i18n/pt_BR/libtodayweatherplugin.ts \
38 ../../../i18n/sl/libtodayweatherplugin.ts \ 38 ../../../i18n/sl/libtodayweatherplugin.ts \
39 ../../../i18n/zh_CN/libtodayweatherplugin.ts \ 39 ../../../i18n/zh_CN/libtodayweatherplugin.ts \
40 ../../../i18n/zh_TW/libtodayweatherplugin.ts \ 40 ../../../i18n/zh_TW/libtodayweatherplugin.ts \
41 ../../../i18n/it/libtodayweatherplugin.ts \ 41 ../../../i18n/it/libtodayweatherplugin.ts \
42 ../../../i18n/da/libtodayweatherplugin.ts 42 ../../../i18n/da/libtodayweatherplugin.ts
43include ( $(OPIEDIR)/include.pro ) 43include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/unsupported/mail2/bend/bend.pro b/noncore/unsupported/mail2/bend/bend.pro
index b03f652..61eea5f 100644
--- a/noncore/unsupported/mail2/bend/bend.pro
+++ b/noncore/unsupported/mail2/bend/bend.pro
@@ -1,32 +1,32 @@
1 TEMPLATE =lib 1 TEMPLATE =lib
2 CONFIG +=qt warn_on release 2 CONFIG +=qt plugin warn_on release
3 HEADERS +=bend.h \ 3 HEADERS +=bend.h \
4 bendimpl.h 4 bendimpl.h
5 SOURCES +=bend.cpp \ 5 SOURCES +=bend.cpp \
6 bendimpl.cpp 6 bendimpl.cpp
7 INCLUDEPATH +=$(OPIEDIR)/include ../libmail 7 INCLUDEPATH +=$(OPIEDIR)/include ../libmail
8 LIBS +=-lmail -lqpe 8 LIBS +=-lmail -lqpe
9 TARGET =bend 9 TARGET =bend
10 DESTDIR +=$(OPIEDIR)/plugins/applets/ 10 DESTDIR +=$(OPIEDIR)/plugins/applets/
11 11
12TRANSLATIONS = ../../../i18n/de/libbend.ts \ 12TRANSLATIONS = ../../../i18n/de/libbend.ts \
13 ../../../i18n/nl/libbend.ts \ 13 ../../../i18n/nl/libbend.ts \
14 ../../../i18n/da/libbend.ts \ 14 ../../../i18n/da/libbend.ts \
15 ../../../i18n/xx/libbend.ts \ 15 ../../../i18n/xx/libbend.ts \
16 ../../../i18n/en/libbend.ts \ 16 ../../../i18n/en/libbend.ts \
17 ../../../i18n/es/libbend.ts \ 17 ../../../i18n/es/libbend.ts \
18 ../../../i18n/fr/libbend.ts \ 18 ../../../i18n/fr/libbend.ts \
19 ../../../i18n/hu/libbend.ts \ 19 ../../../i18n/hu/libbend.ts \
20 ../../../i18n/ja/libbend.ts \ 20 ../../../i18n/ja/libbend.ts \
21 ../../../i18n/ko/libbend.ts \ 21 ../../../i18n/ko/libbend.ts \
22 ../../../i18n/no/libbend.ts \ 22 ../../../i18n/no/libbend.ts \
23 ../../../i18n/pl/libbend.ts \ 23 ../../../i18n/pl/libbend.ts \
24 ../../../i18n/pt/libbend.ts \ 24 ../../../i18n/pt/libbend.ts \
25 ../../../i18n/pt_BR/libbend.ts \ 25 ../../../i18n/pt_BR/libbend.ts \
26 ../../../i18n/sl/libbend.ts \ 26 ../../../i18n/sl/libbend.ts \
27 ../../../i18n/zh_CN/libbend.ts \ 27 ../../../i18n/zh_CN/libbend.ts \
28 ../../../i18n/zh_TW/libbend.ts 28 ../../../i18n/zh_TW/libbend.ts
29 29
30 30
31 31
32include ( $(OPIEDIR)/include.pro ) 32include ( $(OPIEDIR)/include.pro )
diff --git a/plugins/Makefile b/plugins/Makefile
index 4863bd0..2515903 100644
--- a/plugins/Makefile
+++ b/plugins/Makefile
@@ -1,4 +1,8 @@
1clean: 1clean:
2 find -name "*.so*" -print0 | xargs -0 rm -f 2ifeq ( CONFIG_TARGET_MACOSX, y )
3 find ./ -name "*.dylib*" -print0 | xargs -0 rm -f
4else
5 find ./ -name "*.so*" -print0 | xargs -0 rm -f
6endif
3 7
4all install ipk lupdate lrelease opie-lupdate opie-lrelease: 8all install ipk lupdate lrelease opie-lupdate opie-lrelease:
diff --git a/qmake/include/qglobal.h b/qmake/include/qglobal.h
index d212bff..94e5607 100644
--- a/qmake/include/qglobal.h
+++ b/qmake/include/qglobal.h
@@ -1,1065 +1,1072 @@
1/**************************************************************************** 1/****************************************************************************
2** $Id$ 2** $Id$
3** 3**
4** Global type declarations and definitions 4** Global type declarations and definitions
5** 5**
6** Created : 920529 6** Created : 920529
7** 7**
8** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
9** 9**
10** This file is part of the tools module of the Qt GUI Toolkit. 10** This file is part of the tools module of the Qt GUI Toolkit.
11** 11**
12** This file may be distributed under the terms of the Q Public License 12** This file may be distributed under the terms of the Q Public License
13** as defined by Trolltech AS of Norway and appearing in the file 13** as defined by Trolltech AS of Norway and appearing in the file
14** LICENSE.QPL included in the packaging of this file. 14** LICENSE.QPL included in the packaging of this file.
15** 15**
16** This file may be distributed and/or modified under the terms of the 16** This file may be distributed and/or modified under the terms of the
17** GNU General Public License version 2 as published by the Free Software 17** GNU General Public License version 2 as published by the Free Software
18** Foundation and appearing in the file LICENSE.GPL included in the 18** Foundation and appearing in the file LICENSE.GPL included in the
19** packaging of this file. 19** packaging of this file.
20** 20**
21** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition 21** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
22** licenses may use this file in accordance with the Qt Commercial License 22** licenses may use this file in accordance with the Qt Commercial License
23** Agreement provided with the Software. 23** Agreement provided with the Software.
24** 24**
25** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 25** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
26** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 26** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27** 27**
28** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for 28** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
29** information about Qt Commercial License Agreements. 29** information about Qt Commercial License Agreements.
30** See http://www.trolltech.com/qpl/ for QPL licensing information. 30** See http://www.trolltech.com/qpl/ for QPL licensing information.
31** See http://www.trolltech.com/gpl/ for GPL licensing information. 31** See http://www.trolltech.com/gpl/ for GPL licensing information.
32** 32**
33** Contact info@trolltech.com if any conditions of this licensing are 33** Contact info@trolltech.com if any conditions of this licensing are
34** not clear to you. 34** not clear to you.
35** 35**
36**********************************************************************/ 36**********************************************************************/
37 37
38#ifndef QGLOBAL_H 38#ifndef QGLOBAL_H
39#define QGLOBAL_H 39#define QGLOBAL_H
40 40
41#define QT_VERSION_STR "3.1.2" 41#define QT_VERSION_STR "3.1.2"
42/* 42/*
43 QT_VERSION is (major << 16) + (minor << 8) + patch. 43 QT_VERSION is (major << 16) + (minor << 8) + patch.
44 */ 44 */
45#define QT_VERSION 0x030102 45#define QT_VERSION 0x030102
46 46
47/* 47/*
48 The operating system, must be one of: (Q_OS_x) 48 The operating system, must be one of: (Q_OS_x)
49 49
50 MACX- Mac OS X 50 MACX- Mac OS X
51 MAC9- Mac OS 9 51 MAC9- Mac OS 9
52 MSDOS- MS-DOS and Windows 52 MSDOS- MS-DOS and Windows
53 OS2- OS/2 53 OS2- OS/2
54 OS2EMX- XFree86 on OS/2 (not PM) 54 OS2EMX- XFree86 on OS/2 (not PM)
55 WIN32- Win32 (Windows 95/98/ME and Windows NT/2000/XP) 55 WIN32- Win32 (Windows 95/98/ME and Windows NT/2000/XP)
56 CYGWIN- Cygwin 56 CYGWIN- Cygwin
57 SOLARIS- Sun Solaris 57 SOLARIS- Sun Solaris
58 HPUX- HP-UX 58 HPUX- HP-UX
59 ULTRIX- DEC Ultrix 59 ULTRIX- DEC Ultrix
60 LINUX- Linux 60 LINUX- Linux
61 FREEBSD- FreeBSD 61 FREEBSD- FreeBSD
62 NETBSD- NetBSD 62 NETBSD- NetBSD
63 OPENBSD- OpenBSD 63 OPENBSD- OpenBSD
64 BSDI- BSD/OS 64 BSDI- BSD/OS
65 IRIX- SGI Irix 65 IRIX- SGI Irix
66 OSF- HP Tru64 UNIX 66 OSF- HP Tru64 UNIX
67 SCO- SCO OpenServer 5 67 SCO- SCO OpenServer 5
68 UNIXWARE- UnixWare 7, Open UNIX 8 68 UNIXWARE- UnixWare 7, Open UNIX 8
69 AIX- AIX 69 AIX- AIX
70 HURD- GNU Hurd 70 HURD- GNU Hurd
71 DGUX- DG/UX 71 DGUX- DG/UX
72 RELIANT- Reliant UNIX 72 RELIANT- Reliant UNIX
73 DYNIX- DYNIX/ptx 73 DYNIX- DYNIX/ptx
74 QNX- QNX 74 QNX- QNX
75 QNX6- QNX RTP 6.1 75 QNX6- QNX RTP 6.1
76 LYNX- LynxOS 76 LYNX- LynxOS
77 BSD4- Any BSD 4.4 system 77 BSD4- Any BSD 4.4 system
78 UNIX- Any UNIX BSD/SYSV system 78 UNIX- Any UNIX BSD/SYSV system
79*/ 79*/
80 80
81#if defined(__APPLE__) && defined(__GNUC__) 81#if defined(__APPLE__) && defined(__GNUC__)
82# define Q_OS_MACX 82# define Q_OS_MACX
83#elif defined(__MACOSX__) 83#elif defined(__MACOSX__)
84# define Q_OS_MACX 84# define Q_OS_MACX
85#elif defined(macintosh) 85#elif defined(macintosh)
86# define Q_OS_MAC9 86# define Q_OS_MAC9
87#elif defined(__CYGWIN__) 87#elif defined(__CYGWIN__)
88# define Q_OS_CYGWIN 88# define Q_OS_CYGWIN
89#elif defined(MSDOS) || defined(_MSDOS) 89#elif defined(MSDOS) || defined(_MSDOS)
90# define Q_OS_MSDOS 90# define Q_OS_MSDOS
91#elif defined(__OS2__) 91#elif defined(__OS2__)
92# if defined(__EMX__) 92# if defined(__EMX__)
93# define Q_OS_OS2EMX 93# define Q_OS_OS2EMX
94# else 94# else
95# define Q_OS_OS2 95# define Q_OS_OS2
96# endif 96# endif
97#elif !defined(SAG_COM) && (defined(WIN64) || defined(_WIN64) || defined(__WIN64__)) 97#elif !defined(SAG_COM) && (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))
98# define Q_OS_WIN32 98# define Q_OS_WIN32
99# define Q_OS_WIN64 99# define Q_OS_WIN64
100#elif !defined(SAG_COM) && (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)) 100#elif !defined(SAG_COM) && (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__))
101# define Q_OS_WIN32 101# define Q_OS_WIN32
102#elif defined(__MWERKS__) && defined(__INTEL__) 102#elif defined(__MWERKS__) && defined(__INTEL__)
103# define Q_OS_WIN32 103# define Q_OS_WIN32
104#elif defined(__sun) || defined(sun) 104#elif defined(__sun) || defined(sun)
105# define Q_OS_SOLARIS 105# define Q_OS_SOLARIS
106#elif defined(hpux) || defined(__hpux) 106#elif defined(hpux) || defined(__hpux)
107# define Q_OS_HPUX 107# define Q_OS_HPUX
108#elif defined(__ultrix) || defined(ultrix) 108#elif defined(__ultrix) || defined(ultrix)
109# define Q_OS_ULTRIX 109# define Q_OS_ULTRIX
110#elif defined(sinix) 110#elif defined(sinix)
111# define Q_OS_RELIANT 111# define Q_OS_RELIANT
112#elif defined(__linux__) || defined(__linux) 112#elif defined(__linux__) || defined(__linux)
113# define Q_OS_LINUX 113# define Q_OS_LINUX
114#elif defined(__FreeBSD__) 114#elif defined(__FreeBSD__)
115# define Q_OS_FREEBSD 115# define Q_OS_FREEBSD
116# define Q_OS_BSD4 116# define Q_OS_BSD4
117#elif defined(__NetBSD__) 117#elif defined(__NetBSD__)
118# define Q_OS_NETBSD 118# define Q_OS_NETBSD
119# define Q_OS_BSD4 119# define Q_OS_BSD4
120#elif defined(__OpenBSD__) 120#elif defined(__OpenBSD__)
121# define Q_OS_OPENBSD 121# define Q_OS_OPENBSD
122# define Q_OS_BSD4 122# define Q_OS_BSD4
123#elif defined(__bsdi__) 123#elif defined(__bsdi__)
124# define Q_OS_BSDI 124# define Q_OS_BSDI
125# define Q_OS_BSD4 125# define Q_OS_BSD4
126#elif defined(__sgi) 126#elif defined(__sgi)
127# define Q_OS_IRIX 127# define Q_OS_IRIX
128#elif defined(__osf__) 128#elif defined(__osf__)
129# define Q_OS_OSF 129# define Q_OS_OSF
130#elif defined(_AIX) 130#elif defined(_AIX)
131# define Q_OS_AIX 131# define Q_OS_AIX
132#elif defined(__Lynx__) 132#elif defined(__Lynx__)
133# define Q_OS_LYNX 133# define Q_OS_LYNX
134#elif defined(__GNU_HURD__) 134#elif defined(__GNU_HURD__)
135# define Q_OS_HURD 135# define Q_OS_HURD
136#elif defined(__DGUX__) 136#elif defined(__DGUX__)
137# define Q_OS_DGUX 137# define Q_OS_DGUX
138#elif defined(__QNXNTO__) 138#elif defined(__QNXNTO__)
139# define Q_OS_QNX6 139# define Q_OS_QNX6
140#elif defined(__QNX__) 140#elif defined(__QNX__)
141# define Q_OS_QNX 141# define Q_OS_QNX
142#elif defined(_SEQUENT_) 142#elif defined(_SEQUENT_)
143# define Q_OS_DYNIX 143# define Q_OS_DYNIX
144#elif defined(_SCO_DS) /* SCO OpenServer 5 + GCC */ 144#elif defined(_SCO_DS) /* SCO OpenServer 5 + GCC */
145# define Q_OS_SCO 145# define Q_OS_SCO
146#elif defined(__USLC__) /* all SCO platforms + UDK or OUDK */ 146#elif defined(__USLC__) /* all SCO platforms + UDK or OUDK */
147# define Q_OS_UNIXWARE 147# define Q_OS_UNIXWARE
148# define Q_OS_UNIXWARE7 148# define Q_OS_UNIXWARE7
149#elif defined(__svr4__) && defined(i386) /* Open UNIX 8 + GCC */ 149#elif defined(__svr4__) && defined(i386) /* Open UNIX 8 + GCC */
150# define Q_OS_UNIXWARE 150# define Q_OS_UNIXWARE
151# define Q_OS_UNIXWARE7 151# define Q_OS_UNIXWARE7
152#else 152#else
153# error "Qt has not been ported to this OS - talk to qt-bugs@trolltech.com" 153# error "Qt has not been ported to this OS - talk to qt-bugs@trolltech.com"
154#endif 154#endif
155 155
156#if defined(Q_OS_MAC9) || defined(Q_OS_MACX) 156#if defined(Q_OS_MAC9) || defined(Q_OS_MACX)
157# define Q_OS_MAC 157/* This hack forces the generater to compile qmake not for maxosx native. It is
158 * compiled for Linux and generates usual makefiles..
159 * Does anyone has a better solution for this ? (eilers)
160 */
161// # define Q_OS_MAC
162#define Q_OS_LINUX
163#warning "boeser Hack !! (se)"
164#undef Q_OS_MACX
158#endif 165#endif
159 166
160#if defined(Q_OS_MAC9) || defined(Q_OS_MSDOS) || defined(Q_OS_OS2) || defined(Q_OS_WIN32) || defined(Q_OS_WIN64) 167#if defined(Q_OS_MAC9) || defined(Q_OS_MSDOS) || defined(Q_OS_OS2) || defined(Q_OS_WIN32) || defined(Q_OS_WIN64)
161# undef Q_OS_UNIX 168# undef Q_OS_UNIX
162#elif !defined(Q_OS_UNIX) 169#elif !defined(Q_OS_UNIX)
163# define Q_OS_UNIX 170# define Q_OS_UNIX
164#endif 171#endif
165 172
166 173
167/* 174/*
168 The compiler, must be one of: (Q_CC_x) 175 The compiler, must be one of: (Q_CC_x)
169 176
170 SYM- Symantec C++ for both PC and Macintosh 177 SYM- Symantec C++ for both PC and Macintosh
171 MPW- MPW C++ 178 MPW- MPW C++
172 MWERKS- Metrowerks CodeWarrior 179 MWERKS- Metrowerks CodeWarrior
173 MSVC- Microsoft Visual C/C++ 180 MSVC- Microsoft Visual C/C++
174 BOR- Borland/Turbo C++ 181 BOR- Borland/Turbo C++
175 WAT- Watcom C++ 182 WAT- Watcom C++
176 GNU- GNU C++ 183 GNU- GNU C++
177 COMEAU- Comeau C++ 184 COMEAU- Comeau C++
178 EDG- Edison Design Group C++ 185 EDG- Edison Design Group C++
179 OC - CenterLine C++ 186 OC - CenterLine C++
180 SUN- Sun WorkShop, Forte Developer, or Sun ONE Studio C++ 187 SUN- Sun WorkShop, Forte Developer, or Sun ONE Studio C++
181 MIPS- MIPSpro C++ 188 MIPS- MIPSpro C++
182 DEC- DEC C++ 189 DEC- DEC C++
183 HP - HPUX C++ 190 HP - HPUX C++
184 HPACC- HPUX ANSI C++ 191 HPACC- HPUX ANSI C++
185 USLC- SCO OUDK, UDK, and UnixWare 2.X C++ 192 USLC- SCO OUDK, UDK, and UnixWare 2.X C++
186 CDS- Reliant C++ 193 CDS- Reliant C++
187 KAI- KAI C++ 194 KAI- KAI C++
188 INTEL- Intel C++ 195 INTEL- Intel C++
189 HIGHC- MetaWare High C/C++ 196 HIGHC- MetaWare High C/C++
190 PGI- Portland Group C++ 197 PGI- Portland Group C++
191 GHS- Green Hills Optimizing C++ Compilers 198 GHS- Green Hills Optimizing C++ Compilers
192 199
193 Should be sorted most to least authoritative. 200 Should be sorted most to least authoritative.
194*/ 201*/
195 202
196/* Symantec C++ is now Digital Mars */ 203/* Symantec C++ is now Digital Mars */
197#if defined(__DMC__) || defined(__SC__) 204#if defined(__DMC__) || defined(__SC__)
198# define Q_CC_SYM 205# define Q_CC_SYM
199/* "explicit" semantics implemented in 8.1e but keyword recognized since 7.5 */ 206/* "explicit" semantics implemented in 8.1e but keyword recognized since 7.5 */
200# if defined(__SC__) && __SC__ < 0x750 207# if defined(__SC__) && __SC__ < 0x750
201# define Q_NO_EXPLICIT_KEYWORD 208# define Q_NO_EXPLICIT_KEYWORD
202# endif 209# endif
203# define Q_NO_USING_KEYWORD 210# define Q_NO_USING_KEYWORD
204# if !defined(_CPPUNWIND) 211# if !defined(_CPPUNWIND)
205# define Q_NO_EXCEPTIONS 212# define Q_NO_EXCEPTIONS
206# endif 213# endif
207 214
208#elif defined(applec) 215#elif defined(applec)
209# define Q_CC_MPW 216# define Q_CC_MPW
210# define Q_NO_BOOL_TYPE 217# define Q_NO_BOOL_TYPE
211# define Q_NO_EXPLICIT_KEYWORD 218# define Q_NO_EXPLICIT_KEYWORD
212# define Q_NO_USING_KEYWORD 219# define Q_NO_USING_KEYWORD
213 220
214#elif defined(__MWERKS__) 221#elif defined(__MWERKS__)
215# define Q_CC_MWERKS 222# define Q_CC_MWERKS
216/* "explicit" recognized since 4.0d1 */ 223/* "explicit" recognized since 4.0d1 */
217# define QMAC_PASCAL pascal 224# define QMAC_PASCAL pascal
218# define Q_NO_USING_KEYWORD /* ### check "using" status */ 225# define Q_NO_USING_KEYWORD /* ### check "using" status */
219 226
220#elif defined(_MSC_VER) 227#elif defined(_MSC_VER)
221# define Q_CC_MSVC 228# define Q_CC_MSVC
222/* proper support of bool for _MSC_VER >= 1100 */ 229/* proper support of bool for _MSC_VER >= 1100 */
223# define Q_CANNOT_DELETE_CONSTANT 230# define Q_CANNOT_DELETE_CONSTANT
224# define Q_INLINE_TEMPLATES inline 231# define Q_INLINE_TEMPLATES inline
225/* Visual C++.Net issues for _MSC_VER >= 1300 */ 232/* Visual C++.Net issues for _MSC_VER >= 1300 */
226# if _MSC_VER >= 1300 233# if _MSC_VER >= 1300
227# define Q_CC_MSVC_NET 234# define Q_CC_MSVC_NET
228# if _MSC_VER < 1310 235# if _MSC_VER < 1310
229# define Q_TYPENAME 236# define Q_TYPENAME
230# endif 237# endif
231# endif 238# endif
232# define Q_NO_USING_KEYWORD /* ### check "using" status */ 239# define Q_NO_USING_KEYWORD /* ### check "using" status */
233 240
234#elif defined(__BORLANDC__) || defined(__TURBOC__) 241#elif defined(__BORLANDC__) || defined(__TURBOC__)
235# define Q_CC_BOR 242# define Q_CC_BOR
236# if __BORLANDC__ < 0x502 243# if __BORLANDC__ < 0x502
237# define Q_NO_BOOL_TYPE 244# define Q_NO_BOOL_TYPE
238# define Q_NO_EXPLICIT_KEYWORD 245# define Q_NO_EXPLICIT_KEYWORD
239# endif 246# endif
240# define Q_NO_USING_KEYWORD /* ### check "using" status */ 247# define Q_NO_USING_KEYWORD /* ### check "using" status */
241 248
242#elif defined(__WATCOMC__) 249#elif defined(__WATCOMC__)
243# define Q_CC_WAT 250# define Q_CC_WAT
244# if defined(Q_OS_QNX4) 251# if defined(Q_OS_QNX4)
245/* compiler flags */ 252/* compiler flags */
246# define Q_TYPENAME 253# define Q_TYPENAME
247# define Q_NO_BOOL_TYPE 254# define Q_NO_BOOL_TYPE
248# define Q_CANNOT_DELETE_CONSTANT 255# define Q_CANNOT_DELETE_CONSTANT
249# define mutable 256# define mutable
250/* ??? */ 257/* ??? */
251# define Q_BROKEN_TEMPLATE_SPECIALIZATION 258# define Q_BROKEN_TEMPLATE_SPECIALIZATION
252/* no template classes in QVariant */ 259/* no template classes in QVariant */
253# define QT_NO_TEMPLATE_VARIANT 260# define QT_NO_TEMPLATE_VARIANT
254/* Wcc does not fill in functions needed by valuelists, maps, and 261/* Wcc does not fill in functions needed by valuelists, maps, and
255 valuestacks implicitly */ 262 valuestacks implicitly */
256# define Q_FULL_TEMPLATE_INSTANTIATION 263# define Q_FULL_TEMPLATE_INSTANTIATION
257/* can we just compare the structures? */ 264/* can we just compare the structures? */
258# define Q_FULL_TEMPLATE_INSTANTIATION_MEMCMP 265# define Q_FULL_TEMPLATE_INSTANTIATION_MEMCMP
259/* these are not useful to our customers */ 266/* these are not useful to our customers */
260# define QT_QWS_NO_SHM 267# define QT_QWS_NO_SHM
261# define QT_NO_QWS_MULTIPROCESS 268# define QT_NO_QWS_MULTIPROCESS
262# define QT_NO_SQL 269# define QT_NO_SQL
263# define QT_NO_QWS_CURSOR 270# define QT_NO_QWS_CURSOR
264# endif 271# endif
265 272
266#elif defined(__GNUC__) 273#elif defined(__GNUC__)
267# define Q_CC_GNU 274# define Q_CC_GNU
268# define Q_C_CALLBACKS 275# define Q_C_CALLBACKS
269# if __GNUC__ == 2 && __GNUC_MINOR__ <= 7 276# if __GNUC__ == 2 && __GNUC_MINOR__ <= 7
270# define Q_FULL_TEMPLATE_INSTANTIATION 277# define Q_FULL_TEMPLATE_INSTANTIATION
271# endif 278# endif
272/* GCC 2.95 knows "using" but does not support it correctly */ 279/* GCC 2.95 knows "using" but does not support it correctly */
273# if __GNUC__ == 2 && __GNUC_MINOR__ <= 95 280# if __GNUC__ == 2 && __GNUC_MINOR__ <= 95
274# define Q_NO_USING_KEYWORD 281# define Q_NO_USING_KEYWORD
275# endif 282# endif
276/* GCC 3.1 and GCC 3.2 wrongly define _SB_CTYPE_MACROS on HP-UX */ 283/* GCC 3.1 and GCC 3.2 wrongly define _SB_CTYPE_MACROS on HP-UX */
277# if defined(Q_OS_HPUX) && __GNUC__ == 3 && __GNUC_MINOR__ >= 1 284# if defined(Q_OS_HPUX) && __GNUC__ == 3 && __GNUC_MINOR__ >= 1
278# define Q_WRONG_SB_CTYPE_MACROS 285# define Q_WRONG_SB_CTYPE_MACROS
279# endif 286# endif
280# if (defined(__arm__) || defined(__ARMEL__)) && !defined(QT_MOC_CPP) 287# if (defined(__arm__) || defined(__ARMEL__)) && !defined(QT_MOC_CPP)
281# define Q_PACKED __attribute__ ((packed)) 288# define Q_PACKED __attribute__ ((packed))
282# endif 289# endif
283# if !defined(__EXCEPTIONS) 290# if !defined(__EXCEPTIONS)
284# define Q_NO_EXCEPTIONS 291# define Q_NO_EXCEPTIONS
285# endif 292# endif
286 293
287/* IBM compiler versions are a bit messy. There are actually two products: 294/* IBM compiler versions are a bit messy. There are actually two products:
288 the C product, and the C++ product. The C++ compiler is always packaged 295 the C product, and the C++ product. The C++ compiler is always packaged
289 with the latest version of the C compiler. Version numbers do not always 296 with the latest version of the C compiler. Version numbers do not always
290 match. This little table (I'm not sure it's accurate) should be helpful: 297 match. This little table (I'm not sure it's accurate) should be helpful:
291 298
292 C++ product C product 299 C++ product C product
293 300
294 C Set 3.1 C Compiler 3.0 301 C Set 3.1 C Compiler 3.0
295 ... ... 302 ... ...
296 C++ Compiler 3.6.6 C Compiler 4.3 303 C++ Compiler 3.6.6 C Compiler 4.3
297 ... ... 304 ... ...
298 Visual Age C++ 4.0 ... 305 Visual Age C++ 4.0 ...
299 ... ... 306 ... ...
300 Visual Age C++ 5.0 C Compiler 5.0 307 Visual Age C++ 5.0 C Compiler 5.0
301 308
302 Now: 309 Now:
303 __xlC__ is the version of the C compiler in hexadecimal notation 310 __xlC__ is the version of the C compiler in hexadecimal notation
304 is only an approximation of the C++ compiler version 311 is only an approximation of the C++ compiler version
305 __IBMCPP__ is the version of the C++ compiler in decimal notation 312 __IBMCPP__ is the version of the C++ compiler in decimal notation
306 but it is not defined on older compilers like C Set 3.1 */ 313 but it is not defined on older compilers like C Set 3.1 */
307#elif defined(__xlC__) 314#elif defined(__xlC__)
308# define Q_CC_XLC 315# define Q_CC_XLC
309# define Q_FULL_TEMPLATE_INSTANTIATION 316# define Q_FULL_TEMPLATE_INSTANTIATION
310# if __xlC__ < 0x400 317# if __xlC__ < 0x400
311# define Q_NO_BOOL_TYPE 318# define Q_NO_BOOL_TYPE
312# define Q_NO_EXPLICIT_KEYWORD 319# define Q_NO_EXPLICIT_KEYWORD
313# define Q_NO_USING_KEYWORD 320# define Q_NO_USING_KEYWORD
314# define Q_TYPENAME 321# define Q_TYPENAME
315# define Q_INLINE_TEMPLATES inline 322# define Q_INLINE_TEMPLATES inline
316# define Q_BROKEN_TEMPLATE_SPECIALIZATION 323# define Q_BROKEN_TEMPLATE_SPECIALIZATION
317# define Q_CANNOT_DELETE_CONSTANT 324# define Q_CANNOT_DELETE_CONSTANT
318# endif 325# endif
319 326
320/* Older versions of DEC C++ do not define __EDG__ or __EDG - observed 327/* Older versions of DEC C++ do not define __EDG__ or __EDG - observed
321 on DEC C++ V5.5-004. New versions do define __EDG__ - observed on 328 on DEC C++ V5.5-004. New versions do define __EDG__ - observed on
322 Compaq C++ V6.3-002. 329 Compaq C++ V6.3-002.
323 This compiler is different enough from other EDG compilers to handle 330 This compiler is different enough from other EDG compilers to handle
324 it separately anyway. */ 331 it separately anyway. */
325#elif defined(__DECCXX) 332#elif defined(__DECCXX)
326# define Q_CC_DEC 333# define Q_CC_DEC
327/* Compaq C++ V6 compilers are EDG-based but I'm not sure about older 334/* Compaq C++ V6 compilers are EDG-based but I'm not sure about older
328 DEC C++ V5 compilers. */ 335 DEC C++ V5 compilers. */
329# if defined(__EDG__) 336# if defined(__EDG__)
330# define Q_CC_EDG 337# define Q_CC_EDG
331# endif 338# endif
332/* Compaq have disabled EDG's _BOOL macro and use _BOOL_EXISTS instead 339/* Compaq have disabled EDG's _BOOL macro and use _BOOL_EXISTS instead
333 - observed on Compaq C++ V6.3-002. 340 - observed on Compaq C++ V6.3-002.
334 In any case versions prior to Compaq C++ V6.0-005 do not have bool. */ 341 In any case versions prior to Compaq C++ V6.0-005 do not have bool. */
335# if !defined(_BOOL_EXISTS) 342# if !defined(_BOOL_EXISTS)
336# define Q_NO_BOOL_TYPE 343# define Q_NO_BOOL_TYPE
337# endif 344# endif
338/* Spurious (?) error messages observed on Compaq C++ V6.5-014. */ 345/* Spurious (?) error messages observed on Compaq C++ V6.5-014. */
339# define Q_NO_USING_KEYWORD 346# define Q_NO_USING_KEYWORD
340/* Apply to all versions prior to Compaq C++ V6.0-000 - observed on 347/* Apply to all versions prior to Compaq C++ V6.0-000 - observed on
341 DEC C++ V5.5-004. */ 348 DEC C++ V5.5-004. */
342# if __DECCXX_VER < 60060000 349# if __DECCXX_VER < 60060000
343# define Q_TYPENAME 350# define Q_TYPENAME
344# define Q_BROKEN_TEMPLATE_SPECIALIZATION 351# define Q_BROKEN_TEMPLATE_SPECIALIZATION
345# define Q_CANNOT_DELETE_CONSTANT 352# define Q_CANNOT_DELETE_CONSTANT
346# endif 353# endif
347/* avoid undefined symbol problems with out-of-line template members */ 354/* avoid undefined symbol problems with out-of-line template members */
348# define Q_INLINE_TEMPLATES inline 355# define Q_INLINE_TEMPLATES inline
349 356
350/* Compilers with EDG front end are similar. To detect them we test: 357/* Compilers with EDG front end are similar. To detect them we test:
351 __EDG documented by SGI, observed on MIPSpro 7.3.1.1 and KAI C++ 4.0b 358 __EDG documented by SGI, observed on MIPSpro 7.3.1.1 and KAI C++ 4.0b
352 __EDG__ documented in EDG online docs, observed on Compaq C++ V6.3-002 */ 359 __EDG__ documented in EDG online docs, observed on Compaq C++ V6.3-002 */
353#elif defined(__EDG) || defined(__EDG__) 360#elif defined(__EDG) || defined(__EDG__)
354# define Q_CC_EDG 361# define Q_CC_EDG
355/* From the EDG documentation (does not seem to apply to Compaq C++): 362/* From the EDG documentation (does not seem to apply to Compaq C++):
356 _BOOL 363 _BOOL
357 Defined in C++ mode when bool is a keyword. The name of this 364 Defined in C++ mode when bool is a keyword. The name of this
358 predefined macro is specified by a configuration flag. _BOOL 365 predefined macro is specified by a configuration flag. _BOOL
359 is the default. 366 is the default.
360 __BOOL_DEFINED 367 __BOOL_DEFINED
361 Defined in Microsoft C++ mode when bool is a keyword. */ 368 Defined in Microsoft C++ mode when bool is a keyword. */
362# if !defined(_BOOL) && !defined(__BOOL_DEFINED) 369# if !defined(_BOOL) && !defined(__BOOL_DEFINED)
363# define Q_NO_BOOL_TYPE 370# define Q_NO_BOOL_TYPE
364# endif 371# endif
365 372
366/* The Portland Group compiler is based on EDG and does define __EDG__ */ 373/* The Portland Group compiler is based on EDG and does define __EDG__ */
367# if defined(__COMO__) 374# if defined(__COMO__)
368# define Q_CC_COMEAU 375# define Q_CC_COMEAU
369# define Q_C_CALLBACKS 376# define Q_C_CALLBACKS
370 377
371/* Using the `using' keyword avoids KAI C++ warnings */ 378/* Using the `using' keyword avoids KAI C++ warnings */
372# elif defined(__KCC) 379# elif defined(__KCC)
373# define Q_CC_KAI 380# define Q_CC_KAI
374# if !defined(_EXCEPTIONS) 381# if !defined(_EXCEPTIONS)
375# define Q_NO_EXCEPTIONS 382# define Q_NO_EXCEPTIONS
376# endif 383# endif
377 384
378/* Using the `using' keyword avoids Intel C++ warnings */ 385/* Using the `using' keyword avoids Intel C++ warnings */
379# elif defined(__INTEL_COMPILER) 386# elif defined(__INTEL_COMPILER)
380# define Q_CC_INTEL 387# define Q_CC_INTEL
381# if !defined(__EXCEPTIONS) 388# if !defined(__EXCEPTIONS)
382# define Q_NO_EXCEPTIONS 389# define Q_NO_EXCEPTIONS
383# endif 390# endif
384 391
385/* The Portland Group compiler is based on EDG and does define __EDG__ */ 392/* The Portland Group compiler is based on EDG and does define __EDG__ */
386# elif defined(__PGI) 393# elif defined(__PGI)
387# define Q_CC_PGI 394# define Q_CC_PGI
388# if !defined(__EXCEPTIONS) 395# if !defined(__EXCEPTIONS)
389# define Q_NO_EXCEPTIONS 396# define Q_NO_EXCEPTIONS
390# endif 397# endif
391 398
392/* Never tested! */ 399/* Never tested! */
393# elif defined(__ghs) 400# elif defined(__ghs)
394# define Q_CC_GHS 401# define Q_CC_GHS
395 402
396/* The UnixWare 7 UDK compiler is based on EDG and does define __EDG__ */ 403/* The UnixWare 7 UDK compiler is based on EDG and does define __EDG__ */
397# elif defined(__USLC__) && defined(__SCO_VERSION__) 404# elif defined(__USLC__) && defined(__SCO_VERSION__)
398# define Q_CC_USLC 405# define Q_CC_USLC
399/* The latest UDK 7.1.1b does not need this, but previous versions do */ 406/* The latest UDK 7.1.1b does not need this, but previous versions do */
400# if !defined(__SCO_VERSION__) || (__SCO_VERSION__ < 302200010) 407# if !defined(__SCO_VERSION__) || (__SCO_VERSION__ < 302200010)
401# define Q_INLINE_TEMPLATES inline 408# define Q_INLINE_TEMPLATES inline
402# endif 409# endif
403# define Q_NO_USING_KEYWORD /* ### check "using" status */ 410# define Q_NO_USING_KEYWORD /* ### check "using" status */
404 411
405/* Never tested! */ 412/* Never tested! */
406# elif defined(CENTERLINE_CLPP) || defined(OBJECTCENTER) 413# elif defined(CENTERLINE_CLPP) || defined(OBJECTCENTER)
407# define Q_CC_OC 414# define Q_CC_OC
408# define Q_NO_USING_KEYWORD 415# define Q_NO_USING_KEYWORD
409 416
410/* CDS++ defines __EDG__ although this is not documented in the Reliant 417/* CDS++ defines __EDG__ although this is not documented in the Reliant
411 documentation. It also follows conventions like _BOOL and this documented */ 418 documentation. It also follows conventions like _BOOL and this documented */
412# elif defined(sinix) 419# elif defined(sinix)
413# define Q_CC_CDS 420# define Q_CC_CDS
414# define Q_NO_USING_KEYWORD 421# define Q_NO_USING_KEYWORD
415# if defined(__cplusplus) && (__cplusplus < 2) /* Cfront C++ mode */ 422# if defined(__cplusplus) && (__cplusplus < 2) /* Cfront C++ mode */
416# define Q_NO_EXCEPTIONS 423# define Q_NO_EXCEPTIONS
417# endif 424# endif
418 425
419/* The MIPSpro compiler in o32 mode is based on EDG but disables features 426/* The MIPSpro compiler in o32 mode is based on EDG but disables features
420 such as template specialization nevertheless */ 427 such as template specialization nevertheless */
421# elif defined(__sgi) 428# elif defined(__sgi)
422# define Q_CC_MIPS 429# define Q_CC_MIPS
423# if defined(_MIPS_SIM) && (_MIPS_SIM == _ABIO32) /* o32 ABI */ 430# if defined(_MIPS_SIM) && (_MIPS_SIM == _ABIO32) /* o32 ABI */
424# define Q_TYPENAME 431# define Q_TYPENAME
425# define Q_BROKEN_TEMPLATE_SPECIALIZATION 432# define Q_BROKEN_TEMPLATE_SPECIALIZATION
426# define Q_STRICT_INLINING_RULES 433# define Q_STRICT_INLINING_RULES
427# define Q_NO_EXPLICIT_KEYWORD 434# define Q_NO_EXPLICIT_KEYWORD
428# define Q_INLINE_TEMPLATES inline 435# define Q_INLINE_TEMPLATES inline
429# elif defined(_COMPILER_VERSION) && (_COMPILER_VERSION < 730) /* 7.2 */ 436# elif defined(_COMPILER_VERSION) && (_COMPILER_VERSION < 730) /* 7.2 */
430# define Q_TYPENAME 437# define Q_TYPENAME
431# define Q_BROKEN_TEMPLATE_SPECIALIZATION 438# define Q_BROKEN_TEMPLATE_SPECIALIZATION
432# endif 439# endif
433# define Q_NO_USING_KEYWORD /* ### check "using" status */ 440# define Q_NO_USING_KEYWORD /* ### check "using" status */
434# endif 441# endif
435 442
436/* The older UnixWare 2.X compiler? */ 443/* The older UnixWare 2.X compiler? */
437#elif defined(__USLC__) 444#elif defined(__USLC__)
438# define Q_CC_USLC 445# define Q_CC_USLC
439# define Q_TYPENAME 446# define Q_TYPENAME
440# define Q_NO_BOOL_TYPE 447# define Q_NO_BOOL_TYPE
441# define Q_NO_EXPLICIT_KEYWORD 448# define Q_NO_EXPLICIT_KEYWORD
442# define Q_NO_USING_KEYWORD 449# define Q_NO_USING_KEYWORD
443# define Q_INLINE_TEMPLATES inline 450# define Q_INLINE_TEMPLATES inline
444 451
445/* Never tested! */ 452/* Never tested! */
446#elif defined(__HIGHC__) 453#elif defined(__HIGHC__)
447# define Q_CC_HIGHC 454# define Q_CC_HIGHC
448 455
449#elif defined(__SUNPRO_CC) 456#elif defined(__SUNPRO_CC)
450# define Q_CC_SUN 457# define Q_CC_SUN
451/* 5.0 compiler or better 458/* 5.0 compiler or better
452 'bool' is enabled by default but can be disabled using -features=nobool 459 'bool' is enabled by default but can be disabled using -features=nobool
453 in which case _BOOL is not defined 460 in which case _BOOL is not defined
454 this is the default in 4.2 compatibility mode triggered by -compat=4 */ 461 this is the default in 4.2 compatibility mode triggered by -compat=4 */
455# if __SUNPRO_CC >= 0x500 462# if __SUNPRO_CC >= 0x500
456# if !defined(_BOOL) 463# if !defined(_BOOL)
457# define Q_NO_BOOL_TYPE 464# define Q_NO_BOOL_TYPE
458# endif 465# endif
459# if defined(__SUNPRO_CC_COMPAT) && (__SUNPRO_CC_COMPAT <= 4) 466# if defined(__SUNPRO_CC_COMPAT) && (__SUNPRO_CC_COMPAT <= 4)
460# define Q_NO_USING_KEYWORD 467# define Q_NO_USING_KEYWORD
461# endif 468# endif
462# define Q_C_CALLBACKS 469# define Q_C_CALLBACKS
463/* 4.2 compiler or older */ 470/* 4.2 compiler or older */
464# else 471# else
465# define Q_NO_BOOL_TYPE 472# define Q_NO_BOOL_TYPE
466# define Q_NO_EXPLICIT_KEYWORD 473# define Q_NO_EXPLICIT_KEYWORD
467# define Q_NO_USING_KEYWORD 474# define Q_NO_USING_KEYWORD
468# endif 475# endif
469 476
470/* CDS++ does not seem to define __EDG__ or __EDG according to Reliant 477/* CDS++ does not seem to define __EDG__ or __EDG according to Reliant
471 documentation but nevertheless uses EDG conventions like _BOOL */ 478 documentation but nevertheless uses EDG conventions like _BOOL */
472#elif defined(sinix) 479#elif defined(sinix)
473# define Q_CC_EDG 480# define Q_CC_EDG
474# define Q_CC_CDS 481# define Q_CC_CDS
475# if !defined(_BOOL) 482# if !defined(_BOOL)
476# define Q_NO_BOOL_TYPE 483# define Q_NO_BOOL_TYPE
477# endif 484# endif
478# define Q_BROKEN_TEMPLATE_SPECIALIZATION 485# define Q_BROKEN_TEMPLATE_SPECIALIZATION
479 486
480#elif defined(Q_OS_HPUX) 487#elif defined(Q_OS_HPUX)
481/* __HP_aCC was not defined in first aCC releases */ 488/* __HP_aCC was not defined in first aCC releases */
482# if defined(__HP_aCC) || __cplusplus >= 199707L 489# if defined(__HP_aCC) || __cplusplus >= 199707L
483# define Q_CC_HPACC 490# define Q_CC_HPACC
484# else 491# else
485# define Q_CC_HP 492# define Q_CC_HP
486# define Q_NO_BOOL_TYPE 493# define Q_NO_BOOL_TYPE
487# define Q_FULL_TEMPLATE_INSTANTIATION 494# define Q_FULL_TEMPLATE_INSTANTIATION
488# define Q_BROKEN_TEMPLATE_SPECIALIZATION 495# define Q_BROKEN_TEMPLATE_SPECIALIZATION
489# define Q_NO_EXPLICIT_KEYWORD 496# define Q_NO_EXPLICIT_KEYWORD
490# endif 497# endif
491# define Q_NO_USING_KEYWORD /* ### check "using" status */ 498# define Q_NO_USING_KEYWORD /* ### check "using" status */
492 499
493#else 500#else
494# error "Qt has not been tested with this compiler - talk to qt-bugs@trolltech.com" 501# error "Qt has not been tested with this compiler - talk to qt-bugs@trolltech.com"
495#endif 502#endif
496 503
497#ifndef Q_PACKED 504#ifndef Q_PACKED
498# define Q_PACKED 505# define Q_PACKED
499#endif 506#endif
500 507
501 508
502/* 509/*
503 The window system, must be one of: (Q_WS_x) 510 The window system, must be one of: (Q_WS_x)
504 511
505 MACX- Mac OS X 512 MACX- Mac OS X
506 MAC9- Mac OS 9 513 MAC9- Mac OS 9
507 QWS- Qt/Embedded 514 QWS- Qt/Embedded
508 WIN32- Windows 515 WIN32- Windows
509 X11- X Window System 516 X11- X Window System
510 PM - unsupported 517 PM - unsupported
511 WIN16- unsupported 518 WIN16- unsupported
512*/ 519*/
513 520
514#if defined(Q_OS_MAC9) 521#if defined(Q_OS_MAC9)
515# define Q_WS_MAC9 522# define Q_WS_MAC9
516#elif defined(Q_OS_MSDOS) 523#elif defined(Q_OS_MSDOS)
517# define Q_WS_WIN16 524# define Q_WS_WIN16
518# error "Qt requires Win32 and does not work with Windows 3.x" 525# error "Qt requires Win32 and does not work with Windows 3.x"
519#elif defined(_WIN32_X11_) 526#elif defined(_WIN32_X11_)
520# define Q_WS_X11 527# define Q_WS_X11
521#elif defined(Q_OS_WIN32) 528#elif defined(Q_OS_WIN32)
522# define Q_WS_WIN32 529# define Q_WS_WIN32
523# if defined(Q_OS_WIN64) 530# if defined(Q_OS_WIN64)
524# define Q_WS_WIN64 531# define Q_WS_WIN64
525# endif 532# endif
526#elif defined(Q_OS_OS2) 533#elif defined(Q_OS_OS2)
527# define Q_WS_PM 534# define Q_WS_PM
528# error "Qt does not work with OS/2 Presentation Manager or Workplace Shell" 535# error "Qt does not work with OS/2 Presentation Manager or Workplace Shell"
529#elif defined(Q_OS_UNIX) 536#elif defined(Q_OS_UNIX)
530# if defined(QWS) 537# if defined(QWS)
531# define Q_WS_QWS 538# define Q_WS_QWS
532# define QT_NO_QWS_IM 539# define QT_NO_QWS_IM
533# elif defined(Q_OS_MACX) 540# elif defined(Q_OS_MACX)
534# define Q_WS_MACX 541# define Q_WS_MACX
535# else 542# else
536# define Q_WS_X11 543# define Q_WS_X11
537# endif 544# endif
538#endif 545#endif
539#if defined(Q_OS_MAC) && !defined(QMAC_PASCAL) 546#if defined(Q_OS_MAC) && !defined(QMAC_PASCAL)
540# define QMAC_PASCAL 547# define QMAC_PASCAL
541#endif 548#endif
542 549
543#if defined(Q_WS_WIN16) || defined(Q_WS_WIN32) 550#if defined(Q_WS_WIN16) || defined(Q_WS_WIN32)
544# define Q_WS_WIN 551# define Q_WS_WIN
545#endif 552#endif
546 553
547#if (defined(Q_WS_MAC9) || defined(Q_WS_MACX)) && !defined(Q_WS_QWS) && !defined(Q_WS_X11) 554#if (defined(Q_WS_MAC9) || defined(Q_WS_MACX)) && !defined(Q_WS_QWS) && !defined(Q_WS_X11)
548# define Q_WS_MAC 555# define Q_WS_MAC
549#endif 556#endif
550 557
551 558
552/* 559/*
553 Some classes do not permit copies to be made of an object. 560 Some classes do not permit copies to be made of an object.
554 These classes contains a private copy constructor and operator= 561 These classes contains a private copy constructor and operator=
555 to disable copying (the compiler gives an error message). 562 to disable copying (the compiler gives an error message).
556 Undefine Q_DISABLE_COPY to turn off this checking. 563 Undefine Q_DISABLE_COPY to turn off this checking.
557*/ 564*/
558 565
559#define Q_DISABLE_COPY 566#define Q_DISABLE_COPY
560 567
561#if defined(__cplusplus) 568#if defined(__cplusplus)
562 569
563 570
564// 571//
565// Useful type definitions for Qt 572// Useful type definitions for Qt
566// 573//
567 574
568#if defined(Q_NO_BOOL_TYPE) 575#if defined(Q_NO_BOOL_TYPE)
569#if defined(Q_CC_HP) 576#if defined(Q_CC_HP)
570// bool is an unsupported reserved keyword in later versions 577// bool is an unsupported reserved keyword in later versions
571#define bool int 578#define bool int
572#else 579#else
573typedef int bool; 580typedef int bool;
574#endif 581#endif
575#endif 582#endif
576 583
577typedef unsigned char uchar; 584typedef unsigned char uchar;
578typedef unsigned short ushort; 585typedef unsigned short ushort;
579 typedef unsigneduint; 586 typedef unsigneduint;
580typedef unsigned long ulong; 587typedef unsigned long ulong;
581 typedef char *pchar; 588 typedef char *pchar;
582 typedef uchar *puchar; 589 typedef uchar *puchar;
583typedef const char *pcchar; 590typedef const char *pcchar;
584 591
585 592
586// 593//
587// Constant bool values 594// Constant bool values
588// 595//
589 596
590#ifndef TRUE 597#ifndef TRUE
591const bool FALSE = 0; 598const bool FALSE = 0;
592const bool TRUE = !0; 599const bool TRUE = !0;
593#endif 600#endif
594#if defined(__WATCOMC__) 601#if defined(__WATCOMC__)
595# if defined(Q_OS_QNX4) 602# if defined(Q_OS_QNX4)
596const bool false = FALSE; 603const bool false = FALSE;
597const bool true = TRUE; 604const bool true = TRUE;
598# endif 605# endif
599#endif 606#endif
600 607
601 608
602// 609//
603// Use the "explicit" keyword on platforms that support it. 610// Use the "explicit" keyword on platforms that support it.
604// 611//
605 612
606#if !defined(Q_NO_EXPLICIT_KEYWORD) 613#if !defined(Q_NO_EXPLICIT_KEYWORD)
607# define Q_EXPLICIT explicit 614# define Q_EXPLICIT explicit
608#else 615#else
609# define Q_EXPLICIT 616# define Q_EXPLICIT
610#endif 617#endif
611 618
612 619
613// 620//
614// Workaround for static const members on MSVC++. 621// Workaround for static const members on MSVC++.
615// 622//
616 623
617#if defined(Q_CC_MSVC) 624#if defined(Q_CC_MSVC)
618# define QT_STATIC_CONST static 625# define QT_STATIC_CONST static
619# define QT_STATIC_CONST_IMPL 626# define QT_STATIC_CONST_IMPL
620#else 627#else
621# define QT_STATIC_CONST static const 628# define QT_STATIC_CONST static const
622# define QT_STATIC_CONST_IMPL const 629# define QT_STATIC_CONST_IMPL const
623#endif 630#endif
624 631
625 632
626// 633//
627// Utility macros and inline functions 634// Utility macros and inline functions
628// 635//
629 636
630 #define QMAX(a, b)((b) < (a) ? (a) : (b)) 637 #define QMAX(a, b)((b) < (a) ? (a) : (b))
631 #define QMIN(a, b)((a) < (b) ? (a) : (b)) 638 #define QMIN(a, b)((a) < (b) ? (a) : (b))
632 #define QABS(a)((a) >= 0 ? (a) : -(a)) 639 #define QABS(a)((a) >= 0 ? (a) : -(a))
633 640
634inline int qRound( double d ) 641inline int qRound( double d )
635{ 642{
636 return d >= 0.0 ? int(d + 0.5) : int( d - ((int)d-1) + 0.5 ) + ((int)d-1); 643 return d >= 0.0 ? int(d + 0.5) : int( d - ((int)d-1) + 0.5 ) + ((int)d-1);
637} 644}
638 645
639 646
640// 647//
641// Size-dependent types (architechture-dependent byte order) 648// Size-dependent types (architechture-dependent byte order)
642// 649//
643 650
644#if !defined(QT_CLEAN_NAMESPACE) 651#if !defined(QT_CLEAN_NAMESPACE)
645// source compatibility with Qt 1.x 652// source compatibility with Qt 1.x
646 typedef signed char INT8; // 8 bit signed 653 typedef signed char INT8; // 8 bit signed
647 typedef unsigned char UINT8; // 8 bit unsigned 654 typedef unsigned char UINT8; // 8 bit unsigned
648 typedef short INT16; // 16 bit signed 655 typedef short INT16; // 16 bit signed
649 typedef unsigned short UINT16; // 16 bit unsigned 656 typedef unsigned short UINT16; // 16 bit unsigned
650 typedef int INT32; // 32 bit signed 657 typedef int INT32; // 32 bit signed
651 typedef unsigned int UINT32; // 32 bit unsigned 658 typedef unsigned int UINT32; // 32 bit unsigned
652#endif 659#endif
653 660
654 typedef signed char Q_INT8; // 8 bit signed 661 typedef signed char Q_INT8; // 8 bit signed
655 typedef unsigned char Q_UINT8;// 8 bit unsigned 662 typedef unsigned char Q_UINT8;// 8 bit unsigned
656 typedef short Q_INT16;// 16 bit signed 663 typedef short Q_INT16;// 16 bit signed
657 typedef unsigned short Q_UINT16;// 16 bit unsigned 664 typedef unsigned short Q_UINT16;// 16 bit unsigned
658 typedef int Q_INT32;// 32 bit signed 665 typedef int Q_INT32;// 32 bit signed
659 typedef unsigned int Q_UINT32;// 32 bit unsigned 666 typedef unsigned int Q_UINT32;// 32 bit unsigned
660#if defined(Q_OS_WIN64) 667#if defined(Q_OS_WIN64)
661// LLP64 64-bit model on Windows 668// LLP64 64-bit model on Windows
662 typedef __int64 Q_LONG; // word up to 64 bit signed 669 typedef __int64 Q_LONG; // word up to 64 bit signed
663 typedef unsigned __int64 Q_ULONG;// word up to 64 bit unsigned 670 typedef unsigned __int64 Q_ULONG;// word up to 64 bit unsigned
664#else 671#else
665// LP64 64-bit model on Linux 672// LP64 64-bit model on Linux
666 typedef long Q_LONG; 673 typedef long Q_LONG;
667 typedef unsigned long Q_ULONG; 674 typedef unsigned long Q_ULONG;
668#endif 675#endif
669 676
670#if !defined(QT_CLEAN_NAMESPACE) 677#if !defined(QT_CLEAN_NAMESPACE)
671// mininum size of 64 bits is not guaranteed 678// mininum size of 64 bits is not guaranteed
672 #define Q_INT64 Q_LONG 679 #define Q_INT64 Q_LONG
673 #define Q_UINT64 Q_ULONG 680 #define Q_UINT64 Q_ULONG
674#endif 681#endif
675 682
676#if defined(Q_OS_MACX) && !defined(QT_LARGEFILE_SUPPORT) 683#if defined(Q_OS_MACX) && !defined(QT_LARGEFILE_SUPPORT)
677# define QT_LARGEFILE_SUPPORT 64 684# define QT_LARGEFILE_SUPPORT 64
678#endif 685#endif
679#if defined(QT_LARGEFILE_SUPPORT) 686#if defined(QT_LARGEFILE_SUPPORT)
680 typedef unsigned long long QtOffset; 687 typedef unsigned long long QtOffset;
681#else 688#else
682 typedef Q_ULONG QtOffset; 689 typedef Q_ULONG QtOffset;
683#endif 690#endif
684 691
685 692
686// 693//
687// Data stream functions is provided by many classes (defined in qdatastream.h) 694// Data stream functions is provided by many classes (defined in qdatastream.h)
688// 695//
689 696
690class QDataStream; 697class QDataStream;
691 698
692 699
693// 700//
694// Feature subsetting 701// Feature subsetting
695// 702//
696// Note that disabling some features will produce a libqt that is not 703// Note that disabling some features will produce a libqt that is not
697// compatible with other libqt builds. Such modifications are only 704// compatible with other libqt builds. Such modifications are only
698// supported on Qt/Embedded where reducing the library size is important 705// supported on Qt/Embedded where reducing the library size is important
699// and where the application-suite is often a fixed set. 706// and where the application-suite is often a fixed set.
700// 707//
701 708
702#if !defined(QT_MOC) 709#if !defined(QT_MOC)
703#if defined(QCONFIG_LOCAL) 710#if defined(QCONFIG_LOCAL)
704#include <qconfig-local.h> 711#include <qconfig-local.h>
705#elif defined(QCONFIG_MINIMAL) 712#elif defined(QCONFIG_MINIMAL)
706#include <qconfig-minimal.h> 713#include <qconfig-minimal.h>
707#elif defined(QCONFIG_SMALL) 714#elif defined(QCONFIG_SMALL)
708#include <qconfig-small.h> 715#include <qconfig-small.h>
709#elif defined(QCONFIG_MEDIUM) 716#elif defined(QCONFIG_MEDIUM)
710#include <qconfig-medium.h> 717#include <qconfig-medium.h>
711#elif defined(QCONFIG_LARGE) 718#elif defined(QCONFIG_LARGE)
712#include <qconfig-large.h> 719#include <qconfig-large.h>
713#else // everything... 720#else // everything...
714#include <qconfig.h> 721#include <qconfig.h>
715#endif 722#endif
716#endif 723#endif
717 724
718 725
719#ifndef QT_BUILD_KEY 726#ifndef QT_BUILD_KEY
720#define QT_BUILD_KEY "unspecified" 727#define QT_BUILD_KEY "unspecified"
721#endif 728#endif
722 729
723// prune to local config 730// prune to local config
724#include "qmodules.h" 731#include "qmodules.h"
725#ifndef QT_MODULE_ICONVIEW 732#ifndef QT_MODULE_ICONVIEW
726# define QT_NO_ICONVIEW 733# define QT_NO_ICONVIEW
727#endif 734#endif
728#ifndef QT_MODULE_WORKSPACE 735#ifndef QT_MODULE_WORKSPACE
729# define QT_NO_WORKSPACE 736# define QT_NO_WORKSPACE
730#endif 737#endif
731#ifndef QT_MODULE_NETWORK 738#ifndef QT_MODULE_NETWORK
732#define QT_NO_NETWORK 739#define QT_NO_NETWORK
733#endif 740#endif
734#ifndef QT_MODULE_CANVAS 741#ifndef QT_MODULE_CANVAS
735# define QT_NO_CANVAS 742# define QT_NO_CANVAS
736#endif 743#endif
737#ifndef QT_MODULE_TABLE 744#ifndef QT_MODULE_TABLE
738#define QT_NO_TABLE 745#define QT_NO_TABLE
739#endif 746#endif
740#ifndef QT_MODULE_XML 747#ifndef QT_MODULE_XML
741# define QT_NO_XML 748# define QT_NO_XML
742#endif 749#endif
743#ifndef QT_MODULE_OPENGL 750#ifndef QT_MODULE_OPENGL
744# define QT_NO_OPENGL 751# define QT_NO_OPENGL
745#endif 752#endif
746#if !defined(QT_MODULE_SQL) 753#if !defined(QT_MODULE_SQL)
747# define QT_NO_SQL 754# define QT_NO_SQL
748#endif 755#endif
749 756
750#if defined(Q_WS_MAC9) 757#if defined(Q_WS_MAC9)
751//No need for menu merging 758//No need for menu merging
752# ifndef QMAC_QMENUBAR_NO_MERGE 759# ifndef QMAC_QMENUBAR_NO_MERGE
753# define QMAC_QMENUBAR_NO_MERGE 760# define QMAC_QMENUBAR_NO_MERGE
754# endif 761# endif
755//Mac9 does not use quartz 762//Mac9 does not use quartz
756# ifndef QMAC_NO_QUARTZ 763# ifndef QMAC_NO_QUARTZ
757# define QMAC_NO_QUARTZ 764# define QMAC_NO_QUARTZ
758# endif 765# endif
759# ifndef QMAC_QMENUBAR_NO_EVENT 766# ifndef QMAC_QMENUBAR_NO_EVENT
760# define QMAC_QMENUBAR_NO_EVENT 767# define QMAC_QMENUBAR_NO_EVENT
761# endif 768# endif
762#endif 769#endif
763#if defined(Q_WS_MACX) //for no nobody uses quartz, just putting in first level hooks 770#if defined(Q_WS_MACX) //for no nobody uses quartz, just putting in first level hooks
764# ifndef QMAC_NO_QUARTZ 771# ifndef QMAC_NO_QUARTZ
765# define QMAC_NO_QUARTZ 772# define QMAC_NO_QUARTZ
766# endif 773# endif
767# ifndef QMAC_QMENUBAR_NO_EVENT 774# ifndef QMAC_QMENUBAR_NO_EVENT
768# define QMAC_QMENUBAR_NO_EVENT 775# define QMAC_QMENUBAR_NO_EVENT
769# endif 776# endif
770#endif 777#endif
771 778
772#if !defined(Q_WS_QWS) && !defined(QT_NO_COP) 779#if !defined(Q_WS_QWS) && !defined(QT_NO_COP)
773# define QT_NO_COP 780# define QT_NO_COP
774#endif 781#endif
775 782
776#ifndef QT_H 783#ifndef QT_H
777#include <qfeatures.h> 784#include <qfeatures.h>
778#endif // QT_H 785#endif // QT_H
779 786
780 787
781// 788//
782// Create Qt DLL if QT_DLL is defined (Windows only) 789// Create Qt DLL if QT_DLL is defined (Windows only)
783// or QT_SHARED is defined (Kylix only) 790// or QT_SHARED is defined (Kylix only)
784// 791//
785 792
786#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) 793#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64)
787# if defined(QT_NODLL) 794# if defined(QT_NODLL)
788# undef QT_MAKEDLL 795# undef QT_MAKEDLL
789# undef QT_DLL 796# undef QT_DLL
790 # elif defined(QT_MAKEDLL)/* create a Qt DLL library */ 797 # elif defined(QT_MAKEDLL)/* create a Qt DLL library */
791# if defined(QT_DLL) 798# if defined(QT_DLL)
792# undef QT_DLL 799# undef QT_DLL
793# endif 800# endif
794# define Q_EXPORT __declspec(dllexport) 801# define Q_EXPORT __declspec(dllexport)
795# define Q_TEMPLATEDLL 802# define Q_TEMPLATEDLL
796# define Q_TEMPLATE_EXTERN 803# define Q_TEMPLATE_EXTERN
797 # undef Q_DISABLE_COPY/* avoid unresolved externals */ 804 # undef Q_DISABLE_COPY/* avoid unresolved externals */
798 # elif defined(QT_DLL) /* use a Qt DLL library */ 805 # elif defined(QT_DLL) /* use a Qt DLL library */
799# define Q_EXPORT __declspec(dllimport) 806# define Q_EXPORT __declspec(dllimport)
800# define Q_TEMPLATEDLL 807# define Q_TEMPLATEDLL
801# ifndef Q_TEMPLATE_EXTERN 808# ifndef Q_TEMPLATE_EXTERN
802# if defined(Q_CC_MSVC_NET) 809# if defined(Q_CC_MSVC_NET)
803# define Q_TEMPLATE_EXTERN extern 810# define Q_TEMPLATE_EXTERN extern
804# else 811# else
805# define Q_TEMPLATE_EXTERN 812# define Q_TEMPLATE_EXTERN
806# endif 813# endif
807# endif 814# endif
808 # undef Q_DISABLE_COPY/* avoid unresolved externals */ 815 # undef Q_DISABLE_COPY/* avoid unresolved externals */
809# endif 816# endif
810#elif defined(Q_OS_LINUX) && defined(Q_CC_BOR) 817#elif defined(Q_OS_LINUX) && defined(Q_CC_BOR)
811 # if defined(QT_SHARED)/* create a Qt shared library */ 818 # if defined(QT_SHARED)/* create a Qt shared library */
812# define Q_EXPORT __declspec(dllexport) 819# define Q_EXPORT __declspec(dllexport)
813# define Q_TEMPLATEDLL 820# define Q_TEMPLATEDLL
814# define Q_TEMPLATE_EXTERN 821# define Q_TEMPLATE_EXTERN
815 # undef Q_DISABLE_COPY/* avoid unresolved externals */ 822 # undef Q_DISABLE_COPY/* avoid unresolved externals */
816# else 823# else
817# define Q_TEMPLATEDLL 824# define Q_TEMPLATEDLL
818# define Q_TEMPLATE_EXTERN 825# define Q_TEMPLATE_EXTERN
819 # undef Q_DISABLE_COPY /* avoid unresolved externals */ 826 # undef Q_DISABLE_COPY /* avoid unresolved externals */
820# endif 827# endif
821#else 828#else
822 # undef QT_MAKEDLL /* ignore these for other platforms */ 829 # undef QT_MAKEDLL /* ignore these for other platforms */
823# undef QT_DLL 830# undef QT_DLL
824#endif 831#endif
825 832
826#ifndef Q_EXPORT 833#ifndef Q_EXPORT
827# define Q_EXPORT 834# define Q_EXPORT
828#endif 835#endif
829 836
830 837
831// 838//
832// Some platform specific stuff 839// Some platform specific stuff
833// 840//
834 841
835#if defined(Q_WS_WIN) 842#if defined(Q_WS_WIN)
836extern Q_EXPORT bool qt_winunicode; 843extern Q_EXPORT bool qt_winunicode;
837#endif 844#endif
838 845
839 846
840// 847//
841// System information 848// System information
842// 849//
843 850
844Q_EXPORT const char *qVersion(); 851Q_EXPORT const char *qVersion();
845Q_EXPORT bool qSysInfo( int *wordSize, bool *bigEndian ); 852Q_EXPORT bool qSysInfo( int *wordSize, bool *bigEndian );
846#if defined(Q_OS_MAC) 853#if defined(Q_OS_MAC)
847int qMacVersion(); 854int qMacVersion();
848#elif defined(Q_WS_WIN) 855#elif defined(Q_WS_WIN)
849Q_EXPORT int qWinVersion(); 856Q_EXPORT int qWinVersion();
850#if defined(UNICODE) 857#if defined(UNICODE)
851#define QT_WA( uni, ansi ) if ( qt_winunicode ) { uni } else { ansi } 858#define QT_WA( uni, ansi ) if ( qt_winunicode ) { uni } else { ansi }
852#define QT_WA_INLINE( uni, ansi ) ( qt_winunicode ? uni : ansi ) 859#define QT_WA_INLINE( uni, ansi ) ( qt_winunicode ? uni : ansi )
853#else 860#else
854#define QT_WA( uni, ansi ) ansi 861#define QT_WA( uni, ansi ) ansi
855#define QT_WA_INLINE( uni, ansi ) ansi 862#define QT_WA_INLINE( uni, ansi ) ansi
856#endif 863#endif
857#endif 864#endif
858 865
859#ifdef Q_OS_TEMP 866#ifdef Q_OS_TEMP
860#ifdef QT_WA 867#ifdef QT_WA
861#undef QT_WA 868#undef QT_WA
862#undef QT_WA_INLINE 869#undef QT_WA_INLINE
863#endif 870#endif
864#define QT_WA( uni, ansi ) uni 871#define QT_WA( uni, ansi ) uni
865#define QT_WA_INLINE( uni, ansi ) ( uni ) 872#define QT_WA_INLINE( uni, ansi ) ( uni )
866#endif 873#endif
867 874
868#ifndef Q_INLINE_TEMPLATES 875#ifndef Q_INLINE_TEMPLATES
869# define Q_INLINE_TEMPLATES 876# define Q_INLINE_TEMPLATES
870#endif 877#endif
871 878
872#ifndef Q_TYPENAME 879#ifndef Q_TYPENAME
873# define Q_TYPENAME typename 880# define Q_TYPENAME typename
874#endif 881#endif
875 882
876// 883//
877// Use to avoid "unused parameter" warnings 884// Use to avoid "unused parameter" warnings
878// 885//
879 886
880#define Q_UNUSED(x) (void)x; 887#define Q_UNUSED(x) (void)x;
881 888
882// 889//
883// Debugging and error handling 890// Debugging and error handling
884// 891//
885 892
886#if !defined(QT_NO_CHECK) 893#if !defined(QT_NO_CHECK)
887 # define QT_CHECK_STATE // check state of objects etc. 894 # define QT_CHECK_STATE // check state of objects etc.
888 # define QT_CHECK_RANGE // check range of indexes etc. 895 # define QT_CHECK_RANGE // check range of indexes etc.
889 # define QT_CHECK_NULL // check null pointers 896 # define QT_CHECK_NULL // check null pointers
890 # define QT_CHECK_MATH // check math functions 897 # define QT_CHECK_MATH // check math functions
891#endif 898#endif
892 899
893#if !defined(QT_NO_DEBUG) && !defined(QT_DEBUG) 900#if !defined(QT_NO_DEBUG) && !defined(QT_DEBUG)
894 # define QT_DEBUG // display debug messages 901 # define QT_DEBUG // display debug messages
895 # if !defined(QT_NO_COMPAT) // compatibility with Qt 2 902 # if !defined(QT_NO_COMPAT) // compatibility with Qt 2
896# if !defined(NO_DEBUG) && !defined(DEBUG) 903# if !defined(NO_DEBUG) && !defined(DEBUG)
897 # if !defined(Q_OS_MACX) // clash with MacOS X headers 904 # if !defined(Q_OS_MACX) // clash with MacOS X headers
898# define DEBUG 905# define DEBUG
899# endif 906# endif
900# endif 907# endif
901# endif 908# endif
902#endif 909#endif
903 910
904 911
905 Q_EXPORT void qDebug( const char *, ... )// print debug message 912 Q_EXPORT void qDebug( const char *, ... )// print debug message
906#if defined(Q_CC_GNU) && !defined(__INSURE__) 913#if defined(Q_CC_GNU) && !defined(__INSURE__)
907 __attribute__ ((format (printf, 1, 2))) 914 __attribute__ ((format (printf, 1, 2)))
908#endif 915#endif
909; 916;
910 917
911 Q_EXPORT void qWarning( const char *, ... )// print warning message 918 Q_EXPORT void qWarning( const char *, ... )// print warning message
912#if defined(Q_CC_GNU) && !defined(__INSURE__) 919#if defined(Q_CC_GNU) && !defined(__INSURE__)
913 __attribute__ ((format (printf, 1, 2))) 920 __attribute__ ((format (printf, 1, 2)))
914#endif 921#endif
915; 922;
916 923
917 Q_EXPORT void qFatal( const char *, ... )// print fatal message and exit 924 Q_EXPORT void qFatal( const char *, ... )// print fatal message and exit
918#if defined(Q_CC_GNU) 925#if defined(Q_CC_GNU)
919 __attribute__ ((format (printf, 1, 2))) 926 __attribute__ ((format (printf, 1, 2)))
920#endif 927#endif
921; 928;
922 929
923Q_EXPORT void qSystemWarning( const char *, int code = -1 ); 930Q_EXPORT void qSystemWarning( const char *, int code = -1 );
924 931
925 #if !defined(QT_CLEAN_NAMESPACE) // compatibility with Qt 1 932 #if !defined(QT_CLEAN_NAMESPACE) // compatibility with Qt 1
926 933
927 Q_EXPORT void debug( const char *, ... )// print debug message 934 Q_EXPORT void debug( const char *, ... )// print debug message
928#if defined(Q_CC_GNU) && !defined(__INSURE__) 935#if defined(Q_CC_GNU) && !defined(__INSURE__)
929 __attribute__ ((format (printf, 1, 2))) 936 __attribute__ ((format (printf, 1, 2)))
930#endif 937#endif
931; 938;
932 939
933 Q_EXPORT void warning( const char *, ... )// print warning message 940 Q_EXPORT void warning( const char *, ... )// print warning message
934#if defined(Q_CC_GNU) && !defined(__INSURE__) 941#if defined(Q_CC_GNU) && !defined(__INSURE__)
935 __attribute__ ((format (printf, 1, 2))) 942 __attribute__ ((format (printf, 1, 2)))
936#endif 943#endif
937; 944;
938 945
939 Q_EXPORT void fatal( const char *, ... )// print fatal message and exit 946 Q_EXPORT void fatal( const char *, ... )// print fatal message and exit
940#if defined(Q_CC_GNU) && !defined(__INSURE__) 947#if defined(Q_CC_GNU) && !defined(__INSURE__)
941 __attribute__ ((format (printf, 1, 2))) 948 __attribute__ ((format (printf, 1, 2)))
942#endif 949#endif
943; 950;
944 951
945#endif // QT_CLEAN_NAMESPACE 952#endif // QT_CLEAN_NAMESPACE
946 953
947 954
948#if !defined(Q_ASSERT) 955#if !defined(Q_ASSERT)
949# if defined(QT_CHECK_STATE) 956# if defined(QT_CHECK_STATE)
950# if defined(QT_FATAL_ASSERT) 957# if defined(QT_FATAL_ASSERT)
951# define Q_ASSERT(x) ((x) ? (void)0 : qFatal("ASSERT: \"%s\" in %s (%d)",#x,__FILE__,__LINE__)) 958# define Q_ASSERT(x) ((x) ? (void)0 : qFatal("ASSERT: \"%s\" in %s (%d)",#x,__FILE__,__LINE__))
952# else 959# else
953# define Q_ASSERT(x) ((x) ? (void)0 : qWarning("ASSERT: \"%s\" in %s (%d)",#x,__FILE__,__LINE__)) 960# define Q_ASSERT(x) ((x) ? (void)0 : qWarning("ASSERT: \"%s\" in %s (%d)",#x,__FILE__,__LINE__))
954# endif 961# endif
955# else 962# else
956# define Q_ASSERT(x) 963# define Q_ASSERT(x)
957# endif 964# endif
958#endif 965#endif
959 966
960 #if !defined(QT_NO_COMPAT) // compatibility with Qt 2 967 #if !defined(QT_NO_COMPAT) // compatibility with Qt 2
961# if !defined(ASSERT) 968# if !defined(ASSERT)
962# if !defined(Q_OS_TEMP) 969# if !defined(Q_OS_TEMP)
963# define ASSERT(x) Q_ASSERT(x) 970# define ASSERT(x) Q_ASSERT(x)
964# endif 971# endif
965# endif 972# endif
966#endif // QT_NO_COMPAT 973#endif // QT_NO_COMPAT
967 974
968 975
969Q_EXPORT bool qt_check_pointer( bool c, const char *, int ); 976Q_EXPORT bool qt_check_pointer( bool c, const char *, int );
970 977
971#if defined(QT_CHECK_NULL) 978#if defined(QT_CHECK_NULL)
972# define Q_CHECK_PTR(p) (qt_check_pointer((p)==0,__FILE__,__LINE__)) 979# define Q_CHECK_PTR(p) (qt_check_pointer((p)==0,__FILE__,__LINE__))
973#else 980#else
974# define Q_CHECK_PTR(p) 981# define Q_CHECK_PTR(p)
975#endif 982#endif
976 983
977 #if !defined(QT_NO_COMPAT) // compatibility with Qt 2 984 #if !defined(QT_NO_COMPAT) // compatibility with Qt 2
978# if !defined(CHECK_PTR) 985# if !defined(CHECK_PTR)
979# define CHECK_PTR(x) Q_CHECK_PTR(x) 986# define CHECK_PTR(x) Q_CHECK_PTR(x)
980# endif 987# endif
981#endif // QT_NO_COMPAT 988#endif // QT_NO_COMPAT
982 989
983enum QtMsgType { QtDebugMsg, QtWarningMsg, QtFatalMsg }; 990enum QtMsgType { QtDebugMsg, QtWarningMsg, QtFatalMsg };
984 991
985typedef void (*QtMsgHandler)(QtMsgType, const char *); 992typedef void (*QtMsgHandler)(QtMsgType, const char *);
986Q_EXPORT QtMsgHandler qInstallMsgHandler( QtMsgHandler ); 993Q_EXPORT QtMsgHandler qInstallMsgHandler( QtMsgHandler );
987 994
988 #if !defined(QT_NO_COMPAT) // compatibility with Qt 2 995 #if !defined(QT_NO_COMPAT) // compatibility with Qt 2
989typedef QtMsgHandler msg_handler; 996typedef QtMsgHandler msg_handler;
990#endif // QT_NO_COMPAT 997#endif // QT_NO_COMPAT
991 998
992Q_EXPORT void qSuppressObsoleteWarnings( bool = TRUE ); 999Q_EXPORT void qSuppressObsoleteWarnings( bool = TRUE );
993 1000
994Q_EXPORT void qObsolete( const char *obj, const char *oldfunc, 1001Q_EXPORT void qObsolete( const char *obj, const char *oldfunc,
995 const char *newfunc ); 1002 const char *newfunc );
996Q_EXPORT void qObsolete( const char *obj, const char *oldfunc ); 1003Q_EXPORT void qObsolete( const char *obj, const char *oldfunc );
997Q_EXPORT void qObsolete( const char *message ); 1004Q_EXPORT void qObsolete( const char *message );
998 1005
999 1006
1000// 1007//
1001// Install paths from configure 1008// Install paths from configure
1002// 1009//
1003 1010
1004Q_EXPORT const char *qInstallPath(); 1011Q_EXPORT const char *qInstallPath();
1005Q_EXPORT const char *qInstallPathDocs(); 1012Q_EXPORT const char *qInstallPathDocs();
1006Q_EXPORT const char *qInstallPathHeaders(); 1013Q_EXPORT const char *qInstallPathHeaders();
1007Q_EXPORT const char *qInstallPathLibs(); 1014Q_EXPORT const char *qInstallPathLibs();
1008Q_EXPORT const char *qInstallPathBins(); 1015Q_EXPORT const char *qInstallPathBins();
1009Q_EXPORT const char *qInstallPathPlugins(); 1016Q_EXPORT const char *qInstallPathPlugins();
1010Q_EXPORT const char *qInstallPathData(); 1017Q_EXPORT const char *qInstallPathData();
1011 1018
1012#endif // __cplusplus 1019#endif // __cplusplus
1013 1020
1014// compilers which follow outdated template instantiation rules 1021// compilers which follow outdated template instantiation rules
1015// require a class to have a comparison operator to exist when 1022// require a class to have a comparison operator to exist when
1016// a QValueList of this type is instantiated. It's not actually 1023// a QValueList of this type is instantiated. It's not actually
1017// used in the list, though. Hence the dummy implementation. 1024// used in the list, though. Hence the dummy implementation.
1018// Just in case other code relies on it we better trigger a warning 1025// Just in case other code relies on it we better trigger a warning
1019// mandating a real implementation. 1026// mandating a real implementation.
1020#ifdef Q_FULL_TEMPLATE_INSTANTIATION 1027#ifdef Q_FULL_TEMPLATE_INSTANTIATION
1021# define Q_DUMMY_COMPARISON_OPERATOR(C) \ 1028# define Q_DUMMY_COMPARISON_OPERATOR(C) \
1022 bool operator==( const C& ) const { \ 1029 bool operator==( const C& ) const { \
1023 qWarning( #C"::operator==( const "#C"& ) got called." ); \ 1030 qWarning( #C"::operator==( const "#C"& ) got called." ); \
1024 return FALSE; \ 1031 return FALSE; \
1025 } 1032 }
1026#else 1033#else
1027# define Q_DUMMY_COMPARISON_OPERATOR(C) 1034# define Q_DUMMY_COMPARISON_OPERATOR(C)
1028#endif 1035#endif
1029 1036
1030#endif // QGLOBAL_H 1037#endif // QGLOBAL_H
1031 1038
1032// 1039//
1033// Avoid some particularly useless warnings from some stupid compilers. 1040// Avoid some particularly useless warnings from some stupid compilers.
1034// To get ALL C++ compiler warnings, define QT_CC_WARNINGS or comment out 1041// To get ALL C++ compiler warnings, define QT_CC_WARNINGS or comment out
1035// the line "#define QT_NO_WARNINGS" 1042// the line "#define QT_NO_WARNINGS"
1036// 1043//
1037 1044
1038#if !defined(QT_CC_WARNINGS) 1045#if !defined(QT_CC_WARNINGS)
1039# define QT_NO_WARNINGS 1046# define QT_NO_WARNINGS
1040#endif 1047#endif
1041#if defined(QT_NO_WARNINGS) 1048#if defined(QT_NO_WARNINGS)
1042# if defined(Q_CC_MSVC) 1049# if defined(Q_CC_MSVC)
1043# pragma warning(disable: 4244) // 'conversion' conversion from 'type1' to 'type2', possible loss of data 1050# pragma warning(disable: 4244) // 'conversion' conversion from 'type1' to 'type2', possible loss of data
1044# pragma warning(disable: 4275) // non - DLL-interface classkey 'identifier' used as base for DLL-interface classkey 'identifier' 1051# pragma warning(disable: 4275) // non - DLL-interface classkey 'identifier' used as base for DLL-interface classkey 'identifier'
1045# pragma warning(disable: 4514) // unreferenced inline/local function has been removed 1052# pragma warning(disable: 4514) // unreferenced inline/local function has been removed
1046# pragma warning(disable: 4800) // 'type' : forcing value to bool 'true' or 'false' (performance warning) 1053# pragma warning(disable: 4800) // 'type' : forcing value to bool 'true' or 'false' (performance warning)
1047# pragma warning(disable: 4097) // typedef-name 'identifier1' used as synonym for class-name 'identifier2' 1054# pragma warning(disable: 4097) // typedef-name 'identifier1' used as synonym for class-name 'identifier2'
1048# pragma warning(disable: 4706) // assignment within conditional expression 1055# pragma warning(disable: 4706) // assignment within conditional expression
1049# pragma warning(disable: 4786) // truncating debug info after 255 characters 1056# pragma warning(disable: 4786) // truncating debug info after 255 characters
1050# pragma warning(disable: 4660) // template-class specialization 'identifier' is already instantiated 1057# pragma warning(disable: 4660) // template-class specialization 'identifier' is already instantiated
1051# pragma warning(disable: 4355) // 'this' : used in base member initializer list 1058# pragma warning(disable: 4355) // 'this' : used in base member initializer list
1052# pragma warning(disable: 4231) // nonstandard extension used : 'extern' before template explicit instantiation 1059# pragma warning(disable: 4231) // nonstandard extension used : 'extern' before template explicit instantiation
1053# pragma warning(disable: 4710) // function not inlined 1060# pragma warning(disable: 4710) // function not inlined
1054# elif defined(Q_CC_BOR) 1061# elif defined(Q_CC_BOR)
1055# pragma option -w-inl 1062# pragma option -w-inl
1056# pragma option -w-aus 1063# pragma option -w-aus
1057# pragma warn -inl 1064# pragma warn -inl
1058# pragma warn -pia 1065# pragma warn -pia
1059# pragma warn -ccc 1066# pragma warn -ccc
1060# pragma warn -rch 1067# pragma warn -rch
1061# pragma warn -sig 1068# pragma warn -sig
1062# elif defined(Q_CC_MWERKS) 1069# elif defined(Q_CC_MWERKS)
1063# pragma warn_possunwant off 1070# pragma warn_possunwant off
1064# endif 1071# endif
1065#endif 1072#endif
diff --git a/qt/qt-2.3.7.patch/qte237-all-macosx.patch b/qt/qt-2.3.7.patch/qte237-all-macosx.patch
new file mode 100644
index 0000000..82ed530
--- a/dev/null
+++ b/qt/qt-2.3.7.patch/qte237-all-macosx.patch
@@ -0,0 +1,1161 @@
1diff -ru qte-2.3.7_orig/include/qapplication.h qte-2.3.7/include/qapplication.h
2 --- qte-2.3.7_orig/include/qapplication.hThu Jul 17 03:20:25 2003
3 +++ qte-2.3.7/include/qapplication.hMon Oct 27 14:21:28 2003
4@@ -61,6 +61,10 @@
5 class QSemaphore;
6 #endif
7
8+#if !defined( QT_WEAK_SYMBOL )
9+#define QT_WEAK_SYMBOL
10+#endif
11+
12 // REMOVE IN 3.0 (just here for moc source compatibility)
13 #define QNonBaseApplication QApplication
14
15@@ -85,7 +89,10 @@
16
17 #ifndef QT_NO_STYLE
18 static QStyle &style();
19 - static void setStyle( QStyle* );
20 + static void setStyle( QStyle* ) QT_WEAK_SYMBOL;
21+private:
22 +static void setStyle_NonWeak( QStyle* );
23+public:
24 #endif
25 #if 1/* OBSOLETE */
26 enum ColorMode { NormalColors, CustomColors };
27@@ -106,11 +113,19 @@
28 #ifndef QT_NO_PALETTE
29 static QPalette palette( const QWidget* = 0 );
30 static void setPalette( const QPalette &, bool informWidgets=FALSE,
31 + const char* className = 0 ) QT_WEAK_SYMBOL;
32+private:
33 + static void setPalette_NonWeak( const QPalette &, bool informWidgets=FALSE,
34 const char* className = 0 );
35+public:
36 #endif
37 static QFont font( const QWidget* = 0 );
38 static void setFont( const QFont &, bool informWidgets=FALSE,
39 + const char* className = 0 ) QT_WEAK_SYMBOL;
40+private:
41 + static void setFont_NonWeak( const QFont &, bool informWidgets=FALSE,
42 const char* className = 0 );
43 +public:
44 static QFontMetrics fontMetrics();
45
46 QWidget *mainWidget() const;
47@@ -207,7 +222,10 @@
48 void qwsSetCustomColors( QRgb *colortable, int start, int numColors );
49 #ifndef QT_NO_QWS_MANAGER
50 static QWSDecoration &qwsDecoration();
51- static void qwsSetDecoration( QWSDecoration *);
52+ static void qwsSetDecoration( QWSDecoration *) QT_WEAK_SYMBOL;
53+private:
54+ static void qwsSetDecoration_NonWeak( QWSDecoration *);
55+public:
56 #endif
57 #endif
58
59Only in qte-2.3.7/include: qconfig-qpe.h
60diff -ru qte-2.3.7_orig/include/qconfig.h qte-2.3.7/include/qconfig.h
61 --- qte-2.3.7_orig/include/qconfig.hFri Jan 26 14:43:06 2001
62 +++ qte-2.3.7/include/qconfig.hWed Oct 29 22:13:16 2003
63@@ -1,3 +1,26 @@
64+// Copied from qconfig-qpe.h
65+/**********************************************************************
66+** Copyright (C) 2000 Trolltech AS. All rights reserved.
67+**
68+** This file is part of Qtopia Environment.
69+**
70+** This file may be distributed and/or modified under the terms of the
71+** GNU General Public License version 2 as published by the Free Software
72+** Foundation and appearing in the file LICENSE.GPL included in the
73+** packaging of this file.
74+**
75+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
76+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
77+**
78+** See http://www.trolltech.com/gpl/ for GPL licensing information.
79+**
80+** Contact info@trolltech.com if any conditions of this licensing are
81+** not clear to you.
82+**
83+**********************************************************************/
84+#ifndef QT_H
85+#endif // QT_H
86+
87 // Empty leaves all features enabled. See doc/html/features.html for choices.
88
89 // Note that disabling some features will produce a libqt that is not
90@@ -8,3 +31,69 @@
91 #ifndef QT_DLL
92 #define QT_DLL // Internal
93 #endif
94+
95+#if defined(QT_QWS_IPAQ) || defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_SL5XXX)
96+# define QT_NO_QWS_CURSOR
97+# define QT_NO_QWS_MOUSE_AUTO
98+#endif
99+#ifndef QT_NO_CODECS
100+#define QT_NO_CODECS
101+#endif
102+#define QT_NO_UNICODETABLES
103+//#define QT_NO_IMAGEIO_BMP
104+#define QT_NO_IMAGEIO_PPM
105+//#define QT_NO_ASYNC_IO
106+//#define QT_NO_ASYNC_IMAGE_IO
107+#define QT_NO_FREETYPE
108+#define QT_NO_BDF
109+//#define QT_NO_FONTDATABASE
110+#define QT_NO_DRAGANDDROP
111+//#define QT_NO_CLIPBOARD
112+#define QT_NO_PROPERTIES
113+#define QT_NO_NETWORKPROTOCOL
114+
115+#define QT_NO_IMAGE_TEXT
116+
117+//#define QT_NO_TOOLTIP
118+#define QT_NO_COLORNAMES
119+#define QT_NO_TRANSFORMATIONS
120+#define QT_NO_TRANSLATION_BUILDER
121+#define QT_NO_COMPLEXTEXT
122+#define QT_NO_PRINTER
123+#define QT_NO_PICTURE
124+//#define QT_NO_ICONVIEW
125+#define QT_NO_DIAL
126+#define QT_NO_SIZEGRIP
127+#define QT_NO_WORKSPACE
128+//#define QT_NO_TABLE
129+//#define QT_NO_ACTION
130+//#define QT_NO_SETTINGS
131+#define QT_NO_STYLE_POCKETPC
132+#ifndef QT_NO_STYLE_AQUA
133+# define QT_NO_STYLE_AQUA
134+#endif
135+#define QT_NO_STYLE_MOTIF
136+#define QT_NO_STYLE_PLATINUM
137+#define QT_NO_FILEDIALOG
138+#define QT_NO_FONTDIALOG
139+#define QT_NO_PRINTDIALOG
140+#define QT_NO_COLORDIALOG
141+#define QT_NO_INPUTDIALOG
142+//#define QT_NO_MESSAGEBOX
143+#define QT_NO_PROGRESSDIALOG
144+//#define QT_NO_TABDIALOG
145+#define QT_NO_WIZARD
146+#define QT_NO_EFFECTS
147+//#define QT_NO_COMPONENT
148+#define QT_NO_DOM
149+#define QT_NO_SEMIMODAL
150+//#define QT_NO_PROGRESSBAR
151+#define QT_NO_SPLITTER
152+
153+//#define QT_NO_QWS_SAVEFONTS
154+//#define QT_NO_QWS_PROPERTIES
155+
156+#define QT_NO_QWS_BEOS_WM_STYLE
157+#define QT_NO_QWS_KDE2_WM_STYLE
158+#define QT_NO_QWS_KDE_WM_STYLE
159+#define QT_NO_QWS_WINDOWS_WM_STYLE
160diff -ru qte-2.3.7_orig/include/qfontdatabase.h qte-2.3.7/include/qfontdatabase.h
161 --- qte-2.3.7_orig/include/qfontdatabase.hThu Jul 17 03:20:25 2003
162 +++ qte-2.3.7/include/qfontdatabase.hMon Oct 27 14:21:28 2003
163@@ -59,6 +59,10 @@
164 class QDiskFont;
165 #endif
166
167+#if !defined( QT_WEAK_SYMBOL )
168+#define QT_WEAK_SYMBOL
169+#endif
170+
171 class QFontDatabasePrivate;
172
173 class Q_EXPORT QFontDatabase
174@@ -67,9 +71,16 @@
175 QFontDatabase();
176
177 QStringList families( bool onlyForLocale = TRUE ) const;
178+
179+
180 QValueList<int> pointSizes( const QString &family,
181 const QString &style = QString::null,
182 - const QString &charSet = QString::null );
183 + const QString &charSet = QString::null ) QT_WEAK_SYMBOL;
184+private:
185+ QValueList<int> pointSizes_NonWeak( const QString &family,
186 + const QString &style,
187 + const QString &charSet );
188+public:
189 QStringList styles( const QString &family,
190 const QString &charSet = QString::null ) const;
191 QStringList charSets( const QString &familyName,
192Only in qte-2.3.7_orig/include: qgifimageformat_p.h
193diff -ru qte-2.3.7_orig/include/qmodules.h qte-2.3.7/include/qmodules.h
194 --- qte-2.3.7_orig/include/qmodules.hFri Aug 31 17:00:56 2001
195 +++ qte-2.3.7/include/qmodules.hWed Oct 29 21:57:53 2003
196@@ -1,14 +1,12 @@
197-#ifndef QT_H
198-#endif // QT_H
199-
200+// These modules are licensed to you
201 #define QT_MODULE_TOOLS
202 #define QT_MODULE_KERNEL
203 #define QT_MODULE_WIDGETS
204 #define QT_MODULE_DIALOGS
205-
206 #define QT_MODULE_ICONVIEW
207 #define QT_MODULE_WORKSPACE
208-#define QT_MODULE_TABLE
209+#define QT_MODULE_NETWORK
210 #define QT_MODULE_CANVAS
211+#define QT_MODULE_TABLE
212 #define QT_MODULE_XML
213-#define QT_MODULE_NETWORK
214+#define QT_MODULE_OPENGL
215Only in qte-2.3.7_orig/include: qxt.h
216Only in qte-2.3.7/lib: libqte.dylib
217Only in qte-2.3.7/lib: libqte.dylib.2
218Only in qte-2.3.7/lib: libqte.dylib.2.3
219Only in qte-2.3.7/lib: libqte.dylib.2.3.7
220Only in qte-2.3.7/src/3rdparty/kernel: qgifimageformat.o
221Only in qte-2.3.7/src/3rdparty/kernel: qpointarray.o
222Only in qte-2.3.7/src/3rdparty/kernel: qpolygonscanner.o
223Only in qte-2.3.7/src/3rdparty/kernel: qregion_qws.o
224Only in qte-2.3.7/src/3rdparty/libpng: png.o
225Only in qte-2.3.7/src/3rdparty/libpng: pngerror.o
226Only in qte-2.3.7/src/3rdparty/libpng: pngget.o
227Only in qte-2.3.7/src/3rdparty/libpng: pngmem.o
228Only in qte-2.3.7/src/3rdparty/libpng: pngpread.o
229Only in qte-2.3.7/src/3rdparty/libpng: pngread.o
230Only in qte-2.3.7/src/3rdparty/libpng: pngrio.o
231Only in qte-2.3.7/src/3rdparty/libpng: pngrtran.o
232Only in qte-2.3.7/src/3rdparty/libpng: pngrutil.o
233Only in qte-2.3.7/src/3rdparty/libpng: pngset.o
234Only in qte-2.3.7/src/3rdparty/libpng: pngtrans.o
235Only in qte-2.3.7/src/3rdparty/libpng: pngwio.o
236Only in qte-2.3.7/src/3rdparty/libpng: pngwrite.o
237Only in qte-2.3.7/src/3rdparty/libpng: pngwtran.o
238Only in qte-2.3.7/src/3rdparty/libpng: pngwutil.o
239Only in qte-2.3.7/src/3rdparty/tools: qbig5codec.o
240Only in qte-2.3.7/src/3rdparty/tools: qeucjpcodec.o
241Only in qte-2.3.7/src/3rdparty/tools: qeuckrcodec.o
242Only in qte-2.3.7/src/3rdparty/tools: qgbkcodec.o
243Only in qte-2.3.7/src/3rdparty/tools: qjiscodec.o
244Only in qte-2.3.7/src/3rdparty/tools: qjpunicode.o
245Only in qte-2.3.7/src/3rdparty/tools: qrtlcodec.o
246Only in qte-2.3.7/src/3rdparty/tools: qsjiscodec.o
247Only in qte-2.3.7/src/3rdparty/tools: qtsciicodec.o
248Only in qte-2.3.7/src/3rdparty/zlib: Makefile
249Only in qte-2.3.7/src/3rdparty/zlib: adler32.o
250Only in qte-2.3.7/src/3rdparty/zlib: compress.o
251Only in qte-2.3.7/src/3rdparty/zlib: crc32.o
252Only in qte-2.3.7/src/3rdparty/zlib: deflate.o
253Only in qte-2.3.7/src/3rdparty/zlib: gzio.o
254Only in qte-2.3.7/src/3rdparty/zlib: infblock.o
255Only in qte-2.3.7/src/3rdparty/zlib: infcodes.o
256Only in qte-2.3.7/src/3rdparty/zlib: inffast.o
257Only in qte-2.3.7/src/3rdparty/zlib: inflate.o
258Only in qte-2.3.7/src/3rdparty/zlib: inftrees.o
259Only in qte-2.3.7/src/3rdparty/zlib: infutil.o
260Only in qte-2.3.7/src/3rdparty/zlib: trees.o
261Only in qte-2.3.7/src/3rdparty/zlib: uncompr.o
262Only in qte-2.3.7/src/3rdparty/zlib: zutil.o
263Only in qte-2.3.7/src: Makefile
264Only in qte-2.3.7/src: allmoc.cpp
265Only in qte-2.3.7/src: allmoc.o
266Only in qte-2.3.7/src/canvas: qcanvas.o
267Only in qte-2.3.7/src/dialogs: qcolordialog.moc
268Only in qte-2.3.7/src/dialogs: qcolordialog.o
269Only in qte-2.3.7/src/dialogs: qfiledialog.moc
270Only in qte-2.3.7/src/dialogs: qfiledialog.o
271Only in qte-2.3.7/src/dialogs: qfontdialog.o
272Only in qte-2.3.7/src/dialogs: qinputdialog.o
273Only in qte-2.3.7/src/dialogs: qmessagebox.o
274Only in qte-2.3.7/src/dialogs: qprintdialog.o
275Only in qte-2.3.7/src/dialogs: qprogressdialog.o
276Only in qte-2.3.7/src/dialogs: qtabdialog.o
277Only in qte-2.3.7/src/dialogs: qwizard.o
278Only in qte-2.3.7/src/iconview: qiconview.o
279Only in qte-2.3.7/src/kernel: qabstractlayout.o
280Only in qte-2.3.7/src/kernel: qaccel.o
281diff -ru qte-2.3.7_orig/src/kernel/qapplication.cpp qte-2.3.7/src/kernel/qapplication.cpp
282 --- qte-2.3.7_orig/src/kernel/qapplication.cppThu Jul 17 03:20:25 2003
283 +++ qte-2.3.7/src/kernel/qapplication.cppMon Oct 27 14:21:28 2003
284@@ -35,6 +35,8 @@
285 **
286 **********************************************************************/
287
288 +#define QT_WEAK_SYMBOL__attribute__(( weak ))
289+
290 #include "qobjectlist.h"
291 #include "qobjectdict.h"
292 #include "qapplication.h"
293@@ -933,11 +935,16 @@
294 #ifndef QT_NO_STYLE
295 void QApplication::setStyle( QStyle *style )
296 {
297 +setStyle_NonWeak ( style );
298+}
299+
300+void QApplication::setStyle_NonWeak( QStyle *style )
301+{
302 QStyle* old = app_style;
303- app_style = style;
304
305 if ( startingUp() ) {
306 delete old;
307 +app_style = style;
308 return;
309 }
310
311@@ -958,6 +965,8 @@
312 old->unPolish( qApp );
313 }
314
315+ app_style = style;
316+
317 // take care of possible palette requirements of certain gui
318 // styles. Do it before polishing the application since the style
319 // might call QApplication::setStyle() itself
320@@ -1184,13 +1193,30 @@
321 \sa QWidget::setPalette(), palette(), QStyle::polish()
322 */
323
324-void QApplication::setPalette( const QPalette &palette, bool informWidgets,
325+void QApplication::setPalette ( const QPalette &palette, bool informWidgets,
326 + const char* className )
327+{
328 +setPalette_NonWeak ( palette, informWidgets, className );
329+}
330+
331+void QApplication::setPalette_NonWeak ( const QPalette &palette, bool informWidgets,
332 const char* className )
333 {
334 QPalette pal = palette;
335 #ifndef QT_NO_STYLE
336- if ( !startingUp() )
337+ if ( !startingUp() ) {
338 qApp->style().polish( pal );// NB: non-const reference
339 +if ( className ) {
340 + // if we just polished a class specific palette (this normally
341 + // only called by qt_fix_tooltips - see below), we better re-
342 + // polish the global palette. Some styles like liquid can get
343 + // confused, because they can not detect if the polished palette
344 + // is the global one or only a class specific one.
345 + // (liquid uses this palette to calculate blending pixmaps)
346 + QPalette p = qApp-> palette ( );
347 + qApp->style().polish ( p );
348 +}
349+ }
350 #endif
351 bool all = FALSE;
352 if ( !className ) {
353@@ -1273,6 +1299,12 @@
354 */
355
356 void QApplication::setFont( const QFont &font, bool informWidgets,
357 + const char* className )
358+{
359 +setFont_NonWeak ( font, informWidgets, className );
360+}
361+
362+void QApplication::setFont_NonWeak( const QFont &font, bool informWidgets,
363 const char* className )
364 {
365 bool all = FALSE;
366diff -ru qte-2.3.7_orig/src/kernel/qapplication.h qte-2.3.7/src/kernel/qapplication.h
367 --- qte-2.3.7_orig/src/kernel/qapplication.hThu Jul 17 03:20:25 2003
368 +++ qte-2.3.7/src/kernel/qapplication.hMon Oct 27 14:21:28 2003
369@@ -61,6 +61,10 @@
370 class QSemaphore;
371 #endif
372
373+#if !defined( QT_WEAK_SYMBOL )
374+#define QT_WEAK_SYMBOL
375+#endif
376+
377 // REMOVE IN 3.0 (just here for moc source compatibility)
378 #define QNonBaseApplication QApplication
379
380@@ -85,7 +89,10 @@
381
382 #ifndef QT_NO_STYLE
383 static QStyle &style();
384 - static void setStyle( QStyle* );
385 + static void setStyle( QStyle* ) QT_WEAK_SYMBOL;
386+private:
387 +static void setStyle_NonWeak( QStyle* );
388+public:
389 #endif
390 #if 1/* OBSOLETE */
391 enum ColorMode { NormalColors, CustomColors };
392@@ -106,11 +113,19 @@
393 #ifndef QT_NO_PALETTE
394 static QPalette palette( const QWidget* = 0 );
395 static void setPalette( const QPalette &, bool informWidgets=FALSE,
396 + const char* className = 0 ) QT_WEAK_SYMBOL;
397+private:
398 + static void setPalette_NonWeak( const QPalette &, bool informWidgets=FALSE,
399 const char* className = 0 );
400+public:
401 #endif
402 static QFont font( const QWidget* = 0 );
403 static void setFont( const QFont &, bool informWidgets=FALSE,
404 + const char* className = 0 ) QT_WEAK_SYMBOL;
405+private:
406 + static void setFont_NonWeak( const QFont &, bool informWidgets=FALSE,
407 const char* className = 0 );
408 +public:
409 static QFontMetrics fontMetrics();
410
411 QWidget *mainWidget() const;
412@@ -207,7 +222,10 @@
413 void qwsSetCustomColors( QRgb *colortable, int start, int numColors );
414 #ifndef QT_NO_QWS_MANAGER
415 static QWSDecoration &qwsDecoration();
416- static void qwsSetDecoration( QWSDecoration *);
417+ static void qwsSetDecoration( QWSDecoration *) QT_WEAK_SYMBOL;
418+private:
419+ static void qwsSetDecoration_NonWeak( QWSDecoration *);
420+public:
421 #endif
422 #endif
423
424Only in qte-2.3.7/src/kernel: qapplication.o
425diff -ru qte-2.3.7_orig/src/kernel/qapplication_qws.cpp qte-2.3.7/src/kernel/qapplication_qws.cpp
426 --- qte-2.3.7_orig/src/kernel/qapplication_qws.cppThu Jul 17 03:20:25 2003
427 +++ qte-2.3.7/src/kernel/qapplication_qws.cppMon Oct 27 14:21:28 2003
428@@ -2804,6 +2804,11 @@
429 */
430 void QApplication::qwsSetDecoration( QWSDecoration *d )
431 {
432 +qwsSetDecoration_NonWeak ( d );
433+}
434+
435+void QApplication::qwsSetDecoration_NonWeak( QWSDecoration *d )
436+{
437 if ( d ) {
438 delete qws_decoration;
439 qws_decoration = d;
440Only in qte-2.3.7/src/kernel: qapplication_qws.cpp~
441Only in qte-2.3.7/src/kernel: qapplication_qws.o
442Only in qte-2.3.7/src/kernel: qasyncimageio.o
443Only in qte-2.3.7/src/kernel: qasyncio.o
444Only in qte-2.3.7/src/kernel: qbitmap.o
445Only in qte-2.3.7/src/kernel: qclipboard.o
446Only in qte-2.3.7/src/kernel: qclipboard_qws.o
447Only in qte-2.3.7/src/kernel: qcolor.o
448Only in qte-2.3.7/src/kernel: qcolor_p.o
449Only in qte-2.3.7/src/kernel: qcolor_qws.o
450Only in qte-2.3.7/src/kernel: qconnection.o
451Only in qte-2.3.7/src/kernel: qcopchannel_qws.moc
452Only in qte-2.3.7/src/kernel: qcopchannel_qws.o
453Only in qte-2.3.7/src/kernel: qcursor.o
454Only in qte-2.3.7/src/kernel: qcursor_qws.o
455Only in qte-2.3.7/src/kernel: qdialog.o
456Only in qte-2.3.7/src/kernel: qdirectpainter_qws.o
457Only in qte-2.3.7/src/kernel: qdnd_qws.o
458Only in qte-2.3.7/src/kernel: qdragobject.o
459Only in qte-2.3.7/src/kernel: qdrawutil.o
460Only in qte-2.3.7/src/kernel: qdropsite.o
461Only in qte-2.3.7/src/kernel: qevent.o
462Only in qte-2.3.7/src/kernel: qfocusdata.o
463Only in qte-2.3.7/src/kernel: qfont.o
464Only in qte-2.3.7/src/kernel: qfont_qws.o
465diff -ru qte-2.3.7_orig/src/kernel/qfontdatabase.cpp qte-2.3.7/src/kernel/qfontdatabase.cpp
466 --- qte-2.3.7_orig/src/kernel/qfontdatabase.cppThu Jul 17 03:20:25 2003
467 +++ qte-2.3.7/src/kernel/qfontdatabase.cppMon Oct 27 14:21:28 2003
468@@ -35,6 +35,8 @@
469 **
470 **********************************************************************/
471
472+#define QT_WEAK_SYMBOL __attribute__(( weak ))
473+
474 #include "qfontdatabase.h"
475
476 #ifndef QT_NO_FONTDATABASE
477@@ -2421,6 +2423,13 @@
478 */
479
480 QValueList<int> QFontDatabase::pointSizes( const QString &family,
481+ const QString &style,
482+ const QString &charSet )
483+{
484 +return pointSizes_NonWeak ( family, style, charSet );
485+}
486+
487+QValueList<int> QFontDatabase::pointSizes_NonWeak ( const QString &family,
488 const QString &style,
489 const QString &charSet )
490 {
491diff -ru qte-2.3.7_orig/src/kernel/qfontdatabase.h qte-2.3.7/src/kernel/qfontdatabase.h
492 --- qte-2.3.7_orig/src/kernel/qfontdatabase.hThu Jul 17 03:20:25 2003
493 +++ qte-2.3.7/src/kernel/qfontdatabase.hMon Oct 27 14:21:28 2003
494@@ -59,6 +59,10 @@
495 class QDiskFont;
496 #endif
497
498+#if !defined( QT_WEAK_SYMBOL )
499+#define QT_WEAK_SYMBOL
500+#endif
501+
502 class QFontDatabasePrivate;
503
504 class Q_EXPORT QFontDatabase
505@@ -67,9 +71,16 @@
506 QFontDatabase();
507
508 QStringList families( bool onlyForLocale = TRUE ) const;
509+
510+
511 QValueList<int> pointSizes( const QString &family,
512 const QString &style = QString::null,
513 - const QString &charSet = QString::null );
514 + const QString &charSet = QString::null ) QT_WEAK_SYMBOL;
515+private:
516+ QValueList<int> pointSizes_NonWeak( const QString &family,
517 + const QString &style,
518 + const QString &charSet );
519+public:
520 QStringList styles( const QString &family,
521 const QString &charSet = QString::null ) const;
522 QStringList charSets( const QString &familyName,
523Only in qte-2.3.7/src/kernel: qfontdatabase.o
524Only in qte-2.3.7/src/kernel: qfontfactorybdf_qws.o
525Only in qte-2.3.7/src/kernel: qfontfactoryttf_qws.o
526Only in qte-2.3.7/src/kernel: qfontmanager_qws.o
527diff -ru qte-2.3.7_orig/src/kernel/qgfx_qws.cpp qte-2.3.7/src/kernel/qgfx_qws.cpp
528 --- qte-2.3.7_orig/src/kernel/qgfx_qws.cppThu Jul 17 03:20:25 2003
529 +++ qte-2.3.7/src/kernel/qgfx_qws.cppMon Oct 27 14:27:25 2003
530@@ -32,7 +32,7 @@
531 #include "qgfx_qws.h"
532
533 #include <stdio.h>
534-#include <dlfcn.h>
535+//#include <dlfcn.h>
536 #include <sys/types.h>
537 #include <dirent.h>
538 #include <stdlib.h>
539Only in qte-2.3.7/src/kernel: qgfx_qws.o
540diff -ru qte-2.3.7_orig/src/kernel/qgfxraster_qws.cpp qte-2.3.7/src/kernel/qgfxraster_qws.cpp
541 --- qte-2.3.7_orig/src/kernel/qgfxraster_qws.cppThu Jul 17 03:20:25 2003
542 +++ qte-2.3.7/src/kernel/qgfxraster_qws.cppMon Oct 27 14:27:25 2003
543@@ -75,7 +75,11 @@
544 # if __BYTE_ORDER == __BIG_ENDIAN
545 # define QWS_BIG_ENDIAN
546 # endif
547+#elif defined(__APPLE__)
548+# define QWS_BIG_ENDIAN
549 #endif
550+// AJ: the above (test for __APPLE__) is very hacky, but I can't
551+// think of something better at the moment.
552
553 // Pull this private function in from qglobal.cpp
554 extern unsigned int qt_int_sqrt( unsigned int n );
555@@ -3770,6 +3774,19 @@
556 b = srcval & 0xff;
557
558 unsigned char * tmp=(unsigned char *)&alphabuf[loopc];
559+# ifdef QWS_BIG_ENDIAN
560 + if(av==255) {
561 + // Do nothing - we already have source values in r,g,b
562 + } else if(av==0) {
563 + r = *(tmp+1);
564 + g = *(tmp+2);
565 + b = *(tmp+3);
566 + } else {
567 + r = ((r-*(tmp+1)) * av) / 256 + *(tmp+1);
568 + g = ((g-*(tmp+2)) * av) / 256 + *(tmp+2);
569 + b = ((b-*(tmp+3)) * av) / 256 + *(tmp+3);
570 + }
571+# else
572 if(av==255) {
573 // Do nothing - we already have source values in r,g,b
574 } else if(av==0) {
575@@ -3781,6 +3798,7 @@
576 g = ((g-*(tmp+1)) * av) / 256 + *(tmp+1);
577 b = ((b-*(tmp+0)) * av) / 256 + *(tmp+0);
578 }
579+# endif
580 *(alphaptr++) = (r << 16) | (g << 8) | b;
581 }
582
583@@ -4204,7 +4222,7 @@
584
585 } else if ( depth == 1 ) {
586 if (srctype==SourceImage) {
587 - static int warn;
588 + static int warn = 0;
589 if ( warn++ < 5 )
590 qDebug( "bitmap alpha-image not implemented" );
591 hImageLineUnclipped( x1, x2, l, srcdata, FALSE );
592@@ -4237,7 +4255,7 @@
593 setAlphaType(IgnoreAlpha);
594 if ( w <= 0 || h <= 0 || !ncliprect ) return;
595 GFX_START(QRect(rx+xoffs, ry+yoffs, w+1, h+1))
596-#ifdef QWS_EXPERIMENTAL_FASTPATH
597+#if 0 // def QWS_EXPERIMENTAL_FASTPATH !! this is crashing HancomWord on OZ !!
598 // ### fix for 8bpp
599 // This seems to be reliable now, at least for 16bpp
600
601Only in qte-2.3.7/src/kernel: qgfxraster_qws.cpp~
602Only in qte-2.3.7/src/kernel: qgfxraster_qws.o
603Only in qte-2.3.7/src/kernel: qguardedptr.o
604Only in qte-2.3.7/src/kernel: qiconset.o
605Only in qte-2.3.7/src/kernel: qimage.o
606Only in qte-2.3.7/src/kernel: qinputcontext_qws.o
607Only in qte-2.3.7/src/kernel: qjpegio.o
608diff -ru qte-2.3.7_orig/src/kernel/qkeyboard_qws.cpp qte-2.3.7/src/kernel/qkeyboard_qws.cpp
609 --- qte-2.3.7_orig/src/kernel/qkeyboard_qws.cppThu Jul 17 03:20:25 2003
610 +++ qte-2.3.7/src/kernel/qkeyboard_qws.cppMon Oct 27 14:42:11 2003
611@@ -69,7 +69,7 @@
612 #if !defined(_OS_QNX6_)
613
614 #include <termios.h>
615-#if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
616+#if !defined(_OS_MACX_) && !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
617 #include <sys/kd.h>
618 #include <sys/vt.h>
619 #endif
620@@ -468,10 +468,12 @@
621 void QWSPC101KeyboardHandler::restoreLeds()
622 {
623 char leds;
624+#if !defined(_OS_MACX_)
625 ioctl(0, KDGETLED, &leds);
626 leds = leds & ~LED_CAP;
627 if ( caps ) leds |= LED_CAP;
628 ioctl(0, KDSETLED, leds);
629+#endif
630 }
631
632 class QWSTtyKeyboardHandler : public QWSPC101KeyboardHandler
633@@ -547,7 +549,7 @@
634
635 static void vtSwitchHandler(int /*sig*/)
636 {
637-#if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
638+#if !defined(_OS_MACX_) && !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
639 if (vtActive) {
640 qwsServer->enablePainting(false);
641 qt_screen->save();
642@@ -880,7 +882,7 @@
643 if (term && !release) {
644 ctrl = false;
645 alt = false;
646-#if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
647+#if !defined(_OS_MACX_) && !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
648 ioctl(kbdFD, VT_ACTIVATE, term);
649 #endif
650 return;
651@@ -1031,7 +1033,7 @@
652 struct termios termdata;
653 tcgetattr( kbdFD, &termdata );
654
655-#if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
656+#if !defined(_OS_MACX_) && !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
657 ioctl(kbdFD, KDSKBMODE, K_RAW);
658 #endif
659
660@@ -1047,7 +1049,7 @@
661
662 signal(VTSWITCHSIG, vtSwitchHandler);
663
664-#if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
665+#if !defined(_OS_MACX_) && !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
666 struct vt_mode vtMode;
667 ioctl(kbdFD, VT_GETMODE, &vtMode);
668
669@@ -1068,7 +1070,7 @@
670 {
671 if (kbdFD >= 0)
672 {
673-#if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
674+#if !defined(_OS_MACX_) && !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
675 ioctl(kbdFD, KDSKBMODE, K_XLATE);
676 #endif
677 tcsetattr(kbdFD, TCSANOW, &origTermData);
678Only in qte-2.3.7/src/kernel: qkeyboard_qws.cpp.rej
679Only in qte-2.3.7/src/kernel: qkeyboard_qws.cpp~
680Only in qte-2.3.7/src/kernel: qkeyboard_qws.moc
681Only in qte-2.3.7/src/kernel: qkeyboard_qws.o
682Only in qte-2.3.7/src/kernel: qlayout.o
683Only in qte-2.3.7/src/kernel: qlayoutengine.o
684Only in qte-2.3.7/src/kernel: qlocalfs.o
685diff -ru qte-2.3.7_orig/src/kernel/qlock_qws.cpp qte-2.3.7/src/kernel/qlock_qws.cpp
686 --- qte-2.3.7_orig/src/kernel/qlock_qws.cppThu Jul 17 03:20:25 2003
687 +++ qte-2.3.7/src/kernel/qlock_qws.cppMon Oct 27 14:27:25 2003
688@@ -38,7 +38,7 @@
689 #include <errno.h>
690
691 #if defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED) \
692- || defined _OS_FREEBSD_
693+ || defined(_OS_FREEBSD_) || defined(_OS_MACX_)
694 /* union semun is defined by including <sys/sem.h> */
695 #else
696 /* according to X/OPEN we have to define it ourselves */
697Only in qte-2.3.7/src/kernel: qlock_qws.o
698Only in qte-2.3.7/src/kernel: qmemorymanager_qws.o
699Only in qte-2.3.7/src/kernel: qmetaobject.o
700Only in qte-2.3.7/src/kernel: qmime.o
701Only in qte-2.3.7/src/kernel: qmngio.o
702Only in qte-2.3.7/src/kernel: qmovie.moc
703Only in qte-2.3.7/src/kernel: qmovie.o
704Only in qte-2.3.7/src/kernel: qnetworkprotocol.o
705Only in qte-2.3.7/src/kernel: qobject.o
706Only in qte-2.3.7/src/kernel: qpaintdevice_qws.o
707Only in qte-2.3.7/src/kernel: qpaintdevicemetrics.o
708Only in qte-2.3.7/src/kernel: qpainter.o
709Only in qte-2.3.7/src/kernel: qpainter_qws.o
710Only in qte-2.3.7/src/kernel: qpalette.o
711Only in qte-2.3.7/src/kernel: qpicture.o
712Only in qte-2.3.7/src/kernel: qpixmap.o
713Only in qte-2.3.7/src/kernel: qpixmap_qws.o
714Only in qte-2.3.7/src/kernel: qpixmapcache.o
715Only in qte-2.3.7/src/kernel: qpngio.o
716Only in qte-2.3.7/src/kernel: qpoint.o
717Only in qte-2.3.7/src/kernel: qprinter.o
718Only in qte-2.3.7/src/kernel: qprinter_qws.o
719Only in qte-2.3.7/src/kernel: qpsprinter.o
720Only in qte-2.3.7/src/kernel: qrect.o
721Only in qte-2.3.7/src/kernel: qregion.o
722Only in qte-2.3.7/src/kernel: qrichtext.o
723Only in qte-2.3.7/src/kernel: qsemimodal.o
724Only in qte-2.3.7/src/kernel: qsharedmemory.o
725Only in qte-2.3.7/src/kernel: qsignal.o
726Only in qte-2.3.7/src/kernel: qsignalmapper.o
727Only in qte-2.3.7/src/kernel: qsimplerichtext.o
728Only in qte-2.3.7/src/kernel: qsize.o
729Only in qte-2.3.7/src/kernel: qsizegrip.o
730Only in qte-2.3.7/src/kernel: qsocketnotifier.o
731Only in qte-2.3.7/src/kernel: qsound.o
732Only in qte-2.3.7/src/kernel: qsound_qws.o
733Only in qte-2.3.7/src/kernel: qsoundqss_qws.moc
734Only in qte-2.3.7/src/kernel: qsoundqss_qws.o
735Only in qte-2.3.7/src/kernel: qstyle.o
736Only in qte-2.3.7/src/kernel: qstylesheet.o
737Only in qte-2.3.7/src/kernel: qthread_unix.moc
738Only in qte-2.3.7/src/kernel: qthread_unix.o
739Only in qte-2.3.7/src/kernel: qtimer.o
740Only in qte-2.3.7/src/kernel: qtranslator.o
741Only in qte-2.3.7/src/kernel: qurl.o
742Only in qte-2.3.7/src/kernel: qurlinfo.o
743Only in qte-2.3.7/src/kernel: qurloperator.o
744Only in qte-2.3.7/src/kernel: qvariant.o
745Only in qte-2.3.7/src/kernel: qwidget.o
746Only in qte-2.3.7/src/kernel: qwidget_qws.o
747diff -ru qte-2.3.7_orig/src/kernel/qwindowsystem_qws.cpp qte-2.3.7/src/kernel/qwindowsystem_qws.cpp
748 --- qte-2.3.7_orig/src/kernel/qwindowsystem_qws.cppThu Jul 17 03:20:26 2003
749 +++ qte-2.3.7/src/kernel/qwindowsystem_qws.cppMon Oct 27 14:27:25 2003
750@@ -844,6 +844,18 @@
751 {
752 }
753
754+static void catchSegvSignal( int )
755+{
756+#ifndef QT_NO_QWS_KEYBOARD
757+ if ( qwsServer )
758 +qwsServer->closeKeyboard();
759+#endif
760+ QWSServer::closedown();
761+ fprintf(stderr, "Segmentation fault.\n");
762+ exit(1);
763+}
764+
765+
766 /*!
767 \class QWSServer qwindowsystem_qws.h
768 \brief Server-specific functionality in Qt/Embedded
769@@ -936,6 +948,7 @@
770 }
771
772 signal(SIGPIPE, ignoreSignal); //we get it when we read
773+ signal(SIGSEGV, catchSegvSignal); //recover the keyboard on crash
774 #endif
775 focusw = 0;
776 mouseGrabber = 0;
777@@ -950,7 +963,7 @@
778
779 #ifndef QT_NO_QWS_MULTIPROCESS
780 if ( !geteuid() ) {
781-#if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
782+#if !defined(_OS_MACX_) && !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
783 if( mount(0, "/var/shm", "shm", 0, 0) ) {
784 /* This just confuses people with 2.2 kernels
785 if ( errno != EBUSY )
786Only in qte-2.3.7/src/kernel: qwindowsystem_qws.cpp~
787Only in qte-2.3.7/src/kernel: qwindowsystem_qws.o
788Only in qte-2.3.7/src/kernel: qwmatrix.o
789Only in qte-2.3.7/src/kernel: qwsbeosdecoration_qws.o
790Only in qte-2.3.7/src/kernel: qwscommand_qws.o
791Only in qte-2.3.7/src/kernel: qwscursor_qws.o
792Only in qte-2.3.7/src/kernel: qwsdecoration_qws.o
793Only in qte-2.3.7/src/kernel: qwsdefaultdecoration_qws.o
794Only in qte-2.3.7/src/kernel: qwsevent_qws.o
795Only in qte-2.3.7/src/kernel: qwshydrodecoration_qws.o
796Only in qte-2.3.7/src/kernel: qwskde2decoration_qws.o
797Only in qte-2.3.7/src/kernel: qwskdedecoration_qws.o
798Only in qte-2.3.7/src/kernel: qwsmanager_qws.o
799diff -ru qte-2.3.7_orig/src/kernel/qwsmouse_qws.cpp qte-2.3.7/src/kernel/qwsmouse_qws.cpp
800 --- qte-2.3.7_orig/src/kernel/qwsmouse_qws.cppThu Jul 17 03:20:26 2003
801 +++ qte-2.3.7/src/kernel/qwsmouse_qws.cppMon Oct 27 14:27:25 2003
802@@ -336,7 +336,7 @@
803 tty.c_oflag = 0;
804 tty.c_lflag = 0;
805 tty.c_cflag = f | CREAD | CLOCAL | HUPCL;
806-#if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
807+#if !defined(_OS_MACX_) && !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
808 tty.c_line = 0;
809 #endif
810 tty.c_cc[VTIME] = 0;
811@@ -889,7 +889,7 @@
812 tty.c_iflag = IGNBRK | IGNPAR;
813 tty.c_oflag = 0;
814 tty.c_lflag = 0;
815-#if !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
816+#if !defined(_OS_MACX_) && !defined(_OS_FREEBSD_) && !defined(_OS_SOLARIS_)
817 tty.c_line = 0;
818 #endif // _OS_FREEBSD_
819 tty.c_cc[VTIME] = 0;
820Only in qte-2.3.7/src/kernel: qwsmouse_qws.moc
821Only in qte-2.3.7/src/kernel: qwsmouse_qws.o
822Only in qte-2.3.7/src/kernel: qwsproperty_qws.o
823Only in qte-2.3.7/src/kernel: qwsregionmanager_qws.o
824Only in qte-2.3.7/src/kernel: qwssocket_qws.o
825Only in qte-2.3.7/src/kernel: qwswindowsdecoration_qws.o
826Only in qte-2.3.7/src/moc: Makefile
827Only in qte-2.3.7/src/moc: moc
828Only in qte-2.3.7/src/moc: mocgen.o
829Only in qte-2.3.7/src/moc: qbuffer.o
830Only in qte-2.3.7/src/moc: qcollection.o
831Only in qte-2.3.7/src/moc: qcstring.o
832Only in qte-2.3.7/src/moc: qdatastream.o
833Only in qte-2.3.7/src/moc: qdatetime.o
834Only in qte-2.3.7/src/moc: qfile.o
835Only in qte-2.3.7/src/moc: qfile_unix.o
836Only in qte-2.3.7/src/moc: qgarray.o
837Only in qte-2.3.7/src/moc: qgdict.o
838Only in qte-2.3.7/src/moc: qglist.o
839Only in qte-2.3.7/src/moc: qglobal.o
840Only in qte-2.3.7/src/moc: qgvector.o
841Only in qte-2.3.7/src/moc: qiodevice.o
842Only in qte-2.3.7/src/moc: qregexp.o
843Only in qte-2.3.7/src/moc: qstring.o
844Only in qte-2.3.7/src/moc: qtextcodec.o
845Only in qte-2.3.7/src/moc: qtextstream.o
846Only in qte-2.3.7/src/moc: qutfcodec.o
847Only in qte-2.3.7/src/network: qdns.o
848Only in qte-2.3.7/src/network: qftp.o
849Only in qte-2.3.7/src/network: qhostaddress.o
850Only in qte-2.3.7/src/network: qnetwork.o
851Only in qte-2.3.7/src/network: qserversocket.o
852Only in qte-2.3.7/src/network: qsocket.o
853Only in qte-2.3.7/src/network: qsocketdevice.o
854Only in qte-2.3.7/src/network: qsocketdevice_unix.o
855Only in qte-2.3.7/src/table: qtable.o
856Only in qte-2.3.7/src/tools: qbitarray.o
857Only in qte-2.3.7/src/tools: qbuffer.o
858Only in qte-2.3.7/src/tools: qcollection.o
859Only in qte-2.3.7/src/tools: qconfig-qpe.h
860Only in qte-2.3.7/src/tools: qconfig-qpe.h~
861diff -ru qte-2.3.7_orig/src/tools/qconfig.h qte-2.3.7/src/tools/qconfig.h
862 --- qte-2.3.7_orig/src/tools/qconfig.hFri Jan 26 14:43:06 2001
863 +++ qte-2.3.7/src/tools/qconfig.hWed Oct 29 22:13:16 2003
864@@ -1,3 +1,26 @@
865+// Copied from qconfig-qpe.h
866+/**********************************************************************
867+** Copyright (C) 2000 Trolltech AS. All rights reserved.
868+**
869+** This file is part of Qtopia Environment.
870+**
871+** This file may be distributed and/or modified under the terms of the
872+** GNU General Public License version 2 as published by the Free Software
873+** Foundation and appearing in the file LICENSE.GPL included in the
874+** packaging of this file.
875+**
876+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
877+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
878+**
879+** See http://www.trolltech.com/gpl/ for GPL licensing information.
880+**
881+** Contact info@trolltech.com if any conditions of this licensing are
882+** not clear to you.
883+**
884+**********************************************************************/
885+#ifndef QT_H
886+#endif // QT_H
887+
888 // Empty leaves all features enabled. See doc/html/features.html for choices.
889
890 // Note that disabling some features will produce a libqt that is not
891@@ -8,3 +31,69 @@
892 #ifndef QT_DLL
893 #define QT_DLL // Internal
894 #endif
895+
896+#if defined(QT_QWS_IPAQ) || defined(QT_QWS_CASSIOPEIA) || defined(QT_QWS_SL5XXX)
897+# define QT_NO_QWS_CURSOR
898+# define QT_NO_QWS_MOUSE_AUTO
899+#endif
900+#ifndef QT_NO_CODECS
901+#define QT_NO_CODECS
902+#endif
903+#define QT_NO_UNICODETABLES
904+//#define QT_NO_IMAGEIO_BMP
905+#define QT_NO_IMAGEIO_PPM
906+//#define QT_NO_ASYNC_IO
907+//#define QT_NO_ASYNC_IMAGE_IO
908+#define QT_NO_FREETYPE
909+#define QT_NO_BDF
910+//#define QT_NO_FONTDATABASE
911+#define QT_NO_DRAGANDDROP
912+//#define QT_NO_CLIPBOARD
913+#define QT_NO_PROPERTIES
914+#define QT_NO_NETWORKPROTOCOL
915+
916+#define QT_NO_IMAGE_TEXT
917+
918+//#define QT_NO_TOOLTIP
919+#define QT_NO_COLORNAMES
920+#define QT_NO_TRANSFORMATIONS
921+#define QT_NO_TRANSLATION_BUILDER
922+#define QT_NO_COMPLEXTEXT
923+#define QT_NO_PRINTER
924+#define QT_NO_PICTURE
925+//#define QT_NO_ICONVIEW
926+#define QT_NO_DIAL
927+#define QT_NO_SIZEGRIP
928+#define QT_NO_WORKSPACE
929+//#define QT_NO_TABLE
930+//#define QT_NO_ACTION
931+//#define QT_NO_SETTINGS
932+#define QT_NO_STYLE_POCKETPC
933+#ifndef QT_NO_STYLE_AQUA
934+# define QT_NO_STYLE_AQUA
935+#endif
936+#define QT_NO_STYLE_MOTIF
937+#define QT_NO_STYLE_PLATINUM
938+#define QT_NO_FILEDIALOG
939+#define QT_NO_FONTDIALOG
940+#define QT_NO_PRINTDIALOG
941+#define QT_NO_COLORDIALOG
942+#define QT_NO_INPUTDIALOG
943+//#define QT_NO_MESSAGEBOX
944+#define QT_NO_PROGRESSDIALOG
945+//#define QT_NO_TABDIALOG
946+#define QT_NO_WIZARD
947+#define QT_NO_EFFECTS
948+//#define QT_NO_COMPONENT
949+#define QT_NO_DOM
950+#define QT_NO_SEMIMODAL
951+//#define QT_NO_PROGRESSBAR
952+#define QT_NO_SPLITTER
953+
954+//#define QT_NO_QWS_SAVEFONTS
955+//#define QT_NO_QWS_PROPERTIES
956+
957+#define QT_NO_QWS_BEOS_WM_STYLE
958+#define QT_NO_QWS_KDE2_WM_STYLE
959+#define QT_NO_QWS_KDE_WM_STYLE
960+#define QT_NO_QWS_WINDOWS_WM_STYLE
961Only in qte-2.3.7/src/tools: qconfig.h~
962Only in qte-2.3.7/src/tools: qcstring.o
963Only in qte-2.3.7/src/tools: qdatastream.o
964Only in qte-2.3.7/src/tools: qdatetime.o
965Only in qte-2.3.7/src/tools: qdir.o
966Only in qte-2.3.7/src/tools: qdir_unix.o
967Only in qte-2.3.7/src/tools: qfile.o
968Only in qte-2.3.7/src/tools: qfile_unix.o
969Only in qte-2.3.7/src/tools: qfileinfo.o
970Only in qte-2.3.7/src/tools: qfileinfo_unix.o
971Only in qte-2.3.7/src/tools: qgarray.o
972Only in qte-2.3.7/src/tools: qgcache.o
973Only in qte-2.3.7/src/tools: qgdict.o
974Only in qte-2.3.7/src/tools: qglist.o
975Only in qte-2.3.7/src/tools: qglobal.o
976Only in qte-2.3.7/src/tools: qgvector.o
977Only in qte-2.3.7/src/tools: qiodevice.o
978Only in qte-2.3.7/src/tools: qmap.o
979diff -ru qte-2.3.7_orig/src/tools/qmodules.h qte-2.3.7/src/tools/qmodules.h
980 --- qte-2.3.7_orig/src/tools/qmodules.hFri Aug 31 17:00:56 2001
981 +++ qte-2.3.7/src/tools/qmodules.hWed Oct 29 21:57:53 2003
982@@ -1,14 +1,12 @@
983-#ifndef QT_H
984-#endif // QT_H
985-
986+// These modules are licensed to you
987 #define QT_MODULE_TOOLS
988 #define QT_MODULE_KERNEL
989 #define QT_MODULE_WIDGETS
990 #define QT_MODULE_DIALOGS
991-
992 #define QT_MODULE_ICONVIEW
993 #define QT_MODULE_WORKSPACE
994-#define QT_MODULE_TABLE
995+#define QT_MODULE_NETWORK
996 #define QT_MODULE_CANVAS
997+#define QT_MODULE_TABLE
998 #define QT_MODULE_XML
999-#define QT_MODULE_NETWORK
1000+#define QT_MODULE_OPENGL
1001Only in qte-2.3.7/src/tools: qregexp.o
1002Only in qte-2.3.7/src/tools: qstring.o
1003Only in qte-2.3.7/src/tools: qstringlist.o
1004Only in qte-2.3.7/src/tools: qtextcodec.o
1005Only in qte-2.3.7/src/tools: qtextstream.o
1006Only in qte-2.3.7/src/tools: qutfcodec.o
1007Only in qte-2.3.7/src/widgets: qaction.o
1008Only in qte-2.3.7/src/widgets: qbutton.o
1009Only in qte-2.3.7/src/widgets: qbuttongroup.o
1010Only in qte-2.3.7/src/widgets: qcdestyle.o
1011Only in qte-2.3.7/src/widgets: qcheckbox.o
1012Only in qte-2.3.7/src/widgets: qcombobox.o
1013diff -ru qte-2.3.7_orig/src/widgets/qcommonstyle.cpp qte-2.3.7/src/widgets/qcommonstyle.cpp
1014 --- qte-2.3.7_orig/src/widgets/qcommonstyle.cppThu Jul 17 03:20:26 2003
1015 +++ qte-2.3.7/src/widgets/qcommonstyle.cppMon Oct 27 14:21:28 2003
1016@@ -566,7 +566,7 @@
1017 bool enabled, bool active )
1018 {
1019 #ifndef QT_NO_MENUBAR
1020-#ifndef QT_NO_STYLE_SGI
1021+#if 1 // #ifndef QT_NO_STYLE_SGI
1022 if (draw_menu_bar_impl != 0) {
1023 QDrawMenuBarItemImpl impl = draw_menu_bar_impl;
1024 (this->*impl)(p, x, y, w, h, mi, g, enabled, active);
1025Only in qte-2.3.7/src/widgets: qcommonstyle.o
1026Only in qte-2.3.7/src/widgets: qcompactstyle.o
1027Only in qte-2.3.7/src/widgets: qdial.o
1028Only in qte-2.3.7/src/widgets: qeffects.moc
1029Only in qte-2.3.7/src/widgets: qeffects.o
1030Only in qte-2.3.7/src/widgets: qframe.o
1031Only in qte-2.3.7/src/widgets: qgrid.o
1032Only in qte-2.3.7/src/widgets: qgroupbox.o
1033Only in qte-2.3.7/src/widgets: qhbox.o
1034Only in qte-2.3.7/src/widgets: qhbuttongroup.o
1035Only in qte-2.3.7/src/widgets: qheader.o
1036Only in qte-2.3.7/src/widgets: qhgroupbox.o
1037Only in qte-2.3.7/src/widgets: qinterlacestyle.o
1038Only in qte-2.3.7/src/widgets: qlabel.o
1039Only in qte-2.3.7/src/widgets: qlcdnumber.o
1040Only in qte-2.3.7/src/widgets: qlineedit.o
1041Only in qte-2.3.7/src/widgets: qlistbox.o
1042diff -ru qte-2.3.7_orig/src/widgets/qlistview.cpp qte-2.3.7/src/widgets/qlistview.cpp
1043 --- qte-2.3.7_orig/src/widgets/qlistview.cppThu Jul 17 03:20:26 2003
1044 +++ qte-2.3.7/src/widgets/qlistview.cppMon Oct 27 14:21:28 2003
1045@@ -4968,9 +4968,9 @@
1046 l = l->childItem ? l->childItem : l->siblingItem;
1047
1048 if ( l && l->height() )
1049 -s.setHeight( s.height() + 10 * l->height() );
1050- else
1051 -s.setHeight( s.height() + 140 );
1052 +s.setHeight( s.height() + 4 /*10*/ * l->height() );
1053+ else // ^v much too big for handhelds
1054 +s.setHeight( s.height() + 30 /*140*/ );
1055
1056 if ( s.width() > s.height() * 3 )
1057 s.setHeight( s.width() / 3 );
1058Only in qte-2.3.7/src/widgets: qlistview.o
1059Only in qte-2.3.7/src/widgets: qmainwindow.moc
1060Only in qte-2.3.7/src/widgets: qmainwindow.o
1061Only in qte-2.3.7/src/widgets: qmenubar.o
1062Only in qte-2.3.7/src/widgets: qmenudata.o
1063Only in qte-2.3.7/src/widgets: qmotifplusstyle.o
1064Only in qte-2.3.7/src/widgets: qmotifstyle.o
1065Only in qte-2.3.7/src/widgets: qmultilineedit.o
1066Only in qte-2.3.7/src/widgets: qplatinumstyle.o
1067Only in qte-2.3.7/src/widgets: qpopupmenu.o
1068Only in qte-2.3.7/src/widgets: qprogressbar.o
1069Only in qte-2.3.7/src/widgets: qpushbutton.o
1070Only in qte-2.3.7/src/widgets: qradiobutton.o
1071Only in qte-2.3.7/src/widgets: qrangecontrol.o
1072Only in qte-2.3.7/src/widgets: qscrollbar.o
1073Only in qte-2.3.7/src/widgets: qscrollview.o
1074Only in qte-2.3.7/src/widgets: qsgistyle.o
1075Only in qte-2.3.7/src/widgets: qslider.o
1076Only in qte-2.3.7/src/widgets: qspinbox.o
1077Only in qte-2.3.7/src/widgets: qsplitter.o
1078Only in qte-2.3.7/src/widgets: qstatusbar.o
1079Only in qte-2.3.7/src/widgets: qtabbar.o
1080Only in qte-2.3.7/src/widgets: qtableview.o
1081Only in qte-2.3.7/src/widgets: qtabwidget.o
1082Only in qte-2.3.7/src/widgets: qtextbrowser.o
1083Only in qte-2.3.7/src/widgets: qtextview.o
1084Only in qte-2.3.7/src/widgets: qtoolbar.moc
1085Only in qte-2.3.7/src/widgets: qtoolbar.o
1086diff -ru qte-2.3.7_orig/src/widgets/qtoolbutton.cpp qte-2.3.7/src/widgets/qtoolbutton.cpp
1087 --- qte-2.3.7_orig/src/widgets/qtoolbutton.cppThu Jul 17 03:20:27 2003
1088 +++ qte-2.3.7/src/widgets/qtoolbutton.cppMon Oct 27 14:21:28 2003
1089@@ -230,7 +230,7 @@
1090 else
1091 QToolTip::add( this, textLabel );
1092 }
1093 -#endif
1094+#endif
1095 }
1096
1097
1098@@ -324,12 +324,12 @@
1099 QPixmap pm = iconSet(TRUE).pixmap(QIconSet::Large, QIconSet::Normal);
1100 w = pm.width();
1101 h = pm.height();
1102 -if ( w < 32 )
1103 - w = 32;
1104 -if ( h < 32 )
1105 - h = 32;
1106 +if ( w < 24 )
1107 + w = 24;
1108 +if ( h < 24 )
1109 + h = 24;
1110 } else {
1111 -w = h = 16;
1112 +w = h = 14;
1113 QPixmap pm = iconSet(TRUE).pixmap(QIconSet::Small, QIconSet::Normal);
1114 w = pm.width();
1115 h = pm.height();
1116Only in qte-2.3.7/src/widgets: qtoolbutton.o
1117Only in qte-2.3.7/src/widgets: qtooltip.moc
1118Only in qte-2.3.7/src/widgets: qtooltip.o
1119Only in qte-2.3.7/src/widgets: qvalidator.o
1120Only in qte-2.3.7/src/widgets: qvbox.o
1121Only in qte-2.3.7/src/widgets: qvbuttongroup.o
1122Only in qte-2.3.7/src/widgets: qvgroupbox.o
1123Only in qte-2.3.7/src/widgets: qwhatsthis.moc
1124Only in qte-2.3.7/src/widgets: qwhatsthis.o
1125Only in qte-2.3.7/src/widgets: qwidgetstack.o
1126Only in qte-2.3.7/src/widgets: qwindowsstyle.o
1127Only in qte-2.3.7/src/workspace: qworkspace.moc
1128Only in qte-2.3.7/src/workspace: qworkspace.o
1129Only in qte-2.3.7/src/xml: qdom.o
1130Only in qte-2.3.7/src/xml: qxml.o
1131Only in qte-2.3.7: src-mt.mk
1132Only in qte-2.3.7: stamp-headers
1133Only in qte-2.3.7/tools: Makefile
1134Only in qte-2.3.7/tools/designer: Makefile
1135Only in qte-2.3.7/tools/designer/designer: Makefile
1136Only in qte-2.3.7/tools/designer/examples/walkthrough: Makefile
1137Only in qte-2.3.7/tools/designer/integration/rc2ui: Makefile
1138Only in qte-2.3.7/tools/designer/tools/createcw: Makefile
1139Only in qte-2.3.7/tools/designer/uic: Makefile
1140Only in qte-2.3.7/tools/designer/util: Makefile
1141Only in qte-2.3.7/tools/makeqpf: Makefile
1142Only in qte-2.3.7/tools/mergetr: Makefile
1143Only in qte-2.3.7/tools/msg2qm: Makefile
1144Only in qte-2.3.7/tools/qconfig: Makefile
1145Only in qte-2.3.7/tools/qembed: Makefile
1146Only in qte-2.3.7/tools/qvfb: Makefile
1147Only in qte-2.3.7/tutorial: Makefile
1148Only in qte-2.3.7/tutorial/t1: Makefile
1149Only in qte-2.3.7/tutorial/t10: Makefile
1150Only in qte-2.3.7/tutorial/t11: Makefile
1151Only in qte-2.3.7/tutorial/t12: Makefile
1152Only in qte-2.3.7/tutorial/t13: Makefile
1153Only in qte-2.3.7/tutorial/t14: Makefile
1154Only in qte-2.3.7/tutorial/t2: Makefile
1155Only in qte-2.3.7/tutorial/t3: Makefile
1156Only in qte-2.3.7/tutorial/t4: Makefile
1157Only in qte-2.3.7/tutorial/t5: Makefile
1158Only in qte-2.3.7/tutorial/t6: Makefile
1159Only in qte-2.3.7/tutorial/t7: Makefile
1160Only in qte-2.3.7/tutorial/t8: Makefile
1161Only in qte-2.3.7/tutorial/t9: Makefile
diff --git a/rsync/config_linux.h b/rsync/config_linux.h
index e5ff3e4..f488b78 100644
--- a/rsync/config_linux.h
+++ b/rsync/config_linux.h
@@ -1,115 +1,115 @@
1/* config.h. Generated automatically by configure. */ 1/* config.h. Generated automatically by configure. */
2/* config.h.in. Generated automatically from configure.in by autoheader 2.13. */ 2/* config.h.in. Generated automatically from configure.in by autoheader 2.13. */
3 3
4/* Define to empty if the keyword does not work. */ 4/* Define to empty if the keyword does not work. */
5/* #undef const */ 5/* #undef const */
6 6
7/* Define to `long' if <sys/types.h> doesn't define. */ 7/* Define to `long' if <sys/types.h> doesn't define. */
8/* #undef off_t */ 8/* #undef off_t */
9 9
10/* Define to `unsigned' if <sys/types.h> doesn't define. */ 10/* Define to `unsigned' if <sys/types.h> doesn't define. */
11/* #undef size_t */ 11/* #undef size_t */
12 12
13/* Define if you have the ANSI C header files. */ 13/* Define if you have the ANSI C header files. */
14#define STDC_HEADERS 1 14#define STDC_HEADERS 1
15 15
16/* Define this if your sockaddr structure contains sin_len */ 16/* Define this if your sockaddr structure contains sin_len */
17/* #undef HAVE_SOCK_SIN_LEN */ 17/* #undef HAVE_SOCK_SIN_LEN */
18 18
19/* How many bits would you like to have in an off_t? */ 19/* How many bits would you like to have in an off_t? */
20#define _FILE_OFFSET_BITS 64 20#define _FILE_OFFSET_BITS 64
21 21
22/* Define to include GNU C library extensions. */ 22/* Define to include GNU C library extensions. */
23#define _GNU_SOURCE 1 23#define _GNU_SOURCE 1
24 24
25/* GNU extension of saving argv[0] to program_invocation_short_name */ 25/* GNU extension of saving argv[0] to program_invocation_short_name */
26#define HAVE_PROGRAM_INVOCATION_NAME 1 26/* #define HAVE_PROGRAM_INVOCATION_NAME 1 */
27 27
28/* Define to a replacement type if intmax_t is not a builtin, or in 28/* Define to a replacement type if intmax_t is not a builtin, or in
29 sys/types.h or stdlib.h or stddef.h */ 29 sys/types.h or stdlib.h or stddef.h */
30/* #undef intmax_t */ 30/* #undef intmax_t */
31 31
32/* The number of bytes in a int. */ 32/* The number of bytes in a int. */
33#define SIZEOF_INT 4 33#define SIZEOF_INT 4
34 34
35/* The number of bytes in a long. */ 35/* The number of bytes in a long. */
36#define SIZEOF_LONG 4 36#define SIZEOF_LONG 4
37 37
38/* The number of bytes in a off_t. */ 38/* The number of bytes in a off_t. */
39#define SIZEOF_OFF_T 8 39#define SIZEOF_OFF_T 8
40 40
41/* The number of bytes in a short. */ 41/* The number of bytes in a short. */
42#define SIZEOF_SHORT 2 42#define SIZEOF_SHORT 2
43 43
44/* The number of bytes in a size_t. */ 44/* The number of bytes in a size_t. */
45#define SIZEOF_SIZE_T 4 45#define SIZEOF_SIZE_T 4
46 46
47/* The number of bytes in a unsigned char. */ 47/* The number of bytes in a unsigned char. */
48#define SIZEOF_UNSIGNED_CHAR 1 48#define SIZEOF_UNSIGNED_CHAR 1
49 49
50/* The number of bytes in a unsigned int. */ 50/* The number of bytes in a unsigned int. */
51#define SIZEOF_UNSIGNED_INT 4 51#define SIZEOF_UNSIGNED_INT 4
52 52
53/* The number of bytes in a unsigned long. */ 53/* The number of bytes in a unsigned long. */
54#define SIZEOF_UNSIGNED_LONG 4 54#define SIZEOF_UNSIGNED_LONG 4
55 55
56/* The number of bytes in a unsigned short. */ 56/* The number of bytes in a unsigned short. */
57#define SIZEOF_UNSIGNED_SHORT 2 57#define SIZEOF_UNSIGNED_SHORT 2
58 58
59/* Define if you have the mtrace function. */ 59/* Define if you have the mtrace function. */
60#define HAVE_MTRACE 1 60#define HAVE_MTRACE 1
61 61
62/* Define if you have the snprintf function. */ 62/* Define if you have the snprintf function. */
63#define HAVE_SNPRINTF 1 63#define HAVE_SNPRINTF 1
64 64
65/* Define if you have the strerror function. */ 65/* Define if you have the strerror function. */
66#define HAVE_STRERROR 1 66#define HAVE_STRERROR 1
67 67
68/* Define if you have the vsnprintf function. */ 68/* Define if you have the vsnprintf function. */
69#define HAVE_VSNPRINTF 1 69#define HAVE_VSNPRINTF 1
70 70
71/* Define if you have the <alloca.h> header file. */ 71/* Define if you have the <alloca.h> header file. */
72#define HAVE_ALLOCA_H 1 72#define HAVE_ALLOCA_H 1
73 73
74/* Define if you have the <bzlib.h> header file. */ 74/* Define if you have the <bzlib.h> header file. */
75#define HAVE_BZLIB_H 1 75#define HAVE_BZLIB_H 1
76 76
77/* Define if you have the <config.h> header file. */ 77/* Define if you have the <config.h> header file. */
78/* #undef HAVE_CONFIG_H */ 78/* #undef HAVE_CONFIG_H */
79 79
80/* Define if you have the <dlfcn.h> header file. */ 80/* Define if you have the <dlfcn.h> header file. */
81#define HAVE_DLFCN_H 1 81#define HAVE_DLFCN_H 1
82 82
83/* Define if you have the <libintl.h> header file. */ 83/* Define if you have the <libintl.h> header file. */
84#define HAVE_LIBINTL_H 1 84#define HAVE_LIBINTL_H 1
85 85
86/* Define if you have the <mcheck.h> header file. */ 86/* Define if you have the <mcheck.h> header file. */
87#define HAVE_MCHECK_H 1 87#define HAVE_MCHECK_H 1
88 88
89/* Define if you have the <stdint.h> header file. */ 89/* Define if you have the <stdint.h> header file. */
90#define HAVE_STDINT_H 1 90#define HAVE_STDINT_H 1
91 91
92/* Define if you have the <unistd.h> header file. */ 92/* Define if you have the <unistd.h> header file. */
93#define HAVE_UNISTD_H 1 93#define HAVE_UNISTD_H 1
94 94
95/* Define if you have the popt library (-lpopt). */ 95/* Define if you have the popt library (-lpopt). */
96#define HAVE_LIBPOPT 1 96#define HAVE_LIBPOPT 1
97 97
98/* Name of package */ 98/* Name of package */
99#define PACKAGE "librsync" 99#define PACKAGE "librsync"
100 100
101/* Version number of package */ 101/* Version number of package */
102#define VERSION "0.9.5" 102#define VERSION "0.9.5"
103 103
104/* Number of bits in a file offset, on hosts where this is settable. */ 104/* Number of bits in a file offset, on hosts where this is settable. */
105#define _FILE_OFFSET_BITS 64 105#define _FILE_OFFSET_BITS 64
106 106
107/* Define to make ftello visible on some hosts (e.g. HP-UX 10.20). */ 107/* Define to make ftello visible on some hosts (e.g. HP-UX 10.20). */
108/* #undef _LARGEFILE_SOURCE */ 108/* #undef _LARGEFILE_SOURCE */
109 109
110/* Define for large files, on AIX-style hosts. */ 110/* Define for large files, on AIX-style hosts. */
111/* #undef _LARGE_FILES */ 111/* #undef _LARGE_FILES */
112 112
113/* Define to make ftello visible on some hosts (e.g. glibc 2.1.3). */ 113/* Define to make ftello visible on some hosts (e.g. glibc 2.1.3). */
114/* #undef _XOPEN_SOURCE */ 114/* #undef _XOPEN_SOURCE */
115 115
diff --git a/rsync/trace.h b/rsync/trace.h
index 60a6477..2bb8552 100644
--- a/rsync/trace.h
+++ b/rsync/trace.h
@@ -1,122 +1,112 @@
1/*= -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- 1/*= -*- c-basic-offset: 4; indent-tabs-mode: nil; -*-
2 * 2 *
3 * librsync -- generate and apply network deltas 3 * librsync -- generate and apply network deltas
4 * $Id$ 4 * $Id$
5 * 5 *
6 * Copyright (C) 2000, 2001 by Martin Pool <mbp@samba.org> 6 * Copyright (C) 2000, 2001 by Martin Pool <mbp@samba.org>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as published by 9 * it under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation; either version 2.1 of the License, or 10 * the Free Software Foundation; either version 2.1 of the License, or
11 * (at your option) any later version. 11 * (at your option) any later version.
12 * 12 *
13 * This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Lesser General Public License for more details. 16 * GNU Lesser General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU Lesser General Public License 18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software 19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */ 21 */
22 22
23 23
24/* 24/*
25 * TODO: A function like perror that includes strerror output. Apache 25 * TODO: A function like perror that includes strerror output. Apache
26 * does this by adding flags as well as the severity level which say 26 * does this by adding flags as well as the severity level which say
27 * whether such information should be included. 27 * whether such information should be included.
28 */ 28 */
29 29
30 30
31/* 31/*
32 * trace may be turned off. 32 * trace may be turned off.
33 * 33 *
34 * error is always on, but you can return and continue in some way 34 * error is always on, but you can return and continue in some way
35 * 35 *
36 * fatal terminates the whole process 36 * fatal terminates the whole process
37 */ 37 */
38 38
39void rs_fatal0(char const *s, ...); 39#if defined(HAVE_VARARG_MACROS) && defined(__GNUC__)
40void rs_error0(char const *s, ...); 40/*
41void rs_trace0(char const *s, ...); 41 * TODO: Don't assume this is a gcc thing; rather test in autoconf for
42 42 * support for __FUNCTION__. One simple way might just be to try compiling
43void rs_log0_nofn(int level, char const *fmt, ...); 43 * the definition of one of these functions!
44 44 *
45#ifdef __GNUC__ 45 * TODO: Also look for the C9X predefined identifier `_function', or
46 * whatever it's called.
47 */
46 48
47void rs_log0(int level, char const *fn, char const *fmt, ...) 49void rs_log0(int level, char const *fn, char const *fmt, ...)
48 __attribute__ ((format(printf, 3, 4))); 50 __attribute__ ((format(printf, 3, 4)));
49 51
50#ifdef DO_RS_TRACE 52#ifdef DO_RS_TRACE
51# define rs_trace(fmt, arg...) \ 53# define rs_trace(fmt, arg...) \
52 do { rs_log0(RS_LOG_DEBUG, __FUNCTION__, fmt , ##arg); \ 54 do { rs_log0(RS_LOG_DEBUG, __FUNCTION__, fmt , ##arg); \
53 } while (0) 55 } while (0)
54#else 56#else
55# define rs_trace(s, str...) 57# define rs_trace(fmt, arg...)
56 #endif/* !DO_RS_TRACE */ 58 #endif/* !DO_RS_TRACE */
57 59
58/*
59 * TODO: Don't assume this is a gcc thing; rather test in autoconf for
60 * support for __FUNCTION__ and varargs macros. One simple way might
61 * just be to try compiling the definition of one of these functions!
62 *
63 * TODO: Also look for the C9X predefined identifier `_function', or
64 * whatever it's called.
65 */
66
67#define rs_log(l, s, str...) do { \ 60#define rs_log(l, s, str...) do { \
68 rs_log0((l), __FUNCTION__, (s) , ##str); \ 61 rs_log0((l), __FUNCTION__, (s) , ##str); \
69 } while (0) 62 } while (0)
70 63
71 64
72#define rs_error(s, str...) do { \ 65#define rs_error(s, str...) do { \
73 rs_log0(RS_LOG_ERR, __FUNCTION__, (s) , ##str); \ 66 rs_log0(RS_LOG_ERR, __FUNCTION__, (s) , ##str); \
74 } while (0) 67 } while (0)
75 68
76 69
77#define rs_fatal(s, str...) do { \ 70#define rs_fatal(s, str...) do { \
78 rs_log0(RS_LOG_CRIT, __FUNCTION__, \ 71 rs_log0(RS_LOG_CRIT, __FUNCTION__, \
79 (s) , ##str); \ 72 (s) , ##str); \
80 abort(); \ 73 abort(); \
81 } while (0) 74 } while (0)
82 75
83 76
84#else /************************* ! __GNUC__ */ 77#else /************************* ! __GNUC__ */
85 78# define rs_trace rs_trace0
86# define rs_fatal rs_fatal0 79# define rs_fatal rs_fatal0
87# define rs_error rs_error0 80# define rs_error rs_error0
88# define rs_log rs_log0_nofn 81# define rs_log rs_log0_nofn
89
90# ifdef DO_RS_TRACE
91# define rs_trace rs_trace0
92 # endif /* DO_RS_TRACE */
93 #endif /* ! __GNUC__ */ 82 #endif /* ! __GNUC__ */
94 83
95 84void rs_trace0(char const *s, ...);
85void rs_fatal0(char const *s, ...);
86void rs_error0(char const *s, ...);
96void rs_log0(int level, char const *fn, char const *fmt, ...); 87void rs_log0(int level, char const *fn, char const *fmt, ...);
97 88void rs_log0_nofn(int level, char const *fmt, ...);
98 89
99enum { 90enum {
100 RS_LOG_PRIMASK = 7, /**< Mask to extract priority 91 RS_LOG_PRIMASK = 7, /**< Mask to extract priority
101 part. \internal */ 92 part. \internal */
102 93
103 RS_LOG_NONAME = 8 /**< \b Don't show function name in 94 RS_LOG_NONAME = 8 /**< \b Don't show function name in
104 message. */ 95 message. */
105}; 96};
106 97
107 98
108
109/** 99/**
110 * \macro rs_trace_enabled() 100 * \macro rs_trace_enabled()
111 * 101 *
112 * Call this before putting too much effort into generating trace 102 * Call this before putting too much effort into generating trace
113 * messages. 103 * messages.
114 */ 104 */
115 105
116extern int rs_trace_level; 106extern int rs_trace_level;
117 107
118#ifdef DO_RS_TRACE 108#ifdef DO_RS_TRACE
119# define rs_trace_enabled() ((rs_trace_level & RS_LOG_PRIMASK) >= RS_LOG_DEBUG) 109# define rs_trace_enabled() ((rs_trace_level & RS_LOG_PRIMASK) >= RS_LOG_DEBUG)
120#else 110#else
121# define rs_trace_enabled() 0 111# define rs_trace_enabled() 0
122#endif 112#endif
diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h
index 97c7917..e438bd8 100644
--- a/scripts/kconfig/lkc_proto.h
+++ b/scripts/kconfig/lkc_proto.h
@@ -1,39 +1,39 @@
1 1
2/* confdata.c */ 2/* confdata.c */
3P(conf_parse,void,(const char *name)); 3P(conf_parse,void,(const char *name));
4P(conf_read,int,(const char *name)); 4P(conf_read,int,(const char *name));
5P(conf_write,int,(const char *name)); 5P(conf_write,int,(const char *name));
6 6
7/* menu.c */ 7/* menu.c */
8P(rootmenu,struct menu,); 8extern struct menu rootmenu;
9 9
10P(menu_is_visible,bool,(struct menu *menu)); 10P(menu_is_visible,bool,(struct menu *menu));
11P(menu_get_prompt,const char *,(struct menu *menu)); 11P(menu_get_prompt,const char *,(struct menu *menu));
12P(menu_get_root_menu,struct menu *,(struct menu *menu)); 12P(menu_get_root_menu,struct menu *,(struct menu *menu));
13P(menu_get_parent_menu,struct menu *,(struct menu *menu)); 13P(menu_get_parent_menu,struct menu *,(struct menu *menu));
14 14
15/* symbol.c */ 15/* symbol.c */
16P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]); 16P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]);
17P(sym_change_count,int,); 17extern int sym_change_count;
18 18
19P(sym_lookup,struct symbol *,(const char *name, int isconst)); 19P(sym_lookup,struct symbol *,(const char *name, int isconst));
20P(sym_find,struct symbol *,(const char *name)); 20P(sym_find,struct symbol *,(const char *name));
21P(sym_type_name,const char *,(enum symbol_type type)); 21P(sym_type_name,const char *,(enum symbol_type type));
22P(sym_calc_value,void,(struct symbol *sym)); 22P(sym_calc_value,void,(struct symbol *sym));
23P(sym_get_type,enum symbol_type,(struct symbol *sym)); 23P(sym_get_type,enum symbol_type,(struct symbol *sym));
24P(sym_tristate_within_range,bool,(struct symbol *sym,tristate tri)); 24P(sym_tristate_within_range,bool,(struct symbol *sym,tristate tri));
25P(sym_set_tristate_value,bool,(struct symbol *sym,tristate tri)); 25P(sym_set_tristate_value,bool,(struct symbol *sym,tristate tri));
26P(sym_toggle_tristate_value,tristate,(struct symbol *sym)); 26P(sym_toggle_tristate_value,tristate,(struct symbol *sym));
27P(sym_string_valid,bool,(struct symbol *sym, const char *newval)); 27P(sym_string_valid,bool,(struct symbol *sym, const char *newval));
28P(sym_string_within_range,bool,(struct symbol *sym, const char *str)); 28P(sym_string_within_range,bool,(struct symbol *sym, const char *str));
29P(sym_set_string_value,bool,(struct symbol *sym, const char *newval)); 29P(sym_set_string_value,bool,(struct symbol *sym, const char *newval));
30P(sym_is_changable,bool,(struct symbol *sym)); 30P(sym_is_changable,bool,(struct symbol *sym));
31P(sym_get_choice_prop,struct property *,(struct symbol *sym)); 31P(sym_get_choice_prop,struct property *,(struct symbol *sym));
32P(sym_get_default_prop,struct property *,(struct symbol *sym)); 32P(sym_get_default_prop,struct property *,(struct symbol *sym));
33P(sym_get_string_value,const char *,(struct symbol *sym)); 33P(sym_get_string_value,const char *,(struct symbol *sym));
34 34
35P(prop_get_type_name,const char *,(enum prop_type type)); 35P(prop_get_type_name,const char *,(enum prop_type type));
36 36
37/* expr.c */ 37/* expr.c */
38P(expr_compare_type,int,(enum expr_type t1, enum expr_type t2)); 38P(expr_compare_type,int,(enum expr_type t1, enum expr_type t2));
39P(expr_print,void,(struct expr *e, void (*fn)(void *, const char *), void *data, int prevtoken)); 39P(expr_print,void,(struct expr *e, void (*fn)(void *, const char *), void *data, int prevtoken));