author | zecke <zecke> | 2003-10-04 08:59:51 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-10-04 08:59:51 (UTC) |
commit | dc9510f788212a6be063349461540e4bea690f51 (patch) (unidiff) | |
tree | b8728fdc12c1580287f16f3828180beac5d55c13 | |
parent | 23f729eb7487ad189591c3b0c9af9d3afecd3b91 (diff) | |
download | opie-dc9510f788212a6be063349461540e4bea690f51.zip opie-dc9510f788212a6be063349461540e4bea690f51.tar.gz opie-dc9510f788212a6be063349461540e4bea690f51.tar.bz2 |
Allow Opie beeing build with a Plain version of Qt without weak symbols
-rw-r--r-- | Rules.make | 3 | ||||
-rw-r--r-- | config.in | 4 | ||||
-rw-r--r-- | library/library.pro | 6 | ||||
-rw-r--r-- | library/qpeapplication.cpp | 10 | ||||
-rw-r--r-- | library/qt_override.cpp | 40 |
5 files changed, 44 insertions, 19 deletions
@@ -1,203 +1,206 @@ | |||
1 | .phony: force | 1 | .phony: force |
2 | force: | 2 | force: |
3 | 3 | ||
4 | $(configs) : | 4 | $(configs) : |
5 | $(call makecfg,$@) | 5 | $(call makecfg,$@) |
6 | 6 | ||
7 | $(TOPDIR)/gen.pro : $(TOPDIR)/.config | 7 | $(TOPDIR)/gen.pro : $(TOPDIR)/.config |
8 | echo > $@ | 8 | echo > $@ |
9 | ifneq ($(CONFIG_DEBUG),) | 9 | ifneq ($(CONFIG_DEBUG),) |
10 | echo CONFIG += debug >> $@ | 10 | echo CONFIG += debug >> $@ |
11 | echo CONFIG -= release >> $@ | 11 | echo CONFIG -= release >> $@ |
12 | else | 12 | else |
13 | echo CONFIG -= debug >> $@ | 13 | echo CONFIG -= debug >> $@ |
14 | echo CONFIG += release >> $@ | 14 | echo CONFIG += release >> $@ |
15 | endif | 15 | endif |
16 | ifeq ($(filter 3.%,$(QTE_VERSION)),) # not qt3 | 16 | ifeq ($(filter 3.%,$(QTE_VERSION)),) # not qt3 |
17 | echo CONFIG -= qt3 >> $@ | 17 | echo CONFIG -= qt3 >> $@ |
18 | else | 18 | else |
19 | echo CONFIG += qt3 >> $@ | 19 | echo CONFIG += qt3 >> $@ |
20 | endif | 20 | endif |
21 | ifeq ($(CONFIG_QUICK_LAUNCH),) | 21 | ifeq ($(CONFIG_QUICK_LAUNCH),) |
22 | echo contains\( CONFIG, quick-app \) \{ >> $@ | 22 | echo contains\( CONFIG, quick-app \) \{ >> $@ |
23 | echo CONFIG -= quick-app >> $@ | 23 | echo CONFIG -= quick-app >> $@ |
24 | echo CONFIG += quick-app-lib >> $@ | 24 | echo CONFIG += quick-app-lib >> $@ |
25 | echo \} >> $@ | 25 | echo \} >> $@ |
26 | else | 26 | else |
27 | echo contains\( CONFIG, quick-app \) \{ >> $@ | 27 | echo contains\( CONFIG, quick-app \) \{ >> $@ |
28 | echo CONFIG -= quick-app >> $@ | 28 | echo CONFIG -= quick-app >> $@ |
29 | echo CONFIG += quick-app-bin >> $@ | 29 | echo CONFIG += quick-app-bin >> $@ |
30 | echo \} >> $@ | 30 | echo \} >> $@ |
31 | endif | 31 | endif |
32 | ifeq ($(CONFIG_OPIE_NO_OVERRIDE_QT),y) | ||
33 | echo CONFIG += no-override >> $@ | ||
34 | endif | ||
32 | 35 | ||
33 | $(TOPDIR)/.depends : $(shell if [ -e $(TOPDIR)/config.in ]\; then echo $(TOPDIR)/config.in\; fi\;) $(TOPDIR)/.config $(TOPDIR)/packages | 36 | $(TOPDIR)/.depends : $(shell if [ -e $(TOPDIR)/config.in ]\; then echo $(TOPDIR)/config.in\; fi\;) $(TOPDIR)/.config $(TOPDIR)/packages |
34 | @echo Generating dependency information... | 37 | @echo Generating dependency information... |
35 | # add to subdir-y, and add descend rules | 38 | # add to subdir-y, and add descend rules |
36 | @cat $(TOPDIR)/packages | grep -v '^#' | \ | 39 | @cat $(TOPDIR)/packages | grep -v '^#' | \ |
37 | awk '{print \ | 40 | awk '{print \ |
38 | ".PHONY : " $$2 "\n" \ | 41 | ".PHONY : " $$2 "\n" \ |
39 | "subdir-$$(" $$1 ") += " $$2 "\n\n"; \ | 42 | "subdir-$$(" $$1 ") += " $$2 "\n\n"; \ |
40 | print $$2 " : " $$2 "/Makefile\n\t$$(call descend,$$@,$(filter-out $$@,$$(filter-out $$@,$$(MAKECMDGOALS))))\n"; }' > $(TOPDIR)/.depends | 43 | print $$2 " : " $$2 "/Makefile\n\t$$(call descend,$$@,$(filter-out $$@,$$(filter-out $$@,$$(MAKECMDGOALS))))\n"; }' > $(TOPDIR)/.depends |
41 | cat $(TOPDIR)/packages | grep -v '^#' | \ | 44 | cat $(TOPDIR)/packages | grep -v '^#' | \ |
42 | perl -ne '($$cfg, $$dir, $$pro) = $$_ =~ /^(\S+)\s+(\S+)\s+(\S+)/; if ( -e "$$dir/$$pro" ) { print "$$dir/Makefile : $$dir/$$pro \$$(QMAKE) \$$(OPIEDIR)/gen.pro \$$(OPIEDIR)/.config\n\t\$$(call makefilegen,\$$@)\n\n"; }' \ | 45 | perl -ne '($$cfg, $$dir, $$pro) = $$_ =~ /^(\S+)\s+(\S+)\s+(\S+)/; if ( -e "$$dir/$$pro" ) { print "$$dir/Makefile : $$dir/$$pro \$$(QMAKE) \$$(OPIEDIR)/gen.pro \$$(OPIEDIR)/.config\n\t\$$(call makefilegen,\$$@)\n\n"; }' \ |
43 | >> $(TOPDIR)/.depends | 46 | >> $(TOPDIR)/.depends |
44 | # interpackage dependency generation | 47 | # interpackage dependency generation |
45 | @cat $(TOPDIR)/packages | \ | 48 | @cat $(TOPDIR)/packages | \ |
46 | $(TOPDIR)/scripts/deps.pl >> $(TOPDIR)/.depends | 49 | $(TOPDIR)/scripts/deps.pl >> $(TOPDIR)/.depends |
47 | 50 | ||
48 | $(TOPDIR)/.depends.cfgs: | 51 | $(TOPDIR)/.depends.cfgs: |
49 | # config.in interdependencies | 52 | # config.in interdependencies |
50 | @echo $(configs) | sed -e 's,/config.in,,g' | ( for i in `cat`; do echo $$i; done ) > dirs | 53 | @echo $(configs) | sed -e 's,/config.in,,g' | ( for i in `cat`; do echo $$i; done ) > dirs |
51 | @cat dirs | ( for i in `cat`; do if [ "`cat dirs|grep $$i 2>/dev/null|wc -l`" -ne "1" ]; then deps=`cat dirs|grep $$i| grep -v "^$$i$$"|for i in \`cat|sed -e's,^$(TOPDIR)/,$$(TOPDIR)/,g'\`; do echo $$i/config.in; done`; echo `echo $$i/config.in|sed -e 's,^$(TOPDIR)/,$$(TOPDIR)/,'` : $$deps; fi; done ) >> $@ | 54 | @cat dirs | ( for i in `cat`; do if [ "`cat dirs|grep $$i 2>/dev/null|wc -l`" -ne "1" ]; then deps=`cat dirs|grep $$i| grep -v "^$$i$$"|for i in \`cat|sed -e's,^$(TOPDIR)/,$$(TOPDIR)/,g'\`; do echo $$i/config.in; done`; echo `echo $$i/config.in|sed -e 's,^$(TOPDIR)/,$$(TOPDIR)/,'` : $$deps; fi; done ) >> $@ |
52 | @-rm -f dirs | 55 | @-rm -f dirs |
53 | 56 | ||
54 | $(QTDIR)/stamp-headers : | 57 | $(QTDIR)/stamp-headers : |
55 | @-rm -f $(QTDIR)/stamp-headers* | 58 | @-rm -f $(QTDIR)/stamp-headers* |
56 | ( cd $(QTDIR)/include; \ | 59 | ( cd $(QTDIR)/include; \ |
57 | $(patsubst %,ln -sf ../src/kernel/%;,qgfx_qws.h qwsmouse_qws.h \ | 60 | $(patsubst %,ln -sf ../src/kernel/%;,qgfx_qws.h qwsmouse_qws.h \ |
58 | qcopchannel_qws.h qwindowsystem_qws.h \ | 61 | qcopchannel_qws.h qwindowsystem_qws.h \ |
59 | qfontmanager_qws.h qwsdefaultdecoration_qws.h)) | 62 | qfontmanager_qws.h qwsdefaultdecoration_qws.h)) |
60 | touch $@ | 63 | touch $@ |
61 | 64 | ||
62 | $(QTDIR)/stamp-headers-x11 : | 65 | $(QTDIR)/stamp-headers-x11 : |
63 | @-rm -f $(QTDIR)/stamp-headers* | 66 | @-rm -f $(QTDIR)/stamp-headers* |
64 | cd $(QTDIR)/include; $(patsubst %,ln -sf $(OPIEDIR)/x11/libqpe-x11/qt/%;,qgfx_qws.h qwsmouse_qws.h qcopchannel_qws.h qwindowsystem_qws.h qfontmanager_qws.h qwsdefaultdecoration_qws.h) | 67 | cd $(QTDIR)/include; $(patsubst %,ln -sf $(OPIEDIR)/x11/libqpe-x11/qt/%;,qgfx_qws.h qwsmouse_qws.h qcopchannel_qws.h qwindowsystem_qws.h qfontmanager_qws.h qwsdefaultdecoration_qws.h) |
65 | touch $@ | 68 | touch $@ |
66 | 69 | ||
67 | $(OPIEDIR)/stamp-headers : | 70 | $(OPIEDIR)/stamp-headers : |
68 | @-rm -f $(OPIEDIR)/stamp-headers* | 71 | @-rm -f $(OPIEDIR)/stamp-headers* |
69 | mkdir -p $(TOPDIR)/include/qpe \ | 72 | mkdir -p $(TOPDIR)/include/qpe \ |
70 | $(TOPDIR)/include/qtopia \ | 73 | $(TOPDIR)/include/qtopia \ |
71 | $(TOPDIR)/include/opie \ | 74 | $(TOPDIR)/include/opie \ |
72 | $(TOPDIR)/include/opie2 \ | 75 | $(TOPDIR)/include/opie2 \ |
73 | $(TOPDIR)/include/qtopia/private | 76 | $(TOPDIR)/include/qtopia/private |
74 | ( cd include/qpe && rm -f *.h; ln -sf ../../library/*.h .; ln -sf ../../library/backend/*.h .; rm -f *_p.h; ) | 77 | ( cd include/qpe && rm -f *.h; ln -sf ../../library/*.h .; ln -sf ../../library/backend/*.h .; rm -f *_p.h; ) |
75 | ( cd include/qtopia && rm -f *.h; ln -sf ../../library/*.h .; ) | 78 | ( cd include/qtopia && rm -f *.h; ln -sf ../../library/*.h .; ) |
76 | ( cd include/qtopia/private && rm -f *.h; ln -sf ../../../library/backend/*.h .; ) | 79 | ( cd include/qtopia/private && rm -f *.h; ln -sf ../../../library/backend/*.h .; ) |
77 | ( cd include/opie && rm -f *.h; ln -sf ../../libopie/*.h .; rm -f *_p.h; ) | 80 | ( cd include/opie && rm -f *.h; ln -sf ../../libopie/*.h .; rm -f *_p.h; ) |
78 | ( cd include/opie && ln -sf ../../libopie/pim/*.h .; ) | 81 | ( cd include/opie && ln -sf ../../libopie/pim/*.h .; ) |
79 | ( cd include/opie && ln -sf ../../libopie/big-screen/*.h .; ) | 82 | ( cd include/opie && ln -sf ../../libopie/big-screen/*.h .; ) |
80 | ( cd include/opie2 && ln -sf ../../libopie2/opiecore/*.h .; ) | 83 | ( cd include/opie2 && ln -sf ../../libopie2/opiecore/*.h .; ) |
81 | ( cd include/opie2 && ln -sf ../../libopie2/opiemm/*.h .; ) | 84 | ( cd include/opie2 && ln -sf ../../libopie2/opiemm/*.h .; ) |
82 | ( cd include/opie2 && ln -sf ../../libopie2/opiedb/*.h .; ) | 85 | ( cd include/opie2 && ln -sf ../../libopie2/opiedb/*.h .; ) |
83 | ( cd include/opie2 && ln -sf ../../libopie2/opienet/*.h .; ) | 86 | ( cd include/opie2 && ln -sf ../../libopie2/opienet/*.h .; ) |
84 | #( cd include/opie2 && ln -sf ../../libopie2/opiepim/*.h .; ) | 87 | #( cd include/opie2 && ln -sf ../../libopie2/opiepim/*.h .; ) |
85 | ( cd include/opie2 && ln -sf ../../libopie2/opieui/*.h .; ) | 88 | ( cd include/opie2 && ln -sf ../../libopie2/opieui/*.h .; ) |
86 | ( cd include/opie; for generatedHeader in `cd ../../libopie; ls *.ui | sed -e "s,\.ui,\.h,g"`; do \ | 89 | ( cd include/opie; for generatedHeader in `cd ../../libopie; ls *.ui | sed -e "s,\.ui,\.h,g"`; do \ |
87 | ln -sf ../../libopie/$$generatedHeader $$generatedHeader; done ) | 90 | ln -sf ../../libopie/$$generatedHeader $$generatedHeader; done ) |
88 | ln -sf ../../library/custom.h $(TOPDIR)/include/qpe/custom.h | 91 | ln -sf ../../library/custom.h $(TOPDIR)/include/qpe/custom.h |
89 | touch $@ | 92 | touch $@ |
90 | 93 | ||
91 | $(OPIEDIR)/stamp-headers-x11 : | 94 | $(OPIEDIR)/stamp-headers-x11 : |
92 | @-rm -f $(OPIEDIR)/stamp-headers* | 95 | @-rm -f $(OPIEDIR)/stamp-headers* |
93 | mkdir -p $(TOPDIR)/include/qpe $(TOPDIR)/include/qtopia \ | 96 | mkdir -p $(TOPDIR)/include/qpe $(TOPDIR)/include/qtopia \ |
94 | $(TOPDIR)/include/opie $(TOPDIR)/include/qtopia/private | 97 | $(TOPDIR)/include/opie $(TOPDIR)/include/qtopia/private |
95 | ( cd include/qpe && rm -f *.h; ln -sf ../../library/*.h .; ln -sf ../../library/backend/*.h .; rm -f *_p.h; ) | 98 | ( cd include/qpe && rm -f *.h; ln -sf ../../library/*.h .; ln -sf ../../library/backend/*.h .; rm -f *_p.h; ) |
96 | ( cd include/qtopia && rm -f *.h; ln -sf ../../library/*.h .; ) | 99 | ( cd include/qtopia && rm -f *.h; ln -sf ../../library/*.h .; ) |
97 | ( cd include/qtopia/private && rm -f *.h; ln -sf ../../../library/backend/*.h .; ) | 100 | ( cd include/qtopia/private && rm -f *.h; ln -sf ../../../library/backend/*.h .; ) |
98 | ( cd include/opie && rm -f *.h; ln -sf ../../libopie/*.h .; rm -f *_p.h; ) | 101 | ( cd include/opie && rm -f *.h; ln -sf ../../libopie/*.h .; rm -f *_p.h; ) |
99 | ( cd include/opie && ln -sf ../../libsql/*.h .; ) | 102 | ( cd include/opie && ln -sf ../../libsql/*.h .; ) |
100 | ( cd include/opie && ln -sf ../../libopie/pim/*.h .; ) | 103 | ( cd include/opie && ln -sf ../../libopie/pim/*.h .; ) |
101 | ( cd include/opie; for generatedHeader in `cd ../../libopie; ls *.ui | sed -e "s,\.ui,\.h,g"`; do \ | 104 | ( cd include/opie; for generatedHeader in `cd ../../libopie; ls *.ui | sed -e "s,\.ui,\.h,g"`; do \ |
102 | ln -sf ../../libopie/$$generatedHeader $$generatedHeader; done ) | 105 | ln -sf ../../libopie/$$generatedHeader $$generatedHeader; done ) |
103 | ln -sf ../../library/custom.h $(TOPDIR)/include/qpe/custom.h | 106 | ln -sf ../../library/custom.h $(TOPDIR)/include/qpe/custom.h |
104 | ( cd include/qpe; ln -sf ../../x11/libqpe-x11/qpe/*.h .; ) | 107 | ( cd include/qpe; ln -sf ../../x11/libqpe-x11/qpe/*.h .; ) |
105 | touch $@ | 108 | touch $@ |
106 | 109 | ||
107 | $(TOPDIR)/library/custom.h : $(TOPDIR)/.config | 110 | $(TOPDIR)/library/custom.h : $(TOPDIR)/.config |
108 | @-rm -f $@ | 111 | @-rm -f $@ |
109 | @$(if $(patsubst "%",%,$(CONFIG_CUSTOMFILE)),\ | 112 | @$(if $(patsubst "%",%,$(CONFIG_CUSTOMFILE)),\ |
110 | ln -sf $(patsubst "%",%,$(CONFIG_CUSTOMFILE)) $@) | 113 | ln -sf $(patsubst "%",%,$(CONFIG_CUSTOMFILE)) $@) |
111 | @touch $@ | 114 | @touch $@ |
112 | 115 | ||
113 | $(TOPDIR)/scripts/lxdialog/lxdialog $(TOPDIR)/scripts/kconfig/mconf $(TOPDIR)/scripts/kconfig/conf $(TOPDIR)/scripts/kconfig/qconf $(TOPDIR)/scripts/kconfig/libkconfig.so $(TOPDIR)/scripts/kconfig/gconf $(TOPDIR)/qmake/qmake: | 116 | $(TOPDIR)/scripts/lxdialog/lxdialog $(TOPDIR)/scripts/kconfig/mconf $(TOPDIR)/scripts/kconfig/conf $(TOPDIR)/scripts/kconfig/qconf $(TOPDIR)/scripts/kconfig/libkconfig.so $(TOPDIR)/scripts/kconfig/gconf $(TOPDIR)/qmake/qmake: |
114 | @$(call descend,$(shell dirname $@),$(shell basename $@)) | 117 | @$(call descend,$(shell dirname $@),$(shell basename $@)) |
115 | 118 | ||
116 | menuconfig: $(TOPDIR)/scripts/lxdialog/lxdialog $(TOPDIR)/scripts/kconfig/mconf ./config.in | 119 | menuconfig: $(TOPDIR)/scripts/lxdialog/lxdialog $(TOPDIR)/scripts/kconfig/mconf ./config.in |
117 | $(TOPDIR)/scripts/kconfig/mconf ./config.in | 120 | $(TOPDIR)/scripts/kconfig/mconf ./config.in |
118 | @touch ./.config.stamp | 121 | @touch ./.config.stamp |
119 | 122 | ||
120 | xconfig: $(TOPDIR)/scripts/kconfig/qconf $(TOPDIR)/scripts/kconfig/libkconfig.so ./config.in | 123 | xconfig: $(TOPDIR)/scripts/kconfig/qconf $(TOPDIR)/scripts/kconfig/libkconfig.so ./config.in |
121 | $(TOPDIR)/scripts/kconfig/qconf ./config.in | 124 | $(TOPDIR)/scripts/kconfig/qconf ./config.in |
122 | @touch .config.stamp | 125 | @touch .config.stamp |
123 | 126 | ||
124 | gconfig: $(TOPDIR)/scripts/kconfig/gconf $(TOPDIR)/scripts/kconfig/libkconfig.so ./config.in | 127 | gconfig: $(TOPDIR)/scripts/kconfig/gconf $(TOPDIR)/scripts/kconfig/libkconfig.so ./config.in |
125 | $(TOPDIR)/scripts/kconfig/gconf ./config.in | 128 | $(TOPDIR)/scripts/kconfig/gconf ./config.in |
126 | @touch .config.stamp | 129 | @touch .config.stamp |
127 | 130 | ||
128 | config: $(TOPDIR)/scripts/kconfig/conf ./config.in | 131 | config: $(TOPDIR)/scripts/kconfig/conf ./config.in |
129 | $(TOPDIR)/scripts/kconfig/conf ./config.in | 132 | $(TOPDIR)/scripts/kconfig/conf ./config.in |
130 | @touch .config.stamp | 133 | @touch .config.stamp |
131 | 134 | ||
132 | oldconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in | 135 | oldconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in |
133 | $(TOPDIR)/scripts/kconfig/conf -o ./config.in | 136 | $(TOPDIR)/scripts/kconfig/conf -o ./config.in |
134 | @touch .config.stamp | 137 | @touch .config.stamp |
135 | 138 | ||
136 | randconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in | 139 | randconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in |
137 | $(TOPDIR)/scripts/kconfig/conf -r ./config.in | 140 | $(TOPDIR)/scripts/kconfig/conf -r ./config.in |
138 | @touch .config.stamp | 141 | @touch .config.stamp |
139 | 142 | ||
140 | allyesconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in | 143 | allyesconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in |
141 | $(TOPDIR)/scripts/kconfig/conf -y ./config.in | 144 | $(TOPDIR)/scripts/kconfig/conf -y ./config.in |
142 | @touch .config.stamp | 145 | @touch .config.stamp |
143 | 146 | ||
144 | allnoconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in | 147 | allnoconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in |
145 | $(TOPDIR)/scripts/kconfig/conf -n ./config.in | 148 | $(TOPDIR)/scripts/kconfig/conf -n ./config.in |
146 | @touch .config.stamp | 149 | @touch .config.stamp |
147 | 150 | ||
148 | defconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in | 151 | defconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in |
149 | $(TOPDIR)/scripts/kconfig/conf -d ./config.in | 152 | $(TOPDIR)/scripts/kconfig/conf -d ./config.in |
150 | @touch .config.stamp | 153 | @touch .config.stamp |
151 | 154 | ||
152 | $(TOPDIR)/qmake/qmake : $(TOPDIR)/mkspecs/default | 155 | $(TOPDIR)/qmake/qmake : $(TOPDIR)/mkspecs/default |
153 | 156 | ||
154 | $(TOPDIR)/mkspecs/default : | 157 | $(TOPDIR)/mkspecs/default : |
155 | ln -sf linux-g++ $@ | 158 | ln -sf linux-g++ $@ |
156 | 159 | ||
157 | $(TOPDIR)/scripts/subst : force | 160 | $(TOPDIR)/scripts/subst : force |
158 | @( \ | 161 | @( \ |
159 | echo 's,\$$QPE_VERSION,$(QPE_VERSION),g'; \ | 162 | echo 's,\$$QPE_VERSION,$(QPE_VERSION),g'; \ |
160 | echo 's,\$$OPIE_VERSION,$(OPIE_VERSION),g'; \ | 163 | echo 's,\$$OPIE_VERSION,$(OPIE_VERSION),g'; \ |
161 | echo 's,\$$QTE_VERSION,$(QTE_VERSION),g'; \ | 164 | echo 's,\$$QTE_VERSION,$(QTE_VERSION),g'; \ |
162 | echo 's,\$$QTE_REVISION,$(QTE_REVISION),g'; \ | 165 | echo 's,\$$QTE_REVISION,$(QTE_REVISION),g'; \ |
163 | echo 's,\$$SUB_VERSION,$(SUB_VERSION),g'; \ | 166 | echo 's,\$$SUB_VERSION,$(SUB_VERSION),g'; \ |
164 | echo 's,\$$EXTRAVERSION,$(EXTRAVERSION),g'; \ | 167 | echo 's,\$$EXTRAVERSION,$(EXTRAVERSION),g'; \ |
165 | echo 's,\$$QTE_BASEVERSION,$(QTE_BASEVERSION),g'; \ | 168 | echo 's,\$$QTE_BASEVERSION,$(QTE_BASEVERSION),g'; \ |
166 | ) > $@ || ( rm -f $@; exit 1 ) | 169 | ) > $@ || ( rm -f $@; exit 1 ) |
167 | 170 | ||
168 | $(TOPDIR)/scripts/filesubst : force | 171 | $(TOPDIR)/scripts/filesubst : force |
169 | @( \ | 172 | @( \ |
170 | echo 's,\$$OPIEDIR/root/,/,g'; \ | 173 | echo 's,\$$OPIEDIR/root/,/,g'; \ |
171 | echo 's,$(OPIEDIR)/root/,/,g'; \ | 174 | echo 's,$(OPIEDIR)/root/,/,g'; \ |
172 | echo 's,\$$OPIEDIR,$(prefix),g'; \ | 175 | echo 's,\$$OPIEDIR,$(prefix),g'; \ |
173 | echo 's,$(OPIEDIR),$(prefix),g'; \ | 176 | echo 's,$(OPIEDIR),$(prefix),g'; \ |
174 | echo 's,\$$QTDIR,$(prefix),g'; \ | 177 | echo 's,\$$QTDIR,$(prefix),g'; \ |
175 | echo 's,$(QTDIR),$(prefix),g'; \ | 178 | echo 's,$(QTDIR),$(prefix),g'; \ |
176 | echo 's,^\(\./\)*root/,/,g'; \ | 179 | echo 's,^\(\./\)*root/,/,g'; \ |
177 | echo 's,^\(\./\)*etc/,$(prefix)/etc/,g'; \ | 180 | echo 's,^\(\./\)*etc/,$(prefix)/etc/,g'; \ |
178 | echo 's,^\(\./\)*lib/,$(prefix)/lib/,g'; \ | 181 | echo 's,^\(\./\)*lib/,$(prefix)/lib/,g'; \ |
179 | echo 's,^\(\./\)*bin/,$(prefix)/bin/,g'; \ | 182 | echo 's,^\(\./\)*bin/,$(prefix)/bin/,g'; \ |
180 | echo 's,^\(\./\)*pics/,$(prefix)/pics/,g'; \ | 183 | echo 's,^\(\./\)*pics/,$(prefix)/pics/,g'; \ |
181 | echo 's,^\(\./\)*sounds/,$(prefix)/sounds/,g'; \ | 184 | echo 's,^\(\./\)*sounds/,$(prefix)/sounds/,g'; \ |
182 | echo 's,^\(\./\)*i18n/,$(prefix)/i18n/,g'; \ | 185 | echo 's,^\(\./\)*i18n/,$(prefix)/i18n/,g'; \ |
183 | echo 's,^\(\./\)*plugins/,$(prefix)/plugins/,g'; \ | 186 | echo 's,^\(\./\)*plugins/,$(prefix)/plugins/,g'; \ |
184 | echo 's,^\(\./\)*apps/,$(prefix)/apps/,g'; \ | 187 | echo 's,^\(\./\)*apps/,$(prefix)/apps/,g'; \ |
185 | echo 's,^\(\./\)*share/,$(prefix)/share/,g'; \ | 188 | echo 's,^\(\./\)*share/,$(prefix)/share/,g'; \ |
186 | echo 's,^\(\./\)*i18n/,$(prefix)/i18n/,g'; \ | 189 | echo 's,^\(\./\)*i18n/,$(prefix)/i18n/,g'; \ |
187 | echo 's,^\(\./\)*help/,$(prefix)/help/,g'; \ | 190 | echo 's,^\(\./\)*help/,$(prefix)/help/,g'; \ |
188 | ) > $@ || ( rm -f $@; exit 1 ) | 191 | ) > $@ || ( rm -f $@; exit 1 ) |
189 | 192 | ||
190 | ## general rules ## | 193 | ## general rules ## |
191 | 194 | ||
192 | define descend | 195 | define descend |
193 | $(MAKE) $(if $(QMAKE),QMAKE=$(QMAKE)) -C $(1) $(2) | 196 | $(MAKE) $(if $(QMAKE),QMAKE=$(QMAKE)) -C $(1) $(2) |
194 | endef | 197 | endef |
195 | 198 | ||
196 | define makefilegen | 199 | define makefilegen |
197 | cd $(if $(1),$(shell dirname $(1))); $(TOPDIR)/qmake/qmake $(3) -o $(if $(1),$(shell basename $(1))) `cat $(OPIEDIR)/packages | grep " \`echo $(1)|sed -e 's,/Makefile$$,,'\`" | \ | 200 | cd $(if $(1),$(shell dirname $(1))); $(TOPDIR)/qmake/qmake $(3) -o $(if $(1),$(shell basename $(1))) `cat $(OPIEDIR)/packages | grep " \`echo $(1)|sed -e 's,/Makefile$$,,'\`" | \ |
198 | head -1 | awk '{print $$3}'` | 201 | head -1 | awk '{print $$3}'` |
199 | endef | 202 | endef |
200 | 203 | ||
201 | define makecfg | 204 | define makecfg |
202 | $(TOPDIR)/scripts/makecfg.pl $1 $(OPIEDIR) | 205 | $(TOPDIR)/scripts/makecfg.pl $1 $(OPIEDIR) |
203 | endef | 206 | endef |
@@ -1,180 +1,184 @@ | |||
1 | mainmenu "Opie Configuration" | 1 | mainmenu "Opie Configuration" |
2 | 2 | ||
3 | menu "Build Parameters" | 3 | menu "Build Parameters" |
4 | 4 | ||
5 | choice | 5 | choice |
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_SHARP | 15 | config TARGET_SHARP |
16 | boolean "Sharp Zaurus" | 16 | boolean "Sharp Zaurus" |
17 | 17 | ||
18 | config TARGET_IPAQ | 18 | config TARGET_IPAQ |
19 | boolean "iPAQ" | 19 | boolean "iPAQ" |
20 | 20 | ||
21 | config TARGET_RAMSES | 21 | config TARGET_RAMSES |
22 | boolean "Ramses" | 22 | boolean "Ramses" |
23 | 23 | ||
24 | config TARGET_SIMPAD | 24 | config TARGET_SIMPAD |
25 | boolean "SIMpad" | 25 | boolean "SIMpad" |
26 | 26 | ||
27 | endchoice | 27 | endchoice |
28 | 28 | ||
29 | config OPTIMIZE | 29 | config OPTIMIZE |
30 | boolean "Use optimizations" | 30 | boolean "Use optimizations" |
31 | default "y" if ! TARGET_X86 | 31 | default "y" if ! TARGET_X86 |
32 | 32 | ||
33 | config DEBUG | 33 | config DEBUG |
34 | boolean "Enable debug builds" | 34 | boolean "Enable debug builds" |
35 | default n | 35 | default n |
36 | config RELEASE | 36 | config RELEASE |
37 | bool | 37 | bool |
38 | default y | 38 | default y |
39 | depends !DEBUG | 39 | depends !DEBUG |
40 | 40 | ||
41 | config QUICK_LAUNCH | 41 | config QUICK_LAUNCH |
42 | boolean "Enable Quick Launch" | 42 | boolean "Enable Quick Launch" |
43 | default n | 43 | default n |
44 | |||
45 | config OPIE_NO_OVERRIDE_QT | ||
46 | boolean "Build Opie against an unpatched version of Qt" | ||
47 | default n | ||
44 | 48 | ||
45 | config SPECFILE | 49 | config SPECFILE |
46 | string | 50 | string |
47 | default "qws/linux-generic-g++" if TARGET_X86 && (! X11) | 51 | default "qws/linux-generic-g++" if TARGET_X86 && (! X11) |
48 | default "linux-g++" if TARGET_X86 && X11 | 52 | default "linux-g++" if TARGET_X86 && X11 |
49 | default "qws/linux-sharp-g++" if TARGET_SHARP && (! X11) | 53 | default "qws/linux-sharp-g++" if TARGET_SHARP && (! X11) |
50 | default "linux-g++" if TARGET_SHARP && X11 | 54 | default "linux-g++" if TARGET_SHARP && X11 |
51 | default "qws/linux-ipaq-g++" if TARGET_IPAQ && (! X11) | 55 | default "qws/linux-ipaq-g++" if TARGET_IPAQ && (! X11) |
52 | default "linux-g++" if TARGET_IPAQ && X11 | 56 | default "linux-g++" if TARGET_IPAQ && X11 |
53 | default "qws/linux-ramses-g++" if TARGET_RAMSES && (! X11) | 57 | default "qws/linux-ramses-g++" if TARGET_RAMSES && (! X11) |
54 | default "linux-g++" if TARGET_RAMSES && X11 | 58 | default "linux-g++" if TARGET_RAMSES && X11 |
55 | default "qws/linux-simpad-g++" if TARGET_SIMPAD && (! X11) | 59 | default "qws/linux-simpad-g++" if TARGET_SIMPAD && (! X11) |
56 | default "linux-g++" if TARGET_SIMPAD && X11 | 60 | default "linux-g++" if TARGET_SIMPAD && X11 |
57 | 61 | ||
58 | config CUSTOMFILE | 62 | config CUSTOMFILE |
59 | string | 63 | string |
60 | default "custom-ipaq.h" if TARGET_IPAQ | 64 | default "custom-ipaq.h" if TARGET_IPAQ |
61 | default "custom-sharp.h" if TARGET_SHARP | 65 | default "custom-sharp.h" if TARGET_SHARP |
62 | default "custom-ramses.h" if TARGET_RAMSES | 66 | default "custom-ramses.h" if TARGET_RAMSES |
63 | default "custom-ipaq.h" if TARGET_SIMPAD | 67 | default "custom-ipaq.h" if TARGET_SIMPAD |
64 | 68 | ||
65 | config OPTIMIZATIONS | 69 | config OPTIMIZATIONS |
66 | string "Optimization flags" | 70 | string "Optimization flags" |
67 | depends OPTIMIZE | 71 | depends OPTIMIZE |
68 | default "-march=armv4 -mtune=strongarm1100 -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_IPAQ | 72 | default "-march=armv4 -mtune=strongarm1100 -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_IPAQ |
69 | default "-march=armv4 -mtune=strongarm1100 -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_SHARP | 73 | default "-march=armv4 -mtune=strongarm1100 -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_SHARP |
70 | default "-march=armv4 -mtune=strongarm1100 -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_RAMSES | 74 | default "-march=armv4 -mtune=strongarm1100 -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_RAMSES |
71 | default "-march=armv4 -mtune=strongarm1100 -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_SIMPAD | 75 | default "-march=armv4 -mtune=strongarm1100 -mapcs-32 -fexpensive-optimizations -fomit-frame-pointer -O2" if TARGET_SIMPAD |
72 | 76 | ||
73 | config EXPERIMENTAL | 77 | config EXPERIMENTAL |
74 | bool "Prompt for development and/or incomplete items" | 78 | bool "Prompt for development and/or incomplete items" |
75 | default y | 79 | default y |
76 | 80 | ||
77 | endmenu | 81 | endmenu |
78 | 82 | ||
79 | menu "Base" | 83 | menu "Base" |
80 | choice | 84 | choice |
81 | prompt "Qpe Library Selection" | 85 | prompt "Qpe Library Selection" |
82 | default LIBQPE | 86 | default LIBQPE |
83 | source library/config.in | 87 | source library/config.in |
84 | source x11/config.in | 88 | source x11/config.in |
85 | endchoice | 89 | endchoice |
86 | source libopie/config.in | 90 | source libopie/config.in |
87 | source core/opie-login/config.in | 91 | source core/opie-login/config.in |
88 | source core/opiealarm/config.in | 92 | source core/opiealarm/config.in |
89 | source core/launcher/config.in | 93 | source core/launcher/config.in |
90 | source core/qws/config.in | 94 | source core/qws/config.in |
91 | endmenu | 95 | endmenu |
92 | 96 | ||
93 | comment "" | 97 | comment "" |
94 | 98 | ||
95 | menu "Applets" | 99 | menu "Applets" |
96 | source core/applets/config.in | 100 | source core/applets/config.in |
97 | source noncore/applets/config.in | 101 | source noncore/applets/config.in |
98 | endmenu | 102 | endmenu |
99 | 103 | ||
100 | menu "Apps" | 104 | menu "Apps" |
101 | source core/apps/config.in | 105 | source core/apps/config.in |
102 | source noncore/apps/config.in | 106 | source noncore/apps/config.in |
103 | endmenu | 107 | endmenu |
104 | 108 | ||
105 | menu "Communications and Networking" | 109 | menu "Communications and Networking" |
106 | source noncore/comm/config.in | 110 | source noncore/comm/config.in |
107 | source noncore/mail/config.in | 111 | source noncore/mail/config.in |
108 | source noncore/net/config.in | 112 | source noncore/net/config.in |
109 | endmenu | 113 | endmenu |
110 | 114 | ||
111 | menu "Games" | 115 | menu "Games" |
112 | source noncore/games/config.in | 116 | source noncore/games/config.in |
113 | endmenu | 117 | endmenu |
114 | 118 | ||
115 | menu "Graphics and Multimedia" | 119 | menu "Graphics and Multimedia" |
116 | source freetype/config.in | 120 | source freetype/config.in |
117 | source noncore/graphics/config.in | 121 | source noncore/graphics/config.in |
118 | source core/multimedia/config.in | 122 | source core/multimedia/config.in |
119 | source noncore/multimedia/config.in | 123 | source noncore/multimedia/config.in |
120 | endmenu | 124 | endmenu |
121 | 125 | ||
122 | menu "Input methods" | 126 | menu "Input methods" |
123 | source inputmethods/config.in | 127 | source inputmethods/config.in |
124 | endmenu | 128 | endmenu |
125 | 129 | ||
126 | menu "Pim" | 130 | menu "Pim" |
127 | source core/pim/config.in | 131 | source core/pim/config.in |
128 | menu "Today Plugins" | 132 | menu "Today Plugins" |
129 | source noncore/todayplugins/config.in | 133 | source noncore/todayplugins/config.in |
130 | source core/pim/today/plugins/config.in | 134 | source core/pim/today/plugins/config.in |
131 | endmenu | 135 | endmenu |
132 | endmenu | 136 | endmenu |
133 | 137 | ||
134 | menu "Settings" | 138 | menu "Settings" |
135 | source core/settings/config.in | 139 | source core/settings/config.in |
136 | source noncore/settings/config.in | 140 | source noncore/settings/config.in |
137 | endmenu | 141 | endmenu |
138 | 142 | ||
139 | menu "Theming" | 143 | menu "Theming" |
140 | source noncore/decorations/config.in | 144 | source noncore/decorations/config.in |
141 | source noncore/styles/config.in | 145 | source noncore/styles/config.in |
142 | endmenu | 146 | endmenu |
143 | 147 | ||
144 | menu "Tools" | 148 | menu "Tools" |
145 | source noncore/tools/config.in | 149 | source noncore/tools/config.in |
146 | endmenu | 150 | endmenu |
147 | 151 | ||
148 | menu "Development" | 152 | menu "Development" |
149 | source development/keyview/config.in | 153 | source development/keyview/config.in |
150 | #source development/debugviewer/config.in | 154 | #source development/debugviewer/config.in |
151 | endmenu | 155 | endmenu |
152 | 156 | ||
153 | menu "Examples" | 157 | menu "Examples" |
154 | config EXAMPLES | 158 | config EXAMPLES |
155 | boolean "Compile Example Application" | 159 | boolean "Compile Example Application" |
156 | source examples/config.in | 160 | source examples/config.in |
157 | endmenu | 161 | endmenu |
158 | 162 | ||
159 | comment "" | 163 | comment "" |
160 | depends on EXPERIMENTAL | 164 | depends on EXPERIMENTAL |
161 | menu "Experimental" | 165 | menu "Experimental" |
162 | depends on EXPERIMENTAL | 166 | depends on EXPERIMENTAL |
163 | source libopie2/config.in | 167 | source libopie2/config.in |
164 | 168 | ||
165 | config SQL_PIM_BACKEND | 169 | config SQL_PIM_BACKEND |
166 | bool "Add SQL-Backend support (experimental)" | 170 | bool "Add SQL-Backend support (experimental)" |
167 | default n | 171 | default n |
168 | help | 172 | help |
169 | This adds the SQL-Support, using SQLite. Which database is used | 173 | This adds the SQL-Support, using SQLite. Which database is used |
170 | by the backends is defined by the file "pimaccess.conf" in the | 174 | by the backends is defined by the file "pimaccess.conf" in the |
171 | directory "Settings". | 175 | directory "Settings". |
172 | There currently do exist to groups "[contact]" and "[todo]". You can | 176 | There currently do exist to groups "[contact]" and "[todo]". You can |
173 | select the used backend by the variable "usebackend=<type>", where | 177 | select the used backend by the variable "usebackend=<type>", where |
174 | <type> is "sql" or "xml". "xml" is the default ! | 178 | <type> is "sql" or "xml". "xml" is the default ! |
175 | Important: The SQLite-library "libsqlite.so" must be installed ! | 179 | Important: The SQLite-library "libsqlite.so" must be installed ! |
176 | depends ( LIBOPIE2DB ) | 180 | depends ( LIBOPIE2DB ) |
177 | 181 | ||
178 | comment "SQL-Support needs libopie2db!" | 182 | comment "SQL-Support needs libopie2db!" |
179 | depends !( LIBOPIE2DB ) | 183 | depends !( LIBOPIE2DB ) |
180 | endmenu | 184 | endmenu |
diff --git a/library/library.pro b/library/library.pro index 80a0f62..ab1f451 100644 --- a/library/library.pro +++ b/library/library.pro | |||
@@ -1,151 +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 | |||
122 | |||
121 | # Qt 3 compatibility | 123 | # Qt 3 compatibility |
122 | HEADERS += quuid.h qcom.h qlibrary.h qlibrary_p.h | 124 | HEADERS += quuid.h qcom.h qlibrary.h qlibrary_p.h |
123 | SOURCES += quuid.cpp qlibrary.cpp qlibrary_unix.cpp | 125 | SOURCES += quuid.cpp qlibrary.cpp qlibrary_unix.cpp |
124 | INCLUDEPATH += $(OPIEDIR)/include backend | 126 | INCLUDEPATH += $(OPIEDIR)/include backend |
125 | LIBS += -ldl -lcrypt -lm | 127 | LIBS += -ldl -lcrypt -lm |
126 | INTERFACES = passwordbase_p.ui categoryeditbase_p.ui findwidgetbase_p.ui lnkpropertiesbase_p.ui | 128 | INTERFACES = passwordbase_p.ui categoryeditbase_p.ui findwidgetbase_p.ui lnkpropertiesbase_p.ui |
127 | TARGET = qpe | 129 | TARGET = qpe |
128 | DESTDIR = $(OPIEDIR)/lib$(PROJMAK) | 130 | DESTDIR = $(OPIEDIR)/lib$(PROJMAK) |
129 | VERSION = 1.5.0.1 | 131 | VERSION = 1.5.0.1 |
130 | 132 | ||
131 | TRANSLATIONS = ../i18n/de/libqpe.ts \ | 133 | TRANSLATIONS = ../i18n/de/libqpe.ts \ |
132 | ../i18n/nl/libqpe.ts \ | 134 | ../i18n/nl/libqpe.ts \ |
133 | ../i18n/xx/libqpe.ts \ | 135 | ../i18n/xx/libqpe.ts \ |
134 | ../i18n/en/libqpe.ts \ | 136 | ../i18n/en/libqpe.ts \ |
135 | ../i18n/es/libqpe.ts \ | 137 | ../i18n/es/libqpe.ts \ |
136 | ../i18n/fr/libqpe.ts \ | 138 | ../i18n/fr/libqpe.ts \ |
137 | ../i18n/hu/libqpe.ts \ | 139 | ../i18n/hu/libqpe.ts \ |
138 | ../i18n/ja/libqpe.ts \ | 140 | ../i18n/ja/libqpe.ts \ |
139 | ../i18n/ko/libqpe.ts \ | 141 | ../i18n/ko/libqpe.ts \ |
140 | ../i18n/no/libqpe.ts \ | 142 | ../i18n/no/libqpe.ts \ |
141 | ../i18n/pl/libqpe.ts \ | 143 | ../i18n/pl/libqpe.ts \ |
142 | ../i18n/pt/libqpe.ts \ | 144 | ../i18n/pt/libqpe.ts \ |
143 | ../i18n/pt_BR/libqpe.ts \ | 145 | ../i18n/pt_BR/libqpe.ts \ |
144 | ../i18n/sl/libqpe.ts \ | 146 | ../i18n/sl/libqpe.ts \ |
145 | ../i18n/zh_CN/libqpe.ts \ | 147 | ../i18n/zh_CN/libqpe.ts \ |
146 | ../i18n/it/libqpe.ts \ | 148 | ../i18n/it/libqpe.ts \ |
147 | ../i18n/zh_TW/libqpe.ts \ | 149 | ../i18n/zh_TW/libqpe.ts \ |
148 | ../i18n/da/libqpe.ts | 150 | ../i18n/da/libqpe.ts |
149 | 151 | ||
150 | 152 | ||
151 | include ( $(OPIEDIR)/include.pro ) | 153 | include ( $(OPIEDIR)/include.pro ) |
154 | |||
155 | contains( CONFIG, no-override ){ | ||
156 | DEFINES += OPIE_NO_OVERRIDE_QT | ||
157 | } | ||
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 28fb13a..feba8b6 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -1,2068 +1,2074 @@ | |||
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 | #include <linux/limits.h> // needed for some toolchains (PATH_MAX) | 23 | #include <linux/limits.h> // needed for some toolchains (PATH_MAX) |
24 | #include <qfile.h> | 24 | #include <qfile.h> |
25 | #include <qqueue.h> | 25 | #include <qqueue.h> |
26 | #ifdef Q_WS_QWS | 26 | #ifdef Q_WS_QWS |
27 | #ifndef QT_NO_COP | 27 | #ifndef QT_NO_COP |
28 | #if QT_VERSION <= 231 | 28 | #if QT_VERSION <= 231 |
29 | #define private public | 29 | #define private public |
30 | #define sendLocally processEvent | 30 | #define sendLocally processEvent |
31 | #include "qcopenvelope_qws.h" | 31 | #include "qcopenvelope_qws.h" |
32 | #undef private | 32 | #undef private |
33 | #else | 33 | #else |
34 | #include "qcopenvelope_qws.h" | 34 | #include "qcopenvelope_qws.h" |
35 | #endif | 35 | #endif |
36 | #endif | 36 | #endif |
37 | #include <qwindowsystem_qws.h> | 37 | #include <qwindowsystem_qws.h> |
38 | #endif | 38 | #endif |
39 | #include <qtextstream.h> | 39 | #include <qtextstream.h> |
40 | #include <qpalette.h> | 40 | #include <qpalette.h> |
41 | #include <qbuffer.h> | 41 | #include <qbuffer.h> |
42 | #include <qptrdict.h> | 42 | #include <qptrdict.h> |
43 | #include <qregexp.h> | 43 | #include <qregexp.h> |
44 | #include <qdir.h> | 44 | #include <qdir.h> |
45 | #include <qlabel.h> | 45 | #include <qlabel.h> |
46 | #include <qdialog.h> | 46 | #include <qdialog.h> |
47 | #include <qdragobject.h> | 47 | #include <qdragobject.h> |
48 | #include <qtextcodec.h> | 48 | #include <qtextcodec.h> |
49 | #include <qevent.h> | 49 | #include <qevent.h> |
50 | #include <qtooltip.h> | 50 | #include <qtooltip.h> |
51 | #include <qsignal.h> | 51 | #include <qsignal.h> |
52 | #include <qmainwindow.h> | 52 | #include <qmainwindow.h> |
53 | #include <qwidgetlist.h> | 53 | #include <qwidgetlist.h> |
54 | #include <qpixmapcache.h> | 54 | #include <qpixmapcache.h> |
55 | 55 | ||
56 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 56 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
57 | #define QTOPIA_INTERNAL_INITAPP | 57 | #define QTOPIA_INTERNAL_INITAPP |
58 | #include "qpeapplication.h" | 58 | #include "qpeapplication.h" |
59 | #include "qpestyle.h" | 59 | #include "qpestyle.h" |
60 | #include "styleinterface.h" | 60 | #include "styleinterface.h" |
61 | #if QT_VERSION >= 300 | 61 | #if QT_VERSION >= 300 |
62 | #include <qstylefactory.h> | 62 | #include <qstylefactory.h> |
63 | #else | 63 | #else |
64 | #include <qplatinumstyle.h> | 64 | #include <qplatinumstyle.h> |
65 | #include <qwindowsstyle.h> | 65 | #include <qwindowsstyle.h> |
66 | #include <qmotifstyle.h> | 66 | #include <qmotifstyle.h> |
67 | #include <qmotifplusstyle.h> | 67 | #include <qmotifplusstyle.h> |
68 | #include "lightstyle.h" | 68 | #include "lightstyle.h" |
69 | 69 | ||
70 | #include <qpe/qlibrary.h> | 70 | #include <qpe/qlibrary.h> |
71 | #endif | 71 | #endif |
72 | #include "global.h" | 72 | #include "global.h" |
73 | #include "resource.h" | 73 | #include "resource.h" |
74 | #if QT_VERSION <= 230 && defined(QT_NO_CODECS) | 74 | #if QT_VERSION <= 230 && defined(QT_NO_CODECS) |
75 | #include "qutfcodec.h" | 75 | #include "qutfcodec.h" |
76 | #endif | 76 | #endif |
77 | #include "config.h" | 77 | #include "config.h" |
78 | #include "network.h" | 78 | #include "network.h" |
79 | #ifdef QWS | 79 | #ifdef QWS |
80 | #include "fontmanager.h" | 80 | #include "fontmanager.h" |
81 | #endif | 81 | #endif |
82 | 82 | ||
83 | #include "alarmserver.h" | 83 | #include "alarmserver.h" |
84 | #include "applnk.h" | 84 | #include "applnk.h" |
85 | #include "qpemenubar.h" | 85 | #include "qpemenubar.h" |
86 | #include "textcodecinterface.h" | 86 | #include "textcodecinterface.h" |
87 | #include "imagecodecinterface.h" | 87 | #include "imagecodecinterface.h" |
88 | 88 | ||
89 | #include <unistd.h> | 89 | #include <unistd.h> |
90 | #include <sys/file.h> | 90 | #include <sys/file.h> |
91 | #include <sys/ioctl.h> | 91 | #include <sys/ioctl.h> |
92 | #include <sys/soundcard.h> | 92 | #include <sys/soundcard.h> |
93 | 93 | ||
94 | #include "qt_override_p.h" | 94 | #include "qt_override_p.h" |
95 | 95 | ||
96 | 96 | ||
97 | class QPEApplicationData | 97 | class QPEApplicationData |
98 | { | 98 | { |
99 | public: | 99 | public: |
100 | QPEApplicationData ( ) | 100 | QPEApplicationData ( ) |
101 | : presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ), | 101 | : presstimer( 0 ), presswidget( 0 ), rightpressed( false ), kbgrabbed( false ), |
102 | notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ), | 102 | notbusysent( false ), preloaded( false ), forceshow( false ), nomaximize( false ), |
103 | keep_running( true ), qcopQok( false ), qpe_main_widget( 0 ) | 103 | keep_running( true ), qcopQok( false ), qpe_main_widget( 0 ) |
104 | 104 | ||
105 | {} | 105 | {} |
106 | 106 | ||
107 | int presstimer; | 107 | int presstimer; |
108 | QWidget* presswidget; | 108 | QWidget* presswidget; |
109 | QPoint presspos; | 109 | QPoint presspos; |
110 | 110 | ||
111 | bool rightpressed : 1; | 111 | bool rightpressed : 1; |
112 | bool kbgrabbed : 1; | 112 | bool kbgrabbed : 1; |
113 | bool notbusysent : 1; | 113 | bool notbusysent : 1; |
114 | bool preloaded : 1; | 114 | bool preloaded : 1; |
115 | bool forceshow : 1; | 115 | bool forceshow : 1; |
116 | bool nomaximize : 1; | 116 | bool nomaximize : 1; |
117 | bool keep_running : 1; | 117 | bool keep_running : 1; |
118 | bool qcopQok : 1; | 118 | bool qcopQok : 1; |
119 | 119 | ||
120 | 120 | ||
121 | QStringList langs; | 121 | QStringList langs; |
122 | QString appName; | 122 | QString appName; |
123 | struct QCopRec | 123 | struct QCopRec |
124 | { | 124 | { |
125 | QCopRec( const QCString &ch, const QCString &msg, | 125 | QCopRec( const QCString &ch, const QCString &msg, |
126 | const QByteArray &d ) : | 126 | const QByteArray &d ) : |
127 | channel( ch ), message( msg ), data( d ) | 127 | channel( ch ), message( msg ), data( d ) |
128 | { } | 128 | { } |
129 | 129 | ||
130 | QCString channel; | 130 | QCString channel; |
131 | QCString message; | 131 | QCString message; |
132 | QByteArray data; | 132 | QByteArray data; |
133 | }; | 133 | }; |
134 | QWidget* qpe_main_widget; | 134 | QWidget* qpe_main_widget; |
135 | QGuardedPtr<QWidget> lastraised; | 135 | QGuardedPtr<QWidget> lastraised; |
136 | QQueue<QCopRec> qcopq; | 136 | QQueue<QCopRec> qcopq; |
137 | QString styleName; | 137 | QString styleName; |
138 | QString decorationName; | 138 | QString decorationName; |
139 | 139 | ||
140 | void enqueueQCop( const QCString &ch, const QCString &msg, | 140 | void enqueueQCop( const QCString &ch, const QCString &msg, |
141 | const QByteArray &data ) | 141 | const QByteArray &data ) |
142 | { | 142 | { |
143 | qcopq.enqueue( new QCopRec( ch, msg, data ) ); | 143 | qcopq.enqueue( new QCopRec( ch, msg, data ) ); |
144 | } | 144 | } |
145 | void sendQCopQ() | 145 | void sendQCopQ() |
146 | { | 146 | { |
147 | if (!qcopQok ) | 147 | if (!qcopQok ) |
148 | return; | 148 | return; |
149 | 149 | ||
150 | QCopRec * r; | 150 | QCopRec * r; |
151 | 151 | ||
152 | while((r=qcopq.dequeue())) { | 152 | while((r=qcopq.dequeue())) { |
153 | // remove from queue before sending... | 153 | // remove from queue before sending... |
154 | // event loop can come around again before getting | 154 | // event loop can come around again before getting |
155 | // back from sendLocally | 155 | // back from sendLocally |
156 | #ifndef QT_NO_COP | 156 | #ifndef QT_NO_COP |
157 | QCopChannel::sendLocally( r->channel, r->message, r->data ); | 157 | QCopChannel::sendLocally( r->channel, r->message, r->data ); |
158 | #endif | 158 | #endif |
159 | 159 | ||
160 | delete r; | 160 | delete r; |
161 | } | 161 | } |
162 | } | 162 | } |
163 | static void show_mx(QWidget* mw, bool nomaximize, const QString & = QString::null ) | 163 | static void show_mx(QWidget* mw, bool nomaximize, const QString & = QString::null ) |
164 | { | 164 | { |
165 | 165 | ||
166 | // ugly hack, remove that later after finding a sane solution | 166 | // ugly hack, remove that later after finding a sane solution |
167 | // Addendum: Only Sharp currently has models with high resolution but (physically) small displays, | 167 | // 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 | 168 | // 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 | 169 | // a (physically) large enough display to use the small icons |
170 | #ifndef QT_QWS_SIMPAD | 170 | #ifndef QT_QWS_SIMPAD |
171 | if ( QPEApplication::desktop() ->width() >= 600 && ( mw->inherits("QMainWindow") || mw->isA("QMainWindow") ) ) { | 171 | if ( QPEApplication::desktop() ->width() >= 600 && ( mw->inherits("QMainWindow") || mw->isA("QMainWindow") ) ) { |
172 | ( ( QMainWindow* ) mw )->setUsesBigPixmaps( true ); | 172 | ( ( QMainWindow* ) mw )->setUsesBigPixmaps( true ); |
173 | } | 173 | } |
174 | #endif | 174 | #endif |
175 | 175 | ||
176 | if ( mw->layout() && mw->inherits("QDialog") ) { | 176 | if ( mw->layout() && mw->inherits("QDialog") ) { |
177 | QPEApplication::showDialog((QDialog*)mw, nomaximize); | 177 | QPEApplication::showDialog((QDialog*)mw, nomaximize); |
178 | } | 178 | } |
179 | else { | 179 | else { |
180 | #ifdef Q_WS_QWS | 180 | #ifdef Q_WS_QWS |
181 | if ( !nomaximize ) | 181 | if ( !nomaximize ) |
182 | mw->showMaximized(); | 182 | mw->showMaximized(); |
183 | else | 183 | else |
184 | #endif | 184 | #endif |
185 | 185 | ||
186 | mw->show(); | 186 | mw->show(); |
187 | } | 187 | } |
188 | } | 188 | } |
189 | static bool setWidgetCaptionFromAppName( QWidget* /*mw*/, const QString& /*appName*/, const QString& /*appsPath*/ ) | 189 | static bool setWidgetCaptionFromAppName( QWidget* /*mw*/, const QString& /*appName*/, const QString& /*appsPath*/ ) |
190 | { | 190 | { |
191 | /* | 191 | /* |
192 | // This works but disable it for now until it is safe to apply | 192 | // 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 | 193 | // 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 | 194 | // 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 | 195 | // then it uses the name stored in the .desktop file as the caption |
196 | // for the main widget. This saves duplicating translations for | 196 | // for the main widget. This saves duplicating translations for |
197 | // the app name in the program and in the .desktop files. | 197 | // the app name in the program and in the .desktop files. |
198 | 198 | ||
199 | AppLnkSet apps( appsPath ); | 199 | AppLnkSet apps( appsPath ); |
200 | 200 | ||
201 | QList<AppLnk> appsList = apps.children(); | 201 | QList<AppLnk> appsList = apps.children(); |
202 | for ( QListIterator<AppLnk> it(appsList); it.current(); ++it ) { | 202 | for ( QListIterator<AppLnk> it(appsList); it.current(); ++it ) { |
203 | if ( (*it)->exec() == appName ) { | 203 | if ( (*it)->exec() == appName ) { |
204 | mw->setCaption( (*it)->name() ); | 204 | mw->setCaption( (*it)->name() ); |
205 | return TRUE; | 205 | return TRUE; |
206 | } | 206 | } |
207 | } | 207 | } |
208 | */ | 208 | */ |
209 | return FALSE; | 209 | return FALSE; |
210 | } | 210 | } |
211 | 211 | ||
212 | 212 | ||
213 | void show(QWidget* mw, bool nomax) | 213 | void show(QWidget* mw, bool nomax) |
214 | { | 214 | { |
215 | setWidgetCaptionFromAppName( mw, appName, QPEApplication::qpeDir() + "apps" ); | 215 | setWidgetCaptionFromAppName( mw, appName, QPEApplication::qpeDir() + "apps" ); |
216 | nomaximize = nomax; | 216 | nomaximize = nomax; |
217 | qpe_main_widget = mw; | 217 | qpe_main_widget = mw; |
218 | qcopQok = TRUE; | 218 | qcopQok = TRUE; |
219 | #ifndef QT_NO_COP | 219 | #ifndef QT_NO_COP |
220 | 220 | ||
221 | sendQCopQ(); | 221 | sendQCopQ(); |
222 | #endif | 222 | #endif |
223 | 223 | ||
224 | if ( preloaded ) { | 224 | if ( preloaded ) { |
225 | if (forceshow) | 225 | if (forceshow) |
226 | show_mx(mw, nomax); | 226 | show_mx(mw, nomax); |
227 | } | 227 | } |
228 | else if ( keep_running ) { | 228 | else if ( keep_running ) { |
229 | show_mx(mw, nomax); | 229 | show_mx(mw, nomax); |
230 | } | 230 | } |
231 | } | 231 | } |
232 | 232 | ||
233 | void loadTextCodecs() | 233 | void loadTextCodecs() |
234 | { | 234 | { |
235 | QString path = QPEApplication::qpeDir() + "/plugins/textcodecs"; | 235 | QString path = QPEApplication::qpeDir() + "/plugins/textcodecs"; |
236 | QDir dir( path, "lib*.so" ); | 236 | QDir dir( path, "lib*.so" ); |
237 | QStringList list; | 237 | QStringList list; |
238 | if ( dir. exists ( )) | 238 | if ( dir. exists ( )) |
239 | list = dir.entryList(); | 239 | list = dir.entryList(); |
240 | QStringList::Iterator it; | 240 | QStringList::Iterator it; |
241 | for ( it = list.begin(); it != list.end(); ++it ) { | 241 | for ( it = list.begin(); it != list.end(); ++it ) { |
242 | TextCodecInterface *iface = 0; | 242 | TextCodecInterface *iface = 0; |
243 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 243 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
244 | if ( lib->queryInterface( IID_QtopiaTextCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { | 244 | if ( lib->queryInterface( IID_QtopiaTextCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { |
245 | QValueList<int> mibs = iface->mibEnums(); | 245 | QValueList<int> mibs = iface->mibEnums(); |
246 | for (QValueList<int>::ConstIterator i = mibs.begin(); i != mibs.end(); ++i) { | 246 | for (QValueList<int>::ConstIterator i = mibs.begin(); i != mibs.end(); ++i) { |
247 | (void)iface->createForMib(*i); | 247 | (void)iface->createForMib(*i); |
248 | // ### it exists now; need to remember if we can delete it | 248 | // ### it exists now; need to remember if we can delete it |
249 | } | 249 | } |
250 | } | 250 | } |
251 | else { | 251 | else { |
252 | lib->unload(); | 252 | lib->unload(); |
253 | delete lib; | 253 | delete lib; |
254 | } | 254 | } |
255 | } | 255 | } |
256 | } | 256 | } |
257 | 257 | ||
258 | void loadImageCodecs() | 258 | void loadImageCodecs() |
259 | { | 259 | { |
260 | QString path = QPEApplication::qpeDir() + "/plugins/imagecodecs"; | 260 | QString path = QPEApplication::qpeDir() + "/plugins/imagecodecs"; |
261 | QDir dir( path, "lib*.so" ); | 261 | QDir dir( path, "lib*.so" ); |
262 | QStringList list; | 262 | QStringList list; |
263 | if ( dir. exists ( )) | 263 | if ( dir. exists ( )) |
264 | list = dir.entryList(); | 264 | list = dir.entryList(); |
265 | QStringList::Iterator it; | 265 | QStringList::Iterator it; |
266 | for ( it = list.begin(); it != list.end(); ++it ) { | 266 | for ( it = list.begin(); it != list.end(); ++it ) { |
267 | ImageCodecInterface *iface = 0; | 267 | ImageCodecInterface *iface = 0; |
268 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 268 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
269 | if ( lib->queryInterface( IID_QtopiaImageCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { | 269 | if ( lib->queryInterface( IID_QtopiaImageCodec, (QUnknownInterface**)&iface ) == QS_OK && iface ) { |
270 | QStringList formats = iface->keys(); | 270 | QStringList formats = iface->keys(); |
271 | for (QStringList::ConstIterator i = formats.begin(); i != formats.end(); ++i) { | 271 | for (QStringList::ConstIterator i = formats.begin(); i != formats.end(); ++i) { |
272 | (void)iface->installIOHandler(*i); | 272 | (void)iface->installIOHandler(*i); |
273 | // ### it exists now; need to remember if we can delete it | 273 | // ### it exists now; need to remember if we can delete it |
274 | } | 274 | } |
275 | } | 275 | } |
276 | else { | 276 | else { |
277 | lib->unload(); | 277 | lib->unload(); |
278 | delete lib; | 278 | delete lib; |
279 | } | 279 | } |
280 | } | 280 | } |
281 | } | 281 | } |
282 | }; | 282 | }; |
283 | 283 | ||
284 | class ResourceMimeFactory : public QMimeSourceFactory | 284 | class ResourceMimeFactory : public QMimeSourceFactory |
285 | { | 285 | { |
286 | public: | 286 | public: |
287 | ResourceMimeFactory() : resImage( 0 ) | 287 | ResourceMimeFactory() : resImage( 0 ) |
288 | { | 288 | { |
289 | setFilePath( Global::helpPath() ); | 289 | setFilePath( Global::helpPath() ); |
290 | setExtensionType( "html", "text/html;charset=UTF-8" ); | 290 | setExtensionType( "html", "text/html;charset=UTF-8" ); |
291 | } | 291 | } |
292 | ~ResourceMimeFactory() { | 292 | ~ResourceMimeFactory() { |
293 | delete resImage; | 293 | delete resImage; |
294 | } | 294 | } |
295 | 295 | ||
296 | const QMimeSource* data( const QString& abs_name ) const | 296 | const QMimeSource* data( const QString& abs_name ) const |
297 | { | 297 | { |
298 | const QMimeSource * r = QMimeSourceFactory::data( abs_name ); | 298 | const QMimeSource * r = QMimeSourceFactory::data( abs_name ); |
299 | if ( !r ) { | 299 | if ( !r ) { |
300 | int sl = abs_name.length(); | 300 | int sl = abs_name.length(); |
301 | do { | 301 | do { |
302 | sl = abs_name.findRev( '/', sl - 1 ); | 302 | sl = abs_name.findRev( '/', sl - 1 ); |
303 | QString name = sl >= 0 ? abs_name.mid( sl + 1 ) : abs_name; | 303 | QString name = sl >= 0 ? abs_name.mid( sl + 1 ) : abs_name; |
304 | int dot = name.findRev( '.' ); | 304 | int dot = name.findRev( '.' ); |
305 | if ( dot >= 0 ) | 305 | if ( dot >= 0 ) |
306 | name = name.left( dot ); | 306 | name = name.left( dot ); |
307 | QImage img = Resource::loadImage( name ); | 307 | QImage img = Resource::loadImage( name ); |
308 | if ( !img.isNull() ) { | 308 | if ( !img.isNull() ) { |
309 | delete resImage; | 309 | delete resImage; |
310 | resImage = new QImageDrag( img ); | 310 | resImage = new QImageDrag( img ); |
311 | r = resImage; | 311 | r = resImage; |
312 | } | 312 | } |
313 | } | 313 | } |
314 | while ( !r && sl > 0 ); | 314 | while ( !r && sl > 0 ); |
315 | } | 315 | } |
316 | return r; | 316 | return r; |
317 | } | 317 | } |
318 | private: | 318 | private: |
319 | mutable QImageDrag *resImage; | 319 | mutable QImageDrag *resImage; |
320 | }; | 320 | }; |
321 | 321 | ||
322 | static int& hack(int& i) | 322 | static int& hack(int& i) |
323 | { | 323 | { |
324 | #if QT_VERSION <= 230 && defined(QT_NO_CODECS) | 324 | #if QT_VERSION <= 230 && defined(QT_NO_CODECS) |
325 | // These should be created, but aren't in Qt 2.3.0 | 325 | // These should be created, but aren't in Qt 2.3.0 |
326 | (void)new QUtf8Codec; | 326 | (void)new QUtf8Codec; |
327 | (void)new QUtf16Codec; | 327 | (void)new QUtf16Codec; |
328 | #endif | 328 | #endif |
329 | return i; | 329 | return i; |
330 | } | 330 | } |
331 | 331 | ||
332 | static int muted = 0; | 332 | static int muted = 0; |
333 | static int micMuted = 0; | 333 | static int micMuted = 0; |
334 | 334 | ||
335 | static void setVolume( int t = 0, int percent = -1 ) | 335 | static void setVolume( int t = 0, int percent = -1 ) |
336 | { | 336 | { |
337 | switch ( t ) { | 337 | switch ( t ) { |
338 | case 0: { | 338 | case 0: { |
339 | Config cfg( "qpe" ); | 339 | Config cfg( "qpe" ); |
340 | cfg.setGroup( "Volume" ); | 340 | cfg.setGroup( "Volume" ); |
341 | if ( percent < 0 ) | 341 | if ( percent < 0 ) |
342 | percent = cfg.readNumEntry( "VolumePercent", 50 ); | 342 | percent = cfg.readNumEntry( "VolumePercent", 50 ); |
343 | int fd = 0; | 343 | int fd = 0; |
344 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | 344 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { |
345 | int vol = muted ? 0 : percent; | 345 | int vol = muted ? 0 : percent; |
346 | // set both channels to same volume | 346 | // set both channels to same volume |
347 | vol |= vol << 8; | 347 | vol |= vol << 8; |
348 | ioctl( fd, MIXER_WRITE( 0 ), &vol ); | 348 | ioctl( fd, MIXER_WRITE( 0 ), &vol ); |
349 | ::close( fd ); | 349 | ::close( fd ); |
350 | } | 350 | } |
351 | } | 351 | } |
352 | break; | 352 | break; |
353 | } | 353 | } |
354 | } | 354 | } |
355 | 355 | ||
356 | static void setMic( int t = 0, int percent = -1 ) | 356 | static void setMic( int t = 0, int percent = -1 ) |
357 | { | 357 | { |
358 | switch ( t ) { | 358 | switch ( t ) { |
359 | case 0: { | 359 | case 0: { |
360 | Config cfg( "qpe" ); | 360 | Config cfg( "qpe" ); |
361 | cfg.setGroup( "Volume" ); | 361 | cfg.setGroup( "Volume" ); |
362 | if ( percent < 0 ) | 362 | if ( percent < 0 ) |
363 | percent = cfg.readNumEntry( "Mic", 50 ); | 363 | percent = cfg.readNumEntry( "Mic", 50 ); |
364 | 364 | ||
365 | int fd = 0; | 365 | int fd = 0; |
366 | int mic = micMuted ? 0 : percent; | 366 | int mic = micMuted ? 0 : percent; |
367 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | 367 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { |
368 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_MIC ), &mic ); | 368 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_MIC ), &mic ); |
369 | ::close( fd ); | 369 | ::close( fd ); |
370 | } | 370 | } |
371 | } | 371 | } |
372 | break; | 372 | break; |
373 | } | 373 | } |
374 | } | 374 | } |
375 | 375 | ||
376 | 376 | ||
377 | static void setBass( int t = 0, int percent = -1 ) | 377 | static void setBass( int t = 0, int percent = -1 ) |
378 | { | 378 | { |
379 | switch ( t ) { | 379 | switch ( t ) { |
380 | case 0: { | 380 | case 0: { |
381 | Config cfg( "qpe" ); | 381 | Config cfg( "qpe" ); |
382 | cfg.setGroup( "Volume" ); | 382 | cfg.setGroup( "Volume" ); |
383 | if ( percent < 0 ) | 383 | if ( percent < 0 ) |
384 | percent = cfg.readNumEntry( "BassPercent", 50 ); | 384 | percent = cfg.readNumEntry( "BassPercent", 50 ); |
385 | 385 | ||
386 | int fd = 0; | 386 | int fd = 0; |
387 | int bass = percent; | 387 | int bass = percent; |
388 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | 388 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { |
389 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_BASS ), &bass ); | 389 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_BASS ), &bass ); |
390 | ::close( fd ); | 390 | ::close( fd ); |
391 | } | 391 | } |
392 | } | 392 | } |
393 | break; | 393 | break; |
394 | } | 394 | } |
395 | } | 395 | } |
396 | 396 | ||
397 | 397 | ||
398 | static void setTreble( int t = 0, int percent = -1 ) | 398 | static void setTreble( int t = 0, int percent = -1 ) |
399 | { | 399 | { |
400 | switch ( t ) { | 400 | switch ( t ) { |
401 | case 0: { | 401 | case 0: { |
402 | Config cfg( "qpe" ); | 402 | Config cfg( "qpe" ); |
403 | cfg.setGroup( "Volume" ); | 403 | cfg.setGroup( "Volume" ); |
404 | if ( percent < 0 ) | 404 | if ( percent < 0 ) |
405 | percent = cfg.readNumEntry( "TreblePercent", 50 ); | 405 | percent = cfg.readNumEntry( "TreblePercent", 50 ); |
406 | 406 | ||
407 | int fd = 0; | 407 | int fd = 0; |
408 | int treble = percent; | 408 | int treble = percent; |
409 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | 409 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { |
410 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_TREBLE ), &treble ); | 410 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_TREBLE ), &treble ); |
411 | ::close( fd ); | 411 | ::close( fd ); |
412 | } | 412 | } |
413 | } | 413 | } |
414 | break; | 414 | break; |
415 | } | 415 | } |
416 | } | 416 | } |
417 | 417 | ||
418 | 418 | ||
419 | /*! | 419 | /*! |
420 | \class QPEApplication qpeapplication.h | 420 | \class QPEApplication qpeapplication.h |
421 | \brief The QPEApplication class implements various system services | 421 | \brief The QPEApplication class implements various system services |
422 | that are available to all Qtopia applications. | 422 | that are available to all Qtopia applications. |
423 | 423 | ||
424 | Simply by using QPEApplication instead of QApplication, a standard Qt | 424 | Simply by using QPEApplication instead of QApplication, a standard Qt |
425 | application becomes a Qtopia application. It automatically follows | 425 | application becomes a Qtopia application. It automatically follows |
426 | style changes, quits and raises, and in the | 426 | style changes, quits and raises, and in the |
427 | case of \link docwidget.html document-oriented\endlink applications, | 427 | case of \link docwidget.html document-oriented\endlink applications, |
428 | changes the currently displayed document in response to the environment. | 428 | changes the currently displayed document in response to the environment. |
429 | 429 | ||
430 | To create a \link docwidget.html document-oriented\endlink | 430 | To create a \link docwidget.html document-oriented\endlink |
431 | application use showMainDocumentWidget(); to create a | 431 | application use showMainDocumentWidget(); to create a |
432 | non-document-oriented application use showMainWidget(). The | 432 | non-document-oriented application use showMainWidget(). The |
433 | keepRunning() function indicates whether the application will | 433 | keepRunning() function indicates whether the application will |
434 | continue running after it's processed the last \link qcop.html | 434 | continue running after it's processed the last \link qcop.html |
435 | QCop\endlink message. This can be changed using setKeepRunning(). | 435 | QCop\endlink message. This can be changed using setKeepRunning(). |
436 | 436 | ||
437 | A variety of signals are emitted when certain events occur, for | 437 | A variety of signals are emitted when certain events occur, for |
438 | example, timeChanged(), clockChanged(), weekChanged(), | 438 | example, timeChanged(), clockChanged(), weekChanged(), |
439 | dateFormatChanged() and volumeChanged(). If the application receives | 439 | dateFormatChanged() and volumeChanged(). If the application receives |
440 | a \link qcop.html QCop\endlink message on the application's | 440 | a \link qcop.html QCop\endlink message on the application's |
441 | QPE/Application/\e{appname} channel, the appMessage() signal is | 441 | QPE/Application/\e{appname} channel, the appMessage() signal is |
442 | emitted. There are also flush() and reload() signals, which | 442 | emitted. There are also flush() and reload() signals, which |
443 | are emitted when synching begins and ends respectively - upon these | 443 | are emitted when synching begins and ends respectively - upon these |
444 | signals, the application should save and reload any data | 444 | signals, the application should save and reload any data |
445 | files that are involved in synching. Most of these signals will initially | 445 | files that are involved in synching. Most of these signals will initially |
446 | be received and unfiltered through the appMessage() signal. | 446 | be received and unfiltered through the appMessage() signal. |
447 | 447 | ||
448 | This class also provides a set of useful static functions. The | 448 | This class also provides a set of useful static functions. The |
449 | qpeDir() and documentDir() functions return the respective paths. | 449 | qpeDir() and documentDir() functions return the respective paths. |
450 | The grabKeyboard() and ungrabKeyboard() functions are used to | 450 | The grabKeyboard() and ungrabKeyboard() functions are used to |
451 | control whether the application takes control of the device's | 451 | control whether the application takes control of the device's |
452 | physical buttons (e.g. application launch keys). The stylus' mode of | 452 | physical buttons (e.g. application launch keys). The stylus' mode of |
453 | operation is set with setStylusOperation() and retrieved with | 453 | operation is set with setStylusOperation() and retrieved with |
454 | stylusOperation(). There are also setInputMethodHint() and | 454 | stylusOperation(). There are also setInputMethodHint() and |
455 | inputMethodHint() functions. | 455 | inputMethodHint() functions. |
456 | 456 | ||
457 | \ingroup qtopiaemb | 457 | \ingroup qtopiaemb |
458 | */ | 458 | */ |
459 | 459 | ||
460 | /*! | 460 | /*! |
461 | \fn void QPEApplication::clientMoused() | 461 | \fn void QPEApplication::clientMoused() |
462 | 462 | ||
463 | \internal | 463 | \internal |
464 | */ | 464 | */ |
465 | 465 | ||
466 | /*! | 466 | /*! |
467 | \fn void QPEApplication::timeChanged(); | 467 | \fn void QPEApplication::timeChanged(); |
468 | This signal is emitted when the time changes outside the normal | 468 | 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. | 469 | passage of time, i.e. if the time is set backwards or forwards. |
470 | */ | 470 | */ |
471 | 471 | ||
472 | /*! | 472 | /*! |
473 | \fn void QPEApplication::clockChanged( bool ampm ); | 473 | \fn void QPEApplication::clockChanged( bool ampm ); |
474 | 474 | ||
475 | This signal is emitted when the user changes the clock's style. If | 475 | 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, | 476 | \a ampm is TRUE, the user wants a 12-hour AM/PM clock, otherwise, |
477 | they want a 24-hour clock. | 477 | they want a 24-hour clock. |
478 | */ | 478 | */ |
479 | 479 | ||
480 | /*! | 480 | /*! |
481 | \fn void QPEApplication::volumeChanged( bool muted ) | 481 | \fn void QPEApplication::volumeChanged( bool muted ) |
482 | 482 | ||
483 | This signal is emitted whenever the mute state is changed. If \a | 483 | This signal is emitted whenever the mute state is changed. If \a |
484 | muted is TRUE, then sound output has been muted. | 484 | muted is TRUE, then sound output has been muted. |
485 | */ | 485 | */ |
486 | 486 | ||
487 | /*! | 487 | /*! |
488 | \fn void QPEApplication::weekChanged( bool startOnMonday ) | 488 | \fn void QPEApplication::weekChanged( bool startOnMonday ) |
489 | 489 | ||
490 | This signal is emitted if the week start day is changed. If \a | 490 | 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 | 491 | 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 | 492 | \a startOnMonday is FALSE then the first day of the week is |
493 | Sunday. | 493 | Sunday. |
494 | */ | 494 | */ |
495 | 495 | ||
496 | /*! | 496 | /*! |
497 | \fn void QPEApplication::dateFormatChanged(DateFormat) | 497 | \fn void QPEApplication::dateFormatChanged(DateFormat) |
498 | 498 | ||
499 | This signal is emitted whenever the date format is changed. | 499 | This signal is emitted whenever the date format is changed. |
500 | */ | 500 | */ |
501 | 501 | ||
502 | /*! | 502 | /*! |
503 | \fn void QPEApplication::flush() | 503 | \fn void QPEApplication::flush() |
504 | 504 | ||
505 | ### | 505 | ### |
506 | */ | 506 | */ |
507 | 507 | ||
508 | /*! | 508 | /*! |
509 | \fn void QPEApplication::reload() | 509 | \fn void QPEApplication::reload() |
510 | 510 | ||
511 | */ | 511 | */ |
512 | 512 | ||
513 | 513 | ||
514 | 514 | ||
515 | void QPEApplication::processQCopFile() | 515 | void QPEApplication::processQCopFile() |
516 | { | 516 | { |
517 | QString qcopfn("/tmp/qcop-msg-"); | 517 | QString qcopfn("/tmp/qcop-msg-"); |
518 | qcopfn += d->appName; // append command name | 518 | qcopfn += d->appName; // append command name |
519 | 519 | ||
520 | QFile f(qcopfn); | 520 | QFile f(qcopfn); |
521 | if ( f.open(IO_ReadWrite) ) { | 521 | if ( f.open(IO_ReadWrite) ) { |
522 | #ifndef Q_OS_WIN32 | 522 | #ifndef Q_OS_WIN32 |
523 | flock(f.handle(), LOCK_EX); | 523 | flock(f.handle(), LOCK_EX); |
524 | #endif | 524 | #endif |
525 | QDataStream ds(&f); | 525 | QDataStream ds(&f); |
526 | QCString channel, message; | 526 | QCString channel, message; |
527 | QByteArray data; | 527 | QByteArray data; |
528 | while(!ds.atEnd()) { | 528 | while(!ds.atEnd()) { |
529 | ds >> channel >> message >> data; | 529 | ds >> channel >> message >> data; |
530 | d->enqueueQCop(channel,message,data); | 530 | d->enqueueQCop(channel,message,data); |
531 | } | 531 | } |
532 | ::ftruncate(f.handle(), 0); | 532 | ::ftruncate(f.handle(), 0); |
533 | #ifndef Q_OS_WIN32 | 533 | #ifndef Q_OS_WIN32 |
534 | f.flush(); | 534 | f.flush(); |
535 | flock(f.handle(), LOCK_UN); | 535 | flock(f.handle(), LOCK_UN); |
536 | #endif | 536 | #endif |
537 | } | 537 | } |
538 | #endif | 538 | #endif |
539 | } | 539 | } |
540 | 540 | ||
541 | 541 | ||
542 | /*! | 542 | /*! |
543 | \fn void QPEApplication::appMessage( const QCString& msg, const QByteArray& data ) | 543 | \fn void QPEApplication::appMessage( const QCString& msg, const QByteArray& data ) |
544 | 544 | ||
545 | This signal is emitted when a message is received on this | 545 | This signal is emitted when a message is received on this |
546 | application's QPE/Application/<i>appname</i> \link qcop.html | 546 | application's QPE/Application/<i>appname</i> \link qcop.html |
547 | QCop\endlink channel. | 547 | QCop\endlink channel. |
548 | 548 | ||
549 | The slot to which you connect this signal uses \a msg and \a data | 549 | The slot to which you connect this signal uses \a msg and \a data |
550 | in the following way: | 550 | in the following way: |
551 | 551 | ||
552 | \code | 552 | \code |
553 | void MyWidget::receive( const QCString& msg, const QByteArray& data ) | 553 | void MyWidget::receive( const QCString& msg, const QByteArray& data ) |
554 | { | 554 | { |
555 | QDataStream stream( data, IO_ReadOnly ); | 555 | QDataStream stream( data, IO_ReadOnly ); |
556 | if ( msg == "someMessage(int,int,int)" ) { | 556 | if ( msg == "someMessage(int,int,int)" ) { |
557 | int a,b,c; | 557 | int a,b,c; |
558 | stream >> a >> b >> c; | 558 | stream >> a >> b >> c; |
559 | ... | 559 | ... |
560 | } else if ( msg == "otherMessage(QString)" ) { | 560 | } else if ( msg == "otherMessage(QString)" ) { |
561 | ... | 561 | ... |
562 | } | 562 | } |
563 | } | 563 | } |
564 | \endcode | 564 | \endcode |
565 | 565 | ||
566 | \sa qcop.html | 566 | \sa qcop.html |
567 | Note that messages received here may be processed by qpe application | 567 | Note that messages received here may be processed by qpe application |
568 | and emitted as signals, such as flush() and reload(). | 568 | and emitted as signals, such as flush() and reload(). |
569 | */ | 569 | */ |
570 | 570 | ||
571 | /*! | 571 | /*! |
572 | Constructs a QPEApplication just as you would construct | 572 | Constructs a QPEApplication just as you would construct |
573 | a QApplication, passing \a argc, \a argv, and \a t. | 573 | a QApplication, passing \a argc, \a argv, and \a t. |
574 | 574 | ||
575 | For applications, \a t should be the default, GuiClient. Only | 575 | For applications, \a t should be the default, GuiClient. Only |
576 | the Qtopia server passes GuiServer. | 576 | the Qtopia server passes GuiServer. |
577 | */ | 577 | */ |
578 | QPEApplication::QPEApplication( int & argc, char **argv, Type t ) | 578 | QPEApplication::QPEApplication( int & argc, char **argv, Type t ) |
579 | : QApplication( hack(argc), argv, t ), pidChannel( 0 ) | 579 | : QApplication( hack(argc), argv, t ), pidChannel( 0 ) |
580 | { | 580 | { |
581 | QPixmapCache::setCacheLimit(256); // sensible default for smaller devices. | 581 | QPixmapCache::setCacheLimit(256); // sensible default for smaller devices. |
582 | 582 | ||
583 | d = new QPEApplicationData; | 583 | d = new QPEApplicationData; |
584 | d->loadTextCodecs(); | 584 | d->loadTextCodecs(); |
585 | d->loadImageCodecs(); | 585 | d->loadImageCodecs(); |
586 | int dw = desktop() ->width(); | 586 | int dw = desktop() ->width(); |
587 | 587 | ||
588 | if ( dw < 200 ) { | 588 | if ( dw < 200 ) { |
589 | setFont( QFont( "vera", 8 ) ); | 589 | setFont( QFont( "vera", 8 ) ); |
590 | AppLnk::setSmallIconSize( 10 ); | 590 | AppLnk::setSmallIconSize( 10 ); |
591 | AppLnk::setBigIconSize( 28 ); | 591 | AppLnk::setBigIconSize( 28 ); |
592 | } | 592 | } |
593 | #ifndef QT_QWS_SIMPAD | 593 | #ifndef QT_QWS_SIMPAD |
594 | else if ( dw > 600 ) { | 594 | else if ( dw > 600 ) { |
595 | setFont( QFont( "vera", 16 ) ); | 595 | setFont( QFont( "vera", 16 ) ); |
596 | AppLnk::setSmallIconSize( 24 ); | 596 | AppLnk::setSmallIconSize( 24 ); |
597 | AppLnk::setBigIconSize( 48 ); | 597 | AppLnk::setBigIconSize( 48 ); |
598 | } | 598 | } |
599 | #endif | 599 | #endif |
600 | else if ( dw > 200 ) { | 600 | else if ( dw > 200 ) { |
601 | setFont( QFont( "vera", 10 ) ); | 601 | setFont( QFont( "vera", 10 ) ); |
602 | AppLnk::setSmallIconSize( 14 ); | 602 | AppLnk::setSmallIconSize( 14 ); |
603 | AppLnk::setBigIconSize( 32 ); | 603 | AppLnk::setBigIconSize( 32 ); |
604 | } | 604 | } |
605 | 605 | ||
606 | QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); | 606 | QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); |
607 | 607 | ||
608 | connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) ); | 608 | connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) ); |
609 | 609 | ||
610 | 610 | ||
611 | sysChannel = new QCopChannel( "QPE/System", this ); | 611 | sysChannel = new QCopChannel( "QPE/System", this ); |
612 | connect( sysChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), | 612 | connect( sysChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), |
613 | this, SLOT( systemMessage( const QCString &, const QByteArray & ) ) ); | 613 | this, SLOT( systemMessage( const QCString &, const QByteArray & ) ) ); |
614 | 614 | ||
615 | /* COde now in initapp */ | 615 | /* COde now in initapp */ |
616 | #if 0 | 616 | #if 0 |
617 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 617 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
618 | 618 | ||
619 | QString qcopfn( "/tmp/qcop-msg-" ); | 619 | QString qcopfn( "/tmp/qcop-msg-" ); |
620 | qcopfn += QString( argv[ 0 ] ); // append command name | 620 | qcopfn += QString( argv[ 0 ] ); // append command name |
621 | 621 | ||
622 | QFile f( qcopfn ); | 622 | QFile f( qcopfn ); |
623 | if ( f.open( IO_ReadOnly ) ) { | 623 | if ( f.open( IO_ReadOnly ) ) { |
624 | flock( f.handle(), LOCK_EX ); | 624 | flock( f.handle(), LOCK_EX ); |
625 | } | 625 | } |
626 | 626 | ||
627 | 627 | ||
628 | 628 | ||
629 | QCString channel = QCString( argv[ 0 ] ); | 629 | QCString channel = QCString( argv[ 0 ] ); |
630 | channel.replace( QRegExp( ".*/" ), "" ); | 630 | channel.replace( QRegExp( ".*/" ), "" ); |
631 | d->appName = channel; | 631 | d->appName = channel; |
632 | channel = "QPE/Application/" + channel; | 632 | channel = "QPE/Application/" + channel; |
633 | pidChannel = new QCopChannel( channel, this ); | 633 | pidChannel = new QCopChannel( channel, this ); |
634 | connect( pidChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), | 634 | connect( pidChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), |
635 | this, SLOT( pidMessage( const QCString &, const QByteArray & ) ) ); | 635 | this, SLOT( pidMessage( const QCString &, const QByteArray & ) ) ); |
636 | 636 | ||
637 | if ( f.isOpen() ) { | 637 | if ( f.isOpen() ) { |
638 | d->keep_running = FALSE; | 638 | d->keep_running = FALSE; |
639 | QDataStream ds( &f ); | 639 | QDataStream ds( &f ); |
640 | QCString channel, message; | 640 | QCString channel, message; |
641 | QByteArray data; | 641 | QByteArray data; |
642 | while ( !ds.atEnd() ) { | 642 | while ( !ds.atEnd() ) { |
643 | ds >> channel >> message >> data; | 643 | ds >> channel >> message >> data; |
644 | d->enqueueQCop( channel, message, data ); | 644 | d->enqueueQCop( channel, message, data ); |
645 | } | 645 | } |
646 | 646 | ||
647 | flock( f.handle(), LOCK_UN ); | 647 | flock( f.handle(), LOCK_UN ); |
648 | f.close(); | 648 | f.close(); |
649 | f.remove(); | 649 | f.remove(); |
650 | } | 650 | } |
651 | 651 | ||
652 | for ( int a = 0; a < argc; a++ ) { | 652 | for ( int a = 0; a < argc; a++ ) { |
653 | if ( qstrcmp( argv[ a ], "-preload" ) == 0 ) { | 653 | if ( qstrcmp( argv[ a ], "-preload" ) == 0 ) { |
654 | argv[ a ] = argv[ a + 1 ]; | 654 | argv[ a ] = argv[ a + 1 ]; |
655 | a++; | 655 | a++; |
656 | d->preloaded = TRUE; | 656 | d->preloaded = TRUE; |
657 | argc -= 1; | 657 | argc -= 1; |
658 | } | 658 | } |
659 | else if ( qstrcmp( argv[ a ], "-preload-show" ) == 0 ) { | 659 | else if ( qstrcmp( argv[ a ], "-preload-show" ) == 0 ) { |
660 | argv[ a ] = argv[ a + 1 ]; | 660 | argv[ a ] = argv[ a + 1 ]; |
661 | a++; | 661 | a++; |
662 | d->preloaded = TRUE; | 662 | d->preloaded = TRUE; |
663 | d->forceshow = TRUE; | 663 | d->forceshow = TRUE; |
664 | argc -= 1; | 664 | argc -= 1; |
665 | } | 665 | } |
666 | } | 666 | } |
667 | 667 | ||
668 | /* overide stored arguments */ | 668 | /* overide stored arguments */ |
669 | setArgs( argc, argv ); | 669 | setArgs( argc, argv ); |
670 | 670 | ||
671 | #endif | 671 | #endif |
672 | #else | 672 | #else |
673 | initApp( argc, argv ); | 673 | initApp( argc, argv ); |
674 | #endif | 674 | #endif |
675 | // qwsSetDecoration( new QPEDecoration() ); | 675 | // qwsSetDecoration( new QPEDecoration() ); |
676 | 676 | ||
677 | #ifndef QT_NO_TRANSLATION | 677 | #ifndef QT_NO_TRANSLATION |
678 | 678 | ||
679 | d->langs = Global::languageList(); | 679 | d->langs = Global::languageList(); |
680 | for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) { | 680 | for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) { |
681 | QString lang = *it; | 681 | QString lang = *it; |
682 | 682 | ||
683 | installTranslation( lang + "/libopie.qm"); | 683 | installTranslation( lang + "/libopie.qm"); |
684 | installTranslation( lang + "/libqpe.qm" ); | 684 | installTranslation( lang + "/libqpe.qm" ); |
685 | installTranslation( lang + "/" + d->appName + ".qm" ); | 685 | installTranslation( lang + "/" + d->appName + ".qm" ); |
686 | 686 | ||
687 | 687 | ||
688 | //###language/font hack; should look it up somewhere | 688 | //###language/font hack; should look it up somewhere |
689 | #ifdef QWS | 689 | #ifdef QWS |
690 | 690 | ||
691 | if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { | 691 | if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { |
692 | QFont fn = FontManager::unicodeFont( FontManager::Proportional ); | 692 | QFont fn = FontManager::unicodeFont( FontManager::Proportional ); |
693 | setFont( fn ); | 693 | setFont( fn ); |
694 | } | 694 | } |
695 | #endif | 695 | #endif |
696 | } | 696 | } |
697 | #endif | 697 | #endif |
698 | 698 | ||
699 | applyStyle(); | 699 | applyStyle(); |
700 | 700 | ||
701 | if ( type() == GuiServer ) { | 701 | if ( type() == GuiServer ) { |
702 | setVolume(); | 702 | setVolume(); |
703 | } | 703 | } |
704 | 704 | ||
705 | installEventFilter( this ); | 705 | installEventFilter( this ); |
706 | 706 | ||
707 | QPEMenuToolFocusManager::initialize(); | 707 | QPEMenuToolFocusManager::initialize(); |
708 | 708 | ||
709 | #ifdef QT_NO_QWS_CURSOR | 709 | #ifdef QT_NO_QWS_CURSOR |
710 | // if we have no cursor, probably don't want tooltips | 710 | // if we have no cursor, probably don't want tooltips |
711 | QToolTip::setEnabled( FALSE ); | 711 | QToolTip::setEnabled( FALSE ); |
712 | #endif | 712 | #endif |
713 | } | 713 | } |
714 | 714 | ||
715 | 715 | ||
716 | #ifdef QTOPIA_INTERNAL_INITAPP | 716 | #ifdef QTOPIA_INTERNAL_INITAPP |
717 | void QPEApplication::initApp( int argc, char **argv ) | 717 | void QPEApplication::initApp( int argc, char **argv ) |
718 | { | 718 | { |
719 | bool initial = pidChannel; // was set to 0 in the initializer | 719 | bool initial = pidChannel; // was set to 0 in the initializer |
720 | delete pidChannel; | 720 | delete pidChannel; |
721 | d->keep_running = TRUE; | 721 | d->keep_running = TRUE; |
722 | d->preloaded = FALSE; | 722 | d->preloaded = FALSE; |
723 | d->forceshow = FALSE; | 723 | d->forceshow = FALSE; |
724 | 724 | ||
725 | QCString channel = QCString(argv[0]); | 725 | QCString channel = QCString(argv[0]); |
726 | 726 | ||
727 | channel.replace(QRegExp(".*/"),""); | 727 | channel.replace(QRegExp(".*/"),""); |
728 | d->appName = channel; | 728 | d->appName = channel; |
729 | 729 | ||
730 | #if QT_VERSION > 235 | 730 | #if QT_VERSION > 235 |
731 | qt_fbdpy->setIdentity( channel ); // In Qt/E 2.3.6 | 731 | qt_fbdpy->setIdentity( channel ); // In Qt/E 2.3.6 |
732 | #endif | 732 | #endif |
733 | 733 | ||
734 | channel = "QPE/Application/" + channel; | 734 | channel = "QPE/Application/" + channel; |
735 | pidChannel = new QCopChannel( channel, this); | 735 | pidChannel = new QCopChannel( channel, this); |
736 | connect( pidChannel, SIGNAL(received(const QCString &, const QByteArray &)), | 736 | connect( pidChannel, SIGNAL(received(const QCString &, const QByteArray &)), |
737 | this, SLOT(pidMessage(const QCString &, const QByteArray &))); | 737 | this, SLOT(pidMessage(const QCString &, const QByteArray &))); |
738 | 738 | ||
739 | if (!initial) { | 739 | if (!initial) { |
740 | processQCopFile(); | 740 | processQCopFile(); |
741 | d->keep_running = d->qcopq.isEmpty(); | 741 | d->keep_running = d->qcopq.isEmpty(); |
742 | } | 742 | } |
743 | 743 | ||
744 | for (int a=0; a<argc; a++) { | 744 | for (int a=0; a<argc; a++) { |
745 | if ( qstrcmp(argv[a],"-preload")==0 ) { | 745 | if ( qstrcmp(argv[a],"-preload")==0 ) { |
746 | argv[a] = argv[a+1]; | 746 | argv[a] = argv[a+1]; |
747 | a++; | 747 | a++; |
748 | d->preloaded = TRUE; | 748 | d->preloaded = TRUE; |
749 | argc-=1; | 749 | argc-=1; |
750 | } else if ( qstrcmp(argv[a],"-preload-show")==0 ) { | 750 | } else if ( qstrcmp(argv[a],"-preload-show")==0 ) { |
751 | argv[a] = argv[a+1]; | 751 | argv[a] = argv[a+1]; |
752 | a++; | 752 | a++; |
753 | d->preloaded = TRUE; | 753 | d->preloaded = TRUE; |
754 | d->forceshow = TRUE; | 754 | d->forceshow = TRUE; |
755 | argc-=1; | 755 | argc-=1; |
756 | } | 756 | } |
757 | } | 757 | } |
758 | 758 | ||
759 | /* overide stored arguments */ | 759 | /* overide stored arguments */ |
760 | setArgs(argc, argv); | 760 | setArgs(argc, argv); |
761 | 761 | ||
762 | /* install translation here */ | 762 | /* install translation here */ |
763 | for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) | 763 | for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) |
764 | installTranslation( (*it) + "/" + d->appName + ".qm" ); | 764 | installTranslation( (*it) + "/" + d->appName + ".qm" ); |
765 | } | 765 | } |
766 | #endif | 766 | #endif |
767 | 767 | ||
768 | 768 | ||
769 | static QPtrDict<void>* inputMethodDict = 0; | 769 | static QPtrDict<void>* inputMethodDict = 0; |
770 | static void createInputMethodDict() | 770 | static void createInputMethodDict() |
771 | { | 771 | { |
772 | if ( !inputMethodDict ) | 772 | if ( !inputMethodDict ) |
773 | inputMethodDict = new QPtrDict<void>; | 773 | inputMethodDict = new QPtrDict<void>; |
774 | } | 774 | } |
775 | 775 | ||
776 | /*! | 776 | /*! |
777 | Returns the currently set hint to the system as to whether | 777 | Returns the currently set hint to the system as to whether |
778 | widget \a w has any use for text input methods. | 778 | widget \a w has any use for text input methods. |
779 | 779 | ||
780 | 780 | ||
781 | \sa setInputMethodHint() InputMethodHint | 781 | \sa setInputMethodHint() InputMethodHint |
782 | */ | 782 | */ |
783 | QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget * w ) | 783 | QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget * w ) |
784 | { | 784 | { |
785 | if ( inputMethodDict && w ) | 785 | if ( inputMethodDict && w ) |
786 | return ( InputMethodHint ) ( int ) inputMethodDict->find( w ); | 786 | return ( InputMethodHint ) ( int ) inputMethodDict->find( w ); |
787 | return Normal; | 787 | return Normal; |
788 | } | 788 | } |
789 | 789 | ||
790 | /*! | 790 | /*! |
791 | \enum QPEApplication::InputMethodHint | 791 | \enum QPEApplication::InputMethodHint |
792 | 792 | ||
793 | \value Normal the application sometimes needs text input (the default). | 793 | \value Normal the application sometimes needs text input (the default). |
794 | \value AlwaysOff the application never needs text input. | 794 | \value AlwaysOff the application never needs text input. |
795 | \value AlwaysOn the application always needs text input. | 795 | \value AlwaysOn the application always needs text input. |
796 | */ | 796 | */ |
797 | 797 | ||
798 | /*! | 798 | /*! |
799 | Hints to the system that widget \a w has use for text input methods | 799 | Hints to the system that widget \a w has use for text input methods |
800 | as specified by \a mode. | 800 | as specified by \a mode. |
801 | 801 | ||
802 | \sa inputMethodHint() InputMethodHint | 802 | \sa inputMethodHint() InputMethodHint |
803 | */ | 803 | */ |
804 | void QPEApplication::setInputMethodHint( QWidget * w, InputMethodHint mode ) | 804 | void QPEApplication::setInputMethodHint( QWidget * w, InputMethodHint mode ) |
805 | { | 805 | { |
806 | createInputMethodDict(); | 806 | createInputMethodDict(); |
807 | if ( mode == Normal ) { | 807 | if ( mode == Normal ) { |
808 | inputMethodDict->remove | 808 | inputMethodDict->remove |
809 | ( w ); | 809 | ( w ); |
810 | } | 810 | } |
811 | else { | 811 | else { |
812 | inputMethodDict->insert( w, ( void* ) mode ); | 812 | inputMethodDict->insert( w, ( void* ) mode ); |
813 | } | 813 | } |
814 | } | 814 | } |
815 | 815 | ||
816 | class HackDialog : public QDialog | 816 | class HackDialog : public QDialog |
817 | { | 817 | { |
818 | public: | 818 | public: |
819 | void acceptIt() | 819 | void acceptIt() |
820 | { | 820 | { |
821 | accept(); | 821 | accept(); |
822 | } | 822 | } |
823 | void rejectIt() | 823 | void rejectIt() |
824 | { | 824 | { |
825 | reject(); | 825 | reject(); |
826 | } | 826 | } |
827 | }; | 827 | }; |
828 | 828 | ||
829 | 829 | ||
830 | void QPEApplication::mapToDefaultAction( QWSKeyEvent * ke, int key ) | 830 | void QPEApplication::mapToDefaultAction( QWSKeyEvent * ke, int key ) |
831 | { | 831 | { |
832 | // specialised actions for certain widgets. May want to | 832 | // specialised actions for certain widgets. May want to |
833 | // add more stuff here. | 833 | // add more stuff here. |
834 | if ( activePopupWidget() && activePopupWidget() ->inherits( "QListBox" ) | 834 | if ( activePopupWidget() && activePopupWidget() ->inherits( "QListBox" ) |
835 | && activePopupWidget() ->parentWidget() | 835 | && activePopupWidget() ->parentWidget() |
836 | && activePopupWidget() ->parentWidget() ->inherits( "QComboBox" ) ) | 836 | && activePopupWidget() ->parentWidget() ->inherits( "QComboBox" ) ) |
837 | key = Qt::Key_Return; | 837 | key = Qt::Key_Return; |
838 | 838 | ||
839 | if ( activePopupWidget() && activePopupWidget() ->inherits( "QPopupMenu" ) ) | 839 | if ( activePopupWidget() && activePopupWidget() ->inherits( "QPopupMenu" ) ) |
840 | key = Qt::Key_Return; | 840 | key = Qt::Key_Return; |
841 | 841 | ||
842 | #ifdef QWS | 842 | #ifdef QWS |
843 | 843 | ||
844 | ke->simpleData.keycode = key; | 844 | ke->simpleData.keycode = key; |
845 | #endif | 845 | #endif |
846 | } | 846 | } |
847 | 847 | ||
848 | class HackWidget : public QWidget | 848 | class HackWidget : public QWidget |
849 | { | 849 | { |
850 | public: | 850 | public: |
851 | bool needsOk() | 851 | bool needsOk() |
852 | { | 852 | { |
853 | return ( getWState() & WState_Reserved1 ); | 853 | return ( getWState() & WState_Reserved1 ); |
854 | } | 854 | } |
855 | }; | 855 | }; |
856 | 856 | ||
857 | /*! | 857 | /*! |
858 | \internal | 858 | \internal |
859 | */ | 859 | */ |
860 | 860 | ||
861 | #ifdef QWS | 861 | #ifdef QWS |
862 | bool QPEApplication::qwsEventFilter( QWSEvent * e ) | 862 | bool QPEApplication::qwsEventFilter( QWSEvent * e ) |
863 | { | 863 | { |
864 | if ( !d->notbusysent && e->type == QWSEvent::Focus ) { | 864 | if ( !d->notbusysent && e->type == QWSEvent::Focus ) { |
865 | if ( qApp->type() != QApplication::GuiServer ) { | 865 | if ( qApp->type() != QApplication::GuiServer ) { |
866 | QCopEnvelope e( "QPE/System", "notBusy(QString)" ); | 866 | QCopEnvelope e( "QPE/System", "notBusy(QString)" ); |
867 | e << d->appName; | 867 | e << d->appName; |
868 | } | 868 | } |
869 | d->notbusysent = TRUE; | 869 | d->notbusysent = TRUE; |
870 | } | 870 | } |
871 | if ( type() == GuiServer ) { | 871 | if ( type() == GuiServer ) { |
872 | switch ( e->type ) { | 872 | switch ( e->type ) { |
873 | case QWSEvent::Mouse: | 873 | case QWSEvent::Mouse: |
874 | if ( e->asMouse() ->simpleData.state && !QWidget::find( e->window() ) ) | 874 | if ( e->asMouse() ->simpleData.state && !QWidget::find( e->window() ) ) |
875 | emit clientMoused(); | 875 | emit clientMoused(); |
876 | break; | 876 | break; |
877 | default: | 877 | default: |
878 | break; | 878 | break; |
879 | } | 879 | } |
880 | } | 880 | } |
881 | if ( e->type == QWSEvent::Key ) { | 881 | if ( e->type == QWSEvent::Key ) { |
882 | QWSKeyEvent *ke = ( QWSKeyEvent * ) e; | 882 | QWSKeyEvent *ke = ( QWSKeyEvent * ) e; |
883 | if ( ke->simpleData.keycode == Qt::Key_F33 ) { | 883 | if ( ke->simpleData.keycode == Qt::Key_F33 ) { |
884 | // Use special "OK" key to press "OK" on top level widgets | 884 | // Use special "OK" key to press "OK" on top level widgets |
885 | QWidget * active = activeWindow(); | 885 | QWidget * active = activeWindow(); |
886 | QWidget *popup = 0; | 886 | QWidget *popup = 0; |
887 | if ( active && active->isPopup() ) { | 887 | if ( active && active->isPopup() ) { |
888 | popup = active; | 888 | popup = active; |
889 | active = active->parentWidget(); | 889 | active = active->parentWidget(); |
890 | } | 890 | } |
891 | if ( active && ( int ) active->winId() == ke->simpleData.window && | 891 | if ( active && ( int ) active->winId() == ke->simpleData.window && |
892 | !active->testWFlags( WStyle_Customize | WType_Popup | WType_Desktop ) ) { | 892 | !active->testWFlags( WStyle_Customize | WType_Popup | WType_Desktop ) ) { |
893 | if ( ke->simpleData.is_press ) { | 893 | if ( ke->simpleData.is_press ) { |
894 | if ( popup ) | 894 | if ( popup ) |
895 | popup->close(); | 895 | popup->close(); |
896 | if ( active->inherits( "QDialog" ) ) { | 896 | if ( active->inherits( "QDialog" ) ) { |
897 | HackDialog * d = ( HackDialog * ) active; | 897 | HackDialog * d = ( HackDialog * ) active; |
898 | d->acceptIt(); | 898 | d->acceptIt(); |
899 | return TRUE; | 899 | return TRUE; |
900 | } | 900 | } |
901 | else if ( ( ( HackWidget * ) active ) ->needsOk() ) { | 901 | else if ( ( ( HackWidget * ) active ) ->needsOk() ) { |
902 | QSignal s; | 902 | QSignal s; |
903 | s.connect( active, SLOT( accept() ) ); | 903 | s.connect( active, SLOT( accept() ) ); |
904 | s.activate(); | 904 | s.activate(); |
905 | } | 905 | } |
906 | else { | 906 | else { |
907 | // do the same as with the select key: Map to the default action of the widget: | 907 | // do the same as with the select key: Map to the default action of the widget: |
908 | mapToDefaultAction( ke, Qt::Key_Return ); | 908 | mapToDefaultAction( ke, Qt::Key_Return ); |
909 | } | 909 | } |
910 | } | 910 | } |
911 | } | 911 | } |
912 | } | 912 | } |
913 | else if ( ke->simpleData.keycode == Qt::Key_F30 ) { | 913 | else if ( ke->simpleData.keycode == Qt::Key_F30 ) { |
914 | // Use special "select" key to do whatever default action a widget has | 914 | // Use special "select" key to do whatever default action a widget has |
915 | mapToDefaultAction( ke, Qt::Key_Space ); | 915 | mapToDefaultAction( ke, Qt::Key_Space ); |
916 | } | 916 | } |
917 | else if ( ke->simpleData.keycode == Qt::Key_Escape && | 917 | else if ( ke->simpleData.keycode == Qt::Key_Escape && |
918 | ke->simpleData.is_press ) { | 918 | ke->simpleData.is_press ) { |
919 | // Escape key closes app if focus on toplevel | 919 | // Escape key closes app if focus on toplevel |
920 | QWidget * active = activeWindow(); | 920 | QWidget * active = activeWindow(); |
921 | if ( active && active->testWFlags( WType_TopLevel ) && | 921 | if ( active && active->testWFlags( WType_TopLevel ) && |
922 | ( int ) active->winId() == ke->simpleData.window && | 922 | ( int ) active->winId() == ke->simpleData.window && |
923 | !active->testWFlags( WStyle_Dialog | WStyle_Customize | WType_Popup | WType_Desktop ) ) { | 923 | !active->testWFlags( WStyle_Dialog | WStyle_Customize | WType_Popup | WType_Desktop ) ) { |
924 | if ( active->inherits( "QDialog" ) ) { | 924 | if ( active->inherits( "QDialog" ) ) { |
925 | HackDialog * d = ( HackDialog * ) active; | 925 | HackDialog * d = ( HackDialog * ) active; |
926 | d->rejectIt(); | 926 | d->rejectIt(); |
927 | return TRUE; | 927 | return TRUE; |
928 | } | 928 | } |
929 | else if ( strcmp( argv() [ 0 ], "embeddedkonsole" ) != 0 ) { | 929 | else if ( strcmp( argv() [ 0 ], "embeddedkonsole" ) != 0 ) { |
930 | active->close(); | 930 | active->close(); |
931 | } | 931 | } |
932 | } | 932 | } |
933 | } | 933 | } |
934 | else if ( ke->simpleData.keycode >= Qt::Key_F1 && ke->simpleData.keycode <= Qt::Key_F29 ) { | 934 | else if ( ke->simpleData.keycode >= Qt::Key_F1 && ke->simpleData.keycode <= Qt::Key_F29 ) { |
935 | // this should be if ( ODevice::inst ( )-> buttonForKeycode ( ... )) | 935 | // this should be if ( ODevice::inst ( )-> buttonForKeycode ( ... )) |
936 | // but we cannot access libopie function within libqpe :( | 936 | // but we cannot access libopie function within libqpe :( |
937 | 937 | ||
938 | QWidget * active = activeWindow ( ); | 938 | QWidget * active = activeWindow ( ); |
939 | if ( active && ((int) active-> winId ( ) == ke-> simpleData.window )) { | 939 | if ( active && ((int) active-> winId ( ) == ke-> simpleData.window )) { |
940 | if ( d-> kbgrabbed ) { // we grabbed the keyboard | 940 | if ( d-> kbgrabbed ) { // we grabbed the keyboard |
941 | QChar ch ( ke-> simpleData.unicode ); | 941 | QChar ch ( ke-> simpleData.unicode ); |
942 | QKeyEvent qke ( ke-> simpleData. is_press ? QEvent::KeyPress : QEvent::KeyRelease, | 942 | QKeyEvent qke ( ke-> simpleData. is_press ? QEvent::KeyPress : QEvent::KeyRelease, |
943 | ke-> simpleData.keycode, | 943 | ke-> simpleData.keycode, |
944 | ch. latin1 ( ), | 944 | ch. latin1 ( ), |
945 | ke-> simpleData.modifiers, | 945 | ke-> simpleData.modifiers, |
946 | QString ( ch ), | 946 | QString ( ch ), |
947 | ke-> simpleData.is_auto_repeat, 1 ); | 947 | ke-> simpleData.is_auto_repeat, 1 ); |
948 | 948 | ||
949 | QObject *which = QWidget::keyboardGrabber ( ); | 949 | QObject *which = QWidget::keyboardGrabber ( ); |
950 | if ( !which ) | 950 | if ( !which ) |
951 | which = QApplication::focusWidget ( ); | 951 | which = QApplication::focusWidget ( ); |
952 | if ( !which ) | 952 | if ( !which ) |
953 | which = QApplication::activeWindow ( ); | 953 | which = QApplication::activeWindow ( ); |
954 | if ( !which ) | 954 | if ( !which ) |
955 | which = qApp; | 955 | which = qApp; |
956 | 956 | ||
957 | QApplication::sendEvent ( which, &qke ); | 957 | QApplication::sendEvent ( which, &qke ); |
958 | } | 958 | } |
959 | else { // we didn't grab the keyboard, so send the event to the launcher | 959 | else { // we didn't grab the keyboard, so send the event to the launcher |
960 | QCopEnvelope e ( "QPE/Launcher", "deviceButton(int,int,int)" ); | 960 | 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 ); | 961 | e << int( ke-> simpleData.keycode ) << int( ke-> simpleData. is_press ) << int( ke-> simpleData.is_auto_repeat ); |
962 | } | 962 | } |
963 | } | 963 | } |
964 | return true; | 964 | return true; |
965 | } | 965 | } |
966 | } | 966 | } |
967 | if ( e->type == QWSEvent::Focus ) { | 967 | if ( e->type == QWSEvent::Focus ) { |
968 | QWSFocusEvent * fe = ( QWSFocusEvent* ) e; | 968 | QWSFocusEvent * fe = ( QWSFocusEvent* ) e; |
969 | if ( !fe->simpleData.get_focus ) { | 969 | if ( !fe->simpleData.get_focus ) { |
970 | QWidget * active = activeWindow(); | 970 | QWidget * active = activeWindow(); |
971 | while ( active && active->isPopup() ) { | 971 | while ( active && active->isPopup() ) { |
972 | active->close(); | 972 | active->close(); |
973 | active = activeWindow(); | 973 | active = activeWindow(); |
974 | } | 974 | } |
975 | } | 975 | } |
976 | else { | 976 | else { |
977 | // make sure our modal widget is ALWAYS on top | 977 | // make sure our modal widget is ALWAYS on top |
978 | QWidget *topm = activeModalWidget(); | 978 | QWidget *topm = activeModalWidget(); |
979 | if ( topm ) { | 979 | if ( topm ) { |
980 | topm->raise(); | 980 | topm->raise(); |
981 | } | 981 | } |
982 | } | 982 | } |
983 | if ( fe->simpleData.get_focus && inputMethodDict ) { | 983 | if ( fe->simpleData.get_focus && inputMethodDict ) { |
984 | InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) ); | 984 | InputMethodHint m = inputMethodHint( QWidget::find( e->window() ) ); |
985 | if ( m == AlwaysOff ) | 985 | if ( m == AlwaysOff ) |
986 | Global::hideInputMethod(); | 986 | Global::hideInputMethod(); |
987 | if ( m == AlwaysOn ) | 987 | if ( m == AlwaysOn ) |
988 | Global::showInputMethod(); | 988 | Global::showInputMethod(); |
989 | } | 989 | } |
990 | } | 990 | } |
991 | 991 | ||
992 | 992 | ||
993 | return QApplication::qwsEventFilter( e ); | 993 | return QApplication::qwsEventFilter( e ); |
994 | } | 994 | } |
995 | #endif | 995 | #endif |
996 | 996 | ||
997 | /*! | 997 | /*! |
998 | Destroys the QPEApplication. | 998 | Destroys the QPEApplication. |
999 | */ | 999 | */ |
1000 | QPEApplication::~QPEApplication() | 1000 | QPEApplication::~QPEApplication() |
1001 | { | 1001 | { |
1002 | ungrabKeyboard(); | 1002 | ungrabKeyboard(); |
1003 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 1003 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
1004 | // Need to delete QCopChannels early, since the display will | 1004 | // Need to delete QCopChannels early, since the display will |
1005 | // be gone by the time we get to ~QObject(). | 1005 | // be gone by the time we get to ~QObject(). |
1006 | delete sysChannel; | 1006 | delete sysChannel; |
1007 | delete pidChannel; | 1007 | delete pidChannel; |
1008 | #endif | 1008 | #endif |
1009 | 1009 | ||
1010 | delete d; | 1010 | delete d; |
1011 | } | 1011 | } |
1012 | 1012 | ||
1013 | /*! | 1013 | /*! |
1014 | Returns <tt>$OPIEDIR/</tt>. | 1014 | Returns <tt>$OPIEDIR/</tt>. |
1015 | */ | 1015 | */ |
1016 | QString QPEApplication::qpeDir() | 1016 | QString QPEApplication::qpeDir() |
1017 | { | 1017 | { |
1018 | const char * base = getenv( "OPIEDIR" ); | 1018 | const char * base = getenv( "OPIEDIR" ); |
1019 | if ( base ) | 1019 | if ( base ) |
1020 | return QString( base ) + "/"; | 1020 | return QString( base ) + "/"; |
1021 | 1021 | ||
1022 | return QString( "../" ); | 1022 | return QString( "../" ); |
1023 | } | 1023 | } |
1024 | 1024 | ||
1025 | /*! | 1025 | /*! |
1026 | Returns the user's current Document directory. There is a trailing "/". | 1026 | Returns the user's current Document directory. There is a trailing "/". |
1027 | .. well, it does now,, and there's no trailing '/' | 1027 | .. well, it does now,, and there's no trailing '/' |
1028 | */ | 1028 | */ |
1029 | QString QPEApplication::documentDir() | 1029 | QString QPEApplication::documentDir() |
1030 | { | 1030 | { |
1031 | const char* base = getenv( "HOME"); | 1031 | const char* base = getenv( "HOME"); |
1032 | if ( base ) | 1032 | if ( base ) |
1033 | return QString( base ) + "/Documents"; | 1033 | return QString( base ) + "/Documents"; |
1034 | 1034 | ||
1035 | return QString( "../Documents" ); | 1035 | return QString( "../Documents" ); |
1036 | } | 1036 | } |
1037 | 1037 | ||
1038 | static int deforient = -1; | 1038 | static int deforient = -1; |
1039 | 1039 | ||
1040 | /*! | 1040 | /*! |
1041 | \internal | 1041 | \internal |
1042 | */ | 1042 | */ |
1043 | int QPEApplication::defaultRotation() | 1043 | int QPEApplication::defaultRotation() |
1044 | { | 1044 | { |
1045 | if ( deforient < 0 ) { | 1045 | if ( deforient < 0 ) { |
1046 | QString d = getenv( "QWS_DISPLAY" ); | 1046 | QString d = getenv( "QWS_DISPLAY" ); |
1047 | if ( d.contains( "Rot90" ) ) { | 1047 | if ( d.contains( "Rot90" ) ) { |
1048 | deforient = 90; | 1048 | deforient = 90; |
1049 | } | 1049 | } |
1050 | else if ( d.contains( "Rot180" ) ) { | 1050 | else if ( d.contains( "Rot180" ) ) { |
1051 | deforient = 180; | 1051 | deforient = 180; |
1052 | } | 1052 | } |
1053 | else if ( d.contains( "Rot270" ) ) { | 1053 | else if ( d.contains( "Rot270" ) ) { |
1054 | deforient = 270; | 1054 | deforient = 270; |
1055 | } | 1055 | } |
1056 | else { | 1056 | else { |
1057 | deforient = 0; | 1057 | deforient = 0; |
1058 | } | 1058 | } |
1059 | } | 1059 | } |
1060 | return deforient; | 1060 | return deforient; |
1061 | } | 1061 | } |
1062 | 1062 | ||
1063 | /*! | 1063 | /*! |
1064 | \internal | 1064 | \internal |
1065 | */ | 1065 | */ |
1066 | void QPEApplication::setDefaultRotation( int r ) | 1066 | void QPEApplication::setDefaultRotation( int r ) |
1067 | { | 1067 | { |
1068 | if ( qApp->type() == GuiServer ) { | 1068 | if ( qApp->type() == GuiServer ) { |
1069 | deforient = r; | 1069 | deforient = r; |
1070 | setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); | 1070 | setenv( "QWS_DISPLAY", QString( "Transformed:Rot%1:0" ).arg( r ).latin1(), 1 ); |
1071 | Config config("qpe"); | 1071 | Config config("qpe"); |
1072 | config.setGroup( "Rotation" ); | 1072 | config.setGroup( "Rotation" ); |
1073 | config.writeEntry( "Rot", r ); | 1073 | config.writeEntry( "Rot", r ); |
1074 | } | 1074 | } |
1075 | else { | 1075 | else { |
1076 | #ifndef QT_NO_COP | 1076 | #ifndef QT_NO_COP |
1077 | { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); | 1077 | { QCopEnvelope e( "QPE/System", "setDefaultRotation(int)" ); |
1078 | e << r; | 1078 | e << r; |
1079 | } | 1079 | } |
1080 | #endif | 1080 | #endif |
1081 | 1081 | ||
1082 | } | 1082 | } |
1083 | } | 1083 | } |
1084 | 1084 | ||
1085 | #include <qgfx_qws.h> | 1085 | #include <qgfx_qws.h> |
1086 | #include <qwindowsystem_qws.h> | 1086 | #include <qwindowsystem_qws.h> |
1087 | #include <qpixmapcache.h> | 1087 | #include <qpixmapcache.h> |
1088 | 1088 | ||
1089 | extern void qws_clearLoadedFonts(); | 1089 | extern void qws_clearLoadedFonts(); |
1090 | 1090 | ||
1091 | void QPEApplication::setCurrentMode( int x, int y, int depth ) | 1091 | void QPEApplication::setCurrentMode( int x, int y, int depth ) |
1092 | { | 1092 | { |
1093 | // Reset the caches | 1093 | // Reset the caches |
1094 | qws_clearLoadedFonts(); | 1094 | qws_clearLoadedFonts(); |
1095 | QPixmapCache::clear(); | 1095 | QPixmapCache::clear(); |
1096 | 1096 | ||
1097 | // Change the screen mode | 1097 | // Change the screen mode |
1098 | qt_screen->setMode(x, y, depth); | 1098 | qt_screen->setMode(x, y, depth); |
1099 | 1099 | ||
1100 | if ( qApp->type() == GuiServer ) { | 1100 | if ( qApp->type() == GuiServer ) { |
1101 | // Reconfigure the GuiServer | 1101 | // Reconfigure the GuiServer |
1102 | qwsServer->beginDisplayReconfigure(); | 1102 | qwsServer->beginDisplayReconfigure(); |
1103 | qwsServer->endDisplayReconfigure(); | 1103 | qwsServer->endDisplayReconfigure(); |
1104 | 1104 | ||
1105 | // Get all the running apps to reset | 1105 | // Get all the running apps to reset |
1106 | QCopEnvelope env( "QPE/System", "reset()" ); | 1106 | QCopEnvelope env( "QPE/System", "reset()" ); |
1107 | } | 1107 | } |
1108 | } | 1108 | } |
1109 | 1109 | ||
1110 | void QPEApplication::reset() { | 1110 | void QPEApplication::reset() { |
1111 | // Reconnect to the screen | 1111 | // Reconnect to the screen |
1112 | qt_screen->disconnect(); | 1112 | qt_screen->disconnect(); |
1113 | qt_screen->connect( QString::null ); | 1113 | qt_screen->connect( QString::null ); |
1114 | 1114 | ||
1115 | // Redraw everything | 1115 | // Redraw everything |
1116 | applyStyle(); | 1116 | applyStyle(); |
1117 | } | 1117 | } |
1118 | 1118 | ||
1119 | /*! | 1119 | /*! |
1120 | \internal | 1120 | \internal |
1121 | */ | 1121 | */ |
1122 | void QPEApplication::applyStyle() | 1122 | void QPEApplication::applyStyle() |
1123 | { | 1123 | { |
1124 | Config config( "qpe" ); | 1124 | Config config( "qpe" ); |
1125 | config.setGroup( "Appearance" ); | 1125 | config.setGroup( "Appearance" ); |
1126 | 1126 | ||
1127 | #if QT_VERSION > 233 | 1127 | #if QT_VERSION > 233 |
1128 | #if !defined(OPIE_NO_OVERRIDE_QT) | ||
1128 | // don't block ourselves ... | 1129 | // don't block ourselves ... |
1129 | Opie::force_appearance = 0; | 1130 | Opie::force_appearance = 0; |
1130 | 1131 | ||
1131 | static QString appname = Opie::binaryName ( ); | 1132 | static QString appname = Opie::binaryName ( ); |
1132 | 1133 | ||
1133 | QStringList ex = config. readListEntry ( "NoStyle", ';' ); | 1134 | QStringList ex = config. readListEntry ( "NoStyle", ';' ); |
1134 | int nostyle = 0; | 1135 | int nostyle = 0; |
1135 | for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) { | 1136 | for ( QStringList::Iterator it = ex. begin ( ); it != ex. end ( ); ++it ) { |
1136 | if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) { | 1137 | if ( QRegExp (( *it ). mid ( 1 ), false, true ). find ( appname, 0 ) >= 0 ) { |
1137 | nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 ); | 1138 | nostyle = ( *it ). left ( 1 ). toInt ( 0, 32 ); |
1138 | break; | 1139 | break; |
1139 | } | 1140 | } |
1140 | } | 1141 | } |
1142 | #else | ||
1143 | int nostyle = 0; | ||
1144 | #endif | ||
1141 | 1145 | ||
1142 | // Widget style | 1146 | // Widget style |
1143 | QString style = config.readEntry( "Style", "FlatStyle" ); | 1147 | QString style = config.readEntry( "Style", "FlatStyle" ); |
1144 | 1148 | ||
1145 | // don't set a custom style | 1149 | // don't set a custom style |
1146 | if ( nostyle & Opie::Force_Style ) | 1150 | if ( nostyle & Opie::Force_Style ) |
1147 | style = "FlatStyle"; | 1151 | style = "FlatStyle"; |
1148 | 1152 | ||
1149 | internalSetStyle ( style ); | 1153 | internalSetStyle ( style ); |
1150 | 1154 | ||
1151 | // Colors - from /etc/colors/Liquid.scheme | 1155 | // Colors - from /etc/colors/Liquid.scheme |
1152 | QColor bgcolor( config.readEntry( "Background", "#E0E0E0" ) ); | 1156 | QColor bgcolor( config.readEntry( "Background", "#E0E0E0" ) ); |
1153 | QColor btncolor( config.readEntry( "Button", "#96c8fa" ) ); | 1157 | QColor btncolor( config.readEntry( "Button", "#96c8fa" ) ); |
1154 | QPalette pal( btncolor, bgcolor ); | 1158 | QPalette pal( btncolor, bgcolor ); |
1155 | QString color = config.readEntry( "Highlight", "#73adef" ); | 1159 | QString color = config.readEntry( "Highlight", "#73adef" ); |
1156 | pal.setColor( QColorGroup::Highlight, QColor( color ) ); | 1160 | pal.setColor( QColorGroup::Highlight, QColor( color ) ); |
1157 | color = config.readEntry( "HighlightedText", "#FFFFFF" ); | 1161 | color = config.readEntry( "HighlightedText", "#FFFFFF" ); |
1158 | pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); | 1162 | pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); |
1159 | color = config.readEntry( "Text", "#000000" ); | 1163 | color = config.readEntry( "Text", "#000000" ); |
1160 | pal.setColor( QColorGroup::Text, QColor( color ) ); | 1164 | pal.setColor( QColorGroup::Text, QColor( color ) ); |
1161 | color = config.readEntry( "ButtonText", "#000000" ); | 1165 | color = config.readEntry( "ButtonText", "#000000" ); |
1162 | pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); | 1166 | pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); |
1163 | color = config.readEntry( "Base", "#FFFFFF" ); | 1167 | color = config.readEntry( "Base", "#FFFFFF" ); |
1164 | pal.setColor( QColorGroup::Base, QColor( color ) ); | 1168 | pal.setColor( QColorGroup::Base, QColor( color ) ); |
1165 | 1169 | ||
1166 | pal.setColor( QPalette::Disabled, QColorGroup::Text, | 1170 | pal.setColor( QPalette::Disabled, QColorGroup::Text, |
1167 | pal.color( QPalette::Active, QColorGroup::Background ).dark() ); | 1171 | pal.color( QPalette::Active, QColorGroup::Background ).dark() ); |
1168 | 1172 | ||
1169 | setPalette( pal, TRUE ); | 1173 | setPalette( pal, TRUE ); |
1170 | 1174 | ||
1171 | // Window Decoration | 1175 | // Window Decoration |
1172 | QString dec = config.readEntry( "Decoration", "Flat" ); | 1176 | QString dec = config.readEntry( "Decoration", "Flat" ); |
1173 | 1177 | ||
1174 | // don't set a custom deco | 1178 | // don't set a custom deco |
1175 | if ( nostyle & Opie::Force_Decoration ) | 1179 | if ( nostyle & Opie::Force_Decoration ) |
1176 | dec = ""; | 1180 | dec = ""; |
1177 | 1181 | ||
1178 | //qDebug ( "Setting Deco: %s -- old %s (%d)", dec.latin1(), d-> decorationName.latin1(), nostyle); | 1182 | //qDebug ( "Setting Deco: %s -- old %s (%d)", dec.latin1(), d-> decorationName.latin1(), nostyle); |
1179 | 1183 | ||
1180 | if ( dec != d->decorationName ) { | 1184 | if ( dec != d->decorationName ) { |
1181 | qwsSetDecoration( new QPEDecoration( dec ) ); | 1185 | qwsSetDecoration( new QPEDecoration( dec ) ); |
1182 | d->decorationName = dec; | 1186 | d->decorationName = dec; |
1183 | } | 1187 | } |
1184 | 1188 | ||
1185 | // Font | 1189 | // Font |
1186 | QString ff = config.readEntry( "FontFamily", font().family() ); | 1190 | QString ff = config.readEntry( "FontFamily", font().family() ); |
1187 | int fs = config.readNumEntry( "FontSize", font().pointSize() ); | 1191 | int fs = config.readNumEntry( "FontSize", font().pointSize() ); |
1188 | 1192 | ||
1189 | // don't set a custom font | 1193 | // don't set a custom font |
1190 | if ( nostyle & Opie::Force_Font ) { | 1194 | if ( nostyle & Opie::Force_Font ) { |
1191 | ff = "Vera"; | 1195 | ff = "Vera"; |
1192 | fs = 10; | 1196 | fs = 10; |
1193 | } | 1197 | } |
1194 | 1198 | ||
1195 | setFont ( QFont ( ff, fs ), true ); | 1199 | setFont ( QFont ( ff, fs ), true ); |
1196 | 1200 | ||
1201 | #if !defined(OPIE_NO_OVERRIDE_QT) | ||
1197 | // revert to global blocking policy ... | 1202 | // revert to global blocking policy ... |
1198 | Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None; | 1203 | Opie::force_appearance = config. readBoolEntry ( "ForceStyle", false ) ? Opie::Force_All : Opie::Force_None; |
1199 | Opie::force_appearance &= ~nostyle; | 1204 | Opie::force_appearance &= ~nostyle; |
1200 | #endif | 1205 | #endif |
1206 | #endif | ||
1201 | } | 1207 | } |
1202 | 1208 | ||
1203 | void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) | 1209 | void QPEApplication::systemMessage( const QCString& msg, const QByteArray& data ) |
1204 | { | 1210 | { |
1205 | #ifdef Q_WS_QWS | 1211 | #ifdef Q_WS_QWS |
1206 | QDataStream stream( data, IO_ReadOnly ); | 1212 | QDataStream stream( data, IO_ReadOnly ); |
1207 | if ( msg == "applyStyle()" ) { | 1213 | if ( msg == "applyStyle()" ) { |
1208 | applyStyle(); | 1214 | applyStyle(); |
1209 | } | 1215 | } |
1210 | else if ( msg == "toggleApplicationMenu()" ) { | 1216 | else if ( msg == "toggleApplicationMenu()" ) { |
1211 | QWidget *active = activeWindow ( ); | 1217 | QWidget *active = activeWindow ( ); |
1212 | 1218 | ||
1213 | if ( active ) { | 1219 | if ( active ) { |
1214 | QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( ); | 1220 | QPEMenuToolFocusManager *man = QPEMenuToolFocusManager::manager ( ); |
1215 | bool oldactive = man-> isActive ( ); | 1221 | bool oldactive = man-> isActive ( ); |
1216 | 1222 | ||
1217 | man-> setActive( !man-> isActive() ); | 1223 | man-> setActive( !man-> isActive() ); |
1218 | 1224 | ||
1219 | if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu | 1225 | if ( !oldactive && !man-> isActive ( )) { // no menubar to toggle -> try O-Menu |
1220 | QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" ); | 1226 | QCopEnvelope e ( "QPE/TaskBar", "toggleStartMenu()" ); |
1221 | } | 1227 | } |
1222 | } | 1228 | } |
1223 | } | 1229 | } |
1224 | else if ( msg == "setDefaultRotation(int)" ) { | 1230 | else if ( msg == "setDefaultRotation(int)" ) { |
1225 | if ( type() == GuiServer ) { | 1231 | if ( type() == GuiServer ) { |
1226 | int r; | 1232 | int r; |
1227 | stream >> r; | 1233 | stream >> r; |
1228 | setDefaultRotation( r ); | 1234 | setDefaultRotation( r ); |
1229 | } | 1235 | } |
1230 | } | 1236 | } |
1231 | else if ( msg == "setCurrentMode(int,int,int)" ) { // Added: 2003-06-11 by Tim Ansell <mithro@mithis.net> | 1237 | else if ( msg == "setCurrentMode(int,int,int)" ) { // Added: 2003-06-11 by Tim Ansell <mithro@mithis.net> |
1232 | if ( type() == GuiServer ) { | 1238 | if ( type() == GuiServer ) { |
1233 | int x, y, depth; | 1239 | int x, y, depth; |
1234 | stream >> x; | 1240 | stream >> x; |
1235 | stream >> y; | 1241 | stream >> y; |
1236 | stream >> depth; | 1242 | stream >> depth; |
1237 | setCurrentMode( x, y, depth ); | 1243 | setCurrentMode( x, y, depth ); |
1238 | } | 1244 | } |
1239 | } | 1245 | } |
1240 | else if ( msg == "reset()" ) { | 1246 | else if ( msg == "reset()" ) { |
1241 | if ( type() != GuiServer ) | 1247 | if ( type() != GuiServer ) |
1242 | reset(); | 1248 | reset(); |
1243 | } | 1249 | } |
1244 | else if ( msg == "setCurrentRotation(int)" ) { | 1250 | else if ( msg == "setCurrentRotation(int)" ) { |
1245 | int r; | 1251 | int r; |
1246 | stream >> r; | 1252 | stream >> r; |
1247 | setCurrentRotation( r ); | 1253 | setCurrentRotation( r ); |
1248 | } | 1254 | } |
1249 | else if ( msg == "shutdown()" ) { | 1255 | else if ( msg == "shutdown()" ) { |
1250 | if ( type() == GuiServer ) | 1256 | if ( type() == GuiServer ) |
1251 | shutdown(); | 1257 | shutdown(); |
1252 | } | 1258 | } |
1253 | else if ( msg == "quit()" ) { | 1259 | else if ( msg == "quit()" ) { |
1254 | if ( type() != GuiServer ) | 1260 | if ( type() != GuiServer ) |
1255 | tryQuit(); | 1261 | tryQuit(); |
1256 | } | 1262 | } |
1257 | else if ( msg == "forceQuit()" ) { | 1263 | else if ( msg == "forceQuit()" ) { |
1258 | if ( type() != GuiServer ) | 1264 | if ( type() != GuiServer ) |
1259 | quit(); | 1265 | quit(); |
1260 | } | 1266 | } |
1261 | else if ( msg == "restart()" ) { | 1267 | else if ( msg == "restart()" ) { |
1262 | if ( type() == GuiServer ) | 1268 | if ( type() == GuiServer ) |
1263 | restart(); | 1269 | restart(); |
1264 | } | 1270 | } |
1265 | else if ( msg == "language(QString)" ) { | 1271 | else if ( msg == "language(QString)" ) { |
1266 | if ( type() == GuiServer ) { | 1272 | if ( type() == GuiServer ) { |
1267 | QString l; | 1273 | QString l; |
1268 | stream >> l; | 1274 | stream >> l; |
1269 | QString cl = getenv( "LANG" ); | 1275 | QString cl = getenv( "LANG" ); |
1270 | if ( cl != l ) { | 1276 | if ( cl != l ) { |
1271 | if ( l.isNull() ) | 1277 | if ( l.isNull() ) |
1272 | unsetenv( "LANG" ); | 1278 | unsetenv( "LANG" ); |
1273 | else | 1279 | else |
1274 | setenv( "LANG", l.latin1(), 1 ); | 1280 | setenv( "LANG", l.latin1(), 1 ); |
1275 | restart(); | 1281 | restart(); |
1276 | } | 1282 | } |
1277 | } | 1283 | } |
1278 | } | 1284 | } |
1279 | else if ( msg == "timeChange(QString)" ) { | 1285 | else if ( msg == "timeChange(QString)" ) { |
1280 | QString t; | 1286 | QString t; |
1281 | stream >> t; | 1287 | stream >> t; |
1282 | if ( t.isNull() ) | 1288 | if ( t.isNull() ) |
1283 | unsetenv( "TZ" ); | 1289 | unsetenv( "TZ" ); |
1284 | else | 1290 | else |
1285 | setenv( "TZ", t.latin1(), 1 ); | 1291 | setenv( "TZ", t.latin1(), 1 ); |
1286 | // emit the signal so everyone else knows... | 1292 | // emit the signal so everyone else knows... |
1287 | emit timeChanged(); | 1293 | emit timeChanged(); |
1288 | } | 1294 | } |
1289 | else if ( msg == "addAlarm(QDateTime,QCString,QCString,int)" ) { | 1295 | else if ( msg == "addAlarm(QDateTime,QCString,QCString,int)" ) { |
1290 | if ( type() == GuiServer ) { | 1296 | if ( type() == GuiServer ) { |
1291 | QDateTime when; | 1297 | QDateTime when; |
1292 | QCString channel, message; | 1298 | QCString channel, message; |
1293 | int data; | 1299 | int data; |
1294 | stream >> when >> channel >> message >> data; | 1300 | stream >> when >> channel >> message >> data; |
1295 | AlarmServer::addAlarm( when, channel, message, data ); | 1301 | AlarmServer::addAlarm( when, channel, message, data ); |
1296 | } | 1302 | } |
1297 | } | 1303 | } |
1298 | else if ( msg == "deleteAlarm(QDateTime,QCString,QCString,int)" ) { | 1304 | else if ( msg == "deleteAlarm(QDateTime,QCString,QCString,int)" ) { |
1299 | if ( type() == GuiServer ) { | 1305 | if ( type() == GuiServer ) { |
1300 | QDateTime when; | 1306 | QDateTime when; |
1301 | QCString channel, message; | 1307 | QCString channel, message; |
1302 | int data; | 1308 | int data; |
1303 | stream >> when >> channel >> message >> data; | 1309 | stream >> when >> channel >> message >> data; |
1304 | AlarmServer::deleteAlarm( when, channel, message, data ); | 1310 | AlarmServer::deleteAlarm( when, channel, message, data ); |
1305 | } | 1311 | } |
1306 | } | 1312 | } |
1307 | else if ( msg == "clockChange(bool)" ) { | 1313 | else if ( msg == "clockChange(bool)" ) { |
1308 | int tmp; | 1314 | int tmp; |
1309 | stream >> tmp; | 1315 | stream >> tmp; |
1310 | emit clockChanged( tmp ); | 1316 | emit clockChanged( tmp ); |
1311 | } | 1317 | } |
1312 | else if ( msg == "weekChange(bool)" ) { | 1318 | else if ( msg == "weekChange(bool)" ) { |
1313 | int tmp; | 1319 | int tmp; |
1314 | stream >> tmp; | 1320 | stream >> tmp; |
1315 | emit weekChanged( tmp ); | 1321 | emit weekChanged( tmp ); |
1316 | } | 1322 | } |
1317 | else if ( msg == "setDateFormat(DateFormat)" ) { | 1323 | else if ( msg == "setDateFormat(DateFormat)" ) { |
1318 | DateFormat tmp; | 1324 | DateFormat tmp; |
1319 | stream >> tmp; | 1325 | stream >> tmp; |
1320 | emit dateFormatChanged( tmp ); | 1326 | emit dateFormatChanged( tmp ); |
1321 | } | 1327 | } |
1322 | else if ( msg == "setVolume(int,int)" ) { | 1328 | else if ( msg == "setVolume(int,int)" ) { |
1323 | int t, v; | 1329 | int t, v; |
1324 | stream >> t >> v; | 1330 | stream >> t >> v; |
1325 | setVolume( t, v ); | 1331 | setVolume( t, v ); |
1326 | emit volumeChanged( muted ); | 1332 | emit volumeChanged( muted ); |
1327 | } | 1333 | } |
1328 | else if ( msg == "volumeChange(bool)" ) { | 1334 | else if ( msg == "volumeChange(bool)" ) { |
1329 | stream >> muted; | 1335 | stream >> muted; |
1330 | setVolume(); | 1336 | setVolume(); |
1331 | emit volumeChanged( muted ); | 1337 | emit volumeChanged( muted ); |
1332 | } | 1338 | } |
1333 | else if ( msg == "setMic(int,int)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com> | 1339 | else if ( msg == "setMic(int,int)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com> |
1334 | int t, v; | 1340 | int t, v; |
1335 | stream >> t >> v; | 1341 | stream >> t >> v; |
1336 | setMic( t, v ); | 1342 | setMic( t, v ); |
1337 | emit micChanged( micMuted ); | 1343 | emit micChanged( micMuted ); |
1338 | } | 1344 | } |
1339 | else if ( msg == "micChange(bool)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com> | 1345 | else if ( msg == "micChange(bool)" ) { // Added: 2002-02-08 by Jeremy Cowgar <jc@cowgar.com> |
1340 | stream >> micMuted; | 1346 | stream >> micMuted; |
1341 | setMic(); | 1347 | setMic(); |
1342 | emit micChanged( micMuted ); | 1348 | emit micChanged( micMuted ); |
1343 | } | 1349 | } |
1344 | else if ( msg == "setBass(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> | 1350 | else if ( msg == "setBass(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> |
1345 | int t, v; | 1351 | int t, v; |
1346 | stream >> t >> v; | 1352 | stream >> t >> v; |
1347 | setBass( t, v ); | 1353 | setBass( t, v ); |
1348 | } | 1354 | } |
1349 | else if ( msg == "bassChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> | 1355 | else if ( msg == "bassChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> |
1350 | setBass(); | 1356 | setBass(); |
1351 | } | 1357 | } |
1352 | else if ( msg == "setTreble(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> | 1358 | else if ( msg == "setTreble(int,int)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> |
1353 | int t, v; | 1359 | int t, v; |
1354 | stream >> t >> v; | 1360 | stream >> t >> v; |
1355 | setTreble( t, v ); | 1361 | setTreble( t, v ); |
1356 | } | 1362 | } |
1357 | else if ( msg == "trebleChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> | 1363 | else if ( msg == "trebleChange(bool)" ) { // Added: 2002-12-13 by Maximilian Reiss <harlekin@handhelds.org> |
1358 | setTreble(); | 1364 | setTreble(); |
1359 | } else if ( msg == "getMarkedText()" ) { | 1365 | } else if ( msg == "getMarkedText()" ) { |
1360 | if ( type() == GuiServer ) { | 1366 | if ( type() == GuiServer ) { |
1361 | const ushort unicode = 'C'-'@'; | 1367 | const ushort unicode = 'C'-'@'; |
1362 | const int scan = Key_C; | 1368 | const int scan = Key_C; |
1363 | qwsServer->processKeyEvent( unicode, scan, ControlButton, TRUE, FALSE ); | 1369 | qwsServer->processKeyEvent( unicode, scan, ControlButton, TRUE, FALSE ); |
1364 | qwsServer->processKeyEvent( unicode, scan, ControlButton, FALSE, FALSE ); | 1370 | qwsServer->processKeyEvent( unicode, scan, ControlButton, FALSE, FALSE ); |
1365 | } | 1371 | } |
1366 | } else if ( msg == "newChannel(QString)") { | 1372 | } else if ( msg == "newChannel(QString)") { |
1367 | QString myChannel = "QPE/Application/" + d->appName; | 1373 | QString myChannel = "QPE/Application/" + d->appName; |
1368 | QString channel; | 1374 | QString channel; |
1369 | stream >> channel; | 1375 | stream >> channel; |
1370 | if (channel == myChannel) { | 1376 | if (channel == myChannel) { |
1371 | processQCopFile(); | 1377 | processQCopFile(); |
1372 | d->sendQCopQ(); | 1378 | d->sendQCopQ(); |
1373 | } | 1379 | } |
1374 | } | 1380 | } |
1375 | 1381 | ||
1376 | 1382 | ||
1377 | #endif | 1383 | #endif |
1378 | } | 1384 | } |
1379 | 1385 | ||
1380 | 1386 | ||
1381 | 1387 | ||
1382 | 1388 | ||
1383 | 1389 | ||
1384 | /*! | 1390 | /*! |
1385 | \internal | 1391 | \internal |
1386 | */ | 1392 | */ |
1387 | bool QPEApplication::raiseAppropriateWindow() | 1393 | bool QPEApplication::raiseAppropriateWindow() |
1388 | { | 1394 | { |
1389 | bool r=FALSE; | 1395 | bool r=FALSE; |
1390 | 1396 | ||
1391 | // 1. Raise the main widget | 1397 | // 1. Raise the main widget |
1392 | QWidget *top = d->qpe_main_widget; | 1398 | QWidget *top = d->qpe_main_widget; |
1393 | if ( !top ) top = mainWidget(); | 1399 | if ( !top ) top = mainWidget(); |
1394 | 1400 | ||
1395 | if ( top && d->keep_running ) { | 1401 | if ( top && d->keep_running ) { |
1396 | if ( top->isVisible() ) | 1402 | if ( top->isVisible() ) |
1397 | r = TRUE; | 1403 | r = TRUE; |
1398 | else if (d->preloaded) { | 1404 | else if (d->preloaded) { |
1399 | // We are preloaded and not visible.. pretend we just started.. | 1405 | // We are preloaded and not visible.. pretend we just started.. |
1400 | #ifndef QT_NO_COP | 1406 | #ifndef QT_NO_COP |
1401 | QCopEnvelope e("QPE/System", "fastAppShowing(QString)"); | 1407 | QCopEnvelope e("QPE/System", "fastAppShowing(QString)"); |
1402 | e << d->appName; | 1408 | e << d->appName; |
1403 | #endif | 1409 | #endif |
1404 | } | 1410 | } |
1405 | 1411 | ||
1406 | d->show_mx(top,d->nomaximize, d->appName); | 1412 | d->show_mx(top,d->nomaximize, d->appName); |
1407 | top->raise(); | 1413 | top->raise(); |
1408 | } | 1414 | } |
1409 | 1415 | ||
1410 | QWidget *topm = activeModalWidget(); | 1416 | QWidget *topm = activeModalWidget(); |
1411 | 1417 | ||
1412 | // 2. Raise any parentless widgets (except top and topm, as they | 1418 | // 2. Raise any parentless widgets (except top and topm, as they |
1413 | // are raised before and after this loop). Order from most | 1419 | // are raised before and after this loop). Order from most |
1414 | // recently raised as deepest to least recently as top, so | 1420 | // recently raised as deepest to least recently as top, so |
1415 | // that repeated calls cycle through widgets. | 1421 | // that repeated calls cycle through widgets. |
1416 | QWidgetList *list = topLevelWidgets(); | 1422 | QWidgetList *list = topLevelWidgets(); |
1417 | if ( list ) { | 1423 | if ( list ) { |
1418 | bool foundlast = FALSE; | 1424 | bool foundlast = FALSE; |
1419 | QWidget* topsub = 0; | 1425 | QWidget* topsub = 0; |
1420 | if ( d->lastraised ) { | 1426 | if ( d->lastraised ) { |
1421 | for (QWidget* w = list->first(); w; w = list->next()) { | 1427 | for (QWidget* w = list->first(); w; w = list->next()) { |
1422 | if ( !w->parentWidget() && w != topm && w->isVisible() && !w->isDesktop() ) { | 1428 | if ( !w->parentWidget() && w != topm && w->isVisible() && !w->isDesktop() ) { |
1423 | if ( w == d->lastraised ) | 1429 | if ( w == d->lastraised ) |
1424 | foundlast = TRUE; | 1430 | foundlast = TRUE; |
1425 | if ( foundlast ) { | 1431 | if ( foundlast ) { |
1426 | w->raise(); | 1432 | w->raise(); |
1427 | topsub = w; | 1433 | topsub = w; |
1428 | } | 1434 | } |
1429 | } | 1435 | } |
1430 | } | 1436 | } |
1431 | } | 1437 | } |
1432 | for (QWidget* w = list->first(); w; w = list->next()) { | 1438 | for (QWidget* w = list->first(); w; w = list->next()) { |
1433 | if ( !w->parentWidget() && w != topm && w->isVisible() && !w->isDesktop() ) { | 1439 | if ( !w->parentWidget() && w != topm && w->isVisible() && !w->isDesktop() ) { |
1434 | if ( w == d->lastraised ) | 1440 | if ( w == d->lastraised ) |
1435 | break; | 1441 | break; |
1436 | w->raise(); | 1442 | w->raise(); |
1437 | topsub = w; | 1443 | topsub = w; |
1438 | } | 1444 | } |
1439 | } | 1445 | } |
1440 | d->lastraised = topsub; | 1446 | d->lastraised = topsub; |
1441 | delete list; | 1447 | delete list; |
1442 | } | 1448 | } |
1443 | 1449 | ||
1444 | // 3. Raise the active modal widget. | 1450 | // 3. Raise the active modal widget. |
1445 | if ( topm && topm != top ) { | 1451 | if ( topm && topm != top ) { |
1446 | topm->show(); | 1452 | topm->show(); |
1447 | topm->raise(); | 1453 | topm->raise(); |
1448 | // If we haven't already handled the fastAppShowing message | 1454 | // If we haven't already handled the fastAppShowing message |
1449 | if (!top && d->preloaded) { | 1455 | if (!top && d->preloaded) { |
1450 | #ifndef QT_NO_COP | 1456 | #ifndef QT_NO_COP |
1451 | QCopEnvelope e("QPE/System", "fastAppShowing(QString)"); | 1457 | QCopEnvelope e("QPE/System", "fastAppShowing(QString)"); |
1452 | e << d->appName; | 1458 | e << d->appName; |
1453 | #endif | 1459 | #endif |
1454 | } | 1460 | } |
1455 | r = FALSE; | 1461 | r = FALSE; |
1456 | } | 1462 | } |
1457 | 1463 | ||
1458 | return r; | 1464 | return r; |
1459 | } | 1465 | } |
1460 | 1466 | ||
1461 | 1467 | ||
1462 | void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data) | 1468 | void QPEApplication::pidMessage( const QCString& msg, const QByteArray& data) |
1463 | { | 1469 | { |
1464 | #ifdef Q_WS_QWS | 1470 | #ifdef Q_WS_QWS |
1465 | 1471 | ||
1466 | if ( msg == "quit()" ) { | 1472 | if ( msg == "quit()" ) { |
1467 | tryQuit(); | 1473 | tryQuit(); |
1468 | } | 1474 | } |
1469 | else if ( msg == "quitIfInvisible()" ) { | 1475 | else if ( msg == "quitIfInvisible()" ) { |
1470 | if ( d->qpe_main_widget && !d->qpe_main_widget->isVisible() ) | 1476 | if ( d->qpe_main_widget && !d->qpe_main_widget->isVisible() ) |
1471 | quit(); | 1477 | quit(); |
1472 | } | 1478 | } |
1473 | else if ( msg == "close()" ) { | 1479 | else if ( msg == "close()" ) { |
1474 | hideOrQuit(); | 1480 | hideOrQuit(); |
1475 | } | 1481 | } |
1476 | else if ( msg == "disablePreload()" ) { | 1482 | else if ( msg == "disablePreload()" ) { |
1477 | d->preloaded = FALSE; | 1483 | d->preloaded = FALSE; |
1478 | d->keep_running = TRUE; | 1484 | d->keep_running = TRUE; |
1479 | /* so that quit will quit */ | 1485 | /* so that quit will quit */ |
1480 | } | 1486 | } |
1481 | else if ( msg == "enablePreload()" ) { | 1487 | else if ( msg == "enablePreload()" ) { |
1482 | if (d->qpe_main_widget) | 1488 | if (d->qpe_main_widget) |
1483 | d->preloaded = TRUE; | 1489 | d->preloaded = TRUE; |
1484 | d->keep_running = TRUE; | 1490 | d->keep_running = TRUE; |
1485 | /* so next quit won't quit */ | 1491 | /* so next quit won't quit */ |
1486 | } | 1492 | } |
1487 | else if ( msg == "raise()" ) { | 1493 | else if ( msg == "raise()" ) { |
1488 | d->keep_running = TRUE; | 1494 | d->keep_running = TRUE; |
1489 | d->notbusysent = FALSE; | 1495 | d->notbusysent = FALSE; |
1490 | raiseAppropriateWindow(); | 1496 | raiseAppropriateWindow(); |
1491 | // Tell the system we're still chugging along... | 1497 | // Tell the system we're still chugging along... |
1492 | QCopEnvelope e("QPE/System", "appRaised(QString)"); | 1498 | QCopEnvelope e("QPE/System", "appRaised(QString)"); |
1493 | e << d->appName; | 1499 | e << d->appName; |
1494 | } | 1500 | } |
1495 | else if ( msg == "flush()" ) { | 1501 | else if ( msg == "flush()" ) { |
1496 | emit flush(); | 1502 | emit flush(); |
1497 | // we need to tell the desktop | 1503 | // we need to tell the desktop |
1498 | QCopEnvelope e( "QPE/Desktop", "flushDone(QString)" ); | 1504 | QCopEnvelope e( "QPE/Desktop", "flushDone(QString)" ); |
1499 | e << d->appName; | 1505 | e << d->appName; |
1500 | } | 1506 | } |
1501 | else if ( msg == "reload()" ) { | 1507 | else if ( msg == "reload()" ) { |
1502 | emit reload(); | 1508 | emit reload(); |
1503 | } | 1509 | } |
1504 | else if ( msg == "setDocument(QString)" ) { | 1510 | else if ( msg == "setDocument(QString)" ) { |
1505 | d->keep_running = TRUE; | 1511 | d->keep_running = TRUE; |
1506 | QDataStream stream( data, IO_ReadOnly ); | 1512 | QDataStream stream( data, IO_ReadOnly ); |
1507 | QString doc; | 1513 | QString doc; |
1508 | stream >> doc; | 1514 | stream >> doc; |
1509 | QWidget *mw = mainWidget(); | 1515 | QWidget *mw = mainWidget(); |
1510 | if ( !mw ) | 1516 | if ( !mw ) |
1511 | mw = d->qpe_main_widget; | 1517 | mw = d->qpe_main_widget; |
1512 | if ( mw ) | 1518 | if ( mw ) |
1513 | Global::setDocument( mw, doc ); | 1519 | Global::setDocument( mw, doc ); |
1514 | 1520 | ||
1515 | } else if ( msg == "QPEProcessQCop()" ) { | 1521 | } else if ( msg == "QPEProcessQCop()" ) { |
1516 | processQCopFile(); | 1522 | processQCopFile(); |
1517 | d->sendQCopQ(); | 1523 | d->sendQCopQ(); |
1518 | }else | 1524 | }else |
1519 | { | 1525 | { |
1520 | bool p = d->keep_running; | 1526 | bool p = d->keep_running; |
1521 | d->keep_running = FALSE; | 1527 | d->keep_running = FALSE; |
1522 | emit appMessage( msg, data); | 1528 | emit appMessage( msg, data); |
1523 | if ( d->keep_running ) { | 1529 | if ( d->keep_running ) { |
1524 | d->notbusysent = FALSE; | 1530 | d->notbusysent = FALSE; |
1525 | raiseAppropriateWindow(); | 1531 | raiseAppropriateWindow(); |
1526 | if ( !p ) { | 1532 | if ( !p ) { |
1527 | // Tell the system we're still chugging along... | 1533 | // Tell the system we're still chugging along... |
1528 | #ifndef QT_NO_COP | 1534 | #ifndef QT_NO_COP |
1529 | QCopEnvelope e("QPE/System", "appRaised(QString)"); | 1535 | QCopEnvelope e("QPE/System", "appRaised(QString)"); |
1530 | e << d->appName; | 1536 | e << d->appName; |
1531 | #endif | 1537 | #endif |
1532 | } | 1538 | } |
1533 | } | 1539 | } |
1534 | if ( p ) | 1540 | if ( p ) |
1535 | d->keep_running = p; | 1541 | d->keep_running = p; |
1536 | } | 1542 | } |
1537 | #endif | 1543 | #endif |
1538 | } | 1544 | } |
1539 | 1545 | ||
1540 | 1546 | ||
1541 | /*! | 1547 | /*! |
1542 | Sets widget \a mw as the mainWidget() and shows it. For small windows, | 1548 | Sets widget \a mw as the mainWidget() and shows it. For small windows, |
1543 | consider passing TRUE for \a nomaximize rather than the default FALSE. | 1549 | consider passing TRUE for \a nomaximize rather than the default FALSE. |
1544 | 1550 | ||
1545 | \sa showMainDocumentWidget() | 1551 | \sa showMainDocumentWidget() |
1546 | */ | 1552 | */ |
1547 | void QPEApplication::showMainWidget( QWidget* mw, bool nomaximize ) | 1553 | void QPEApplication::showMainWidget( QWidget* mw, bool nomaximize ) |
1548 | { | 1554 | { |
1549 | d->show(mw, nomaximize ); | 1555 | d->show(mw, nomaximize ); |
1550 | } | 1556 | } |
1551 | 1557 | ||
1552 | /*! | 1558 | /*! |
1553 | Sets widget \a mw as the mainWidget() and shows it. For small windows, | 1559 | Sets widget \a mw as the mainWidget() and shows it. For small windows, |
1554 | consider passing TRUE for \a nomaximize rather than the default FALSE. | 1560 | consider passing TRUE for \a nomaximize rather than the default FALSE. |
1555 | 1561 | ||
1556 | This calls designates the application as | 1562 | This calls designates the application as |
1557 | a \link docwidget.html document-oriented\endlink application. | 1563 | a \link docwidget.html document-oriented\endlink application. |
1558 | 1564 | ||
1559 | The \a mw widget \e must have this slot: setDocument(const QString&). | 1565 | The \a mw widget \e must have this slot: setDocument(const QString&). |
1560 | 1566 | ||
1561 | \sa showMainWidget() | 1567 | \sa showMainWidget() |
1562 | */ | 1568 | */ |
1563 | void QPEApplication::showMainDocumentWidget( QWidget* mw, bool nomaximize ) | 1569 | void QPEApplication::showMainDocumentWidget( QWidget* mw, bool nomaximize ) |
1564 | { | 1570 | { |
1565 | if ( mw && argc() == 2 ) | 1571 | if ( mw && argc() == 2 ) |
1566 | Global::setDocument( mw, QString::fromUtf8(argv()[1]) ); | 1572 | Global::setDocument( mw, QString::fromUtf8(argv()[1]) ); |
1567 | 1573 | ||
1568 | 1574 | ||
1569 | d->show(mw, nomaximize ); | 1575 | d->show(mw, nomaximize ); |
1570 | } | 1576 | } |
1571 | 1577 | ||
1572 | 1578 | ||
1573 | /*! | 1579 | /*! |
1574 | If an application is started via a \link qcop.html QCop\endlink | 1580 | If an application is started via a \link qcop.html QCop\endlink |
1575 | message, the application will process the \link qcop.html | 1581 | message, the application will process the \link qcop.html |
1576 | QCop\endlink message and then quit. If the application calls this | 1582 | QCop\endlink message and then quit. If the application calls this |
1577 | function while processing a \link qcop.html QCop\endlink message, | 1583 | function while processing a \link qcop.html QCop\endlink message, |
1578 | after processing its outstanding \link qcop.html QCop\endlink | 1584 | after processing its outstanding \link qcop.html QCop\endlink |
1579 | messages the application will start 'properly' and show itself. | 1585 | messages the application will start 'properly' and show itself. |
1580 | 1586 | ||
1581 | \sa keepRunning() | 1587 | \sa keepRunning() |
1582 | */ | 1588 | */ |
1583 | void QPEApplication::setKeepRunning() | 1589 | void QPEApplication::setKeepRunning() |
1584 | { | 1590 | { |
1585 | if ( qApp && qApp->inherits( "QPEApplication" ) ) { | 1591 | if ( qApp && qApp->inherits( "QPEApplication" ) ) { |
1586 | QPEApplication * qpeApp = ( QPEApplication* ) qApp; | 1592 | QPEApplication * qpeApp = ( QPEApplication* ) qApp; |
1587 | qpeApp->d->keep_running = TRUE; | 1593 | qpeApp->d->keep_running = TRUE; |
1588 | } | 1594 | } |
1589 | } | 1595 | } |
1590 | 1596 | ||
1591 | /*! | 1597 | /*! |
1592 | Returns TRUE if the application will quit after processing the | 1598 | Returns TRUE if the application will quit after processing the |
1593 | current list of qcop messages; otherwise returns FALSE. | 1599 | current list of qcop messages; otherwise returns FALSE. |
1594 | 1600 | ||
1595 | \sa setKeepRunning() | 1601 | \sa setKeepRunning() |
1596 | */ | 1602 | */ |
1597 | bool QPEApplication::keepRunning() const | 1603 | bool QPEApplication::keepRunning() const |
1598 | { | 1604 | { |
1599 | return d->keep_running; | 1605 | return d->keep_running; |
1600 | } | 1606 | } |
1601 | 1607 | ||
1602 | /*! | 1608 | /*! |
1603 | \internal | 1609 | \internal |
1604 | */ | 1610 | */ |
1605 | void QPEApplication::internalSetStyle( const QString &style ) | 1611 | void QPEApplication::internalSetStyle( const QString &style ) |
1606 | { | 1612 | { |
1607 | #if QT_VERSION >= 300 | 1613 | #if QT_VERSION >= 300 |
1608 | if ( style == "QPE" ) { | 1614 | if ( style == "QPE" ) { |
1609 | setStyle( new QPEStyle ); | 1615 | setStyle( new QPEStyle ); |
1610 | } | 1616 | } |
1611 | else { | 1617 | else { |
1612 | QStyle *s = QStyleFactory::create( style ); | 1618 | QStyle *s = QStyleFactory::create( style ); |
1613 | if ( s ) | 1619 | if ( s ) |
1614 | setStyle( s ); | 1620 | setStyle( s ); |
1615 | } | 1621 | } |
1616 | #else | 1622 | #else |
1617 | if ( style == "Windows" ) { | 1623 | if ( style == "Windows" ) { |
1618 | setStyle( new QWindowsStyle ); | 1624 | setStyle( new QWindowsStyle ); |
1619 | } | 1625 | } |
1620 | else if ( style == "QPE" ) { | 1626 | else if ( style == "QPE" ) { |
1621 | setStyle( new QPEStyle ); | 1627 | setStyle( new QPEStyle ); |
1622 | } | 1628 | } |
1623 | else if ( style == "Light" ) { | 1629 | else if ( style == "Light" ) { |
1624 | setStyle( new LightStyle ); | 1630 | setStyle( new LightStyle ); |
1625 | } | 1631 | } |
1626 | #ifndef QT_NO_STYLE_PLATINUM | 1632 | #ifndef QT_NO_STYLE_PLATINUM |
1627 | else if ( style == "Platinum" ) { | 1633 | else if ( style == "Platinum" ) { |
1628 | setStyle( new QPlatinumStyle ); | 1634 | setStyle( new QPlatinumStyle ); |
1629 | } | 1635 | } |
1630 | #endif | 1636 | #endif |
1631 | #ifndef QT_NO_STYLE_MOTIF | 1637 | #ifndef QT_NO_STYLE_MOTIF |
1632 | else if ( style == "Motif" ) { | 1638 | else if ( style == "Motif" ) { |
1633 | setStyle( new QMotifStyle ); | 1639 | setStyle( new QMotifStyle ); |
1634 | } | 1640 | } |
1635 | #endif | 1641 | #endif |
1636 | #ifndef QT_NO_STYLE_MOTIFPLUS | 1642 | #ifndef QT_NO_STYLE_MOTIFPLUS |
1637 | else if ( style == "MotifPlus" ) { | 1643 | else if ( style == "MotifPlus" ) { |
1638 | setStyle( new QMotifPlusStyle ); | 1644 | setStyle( new QMotifPlusStyle ); |
1639 | } | 1645 | } |
1640 | #endif | 1646 | #endif |
1641 | 1647 | ||
1642 | else { | 1648 | else { |
1643 | QStyle *sty = 0; | 1649 | QStyle *sty = 0; |
1644 | QString path = QPEApplication::qpeDir ( ) + "/plugins/styles/"; | 1650 | QString path = QPEApplication::qpeDir ( ) + "/plugins/styles/"; |
1645 | 1651 | ||
1646 | if ( style. find ( ".so" ) > 0 ) | 1652 | if ( style. find ( ".so" ) > 0 ) |
1647 | path += style; | 1653 | path += style; |
1648 | else | 1654 | else |
1649 | path = path + "lib" + style. lower ( ) + ".so"; // compatibility | 1655 | path = path + "lib" + style. lower ( ) + ".so"; // compatibility |
1650 | 1656 | ||
1651 | static QLibrary *lastlib = 0; | 1657 | static QLibrary *lastlib = 0; |
1652 | static StyleInterface *lastiface = 0; | 1658 | static StyleInterface *lastiface = 0; |
1653 | 1659 | ||
1654 | QLibrary *lib = new QLibrary ( path ); | 1660 | QLibrary *lib = new QLibrary ( path ); |
1655 | StyleInterface *iface = 0; | 1661 | StyleInterface *iface = 0; |
1656 | 1662 | ||
1657 | if (( lib-> queryInterface ( IID_Style, ( QUnknownInterface ** ) &iface ) == QS_OK ) && iface ) | 1663 | if (( lib-> queryInterface ( IID_Style, ( QUnknownInterface ** ) &iface ) == QS_OK ) && iface ) |
1658 | sty = iface-> style ( ); | 1664 | sty = iface-> style ( ); |
1659 | 1665 | ||
1660 | if ( sty ) { | 1666 | if ( sty ) { |
1661 | setStyle ( sty ); | 1667 | setStyle ( sty ); |
1662 | 1668 | ||
1663 | if ( lastiface ) | 1669 | if ( lastiface ) |
1664 | lastiface-> release ( ); | 1670 | lastiface-> release ( ); |
1665 | lastiface = iface; | 1671 | lastiface = iface; |
1666 | 1672 | ||
1667 | if ( lastlib ) { | 1673 | if ( lastlib ) { |
1668 | lastlib-> unload ( ); | 1674 | lastlib-> unload ( ); |
1669 | delete lastlib; | 1675 | delete lastlib; |
1670 | } | 1676 | } |
1671 | lastlib = lib; | 1677 | lastlib = lib; |
1672 | } | 1678 | } |
1673 | else { | 1679 | else { |
1674 | if ( iface ) | 1680 | if ( iface ) |
1675 | iface-> release ( ); | 1681 | iface-> release ( ); |
1676 | delete lib; | 1682 | delete lib; |
1677 | 1683 | ||
1678 | setStyle ( new LightStyle ( )); | 1684 | setStyle ( new LightStyle ( )); |
1679 | } | 1685 | } |
1680 | } | 1686 | } |
1681 | #endif | 1687 | #endif |
1682 | } | 1688 | } |
1683 | 1689 | ||
1684 | /*! | 1690 | /*! |
1685 | \internal | 1691 | \internal |
1686 | */ | 1692 | */ |
1687 | void QPEApplication::prepareForTermination( bool willrestart ) | 1693 | void QPEApplication::prepareForTermination( bool willrestart ) |
1688 | { | 1694 | { |
1689 | if ( willrestart ) { | 1695 | if ( willrestart ) { |
1690 | // Draw a big wait icon, the image can be altered in later revisions | 1696 | // Draw a big wait icon, the image can be altered in later revisions |
1691 | // QWidget *d = QApplication::desktop(); | 1697 | // QWidget *d = QApplication::desktop(); |
1692 | QImage img = Resource::loadImage( "launcher/new_wait" ); | 1698 | QImage img = Resource::loadImage( "launcher/new_wait" ); |
1693 | QPixmap pix; | 1699 | QPixmap pix; |
1694 | pix.convertFromImage( img.smoothScale( 1 * img.width(), 1 * img.height() ) ); | 1700 | pix.convertFromImage( img.smoothScale( 1 * img.width(), 1 * img.height() ) ); |
1695 | QLabel *lblWait = new QLabel( 0, "wait hack!", QWidget::WStyle_Customize | | 1701 | QLabel *lblWait = new QLabel( 0, "wait hack!", QWidget::WStyle_Customize | |
1696 | QWidget::WStyle_NoBorder | QWidget::WStyle_Tool ); | 1702 | QWidget::WStyle_NoBorder | QWidget::WStyle_Tool ); |
1697 | lblWait->setPixmap( pix ); | 1703 | lblWait->setPixmap( pix ); |
1698 | lblWait->setAlignment( QWidget::AlignCenter ); | 1704 | lblWait->setAlignment( QWidget::AlignCenter ); |
1699 | lblWait->show(); | 1705 | lblWait->show(); |
1700 | lblWait->showMaximized(); | 1706 | lblWait->showMaximized(); |
1701 | } | 1707 | } |
1702 | #ifndef SINGLE_APP | 1708 | #ifndef SINGLE_APP |
1703 | { QCopEnvelope envelope( "QPE/System", "forceQuit()" ); | 1709 | { QCopEnvelope envelope( "QPE/System", "forceQuit()" ); |
1704 | } | 1710 | } |
1705 | processEvents(); // ensure the message goes out. | 1711 | processEvents(); // ensure the message goes out. |
1706 | sleep( 1 ); // You have 1 second to comply. | 1712 | sleep( 1 ); // You have 1 second to comply. |
1707 | #endif | 1713 | #endif |
1708 | } | 1714 | } |
1709 | 1715 | ||
1710 | /*! | 1716 | /*! |
1711 | \internal | 1717 | \internal |
1712 | */ | 1718 | */ |
1713 | void QPEApplication::shutdown() | 1719 | void QPEApplication::shutdown() |
1714 | { | 1720 | { |
1715 | // Implement in server's QPEApplication subclass | 1721 | // Implement in server's QPEApplication subclass |
1716 | } | 1722 | } |
1717 | 1723 | ||
1718 | /*! | 1724 | /*! |
1719 | \internal | 1725 | \internal |
1720 | */ | 1726 | */ |
1721 | void QPEApplication::restart() | 1727 | void QPEApplication::restart() |
1722 | { | 1728 | { |
1723 | // Implement in server's QPEApplication subclass | 1729 | // Implement in server's QPEApplication subclass |
1724 | } | 1730 | } |
1725 | 1731 | ||
1726 | static QPtrDict<void>* stylusDict = 0; | 1732 | static QPtrDict<void>* stylusDict = 0; |
1727 | static void createDict() | 1733 | static void createDict() |
1728 | { | 1734 | { |
1729 | if ( !stylusDict ) | 1735 | if ( !stylusDict ) |
1730 | stylusDict = new QPtrDict<void>; | 1736 | stylusDict = new QPtrDict<void>; |
1731 | } | 1737 | } |
1732 | 1738 | ||
1733 | /*! | 1739 | /*! |
1734 | Returns the current StylusMode for widget \a w. | 1740 | Returns the current StylusMode for widget \a w. |
1735 | 1741 | ||
1736 | \sa setStylusOperation() StylusMode | 1742 | \sa setStylusOperation() StylusMode |
1737 | */ | 1743 | */ |
1738 | QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w ) | 1744 | QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w ) |
1739 | { | 1745 | { |
1740 | if ( stylusDict ) | 1746 | if ( stylusDict ) |
1741 | return ( StylusMode ) ( int ) stylusDict->find( w ); | 1747 | return ( StylusMode ) ( int ) stylusDict->find( w ); |
1742 | return LeftOnly; | 1748 | return LeftOnly; |
1743 | } | 1749 | } |
1744 | 1750 | ||
1745 | /*! | 1751 | /*! |
1746 | \enum QPEApplication::StylusMode | 1752 | \enum QPEApplication::StylusMode |
1747 | 1753 | ||
1748 | \value LeftOnly the stylus only generates LeftButton | 1754 | \value LeftOnly the stylus only generates LeftButton |
1749 | events (the default). | 1755 | events (the default). |
1750 | \value RightOnHold the stylus generates RightButton events | 1756 | \value RightOnHold the stylus generates RightButton events |
1751 | if the user uses the press-and-hold gesture. | 1757 | if the user uses the press-and-hold gesture. |
1752 | 1758 | ||
1753 | \sa setStylusOperation() stylusOperation() | 1759 | \sa setStylusOperation() stylusOperation() |
1754 | */ | 1760 | */ |
1755 | 1761 | ||
1756 | /*! | 1762 | /*! |
1757 | Causes widget \a w to receive mouse events according to the stylus | 1763 | Causes widget \a w to receive mouse events according to the stylus |
1758 | \a mode. | 1764 | \a mode. |
1759 | 1765 | ||
1760 | \sa stylusOperation() StylusMode | 1766 | \sa stylusOperation() StylusMode |
1761 | */ | 1767 | */ |
1762 | void QPEApplication::setStylusOperation( QWidget * w, StylusMode mode ) | 1768 | void QPEApplication::setStylusOperation( QWidget * w, StylusMode mode ) |
1763 | { | 1769 | { |
1764 | createDict(); | 1770 | createDict(); |
1765 | if ( mode == LeftOnly ) { | 1771 | if ( mode == LeftOnly ) { |
1766 | stylusDict->remove | 1772 | stylusDict->remove |
1767 | ( w ); | 1773 | ( w ); |
1768 | w->removeEventFilter( qApp ); | 1774 | w->removeEventFilter( qApp ); |
1769 | } | 1775 | } |
1770 | else { | 1776 | else { |
1771 | stylusDict->insert( w, ( void* ) mode ); | 1777 | stylusDict->insert( w, ( void* ) mode ); |
1772 | connect( w, SIGNAL( destroyed() ), qApp, SLOT( removeSenderFromStylusDict() ) ); | 1778 | connect( w, SIGNAL( destroyed() ), qApp, SLOT( removeSenderFromStylusDict() ) ); |
1773 | w->installEventFilter( qApp ); | 1779 | w->installEventFilter( qApp ); |
1774 | } | 1780 | } |
1775 | } | 1781 | } |
1776 | 1782 | ||
1777 | 1783 | ||
1778 | /*! | 1784 | /*! |
1779 | \reimp | 1785 | \reimp |
1780 | */ | 1786 | */ |
1781 | bool QPEApplication::eventFilter( QObject *o, QEvent *e ) | 1787 | bool QPEApplication::eventFilter( QObject *o, QEvent *e ) |
1782 | { | 1788 | { |
1783 | if ( !o->isWidgetType() ) | 1789 | if ( !o->isWidgetType() ) |
1784 | return FALSE; | 1790 | return FALSE; |
1785 | 1791 | ||
1786 | if ( stylusDict && e->type() >= QEvent::MouseButtonPress && e->type() <= QEvent::MouseMove ) { | 1792 | if ( stylusDict && e->type() >= QEvent::MouseButtonPress && e->type() <= QEvent::MouseMove ) { |
1787 | QMouseEvent * me = ( QMouseEvent* ) e; | 1793 | QMouseEvent * me = ( QMouseEvent* ) e; |
1788 | StylusMode mode = (StylusMode)(int)stylusDict->find(o); | 1794 | StylusMode mode = (StylusMode)(int)stylusDict->find(o); |
1789 | switch (mode) { | 1795 | switch (mode) { |
1790 | case RightOnHold: | 1796 | case RightOnHold: |
1791 | switch ( me->type() ) { | 1797 | switch ( me->type() ) { |
1792 | case QEvent::MouseButtonPress: | 1798 | case QEvent::MouseButtonPress: |
1793 | if ( me->button() == LeftButton ) { | 1799 | if ( me->button() == LeftButton ) { |
1794 | if (!d->presstimer ) | 1800 | if (!d->presstimer ) |
1795 | d->presstimer = startTimer(500); // #### pref. | 1801 | d->presstimer = startTimer(500); // #### pref. |
1796 | d->presswidget = (QWidget*)o; | 1802 | d->presswidget = (QWidget*)o; |
1797 | d->presspos = me->pos(); | 1803 | d->presspos = me->pos(); |
1798 | d->rightpressed = FALSE; | 1804 | d->rightpressed = FALSE; |
1799 | } | 1805 | } |
1800 | break; | 1806 | break; |
1801 | case QEvent::MouseMove: | 1807 | case QEvent::MouseMove: |
1802 | if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) { | 1808 | if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) { |
1803 | killTimer(d->presstimer); | 1809 | killTimer(d->presstimer); |
1804 | d->presstimer = 0; | 1810 | d->presstimer = 0; |
1805 | } | 1811 | } |
1806 | break; | 1812 | break; |
1807 | case QEvent::MouseButtonRelease: | 1813 | case QEvent::MouseButtonRelease: |
1808 | if ( me->button() == LeftButton ) { | 1814 | if ( me->button() == LeftButton ) { |
1809 | if ( d->presstimer ) { | 1815 | if ( d->presstimer ) { |
1810 | killTimer(d->presstimer); | 1816 | killTimer(d->presstimer); |
1811 | d->presstimer = 0; | 1817 | d->presstimer = 0; |
1812 | } | 1818 | } |
1813 | if ( d->rightpressed && d->presswidget ) { | 1819 | if ( d->rightpressed && d->presswidget ) { |
1814 | // Right released | 1820 | // Right released |
1815 | postEvent( d->presswidget, | 1821 | postEvent( d->presswidget, |
1816 | new QMouseEvent( QEvent::MouseButtonRelease, me->pos(), | 1822 | new QMouseEvent( QEvent::MouseButtonRelease, me->pos(), |
1817 | RightButton, LeftButton + RightButton ) ); | 1823 | RightButton, LeftButton + RightButton ) ); |
1818 | // Left released, off-widget | 1824 | // Left released, off-widget |
1819 | postEvent( d->presswidget, | 1825 | postEvent( d->presswidget, |
1820 | new QMouseEvent( QEvent::MouseMove, QPoint( -1, -1), | 1826 | new QMouseEvent( QEvent::MouseMove, QPoint( -1, -1), |
1821 | LeftButton, LeftButton ) ); | 1827 | LeftButton, LeftButton ) ); |
1822 | postEvent( d->presswidget, | 1828 | postEvent( d->presswidget, |
1823 | new QMouseEvent( QEvent::MouseButtonRelease, QPoint( -1, -1), | 1829 | new QMouseEvent( QEvent::MouseButtonRelease, QPoint( -1, -1), |
1824 | LeftButton, LeftButton ) ); | 1830 | LeftButton, LeftButton ) ); |
1825 | d->rightpressed = FALSE; | 1831 | d->rightpressed = FALSE; |
1826 | return TRUE; // don't send the real Left release | 1832 | return TRUE; // don't send the real Left release |
1827 | } | 1833 | } |
1828 | } | 1834 | } |
1829 | break; | 1835 | break; |
1830 | default: | 1836 | default: |
1831 | break; | 1837 | break; |
1832 | } | 1838 | } |
1833 | break; | 1839 | break; |
1834 | default: | 1840 | default: |
1835 | ; | 1841 | ; |
1836 | } | 1842 | } |
1837 | } | 1843 | } |
1838 | else if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { | 1844 | else if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { |
1839 | QKeyEvent *ke = (QKeyEvent *)e; | 1845 | QKeyEvent *ke = (QKeyEvent *)e; |
1840 | if ( ke->key() == Key_Enter ) { | 1846 | if ( ke->key() == Key_Enter ) { |
1841 | if ( o->isA( "QRadioButton" ) || o->isA( "QCheckBox" ) ) { | 1847 | if ( o->isA( "QRadioButton" ) || o->isA( "QCheckBox" ) ) { |
1842 | postEvent( o, new QKeyEvent( e->type(), Key_Space, ' ', | 1848 | postEvent( o, new QKeyEvent( e->type(), Key_Space, ' ', |
1843 | ke->state(), " ", ke->isAutoRepeat(), ke->count() ) ); | 1849 | ke->state(), " ", ke->isAutoRepeat(), ke->count() ) ); |
1844 | return TRUE; | 1850 | return TRUE; |
1845 | } | 1851 | } |
1846 | } | 1852 | } |
1847 | } | 1853 | } |
1848 | return FALSE; | 1854 | return FALSE; |
1849 | } | 1855 | } |
1850 | 1856 | ||
1851 | /*! | 1857 | /*! |
1852 | \reimp | 1858 | \reimp |
1853 | */ | 1859 | */ |
1854 | void QPEApplication::timerEvent( QTimerEvent *e ) | 1860 | void QPEApplication::timerEvent( QTimerEvent *e ) |
1855 | { | 1861 | { |
1856 | if ( e->timerId() == d->presstimer && d->presswidget ) { | 1862 | if ( e->timerId() == d->presstimer && d->presswidget ) { |
1857 | // Right pressed | 1863 | // Right pressed |
1858 | postEvent( d->presswidget, | 1864 | postEvent( d->presswidget, |
1859 | new QMouseEvent( QEvent::MouseButtonPress, d->presspos, | 1865 | new QMouseEvent( QEvent::MouseButtonPress, d->presspos, |
1860 | RightButton, LeftButton ) ); | 1866 | RightButton, LeftButton ) ); |
1861 | killTimer( d->presstimer ); | 1867 | killTimer( d->presstimer ); |
1862 | d->presstimer = 0; | 1868 | d->presstimer = 0; |
1863 | d->rightpressed = TRUE; | 1869 | d->rightpressed = TRUE; |
1864 | } | 1870 | } |
1865 | } | 1871 | } |
1866 | 1872 | ||
1867 | void QPEApplication::removeSenderFromStylusDict() | 1873 | void QPEApplication::removeSenderFromStylusDict() |
1868 | { | 1874 | { |
1869 | stylusDict->remove | 1875 | stylusDict->remove |
1870 | ( ( void* ) sender() ); | 1876 | ( ( void* ) sender() ); |
1871 | if ( d->presswidget == sender() ) | 1877 | if ( d->presswidget == sender() ) |
1872 | d->presswidget = 0; | 1878 | d->presswidget = 0; |
1873 | } | 1879 | } |
1874 | 1880 | ||
1875 | /*! | 1881 | /*! |
1876 | \internal | 1882 | \internal |
1877 | */ | 1883 | */ |
1878 | bool QPEApplication::keyboardGrabbed() const | 1884 | bool QPEApplication::keyboardGrabbed() const |
1879 | { | 1885 | { |
1880 | return d->kbgrabbed; | 1886 | return d->kbgrabbed; |
1881 | } | 1887 | } |
1882 | 1888 | ||
1883 | 1889 | ||
1884 | /*! | 1890 | /*! |
1885 | Reverses the effect of grabKeyboard(). This is called automatically | 1891 | Reverses the effect of grabKeyboard(). This is called automatically |
1886 | on program exit. | 1892 | on program exit. |
1887 | */ | 1893 | */ |
1888 | void QPEApplication::ungrabKeyboard() | 1894 | void QPEApplication::ungrabKeyboard() |
1889 | { | 1895 | { |
1890 | ((QPEApplication *) qApp )-> d-> kbgrabbed = false; | 1896 | ((QPEApplication *) qApp )-> d-> kbgrabbed = false; |
1891 | } | 1897 | } |
1892 | 1898 | ||
1893 | /*! | 1899 | /*! |
1894 | Grabs the physical keyboard keys, e.g. the application's launching | 1900 | Grabs the physical keyboard keys, e.g. the application's launching |
1895 | keys. Instead of launching applications when these keys are pressed | 1901 | keys. Instead of launching applications when these keys are pressed |
1896 | the signals emitted are sent to this application instead. Some games | 1902 | the signals emitted are sent to this application instead. Some games |
1897 | programs take over the launch keys in this way to make interaction | 1903 | programs take over the launch keys in this way to make interaction |
1898 | easier. | 1904 | easier. |
1899 | 1905 | ||
1900 | \sa ungrabKeyboard() | 1906 | \sa ungrabKeyboard() |
1901 | */ | 1907 | */ |
1902 | void QPEApplication::grabKeyboard() | 1908 | void QPEApplication::grabKeyboard() |
1903 | { | 1909 | { |
1904 | ((QPEApplication *) qApp )-> d-> kbgrabbed = true; | 1910 | ((QPEApplication *) qApp )-> d-> kbgrabbed = true; |
1905 | } | 1911 | } |
1906 | 1912 | ||
1907 | /*! | 1913 | /*! |
1908 | \reimp | 1914 | \reimp |
1909 | */ | 1915 | */ |
1910 | int QPEApplication::exec() | 1916 | int QPEApplication::exec() |
1911 | { | 1917 | { |
1912 | d->qcopQok = true; | 1918 | d->qcopQok = true; |
1913 | #ifndef QT_NO_COP | 1919 | #ifndef QT_NO_COP |
1914 | d->sendQCopQ(); | 1920 | d->sendQCopQ(); |
1915 | if ( !d->keep_running ) | 1921 | if ( !d->keep_running ) |
1916 | processEvents(); // we may have received QCop messages in the meantime. | 1922 | processEvents(); // we may have received QCop messages in the meantime. |
1917 | #endif | 1923 | #endif |
1918 | 1924 | ||
1919 | if ( d->keep_running ) | 1925 | if ( d->keep_running ) |
1920 | //|| d->qpe_main_widget && d->qpe_main_widget->isVisible() ) | 1926 | //|| d->qpe_main_widget && d->qpe_main_widget->isVisible() ) |
1921 | return QApplication::exec(); | 1927 | return QApplication::exec(); |
1922 | 1928 | ||
1923 | #ifndef QT_NO_COP | 1929 | #ifndef QT_NO_COP |
1924 | 1930 | ||
1925 | { | 1931 | { |
1926 | QCopEnvelope e( "QPE/System", "closing(QString)" ); | 1932 | QCopEnvelope e( "QPE/System", "closing(QString)" ); |
1927 | e << d->appName; | 1933 | e << d->appName; |
1928 | } | 1934 | } |
1929 | #endif | 1935 | #endif |
1930 | processEvents(); | 1936 | processEvents(); |
1931 | return 0; | 1937 | return 0; |
1932 | } | 1938 | } |
1933 | 1939 | ||
1934 | /*! | 1940 | /*! |
1935 | \internal | 1941 | \internal |
1936 | External request for application to quit. Quits if possible without | 1942 | External request for application to quit. Quits if possible without |
1937 | loosing state. | 1943 | loosing state. |
1938 | */ | 1944 | */ |
1939 | void QPEApplication::tryQuit() | 1945 | void QPEApplication::tryQuit() |
1940 | { | 1946 | { |
1941 | if ( activeModalWidget() || strcmp( argv() [ 0 ], "embeddedkonsole" ) == 0 ) | 1947 | if ( activeModalWidget() || strcmp( argv() [ 0 ], "embeddedkonsole" ) == 0 ) |
1942 | return ; // Inside modal loop or konsole. Too hard to save state. | 1948 | return ; // Inside modal loop or konsole. Too hard to save state. |
1943 | #ifndef QT_NO_COP | 1949 | #ifndef QT_NO_COP |
1944 | 1950 | ||
1945 | { | 1951 | { |
1946 | QCopEnvelope e( "QPE/System", "closing(QString)" ); | 1952 | QCopEnvelope e( "QPE/System", "closing(QString)" ); |
1947 | e << d->appName; | 1953 | e << d->appName; |
1948 | } | 1954 | } |
1949 | #endif | 1955 | #endif |
1950 | processEvents(); | 1956 | processEvents(); |
1951 | 1957 | ||
1952 | quit(); | 1958 | quit(); |
1953 | } | 1959 | } |
1954 | 1960 | ||
1955 | /*! | 1961 | /*! |
1956 | \internal | 1962 | \internal |
1957 | */ | 1963 | */ |
1958 | void QPEApplication::installTranslation( const QString& baseName ) { | 1964 | void QPEApplication::installTranslation( const QString& baseName ) { |
1959 | QTranslator* trans = new QTranslator(this); | 1965 | QTranslator* trans = new QTranslator(this); |
1960 | QString tfn = qpeDir() + "/i18n/"+baseName; | 1966 | QString tfn = qpeDir() + "/i18n/"+baseName; |
1961 | if ( trans->load( tfn ) ) | 1967 | if ( trans->load( tfn ) ) |
1962 | installTranslator( trans ); | 1968 | installTranslator( trans ); |
1963 | else | 1969 | else |
1964 | delete trans; | 1970 | delete trans; |
1965 | } | 1971 | } |
1966 | 1972 | ||
1967 | /*! | 1973 | /*! |
1968 | \internal | 1974 | \internal |
1969 | User initiated quit. Makes the window 'Go Away'. If preloaded this means | 1975 | User initiated quit. Makes the window 'Go Away'. If preloaded this means |
1970 | hiding the window. If not it means quitting the application. | 1976 | hiding the window. If not it means quitting the application. |
1971 | As this is user initiated we don't need to check state. | 1977 | As this is user initiated we don't need to check state. |
1972 | */ | 1978 | */ |
1973 | void QPEApplication::hideOrQuit() | 1979 | void QPEApplication::hideOrQuit() |
1974 | { | 1980 | { |
1975 | processEvents(); | 1981 | processEvents(); |
1976 | 1982 | ||
1977 | // If we are a preloaded application we don't actually quit, so emit | 1983 | // If we are a preloaded application we don't actually quit, so emit |
1978 | // a System message indicating we're quasi-closing. | 1984 | // a System message indicating we're quasi-closing. |
1979 | if ( d->preloaded && d->qpe_main_widget ) | 1985 | if ( d->preloaded && d->qpe_main_widget ) |
1980 | #ifndef QT_NO_COP | 1986 | #ifndef QT_NO_COP |
1981 | 1987 | ||
1982 | { | 1988 | { |
1983 | QCopEnvelope e("QPE/System", "fastAppHiding(QString)" ); | 1989 | QCopEnvelope e("QPE/System", "fastAppHiding(QString)" ); |
1984 | e << d->appName; | 1990 | e << d->appName; |
1985 | d->qpe_main_widget->hide(); | 1991 | d->qpe_main_widget->hide(); |
1986 | } | 1992 | } |
1987 | #endif | 1993 | #endif |
1988 | else | 1994 | else |
1989 | quit(); | 1995 | quit(); |
1990 | } | 1996 | } |
1991 | 1997 | ||
1992 | #if (__GNUC__ > 2 ) | 1998 | #if (__GNUC__ > 2 ) |
1993 | extern "C" void __cxa_pure_virtual(); | 1999 | extern "C" void __cxa_pure_virtual(); |
1994 | 2000 | ||
1995 | void __cxa_pure_virtual() | 2001 | void __cxa_pure_virtual() |
1996 | { | 2002 | { |
1997 | fprintf( stderr, "Pure virtual called\n"); | 2003 | fprintf( stderr, "Pure virtual called\n"); |
1998 | abort(); | 2004 | abort(); |
1999 | 2005 | ||
2000 | } | 2006 | } |
2001 | 2007 | ||
2002 | #endif | 2008 | #endif |
2003 | 2009 | ||
2004 | 2010 | ||
2005 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_RAMSES) | 2011 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_RAMSES) |
2006 | 2012 | ||
2007 | // The libraries with the skiff package (and possibly others) have | 2013 | // The libraries with the skiff package (and possibly others) have |
2008 | // completely useless implementations of builtin new and delete that | 2014 | // completely useless implementations of builtin new and delete that |
2009 | // use about 50% of your CPU. Here we revert to the simple libc | 2015 | // use about 50% of your CPU. Here we revert to the simple libc |
2010 | // functions. | 2016 | // functions. |
2011 | 2017 | ||
2012 | void* operator new[]( size_t size ) | 2018 | void* operator new[]( size_t size ) |
2013 | { | 2019 | { |
2014 | return malloc( size ); | 2020 | return malloc( size ); |
2015 | } | 2021 | } |
2016 | 2022 | ||
2017 | void* operator new( size_t size ) | 2023 | void* operator new( size_t size ) |
2018 | { | 2024 | { |
2019 | return malloc( size ); | 2025 | return malloc( size ); |
2020 | } | 2026 | } |
2021 | 2027 | ||
2022 | void operator delete[]( void* p ) | 2028 | void operator delete[]( void* p ) |
2023 | { | 2029 | { |
2024 | free( p ); | 2030 | free( p ); |
2025 | } | 2031 | } |
2026 | 2032 | ||
2027 | void operator delete[]( void* p, size_t /*size*/ ) | 2033 | void operator delete[]( void* p, size_t /*size*/ ) |
2028 | { | 2034 | { |
2029 | free( p ); | 2035 | free( p ); |
2030 | } | 2036 | } |
2031 | 2037 | ||
2032 | 2038 | ||
2033 | void operator delete( void* p ) | 2039 | void operator delete( void* p ) |
2034 | { | 2040 | { |
2035 | free( p ); | 2041 | free( p ); |
2036 | } | 2042 | } |
2037 | 2043 | ||
2038 | void operator delete( void* p, size_t /*size*/ ) | 2044 | void operator delete( void* p, size_t /*size*/ ) |
2039 | { | 2045 | { |
2040 | free( p ); | 2046 | free( p ); |
2041 | } | 2047 | } |
2042 | 2048 | ||
2043 | #endif | 2049 | #endif |
2044 | 2050 | ||
2045 | #if ( QT_VERSION <= 230 ) && !defined(SINGLE_APP) | 2051 | #if ( QT_VERSION <= 230 ) && !defined(SINGLE_APP) |
2046 | #include <qwidgetlist.h> | 2052 | #include <qwidgetlist.h> |
2047 | #ifdef QWS | 2053 | #ifdef QWS |
2048 | #include <qgfx_qws.h> | 2054 | #include <qgfx_qws.h> |
2049 | extern QRect qt_maxWindowRect; | 2055 | extern QRect qt_maxWindowRect; |
2050 | void qt_setMaxWindowRect(const QRect& r ) | 2056 | void qt_setMaxWindowRect(const QRect& r ) |
2051 | { | 2057 | { |
2052 | qt_maxWindowRect = qt_screen->mapFromDevice( r, | 2058 | qt_maxWindowRect = qt_screen->mapFromDevice( r, |
2053 | qt_screen->mapToDevice( QSize( qt_screen->width(), qt_screen->height() ) ) ); | 2059 | qt_screen->mapToDevice( QSize( qt_screen->width(), qt_screen->height() ) ) ); |
2054 | // Re-resize any maximized windows | 2060 | // Re-resize any maximized windows |
2055 | QWidgetList* l = QApplication::topLevelWidgets(); | 2061 | QWidgetList* l = QApplication::topLevelWidgets(); |
2056 | if ( l ) { | 2062 | if ( l ) { |
2057 | QWidget * w = l->first(); | 2063 | QWidget * w = l->first(); |
2058 | while ( w ) { | 2064 | while ( w ) { |
2059 | if ( w->isVisible() && w->isMaximized() ) { | 2065 | if ( w->isVisible() && w->isMaximized() ) { |
2060 | w->showMaximized(); | 2066 | w->showMaximized(); |
2061 | } | 2067 | } |
2062 | w = l->next(); | 2068 | w = l->next(); |
2063 | } | 2069 | } |
2064 | delete l; | 2070 | delete l; |
2065 | } | 2071 | } |
2066 | } | 2072 | } |
2067 | #endif | 2073 | #endif |
2068 | #endif | 2074 | #endif |
diff --git a/library/qt_override.cpp b/library/qt_override.cpp index edda874..df5a419 100644 --- a/library/qt_override.cpp +++ b/library/qt_override.cpp | |||
@@ -1,171 +1,177 @@ | |||
1 | 1 | ||
2 | #include <qpe/qpeapplication.h> | 2 | #include <qpe/qpeapplication.h> |
3 | #include <qwsdecoration_qws.h> | 3 | #include <qwsdecoration_qws.h> |
4 | #include <qcommonstyle.h> | 4 | #include <qcommonstyle.h> |
5 | #include <qfontdatabase.h> | 5 | #include <qfontdatabase.h> |
6 | 6 | ||
7 | #include <unistd.h> | 7 | #include <unistd.h> |
8 | #include <stdlib.h> | 8 | #include <stdlib.h> |
9 | #include <stdio.h> | 9 | #include <stdio.h> |
10 | #include <limits.h> | 10 | #include <limits.h> |
11 | #include <sys/param.h> // for toolchains with old libc headers | 11 | #include <sys/param.h> // for toolchains with old libc headers |
12 | 12 | ||
13 | #include "qt_override_p.h" | 13 | #include "qt_override_p.h" |
14 | 14 | ||
15 | #if QT_VERSION > 233 | 15 | #if QT_VERSION > 233 |
16 | 16 | ||
17 | struct color_fix_t { | 17 | struct color_fix_t { |
18 | char *m_app; | 18 | char *m_app; |
19 | char *m_class; | 19 | char *m_class; |
20 | char *m_name; | 20 | char *m_name; |
21 | QColorGroup::ColorRole m_set; | 21 | QColorGroup::ColorRole m_set; |
22 | QColorGroup::ColorRole m_get; | 22 | QColorGroup::ColorRole m_get; |
23 | }; | 23 | }; |
24 | 24 | ||
25 | 25 | #ifndef OPIE_NO_OVERRIDE_QT | |
26 | 26 | ||
27 | static const color_fix_t apps_that_need_special_colors [] = { | 27 | static const color_fix_t apps_that_need_special_colors [] = { |
28 | { "HancomMobileWord", "HTextEdit", 0, QColorGroup::Background, QColorGroup::Base }, | 28 | { "HancomMobileWord", "HTextEdit", 0, QColorGroup::Background, QColorGroup::Base }, |
29 | { "neocal", "Display", 0, QColorGroup::Background, QColorGroup::Base }, | 29 | { "neocal", "Display", 0, QColorGroup::Background, QColorGroup::Base }, |
30 | 30 | ||
31 | { 0, 0, 0, QColorGroup::Base, QColorGroup::Base } | 31 | { 0, 0, 0, QColorGroup::Base, QColorGroup::Base } |
32 | }; | 32 | }; |
33 | 33 | ||
34 | static const char * const apps_that_need_pointsizes_times_10 [] = { | 34 | static const char * const apps_that_need_pointsizes_times_10 [] = { |
35 | "HancomMobileWord", | 35 | "HancomMobileWord", |
36 | "hancomsheet", | 36 | "hancomsheet", |
37 | "HancomPresenterViewer", | 37 | "HancomPresenterViewer", |
38 | 38 | ||
39 | 0 | 39 | 0 |
40 | }; | 40 | }; |
41 | 41 | ||
42 | 42 | ||
43 | 43 | ||
44 | 44 | ||
45 | int Opie::force_appearance = 0; | 45 | int Opie::force_appearance = 0; |
46 | 46 | ||
47 | 47 | ||
48 | // Return the *real* name of the binary - not just a quick guess | 48 | // Return the *real* name of the binary - not just a quick guess |
49 | // by looking at argv [0] (which could be anything) | 49 | // by looking at argv [0] (which could be anything) |
50 | 50 | ||
51 | static void binaryNameFree ( ) | 51 | static void binaryNameFree ( ) |
52 | { | 52 | { |
53 | ::free ((void *) Opie::binaryName ( )); // we need to cast away the const here | 53 | ::free ((void *) Opie::binaryName ( )); // we need to cast away the const here |
54 | } | 54 | } |
55 | 55 | ||
56 | const char *Opie::binaryName ( ) | 56 | const char *Opie::binaryName ( ) |
57 | { | 57 | { |
58 | static const char *appname = 0; | 58 | static const char *appname = 0; |
59 | 59 | ||
60 | if ( !appname ) { | 60 | if ( !appname ) { |
61 | char dst [PATH_MAX + 1]; | 61 | char dst [PATH_MAX + 1]; |
62 | int l = ::readlink ( "/proc/self/exe", dst, PATH_MAX ); | 62 | int l = ::readlink ( "/proc/self/exe", dst, PATH_MAX ); |
63 | 63 | ||
64 | if ( l <= 0 ) | 64 | if ( l <= 0 ) |
65 | l = 0; | 65 | l = 0; |
66 | 66 | ||
67 | dst [l] = 0; | 67 | dst [l] = 0; |
68 | const char *b = ::strrchr ( dst, '/' ); | 68 | const char *b = ::strrchr ( dst, '/' ); |
69 | appname = ::strdup ( b ? b + 1 : dst ); | 69 | appname = ::strdup ( b ? b + 1 : dst ); |
70 | 70 | ||
71 | ::atexit ( binaryNameFree ); | 71 | ::atexit ( binaryNameFree ); |
72 | } | 72 | } |
73 | return appname; | 73 | return appname; |
74 | } | 74 | } |
75 | 75 | ||
76 | #else | ||
77 | int Opie::force_appearance = 0; | ||
78 | #endif | ||
76 | 79 | ||
77 | // Fix for a toolchain incompatibility (binaries compiled with | 80 | // Fix for a toolchain incompatibility (binaries compiled with |
78 | // old tcs using shared libs compiled with newer tcs) | 81 | // old tcs using shared libs compiled with newer tcs) |
79 | 82 | ||
80 | extern "C" { | 83 | extern "C" { |
81 | 84 | ||
82 | extern void __gmon_start__ ( ) __attribute__(( weak )); | 85 | extern void __gmon_start__ ( ) __attribute__(( weak )); |
83 | 86 | ||
84 | extern void __gmon_start__ ( ) | 87 | extern void __gmon_start__ ( ) |
85 | { | 88 | { |
86 | } | 89 | } |
87 | 90 | ||
88 | } | 91 | } |
89 | 92 | ||
90 | 93 | ||
91 | // Fix for apps, that use QPainter::eraseRect() which doesn't work with styles | 94 | // Fix for apps, that use QPainter::eraseRect() which doesn't work with styles |
92 | // that set a background pixmap (it would be easier to fix eraseRect(), but | 95 | // that set a background pixmap (it would be easier to fix eraseRect(), but |
93 | // TT made it an inline ...) | 96 | // TT made it an inline ...) |
94 | 97 | ||
95 | void QPEApplication::polish ( QWidget *w ) | 98 | void QPEApplication::polish ( QWidget *w ) |
96 | { | 99 | { |
100 | #ifndef OPIE_NO_OVERRIDE_QT | ||
97 | //qDebug ( "QPEApplication::polish()" ); | 101 | //qDebug ( "QPEApplication::polish()" ); |
98 | 102 | ||
99 | for ( const color_fix_t *ptr = apps_that_need_special_colors; ptr-> m_app; ptr++ ) { | 103 | for ( const color_fix_t *ptr = apps_that_need_special_colors; ptr-> m_app; ptr++ ) { |
100 | if (( ::strcmp ( Opie::binaryName ( ), ptr-> m_app ) == 0 ) && | 104 | if (( ::strcmp ( Opie::binaryName ( ), ptr-> m_app ) == 0 ) && |
101 | ( ptr-> m_class ? w-> inherits ( ptr-> m_class ) : true ) && | 105 | ( ptr-> m_class ? w-> inherits ( ptr-> m_class ) : true ) && |
102 | ( ptr-> m_name ? ( ::strcmp ( w-> name ( ), ptr-> m_name ) == 0 ) : true )) { | 106 | ( ptr-> m_name ? ( ::strcmp ( w-> name ( ), ptr-> m_name ) == 0 ) : true )) { |
103 | QPalette pal = w-> palette ( ); | 107 | QPalette pal = w-> palette ( ); |
104 | pal. setColor ( ptr-> m_set, pal. color ( QPalette::Active, ptr-> m_get )); | 108 | pal. setColor ( ptr-> m_set, pal. color ( QPalette::Active, ptr-> m_get )); |
105 | w-> setPalette ( pal ); | 109 | w-> setPalette ( pal ); |
106 | } | 110 | } |
107 | } | 111 | } |
112 | #endif | ||
108 | QApplication::polish ( w ); | 113 | QApplication::polish ( w ); |
109 | } | 114 | } |
110 | 115 | ||
111 | 116 | ||
117 | #ifndef OPIE_NO_OVERRIDE_QT | ||
112 | // Fix for the binary incompatibility that TT introduced in Qt/E 2.3.4 -- point sizes | 118 | // Fix for the binary incompatibility that TT introduced in Qt/E 2.3.4 -- point sizes |
113 | // were multiplied by 10 (which was incorrect) | 119 | // were multiplied by 10 (which was incorrect) |
114 | 120 | ||
115 | QValueList <int> QFontDatabase::pointSizes ( QString const &family, QString const &style, QString const &charset ) | 121 | QValueList <int> QFontDatabase::pointSizes ( QString const &family, QString const &style, QString const &charset ) |
116 | { | 122 | { |
117 | //qDebug ( "QFontDatabase::pointSizes()" ); | 123 | //qDebug ( "QFontDatabase::pointSizes()" ); |
118 | 124 | ||
119 | QValueList <int> sl = pointSizes_NonWeak ( family, style, charset ); | 125 | QValueList <int> sl = pointSizes_NonWeak ( family, style, charset ); |
120 | 126 | ||
121 | for ( const char * const *ptr = apps_that_need_pointsizes_times_10; *ptr; ptr++ ) { | 127 | for ( const char * const *ptr = apps_that_need_pointsizes_times_10; *ptr; ptr++ ) { |
122 | if ( ::strcmp ( Opie::binaryName ( ), *ptr ) == 0 ) { | 128 | if ( ::strcmp ( Opie::binaryName ( ), *ptr ) == 0 ) { |
123 | for ( QValueList <int>::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) | 129 | for ( QValueList <int>::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) |
124 | *it *= 10; | 130 | *it *= 10; |
125 | } | 131 | } |
126 | } | 132 | } |
127 | return sl; | 133 | return sl; |
128 | } | 134 | } |
129 | 135 | ||
130 | 136 | ||
131 | // Various style/font/color related overrides for weak symbols in Qt/E, | 137 | // Various style/font/color related overrides for weak symbols in Qt/E, |
132 | // which allows us to force the usage of the global Opie appearance. | 138 | // which allows us to force the usage of the global Opie appearance. |
133 | 139 | ||
134 | void QApplication::setStyle ( QStyle *style ) | 140 | void QApplication::setStyle ( QStyle *style ) |
135 | { | 141 | { |
136 | //qDebug ( "QApplication::setStyle()" ); | 142 | //qDebug ( "QApplication::setStyle()" ); |
137 | 143 | ||
138 | if ( Opie::force_appearance & Opie::Force_Style ) | 144 | if ( Opie::force_appearance & Opie::Force_Style ) |
139 | delete style; | 145 | delete style; |
140 | else | 146 | else |
141 | QApplication::setStyle_NonWeak ( style ); | 147 | QApplication::setStyle_NonWeak ( style ); |
142 | } | 148 | } |
143 | 149 | ||
144 | void QApplication::setPalette ( const QPalette &pal, bool informWidgets, const char *className ) | 150 | void QApplication::setPalette ( const QPalette &pal, bool informWidgets, const char *className ) |
145 | { | 151 | { |
146 | //qDebug ( "QApplication::setPalette()" ); | 152 | //qDebug ( "QApplication::setPalette()" ); |
147 | 153 | ||
148 | if (!( Opie::force_appearance & Opie::Force_Style )) | 154 | if (!( Opie::force_appearance & Opie::Force_Style )) |
149 | QApplication::setPalette_NonWeak ( pal, informWidgets, className ); | 155 | QApplication::setPalette_NonWeak ( pal, informWidgets, className ); |
150 | } | 156 | } |
151 | 157 | ||
152 | void QApplication::setFont ( const QFont &fnt, bool informWidgets, const char *className ) | 158 | void QApplication::setFont ( const QFont &fnt, bool informWidgets, const char *className ) |
153 | { | 159 | { |
154 | //qDebug ( "QApplication::setFont()" ); | 160 | //qDebug ( "QApplication::setFont()" ); |
155 | 161 | ||
156 | if (!( Opie::force_appearance & Opie::Force_Font )) | 162 | if (!( Opie::force_appearance & Opie::Force_Font )) |
157 | QApplication::setFont_NonWeak ( fnt, informWidgets, className ); | 163 | QApplication::setFont_NonWeak ( fnt, informWidgets, className ); |
158 | } | 164 | } |
159 | 165 | ||
160 | 166 | ||
161 | void QApplication::qwsSetDecoration ( QWSDecoration *deco ) | 167 | void QApplication::qwsSetDecoration ( QWSDecoration *deco ) |
162 | { | 168 | { |
163 | //qDebug ( "QApplication::qwsSetDecoration()" ); | 169 | //qDebug ( "QApplication::qwsSetDecoration()" ); |
164 | 170 | ||
165 | if ( Opie::force_appearance & Opie::Force_Decoration ) | 171 | if ( Opie::force_appearance & Opie::Force_Decoration ) |
166 | delete deco; | 172 | delete deco; |
167 | else | 173 | else |
168 | QApplication::qwsSetDecoration_NonWeak ( deco ); | 174 | QApplication::qwsSetDecoration_NonWeak ( deco ); |
169 | } | 175 | } |
170 | 176 | #endif | |
171 | #endif \ No newline at end of file | 177 | #endif |