author | mickeyl <mickeyl> | 2003-08-13 12:24:47 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-08-13 12:24:47 (UTC) |
commit | 6e7dbb9320256c326cd19e7555b4309e71d039e3 (patch) (unidiff) | |
tree | 3a64f0284a7f9f2a2fdbacffde3e11eb768b79bc | |
parent | db952faa29fa56602b061ef4faff61cc57f71243 (diff) | |
download | opie-6e7dbb9320256c326cd19e7555b4309e71d039e3.zip opie-6e7dbb9320256c326cd19e7555b4309e71d039e3.tar.gz opie-6e7dbb9320256c326cd19e7555b4309e71d039e3.tar.bz2 |
make it at least compile. ljp, please look @ the doctab
-rw-r--r-- | Rules.make | 1 | ||||
-rw-r--r-- | core/launcher/launcher.cpp | 27 |
2 files changed, 15 insertions, 13 deletions
@@ -1,190 +1,191 @@ | |||
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 | 21 | ||
22 | $(TOPDIR)/.depends : $(shell if [ -e $(TOPDIR)/config.in ]\; then echo $(TOPDIR)/config.in\; fi\;) $(TOPDIR)/.config $(TOPDIR)/packages | 22 | $(TOPDIR)/.depends : $(shell if [ -e $(TOPDIR)/config.in ]\; then echo $(TOPDIR)/config.in\; fi\;) $(TOPDIR)/.config $(TOPDIR)/packages |
23 | @echo Generating dependency information... | 23 | @echo Generating dependency information... |
24 | # add to subdir-y, and add descend rules | 24 | # add to subdir-y, and add descend rules |
25 | @cat $(TOPDIR)/packages | grep -v '^#' | \ | 25 | @cat $(TOPDIR)/packages | grep -v '^#' | \ |
26 | awk '{print \ | 26 | awk '{print \ |
27 | ".PHONY : " $$2 "\n" \ | 27 | ".PHONY : " $$2 "\n" \ |
28 | "subdir-$$(" $$1 ") += " $$2 "\n\n"; \ | 28 | "subdir-$$(" $$1 ") += " $$2 "\n\n"; \ |
29 | print $$2 " : " $$2 "/Makefile\n\t$$(call descend,$$@,$(filter-out $$@,$$(filter-out $$@,$$(MAKECMDGOALS))))\n"; }' > $(TOPDIR)/.depends | 29 | print $$2 " : " $$2 "/Makefile\n\t$$(call descend,$$@,$(filter-out $$@,$$(filter-out $$@,$$(MAKECMDGOALS))))\n"; }' > $(TOPDIR)/.depends |
30 | cat $(TOPDIR)/packages | grep -v '^#' | \ | 30 | cat $(TOPDIR)/packages | grep -v '^#' | \ |
31 | 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"; }' \ | 31 | 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"; }' \ |
32 | >> $(TOPDIR)/.depends | 32 | >> $(TOPDIR)/.depends |
33 | # interpackage dependency generation | 33 | # interpackage dependency generation |
34 | @cat $(TOPDIR)/packages | \ | 34 | @cat $(TOPDIR)/packages | \ |
35 | $(TOPDIR)/scripts/deps.pl >> $(TOPDIR)/.depends | 35 | $(TOPDIR)/scripts/deps.pl >> $(TOPDIR)/.depends |
36 | 36 | ||
37 | $(TOPDIR)/.depends.cfgs: | 37 | $(TOPDIR)/.depends.cfgs: |
38 | # config.in interdependencies | 38 | # config.in interdependencies |
39 | @echo $(configs) | sed -e 's,/config.in,,g' | ( for i in `cat`; do echo $$i; done ) > dirs | 39 | @echo $(configs) | sed -e 's,/config.in,,g' | ( for i in `cat`; do echo $$i; done ) > dirs |
40 | @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 ) >> $@ | 40 | @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 ) >> $@ |
41 | @-rm -f dirs | 41 | @-rm -f dirs |
42 | 42 | ||
43 | $(QTDIR)/stamp-headers : | 43 | $(QTDIR)/stamp-headers : |
44 | @-rm -f $(QTDIR)/stamp-headers* | 44 | @-rm -f $(QTDIR)/stamp-headers* |
45 | ( cd $(QTDIR)/include; \ | 45 | ( cd $(QTDIR)/include; \ |
46 | $(patsubst %,ln -sf ../src/kernel/%;,qgfx_qws.h qwsmouse_qws.h \ | 46 | $(patsubst %,ln -sf ../src/kernel/%;,qgfx_qws.h qwsmouse_qws.h \ |
47 | qcopchannel_qws.h qwindowsystem_qws.h \ | 47 | qcopchannel_qws.h qwindowsystem_qws.h \ |
48 | qfontmanager_qws.h qwsdefaultdecoration_qws.h)) | 48 | qfontmanager_qws.h qwsdefaultdecoration_qws.h)) |
49 | touch $@ | 49 | touch $@ |
50 | 50 | ||
51 | $(QTDIR)/stamp-headers-x11 : | 51 | $(QTDIR)/stamp-headers-x11 : |
52 | @-rm -f $(QTDIR)/stamp-headers* | 52 | @-rm -f $(QTDIR)/stamp-headers* |
53 | 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) | 53 | 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) |
54 | touch $@ | 54 | touch $@ |
55 | 55 | ||
56 | $(OPIEDIR)/stamp-headers : | 56 | $(OPIEDIR)/stamp-headers : |
57 | @-rm -f $(OPIEDIR)/stamp-headers* | 57 | @-rm -f $(OPIEDIR)/stamp-headers* |
58 | mkdir -p $(TOPDIR)/include/qpe \ | 58 | mkdir -p $(TOPDIR)/include/qpe \ |
59 | $(TOPDIR)/include/qtopia \ | 59 | $(TOPDIR)/include/qtopia \ |
60 | $(TOPDIR)/include/opie \ | 60 | $(TOPDIR)/include/opie \ |
61 | $(TOPDIR)/include/opie2 \ | ||
61 | $(TOPDIR)/include/qtopia/private | 62 | $(TOPDIR)/include/qtopia/private |
62 | ( cd include/qpe && rm -f *.h; ln -sf ../../library/*.h .; ln -sf ../../library/backend/*.h .; rm -f *_p.h; ) | 63 | ( cd include/qpe && rm -f *.h; ln -sf ../../library/*.h .; ln -sf ../../library/backend/*.h .; rm -f *_p.h; ) |
63 | ( cd include/qtopia && rm -f *.h; ln -sf ../../library/*.h .; ) | 64 | ( cd include/qtopia && rm -f *.h; ln -sf ../../library/*.h .; ) |
64 | ( cd include/qtopia/private && rm -f *.h; ln -sf ../../../library/backend/*.h .; ) | 65 | ( cd include/qtopia/private && rm -f *.h; ln -sf ../../../library/backend/*.h .; ) |
65 | ( cd include/opie && rm -f *.h; ln -sf ../../libopie/*.h .; rm -f *_p.h; ) | 66 | ( cd include/opie && rm -f *.h; ln -sf ../../libopie/*.h .; rm -f *_p.h; ) |
66 | ( cd include/opie && ln -sf ../../libopie/pim/*.h .; ) | 67 | ( cd include/opie && ln -sf ../../libopie/pim/*.h .; ) |
67 | ( cd include/opie2 && ln -sf ../../libopie2/opiecore/*.h .; ) | 68 | ( cd include/opie2 && ln -sf ../../libopie2/opiecore/*.h .; ) |
68 | ( cd include/opie2 && ln -sf ../../libopie2/opiemm/*.h .; ) | 69 | ( cd include/opie2 && ln -sf ../../libopie2/opiemm/*.h .; ) |
69 | ( cd include/opie2 && ln -sf ../../libopie2/opiedb/*.h .; ) | 70 | ( cd include/opie2 && ln -sf ../../libopie2/opiedb/*.h .; ) |
70 | ( cd include/opie2 && ln -sf ../../libopie2/opienet/*.h .; ) | 71 | ( cd include/opie2 && ln -sf ../../libopie2/opienet/*.h .; ) |
71 | #( cd include/opie2 && ln -sf ../../libopie2/opiepim/*.h .; ) | 72 | #( cd include/opie2 && ln -sf ../../libopie2/opiepim/*.h .; ) |
72 | ( cd include/opie2 && ln -sf ../../libopie2/opieui/*.h .; ) | 73 | ( cd include/opie2 && ln -sf ../../libopie2/opieui/*.h .; ) |
73 | ( cd include/opie; for generatedHeader in `cd ../../libopie; ls *.ui | sed -e "s,\.ui,\.h,g"`; do \ | 74 | ( cd include/opie; for generatedHeader in `cd ../../libopie; ls *.ui | sed -e "s,\.ui,\.h,g"`; do \ |
74 | ln -sf ../../libopie/$$generatedHeader $$generatedHeader; done ) | 75 | ln -sf ../../libopie/$$generatedHeader $$generatedHeader; done ) |
75 | ln -sf ../../library/custom.h $(TOPDIR)/include/qpe/custom.h | 76 | ln -sf ../../library/custom.h $(TOPDIR)/include/qpe/custom.h |
76 | touch $@ | 77 | touch $@ |
77 | 78 | ||
78 | $(OPIEDIR)/stamp-headers-x11 : | 79 | $(OPIEDIR)/stamp-headers-x11 : |
79 | @-rm -f $(OPIEDIR)/stamp-headers* | 80 | @-rm -f $(OPIEDIR)/stamp-headers* |
80 | mkdir -p $(TOPDIR)/include/qpe $(TOPDIR)/include/qtopia \ | 81 | mkdir -p $(TOPDIR)/include/qpe $(TOPDIR)/include/qtopia \ |
81 | $(TOPDIR)/include/opie $(TOPDIR)/include/qtopia/private | 82 | $(TOPDIR)/include/opie $(TOPDIR)/include/qtopia/private |
82 | ( cd include/qpe && rm -f *.h; ln -sf ../../library/*.h .; ln -sf ../../library/backend/*.h .; rm -f *_p.h; ) | 83 | ( cd include/qpe && rm -f *.h; ln -sf ../../library/*.h .; ln -sf ../../library/backend/*.h .; rm -f *_p.h; ) |
83 | ( cd include/qtopia && rm -f *.h; ln -sf ../../library/*.h .; ) | 84 | ( cd include/qtopia && rm -f *.h; ln -sf ../../library/*.h .; ) |
84 | ( cd include/qtopia/private && rm -f *.h; ln -sf ../../../library/backend/*.h .; ) | 85 | ( cd include/qtopia/private && rm -f *.h; ln -sf ../../../library/backend/*.h .; ) |
85 | ( cd include/opie && rm -f *.h; ln -sf ../../libopie/*.h .; rm -f *_p.h; ) | 86 | ( cd include/opie && rm -f *.h; ln -sf ../../libopie/*.h .; rm -f *_p.h; ) |
86 | ( cd include/opie && ln -sf ../../libsql/*.h .; ) | 87 | ( cd include/opie && ln -sf ../../libsql/*.h .; ) |
87 | ( cd include/opie && ln -sf ../../libopie/pim/*.h .; ) | 88 | ( cd include/opie && ln -sf ../../libopie/pim/*.h .; ) |
88 | ( 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 \ |
89 | ln -sf ../../libopie/$$generatedHeader $$generatedHeader; done ) | 90 | ln -sf ../../libopie/$$generatedHeader $$generatedHeader; done ) |
90 | ln -sf ../../library/custom.h $(TOPDIR)/include/qpe/custom.h | 91 | ln -sf ../../library/custom.h $(TOPDIR)/include/qpe/custom.h |
91 | ( cd include/qpe; ln -sf ../../x11/libqpe-x11/qpe/*.h .; ) | 92 | ( cd include/qpe; ln -sf ../../x11/libqpe-x11/qpe/*.h .; ) |
92 | touch $@ | 93 | touch $@ |
93 | 94 | ||
94 | $(TOPDIR)/library/custom.h : $(TOPDIR)/.config | 95 | $(TOPDIR)/library/custom.h : $(TOPDIR)/.config |
95 | @-rm -f $@ | 96 | @-rm -f $@ |
96 | @$(if $(patsubst "%",%,$(CONFIG_CUSTOMFILE)),\ | 97 | @$(if $(patsubst "%",%,$(CONFIG_CUSTOMFILE)),\ |
97 | ln -sf $(patsubst "%",%,$(CONFIG_CUSTOMFILE)) $@) | 98 | ln -sf $(patsubst "%",%,$(CONFIG_CUSTOMFILE)) $@) |
98 | @touch $@ | 99 | @touch $@ |
99 | 100 | ||
100 | $(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: | 101 | $(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: |
101 | @$(call descend,$(shell dirname $@),$(shell basename $@)) | 102 | @$(call descend,$(shell dirname $@),$(shell basename $@)) |
102 | 103 | ||
103 | menuconfig: $(TOPDIR)/scripts/lxdialog/lxdialog $(TOPDIR)/scripts/kconfig/mconf ./config.in | 104 | menuconfig: $(TOPDIR)/scripts/lxdialog/lxdialog $(TOPDIR)/scripts/kconfig/mconf ./config.in |
104 | $(TOPDIR)/scripts/kconfig/mconf ./config.in | 105 | $(TOPDIR)/scripts/kconfig/mconf ./config.in |
105 | @touch ./.config.stamp | 106 | @touch ./.config.stamp |
106 | 107 | ||
107 | xconfig: $(TOPDIR)/scripts/kconfig/qconf $(TOPDIR)/scripts/kconfig/libkconfig.so ./config.in | 108 | xconfig: $(TOPDIR)/scripts/kconfig/qconf $(TOPDIR)/scripts/kconfig/libkconfig.so ./config.in |
108 | $(TOPDIR)/scripts/kconfig/qconf ./config.in | 109 | $(TOPDIR)/scripts/kconfig/qconf ./config.in |
109 | @touch .config.stamp | 110 | @touch .config.stamp |
110 | 111 | ||
111 | gconfig: $(TOPDIR)/scripts/kconfig/gconf $(TOPDIR)/scripts/kconfig/libkconfig.so ./config.in | 112 | gconfig: $(TOPDIR)/scripts/kconfig/gconf $(TOPDIR)/scripts/kconfig/libkconfig.so ./config.in |
112 | $(TOPDIR)/scripts/kconfig/gconf ./config.in | 113 | $(TOPDIR)/scripts/kconfig/gconf ./config.in |
113 | @touch .config.stamp | 114 | @touch .config.stamp |
114 | 115 | ||
115 | config: $(TOPDIR)/scripts/kconfig/conf ./config.in | 116 | config: $(TOPDIR)/scripts/kconfig/conf ./config.in |
116 | $(TOPDIR)/scripts/kconfig/conf ./config.in | 117 | $(TOPDIR)/scripts/kconfig/conf ./config.in |
117 | @touch .config.stamp | 118 | @touch .config.stamp |
118 | 119 | ||
119 | oldconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in | 120 | oldconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in |
120 | $(TOPDIR)/scripts/kconfig/conf -o ./config.in | 121 | $(TOPDIR)/scripts/kconfig/conf -o ./config.in |
121 | @touch .config.stamp | 122 | @touch .config.stamp |
122 | 123 | ||
123 | randconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in | 124 | randconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in |
124 | $(TOPDIR)/scripts/kconfig/conf -r ./config.in | 125 | $(TOPDIR)/scripts/kconfig/conf -r ./config.in |
125 | @touch .config.stamp | 126 | @touch .config.stamp |
126 | 127 | ||
127 | allyesconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in | 128 | allyesconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in |
128 | $(TOPDIR)/scripts/kconfig/conf -y ./config.in | 129 | $(TOPDIR)/scripts/kconfig/conf -y ./config.in |
129 | @touch .config.stamp | 130 | @touch .config.stamp |
130 | 131 | ||
131 | allnoconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in | 132 | allnoconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in |
132 | $(TOPDIR)/scripts/kconfig/conf -n ./config.in | 133 | $(TOPDIR)/scripts/kconfig/conf -n ./config.in |
133 | @touch .config.stamp | 134 | @touch .config.stamp |
134 | 135 | ||
135 | defconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in | 136 | defconfig: $(TOPDIR)/scripts/kconfig/conf ./config.in |
136 | $(TOPDIR)/scripts/kconfig/conf -d ./config.in | 137 | $(TOPDIR)/scripts/kconfig/conf -d ./config.in |
137 | @touch .config.stamp | 138 | @touch .config.stamp |
138 | 139 | ||
139 | $(TOPDIR)/qmake/qmake : $(TOPDIR)/mkspecs/default | 140 | $(TOPDIR)/qmake/qmake : $(TOPDIR)/mkspecs/default |
140 | 141 | ||
141 | $(TOPDIR)/mkspecs/default : | 142 | $(TOPDIR)/mkspecs/default : |
142 | ln -sf linux-g++ $@ | 143 | ln -sf linux-g++ $@ |
143 | 144 | ||
144 | $(TOPDIR)/scripts/subst : force | 145 | $(TOPDIR)/scripts/subst : force |
145 | @( \ | 146 | @( \ |
146 | echo 's,\$$QPE_VERSION,$(QPE_VERSION),g'; \ | 147 | echo 's,\$$QPE_VERSION,$(QPE_VERSION),g'; \ |
147 | echo 's,\$$OPIE_VERSION,$(OPIE_VERSION),g'; \ | 148 | echo 's,\$$OPIE_VERSION,$(OPIE_VERSION),g'; \ |
148 | echo 's,\$$QTE_VERSION,$(QTE_VERSION),g'; \ | 149 | echo 's,\$$QTE_VERSION,$(QTE_VERSION),g'; \ |
149 | echo 's,\$$QTE_REVISION,$(QTE_REVISION),g'; \ | 150 | echo 's,\$$QTE_REVISION,$(QTE_REVISION),g'; \ |
150 | echo 's,\$$SUB_VERSION,$(SUB_VERSION),g'; \ | 151 | echo 's,\$$SUB_VERSION,$(SUB_VERSION),g'; \ |
151 | echo 's,\$$EXTRAVERSION,$(EXTRAVERSION),g'; \ | 152 | echo 's,\$$EXTRAVERSION,$(EXTRAVERSION),g'; \ |
152 | echo 's,\$$QTE_BASEVERSION,$(QTE_BASEVERSION),g'; \ | 153 | echo 's,\$$QTE_BASEVERSION,$(QTE_BASEVERSION),g'; \ |
153 | ) > $@ || ( rm -f $@; exit 1 ) | 154 | ) > $@ || ( rm -f $@; exit 1 ) |
154 | 155 | ||
155 | $(TOPDIR)/scripts/filesubst : force | 156 | $(TOPDIR)/scripts/filesubst : force |
156 | @( \ | 157 | @( \ |
157 | echo 's,\$$OPIEDIR/root/,/,g'; \ | 158 | echo 's,\$$OPIEDIR/root/,/,g'; \ |
158 | echo 's,$(OPIEDIR)/root/,/,g'; \ | 159 | echo 's,$(OPIEDIR)/root/,/,g'; \ |
159 | echo 's,\$$OPIEDIR,$(prefix),g'; \ | 160 | echo 's,\$$OPIEDIR,$(prefix),g'; \ |
160 | echo 's,$(OPIEDIR),$(prefix),g'; \ | 161 | echo 's,$(OPIEDIR),$(prefix),g'; \ |
161 | echo 's,\$$QTDIR,$(prefix),g'; \ | 162 | echo 's,\$$QTDIR,$(prefix),g'; \ |
162 | echo 's,$(QTDIR),$(prefix),g'; \ | 163 | echo 's,$(QTDIR),$(prefix),g'; \ |
163 | echo 's,^\(\./\)*root/,/,g'; \ | 164 | echo 's,^\(\./\)*root/,/,g'; \ |
164 | echo 's,^\(\./\)*etc/,$(prefix)/etc/,g'; \ | 165 | echo 's,^\(\./\)*etc/,$(prefix)/etc/,g'; \ |
165 | echo 's,^\(\./\)*lib/,$(prefix)/lib/,g'; \ | 166 | echo 's,^\(\./\)*lib/,$(prefix)/lib/,g'; \ |
166 | echo 's,^\(\./\)*bin/,$(prefix)/bin/,g'; \ | 167 | echo 's,^\(\./\)*bin/,$(prefix)/bin/,g'; \ |
167 | echo 's,^\(\./\)*pics/,$(prefix)/pics/,g'; \ | 168 | echo 's,^\(\./\)*pics/,$(prefix)/pics/,g'; \ |
168 | echo 's,^\(\./\)*sounds/,$(prefix)/sounds/,g'; \ | 169 | echo 's,^\(\./\)*sounds/,$(prefix)/sounds/,g'; \ |
169 | echo 's,^\(\./\)*i18n/,$(prefix)/i18n/,g'; \ | 170 | echo 's,^\(\./\)*i18n/,$(prefix)/i18n/,g'; \ |
170 | echo 's,^\(\./\)*plugins/,$(prefix)/plugins/,g'; \ | 171 | echo 's,^\(\./\)*plugins/,$(prefix)/plugins/,g'; \ |
171 | echo 's,^\(\./\)*apps/,$(prefix)/apps/,g'; \ | 172 | echo 's,^\(\./\)*apps/,$(prefix)/apps/,g'; \ |
172 | echo 's,^\(\./\)*share/,$(prefix)/share/,g'; \ | 173 | echo 's,^\(\./\)*share/,$(prefix)/share/,g'; \ |
173 | echo 's,^\(\./\)*i18n/,$(prefix)/i18n/,g'; \ | 174 | echo 's,^\(\./\)*i18n/,$(prefix)/i18n/,g'; \ |
174 | echo 's,^\(\./\)*help/,$(prefix)/help/,g'; \ | 175 | echo 's,^\(\./\)*help/,$(prefix)/help/,g'; \ |
175 | ) > $@ || ( rm -f $@; exit 1 ) | 176 | ) > $@ || ( rm -f $@; exit 1 ) |
176 | 177 | ||
177 | ## general rules ## | 178 | ## general rules ## |
178 | 179 | ||
179 | define descend | 180 | define descend |
180 | $(MAKE) $(if $(QMAKE),QMAKE=$(QMAKE)) -C $(1) $(2) | 181 | $(MAKE) $(if $(QMAKE),QMAKE=$(QMAKE)) -C $(1) $(2) |
181 | endef | 182 | endef |
182 | 183 | ||
183 | define makefilegen | 184 | define makefilegen |
184 | 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$$,,'\`" | \ | 185 | 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$$,,'\`" | \ |
185 | head -1 | awk '{print $$3}'` | 186 | head -1 | awk '{print $$3}'` |
186 | endef | 187 | endef |
187 | 188 | ||
188 | define makecfg | 189 | define makecfg |
189 | $(TOPDIR)/scripts/makecfg.pl $1 $(OPIEDIR) | 190 | $(TOPDIR)/scripts/makecfg.pl $1 $(OPIEDIR) |
190 | endef | 191 | endef |
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index 0205622..b612aa2 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp | |||
@@ -1,1355 +1,1356 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | // WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT | 21 | // WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT |
22 | // have this class. | 22 | // have this class. |
23 | #define QTOPIA_INTERNAL_FSLP | 23 | #define QTOPIA_INTERNAL_FSLP |
24 | 24 | ||
25 | //#include <opie/ofiledialog.h> | 25 | //#include <opie/ofiledialog.h> |
26 | #include <opie/ofileselector.h> | 26 | #include <opie/ofileselector.h> |
27 | #include <qpe/qcopenvelope_qws.h> | 27 | #include <qpe/qcopenvelope_qws.h> |
28 | #include <qpe/resource.h> | 28 | #include <qpe/resource.h> |
29 | #include <qpe/applnk.h> | 29 | #include <qpe/applnk.h> |
30 | #include <qpe/config.h> | 30 | #include <qpe/config.h> |
31 | #include <qpe/global.h> | 31 | #include <qpe/global.h> |
32 | #include <qpe/qpeapplication.h> | 32 | #include <qpe/qpeapplication.h> |
33 | #include <qpe/mimetype.h> | 33 | #include <qpe/mimetype.h> |
34 | #include <qpe/storage.h> | 34 | #include <qpe/storage.h> |
35 | #include <qpe/palmtoprecord.h> | 35 | #include <qpe/palmtoprecord.h> |
36 | 36 | ||
37 | #include <qpe/version.h> | 37 | #include <qpe/version.h> |
38 | 38 | ||
39 | #include <qdir.h> | 39 | #include <qdir.h> |
40 | #ifdef QWS | 40 | #ifdef QWS |
41 | #include <qwindowsystem_qws.h> | 41 | #include <qwindowsystem_qws.h> |
42 | #endif | 42 | #endif |
43 | #include <qtimer.h> | 43 | #include <qtimer.h> |
44 | #include <qcombobox.h> | 44 | #include <qcombobox.h> |
45 | #include <qvbox.h> | 45 | #include <qvbox.h> |
46 | #include <qlayout.h> | 46 | #include <qlayout.h> |
47 | #include <qstyle.h> | 47 | #include <qstyle.h> |
48 | #include <qpushbutton.h> | 48 | #include <qpushbutton.h> |
49 | #include <qtabbar.h> | 49 | #include <qtabbar.h> |
50 | #include <qwidgetstack.h> | 50 | #include <qwidgetstack.h> |
51 | #include <qlayout.h> | 51 | #include <qlayout.h> |
52 | #include <qregexp.h> | 52 | #include <qregexp.h> |
53 | #include <qmessagebox.h> | 53 | #include <qmessagebox.h> |
54 | #include <qframe.h> | 54 | #include <qframe.h> |
55 | #include <qpainter.h> | 55 | #include <qpainter.h> |
56 | #include <qlabel.h> | 56 | #include <qlabel.h> |
57 | #include <qtextstream.h> | 57 | #include <qtextstream.h> |
58 | #include <qpopupmenu.h> | 58 | #include <qpopupmenu.h> |
59 | 59 | ||
60 | #include <opie/owait.h> | 60 | #include <opie/owait.h> |
61 | 61 | ||
62 | 62 | ||
63 | #include "launcherview.h" | 63 | #include "launcherview.h" |
64 | #include "launcher.h" | 64 | #include "launcher.h" |
65 | #include "syncdialog.h" | 65 | #include "syncdialog.h" |
66 | #include "desktop.h" | 66 | #include "desktop.h" |
67 | #include <qpe/lnkproperties.h> | 67 | #include <qpe/lnkproperties.h> |
68 | //#include "mrulist.h" | 68 | //#include "mrulist.h" |
69 | #include "qrsync.h" | 69 | #include "qrsync.h" |
70 | #include <stdlib.h> | 70 | #include <stdlib.h> |
71 | #include <unistd.h> | 71 | #include <unistd.h> |
72 | 72 | ||
73 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 73 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
74 | #include <stdio.h> | 74 | #include <stdio.h> |
75 | #include <sys/vfs.h> | 75 | #include <sys/vfs.h> |
76 | #include <mntent.h> | 76 | #include <mntent.h> |
77 | #endif | 77 | #endif |
78 | 78 | ||
79 | #include <qpe/storage.h> | 79 | #include <qpe/storage.h> |
80 | #include "mediummountgui.h" | 80 | #include "mediummountgui.h" |
81 | 81 | ||
82 | namespace { | 82 | namespace { |
83 | QStringList configToMime( Config *cfg ){ | 83 | QStringList configToMime( Config *cfg ){ |
84 | QStringList mimes; | 84 | QStringList mimes; |
85 | bool tmpMime = true; | 85 | bool tmpMime = true; |
86 | cfg->setGroup("mimetypes" ); | 86 | cfg->setGroup("mimetypes" ); |
87 | tmpMime = cfg->readBoolEntry("all" ,true); | 87 | tmpMime = cfg->readBoolEntry("all" ,true); |
88 | if( tmpMime ){ | 88 | if( tmpMime ){ |
89 | mimes << QString::null; | 89 | mimes << QString::null; |
90 | return mimes; | 90 | return mimes; |
91 | }else{ | 91 | }else{ |
92 | tmpMime = cfg->readBoolEntry("audio", true ); | 92 | tmpMime = cfg->readBoolEntry("audio", true ); |
93 | if(tmpMime ) | 93 | if(tmpMime ) |
94 | mimes.append("audio/*" ); | 94 | mimes.append("audio/*" ); |
95 | 95 | ||
96 | tmpMime = cfg->readBoolEntry("image", true ); | 96 | tmpMime = cfg->readBoolEntry("image", true ); |
97 | if(tmpMime ) | 97 | if(tmpMime ) |
98 | mimes.append("image/*" ); | 98 | mimes.append("image/*" ); |
99 | 99 | ||
100 | tmpMime = cfg->readBoolEntry("text", true ); | 100 | tmpMime = cfg->readBoolEntry("text", true ); |
101 | if(tmpMime ) | 101 | if(tmpMime ) |
102 | mimes.append("text/*"); | 102 | mimes.append("text/*"); |
103 | 103 | ||
104 | tmpMime = cfg->readBoolEntry("video", true ); | 104 | tmpMime = cfg->readBoolEntry("video", true ); |
105 | if(tmpMime ) | 105 | if(tmpMime ) |
106 | mimes.append("video/*" ); | 106 | mimes.append("video/*" ); |
107 | } | 107 | } |
108 | return mimes; | 108 | return mimes; |
109 | } | 109 | } |
110 | 110 | ||
111 | } | 111 | } |
112 | 112 | ||
113 | 113 | ||
114 | 114 | ||
115 | //#define SHOW_ALL | 115 | //#define SHOW_ALL |
116 | 116 | ||
117 | class CategoryTab : public QTab | 117 | class CategoryTab : public QTab |
118 | { | 118 | { |
119 | public: | 119 | public: |
120 | CategoryTab( const QIconSet &icon, const QString &text=QString::null ) | 120 | CategoryTab( const QIconSet &icon, const QString &text=QString::null ) |
121 | : QTab( icon, text ) | 121 | : QTab( icon, text ) |
122 | { | 122 | { |
123 | } | 123 | } |
124 | 124 | ||
125 | QColor bgColor; | 125 | QColor bgColor; |
126 | QColor fgColor; | 126 | QColor fgColor; |
127 | }; | 127 | }; |
128 | 128 | ||
129 | //=========================================================================== | 129 | //=========================================================================== |
130 | 130 | ||
131 | CategoryTabWidget::CategoryTabWidget( QWidget* parent ) : | 131 | CategoryTabWidget::CategoryTabWidget( QWidget* parent ) : |
132 | QVBox( parent ) | 132 | QVBox( parent ) |
133 | { | 133 | { |
134 | categoryBar = 0; | 134 | categoryBar = 0; |
135 | stack = 0; | 135 | stack = 0; |
136 | } | 136 | } |
137 | 137 | ||
138 | void CategoryTabWidget::prevTab() | 138 | void CategoryTabWidget::prevTab() |
139 | { | 139 | { |
140 | if ( categoryBar ) { | 140 | if ( categoryBar ) { |
141 | int n = categoryBar->count(); | 141 | int n = categoryBar->count(); |
142 | int tab = categoryBar->currentTab(); | 142 | int tab = categoryBar->currentTab(); |
143 | if ( tab >= 0 ) | 143 | if ( tab >= 0 ) |
144 | categoryBar->setCurrentTab( (tab - 1 + n)%n ); | 144 | categoryBar->setCurrentTab( (tab - 1 + n)%n ); |
145 | } | 145 | } |
146 | } | 146 | } |
147 | 147 | ||
148 | void CategoryTabWidget::nextTab() | 148 | void CategoryTabWidget::nextTab() |
149 | { | 149 | { |
150 | if ( categoryBar ) { | 150 | if ( categoryBar ) { |
151 | int n = categoryBar->count(); | 151 | int n = categoryBar->count(); |
152 | int tab = categoryBar->currentTab(); | 152 | int tab = categoryBar->currentTab(); |
153 | categoryBar->setCurrentTab( (tab + 1)%n ); | 153 | categoryBar->setCurrentTab( (tab + 1)%n ); |
154 | } | 154 | } |
155 | } | 155 | } |
156 | 156 | ||
157 | 157 | ||
158 | void CategoryTabWidget::showTab(const QString& id) | 158 | void CategoryTabWidget::showTab(const QString& id) |
159 | { | 159 | { |
160 | if ( categoryBar ) { | 160 | if ( categoryBar ) { |
161 | int idx = ids.findIndex( id ); | 161 | int idx = ids.findIndex( id ); |
162 | categoryBar->setCurrentTab( idx ); | 162 | categoryBar->setCurrentTab( idx ); |
163 | } | 163 | } |
164 | } | 164 | } |
165 | 165 | ||
166 | void CategoryTabWidget::addItem( const QString& linkfile ) | 166 | void CategoryTabWidget::addItem( const QString& linkfile ) |
167 | { | 167 | { |
168 | // int i=0; | 168 | // int i=0; |
169 | // AppLnk *app = new AppLnk(linkfile); | 169 | // AppLnk *app = new AppLnk(linkfile); |
170 | // if ( !app->isValid() ) { | 170 | // if ( !app->isValid() ) { |
171 | // delete app; | 171 | // delete app; |
172 | // app=0; | 172 | // app=0; |
173 | // } | 173 | // } |
174 | // if ( !app || !app->file().isEmpty() ) { | 174 | // if ( !app || !app->file().isEmpty() ) { |
175 | // A document | 175 | // A document |
176 | // delete app; | 176 | // delete app; |
177 | // app = new DocLnk(linkfile); | 177 | // app = new DocLnk(linkfile); |
178 | // if ( app->fileKnown() ) { | 178 | // if ( app->fileKnown() ) { |
179 | // ((LauncherView*)(stack->widget(ids.count()-1)))->addItem(app); | 179 | // ((LauncherView*)(stack->widget(ids.count()-1)))->addItem(app); |
180 | // } else { | 180 | // } else { |
181 | // ((LauncherView*)(stack->widget(ids.count()-1)))->sort(); | 181 | // ((LauncherView*)(stack->widget(ids.count()-1)))->sort(); |
182 | // delete app; | 182 | // delete app; |
183 | // } | 183 | // } |
184 | // return; | 184 | // return; |
185 | // } | 185 | // } |
186 | // An application | 186 | // An application |
187 | // for ( QStringList::Iterator it=ids.begin(); it!=ids.end(); ++it) { | 187 | // for ( QStringList::Iterator it=ids.begin(); it!=ids.end(); ++it) { |
188 | // if ( !(*it).isEmpty() ) { | 188 | // if ( !(*it).isEmpty() ) { |
189 | // QRegExp tf(*it,FALSE,TRUE); | 189 | // QRegExp tf(*it,FALSE,TRUE); |
190 | // if ( tf.match(app->type()) >= 0 ) { | 190 | // if ( tf.match(app->type()) >= 0 ) { |
191 | // ((LauncherView*)stack->widget(i))->addItem(app); | 191 | // ((LauncherView*)stack->widget(i))->addItem(app); |
192 | // return; | 192 | // return; |
193 | // } | 193 | // } |
194 | // i++; | 194 | // i++; |
195 | // } | 195 | // } |
196 | // } | 196 | // } |
197 | 197 | ||
198 | QCopEnvelope e("QPE/TaskBar","reloadApps()"); | 198 | QCopEnvelope e("QPE/TaskBar","reloadApps()"); |
199 | } | 199 | } |
200 | 200 | ||
201 | void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, | 201 | void CategoryTabWidget::initializeCategories(AppLnkSet* rootFolder, |
202 | AppLnkSet* /*docFolder*/, const QList<FileSystem> & /*fs*/) | 202 | AppLnkSet* /*docFolder*/, const QList<FileSystem> & /*fs*/) |
203 | { | 203 | { |
204 | QString current; | 204 | QString current; |
205 | if ( categoryBar ) { | 205 | if ( categoryBar ) { |
206 | int c = categoryBar->currentTab(); | 206 | int c = categoryBar->currentTab(); |
207 | if ( c >= 0 ) current = ids[c]; | 207 | if ( c >= 0 ) current = ids[c]; |
208 | } | 208 | } |
209 | 209 | ||
210 | delete categoryBar; | 210 | delete categoryBar; |
211 | categoryBar = new CategoryTabBar( this ); | 211 | categoryBar = new CategoryTabBar( this ); |
212 | QPalette pal = categoryBar->palette(); | 212 | QPalette pal = categoryBar->palette(); |
213 | pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); | 213 | pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); |
214 | pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); | 214 | pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); |
215 | categoryBar->setPalette( pal ); | 215 | categoryBar->setPalette( pal ); |
216 | 216 | ||
217 | delete stack; | 217 | delete stack; |
218 | stack = new QWidgetStack(this); | 218 | stack = new QWidgetStack(this); |
219 | tabs=0; | 219 | tabs=0; |
220 | 220 | ||
221 | ids.clear(); | 221 | ids.clear(); |
222 | 222 | ||
223 | Config cfg("Launcher"); | 223 | Config cfg("Launcher"); |
224 | 224 | ||
225 | QStringList types = rootFolder->types(); | 225 | QStringList types = rootFolder->types(); |
226 | for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) { | 226 | for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) { |
227 | if ( !(*it).isEmpty() ) { | 227 | if ( !(*it).isEmpty() ) { |
228 | (void)newView(*it,rootFolder->typePixmap(*it),rootFolder->typeName(*it)); | 228 | (void)newView(*it,rootFolder->typePixmap(*it),rootFolder->typeName(*it)); |
229 | setTabAppearance( *it, cfg ); | 229 | setTabAppearance( *it, cfg ); |
230 | } | 230 | } |
231 | } | 231 | } |
232 | QListIterator<AppLnk> it( rootFolder->children() ); | 232 | QListIterator<AppLnk> it( rootFolder->children() ); |
233 | AppLnk* l; | 233 | AppLnk* l; |
234 | while ( (l=it.current()) ) { | 234 | while ( (l=it.current()) ) { |
235 | if ( l->type() == "Separator" ) { // No tr | 235 | if ( l->type() == "Separator" ) { // No tr |
236 | rootFolder->remove(l); | 236 | rootFolder->remove(l); |
237 | delete l; | 237 | delete l; |
238 | } else { | 238 | } else { |
239 | int i=0; | 239 | int i=0; |
240 | for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) { | 240 | for ( QStringList::Iterator it=types.begin(); it!=types.end(); ++it) { |
241 | if ( *it == l->type() ) | 241 | if ( *it == l->type() ) |
242 | ((LauncherView*)stack->widget(i))->addItem(l,FALSE); | 242 | ((LauncherView*)stack->widget(i))->addItem(l,FALSE); |
243 | i++; | 243 | i++; |
244 | } | 244 | } |
245 | } | 245 | } |
246 | ++it; | 246 | ++it; |
247 | } | 247 | } |
248 | rootFolder->detachChildren(); | 248 | rootFolder->detachChildren(); |
249 | for (int i=0; i<tabs; i++) | 249 | for (int i=0; i<tabs; i++) |
250 | ((LauncherView*)stack->widget(i))->sort(); | 250 | ((LauncherView*)stack->widget(i))->sort(); |
251 | 251 | ||
252 | // all documents | 252 | // all documents |
253 | QImage img( Resource::loadImage( "DocsIcon" ) ); | 253 | QImage img( Resource::loadImage( "DocsIcon" ) ); |
254 | QPixmap pm; | 254 | QPixmap pm; |
255 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); | 255 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); |
256 | 256 | ||
257 | //ljpotter | 257 | //ljpotter |
258 | CategoryTab *catTab ; | 258 | CategoryTab *catTab ; |
259 | catTab = new CategoryTab( pm, "Documents" ); | 259 | catTab = new CategoryTab( pm, "Documents" ); |
260 | 260 | ||
261 | categoryBar->addTab( catTab ); | 261 | categoryBar->addTab( catTab ); |
262 | 262 | ||
263 | fileSel = new DocumentTab( stack, 4, 0, "/",""); | 263 | fileSel = new DocumentTab( stack, 4, 0, "/",""); |
264 | stack->addWidget( fileSel, tabs++ ); | 264 | stack->addWidget( fileSel, tabs++ ); |
265 | 265 | ||
266 | // fileSel->hide(); | 266 | // fileSel->hide(); |
267 | 267 | ||
268 | connect( fileSel, SIGNAL( fileSelected( const DocLnk & )), | 268 | connect( fileSel, SIGNAL( fileSelected( const DocLnk & )), |
269 | this, SLOT(clickie(const DocLnk&)) ); | 269 | this, SLOT(clickie(const DocLnk&)) ); |
270 | 270 | ||
271 | // connect( fileSel, SIGNAL( fileSelected( const QString & )), | 271 | // connect( fileSel, SIGNAL( fileSelected( const QString & )), |
272 | // this, SLOT(clickie(const QString&)) ); | 272 | // this, SLOT(clickie(const QString&)) ); |
273 | 273 | ||
274 | connect( categoryBar, SIGNAL(selected(int)), stack, SLOT(raiseWidget(int)) ); | 274 | connect( categoryBar, SIGNAL(selected(int)), stack, SLOT(raiseWidget(int)) ); |
275 | 275 | ||
276 | ((LauncherView*)stack->widget(0))->setFocus(); | 276 | ((LauncherView*)stack->widget(0))->setFocus(); |
277 | 277 | ||
278 | cfg. setGroup ( "GUI" ); | 278 | cfg. setGroup ( "GUI" ); |
279 | setBusyIndicatorType ( cfg. readEntry ( "BusyType", QString::null )); | 279 | setBusyIndicatorType ( cfg. readEntry ( "BusyType", QString::null )); |
280 | 280 | ||
281 | if ( !current.isNull() ) { | 281 | if ( !current.isNull() ) { |
282 | showTab(current); | 282 | showTab(current); |
283 | } | 283 | } |
284 | 284 | ||
285 | categoryBar->show(); | 285 | categoryBar->show(); |
286 | stack->show(); | 286 | stack->show(); |
287 | 287 | ||
288 | 288 | ||
289 | QCopEnvelope e("QPE/TaskBar","reloadApps()"); | 289 | QCopEnvelope e("QPE/TaskBar","reloadApps()"); |
290 | } | 290 | } |
291 | 291 | ||
292 | void CategoryTabWidget::clickie(const DocLnk &lnk) { | 292 | void CategoryTabWidget::clickie(const DocLnk &lnk) { |
293 | lnk.execute(); | 293 | lnk.execute(); |
294 | // fileSel->reparse(); | 294 | // fileSel->reparse(); |
295 | } | 295 | } |
296 | 296 | ||
297 | void CategoryTabWidget::clickie(const QString &appStr) { | 297 | void CategoryTabWidget::clickie(const QString &appStr) { |
298 | // DocLnk lnk(appStr); | 298 | // DocLnk lnk(appStr); |
299 | // lnk.execute(); | 299 | // lnk.execute(); |
300 | } | 300 | } |
301 | 301 | ||
302 | void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg ) | 302 | void CategoryTabWidget::setTabAppearance( const QString &id, Config &cfg ) |
303 | { | 303 | { |
304 | QString grp( "Tab %1" ); // No tr | 304 | QString grp( "Tab %1" ); // No tr |
305 | cfg.setGroup( grp.arg(id) ); | 305 | cfg.setGroup( grp.arg(id) ); |
306 | LauncherView *v = view( id ); | 306 | LauncherView *v = view( id ); |
307 | int idx = ids.findIndex( id ); | 307 | int idx = ids.findIndex( id ); |
308 | CategoryTab *tab = (CategoryTab *)categoryBar->tab( idx ); | 308 | CategoryTab *tab = (CategoryTab *)categoryBar->tab( idx ); |
309 | 309 | ||
310 | // View | 310 | // View |
311 | QString view = cfg.readEntry( "View", "Icon" ); | 311 | QString view = cfg.readEntry( "View", "Icon" ); |
312 | if ( view == "List" ) // No tr | 312 | if ( view == "List" ) // No tr |
313 | v->setViewMode( LauncherView::List ); | 313 | v->setViewMode( LauncherView::List ); |
314 | QString bgType = cfg.readEntry( "BackgroundType", "Image" ); | 314 | QString bgType = cfg.readEntry( "BackgroundType", "Image" ); |
315 | if ( bgType == "Image" ) { // No tr | 315 | if ( bgType == "Image" ) { // No tr |
316 | QString pm = cfg.readEntry( "BackgroundImage", "launcher/opie-background" ); | 316 | QString pm = cfg.readEntry( "BackgroundImage", "launcher/opie-background" ); |
317 | v->setBackgroundType( LauncherView::Image, pm ); | 317 | v->setBackgroundType( LauncherView::Image, pm ); |
318 | } else if ( bgType == "SolidColor" ) { | 318 | } else if ( bgType == "SolidColor" ) { |
319 | QString c = cfg.readEntry( "BackgroundColor" ); | 319 | QString c = cfg.readEntry( "BackgroundColor" ); |
320 | v->setBackgroundType( LauncherView::SolidColor, c ); | 320 | v->setBackgroundType( LauncherView::SolidColor, c ); |
321 | } | 321 | } |
322 | QString textCol = cfg.readEntry( "TextColor" ); | 322 | QString textCol = cfg.readEntry( "TextColor" ); |
323 | if ( textCol.isEmpty() ) | 323 | if ( textCol.isEmpty() ) |
324 | v->setTextColor( QColor() ); | 324 | v->setTextColor( QColor() ); |
325 | else | 325 | else |
326 | v->setTextColor( QColor(textCol) ); | 326 | v->setTextColor( QColor(textCol) ); |
327 | QStringList font = cfg.readListEntry( "Font", ',' ); | 327 | QStringList font = cfg.readListEntry( "Font", ',' ); |
328 | if ( font.count() == 4 ) | 328 | if ( font.count() == 4 ) |
329 | v->setViewFont( QFont(font[0], font[1].toInt(), font[2].toInt(), font[3].toInt()!=0) ); | 329 | v->setViewFont( QFont(font[0], font[1].toInt(), font[2].toInt(), font[3].toInt()!=0) ); |
330 | 330 | ||
331 | // Tabs | 331 | // Tabs |
332 | QString tabCol = cfg.readEntry( "TabColor" ); | 332 | QString tabCol = cfg.readEntry( "TabColor" ); |
333 | if ( tabCol.isEmpty() ) | 333 | if ( tabCol.isEmpty() ) |
334 | tab->bgColor = QColor(); | 334 | tab->bgColor = QColor(); |
335 | else | 335 | else |
336 | tab->bgColor = QColor(tabCol); | 336 | tab->bgColor = QColor(tabCol); |
337 | QString tabTextCol = cfg.readEntry( "TabTextColor" ); | 337 | QString tabTextCol = cfg.readEntry( "TabTextColor" ); |
338 | if ( tabTextCol.isEmpty() ) | 338 | if ( tabTextCol.isEmpty() ) |
339 | tab->fgColor = QColor(); | 339 | tab->fgColor = QColor(); |
340 | else | 340 | else |
341 | tab->fgColor = QColor(tabTextCol); | 341 | tab->fgColor = QColor(tabTextCol); |
342 | } | 342 | } |
343 | 343 | ||
344 | //void CategoryTabWidget::updateDocs(AppLnkSet* docFolder, const QList<FileSystem> & /*fs*/) | 344 | //void CategoryTabWidget::updateDocs(AppLnkSet* docFolder, const QList<FileSystem> & /*fs*/) |
345 | //{ | 345 | //{ |
346 | // docFolder->detachChildren(); | 346 | // docFolder->detachChildren(); |
347 | //} | 347 | //} |
348 | 348 | ||
349 | void CategoryTabWidget::tabProperties() | 349 | void CategoryTabWidget::tabProperties() |
350 | { | 350 | { |
351 | LauncherView *view = (LauncherView*)stack->widget( categoryBar->currentTab() ); | 351 | LauncherView *view = (LauncherView*)stack->widget( categoryBar->currentTab() ); |
352 | QPopupMenu *m = new QPopupMenu( this ); | 352 | QPopupMenu *m = new QPopupMenu( this ); |
353 | m->insertItem( tr("Icon View"), LauncherView::Icon ); | 353 | m->insertItem( tr("Icon View"), LauncherView::Icon ); |
354 | m->insertItem( tr("List View"), LauncherView::List ); | 354 | m->insertItem( tr("List View"), LauncherView::List ); |
355 | m->setItemChecked( (int)view->viewMode(), TRUE ); | 355 | m->setItemChecked( (int)view->viewMode(), TRUE ); |
356 | int rv = m->exec( QCursor::pos() ); | 356 | int rv = m->exec( QCursor::pos() ); |
357 | if ( rv >= 0 && rv != view->viewMode() ) { | 357 | if ( rv >= 0 && rv != view->viewMode() ) { |
358 | view->setViewMode( (LauncherView::ViewMode)rv ); | 358 | view->setViewMode( (LauncherView::ViewMode)rv ); |
359 | } | 359 | } |
360 | 360 | ||
361 | delete m; | 361 | delete m; |
362 | } | 362 | } |
363 | 363 | ||
364 | QString CategoryTabWidget::getAllDocLinkInfo() const | 364 | QString CategoryTabWidget::getAllDocLinkInfo() const |
365 | { | 365 | { |
366 | return ""; | 366 | return ""; |
367 | } | 367 | } |
368 | 368 | ||
369 | LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label ) | 369 | LauncherView* CategoryTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label ) |
370 | { | 370 | { |
371 | LauncherView* view = new LauncherView( stack ); | 371 | LauncherView* view = new LauncherView( stack ); |
372 | connect( view, SIGNAL(clicked(const AppLnk*)), | 372 | connect( view, SIGNAL(clicked(const AppLnk*)), |
373 | this, SIGNAL(clicked(const AppLnk*))); | 373 | this, SIGNAL(clicked(const AppLnk*))); |
374 | connect( view, SIGNAL(rightPressed(AppLnk*)), | 374 | connect( view, SIGNAL(rightPressed(AppLnk*)), |
375 | this, SIGNAL(rightPressed(AppLnk*))); | 375 | this, SIGNAL(rightPressed(AppLnk*))); |
376 | ids.append(id); | 376 | ids.append(id); |
377 | categoryBar->addTab( new CategoryTab( pm, label ) ); | 377 | categoryBar->addTab( new CategoryTab( pm, label ) ); |
378 | stack->addWidget( view, tabs++ ); | 378 | stack->addWidget( view, tabs++ ); |
379 | return view; | 379 | return view; |
380 | } | 380 | } |
381 | 381 | ||
382 | void CategoryTabWidget::updateLink(const QString& linkfile) | 382 | void CategoryTabWidget::updateLink(const QString& linkfile) |
383 | { | 383 | { |
384 | // LauncherView* view; | 384 | int i=0; |
385 | qApp->processEvents(); | 385 | LauncherView* view; |
386 | // while ((view = (LauncherView*)stack->widget(i++))) { | 386 | //qApp->processEvents(); |
387 | // if ( view->removeLink(linkfile) ) | 387 | while ((view = (LauncherView*)stack->widget(i++))) { |
388 | // break; | 388 | if ( view->removeLink(linkfile) ) |
389 | // } | 389 | break; |
390 | // addItem(linkfile); | 390 | } |
391 | fileSel->reparse(); | 391 | addItem(linkfile); |
392 | docview->updateTools(); | ||
392 | } | 393 | } |
393 | 394 | ||
394 | void CategoryTabWidget::paletteChange( const QPalette &p ) | 395 | void CategoryTabWidget::paletteChange( const QPalette &p ) |
395 | { | 396 | { |
396 | QVBox::paletteChange( p ); | 397 | QVBox::paletteChange( p ); |
397 | QPalette pal = palette(); | 398 | QPalette pal = palette(); |
398 | pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); | 399 | pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); |
399 | pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); | 400 | pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); |
400 | categoryBar->setPalette( pal ); | 401 | categoryBar->setPalette( pal ); |
401 | categoryBar->update(); | 402 | categoryBar->update(); |
402 | } | 403 | } |
403 | 404 | ||
404 | void CategoryTabWidget::setBusy(bool on) | 405 | void CategoryTabWidget::setBusy(bool on) |
405 | { | 406 | { |
406 | if ( on ) | 407 | if ( on ) |
407 | ((LauncherView*)stack->visibleWidget())->setBusy(TRUE); | 408 | ((LauncherView*)stack->visibleWidget())->setBusy(TRUE); |
408 | else | 409 | else |
409 | for (int i=0; i<tabs-1; i++) | 410 | for (int i=0; i<tabs-1; i++) |
410 | ((LauncherView*)stack->widget(i))->setBusy(FALSE); | 411 | ((LauncherView*)stack->widget(i))->setBusy(FALSE); |
411 | } | 412 | } |
412 | 413 | ||
413 | LauncherView *CategoryTabWidget::view( const QString &id ) | 414 | LauncherView *CategoryTabWidget::view( const QString &id ) |
414 | { | 415 | { |
415 | int idx = ids.findIndex( id ); | 416 | int idx = ids.findIndex( id ); |
416 | return (LauncherView *)stack->widget(idx); | 417 | return (LauncherView *)stack->widget(idx); |
417 | } | 418 | } |
418 | 419 | ||
419 | void CategoryTabWidget::setBusyIndicatorType ( const QString &type ) | 420 | void CategoryTabWidget::setBusyIndicatorType ( const QString &type ) |
420 | { | 421 | { |
421 | for ( QStringList::Iterator it = ids. begin ( ); it != ids. end ( ); ++it ) | 422 | for ( QStringList::Iterator it = ids. begin ( ); it != ids. end ( ); ++it ) |
422 | view ( *it )-> setBusyIndicatorType ( type ); | 423 | view ( *it )-> setBusyIndicatorType ( type ); |
423 | } | 424 | } |
424 | 425 | ||
425 | //=========================================================================== | 426 | //=========================================================================== |
426 | 427 | ||
427 | CategoryTabBar::CategoryTabBar( QWidget *parent, const char *name ) | 428 | CategoryTabBar::CategoryTabBar( QWidget *parent, const char *name ) |
428 | : QTabBar( parent, name ) | 429 | : QTabBar( parent, name ) |
429 | { | 430 | { |
430 | setFocusPolicy( NoFocus ); | 431 | setFocusPolicy( NoFocus ); |
431 | connect( this, SIGNAL( selected(int) ), this, SLOT( layoutTabs() ) ); | 432 | connect( this, SIGNAL( selected(int) ), this, SLOT( layoutTabs() ) ); |
432 | } | 433 | } |
433 | 434 | ||
434 | CategoryTabBar::~CategoryTabBar() | 435 | CategoryTabBar::~CategoryTabBar() |
435 | { | 436 | { |
436 | } | 437 | } |
437 | 438 | ||
438 | void CategoryTabBar::layoutTabs() | 439 | void CategoryTabBar::layoutTabs() |
439 | { | 440 | { |
440 | if ( !count() ) | 441 | if ( !count() ) |
441 | return; | 442 | return; |
442 | 443 | ||
443 | // int percentFalloffTable[] = { 100, 70, 40, 12, 6, 3, 1, 0 }; | 444 | // int percentFalloffTable[] = { 100, 70, 40, 12, 6, 3, 1, 0 }; |
444 | int available = width()-1; | 445 | int available = width()-1; |
445 | QFontMetrics fm = fontMetrics(); | 446 | QFontMetrics fm = fontMetrics(); |
446 | int hiddenTabWidth = -7; | 447 | int hiddenTabWidth = -7; |
447 | int middleTab = currentTab(); | 448 | int middleTab = currentTab(); |
448 | int hframe, vframe, overlap; | 449 | int hframe, vframe, overlap; |
449 | style().tabbarMetrics( this, hframe, vframe, overlap ); | 450 | style().tabbarMetrics( this, hframe, vframe, overlap ); |
450 | int x = 0; | 451 | int x = 0; |
451 | QRect r; | 452 | QRect r; |
452 | QTab *t; | 453 | QTab *t; |
453 | int required = 0; | 454 | int required = 0; |
454 | int eventabwidth = (width()-1)/count(); | 455 | int eventabwidth = (width()-1)/count(); |
455 | enum Mode { HideBackText, Pack, Even } mode=Even; | 456 | enum Mode { HideBackText, Pack, Even } mode=Even; |
456 | for ( int i = 0; i < count(); i++ ) { | 457 | for ( int i = 0; i < count(); i++ ) { |
457 | t = tab(i); | 458 | t = tab(i); |
458 | int iw = fm.width( t->text() ) + hframe - overlap; | 459 | int iw = fm.width( t->text() ) + hframe - overlap; |
459 | if ( i != middleTab ) { | 460 | if ( i != middleTab ) { |
460 | available -= hiddenTabWidth + hframe - overlap; | 461 | available -= hiddenTabWidth + hframe - overlap; |
461 | if ( t->iconSet() != 0 ) | 462 | if ( t->iconSet() != 0 ) |
462 | available -= t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); | 463 | available -= t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); |
463 | } | 464 | } |
464 | if ( t->iconSet() != 0 ) | 465 | if ( t->iconSet() != 0 ) |
465 | iw += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); | 466 | iw += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); |
466 | required += iw; | 467 | required += iw; |
467 | // As space gets tight, packed looks better than even. "10" must be at least 0. | 468 | // As space gets tight, packed looks better than even. "10" must be at least 0. |
468 | if ( iw >= eventabwidth-10 ) | 469 | if ( iw >= eventabwidth-10 ) |
469 | mode = Pack; | 470 | mode = Pack; |
470 | } | 471 | } |
471 | if ( mode == Pack && required > width()-1 ) | 472 | if ( mode == Pack && required > width()-1 ) |
472 | mode = HideBackText; | 473 | mode = HideBackText; |
473 | for ( int i = 0; i < count(); i++ ) { | 474 | for ( int i = 0; i < count(); i++ ) { |
474 | t = tab(i); | 475 | t = tab(i); |
475 | if ( mode != HideBackText ) { | 476 | if ( mode != HideBackText ) { |
476 | int w = fm.width( t->text() ); | 477 | int w = fm.width( t->text() ); |
477 | int ih = 0; | 478 | int ih = 0; |
478 | if ( t->iconSet() != 0 ) { | 479 | if ( t->iconSet() != 0 ) { |
479 | w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); | 480 | w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); |
480 | ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); | 481 | ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); |
481 | } | 482 | } |
482 | int h = QMAX( fm.height(), ih ); | 483 | int h = QMAX( fm.height(), ih ); |
483 | h = QMAX( h, QApplication::globalStrut().height() ); | 484 | h = QMAX( h, QApplication::globalStrut().height() ); |
484 | 485 | ||
485 | h += vframe; | 486 | h += vframe; |
486 | w += hframe; | 487 | w += hframe; |
487 | 488 | ||
488 | QRect tr(x, 0, | 489 | QRect tr(x, 0, |
489 | mode == Even ? eventabwidth : w * (width()-1)/required, h); | 490 | mode == Even ? eventabwidth : w * (width()-1)/required, h); |
490 | t->setRect(tr); | 491 | t->setRect(tr); |
491 | x += tr.width() - overlap; | 492 | x += tr.width() - overlap; |
492 | r = r.unite(tr); | 493 | r = r.unite(tr); |
493 | } else if ( i != middleTab ) { | 494 | } else if ( i != middleTab ) { |
494 | int w = hiddenTabWidth; | 495 | int w = hiddenTabWidth; |
495 | int ih = 0; | 496 | int ih = 0; |
496 | if ( t->iconSet() != 0 ) { | 497 | if ( t->iconSet() != 0 ) { |
497 | w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); | 498 | w += t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width(); |
498 | ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); | 499 | ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); |
499 | } | 500 | } |
500 | int h = QMAX( fm.height(), ih ); | 501 | int h = QMAX( fm.height(), ih ); |
501 | h = QMAX( h, QApplication::globalStrut().height() ); | 502 | h = QMAX( h, QApplication::globalStrut().height() ); |
502 | 503 | ||
503 | h += vframe; | 504 | h += vframe; |
504 | w += hframe; | 505 | w += hframe; |
505 | 506 | ||
506 | t->setRect( QRect(x, 0, w, h) ); | 507 | t->setRect( QRect(x, 0, w, h) ); |
507 | x += t->rect().width() - overlap; | 508 | x += t->rect().width() - overlap; |
508 | r = r.unite( t->rect() ); | 509 | r = r.unite( t->rect() ); |
509 | } else { | 510 | } else { |
510 | int ih = 0; | 511 | int ih = 0; |
511 | if ( t->iconSet() != 0 ) { | 512 | if ( t->iconSet() != 0 ) { |
512 | ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); | 513 | ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); |
513 | } | 514 | } |
514 | int h = QMAX( fm.height(), ih ); | 515 | int h = QMAX( fm.height(), ih ); |
515 | h = QMAX( h, QApplication::globalStrut().height() ); | 516 | h = QMAX( h, QApplication::globalStrut().height() ); |
516 | 517 | ||
517 | h += vframe; | 518 | h += vframe; |
518 | 519 | ||
519 | t->setRect( QRect(x, 0, available, h) ); | 520 | t->setRect( QRect(x, 0, available, h) ); |
520 | x += t->rect().width() - overlap; | 521 | x += t->rect().width() - overlap; |
521 | r = r.unite( t->rect() ); | 522 | r = r.unite( t->rect() ); |
522 | } | 523 | } |
523 | } | 524 | } |
524 | 525 | ||
525 | QRect rr = tab(count()-1)->rect(); | 526 | QRect rr = tab(count()-1)->rect(); |
526 | rr.setRight(width()-1); | 527 | rr.setRight(width()-1); |
527 | tab(count()-1)->setRect( rr ); | 528 | tab(count()-1)->setRect( rr ); |
528 | 529 | ||
529 | for ( t = tabList()->first(); t; t = tabList()->next() ) { | 530 | for ( t = tabList()->first(); t; t = tabList()->next() ) { |
530 | QRect tr = t->rect(); | 531 | QRect tr = t->rect(); |
531 | tr.setHeight( r.height() ); | 532 | tr.setHeight( r.height() ); |
532 | t->setRect( tr ); | 533 | t->setRect( tr ); |
533 | } | 534 | } |
534 | 535 | ||
535 | update(); | 536 | update(); |
536 | } | 537 | } |
537 | 538 | ||
538 | 539 | ||
539 | void CategoryTabBar::paint( QPainter * p, QTab * t, bool selected ) const | 540 | void CategoryTabBar::paint( QPainter * p, QTab * t, bool selected ) const |
540 | { | 541 | { |
541 | CategoryTabBar *that = (CategoryTabBar *) this; | 542 | CategoryTabBar *that = (CategoryTabBar *) this; |
542 | CategoryTab *ct = (CategoryTab *)t; | 543 | CategoryTab *ct = (CategoryTab *)t; |
543 | QPalette pal = palette(); | 544 | QPalette pal = palette(); |
544 | bool setPal = FALSE; | 545 | bool setPal = FALSE; |
545 | if ( ct->bgColor.isValid() ) { | 546 | if ( ct->bgColor.isValid() ) { |
546 | pal.setColor( QPalette::Active, QColorGroup::Background, ct->bgColor ); | 547 | pal.setColor( QPalette::Active, QColorGroup::Background, ct->bgColor ); |
547 | pal.setColor( QPalette::Active, QColorGroup::Button, ct->bgColor ); | 548 | pal.setColor( QPalette::Active, QColorGroup::Button, ct->bgColor ); |
548 | pal.setColor( QPalette::Inactive, QColorGroup::Background, ct->bgColor ); | 549 | pal.setColor( QPalette::Inactive, QColorGroup::Background, ct->bgColor ); |
549 | pal.setColor( QPalette::Inactive, QColorGroup::Button, ct->bgColor ); | 550 | pal.setColor( QPalette::Inactive, QColorGroup::Button, ct->bgColor ); |
550 | that->setUpdatesEnabled( FALSE ); | 551 | that->setUpdatesEnabled( FALSE ); |
551 | that->setPalette( pal ); | 552 | that->setPalette( pal ); |
552 | setPal = TRUE; | 553 | setPal = TRUE; |
553 | } | 554 | } |
554 | #if QT_VERSION >= 300 | 555 | #if QT_VERSION >= 300 |
555 | QStyle::SFlags flags = QStyle::Style_Default; | 556 | QStyle::SFlags flags = QStyle::Style_Default; |
556 | if ( selected ) | 557 | if ( selected ) |
557 | flags |= QStyle::Style_Selected; | 558 | flags |= QStyle::Style_Selected; |
558 | style().drawControl( QStyle::CE_TabBarTab, p, this, t->rect(), | 559 | style().drawControl( QStyle::CE_TabBarTab, p, this, t->rect(), |
559 | colorGroup(), flags, QStyleOption(t) ); | 560 | colorGroup(), flags, QStyleOption(t) ); |
560 | #else | 561 | #else |
561 | style().drawTab( p, this, t, selected ); | 562 | style().drawTab( p, this, t, selected ); |
562 | #endif | 563 | #endif |
563 | 564 | ||
564 | QRect r( t->rect() ); | 565 | QRect r( t->rect() ); |
565 | QFont f( font() ); | 566 | QFont f( font() ); |
566 | if ( selected ) | 567 | if ( selected ) |
567 | f.setBold( TRUE ); | 568 | f.setBold( TRUE ); |
568 | p->setFont( f ); | 569 | p->setFont( f ); |
569 | 570 | ||
570 | if ( ct->fgColor.isValid() ) { | 571 | if ( ct->fgColor.isValid() ) { |
571 | pal.setColor( QPalette::Active, QColorGroup::Foreground, ct->fgColor ); | 572 | pal.setColor( QPalette::Active, QColorGroup::Foreground, ct->fgColor ); |
572 | pal.setColor( QPalette::Inactive, QColorGroup::Foreground, ct->fgColor ); | 573 | pal.setColor( QPalette::Inactive, QColorGroup::Foreground, ct->fgColor ); |
573 | that->setUpdatesEnabled( FALSE ); | 574 | that->setUpdatesEnabled( FALSE ); |
574 | that->setPalette( pal ); | 575 | that->setPalette( pal ); |
575 | setPal = TRUE; | 576 | setPal = TRUE; |
576 | } | 577 | } |
577 | int iw = 0; | 578 | int iw = 0; |
578 | int ih = 0; | 579 | int ih = 0; |
579 | if ( t->iconSet() != 0 ) { | 580 | if ( t->iconSet() != 0 ) { |
580 | iw = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width() + 2; | 581 | iw = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).width() + 2; |
581 | ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); | 582 | ih = t->iconSet()->pixmap( QIconSet::Small, QIconSet::Normal ).height(); |
582 | } | 583 | } |
583 | int w = iw + p->fontMetrics().width( t->text() ) + 4; | 584 | int w = iw + p->fontMetrics().width( t->text() ) + 4; |
584 | int h = QMAX(p->fontMetrics().height() + 4, ih ); | 585 | int h = QMAX(p->fontMetrics().height() + 4, ih ); |
585 | paintLabel( p, QRect( r.left() + (r.width()-w)/2 - 3, | 586 | paintLabel( p, QRect( r.left() + (r.width()-w)/2 - 3, |
586 | r.top() + (r.height()-h)/2, w, h ), t, | 587 | r.top() + (r.height()-h)/2, w, h ), t, |
587 | #if QT_VERSION >= 300 | 588 | #if QT_VERSION >= 300 |
588 | t->identifier() == keyboardFocusTab() | 589 | t->identifier() == keyboardFocusTab() |
589 | #else | 590 | #else |
590 | t->identitifer() == keyboardFocusTab() | 591 | t->identitifer() == keyboardFocusTab() |
591 | #endif | 592 | #endif |
592 | ); | 593 | ); |
593 | if ( setPal ) { | 594 | if ( setPal ) { |
594 | that->unsetPalette(); | 595 | that->unsetPalette(); |
595 | that->setUpdatesEnabled( TRUE ); | 596 | that->setUpdatesEnabled( TRUE ); |
596 | } | 597 | } |
597 | } | 598 | } |
598 | 599 | ||
599 | 600 | ||
600 | void CategoryTabBar::paintLabel( QPainter* p, const QRect&, | 601 | void CategoryTabBar::paintLabel( QPainter* p, const QRect&, |
601 | QTab* t, bool has_focus ) const | 602 | QTab* t, bool has_focus ) const |
602 | { | 603 | { |
603 | QRect r = t->rect(); | 604 | QRect r = t->rect(); |
604 | // if ( t->id != currentTab() ) | 605 | // if ( t->id != currentTab() ) |
605 | //r.moveBy( 1, 1 ); | 606 | //r.moveBy( 1, 1 ); |
606 | // | 607 | // |
607 | if ( t->iconSet() ) { | 608 | if ( t->iconSet() ) { |
608 | // the tab has an iconset, draw it in the right mode | 609 | // the tab has an iconset, draw it in the right mode |
609 | QIconSet::Mode mode = (t->isEnabled() && isEnabled()) ? QIconSet::Normal : QIconSet::Disabled; | 610 | QIconSet::Mode mode = (t->isEnabled() && isEnabled()) ? QIconSet::Normal : QIconSet::Disabled; |
610 | if ( mode == QIconSet::Normal && has_focus ) | 611 | if ( mode == QIconSet::Normal && has_focus ) |
611 | mode = QIconSet::Active; | 612 | mode = QIconSet::Active; |
612 | QPixmap pixmap = t->iconSet()->pixmap( QIconSet::Small, mode ); | 613 | QPixmap pixmap = t->iconSet()->pixmap( QIconSet::Small, mode ); |
613 | int pixw = pixmap.width(); | 614 | int pixw = pixmap.width(); |
614 | int pixh = pixmap.height(); | 615 | int pixh = pixmap.height(); |
615 | p->drawPixmap( r.left() + 6, r.center().y() - pixh / 2 + 1, pixmap ); | 616 | p->drawPixmap( r.left() + 6, r.center().y() - pixh / 2 + 1, pixmap ); |
616 | r.setLeft( r.left() + pixw + 5 ); | 617 | r.setLeft( r.left() + pixw + 5 ); |
617 | } | 618 | } |
618 | 619 | ||
619 | QRect tr = r; | 620 | QRect tr = r; |
620 | 621 | ||
621 | if ( r.width() < 20 ) | 622 | if ( r.width() < 20 ) |
622 | return; | 623 | return; |
623 | 624 | ||
624 | if ( t->isEnabled() && isEnabled() ) { | 625 | if ( t->isEnabled() && isEnabled() ) { |
625 | #if defined(_WS_WIN32_) | 626 | #if defined(_WS_WIN32_) |
626 | if ( colorGroup().brush( QColorGroup::Button ) == colorGroup().brush( QColorGroup::Background ) ) | 627 | if ( colorGroup().brush( QColorGroup::Button ) == colorGroup().brush( QColorGroup::Background ) ) |
627 | p->setPen( colorGroup().buttonText() ); | 628 | p->setPen( colorGroup().buttonText() ); |
628 | else | 629 | else |
629 | p->setPen( colorGroup().foreground() ); | 630 | p->setPen( colorGroup().foreground() ); |
630 | #else | 631 | #else |
631 | p->setPen( colorGroup().foreground() ); | 632 | p->setPen( colorGroup().foreground() ); |
632 | #endif | 633 | #endif |
633 | p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() ); | 634 | p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() ); |
634 | } else { | 635 | } else { |
635 | p->setPen( palette().disabled().foreground() ); | 636 | p->setPen( palette().disabled().foreground() ); |
636 | p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() ); | 637 | p->drawText( tr, AlignCenter | AlignVCenter | ShowPrefix, t->text() ); |
637 | } | 638 | } |
638 | } | 639 | } |
639 | 640 | ||
640 | //--------------------------------------------------------------------------- | 641 | //--------------------------------------------------------------------------- |
641 | 642 | ||
642 | Launcher::Launcher( QWidget* parent, const char* name, WFlags fl ) | 643 | Launcher::Launcher( QWidget* parent, const char* name, WFlags fl ) |
643 | : QMainWindow( parent, name, fl ) | 644 | : QMainWindow( parent, name, fl ) |
644 | { | 645 | { |
645 | setCaption( tr("Launcher") ); | 646 | setCaption( tr("Launcher") ); |
646 | 647 | ||
647 | syncDialog = 0; | 648 | syncDialog = 0; |
648 | 649 | ||
649 | // we have a pretty good idea how big we'll be | 650 | // we have a pretty good idea how big we'll be |
650 | setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() ); | 651 | setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() ); |
651 | 652 | ||
652 | tabs = 0; | 653 | tabs = 0; |
653 | rootFolder = 0; | 654 | rootFolder = 0; |
654 | docsFolder = 0; | 655 | docsFolder = 0; |
655 | 656 | ||
656 | int stamp = uidgen.generate(); // this is our timestamp to see which devices we know | 657 | int stamp = uidgen.generate(); // this is our timestamp to see which devices we know |
657 | //uidgen.store( stamp ); | 658 | //uidgen.store( stamp ); |
658 | m_timeStamp = QString::number( stamp ); | 659 | m_timeStamp = QString::number( stamp ); |
659 | 660 | ||
660 | tabs = new CategoryTabWidget( this ); | 661 | tabs = new CategoryTabWidget( this ); |
661 | setCentralWidget( tabs ); | 662 | setCentralWidget( tabs ); |
662 | 663 | ||
663 | connect( tabs, SIGNAL(selected(const QString&)), | 664 | connect( tabs, SIGNAL(selected(const QString&)), |
664 | this, SLOT(viewSelected(const QString&)) ); | 665 | this, SLOT(viewSelected(const QString&)) ); |
665 | connect( tabs, SIGNAL(clicked(const AppLnk*)), | 666 | connect( tabs, SIGNAL(clicked(const AppLnk*)), |
666 | this, SLOT(select(const AppLnk*))); | 667 | this, SLOT(select(const AppLnk*))); |
667 | connect( tabs, SIGNAL(rightPressed(AppLnk*)), | 668 | connect( tabs, SIGNAL(rightPressed(AppLnk*)), |
668 | this, SLOT(properties(AppLnk*))); | 669 | this, SLOT(properties(AppLnk*))); |
669 | 670 | ||
670 | 671 | ||
671 | #if !defined(QT_NO_COP) | 672 | #if !defined(QT_NO_COP) |
672 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); | 673 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); |
673 | connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), | 674 | connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), |
674 | this, SLOT(systemMessage( const QCString &, const QByteArray &)) ); | 675 | this, SLOT(systemMessage( const QCString &, const QByteArray &)) ); |
675 | QCopChannel *channel = new QCopChannel( "QPE/Launcher", this ); | 676 | QCopChannel *channel = new QCopChannel( "QPE/Launcher", this ); |
676 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 677 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
677 | this, SLOT(launcherMessage(const QCString&, const QByteArray&)) ); | 678 | this, SLOT(launcherMessage(const QCString&, const QByteArray&)) ); |
678 | #endif | 679 | #endif |
679 | 680 | ||
680 | storage = new StorageInfo( this ); | 681 | storage = new StorageInfo( this ); |
681 | connect( storage, SIGNAL( disksChanged() ), SLOT( storageChanged() ) ); | 682 | connect( storage, SIGNAL( disksChanged() ), SLOT( storageChanged() ) ); |
682 | 683 | ||
683 | updateTabs(); | 684 | updateTabs(); |
684 | 685 | ||
685 | preloadApps(); | 686 | preloadApps(); |
686 | 687 | ||
687 | in_lnk_props = FALSE; | 688 | in_lnk_props = FALSE; |
688 | got_lnk_change = FALSE; | 689 | got_lnk_change = FALSE; |
689 | } | 690 | } |
690 | 691 | ||
691 | Launcher::~Launcher() | 692 | Launcher::~Launcher() |
692 | { | 693 | { |
693 | delete rootFolder; | 694 | delete rootFolder; |
694 | delete docsFolder; | 695 | delete docsFolder; |
695 | } | 696 | } |
696 | 697 | ||
697 | static bool isVisibleWindow(int wid) | 698 | static bool isVisibleWindow(int wid) |
698 | { | 699 | { |
699 | #ifdef QWS | 700 | #ifdef QWS |
700 | const QList<QWSWindow> &list = qwsServer->clientWindows(); | 701 | const QList<QWSWindow> &list = qwsServer->clientWindows(); |
701 | QWSWindow* w; | 702 | QWSWindow* w; |
702 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { | 703 | for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { |
703 | if ( w->winId() == wid ) | 704 | if ( w->winId() == wid ) |
704 | return !w->isFullyObscured(); | 705 | return !w->isFullyObscured(); |
705 | } | 706 | } |
706 | #endif | 707 | #endif |
707 | return FALSE; | 708 | return FALSE; |
708 | } | 709 | } |
709 | 710 | ||
710 | void Launcher::showMaximized() | 711 | void Launcher::showMaximized() |
711 | { | 712 | { |
712 | if ( isVisibleWindow( winId() ) ) | 713 | if ( isVisibleWindow( winId() ) ) |
713 | doMaximize(); | 714 | doMaximize(); |
714 | else | 715 | else |
715 | QTimer::singleShot( 20, this, SLOT(doMaximize()) ); | 716 | QTimer::singleShot( 20, this, SLOT(doMaximize()) ); |
716 | } | 717 | } |
717 | 718 | ||
718 | void Launcher::doMaximize() | 719 | void Launcher::doMaximize() |
719 | { | 720 | { |
720 | QMainWindow::showMaximized(); | 721 | QMainWindow::showMaximized(); |
721 | tabs->setMaximumWidth( qApp->desktop()->width() ); | 722 | tabs->setMaximumWidth( qApp->desktop()->width() ); |
722 | } | 723 | } |
723 | 724 | ||
724 | void Launcher::updateMimeTypes() | 725 | void Launcher::updateMimeTypes() |
725 | { | 726 | { |
726 | MimeType::clear(); | 727 | MimeType::clear(); |
727 | updateMimeTypes(rootFolder); | 728 | updateMimeTypes(rootFolder); |
728 | } | 729 | } |
729 | 730 | ||
730 | void Launcher::updateMimeTypes(AppLnkSet* folder) | 731 | void Launcher::updateMimeTypes(AppLnkSet* folder) |
731 | { | 732 | { |
732 | for ( QListIterator<AppLnk> it( folder->children() ); it.current(); ++it ) { | 733 | for ( QListIterator<AppLnk> it( folder->children() ); it.current(); ++it ) { |
733 | AppLnk *app = it.current(); | 734 | AppLnk *app = it.current(); |
734 | if ( app->type() == "Folder" ) // No tr | 735 | if ( app->type() == "Folder" ) // No tr |
735 | updateMimeTypes((AppLnkSet *)app); | 736 | updateMimeTypes((AppLnkSet *)app); |
736 | else { | 737 | else { |
737 | MimeType::registerApp(*app); | 738 | MimeType::registerApp(*app); |
738 | } | 739 | } |
739 | } | 740 | } |
740 | } | 741 | } |
741 | 742 | ||
742 | /** This is a HACK.... | 743 | /** This is a HACK.... |
743 | * Reason: scanning huge mediums, microdirvers for examples | 744 | * Reason: scanning huge mediums, microdirvers for examples |
744 | * consomes time. To avoid that we invented the MediumMountCheck | 745 | * consomes time. To avoid that we invented the MediumMountCheck |
745 | * | 746 | * |
746 | * a) the user globally disabled medium checking. We can ignore | 747 | * a) the user globally disabled medium checking. We can ignore |
747 | * all removable medium | 748 | * all removable medium |
748 | * b) the user enabled medium checking globally and we need to use this mimefilter | 749 | * b) the user enabled medium checking globally and we need to use this mimefilter |
749 | * c) the user enabled medium checking on a per medium bases | 750 | * c) the user enabled medium checking on a per medium bases |
750 | * c1) we already checked and its not ask again turns | 751 | * c1) we already checked and its not ask again turns |
751 | * c2) we need to ask and then apply the mimefilter | 752 | * c2) we need to ask and then apply the mimefilter |
752 | */ | 753 | */ |
753 | void Launcher::loadDocs() // ok here comes a hack belonging to Global:: | 754 | void Launcher::loadDocs() // ok here comes a hack belonging to Global:: |
754 | { | 755 | { |
755 | OWait *owait = new OWait(); | 756 | OWait *owait = new OWait(); |
756 | Global::statusMessage( tr( "Finding documents" ) ); | 757 | Global::statusMessage( tr( "Finding documents" ) ); |
757 | 758 | ||
758 | owait->show(); | 759 | owait->show(); |
759 | qApp->processEvents(); | 760 | qApp->processEvents(); |
760 | if(docsFolder) delete docsFolder; | 761 | if(docsFolder) delete docsFolder; |
761 | docsFolder = new DocLnkSet; | 762 | docsFolder = new DocLnkSet; |
762 | DocLnkSet *tmp = 0; | 763 | DocLnkSet *tmp = 0; |
763 | QString home = QString(getenv("HOME")) + "/Documents"; | 764 | QString home = QString(getenv("HOME")) + "/Documents"; |
764 | tmp = new DocLnkSet( home , QString::null); | 765 | tmp = new DocLnkSet( home , QString::null); |
765 | docsFolder->appendFrom( *tmp ); | 766 | docsFolder->appendFrom( *tmp ); |
766 | delete tmp; | 767 | delete tmp; |
767 | 768 | ||
768 | // RAM documents | 769 | // RAM documents |
769 | StorageInfo storage; | 770 | StorageInfo storage; |
770 | const QList<FileSystem> &fileSystems = storage.fileSystems(); | 771 | const QList<FileSystem> &fileSystems = storage.fileSystems(); |
771 | QListIterator<FileSystem> it ( fileSystems ); | 772 | QListIterator<FileSystem> it ( fileSystems ); |
772 | 773 | ||
773 | for ( ; it.current(); ++it ) { | 774 | for ( ; it.current(); ++it ) { |
774 | if ( (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs" ) { | 775 | if ( (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs" ) { |
775 | tmp = new DocLnkSet( (*it)->path(), QString::null ); | 776 | tmp = new DocLnkSet( (*it)->path(), QString::null ); |
776 | docsFolder->appendFrom( *tmp ); | 777 | docsFolder->appendFrom( *tmp ); |
777 | delete tmp; | 778 | delete tmp; |
778 | } | 779 | } |
779 | } | 780 | } |
780 | 781 | ||
781 | Config mediumCfg( "medium"); | 782 | Config mediumCfg( "medium"); |
782 | mediumCfg.setGroup("main"); | 783 | mediumCfg.setGroup("main"); |
783 | // a) -zecke we don't want to check | 784 | // a) -zecke we don't want to check |
784 | if(!mediumCfg.readBoolEntry("use", true ) ) { | 785 | if(!mediumCfg.readBoolEntry("use", true ) ) { |
785 | owait->hide(); | 786 | owait->hide(); |
786 | delete owait; | 787 | delete owait; |
787 | return; | 788 | return; |
788 | } | 789 | } |
789 | // find out wich filesystems are new in this round | 790 | // find out wich filesystems are new in this round |
790 | // We will do this by having a timestamp inside each mountpoint | 791 | // We will do this by having a timestamp inside each mountpoint |
791 | // if the current timestamp doesn't match this is a new file system and | 792 | // if the current timestamp doesn't match this is a new file system and |
792 | // come up with our MediumMountGui :) let the hacking begin | 793 | // come up with our MediumMountGui :) let the hacking begin |
793 | int stamp = uidgen.generate(); | 794 | int stamp = uidgen.generate(); |
794 | 795 | ||
795 | QString newStamp = QString::number( stamp ); // generates newtime Stamp | 796 | QString newStamp = QString::number( stamp ); // generates newtime Stamp |
796 | 797 | ||
797 | // b) | 798 | // b) |
798 | if( mediumCfg.readBoolEntry("global", true ) ){ | 799 | if( mediumCfg.readBoolEntry("global", true ) ){ |
799 | QString mime = configToMime(&mediumCfg).join(";"); | 800 | QString mime = configToMime(&mediumCfg).join(";"); |
800 | for( it.toFirst(); it.current(); ++it ){ | 801 | for( it.toFirst(); it.current(); ++it ){ |
801 | if( (*it)->isRemovable() ){ | 802 | if( (*it)->isRemovable() ){ |
802 | tmp = new DocLnkSet( (*it)->path(), mime ); | 803 | tmp = new DocLnkSet( (*it)->path(), mime ); |
803 | docsFolder->appendFrom( *tmp ); | 804 | docsFolder->appendFrom( *tmp ); |
804 | delete tmp; | 805 | delete tmp; |
805 | } | 806 | } |
806 | } // done | 807 | } // done |
807 | owait->hide(); | 808 | owait->hide(); |
808 | delete owait; | 809 | delete owait; |
809 | return; // save the else | 810 | return; // save the else |
810 | } | 811 | } |
811 | // c) zecke | 812 | // c) zecke |
812 | for ( it.toFirst(); it.current(); ++it ) { | 813 | for ( it.toFirst(); it.current(); ++it ) { |
813 | if ( (*it)->isRemovable() ) { // let's find out if we should search on it | 814 | if ( (*it)->isRemovable() ) { // let's find out if we should search on it |
814 | Config cfg( (*it)->path() + "/.opiestorage.cf", Config::File); | 815 | Config cfg( (*it)->path() + "/.opiestorage.cf", Config::File); |
815 | cfg.setGroup("main"); | 816 | cfg.setGroup("main"); |
816 | QString stamp = cfg.readEntry("timestamp", QDateTime::currentDateTime().toString() ); | 817 | QString stamp = cfg.readEntry("timestamp", QDateTime::currentDateTime().toString() ); |
817 | /** This medium is uptodate | 818 | /** This medium is uptodate |
818 | */ | 819 | */ |
819 | if( stamp == m_timeStamp ){ // ok we know this card | 820 | if( stamp == m_timeStamp ){ // ok we know this card |
820 | cfg.writeEntry("timestamp", newStamp ); //just write a new timestamp | 821 | cfg.writeEntry("timestamp", newStamp ); //just write a new timestamp |
821 | // we need to scan the list now. Hopefully the cache will be there | 822 | // we need to scan the list now. Hopefully the cache will be there |
822 | // read the mimetypes from the config and search for documents | 823 | // read the mimetypes from the config and search for documents |
823 | QStringList mimetypes = configToMime( &cfg); | 824 | QStringList mimetypes = configToMime( &cfg); |
824 | //qApp->processEvents(); | 825 | //qApp->processEvents(); |
825 | Global::statusMessage( tr( "Searching documents" ) ); | 826 | Global::statusMessage( tr( "Searching documents" ) ); |
826 | tmp = new DocLnkSet( (*it)->path(), mimetypes.join(";") ); | 827 | tmp = new DocLnkSet( (*it)->path(), mimetypes.join(";") ); |
827 | docsFolder->appendFrom( *tmp ); | 828 | docsFolder->appendFrom( *tmp ); |
828 | delete tmp; | 829 | delete tmp; |
829 | 830 | ||
830 | } else { // come up with the gui cause this a new card | 831 | } else { // come up with the gui cause this a new card |
831 | MediumMountGui medium(&cfg, (*it)->path() ); | 832 | MediumMountGui medium(&cfg, (*it)->path() ); |
832 | if( medium.check() ){ // we did not ask before or ask again is off | 833 | if( medium.check() ){ // we did not ask before or ask again is off |
833 | /** c2) */ | 834 | /** c2) */ |
834 | if( medium.exec() ){ // he clicked yes so search it | 835 | if( medium.exec() ){ // he clicked yes so search it |
835 | // speicher | 836 | // speicher |
836 | //cfg.read(); // cause of a race we need to reread - fixed | 837 | //cfg.read(); // cause of a race we need to reread - fixed |
837 | cfg.setGroup("main"); | 838 | cfg.setGroup("main"); |
838 | cfg.writeEntry("timestamp", newStamp ); | 839 | cfg.writeEntry("timestamp", newStamp ); |
839 | cfg.write(); | 840 | cfg.write(); |
840 | 841 | ||
841 | //qApp->processEvents(); | 842 | //qApp->processEvents(); |
842 | tmp = new DocLnkSet( (*it)->path(), medium.mimeTypes().join(";" ) ); | 843 | tmp = new DocLnkSet( (*it)->path(), medium.mimeTypes().join(";" ) ); |
843 | docsFolder->appendFrom( *tmp ); | 844 | docsFolder->appendFrom( *tmp ); |
844 | delete tmp; | 845 | delete tmp; |
845 | }// no else | 846 | }// no else |
846 | /** c1) */ | 847 | /** c1) */ |
847 | } else { // we checked | 848 | } else { // we checked |
848 | // do something different see what we need to do | 849 | // do something different see what we need to do |
849 | // let's see if we should check the device | 850 | // let's see if we should check the device |
850 | cfg.setGroup("main" ); | 851 | cfg.setGroup("main" ); |
851 | bool check = cfg.readBoolEntry("autocheck", true ); | 852 | bool check = cfg.readBoolEntry("autocheck", true ); |
852 | if( check ){ // find the documents | 853 | if( check ){ // find the documents |
853 | 854 | ||
854 | //qApp->processEvents(); | 855 | //qApp->processEvents(); |
855 | Global::statusMessage( tr( "Searching documents" ) ); | 856 | Global::statusMessage( tr( "Searching documents" ) ); |
856 | tmp = new DocLnkSet( (*it)->path(), configToMime(&cfg ).join(";") ); | 857 | tmp = new DocLnkSet( (*it)->path(), configToMime(&cfg ).join(";") ); |
857 | docsFolder->appendFrom( *tmp ); | 858 | docsFolder->appendFrom( *tmp ); |
858 | delete tmp; | 859 | delete tmp; |
859 | } | 860 | } |
860 | } | 861 | } |
861 | } | 862 | } |
862 | } | 863 | } |
863 | } | 864 | } |
864 | m_timeStamp = newStamp; | 865 | m_timeStamp = newStamp; |
865 | owait->hide(); | 866 | owait->hide(); |
866 | delete owait; | 867 | delete owait; |
867 | } | 868 | } |
868 | 869 | ||
869 | void Launcher::updateTabs() | 870 | void Launcher::updateTabs() |
870 | { | 871 | { |
871 | MimeType::updateApplications(); // ### reads all applnks twice | 872 | MimeType::updateApplications(); // ### reads all applnks twice |
872 | delete rootFolder; | 873 | delete rootFolder; |
873 | rootFolder = new AppLnkSet( MimeType::appsFolderName() ); | 874 | rootFolder = new AppLnkSet( MimeType::appsFolderName() ); |
874 | 875 | ||
875 | loadDocs(); | 876 | loadDocs(); |
876 | 877 | ||
877 | tabs->initializeCategories(rootFolder, docsFolder, storage->fileSystems()); | 878 | tabs->initializeCategories(rootFolder, docsFolder, storage->fileSystems()); |
878 | } | 879 | } |
879 | 880 | ||
880 | void Launcher::updateDocs() | 881 | void Launcher::updateDocs() |
881 | { | 882 | { |
882 | loadDocs(); | 883 | loadDocs(); |
883 | // tabs->updateDocs(docsFolder,storage->fileSystems()); | 884 | // tabs->updateDocs(docsFolder,storage->fileSystems()); |
884 | } | 885 | } |
885 | 886 | ||
886 | void Launcher::viewSelected(const QString& s) | 887 | void Launcher::viewSelected(const QString& s) |
887 | { | 888 | { |
888 | setCaption( s + tr(" - Launcher") ); | 889 | setCaption( s + tr(" - Launcher") ); |
889 | } | 890 | } |
890 | 891 | ||
891 | void Launcher::nextView() | 892 | void Launcher::nextView() |
892 | { | 893 | { |
893 | tabs->nextTab(); | 894 | tabs->nextTab(); |
894 | } | 895 | } |
895 | 896 | ||
896 | void Launcher::showTab(const QString& id) | 897 | void Launcher::showTab(const QString& id) |
897 | { | 898 | { |
898 | tabs->showTab(id); | 899 | tabs->showTab(id); |
899 | raise(); | 900 | raise(); |
900 | } | 901 | } |
901 | 902 | ||
902 | void Launcher::select( const AppLnk *appLnk ) | 903 | void Launcher::select( const AppLnk *appLnk ) |
903 | { | 904 | { |
904 | if ( appLnk->type() == "Folder" ) { // No tr | 905 | if ( appLnk->type() == "Folder" ) { // No tr |
905 | // Not supported: flat is simpler for the user | 906 | // Not supported: flat is simpler for the user |
906 | } else { | 907 | } else { |
907 | if ( appLnk->exec().isNull() ) { | 908 | if ( appLnk->exec().isNull() ) { |
908 | QMessageBox::information(this,tr("No application"), | 909 | QMessageBox::information(this,tr("No application"), |
909 | tr("<p>No application is defined for this document." | 910 | tr("<p>No application is defined for this document." |
910 | "<p>Type is %1.").arg(appLnk->type())); | 911 | "<p>Type is %1.").arg(appLnk->type())); |
911 | return; | 912 | return; |
912 | } | 913 | } |
913 | tabs->setBusy(TRUE); | 914 | tabs->setBusy(TRUE); |
914 | emit executing( appLnk ); | 915 | emit executing( appLnk ); |
915 | appLnk->execute(); | 916 | appLnk->execute(); |
916 | } | 917 | } |
917 | } | 918 | } |
918 | 919 | ||
919 | void Launcher::externalSelected(const AppLnk *appLnk) | 920 | void Launcher::externalSelected(const AppLnk *appLnk) |
920 | { | 921 | { |
921 | tabs->setBusy(TRUE); | 922 | tabs->setBusy(TRUE); |
922 | emit executing( appLnk ); | 923 | emit executing( appLnk ); |
923 | } | 924 | } |
924 | 925 | ||
925 | void Launcher::properties( AppLnk *appLnk ) | 926 | void Launcher::properties( AppLnk *appLnk ) |
926 | { | 927 | { |
927 | if ( appLnk->type() == "Folder" ) { // No tr | 928 | if ( appLnk->type() == "Folder" ) { // No tr |
928 | // Not supported: flat is simpler for the user | 929 | // Not supported: flat is simpler for the user |
929 | } else { | 930 | } else { |
930 | in_lnk_props = TRUE; | 931 | in_lnk_props = TRUE; |
931 | got_lnk_change = FALSE; | 932 | got_lnk_change = FALSE; |
932 | LnkProperties prop(appLnk); | 933 | LnkProperties prop(appLnk); |
933 | connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); | 934 | connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); |
934 | prop.showMaximized(); | 935 | prop.showMaximized(); |
935 | prop.exec(); | 936 | prop.exec(); |
936 | in_lnk_props = FALSE; | 937 | in_lnk_props = FALSE; |
937 | if ( got_lnk_change ) { | 938 | if ( got_lnk_change ) { |
938 | updateLink(lnk_change); | 939 | updateLink(lnk_change); |
939 | } | 940 | } |
940 | } | 941 | } |
941 | } | 942 | } |
942 | 943 | ||
943 | void Launcher::updateLink(const QString& link) | 944 | void Launcher::updateLink(const QString& link) |
944 | { | 945 | { |
945 | bool notify_sm = false; | 946 | bool notify_sm = false; |
946 | 947 | ||
947 | if (link.isNull()) { | 948 | if (link.isNull()) { |
948 | updateTabs(); | 949 | updateTabs(); |
949 | notify_sm = true; | 950 | notify_sm = true; |
950 | } | 951 | } |
951 | else if (link.isEmpty()) { | 952 | else if (link.isEmpty()) { |
952 | updateDocs(); | 953 | updateDocs(); |
953 | } | 954 | } |
954 | else { | 955 | else { |
955 | tabs->updateLink(link); | 956 | tabs->updateLink(link); |
956 | notify_sm = true; | 957 | notify_sm = true; |
957 | } | 958 | } |
958 | 959 | ||
959 | if ( notify_sm ) | 960 | if ( notify_sm ) |
960 | QCopEnvelope e ( "QPE/TaskBar", "reloadApps()" ); | 961 | QCopEnvelope e ( "QPE/TaskBar", "reloadApps()" ); |
961 | } | 962 | } |
962 | 963 | ||
963 | void Launcher::systemMessage( const QCString &msg, const QByteArray &data) | 964 | void Launcher::systemMessage( const QCString &msg, const QByteArray &data) |
964 | { | 965 | { |
965 | QDataStream stream( data, IO_ReadOnly ); | 966 | QDataStream stream( data, IO_ReadOnly ); |
966 | if ( msg == "linkChanged(QString)" ) { | 967 | if ( msg == "linkChanged(QString)" ) { |
967 | QString link; | 968 | QString link; |
968 | stream >> link; | 969 | stream >> link; |
969 | if ( in_lnk_props ) { | 970 | if ( in_lnk_props ) { |
970 | got_lnk_change = TRUE; | 971 | got_lnk_change = TRUE; |
971 | lnk_change = link; | 972 | lnk_change = link; |
972 | } else { | 973 | } else { |
973 | updateLink(link); | 974 | updateLink(link); |
974 | } | 975 | } |
975 | } else if ( msg == "busy()" ) { | 976 | } else if ( msg == "busy()" ) { |
976 | emit busy(); | 977 | emit busy(); |
977 | } else if ( msg == "notBusy(QString)" ) { | 978 | } else if ( msg == "notBusy(QString)" ) { |
978 | QString app; | 979 | QString app; |
979 | stream >> app; | 980 | stream >> app; |
980 | tabs->setBusy(FALSE); | 981 | tabs->setBusy(FALSE); |
981 | emit notBusy(app); | 982 | emit notBusy(app); |
982 | } else if ( msg == "mkdir(QString)" ) { | 983 | } else if ( msg == "mkdir(QString)" ) { |
983 | QString dir; | 984 | QString dir; |
984 | stream >> dir; | 985 | stream >> dir; |
985 | if ( !dir.isEmpty() ) | 986 | if ( !dir.isEmpty() ) |
986 | mkdir( dir ); | 987 | mkdir( dir ); |
987 | } else if ( msg == "rdiffGenSig(QString,QString)" ) { | 988 | } else if ( msg == "rdiffGenSig(QString,QString)" ) { |
988 | QString baseFile, sigFile; | 989 | QString baseFile, sigFile; |
989 | stream >> baseFile >> sigFile; | 990 | stream >> baseFile >> sigFile; |
990 | QRsync::generateSignature( baseFile, sigFile ); | 991 | QRsync::generateSignature( baseFile, sigFile ); |
991 | } else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) { | 992 | } else if ( msg == "rdiffGenDiff(QString,QString,QString)" ) { |
992 | QString baseFile, sigFile, deltaFile; | 993 | QString baseFile, sigFile, deltaFile; |
993 | stream >> baseFile >> sigFile >> deltaFile; | 994 | stream >> baseFile >> sigFile >> deltaFile; |
994 | QRsync::generateDiff( baseFile, sigFile, deltaFile ); | 995 | QRsync::generateDiff( baseFile, sigFile, deltaFile ); |
995 | } else if ( msg == "rdiffApplyPatch(QString,QString)" ) { | 996 | } else if ( msg == "rdiffApplyPatch(QString,QString)" ) { |
996 | QString baseFile, deltaFile; | 997 | QString baseFile, deltaFile; |
997 | stream >> baseFile >> deltaFile; | 998 | stream >> baseFile >> deltaFile; |
998 | if ( !QFile::exists( baseFile ) ) { | 999 | if ( !QFile::exists( baseFile ) ) { |
999 | QFile f( baseFile ); | 1000 | QFile f( baseFile ); |
1000 | f.open( IO_WriteOnly ); | 1001 | f.open( IO_WriteOnly ); |
1001 | f.close(); | 1002 | f.close(); |
1002 | } | 1003 | } |
1003 | QRsync::applyDiff( baseFile, deltaFile ); | 1004 | QRsync::applyDiff( baseFile, deltaFile ); |
1004 | #ifndef QT_NO_COP | 1005 | #ifndef QT_NO_COP |
1005 | QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" ); | 1006 | QCopEnvelope e( "QPE/Desktop", "patchApplied(QString)" ); |
1006 | e << baseFile; | 1007 | e << baseFile; |
1007 | #endif | 1008 | #endif |
1008 | } else if ( msg == "rdiffCleanup()" ) { | 1009 | } else if ( msg == "rdiffCleanup()" ) { |
1009 | mkdir( "/tmp/rdiff" ); | 1010 | mkdir( "/tmp/rdiff" ); |
1010 | QDir dir; | 1011 | QDir dir; |
1011 | dir.setPath( "/tmp/rdiff" ); | 1012 | dir.setPath( "/tmp/rdiff" ); |
1012 | QStringList entries = dir.entryList(); | 1013 | QStringList entries = dir.entryList(); |
1013 | for ( QStringList::Iterator it = entries.begin(); it != entries.end(); ++it ) | 1014 | for ( QStringList::Iterator it = entries.begin(); it != entries.end(); ++it ) |
1014 | dir.remove( *it ); | 1015 | dir.remove( *it ); |
1015 | } else if ( msg == "sendHandshakeInfo()" ) { | 1016 | } else if ( msg == "sendHandshakeInfo()" ) { |
1016 | QString home = getenv( "HOME" ); | 1017 | QString home = getenv( "HOME" ); |
1017 | #ifndef QT_NO_COP | 1018 | #ifndef QT_NO_COP |
1018 | QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" ); | 1019 | QCopEnvelope e( "QPE/Desktop", "handshakeInfo(QString,bool)" ); |
1019 | e << home; | 1020 | e << home; |
1020 | int locked = (int) Desktop::screenLocked(); | 1021 | int locked = (int) Desktop::screenLocked(); |
1021 | e << locked; | 1022 | e << locked; |
1022 | #endif | 1023 | #endif |
1023 | } else if ( msg == "autoStart(QString)" ) { | 1024 | } else if ( msg == "autoStart(QString)" ) { |
1024 | QString appName; | 1025 | QString appName; |
1025 | stream >> appName; | 1026 | stream >> appName; |
1026 | Config cfg( "autostart" ); | 1027 | Config cfg( "autostart" ); |
1027 | cfg.setGroup( "AutoStart" ); | 1028 | cfg.setGroup( "AutoStart" ); |
1028 | if ( appName.compare("clear") == 0){ | 1029 | if ( appName.compare("clear") == 0){ |
1029 | cfg.writeEntry("Apps", ""); | 1030 | cfg.writeEntry("Apps", ""); |
1030 | } | 1031 | } |
1031 | } else if ( msg == "autoStart(QString,QString)" ) { | 1032 | } else if ( msg == "autoStart(QString,QString)" ) { |
1032 | QString modifier, appName; | 1033 | QString modifier, appName; |
1033 | stream >> modifier >> appName; | 1034 | stream >> modifier >> appName; |
1034 | Config cfg( "autostart" ); | 1035 | Config cfg( "autostart" ); |
1035 | cfg.setGroup( "AutoStart" ); | 1036 | cfg.setGroup( "AutoStart" ); |
1036 | if ( modifier.compare("add") == 0 ){ | 1037 | if ( modifier.compare("add") == 0 ){ |
1037 | // only add if appname is entered | 1038 | // only add if appname is entered |
1038 | if (!appName.isEmpty()) { | 1039 | if (!appName.isEmpty()) { |
1039 | cfg.writeEntry("Apps", appName); | 1040 | cfg.writeEntry("Apps", appName); |
1040 | } | 1041 | } |
1041 | } else if (modifier.compare("remove") == 0 ) { | 1042 | } else if (modifier.compare("remove") == 0 ) { |
1042 | // need to change for multiple entries | 1043 | // need to change for multiple entries |
1043 | // actually remove is right now simular to clear, but in future there | 1044 | // actually remove is right now simular to clear, but in future there |
1044 | // should be multiple apps in autostart possible. | 1045 | // should be multiple apps in autostart possible. |
1045 | QString checkName; | 1046 | QString checkName; |
1046 | checkName = cfg.readEntry("Apps", ""); | 1047 | checkName = cfg.readEntry("Apps", ""); |
1047 | if (checkName == appName) { | 1048 | if (checkName == appName) { |
1048 | cfg.writeEntry("Apps", ""); | 1049 | cfg.writeEntry("Apps", ""); |
1049 | } | 1050 | } |
1050 | } | 1051 | } |
1051 | // case the autostart feature should be delayed | 1052 | // case the autostart feature should be delayed |
1052 | } else if ( msg == "autoStart(QString,QString,QString)") { | 1053 | } else if ( msg == "autoStart(QString,QString,QString)") { |
1053 | QString modifier, appName, delay; | 1054 | QString modifier, appName, delay; |
1054 | stream >> modifier >> appName >> delay; | 1055 | stream >> modifier >> appName >> delay; |
1055 | Config cfg( "autostart" ); | 1056 | Config cfg( "autostart" ); |
1056 | cfg.setGroup( "AutoStart" ); | 1057 | cfg.setGroup( "AutoStart" ); |
1057 | if ( modifier.compare("add") == 0 ){ | 1058 | if ( modifier.compare("add") == 0 ){ |
1058 | // only add it appname is entered | 1059 | // only add it appname is entered |
1059 | if (!appName.isEmpty()) { | 1060 | if (!appName.isEmpty()) { |
1060 | cfg.writeEntry("Apps", appName); | 1061 | cfg.writeEntry("Apps", appName); |
1061 | cfg.writeEntry("Delay", delay); | 1062 | cfg.writeEntry("Delay", delay); |
1062 | } | 1063 | } |
1063 | } else { | 1064 | } else { |
1064 | } | 1065 | } |
1065 | } | 1066 | } |
1066 | /* | 1067 | /* |
1067 | * QtopiaDesktop relies on the major number | 1068 | * QtopiaDesktop relies on the major number |
1068 | * to start with 1. We're at 0.9 | 1069 | * to start with 1. We're at 0.9 |
1069 | * so wee need to fake at least 1.4 to be able | 1070 | * so wee need to fake at least 1.4 to be able |
1070 | * to sync with QtopiaDesktop1.6 | 1071 | * to sync with QtopiaDesktop1.6 |
1071 | */ | 1072 | */ |
1072 | else if ( msg == "sendVersionInfo()" ) { | 1073 | else if ( msg == "sendVersionInfo()" ) { |
1073 | QCopEnvelope e( "QPE/Desktop", "versionInfo(QString)" ); | 1074 | QCopEnvelope e( "QPE/Desktop", "versionInfo(QString)" ); |
1074 | QString v2 = QString::fromLatin1("1.4"); | 1075 | QString v2 = QString::fromLatin1("1.4"); |
1075 | e << v2; | 1076 | e << v2; |
1076 | //qDebug("version %s\n", line.latin1()); | 1077 | //qDebug("version %s\n", line.latin1()); |
1077 | } else if ( msg == "sendCardInfo()" ) { | 1078 | } else if ( msg == "sendCardInfo()" ) { |
1078 | #ifndef QT_NO_COP | 1079 | #ifndef QT_NO_COP |
1079 | QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" ); | 1080 | QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" ); |
1080 | #endif | 1081 | #endif |
1081 | const QList<FileSystem> &fs = storage->fileSystems(); | 1082 | const QList<FileSystem> &fs = storage->fileSystems(); |
1082 | QListIterator<FileSystem> it ( fs ); | 1083 | QListIterator<FileSystem> it ( fs ); |
1083 | QString s; | 1084 | QString s; |
1084 | QString homeDir = getenv("HOME"); | 1085 | QString homeDir = getenv("HOME"); |
1085 | QString hardDiskHome, hardDiskHomePath; | 1086 | QString hardDiskHome, hardDiskHomePath; |
1086 | for ( ; it.current(); ++it ) { | 1087 | for ( ; it.current(); ++it ) { |
1087 | int k4 = (*it)->blockSize()/256; | 1088 | int k4 = (*it)->blockSize()/256; |
1088 | if ( (*it)->isRemovable() || (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs") { | 1089 | if ( (*it)->isRemovable() || (*it)->disk() == "/dev/mtdblock6" || (*it)->disk() == "tmpfs") { |
1089 | s += (*it)->name() + "=" + (*it)->path() + "/Documents " | 1090 | s += (*it)->name() + "=" + (*it)->path() + "/Documents " |
1090 | + QString::number( (*it)->availBlocks() * k4/4 ) | 1091 | + QString::number( (*it)->availBlocks() * k4/4 ) |
1091 | + "K " + (*it)->options() + ";"; | 1092 | + "K " + (*it)->options() + ";"; |
1092 | } else if ( (*it)->disk() == "/dev/mtdblock1" || | 1093 | } else if ( (*it)->disk() == "/dev/mtdblock1" || |
1093 | (*it)->disk() == "/dev/mtdblock/1" ) { | 1094 | (*it)->disk() == "/dev/mtdblock/1" ) { |
1094 | s += (*it)->name() + "=" + homeDir + "/Documents " | 1095 | s += (*it)->name() + "=" + homeDir + "/Documents " |
1095 | + QString::number( (*it)->availBlocks() * k4/4 ) | 1096 | + QString::number( (*it)->availBlocks() * k4/4 ) |
1096 | + "K " + (*it)->options() + ";"; | 1097 | + "K " + (*it)->options() + ";"; |
1097 | } else if ( (*it)->name().contains( "Hard Disk") && | 1098 | } else if ( (*it)->name().contains( "Hard Disk") && |
1098 | homeDir.contains( (*it)->path() ) && | 1099 | homeDir.contains( (*it)->path() ) && |
1099 | (*it)->path().length() > hardDiskHomePath.length() ) { | 1100 | (*it)->path().length() > hardDiskHomePath.length() ) { |
1100 | hardDiskHomePath = (*it)->path(); | 1101 | hardDiskHomePath = (*it)->path(); |
1101 | hardDiskHome = | 1102 | hardDiskHome = |
1102 | (*it)->name() + "=" + homeDir + "/Documents " | 1103 | (*it)->name() + "=" + homeDir + "/Documents " |
1103 | + QString::number( (*it)->availBlocks() * k4/4 ) | 1104 | + QString::number( (*it)->availBlocks() * k4/4 ) |
1104 | + "K " + (*it)->options() + ";"; | 1105 | + "K " + (*it)->options() + ";"; |
1105 | } | 1106 | } |
1106 | } | 1107 | } |
1107 | if ( !hardDiskHome.isEmpty() ) | 1108 | if ( !hardDiskHome.isEmpty() ) |
1108 | s += hardDiskHome; | 1109 | s += hardDiskHome; |
1109 | 1110 | ||
1110 | #ifndef QT_NO_COP | 1111 | #ifndef QT_NO_COP |
1111 | e << s; | 1112 | e << s; |
1112 | #endif | 1113 | #endif |
1113 | } else if ( msg == "sendSyncDate(QString)" ) { | 1114 | } else if ( msg == "sendSyncDate(QString)" ) { |
1114 | QString app; | 1115 | QString app; |
1115 | stream >> app; | 1116 | stream >> app; |
1116 | Config cfg( "qpe" ); | 1117 | Config cfg( "qpe" ); |
1117 | cfg.setGroup("SyncDate"); | 1118 | cfg.setGroup("SyncDate"); |
1118 | #ifndef QT_NO_COP | 1119 | #ifndef QT_NO_COP |
1119 | QCopEnvelope e( "QPE/Desktop", "syncDate(QString,QString)" ); | 1120 | QCopEnvelope e( "QPE/Desktop", "syncDate(QString,QString)" ); |
1120 | e << app << cfg.readEntry( app ); | 1121 | e << app << cfg.readEntry( app ); |
1121 | #endif | 1122 | #endif |
1122 | //qDebug("QPE/System sendSyncDate for %s: response %s", app.latin1(), | 1123 | //qDebug("QPE/System sendSyncDate for %s: response %s", app.latin1(), |
1123 | //cfg.readEntry( app ).latin1() ); | 1124 | //cfg.readEntry( app ).latin1() ); |
1124 | } else if ( msg == "setSyncDate(QString,QString)" ) { | 1125 | } else if ( msg == "setSyncDate(QString,QString)" ) { |
1125 | QString app, date; | 1126 | QString app, date; |
1126 | stream >> app >> date; | 1127 | stream >> app >> date; |
1127 | Config cfg( "qpe" ); | 1128 | Config cfg( "qpe" ); |
1128 | cfg.setGroup("SyncDate"); | 1129 | cfg.setGroup("SyncDate"); |
1129 | cfg.writeEntry( app, date ); | 1130 | cfg.writeEntry( app, date ); |
1130 | //qDebug("setSyncDate(QString,QString) %s %s", app.latin1(), date.latin1()); | 1131 | //qDebug("setSyncDate(QString,QString) %s %s", app.latin1(), date.latin1()); |
1131 | } else if ( msg == "startSync(QString)" ) { | 1132 | } else if ( msg == "startSync(QString)" ) { |
1132 | QString what; | 1133 | QString what; |
1133 | stream >> what; | 1134 | stream >> what; |
1134 | delete syncDialog; syncDialog = 0; | 1135 | delete syncDialog; syncDialog = 0; |
1135 | syncDialog = new SyncDialog( this, "syncProgress", FALSE, | 1136 | syncDialog = new SyncDialog( this, "syncProgress", FALSE, |
1136 | WStyle_Tool | WStyle_Customize | | 1137 | WStyle_Tool | WStyle_Customize | |
1137 | Qt::WStyle_StaysOnTop ); | 1138 | Qt::WStyle_StaysOnTop ); |
1138 | syncDialog->showMaximized(); | 1139 | syncDialog->showMaximized(); |
1139 | syncDialog->whatLabel->setText( "<b>" + what + "</b>" ); | 1140 | syncDialog->whatLabel->setText( "<b>" + what + "</b>" ); |
1140 | connect( syncDialog->buttonCancel, SIGNAL( clicked() ), | 1141 | connect( syncDialog->buttonCancel, SIGNAL( clicked() ), |
1141 | SLOT( cancelSync() ) ); | 1142 | SLOT( cancelSync() ) ); |
1142 | } else if ( msg == "stopSync()") { | 1143 | } else if ( msg == "stopSync()") { |
1143 | delete syncDialog; syncDialog = 0; | 1144 | delete syncDialog; syncDialog = 0; |
1144 | } else if ( msg == "getAllDocLinks()" ) { | 1145 | } else if ( msg == "getAllDocLinks()" ) { |
1145 | loadDocs(); | 1146 | loadDocs(); |
1146 | 1147 | ||
1147 | // directly show updated docs in document tab | 1148 | // directly show updated docs in document tab |
1148 | updateDocs(); | 1149 | updateDocs(); |
1149 | 1150 | ||
1150 | QString contents; | 1151 | QString contents; |
1151 | 1152 | ||
1152 | // Categories cats; | 1153 | // Categories cats; |
1153 | for ( QListIterator<DocLnk> it( docsFolder->children() ); it.current(); ++it ) { | 1154 | for ( QListIterator<DocLnk> it( docsFolder->children() ); it.current(); ++it ) { |
1154 | DocLnk *doc = it.current(); | 1155 | DocLnk *doc = it.current(); |
1155 | QFileInfo fi( doc->file() ); | 1156 | QFileInfo fi( doc->file() ); |
1156 | if ( !fi.exists() ) | 1157 | if ( !fi.exists() ) |
1157 | continue; | 1158 | continue; |
1158 | 1159 | ||
1159 | bool fake = !doc->linkFileKnown(); | 1160 | bool fake = !doc->linkFileKnown(); |
1160 | if ( !fake ) { | 1161 | if ( !fake ) { |
1161 | QFile f( doc->linkFile() ); | 1162 | QFile f( doc->linkFile() ); |
1162 | if ( f.open( IO_ReadOnly ) ) { | 1163 | if ( f.open( IO_ReadOnly ) ) { |
1163 | QTextStream ts( &f ); | 1164 | QTextStream ts( &f ); |
1164 | ts.setEncoding( QTextStream::UnicodeUTF8 ); | 1165 | ts.setEncoding( QTextStream::UnicodeUTF8 ); |
1165 | contents += ts.read(); | 1166 | contents += ts.read(); |
1166 | f.close(); | 1167 | f.close(); |
1167 | } else | 1168 | } else |
1168 | fake = TRUE; | 1169 | fake = TRUE; |
1169 | } | 1170 | } |
1170 | if (fake) { | 1171 | if (fake) { |
1171 | contents += "[Desktop Entry]\n"; | 1172 | contents += "[Desktop Entry]\n"; |
1172 | contents += "Categories = " + // No tr | 1173 | contents += "Categories = " + // No tr |
1173 | // cats.labels("Document View",doc->categories()).join(";") + "\n"; // No tr | 1174 | // cats.labels("Document View",doc->categories()).join(";") + "\n"; // No tr |
1174 | Qtopia::Record::idsToString( doc->categories() ) + "\n"; | 1175 | Qtopia::Record::idsToString( doc->categories() ) + "\n"; |
1175 | contents += "Name = "+doc->name()+"\n"; // No tr | 1176 | contents += "Name = "+doc->name()+"\n"; // No tr |
1176 | contents += "Type = "+doc->type()+"\n"; // No tr | 1177 | contents += "Type = "+doc->type()+"\n"; // No tr |
1177 | } | 1178 | } |
1178 | contents += "File = "+doc->file()+"\n"; // No tr // (resolves path) | 1179 | contents += "File = "+doc->file()+"\n"; // No tr // (resolves path) |
1179 | contents += QString("Size = %1\n").arg( fi.size() ); // No tr | 1180 | contents += QString("Size = %1\n").arg( fi.size() ); // No tr |
1180 | } | 1181 | } |
1181 | 1182 | ||
1182 | //qDebug( "sending length %d", contents.length() ); | 1183 | //qDebug( "sending length %d", contents.length() ); |
1183 | #ifndef QT_NO_COP | 1184 | #ifndef QT_NO_COP |
1184 | QCopEnvelope e( "QPE/Desktop", "docLinks(QString)" ); | 1185 | QCopEnvelope e( "QPE/Desktop", "docLinks(QString)" ); |
1185 | e << contents; | 1186 | e << contents; |
1186 | #endif | 1187 | #endif |
1187 | 1188 | ||
1188 | //qDebug( "================ \n\n%s\n\n===============", | 1189 | //qDebug( "================ \n\n%s\n\n===============", |
1189 | //contents.latin1() ); | 1190 | //contents.latin1() ); |
1190 | 1191 | ||
1191 | delete docsFolder; | 1192 | delete docsFolder; |
1192 | docsFolder = 0; | 1193 | docsFolder = 0; |
1193 | #ifdef QWS | 1194 | #ifdef QWS |
1194 | } else if ( msg == "setMouseProto(QString)" ) { | 1195 | } else if ( msg == "setMouseProto(QString)" ) { |
1195 | QString mice; | 1196 | QString mice; |
1196 | stream >> mice; | 1197 | stream >> mice; |
1197 | setenv("QWS_MOUSE_PROTO",mice.latin1(),1); | 1198 | setenv("QWS_MOUSE_PROTO",mice.latin1(),1); |
1198 | qwsServer->openMouse(); | 1199 | qwsServer->openMouse(); |
1199 | } else if ( msg == "setKeyboard(QString)" ) { | 1200 | } else if ( msg == "setKeyboard(QString)" ) { |
1200 | QString kb; | 1201 | QString kb; |
1201 | stream >> kb; | 1202 | stream >> kb; |
1202 | setenv("QWS_KEYBOARD",kb.latin1(),1); | 1203 | setenv("QWS_KEYBOARD",kb.latin1(),1); |
1203 | qwsServer->openKeyboard(); | 1204 | qwsServer->openKeyboard(); |
1204 | #endif | 1205 | #endif |
1205 | } | 1206 | } |
1206 | } | 1207 | } |
1207 | 1208 | ||
1208 | void Launcher::cancelSync() | 1209 | void Launcher::cancelSync() |
1209 | { | 1210 | { |
1210 | #ifndef QT_NO_COP | 1211 | #ifndef QT_NO_COP |
1211 | QCopEnvelope e( "QPE/Desktop", "cancelSync()" ); | 1212 | QCopEnvelope e( "QPE/Desktop", "cancelSync()" ); |
1212 | #endif | 1213 | #endif |
1213 | } | 1214 | } |
1214 | 1215 | ||
1215 | void Launcher::launcherMessage( const QCString &msg, const QByteArray &data) | 1216 | void Launcher::launcherMessage( const QCString &msg, const QByteArray &data) |
1216 | { | 1217 | { |
1217 | QDataStream stream( data, IO_ReadOnly ); | 1218 | QDataStream stream( data, IO_ReadOnly ); |
1218 | if ( msg == "setTabView(QString,int)" ) { | 1219 | if ( msg == "setTabView(QString,int)" ) { |
1219 | QString id; | 1220 | QString id; |
1220 | stream >> id; | 1221 | stream >> id; |
1221 | int mode; | 1222 | int mode; |
1222 | stream >> mode; | 1223 | stream >> mode; |
1223 | if ( tabs->view(id) ) | 1224 | if ( tabs->view(id) ) |
1224 | tabs->view(id)->setViewMode( (LauncherView::ViewMode)mode ); | 1225 | tabs->view(id)->setViewMode( (LauncherView::ViewMode)mode ); |
1225 | } else if ( msg == "setTabBackground(QString,int,QString)" ) { | 1226 | } else if ( msg == "setTabBackground(QString,int,QString)" ) { |
1226 | QString id; | 1227 | QString id; |
1227 | stream >> id; | 1228 | stream >> id; |
1228 | int mode; | 1229 | int mode; |
1229 | stream >> mode; | 1230 | stream >> mode; |
1230 | QString pixmapOrColor; | 1231 | QString pixmapOrColor; |
1231 | stream >> pixmapOrColor; | 1232 | stream >> pixmapOrColor; |
1232 | if ( tabs->view(id) ) | 1233 | if ( tabs->view(id) ) |
1233 | tabs->view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); | 1234 | tabs->view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); |
1234 | } else if ( msg == "setTextColor(QString,QString)" ) { | 1235 | } else if ( msg == "setTextColor(QString,QString)" ) { |
1235 | QString id; | 1236 | QString id; |
1236 | stream >> id; | 1237 | stream >> id; |
1237 | QString color; | 1238 | QString color; |
1238 | stream >> color; | 1239 | stream >> color; |
1239 | if ( tabs->view(id) ) | 1240 | if ( tabs->view(id) ) |
1240 | tabs->view(id)->setTextColor( QColor(color) ); | 1241 | tabs->view(id)->setTextColor( QColor(color) ); |
1241 | } else if ( msg == "setFont(QString,QString,int,int,int)" ) { | 1242 | } else if ( msg == "setFont(QString,QString,int,int,int)" ) { |
1242 | QString id; | 1243 | QString id; |
1243 | stream >> id; | 1244 | stream >> id; |
1244 | QString fam; | 1245 | QString fam; |
1245 | stream >> fam; | 1246 | stream >> fam; |
1246 | int size; | 1247 | int size; |
1247 | stream >> size; | 1248 | stream >> size; |
1248 | int weight; | 1249 | int weight; |
1249 | stream >> weight; | 1250 | stream >> weight; |
1250 | int italic; | 1251 | int italic; |
1251 | stream >> italic; | 1252 | stream >> italic; |
1252 | if ( tabs->view(id) ) | 1253 | if ( tabs->view(id) ) |
1253 | if ( !fam. isEmpty ( )) | 1254 | if ( !fam. isEmpty ( )) |
1254 | tabs->view(id)->setViewFont( QFont(fam, size, weight, italic!=0) ); | 1255 | tabs->view(id)->setViewFont( QFont(fam, size, weight, italic!=0) ); |
1255 | else | 1256 | else |
1256 | tabs->view(id)->unsetViewFont(); | 1257 | tabs->view(id)->unsetViewFont(); |
1257 | qDebug( "setFont: %s, %d, %d, %d", fam.latin1(), size, weight, italic ); | 1258 | qDebug( "setFont: %s, %d, %d, %d", fam.latin1(), size, weight, italic ); |
1258 | } | 1259 | } |
1259 | else if ( msg == "setBusyIndicatorType(QString)" ) { | 1260 | else if ( msg == "setBusyIndicatorType(QString)" ) { |
1260 | QString type; | 1261 | QString type; |
1261 | stream >> type; | 1262 | stream >> type; |
1262 | tabs->setBusyIndicatorType(type); | 1263 | tabs->setBusyIndicatorType(type); |
1263 | } | 1264 | } |
1264 | else if ( msg == "home()" ) { | 1265 | else if ( msg == "home()" ) { |
1265 | if ( isVisibleWindow( winId ( ))) | 1266 | if ( isVisibleWindow( winId ( ))) |
1266 | nextView ( ); | 1267 | nextView ( ); |
1267 | else | 1268 | else |
1268 | raise ( ); | 1269 | raise ( ); |
1269 | 1270 | ||
1270 | } | 1271 | } |
1271 | } | 1272 | } |
1272 | 1273 | ||
1273 | void Launcher::storageChanged() | 1274 | void Launcher::storageChanged() |
1274 | { | 1275 | { |
1275 | if ( in_lnk_props ) { | 1276 | if ( in_lnk_props ) { |
1276 | got_lnk_change = TRUE; | 1277 | got_lnk_change = TRUE; |
1277 | lnk_change = QString::null; | 1278 | lnk_change = QString::null; |
1278 | } else { | 1279 | } else { |
1279 | updateLink( QString::null ); | 1280 | updateLink( QString::null ); |
1280 | } | 1281 | } |
1281 | } | 1282 | } |
1282 | 1283 | ||
1283 | 1284 | ||
1284 | bool Launcher::mkdir(const QString &localPath) | 1285 | bool Launcher::mkdir(const QString &localPath) |
1285 | { | 1286 | { |
1286 | QDir fullDir(localPath); | 1287 | QDir fullDir(localPath); |
1287 | if (fullDir.exists()) | 1288 | if (fullDir.exists()) |
1288 | return true; | 1289 | return true; |
1289 | 1290 | ||
1290 | // at this point the directory doesn't exist | 1291 | // at this point the directory doesn't exist |
1291 | // go through the directory tree and start creating the direcotories | 1292 | // go through the directory tree and start creating the direcotories |
1292 | // that don't exist; if we can't create the directories, return false | 1293 | // that don't exist; if we can't create the directories, return false |
1293 | 1294 | ||
1294 | QString dirSeps = "/"; | 1295 | QString dirSeps = "/"; |
1295 | int dirIndex = localPath.find(dirSeps); | 1296 | int dirIndex = localPath.find(dirSeps); |
1296 | QString checkedPath; | 1297 | QString checkedPath; |
1297 | 1298 | ||
1298 | // didn't find any seps; weird, use the cur dir instead | 1299 | // didn't find any seps; weird, use the cur dir instead |
1299 | if (dirIndex == -1) { | 1300 | if (dirIndex == -1) { |
1300 | //qDebug("No seperators found in path %s", localPath.latin1()); | 1301 | //qDebug("No seperators found in path %s", localPath.latin1()); |
1301 | checkedPath = QDir::currentDirPath(); | 1302 | checkedPath = QDir::currentDirPath(); |
1302 | } | 1303 | } |
1303 | 1304 | ||
1304 | while (checkedPath != localPath) { | 1305 | while (checkedPath != localPath) { |
1305 | // no more seperators found, use the local path | 1306 | // no more seperators found, use the local path |
1306 | if (dirIndex == -1) | 1307 | if (dirIndex == -1) |
1307 | checkedPath = localPath; | 1308 | checkedPath = localPath; |
1308 | else { | 1309 | else { |
1309 | // the next directory to check | 1310 | // the next directory to check |
1310 | checkedPath = localPath.left(dirIndex) + "/"; | 1311 | checkedPath = localPath.left(dirIndex) + "/"; |
1311 | // advance the iterator; the next dir seperator | 1312 | // advance the iterator; the next dir seperator |
1312 | dirIndex = localPath.find(dirSeps, dirIndex+1); | 1313 | dirIndex = localPath.find(dirSeps, dirIndex+1); |
1313 | } | 1314 | } |
1314 | 1315 | ||
1315 | QDir checkDir(checkedPath); | 1316 | QDir checkDir(checkedPath); |
1316 | if (!checkDir.exists()) { | 1317 | if (!checkDir.exists()) { |
1317 | //qDebug("mkdir making dir %s", checkedPath.latin1()); | 1318 | //qDebug("mkdir making dir %s", checkedPath.latin1()); |
1318 | 1319 | ||
1319 | if (!checkDir.mkdir(checkedPath)) { | 1320 | if (!checkDir.mkdir(checkedPath)) { |
1320 | qDebug("Unable to make directory %s", checkedPath.latin1()); | 1321 | qDebug("Unable to make directory %s", checkedPath.latin1()); |
1321 | return FALSE; | 1322 | return FALSE; |
1322 | } | 1323 | } |
1323 | } | 1324 | } |
1324 | 1325 | ||
1325 | } | 1326 | } |
1326 | return TRUE; | 1327 | return TRUE; |
1327 | } | 1328 | } |
1328 | 1329 | ||
1329 | void Launcher::preloadApps() | 1330 | void Launcher::preloadApps() |
1330 | { | 1331 | { |
1331 | Config cfg("Launcher"); | 1332 | Config cfg("Launcher"); |
1332 | cfg.setGroup("Preload"); | 1333 | cfg.setGroup("Preload"); |
1333 | QStringList apps = cfg.readListEntry("Apps",','); | 1334 | QStringList apps = cfg.readListEntry("Apps",','); |
1334 | for (QStringList::ConstIterator it=apps.begin(); it!=apps.end(); ++it) { | 1335 | for (QStringList::ConstIterator it=apps.begin(); it!=apps.end(); ++it) { |
1335 | #ifndef QT_NO_COP | 1336 | #ifndef QT_NO_COP |
1336 | QCopEnvelope e("QPE/Application/"+(*it).local8Bit(), "enablePreload()"); | 1337 | QCopEnvelope e("QPE/Application/"+(*it).local8Bit(), "enablePreload()"); |
1337 | #endif | 1338 | #endif |
1338 | } | 1339 | } |
1339 | } | 1340 | } |
1340 | 1341 | ||
1341 | DocumentTab::DocumentTab( QWidget *parent, int mode, int selector, const QString &dirName, const QString &fileName) | 1342 | DocumentTab::DocumentTab( QWidget *parent, int mode, int selector, const QString &dirName, const QString &fileName) |
1342 | : OFileSelector(parent,mode,selector,dirName,fileName) | 1343 | : OFileSelector(parent,mode,selector,dirName,fileName) |
1343 | { | 1344 | { |
1344 | setYesCancelVisible(false); | 1345 | //setYesCancelVisible(false); |
1345 | setToolbarVisible(false); | 1346 | //setToolbarVisible(false); |
1346 | setPermissionBarVisible(false); | 1347 | //setPermissionBarVisible(false); |
1347 | setLineEditVisible(false) ; | 1348 | //setLineEditVisible(false) ; |
1348 | //setChooserVisible( bool chooser ); | 1349 | //setChooserVisible( bool chooser ); |
1349 | 1350 | ||
1350 | } | 1351 | } |
1351 | 1352 | ||
1352 | DocumentTab::~DocumentTab() { | 1353 | DocumentTab::~DocumentTab() { |
1353 | 1354 | ||
1354 | } | 1355 | } |
1355 | 1356 | ||