author | zautrix <zautrix> | 2004-09-16 15:13:40 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-16 15:13:40 (UTC) |
commit | 02e7ae4983679a787834277176a031286a8310c2 (patch) (unidiff) | |
tree | ea7e33e59b86b8fed2b033609d1018a9f245baff | |
parent | 68b1f3bce4b6e89bb343b965256537d93e63f7be (diff) | |
download | kdepimpi-02e7ae4983679a787834277176a031286a8310c2.zip kdepimpi-02e7ae4983679a787834277176a031286a8310c2.tar.gz kdepimpi-02e7ae4983679a787834277176a031286a8310c2.tar.bz2 |
Foldername fixes
-rw-r--r-- | Makefile | 31 | ||||
-rw-r--r-- | kmicromail/accountitem.cpp | 2 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mailwrapper.cpp | 7 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mailwrapper.h | 2 |
4 files changed, 34 insertions, 8 deletions
@@ -1,303 +1,328 @@ | |||
1 | export KDEPIMDIR = $(shell pwd) | 1 | export KDEPIMDIR = $(shell pwd) |
2 | 2 | ||
3 | 3 | ||
4 | ifeq ($(PLATFORM) , zaurus) | 4 | ifeq ($(PLATFORM) , zaurus) |
5 | BUILD_NO_LDAP_PLUGIN=1 | 5 | BUILD_NO_LDAP_PLUGIN=1 |
6 | endif | 6 | endif |
7 | 7 | ||
8 | ifneq ($(PLATFORM) , zaurus) | 8 | ifneq ($(PLATFORM) , zaurus) |
9 | BUILD_NO_SHARP_PLUGIN=1 | 9 | BUILD_NO_SHARP_PLUGIN=1 |
10 | endif | 10 | endif |
11 | 11 | ||
12 | SUBDIRS_MICROKDE = \ | 12 | SUBDIRS_MICROKDE = \ |
13 | libical/src/libical \ | 13 | libical/src/libical \ |
14 | libical/src/libicalss \ | 14 | libical/src/libicalss \ |
15 | qtcompat \ | 15 | qtcompat \ |
16 | microkde \ | 16 | microkde \ |
17 | libkcal \ | 17 | libkcal \ |
18 | libkdepim \ | 18 | libkdepim \ |
19 | kabc \ | 19 | kabc \ |
20 | kabc/formats/binary \ | 20 | kabc/formats/binary \ |
21 | kabc/plugins/file \ | 21 | kabc/plugins/file \ |
22 | kabc/plugins/dir \ | 22 | kabc/plugins/dir \ |
23 | korganizer \ | 23 | korganizer \ |
24 | kalarmd \ | 24 | kalarmd \ |
25 | kaddressbook | 25 | kaddressbook |
26 | 26 | ||
27 | SUBDIRS_QTOPIA_PLUGIN = \ | 27 | SUBDIRS_QTOPIA_PLUGIN = \ |
28 | kabc/plugins/qtopia | 28 | kabc/plugins/qtopia |
29 | 29 | ||
30 | SUBDIRS_OPIE_PLUGIN = \ | 30 | SUBDIRS_OPIE_PLUGIN = \ |
31 | kabc/plugins/opie | 31 | kabc/plugins/opie |
32 | 32 | ||
33 | SUBDIRS_SHARP_PLUGIN = \ | 33 | SUBDIRS_SHARP_PLUGIN = \ |
34 | kabc/plugins/sharpdtm | 34 | kabc/plugins/sharpdtm |
35 | 35 | ||
36 | SUBDIRS_LDAP_PLUGIN = \ | 36 | SUBDIRS_LDAP_PLUGIN = \ |
37 | kabc/plugins/ldap | 37 | kabc/plugins/ldap |
38 | 38 | ||
39 | SUBDIRS_MICROMAIL = \ | 39 | SUBDIRS_MICROMAIL = \ |
40 | kmicromail/libetpan \ | 40 | kmicromail/libetpan \ |
41 | kmicromail/libmailwrapper \ | 41 | kmicromail/libmailwrapper \ |
42 | kmicromail | 42 | kmicromail |
43 | 43 | ||
44 | SUBDIRS_GAMMU = \ | 44 | SUBDIRS_GAMMU = \ |
45 | gammu/emb/common \ | 45 | gammu/emb/common \ |
46 | gammu/emb/gammu | 46 | gammu/emb/gammu |
47 | 47 | ||
48 | SUBDIRS_PWMANAGER = \ | ||
49 | pwmanager/pwmanager | ||
50 | |||
48 | SUBDIRS = \ | 51 | SUBDIRS = \ |
49 | $(SUBDIRS_MICROKDE) \ | 52 | $(SUBDIRS_MICROKDE) \ |
50 | $(SUBDIRS_QTOPIA_PLUGIN) \ | 53 | $(SUBDIRS_QTOPIA_PLUGIN) \ |
51 | $(SUBDIRS_OPIE_PLUGIN) \ | 54 | $(SUBDIRS_OPIE_PLUGIN) \ |
52 | $(SUBDIRS_SHARP_PLUGIN) \ | 55 | $(SUBDIRS_SHARP_PLUGIN) \ |
53 | $(SUBDIRS_LDAP_PLUGIN) \ | 56 | $(SUBDIRS_LDAP_PLUGIN) \ |
54 | $(SUBDIRS_MICROMAIL) \ | 57 | $(SUBDIRS_MICROMAIL) \ |
55 | $(SUBDIRS_GAMMU) | 58 | $(SUBDIRS_GAMMU) \ |
59 | $(SUBDIRS_PWMANAGER) | ||
56 | 60 | ||
57 | all: build_microkde \ | 61 | all: build_microkde \ |
58 | build_qtopia_plugin \ | 62 | build_qtopia_plugin \ |
59 | build_opie_plugin \ | 63 | build_opie_plugin \ |
60 | build_sharp_plugin \ | 64 | build_sharp_plugin \ |
61 | build_ldap_plugin \ | 65 | build_ldap_plugin \ |
62 | build_micromail \ | 66 | build_micromail \ |
63 | build_gammu | 67 | build_gammu \ |
68 | build_pwmanager | ||
64 | 69 | ||
65 | 70 | ||
66 | build_microkde: variable_test tmake | 71 | build_microkde: variable_test tmake |
67 | for i in $(SUBDIRS_MICROKDE); do pushd $$i; \ | 72 | for i in $(SUBDIRS_MICROKDE); do pushd $$i; \ |
68 | make -f Makefile$(PLATFORM) || exit 1; popd; \ | 73 | make -f Makefile$(PLATFORM) || exit 1; popd; \ |
69 | done | 74 | done |
70 | 75 | ||
71 | build_qtopia_plugin: build_microkde | 76 | build_qtopia_plugin: build_microkde |
72 | for i in $(SUBDIRS_QTOPIA_PLUGIN); do pushd $$i; \ | 77 | for i in $(SUBDIRS_QTOPIA_PLUGIN); do pushd $$i; \ |
73 | make -f Makefile$(PLATFORM) || exit 1; popd; \ | 78 | make -f Makefile$(PLATFORM) || exit 1; popd; \ |
74 | done | 79 | done |
75 | 80 | ||
76 | build_opie_plugin: build_microkde | 81 | build_opie_plugin: build_microkde |
77 | ifdef BUILD_NO_OPIE_PLUGIN | 82 | ifdef BUILD_NO_OPIE_PLUGIN |
78 | @echo == opie plugin not build. | 83 | @echo == opie plugin not build. |
79 | else | 84 | else |
80 | for i in $(SUBDIRS_OPIE_PLUGIN); do pushd $$i; \ | 85 | for i in $(SUBDIRS_OPIE_PLUGIN); do pushd $$i; \ |
81 | make -f Makefile$(PLATFORM) || exit 1; popd; \ | 86 | make -f Makefile$(PLATFORM) || exit 1; popd; \ |
82 | done | 87 | done |
83 | endif | 88 | endif |
84 | 89 | ||
85 | build_sharp_plugin: build_microkde | 90 | build_sharp_plugin: build_microkde |
86 | ifdef BUILD_NO_SHARP_PLUGIN | 91 | ifdef BUILD_NO_SHARP_PLUGIN |
87 | @echo == ldap plugin not build. | 92 | @echo == ldap plugin not build. |
88 | else | 93 | else |
89 | for i in $(SUBDIRS_SHARP_PLUGIN); do pushd $$i; \ | 94 | for i in $(SUBDIRS_SHARP_PLUGIN); do pushd $$i; \ |
90 | make -f Makefile$(PLATFORM) || exit 1; popd; \ | 95 | make -f Makefile$(PLATFORM) || exit 1; popd; \ |
91 | done | 96 | done |
92 | endif | 97 | endif |
93 | 98 | ||
94 | build_ldap_plugin: build_microkde | 99 | build_ldap_plugin: build_microkde |
95 | ifdef BUILD_NO_LDAP_PLUGIN | 100 | ifdef BUILD_NO_LDAP_PLUGIN |
96 | @echo == ldap plugin not build. | 101 | @echo == ldap plugin not build. |
97 | else | 102 | else |
98 | for i in $(SUBDIRS_LDAP_PLUGIN); do pushd $$i; \ | 103 | for i in $(SUBDIRS_LDAP_PLUGIN); do pushd $$i; \ |
99 | make -f Makefile$(PLATFORM) || exit 1; popd; \ | 104 | make -f Makefile$(PLATFORM) || exit 1; popd; \ |
100 | done | 105 | done |
101 | endif | 106 | endif |
102 | 107 | ||
103 | 108 | ||
104 | build_micromail: build_microkde | 109 | build_micromail: build_microkde |
105 | ifdef BUILD_NO_MICROMAIL | 110 | ifdef BUILD_NO_MICROMAIL |
106 | @echo == kmicromail not build. | 111 | @echo == kmicromail not build. |
107 | else | 112 | else |
108 | for i in $(SUBDIRS_MICROMAIL); do pushd $$i; \ | 113 | for i in $(SUBDIRS_MICROMAIL); do pushd $$i; \ |
109 | make -f Makefile$(PLATFORM) || exit 1; popd; \ | 114 | make -f Makefile$(PLATFORM) || exit 1; popd; \ |
110 | done | 115 | done |
111 | endif | 116 | endif |
112 | 117 | ||
113 | build_gammu: variable_test tmake | 118 | build_gammu: variable_test tmake |
114 | ifdef BUILD_NO_GAMMU | 119 | ifdef BUILD_NO_GAMMU |
115 | @echo == gammu not build. | 120 | @echo == gammu not build. |
116 | else | 121 | else |
117 | for i in $(SUBDIRS_GAMMU); do pushd $$i; \ | 122 | for i in $(SUBDIRS_GAMMU); do pushd $$i; \ |
118 | make -f Makefile$(PLATFORM) || exit 1; popd; \ | 123 | make -f Makefile$(PLATFORM) || exit 1; popd; \ |
119 | done | 124 | done |
120 | endif | 125 | endif |
121 | 126 | ||
127 | build_pwmanager: build_microkde | ||
128 | ifdef BUILD_NO_PWMANAGER | ||
129 | @echo == pwmanager not build. | ||
130 | else | ||
131 | for i in $(SUBDIRS_PWMANAGER); do pushd $$i; \ | ||
132 | make -f Makefile$(PLATFORM) || exit 1; popd; \ | ||
133 | done | ||
134 | endif | ||
135 | |||
122 | 136 | ||
123 | variable_info: | 137 | variable_info: |
124 | @echo -------------------------------------- | 138 | @echo -------------------------------------- |
125 | @echo KDEPIM buildsystem, variableinfo... | 139 | @echo KDEPIM buildsystem, variableinfo... |
126 | @echo KDEPIMDIR=$(KDEPIMDIR) | 140 | @echo KDEPIMDIR=$(KDEPIMDIR) |
127 | @echo QTDIR=$(QTDIR) | 141 | @echo QTDIR=$(QTDIR) |
128 | @echo QPEDIR=$(QPEDIR) | 142 | @echo QPEDIR=$(QPEDIR) |
129 | @echo OPIEDIR=$(OPIEDIR) | 143 | @echo OPIEDIR=$(OPIEDIR) |
130 | @echo PLATFORM=$(PLATFORM) | 144 | @echo PLATFORM=$(PLATFORM) |
131 | @echo RELEASE_DEBUG=$(RELEASE_DEBUG) | 145 | @echo RELEASE_DEBUG=$(RELEASE_DEBUG) |
132 | @echo BUILD_NO_MICROMAIL=$(BUILD_NO_MICROMAIL) | 146 | @echo BUILD_NO_MICROMAIL=$(BUILD_NO_MICROMAIL) |
133 | @echo BUILD_NO_LDAP_PLUGIN=$(BUILD_NO_LDAP_PLUGIN) | 147 | @echo BUILD_NO_LDAP_PLUGIN=$(BUILD_NO_LDAP_PLUGIN) |
134 | @echo BUILD_NO_OPIE_PLUGIN=$(BUILD_NO_OPIE_PLUGIN) | 148 | @echo BUILD_NO_OPIE_PLUGIN=$(BUILD_NO_OPIE_PLUGIN) |
135 | @echo BUILD_NO_SHARP_PLUGIN=$(BUILD_NO_SHARP_PLUGIN) | 149 | @echo BUILD_NO_SHARP_PLUGIN=$(BUILD_NO_SHARP_PLUGIN) |
136 | ifndef BUILD_NO_SHARP_PLUGIN | 150 | ifndef BUILD_NO_SHARP_PLUGIN |
137 | @echo SHARPDTMSDK=$(SHARPDTMSDK) | 151 | @echo SHARPDTMSDK=$(SHARPDTMSDK) |
138 | endif | 152 | endif |
139 | @echo BUILD_NO_GAMMU=$(BUILD_NO_GAMMU) | 153 | @echo BUILD_NO_GAMMU=$(BUILD_NO_GAMMU) |
154 | @echo BUILD_NO_PWMANAGER=$(BUILD_NO_PWMANAGER) | ||
140 | @echo -------------------------------------- | 155 | @echo -------------------------------------- |
141 | 156 | ||
142 | variable_test: variable_info | 157 | variable_test: variable_info |
143 | @echo KDEPIM buildsystem, variablecheck... | 158 | @echo KDEPIM buildsystem, variablecheck... |
144 | ifndef KDEPIMDIR | 159 | ifndef KDEPIMDIR |
145 | @echo KDEPIMDIR is not defined. | 160 | @echo KDEPIMDIR is not defined. |
146 | $(error KDEPIMDIR is not defined) | 161 | $(error KDEPIMDIR is not defined) |
147 | endif | 162 | endif |
148 | ifndef PLATFORM | 163 | ifndef PLATFORM |
149 | @echo PLATFORM is not defined. | 164 | @echo PLATFORM is not defined. |
150 | $(error PLATFORM is not defined) | 165 | $(error PLATFORM is not defined) |
151 | endif | 166 | endif |
152 | ifdef BUILD_NO_LDAP_PLUGIN | 167 | ifdef BUILD_NO_LDAP_PLUGIN |
153 | @echo LDAP PLUGIN will not be build, because BUILD_NO_LDAP_PLUGIN is set to $(BUILD_NO_LDAP_PLUGIN) | 168 | @echo LDAP PLUGIN will not be build, because BUILD_NO_LDAP_PLUGIN is set to $(BUILD_NO_LDAP_PLUGIN) |
154 | endif | 169 | endif |
155 | ifdef BUILD_NO_OPIE_PLUGIN | 170 | ifdef BUILD_NO_OPIE_PLUGIN |
156 | @echo OPIE PLUGIN will not be build, because BUILD_NO_OPIE_PLUGIN is set to $(BUILD_NO_OPIE_PLUGIN) | 171 | @echo OPIE PLUGIN will not be build, because BUILD_NO_OPIE_PLUGIN is set to $(BUILD_NO_OPIE_PLUGIN) |
157 | endif | 172 | endif |
158 | ifdef BUILD_NO_MICROMAIL | 173 | ifdef BUILD_NO_MICROMAIL |
159 | @echo MICROMAIL will not be build, because BUILD_NO_MICROMAIL is set to $(BUILD_NO_MICROMAIL) | 174 | @echo MICROMAIL will not be build, because BUILD_NO_MICROMAIL is set to $(BUILD_NO_MICROMAIL) |
160 | endif | 175 | endif |
161 | ifdef BUILD_NO_SHARP_PLUGIN | 176 | ifdef BUILD_NO_SHARP_PLUGIN |
162 | @echo SHARP PLUGIN will not be build, because BUILD_NO_SHARP_PLUGIN is set to $(BUILD_NO_SHARP_PLUGIN) | 177 | @echo SHARP PLUGIN will not be build, because BUILD_NO_SHARP_PLUGIN is set to $(BUILD_NO_SHARP_PLUGIN) |
163 | else | 178 | else |
164 | ifndef SHARPDTMSDK | 179 | ifndef SHARPDTMSDK |
165 | @echo SHARP PLUGIN can not be build, because SHARPDTMSDK is set to $(SHARPDTMSDK) | 180 | @echo SHARP PLUGIN can not be build, because SHARPDTMSDK is set to $(SHARPDTMSDK) |
166 | $(error SHARPDTMSDK is not defined) | 181 | $(error SHARPDTMSDK is not defined) |
167 | endif | 182 | endif |
168 | endif | 183 | endif |
169 | ifdef BUILD_NO_GAMMU | 184 | ifdef BUILD_NO_GAMMU |
170 | @echo GAMMU will not be build, because BUILD_NO_GAMMU is set to $(BUILD_NO_GAMMU) | 185 | @echo GAMMU will not be build, because BUILD_NO_GAMMU is set to $(BUILD_NO_GAMMU) |
171 | endif | 186 | endif |
187 | ifdef BUILD_NO_PWMANAGER | ||
188 | @echo PWMANAGER will not be build, because BUILD_NO_PWMANAGER is set to $(BUILD_NO_PWMANAGER) | ||
189 | endif | ||
172 | @echo -------------------------------------- | 190 | @echo -------------------------------------- |
173 | 191 | ||
174 | 192 | ||
175 | objects: | 193 | objects: |
176 | for i in $(SUBDIRS); do mkdir -p $$i/obj/$(PLATFORM); done | 194 | for i in $(SUBDIRS); do mkdir -p $$i/obj/$(PLATFORM); done |
177 | for i in $(SUBDIRS); do mkdir -p $$i/moc/$(PLATFORM); done | 195 | for i in $(SUBDIRS); do mkdir -p $$i/moc/$(PLATFORM); done |
178 | mkdir -p libical/lib/$(PLATFORM) | 196 | mkdir -p libical/lib/$(PLATFORM) |
179 | 197 | ||
180 | clean: | 198 | clean: |
181 | rm -rf libical/lib/$(PLATFORM)/*; | 199 | rm -rf libical/lib/$(PLATFORM)/*; |
182 | for i in $(SUBDIRS); do pushd $$i; make clean; rm -f *~;\ | 200 | for i in $(SUBDIRS); do pushd $$i; make clean; rm -f *~;\ |
183 | rm -f obj/$(PLATFORM)/*; rm -f moc/$(PLATFORM)/*; rm Makefile$(PLATFORM); popd; \ | 201 | rm -f obj/$(PLATFORM)/*; rm -f moc/$(PLATFORM)/*; rm Makefile$(PLATFORM); popd; \ |
184 | done | 202 | done |
185 | install: | 203 | install: |
186 | 204 | ||
187 | cd bin/kdepim; make install | 205 | cd bin/kdepim; make install |
188 | cp -r Pim $(QPEDIR)/apps | 206 | cp -r Pim $(QPEDIR)/apps |
189 | cp db2file/db2file $(QPEDIR)/bin/db2file | 207 | cp db2file/db2file $(QPEDIR)/bin/db2file |
190 | cp korganizer/korganizer.desktop $(QPEDIR)/apps/Pim/korganizer.desktop | 208 | cp korganizer/korganizer.desktop $(QPEDIR)/apps/Pim/korganizer.desktop |
191 | cp kaddressbook/kaddressbook.desktop $(QPEDIR)/apps/Pim/kaddressbook.desktop | 209 | cp kaddressbook/kaddressbook.desktop $(QPEDIR)/apps/Pim/kaddressbook.desktop |
192 | cp kmicromail/kmicromail.desktop $(QPEDIR)/apps/Pim/kopiemail.desktop | 210 | cp kmicromail/kmicromail.desktop $(QPEDIR)/apps/Pim/kopiemail.desktop |
211 | cp pwmanager/pwmanager/pwmanager.desktop $(QPEDIR)/apps/Pim/pwmanager.desktop | ||
193 | 212 | ||
194 | dist: | 213 | dist: |
195 | @echo Dont forget to do "make install" before "make dist" | 214 | @echo Dont forget to do "make install" before "make dist" |
196 | rm -f *arm.ipk | 215 | rm -f *arm.ipk |
197 | rm -f *~ | 216 | rm -f *~ |
198 | cd ..; tar czf kdepim.src.tar.gz --exclude=obj --exclude=moc --exclude=CVS --exclude=Makefilezaurus --exclude=Makefileqtopia kdepim | 217 | cd ..; tar czf kdepim.src.tar.gz --exclude=obj --exclude=moc --exclude=CVS --exclude=Makefilezaurus --exclude=Makefileqtopia kdepim |
199 | ./mkipks kmicrokdelibs.control | 218 | ./mkipks kmicrokdelibs.control |
200 | ./mkipks korganizer.control | 219 | ./mkipks korganizer.control |
201 | ./mkipks kaddressbook.control | 220 | ./mkipks kaddressbook.control |
202 | ifndef BUILD_NO_MICROMAIL | 221 | ifndef BUILD_NO_MICROMAIL |
203 | ./mkipks kopiemail.control | 222 | ./mkipks kopiemail.control |
204 | endif | 223 | endif |
205 | ./mkipks korganizer-alarm.control | 224 | ./mkipks korganizer-alarm.control |
206 | ifndef BUILD_NO_GAMMU | 225 | ifndef BUILD_NO_GAMMU |
207 | ./mkipks kammu.control | 226 | ./mkipks kammu.control |
208 | endif | 227 | endif |
228 | ifndef BUILD_NO_PWMANAGER | ||
229 | ./mkipks pwmanager.control | ||
230 | endif | ||
209 | ./mkipks pim_TAB_icon.control | 231 | ./mkipks pim_TAB_icon.control |
210 | 232 | ||
211 | tmake: objects \ | 233 | tmake: objects \ |
212 | qtcompat/Makefile$(PLATFORM) \ | 234 | qtcompat/Makefile$(PLATFORM) \ |
213 | microkde/Makefile$(PLATFORM) \ | 235 | microkde/Makefile$(PLATFORM) \ |
214 | libkcal/Makefile$(PLATFORM) \ | 236 | libkcal/Makefile$(PLATFORM) \ |
215 | libkdepim/Makefile$(PLATFORM) \ | 237 | libkdepim/Makefile$(PLATFORM) \ |
216 | korganizer/Makefile$(PLATFORM) \ | 238 | korganizer/Makefile$(PLATFORM) \ |
217 | kalarmd/Makefile$(PLATFORM) \ | 239 | kalarmd/Makefile$(PLATFORM) \ |
218 | libical/src/libical/Makefile$(PLATFORM) \ | 240 | libical/src/libical/Makefile$(PLATFORM) \ |
219 | libical/src/libicalss/Makefile$(PLATFORM) \ | 241 | libical/src/libicalss/Makefile$(PLATFORM) \ |
220 | kabc/Makefile$(PLATFORM) \ | 242 | kabc/Makefile$(PLATFORM) \ |
221 | kabc/formats/binary/Makefile$(PLATFORM) \ | 243 | kabc/formats/binary/Makefile$(PLATFORM) \ |
222 | kabc/plugins/file/Makefile$(PLATFORM) \ | 244 | kabc/plugins/file/Makefile$(PLATFORM) \ |
223 | kabc/plugins/dir/Makefile$(PLATFORM) \ | 245 | kabc/plugins/dir/Makefile$(PLATFORM) \ |
224 | kabc/plugins/ldap/Makefile$(PLATFORM) \ | 246 | kabc/plugins/ldap/Makefile$(PLATFORM) \ |
225 | kabc/plugins/opie/Makefile$(PLATFORM) \ | 247 | kabc/plugins/opie/Makefile$(PLATFORM) \ |
226 | kabc/plugins/qtopia/Makefile$(PLATFORM) \ | 248 | kabc/plugins/qtopia/Makefile$(PLATFORM) \ |
227 | kabc/plugins/sharpdtm/Makefile$(PLATFORM) \ | 249 | kabc/plugins/sharpdtm/Makefile$(PLATFORM) \ |
228 | kaddressbook/Makefile$(PLATFORM) \ | 250 | kaddressbook/Makefile$(PLATFORM) \ |
229 | kmicromail/Makefile$(PLATFORM) \ | 251 | kmicromail/Makefile$(PLATFORM) \ |
230 | kmicromail/libetpan/Makefile$(PLATFORM) \ | 252 | kmicromail/libetpan/Makefile$(PLATFORM) \ |
231 | kmicromail/libmailwrapper/Makefile$(PLATFORM) \ | 253 | kmicromail/libmailwrapper/Makefile$(PLATFORM) \ |
232 | gammu/emb/common/Makefile$(PLATFORM) \ | 254 | gammu/emb/common/Makefile$(PLATFORM) \ |
233 | gammu/emb/gammu/Makefile$(PLATFORM) \ | 255 | gammu/emb/gammu/Makefile$(PLATFORM) \ |
234 | 256 | pwmanager/pwmanager/Makefile$(PLATFORM) \ | |
235 | 257 | ||
236 | 258 | ||
237 | 259 | ||
238 | qtcompat/Makefile$(PLATFORM): qtcompat/qtcompat.pro | 260 | qtcompat/Makefile$(PLATFORM): qtcompat/qtcompat.pro |
239 | cd qtcompat; tmake "CONFIG+=$(RELEASE_DEBUG)" qtcompat.pro -o Makefile$(PLATFORM) | 261 | cd qtcompat; tmake "CONFIG+=$(RELEASE_DEBUG)" qtcompat.pro -o Makefile$(PLATFORM) |
240 | 262 | ||
241 | microkde/Makefile$(PLATFORM): microkde/microkdeE.pro | 263 | microkde/Makefile$(PLATFORM): microkde/microkdeE.pro |
242 | cd microkde; tmake "CONFIG+=$(RELEASE_DEBUG)" microkdeE.pro -o Makefile$(PLATFORM) | 264 | cd microkde; tmake "CONFIG+=$(RELEASE_DEBUG)" microkdeE.pro -o Makefile$(PLATFORM) |
243 | 265 | ||
244 | libkcal/Makefile$(PLATFORM): libkcal/libkcalE.pro | 266 | libkcal/Makefile$(PLATFORM): libkcal/libkcalE.pro |
245 | cd libkcal; tmake "CONFIG+=$(RELEASE_DEBUG)" libkcalE.pro -o Makefile$(PLATFORM) | 267 | cd libkcal; tmake "CONFIG+=$(RELEASE_DEBUG)" libkcalE.pro -o Makefile$(PLATFORM) |
246 | 268 | ||
247 | 269 | ||
248 | libkdepim/Makefile$(PLATFORM): libkdepim/libkdepimE.pro | 270 | libkdepim/Makefile$(PLATFORM): libkdepim/libkdepimE.pro |
249 | cd libkdepim; tmake "CONFIG+=$(RELEASE_DEBUG)" libkdepimE.pro -o Makefile$(PLATFORM) | 271 | cd libkdepim; tmake "CONFIG+=$(RELEASE_DEBUG)" libkdepimE.pro -o Makefile$(PLATFORM) |
250 | 272 | ||
251 | kalarmd/Makefile$(PLATFORM): kalarmd/kalarmdE.pro | 273 | kalarmd/Makefile$(PLATFORM): kalarmd/kalarmdE.pro |
252 | cd kalarmd; tmake "CONFIG+=$(RELEASE_DEBUG)" kalarmdE.pro -o Makefile$(PLATFORM) | 274 | cd kalarmd; tmake "CONFIG+=$(RELEASE_DEBUG)" kalarmdE.pro -o Makefile$(PLATFORM) |
253 | 275 | ||
254 | korganizer/Makefile$(PLATFORM): korganizer/korganizerE.pro | 276 | korganizer/Makefile$(PLATFORM): korganizer/korganizerE.pro |
255 | cd korganizer; tmake "CONFIG+=$(RELEASE_DEBUG)" korganizerE.pro -o Makefile$(PLATFORM) | 277 | cd korganizer; tmake "CONFIG+=$(RELEASE_DEBUG)" korganizerE.pro -o Makefile$(PLATFORM) |
256 | 278 | ||
257 | libical/src/libical/Makefile$(PLATFORM): libical/src/libical/libicalE.pro | 279 | libical/src/libical/Makefile$(PLATFORM): libical/src/libical/libicalE.pro |
258 | cd libical/src/libical; tmake "CONFIG+=$(RELEASE_DEBUG)" libicalE.pro -o Makefile$(PLATFORM) | 280 | cd libical/src/libical; tmake "CONFIG+=$(RELEASE_DEBUG)" libicalE.pro -o Makefile$(PLATFORM) |
259 | 281 | ||
260 | libical/src/libicalss/Makefile$(PLATFORM): libical/src/libicalss/libicalssE.pro | 282 | libical/src/libicalss/Makefile$(PLATFORM): libical/src/libicalss/libicalssE.pro |
261 | cd libical/src/libicalss; tmake "CONFIG+=$(RELEASE_DEBUG)" libicalssE.pro -o Makefile$(PLATFORM) | 283 | cd libical/src/libicalss; tmake "CONFIG+=$(RELEASE_DEBUG)" libicalssE.pro -o Makefile$(PLATFORM) |
262 | 284 | ||
263 | kabc/Makefile$(PLATFORM): kabc/kabcE.pro | 285 | kabc/Makefile$(PLATFORM): kabc/kabcE.pro |
264 | cd kabc; tmake "CONFIG+=$(RELEASE_DEBUG)" kabcE.pro -o Makefile$(PLATFORM) | 286 | cd kabc; tmake "CONFIG+=$(RELEASE_DEBUG)" kabcE.pro -o Makefile$(PLATFORM) |
265 | 287 | ||
266 | kabc/formats/binary/Makefile$(PLATFORM): kabc/formats/binary/kabcformat_binaryE.pro | 288 | kabc/formats/binary/Makefile$(PLATFORM): kabc/formats/binary/kabcformat_binaryE.pro |
267 | cd kabc/formats/binary; tmake "CONFIG+=$(RELEASE_DEBUG)" kabcformat_binaryE.pro -o Makefile$(PLATFORM) | 289 | cd kabc/formats/binary; tmake "CONFIG+=$(RELEASE_DEBUG)" kabcformat_binaryE.pro -o Makefile$(PLATFORM) |
268 | 290 | ||
269 | kabc/plugins/file/Makefile$(PLATFORM): kabc/plugins/file/fileE.pro | 291 | kabc/plugins/file/Makefile$(PLATFORM): kabc/plugins/file/fileE.pro |
270 | cd kabc/plugins/file; tmake "CONFIG+=$(RELEASE_DEBUG)" fileE.pro -o Makefile$(PLATFORM) | 292 | cd kabc/plugins/file; tmake "CONFIG+=$(RELEASE_DEBUG)" fileE.pro -o Makefile$(PLATFORM) |
271 | 293 | ||
272 | kabc/plugins/dir/Makefile$(PLATFORM): kabc/plugins/dir/dirE.pro | 294 | kabc/plugins/dir/Makefile$(PLATFORM): kabc/plugins/dir/dirE.pro |
273 | cd kabc/plugins/dir; tmake "CONFIG+=$(RELEASE_DEBUG)" dirE.pro -o Makefile$(PLATFORM) | 295 | cd kabc/plugins/dir; tmake "CONFIG+=$(RELEASE_DEBUG)" dirE.pro -o Makefile$(PLATFORM) |
274 | 296 | ||
275 | kabc/plugins/ldap/Makefile$(PLATFORM): kabc/plugins/ldap/ldapE.pro | 297 | kabc/plugins/ldap/Makefile$(PLATFORM): kabc/plugins/ldap/ldapE.pro |
276 | cd kabc/plugins/ldap; tmake "CONFIG+=$(RELEASE_DEBUG)" ldapE.pro -o Makefile$(PLATFORM) | 298 | cd kabc/plugins/ldap; tmake "CONFIG+=$(RELEASE_DEBUG)" ldapE.pro -o Makefile$(PLATFORM) |
277 | 299 | ||
278 | kabc/plugins/opie/Makefile$(PLATFORM): kabc/plugins/opie/opieE.pro | 300 | kabc/plugins/opie/Makefile$(PLATFORM): kabc/plugins/opie/opieE.pro |
279 | cd kabc/plugins/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" opieE.pro -o Makefile$(PLATFORM) | 301 | cd kabc/plugins/opie; tmake "CONFIG+=$(RELEASE_DEBUG)" opieE.pro -o Makefile$(PLATFORM) |
280 | 302 | ||
281 | kabc/plugins/qtopia/Makefile$(PLATFORM): kabc/plugins/qtopia/qtopiaE.pro | 303 | kabc/plugins/qtopia/Makefile$(PLATFORM): kabc/plugins/qtopia/qtopiaE.pro |
282 | cd kabc/plugins/qtopia; tmake "CONFIG+=$(RELEASE_DEBUG)" qtopiaE.pro -o Makefile$(PLATFORM) | 304 | cd kabc/plugins/qtopia; tmake "CONFIG+=$(RELEASE_DEBUG)" qtopiaE.pro -o Makefile$(PLATFORM) |
283 | 305 | ||
284 | kabc/plugins/sharpdtm/Makefile$(PLATFORM): kabc/plugins/sharpdtm/sharpdtmE.pro | 306 | kabc/plugins/sharpdtm/Makefile$(PLATFORM): kabc/plugins/sharpdtm/sharpdtmE.pro |
285 | cd kabc/plugins/sharpdtm; tmake "CONFIG+=$(RELEASE_DEBUG)" sharpdtmE.pro -o Makefile$(PLATFORM) | 307 | cd kabc/plugins/sharpdtm; tmake "CONFIG+=$(RELEASE_DEBUG)" sharpdtmE.pro -o Makefile$(PLATFORM) |
286 | 308 | ||
287 | kaddressbook/Makefile$(PLATFORM): kaddressbook/kaddressbookE.pro | 309 | kaddressbook/Makefile$(PLATFORM): kaddressbook/kaddressbookE.pro |
288 | cd kaddressbook; tmake "CONFIG+=$(RELEASE_DEBUG)" kaddressbookE.pro -o Makefile$(PLATFORM) | 310 | cd kaddressbook; tmake "CONFIG+=$(RELEASE_DEBUG)" kaddressbookE.pro -o Makefile$(PLATFORM) |
289 | 311 | ||
290 | kmicromail/Makefile$(PLATFORM): kmicromail/kmicromailE.pro | 312 | kmicromail/Makefile$(PLATFORM): kmicromail/kmicromailE.pro |
291 | cd kmicromail; tmake "CONFIG+=$(RELEASE_DEBUG)" kmicromailE.pro -o Makefile$(PLATFORM) | 313 | cd kmicromail; tmake "CONFIG+=$(RELEASE_DEBUG)" kmicromailE.pro -o Makefile$(PLATFORM) |
292 | 314 | ||
293 | kmicromail/libetpan/Makefile$(PLATFORM): kmicromail/libetpan/libetpanE.pro | 315 | kmicromail/libetpan/Makefile$(PLATFORM): kmicromail/libetpan/libetpanE.pro |
294 | cd kmicromail/libetpan; tmake "CONFIG+=$(RELEASE_DEBUG)" libetpanE.pro -o Makefile$(PLATFORM) | 316 | cd kmicromail/libetpan; tmake "CONFIG+=$(RELEASE_DEBUG)" libetpanE.pro -o Makefile$(PLATFORM) |
295 | 317 | ||
296 | kmicromail/libmailwrapper/Makefile$(PLATFORM): kmicromail/libmailwrapper/libmailwrapperE.pro | 318 | kmicromail/libmailwrapper/Makefile$(PLATFORM): kmicromail/libmailwrapper/libmailwrapperE.pro |
297 | cd kmicromail/libmailwrapper; tmake "CONFIG+=$(RELEASE_DEBUG)" libmailwrapperE.pro -o Makefile$(PLATFORM) | 319 | cd kmicromail/libmailwrapper; tmake "CONFIG+=$(RELEASE_DEBUG)" libmailwrapperE.pro -o Makefile$(PLATFORM) |
298 | 320 | ||
299 | gammu/emb/common/Makefile$(PLATFORM): gammu/emb/common/commonE.pro | 321 | gammu/emb/common/Makefile$(PLATFORM): gammu/emb/common/commonE.pro |
300 | cd gammu/emb/common; tmake "CONFIG+=$(RELEASE_DEBUG)" commonE.pro -o Makefile$(PLATFORM) | 322 | cd gammu/emb/common; tmake "CONFIG+=$(RELEASE_DEBUG)" commonE.pro -o Makefile$(PLATFORM) |
301 | 323 | ||
302 | gammu/emb/gammu/Makefile$(PLATFORM): gammu/emb/gammu/gammuE.pro | 324 | gammu/emb/gammu/Makefile$(PLATFORM): gammu/emb/gammu/gammuE.pro |
303 | cd gammu/emb/gammu; tmake "CONFIG+=$(RELEASE_DEBUG)" gammuE.pro -o Makefile$(PLATFORM) | 325 | cd gammu/emb/gammu; tmake "CONFIG+=$(RELEASE_DEBUG)" gammuE.pro -o Makefile$(PLATFORM) |
326 | |||
327 | pwmanager/pwmanager/Makefile$(PLATFORM): pwmanager/pwmanager/pwmanagerE.pro | ||
328 | cd pwmanager/pwmanager; tmake "CONFIG+=$(RELEASE_DEBUG)" pwmanagerE.pro -o Makefile$(PLATFORM) | ||
diff --git a/kmicromail/accountitem.cpp b/kmicromail/accountitem.cpp index 59c8abb..12d047a 100644 --- a/kmicromail/accountitem.cpp +++ b/kmicromail/accountitem.cpp | |||
@@ -1,1172 +1,1172 @@ | |||
1 | 1 | ||
2 | #include "accountitem.h" | 2 | #include "accountitem.h" |
3 | #include "accountview.h" | 3 | #include "accountview.h" |
4 | #include "newmaildir.h" | 4 | #include "newmaildir.h" |
5 | #include "nntpgroupsdlg.h" | 5 | #include "nntpgroupsdlg.h" |
6 | #include "defines.h" | 6 | #include "defines.h" |
7 | 7 | ||
8 | #include <libmailwrapper/mailtypes.h> | 8 | #include <libmailwrapper/mailtypes.h> |
9 | #include <libmailwrapper/abstractmail.h> | 9 | #include <libmailwrapper/abstractmail.h> |
10 | #include <libmailwrapper/mailwrapper.h> | 10 | #include <libmailwrapper/mailwrapper.h> |
11 | /* OPIE */ | 11 | /* OPIE */ |
12 | //#include <qpe/qpeapplication.h> | 12 | //#include <qpe/qpeapplication.h> |
13 | 13 | ||
14 | /* QT */ | 14 | /* QT */ |
15 | #include <qpopupmenu.h> | 15 | #include <qpopupmenu.h> |
16 | #include <qmessagebox.h> | 16 | #include <qmessagebox.h> |
17 | #include <kiconloader.h> | 17 | #include <kiconloader.h> |
18 | 18 | ||
19 | #define GET_NEW_MAILS 101 | 19 | #define GET_NEW_MAILS 101 |
20 | 20 | ||
21 | using namespace Opie::Core; | 21 | using namespace Opie::Core; |
22 | #define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );} | 22 | #define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );} |
23 | /** | 23 | /** |
24 | * POP3 Account stuff | 24 | * POP3 Account stuff |
25 | */ | 25 | */ |
26 | POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent ) | 26 | POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent ) |
27 | : AccountViewItem( parent ) | 27 | : AccountViewItem( parent ) |
28 | { | 28 | { |
29 | account = a; | 29 | account = a; |
30 | wrapper = AbstractMail::getWrapper( account ); | 30 | wrapper = AbstractMail::getWrapper( account ); |
31 | SETPIX(PIXMAP_POP3FOLDER); | 31 | SETPIX(PIXMAP_POP3FOLDER); |
32 | #if 0 | 32 | #if 0 |
33 | if (!account->getOffline()) | 33 | if (!account->getOffline()) |
34 | { | 34 | { |
35 | setPixmap( 0, ); | 35 | setPixmap( 0, ); |
36 | } | 36 | } |
37 | else | 37 | else |
38 | { | 38 | { |
39 | setPixmap( 0, PIXMAP_OFFLINE ); | 39 | setPixmap( 0, PIXMAP_OFFLINE ); |
40 | } | 40 | } |
41 | #endif | 41 | #endif |
42 | setText( 0, account->getAccountName() ); | 42 | setText( 0, account->getAccountName() ); |
43 | setOpen( true ); | 43 | setOpen( true ); |
44 | } | 44 | } |
45 | 45 | ||
46 | POP3viewItem::~POP3viewItem() | 46 | POP3viewItem::~POP3viewItem() |
47 | { | 47 | { |
48 | delete wrapper; | 48 | delete wrapper; |
49 | } | 49 | } |
50 | 50 | ||
51 | AbstractMail *POP3viewItem::getWrapper() | 51 | AbstractMail *POP3viewItem::getWrapper() |
52 | { | 52 | { |
53 | return wrapper; | 53 | return wrapper; |
54 | } | 54 | } |
55 | 55 | ||
56 | void POP3viewItem::refresh(QValueList<Opie::Core::OSmartPointer<RecMail> > & ) | 56 | void POP3viewItem::refresh(QValueList<Opie::Core::OSmartPointer<RecMail> > & ) |
57 | { | 57 | { |
58 | refresh(); | 58 | refresh(); |
59 | } | 59 | } |
60 | 60 | ||
61 | void POP3viewItem::refresh() | 61 | void POP3viewItem::refresh() |
62 | { | 62 | { |
63 | if (account->getOffline()) return; | 63 | if (account->getOffline()) return; |
64 | QValueList<FolderP> *folders = wrapper->listFolders(); | 64 | QValueList<FolderP> *folders = wrapper->listFolders(); |
65 | QListViewItem *child = firstChild(); | 65 | QListViewItem *child = firstChild(); |
66 | while ( child ) | 66 | while ( child ) |
67 | { | 67 | { |
68 | QListViewItem *tmp = child; | 68 | QListViewItem *tmp = child; |
69 | child = child->nextSibling(); | 69 | child = child->nextSibling(); |
70 | delete tmp; | 70 | delete tmp; |
71 | } | 71 | } |
72 | QValueList<FolderP>::ConstIterator it; | 72 | QValueList<FolderP>::ConstIterator it; |
73 | QListViewItem*item = 0; | 73 | QListViewItem*item = 0; |
74 | for ( it = folders->begin(); it!=folders->end(); ++it) | 74 | for ( it = folders->begin(); it!=folders->end(); ++it) |
75 | { | 75 | { |
76 | item = new POP3folderItem( (*it), this , item ); | 76 | item = new POP3folderItem( (*it), this , item ); |
77 | item->setSelectable( (*it)->may_select()); | 77 | item->setSelectable( (*it)->may_select()); |
78 | } | 78 | } |
79 | delete folders; | 79 | delete folders; |
80 | } | 80 | } |
81 | 81 | ||
82 | RECBODYP POP3viewItem::fetchBody( const RecMailP &mail ) | 82 | RECBODYP POP3viewItem::fetchBody( const RecMailP &mail ) |
83 | { | 83 | { |
84 | 84 | ||
85 | return wrapper->fetchBody( mail ); | 85 | return wrapper->fetchBody( mail ); |
86 | } | 86 | } |
87 | 87 | ||
88 | QPopupMenu * POP3viewItem::getContextMenu() | 88 | QPopupMenu * POP3viewItem::getContextMenu() |
89 | { | 89 | { |
90 | QPopupMenu *m = new QPopupMenu(0); | 90 | QPopupMenu *m = new QPopupMenu(0); |
91 | if (m) | 91 | if (m) |
92 | { | 92 | { |
93 | if (!account->getOffline()) | 93 | if (!account->getOffline()) |
94 | { | 94 | { |
95 | m->insertItem(QObject::tr("Disconnect",contextName),0); | 95 | m->insertItem(QObject::tr("Disconnect",contextName),0); |
96 | m->insertItem(QObject::tr("Set offline",contextName),1); | 96 | m->insertItem(QObject::tr("Set offline",contextName),1); |
97 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); | 97 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); |
98 | } | 98 | } |
99 | else | 99 | else |
100 | { | 100 | { |
101 | m->insertItem(QObject::tr("Set online",contextName),1); | 101 | m->insertItem(QObject::tr("Set online",contextName),1); |
102 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); | 102 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); |
103 | } | 103 | } |
104 | } | 104 | } |
105 | return m; | 105 | return m; |
106 | } | 106 | } |
107 | 107 | ||
108 | void POP3viewItem::disconnect() | 108 | void POP3viewItem::disconnect() |
109 | { | 109 | { |
110 | QListViewItem *child = firstChild(); | 110 | QListViewItem *child = firstChild(); |
111 | while ( child ) | 111 | while ( child ) |
112 | { | 112 | { |
113 | QListViewItem *tmp = child; | 113 | QListViewItem *tmp = child; |
114 | child = child->nextSibling(); | 114 | child = child->nextSibling(); |
115 | delete tmp; | 115 | delete tmp; |
116 | } | 116 | } |
117 | wrapper->logout(); | 117 | wrapper->logout(); |
118 | } | 118 | } |
119 | 119 | ||
120 | void POP3viewItem::setOnOffline() | 120 | void POP3viewItem::setOnOffline() |
121 | { | 121 | { |
122 | if (!account->getOffline()) | 122 | if (!account->getOffline()) |
123 | { | 123 | { |
124 | disconnect(); | 124 | disconnect(); |
125 | } | 125 | } |
126 | account->setOffline(!account->getOffline()); | 126 | account->setOffline(!account->getOffline()); |
127 | account->save(); | 127 | account->save(); |
128 | SETPIX(PIXMAP_POP3FOLDER); | 128 | SETPIX(PIXMAP_POP3FOLDER); |
129 | refresh(); | 129 | refresh(); |
130 | } | 130 | } |
131 | 131 | ||
132 | void POP3viewItem::contextMenuSelected(int which) | 132 | void POP3viewItem::contextMenuSelected(int which) |
133 | { | 133 | { |
134 | switch (which) | 134 | switch (which) |
135 | { | 135 | { |
136 | case 0: | 136 | case 0: |
137 | disconnect(); | 137 | disconnect(); |
138 | break; | 138 | break; |
139 | case 1: | 139 | case 1: |
140 | setOnOffline(); | 140 | setOnOffline(); |
141 | break; | 141 | break; |
142 | case GET_NEW_MAILS: // daunlood | 142 | case GET_NEW_MAILS: // daunlood |
143 | if (account->getOffline()) | 143 | if (account->getOffline()) |
144 | setOnOffline(); | 144 | setOnOffline(); |
145 | AccountView*bl = accountView(); | 145 | AccountView*bl = accountView(); |
146 | if (!bl) return; | 146 | if (!bl) return; |
147 | AccountViewItem* in = findSubItem( "inbox" , 0); | 147 | AccountViewItem* in = findSubItem( "inbox" , 0); |
148 | if ( ! in ) | 148 | if ( ! in ) |
149 | return; | 149 | return; |
150 | bl->downloadMailsInbox(in->getFolder() ,getWrapper()); | 150 | bl->downloadMailsInbox(in->getFolder() ,getWrapper()); |
151 | setOnOffline(); | 151 | setOnOffline(); |
152 | break; | 152 | break; |
153 | } | 153 | } |
154 | } | 154 | } |
155 | 155 | ||
156 | POP3folderItem::~POP3folderItem() | 156 | POP3folderItem::~POP3folderItem() |
157 | {} | 157 | {} |
158 | 158 | ||
159 | POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , QListViewItem*after ) | 159 | POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , QListViewItem*after ) |
160 | : AccountViewItem(folderInit,parent,after ) | 160 | : AccountViewItem(folderInit,parent,after ) |
161 | { | 161 | { |
162 | pop3 = parent; | 162 | pop3 = parent; |
163 | if (folder->getDisplayName().lower()!="inbox") | 163 | if (folder->getDisplayName().lower()!="inbox") |
164 | { | 164 | { |
165 | setPixmap( 0, PIXMAP_POP3FOLDER ); | 165 | setPixmap( 0, PIXMAP_POP3FOLDER ); |
166 | } | 166 | } |
167 | else | 167 | else |
168 | { | 168 | { |
169 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 169 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
170 | } | 170 | } |
171 | setText( 0, folder->getDisplayName() ); | 171 | setText( 0, folder->getDisplayName() ); |
172 | } | 172 | } |
173 | 173 | ||
174 | void POP3folderItem::refresh(QValueList<RecMailP>&target) | 174 | void POP3folderItem::refresh(QValueList<RecMailP>&target) |
175 | { | 175 | { |
176 | if (folder->may_select()) | 176 | if (folder->may_select()) |
177 | pop3->getWrapper()->listMessages( folder->getName(),target ); | 177 | pop3->getWrapper()->listMessages( folder->getName(),target ); |
178 | } | 178 | } |
179 | 179 | ||
180 | RECBODYP POP3folderItem::fetchBody(const RecMailP&aMail) | 180 | RECBODYP POP3folderItem::fetchBody(const RecMailP&aMail) |
181 | { | 181 | { |
182 | return pop3->getWrapper()->fetchBody(aMail); | 182 | return pop3->getWrapper()->fetchBody(aMail); |
183 | } | 183 | } |
184 | 184 | ||
185 | QPopupMenu * POP3folderItem::getContextMenu() | 185 | QPopupMenu * POP3folderItem::getContextMenu() |
186 | { | 186 | { |
187 | QPopupMenu *m = new QPopupMenu(0); | 187 | QPopupMenu *m = new QPopupMenu(0); |
188 | if (m) | 188 | if (m) |
189 | { | 189 | { |
190 | m->insertItem(QObject::tr("Refresh header list",contextName),0); | 190 | m->insertItem(QObject::tr("Refresh header list",contextName),0); |
191 | m->insertItem(QObject::tr("Delete all mails",contextName),1); | 191 | m->insertItem(QObject::tr("Delete all mails",contextName),1); |
192 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); | 192 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); |
193 | } | 193 | } |
194 | return m; | 194 | return m; |
195 | } | 195 | } |
196 | 196 | ||
197 | void POP3folderItem::downloadMails() | 197 | void POP3folderItem::downloadMails() |
198 | { | 198 | { |
199 | AccountView*bl = pop3->accountView(); | 199 | AccountView*bl = pop3->accountView(); |
200 | if (!bl) return; | 200 | if (!bl) return; |
201 | bl->downloadMails(folder,pop3->getWrapper()); | 201 | bl->downloadMails(folder,pop3->getWrapper()); |
202 | } | 202 | } |
203 | 203 | ||
204 | void POP3folderItem::contextMenuSelected(int which) | 204 | void POP3folderItem::contextMenuSelected(int which) |
205 | { | 205 | { |
206 | AccountView * view = (AccountView*)listView(); | 206 | AccountView * view = (AccountView*)listView(); |
207 | switch (which) | 207 | switch (which) |
208 | { | 208 | { |
209 | case 0: | 209 | case 0: |
210 | /* must be 'cause pop3 lists are cached */ | 210 | /* must be 'cause pop3 lists are cached */ |
211 | pop3->getWrapper()->logout(); | 211 | pop3->getWrapper()->logout(); |
212 | view->refreshCurrent(); | 212 | view->refreshCurrent(); |
213 | break; | 213 | break; |
214 | case 1: | 214 | case 1: |
215 | deleteAllMail(pop3->getWrapper(),folder); | 215 | deleteAllMail(pop3->getWrapper(),folder); |
216 | break; | 216 | break; |
217 | case 2: | 217 | case 2: |
218 | downloadMails(); | 218 | downloadMails(); |
219 | break; | 219 | break; |
220 | default: | 220 | default: |
221 | break; | 221 | break; |
222 | } | 222 | } |
223 | } | 223 | } |
224 | 224 | ||
225 | /** | 225 | /** |
226 | * NNTP Account stuff | 226 | * NNTP Account stuff |
227 | */ | 227 | */ |
228 | NNTPviewItem::NNTPviewItem( NNTPaccount *a, AccountView *parent ) | 228 | NNTPviewItem::NNTPviewItem( NNTPaccount *a, AccountView *parent ) |
229 | : AccountViewItem( parent ) | 229 | : AccountViewItem( parent ) |
230 | { | 230 | { |
231 | account = a; | 231 | account = a; |
232 | wrapper = AbstractMail::getWrapper( account ); | 232 | wrapper = AbstractMail::getWrapper( account ); |
233 | //FIXME | 233 | //FIXME |
234 | SETPIX(PIXMAP_POP3FOLDER); | 234 | SETPIX(PIXMAP_POP3FOLDER); |
235 | #if 0 | 235 | #if 0 |
236 | if (!account->getOffline()) | 236 | if (!account->getOffline()) |
237 | { | 237 | { |
238 | setPixmap( 0, ); | 238 | setPixmap( 0, ); |
239 | } | 239 | } |
240 | else | 240 | else |
241 | { | 241 | { |
242 | setPixmap( 0, PIXMAP_OFFLINE ); | 242 | setPixmap( 0, PIXMAP_OFFLINE ); |
243 | } | 243 | } |
244 | #endif | 244 | #endif |
245 | setText( 0, account->getAccountName() ); | 245 | setText( 0, account->getAccountName() ); |
246 | setOpen( true ); | 246 | setOpen( true ); |
247 | } | 247 | } |
248 | 248 | ||
249 | NNTPviewItem::~NNTPviewItem() | 249 | NNTPviewItem::~NNTPviewItem() |
250 | { | 250 | { |
251 | delete wrapper; | 251 | delete wrapper; |
252 | } | 252 | } |
253 | 253 | ||
254 | AbstractMail *NNTPviewItem::getWrapper() | 254 | AbstractMail *NNTPviewItem::getWrapper() |
255 | { | 255 | { |
256 | return wrapper; | 256 | return wrapper; |
257 | } | 257 | } |
258 | 258 | ||
259 | void NNTPviewItem::refresh( QValueList<RecMailP> & ) | 259 | void NNTPviewItem::refresh( QValueList<RecMailP> & ) |
260 | { | 260 | { |
261 | refresh(); | 261 | refresh(); |
262 | } | 262 | } |
263 | 263 | ||
264 | void NNTPviewItem::refresh() | 264 | void NNTPviewItem::refresh() |
265 | { | 265 | { |
266 | if (account->getOffline()) return; | 266 | if (account->getOffline()) return; |
267 | QValueList<FolderP> *folders = wrapper->listFolders(); | 267 | QValueList<FolderP> *folders = wrapper->listFolders(); |
268 | 268 | ||
269 | QListViewItem *child = firstChild(); | 269 | QListViewItem *child = firstChild(); |
270 | while ( child ) | 270 | while ( child ) |
271 | { | 271 | { |
272 | QListViewItem *tmp = child; | 272 | QListViewItem *tmp = child; |
273 | child = child->nextSibling(); | 273 | child = child->nextSibling(); |
274 | delete tmp; | 274 | delete tmp; |
275 | } | 275 | } |
276 | QValueList<FolderP>::ConstIterator it; | 276 | QValueList<FolderP>::ConstIterator it; |
277 | QListViewItem*item = 0; | 277 | QListViewItem*item = 0; |
278 | for ( it = folders->begin(); it!=folders->end(); ++it) | 278 | for ( it = folders->begin(); it!=folders->end(); ++it) |
279 | { | 279 | { |
280 | item = new NNTPfolderItem( (*it), this , item ); | 280 | item = new NNTPfolderItem( (*it), this , item ); |
281 | item->setSelectable( (*it)->may_select()); | 281 | item->setSelectable( (*it)->may_select()); |
282 | } | 282 | } |
283 | delete folders; | 283 | delete folders; |
284 | } | 284 | } |
285 | 285 | ||
286 | RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail ) | 286 | RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail ) |
287 | { | 287 | { |
288 | 288 | ||
289 | return wrapper->fetchBody( mail ); | 289 | return wrapper->fetchBody( mail ); |
290 | } | 290 | } |
291 | 291 | ||
292 | QPopupMenu * NNTPviewItem::getContextMenu() | 292 | QPopupMenu * NNTPviewItem::getContextMenu() |
293 | { | 293 | { |
294 | QPopupMenu *m = new QPopupMenu(0); | 294 | QPopupMenu *m = new QPopupMenu(0); |
295 | if (m) | 295 | if (m) |
296 | { | 296 | { |
297 | if (!account->getOffline()) | 297 | if (!account->getOffline()) |
298 | { | 298 | { |
299 | m->insertItem(QObject::tr("Disconnect",contextName),0); | 299 | m->insertItem(QObject::tr("Disconnect",contextName),0); |
300 | m->insertItem(QObject::tr("Set offline",contextName),1); | 300 | m->insertItem(QObject::tr("Set offline",contextName),1); |
301 | m->insertItem(QObject::tr("(Un-)Subscribe groups",contextName),2); | 301 | m->insertItem(QObject::tr("(Un-)Subscribe groups",contextName),2); |
302 | } | 302 | } |
303 | else | 303 | else |
304 | { | 304 | { |
305 | m->insertItem(QObject::tr("Set online",contextName),1); | 305 | m->insertItem(QObject::tr("Set online",contextName),1); |
306 | } | 306 | } |
307 | } | 307 | } |
308 | return m; | 308 | return m; |
309 | } | 309 | } |
310 | 310 | ||
311 | void NNTPviewItem::subscribeGroups() | 311 | void NNTPviewItem::subscribeGroups() |
312 | { | 312 | { |
313 | NNTPGroupsDlg dlg(account); | 313 | NNTPGroupsDlg dlg(account); |
314 | dlg.showMaximized(); | 314 | dlg.showMaximized(); |
315 | if ( dlg.exec()== QDialog::Accepted ){ | 315 | if ( dlg.exec()== QDialog::Accepted ){ |
316 | refresh(); | 316 | refresh(); |
317 | } | 317 | } |
318 | } | 318 | } |
319 | 319 | ||
320 | void NNTPviewItem::disconnect() | 320 | void NNTPviewItem::disconnect() |
321 | { | 321 | { |
322 | QListViewItem *child = firstChild(); | 322 | QListViewItem *child = firstChild(); |
323 | while ( child ) | 323 | while ( child ) |
324 | { | 324 | { |
325 | QListViewItem *tmp = child; | 325 | QListViewItem *tmp = child; |
326 | child = child->nextSibling(); | 326 | child = child->nextSibling(); |
327 | delete tmp; | 327 | delete tmp; |
328 | } | 328 | } |
329 | wrapper->logout(); | 329 | wrapper->logout(); |
330 | } | 330 | } |
331 | 331 | ||
332 | void NNTPviewItem::setOnOffline() | 332 | void NNTPviewItem::setOnOffline() |
333 | { | 333 | { |
334 | if (!account->getOffline()) | 334 | if (!account->getOffline()) |
335 | { | 335 | { |
336 | disconnect(); | 336 | disconnect(); |
337 | } | 337 | } |
338 | account->setOffline(!account->getOffline()); | 338 | account->setOffline(!account->getOffline()); |
339 | account->save(); | 339 | account->save(); |
340 | //FIXME | 340 | //FIXME |
341 | SETPIX(PIXMAP_POP3FOLDER); | 341 | SETPIX(PIXMAP_POP3FOLDER); |
342 | refresh(); | 342 | refresh(); |
343 | } | 343 | } |
344 | 344 | ||
345 | void NNTPviewItem::contextMenuSelected(int which) | 345 | void NNTPviewItem::contextMenuSelected(int which) |
346 | { | 346 | { |
347 | switch (which) | 347 | switch (which) |
348 | { | 348 | { |
349 | case 0: | 349 | case 0: |
350 | disconnect(); | 350 | disconnect(); |
351 | break; | 351 | break; |
352 | case 1: | 352 | case 1: |
353 | setOnOffline(); | 353 | setOnOffline(); |
354 | break; | 354 | break; |
355 | case 2: | 355 | case 2: |
356 | subscribeGroups(); | 356 | subscribeGroups(); |
357 | break; | 357 | break; |
358 | } | 358 | } |
359 | } | 359 | } |
360 | 360 | ||
361 | NNTPfolderItem::~NNTPfolderItem() | 361 | NNTPfolderItem::~NNTPfolderItem() |
362 | {} | 362 | {} |
363 | 363 | ||
364 | NNTPfolderItem::NNTPfolderItem( const FolderP &folderInit, NNTPviewItem *parent , QListViewItem*after ) | 364 | NNTPfolderItem::NNTPfolderItem( const FolderP &folderInit, NNTPviewItem *parent , QListViewItem*after ) |
365 | : AccountViewItem( folderInit, parent,after ) | 365 | : AccountViewItem( folderInit, parent,after ) |
366 | { | 366 | { |
367 | nntp = parent; | 367 | nntp = parent; |
368 | if (folder->getDisplayName().lower()!="inbox") | 368 | if (folder->getDisplayName().lower()!="inbox") |
369 | { | 369 | { |
370 | setPixmap( 0, PIXMAP_POP3FOLDER ); | 370 | setPixmap( 0, PIXMAP_POP3FOLDER ); |
371 | } | 371 | } |
372 | else | 372 | else |
373 | { | 373 | { |
374 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 374 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
375 | } | 375 | } |
376 | setText( 0, folder->getDisplayName() ); | 376 | setText( 0, folder->getDisplayName() ); |
377 | } | 377 | } |
378 | 378 | ||
379 | void NNTPfolderItem::refresh(QValueList<RecMailP>&target) | 379 | void NNTPfolderItem::refresh(QValueList<RecMailP>&target) |
380 | { | 380 | { |
381 | if (folder->may_select()) | 381 | if (folder->may_select()) |
382 | nntp->getWrapper()->listMessages( folder->getName(),target ); | 382 | nntp->getWrapper()->listMessages( folder->getName(),target ); |
383 | } | 383 | } |
384 | 384 | ||
385 | RECBODYP NNTPfolderItem::fetchBody(const RecMailP&aMail) | 385 | RECBODYP NNTPfolderItem::fetchBody(const RecMailP&aMail) |
386 | { | 386 | { |
387 | return nntp->getWrapper()->fetchBody(aMail); | 387 | return nntp->getWrapper()->fetchBody(aMail); |
388 | } | 388 | } |
389 | 389 | ||
390 | QPopupMenu * NNTPfolderItem::getContextMenu() | 390 | QPopupMenu * NNTPfolderItem::getContextMenu() |
391 | { | 391 | { |
392 | QPopupMenu *m = new QPopupMenu(0); | 392 | QPopupMenu *m = new QPopupMenu(0); |
393 | if (m) | 393 | if (m) |
394 | { | 394 | { |
395 | m->insertItem(QObject::tr("Refresh header list",contextName),0); | 395 | m->insertItem(QObject::tr("Refresh header list",contextName),0); |
396 | m->insertItem(QObject::tr("Copy all postings",contextName),1); | 396 | m->insertItem(QObject::tr("Copy all postings",contextName),1); |
397 | } | 397 | } |
398 | return m; | 398 | return m; |
399 | } | 399 | } |
400 | 400 | ||
401 | void NNTPfolderItem::downloadMails() | 401 | void NNTPfolderItem::downloadMails() |
402 | { | 402 | { |
403 | AccountView*bl = nntp->accountView(); | 403 | AccountView*bl = nntp->accountView(); |
404 | if (!bl) return; | 404 | if (!bl) return; |
405 | bl->downloadMails(folder,nntp->getWrapper()); | 405 | bl->downloadMails(folder,nntp->getWrapper()); |
406 | } | 406 | } |
407 | 407 | ||
408 | void NNTPfolderItem::contextMenuSelected(int which) | 408 | void NNTPfolderItem::contextMenuSelected(int which) |
409 | { | 409 | { |
410 | AccountView * view = (AccountView*)listView(); | 410 | AccountView * view = (AccountView*)listView(); |
411 | switch (which) | 411 | switch (which) |
412 | { | 412 | { |
413 | case 0: | 413 | case 0: |
414 | /* must be 'cause pop3 lists are cached */ | 414 | /* must be 'cause pop3 lists are cached */ |
415 | nntp->getWrapper()->logout(); | 415 | nntp->getWrapper()->logout(); |
416 | view->refreshCurrent(); | 416 | view->refreshCurrent(); |
417 | break; | 417 | break; |
418 | case 1: | 418 | case 1: |
419 | downloadMails(); | 419 | downloadMails(); |
420 | break; | 420 | break; |
421 | default: | 421 | default: |
422 | break; | 422 | break; |
423 | } | 423 | } |
424 | } | 424 | } |
425 | 425 | ||
426 | /** | 426 | /** |
427 | * IMAP Account stuff | 427 | * IMAP Account stuff |
428 | */ | 428 | */ |
429 | IMAPviewItem::IMAPviewItem( IMAPaccount *a, AccountView *parent ) | 429 | IMAPviewItem::IMAPviewItem( IMAPaccount *a, AccountView *parent ) |
430 | : AccountViewItem( parent ) | 430 | : AccountViewItem( parent ) |
431 | { | 431 | { |
432 | account = a; | 432 | account = a; |
433 | wrapper = AbstractMail::getWrapper( account ); | 433 | wrapper = AbstractMail::getWrapper( account ); |
434 | SETPIX(PIXMAP_IMAPFOLDER); | 434 | SETPIX(PIXMAP_IMAPFOLDER); |
435 | setText( 0, account->getAccountName() ); | 435 | setText( 0, account->getAccountName() ); |
436 | setOpen( true ); | 436 | setOpen( true ); |
437 | } | 437 | } |
438 | 438 | ||
439 | IMAPviewItem::~IMAPviewItem() | 439 | IMAPviewItem::~IMAPviewItem() |
440 | { | 440 | { |
441 | delete wrapper; | 441 | delete wrapper; |
442 | } | 442 | } |
443 | 443 | ||
444 | AbstractMail *IMAPviewItem::getWrapper() | 444 | AbstractMail *IMAPviewItem::getWrapper() |
445 | { | 445 | { |
446 | return wrapper; | 446 | return wrapper; |
447 | } | 447 | } |
448 | 448 | ||
449 | void IMAPviewItem::refresh(QValueList<RecMailP>&) | 449 | void IMAPviewItem::refresh(QValueList<RecMailP>&) |
450 | { | 450 | { |
451 | refreshFolders(false); | 451 | refreshFolders(false); |
452 | } | 452 | } |
453 | 453 | ||
454 | const QStringList&IMAPviewItem::subFolders() | 454 | const QStringList&IMAPviewItem::subFolders() |
455 | { | 455 | { |
456 | return currentFolders; | 456 | return currentFolders; |
457 | } | 457 | } |
458 | 458 | ||
459 | void IMAPviewItem::refreshFolders(bool force) | 459 | void IMAPviewItem::refreshFolders(bool force) |
460 | { | 460 | { |
461 | if (childCount()>0 && force==false) return; | 461 | if (childCount()>0 && force==false) return; |
462 | if (account->getOffline()) return; | 462 | if (account->getOffline()) return; |
463 | 463 | ||
464 | removeChilds(); | 464 | removeChilds(); |
465 | currentFolders.clear(); | 465 | currentFolders.clear(); |
466 | QValueList<FolderP> * folders = wrapper->listFolders(); | 466 | QValueList<FolderP> * folders = wrapper->listFolders(); |
467 | 467 | ||
468 | QValueList<FolderP>::Iterator it; | 468 | QValueList<FolderP>::Iterator it; |
469 | QListViewItem*item = 0; | 469 | QListViewItem*item = 0; |
470 | QListViewItem*titem = 0; | 470 | QListViewItem*titem = 0; |
471 | QString fname,del,search; | 471 | QString fname,del,search; |
472 | int pos; | 472 | int pos; |
473 | 473 | ||
474 | for ( it = folders->begin(); it!=folders->end(); ++it) | 474 | for ( it = folders->begin(); it!=folders->end(); ++it) |
475 | { | 475 | { |
476 | if ((*it)->getDisplayName().lower()=="inbox") | 476 | if ((*it)->getDisplayName().lower()=="inbox") |
477 | { | 477 | { |
478 | item = new IMAPfolderItem( (*it), this , item ); | 478 | item = new IMAPfolderItem( (*it), this , item ); |
479 | folders->remove(it); | 479 | folders->remove(it); |
480 | break; | 480 | break; |
481 | } | 481 | } |
482 | } | 482 | } |
483 | for ( it = folders->begin(); it!=folders->end(); ++it) | 483 | for ( it = folders->begin(); it!=folders->end(); ++it) |
484 | { | 484 | { |
485 | fname = (*it)->getDisplayName(); | 485 | fname = (*it)->getDisplayName(); |
486 | currentFolders.append((*it)->getName()); | 486 | currentFolders.append((*it)->getName()); |
487 | pos = fname.findRev((*it)->Separator()); | 487 | pos = fname.findRev((*it)->Separator()); |
488 | if (pos != -1) | 488 | if (pos != -1) |
489 | { | 489 | { |
490 | fname = fname.left(pos); | 490 | fname = fname.left(pos); |
491 | } | 491 | } |
492 | IMAPfolderItem*pitem = (IMAPfolderItem*)findSubItem(fname); | 492 | IMAPfolderItem*pitem = (IMAPfolderItem*)findSubItem(fname); |
493 | if (pitem) | 493 | if (pitem) |
494 | { | 494 | { |
495 | titem = item; | 495 | titem = item; |
496 | item = new IMAPfolderItem( (*it),pitem,pitem->firstChild(),this); | 496 | item = new IMAPfolderItem( (*it),pitem,pitem->firstChild(),this); |
497 | /* setup the short name */ | 497 | /* setup the short name */ |
498 | item->setText(0,(*it)->getDisplayName().right((*it)->getDisplayName().length()-pos-1)); | 498 | item->setText(0,(*it)->getDisplayName().mid(pos+1)); |
499 | item = titem; | 499 | item = titem; |
500 | } | 500 | } |
501 | else | 501 | else |
502 | { | 502 | { |
503 | item = new IMAPfolderItem( (*it), this , item ); | 503 | item = new IMAPfolderItem( (*it), this , item ); |
504 | } | 504 | } |
505 | } | 505 | } |
506 | delete folders; | 506 | delete folders; |
507 | } | 507 | } |
508 | 508 | ||
509 | QPopupMenu * IMAPviewItem::getContextMenu() | 509 | QPopupMenu * IMAPviewItem::getContextMenu() |
510 | { | 510 | { |
511 | QPopupMenu *m = new QPopupMenu(0); | 511 | QPopupMenu *m = new QPopupMenu(0); |
512 | if (m) | 512 | if (m) |
513 | { | 513 | { |
514 | if (!account->getOffline()) | 514 | if (!account->getOffline()) |
515 | { | 515 | { |
516 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); | 516 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); |
517 | m->insertItem(QObject::tr("Create new folder",contextName),1); | 517 | m->insertItem(QObject::tr("Create new folder",contextName),1); |
518 | m->insertSeparator(); | 518 | m->insertSeparator(); |
519 | m->insertItem(QObject::tr("Disconnect",contextName),2); | 519 | m->insertItem(QObject::tr("Disconnect",contextName),2); |
520 | m->insertItem(QObject::tr("Set offline",contextName),3); | 520 | m->insertItem(QObject::tr("Set offline",contextName),3); |
521 | m->insertSeparator(); | 521 | m->insertSeparator(); |
522 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); | 522 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); |
523 | } | 523 | } |
524 | else | 524 | else |
525 | { | 525 | { |
526 | m->insertItem(QObject::tr("Set online",contextName),3); | 526 | m->insertItem(QObject::tr("Set online",contextName),3); |
527 | m->insertSeparator(); | 527 | m->insertSeparator(); |
528 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); | 528 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); |
529 | } | 529 | } |
530 | } | 530 | } |
531 | return m; | 531 | return m; |
532 | } | 532 | } |
533 | 533 | ||
534 | void IMAPviewItem::createNewFolder() | 534 | void IMAPviewItem::createNewFolder() |
535 | { | 535 | { |
536 | Newmdirdlg ndirdlg; | 536 | Newmdirdlg ndirdlg; |
537 | 537 | ||
538 | ndirdlg.showMaximized(); | 538 | ndirdlg.showMaximized(); |
539 | if ( ndirdlg.exec() ) | 539 | if ( ndirdlg.exec() ) |
540 | { | 540 | { |
541 | QString ndir = ndirdlg.Newdir(); | 541 | QString ndir = ndirdlg.Newdir(); |
542 | bool makesubs = ndirdlg.subpossible(); | 542 | bool makesubs = ndirdlg.subpossible(); |
543 | QString delemiter = "/"; | 543 | QString delemiter = "/"; |
544 | IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); | 544 | IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); |
545 | if (item) | 545 | if (item) |
546 | { | 546 | { |
547 | delemiter = item->Delemiter(); | 547 | delemiter = item->Delemiter(); |
548 | } | 548 | } |
549 | if (wrapper->createMbox(ndir,0,delemiter,makesubs)) | 549 | if (wrapper->createMbox(ndir,0,delemiter,makesubs)) |
550 | { | 550 | { |
551 | refreshFolders(true); | 551 | refreshFolders(true); |
552 | } | 552 | } |
553 | } | 553 | } |
554 | } | 554 | } |
555 | 555 | ||
556 | void IMAPviewItem::contextMenuSelected(int id) | 556 | void IMAPviewItem::contextMenuSelected(int id) |
557 | { | 557 | { |
558 | 558 | ||
559 | switch (id) | 559 | switch (id) |
560 | { | 560 | { |
561 | case 0: | 561 | case 0: |
562 | refreshFolders(true); | 562 | refreshFolders(true); |
563 | break; | 563 | break; |
564 | case 1: | 564 | case 1: |
565 | createNewFolder(); | 565 | createNewFolder(); |
566 | break; | 566 | break; |
567 | case 2: | 567 | case 2: |
568 | removeChilds(); | 568 | removeChilds(); |
569 | wrapper->logout(); | 569 | wrapper->logout(); |
570 | break; | 570 | break; |
571 | case 3: | 571 | case 3: |
572 | if (account->getOffline()==false) | 572 | if (account->getOffline()==false) |
573 | { | 573 | { |
574 | removeChilds(); | 574 | removeChilds(); |
575 | wrapper->logout(); | 575 | wrapper->logout(); |
576 | } | 576 | } |
577 | account->setOffline(!account->getOffline()); | 577 | account->setOffline(!account->getOffline()); |
578 | account->save(); | 578 | account->save(); |
579 | SETPIX(PIXMAP_IMAPFOLDER); | 579 | SETPIX(PIXMAP_IMAPFOLDER); |
580 | refreshFolders(false); | 580 | refreshFolders(false); |
581 | break; | 581 | break; |
582 | case GET_NEW_MAILS: // daunlood | 582 | case GET_NEW_MAILS: // daunlood |
583 | { | 583 | { |
584 | if (account->getOffline()) { | 584 | if (account->getOffline()) { |
585 | contextMenuSelected( 3 ); | 585 | contextMenuSelected( 3 ); |
586 | } | 586 | } |
587 | AccountView*bl = accountView(); | 587 | AccountView*bl = accountView(); |
588 | if (!bl) return; | 588 | if (!bl) return; |
589 | AccountViewItem* in = findSubItem( "inbox" , 0); | 589 | AccountViewItem* in = findSubItem( "inbox" , 0); |
590 | if ( ! in ) | 590 | if ( ! in ) |
591 | return; | 591 | return; |
592 | bl->downloadMailsInbox(in->getFolder(),getWrapper()); | 592 | bl->downloadMailsInbox(in->getFolder(),getWrapper()); |
593 | } | 593 | } |
594 | break; | 594 | break; |
595 | default: | 595 | default: |
596 | break; | 596 | break; |
597 | } | 597 | } |
598 | } | 598 | } |
599 | 599 | ||
600 | RECBODYP IMAPviewItem::fetchBody(const RecMailP&) | 600 | RECBODYP IMAPviewItem::fetchBody(const RecMailP&) |
601 | { | 601 | { |
602 | return new RecBody(); | 602 | return new RecBody(); |
603 | } | 603 | } |
604 | 604 | ||
605 | bool IMAPviewItem::offline() | 605 | bool IMAPviewItem::offline() |
606 | { | 606 | { |
607 | return account->getOffline(); | 607 | return account->getOffline(); |
608 | } | 608 | } |
609 | 609 | ||
610 | IMAPfolderItem::IMAPfolderItem( const FolderP& folderInit, IMAPviewItem *parent , QListViewItem*after ) | 610 | IMAPfolderItem::IMAPfolderItem( const FolderP& folderInit, IMAPviewItem *parent , QListViewItem*after ) |
611 | : AccountViewItem( folderInit, parent , after ) | 611 | : AccountViewItem( folderInit, parent , after ) |
612 | { | 612 | { |
613 | imap = parent; | 613 | imap = parent; |
614 | if (folder->getDisplayName().lower()!="inbox") | 614 | if (folder->getDisplayName().lower()!="inbox") |
615 | { | 615 | { |
616 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 616 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
617 | } | 617 | } |
618 | else | 618 | else |
619 | { | 619 | { |
620 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 620 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
621 | } | 621 | } |
622 | setText( 0, folder->getDisplayName() ); | 622 | setText( 0, folder->getDisplayName() ); |
623 | } | 623 | } |
624 | 624 | ||
625 | IMAPfolderItem::IMAPfolderItem(const FolderP &folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ) | 625 | IMAPfolderItem::IMAPfolderItem(const FolderP &folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ) |
626 | : AccountViewItem(folderInit, parent,after ) | 626 | : AccountViewItem(folderInit, parent,after ) |
627 | { | 627 | { |
628 | imap = master; | 628 | imap = master; |
629 | if (folder->getDisplayName().lower()!="inbox") | 629 | if (folder->getDisplayName().lower()!="inbox") |
630 | { | 630 | { |
631 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 631 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
632 | } | 632 | } |
633 | else | 633 | else |
634 | { | 634 | { |
635 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 635 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
636 | } | 636 | } |
637 | setText( 0, folder->getDisplayName() ); | 637 | setText( 0, folder->getDisplayName() ); |
638 | } | 638 | } |
639 | 639 | ||
640 | IMAPfolderItem::~IMAPfolderItem() | 640 | IMAPfolderItem::~IMAPfolderItem() |
641 | {} | 641 | {} |
642 | 642 | ||
643 | const QString& IMAPfolderItem::Delemiter()const | 643 | const QString& IMAPfolderItem::Delemiter()const |
644 | { | 644 | { |
645 | return folder->Separator(); | 645 | return folder->Separator(); |
646 | } | 646 | } |
647 | 647 | ||
648 | void IMAPfolderItem::refresh(QValueList<RecMailP>&target) | 648 | void IMAPfolderItem::refresh(QValueList<RecMailP>&target) |
649 | { | 649 | { |
650 | if (folder->may_select()) | 650 | if (folder->may_select()) |
651 | { | 651 | { |
652 | imap->getWrapper()->listMessages( folder->getName(),target ); | 652 | imap->getWrapper()->listMessages( folder->getName(),target ); |
653 | } | 653 | } |
654 | else | 654 | else |
655 | { | 655 | { |
656 | target.clear(); | 656 | target.clear(); |
657 | } | 657 | } |
658 | } | 658 | } |
659 | 659 | ||
660 | RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail) | 660 | RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail) |
661 | { | 661 | { |
662 | return imap->getWrapper()->fetchBody(aMail); | 662 | return imap->getWrapper()->fetchBody(aMail); |
663 | } | 663 | } |
664 | 664 | ||
665 | QPopupMenu * IMAPfolderItem::getContextMenu() | 665 | QPopupMenu * IMAPfolderItem::getContextMenu() |
666 | { | 666 | { |
667 | QPopupMenu *m = new QPopupMenu(0); | 667 | QPopupMenu *m = new QPopupMenu(0); |
668 | if (m) | 668 | if (m) |
669 | { | 669 | { |
670 | if (folder->may_select()) | 670 | if (folder->may_select()) |
671 | { | 671 | { |
672 | m->insertItem(QObject::tr("Refresh header list",contextName),0); | 672 | m->insertItem(QObject::tr("Refresh header list",contextName),0); |
673 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),4); | 673 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),4); |
674 | m->insertItem(QObject::tr("Delete all mails",contextName),1); | 674 | m->insertItem(QObject::tr("Delete all mails",contextName),1); |
675 | } | 675 | } |
676 | if (folder->no_inferior()==false) | 676 | if (folder->no_inferior()==false) |
677 | { | 677 | { |
678 | m->insertItem(QObject::tr("Create new subfolder",contextName),2); | 678 | m->insertItem(QObject::tr("Create new subfolder",contextName),2); |
679 | } | 679 | } |
680 | if (folder->getDisplayName().lower()!="inbox") | 680 | if (folder->getDisplayName().lower()!="inbox") |
681 | { | 681 | { |
682 | m->insertItem(QObject::tr("Delete folder",contextName),3); | 682 | m->insertItem(QObject::tr("Delete folder",contextName),3); |
683 | } | 683 | } |
684 | } | 684 | } |
685 | return m; | 685 | return m; |
686 | } | 686 | } |
687 | 687 | ||
688 | void IMAPfolderItem::createNewFolder() | 688 | void IMAPfolderItem::createNewFolder() |
689 | { | 689 | { |
690 | Newmdirdlg ndirdlg; | 690 | Newmdirdlg ndirdlg; |
691 | ndirdlg.showMaximized(); | 691 | ndirdlg.showMaximized(); |
692 | if ( ndirdlg.exec() ) | 692 | if ( ndirdlg.exec() ) |
693 | { | 693 | { |
694 | QString ndir = ndirdlg.Newdir(); | 694 | QString ndir = ndirdlg.Newdir(); |
695 | bool makesubs = ndirdlg.subpossible(); | 695 | bool makesubs = ndirdlg.subpossible(); |
696 | QString delemiter = Delemiter(); | 696 | QString delemiter = Delemiter(); |
697 | if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) | 697 | if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) |
698 | { | 698 | { |
699 | imap->refreshFolders(true); | 699 | imap->refreshFolders(true); |
700 | } | 700 | } |
701 | } | 701 | } |
702 | } | 702 | } |
703 | 703 | ||
704 | void IMAPfolderItem::deleteFolder() | 704 | void IMAPfolderItem::deleteFolder() |
705 | { | 705 | { |
706 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), | 706 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), |
707 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), | 707 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), |
708 | QObject::tr("Yes",contextName), | 708 | QObject::tr("Yes",contextName), |
709 | QObject::tr("No",contextName),QString::null,1,1); | 709 | QObject::tr("No",contextName),QString::null,1,1); |
710 | 710 | ||
711 | if (yesno == 0) | 711 | if (yesno == 0) |
712 | { | 712 | { |
713 | if (imap->getWrapper()->deleteMbox(folder)) | 713 | if (imap->getWrapper()->deleteMbox(folder)) |
714 | { | 714 | { |
715 | QListView*v=listView(); | 715 | QListView*v=listView(); |
716 | IMAPviewItem * box = imap; | 716 | IMAPviewItem * box = imap; |
717 | /* be carefull - after that this object is destroyd so don't use | 717 | /* be carefull - after that this object is destroyd so don't use |
718 | * any member of it after that call!!*/ | 718 | * any member of it after that call!!*/ |
719 | imap->refreshFolders(true); | 719 | imap->refreshFolders(true); |
720 | if (v) | 720 | if (v) |
721 | { | 721 | { |
722 | v->setSelected(box,true); | 722 | v->setSelected(box,true); |
723 | } | 723 | } |
724 | } | 724 | } |
725 | } | 725 | } |
726 | } | 726 | } |
727 | 727 | ||
728 | void IMAPfolderItem::downloadMails() | 728 | void IMAPfolderItem::downloadMails() |
729 | { | 729 | { |
730 | AccountView*bl = imap->accountView(); | 730 | AccountView*bl = imap->accountView(); |
731 | if (!bl) return; | 731 | if (!bl) return; |
732 | bl->downloadMails(folder,imap->getWrapper()); | 732 | bl->downloadMails(folder,imap->getWrapper()); |
733 | } | 733 | } |
734 | 734 | ||
735 | void IMAPfolderItem::contextMenuSelected(int id) | 735 | void IMAPfolderItem::contextMenuSelected(int id) |
736 | { | 736 | { |
737 | 737 | ||
738 | AccountView * view = (AccountView*)listView(); | 738 | AccountView * view = (AccountView*)listView(); |
739 | switch(id) | 739 | switch(id) |
740 | { | 740 | { |
741 | case 0: | 741 | case 0: |
742 | view->refreshCurrent(); | 742 | view->refreshCurrent(); |
743 | break; | 743 | break; |
744 | case 1: | 744 | case 1: |
745 | deleteAllMail(imap->getWrapper(),folder); | 745 | deleteAllMail(imap->getWrapper(),folder); |
746 | break; | 746 | break; |
747 | case 2: | 747 | case 2: |
748 | createNewFolder(); | 748 | createNewFolder(); |
749 | break; | 749 | break; |
750 | case 3: | 750 | case 3: |
751 | deleteFolder(); | 751 | deleteFolder(); |
752 | break; | 752 | break; |
753 | case 4: | 753 | case 4: |
754 | downloadMails(); | 754 | downloadMails(); |
755 | break; | 755 | break; |
756 | default: | 756 | default: |
757 | break; | 757 | break; |
758 | } | 758 | } |
759 | } | 759 | } |
760 | 760 | ||
761 | /** | 761 | /** |
762 | * MH Account stuff | 762 | * MH Account stuff |
763 | */ | 763 | */ |
764 | /* MH is a little bit different - the top folder can contains messages other than in IMAP and | 764 | /* MH is a little bit different - the top folder can contains messages other than in IMAP and |
765 | POP3 and MBOX */ | 765 | POP3 and MBOX */ |
766 | MHviewItem::MHviewItem( const QString&aPath, AccountView *parent ) | 766 | MHviewItem::MHviewItem( const QString&aPath, AccountView *parent ) |
767 | : AccountViewItem( parent ) | 767 | : AccountViewItem( parent ) |
768 | { | 768 | { |
769 | m_Path = aPath; | 769 | m_Path = aPath; |
770 | /* be carefull - the space within settext is wanted - thats why the string twice */ | 770 | /* be carefull - the space within settext is wanted - thats why the string twice */ |
771 | wrapper = AbstractMail::getWrapper( m_Path,"Local Folders"); | 771 | wrapper = AbstractMail::getWrapper( m_Path,"Local Folders"); |
772 | setPixmap( 0, PIXMAP_LOCALFOLDER ); | 772 | setPixmap( 0, PIXMAP_LOCALFOLDER ); |
773 | setText( 0, " Local Folders" ); | 773 | setText( 0, " Local Folders" ); |
774 | setOpen( true ); | 774 | setOpen( true ); |
775 | folder = 0; | 775 | folder = 0; |
776 | } | 776 | } |
777 | 777 | ||
778 | MHviewItem::~MHviewItem() | 778 | MHviewItem::~MHviewItem() |
779 | { | 779 | { |
780 | delete wrapper; | 780 | delete wrapper; |
781 | } | 781 | } |
782 | 782 | ||
783 | AbstractMail *MHviewItem::getWrapper() | 783 | AbstractMail *MHviewItem::getWrapper() |
784 | { | 784 | { |
785 | return wrapper; | 785 | return wrapper; |
786 | } | 786 | } |
787 | 787 | ||
788 | void MHviewItem::refresh( QValueList<RecMailP> & target) | 788 | void MHviewItem::refresh( QValueList<RecMailP> & target) |
789 | { | 789 | { |
790 | refresh(false); | 790 | refresh(false); |
791 | getWrapper()->listMessages( "",target ); | 791 | getWrapper()->listMessages( "",target ); |
792 | } | 792 | } |
793 | 793 | ||
794 | void MHviewItem::refresh(bool force) | 794 | void MHviewItem::refresh(bool force) |
795 | { | 795 | { |
796 | if (childCount()>0 && force==false) return; | 796 | if (childCount()>0 && force==false) return; |
797 | removeChilds(); | 797 | removeChilds(); |
798 | currentFolders.clear(); | 798 | currentFolders.clear(); |
799 | QValueList<FolderP> *folders = wrapper->listFolders(); | 799 | QValueList<FolderP> *folders = wrapper->listFolders(); |
800 | QValueList<FolderP>::ConstIterator it; | 800 | QValueList<FolderP>::ConstIterator it; |
801 | MHfolderItem*item = 0; | 801 | MHfolderItem*item = 0; |
802 | MHfolderItem*pmaster = 0; | 802 | MHfolderItem*pmaster = 0; |
803 | QString fname = ""; | 803 | QString fname = ""; |
804 | int pos; | 804 | int pos; |
805 | for ( it = folders->begin(); it!=folders->end(); ++it) | 805 | for ( it = folders->begin(); it!=folders->end(); ++it) |
806 | { | 806 | { |
807 | fname = (*it)->getDisplayName(); | 807 | fname = (*it)->getDisplayName(); |
808 | /* this folder itself */ | 808 | /* this folder itself */ |
809 | if (fname=="/") | 809 | if (fname=="/") |
810 | { | 810 | { |
811 | currentFolders.append(fname); | 811 | currentFolders.append(fname); |
812 | folder = (*it); | 812 | folder = (*it); |
813 | continue; | 813 | continue; |
814 | } | 814 | } |
815 | currentFolders.append(fname); | 815 | currentFolders.append(fname); |
816 | pos = fname.findRev("/"); | 816 | pos = fname.findRev("/"); |
817 | if (pos > 0) | 817 | if (pos > 0) |
818 | { | 818 | { |
819 | fname = fname.left(pos); | 819 | fname = fname.left(pos); |
820 | pmaster = (MHfolderItem*)findSubItem(fname); | 820 | pmaster = (MHfolderItem*)findSubItem(fname); |
821 | } | 821 | } |
822 | else | 822 | else |
823 | { | 823 | { |
824 | pmaster = 0; | 824 | pmaster = 0; |
825 | } | 825 | } |
826 | if (pmaster) | 826 | if (pmaster) |
827 | { | 827 | { |
828 | item = new MHfolderItem( (*it), pmaster, item, this ); | 828 | item = new MHfolderItem( (*it), pmaster, item, this ); |
829 | } | 829 | } |
830 | else | 830 | else |
831 | { | 831 | { |
832 | item = new MHfolderItem( (*it), this , item ); | 832 | item = new MHfolderItem( (*it), this , item ); |
833 | } | 833 | } |
834 | item->setSelectable((*it)->may_select()); | 834 | item->setSelectable((*it)->may_select()); |
835 | } | 835 | } |
836 | delete folders; | 836 | delete folders; |
837 | } | 837 | } |
838 | 838 | ||
839 | RECBODYP MHviewItem::fetchBody( const RecMailP &mail ) | 839 | RECBODYP MHviewItem::fetchBody( const RecMailP &mail ) |
840 | { | 840 | { |
841 | 841 | ||
842 | return wrapper->fetchBody( mail ); | 842 | return wrapper->fetchBody( mail ); |
843 | } | 843 | } |
844 | 844 | ||
845 | QPopupMenu * MHviewItem::getContextMenu() | 845 | QPopupMenu * MHviewItem::getContextMenu() |
846 | { | 846 | { |
847 | QPopupMenu *m = new QPopupMenu(0); | 847 | QPopupMenu *m = new QPopupMenu(0); |
848 | if (m) | 848 | if (m) |
849 | { | 849 | { |
850 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); | 850 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); |
851 | m->insertItem(QObject::tr("Create new folder",contextName),1); | 851 | m->insertItem(QObject::tr("Create new folder",contextName),1); |
852 | m->insertItem(QObject::tr("Delete all mails",contextName),2); | 852 | m->insertItem(QObject::tr("Delete all mails",contextName),2); |
853 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),3); | 853 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),3); |
854 | } | 854 | } |
855 | return m; | 855 | return m; |
856 | } | 856 | } |
857 | 857 | ||
858 | void MHviewItem::createFolder() | 858 | void MHviewItem::createFolder() |
859 | { | 859 | { |
860 | Newmdirdlg ndirdlg(0,0,true); | 860 | Newmdirdlg ndirdlg(0,0,true); |
861 | ndirdlg.showMaximized(); | 861 | ndirdlg.showMaximized(); |
862 | if ( ndirdlg.exec() ) | 862 | if ( ndirdlg.exec() ) |
863 | { | 863 | { |
864 | QString ndir = ndirdlg.Newdir(); | 864 | QString ndir = ndirdlg.Newdir(); |
865 | if (wrapper->createMbox(ndir)) | 865 | if (wrapper->createMbox(ndir)) |
866 | { | 866 | { |
867 | refresh(true); | 867 | refresh(true); |
868 | } | 868 | } |
869 | } | 869 | } |
870 | } | 870 | } |
871 | 871 | ||
872 | void MHviewItem::downloadMails() | 872 | void MHviewItem::downloadMails() |
873 | { | 873 | { |
874 | AccountView*bl = accountView(); | 874 | AccountView*bl = accountView(); |
875 | if (!bl) return; | 875 | if (!bl) return; |
876 | bl->downloadMails(folder,getWrapper()); | 876 | bl->downloadMails(folder,getWrapper()); |
877 | } | 877 | } |
878 | 878 | ||
879 | QStringList MHviewItem::subFolders() | 879 | QStringList MHviewItem::subFolders() |
880 | { | 880 | { |
881 | return currentFolders; | 881 | return currentFolders; |
882 | } | 882 | } |
883 | 883 | ||
884 | void MHviewItem::contextMenuSelected(int which) | 884 | void MHviewItem::contextMenuSelected(int which) |
885 | { | 885 | { |
886 | switch (which) | 886 | switch (which) |
887 | { | 887 | { |
888 | case 0: | 888 | case 0: |
889 | refresh(true); | 889 | refresh(true); |
890 | break; | 890 | break; |
891 | case 1: | 891 | case 1: |
892 | createFolder(); | 892 | createFolder(); |
893 | break; | 893 | break; |
894 | case 2: | 894 | case 2: |
895 | deleteAllMail(getWrapper(),folder); | 895 | deleteAllMail(getWrapper(),folder); |
896 | break; | 896 | break; |
897 | case 3: | 897 | case 3: |
898 | downloadMails(); | 898 | downloadMails(); |
899 | break; | 899 | break; |
900 | default: | 900 | default: |
901 | break; | 901 | break; |
902 | } | 902 | } |
903 | } | 903 | } |
904 | 904 | ||
905 | MHfolderItem::~MHfolderItem() | 905 | MHfolderItem::~MHfolderItem() |
906 | {} | 906 | {} |
907 | 907 | ||
908 | MHfolderItem::MHfolderItem( const FolderP &folderInit, MHviewItem *parent , QListViewItem*after ) | 908 | MHfolderItem::MHfolderItem( const FolderP &folderInit, MHviewItem *parent , QListViewItem*after ) |
909 | : AccountViewItem(folderInit, parent,after ) | 909 | : AccountViewItem(folderInit, parent,after ) |
910 | { | 910 | { |
911 | mbox = parent; | 911 | mbox = parent; |
912 | initName(); | 912 | initName(); |
913 | } | 913 | } |
914 | 914 | ||
915 | MHfolderItem::MHfolderItem(const FolderP& folderInit, MHfolderItem *parent, QListViewItem*after, MHviewItem*master) | 915 | MHfolderItem::MHfolderItem(const FolderP& folderInit, MHfolderItem *parent, QListViewItem*after, MHviewItem*master) |
916 | : AccountViewItem(folderInit, parent,after ) | 916 | : AccountViewItem(folderInit, parent,after ) |
917 | { | 917 | { |
918 | folder = folderInit; | 918 | folder = folderInit; |
919 | mbox = master; | 919 | mbox = master; |
920 | initName(); | 920 | initName(); |
921 | } | 921 | } |
922 | 922 | ||
923 | void MHfolderItem::initName() | 923 | void MHfolderItem::initName() |
924 | { | 924 | { |
925 | QString bName = folder->getDisplayName(); | 925 | QString bName = folder->getDisplayName(); |
926 | if (bName.startsWith("/")&&bName.length()>1) | 926 | if (bName.startsWith("/")&&bName.length()>1) |
927 | { | 927 | { |
928 | bName.replace(0,1,""); | 928 | bName.replace(0,1,""); |
929 | } | 929 | } |
930 | int pos = bName.findRev("/"); | 930 | int pos = bName.findRev("/"); |
931 | if (pos > 0) | 931 | if (pos > 0) |
932 | { | 932 | { |
933 | bName.replace(0,pos+1,""); | 933 | bName.replace(0,pos+1,""); |
934 | } | 934 | } |
935 | if (bName.lower() == "outgoing") | 935 | if (bName.lower() == "outgoing") |
936 | { | 936 | { |
937 | setPixmap( 0, PIXMAP_OUTBOXFOLDER ); | 937 | setPixmap( 0, PIXMAP_OUTBOXFOLDER ); |
938 | } | 938 | } |
939 | else if (bName.lower() == "inbox") | 939 | else if (bName.lower() == "inbox") |
940 | { | 940 | { |
941 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 941 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
942 | } else if (bName.lower() == "drafts") { | 942 | } else if (bName.lower() == "drafts") { |
943 | setPixmap(0, SmallIcon ("edit")); | 943 | setPixmap(0, SmallIcon ("edit")); |
944 | } else { | 944 | } else { |
945 | setPixmap( 0, PIXMAP_MBOXFOLDER ); | 945 | setPixmap( 0, PIXMAP_MBOXFOLDER ); |
946 | } | 946 | } |
947 | setText( 0, bName ); | 947 | setText( 0, bName ); |
948 | } | 948 | } |
949 | 949 | ||
950 | const FolderP&MHfolderItem::getFolder()const | 950 | const FolderP&MHfolderItem::getFolder()const |
951 | { | 951 | { |
952 | return folder; | 952 | return folder; |
953 | } | 953 | } |
954 | 954 | ||
955 | void MHfolderItem::refresh(QValueList<RecMailP>&target) | 955 | void MHfolderItem::refresh(QValueList<RecMailP>&target) |
956 | { | 956 | { |
957 | if (folder->may_select()) | 957 | if (folder->may_select()) |
958 | mbox->getWrapper()->listMessages( folder->getName(),target ); | 958 | mbox->getWrapper()->listMessages( folder->getName(),target ); |
959 | } | 959 | } |
960 | 960 | ||
961 | RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail) | 961 | RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail) |
962 | { | 962 | { |
963 | return mbox->getWrapper()->fetchBody(aMail); | 963 | return mbox->getWrapper()->fetchBody(aMail); |
964 | } | 964 | } |
965 | 965 | ||
966 | void MHfolderItem::deleteFolder() | 966 | void MHfolderItem::deleteFolder() |
967 | { | 967 | { |
968 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), | 968 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), |
969 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), | 969 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), |
970 | QObject::tr("Yes",contextName), | 970 | QObject::tr("Yes",contextName), |
971 | QObject::tr("No",contextName),QString::null,1,1); | 971 | QObject::tr("No",contextName),QString::null,1,1); |
972 | 972 | ||
973 | if (yesno == 0) | 973 | if (yesno == 0) |
974 | { | 974 | { |
975 | if (mbox->getWrapper()->deleteMbox(folder)) | 975 | if (mbox->getWrapper()->deleteMbox(folder)) |
976 | { | 976 | { |
977 | QListView*v=listView(); | 977 | QListView*v=listView(); |
978 | MHviewItem * box = mbox; | 978 | MHviewItem * box = mbox; |
979 | /* be carefull - after that this object is destroyd so don't use | 979 | /* be carefull - after that this object is destroyd so don't use |
980 | * any member of it after that call!!*/ | 980 | * any member of it after that call!!*/ |
981 | mbox->refresh(true); | 981 | mbox->refresh(true); |
982 | if (v) | 982 | if (v) |
983 | { | 983 | { |
984 | v->setSelected(box,true); | 984 | v->setSelected(box,true); |
985 | } | 985 | } |
986 | } | 986 | } |
987 | } | 987 | } |
988 | } | 988 | } |
989 | 989 | ||
990 | QPopupMenu * MHfolderItem::getContextMenu() | 990 | QPopupMenu * MHfolderItem::getContextMenu() |
991 | { | 991 | { |
992 | QPopupMenu *m = new QPopupMenu(0); | 992 | QPopupMenu *m = new QPopupMenu(0); |
993 | if (m) | 993 | if (m) |
994 | { | 994 | { |
995 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); | 995 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); |
996 | m->insertItem(QObject::tr("Delete all mails",contextName),0); | 996 | m->insertItem(QObject::tr("Delete all mails",contextName),0); |
997 | m->insertItem(QObject::tr("Create new subfolder",contextName),3); | 997 | m->insertItem(QObject::tr("Create new subfolder",contextName),3); |
998 | m->insertItem(QObject::tr("Delete folder",contextName),1); | 998 | m->insertItem(QObject::tr("Delete folder",contextName),1); |
999 | } | 999 | } |
1000 | return m; | 1000 | return m; |
1001 | } | 1001 | } |
1002 | 1002 | ||
1003 | void MHfolderItem::downloadMails() | 1003 | void MHfolderItem::downloadMails() |
1004 | { | 1004 | { |
1005 | AccountView*bl = mbox->accountView(); | 1005 | AccountView*bl = mbox->accountView(); |
1006 | if (!bl) return; | 1006 | if (!bl) return; |
1007 | bl->downloadMails(folder,mbox->getWrapper()); | 1007 | bl->downloadMails(folder,mbox->getWrapper()); |
1008 | } | 1008 | } |
1009 | 1009 | ||
1010 | void MHfolderItem::createFolder() | 1010 | void MHfolderItem::createFolder() |
1011 | { | 1011 | { |
1012 | Newmdirdlg ndirdlg(0,0,true); | 1012 | Newmdirdlg ndirdlg(0,0,true); |
1013 | ndirdlg.showMaximized(); | 1013 | ndirdlg.showMaximized(); |
1014 | if (ndirdlg.exec() ) | 1014 | if (ndirdlg.exec() ) |
1015 | { | 1015 | { |
1016 | QString ndir = ndirdlg.Newdir(); | 1016 | QString ndir = ndirdlg.Newdir(); |
1017 | if (mbox->getWrapper()->createMbox(ndir,folder)) | 1017 | if (mbox->getWrapper()->createMbox(ndir,folder)) |
1018 | { | 1018 | { |
1019 | QListView*v=listView(); | 1019 | QListView*v=listView(); |
1020 | MHviewItem * box = mbox; | 1020 | MHviewItem * box = mbox; |
1021 | /* be carefull - after that this object is destroyd so don't use | 1021 | /* be carefull - after that this object is destroyd so don't use |
1022 | * any member of it after that call!!*/ | 1022 | * any member of it after that call!!*/ |
1023 | mbox->refresh(true); | 1023 | mbox->refresh(true); |
1024 | if (v) | 1024 | if (v) |
1025 | { | 1025 | { |
1026 | v->setSelected(box,true); | 1026 | v->setSelected(box,true); |
1027 | } | 1027 | } |
1028 | } | 1028 | } |
1029 | } | 1029 | } |
1030 | } | 1030 | } |
1031 | 1031 | ||
1032 | void MHfolderItem::contextMenuSelected(int which) | 1032 | void MHfolderItem::contextMenuSelected(int which) |
1033 | { | 1033 | { |
1034 | switch(which) | 1034 | switch(which) |
1035 | { | 1035 | { |
1036 | case 0: | 1036 | case 0: |
1037 | deleteAllMail(mbox->getWrapper(),folder); | 1037 | deleteAllMail(mbox->getWrapper(),folder); |
1038 | break; | 1038 | break; |
1039 | case 1: | 1039 | case 1: |
1040 | deleteFolder(); | 1040 | deleteFolder(); |
1041 | break; | 1041 | break; |
1042 | case 2: | 1042 | case 2: |
1043 | downloadMails(); | 1043 | downloadMails(); |
1044 | break; | 1044 | break; |
1045 | case 3: | 1045 | case 3: |
1046 | createFolder(); | 1046 | createFolder(); |
1047 | break; | 1047 | break; |
1048 | default: | 1048 | default: |
1049 | break; | 1049 | break; |
1050 | } | 1050 | } |
1051 | } | 1051 | } |
1052 | 1052 | ||
1053 | bool MHfolderItem::isDraftfolder() | 1053 | bool MHfolderItem::isDraftfolder() |
1054 | { | 1054 | { |
1055 | if (folder && folder->getName()==AbstractMail::defaultLocalfolder()+"/"+AbstractMail::draftFolder()) return true; | 1055 | if (folder && folder->getName()==AbstractMail::defaultLocalfolder()+"/"+AbstractMail::draftFolder()) return true; |
1056 | return false; | 1056 | return false; |
1057 | } | 1057 | } |
1058 | 1058 | ||
1059 | /** | 1059 | /** |
1060 | * Generic stuff | 1060 | * Generic stuff |
1061 | */ | 1061 | */ |
1062 | 1062 | ||
1063 | const QString AccountViewItem::contextName="AccountViewItem"; | 1063 | const QString AccountViewItem::contextName="AccountViewItem"; |
1064 | 1064 | ||
1065 | AccountViewItem::AccountViewItem( AccountView *parent ) | 1065 | AccountViewItem::AccountViewItem( AccountView *parent ) |
1066 | : QListViewItem( parent ) | 1066 | : QListViewItem( parent ) |
1067 | { | 1067 | { |
1068 | init(); | 1068 | init(); |
1069 | m_Backlink = parent; | 1069 | m_Backlink = parent; |
1070 | } | 1070 | } |
1071 | 1071 | ||
1072 | AccountViewItem::AccountViewItem( QListViewItem *parent) | 1072 | AccountViewItem::AccountViewItem( QListViewItem *parent) |
1073 | : QListViewItem( parent),folder(0) | 1073 | : QListViewItem( parent),folder(0) |
1074 | { | 1074 | { |
1075 | init(); | 1075 | init(); |
1076 | } | 1076 | } |
1077 | 1077 | ||
1078 | AccountViewItem::AccountViewItem( QListViewItem *parent , QListViewItem*after ) | 1078 | AccountViewItem::AccountViewItem( QListViewItem *parent , QListViewItem*after ) |
1079 | :QListViewItem( parent,after ),folder(0) | 1079 | :QListViewItem( parent,after ),folder(0) |
1080 | { | 1080 | { |
1081 | init(); | 1081 | init(); |
1082 | } | 1082 | } |
1083 | 1083 | ||
1084 | AccountViewItem::AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after ) | 1084 | AccountViewItem::AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after ) |
1085 | :QListViewItem( parent,after ),folder(folderInit) | 1085 | :QListViewItem( parent,after ),folder(folderInit) |
1086 | { | 1086 | { |
1087 | init(); | 1087 | init(); |
1088 | } | 1088 | } |
1089 | 1089 | ||
1090 | void AccountViewItem::init() | 1090 | void AccountViewItem::init() |
1091 | { | 1091 | { |
1092 | m_Backlink = 0; | 1092 | m_Backlink = 0; |
1093 | } | 1093 | } |
1094 | 1094 | ||
1095 | AccountViewItem::~AccountViewItem() | 1095 | AccountViewItem::~AccountViewItem() |
1096 | { | 1096 | { |
1097 | folder = 0; | 1097 | folder = 0; |
1098 | } | 1098 | } |
1099 | 1099 | ||
1100 | AccountView*AccountViewItem::accountView() | 1100 | AccountView*AccountViewItem::accountView() |
1101 | { | 1101 | { |
1102 | return m_Backlink; | 1102 | return m_Backlink; |
1103 | } | 1103 | } |
1104 | 1104 | ||
1105 | void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder) | 1105 | void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder) |
1106 | { | 1106 | { |
1107 | if (!wrapper) return; | 1107 | if (!wrapper) return; |
1108 | QString fname=""; | 1108 | QString fname=""; |
1109 | if (folder) fname = folder->getDisplayName(); | 1109 | if (folder) fname = folder->getDisplayName(); |
1110 | int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName), | 1110 | int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName), |
1111 | QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName). | 1111 | QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName). |
1112 | arg(fname), | 1112 | arg(fname), |
1113 | QObject::tr("Yes",contextName), | 1113 | QObject::tr("Yes",contextName), |
1114 | QObject::tr("No",contextName),QString::null,1,1); | 1114 | QObject::tr("No",contextName),QString::null,1,1); |
1115 | 1115 | ||
1116 | if (yesno == 0) | 1116 | if (yesno == 0) |
1117 | { | 1117 | { |
1118 | if (wrapper->deleteAllMail(folder)) | 1118 | if (wrapper->deleteAllMail(folder)) |
1119 | { | 1119 | { |
1120 | AccountView * view = (AccountView*)listView(); | 1120 | AccountView * view = (AccountView*)listView(); |
1121 | if (view) view->refreshCurrent(); | 1121 | if (view) view->refreshCurrent(); |
1122 | } | 1122 | } |
1123 | } | 1123 | } |
1124 | } | 1124 | } |
1125 | 1125 | ||
1126 | void AccountViewItem::removeChilds() | 1126 | void AccountViewItem::removeChilds() |
1127 | { | 1127 | { |
1128 | QListViewItem *child = firstChild(); | 1128 | QListViewItem *child = firstChild(); |
1129 | while ( child ) | 1129 | while ( child ) |
1130 | { | 1130 | { |
1131 | QListViewItem *tmp = child; | 1131 | QListViewItem *tmp = child; |
1132 | child = child->nextSibling(); | 1132 | child = child->nextSibling(); |
1133 | delete tmp; | 1133 | delete tmp; |
1134 | } | 1134 | } |
1135 | } | 1135 | } |
1136 | 1136 | ||
1137 | bool AccountViewItem::matchName(const QString&name)const | 1137 | bool AccountViewItem::matchName(const QString&name)const |
1138 | { | 1138 | { |
1139 | if (!folder) return false; | 1139 | if (!folder) return false; |
1140 | return folder->getDisplayName().lower()==name.lower(); | 1140 | return folder->getDisplayName().lower()==name.lower(); |
1141 | } | 1141 | } |
1142 | 1142 | ||
1143 | 1143 | ||
1144 | AccountViewItem*AccountViewItem::findSubItem(const QString&path,AccountViewItem*start) | 1144 | AccountViewItem*AccountViewItem::findSubItem(const QString&path,AccountViewItem*start) |
1145 | { | 1145 | { |
1146 | AccountViewItem*pitem,*sitem; | 1146 | AccountViewItem*pitem,*sitem; |
1147 | if (!start) pitem = (AccountViewItem*)firstChild(); | 1147 | if (!start) pitem = (AccountViewItem*)firstChild(); |
1148 | else pitem = (AccountViewItem*)start->firstChild(); | 1148 | else pitem = (AccountViewItem*)start->firstChild(); |
1149 | while (pitem) | 1149 | while (pitem) |
1150 | { | 1150 | { |
1151 | if (pitem->matchName(path)) | 1151 | if (pitem->matchName(path)) |
1152 | { | 1152 | { |
1153 | break; | 1153 | break; |
1154 | } | 1154 | } |
1155 | if (pitem->childCount()>0) | 1155 | if (pitem->childCount()>0) |
1156 | { | 1156 | { |
1157 | sitem = findSubItem(path,pitem); | 1157 | sitem = findSubItem(path,pitem); |
1158 | if (sitem) | 1158 | if (sitem) |
1159 | { | 1159 | { |
1160 | pitem = sitem; | 1160 | pitem = sitem; |
1161 | break; | 1161 | break; |
1162 | } | 1162 | } |
1163 | } | 1163 | } |
1164 | pitem=(AccountViewItem*)pitem->nextSibling(); | 1164 | pitem=(AccountViewItem*)pitem->nextSibling(); |
1165 | } | 1165 | } |
1166 | return pitem; | 1166 | return pitem; |
1167 | } | 1167 | } |
1168 | 1168 | ||
1169 | bool AccountViewItem::isDraftfolder() | 1169 | bool AccountViewItem::isDraftfolder() |
1170 | { | 1170 | { |
1171 | return false; | 1171 | return false; |
1172 | } | 1172 | } |
diff --git a/kmicromail/libmailwrapper/mailwrapper.cpp b/kmicromail/libmailwrapper/mailwrapper.cpp index 9400649..2ee1ab3 100644 --- a/kmicromail/libmailwrapper/mailwrapper.cpp +++ b/kmicromail/libmailwrapper/mailwrapper.cpp | |||
@@ -1,180 +1,181 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include <sys/stat.h> | 2 | #include <sys/stat.h> |
3 | #include <sys/types.h> | 3 | #include <sys/types.h> |
4 | #include <unistd.h> | 4 | #include <unistd.h> |
5 | #include <fcntl.h> | 5 | #include <fcntl.h> |
6 | #include <string.h> | 6 | #include <string.h> |
7 | #include <qdir.h> | 7 | #include <qdir.h> |
8 | 8 | ||
9 | #include "mailwrapper.h" | 9 | #include "mailwrapper.h" |
10 | //#include "logindialog.h" | 10 | //#include "logindialog.h" |
11 | //#include "defines.h" | 11 | //#include "defines.h" |
12 | 12 | ||
13 | #define UNDEFINED 64 | 13 | #define UNDEFINED 64 |
14 | #define MAXLINE 76 | 14 | #define MAXLINE 76 |
15 | #define UTF16MASK 0x03FFUL | 15 | #define UTF16MASK 0x03FFUL |
16 | #define UTF16SHIFT 10 | 16 | #define UTF16SHIFT 10 |
17 | #define UTF16BASE 0x10000UL | 17 | #define UTF16BASE 0x10000UL |
18 | #define UTF16HIGHSTART 0xD800UL | 18 | #define UTF16HIGHSTART 0xD800UL |
19 | #define UTF16HIGHEND 0xDBFFUL | 19 | #define UTF16HIGHEND 0xDBFFUL |
20 | #define UTF16LOSTART 0xDC00UL | 20 | #define UTF16LOSTART 0xDC00UL |
21 | #define UTF16LOEND 0xDFFFUL | 21 | #define UTF16LOEND 0xDFFFUL |
22 | 22 | ||
23 | 23 | ||
24 | using namespace Opie::Core; | 24 | using namespace Opie::Core; |
25 | Attachment::Attachment( QString lnk ) | 25 | Attachment::Attachment( QString lnk ) |
26 | { | 26 | { |
27 | doc = lnk; | 27 | doc = lnk; |
28 | size = QFileInfo( doc ).size(); | 28 | size = QFileInfo( doc ).size(); |
29 | mPix = SmallIcon( "files" ); | 29 | mPix = SmallIcon( "files" ); |
30 | } | 30 | } |
31 | 31 | ||
32 | Folder::Folder(const QString&tmp_name, const QString&sep ) | 32 | Folder::Folder(const QString&tmp_name, const QString&sep ) |
33 | { | 33 | { |
34 | name = tmp_name; | 34 | name = tmp_name; |
35 | nameDisplay = name; | 35 | nameDisplay = name; |
36 | separator = sep; | 36 | separator = sep; |
37 | prefix = ""; | 37 | prefix = ""; |
38 | } | 38 | } |
39 | 39 | ||
40 | Folder::~Folder() | 40 | Folder::~Folder() |
41 | { | 41 | { |
42 | } | 42 | } |
43 | 43 | ||
44 | const QString& Folder::Separator()const | 44 | const QString& Folder::Separator()const |
45 | { | 45 | { |
46 | return separator; | 46 | return separator; |
47 | } | 47 | } |
48 | 48 | ||
49 | IMAPFolder::IMAPFolder(const QString&name,const QString&sep, bool select,bool no_inf, const QString&aprefix ) | 49 | IMAPFolder::IMAPFolder(const QString&t_name,const QString&sep, bool select,bool no_inf, const QString&aprefix ) |
50 | : Folder( name,sep ),m_MaySelect(select),m_NoInferior(no_inf) | 50 | : Folder( t_name,sep ),m_MaySelect(select),m_NoInferior(no_inf) |
51 | { | 51 | { |
52 | // Decode IMAP foldername | 52 | // Decode IMAP foldername |
53 | nameDisplay = IMAPFolder::decodeFolderName( name ); | 53 | nameDisplay = IMAPFolder::decodeFolderName( t_name ); |
54 | name = nameDisplay ; | ||
54 | /* | 55 | /* |
55 | odebug << "folder " + name + " - displayed as " + nameDisplay << oendl; | 56 | odebug << "folder " + name + " - displayed as " + nameDisplay << oendl; |
56 | */ | 57 | */ |
57 | prefix = aprefix; | 58 | prefix = aprefix; |
58 | 59 | ||
59 | if (prefix.length()>0) { | 60 | if (prefix.length()>0) { |
60 | if (nameDisplay.startsWith(prefix) && nameDisplay.length()>prefix.length()) { | 61 | if (nameDisplay.startsWith(prefix) && nameDisplay.length()>prefix.length()) { |
61 | nameDisplay=nameDisplay.right(nameDisplay.length()-prefix.length()); | 62 | nameDisplay=nameDisplay.right(nameDisplay.length()-prefix.length()); |
62 | } | 63 | } |
63 | } | 64 | } |
64 | } | 65 | } |
65 | 66 | ||
66 | IMAPFolder::~IMAPFolder() | 67 | IMAPFolder::~IMAPFolder() |
67 | { | 68 | { |
68 | } | 69 | } |
69 | 70 | ||
70 | static unsigned char base64chars[] = | 71 | static unsigned char base64chars[] = |
71 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+,"; | 72 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+,"; |
72 | 73 | ||
73 | /** | 74 | /** |
74 | * Decodes base64 encoded parts of the imapfolder name | 75 | * Decodes base64 encoded parts of the imapfolder name |
75 | * Code taken from kde cvs: kdebase/kioslave/imap4/rfcdecoder.cc | 76 | * Code taken from kde cvs: kdebase/kioslave/imap4/rfcdecoder.cc |
76 | */ | 77 | */ |
77 | QString IMAPFolder::decodeFolderName( const QString &name ) | 78 | QString IMAPFolder::decodeFolderName( const QString &name ) |
78 | { | 79 | { |
79 | unsigned char c, i, bitcount; | 80 | unsigned char c, i, bitcount; |
80 | unsigned long ucs4, utf16, bitbuf; | 81 | unsigned long ucs4, utf16, bitbuf; |
81 | unsigned char base64[256], utf8[6]; | 82 | unsigned char base64[256], utf8[6]; |
82 | unsigned long srcPtr = 0; | 83 | unsigned long srcPtr = 0; |
83 | QCString dst = ""; | 84 | QCString dst = ""; |
84 | QCString src = name.ascii(); | 85 | QCString src = name.ascii(); |
85 | 86 | ||
86 | /* initialize modified base64 decoding table */ | 87 | /* initialize modified base64 decoding table */ |
87 | memset(base64, UNDEFINED, sizeof(base64)); | 88 | memset(base64, UNDEFINED, sizeof(base64)); |
88 | for (i = 0; i < sizeof(base64chars); ++i) { | 89 | for (i = 0; i < sizeof(base64chars); ++i) { |
89 | base64[(int)base64chars[i]] = i; | 90 | base64[(int)base64chars[i]] = i; |
90 | } | 91 | } |
91 | 92 | ||
92 | /* loop until end of string */ | 93 | /* loop until end of string */ |
93 | while (srcPtr < src.length ()) { | 94 | while (srcPtr < src.length ()) { |
94 | c = src[srcPtr++]; | 95 | c = src[srcPtr++]; |
95 | /* deal with literal characters and &- */ | 96 | /* deal with literal characters and &- */ |
96 | if (c != '&' || src[srcPtr] == '-') { | 97 | if (c != '&' || src[srcPtr] == '-') { |
97 | /* encode literally */ | 98 | /* encode literally */ |
98 | dst += c; | 99 | dst += c; |
99 | /* skip over the '-' if this is an &- sequence */ | 100 | /* skip over the '-' if this is an &- sequence */ |
100 | if (c == '&') | 101 | if (c == '&') |
101 | srcPtr++; | 102 | srcPtr++; |
102 | } else { | 103 | } else { |
103 | /* convert modified UTF-7 -> UTF-16 -> UCS-4 -> UTF-8 -> HEX */ | 104 | /* convert modified UTF-7 -> UTF-16 -> UCS-4 -> UTF-8 -> HEX */ |
104 | bitbuf = 0; | 105 | bitbuf = 0; |
105 | bitcount = 0; | 106 | bitcount = 0; |
106 | ucs4 = 0; | 107 | ucs4 = 0; |
107 | while ((c = base64[(unsigned char) src[srcPtr]]) != UNDEFINED) { | 108 | while ((c = base64[(unsigned char) src[srcPtr]]) != UNDEFINED) { |
108 | ++srcPtr; | 109 | ++srcPtr; |
109 | bitbuf = (bitbuf << 6) | c; | 110 | bitbuf = (bitbuf << 6) | c; |
110 | bitcount += 6; | 111 | bitcount += 6; |
111 | /* enough bits for a UTF-16 character? */ | 112 | /* enough bits for a UTF-16 character? */ |
112 | if (bitcount >= 16) { | 113 | if (bitcount >= 16) { |
113 | bitcount -= 16; | 114 | bitcount -= 16; |
114 | utf16 = (bitcount ? bitbuf >> bitcount : bitbuf) & 0xffff; | 115 | utf16 = (bitcount ? bitbuf >> bitcount : bitbuf) & 0xffff; |
115 | /* convert UTF16 to UCS4 */ | 116 | /* convert UTF16 to UCS4 */ |
116 | if (utf16 >= UTF16HIGHSTART && utf16 <= UTF16HIGHEND) { | 117 | if (utf16 >= UTF16HIGHSTART && utf16 <= UTF16HIGHEND) { |
117 | ucs4 = (utf16 - UTF16HIGHSTART) << UTF16SHIFT; | 118 | ucs4 = (utf16 - UTF16HIGHSTART) << UTF16SHIFT; |
118 | continue; | 119 | continue; |
119 | } else if (utf16 >= UTF16LOSTART && utf16 <= UTF16LOEND) { | 120 | } else if (utf16 >= UTF16LOSTART && utf16 <= UTF16LOEND) { |
120 | ucs4 += utf16 - UTF16LOSTART + UTF16BASE; | 121 | ucs4 += utf16 - UTF16LOSTART + UTF16BASE; |
121 | } else { | 122 | } else { |
122 | ucs4 = utf16; | 123 | ucs4 = utf16; |
123 | } | 124 | } |
124 | /* convert UTF-16 range of UCS4 to UTF-8 */ | 125 | /* convert UTF-16 range of UCS4 to UTF-8 */ |
125 | if (ucs4 <= 0x7fUL) { | 126 | if (ucs4 <= 0x7fUL) { |
126 | utf8[0] = ucs4; | 127 | utf8[0] = ucs4; |
127 | i = 1; | 128 | i = 1; |
128 | } else if (ucs4 <= 0x7ffUL) { | 129 | } else if (ucs4 <= 0x7ffUL) { |
129 | utf8[0] = 0xc0 | (ucs4 >> 6); | 130 | utf8[0] = 0xc0 | (ucs4 >> 6); |
130 | utf8[1] = 0x80 | (ucs4 & 0x3f); | 131 | utf8[1] = 0x80 | (ucs4 & 0x3f); |
131 | i = 2; | 132 | i = 2; |
132 | } else if (ucs4 <= 0xffffUL) { | 133 | } else if (ucs4 <= 0xffffUL) { |
133 | utf8[0] = 0xe0 | (ucs4 >> 12); | 134 | utf8[0] = 0xe0 | (ucs4 >> 12); |
134 | utf8[1] = 0x80 | ((ucs4 >> 6) & 0x3f); | 135 | utf8[1] = 0x80 | ((ucs4 >> 6) & 0x3f); |
135 | utf8[2] = 0x80 | (ucs4 & 0x3f); | 136 | utf8[2] = 0x80 | (ucs4 & 0x3f); |
136 | i = 3; | 137 | i = 3; |
137 | } else { | 138 | } else { |
138 | utf8[0] = 0xf0 | (ucs4 >> 18); | 139 | utf8[0] = 0xf0 | (ucs4 >> 18); |
139 | utf8[1] = 0x80 | ((ucs4 >> 12) & 0x3f); | 140 | utf8[1] = 0x80 | ((ucs4 >> 12) & 0x3f); |
140 | utf8[2] = 0x80 | ((ucs4 >> 6) & 0x3f); | 141 | utf8[2] = 0x80 | ((ucs4 >> 6) & 0x3f); |
141 | utf8[3] = 0x80 | (ucs4 & 0x3f); | 142 | utf8[3] = 0x80 | (ucs4 & 0x3f); |
142 | i = 4; | 143 | i = 4; |
143 | } | 144 | } |
144 | /* copy it */ | 145 | /* copy it */ |
145 | for (c = 0; c < i; ++c) { | 146 | for (c = 0; c < i; ++c) { |
146 | dst += utf8[c]; | 147 | dst += utf8[c]; |
147 | } | 148 | } |
148 | } | 149 | } |
149 | } | 150 | } |
150 | /* skip over trailing '-' in modified UTF-7 encoding */ | 151 | /* skip over trailing '-' in modified UTF-7 encoding */ |
151 | if (src[srcPtr] == '-') | 152 | if (src[srcPtr] == '-') |
152 | ++srcPtr; | 153 | ++srcPtr; |
153 | } | 154 | } |
154 | } | 155 | } |
155 | 156 | ||
156 | return QString::fromUtf8( dst.data() ); | 157 | return QString::fromUtf8( dst.data() ); |
157 | } | 158 | } |
158 | 159 | ||
159 | Mail::Mail() | 160 | Mail::Mail() |
160 | :Opie::Core::ORefCount(),name(""), mail(""), to(""), cc(""), bcc(""), reply(""), subject(""), message("") | 161 | :Opie::Core::ORefCount(),name(""), mail(""), to(""), cc(""), bcc(""), reply(""), subject(""), message("") |
161 | { | 162 | { |
162 | } | 163 | } |
163 | 164 | ||
164 | MHFolder::MHFolder(const QString&disp_name,const QString&mbox) | 165 | MHFolder::MHFolder(const QString&disp_name,const QString&mbox) |
165 | : Folder( disp_name,"/" ) | 166 | : Folder( disp_name,"/" ) |
166 | { | 167 | { |
167 | separator = "/"; | 168 | separator = "/"; |
168 | name = mbox; | 169 | name = mbox; |
169 | if (!disp_name.startsWith("/") && disp_name.length()>0) | 170 | if (!disp_name.startsWith("/") && disp_name.length()>0) |
170 | name+="/"; | 171 | name+="/"; |
171 | name+=disp_name; | 172 | name+=disp_name; |
172 | if (disp_name.length()==0) { | 173 | if (disp_name.length()==0) { |
173 | nameDisplay = separator; | 174 | nameDisplay = separator; |
174 | } | 175 | } |
175 | prefix = mbox; | 176 | prefix = mbox; |
176 | } | 177 | } |
177 | 178 | ||
178 | MHFolder::~MHFolder() | 179 | MHFolder::~MHFolder() |
179 | { | 180 | { |
180 | } | 181 | } |
diff --git a/kmicromail/libmailwrapper/mailwrapper.h b/kmicromail/libmailwrapper/mailwrapper.h index cefe64e..2ba908b 100644 --- a/kmicromail/libmailwrapper/mailwrapper.h +++ b/kmicromail/libmailwrapper/mailwrapper.h | |||
@@ -1,128 +1,128 @@ | |||
1 | #ifndef MAILWRAPPER_H | 1 | #ifndef MAILWRAPPER_H |
2 | #define MAILWRAPPER_H | 2 | #define MAILWRAPPER_H |
3 | 3 | ||
4 | #include <qpe/applnk.h> | 4 | #include <qpe/applnk.h> |
5 | 5 | ||
6 | #include <qbitarray.h> | 6 | #include <qbitarray.h> |
7 | #include <qdatetime.h> | 7 | #include <qdatetime.h> |
8 | #include <qfileinfo.h> | 8 | #include <qfileinfo.h> |
9 | #include <kiconloader.h> | 9 | #include <kiconloader.h> |
10 | 10 | ||
11 | #include "settings.h" | 11 | #include "settings.h" |
12 | 12 | ||
13 | #include <opie2/osmartpointer.h> | 13 | #include <opie2/osmartpointer.h> |
14 | /* | 14 | /* |
15 | class Attachment | 15 | class Attachment |
16 | { | 16 | { |
17 | public: | 17 | public: |
18 | Attachment( DocLnk lnk ); | 18 | Attachment( DocLnk lnk ); |
19 | virtual ~Attachment(){} | 19 | virtual ~Attachment(){} |
20 | const QString getFileName()const{ return doc.file(); } | 20 | const QString getFileName()const{ return doc.file(); } |
21 | const QString getName()const{ return doc.name(); } | 21 | const QString getName()const{ return doc.name(); } |
22 | const QString getMimeType()const{ return doc.type(); } | 22 | const QString getMimeType()const{ return doc.type(); } |
23 | const QPixmap getPixmap()const{ return doc.pixmap(); } | 23 | const QPixmap getPixmap()const{ return doc.pixmap(); } |
24 | const int getSize()const { return size; } | 24 | const int getSize()const { return size; } |
25 | DocLnk getDocLnk() { return doc; } | 25 | DocLnk getDocLnk() { return doc; } |
26 | 26 | ||
27 | protected: | 27 | protected: |
28 | DocLnk doc; | 28 | DocLnk doc; |
29 | int size; | 29 | int size; |
30 | 30 | ||
31 | }; | 31 | }; |
32 | */ | 32 | */ |
33 | 33 | ||
34 | class Attachment | 34 | class Attachment |
35 | { | 35 | { |
36 | public: | 36 | public: |
37 | Attachment( QString lnk ); | 37 | Attachment( QString lnk ); |
38 | virtual ~Attachment(){} | 38 | virtual ~Attachment(){} |
39 | const QString getFileName()const{ return doc; } | 39 | const QString getFileName()const{ return doc; } |
40 | const QString getName()const{ return QFileInfo( doc ).baseName (); } | 40 | const QString getName()const{ return QFileInfo( doc ).baseName (); } |
41 | const QString getMimeType()const{ return QFileInfo( doc ).extension(false); } | 41 | const QString getMimeType()const{ return QFileInfo( doc ).extension(false); } |
42 | const QPixmap getPixmap()const{ return mPix; } | 42 | const QPixmap getPixmap()const{ return mPix; } |
43 | const int getSize()const { return size; } | 43 | const int getSize()const { return size; } |
44 | QString getDocLnk() { return doc; } | 44 | QString getDocLnk() { return doc; } |
45 | 45 | ||
46 | protected: | 46 | protected: |
47 | QPixmap mPix; | 47 | QPixmap mPix; |
48 | QString doc; | 48 | QString doc; |
49 | int size; | 49 | int size; |
50 | 50 | ||
51 | }; | 51 | }; |
52 | 52 | ||
53 | class Mail:public Opie::Core::ORefCount | 53 | class Mail:public Opie::Core::ORefCount |
54 | { | 54 | { |
55 | public: | 55 | public: |
56 | Mail(); | 56 | Mail(); |
57 | /* Possible that this destructor must not be declared virtual | 57 | /* Possible that this destructor must not be declared virtual |
58 | * 'cause it seems that it will never have some child classes. | 58 | * 'cause it seems that it will never have some child classes. |
59 | * in this case this object will not get a virtual table -> memory and | 59 | * in this case this object will not get a virtual table -> memory and |
60 | * speed will be a little bit better? | 60 | * speed will be a little bit better? |
61 | */ | 61 | */ |
62 | virtual ~Mail(){} | 62 | virtual ~Mail(){} |
63 | void addAttachment( Attachment *att ) { attList.append( att ); } | 63 | void addAttachment( Attachment *att ) { attList.append( att ); } |
64 | const QList<Attachment>& getAttachments()const { return attList; } | 64 | const QList<Attachment>& getAttachments()const { return attList; } |
65 | void removeAttachment( Attachment *att ) { attList.remove( att ); } | 65 | void removeAttachment( Attachment *att ) { attList.remove( att ); } |
66 | const QString&getName()const { return name; } | 66 | const QString&getName()const { return name; } |
67 | void setName( QString s ) { name = s; } | 67 | void setName( QString s ) { name = s; } |
68 | const QString&getMail()const{ return mail; } | 68 | const QString&getMail()const{ return mail; } |
69 | void setMail( const QString&s ) { mail = s; } | 69 | void setMail( const QString&s ) { mail = s; } |
70 | const QString&getTo()const{ return to; } | 70 | const QString&getTo()const{ return to; } |
71 | void setTo( const QString&s ) { to = s; } | 71 | void setTo( const QString&s ) { to = s; } |
72 | const QString&getCC()const{ return cc; } | 72 | const QString&getCC()const{ return cc; } |
73 | void setCC( const QString&s ) { cc = s; } | 73 | void setCC( const QString&s ) { cc = s; } |
74 | const QString&getBCC()const { return bcc; } | 74 | const QString&getBCC()const { return bcc; } |
75 | void setBCC( const QString&s ) { bcc = s; } | 75 | void setBCC( const QString&s ) { bcc = s; } |
76 | const QString&getMessage()const { return message; } | 76 | const QString&getMessage()const { return message; } |
77 | void setMessage( const QString&s ) { message = s; } | 77 | void setMessage( const QString&s ) { message = s; } |
78 | const QString&getSubject()const { return subject; } | 78 | const QString&getSubject()const { return subject; } |
79 | void setSubject( const QString&s ) { subject = s; } | 79 | void setSubject( const QString&s ) { subject = s; } |
80 | const QString&getReply()const{ return reply; } | 80 | const QString&getReply()const{ return reply; } |
81 | void setReply( const QString&a ) { reply = a; } | 81 | void setReply( const QString&a ) { reply = a; } |
82 | void setInreply(const QStringList&list){m_in_reply_to = list;} | 82 | void setInreply(const QStringList&list){m_in_reply_to = list;} |
83 | const QStringList&Inreply()const{return m_in_reply_to;} | 83 | const QStringList&Inreply()const{return m_in_reply_to;} |
84 | 84 | ||
85 | private: | 85 | private: |
86 | QList<Attachment> attList; | 86 | QList<Attachment> attList; |
87 | QString name, mail, to, cc, bcc, reply, subject, message; | 87 | QString name, mail, to, cc, bcc, reply, subject, message; |
88 | QStringList m_in_reply_to; | 88 | QStringList m_in_reply_to; |
89 | }; | 89 | }; |
90 | 90 | ||
91 | class Folder:public Opie::Core::ORefCount | 91 | class Folder:public Opie::Core::ORefCount |
92 | { | 92 | { |
93 | public: | 93 | public: |
94 | Folder( const QString&init_name,const QString&sep ); | 94 | Folder( const QString&init_name,const QString&sep ); |
95 | virtual ~Folder(); | 95 | virtual ~Folder(); |
96 | const QString&getDisplayName()const { return nameDisplay; } | 96 | const QString&getDisplayName()const { return nameDisplay; } |
97 | const QString&getName()const { return name; } | 97 | const QString&getName()const { return name; } |
98 | const QString&getPrefix()const{return prefix; } | 98 | const QString&getPrefix()const{return prefix; } |
99 | virtual bool may_select()const{return true;} | 99 | virtual bool may_select()const{return true;} |
100 | virtual bool no_inferior()const{return true;} | 100 | virtual bool no_inferior()const{return true;} |
101 | const QString&Separator()const; | 101 | const QString&Separator()const; |
102 | 102 | ||
103 | protected: | 103 | protected: |
104 | QString nameDisplay, name, separator,prefix; | 104 | QString nameDisplay, name, separator,prefix; |
105 | }; | 105 | }; |
106 | 106 | ||
107 | typedef Opie::Core::OSmartPointer<Folder> FolderP; | 107 | typedef Opie::Core::OSmartPointer<Folder> FolderP; |
108 | 108 | ||
109 | class MHFolder : public Folder | 109 | class MHFolder : public Folder |
110 | { | 110 | { |
111 | public: | 111 | public: |
112 | MHFolder(const QString&disp_name,const QString&mbox); | 112 | MHFolder(const QString&disp_name,const QString&mbox); |
113 | virtual ~MHFolder(); | 113 | virtual ~MHFolder(); |
114 | }; | 114 | }; |
115 | 115 | ||
116 | class IMAPFolder : public Folder | 116 | class IMAPFolder : public Folder |
117 | { | 117 | { |
118 | public: | 118 | public: |
119 | IMAPFolder(const QString&name, const QString&sep, bool select=true,bool noinf=false,const QString&prefix="" ); | 119 | IMAPFolder(const QString&name, const QString&sep, bool select=true,bool noinf=false,const QString&prefix="" ); |
120 | virtual ~IMAPFolder(); | 120 | virtual ~IMAPFolder(); |
121 | virtual bool may_select()const{return m_MaySelect;} | 121 | virtual bool may_select()const{return m_MaySelect;} |
122 | virtual bool no_inferior()const{return m_NoInferior;} | 122 | virtual bool no_inferior()const{return m_NoInferior;} |
123 | private: | ||
124 | static QString decodeFolderName( const QString &name ); | 123 | static QString decodeFolderName( const QString &name ); |
124 | private: | ||
125 | bool m_MaySelect,m_NoInferior; | 125 | bool m_MaySelect,m_NoInferior; |
126 | }; | 126 | }; |
127 | 127 | ||
128 | #endif | 128 | #endif |