-rw-r--r-- | kmicromail/imapconfigui.ui | 6 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/abstractmail.cpp | 13 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/imapwrapper.cpp | 5 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/pop3wrapper.cpp | 12 | ||||
-rw-r--r-- | kmicromail/mainwindow.cpp | 3 | ||||
-rw-r--r-- | kmicromail/pop3configui.ui | 6 |
6 files changed, 31 insertions, 14 deletions
diff --git a/kmicromail/imapconfigui.ui b/kmicromail/imapconfigui.ui index 2e4c9ca..d24c9ea 100644 --- a/kmicromail/imapconfigui.ui +++ b/kmicromail/imapconfigui.ui | |||
@@ -1,475 +1,475 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>IMAPconfigUI</class> | 2 | <class>IMAPconfigUI</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QDialog</class> | 4 | <class>QDialog</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>IMAPconfigUI</cstring> | 7 | <cstring>IMAPconfigUI</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>306</width> | 14 | <width>269</width> |
15 | <height>396</height> | 15 | <height>388</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Configure IMAP</string> | 20 | <string>Configure IMAP</string> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
23 | <name>layoutMargin</name> | 23 | <name>layoutMargin</name> |
24 | </property> | 24 | </property> |
25 | <property> | 25 | <property> |
26 | <name>layoutSpacing</name> | 26 | <name>layoutSpacing</name> |
27 | </property> | 27 | </property> |
28 | <vbox> | 28 | <vbox> |
29 | <property stdset="1"> | 29 | <property stdset="1"> |
30 | <name>margin</name> | 30 | <name>margin</name> |
31 | <number>3</number> | 31 | <number>3</number> |
32 | </property> | 32 | </property> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>spacing</name> | 34 | <name>spacing</name> |
35 | <number>1</number> | 35 | <number>1</number> |
36 | </property> | 36 | </property> |
37 | <widget> | 37 | <widget> |
38 | <class>QLayoutWidget</class> | 38 | <class>QLayoutWidget</class> |
39 | <property stdset="1"> | 39 | <property stdset="1"> |
40 | <name>name</name> | 40 | <name>name</name> |
41 | <cstring>Layout22</cstring> | 41 | <cstring>Layout22</cstring> |
42 | </property> | 42 | </property> |
43 | <hbox> | 43 | <hbox> |
44 | <property stdset="1"> | 44 | <property stdset="1"> |
45 | <name>margin</name> | 45 | <name>margin</name> |
46 | <number>0</number> | 46 | <number>0</number> |
47 | </property> | 47 | </property> |
48 | <property stdset="1"> | 48 | <property stdset="1"> |
49 | <name>spacing</name> | 49 | <name>spacing</name> |
50 | <number>6</number> | 50 | <number>6</number> |
51 | </property> | 51 | </property> |
52 | <widget> | 52 | <widget> |
53 | <class>QLabel</class> | 53 | <class>QLabel</class> |
54 | <property stdset="1"> | 54 | <property stdset="1"> |
55 | <name>name</name> | 55 | <name>name</name> |
56 | <cstring>accountLabel</cstring> | 56 | <cstring>accountLabel</cstring> |
57 | </property> | 57 | </property> |
58 | <property stdset="1"> | 58 | <property stdset="1"> |
59 | <name>text</name> | 59 | <name>text</name> |
60 | <string>Account</string> | 60 | <string>Account</string> |
61 | </property> | 61 | </property> |
62 | </widget> | 62 | </widget> |
63 | <widget> | 63 | <widget> |
64 | <class>QLineEdit</class> | 64 | <class>QLineEdit</class> |
65 | <property stdset="1"> | 65 | <property stdset="1"> |
66 | <name>name</name> | 66 | <name>name</name> |
67 | <cstring>accountLine</cstring> | 67 | <cstring>accountLine</cstring> |
68 | </property> | 68 | </property> |
69 | <property> | 69 | <property> |
70 | <name>toolTip</name> | 70 | <name>toolTip</name> |
71 | <string>Name of the Account</string> | 71 | <string>Name of the Account</string> |
72 | </property> | 72 | </property> |
73 | </widget> | 73 | </widget> |
74 | </hbox> | 74 | </hbox> |
75 | </widget> | 75 | </widget> |
76 | <widget> | 76 | <widget> |
77 | <class>Line</class> | 77 | <class>Line</class> |
78 | <property stdset="1"> | 78 | <property stdset="1"> |
79 | <name>name</name> | 79 | <name>name</name> |
80 | <cstring>line1</cstring> | 80 | <cstring>line1</cstring> |
81 | </property> | 81 | </property> |
82 | <property stdset="1"> | 82 | <property stdset="1"> |
83 | <name>orientation</name> | 83 | <name>orientation</name> |
84 | <enum>Horizontal</enum> | 84 | <enum>Horizontal</enum> |
85 | </property> | 85 | </property> |
86 | </widget> | 86 | </widget> |
87 | <widget> | 87 | <widget> |
88 | <class>QLayoutWidget</class> | 88 | <class>QLayoutWidget</class> |
89 | <property stdset="1"> | 89 | <property stdset="1"> |
90 | <name>name</name> | 90 | <name>name</name> |
91 | <cstring>Layout23</cstring> | 91 | <cstring>Layout23</cstring> |
92 | </property> | 92 | </property> |
93 | <hbox> | 93 | <hbox> |
94 | <property stdset="1"> | 94 | <property stdset="1"> |
95 | <name>margin</name> | 95 | <name>margin</name> |
96 | <number>0</number> | 96 | <number>0</number> |
97 | </property> | 97 | </property> |
98 | <property stdset="1"> | 98 | <property stdset="1"> |
99 | <name>spacing</name> | 99 | <name>spacing</name> |
100 | <number>6</number> | 100 | <number>6</number> |
101 | </property> | 101 | </property> |
102 | <widget> | 102 | <widget> |
103 | <class>QLabel</class> | 103 | <class>QLabel</class> |
104 | <property stdset="1"> | 104 | <property stdset="1"> |
105 | <name>name</name> | 105 | <name>name</name> |
106 | <cstring>serverLabel</cstring> | 106 | <cstring>serverLabel</cstring> |
107 | </property> | 107 | </property> |
108 | <property stdset="1"> | 108 | <property stdset="1"> |
109 | <name>text</name> | 109 | <name>text</name> |
110 | <string>Server</string> | 110 | <string>Server</string> |
111 | </property> | 111 | </property> |
112 | </widget> | 112 | </widget> |
113 | <widget> | 113 | <widget> |
114 | <class>QLineEdit</class> | 114 | <class>QLineEdit</class> |
115 | <property stdset="1"> | 115 | <property stdset="1"> |
116 | <name>name</name> | 116 | <name>name</name> |
117 | <cstring>serverLine</cstring> | 117 | <cstring>serverLine</cstring> |
118 | </property> | 118 | </property> |
119 | </widget> | 119 | </widget> |
120 | </hbox> | 120 | </hbox> |
121 | </widget> | 121 | </widget> |
122 | <widget> | 122 | <widget> |
123 | <class>QLayoutWidget</class> | 123 | <class>QLayoutWidget</class> |
124 | <property stdset="1"> | 124 | <property stdset="1"> |
125 | <name>name</name> | 125 | <name>name</name> |
126 | <cstring>Layout24</cstring> | 126 | <cstring>Layout24</cstring> |
127 | </property> | 127 | </property> |
128 | <hbox> | 128 | <hbox> |
129 | <property stdset="1"> | 129 | <property stdset="1"> |
130 | <name>margin</name> | 130 | <name>margin</name> |
131 | <number>0</number> | 131 | <number>0</number> |
132 | </property> | 132 | </property> |
133 | <property stdset="1"> | 133 | <property stdset="1"> |
134 | <name>spacing</name> | 134 | <name>spacing</name> |
135 | <number>6</number> | 135 | <number>6</number> |
136 | </property> | 136 | </property> |
137 | <widget> | 137 | <widget> |
138 | <class>QLabel</class> | 138 | <class>QLabel</class> |
139 | <property stdset="1"> | 139 | <property stdset="1"> |
140 | <name>name</name> | 140 | <name>name</name> |
141 | <cstring>portLabel</cstring> | 141 | <cstring>portLabel</cstring> |
142 | </property> | 142 | </property> |
143 | <property stdset="1"> | 143 | <property stdset="1"> |
144 | <name>text</name> | 144 | <name>text</name> |
145 | <string>Port</string> | 145 | <string>Port</string> |
146 | </property> | 146 | </property> |
147 | </widget> | 147 | </widget> |
148 | <widget> | 148 | <widget> |
149 | <class>QLineEdit</class> | 149 | <class>QLineEdit</class> |
150 | <property stdset="1"> | 150 | <property stdset="1"> |
151 | <name>name</name> | 151 | <name>name</name> |
152 | <cstring>portLine</cstring> | 152 | <cstring>portLine</cstring> |
153 | </property> | 153 | </property> |
154 | </widget> | 154 | </widget> |
155 | </hbox> | 155 | </hbox> |
156 | </widget> | 156 | </widget> |
157 | <widget> | 157 | <widget> |
158 | <class>QLayoutWidget</class> | 158 | <class>QLayoutWidget</class> |
159 | <property stdset="1"> | 159 | <property stdset="1"> |
160 | <name>name</name> | 160 | <name>name</name> |
161 | <cstring>Layout16</cstring> | 161 | <cstring>Layout16</cstring> |
162 | </property> | 162 | </property> |
163 | <vbox> | 163 | <vbox> |
164 | <property stdset="1"> | 164 | <property stdset="1"> |
165 | <name>margin</name> | 165 | <name>margin</name> |
166 | <number>0</number> | 166 | <number>0</number> |
167 | </property> | 167 | </property> |
168 | <property stdset="1"> | 168 | <property stdset="1"> |
169 | <name>spacing</name> | 169 | <name>spacing</name> |
170 | <number>6</number> | 170 | <number>6</number> |
171 | </property> | 171 | </property> |
172 | <widget> | 172 | <widget> |
173 | <class>QLabel</class> | 173 | <class>QLabel</class> |
174 | <property stdset="1"> | 174 | <property stdset="1"> |
175 | <name>name</name> | 175 | <name>name</name> |
176 | <cstring>TextLabel1</cstring> | 176 | <cstring>TextLabel1</cstring> |
177 | </property> | 177 | </property> |
178 | <property stdset="1"> | 178 | <property stdset="1"> |
179 | <name>text</name> | 179 | <name>text</name> |
180 | <string>Use secure sockets:</string> | 180 | <string>Use secure sockets:</string> |
181 | </property> | 181 | </property> |
182 | </widget> | 182 | </widget> |
183 | <widget> | 183 | <widget> |
184 | <class>QComboBox</class> | 184 | <class>QComboBox</class> |
185 | <property stdset="1"> | 185 | <property stdset="1"> |
186 | <name>name</name> | 186 | <name>name</name> |
187 | <cstring>ComboBox1</cstring> | 187 | <cstring>ComboBox1</cstring> |
188 | </property> | 188 | </property> |
189 | </widget> | 189 | </widget> |
190 | <widget> | 190 | <widget> |
191 | <class>QLineEdit</class> | 191 | <class>QLineEdit</class> |
192 | <property stdset="1"> | 192 | <property stdset="1"> |
193 | <name>name</name> | 193 | <name>name</name> |
194 | <cstring>CommandEdit</cstring> | 194 | <cstring>CommandEdit</cstring> |
195 | </property> | 195 | </property> |
196 | <property stdset="1"> | 196 | <property stdset="1"> |
197 | <name>text</name> | 197 | <name>text</name> |
198 | <string>ssh $SERVER exec</string> | 198 | <string>ssh $SERVER exec</string> |
199 | </property> | 199 | </property> |
200 | </widget> | 200 | </widget> |
201 | </vbox> | 201 | </vbox> |
202 | </widget> | 202 | </widget> |
203 | <widget> | 203 | <widget> |
204 | <class>Line</class> | 204 | <class>Line</class> |
205 | <property stdset="1"> | 205 | <property stdset="1"> |
206 | <name>name</name> | 206 | <name>name</name> |
207 | <cstring>line2</cstring> | 207 | <cstring>line2</cstring> |
208 | </property> | 208 | </property> |
209 | <property stdset="1"> | 209 | <property stdset="1"> |
210 | <name>enabled</name> | 210 | <name>enabled</name> |
211 | <bool>true</bool> | 211 | <bool>true</bool> |
212 | </property> | 212 | </property> |
213 | <property stdset="1"> | 213 | <property stdset="1"> |
214 | <name>caption</name> | 214 | <name>caption</name> |
215 | <string></string> | 215 | <string></string> |
216 | </property> | 216 | </property> |
217 | <property stdset="1"> | 217 | <property stdset="1"> |
218 | <name>orientation</name> | 218 | <name>orientation</name> |
219 | <enum>Horizontal</enum> | 219 | <enum>Horizontal</enum> |
220 | </property> | 220 | </property> |
221 | <property> | 221 | <property> |
222 | <name>layoutMargin</name> | 222 | <name>layoutMargin</name> |
223 | </property> | 223 | </property> |
224 | <property> | 224 | <property> |
225 | <name>layoutSpacing</name> | 225 | <name>layoutSpacing</name> |
226 | </property> | 226 | </property> |
227 | </widget> | 227 | </widget> |
228 | <widget> | 228 | <widget> |
229 | <class>QLayoutWidget</class> | 229 | <class>QLayoutWidget</class> |
230 | <property stdset="1"> | 230 | <property stdset="1"> |
231 | <name>name</name> | 231 | <name>name</name> |
232 | <cstring>Layout25</cstring> | 232 | <cstring>Layout25</cstring> |
233 | </property> | 233 | </property> |
234 | <hbox> | 234 | <hbox> |
235 | <property stdset="1"> | 235 | <property stdset="1"> |
236 | <name>margin</name> | 236 | <name>margin</name> |
237 | <number>0</number> | 237 | <number>0</number> |
238 | </property> | 238 | </property> |
239 | <property stdset="1"> | 239 | <property stdset="1"> |
240 | <name>spacing</name> | 240 | <name>spacing</name> |
241 | <number>6</number> | 241 | <number>6</number> |
242 | </property> | 242 | </property> |
243 | <widget> | 243 | <widget> |
244 | <class>QLabel</class> | 244 | <class>QLabel</class> |
245 | <property stdset="1"> | 245 | <property stdset="1"> |
246 | <name>name</name> | 246 | <name>name</name> |
247 | <cstring>userLabel</cstring> | 247 | <cstring>userLabel</cstring> |
248 | </property> | 248 | </property> |
249 | <property stdset="1"> | 249 | <property stdset="1"> |
250 | <name>text</name> | 250 | <name>text</name> |
251 | <string>User</string> | 251 | <string>User</string> |
252 | </property> | 252 | </property> |
253 | </widget> | 253 | </widget> |
254 | <widget> | 254 | <widget> |
255 | <class>QLineEdit</class> | 255 | <class>QLineEdit</class> |
256 | <property stdset="1"> | 256 | <property stdset="1"> |
257 | <name>name</name> | 257 | <name>name</name> |
258 | <cstring>userLine</cstring> | 258 | <cstring>userLine</cstring> |
259 | </property> | 259 | </property> |
260 | </widget> | 260 | </widget> |
261 | </hbox> | 261 | </hbox> |
262 | </widget> | 262 | </widget> |
263 | <widget> | 263 | <widget> |
264 | <class>QLayoutWidget</class> | 264 | <class>QLayoutWidget</class> |
265 | <property stdset="1"> | 265 | <property stdset="1"> |
266 | <name>name</name> | 266 | <name>name</name> |
267 | <cstring>Layout26</cstring> | 267 | <cstring>Layout26</cstring> |
268 | </property> | 268 | </property> |
269 | <hbox> | 269 | <hbox> |
270 | <property stdset="1"> | 270 | <property stdset="1"> |
271 | <name>margin</name> | 271 | <name>margin</name> |
272 | <number>0</number> | 272 | <number>0</number> |
273 | </property> | 273 | </property> |
274 | <property stdset="1"> | 274 | <property stdset="1"> |
275 | <name>spacing</name> | 275 | <name>spacing</name> |
276 | <number>6</number> | 276 | <number>6</number> |
277 | </property> | 277 | </property> |
278 | <widget> | 278 | <widget> |
279 | <class>QLabel</class> | 279 | <class>QLabel</class> |
280 | <property stdset="1"> | 280 | <property stdset="1"> |
281 | <name>name</name> | 281 | <name>name</name> |
282 | <cstring>passLabel</cstring> | 282 | <cstring>passLabel</cstring> |
283 | </property> | 283 | </property> |
284 | <property stdset="1"> | 284 | <property stdset="1"> |
285 | <name>text</name> | 285 | <name>text</name> |
286 | <string>Password</string> | 286 | <string>Password</string> |
287 | </property> | 287 | </property> |
288 | </widget> | 288 | </widget> |
289 | <widget> | 289 | <widget> |
290 | <class>QLineEdit</class> | 290 | <class>QLineEdit</class> |
291 | <property stdset="1"> | 291 | <property stdset="1"> |
292 | <name>name</name> | 292 | <name>name</name> |
293 | <cstring>passLine</cstring> | 293 | <cstring>passLine</cstring> |
294 | </property> | 294 | </property> |
295 | <property stdset="1"> | 295 | <property stdset="1"> |
296 | <name>echoMode</name> | 296 | <name>echoMode</name> |
297 | <enum>Password</enum> | 297 | <enum>Password</enum> |
298 | </property> | 298 | </property> |
299 | </widget> | 299 | </widget> |
300 | </hbox> | 300 | </hbox> |
301 | </widget> | 301 | </widget> |
302 | <widget> | 302 | <widget> |
303 | <class>Line</class> | 303 | <class>Line</class> |
304 | <property stdset="1"> | 304 | <property stdset="1"> |
305 | <name>name</name> | 305 | <name>name</name> |
306 | <cstring>Line3</cstring> | 306 | <cstring>Line3</cstring> |
307 | </property> | 307 | </property> |
308 | <property stdset="1"> | 308 | <property stdset="1"> |
309 | <name>orientation</name> | 309 | <name>orientation</name> |
310 | <enum>Horizontal</enum> | 310 | <enum>Horizontal</enum> |
311 | </property> | 311 | </property> |
312 | </widget> | 312 | </widget> |
313 | <widget> | 313 | <widget> |
314 | <class>QLayoutWidget</class> | 314 | <class>QLayoutWidget</class> |
315 | <property stdset="1"> | 315 | <property stdset="1"> |
316 | <name>name</name> | 316 | <name>name</name> |
317 | <cstring>Layout27</cstring> | 317 | <cstring>Layout27</cstring> |
318 | </property> | 318 | </property> |
319 | <hbox> | 319 | <hbox> |
320 | <property stdset="1"> | 320 | <property stdset="1"> |
321 | <name>margin</name> | 321 | <name>margin</name> |
322 | <number>0</number> | 322 | <number>0</number> |
323 | </property> | 323 | </property> |
324 | <property stdset="1"> | 324 | <property stdset="1"> |
325 | <name>spacing</name> | 325 | <name>spacing</name> |
326 | <number>6</number> | 326 | <number>6</number> |
327 | </property> | 327 | </property> |
328 | <widget> | 328 | <widget> |
329 | <class>QLabel</class> | 329 | <class>QLabel</class> |
330 | <property stdset="1"> | 330 | <property stdset="1"> |
331 | <name>name</name> | 331 | <name>name</name> |
332 | <cstring>prefixLabel</cstring> | 332 | <cstring>prefixLabel</cstring> |
333 | </property> | 333 | </property> |
334 | <property stdset="1"> | 334 | <property stdset="1"> |
335 | <name>text</name> | 335 | <name>text</name> |
336 | <string>Prefix</string> | 336 | <string>Prefix</string> |
337 | </property> | 337 | </property> |
338 | </widget> | 338 | </widget> |
339 | <widget> | 339 | <widget> |
340 | <class>QLineEdit</class> | 340 | <class>QLineEdit</class> |
341 | <property stdset="1"> | 341 | <property stdset="1"> |
342 | <name>name</name> | 342 | <name>name</name> |
343 | <cstring>prefixLine</cstring> | 343 | <cstring>prefixLine</cstring> |
344 | </property> | 344 | </property> |
345 | </widget> | 345 | </widget> |
346 | </hbox> | 346 | </hbox> |
347 | </widget> | 347 | </widget> |
348 | <widget> | 348 | <widget> |
349 | <class>QLayoutWidget</class> | 349 | <class>QLayoutWidget</class> |
350 | <property stdset="1"> | 350 | <property stdset="1"> |
351 | <name>name</name> | 351 | <name>name</name> |
352 | <cstring>Layout11</cstring> | 352 | <cstring>Layout11</cstring> |
353 | </property> | 353 | </property> |
354 | <hbox> | 354 | <hbox> |
355 | <property stdset="1"> | 355 | <property stdset="1"> |
356 | <name>margin</name> | 356 | <name>margin</name> |
357 | <number>0</number> | 357 | <number>0</number> |
358 | </property> | 358 | </property> |
359 | <property stdset="1"> | 359 | <property stdset="1"> |
360 | <name>spacing</name> | 360 | <name>spacing</name> |
361 | <number>6</number> | 361 | <number>6</number> |
362 | </property> | 362 | </property> |
363 | <widget> | 363 | <widget> |
364 | <class>QLabel</class> | 364 | <class>QLabel</class> |
365 | <property stdset="1"> | 365 | <property stdset="1"> |
366 | <name>name</name> | 366 | <name>name</name> |
367 | <cstring>TextLabel1_2</cstring> | 367 | <cstring>TextLabel1_2</cstring> |
368 | </property> | 368 | </property> |
369 | <property stdset="1"> | 369 | <property stdset="1"> |
370 | <name>text</name> | 370 | <name>text</name> |
371 | <string>Local storage folder:</string> | 371 | <string>Local storage folder:</string> |
372 | </property> | 372 | </property> |
373 | </widget> | 373 | </widget> |
374 | <widget> | 374 | <widget> |
375 | <class>QLineEdit</class> | 375 | <class>QLineEdit</class> |
376 | <property stdset="1"> | 376 | <property stdset="1"> |
377 | <name>name</name> | 377 | <name>name</name> |
378 | <cstring>localFolder</cstring> | 378 | <cstring>localFolder</cstring> |
379 | </property> | 379 | </property> |
380 | <property stdset="1"> | 380 | <property stdset="1"> |
381 | <name>text</name> | 381 | <name>text</name> |
382 | <string></string> | 382 | <string></string> |
383 | </property> | 383 | </property> |
384 | </widget> | 384 | </widget> |
385 | </hbox> | 385 | </hbox> |
386 | </widget> | 386 | </widget> |
387 | <widget> | 387 | <widget> |
388 | <class>QLayoutWidget</class> | 388 | <class>QLayoutWidget</class> |
389 | <property stdset="1"> | 389 | <property stdset="1"> |
390 | <name>name</name> | 390 | <name>name</name> |
391 | <cstring>Layout12</cstring> | 391 | <cstring>Layout12</cstring> |
392 | </property> | 392 | </property> |
393 | <hbox> | 393 | <hbox> |
394 | <property stdset="1"> | 394 | <property stdset="1"> |
395 | <name>margin</name> | 395 | <name>margin</name> |
396 | <number>0</number> | 396 | <number>0</number> |
397 | </property> | 397 | </property> |
398 | <property stdset="1"> | 398 | <property stdset="1"> |
399 | <name>spacing</name> | 399 | <name>spacing</name> |
400 | <number>6</number> | 400 | <number>6</number> |
401 | </property> | 401 | </property> |
402 | <widget> | 402 | <widget> |
403 | <class>QCheckBox</class> | 403 | <class>QCheckBox</class> |
404 | <property stdset="1"> | 404 | <property stdset="1"> |
405 | <name>name</name> | 405 | <name>name</name> |
406 | <cstring>CheckBoxDown</cstring> | 406 | <cstring>CheckBoxDown</cstring> |
407 | </property> | 407 | </property> |
408 | <property stdset="1"> | 408 | <property stdset="1"> |
409 | <name>text</name> | 409 | <name>text</name> |
410 | <string>Download only messages smaller</string> | 410 | <string>Get only messages smaller</string> |
411 | </property> | 411 | </property> |
412 | </widget> | 412 | </widget> |
413 | <widget> | 413 | <widget> |
414 | <class>QSpinBox</class> | 414 | <class>QSpinBox</class> |
415 | <property stdset="1"> | 415 | <property stdset="1"> |
416 | <name>name</name> | 416 | <name>name</name> |
417 | <cstring>SpinBoxDown</cstring> | 417 | <cstring>SpinBoxDown</cstring> |
418 | </property> | 418 | </property> |
419 | <property stdset="1"> | 419 | <property stdset="1"> |
420 | <name>suffix</name> | 420 | <name>suffix</name> |
421 | <string>kB</string> | 421 | <string>kB</string> |
422 | </property> | 422 | </property> |
423 | <property stdset="1"> | 423 | <property stdset="1"> |
424 | <name>maxValue</name> | 424 | <name>maxValue</name> |
425 | <number>99999</number> | 425 | <number>99999</number> |
426 | </property> | 426 | </property> |
427 | <property stdset="1"> | 427 | <property stdset="1"> |
428 | <name>minValue</name> | 428 | <name>minValue</name> |
429 | <number>1</number> | 429 | <number>1</number> |
430 | </property> | 430 | </property> |
431 | </widget> | 431 | </widget> |
432 | </hbox> | 432 | </hbox> |
433 | </widget> | 433 | </widget> |
434 | <widget> | 434 | <widget> |
435 | <class>QCheckBox</class> | 435 | <class>QCheckBox</class> |
436 | <property stdset="1"> | 436 | <property stdset="1"> |
437 | <name>name</name> | 437 | <name>name</name> |
438 | <cstring>CheckBoxLeaveOn</cstring> | 438 | <cstring>CheckBoxLeaveOn</cstring> |
439 | </property> | 439 | </property> |
440 | <property stdset="1"> | 440 | <property stdset="1"> |
441 | <name>text</name> | 441 | <name>text</name> |
442 | <string>Leave Messages on Server</string> | 442 | <string>Leave Messages on Server</string> |
443 | </property> | 443 | </property> |
444 | </widget> | 444 | </widget> |
445 | <spacer> | 445 | <spacer> |
446 | <property> | 446 | <property> |
447 | <name>name</name> | 447 | <name>name</name> |
448 | <cstring>spacer</cstring> | 448 | <cstring>spacer</cstring> |
449 | </property> | 449 | </property> |
450 | <property stdset="1"> | 450 | <property stdset="1"> |
451 | <name>orientation</name> | 451 | <name>orientation</name> |
452 | <enum>Vertical</enum> | 452 | <enum>Vertical</enum> |
453 | </property> | 453 | </property> |
454 | <property stdset="1"> | 454 | <property stdset="1"> |
455 | <name>sizeType</name> | 455 | <name>sizeType</name> |
456 | <enum>Expanding</enum> | 456 | <enum>Expanding</enum> |
457 | </property> | 457 | </property> |
458 | <property> | 458 | <property> |
459 | <name>sizeHint</name> | 459 | <name>sizeHint</name> |
460 | <size> | 460 | <size> |
461 | <width>20</width> | 461 | <width>20</width> |
462 | <height>20</height> | 462 | <height>20</height> |
463 | </size> | 463 | </size> |
464 | </property> | 464 | </property> |
465 | </spacer> | 465 | </spacer> |
466 | </vbox> | 466 | </vbox> |
467 | </widget> | 467 | </widget> |
468 | <tabstops> | 468 | <tabstops> |
469 | <tabstop>accountLine</tabstop> | 469 | <tabstop>accountLine</tabstop> |
470 | <tabstop>serverLine</tabstop> | 470 | <tabstop>serverLine</tabstop> |
471 | <tabstop>portLine</tabstop> | 471 | <tabstop>portLine</tabstop> |
472 | <tabstop>userLine</tabstop> | 472 | <tabstop>userLine</tabstop> |
473 | <tabstop>passLine</tabstop> | 473 | <tabstop>passLine</tabstop> |
474 | </tabstops> | 474 | </tabstops> |
475 | </UI> | 475 | </UI> |
diff --git a/kmicromail/libmailwrapper/abstractmail.cpp b/kmicromail/libmailwrapper/abstractmail.cpp index 44878e0..8f67566 100644 --- a/kmicromail/libmailwrapper/abstractmail.cpp +++ b/kmicromail/libmailwrapper/abstractmail.cpp | |||
@@ -1,272 +1,277 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | #include "abstractmail.h" | 2 | #include "abstractmail.h" |
3 | #include "imapwrapper.h" | 3 | #include "imapwrapper.h" |
4 | #include "pop3wrapper.h" | 4 | #include "pop3wrapper.h" |
5 | #include "nntpwrapper.h" | 5 | #include "nntpwrapper.h" |
6 | #include "mhwrapper.h" | 6 | #include "mhwrapper.h" |
7 | #include "mailtypes.h" | 7 | #include "mailtypes.h" |
8 | #include <qpe/global.h> | 8 | #include <qpe/global.h> |
9 | 9 | ||
10 | 10 | ||
11 | #include <qprogressbar.h> | 11 | #include <qprogressbar.h> |
12 | #include <qapplication.h> | 12 | #include <qapplication.h> |
13 | #include <qmessagebox.h> | 13 | #include <qmessagebox.h> |
14 | 14 | ||
15 | #include <kdecore/kstandarddirs.h> | 15 | #include <kdecore/kstandarddirs.h> |
16 | #include <qfile.h> | 16 | #include <qfile.h> |
17 | #include <qtextstream.h> | 17 | #include <qtextstream.h> |
18 | #include <stdlib.h> | 18 | #include <stdlib.h> |
19 | #include <libetpan/mailmime_content.h> | 19 | #include <libetpan/mailmime_content.h> |
20 | #include <libetpan/mailmime.h> | 20 | #include <libetpan/mailmime.h> |
21 | 21 | ||
22 | using namespace Opie::Core; | 22 | using namespace Opie::Core; |
23 | AbstractMail* AbstractMail::getWrapper(IMAPaccount *a) | 23 | AbstractMail* AbstractMail::getWrapper(IMAPaccount *a) |
24 | { | 24 | { |
25 | return new IMAPwrapper(a); | 25 | return new IMAPwrapper(a); |
26 | } | 26 | } |
27 | 27 | ||
28 | AbstractMail* AbstractMail::getWrapper(POP3account *a) | 28 | AbstractMail* AbstractMail::getWrapper(POP3account *a) |
29 | { | 29 | { |
30 | return new POP3wrapper(a); | 30 | return new POP3wrapper(a); |
31 | } | 31 | } |
32 | 32 | ||
33 | AbstractMail* AbstractMail::getWrapper(NNTPaccount *a) | 33 | AbstractMail* AbstractMail::getWrapper(NNTPaccount *a) |
34 | { | 34 | { |
35 | return new NNTPwrapper(a); | 35 | return new NNTPwrapper(a); |
36 | } | 36 | } |
37 | 37 | ||
38 | AbstractMail* AbstractMail::getWrapper(const QString&a,const QString&name) | 38 | AbstractMail* AbstractMail::getWrapper(const QString&a,const QString&name) |
39 | { | 39 | { |
40 | return new MHwrapper(a,name); | 40 | return new MHwrapper(a,name); |
41 | } | 41 | } |
42 | 42 | ||
43 | AbstractMail* AbstractMail::getWrapper(Account*a) | 43 | AbstractMail* AbstractMail::getWrapper(Account*a) |
44 | { | 44 | { |
45 | if (!a) return 0; | 45 | if (!a) return 0; |
46 | switch (a->getType()) { | 46 | switch (a->getType()) { |
47 | case MAILLIB::A_IMAP: | 47 | case MAILLIB::A_IMAP: |
48 | return new IMAPwrapper((IMAPaccount*)a); | 48 | return new IMAPwrapper((IMAPaccount*)a); |
49 | break; | 49 | break; |
50 | case MAILLIB::A_POP3: | 50 | case MAILLIB::A_POP3: |
51 | return new POP3wrapper((POP3account*)a); | 51 | return new POP3wrapper((POP3account*)a); |
52 | break; | 52 | break; |
53 | case MAILLIB::A_NNTP: | 53 | case MAILLIB::A_NNTP: |
54 | return new NNTPwrapper((NNTPaccount*)a); | 54 | return new NNTPwrapper((NNTPaccount*)a); |
55 | break; | 55 | break; |
56 | default: | 56 | default: |
57 | return 0; | 57 | return 0; |
58 | } | 58 | } |
59 | } | 59 | } |
60 | 60 | ||
61 | encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc) | 61 | encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc) |
62 | { | 62 | { |
63 | // odebug << "Decode string start" << oendl; | 63 | // odebug << "Decode string start" << oendl; |
64 | char*result_text; | 64 | char*result_text; |
65 | size_t index = 0; | 65 | size_t index = 0; |
66 | /* reset for recursive use! */ | 66 | /* reset for recursive use! */ |
67 | size_t target_length = 0; | 67 | size_t target_length = 0; |
68 | result_text = 0; | 68 | result_text = 0; |
69 | int mimetype = MAILMIME_MECHANISM_7BIT; | 69 | int mimetype = MAILMIME_MECHANISM_7BIT; |
70 | if (enc.lower()=="quoted-printable") { | 70 | if (enc.lower()=="quoted-printable") { |
71 | mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE; | 71 | mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE; |
72 | } else if (enc.lower()=="base64") { | 72 | } else if (enc.lower()=="base64") { |
73 | mimetype = MAILMIME_MECHANISM_BASE64; | 73 | mimetype = MAILMIME_MECHANISM_BASE64; |
74 | } else if (enc.lower()=="8bit") { | 74 | } else if (enc.lower()=="8bit") { |
75 | mimetype = MAILMIME_MECHANISM_8BIT; | 75 | mimetype = MAILMIME_MECHANISM_8BIT; |
76 | } else if (enc.lower()=="binary") { | 76 | } else if (enc.lower()=="binary") { |
77 | mimetype = MAILMIME_MECHANISM_BINARY; | 77 | mimetype = MAILMIME_MECHANISM_BINARY; |
78 | } | 78 | } |
79 | 79 | ||
80 | int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype, | 80 | int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype, |
81 | &result_text,&target_length); | 81 | &result_text,&target_length); |
82 | 82 | ||
83 | encodedString* result = new encodedString(); | 83 | encodedString* result = new encodedString(); |
84 | if (err == MAILIMF_NO_ERROR) { | 84 | if (err == MAILIMF_NO_ERROR) { |
85 | result->setContent(result_text,target_length); | 85 | result->setContent(result_text,target_length); |
86 | } | 86 | } |
87 | //odebug << "Decode string finished" << oendl; | 87 | //odebug << "Decode string finished" << oendl; |
88 | return result; | 88 | return result; |
89 | } | 89 | } |
90 | 90 | ||
91 | QString AbstractMail::convert_String(const char*text) | 91 | QString AbstractMail::convert_String(const char*text) |
92 | { | 92 | { |
93 | //size_t index = 0; | 93 | //size_t index = 0; |
94 | char*res = 0; | 94 | char*res = 0; |
95 | int err = MAILIMF_NO_ERROR; | 95 | int err = MAILIMF_NO_ERROR; |
96 | 96 | ||
97 | QString result(text); | 97 | QString result(text); |
98 | 98 | ||
99 | /* due a bug in libetpan it isn't usable this moment */ | 99 | /* due a bug in libetpan it isn't usable this moment */ |
100 | /* int err = mailmime_encoded_phrase_parse("iso-8859-1", | 100 | /* int err = mailmime_encoded_phrase_parse("iso-8859-1", |
101 | text, strlen(text),&index, "iso-8859-1",&res);*/ | 101 | text, strlen(text),&index, "iso-8859-1",&res);*/ |
102 | //odebug << "Input: " << text << "" << oendl; | 102 | //odebug << "Input: " << text << "" << oendl; |
103 | if (err == MAILIMF_NO_ERROR && res && strlen(res)) { | 103 | if (err == MAILIMF_NO_ERROR && res && strlen(res)) { |
104 | // result = QString(res); | 104 | // result = QString(res); |
105 | // odebug << "Res: " << res << ", length: " << strlen(res) << "" << oendl; | 105 | // odebug << "Res: " << res << ", length: " << strlen(res) << "" << oendl; |
106 | } | 106 | } |
107 | if (res) free(res); | 107 | if (res) free(res); |
108 | return result; | 108 | return result; |
109 | } | 109 | } |
110 | 110 | ||
111 | /* cp & paste from launcher */ | 111 | /* cp & paste from launcher */ |
112 | QString AbstractMail::gen_attachment_id() | 112 | QString AbstractMail::gen_attachment_id() |
113 | { | 113 | { |
114 | QFile file( "/proc/sys/kernel/random/uuid" ); | 114 | QFile file( "/proc/sys/kernel/random/uuid" ); |
115 | if (!file.open(IO_ReadOnly ) ) | 115 | if (!file.open(IO_ReadOnly ) ) |
116 | return QString::null; | 116 | return QString::null; |
117 | 117 | ||
118 | QTextStream stream(&file); | 118 | QTextStream stream(&file); |
119 | 119 | ||
120 | return "{" + stream.read().stripWhiteSpace() + "}"; | 120 | return "{" + stream.read().stripWhiteSpace() + "}"; |
121 | } | 121 | } |
122 | 122 | ||
123 | int AbstractMail::createMbox(const QString&,const FolderP&,const QString& ,bool) | 123 | int AbstractMail::createMbox(const QString&,const FolderP&,const QString& ,bool) |
124 | { | 124 | { |
125 | return 0; | 125 | return 0; |
126 | } | 126 | } |
127 | 127 | ||
128 | QString AbstractMail::defaultLocalfolder() | 128 | QString AbstractMail::defaultLocalfolder() |
129 | { | 129 | { |
130 | // QString f = getenv( "HOME" ); | 130 | // QString f = getenv( "HOME" ); |
131 | QString f = locateLocal( "data", "kopiemail/localmail"); | 131 | QString f = locateLocal( "data", "kopiemail/localmail"); |
132 | // f += "/Applications/opiemail/localmail"; | 132 | // f += "/Applications/opiemail/localmail"; |
133 | return f; | 133 | return f; |
134 | } | 134 | } |
135 | 135 | ||
136 | QString AbstractMail::draftFolder() | 136 | QString AbstractMail::draftFolder() |
137 | { | 137 | { |
138 | return QString("Drafts"); | 138 | return QString("Drafts"); |
139 | } | 139 | } |
140 | 140 | ||
141 | /* temporary - will be removed when implemented in all classes */ | 141 | /* temporary - will be removed when implemented in all classes */ |
142 | void AbstractMail::deleteMails(const QString &,const QValueList<Opie::Core::OSmartPointer<RecMail> > &) | 142 | void AbstractMail::deleteMails(const QString &,const QValueList<Opie::Core::OSmartPointer<RecMail> > &) |
143 | { | 143 | { |
144 | } | 144 | } |
145 | void AbstractMail::deleteMailList(const QValueList<RecMailP>&target) | 145 | void AbstractMail::deleteMailList(const QValueList<RecMailP>&target) |
146 | { | 146 | { |
147 | //qDebug("AbstractMail::deleteMailList:: Please reimplement! "); | 147 | //qDebug("AbstractMail::deleteMailList:: Please reimplement! "); |
148 | // this is currently re-implemented in pop3wrapper and imapwrapper | 148 | // this is currently re-implemented in pop3wrapper and imapwrapper |
149 | int iii = 0; | 149 | int iii = 0; |
150 | int count = target.count(); | 150 | int count = target.count(); |
151 | QWidget wid; | 151 | QProgressBar wid ( count ); |
152 | wid.setCaption( tr("Deleting ...")); | ||
152 | wid.show(); | 153 | wid.show(); |
153 | while (iii < count ) { | 154 | while (iii < count ) { |
154 | Global::statusMessage(tr("Delete message %1 of %2").arg(iii).arg(count)); | 155 | Global::statusMessage(tr("Delete message %1 of %2").arg(iii).arg(count)); |
156 | wid.setProgress( iii ); | ||
155 | wid.raise(); | 157 | wid.raise(); |
156 | qApp->processEvents(); | 158 | qApp->processEvents(); |
157 | RecMailP mail = (*target.at( iii )); | 159 | RecMailP mail = (*target.at( iii )); |
158 | deleteMail(mail); | 160 | deleteMail(mail); |
159 | ++iii; | 161 | ++iii; |
160 | } | 162 | } |
161 | } | 163 | } |
162 | 164 | ||
163 | void AbstractMail::downloadNewMails(const FolderP&fromFolder, AbstractMail*targetMail ) | 165 | void AbstractMail::downloadNewMails(const FolderP&fromFolder, AbstractMail*targetMail ) |
164 | { | 166 | { |
165 | //qDebug("AbstractMail::downloadNewMails %s ", fromFolder->getName().latin1()); | 167 | //qDebug("AbstractMail::downloadNewMails %s ", fromFolder->getName().latin1()); |
166 | // get local folder | 168 | // get local folder |
167 | Account * acc = getAccount(); | 169 | Account * acc = getAccount(); |
168 | if ( !acc ) return; | 170 | if ( !acc ) return; |
169 | QString lfName = acc->getLocalFolder(); | 171 | QString lfName = acc->getLocalFolder(); |
170 | if ( lfName.isEmpty() ) | 172 | if ( lfName.isEmpty() ) |
171 | lfName = acc->getAccountName(); | 173 | lfName = acc->getAccountName(); |
172 | // create local folder | 174 | // create local folder |
173 | if ( !targetMail->createMbox(lfName)) | 175 | if ( !targetMail->createMbox(lfName)) |
174 | { | 176 | { |
175 | QMessageBox::critical(0,tr("Error creating new Folder"), | 177 | QMessageBox::critical(0,tr("Error creating new Folder"), |
176 | tr("Error while creating new folder\n%1\n\nCancelling action.").arg(lfName)); | 178 | tr("Error while creating new folder\n%1\n\nCancelling action.").arg(lfName)); |
177 | return; | 179 | return; |
178 | } | 180 | } |
179 | QValueList<RecMailP> t; | 181 | QValueList<RecMailP> t; |
180 | listMessages(fromFolder->getName(),t,acc->getMaxMailSize() ); | 182 | listMessages(fromFolder->getName(),t,acc->getMaxMailSize() ); |
181 | if ( t.count() == 0 ) { | 183 | if ( t.count() == 0 ) { |
182 | Global::statusMessage(tr("There are no new messages")); | 184 | Global::statusMessage(tr("There are no new messages")); |
183 | return; | 185 | return; |
184 | } | 186 | } |
185 | QValueList<RecMailP> e; | 187 | QValueList<RecMailP> e; |
186 | targetMail->listMessages(lfName,e,acc->getMaxMailSize() ); | 188 | targetMail->listMessages(lfName,e,acc->getMaxMailSize() ); |
187 | //qDebug("target has mails %d ", e.count()); | 189 | //qDebug("target has mails %d ", e.count()); |
188 | QValueList<RecMailP> n; | 190 | QValueList<RecMailP> n; |
189 | int iii = 0; | 191 | int iii = 0; |
190 | int count = t.count(); | 192 | int count = t.count(); |
191 | while (iii < count ) { | 193 | while (iii < count ) { |
192 | RecMailP r = (*t.at( iii )); | 194 | RecMailP r = (*t.at( iii )); |
193 | bool found = false; | 195 | bool found = false; |
194 | int jjj = 0; | 196 | int jjj = 0; |
195 | int countE = e.count(); | 197 | int countE = e.count(); |
196 | while (jjj < countE ) { | 198 | while (jjj < countE ) { |
197 | RecMailP re = (*e.at( jjj )); | 199 | RecMailP re = (*e.at( jjj )); |
198 | if ( re->isEqual(r) ) { | 200 | if ( re->isEqual(r) ) { |
199 | found = true; | 201 | found = true; |
200 | break; | 202 | break; |
201 | } | 203 | } |
202 | ++jjj; | 204 | ++jjj; |
203 | } | 205 | } |
204 | if ( !found ) { | 206 | if ( !found ) { |
205 | n.append( r ); | 207 | n.append( r ); |
206 | } | 208 | } |
207 | ++iii; | 209 | ++iii; |
208 | } | 210 | } |
209 | if ( n.count() == 0 ) { | 211 | if ( n.count() == 0 ) { |
210 | Global::statusMessage(tr("There are no new messages")); | 212 | Global::statusMessage(tr("There are no new messages")); |
211 | return; | 213 | return; |
212 | } | 214 | } |
213 | mvcpMailList( n,lfName,targetMail,!acc->getLeaveOnServer()); | 215 | mvcpMailList( n,lfName,targetMail,!acc->getLeaveOnServer()); |
214 | Global::statusMessage(tr("Downloaded %1 messages").arg(n.count())); | 216 | Global::statusMessage(tr("Downloaded %1 messages").arg(n.count())); |
215 | 217 | ||
216 | #if 0 | 218 | #if 0 |
217 | QValueList<RecMailP> t; | 219 | QValueList<RecMailP> t; |
218 | listMessages(fromFolder->getName(),t, maxSizeInKb); | 220 | listMessages(fromFolder->getName(),t, maxSizeInKb); |
219 | mvcpMailList( t,targetFolder,targetWrapper,moveit); | 221 | mvcpMailList( t,targetFolder,targetWrapper,moveit); |
220 | #endif | 222 | #endif |
221 | 223 | ||
222 | } | 224 | } |
223 | void AbstractMail::mvcpAllMails(const FolderP&fromFolder, | 225 | void AbstractMail::mvcpAllMails(const FolderP&fromFolder, |
224 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb) | 226 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb) |
225 | { | 227 | { |
226 | QValueList<RecMailP> t; | 228 | QValueList<RecMailP> t; |
227 | listMessages(fromFolder->getName(),t, maxSizeInKb); | 229 | listMessages(fromFolder->getName(),t, maxSizeInKb); |
228 | mvcpMailList( t,targetFolder,targetWrapper,moveit); | 230 | mvcpMailList( t,targetFolder,targetWrapper,moveit); |
229 | 231 | ||
230 | } | 232 | } |
231 | void AbstractMail::mvcpMailList(const QValueList<RecMailP>& t, | 233 | void AbstractMail::mvcpMailList(const QValueList<RecMailP>& t, |
232 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) | 234 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) |
233 | { | 235 | { |
234 | encodedString*st = 0; | 236 | encodedString*st = 0; |
235 | int iii = 0; | 237 | int iii = 0; |
236 | int count = t.count(); | 238 | int count = t.count(); |
237 | if ( count == 0 ) | 239 | if ( count == 0 ) |
238 | return; | 240 | return; |
239 | // wel, processevents is qite strange, we need a widget for getting | 241 | // wel, processevents is qite strange, we need a widget for getting |
240 | // Global::statusMessage(tr("Copy2 message %1").arg(iii)); displayed | 242 | // Global::statusMessage(tr("Copy2 message %1").arg(iii)); displaye |
241 | QWidget wid; | 243 | |
244 | QProgressBar wid ( count ); | ||
245 | wid.setCaption( tr("Copying ...")); | ||
242 | wid.show(); | 246 | wid.show(); |
243 | while (iii < count ) { | 247 | while (iii < count ) { |
244 | Global::statusMessage(tr("Copy message %1 of %2").arg(iii).arg(count)); | 248 | Global::statusMessage(tr("Copy message %1 of %2").arg(iii).arg(count)); |
249 | wid.setProgress( iii ); | ||
245 | wid.raise(); | 250 | wid.raise(); |
246 | qApp->processEvents(); | 251 | qApp->processEvents(); |
247 | RecMailP r = (*t.at( iii )); | 252 | RecMailP r = (*t.at( iii )); |
248 | st = fetchRawBody(r); | 253 | st = fetchRawBody(r); |
249 | if (st) { | 254 | if (st) { |
250 | targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder); | 255 | targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder); |
251 | delete st; | 256 | delete st; |
252 | } | 257 | } |
253 | ++iii; | 258 | ++iii; |
254 | } | 259 | } |
255 | if (moveit) { | 260 | if (moveit) { |
256 | deleteMailList( t ); | 261 | deleteMailList( t ); |
257 | //deleteAllMail(fromFolder); | 262 | //deleteAllMail(fromFolder); |
258 | } | 263 | } |
259 | } | 264 | } |
260 | 265 | ||
261 | void AbstractMail::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) | 266 | void AbstractMail::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) |
262 | { | 267 | { |
263 | encodedString*st = 0; | 268 | encodedString*st = 0; |
264 | st = fetchRawBody(mail); | 269 | st = fetchRawBody(mail); |
265 | if (st) { | 270 | if (st) { |
266 | targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder); | 271 | targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder); |
267 | delete st; | 272 | delete st; |
268 | } | 273 | } |
269 | if (moveit) { | 274 | if (moveit) { |
270 | deleteMail(mail); | 275 | deleteMail(mail); |
271 | } | 276 | } |
272 | } | 277 | } |
diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp index 91332c3..d79df4f 100644 --- a/kmicromail/libmailwrapper/imapwrapper.cpp +++ b/kmicromail/libmailwrapper/imapwrapper.cpp | |||
@@ -1,1307 +1,1310 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | #include <stdlib.h> | 2 | #include <stdlib.h> |
3 | #include <libetpan/libetpan.h> | 3 | #include <libetpan/libetpan.h> |
4 | #include <qpe/global.h> | 4 | #include <qpe/global.h> |
5 | #include <qapplication.h> | 5 | #include <qapplication.h> |
6 | #include "imapwrapper.h" | 6 | #include "imapwrapper.h" |
7 | #include "mailtypes.h" | 7 | #include "mailtypes.h" |
8 | #include "logindialog.h" | 8 | #include "logindialog.h" |
9 | #include <qprogressbar.h> | 9 | #include <qprogressbar.h> |
10 | #include "genericwrapper.h" | 10 | #include "genericwrapper.h" |
11 | 11 | ||
12 | using namespace Opie::Core; | 12 | using namespace Opie::Core; |
13 | int IMAPwrapper::mMax = 0; | 13 | int IMAPwrapper::mMax = 0; |
14 | int IMAPwrapper::mCurrent = 0; | 14 | int IMAPwrapper::mCurrent = 0; |
15 | 15 | ||
16 | IMAPwrapper::IMAPwrapper( IMAPaccount *a ) | 16 | IMAPwrapper::IMAPwrapper( IMAPaccount *a ) |
17 | : AbstractMail() | 17 | : AbstractMail() |
18 | { | 18 | { |
19 | account = a; | 19 | account = a; |
20 | m_imap = 0; | 20 | m_imap = 0; |
21 | m_Lastmbox = ""; | 21 | m_Lastmbox = ""; |
22 | mCurrent = 0; | 22 | mCurrent = 0; |
23 | mMax = 0; | 23 | mMax = 0; |
24 | } | 24 | } |
25 | 25 | ||
26 | IMAPwrapper::~IMAPwrapper() | 26 | IMAPwrapper::~IMAPwrapper() |
27 | { | 27 | { |
28 | logout(); | 28 | logout(); |
29 | } | 29 | } |
30 | 30 | ||
31 | /* to avoid to often select statements in loops etc. | 31 | /* to avoid to often select statements in loops etc. |
32 | we trust that we are logged in and connection is established!*/ | 32 | we trust that we are logged in and connection is established!*/ |
33 | int IMAPwrapper::selectMbox(const QString&mbox) | 33 | int IMAPwrapper::selectMbox(const QString&mbox) |
34 | { | 34 | { |
35 | if (mbox == m_Lastmbox) { | 35 | if (mbox == m_Lastmbox) { |
36 | return MAILIMAP_NO_ERROR; | 36 | return MAILIMAP_NO_ERROR; |
37 | } | 37 | } |
38 | int err = mailimap_select( m_imap, (char*)mbox.latin1()); | 38 | int err = mailimap_select( m_imap, (char*)mbox.latin1()); |
39 | if ( err != MAILIMAP_NO_ERROR ) { | 39 | if ( err != MAILIMAP_NO_ERROR ) { |
40 | m_Lastmbox = ""; | 40 | m_Lastmbox = ""; |
41 | return err; | 41 | return err; |
42 | } | 42 | } |
43 | m_Lastmbox = mbox; | 43 | m_Lastmbox = mbox; |
44 | return err; | 44 | return err; |
45 | } | 45 | } |
46 | 46 | ||
47 | void IMAPwrapper::imap_progress( size_t current, size_t maximum ) | 47 | void IMAPwrapper::imap_progress( size_t current, size_t maximum ) |
48 | { | 48 | { |
49 | //qDebug("imap progress %d of %d ",current,maximum ); | 49 | //qDebug("imap progress %d of %d ",current,maximum ); |
50 | //Global::statusMessage(tr("Downloading message %1 of %2").arg( current).arg(maximum)); | 50 | //Global::statusMessage(tr("Downloading message %1 of %2").arg( current).arg(maximum)); |
51 | //qApp->processEvents() | 51 | //qApp->processEvents() |
52 | static int last = 0; | 52 | static int last = 0; |
53 | if ( last != current ) | 53 | if ( last != current ) |
54 | IMAPwrapper::progress(); | 54 | IMAPwrapper::progress(); |
55 | last = current; | 55 | last = current; |
56 | } | 56 | } |
57 | void IMAPwrapper::progress( QString m ) | 57 | void IMAPwrapper::progress( QString m ) |
58 | { | 58 | { |
59 | 59 | ||
60 | static QString mProgrMess; | 60 | static QString mProgrMess; |
61 | if ( m != QString::null ) { | 61 | if ( m != QString::null ) { |
62 | mProgrMess = m; | 62 | mProgrMess = m; |
63 | mCurrent = 0; | 63 | mCurrent = 0; |
64 | return; | 64 | return; |
65 | } | 65 | } |
66 | QString mess; | 66 | QString mess; |
67 | //qDebug("progress "); | 67 | //qDebug("progress "); |
68 | if ( mMax ) mess = mProgrMess +tr(" message %1 of %2").arg( mCurrent++).arg(mMax); | 68 | if ( mMax ) mess = mProgrMess +tr(" message %1 of %2").arg( mCurrent++).arg(mMax); |
69 | else mess = mProgrMess +tr(" message %1").arg( mCurrent++); | 69 | else mess = mProgrMess +tr(" message %1").arg( mCurrent++); |
70 | Global::statusMessage(mess); | 70 | Global::statusMessage(mess); |
71 | qApp->processEvents(); | 71 | qApp->processEvents(); |
72 | } | 72 | } |
73 | bool IMAPwrapper::start_tls(bool force_tls) | 73 | bool IMAPwrapper::start_tls(bool force_tls) |
74 | { | 74 | { |
75 | int err; | 75 | int err; |
76 | bool try_tls; | 76 | bool try_tls; |
77 | mailimap_capability_data * cap_data = 0; | 77 | mailimap_capability_data * cap_data = 0; |
78 | 78 | ||
79 | err = mailimap_capability(m_imap,&cap_data); | 79 | err = mailimap_capability(m_imap,&cap_data); |
80 | if (err != MAILIMAP_NO_ERROR) { | 80 | if (err != MAILIMAP_NO_ERROR) { |
81 | Global::statusMessage("error getting capabilities!"); | 81 | Global::statusMessage("error getting capabilities!"); |
82 | return false; | 82 | return false; |
83 | } | 83 | } |
84 | clistiter * cur; | 84 | clistiter * cur; |
85 | for(cur = clist_begin(cap_data->cap_list) ; cur != NULL;cur = clist_next(cur)) { | 85 | for(cur = clist_begin(cap_data->cap_list) ; cur != NULL;cur = clist_next(cur)) { |
86 | struct mailimap_capability * cap; | 86 | struct mailimap_capability * cap; |
87 | cap = (struct mailimap_capability *)clist_content(cur); | 87 | cap = (struct mailimap_capability *)clist_content(cur); |
88 | if (cap->cap_type == MAILIMAP_CAPABILITY_NAME) { | 88 | if (cap->cap_type == MAILIMAP_CAPABILITY_NAME) { |
89 | if (strcasecmp(cap->cap_data.cap_name, "STARTTLS") == 0) { | 89 | if (strcasecmp(cap->cap_data.cap_name, "STARTTLS") == 0) { |
90 | try_tls = true; | 90 | try_tls = true; |
91 | break; | 91 | break; |
92 | } | 92 | } |
93 | } | 93 | } |
94 | } | 94 | } |
95 | if (cap_data) { | 95 | if (cap_data) { |
96 | mailimap_capability_data_free(cap_data); | 96 | mailimap_capability_data_free(cap_data); |
97 | } | 97 | } |
98 | if (try_tls) { | 98 | if (try_tls) { |
99 | err = mailimap_starttls(m_imap); | 99 | err = mailimap_starttls(m_imap); |
100 | if (err != MAILIMAP_NO_ERROR && force_tls) { | 100 | if (err != MAILIMAP_NO_ERROR && force_tls) { |
101 | Global::statusMessage(tr("Server has no TLS support!")); | 101 | Global::statusMessage(tr("Server has no TLS support!")); |
102 | try_tls = false; | 102 | try_tls = false; |
103 | } else { | 103 | } else { |
104 | mailstream_low * low; | 104 | mailstream_low * low; |
105 | mailstream_low * new_low; | 105 | mailstream_low * new_low; |
106 | low = mailstream_get_low(m_imap->imap_stream); | 106 | low = mailstream_get_low(m_imap->imap_stream); |
107 | if (!low) { | 107 | if (!low) { |
108 | try_tls = false; | 108 | try_tls = false; |
109 | } else { | 109 | } else { |
110 | int fd = mailstream_low_get_fd(low); | 110 | int fd = mailstream_low_get_fd(low); |
111 | if (fd > -1 && (new_low = mailstream_low_ssl_open(fd))!=0) { | 111 | if (fd > -1 && (new_low = mailstream_low_ssl_open(fd))!=0) { |
112 | mailstream_low_free(low); | 112 | mailstream_low_free(low); |
113 | mailstream_set_low(m_imap->imap_stream, new_low); | 113 | mailstream_set_low(m_imap->imap_stream, new_low); |
114 | } else { | 114 | } else { |
115 | try_tls = false; | 115 | try_tls = false; |
116 | } | 116 | } |
117 | } | 117 | } |
118 | } | 118 | } |
119 | } | 119 | } |
120 | return try_tls; | 120 | return try_tls; |
121 | } | 121 | } |
122 | 122 | ||
123 | void IMAPwrapper::login() | 123 | void IMAPwrapper::login() |
124 | { | 124 | { |
125 | QString server, user, pass; | 125 | QString server, user, pass; |
126 | uint16_t port; | 126 | uint16_t port; |
127 | int err = MAILIMAP_NO_ERROR; | 127 | int err = MAILIMAP_NO_ERROR; |
128 | 128 | ||
129 | if (account->getOffline()) return; | 129 | if (account->getOffline()) return; |
130 | /* we are connected this moment */ | 130 | /* we are connected this moment */ |
131 | /* TODO: setup a timer holding the line or if connection closed - delete the value */ | 131 | /* TODO: setup a timer holding the line or if connection closed - delete the value */ |
132 | if (m_imap) { | 132 | if (m_imap) { |
133 | err = mailimap_noop(m_imap); | 133 | err = mailimap_noop(m_imap); |
134 | if (err!=MAILIMAP_NO_ERROR) { | 134 | if (err!=MAILIMAP_NO_ERROR) { |
135 | logout(); | 135 | logout(); |
136 | } else { | 136 | } else { |
137 | mailstream_flush(m_imap->imap_stream); | 137 | mailstream_flush(m_imap->imap_stream); |
138 | return; | 138 | return; |
139 | } | 139 | } |
140 | } | 140 | } |
141 | server = account->getServer(); | 141 | server = account->getServer(); |
142 | port = account->getPort().toUInt(); | 142 | port = account->getPort().toUInt(); |
143 | if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { | 143 | if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { |
144 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); | 144 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); |
145 | login.show(); | 145 | login.show(); |
146 | if ( QDialog::Accepted == login.exec() ) { | 146 | if ( QDialog::Accepted == login.exec() ) { |
147 | // ok | 147 | // ok |
148 | user = login.getUser(); | 148 | user = login.getUser(); |
149 | pass = login.getPassword(); | 149 | pass = login.getPassword(); |
150 | } else { | 150 | } else { |
151 | // cancel | 151 | // cancel |
152 | return; | 152 | return; |
153 | } | 153 | } |
154 | } else { | 154 | } else { |
155 | user = account->getUser(); | 155 | user = account->getUser(); |
156 | pass = account->getPassword(); | 156 | pass = account->getPassword(); |
157 | } | 157 | } |
158 | 158 | ||
159 | m_imap = mailimap_new( 20, &imap_progress ); | 159 | m_imap = mailimap_new( 20, &imap_progress ); |
160 | 160 | ||
161 | /* connect */ | 161 | /* connect */ |
162 | bool ssl = false; | 162 | bool ssl = false; |
163 | bool try_tls = false; | 163 | bool try_tls = false; |
164 | bool force_tls = false; | 164 | bool force_tls = false; |
165 | 165 | ||
166 | if ( account->ConnectionType() == 2 ) { | 166 | if ( account->ConnectionType() == 2 ) { |
167 | ssl = true; | 167 | ssl = true; |
168 | } | 168 | } |
169 | if (account->ConnectionType()==1) { | 169 | if (account->ConnectionType()==1) { |
170 | force_tls = true; | 170 | force_tls = true; |
171 | } | 171 | } |
172 | 172 | ||
173 | if ( ssl ) { | 173 | if ( ssl ) { |
174 | //qDebug("using ssl "); | 174 | //qDebug("using ssl "); |
175 | err = mailimap_ssl_connect( m_imap, (char*)server.latin1(), port ); | 175 | err = mailimap_ssl_connect( m_imap, (char*)server.latin1(), port ); |
176 | } else { | 176 | } else { |
177 | err = mailimap_socket_connect( m_imap, (char*)server.latin1(), port ); | 177 | err = mailimap_socket_connect( m_imap, (char*)server.latin1(), port ); |
178 | } | 178 | } |
179 | 179 | ||
180 | if ( err != MAILIMAP_NO_ERROR && | 180 | if ( err != MAILIMAP_NO_ERROR && |
181 | err != MAILIMAP_NO_ERROR_AUTHENTICATED && | 181 | err != MAILIMAP_NO_ERROR_AUTHENTICATED && |
182 | err != MAILIMAP_NO_ERROR_NON_AUTHENTICATED ) { | 182 | err != MAILIMAP_NO_ERROR_NON_AUTHENTICATED ) { |
183 | QString failure = ""; | 183 | QString failure = ""; |
184 | if (err == MAILIMAP_ERROR_CONNECTION_REFUSED) { | 184 | if (err == MAILIMAP_ERROR_CONNECTION_REFUSED) { |
185 | failure="Connection refused"; | 185 | failure="Connection refused"; |
186 | } else { | 186 | } else { |
187 | failure="Unknown failure"; | 187 | failure="Unknown failure"; |
188 | } | 188 | } |
189 | Global::statusMessage(tr("error connecting imap server: %1").arg(failure)); | 189 | Global::statusMessage(tr("error connecting imap server: %1").arg(failure)); |
190 | mailimap_free( m_imap ); | 190 | mailimap_free( m_imap ); |
191 | m_imap = 0; | 191 | m_imap = 0; |
192 | return; | 192 | return; |
193 | } | 193 | } |
194 | 194 | ||
195 | if (!ssl) { | 195 | if (!ssl) { |
196 | try_tls = start_tls(force_tls); | 196 | try_tls = start_tls(force_tls); |
197 | } | 197 | } |
198 | 198 | ||
199 | bool ok = true; | 199 | bool ok = true; |
200 | if (force_tls && !try_tls) { | 200 | if (force_tls && !try_tls) { |
201 | Global::statusMessage(tr("Server has no TLS support!")); | 201 | Global::statusMessage(tr("Server has no TLS support!")); |
202 | ok = false; | 202 | ok = false; |
203 | } | 203 | } |
204 | 204 | ||
205 | 205 | ||
206 | /* login */ | 206 | /* login */ |
207 | 207 | ||
208 | if (ok) { | 208 | if (ok) { |
209 | err = mailimap_login_simple( m_imap, (char*)user.latin1(), (char*)pass.latin1() ); | 209 | err = mailimap_login_simple( m_imap, (char*)user.latin1(), (char*)pass.latin1() ); |
210 | if ( err != MAILIMAP_NO_ERROR ) { | 210 | if ( err != MAILIMAP_NO_ERROR ) { |
211 | Global::statusMessage(tr("error logging in imap server: %1").arg(m_imap->imap_response)); | 211 | Global::statusMessage(tr("error logging in imap server: %1").arg(m_imap->imap_response)); |
212 | ok = false; | 212 | ok = false; |
213 | } | 213 | } |
214 | } | 214 | } |
215 | if (!ok) { | 215 | if (!ok) { |
216 | err = mailimap_close( m_imap ); | 216 | err = mailimap_close( m_imap ); |
217 | mailimap_free( m_imap ); | 217 | mailimap_free( m_imap ); |
218 | m_imap = 0; | 218 | m_imap = 0; |
219 | } | 219 | } |
220 | } | 220 | } |
221 | 221 | ||
222 | void IMAPwrapper::logout() | 222 | void IMAPwrapper::logout() |
223 | { | 223 | { |
224 | int err = MAILIMAP_NO_ERROR; | 224 | int err = MAILIMAP_NO_ERROR; |
225 | if (!m_imap) return; | 225 | if (!m_imap) return; |
226 | err = mailimap_logout( m_imap ); | 226 | err = mailimap_logout( m_imap ); |
227 | err = mailimap_close( m_imap ); | 227 | err = mailimap_close( m_imap ); |
228 | mailimap_free( m_imap ); | 228 | mailimap_free( m_imap ); |
229 | m_imap = 0; | 229 | m_imap = 0; |
230 | m_Lastmbox = ""; | 230 | m_Lastmbox = ""; |
231 | } | 231 | } |
232 | 232 | ||
233 | void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSmartPointer<RecMail> > &target , int maxSizeInKb) | 233 | void IMAPwrapper::listMessages(const QString&mailbox,QValueList<Opie::Core::OSmartPointer<RecMail> > &target , int maxSizeInKb) |
234 | { | 234 | { |
235 | int err = MAILIMAP_NO_ERROR; | 235 | int err = MAILIMAP_NO_ERROR; |
236 | clist *result = 0; | 236 | clist *result = 0; |
237 | clistcell *current; | 237 | clistcell *current; |
238 | mailimap_fetch_type *fetchType = 0; | 238 | mailimap_fetch_type *fetchType = 0; |
239 | mailimap_set *set = 0; | 239 | mailimap_set *set = 0; |
240 | 240 | ||
241 | login(); | 241 | login(); |
242 | if (!m_imap) { | 242 | if (!m_imap) { |
243 | return; | 243 | return; |
244 | } | 244 | } |
245 | /* select mailbox READONLY for operations */ | 245 | /* select mailbox READONLY for operations */ |
246 | err = selectMbox(mailbox); | 246 | err = selectMbox(mailbox); |
247 | if ( err != MAILIMAP_NO_ERROR ) { | 247 | if ( err != MAILIMAP_NO_ERROR ) { |
248 | return; | 248 | return; |
249 | } | 249 | } |
250 | 250 | ||
251 | int last = m_imap->imap_selection_info->sel_exists; | 251 | int last = m_imap->imap_selection_info->sel_exists; |
252 | 252 | ||
253 | if (last == 0) { | 253 | if (last == 0) { |
254 | Global::statusMessage(tr("Mailbox has no mails")); | 254 | Global::statusMessage(tr("Mailbox has no mails")); |
255 | return; | 255 | return; |
256 | } else { | 256 | } else { |
257 | } | 257 | } |
258 | 258 | ||
259 | Global::statusMessage(tr("Fetching header list")); | 259 | Global::statusMessage(tr("Fetching header list")); |
260 | qApp->processEvents(); | 260 | qApp->processEvents(); |
261 | /* the range has to start at 1!!! not with 0!!!! */ | 261 | /* the range has to start at 1!!! not with 0!!!! */ |
262 | set = mailimap_set_new_interval( 1, last ); | 262 | set = mailimap_set_new_interval( 1, last ); |
263 | fetchType = mailimap_fetch_type_new_fetch_att_list_empty(); | 263 | fetchType = mailimap_fetch_type_new_fetch_att_list_empty(); |
264 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_envelope()); | 264 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_envelope()); |
265 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_flags()); | 265 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_flags()); |
266 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_internaldate()); | 266 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_internaldate()); |
267 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_rfc822_size()); | 267 | mailimap_fetch_type_new_fetch_att_list_add(fetchType,mailimap_fetch_att_new_rfc822_size()); |
268 | 268 | ||
269 | err = mailimap_fetch( m_imap, set, fetchType, &result ); | 269 | err = mailimap_fetch( m_imap, set, fetchType, &result ); |
270 | mailimap_set_free( set ); | 270 | mailimap_set_free( set ); |
271 | mailimap_fetch_type_free( fetchType ); | 271 | mailimap_fetch_type_free( fetchType ); |
272 | 272 | ||
273 | QString date,subject,from; | 273 | QString date,subject,from; |
274 | 274 | ||
275 | if ( err == MAILIMAP_NO_ERROR ) { | 275 | if ( err == MAILIMAP_NO_ERROR ) { |
276 | mailimap_msg_att * msg_att; | 276 | mailimap_msg_att * msg_att; |
277 | int i = 0; | 277 | int i = 0; |
278 | for (current = clist_begin(result); current != 0; current=clist_next(current)) { | 278 | for (current = clist_begin(result); current != 0; current=clist_next(current)) { |
279 | ++i; | 279 | ++i; |
280 | msg_att = (mailimap_msg_att*)current->data; | 280 | msg_att = (mailimap_msg_att*)current->data; |
281 | RecMail*m = parse_list_result(msg_att); | 281 | RecMail*m = parse_list_result(msg_att); |
282 | if (m) { | 282 | if (m) { |
283 | if ( maxSizeInKb == 0 || m->Msgsize()<=maxSizeInKb*1024 ) { | 283 | if ( maxSizeInKb == 0 || m->Msgsize()<=maxSizeInKb*1024 ) { |
284 | m->setNumber(i); | 284 | m->setNumber(i); |
285 | m->setMbox(mailbox); | 285 | m->setMbox(mailbox); |
286 | m->setWrapper(this); | 286 | m->setWrapper(this); |
287 | target.append(m); | 287 | target.append(m); |
288 | } | 288 | } |
289 | } | 289 | } |
290 | } | 290 | } |
291 | Global::statusMessage(tr("Mailbox has %1 mails").arg(target.count())); | 291 | Global::statusMessage(tr("Mailbox has %1 mails").arg(target.count())); |
292 | } else { | 292 | } else { |
293 | Global::statusMessage(tr("Error fetching headers: %1").arg(m_imap->imap_response)); | 293 | Global::statusMessage(tr("Error fetching headers: %1").arg(m_imap->imap_response)); |
294 | } | 294 | } |
295 | if (result) mailimap_fetch_list_free(result); | 295 | if (result) mailimap_fetch_list_free(result); |
296 | } | 296 | } |
297 | 297 | ||
298 | QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders() | 298 | QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders() |
299 | { | 299 | { |
300 | const char *path, *mask; | 300 | const char *path, *mask; |
301 | int err = MAILIMAP_NO_ERROR; | 301 | int err = MAILIMAP_NO_ERROR; |
302 | clist *result = 0; | 302 | clist *result = 0; |
303 | clistcell *current = 0; | 303 | clistcell *current = 0; |
304 | clistcell*cur_flag = 0; | 304 | clistcell*cur_flag = 0; |
305 | mailimap_mbx_list_flags*bflags = 0; | 305 | mailimap_mbx_list_flags*bflags = 0; |
306 | 306 | ||
307 | QValueList<FolderP>* folders = new QValueList<FolderP>(); | 307 | QValueList<FolderP>* folders = new QValueList<FolderP>(); |
308 | login(); | 308 | login(); |
309 | if (!m_imap) { | 309 | if (!m_imap) { |
310 | return folders; | 310 | return folders; |
311 | } | 311 | } |
312 | 312 | ||
313 | /* | 313 | /* |
314 | * First we have to check for INBOX 'cause it sometimes it's not inside the path. | 314 | * First we have to check for INBOX 'cause it sometimes it's not inside the path. |
315 | * We must not forget to filter them out in next loop! | 315 | * We must not forget to filter them out in next loop! |
316 | * it seems like ugly code. and yes - it is ugly code. but the best way. | 316 | * it seems like ugly code. and yes - it is ugly code. but the best way. |
317 | */ | 317 | */ |
318 | Global::statusMessage(tr("Fetching folder list")); | 318 | Global::statusMessage(tr("Fetching folder list")); |
319 | qApp->processEvents(); | 319 | qApp->processEvents(); |
320 | QString temp; | 320 | QString temp; |
321 | mask = "INBOX" ; | 321 | mask = "INBOX" ; |
322 | mailimap_mailbox_list *list; | 322 | mailimap_mailbox_list *list; |
323 | err = mailimap_list( m_imap, (char*)"", (char*)mask, &result ); | 323 | err = mailimap_list( m_imap, (char*)"", (char*)mask, &result ); |
324 | QString del; | 324 | QString del; |
325 | bool selectable = true; | 325 | bool selectable = true; |
326 | bool no_inferiors = false; | 326 | bool no_inferiors = false; |
327 | if ( err == MAILIMAP_NO_ERROR ) { | 327 | if ( err == MAILIMAP_NO_ERROR ) { |
328 | current = result->first; | 328 | current = result->first; |
329 | for ( int i = result->count; i > 0; i-- ) { | 329 | for ( int i = result->count; i > 0; i-- ) { |
330 | list = (mailimap_mailbox_list *) current->data; | 330 | list = (mailimap_mailbox_list *) current->data; |
331 | // it is better use the deep copy mechanism of qt itself | 331 | // it is better use the deep copy mechanism of qt itself |
332 | // instead of using strdup! | 332 | // instead of using strdup! |
333 | temp = list->mb_name; | 333 | temp = list->mb_name; |
334 | del = list->mb_delimiter; | 334 | del = list->mb_delimiter; |
335 | current = current->next; | 335 | current = current->next; |
336 | if ( (bflags = list->mb_flag) ) { | 336 | if ( (bflags = list->mb_flag) ) { |
337 | selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&& | 337 | selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&& |
338 | bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT); | 338 | bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT); |
339 | for(cur_flag=clist_begin(bflags->mbf_oflags);cur_flag;cur_flag=clist_next(cur_flag)) { | 339 | for(cur_flag=clist_begin(bflags->mbf_oflags);cur_flag;cur_flag=clist_next(cur_flag)) { |
340 | if ( ((mailimap_mbx_list_oflag*)cur_flag->data)->of_type==MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS) { | 340 | if ( ((mailimap_mbx_list_oflag*)cur_flag->data)->of_type==MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS) { |
341 | no_inferiors = true; | 341 | no_inferiors = true; |
342 | } | 342 | } |
343 | } | 343 | } |
344 | } | 344 | } |
345 | folders->append( new IMAPFolder(temp,del,selectable,no_inferiors,account->getPrefix())); | 345 | folders->append( new IMAPFolder(temp,del,selectable,no_inferiors,account->getPrefix())); |
346 | } | 346 | } |
347 | } else { | 347 | } else { |
348 | qDebug("error fetching folders: "); | 348 | qDebug("error fetching folders: "); |
349 | 349 | ||
350 | } | 350 | } |
351 | mailimap_list_result_free( result ); | 351 | mailimap_list_result_free( result ); |
352 | 352 | ||
353 | /* | 353 | /* |
354 | * second stage - get the other then inbox folders | 354 | * second stage - get the other then inbox folders |
355 | */ | 355 | */ |
356 | mask = "*" ; | 356 | mask = "*" ; |
357 | path = account->getPrefix().latin1(); | 357 | path = account->getPrefix().latin1(); |
358 | if (!path) path = ""; | 358 | if (!path) path = ""; |
359 | err = mailimap_list( m_imap, (char*)path, (char*)mask, &result ); | 359 | err = mailimap_list( m_imap, (char*)path, (char*)mask, &result ); |
360 | if ( err == MAILIMAP_NO_ERROR ) { | 360 | if ( err == MAILIMAP_NO_ERROR ) { |
361 | current = result->first; | 361 | current = result->first; |
362 | for ( current=clist_begin(result);current!=NULL;current=clist_next(current)) { | 362 | for ( current=clist_begin(result);current!=NULL;current=clist_next(current)) { |
363 | no_inferiors = false; | 363 | no_inferiors = false; |
364 | list = (mailimap_mailbox_list *) current->data; | 364 | list = (mailimap_mailbox_list *) current->data; |
365 | // it is better use the deep copy mechanism of qt itself | 365 | // it is better use the deep copy mechanism of qt itself |
366 | // instead of using strdup! | 366 | // instead of using strdup! |
367 | temp = list->mb_name; | 367 | temp = list->mb_name; |
368 | if (temp.lower()=="inbox") | 368 | if (temp.lower()=="inbox") |
369 | continue; | 369 | continue; |
370 | if (temp.lower()==account->getPrefix().lower()) | 370 | if (temp.lower()==account->getPrefix().lower()) |
371 | continue; | 371 | continue; |
372 | if ( (bflags = list->mb_flag) ) { | 372 | if ( (bflags = list->mb_flag) ) { |
373 | selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&& | 373 | selectable = !(bflags->mbf_type==MAILIMAP_MBX_LIST_FLAGS_SFLAG&& |
374 | bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT); | 374 | bflags->mbf_sflag==MAILIMAP_MBX_LIST_SFLAG_NOSELECT); |
375 | for(cur_flag=clist_begin(bflags->mbf_oflags);cur_flag;cur_flag=clist_next(cur_flag)) { | 375 | for(cur_flag=clist_begin(bflags->mbf_oflags);cur_flag;cur_flag=clist_next(cur_flag)) { |
376 | if ( ((mailimap_mbx_list_oflag*)cur_flag->data)->of_type==MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS) { | 376 | if ( ((mailimap_mbx_list_oflag*)cur_flag->data)->of_type==MAILIMAP_MBX_LIST_OFLAG_NOINFERIORS) { |
377 | no_inferiors = true; | 377 | no_inferiors = true; |
378 | } | 378 | } |
379 | } | 379 | } |
380 | } | 380 | } |
381 | del = list->mb_delimiter; | 381 | del = list->mb_delimiter; |
382 | folders->append(new IMAPFolder(temp,del,selectable,no_inferiors,account->getPrefix())); | 382 | folders->append(new IMAPFolder(temp,del,selectable,no_inferiors,account->getPrefix())); |
383 | } | 383 | } |
384 | } else { | 384 | } else { |
385 | qDebug("error fetching folders "); | 385 | qDebug("error fetching folders "); |
386 | 386 | ||
387 | } | 387 | } |
388 | if (result) mailimap_list_result_free( result ); | 388 | if (result) mailimap_list_result_free( result ); |
389 | return folders; | 389 | return folders; |
390 | } | 390 | } |
391 | 391 | ||
392 | RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | 392 | RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) |
393 | { | 393 | { |
394 | RecMail * m = 0; | 394 | RecMail * m = 0; |
395 | mailimap_msg_att_item *item=0; | 395 | mailimap_msg_att_item *item=0; |
396 | clistcell *current,*c,*cf; | 396 | clistcell *current,*c,*cf; |
397 | mailimap_msg_att_dynamic*flist; | 397 | mailimap_msg_att_dynamic*flist; |
398 | mailimap_flag_fetch*cflag; | 398 | mailimap_flag_fetch*cflag; |
399 | int size; | 399 | int size; |
400 | QBitArray mFlags(7); | 400 | QBitArray mFlags(7); |
401 | QStringList addresslist; | 401 | QStringList addresslist; |
402 | 402 | ||
403 | if (!m_att) { | 403 | if (!m_att) { |
404 | return m; | 404 | return m; |
405 | } | 405 | } |
406 | m = new RecMail(); | 406 | m = new RecMail(); |
407 | for (c = clist_begin(m_att->att_list); c!=NULL;c=clist_next(c) ) { | 407 | for (c = clist_begin(m_att->att_list); c!=NULL;c=clist_next(c) ) { |
408 | current = c; | 408 | current = c; |
409 | size = 0; | 409 | size = 0; |
410 | item = (mailimap_msg_att_item*)current->data; | 410 | item = (mailimap_msg_att_item*)current->data; |
411 | if ( !item ) | 411 | if ( !item ) |
412 | continue; | 412 | continue; |
413 | if (item->att_type!=MAILIMAP_MSG_ATT_ITEM_STATIC) { | 413 | if (item->att_type!=MAILIMAP_MSG_ATT_ITEM_STATIC) { |
414 | flist = (mailimap_msg_att_dynamic*)item->att_data.att_dyn; | 414 | flist = (mailimap_msg_att_dynamic*)item->att_data.att_dyn; |
415 | if (!flist || !flist->att_list) { | 415 | if (!flist || !flist->att_list) { |
416 | continue; | 416 | continue; |
417 | } | 417 | } |
418 | cf = flist->att_list->first; | 418 | cf = flist->att_list->first; |
419 | if( ! cf ) | 419 | if( ! cf ) |
420 | for (cf = clist_begin(flist->att_list); cf!=NULL; cf = clist_next(cf)) { | 420 | for (cf = clist_begin(flist->att_list); cf!=NULL; cf = clist_next(cf)) { |
421 | cflag = (mailimap_flag_fetch*)cf->data; | 421 | cflag = (mailimap_flag_fetch*)cf->data; |
422 | if( ! cflag ) | 422 | if( ! cflag ) |
423 | qDebug("imap:not cflag "); | 423 | qDebug("imap:not cflag "); |
424 | if (cflag->fl_type==MAILIMAP_FLAG_FETCH_OTHER && cflag->fl_flag!=0) { | 424 | if (cflag->fl_type==MAILIMAP_FLAG_FETCH_OTHER && cflag->fl_flag!=0) { |
425 | switch (cflag->fl_flag->fl_type) { | 425 | switch (cflag->fl_flag->fl_type) { |
426 | case MAILIMAP_FLAG_ANSWERED: /* \Answered flag */ | 426 | case MAILIMAP_FLAG_ANSWERED: /* \Answered flag */ |
427 | mFlags.setBit(FLAG_ANSWERED); | 427 | mFlags.setBit(FLAG_ANSWERED); |
428 | break; | 428 | break; |
429 | case MAILIMAP_FLAG_FLAGGED: /* \Flagged flag */ | 429 | case MAILIMAP_FLAG_FLAGGED: /* \Flagged flag */ |
430 | mFlags.setBit(FLAG_FLAGGED); | 430 | mFlags.setBit(FLAG_FLAGGED); |
431 | break; | 431 | break; |
432 | case MAILIMAP_FLAG_DELETED: /* \Deleted flag */ | 432 | case MAILIMAP_FLAG_DELETED: /* \Deleted flag */ |
433 | mFlags.setBit(FLAG_DELETED); | 433 | mFlags.setBit(FLAG_DELETED); |
434 | break; | 434 | break; |
435 | case MAILIMAP_FLAG_SEEN: /* \Seen flag */ | 435 | case MAILIMAP_FLAG_SEEN: /* \Seen flag */ |
436 | mFlags.setBit(FLAG_SEEN); | 436 | mFlags.setBit(FLAG_SEEN); |
437 | break; | 437 | break; |
438 | case MAILIMAP_FLAG_DRAFT: /* \Draft flag */ | 438 | case MAILIMAP_FLAG_DRAFT: /* \Draft flag */ |
439 | mFlags.setBit(FLAG_DRAFT); | 439 | mFlags.setBit(FLAG_DRAFT); |
440 | break; | 440 | break; |
441 | case MAILIMAP_FLAG_KEYWORD: /* keyword flag */ | 441 | case MAILIMAP_FLAG_KEYWORD: /* keyword flag */ |
442 | break; | 442 | break; |
443 | case MAILIMAP_FLAG_EXTENSION: /* \extension flag */ | 443 | case MAILIMAP_FLAG_EXTENSION: /* \extension flag */ |
444 | break; | 444 | break; |
445 | default: | 445 | default: |
446 | break; | 446 | break; |
447 | } | 447 | } |
448 | } else if (cflag->fl_type==MAILIMAP_FLAG_FETCH_RECENT) { | 448 | } else if (cflag->fl_type==MAILIMAP_FLAG_FETCH_RECENT) { |
449 | mFlags.setBit(FLAG_RECENT); | 449 | mFlags.setBit(FLAG_RECENT); |
450 | } | 450 | } |
451 | } | 451 | } |
452 | continue; | 452 | continue; |
453 | } | 453 | } |
454 | if ( item->att_data.att_static == NULL ) | 454 | if ( item->att_data.att_static == NULL ) |
455 | continue; | 455 | continue; |
456 | if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) { | 456 | if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) { |
457 | mailimap_envelope * head = item->att_data.att_static->att_data.att_env; | 457 | mailimap_envelope * head = item->att_data.att_static->att_data.att_env; |
458 | if ( head == NULL ) | 458 | if ( head == NULL ) |
459 | continue; | 459 | continue; |
460 | if ( head->env_date != NULL ) { | 460 | if ( head->env_date != NULL ) { |
461 | m->setDate(head->env_date); | 461 | m->setDate(head->env_date); |
462 | struct mailimf_date_time result; | 462 | struct mailimf_date_time result; |
463 | struct mailimf_date_time* date = &result; | 463 | struct mailimf_date_time* date = &result; |
464 | struct mailimf_date_time **re = &date; | 464 | struct mailimf_date_time **re = &date; |
465 | size_t length = m->getDate().length(); | 465 | size_t length = m->getDate().length(); |
466 | size_t index = 0; | 466 | size_t index = 0; |
467 | if ( mailimf_date_time_parse(head->env_date, length,&index, re ) == MAILIMF_NO_ERROR ) { | 467 | if ( mailimf_date_time_parse(head->env_date, length,&index, re ) == MAILIMF_NO_ERROR ) { |
468 | m->setDate( Genericwrapper::parseDateTime( date ) ); | 468 | m->setDate( Genericwrapper::parseDateTime( date ) ); |
469 | char tmp[23]; | 469 | char tmp[23]; |
470 | snprintf( tmp, 23, "%04i-%02i-%02i %02i:%02i:%02i %05i", | 470 | snprintf( tmp, 23, "%04i-%02i-%02i %02i:%02i:%02i %05i", |
471 | date->dt_year,date->dt_month, date->dt_day, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); | 471 | date->dt_year,date->dt_month, date->dt_day, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); |
472 | m->setIsoDate( QString( tmp ) ); | 472 | m->setIsoDate( QString( tmp ) ); |
473 | } else { | 473 | } else { |
474 | m->setIsoDate(head->env_date); | 474 | m->setIsoDate(head->env_date); |
475 | } | 475 | } |
476 | } | 476 | } |
477 | if ( head->env_subject != NULL ) | 477 | if ( head->env_subject != NULL ) |
478 | m->setSubject(convert_String((const char*)head->env_subject)); | 478 | m->setSubject(convert_String((const char*)head->env_subject)); |
479 | //m->setSubject(head->env_subject); | 479 | //m->setSubject(head->env_subject); |
480 | if (head->env_from!=NULL) { | 480 | if (head->env_from!=NULL) { |
481 | addresslist = address_list_to_stringlist(head->env_from->frm_list); | 481 | addresslist = address_list_to_stringlist(head->env_from->frm_list); |
482 | if (addresslist.count()) { | 482 | if (addresslist.count()) { |
483 | m->setFrom(addresslist.first()); | 483 | m->setFrom(addresslist.first()); |
484 | } | 484 | } |
485 | } | 485 | } |
486 | if (head->env_to!=NULL) { | 486 | if (head->env_to!=NULL) { |
487 | addresslist = address_list_to_stringlist(head->env_to->to_list); | 487 | addresslist = address_list_to_stringlist(head->env_to->to_list); |
488 | m->setTo(addresslist); | 488 | m->setTo(addresslist); |
489 | } | 489 | } |
490 | if (head->env_cc!=NULL) { | 490 | if (head->env_cc!=NULL) { |
491 | addresslist = address_list_to_stringlist(head->env_cc->cc_list); | 491 | addresslist = address_list_to_stringlist(head->env_cc->cc_list); |
492 | m->setCC(addresslist); | 492 | m->setCC(addresslist); |
493 | } | 493 | } |
494 | if (head->env_bcc!=NULL) { | 494 | if (head->env_bcc!=NULL) { |
495 | addresslist = address_list_to_stringlist(head->env_bcc->bcc_list); | 495 | addresslist = address_list_to_stringlist(head->env_bcc->bcc_list); |
496 | m->setBcc(addresslist); | 496 | m->setBcc(addresslist); |
497 | } | 497 | } |
498 | /* reply to address, eg. email. */ | 498 | /* reply to address, eg. email. */ |
499 | if (head->env_reply_to!=NULL) { | 499 | if (head->env_reply_to!=NULL) { |
500 | addresslist = address_list_to_stringlist(head->env_reply_to->rt_list); | 500 | addresslist = address_list_to_stringlist(head->env_reply_to->rt_list); |
501 | if (addresslist.count()) { | 501 | if (addresslist.count()) { |
502 | m->setReplyto(addresslist.first()); | 502 | m->setReplyto(addresslist.first()); |
503 | } | 503 | } |
504 | } | 504 | } |
505 | if (head->env_in_reply_to!=NULL) { | 505 | if (head->env_in_reply_to!=NULL) { |
506 | QString h(head->env_in_reply_to); | 506 | QString h(head->env_in_reply_to); |
507 | while (h.length()>0 && h[0]=='<') { | 507 | while (h.length()>0 && h[0]=='<') { |
508 | h.remove(0,1); | 508 | h.remove(0,1); |
509 | } | 509 | } |
510 | while (h.length()>0 && h[h.length()-1]=='>') { | 510 | while (h.length()>0 && h[h.length()-1]=='>') { |
511 | h.remove(h.length()-1,1); | 511 | h.remove(h.length()-1,1); |
512 | } | 512 | } |
513 | if (h.length()>0) { | 513 | if (h.length()>0) { |
514 | m->setInreply(QStringList(h)); | 514 | m->setInreply(QStringList(h)); |
515 | } | 515 | } |
516 | } | 516 | } |
517 | if (head->env_message_id != NULL) { | 517 | if (head->env_message_id != NULL) { |
518 | m->setMsgid(QString(head->env_message_id)); | 518 | m->setMsgid(QString(head->env_message_id)); |
519 | } | 519 | } |
520 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_INTERNALDATE) { | 520 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_INTERNALDATE) { |
521 | #if 0 | 521 | #if 0 |
522 | mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date; | 522 | mailimap_date_time*d = item->att_data.att_static->att_data.att_internal_date; |
523 | QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec)); | 523 | QDateTime da(QDate(d->dt_year,d->dt_month,d->dt_day),QTime(d->dt_hour,d->dt_min,d->dt_sec)); |
524 | qDebug("time %s ",da.toString().latin1() ); | 524 | qDebug("time %s ",da.toString().latin1() ); |
525 | #endif | 525 | #endif |
526 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_RFC822_SIZE) { | 526 | } else if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_RFC822_SIZE) { |
527 | size = item->att_data.att_static->att_data.att_rfc822_size; | 527 | size = item->att_data.att_static->att_data.att_rfc822_size; |
528 | } | 528 | } |
529 | } | 529 | } |
530 | /* msg is already deleted */ | 530 | /* msg is already deleted */ |
531 | if (mFlags.testBit(FLAG_DELETED) && m) { | 531 | if (mFlags.testBit(FLAG_DELETED) && m) { |
532 | delete m; | 532 | delete m; |
533 | m = 0; | 533 | m = 0; |
534 | } | 534 | } |
535 | if (m) { | 535 | if (m) { |
536 | m->setFlags(mFlags); | 536 | m->setFlags(mFlags); |
537 | m->setMsgsize(size); | 537 | m->setMsgsize(size); |
538 | } | 538 | } |
539 | return m; | 539 | return m; |
540 | } | 540 | } |
541 | 541 | ||
542 | RecBodyP IMAPwrapper::fetchBody(const RecMailP&mail) | 542 | RecBodyP IMAPwrapper::fetchBody(const RecMailP&mail) |
543 | { | 543 | { |
544 | RecBodyP body = new RecBody(); | 544 | RecBodyP body = new RecBody(); |
545 | const char *mb; | 545 | const char *mb; |
546 | int err = MAILIMAP_NO_ERROR; | 546 | int err = MAILIMAP_NO_ERROR; |
547 | clist *result = 0; | 547 | clist *result = 0; |
548 | clistcell *current; | 548 | clistcell *current; |
549 | mailimap_fetch_att *fetchAtt = 0; | 549 | mailimap_fetch_att *fetchAtt = 0; |
550 | mailimap_fetch_type *fetchType = 0; | 550 | mailimap_fetch_type *fetchType = 0; |
551 | mailimap_set *set = 0; | 551 | mailimap_set *set = 0; |
552 | mailimap_body*body_desc = 0; | 552 | mailimap_body*body_desc = 0; |
553 | 553 | ||
554 | mb = mail->getMbox().latin1(); | 554 | mb = mail->getMbox().latin1(); |
555 | 555 | ||
556 | login(); | 556 | login(); |
557 | if (!m_imap) { | 557 | if (!m_imap) { |
558 | return body; | 558 | return body; |
559 | } | 559 | } |
560 | err = selectMbox(mail->getMbox()); | 560 | err = selectMbox(mail->getMbox()); |
561 | if ( err != MAILIMAP_NO_ERROR ) { | 561 | if ( err != MAILIMAP_NO_ERROR ) { |
562 | return body; | 562 | return body; |
563 | } | 563 | } |
564 | 564 | ||
565 | /* the range has to start at 1!!! not with 0!!!! */ | 565 | /* the range has to start at 1!!! not with 0!!!! */ |
566 | set = mailimap_set_new_interval( mail->getNumber(),mail->getNumber() ); | 566 | set = mailimap_set_new_interval( mail->getNumber(),mail->getNumber() ); |
567 | fetchAtt = mailimap_fetch_att_new_bodystructure(); | 567 | fetchAtt = mailimap_fetch_att_new_bodystructure(); |
568 | fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); | 568 | fetchType = mailimap_fetch_type_new_fetch_att(fetchAtt); |
569 | err = mailimap_fetch( m_imap, set, fetchType, &result ); | 569 | err = mailimap_fetch( m_imap, set, fetchType, &result ); |
570 | mailimap_set_free( set ); | 570 | mailimap_set_free( set ); |
571 | mailimap_fetch_type_free( fetchType ); | 571 | mailimap_fetch_type_free( fetchType ); |
572 | 572 | ||
573 | if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { | 573 | if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { |
574 | mailimap_msg_att * msg_att; | 574 | mailimap_msg_att * msg_att; |
575 | msg_att = (mailimap_msg_att*)current->data; | 575 | msg_att = (mailimap_msg_att*)current->data; |
576 | mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data; | 576 | mailimap_msg_att_item*item = (mailimap_msg_att_item*)msg_att->att_list->first->data; |
577 | QValueList<int> path; | 577 | QValueList<int> path; |
578 | body_desc = item->att_data.att_static->att_data.att_body; | 578 | body_desc = item->att_data.att_static->att_data.att_body; |
579 | traverseBody(mail,body_desc,body,0,path); | 579 | traverseBody(mail,body_desc,body,0,path); |
580 | } else { | 580 | } else { |
581 | //odebug << "error fetching body: " << m_imap->imap_response << "" << oendl; | 581 | //odebug << "error fetching body: " << m_imap->imap_response << "" << oendl; |
582 | } | 582 | } |
583 | if (result) mailimap_fetch_list_free(result); | 583 | if (result) mailimap_fetch_list_free(result); |
584 | return body; | 584 | return body; |
585 | } | 585 | } |
586 | 586 | ||
587 | QStringList IMAPwrapper::address_list_to_stringlist(clist*list) | 587 | QStringList IMAPwrapper::address_list_to_stringlist(clist*list) |
588 | { | 588 | { |
589 | QStringList l; | 589 | QStringList l; |
590 | QString from; | 590 | QString from; |
591 | bool named_from; | 591 | bool named_from; |
592 | clistcell *current = NULL; | 592 | clistcell *current = NULL; |
593 | mailimap_address * current_address=NULL; | 593 | mailimap_address * current_address=NULL; |
594 | if (!list) { | 594 | if (!list) { |
595 | return l; | 595 | return l; |
596 | } | 596 | } |
597 | unsigned int count = 0; | 597 | unsigned int count = 0; |
598 | for (current=clist_begin(list);current!= NULL;current=clist_next(current)) { | 598 | for (current=clist_begin(list);current!= NULL;current=clist_next(current)) { |
599 | from = ""; | 599 | from = ""; |
600 | named_from = false; | 600 | named_from = false; |
601 | current_address=(mailimap_address*)current->data; | 601 | current_address=(mailimap_address*)current->data; |
602 | if (current_address->ad_personal_name){ | 602 | if (current_address->ad_personal_name){ |
603 | from+=convert_String((const char*)current_address->ad_personal_name); | 603 | from+=convert_String((const char*)current_address->ad_personal_name); |
604 | from+=" "; | 604 | from+=" "; |
605 | named_from = true; | 605 | named_from = true; |
606 | } | 606 | } |
607 | if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) { | 607 | if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) { |
608 | from+="<"; | 608 | from+="<"; |
609 | } | 609 | } |
610 | if (current_address->ad_mailbox_name) { | 610 | if (current_address->ad_mailbox_name) { |
611 | from+=QString(current_address->ad_mailbox_name); | 611 | from+=QString(current_address->ad_mailbox_name); |
612 | from+="@"; | 612 | from+="@"; |
613 | } | 613 | } |
614 | if (current_address->ad_host_name) { | 614 | if (current_address->ad_host_name) { |
615 | from+=QString(current_address->ad_host_name); | 615 | from+=QString(current_address->ad_host_name); |
616 | } | 616 | } |
617 | if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) { | 617 | if (named_from && (current_address->ad_mailbox_name || current_address->ad_host_name)) { |
618 | from+=">"; | 618 | from+=">"; |
619 | } | 619 | } |
620 | l.append(QString(from)); | 620 | l.append(QString(from)); |
621 | if (++count > 99) { | 621 | if (++count > 99) { |
622 | break; | 622 | break; |
623 | } | 623 | } |
624 | } | 624 | } |
625 | return l; | 625 | return l; |
626 | } | 626 | } |
627 | 627 | ||
628 | encodedString*IMAPwrapper::fetchRawPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call) | 628 | encodedString*IMAPwrapper::fetchRawPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call) |
629 | { | 629 | { |
630 | encodedString*res=new encodedString; | 630 | encodedString*res=new encodedString; |
631 | int err; | 631 | int err; |
632 | mailimap_fetch_type *fetchType; | 632 | mailimap_fetch_type *fetchType; |
633 | mailimap_set *set; | 633 | mailimap_set *set; |
634 | clistcell*current,*cur; | 634 | clistcell*current,*cur; |
635 | mailimap_section_part * section_part = 0; | 635 | mailimap_section_part * section_part = 0; |
636 | mailimap_section_spec * section_spec = 0; | 636 | mailimap_section_spec * section_spec = 0; |
637 | mailimap_section * section = 0; | 637 | mailimap_section * section = 0; |
638 | mailimap_fetch_att * fetch_att = 0; | 638 | mailimap_fetch_att * fetch_att = 0; |
639 | 639 | ||
640 | login(); | 640 | login(); |
641 | if (!m_imap) { | 641 | if (!m_imap) { |
642 | return res; | 642 | return res; |
643 | } | 643 | } |
644 | if (!internal_call) { | 644 | if (!internal_call) { |
645 | err = selectMbox(mail->getMbox()); | 645 | err = selectMbox(mail->getMbox()); |
646 | if ( err != MAILIMAP_NO_ERROR ) { | 646 | if ( err != MAILIMAP_NO_ERROR ) { |
647 | return res; | 647 | return res; |
648 | } | 648 | } |
649 | } | 649 | } |
650 | set = mailimap_set_new_single(mail->getNumber()); | 650 | set = mailimap_set_new_single(mail->getNumber()); |
651 | 651 | ||
652 | clist*id_list = 0; | 652 | clist*id_list = 0; |
653 | 653 | ||
654 | /* if path == empty then its a request for the whole rfc822 mail and generates | 654 | /* if path == empty then its a request for the whole rfc822 mail and generates |
655 | a "fetch <id> (body[])" statement on imap server */ | 655 | a "fetch <id> (body[])" statement on imap server */ |
656 | if (path.count()>0 ) { | 656 | if (path.count()>0 ) { |
657 | id_list = clist_new(); | 657 | id_list = clist_new(); |
658 | for (unsigned j=0; j < path.count();++j) { | 658 | for (unsigned j=0; j < path.count();++j) { |
659 | uint32_t * p_id = (uint32_t *)malloc(sizeof(*p_id)); | 659 | uint32_t * p_id = (uint32_t *)malloc(sizeof(*p_id)); |
660 | *p_id = path[j]; | 660 | *p_id = path[j]; |
661 | clist_append(id_list,p_id); | 661 | clist_append(id_list,p_id); |
662 | } | 662 | } |
663 | section_part = mailimap_section_part_new(id_list); | 663 | section_part = mailimap_section_part_new(id_list); |
664 | section_spec = mailimap_section_spec_new(MAILIMAP_SECTION_SPEC_SECTION_PART, NULL, section_part, NULL); | 664 | section_spec = mailimap_section_spec_new(MAILIMAP_SECTION_SPEC_SECTION_PART, NULL, section_part, NULL); |
665 | } | 665 | } |
666 | 666 | ||
667 | section = mailimap_section_new(section_spec); | 667 | section = mailimap_section_new(section_spec); |
668 | fetch_att = mailimap_fetch_att_new_body_section(section); | 668 | fetch_att = mailimap_fetch_att_new_body_section(section); |
669 | fetchType = mailimap_fetch_type_new_fetch_att(fetch_att); | 669 | fetchType = mailimap_fetch_type_new_fetch_att(fetch_att); |
670 | 670 | ||
671 | clist*result = 0; | 671 | clist*result = 0; |
672 | 672 | ||
673 | err = mailimap_fetch( m_imap, set, fetchType, &result ); | 673 | err = mailimap_fetch( m_imap, set, fetchType, &result ); |
674 | mailimap_set_free( set ); | 674 | mailimap_set_free( set ); |
675 | mailimap_fetch_type_free( fetchType ); | 675 | mailimap_fetch_type_free( fetchType ); |
676 | 676 | ||
677 | if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { | 677 | if (err == MAILIMAP_NO_ERROR && (current=clist_begin(result)) ) { |
678 | mailimap_msg_att * msg_att; | 678 | mailimap_msg_att * msg_att; |
679 | msg_att = (mailimap_msg_att*)current->data; | 679 | msg_att = (mailimap_msg_att*)current->data; |
680 | mailimap_msg_att_item*msg_att_item; | 680 | mailimap_msg_att_item*msg_att_item; |
681 | for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) { | 681 | for(cur = clist_begin(msg_att->att_list) ; cur != NULL ; cur = clist_next(cur)) { |
682 | msg_att_item = (mailimap_msg_att_item*)clist_content(cur); | 682 | msg_att_item = (mailimap_msg_att_item*)clist_content(cur); |
683 | if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) { | 683 | if (msg_att_item->att_type == MAILIMAP_MSG_ATT_ITEM_STATIC) { |
684 | if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) { | 684 | if (msg_att_item->att_data.att_static->att_type == MAILIMAP_MSG_ATT_BODY_SECTION) { |
685 | char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part; | 685 | char*text = msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part; |
686 | /* detach - we take over the content */ | 686 | /* detach - we take over the content */ |
687 | msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L; | 687 | msg_att_item->att_data.att_static->att_data.att_body_section->sec_body_part = 0L; |
688 | res->setContent(text,msg_att_item->att_data.att_static->att_data.att_body_section->sec_length); | 688 | res->setContent(text,msg_att_item->att_data.att_static->att_data.att_body_section->sec_length); |
689 | } | 689 | } |
690 | } | 690 | } |
691 | } | 691 | } |
692 | } else { | 692 | } else { |
693 | ;//odebug << "error fetching text: " << m_imap->imap_response << "" << oendl; | 693 | ;//odebug << "error fetching text: " << m_imap->imap_response << "" << oendl; |
694 | } | 694 | } |
695 | if (result) mailimap_fetch_list_free(result); | 695 | if (result) mailimap_fetch_list_free(result); |
696 | return res; | 696 | return res; |
697 | } | 697 | } |
698 | 698 | ||
699 | /* current_recursion is for recursive calls. | 699 | /* current_recursion is for recursive calls. |
700 | current_count means the position inside the internal loop! */ | 700 | current_count means the position inside the internal loop! */ |
701 | void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&target_body, | 701 | void IMAPwrapper::traverseBody(const RecMailP&mail,mailimap_body*body,RecBodyP&target_body, |
702 | int current_recursion,QValueList<int>recList,int current_count) | 702 | int current_recursion,QValueList<int>recList,int current_count) |
703 | { | 703 | { |
704 | if (!body || current_recursion>=10) { | 704 | if (!body || current_recursion>=10) { |
705 | return; | 705 | return; |
706 | } | 706 | } |
707 | switch (body->bd_type) { | 707 | switch (body->bd_type) { |
708 | case MAILIMAP_BODY_1PART: | 708 | case MAILIMAP_BODY_1PART: |
709 | { | 709 | { |
710 | QValueList<int>countlist = recList; | 710 | QValueList<int>countlist = recList; |
711 | countlist.append(current_count); | 711 | countlist.append(current_count); |
712 | RecPartP currentPart = new RecPart(); | 712 | RecPartP currentPart = new RecPart(); |
713 | mailimap_body_type_1part*part1 = body->bd_data.bd_body_1part; | 713 | mailimap_body_type_1part*part1 = body->bd_data.bd_body_1part; |
714 | QString id(""); | 714 | QString id(""); |
715 | currentPart->setPositionlist(countlist); | 715 | currentPart->setPositionlist(countlist); |
716 | for (unsigned int j = 0; j < countlist.count();++j) { | 716 | for (unsigned int j = 0; j < countlist.count();++j) { |
717 | id+=(j>0?" ":""); | 717 | id+=(j>0?" ":""); |
718 | id+=QString("%1").arg(countlist[j]); | 718 | id+=QString("%1").arg(countlist[j]); |
719 | } | 719 | } |
720 | //odebug << "ID = " << id.latin1() << "" << oendl; | 720 | //odebug << "ID = " << id.latin1() << "" << oendl; |
721 | currentPart->setIdentifier(id); | 721 | currentPart->setIdentifier(id); |
722 | fillSinglePart(currentPart,part1); | 722 | fillSinglePart(currentPart,part1); |
723 | /* important: Check for is NULL 'cause a body can be empty! | 723 | /* important: Check for is NULL 'cause a body can be empty! |
724 | And we put it only into the mail if it is the FIRST part */ | 724 | And we put it only into the mail if it is the FIRST part */ |
725 | if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body->Bodytext().isNull() && countlist[0]==1) { | 725 | if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_TEXT && target_body->Bodytext().isNull() && countlist[0]==1) { |
726 | QString body_text = fetchTextPart(mail,countlist,true,currentPart->Encoding()); | 726 | QString body_text = fetchTextPart(mail,countlist,true,currentPart->Encoding()); |
727 | target_body->setDescription(currentPart); | 727 | target_body->setDescription(currentPart); |
728 | target_body->setBodytext(body_text); | 728 | target_body->setBodytext(body_text); |
729 | if (countlist.count()>1) { | 729 | if (countlist.count()>1) { |
730 | target_body->addPart(currentPart); | 730 | target_body->addPart(currentPart); |
731 | } | 731 | } |
732 | } else { | 732 | } else { |
733 | target_body->addPart(currentPart); | 733 | target_body->addPart(currentPart); |
734 | } | 734 | } |
735 | if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_MSG) { | 735 | if (part1->bd_type==MAILIMAP_BODY_TYPE_1PART_MSG) { |
736 | traverseBody(mail,part1->bd_data.bd_type_msg->bd_body,target_body,current_recursion+1,countlist); | 736 | traverseBody(mail,part1->bd_data.bd_type_msg->bd_body,target_body,current_recursion+1,countlist); |
737 | } | 737 | } |
738 | } | 738 | } |
739 | break; | 739 | break; |
740 | case MAILIMAP_BODY_MPART: | 740 | case MAILIMAP_BODY_MPART: |
741 | { | 741 | { |
742 | QValueList<int>countlist = recList; | 742 | QValueList<int>countlist = recList; |
743 | clistcell*current=0; | 743 | clistcell*current=0; |
744 | mailimap_body*current_body=0; | 744 | mailimap_body*current_body=0; |
745 | unsigned int ccount = 1; | 745 | unsigned int ccount = 1; |
746 | mailimap_body_type_mpart*mailDescription = body->bd_data.bd_body_mpart; | 746 | mailimap_body_type_mpart*mailDescription = body->bd_data.bd_body_mpart; |
747 | for (current=clist_begin(mailDescription->bd_list);current!=0;current=clist_next(current)) { | 747 | for (current=clist_begin(mailDescription->bd_list);current!=0;current=clist_next(current)) { |
748 | current_body = (mailimap_body*)current->data; | 748 | current_body = (mailimap_body*)current->data; |
749 | if (current_body->bd_type==MAILIMAP_BODY_MPART) { | 749 | if (current_body->bd_type==MAILIMAP_BODY_MPART) { |
750 | RecPartP targetPart = new RecPart(); | 750 | RecPartP targetPart = new RecPart(); |
751 | targetPart->setType("multipart"); | 751 | targetPart->setType("multipart"); |
752 | fillMultiPart(targetPart,mailDescription); | 752 | fillMultiPart(targetPart,mailDescription); |
753 | countlist.append(current_count); | 753 | countlist.append(current_count); |
754 | targetPart->setPositionlist(countlist); | 754 | targetPart->setPositionlist(countlist); |
755 | target_body->addPart(targetPart); | 755 | target_body->addPart(targetPart); |
756 | QString id(""); | 756 | QString id(""); |
757 | for (unsigned int j = 0; j < countlist.count();++j) { | 757 | for (unsigned int j = 0; j < countlist.count();++j) { |
758 | id+=(j>0?" ":""); | 758 | id+=(j>0?" ":""); |
759 | id+=QString("%1").arg(countlist[j]); | 759 | id+=QString("%1").arg(countlist[j]); |
760 | } | 760 | } |
761 | // odebug << "ID(mpart) = " << id.latin1() << "" << oendl; | 761 | // odebug << "ID(mpart) = " << id.latin1() << "" << oendl; |
762 | } | 762 | } |
763 | traverseBody(mail,current_body,target_body,current_recursion+1,countlist,ccount); | 763 | traverseBody(mail,current_body,target_body,current_recursion+1,countlist,ccount); |
764 | if (current_body->bd_type==MAILIMAP_BODY_MPART) { | 764 | if (current_body->bd_type==MAILIMAP_BODY_MPART) { |
765 | countlist = recList; | 765 | countlist = recList; |
766 | } | 766 | } |
767 | ++ccount; | 767 | ++ccount; |
768 | } | 768 | } |
769 | } | 769 | } |
770 | break; | 770 | break; |
771 | default: | 771 | default: |
772 | break; | 772 | break; |
773 | } | 773 | } |
774 | } | 774 | } |
775 | 775 | ||
776 | void IMAPwrapper::fillSinglePart(RecPartP&target_part,mailimap_body_type_1part*Description) | 776 | void IMAPwrapper::fillSinglePart(RecPartP&target_part,mailimap_body_type_1part*Description) |
777 | { | 777 | { |
778 | if (!Description) { | 778 | if (!Description) { |
779 | return; | 779 | return; |
780 | } | 780 | } |
781 | switch (Description->bd_type) { | 781 | switch (Description->bd_type) { |
782 | case MAILIMAP_BODY_TYPE_1PART_TEXT: | 782 | case MAILIMAP_BODY_TYPE_1PART_TEXT: |
783 | target_part->setType("text"); | 783 | target_part->setType("text"); |
784 | fillSingleTextPart(target_part,Description->bd_data.bd_type_text); | 784 | fillSingleTextPart(target_part,Description->bd_data.bd_type_text); |
785 | break; | 785 | break; |
786 | case MAILIMAP_BODY_TYPE_1PART_BASIC: | 786 | case MAILIMAP_BODY_TYPE_1PART_BASIC: |
787 | fillSingleBasicPart(target_part,Description->bd_data.bd_type_basic); | 787 | fillSingleBasicPart(target_part,Description->bd_data.bd_type_basic); |
788 | break; | 788 | break; |
789 | case MAILIMAP_BODY_TYPE_1PART_MSG: | 789 | case MAILIMAP_BODY_TYPE_1PART_MSG: |
790 | target_part->setType("message"); | 790 | target_part->setType("message"); |
791 | fillSingleMsgPart(target_part,Description->bd_data.bd_type_msg); | 791 | fillSingleMsgPart(target_part,Description->bd_data.bd_type_msg); |
792 | break; | 792 | break; |
793 | default: | 793 | default: |
794 | break; | 794 | break; |
795 | } | 795 | } |
796 | } | 796 | } |
797 | 797 | ||
798 | void IMAPwrapper::fillSingleTextPart(RecPartP&target_part,mailimap_body_type_text*which) | 798 | void IMAPwrapper::fillSingleTextPart(RecPartP&target_part,mailimap_body_type_text*which) |
799 | { | 799 | { |
800 | if (!which) { | 800 | if (!which) { |
801 | return; | 801 | return; |
802 | } | 802 | } |
803 | QString sub; | 803 | QString sub; |
804 | sub = which->bd_media_text; | 804 | sub = which->bd_media_text; |
805 | //odebug << "Type= text/" << which->bd_media_text << "" << oendl; | 805 | //odebug << "Type= text/" << which->bd_media_text << "" << oendl; |
806 | target_part->setSubtype(sub.lower()); | 806 | target_part->setSubtype(sub.lower()); |
807 | target_part->setLines(which->bd_lines); | 807 | target_part->setLines(which->bd_lines); |
808 | fillBodyFields(target_part,which->bd_fields); | 808 | fillBodyFields(target_part,which->bd_fields); |
809 | } | 809 | } |
810 | 810 | ||
811 | void IMAPwrapper::fillSingleMsgPart(RecPartP&target_part,mailimap_body_type_msg*which) | 811 | void IMAPwrapper::fillSingleMsgPart(RecPartP&target_part,mailimap_body_type_msg*which) |
812 | { | 812 | { |
813 | if (!which) { | 813 | if (!which) { |
814 | return; | 814 | return; |
815 | } | 815 | } |
816 | target_part->setSubtype("rfc822"); | 816 | target_part->setSubtype("rfc822"); |
817 | //odebug << "Message part" << oendl; | 817 | //odebug << "Message part" << oendl; |
818 | /* we set this type to text/plain */ | 818 | /* we set this type to text/plain */ |
819 | target_part->setLines(which->bd_lines); | 819 | target_part->setLines(which->bd_lines); |
820 | fillBodyFields(target_part,which->bd_fields); | 820 | fillBodyFields(target_part,which->bd_fields); |
821 | } | 821 | } |
822 | 822 | ||
823 | void IMAPwrapper::fillMultiPart(RecPartP&target_part,mailimap_body_type_mpart*which) | 823 | void IMAPwrapper::fillMultiPart(RecPartP&target_part,mailimap_body_type_mpart*which) |
824 | { | 824 | { |
825 | if (!which) return; | 825 | if (!which) return; |
826 | QString sub = which->bd_media_subtype; | 826 | QString sub = which->bd_media_subtype; |
827 | target_part->setSubtype(sub.lower()); | 827 | target_part->setSubtype(sub.lower()); |
828 | if (which->bd_ext_mpart && which->bd_ext_mpart->bd_parameter && which->bd_ext_mpart->bd_parameter->pa_list) { | 828 | if (which->bd_ext_mpart && which->bd_ext_mpart->bd_parameter && which->bd_ext_mpart->bd_parameter->pa_list) { |
829 | clistcell*cur = 0; | 829 | clistcell*cur = 0; |
830 | mailimap_single_body_fld_param*param=0; | 830 | mailimap_single_body_fld_param*param=0; |
831 | for (cur = clist_begin(which->bd_ext_mpart->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { | 831 | for (cur = clist_begin(which->bd_ext_mpart->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { |
832 | param = (mailimap_single_body_fld_param*)cur->data; | 832 | param = (mailimap_single_body_fld_param*)cur->data; |
833 | if (param) { | 833 | if (param) { |
834 | target_part->addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); | 834 | target_part->addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); |
835 | } | 835 | } |
836 | } | 836 | } |
837 | } | 837 | } |
838 | } | 838 | } |
839 | 839 | ||
840 | void IMAPwrapper::fillSingleBasicPart(RecPartP&target_part,mailimap_body_type_basic*which) | 840 | void IMAPwrapper::fillSingleBasicPart(RecPartP&target_part,mailimap_body_type_basic*which) |
841 | { | 841 | { |
842 | if (!which) { | 842 | if (!which) { |
843 | return; | 843 | return; |
844 | } | 844 | } |
845 | QString type,sub; | 845 | QString type,sub; |
846 | switch (which->bd_media_basic->med_type) { | 846 | switch (which->bd_media_basic->med_type) { |
847 | case MAILIMAP_MEDIA_BASIC_APPLICATION: | 847 | case MAILIMAP_MEDIA_BASIC_APPLICATION: |
848 | type = "application"; | 848 | type = "application"; |
849 | break; | 849 | break; |
850 | case MAILIMAP_MEDIA_BASIC_AUDIO: | 850 | case MAILIMAP_MEDIA_BASIC_AUDIO: |
851 | type = "audio"; | 851 | type = "audio"; |
852 | break; | 852 | break; |
853 | case MAILIMAP_MEDIA_BASIC_IMAGE: | 853 | case MAILIMAP_MEDIA_BASIC_IMAGE: |
854 | type = "image"; | 854 | type = "image"; |
855 | break; | 855 | break; |
856 | case MAILIMAP_MEDIA_BASIC_MESSAGE: | 856 | case MAILIMAP_MEDIA_BASIC_MESSAGE: |
857 | type = "message"; | 857 | type = "message"; |
858 | break; | 858 | break; |
859 | case MAILIMAP_MEDIA_BASIC_VIDEO: | 859 | case MAILIMAP_MEDIA_BASIC_VIDEO: |
860 | type = "video"; | 860 | type = "video"; |
861 | break; | 861 | break; |
862 | case MAILIMAP_MEDIA_BASIC_OTHER: | 862 | case MAILIMAP_MEDIA_BASIC_OTHER: |
863 | default: | 863 | default: |
864 | if (which->bd_media_basic->med_basic_type) { | 864 | if (which->bd_media_basic->med_basic_type) { |
865 | type = which->bd_media_basic->med_basic_type; | 865 | type = which->bd_media_basic->med_basic_type; |
866 | } else { | 866 | } else { |
867 | type = ""; | 867 | type = ""; |
868 | } | 868 | } |
869 | break; | 869 | break; |
870 | } | 870 | } |
871 | if (which->bd_media_basic->med_subtype) { | 871 | if (which->bd_media_basic->med_subtype) { |
872 | sub = which->bd_media_basic->med_subtype; | 872 | sub = which->bd_media_basic->med_subtype; |
873 | } else { | 873 | } else { |
874 | sub = ""; | 874 | sub = ""; |
875 | } | 875 | } |
876 | // odebug << "Type = " << type.latin1() << "/" << sub.latin1() << "" << oendl; | 876 | // odebug << "Type = " << type.latin1() << "/" << sub.latin1() << "" << oendl; |
877 | target_part->setType(type.lower()); | 877 | target_part->setType(type.lower()); |
878 | target_part->setSubtype(sub.lower()); | 878 | target_part->setSubtype(sub.lower()); |
879 | fillBodyFields(target_part,which->bd_fields); | 879 | fillBodyFields(target_part,which->bd_fields); |
880 | } | 880 | } |
881 | 881 | ||
882 | void IMAPwrapper::fillBodyFields(RecPartP&target_part,mailimap_body_fields*which) | 882 | void IMAPwrapper::fillBodyFields(RecPartP&target_part,mailimap_body_fields*which) |
883 | { | 883 | { |
884 | if (!which) return; | 884 | if (!which) return; |
885 | if (which->bd_parameter && which->bd_parameter->pa_list && which->bd_parameter->pa_list->count>0) { | 885 | if (which->bd_parameter && which->bd_parameter->pa_list && which->bd_parameter->pa_list->count>0) { |
886 | clistcell*cur; | 886 | clistcell*cur; |
887 | mailimap_single_body_fld_param*param=0; | 887 | mailimap_single_body_fld_param*param=0; |
888 | for (cur = clist_begin(which->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { | 888 | for (cur = clist_begin(which->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { |
889 | param = (mailimap_single_body_fld_param*)cur->data; | 889 | param = (mailimap_single_body_fld_param*)cur->data; |
890 | if (param) { | 890 | if (param) { |
891 | target_part->addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); | 891 | target_part->addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); |
892 | } | 892 | } |
893 | } | 893 | } |
894 | } | 894 | } |
895 | mailimap_body_fld_enc*enc = which->bd_encoding; | 895 | mailimap_body_fld_enc*enc = which->bd_encoding; |
896 | QString encoding(""); | 896 | QString encoding(""); |
897 | switch (enc->enc_type) { | 897 | switch (enc->enc_type) { |
898 | case MAILIMAP_BODY_FLD_ENC_7BIT: | 898 | case MAILIMAP_BODY_FLD_ENC_7BIT: |
899 | encoding = "7bit"; | 899 | encoding = "7bit"; |
900 | break; | 900 | break; |
901 | case MAILIMAP_BODY_FLD_ENC_8BIT: | 901 | case MAILIMAP_BODY_FLD_ENC_8BIT: |
902 | encoding = "8bit"; | 902 | encoding = "8bit"; |
903 | break; | 903 | break; |
904 | case MAILIMAP_BODY_FLD_ENC_BINARY: | 904 | case MAILIMAP_BODY_FLD_ENC_BINARY: |
905 | encoding="binary"; | 905 | encoding="binary"; |
906 | break; | 906 | break; |
907 | case MAILIMAP_BODY_FLD_ENC_BASE64: | 907 | case MAILIMAP_BODY_FLD_ENC_BASE64: |
908 | encoding="base64"; | 908 | encoding="base64"; |
909 | break; | 909 | break; |
910 | case MAILIMAP_BODY_FLD_ENC_QUOTED_PRINTABLE: | 910 | case MAILIMAP_BODY_FLD_ENC_QUOTED_PRINTABLE: |
911 | encoding="quoted-printable"; | 911 | encoding="quoted-printable"; |
912 | break; | 912 | break; |
913 | case MAILIMAP_BODY_FLD_ENC_OTHER: | 913 | case MAILIMAP_BODY_FLD_ENC_OTHER: |
914 | default: | 914 | default: |
915 | if (enc->enc_value) { | 915 | if (enc->enc_value) { |
916 | char*t=enc->enc_value; | 916 | char*t=enc->enc_value; |
917 | encoding=QString(enc->enc_value); | 917 | encoding=QString(enc->enc_value); |
918 | enc->enc_value=0L; | 918 | enc->enc_value=0L; |
919 | free(t); | 919 | free(t); |
920 | } | 920 | } |
921 | } | 921 | } |
922 | if (which->bd_description) { | 922 | if (which->bd_description) { |
923 | target_part->setDescription(QString(which->bd_description)); | 923 | target_part->setDescription(QString(which->bd_description)); |
924 | } | 924 | } |
925 | target_part->setEncoding(encoding); | 925 | target_part->setEncoding(encoding); |
926 | target_part->setSize(which->bd_size); | 926 | target_part->setSize(which->bd_size); |
927 | } | 927 | } |
928 | void IMAPwrapper::deleteMailList(const QValueList<RecMailP>&target) | 928 | void IMAPwrapper::deleteMailList(const QValueList<RecMailP>&target) |
929 | { | 929 | { |
930 | //#if 0 | 930 | //#if 0 |
931 | mailimap_flag_list*flist; | 931 | mailimap_flag_list*flist; |
932 | mailimap_set *set; | 932 | mailimap_set *set; |
933 | mailimap_store_att_flags * store_flags; | 933 | mailimap_store_att_flags * store_flags; |
934 | int err; | 934 | int err; |
935 | login(); | 935 | login(); |
936 | //#endif | 936 | //#endif |
937 | if (!m_imap) { | 937 | if (!m_imap) { |
938 | return; | 938 | return; |
939 | } | 939 | } |
940 | int iii = 0; | 940 | int iii = 0; |
941 | int count = target.count(); | 941 | int count = target.count(); |
942 | // qDebug("imap remove count %d ", count); | 942 | // qDebug("imap remove count %d ", count); |
943 | 943 | ||
944 | 944 | ||
945 | mMax = count; | 945 | mMax = count; |
946 | //progress( tr("Delete")); | 946 | //progress( tr("Delete")); |
947 | QWidget wid; | 947 | |
948 | QProgressBar wid ( count ); | ||
949 | wid.setCaption( tr("Deleting ...")); | ||
948 | wid.show(); | 950 | wid.show(); |
949 | while (iii < count ) { | 951 | while (iii < count ) { |
950 | Global::statusMessage(tr("Delete message %1 of %2").arg(iii).arg(count)); | 952 | Global::statusMessage(tr("Delete message %1 of %2").arg(iii).arg(count)); |
953 | wid.setProgress( iii ); | ||
951 | wid.raise(); | 954 | wid.raise(); |
952 | qApp->processEvents(); | 955 | qApp->processEvents(); |
953 | RecMailP mail = (*target.at( iii )); | 956 | RecMailP mail = (*target.at( iii )); |
954 | //#if 0 | 957 | //#if 0 |
955 | //qDebug("IMAP remove %d %d ", iii, mail->getNumber() ); | 958 | //qDebug("IMAP remove %d %d ", iii, mail->getNumber() ); |
956 | err = selectMbox(mail->getMbox()); | 959 | err = selectMbox(mail->getMbox()); |
957 | if ( err != MAILIMAP_NO_ERROR ) { | 960 | if ( err != MAILIMAP_NO_ERROR ) { |
958 | return; | 961 | return; |
959 | } | 962 | } |
960 | flist = mailimap_flag_list_new_empty(); | 963 | flist = mailimap_flag_list_new_empty(); |
961 | mailimap_flag_list_add(flist,mailimap_flag_new_deleted()); | 964 | mailimap_flag_list_add(flist,mailimap_flag_new_deleted()); |
962 | store_flags = mailimap_store_att_flags_new_set_flags(flist); | 965 | store_flags = mailimap_store_att_flags_new_set_flags(flist); |
963 | set = mailimap_set_new_single(mail->getNumber()); | 966 | set = mailimap_set_new_single(mail->getNumber()); |
964 | err = mailimap_store(m_imap,set,store_flags); | 967 | err = mailimap_store(m_imap,set,store_flags); |
965 | mailimap_set_free( set ); | 968 | mailimap_set_free( set ); |
966 | mailimap_store_att_flags_free(store_flags); | 969 | mailimap_store_att_flags_free(store_flags); |
967 | 970 | ||
968 | if (err != MAILIMAP_NO_ERROR) { | 971 | if (err != MAILIMAP_NO_ERROR) { |
969 | // odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl; | 972 | // odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl; |
970 | return; | 973 | return; |
971 | } | 974 | } |
972 | // odebug << "deleting mail: " << m_imap->imap_response << "" << oendl; | 975 | // odebug << "deleting mail: " << m_imap->imap_response << "" << oendl; |
973 | /* should we realy do that at this moment? */ | 976 | /* should we realy do that at this moment? */ |
974 | 977 | ||
975 | // err = mailimap_expunge(m_imap); | 978 | // err = mailimap_expunge(m_imap); |
976 | //if (err != MAILIMAP_NO_ERROR) { | 979 | //if (err != MAILIMAP_NO_ERROR) { |
977 | // Global::statusMessage(tr("Error deleting mails: %s").arg(m_imap->imap_response)); | 980 | // Global::statusMessage(tr("Error deleting mails: %s").arg(m_imap->imap_response)); |
978 | // } | 981 | // } |
979 | //#endif | 982 | //#endif |
980 | //deleteMail( mail); | 983 | //deleteMail( mail); |
981 | ++iii; | 984 | ++iii; |
982 | } | 985 | } |
983 | //qDebug("Deleting imap mails... "); | 986 | //qDebug("Deleting imap mails... "); |
984 | err = mailimap_expunge(m_imap); | 987 | err = mailimap_expunge(m_imap); |
985 | if (err != MAILIMAP_NO_ERROR) { | 988 | if (err != MAILIMAP_NO_ERROR) { |
986 | Global::statusMessage(tr("Error deleting mails: %s").arg(m_imap->imap_response)); | 989 | Global::statusMessage(tr("Error deleting mails: %s").arg(m_imap->imap_response)); |
987 | } | 990 | } |
988 | } | 991 | } |
989 | void IMAPwrapper::deleteMail(const RecMailP&mail) | 992 | void IMAPwrapper::deleteMail(const RecMailP&mail) |
990 | { | 993 | { |
991 | mailimap_flag_list*flist; | 994 | mailimap_flag_list*flist; |
992 | mailimap_set *set; | 995 | mailimap_set *set; |
993 | mailimap_store_att_flags * store_flags; | 996 | mailimap_store_att_flags * store_flags; |
994 | int err; | 997 | int err; |
995 | login(); | 998 | login(); |
996 | if (!m_imap) { | 999 | if (!m_imap) { |
997 | return; | 1000 | return; |
998 | } | 1001 | } |
999 | err = selectMbox(mail->getMbox()); | 1002 | err = selectMbox(mail->getMbox()); |
1000 | if ( err != MAILIMAP_NO_ERROR ) { | 1003 | if ( err != MAILIMAP_NO_ERROR ) { |
1001 | return; | 1004 | return; |
1002 | } | 1005 | } |
1003 | flist = mailimap_flag_list_new_empty(); | 1006 | flist = mailimap_flag_list_new_empty(); |
1004 | mailimap_flag_list_add(flist,mailimap_flag_new_deleted()); | 1007 | mailimap_flag_list_add(flist,mailimap_flag_new_deleted()); |
1005 | store_flags = mailimap_store_att_flags_new_set_flags(flist); | 1008 | store_flags = mailimap_store_att_flags_new_set_flags(flist); |
1006 | set = mailimap_set_new_single(mail->getNumber()); | 1009 | set = mailimap_set_new_single(mail->getNumber()); |
1007 | err = mailimap_store(m_imap,set,store_flags); | 1010 | err = mailimap_store(m_imap,set,store_flags); |
1008 | mailimap_set_free( set ); | 1011 | mailimap_set_free( set ); |
1009 | mailimap_store_att_flags_free(store_flags); | 1012 | mailimap_store_att_flags_free(store_flags); |
1010 | 1013 | ||
1011 | if (err != MAILIMAP_NO_ERROR) { | 1014 | if (err != MAILIMAP_NO_ERROR) { |
1012 | // odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl; | 1015 | // odebug << "error deleting mail: " << m_imap->imap_response << "" << oendl; |
1013 | return; | 1016 | return; |
1014 | } | 1017 | } |
1015 | // odebug << "deleting mail: " << m_imap->imap_response << "" << oendl; | 1018 | // odebug << "deleting mail: " << m_imap->imap_response << "" << oendl; |
1016 | /* should we realy do that at this moment? */ | 1019 | /* should we realy do that at this moment? */ |
1017 | 1020 | ||
1018 | err = mailimap_expunge(m_imap); | 1021 | err = mailimap_expunge(m_imap); |
1019 | if (err != MAILIMAP_NO_ERROR) { | 1022 | if (err != MAILIMAP_NO_ERROR) { |
1020 | Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response)); | 1023 | Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response)); |
1021 | } | 1024 | } |
1022 | //qDebug("IMAPwrapper::deleteMail 2"); | 1025 | //qDebug("IMAPwrapper::deleteMail 2"); |
1023 | 1026 | ||
1024 | } | 1027 | } |
1025 | 1028 | ||
1026 | void IMAPwrapper::answeredMail(const RecMailP&mail) | 1029 | void IMAPwrapper::answeredMail(const RecMailP&mail) |
1027 | { | 1030 | { |
1028 | mailimap_flag_list*flist; | 1031 | mailimap_flag_list*flist; |
1029 | mailimap_set *set; | 1032 | mailimap_set *set; |
1030 | mailimap_store_att_flags * store_flags; | 1033 | mailimap_store_att_flags * store_flags; |
1031 | int err; | 1034 | int err; |
1032 | login(); | 1035 | login(); |
1033 | if (!m_imap) { | 1036 | if (!m_imap) { |
1034 | return; | 1037 | return; |
1035 | } | 1038 | } |
1036 | err = selectMbox(mail->getMbox()); | 1039 | err = selectMbox(mail->getMbox()); |
1037 | if ( err != MAILIMAP_NO_ERROR ) { | 1040 | if ( err != MAILIMAP_NO_ERROR ) { |
1038 | return; | 1041 | return; |
1039 | } | 1042 | } |
1040 | flist = mailimap_flag_list_new_empty(); | 1043 | flist = mailimap_flag_list_new_empty(); |
1041 | mailimap_flag_list_add(flist,mailimap_flag_new_answered()); | 1044 | mailimap_flag_list_add(flist,mailimap_flag_new_answered()); |
1042 | store_flags = mailimap_store_att_flags_new_add_flags(flist); | 1045 | store_flags = mailimap_store_att_flags_new_add_flags(flist); |
1043 | set = mailimap_set_new_single(mail->getNumber()); | 1046 | set = mailimap_set_new_single(mail->getNumber()); |
1044 | err = mailimap_store(m_imap,set,store_flags); | 1047 | err = mailimap_store(m_imap,set,store_flags); |
1045 | mailimap_set_free( set ); | 1048 | mailimap_set_free( set ); |
1046 | mailimap_store_att_flags_free(store_flags); | 1049 | mailimap_store_att_flags_free(store_flags); |
1047 | 1050 | ||
1048 | if (err != MAILIMAP_NO_ERROR) { | 1051 | if (err != MAILIMAP_NO_ERROR) { |
1049 | // odebug << "error marking mail: " << m_imap->imap_response << "" << oendl; | 1052 | // odebug << "error marking mail: " << m_imap->imap_response << "" << oendl; |
1050 | return; | 1053 | return; |
1051 | } | 1054 | } |
1052 | } | 1055 | } |
1053 | 1056 | ||
1054 | QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call,const QString&enc) | 1057 | QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const QValueList<int>&path,bool internal_call,const QString&enc) |
1055 | { | 1058 | { |
1056 | QString body(""); | 1059 | QString body(""); |
1057 | encodedString*res = fetchRawPart(mail,path,internal_call); | 1060 | encodedString*res = fetchRawPart(mail,path,internal_call); |
1058 | encodedString*r = decode_String(res,enc); | 1061 | encodedString*r = decode_String(res,enc); |
1059 | delete res; | 1062 | delete res; |
1060 | if (r) { | 1063 | if (r) { |
1061 | if (r->Length()>0) { | 1064 | if (r->Length()>0) { |
1062 | body = r->Content(); | 1065 | body = r->Content(); |
1063 | } | 1066 | } |
1064 | delete r; | 1067 | delete r; |
1065 | } | 1068 | } |
1066 | return body; | 1069 | return body; |
1067 | } | 1070 | } |
1068 | 1071 | ||
1069 | QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const RecPartP&part) | 1072 | QString IMAPwrapper::fetchTextPart(const RecMailP&mail,const RecPartP&part) |
1070 | { | 1073 | { |
1071 | return fetchTextPart(mail,part->Positionlist(),false,part->Encoding()); | 1074 | return fetchTextPart(mail,part->Positionlist(),false,part->Encoding()); |
1072 | } | 1075 | } |
1073 | 1076 | ||
1074 | encodedString* IMAPwrapper::fetchDecodedPart(const RecMailP&mail,const RecPartP&part) | 1077 | encodedString* IMAPwrapper::fetchDecodedPart(const RecMailP&mail,const RecPartP&part) |
1075 | { | 1078 | { |
1076 | encodedString*res = fetchRawPart(mail,part->Positionlist(),false); | 1079 | encodedString*res = fetchRawPart(mail,part->Positionlist(),false); |
1077 | encodedString*r = decode_String(res,part->Encoding()); | 1080 | encodedString*r = decode_String(res,part->Encoding()); |
1078 | delete res; | 1081 | delete res; |
1079 | return r; | 1082 | return r; |
1080 | } | 1083 | } |
1081 | 1084 | ||
1082 | encodedString* IMAPwrapper::fetchRawPart(const RecMailP&mail,const RecPartP&part) | 1085 | encodedString* IMAPwrapper::fetchRawPart(const RecMailP&mail,const RecPartP&part) |
1083 | { | 1086 | { |
1084 | return fetchRawPart(mail,part->Positionlist(),false); | 1087 | return fetchRawPart(mail,part->Positionlist(),false); |
1085 | } | 1088 | } |
1086 | 1089 | ||
1087 | int IMAPwrapper::deleteAllMail(const FolderP&folder) | 1090 | int IMAPwrapper::deleteAllMail(const FolderP&folder) |
1088 | { | 1091 | { |
1089 | login(); | 1092 | login(); |
1090 | if (!m_imap) { | 1093 | if (!m_imap) { |
1091 | return 0; | 1094 | return 0; |
1092 | } | 1095 | } |
1093 | mailimap_flag_list*flist; | 1096 | mailimap_flag_list*flist; |
1094 | mailimap_set *set; | 1097 | mailimap_set *set; |
1095 | mailimap_store_att_flags * store_flags; | 1098 | mailimap_store_att_flags * store_flags; |
1096 | int err = selectMbox(folder->getName()); | 1099 | int err = selectMbox(folder->getName()); |
1097 | if ( err != MAILIMAP_NO_ERROR ) { | 1100 | if ( err != MAILIMAP_NO_ERROR ) { |
1098 | return 0; | 1101 | return 0; |
1099 | } | 1102 | } |
1100 | 1103 | ||
1101 | int last = m_imap->imap_selection_info->sel_exists; | 1104 | int last = m_imap->imap_selection_info->sel_exists; |
1102 | if (last == 0) { | 1105 | if (last == 0) { |
1103 | Global::statusMessage(tr("Mailbox has no mails!")); | 1106 | Global::statusMessage(tr("Mailbox has no mails!")); |
1104 | return 0; | 1107 | return 0; |
1105 | } | 1108 | } |
1106 | flist = mailimap_flag_list_new_empty(); | 1109 | flist = mailimap_flag_list_new_empty(); |
1107 | mailimap_flag_list_add(flist,mailimap_flag_new_deleted()); | 1110 | mailimap_flag_list_add(flist,mailimap_flag_new_deleted()); |
1108 | store_flags = mailimap_store_att_flags_new_set_flags(flist); | 1111 | store_flags = mailimap_store_att_flags_new_set_flags(flist); |
1109 | set = mailimap_set_new_interval( 1, last ); | 1112 | set = mailimap_set_new_interval( 1, last ); |
1110 | err = mailimap_store(m_imap,set,store_flags); | 1113 | err = mailimap_store(m_imap,set,store_flags); |
1111 | mailimap_set_free( set ); | 1114 | mailimap_set_free( set ); |
1112 | mailimap_store_att_flags_free(store_flags); | 1115 | mailimap_store_att_flags_free(store_flags); |
1113 | if (err != MAILIMAP_NO_ERROR) { | 1116 | if (err != MAILIMAP_NO_ERROR) { |
1114 | Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response)); | 1117 | Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response)); |
1115 | return 0; | 1118 | return 0; |
1116 | } | 1119 | } |
1117 | // odebug << "deleting mail: " << m_imap->imap_response << "" << oendl; | 1120 | // odebug << "deleting mail: " << m_imap->imap_response << "" << oendl; |
1118 | /* should we realy do that at this moment? */ | 1121 | /* should we realy do that at this moment? */ |
1119 | err = mailimap_expunge(m_imap); | 1122 | err = mailimap_expunge(m_imap); |
1120 | if (err != MAILIMAP_NO_ERROR) { | 1123 | if (err != MAILIMAP_NO_ERROR) { |
1121 | Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response)); | 1124 | Global::statusMessage(tr("error deleting mail: %s").arg(m_imap->imap_response)); |
1122 | return 0; | 1125 | return 0; |
1123 | } | 1126 | } |
1124 | // odebug << "Delete successfull " << m_imap->imap_response << "" << oendl; | 1127 | // odebug << "Delete successfull " << m_imap->imap_response << "" << oendl; |
1125 | return 1; | 1128 | return 1; |
1126 | } | 1129 | } |
1127 | 1130 | ||
1128 | int IMAPwrapper::createMbox(const QString&folder,const FolderP&parentfolder,const QString& delemiter,bool getsubfolder) | 1131 | int IMAPwrapper::createMbox(const QString&folder,const FolderP&parentfolder,const QString& delemiter,bool getsubfolder) |
1129 | { | 1132 | { |
1130 | if (folder.length()==0) return 0; | 1133 | if (folder.length()==0) return 0; |
1131 | login(); | 1134 | login(); |
1132 | if (!m_imap) {return 0;} | 1135 | if (!m_imap) {return 0;} |
1133 | QString pre = account->getPrefix(); | 1136 | QString pre = account->getPrefix(); |
1134 | if (delemiter.length()>0 && pre.findRev(delemiter)!=pre.length()-1) { | 1137 | if (delemiter.length()>0 && pre.findRev(delemiter)!=pre.length()-1) { |
1135 | pre+=delemiter; | 1138 | pre+=delemiter; |
1136 | } | 1139 | } |
1137 | if (parentfolder) { | 1140 | if (parentfolder) { |
1138 | pre += parentfolder->getDisplayName()+delemiter; | 1141 | pre += parentfolder->getDisplayName()+delemiter; |
1139 | } | 1142 | } |
1140 | pre+=folder; | 1143 | pre+=folder; |
1141 | if (getsubfolder) { | 1144 | if (getsubfolder) { |
1142 | if (delemiter.length()>0) { | 1145 | if (delemiter.length()>0) { |
1143 | pre+=delemiter; | 1146 | pre+=delemiter; |
1144 | } else { | 1147 | } else { |
1145 | Global::statusMessage(tr("Cannot create folder %1 for holding subfolders").arg(pre)); | 1148 | Global::statusMessage(tr("Cannot create folder %1 for holding subfolders").arg(pre)); |
1146 | return 0; | 1149 | return 0; |
1147 | } | 1150 | } |
1148 | } | 1151 | } |
1149 | // odebug << "Creating " << pre.latin1() << "" << oendl; | 1152 | // odebug << "Creating " << pre.latin1() << "" << oendl; |
1150 | int res = mailimap_create(m_imap,pre.latin1()); | 1153 | int res = mailimap_create(m_imap,pre.latin1()); |
1151 | if (res != MAILIMAP_NO_ERROR) { | 1154 | if (res != MAILIMAP_NO_ERROR) { |
1152 | Global::statusMessage(tr("%1").arg(m_imap->imap_response)); | 1155 | Global::statusMessage(tr("%1").arg(m_imap->imap_response)); |
1153 | return 0; | 1156 | return 0; |
1154 | } | 1157 | } |
1155 | return 1; | 1158 | return 1; |
1156 | } | 1159 | } |
1157 | 1160 | ||
1158 | int IMAPwrapper::deleteMbox(const FolderP&folder) | 1161 | int IMAPwrapper::deleteMbox(const FolderP&folder) |
1159 | { | 1162 | { |
1160 | if (!folder) return 0; | 1163 | if (!folder) return 0; |
1161 | login(); | 1164 | login(); |
1162 | if (!m_imap) {return 0;} | 1165 | if (!m_imap) {return 0;} |
1163 | int res = mailimap_delete(m_imap,folder->getName()); | 1166 | int res = mailimap_delete(m_imap,folder->getName()); |
1164 | if (res != MAILIMAP_NO_ERROR) { | 1167 | if (res != MAILIMAP_NO_ERROR) { |
1165 | Global::statusMessage(tr("%1").arg(m_imap->imap_response)); | 1168 | Global::statusMessage(tr("%1").arg(m_imap->imap_response)); |
1166 | return 0; | 1169 | return 0; |
1167 | } | 1170 | } |
1168 | return 1; | 1171 | return 1; |
1169 | } | 1172 | } |
1170 | 1173 | ||
1171 | void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) | 1174 | void IMAPwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) |
1172 | { | 1175 | { |
1173 | mailimap_status_att_list * att_list =0; | 1176 | mailimap_status_att_list * att_list =0; |
1174 | mailimap_mailbox_data_status * status=0; | 1177 | mailimap_mailbox_data_status * status=0; |
1175 | clistiter * cur = 0; | 1178 | clistiter * cur = 0; |
1176 | int r = 0; | 1179 | int r = 0; |
1177 | target_stat.message_count = 0; | 1180 | target_stat.message_count = 0; |
1178 | target_stat.message_unseen = 0; | 1181 | target_stat.message_unseen = 0; |
1179 | target_stat.message_recent = 0; | 1182 | target_stat.message_recent = 0; |
1180 | login(); | 1183 | login(); |
1181 | if (!m_imap) { | 1184 | if (!m_imap) { |
1182 | return; | 1185 | return; |
1183 | } | 1186 | } |
1184 | att_list = mailimap_status_att_list_new_empty(); | 1187 | att_list = mailimap_status_att_list_new_empty(); |
1185 | if (!att_list) return; | 1188 | if (!att_list) return; |
1186 | r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_MESSAGES); | 1189 | r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_MESSAGES); |
1187 | r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_RECENT); | 1190 | r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_RECENT); |
1188 | r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_UNSEEN); | 1191 | r = mailimap_status_att_list_add(att_list, MAILIMAP_STATUS_ATT_UNSEEN); |
1189 | r = mailimap_status(m_imap, mailbox.latin1(), att_list, &status); | 1192 | r = mailimap_status(m_imap, mailbox.latin1(), att_list, &status); |
1190 | if (r==MAILIMAP_NO_ERROR&&status->st_info_list!=0) { | 1193 | if (r==MAILIMAP_NO_ERROR&&status->st_info_list!=0) { |
1191 | for (cur = clist_begin(status->st_info_list); | 1194 | for (cur = clist_begin(status->st_info_list); |
1192 | cur != NULL ; cur = clist_next(cur)) { | 1195 | cur != NULL ; cur = clist_next(cur)) { |
1193 | mailimap_status_info * status_info; | 1196 | mailimap_status_info * status_info; |
1194 | status_info = (mailimap_status_info *)clist_content(cur); | 1197 | status_info = (mailimap_status_info *)clist_content(cur); |
1195 | switch (status_info->st_att) { | 1198 | switch (status_info->st_att) { |
1196 | case MAILIMAP_STATUS_ATT_MESSAGES: | 1199 | case MAILIMAP_STATUS_ATT_MESSAGES: |
1197 | target_stat.message_count = status_info->st_value; | 1200 | target_stat.message_count = status_info->st_value; |
1198 | break; | 1201 | break; |
1199 | case MAILIMAP_STATUS_ATT_RECENT: | 1202 | case MAILIMAP_STATUS_ATT_RECENT: |
1200 | target_stat.message_recent = status_info->st_value; | 1203 | target_stat.message_recent = status_info->st_value; |
1201 | break; | 1204 | break; |
1202 | case MAILIMAP_STATUS_ATT_UNSEEN: | 1205 | case MAILIMAP_STATUS_ATT_UNSEEN: |
1203 | target_stat.message_unseen = status_info->st_value; | 1206 | target_stat.message_unseen = status_info->st_value; |
1204 | break; | 1207 | break; |
1205 | } | 1208 | } |
1206 | } | 1209 | } |
1207 | } else { | 1210 | } else { |
1208 | // odebug << "Error retrieving status" << oendl; | 1211 | // odebug << "Error retrieving status" << oendl; |
1209 | } | 1212 | } |
1210 | if (status) mailimap_mailbox_data_status_free(status); | 1213 | if (status) mailimap_mailbox_data_status_free(status); |
1211 | if (att_list) mailimap_status_att_list_free(att_list); | 1214 | if (att_list) mailimap_status_att_list_free(att_list); |
1212 | } | 1215 | } |
1213 | 1216 | ||
1214 | void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folder) | 1217 | void IMAPwrapper::storeMessage(const char*msg,size_t length, const QString&folder) |
1215 | { | 1218 | { |
1216 | login(); | 1219 | login(); |
1217 | if (!m_imap) return; | 1220 | if (!m_imap) return; |
1218 | if (!msg) return; | 1221 | if (!msg) return; |
1219 | int r = mailimap_append(m_imap,(char*)folder.latin1(),0,0,msg,length); | 1222 | int r = mailimap_append(m_imap,(char*)folder.latin1(),0,0,msg,length); |
1220 | if (r != MAILIMAP_NO_ERROR) { | 1223 | if (r != MAILIMAP_NO_ERROR) { |
1221 | Global::statusMessage("Error storing mail!"); | 1224 | Global::statusMessage("Error storing mail!"); |
1222 | } | 1225 | } |
1223 | } | 1226 | } |
1224 | 1227 | ||
1225 | MAILLIB::ATYPE IMAPwrapper::getType()const | 1228 | MAILLIB::ATYPE IMAPwrapper::getType()const |
1226 | { | 1229 | { |
1227 | return account->getType(); | 1230 | return account->getType(); |
1228 | } | 1231 | } |
1229 | 1232 | ||
1230 | const QString&IMAPwrapper::getName()const | 1233 | const QString&IMAPwrapper::getName()const |
1231 | { | 1234 | { |
1232 | // odebug << "Get name: " << account->getAccountName().latin1() << "" << oendl; | 1235 | // odebug << "Get name: " << account->getAccountName().latin1() << "" << oendl; |
1233 | return account->getAccountName(); | 1236 | return account->getAccountName(); |
1234 | } | 1237 | } |
1235 | 1238 | ||
1236 | encodedString* IMAPwrapper::fetchRawBody(const RecMailP&mail) | 1239 | encodedString* IMAPwrapper::fetchRawBody(const RecMailP&mail) |
1237 | { | 1240 | { |
1238 | // dummy | 1241 | // dummy |
1239 | QValueList<int> path; | 1242 | QValueList<int> path; |
1240 | return fetchRawPart(mail,path,false); | 1243 | return fetchRawPart(mail,path,false); |
1241 | } | 1244 | } |
1242 | 1245 | ||
1243 | void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder, | 1246 | void IMAPwrapper::mvcpAllMails(const FolderP&fromFolder, |
1244 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb) | 1247 | const QString&targetFolder,AbstractMail*targetWrapper,bool moveit, int maxSizeInKb) |
1245 | { | 1248 | { |
1246 | if (targetWrapper != this || maxSizeInKb > 0 ) { | 1249 | if (targetWrapper != this || maxSizeInKb > 0 ) { |
1247 | mMax = 0; | 1250 | mMax = 0; |
1248 | progress( tr("Copy")); | 1251 | progress( tr("Copy")); |
1249 | AbstractMail::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit, maxSizeInKb); | 1252 | AbstractMail::mvcpAllMails(fromFolder,targetFolder,targetWrapper,moveit, maxSizeInKb); |
1250 | //qDebug("IMAPwrapper::mvcpAllMails::Using generic"); | 1253 | //qDebug("IMAPwrapper::mvcpAllMails::Using generic"); |
1251 | // odebug << "Using generic" << oendl; | 1254 | // odebug << "Using generic" << oendl; |
1252 | return; | 1255 | return; |
1253 | } | 1256 | } |
1254 | mailimap_set *set = 0; | 1257 | mailimap_set *set = 0; |
1255 | login(); | 1258 | login(); |
1256 | if (!m_imap) { | 1259 | if (!m_imap) { |
1257 | return; | 1260 | return; |
1258 | } | 1261 | } |
1259 | int err = selectMbox(fromFolder->getName()); | 1262 | int err = selectMbox(fromFolder->getName()); |
1260 | if ( err != MAILIMAP_NO_ERROR ) { | 1263 | if ( err != MAILIMAP_NO_ERROR ) { |
1261 | return; | 1264 | return; |
1262 | } | 1265 | } |
1263 | Global::statusMessage( tr("Copying mails on server...") ); | 1266 | Global::statusMessage( tr("Copying mails on server...") ); |
1264 | int last = m_imap->imap_selection_info->sel_exists; | 1267 | int last = m_imap->imap_selection_info->sel_exists; |
1265 | set = mailimap_set_new_interval( 1, last ); | 1268 | set = mailimap_set_new_interval( 1, last ); |
1266 | err = mailimap_copy(m_imap,set,targetFolder.latin1()); | 1269 | err = mailimap_copy(m_imap,set,targetFolder.latin1()); |
1267 | mailimap_set_free( set ); | 1270 | mailimap_set_free( set ); |
1268 | if ( err != MAILIMAP_NO_ERROR ) { | 1271 | if ( err != MAILIMAP_NO_ERROR ) { |
1269 | QString error_msg = tr("Error copy mails: %1").arg(m_imap->imap_response); | 1272 | QString error_msg = tr("Error copy mails: %1").arg(m_imap->imap_response); |
1270 | Global::statusMessage(error_msg); | 1273 | Global::statusMessage(error_msg); |
1271 | // odebug << error_msg << oendl; | 1274 | // odebug << error_msg << oendl; |
1272 | return; | 1275 | return; |
1273 | } | 1276 | } |
1274 | if (moveit) { | 1277 | if (moveit) { |
1275 | deleteAllMail(fromFolder); | 1278 | deleteAllMail(fromFolder); |
1276 | } | 1279 | } |
1277 | } | 1280 | } |
1278 | 1281 | ||
1279 | void IMAPwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) | 1282 | void IMAPwrapper::mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) |
1280 | { | 1283 | { |
1281 | if (targetWrapper != this) { | 1284 | if (targetWrapper != this) { |
1282 | // odebug << "Using generic" << oendl; | 1285 | // odebug << "Using generic" << oendl; |
1283 | AbstractMail::mvcpMail(mail,targetFolder,targetWrapper,moveit); | 1286 | AbstractMail::mvcpMail(mail,targetFolder,targetWrapper,moveit); |
1284 | return; | 1287 | return; |
1285 | } | 1288 | } |
1286 | mailimap_set *set = 0; | 1289 | mailimap_set *set = 0; |
1287 | login(); | 1290 | login(); |
1288 | if (!m_imap) { | 1291 | if (!m_imap) { |
1289 | return; | 1292 | return; |
1290 | } | 1293 | } |
1291 | int err = selectMbox(mail->getMbox()); | 1294 | int err = selectMbox(mail->getMbox()); |
1292 | if ( err != MAILIMAP_NO_ERROR ) { | 1295 | if ( err != MAILIMAP_NO_ERROR ) { |
1293 | return; | 1296 | return; |
1294 | } | 1297 | } |
1295 | set = mailimap_set_new_single(mail->getNumber()); | 1298 | set = mailimap_set_new_single(mail->getNumber()); |
1296 | err = mailimap_copy(m_imap,set,targetFolder.latin1()); | 1299 | err = mailimap_copy(m_imap,set,targetFolder.latin1()); |
1297 | mailimap_set_free( set ); | 1300 | mailimap_set_free( set ); |
1298 | if ( err != MAILIMAP_NO_ERROR ) { | 1301 | if ( err != MAILIMAP_NO_ERROR ) { |
1299 | QString error_msg = tr("error copy mail: %1").arg(m_imap->imap_response); | 1302 | QString error_msg = tr("error copy mail: %1").arg(m_imap->imap_response); |
1300 | Global::statusMessage(error_msg); | 1303 | Global::statusMessage(error_msg); |
1301 | // odebug << error_msg << oendl; | 1304 | // odebug << error_msg << oendl; |
1302 | return; | 1305 | return; |
1303 | } | 1306 | } |
1304 | if (moveit) { | 1307 | if (moveit) { |
1305 | deleteMail(mail); | 1308 | deleteMail(mail); |
1306 | } | 1309 | } |
1307 | } | 1310 | } |
diff --git a/kmicromail/libmailwrapper/pop3wrapper.cpp b/kmicromail/libmailwrapper/pop3wrapper.cpp index 1edec9e..9d52f52 100644 --- a/kmicromail/libmailwrapper/pop3wrapper.cpp +++ b/kmicromail/libmailwrapper/pop3wrapper.cpp | |||
@@ -1,294 +1,302 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | #include <stdlib.h> | 2 | #include <stdlib.h> |
3 | #include "pop3wrapper.h" | 3 | #include "pop3wrapper.h" |
4 | #include "mailtypes.h" | 4 | #include "mailtypes.h" |
5 | #include "logindialog.h" | 5 | #include "logindialog.h" |
6 | #include <libetpan/libetpan.h> | 6 | #include <libetpan/libetpan.h> |
7 | 7 | ||
8 | 8 | ||
9 | #include <qpe/global.h> | 9 | #include <qpe/global.h> |
10 | #include <qfile.h> | 10 | #include <qfile.h> |
11 | #include <qprogressbar.h> | 11 | #include <qprogressbar.h> |
12 | #include <qapplication.h> | 12 | #include <qapplication.h> |
13 | 13 | ||
14 | /* we don't fetch messages larger than 5 MB */ | 14 | /* we don't fetch messages larger than 5 MB */ |
15 | #define HARD_MSG_SIZE_LIMIT 5242880 | 15 | #define HARD_MSG_SIZE_LIMIT 5242880 |
16 | 16 | ||
17 | using namespace Opie::Core; | 17 | using namespace Opie::Core; |
18 | POP3wrapper::POP3wrapper( POP3account *a ) | 18 | POP3wrapper::POP3wrapper( POP3account *a ) |
19 | : Genericwrapper() { | 19 | : Genericwrapper() { |
20 | account = a; | 20 | account = a; |
21 | m_pop3 = NULL; | 21 | m_pop3 = NULL; |
22 | msgTempName = a->getFileName()+"_msg_cache"; | 22 | msgTempName = a->getFileName()+"_msg_cache"; |
23 | last_msg_id = 0; | 23 | last_msg_id = 0; |
24 | } | 24 | } |
25 | 25 | ||
26 | POP3wrapper::~POP3wrapper() { | 26 | POP3wrapper::~POP3wrapper() { |
27 | logout(); | 27 | logout(); |
28 | QFile msg_cache(msgTempName); | 28 | QFile msg_cache(msgTempName); |
29 | if (msg_cache.exists()) { | 29 | if (msg_cache.exists()) { |
30 | msg_cache.remove(); | 30 | msg_cache.remove(); |
31 | } | 31 | } |
32 | } | 32 | } |
33 | 33 | ||
34 | void POP3wrapper::pop3_progress( size_t current, size_t maximum ) { | 34 | void POP3wrapper::pop3_progress( size_t current, size_t maximum ) { |
35 | ; // odebug << "POP3: " << current << " of " << maximum << "" << oendl; | 35 | ; // odebug << "POP3: " << current << " of " << maximum << "" << oendl; |
36 | } | 36 | } |
37 | 37 | ||
38 | RecBodyP POP3wrapper::fetchBody( const RecMailP &mail ) { | 38 | RecBodyP POP3wrapper::fetchBody( const RecMailP &mail ) { |
39 | int err = MAILPOP3_NO_ERROR; | 39 | int err = MAILPOP3_NO_ERROR; |
40 | char *message = 0; | 40 | char *message = 0; |
41 | size_t length = 0; | 41 | size_t length = 0; |
42 | 42 | ||
43 | RecBodyP body = new RecBody(); | 43 | RecBodyP body = new RecBody(); |
44 | 44 | ||
45 | login(); | 45 | login(); |
46 | if ( !m_pop3 ) { | 46 | if ( !m_pop3 ) { |
47 | return body; | 47 | return body; |
48 | } | 48 | } |
49 | 49 | ||
50 | mailmessage * mailmsg; | 50 | mailmessage * mailmsg; |
51 | if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) { | 51 | if (mail->Msgsize()>HARD_MSG_SIZE_LIMIT) { |
52 | ; // odebug << "Message to large: " << mail->Msgsize() << "" << oendl; | 52 | ; // odebug << "Message to large: " << mail->Msgsize() << "" << oendl; |
53 | return body; | 53 | return body; |
54 | } | 54 | } |
55 | 55 | ||
56 | QFile msg_cache(msgTempName); | 56 | QFile msg_cache(msgTempName); |
57 | 57 | ||
58 | cleanMimeCache(); | 58 | cleanMimeCache(); |
59 | 59 | ||
60 | if (mail->getNumber()!=last_msg_id) { | 60 | if (mail->getNumber()!=last_msg_id) { |
61 | if (msg_cache.exists()) { | 61 | if (msg_cache.exists()) { |
62 | msg_cache.remove(); | 62 | msg_cache.remove(); |
63 | } | 63 | } |
64 | msg_cache.open(IO_ReadWrite|IO_Truncate); | 64 | msg_cache.open(IO_ReadWrite|IO_Truncate); |
65 | last_msg_id = mail->getNumber(); | 65 | last_msg_id = mail->getNumber(); |
66 | err = mailsession_get_message(m_pop3->sto_session, mail->getNumber(), &mailmsg); | 66 | err = mailsession_get_message(m_pop3->sto_session, mail->getNumber(), &mailmsg); |
67 | err = mailmessage_fetch(mailmsg,&message,&length); | 67 | err = mailmessage_fetch(mailmsg,&message,&length); |
68 | msg_cache.writeBlock(message,length); | 68 | msg_cache.writeBlock(message,length); |
69 | } else { | 69 | } else { |
70 | QString msg=""; | 70 | QString msg=""; |
71 | msg_cache.open(IO_ReadOnly); | 71 | msg_cache.open(IO_ReadOnly); |
72 | message = new char[4096]; | 72 | message = new char[4096]; |
73 | memset(message,0,4096); | 73 | memset(message,0,4096); |
74 | while (msg_cache.readBlock(message,4095)>0) { | 74 | while (msg_cache.readBlock(message,4095)>0) { |
75 | msg+=message; | 75 | msg+=message; |
76 | memset(message,0,4096); | 76 | memset(message,0,4096); |
77 | } | 77 | } |
78 | delete message; | 78 | delete message; |
79 | message = (char*)malloc(msg.length()+1*sizeof(char)); | 79 | message = (char*)malloc(msg.length()+1*sizeof(char)); |
80 | memset(message,0,msg.length()+1); | 80 | memset(message,0,msg.length()+1); |
81 | memcpy(message,msg.latin1(),msg.length()); | 81 | memcpy(message,msg.latin1(),msg.length()); |
82 | /* transform to libetpan stuff */ | 82 | /* transform to libetpan stuff */ |
83 | mailmsg = mailmessage_new(); | 83 | mailmsg = mailmessage_new(); |
84 | mailmessage_init(mailmsg, NULL, data_message_driver, 0, strlen(message)); | 84 | mailmessage_init(mailmsg, NULL, data_message_driver, 0, strlen(message)); |
85 | generic_message_t * msg_data; | 85 | generic_message_t * msg_data; |
86 | msg_data = (generic_message_t *)mailmsg->msg_data; | 86 | msg_data = (generic_message_t *)mailmsg->msg_data; |
87 | msg_data->msg_fetched = 1; | 87 | msg_data->msg_fetched = 1; |
88 | msg_data->msg_message = message; | 88 | msg_data->msg_message = message; |
89 | msg_data->msg_length = strlen(message); | 89 | msg_data->msg_length = strlen(message); |
90 | } | 90 | } |
91 | body = parseMail(mailmsg); | 91 | body = parseMail(mailmsg); |
92 | 92 | ||
93 | /* clean up */ | 93 | /* clean up */ |
94 | if (mailmsg) | 94 | if (mailmsg) |
95 | mailmessage_free(mailmsg); | 95 | mailmessage_free(mailmsg); |
96 | if (message) | 96 | if (message) |
97 | free(message); | 97 | free(message); |
98 | 98 | ||
99 | return body; | 99 | return body; |
100 | } | 100 | } |
101 | 101 | ||
102 | void POP3wrapper::listMessages(const QString &, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb ) | 102 | void POP3wrapper::listMessages(const QString &, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb ) |
103 | { | 103 | { |
104 | login(); | 104 | login(); |
105 | if (!m_pop3) | 105 | if (!m_pop3) |
106 | return; | 106 | return; |
107 | uint32_t res_messages,res_recent,res_unseen; | 107 | uint32_t res_messages,res_recent,res_unseen; |
108 | mailsession_status_folder(m_pop3->sto_session,"INBOX",&res_messages,&res_recent,&res_unseen); | 108 | mailsession_status_folder(m_pop3->sto_session,"INBOX",&res_messages,&res_recent,&res_unseen); |
109 | parseList(target,m_pop3->sto_session,"INBOX", false, maxSizeInKb); | 109 | parseList(target,m_pop3->sto_session,"INBOX", false, maxSizeInKb); |
110 | Global::statusMessage( tr("Mailbox contains %1 mail(s)").arg(res_messages)); | 110 | Global::statusMessage( tr("Mailbox contains %1 mail(s)").arg(res_messages)); |
111 | } | 111 | } |
112 | 112 | ||
113 | void POP3wrapper::login() | 113 | void POP3wrapper::login() |
114 | { | 114 | { |
115 | if (account->getOffline()) | 115 | if (account->getOffline()) |
116 | return; | 116 | return; |
117 | /* we'll hold the line */ | 117 | /* we'll hold the line */ |
118 | if ( m_pop3 != NULL ) | 118 | if ( m_pop3 != NULL ) |
119 | return; | 119 | return; |
120 | 120 | ||
121 | QString server,user, pass; | 121 | QString server,user, pass; |
122 | uint16_t port; | 122 | uint16_t port; |
123 | int err = MAILPOP3_NO_ERROR; | 123 | int err = MAILPOP3_NO_ERROR; |
124 | 124 | ||
125 | server = account->getServer(); | 125 | server = account->getServer(); |
126 | port = account->getPort().toUInt(); | 126 | port = account->getPort().toUInt(); |
127 | 127 | ||
128 | if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { | 128 | if ( account->getUser().isEmpty() || account->getPassword().isEmpty() ) { |
129 | qApp->processEvents(); | 129 | qApp->processEvents(); |
130 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); | 130 | LoginDialog login( account->getUser(), account->getPassword(), NULL, 0, true ); |
131 | login.show(); | 131 | login.show(); |
132 | if ( QDialog::Accepted == login.exec() ) { | 132 | if ( QDialog::Accepted == login.exec() ) { |
133 | // ok | 133 | // ok |
134 | user = login.getUser(); | 134 | user = login.getUser(); |
135 | pass = login.getPassword(); | 135 | pass = login.getPassword(); |
136 | } else { | 136 | } else { |
137 | // cancel | 137 | // cancel |
138 | ; // odebug << "POP3: Login canceled" << oendl; | 138 | ; // odebug << "POP3: Login canceled" << oendl; |
139 | return; | 139 | return; |
140 | } | 140 | } |
141 | } else { | 141 | } else { |
142 | user = account->getUser(); | 142 | user = account->getUser(); |
143 | pass = account->getPassword(); | 143 | pass = account->getPassword(); |
144 | } | 144 | } |
145 | // bool ssl = account->getSSL(); | 145 | // bool ssl = account->getSSL(); |
146 | 146 | ||
147 | m_pop3=mailstorage_new(NULL); | 147 | m_pop3=mailstorage_new(NULL); |
148 | int conntypeset = account->ConnectionType(); | 148 | int conntypeset = account->ConnectionType(); |
149 | int conntype = 0; | 149 | int conntype = 0; |
150 | if ( conntypeset == 3 ) { | 150 | if ( conntypeset == 3 ) { |
151 | conntype = CONNECTION_TYPE_COMMAND; | 151 | conntype = CONNECTION_TYPE_COMMAND; |
152 | } else if ( conntypeset == 2 ) { | 152 | } else if ( conntypeset == 2 ) { |
153 | conntype = CONNECTION_TYPE_TLS; | 153 | conntype = CONNECTION_TYPE_TLS; |
154 | } else if ( conntypeset == 1 ) { | 154 | } else if ( conntypeset == 1 ) { |
155 | conntype = CONNECTION_TYPE_STARTTLS; | 155 | conntype = CONNECTION_TYPE_STARTTLS; |
156 | } else if ( conntypeset == 0 ) { | 156 | } else if ( conntypeset == 0 ) { |
157 | conntype = CONNECTION_TYPE_TRY_STARTTLS; | 157 | conntype = CONNECTION_TYPE_TRY_STARTTLS; |
158 | } | 158 | } |
159 | 159 | ||
160 | //(ssl?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN); | 160 | //(ssl?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN); |
161 | 161 | ||
162 | pop3_mailstorage_init(m_pop3,(char*)server.latin1(), port, NULL, conntype, POP3_AUTH_TYPE_PLAIN, | 162 | pop3_mailstorage_init(m_pop3,(char*)server.latin1(), port, NULL, conntype, POP3_AUTH_TYPE_PLAIN, |
163 | (char*)user.latin1(),(char*)pass.latin1(),0,0,0); | 163 | (char*)user.latin1(),(char*)pass.latin1(),0,0,0); |
164 | 164 | ||
165 | err = mailstorage_connect(m_pop3); | 165 | err = mailstorage_connect(m_pop3); |
166 | if (err != MAIL_NO_ERROR) { | 166 | if (err != MAIL_NO_ERROR) { |
167 | ; // odebug << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl; | 167 | ; // odebug << QString( "FEHLERNUMMER %1" ).arg( err ) << oendl; |
168 | Global::statusMessage(tr("Error %1 initializing folder").arg( err )); | 168 | Global::statusMessage(tr("Error %1 initializing folder").arg( err )); |
169 | mailstorage_free(m_pop3); | 169 | mailstorage_free(m_pop3); |
170 | m_pop3 = 0; | 170 | m_pop3 = 0; |
171 | } else { | 171 | } else { |
172 | mailsession * session = m_pop3->sto_session; | 172 | mailsession * session = m_pop3->sto_session; |
173 | mailpop3 * mail = ( ( pop3_session_state_data * )session->sess_data )->pop3_session; | 173 | mailpop3 * mail = ( ( pop3_session_state_data * )session->sess_data )->pop3_session; |
174 | if (mail) { | 174 | if (mail) { |
175 | mail->pop3_progr_fun = &pop3_progress; | 175 | mail->pop3_progr_fun = &pop3_progress; |
176 | } | 176 | } |
177 | } | 177 | } |
178 | } | 178 | } |
179 | 179 | ||
180 | void POP3wrapper::logout() | 180 | void POP3wrapper::logout() |
181 | { | 181 | { |
182 | if ( m_pop3 == NULL ) | 182 | if ( m_pop3 == NULL ) |
183 | return; | 183 | return; |
184 | mailstorage_free(m_pop3); | 184 | mailstorage_free(m_pop3); |
185 | m_pop3 = 0; | 185 | m_pop3 = 0; |
186 | } | 186 | } |
187 | 187 | ||
188 | 188 | ||
189 | QValueList<Opie::Core::OSmartPointer<Folder> >* POP3wrapper::listFolders() { | 189 | QValueList<Opie::Core::OSmartPointer<Folder> >* POP3wrapper::listFolders() { |
190 | QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<FolderP>(); | 190 | QValueList<Opie::Core::OSmartPointer<Folder> >* folders = new QValueList<FolderP>(); |
191 | FolderP inb=new Folder("INBOX","/"); | 191 | FolderP inb=new Folder("INBOX","/"); |
192 | folders->append(inb); | 192 | folders->append(inb); |
193 | return folders; | 193 | return folders; |
194 | } | 194 | } |
195 | 195 | ||
196 | void POP3wrapper::deleteMailList(const QValueList<RecMailP>&target) | 196 | void POP3wrapper::deleteMailList(const QValueList<RecMailP>&target) |
197 | { | 197 | { |
198 | login(); | 198 | login(); |
199 | if (!m_pop3) | 199 | if (!m_pop3) |
200 | return; | 200 | return; |
201 | int iii = 0; | 201 | int iii = 0; |
202 | int count = target.count(); | 202 | int count = target.count(); |
203 | QWidget wid; | 203 | |
204 | QProgressBar wid ( count ); | ||
205 | wid.setCaption( tr("Deleting ...")); | ||
204 | wid.show(); | 206 | wid.show(); |
205 | while (iii < count ) { | 207 | while (iii < count ) { |
206 | Global::statusMessage(tr("Delete message %1 of %2").arg(iii).arg(count)); | 208 | Global::statusMessage(tr("Delete message %1 of %2").arg(iii).arg(count)); |
209 | wid.setProgress( iii ); | ||
207 | wid.raise(); | 210 | wid.raise(); |
208 | qApp->processEvents(); | 211 | qApp->processEvents(); |
209 | //qDebug("delete "); | 212 | //qDebug("delete "); |
210 | RecMailP mail = (*target.at( iii )); | 213 | RecMailP mail = (*target.at( iii )); |
211 | int err = mailsession_remove_message(m_pop3->sto_session,mail->getNumber()); | 214 | int err = mailsession_remove_message(m_pop3->sto_session,mail->getNumber()); |
212 | if (err != MAIL_NO_ERROR) { | 215 | if (err != MAIL_NO_ERROR) { |
213 | Global::statusMessage(tr("Error deleting mail")); | 216 | Global::statusMessage(tr("Error deleting mail")); |
214 | } | 217 | } |
215 | ++iii; | 218 | ++iii; |
216 | } | 219 | } |
217 | } | 220 | } |
218 | void POP3wrapper::deleteMail(const RecMailP&mail) { | 221 | void POP3wrapper::deleteMail(const RecMailP&mail) { |
219 | login(); | 222 | login(); |
220 | if (!m_pop3) | 223 | if (!m_pop3) |
221 | return; | 224 | return; |
222 | int err = mailsession_remove_message(m_pop3->sto_session,mail->getNumber()); | 225 | int err = mailsession_remove_message(m_pop3->sto_session,mail->getNumber()); |
223 | if (err != MAIL_NO_ERROR) { | 226 | if (err != MAIL_NO_ERROR) { |
224 | Global::statusMessage(tr("error deleting mail")); | 227 | Global::statusMessage(tr("error deleting mail")); |
225 | } | 228 | } |
226 | } | 229 | } |
227 | 230 | ||
228 | void POP3wrapper::answeredMail(const RecMailP&) {} | 231 | void POP3wrapper::answeredMail(const RecMailP&) {} |
229 | 232 | ||
230 | int POP3wrapper::deleteAllMail(const FolderP&) { | 233 | int POP3wrapper::deleteAllMail(const FolderP&) { |
231 | login(); | 234 | login(); |
232 | if (!m_pop3) | 235 | if (!m_pop3) |
233 | return 0; | 236 | return 0; |
234 | int res = 1; | 237 | int res = 1; |
235 | 238 | ||
236 | uint32_t result = 0; | 239 | uint32_t result = 0; |
237 | int err = mailsession_messages_number(m_pop3->sto_session,NULL,&result); | 240 | int err = mailsession_messages_number(m_pop3->sto_session,NULL,&result); |
238 | if (err != MAIL_NO_ERROR) { | 241 | if (err != MAIL_NO_ERROR) { |
239 | Global::statusMessage(tr("Error getting folder info")); | 242 | Global::statusMessage(tr("Error getting folder info")); |
240 | return 0; | 243 | return 0; |
241 | } | 244 | } |
242 | QWidget wid; | 245 | |
246 | |||
247 | |||
248 | QProgressBar wid ( result ); | ||
249 | wid.setCaption( tr("Deleting ...")); | ||
243 | wid.show(); | 250 | wid.show(); |
244 | for (unsigned int i = 0; i < result; ++i) { | 251 | for (unsigned int i = 0; i < result; ++i) { |
245 | Global::statusMessage(tr("Delete message %1 of %2").arg(i).arg(result)); | 252 | Global::statusMessage(tr("Delete message %1 of %2").arg(i).arg(result)); |
253 | wid.setProgress( i ); | ||
246 | wid.raise(); | 254 | wid.raise(); |
247 | qApp->processEvents(); | 255 | qApp->processEvents(); |
248 | 256 | ||
249 | err = mailsession_remove_message(m_pop3->sto_session,i+1); | 257 | err = mailsession_remove_message(m_pop3->sto_session,i+1); |
250 | if (err != MAIL_NO_ERROR) { | 258 | if (err != MAIL_NO_ERROR) { |
251 | Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); | 259 | Global::statusMessage(tr("Error deleting mail %1").arg(i+1)); |
252 | res=0; | 260 | res=0; |
253 | } | 261 | } |
254 | break; | 262 | break; |
255 | } | 263 | } |
256 | return res; | 264 | return res; |
257 | } | 265 | } |
258 | 266 | ||
259 | void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) { | 267 | void POP3wrapper::statusFolder(folderStat&target_stat,const QString&) { |
260 | login(); | 268 | login(); |
261 | target_stat.message_count = 0; | 269 | target_stat.message_count = 0; |
262 | target_stat.message_unseen = 0; | 270 | target_stat.message_unseen = 0; |
263 | target_stat.message_recent = 0; | 271 | target_stat.message_recent = 0; |
264 | if (!m_pop3) | 272 | if (!m_pop3) |
265 | return; | 273 | return; |
266 | int r = mailsession_status_folder(m_pop3->sto_session,0,&target_stat.message_count, | 274 | int r = mailsession_status_folder(m_pop3->sto_session,0,&target_stat.message_count, |
267 | &target_stat.message_recent,&target_stat.message_unseen); | 275 | &target_stat.message_recent,&target_stat.message_unseen); |
268 | if (r != MAIL_NO_ERROR) { | 276 | if (r != MAIL_NO_ERROR) { |
269 | ; // odebug << "error getting folter status." << oendl; | 277 | ; // odebug << "error getting folter status." << oendl; |
270 | } | 278 | } |
271 | } | 279 | } |
272 | 280 | ||
273 | encodedString* POP3wrapper::fetchRawBody(const RecMailP&mail) { | 281 | encodedString* POP3wrapper::fetchRawBody(const RecMailP&mail) { |
274 | char*target=0; | 282 | char*target=0; |
275 | size_t length=0; | 283 | size_t length=0; |
276 | encodedString*res = 0; | 284 | encodedString*res = 0; |
277 | mailmessage * mailmsg = 0; | 285 | mailmessage * mailmsg = 0; |
278 | int err = mailsession_get_message(m_pop3->sto_session, mail->getNumber(), &mailmsg); | 286 | int err = mailsession_get_message(m_pop3->sto_session, mail->getNumber(), &mailmsg); |
279 | err = mailmessage_fetch(mailmsg,&target,&length); | 287 | err = mailmessage_fetch(mailmsg,&target,&length); |
280 | if (mailmsg) | 288 | if (mailmsg) |
281 | mailmessage_free(mailmsg); | 289 | mailmessage_free(mailmsg); |
282 | if (target) { | 290 | if (target) { |
283 | res = new encodedString(target,length); | 291 | res = new encodedString(target,length); |
284 | } | 292 | } |
285 | return res; | 293 | return res; |
286 | } | 294 | } |
287 | 295 | ||
288 | MAILLIB::ATYPE POP3wrapper::getType()const { | 296 | MAILLIB::ATYPE POP3wrapper::getType()const { |
289 | return account->getType(); | 297 | return account->getType(); |
290 | } | 298 | } |
291 | 299 | ||
292 | const QString&POP3wrapper::getName()const{ | 300 | const QString&POP3wrapper::getName()const{ |
293 | return account->getAccountName(); | 301 | return account->getAccountName(); |
294 | } | 302 | } |
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp index 5f777a3..d130317 100644 --- a/kmicromail/mainwindow.cpp +++ b/kmicromail/mainwindow.cpp | |||
@@ -1,297 +1,298 @@ | |||
1 | 1 | ||
2 | // CHANGED 2004-08-06 Lutz Rogowski | 2 | // CHANGED 2004-08-06 Lutz Rogowski |
3 | #include <qlabel.h> | 3 | #include <qlabel.h> |
4 | #include <qvbox.h> | 4 | #include <qvbox.h> |
5 | #include <qheader.h> | 5 | #include <qheader.h> |
6 | #include <qtimer.h> | 6 | #include <qtimer.h> |
7 | #include <qlayout.h> | 7 | #include <qlayout.h> |
8 | #include <kdialog.h> | 8 | #include <kdialog.h> |
9 | #include <kiconloader.h> | 9 | #include <kiconloader.h> |
10 | #include <kapplication.h> | 10 | #include <kapplication.h> |
11 | 11 | ||
12 | #ifndef DESKTOP_VERSION | 12 | #ifndef DESKTOP_VERSION |
13 | #include <qpe/qpeapplication.h> | 13 | #include <qpe/qpeapplication.h> |
14 | #endif | 14 | #endif |
15 | #include "defines.h" | 15 | #include "defines.h" |
16 | #include "mainwindow.h" | 16 | #include "mainwindow.h" |
17 | #include <KDGanttMinimizeSplitter.h> | 17 | #include <KDGanttMinimizeSplitter.h> |
18 | 18 | ||
19 | 19 | ||
20 | #include <kabc/stdaddressbook.h> | 20 | #include <kabc/stdaddressbook.h> |
21 | 21 | ||
22 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | 22 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) |
23 | : QMainWindow( parent, name ) //, flags ) | 23 | : QMainWindow( parent, name ) //, flags ) |
24 | { | 24 | { |
25 | setCaption( tr( "KOpieMail/Pi" ) ); | 25 | setCaption( tr( "KOpieMail/Pi" ) ); |
26 | setToolBarsMovable( false ); | 26 | setToolBarsMovable( false ); |
27 | //KABC::StdAddressBook::self(); | 27 | //KABC::StdAddressBook::self(); |
28 | toolBar = new QToolBar( this ); | 28 | toolBar = new QToolBar( this ); |
29 | menuBar = new QPEMenuBar( toolBar ); | 29 | menuBar = new QPEMenuBar( toolBar ); |
30 | mailMenu = new QPopupMenu( menuBar ); | 30 | mailMenu = new QPopupMenu( menuBar ); |
31 | menuBar->insertItem( tr( "Mail" ), mailMenu ); | 31 | menuBar->insertItem( tr( "Mail" ), mailMenu ); |
32 | settingsMenu = new QPopupMenu( menuBar ); | 32 | settingsMenu = new QPopupMenu( menuBar ); |
33 | menuBar->insertItem( tr( "Settings" ), settingsMenu ); | 33 | menuBar->insertItem( tr( "Settings" ), settingsMenu ); |
34 | 34 | ||
35 | addToolBar( toolBar ); | 35 | addToolBar( toolBar ); |
36 | toolBar->setHorizontalStretchable( true ); | 36 | toolBar->setHorizontalStretchable( true ); |
37 | 37 | ||
38 | QAction* getMail = new QAction( tr( "Get new mail" ), SmallIcon("add"), | 38 | QAction* getMail = new QAction( tr( "Get new mail" ), SmallIcon("add"), |
39 | 0, 0, this ); | 39 | 0, 0, this ); |
40 | getMail->addTo( toolBar ); | 40 | getMail->addTo( toolBar ); |
41 | getMail->addTo( mailMenu ); | 41 | getMail->addTo( mailMenu ); |
42 | connect(getMail, SIGNAL( activated() ), | 42 | connect(getMail, SIGNAL( activated() ), |
43 | SLOT( slotGetMail() ) ); | 43 | SLOT( slotGetMail() ) ); |
44 | 44 | ||
45 | composeMail = new QAction( tr( "Compose new mail" ), SmallIcon("composemail"), | 45 | composeMail = new QAction( tr( "Compose new mail" ), SmallIcon("composemail"), |
46 | 0, 0, this ); | 46 | 0, 0, this ); |
47 | composeMail->addTo( toolBar ); | 47 | composeMail->addTo( toolBar ); |
48 | composeMail->addTo( mailMenu ); | 48 | composeMail->addTo( mailMenu ); |
49 | 49 | ||
50 | sendQueued = new QAction( tr( "Send queued mails" ), SmallIcon("sendqueued") , | 50 | sendQueued = new QAction( tr( "Send queued mails" ), SmallIcon("sendqueued") , |
51 | 0, 0, this ); | 51 | 0, 0, this ); |
52 | sendQueued->addTo( toolBar ); | 52 | sendQueued->addTo( toolBar ); |
53 | sendQueued->addTo( mailMenu ); | 53 | sendQueued->addTo( mailMenu ); |
54 | 54 | ||
55 | /* | 55 | /* |
56 | syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, | 56 | syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, |
57 | 0, 0, this ); | 57 | 0, 0, this ); |
58 | syncFolders->addTo( toolBar ); | 58 | syncFolders->addTo( toolBar ); |
59 | syncFolders->addTo( mailMenu ); | 59 | syncFolders->addTo( mailMenu ); |
60 | */ | 60 | */ |
61 | 61 | ||
62 | showFolders = new QAction( tr( "Show/Hide folders" ), SmallIcon("showfolders") , | 62 | showFolders = new QAction( tr( "Show/Hide folders" ), SmallIcon("showfolders") , |
63 | 0, 0, this, 0, true ); | 63 | 0, 0, this, 0, true ); |
64 | showFolders->addTo( toolBar ); | 64 | showFolders->addTo( toolBar ); |
65 | showFolders->addTo( mailMenu ); | 65 | showFolders->addTo( mailMenu ); |
66 | showFolders->setOn( true ); | 66 | showFolders->setOn( true ); |
67 | connect(showFolders, SIGNAL( toggled(bool) ), | 67 | connect(showFolders, SIGNAL( toggled(bool) ), |
68 | SLOT( slotShowFolders(bool) ) ); | 68 | SLOT( slotShowFolders(bool) ) ); |
69 | 69 | ||
70 | /* | 70 | /* |
71 | searchMails = new QAction( tr( "Search mails" ), SmallIcon("find") ), | 71 | searchMails = new QAction( tr( "Search mails" ), SmallIcon("find") ), |
72 | 0, 0, this ); | 72 | 0, 0, this ); |
73 | searchMails->addTo( toolBar ); | 73 | searchMails->addTo( toolBar ); |
74 | searchMails->addTo( mailMenu ); | 74 | searchMails->addTo( mailMenu ); |
75 | */ | 75 | */ |
76 | 76 | ||
77 | deleteMails = new QAction(tr("Delete Mail"), SmallIcon("trash"), 0, 0, this); | 77 | deleteMails = new QAction(tr("Delete Mail"), SmallIcon("trash"), 0, 0, this); |
78 | deleteMails->addTo( toolBar ); | 78 | deleteMails->addTo( toolBar ); |
79 | deleteMails->addTo( mailMenu ); | 79 | deleteMails->addTo( mailMenu ); |
80 | connect( deleteMails, SIGNAL( activated() ), | 80 | connect( deleteMails, SIGNAL( activated() ), |
81 | SLOT( slotDeleteMail() ) ); | 81 | SLOT( slotDeleteMail() ) ); |
82 | 82 | ||
83 | editSettings = new QAction( tr( "Edit settings" ), SmallIcon("SettingsIcon") , | 83 | editSettings = new QAction( tr( "Edit settings" ), SmallIcon("SettingsIcon") , |
84 | 0, 0, this ); | 84 | 0, 0, this ); |
85 | editSettings->addTo( settingsMenu ); | 85 | editSettings->addTo( settingsMenu ); |
86 | connect( editSettings, SIGNAL( activated() ), | 86 | connect( editSettings, SIGNAL( activated() ), |
87 | SLOT( slotEditSettings() ) ); | 87 | SLOT( slotEditSettings() ) ); |
88 | editAccounts = new QAction( tr( "Configure accounts" ), SmallIcon("editaccounts") , | 88 | editAccounts = new QAction( tr( "Configure accounts" ), SmallIcon("editaccounts") , |
89 | 0, 0, this ); | 89 | 0, 0, this ); |
90 | editAccounts->addTo( settingsMenu ); | 90 | editAccounts->addTo( settingsMenu ); |
91 | 91 | ||
92 | //setCentralWidget( view ); | 92 | //setCentralWidget( view ); |
93 | 93 | ||
94 | QVBox* wrapperBox = new QVBox( this ); | 94 | QVBox* wrapperBox = new QVBox( this ); |
95 | setCentralWidget( wrapperBox ); | 95 | setCentralWidget( wrapperBox ); |
96 | 96 | ||
97 | // QWidget *view = new QWidget( wrapperBox ); | 97 | // QWidget *view = new QWidget( wrapperBox ); |
98 | KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox); | 98 | KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox); |
99 | split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); | 99 | split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); |
100 | //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); | 100 | //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); |
101 | 101 | ||
102 | folderView = new AccountView( split ); | 102 | folderView = new AccountView( split ); |
103 | folderView->header()->hide(); | 103 | folderView->header()->hide(); |
104 | folderView->setRootIsDecorated( false ); | 104 | folderView->setRootIsDecorated( false ); |
105 | folderView->addColumn( tr( "Mailbox" ) ); | 105 | folderView->addColumn( tr( "Mailbox" ) ); |
106 | 106 | ||
107 | //layout->addWidget( folderView ); | 107 | //layout->addWidget( folderView ); |
108 | 108 | ||
109 | mailView = new QListView( split ); | 109 | mailView = new QListView( split ); |
110 | mailView->addColumn( tr( " " ) ); | 110 | mailView->addColumn( tr( " " ) ); |
111 | mailView->addColumn( tr( "Subject" ),QListView::Manual ); | 111 | mailView->addColumn( tr( "Subject" ),QListView::Manual ); |
112 | mailView->addColumn( tr( "Sender" ),QListView::Manual ); | 112 | mailView->addColumn( tr( "Sender" ),QListView::Manual ); |
113 | mailView->addColumn( tr( "Size" ),QListView::Manual); | 113 | mailView->addColumn( tr( "Size" ),QListView::Manual); |
114 | mailView->addColumn( tr( "Date" ),QListView::Manual); | 114 | mailView->addColumn( tr( "Date" ),QListView::Manual); |
115 | mailView->setAllColumnsShowFocus(true); | 115 | mailView->setAllColumnsShowFocus(true); |
116 | //mailView->setSorting(-1); | 116 | //mailView->setSorting(-1); |
117 | mailView->setRootIsDecorated( false ); | 117 | mailView->setRootIsDecorated( false ); |
118 | statusWidget = new StatusWidget( wrapperBox ); | 118 | statusWidget = new StatusWidget( wrapperBox ); |
119 | statusWidget->hide(); | 119 | statusWidget->hide(); |
120 | 120 | ||
121 | //layout->addWidget( mailView ); | 121 | //layout->addWidget( mailView ); |
122 | //layout->setStretchFactor( folderView, 1 ); | 122 | //layout->setStretchFactor( folderView, 1 ); |
123 | //layout->setStretchFactor( mailView, 2 ); | 123 | //layout->setStretchFactor( mailView, 2 ); |
124 | 124 | ||
125 | slotAdjustLayout(); | 125 | slotAdjustLayout(); |
126 | #ifndef DESKTOP_VERSION | 126 | #ifndef DESKTOP_VERSION |
127 | QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); | 127 | QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); |
128 | QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); | 128 | QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); |
129 | #endif | 129 | #endif |
130 | connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, | 130 | connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, |
131 | SLOT( mailLeftClicked(QListViewItem*) ) ); | 131 | SLOT( mailLeftClicked(QListViewItem*) ) ); |
132 | connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, | 132 | connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, |
133 | SLOT( mailLeftClicked(QListViewItem*) ) ); | 133 | SLOT( mailLeftClicked(QListViewItem*) ) ); |
134 | connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, | 134 | connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, |
135 | SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); | 135 | SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); |
136 | connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), | 136 | connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), |
137 | this,SLOT(refreshMailView(const QValueList<RecMailP>&))); | 137 | this,SLOT(refreshMailView(const QValueList<RecMailP>&))); |
138 | connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); | 138 | connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); |
139 | connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); | 139 | connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); |
140 | // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); | 140 | // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); |
141 | connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); | 141 | connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); |
142 | //mailView->setMultiSelection ( true ); | 142 | //mailView->setMultiSelection ( true ); |
143 | mailView->setSelectionMode( QListView::Extended ); | 143 | mailView->setSelectionMode( QListView::Extended ); |
144 | QValueList<int> list; | 144 | QValueList<int> list; |
145 | int fw = 100; | 145 | int fw = 100; |
146 | if ( QApplication::desktop()->width() > 320 ) | 146 | if ( QApplication::desktop()->width() > 320 ) |
147 | fw = 50; | 147 | fw = 50; |
148 | list.append( fw ); | 148 | list.append( fw ); |
149 | list.append( 100 ); | 149 | list.append( 100 ); |
150 | split->setSizes( list ); | 150 | split->setSizes( list ); |
151 | QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); | 151 | QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); |
152 | mailView->setShowSortIndicator ( true ); | 152 | mailView->setShowSortIndicator ( true ); |
153 | QLabel *spacer = new QLabel( toolBar ); | 153 | QLabel *spacer = new QLabel( toolBar ); |
154 | spacer->setBackgroundMode( QWidget::PaletteButton ); | 154 | spacer->setBackgroundMode( QWidget::PaletteButton ); |
155 | toolBar->setStretchableWidget( spacer ); | 155 | toolBar->setStretchableWidget( spacer ); |
156 | 156 | ||
157 | QAction* closeMail = new QAction(tr("Close"),SmallIcon("exit"), 0, 0, this); | 157 | QAction* closeMail = new QAction(tr("Close"),SmallIcon("exit"), 0, 0, this); |
158 | connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); | 158 | connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); |
159 | closeMail->addTo(toolBar); | 159 | if ( QApplication::desktop()->width() > 320 ) |
160 | closeMail->addTo(toolBar); | ||
160 | closeMail->addTo(mailMenu); | 161 | closeMail->addTo(mailMenu); |
161 | 162 | ||
162 | 163 | ||
163 | QPopupMenu* helpMenu = new QPopupMenu( menuBar ); | 164 | QPopupMenu* helpMenu = new QPopupMenu( menuBar ); |
164 | menuBar->insertItem( tr( "Help" ), helpMenu ); | 165 | menuBar->insertItem( tr( "Help" ), helpMenu ); |
165 | QAction* li = new QAction(tr("About"), QPixmap(), 0, 0, this); | 166 | QAction* li = new QAction(tr("About"), QPixmap(), 0, 0, this); |
166 | connect( li, SIGNAL( activated() ), SLOT( showAbout()) ); | 167 | connect( li, SIGNAL( activated() ), SLOT( showAbout()) ); |
167 | li->addTo(helpMenu); | 168 | li->addTo(helpMenu); |
168 | li = new QAction(tr("Licence"),QPixmap(), 0, 0, this); | 169 | li = new QAction(tr("Licence"),QPixmap(), 0, 0, this); |
169 | connect( li, SIGNAL( activated() ), SLOT( showLicence()) ); | 170 | connect( li, SIGNAL( activated() ), SLOT( showLicence()) ); |
170 | li->addTo(helpMenu); | 171 | li->addTo(helpMenu); |
171 | li = new QAction(tr("LibEtPan Licence"), QPixmap(), 0, 0, this); | 172 | li = new QAction(tr("LibEtPan Licence"), QPixmap(), 0, 0, this); |
172 | connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) ); | 173 | connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) ); |
173 | li->addTo(helpMenu); | 174 | li->addTo(helpMenu); |
174 | } | 175 | } |
175 | 176 | ||
176 | MainWindow::~MainWindow() | 177 | MainWindow::~MainWindow() |
177 | { | 178 | { |
178 | } | 179 | } |
179 | 180 | ||
180 | void MainWindow::showLicence() | 181 | void MainWindow::showLicence() |
181 | { | 182 | { |
182 | KApplication::showLicence(); | 183 | KApplication::showLicence(); |
183 | } | 184 | } |
184 | void MainWindow::showAbout() | 185 | void MainWindow::showAbout() |
185 | { | 186 | { |
186 | QString version; | 187 | QString version; |
187 | #include <../version> | 188 | #include <../version> |
188 | 189 | ||
189 | QString cap = "About KOpieMail/Pi"; | 190 | QString cap = "About KOpieMail/Pi"; |
190 | QString text =i18n("KOpieMail/Platform-independent\n") + | 191 | QString text =i18n("KOpieMail/Platform-independent\n") + |
191 | "(OM/Pi) " + version + " - " | 192 | "(OM/Pi) " + version + " - " |
192 | 193 | ||
193 | #ifdef DESKTOP_VERSION | 194 | #ifdef DESKTOP_VERSION |
194 | "Desktop Edition\n" | 195 | "Desktop Edition\n" |
195 | #else | 196 | #else |
196 | "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n" | 197 | "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n" |
197 | #endif | 198 | #endif |
198 | "www.pi-sync.net\n\n" | 199 | "www.pi-sync.net\n\n" |
199 | 200 | ||
200 | 201 | ||
201 | 202 | ||
202 | "Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.net>\n" | 203 | "Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.net>\n" |
203 | "KOpieMail/Pi is based on Opie Mail\n" | 204 | "KOpieMail/Pi is based on Opie Mail\n" |
204 | "Copyright (c) Rajko Albrecht and the Opie team\n" | 205 | "Copyright (c) Rajko Albrecht and the Opie team\n" |
205 | "KOpieMail/Pi is licensed under the GPL\n" | 206 | "KOpieMail/Pi is licensed under the GPL\n" |
206 | "\n" | 207 | "\n" |
207 | "KOpieMail/Pi uses LibEtPan - a mail stuff library\n" | 208 | "KOpieMail/Pi uses LibEtPan - a mail stuff library\n" |
208 | "Copyright (C) 2001, 2002 - DINH Viet Hoa\n" | 209 | "Copyright (C) 2001, 2002 - DINH Viet Hoa\n" |
209 | "libEtPan has its own licence - see LibEtPan licence\n"; | 210 | "libEtPan has its own licence - see LibEtPan licence\n"; |
210 | 211 | ||
211 | KApplication::showText( cap, text ); | 212 | KApplication::showText( cap, text ); |
212 | } | 213 | } |
213 | void MainWindow::showEtpanLicence() | 214 | void MainWindow::showEtpanLicence() |
214 | { | 215 | { |
215 | KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" ); | 216 | KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" ); |
216 | 217 | ||
217 | } | 218 | } |
218 | void MainWindow::appMessage(const QCString &, const QByteArray &) | 219 | void MainWindow::appMessage(const QCString &, const QByteArray &) |
219 | { | 220 | { |
220 | qDebug("appMessage implemented by subclass"); | 221 | qDebug("appMessage implemented by subclass"); |
221 | } | 222 | } |
222 | 223 | ||
223 | void MainWindow::slotAdjustLayout() { | 224 | void MainWindow::slotAdjustLayout() { |
224 | 225 | ||
225 | /* | 226 | /* |
226 | QWidget *d = QApplication::desktop(); | 227 | QWidget *d = QApplication::desktop(); |
227 | 228 | ||
228 | if ( d->width() < d->height() ) { | 229 | if ( d->width() < d->height() ) { |
229 | layout->setDirection( QBoxLayout::TopToBottom ); | 230 | layout->setDirection( QBoxLayout::TopToBottom ); |
230 | } else { | 231 | } else { |
231 | layout->setDirection( QBoxLayout::LeftToRight ); | 232 | layout->setDirection( QBoxLayout::LeftToRight ); |
232 | } | 233 | } |
233 | */ | 234 | */ |
234 | } | 235 | } |
235 | 236 | ||
236 | void MainWindow::slotAdjustColumns() | 237 | void MainWindow::slotAdjustColumns() |
237 | { | 238 | { |
238 | bool hidden = folderView->isHidden(); | 239 | bool hidden = folderView->isHidden(); |
239 | if ( hidden ) folderView->show(); | 240 | if ( hidden ) folderView->show(); |
240 | folderView->setColumnWidth( 0, folderView->visibleWidth() ); | 241 | folderView->setColumnWidth( 0, folderView->visibleWidth() ); |
241 | if ( hidden ) folderView->hide(); | 242 | if ( hidden ) folderView->hide(); |
242 | 243 | ||
243 | mailView->setColumnWidth( 0, 10 ); | 244 | mailView->setColumnWidth( 0, 10 ); |
244 | mailView->setColumnWidth( 1, 100 ); | 245 | mailView->setColumnWidth( 1, 100 ); |
245 | mailView->setColumnWidth( 2, 100 ); | 246 | mailView->setColumnWidth( 2, 100 ); |
246 | mailView->setColumnWidth( 3, 50 ); | 247 | mailView->setColumnWidth( 3, 50 ); |
247 | mailView->setColumnWidth( 4, 120 ); | 248 | mailView->setColumnWidth( 4, 120 ); |
248 | } | 249 | } |
249 | 250 | ||
250 | void MainWindow::slotEditSettings() | 251 | void MainWindow::slotEditSettings() |
251 | { | 252 | { |
252 | } | 253 | } |
253 | 254 | ||
254 | void MainWindow::slotShowFolders( bool ) | 255 | void MainWindow::slotShowFolders( bool ) |
255 | { | 256 | { |
256 | qDebug("not implemented: "); | 257 | qDebug("not implemented: "); |
257 | } | 258 | } |
258 | 259 | ||
259 | void MainWindow::refreshMailView(const QValueList<RecMailP>&) | 260 | void MainWindow::refreshMailView(const QValueList<RecMailP>&) |
260 | { | 261 | { |
261 | qDebug("not implemented: "); | 262 | qDebug("not implemented: "); |
262 | } | 263 | } |
263 | 264 | ||
264 | void MainWindow::mailLeftClicked(QListViewItem * ) | 265 | void MainWindow::mailLeftClicked(QListViewItem * ) |
265 | { | 266 | { |
266 | qDebug("not implemented: "); | 267 | qDebug("not implemented: "); |
267 | } | 268 | } |
268 | 269 | ||
269 | void MainWindow::displayMail() | 270 | void MainWindow::displayMail() |
270 | { | 271 | { |
271 | qDebug("not implemented: "); | 272 | qDebug("not implemented: "); |
272 | } | 273 | } |
273 | 274 | ||
274 | void MainWindow::slotDeleteMail() | 275 | void MainWindow::slotDeleteMail() |
275 | { | 276 | { |
276 | qDebug("not implemented: "); | 277 | qDebug("not implemented: "); |
277 | } | 278 | } |
278 | 279 | ||
279 | void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) | 280 | void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) |
280 | { | 281 | { |
281 | qDebug("not implemented: "); | 282 | qDebug("not implemented: "); |
282 | } | 283 | } |
283 | 284 | ||
284 | void MainWindow::slotSendQueued() | 285 | void MainWindow::slotSendQueued() |
285 | { | 286 | { |
286 | qDebug("not implemented: "); | 287 | qDebug("not implemented: "); |
287 | } | 288 | } |
288 | 289 | ||
289 | void MainWindow::slotEditAccounts() | 290 | void MainWindow::slotEditAccounts() |
290 | { | 291 | { |
291 | qDebug("not implemented: "); | 292 | qDebug("not implemented: "); |
292 | } | 293 | } |
293 | 294 | ||
294 | void MainWindow::slotComposeMail() | 295 | void MainWindow::slotComposeMail() |
295 | { | 296 | { |
296 | qDebug("not implemented: "); | 297 | qDebug("not implemented: "); |
297 | } | 298 | } |
diff --git a/kmicromail/pop3configui.ui b/kmicromail/pop3configui.ui index 6acd394..f1dda7a 100644 --- a/kmicromail/pop3configui.ui +++ b/kmicromail/pop3configui.ui | |||
@@ -1,449 +1,449 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>POP3configUI</class> | 2 | <class>POP3configUI</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QDialog</class> | 4 | <class>QDialog</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>POP3configUI</cstring> | 7 | <cstring>POP3configUI</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>306</width> | 14 | <width>269</width> |
15 | <height>371</height> | 15 | <height>358</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Configure POP3</string> | 20 | <string>Configure POP3</string> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
23 | <name>layoutMargin</name> | 23 | <name>layoutMargin</name> |
24 | </property> | 24 | </property> |
25 | <property> | 25 | <property> |
26 | <name>layoutSpacing</name> | 26 | <name>layoutSpacing</name> |
27 | </property> | 27 | </property> |
28 | <vbox> | 28 | <vbox> |
29 | <property stdset="1"> | 29 | <property stdset="1"> |
30 | <name>margin</name> | 30 | <name>margin</name> |
31 | <number>3</number> | 31 | <number>3</number> |
32 | </property> | 32 | </property> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>spacing</name> | 34 | <name>spacing</name> |
35 | <number>1</number> | 35 | <number>1</number> |
36 | </property> | 36 | </property> |
37 | <widget> | 37 | <widget> |
38 | <class>QLayoutWidget</class> | 38 | <class>QLayoutWidget</class> |
39 | <property stdset="1"> | 39 | <property stdset="1"> |
40 | <name>name</name> | 40 | <name>name</name> |
41 | <cstring>Layout12</cstring> | 41 | <cstring>Layout12</cstring> |
42 | </property> | 42 | </property> |
43 | <hbox> | 43 | <hbox> |
44 | <property stdset="1"> | 44 | <property stdset="1"> |
45 | <name>margin</name> | 45 | <name>margin</name> |
46 | <number>0</number> | 46 | <number>0</number> |
47 | </property> | 47 | </property> |
48 | <property stdset="1"> | 48 | <property stdset="1"> |
49 | <name>spacing</name> | 49 | <name>spacing</name> |
50 | <number>6</number> | 50 | <number>6</number> |
51 | </property> | 51 | </property> |
52 | <widget> | 52 | <widget> |
53 | <class>QLabel</class> | 53 | <class>QLabel</class> |
54 | <property stdset="1"> | 54 | <property stdset="1"> |
55 | <name>name</name> | 55 | <name>name</name> |
56 | <cstring>accountLabel</cstring> | 56 | <cstring>accountLabel</cstring> |
57 | </property> | 57 | </property> |
58 | <property stdset="1"> | 58 | <property stdset="1"> |
59 | <name>text</name> | 59 | <name>text</name> |
60 | <string>Account</string> | 60 | <string>Account</string> |
61 | </property> | 61 | </property> |
62 | </widget> | 62 | </widget> |
63 | <widget> | 63 | <widget> |
64 | <class>QLineEdit</class> | 64 | <class>QLineEdit</class> |
65 | <property stdset="1"> | 65 | <property stdset="1"> |
66 | <name>name</name> | 66 | <name>name</name> |
67 | <cstring>accountLine</cstring> | 67 | <cstring>accountLine</cstring> |
68 | </property> | 68 | </property> |
69 | <property> | 69 | <property> |
70 | <name>toolTip</name> | 70 | <name>toolTip</name> |
71 | <string>Name of the Account</string> | 71 | <string>Name of the Account</string> |
72 | </property> | 72 | </property> |
73 | </widget> | 73 | </widget> |
74 | </hbox> | 74 | </hbox> |
75 | </widget> | 75 | </widget> |
76 | <widget> | 76 | <widget> |
77 | <class>Line</class> | 77 | <class>Line</class> |
78 | <property stdset="1"> | 78 | <property stdset="1"> |
79 | <name>name</name> | 79 | <name>name</name> |
80 | <cstring>line1</cstring> | 80 | <cstring>line1</cstring> |
81 | </property> | 81 | </property> |
82 | <property stdset="1"> | 82 | <property stdset="1"> |
83 | <name>orientation</name> | 83 | <name>orientation</name> |
84 | <enum>Horizontal</enum> | 84 | <enum>Horizontal</enum> |
85 | </property> | 85 | </property> |
86 | </widget> | 86 | </widget> |
87 | <widget> | 87 | <widget> |
88 | <class>QLayoutWidget</class> | 88 | <class>QLayoutWidget</class> |
89 | <property stdset="1"> | 89 | <property stdset="1"> |
90 | <name>name</name> | 90 | <name>name</name> |
91 | <cstring>Layout11</cstring> | 91 | <cstring>Layout11</cstring> |
92 | </property> | 92 | </property> |
93 | <hbox> | 93 | <hbox> |
94 | <property stdset="1"> | 94 | <property stdset="1"> |
95 | <name>margin</name> | 95 | <name>margin</name> |
96 | <number>0</number> | 96 | <number>0</number> |
97 | </property> | 97 | </property> |
98 | <property stdset="1"> | 98 | <property stdset="1"> |
99 | <name>spacing</name> | 99 | <name>spacing</name> |
100 | <number>6</number> | 100 | <number>6</number> |
101 | </property> | 101 | </property> |
102 | <widget> | 102 | <widget> |
103 | <class>QLayoutWidget</class> | 103 | <class>QLayoutWidget</class> |
104 | <property stdset="1"> | 104 | <property stdset="1"> |
105 | <name>name</name> | 105 | <name>name</name> |
106 | <cstring>Layout9</cstring> | 106 | <cstring>Layout9</cstring> |
107 | </property> | 107 | </property> |
108 | <vbox> | 108 | <vbox> |
109 | <property stdset="1"> | 109 | <property stdset="1"> |
110 | <name>margin</name> | 110 | <name>margin</name> |
111 | <number>0</number> | 111 | <number>0</number> |
112 | </property> | 112 | </property> |
113 | <property stdset="1"> | 113 | <property stdset="1"> |
114 | <name>spacing</name> | 114 | <name>spacing</name> |
115 | <number>6</number> | 115 | <number>6</number> |
116 | </property> | 116 | </property> |
117 | <widget> | 117 | <widget> |
118 | <class>QLabel</class> | 118 | <class>QLabel</class> |
119 | <property stdset="1"> | 119 | <property stdset="1"> |
120 | <name>name</name> | 120 | <name>name</name> |
121 | <cstring>serverLabel</cstring> | 121 | <cstring>serverLabel</cstring> |
122 | </property> | 122 | </property> |
123 | <property stdset="1"> | 123 | <property stdset="1"> |
124 | <name>text</name> | 124 | <name>text</name> |
125 | <string>Server</string> | 125 | <string>Server</string> |
126 | </property> | 126 | </property> |
127 | </widget> | 127 | </widget> |
128 | <widget> | 128 | <widget> |
129 | <class>QLabel</class> | 129 | <class>QLabel</class> |
130 | <property stdset="1"> | 130 | <property stdset="1"> |
131 | <name>name</name> | 131 | <name>name</name> |
132 | <cstring>portLabel</cstring> | 132 | <cstring>portLabel</cstring> |
133 | </property> | 133 | </property> |
134 | <property stdset="1"> | 134 | <property stdset="1"> |
135 | <name>text</name> | 135 | <name>text</name> |
136 | <string>Port</string> | 136 | <string>Port</string> |
137 | </property> | 137 | </property> |
138 | </widget> | 138 | </widget> |
139 | </vbox> | 139 | </vbox> |
140 | </widget> | 140 | </widget> |
141 | <widget> | 141 | <widget> |
142 | <class>QLayoutWidget</class> | 142 | <class>QLayoutWidget</class> |
143 | <property stdset="1"> | 143 | <property stdset="1"> |
144 | <name>name</name> | 144 | <name>name</name> |
145 | <cstring>Layout10</cstring> | 145 | <cstring>Layout10</cstring> |
146 | </property> | 146 | </property> |
147 | <vbox> | 147 | <vbox> |
148 | <property stdset="1"> | 148 | <property stdset="1"> |
149 | <name>margin</name> | 149 | <name>margin</name> |
150 | <number>0</number> | 150 | <number>0</number> |
151 | </property> | 151 | </property> |
152 | <property stdset="1"> | 152 | <property stdset="1"> |
153 | <name>spacing</name> | 153 | <name>spacing</name> |
154 | <number>6</number> | 154 | <number>6</number> |
155 | </property> | 155 | </property> |
156 | <widget> | 156 | <widget> |
157 | <class>QLineEdit</class> | 157 | <class>QLineEdit</class> |
158 | <property stdset="1"> | 158 | <property stdset="1"> |
159 | <name>name</name> | 159 | <name>name</name> |
160 | <cstring>serverLine</cstring> | 160 | <cstring>serverLine</cstring> |
161 | </property> | 161 | </property> |
162 | </widget> | 162 | </widget> |
163 | <widget> | 163 | <widget> |
164 | <class>QLineEdit</class> | 164 | <class>QLineEdit</class> |
165 | <property stdset="1"> | 165 | <property stdset="1"> |
166 | <name>name</name> | 166 | <name>name</name> |
167 | <cstring>portLine</cstring> | 167 | <cstring>portLine</cstring> |
168 | </property> | 168 | </property> |
169 | </widget> | 169 | </widget> |
170 | </vbox> | 170 | </vbox> |
171 | </widget> | 171 | </widget> |
172 | </hbox> | 172 | </hbox> |
173 | </widget> | 173 | </widget> |
174 | <widget> | 174 | <widget> |
175 | <class>QLayoutWidget</class> | 175 | <class>QLayoutWidget</class> |
176 | <property stdset="1"> | 176 | <property stdset="1"> |
177 | <name>name</name> | 177 | <name>name</name> |
178 | <cstring>Layout13</cstring> | 178 | <cstring>Layout13</cstring> |
179 | </property> | 179 | </property> |
180 | <vbox> | 180 | <vbox> |
181 | <property stdset="1"> | 181 | <property stdset="1"> |
182 | <name>margin</name> | 182 | <name>margin</name> |
183 | <number>0</number> | 183 | <number>0</number> |
184 | </property> | 184 | </property> |
185 | <property stdset="1"> | 185 | <property stdset="1"> |
186 | <name>spacing</name> | 186 | <name>spacing</name> |
187 | <number>6</number> | 187 | <number>6</number> |
188 | </property> | 188 | </property> |
189 | <widget> | 189 | <widget> |
190 | <class>QLabel</class> | 190 | <class>QLabel</class> |
191 | <property stdset="1"> | 191 | <property stdset="1"> |
192 | <name>name</name> | 192 | <name>name</name> |
193 | <cstring>TextLabel1</cstring> | 193 | <cstring>TextLabel1</cstring> |
194 | </property> | 194 | </property> |
195 | <property stdset="1"> | 195 | <property stdset="1"> |
196 | <name>text</name> | 196 | <name>text</name> |
197 | <string>Use secure sockets:</string> | 197 | <string>Use secure sockets:</string> |
198 | </property> | 198 | </property> |
199 | </widget> | 199 | </widget> |
200 | <widget> | 200 | <widget> |
201 | <class>QComboBox</class> | 201 | <class>QComboBox</class> |
202 | <property stdset="1"> | 202 | <property stdset="1"> |
203 | <name>name</name> | 203 | <name>name</name> |
204 | <cstring>ComboBox1</cstring> | 204 | <cstring>ComboBox1</cstring> |
205 | </property> | 205 | </property> |
206 | </widget> | 206 | </widget> |
207 | </vbox> | 207 | </vbox> |
208 | </widget> | 208 | </widget> |
209 | <widget> | 209 | <widget> |
210 | <class>QLineEdit</class> | 210 | <class>QLineEdit</class> |
211 | <property stdset="1"> | 211 | <property stdset="1"> |
212 | <name>name</name> | 212 | <name>name</name> |
213 | <cstring>CommandEdit</cstring> | 213 | <cstring>CommandEdit</cstring> |
214 | </property> | 214 | </property> |
215 | <property stdset="1"> | 215 | <property stdset="1"> |
216 | <name>text</name> | 216 | <name>text</name> |
217 | <string>ssh $SERVER exec imapd</string> | 217 | <string>ssh $SERVER exec imapd</string> |
218 | </property> | 218 | </property> |
219 | </widget> | 219 | </widget> |
220 | <widget> | 220 | <widget> |
221 | <class>Line</class> | 221 | <class>Line</class> |
222 | <property stdset="1"> | 222 | <property stdset="1"> |
223 | <name>name</name> | 223 | <name>name</name> |
224 | <cstring>line2</cstring> | 224 | <cstring>line2</cstring> |
225 | </property> | 225 | </property> |
226 | <property stdset="1"> | 226 | <property stdset="1"> |
227 | <name>orientation</name> | 227 | <name>orientation</name> |
228 | <enum>Horizontal</enum> | 228 | <enum>Horizontal</enum> |
229 | </property> | 229 | </property> |
230 | </widget> | 230 | </widget> |
231 | <widget> | 231 | <widget> |
232 | <class>QLayoutWidget</class> | 232 | <class>QLayoutWidget</class> |
233 | <property stdset="1"> | 233 | <property stdset="1"> |
234 | <name>name</name> | 234 | <name>name</name> |
235 | <cstring>Layout6</cstring> | 235 | <cstring>Layout6</cstring> |
236 | </property> | 236 | </property> |
237 | <hbox> | 237 | <hbox> |
238 | <property stdset="1"> | 238 | <property stdset="1"> |
239 | <name>margin</name> | 239 | <name>margin</name> |
240 | <number>0</number> | 240 | <number>0</number> |
241 | </property> | 241 | </property> |
242 | <property stdset="1"> | 242 | <property stdset="1"> |
243 | <name>spacing</name> | 243 | <name>spacing</name> |
244 | <number>6</number> | 244 | <number>6</number> |
245 | </property> | 245 | </property> |
246 | <widget> | 246 | <widget> |
247 | <class>QLayoutWidget</class> | 247 | <class>QLayoutWidget</class> |
248 | <property stdset="1"> | 248 | <property stdset="1"> |
249 | <name>name</name> | 249 | <name>name</name> |
250 | <cstring>Layout4</cstring> | 250 | <cstring>Layout4</cstring> |
251 | </property> | 251 | </property> |
252 | <vbox> | 252 | <vbox> |
253 | <property stdset="1"> | 253 | <property stdset="1"> |
254 | <name>margin</name> | 254 | <name>margin</name> |
255 | <number>0</number> | 255 | <number>0</number> |
256 | </property> | 256 | </property> |
257 | <property stdset="1"> | 257 | <property stdset="1"> |
258 | <name>spacing</name> | 258 | <name>spacing</name> |
259 | <number>6</number> | 259 | <number>6</number> |
260 | </property> | 260 | </property> |
261 | <widget> | 261 | <widget> |
262 | <class>QLabel</class> | 262 | <class>QLabel</class> |
263 | <property stdset="1"> | 263 | <property stdset="1"> |
264 | <name>name</name> | 264 | <name>name</name> |
265 | <cstring>userLabel</cstring> | 265 | <cstring>userLabel</cstring> |
266 | </property> | 266 | </property> |
267 | <property stdset="1"> | 267 | <property stdset="1"> |
268 | <name>text</name> | 268 | <name>text</name> |
269 | <string>User</string> | 269 | <string>User</string> |
270 | </property> | 270 | </property> |
271 | </widget> | 271 | </widget> |
272 | <widget> | 272 | <widget> |
273 | <class>QLabel</class> | 273 | <class>QLabel</class> |
274 | <property stdset="1"> | 274 | <property stdset="1"> |
275 | <name>name</name> | 275 | <name>name</name> |
276 | <cstring>passLabel</cstring> | 276 | <cstring>passLabel</cstring> |
277 | </property> | 277 | </property> |
278 | <property stdset="1"> | 278 | <property stdset="1"> |
279 | <name>text</name> | 279 | <name>text</name> |
280 | <string>Password</string> | 280 | <string>Password</string> |
281 | </property> | 281 | </property> |
282 | </widget> | 282 | </widget> |
283 | </vbox> | 283 | </vbox> |
284 | </widget> | 284 | </widget> |
285 | <widget> | 285 | <widget> |
286 | <class>QLayoutWidget</class> | 286 | <class>QLayoutWidget</class> |
287 | <property stdset="1"> | 287 | <property stdset="1"> |
288 | <name>name</name> | 288 | <name>name</name> |
289 | <cstring>Layout5</cstring> | 289 | <cstring>Layout5</cstring> |
290 | </property> | 290 | </property> |
291 | <vbox> | 291 | <vbox> |
292 | <property stdset="1"> | 292 | <property stdset="1"> |
293 | <name>margin</name> | 293 | <name>margin</name> |
294 | <number>0</number> | 294 | <number>0</number> |
295 | </property> | 295 | </property> |
296 | <property stdset="1"> | 296 | <property stdset="1"> |
297 | <name>spacing</name> | 297 | <name>spacing</name> |
298 | <number>6</number> | 298 | <number>6</number> |
299 | </property> | 299 | </property> |
300 | <widget> | 300 | <widget> |
301 | <class>QLineEdit</class> | 301 | <class>QLineEdit</class> |
302 | <property stdset="1"> | 302 | <property stdset="1"> |
303 | <name>name</name> | 303 | <name>name</name> |
304 | <cstring>userLine</cstring> | 304 | <cstring>userLine</cstring> |
305 | </property> | 305 | </property> |
306 | </widget> | 306 | </widget> |
307 | <widget> | 307 | <widget> |
308 | <class>QLineEdit</class> | 308 | <class>QLineEdit</class> |
309 | <property stdset="1"> | 309 | <property stdset="1"> |
310 | <name>name</name> | 310 | <name>name</name> |
311 | <cstring>passLine</cstring> | 311 | <cstring>passLine</cstring> |
312 | </property> | 312 | </property> |
313 | <property stdset="1"> | 313 | <property stdset="1"> |
314 | <name>echoMode</name> | 314 | <name>echoMode</name> |
315 | <enum>Password</enum> | 315 | <enum>Password</enum> |
316 | </property> | 316 | </property> |
317 | </widget> | 317 | </widget> |
318 | </vbox> | 318 | </vbox> |
319 | </widget> | 319 | </widget> |
320 | </hbox> | 320 | </hbox> |
321 | </widget> | 321 | </widget> |
322 | <widget> | 322 | <widget> |
323 | <class>QLayoutWidget</class> | 323 | <class>QLayoutWidget</class> |
324 | <property stdset="1"> | 324 | <property stdset="1"> |
325 | <name>name</name> | 325 | <name>name</name> |
326 | <cstring>Layout9</cstring> | 326 | <cstring>Layout9</cstring> |
327 | </property> | 327 | </property> |
328 | <hbox> | 328 | <hbox> |
329 | <property stdset="1"> | 329 | <property stdset="1"> |
330 | <name>margin</name> | 330 | <name>margin</name> |
331 | <number>0</number> | 331 | <number>0</number> |
332 | </property> | 332 | </property> |
333 | <property stdset="1"> | 333 | <property stdset="1"> |
334 | <name>spacing</name> | 334 | <name>spacing</name> |
335 | <number>6</number> | 335 | <number>6</number> |
336 | </property> | 336 | </property> |
337 | <widget> | 337 | <widget> |
338 | <class>QLabel</class> | 338 | <class>QLabel</class> |
339 | <property stdset="1"> | 339 | <property stdset="1"> |
340 | <name>name</name> | 340 | <name>name</name> |
341 | <cstring>TextLabel1_2</cstring> | 341 | <cstring>TextLabel1_2</cstring> |
342 | </property> | 342 | </property> |
343 | <property stdset="1"> | 343 | <property stdset="1"> |
344 | <name>text</name> | 344 | <name>text</name> |
345 | <string>Local storage folder:</string> | 345 | <string>Local storage folder:</string> |
346 | </property> | 346 | </property> |
347 | </widget> | 347 | </widget> |
348 | <widget> | 348 | <widget> |
349 | <class>QLineEdit</class> | 349 | <class>QLineEdit</class> |
350 | <property stdset="1"> | 350 | <property stdset="1"> |
351 | <name>name</name> | 351 | <name>name</name> |
352 | <cstring>localFolder</cstring> | 352 | <cstring>localFolder</cstring> |
353 | </property> | 353 | </property> |
354 | <property stdset="1"> | 354 | <property stdset="1"> |
355 | <name>text</name> | 355 | <name>text</name> |
356 | <string></string> | 356 | <string></string> |
357 | </property> | 357 | </property> |
358 | </widget> | 358 | </widget> |
359 | </hbox> | 359 | </hbox> |
360 | </widget> | 360 | </widget> |
361 | <widget> | 361 | <widget> |
362 | <class>QLayoutWidget</class> | 362 | <class>QLayoutWidget</class> |
363 | <property stdset="1"> | 363 | <property stdset="1"> |
364 | <name>name</name> | 364 | <name>name</name> |
365 | <cstring>Layout10</cstring> | 365 | <cstring>Layout10</cstring> |
366 | </property> | 366 | </property> |
367 | <hbox> | 367 | <hbox> |
368 | <property stdset="1"> | 368 | <property stdset="1"> |
369 | <name>margin</name> | 369 | <name>margin</name> |
370 | <number>0</number> | 370 | <number>0</number> |
371 | </property> | 371 | </property> |
372 | <property stdset="1"> | 372 | <property stdset="1"> |
373 | <name>spacing</name> | 373 | <name>spacing</name> |
374 | <number>6</number> | 374 | <number>6</number> |
375 | </property> | 375 | </property> |
376 | <widget> | 376 | <widget> |
377 | <class>QCheckBox</class> | 377 | <class>QCheckBox</class> |
378 | <property stdset="1"> | 378 | <property stdset="1"> |
379 | <name>name</name> | 379 | <name>name</name> |
380 | <cstring>CheckBoxDown</cstring> | 380 | <cstring>CheckBoxDown</cstring> |
381 | </property> | 381 | </property> |
382 | <property stdset="1"> | 382 | <property stdset="1"> |
383 | <name>text</name> | 383 | <name>text</name> |
384 | <string>Download only messages smaller</string> | 384 | <string>Get only messages smaller</string> |
385 | </property> | 385 | </property> |
386 | </widget> | 386 | </widget> |
387 | <widget> | 387 | <widget> |
388 | <class>QSpinBox</class> | 388 | <class>QSpinBox</class> |
389 | <property stdset="1"> | 389 | <property stdset="1"> |
390 | <name>name</name> | 390 | <name>name</name> |
391 | <cstring>SpinBoxDown</cstring> | 391 | <cstring>SpinBoxDown</cstring> |
392 | </property> | 392 | </property> |
393 | <property stdset="1"> | 393 | <property stdset="1"> |
394 | <name>suffix</name> | 394 | <name>suffix</name> |
395 | <string>kB</string> | 395 | <string>kB</string> |
396 | </property> | 396 | </property> |
397 | <property stdset="1"> | 397 | <property stdset="1"> |
398 | <name>maxValue</name> | 398 | <name>maxValue</name> |
399 | <number>99999</number> | 399 | <number>99999</number> |
400 | </property> | 400 | </property> |
401 | <property stdset="1"> | 401 | <property stdset="1"> |
402 | <name>minValue</name> | 402 | <name>minValue</name> |
403 | <number>1</number> | 403 | <number>1</number> |
404 | </property> | 404 | </property> |
405 | </widget> | 405 | </widget> |
406 | </hbox> | 406 | </hbox> |
407 | </widget> | 407 | </widget> |
408 | <widget> | 408 | <widget> |
409 | <class>QCheckBox</class> | 409 | <class>QCheckBox</class> |
410 | <property stdset="1"> | 410 | <property stdset="1"> |
411 | <name>name</name> | 411 | <name>name</name> |
412 | <cstring>CheckBoxLeaveOn</cstring> | 412 | <cstring>CheckBoxLeaveOn</cstring> |
413 | </property> | 413 | </property> |
414 | <property stdset="1"> | 414 | <property stdset="1"> |
415 | <name>text</name> | 415 | <name>text</name> |
416 | <string>Leave Messages on Server</string> | 416 | <string>Leave Messages on Server</string> |
417 | </property> | 417 | </property> |
418 | </widget> | 418 | </widget> |
419 | <spacer> | 419 | <spacer> |
420 | <property> | 420 | <property> |
421 | <name>name</name> | 421 | <name>name</name> |
422 | <cstring>spacer</cstring> | 422 | <cstring>spacer</cstring> |
423 | </property> | 423 | </property> |
424 | <property stdset="1"> | 424 | <property stdset="1"> |
425 | <name>orientation</name> | 425 | <name>orientation</name> |
426 | <enum>Vertical</enum> | 426 | <enum>Vertical</enum> |
427 | </property> | 427 | </property> |
428 | <property stdset="1"> | 428 | <property stdset="1"> |
429 | <name>sizeType</name> | 429 | <name>sizeType</name> |
430 | <enum>Expanding</enum> | 430 | <enum>Expanding</enum> |
431 | </property> | 431 | </property> |
432 | <property> | 432 | <property> |
433 | <name>sizeHint</name> | 433 | <name>sizeHint</name> |
434 | <size> | 434 | <size> |
435 | <width>20</width> | 435 | <width>20</width> |
436 | <height>20</height> | 436 | <height>20</height> |
437 | </size> | 437 | </size> |
438 | </property> | 438 | </property> |
439 | </spacer> | 439 | </spacer> |
440 | </vbox> | 440 | </vbox> |
441 | </widget> | 441 | </widget> |
442 | <tabstops> | 442 | <tabstops> |
443 | <tabstop>accountLine</tabstop> | 443 | <tabstop>accountLine</tabstop> |
444 | <tabstop>serverLine</tabstop> | 444 | <tabstop>serverLine</tabstop> |
445 | <tabstop>portLine</tabstop> | 445 | <tabstop>portLine</tabstop> |
446 | <tabstop>userLine</tabstop> | 446 | <tabstop>userLine</tabstop> |
447 | <tabstop>passLine</tabstop> | 447 | <tabstop>passLine</tabstop> |
448 | </tabstops> | 448 | </tabstops> |
449 | </UI> | 449 | </UI> |