summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-01-24 18:05:48 (UTC)
committer zautrix <zautrix>2005-01-24 18:05:48 (UTC)
commit77f93c632b66b5c8d92e4c63330362272ca1fc40 (patch) (unidiff)
tree31f28656062c899b5368f13ab594ff6fa5c657fa
parent6c89efd80c1e94a0c070025d07c7a4c656f2a81e (diff)
downloadkdepimpi-77f93c632b66b5c8d92e4c63330362272ca1fc40.zip
kdepimpi-77f93c632b66b5c8d92e4c63330362272ca1fc40.tar.gz
kdepimpi-77f93c632b66b5c8d92e4c63330362272ca1fc40.tar.bz2
mail fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt4
-rw-r--r--kmicromail/accountview.h2
-rw-r--r--kmicromail/libmailwrapper/mailtypes.cpp17
-rw-r--r--kmicromail/libmailwrapper/mailtypes.h1
-rw-r--r--kmicromail/mailistviewitem.cpp24
-rw-r--r--kmicromail/opiemail.cpp38
-rw-r--r--kmicromail/viewmail.cpp7
7 files changed, 72 insertions, 21 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index 2516b2a..42b36f1 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,410 +1,412 @@
1Info about the changes in new versions of KDE-Pim/Pi 1Info about the changes in new versions of KDE-Pim/Pi
2 2
3********** VERSION 1.9.20 ************ 3********** VERSION 1.9.20 ************
4 4
5KO/Pi: 5KO/Pi:
6Added for the "dislplay one day" agenda mode 6Added for the "dislplay one day" agenda mode
7info in the caption and in the day lables: 7info in the caption and in the day lables:
8Now it is displayed, if the selected day is from "day before yesterday" 8Now it is displayed, if the selected day is from "day before yesterday"
9to "day after tomorrow". 9to "day after tomorrow".
10Made it possible to delete a Todo, which has sub-todos. 10Made it possible to delete a Todo, which has sub-todos.
11Fixed two small problems in the todo view. 11Fixed two small problems in the todo view.
12Added missing German translation for filter edit and print dialog. 12Added missing German translation for filter edit and print dialog.
13Made search dialog closeable by cancel key. 13Made search dialog closeable by cancel key.
14 14
15Made it possible to select in the date picker the (ligt grey ) 15Made it possible to select in the date picker the (ligt grey )
16dates of the prev./next month with the mouse. 16dates of the prev./next month with the mouse.
17 17
18OM/Pi: 18OM/Pi:
19"Delete mail" icon in main window now deletes all selected mails. 19"Delete mail" icon in main window now deletes all selected mails.
20Fixed the problem, that the state flag of imap mails was ignored. 20Fixed the problem, that the state flag of imap mails was ignored.
21Now mails with "FLAG_SEEN" on the imap server get no icon in the list view 21Now mails with "FLAG_SEEN" on the imap server get no icon in the list view
22to idecate that they are already seen. 22to indecate that they are already seen.
23Fixed the problem that the body of some mails was not displayed in the 23Fixed the problem that the body of some mails was not displayed in the
24mail viewer when fetching them from the imap server directly to read them. 24mail viewer when fetching them from the imap server directly to read them.
25Made it (configurable) possible to show the "To:" field in the list view. 25Made it (configurable) possible to show the "To:" field in the list view.
26Added to the mail viewer the option "View Source" to make it possible to see the raw mail data. 26Added to the mail viewer the option "View Source" to make it possible to see the raw mail data.
27Added a "Download Mail" button to the mail viewer to quickly download the viewed mail to the
28local storage folder (specified in account setiings) of the account of the mail.
27 29
28 30
29 31
30********** VERSION 1.9.19 ************ 32********** VERSION 1.9.19 ************
31 33
32Added a lot of missing translations to KA/Pi, 34Added a lot of missing translations to KA/Pi,
33Added some missing translations to KO/Pi and OM/Pi. 35Added some missing translations to KO/Pi and OM/Pi.
34 36
35Fixed some minor problems in KA/Pi + KO/Pi. 37Fixed some minor problems in KA/Pi + KO/Pi.
36 38
37Fixed a crash when closing PwM/Pi. 39Fixed a crash when closing PwM/Pi.
38Added German translation for PwM/Pi. 40Added German translation for PwM/Pi.
39 41
40Made view change and Month View update faster in KO/Pi. 42Made view change and Month View update faster in KO/Pi.
41 43
42 44
43********** VERSION 1.9.18 ************ 45********** VERSION 1.9.18 ************
44 46
45FYI: The VERSION 1.9.17 was a testing release only. 47FYI: The VERSION 1.9.17 was a testing release only.
46Please read the changelog of VERSION 1.9.17 as well. 48Please read the changelog of VERSION 1.9.17 as well.
47 49
48Cleaned up the syncing config dialog. 50Cleaned up the syncing config dialog.
49Added sync config options for date range for events. 51Added sync config options for date range for events.
50Added sync config options for filters on incoming data. 52Added sync config options for filters on incoming data.
51Added sync config options for filters on outgoing data. 53Added sync config options for filters on outgoing data.
52Please read the updated SyncHowTo about the new filter settings. 54Please read the updated SyncHowTo about the new filter settings.
53These filter settings make it now possible to sync with shared 55These filter settings make it now possible to sync with shared
54calendars without writing back private or confidential data 56calendars without writing back private or confidential data
55(via the outgoing filters). 57(via the outgoing filters).
56To sync only with particular parts of a shared calendar, 58To sync only with particular parts of a shared calendar,
57the incoming filter settings can be used. 59the incoming filter settings can be used.
58An example can be found in the SyncHowTo. 60An example can be found in the SyncHowTo.
59Same for shared addressbooks. 61Same for shared addressbooks.
60 62
61Added a setting for the global kdepim data storage. 63Added a setting for the global kdepim data storage.
62Usually the data is stored in (yourhomedir/kdepim). 64Usually the data is stored in (yourhomedir/kdepim).
63Now you can set in the Global config dialog TAB, subTAB "Data storage path" 65Now you can set in the Global config dialog TAB, subTAB "Data storage path"
64a directory where all the kdepim data is stored. 66a directory where all the kdepim data is stored.
65That makes it easy to save all kdepim data on a SD card on the Z, for example. 67That makes it easy to save all kdepim data on a SD card on the Z, for example.
66 68
67KO/Pi: 69KO/Pi:
68The timeedit input has a pulldown list for times. 70The timeedit input has a pulldown list for times.
69If opened, this pulldown list should now has the right time highlighted. 71If opened, this pulldown list should now has the right time highlighted.
70Added the possibility to exclude events/todos/journals in a filter. 72Added the possibility to exclude events/todos/journals in a filter.
71You should exclude journals, if you do not want them to sync with a public calendar. 73You should exclude journals, if you do not want them to sync with a public calendar.
72 74
73KA/Pi: 75KA/Pi:
74Added the possibility to in/exclude public/private/confidential contacts to a filter. 76Added the possibility to in/exclude public/private/confidential contacts to a filter.
75If you have already defined filterrules in KA/Pi you have to adjust them all by setting the "include public/private/confidential" property manually. Sorry for that ... 77If you have already defined filterrules in KA/Pi you have to adjust them all by setting the "include public/private/confidential" property manually. Sorry for that ...
76Added printing of card view and details view on desktop. 78Added printing of card view and details view on desktop.
77Printing of list view is not working... 79Printing of list view is not working...
78Added button for removing pictures in contact editor. 80Added button for removing pictures in contact editor.
79Parsing data fix of KA/Pi version 1.9.17. 81Parsing data fix of KA/Pi version 1.9.17.
80Fixed the "parse name automatically" problem of KA/Pi version 1.9.17. 82Fixed the "parse name automatically" problem of KA/Pi version 1.9.17.
81Fixed some syncing merging problems. 83Fixed some syncing merging problems.
82 84
83 85
84********** VERSION 1.9.17 ************ 86********** VERSION 1.9.17 ************
85 87
86KO/Pi: 88KO/Pi:
87Fixed that tooltips were not updated after moving an item in agenda view. 89Fixed that tooltips were not updated after moving an item in agenda view.
88Fixed a bug in sorting start date for recurring events in list view. 90Fixed a bug in sorting start date for recurring events in list view.
89Changed the left button in todo viewer from "Agenda" to "Set completed". 91Changed the left button in todo viewer from "Agenda" to "Set completed".
90This makes it possible to change a todo in the What's Next View quickly to the completed state without leaving the What's Next View. 92This makes it possible to change a todo in the What's Next View quickly to the completed state without leaving the What's Next View.
91Added more info in the todo viewer: Startdate, parent/sub todos. 93Added more info in the todo viewer: Startdate, parent/sub todos.
92 94
93 95
94KA/Pi: 96KA/Pi:
95All fields search does now actually search all the (possible) fields, 97All fields search does now actually search all the (possible) fields,
96not only those listed in the contact list. 98not only those listed in the contact list.
97Made is possible to inline a picture in a vcard on the Z. 99Made is possible to inline a picture in a vcard on the Z.
98This was only possible on the desktop, now is it possible on the Z as well. 100This was only possible on the desktop, now is it possible on the Z as well.
99Fixed of missing save settings after filter configuration. 101Fixed of missing save settings after filter configuration.
100Made saving of addressbook much faster. 102Made saving of addressbook much faster.
101Fixed extension widget layout problem. 103Fixed extension widget layout problem.
102Fixed saving of default formatted name settings. 104Fixed saving of default formatted name settings.
103Fixed formatted name handling in edit dialog. 105Fixed formatted name handling in edit dialog.
104Added an option for changing formatted names of many contacts 106Added an option for changing formatted names of many contacts
105(menu: File - Change - Set formatted name). 107(menu: File - Change - Set formatted name).
106 108
107QWhatsThis was not working on the Z ( only black rectangle was shown). 109QWhatsThis was not working on the Z ( only black rectangle was shown).
108This is Fixed. 110This is Fixed.
109 111
110KDE-Sync: 112KDE-Sync:
111Now readonly KDE resources are synced as well. 113Now readonly KDE resources are synced as well.
112(They are not changed in KDE itself, of course). 114(They are not changed in KDE itself, of course).
113 115
114 116
115 117
116********** VERSION 1.9.16 ************ 118********** VERSION 1.9.16 ************
117 119
118KO/Pi: 120KO/Pi:
119Fixed search dialog size on Z 6000 (480x640 display). 121Fixed search dialog size on Z 6000 (480x640 display).
120Added setting to hide/show time in agenda items. 122Added setting to hide/show time in agenda items.
121Added setting to hide not running todos in todo view. 123Added setting to hide not running todos in todo view.
122Added columns for start date/time in todo view. 124Added columns for start date/time in todo view.
123Replaced the solid half-hour lines in agenda view by dot lines. 125Replaced the solid half-hour lines in agenda view by dot lines.
124Added possibility of printing the What's Next View on the desktop 126Added possibility of printing the What's Next View on the desktop
125(i.e. Windows and Linux). 127(i.e. Windows and Linux).
126Fixed a crash in KO/Pi when starting KO/Pi with What's Next view. 128Fixed a crash in KO/Pi when starting KO/Pi with What's Next view.
127Added tooltips in month view.(Tooltips only available on desktop) 129Added tooltips in month view.(Tooltips only available on desktop)
128 130
129Fixed a strange problem in KO/Pi alarm applet. 131Fixed a strange problem in KO/Pi alarm applet.
130Did not find the actual problem, 132Did not find the actual problem,
131such that now Qtopia reboots again if deinstalling the alarm applet. 133such that now Qtopia reboots again if deinstalling the alarm applet.
132But the alarm applet should work again. 134But the alarm applet should work again.
133 135
134KA/Pi: 136KA/Pi:
135Fixed the problem, that internal pictures were not saved. 137Fixed the problem, that internal pictures were not saved.
136 138
137Fixed a problem in the pi-sync mode by increasing the timeout for data transfer from 20 seconds to 5 minutes. 139Fixed a problem in the pi-sync mode by increasing the timeout for data transfer from 20 seconds to 5 minutes.
138 140
139Fixed some minor problems. (Like word wrap in help text windows). 141Fixed some minor problems. (Like word wrap in help text windows).
140 142
141Fixed a compiling problem in microkde/kresources. 143Fixed a compiling problem in microkde/kresources.
142 144
143KO/Pi is using zdbat (renamed to db2file) for syncing with Sharp DTM. 145KO/Pi is using zdbat (renamed to db2file) for syncing with Sharp DTM.
144This version now includes zdbat 1.0.0 (old version was zdbat 0.2.9) 146This version now includes zdbat 1.0.0 (old version was zdbat 0.2.9)
145such that now syncing KO/Pi with Sharp DTM should work on the 147such that now syncing KO/Pi with Sharp DTM should work on the
146Zaurus C 3000 model. 148Zaurus C 3000 model.
147 149
148********** VERSION 1.9.15 ************ 150********** VERSION 1.9.15 ************
149 151
150Usebilty enhancements in KO/Pi: 152Usebilty enhancements in KO/Pi:
151When clicking on the date in a month view cell, the day view is shown. 153When clicking on the date in a month view cell, the day view is shown.
152Old behaviour was, that the "new event" dialog popped up. 154Old behaviour was, that the "new event" dialog popped up.
153 155
154Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu). 156Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu).
155That means, you can restore the latest 157That means, you can restore the latest
156event/todo/journal you have deleted. 158event/todo/journal you have deleted.
157A journal is deleted, if you clear all the text of the journal. 159A journal is deleted, if you clear all the text of the journal.
158 160
159Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14. 161Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14.
160 162
161KA/Pi starting in 480x640 resolution: 163KA/Pi starting in 480x640 resolution:
162Hide the filter action in toolbar 164Hide the filter action in toolbar
163and added icons for undo/delete/redo in toolbar. 165and added icons for undo/delete/redo in toolbar.
164 166
165Change in OM/Pi ViewMail dialog: 167Change in OM/Pi ViewMail dialog:
166When clicking on the "delete" icon the mail is deleted after confirmation as usual. 168When clicking on the "delete" icon the mail is deleted after confirmation as usual.
167But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any). 169But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any).
168 170
169Fixed a crash when deleting mail-accounts in OM/Pi. 171Fixed a crash when deleting mail-accounts in OM/Pi.
170 172
171 173
172********** VERSION 1.9.14 ************ 174********** VERSION 1.9.14 ************
173 175
174Fixed some problems with the dialog sizes when switching 176Fixed some problems with the dialog sizes when switching
175portrait/landscape mode on 640x480 PDA display. 177portrait/landscape mode on 640x480 PDA display.
176 178
177Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi. 179Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi.
178 180
179Fixed an ugly bug in KOpieMail: 181Fixed an ugly bug in KOpieMail:
180KOpieMail was not able to write files (mails) to MSDOS file system, 182KOpieMail was not able to write files (mails) to MSDOS file system,
181like on an usual preformatted SD card. That should work now. 183like on an usual preformatted SD card. That should work now.
182To save your mail data on the Sd card do the following: 184To save your mail data on the Sd card do the following:
183Create a dir on the SD card: 185Create a dir on the SD card:
184mkdir /mnt/card/localmail 186mkdir /mnt/card/localmail
185Go to your home dir: 187Go to your home dir:
186cd 188cd
187Go to kopiemail data storage dir: 189Go to kopiemail data storage dir:
188cd kdepim/apps/kopiemail 190cd kdepim/apps/kopiemail
189Create a symlink to the SD card: 191Create a symlink to the SD card:
190ls -s /mnt/card/localmail 192ls -s /mnt/card/localmail
191Now KOpieMail will store all mails on the SD card. 193Now KOpieMail will store all mails on the SD card.
192 194
193KO/Pi Monthview: 195KO/Pi Monthview:
194Now "Go to Today" selects the current month from day 1-end, 196Now "Go to Today" selects the current month from day 1-end,
195not the current date + some days. 197not the current date + some days.
196I.e. "Go to Today" shows now always 198I.e. "Go to Today" shows now always
197the current month with first day of month in the first row. 199the current month with first day of month in the first row.
198 200
199Added missing German translation. 201Added missing German translation.
200 202
201Fixed icons of executeable on Wintendo. 203Fixed icons of executeable on Wintendo.
202 204
203Added a "Show next Mail" button to the OM/Pi 205Added a "Show next Mail" button to the OM/Pi
204mail viewer such that the mail below the current mail 206mail viewer such that the mail below the current mail
205in the mail list view of the current folder 207in the mail list view of the current folder
206can be read with a single click. 208can be read with a single click.
207 209
208 210
209********** VERSION 1.9.13 ************ 211********** VERSION 1.9.13 ************
210 212
211Fixed nasty PwM/Pi file reading bug, when 213Fixed nasty PwM/Pi file reading bug, when
212the used hash algo of file is different then the global 214the used hash algo of file is different then the global
213hash algo. 215hash algo.
214 216
215Added KA/Pi support for opie mailit mailapplication. 217Added KA/Pi support for opie mailit mailapplication.
216 218
217Fixed some bugs in OM/Pi. 219Fixed some bugs in OM/Pi.
218Now character conversion tables are available for the Zaurus 220Now character conversion tables are available for the Zaurus
219to make OM/Pi working properly. 221to make OM/Pi working properly.
220To get the character conversion in OM/Pi working, please download 222To get the character conversion in OM/Pi working, please download
221at the sourceforge project site the package 223at the sourceforge project site the package
222sr-character-conversion_SharpROM_arm.ipk.zip 224sr-character-conversion_SharpROM_arm.ipk.zip
223(or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms) 225(or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms)
224from the section "general files for KDE/Pim" 226from the section "general files for KDE/Pim"
225Instructions how to install this package are in a ReadMe in this file. 227Instructions how to install this package are in a ReadMe in this file.
226 228
227 229
228Fixed the orientation change problem in KA/Pi when switching 230Fixed the orientation change problem in KA/Pi when switching
229portrait/landscape mode. 231portrait/landscape mode.
230 232
231French translation available for KA/Pi and OM/Pi. 233French translation available for KA/Pi and OM/Pi.
232 234
233Fixed some problems with categories in KO/Pi in DTM sync. 235Fixed some problems with categories in KO/Pi in DTM sync.
234 236
235Added selection dialog for export to phone in KA/Pi. 237Added selection dialog for export to phone in KA/Pi.
236 238
237If in KO/Pi is an attendee selected to add to a meeting and this 239If in KO/Pi is an attendee selected to add to a meeting and this
238attendee is already in the list of attendees, this person is not added 240attendee is already in the list of attendees, this person is not added
239again. 241again.
240 242
241Some menu cleanup in KA/Pi. 243Some menu cleanup in KA/Pi.
242 244
243********** VERSION 1.9.12 ************ 245********** VERSION 1.9.12 ************
244 246
245Fix for the bug in KO/Pi What's Next view of version 1.9.11. 247Fix for the bug in KO/Pi What's Next view of version 1.9.11.
246 248
247Bugfix: Licence file is now shown again. 249Bugfix: Licence file is now shown again.
248 250
249OM/Pi now supports Unicode (utf8 charset). 251OM/Pi now supports Unicode (utf8 charset).
250Fixed some bugs in OM/Pi. 252Fixed some bugs in OM/Pi.
251 253
252KA/Pi has more German translation. 254KA/Pi has more German translation.
253 255
254 256
255********** VERSION 1.9.11 ************ 257********** VERSION 1.9.11 ************
256 258
257Fixed several problems in PWM/Pi, like 259Fixed several problems in PWM/Pi, like
258asking the user, if unsaved changed are pending 260asking the user, if unsaved changed are pending
259when closing the app. 261when closing the app.
260And PwM/Pi handles now different texts for the 262And PwM/Pi handles now different texts for the
261fields Description, Username, Password, configurable per category. 263fields Description, Username, Password, configurable per category.
262 264
263Fixed a crash in KO/Pi , when importing/loading vcs files 265Fixed a crash in KO/Pi , when importing/loading vcs files
264which have an entry with an attendee with state: 266which have an entry with an attendee with state:
265NEEDS ACTION 267NEEDS ACTION
266 268
267Fixed some problems in the German translation of OM/Pi, 269Fixed some problems in the German translation of OM/Pi,
268which makes some dialogs not fitting on the screen 270which makes some dialogs not fitting on the screen
269of the Z 5500. 271of the Z 5500.
270 272
271Fixed Qtopia crash, when disabling/deinstalling 273Fixed Qtopia crash, when disabling/deinstalling
272KO/Pi alarm applet. 274KO/Pi alarm applet.
273 275
274Implemented direct KDE<->KA/Pi sync for KA/Pi running 276Implemented direct KDE<->KA/Pi sync for KA/Pi running
275on Linux desktop. 277on Linux desktop.
276 278
277Added feature "remove sync info" to sync menu. 279Added feature "remove sync info" to sync menu.
278 280
279Tweaked the KO/Pi What's next view a bit, added 281Tweaked the KO/Pi What's next view a bit, added
280setting to hide events that are done. 282setting to hide events that are done.
281 283
282Disabled "beam receive enabled" on startup to 284Disabled "beam receive enabled" on startup to
283avoid problems if Fastload is enabled. 285avoid problems if Fastload is enabled.
284Please set "beam receive enabled", 286Please set "beam receive enabled",
285if you want to receive data via IR. 287if you want to receive data via IR.
286 288
287Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running 289Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running
288on Linux desktop. 290on Linux desktop.
289 291
290Made in KA/Pi scrolling possible, if details view is selected. 292Made in KA/Pi scrolling possible, if details view is selected.
291(The keyboard focus is set automatically to the search line) 293(The keyboard focus is set automatically to the search line)
292 294
293Fixed a bug in DMT sync, that a new entry in DTM was added 295Fixed a bug in DMT sync, that a new entry in DTM was added
294on every sync to Kx/Pi. 296on every sync to Kx/Pi.
295 297
296Fixed missing writing of KA/Pi categories to DMT entries when syncing. 298Fixed missing writing of KA/Pi categories to DMT entries when syncing.
297 299
298Fixed a bug in DMT sync with todos created in KO/Pi containing 300Fixed a bug in DMT sync with todos created in KO/Pi containing
299non-latin1 characters. 301non-latin1 characters.
300 302
301Rearranged package contents of Sharp-ipks and made all 303Rearranged package contents of Sharp-ipks and made all
302packages installable on SD again. 304packages installable on SD again.
303 305
304Fixed the writing of addressbook data in DTM sync. 306Fixed the writing of addressbook data in DTM sync.
305Empty fields in KA/Pi were not removed. 307Empty fields in KA/Pi were not removed.
306 308
307Added better category handling in KA/Pi: 309Added better category handling in KA/Pi:
308Added item 310Added item
309Edit Categories and 311Edit Categories and
310Manage new categories 312Manage new categories
311to the settings menu. 313to the settings menu.
312Possible to configure a view to display categories. 314Possible to configure a view to display categories.
313 315
314Added detailed "KDE Sync Howto" and "Multi Sync Howto" to Help menu. 316Added detailed "KDE Sync Howto" and "Multi Sync Howto" to Help menu.
315 317
316Fixed displaying of "free" days and time in KO Monthview and Agendaview. 318Fixed displaying of "free" days and time in KO Monthview and Agendaview.
317 319
318... and many other bugfixes. 320... and many other bugfixes.
319 321
320********** VERSION 1.9.10 ************ 322********** VERSION 1.9.10 ************
321 323
322Many internal small bugfixes. 324Many internal small bugfixes.
323And fix of the "big" bug in KO/Pi, 325And fix of the "big" bug in KO/Pi,
324that after Syncing the appointments had an offset by several hours. 326that after Syncing the appointments had an offset by several hours.
325That was a problem with the internal timezone setting, 327That was a problem with the internal timezone setting,
326introduced by the changed timezone configuration settings. 328introduced by the changed timezone configuration settings.
327 329
328German translation for OM/Pi is now available. 330German translation for OM/Pi is now available.
329 331
330 332
331********** VERSION 1.9.9 ************ 333********** VERSION 1.9.9 ************
332 334
333KDE-Pim/Pi has a new Member! 335KDE-Pim/Pi has a new Member!
334It is called PWM/Pi (Passwordmanager/platform-independent) 336It is called PWM/Pi (Passwordmanager/platform-independent)
335and it is available for the Zaurus. 337and it is available for the Zaurus.
336It is planned, that it will be available later for Windows. 338It is planned, that it will be available later for Windows.
337(And for Linux, of course). 339(And for Linux, of course).
338It is a port of the Passwordmanager of KDE. 340It is a port of the Passwordmanager of KDE.
339It will need the MicroKDElibs to run. 341It will need the MicroKDElibs to run.
340 342
341Made loading of addressbooks in KA/Pi up to 7 times faster! 343Made loading of addressbooks in KA/Pi up to 7 times faster!
342The bigger your addressbook file, the more starting speed 344The bigger your addressbook file, the more starting speed
343will you gain. (relatively) 345will you gain. (relatively)
344 346
345The Qtopia addressbook connector is now platform independend 347The Qtopia addressbook connector is now platform independend
346as well and should work on any platform for importing/exporting 348as well and should work on any platform for importing/exporting
347Qtopia and Opie XML files. 349Qtopia and Opie XML files.
348 350
349Added a +30min feature to the timezone settings to make 351Added a +30min feature to the timezone settings to make
350KDE-Pim/Pi useable in Australia and other parts on the 352KDE-Pim/Pi useable in Australia and other parts on the
351world with strange timezones ;-) 353world with strange timezones ;-)
352 354
353German "Umlaute" should now be sorted correctly on the Z in KA/Pi. 355German "Umlaute" should now be sorted correctly on the Z in KA/Pi.
354 356
355It is now possible to disable the 357It is now possible to disable the
356"receive data via infrared" feature, such that syncing with 358"receive data via infrared" feature, such that syncing with
357Outlook is now possible again with Kx/Pi runing. 359Outlook is now possible again with Kx/Pi runing.
358Please disable it, before syncing Sharp DTM with Outlook. 360Please disable it, before syncing Sharp DTM with Outlook.
359For your convenience, the "receive data via infrared" feature 361For your convenience, the "receive data via infrared" feature
360is disabled automatically, if you sync Kx/Pi with DTM. 362is disabled automatically, if you sync Kx/Pi with DTM.
361You have to enable it again manually after syncing. 363You have to enable it again manually after syncing.
362Enabling this feature makes it impossible to start the 364Enabling this feature makes it impossible to start the
363Sharp DTM apps. If this feature is enabled, you will only get the 365Sharp DTM apps. If this feature is enabled, you will only get the
364alarm notification from KO/Pi and not from the Sharp calendar. 366alarm notification from KO/Pi and not from the Sharp calendar.
365This is very useful if you sync KO/Pi with Sharp DTM, 367This is very useful if you sync KO/Pi with Sharp DTM,
366because after syncing you usually would get notified about 368because after syncing you usually would get notified about
367an alarm by KO/Pi and the Sharp Calendar. 369an alarm by KO/Pi and the Sharp Calendar.
368 370
369Together with the Linux desktop version of KO/Pi 371Together with the Linux desktop version of KO/Pi
370it is now possible to sync KO/Pi on the Zaurus 372it is now possible to sync KO/Pi on the Zaurus
371with the complete KDE-desktop (3.3 or later) 373with the complete KDE-desktop (3.3 or later)
372calendar data easily. 374calendar data easily.
373That makes it possible to sync the Z with one 375That makes it possible to sync the Z with one
374click of a mouse with the KDE-Desktop. 376click of a mouse with the KDE-Desktop.
375This feature it available for all Zaurus platforms KO/Pi 377This feature it available for all Zaurus platforms KO/Pi
376is running on. 378is running on.
377The only thing needed is a running KO/Pi on Linux and 379The only thing needed is a running KO/Pi on Linux and
378a compiled version of the small 380a compiled version of the small
379KDE-Pim/Pi<->KDE-Desktop access command line program, 381KDE-Pim/Pi<->KDE-Desktop access command line program,
380which is in the KDE-Pim/Pi sources available. 382which is in the KDE-Pim/Pi sources available.
381 383
382The "KDE-desktop" syncing feature for KA/Pi will follow 384The "KDE-desktop" syncing feature for KA/Pi will follow
383in the next releases. 385in the next releases.
384 386
385Fixed the vcard export bug, which had the version 1.9.8. 387Fixed the vcard export bug, which had the version 1.9.8.
386 388
387Added missing GERMAN translation to KO/Pi. 389Added missing GERMAN translation to KO/Pi.
388Hi PsionX, could you add the missing french translation?Thx! 390Hi PsionX, could you add the missing french translation?Thx!
389 391
390Translation files for KA/Pi are available as well. 392Translation files for KA/Pi are available as well.
391GERMAN translation will be available in the next release. 393GERMAN translation will be available in the next release.
392PsionX ( yres, you again ;-) ), could you start translating 394PsionX ( yres, you again ;-) ), could you start translating
393KA/Pi? Thx! 395KA/Pi? Thx!
394 396
395You can download the version 1.9.9 at 397You can download the version 1.9.9 at
396 398
397http://sourceforge.net/project/showfiles.php?group_id=104103&package_id=112604 399http://sourceforge.net/project/showfiles.php?group_id=104103&package_id=112604
398 400
399Note: 401Note:
400To run the mail program OM/Pi you need libopenssl. 402To run the mail program OM/Pi you need libopenssl.
401A link to a download loaction is available at 403A link to a download loaction is available at
402ZSI at www.killefiz.de 404ZSI at www.killefiz.de
403 405
404 406
405********** VERSION 1.9.8 ************ 407********** VERSION 1.9.8 ************
406 408
407Fixed character decoding in OM/Pi. 409Fixed character decoding in OM/Pi.
408(e.g. German "Umlaute" were not displayed properly.) 410(e.g. German "Umlaute" were not displayed properly.)
409 411
410Made is possible to reparent todos in KO/Pi. 412Made is possible to reparent todos in KO/Pi.
diff --git a/kmicromail/accountview.h b/kmicromail/accountview.h
index fcf33d1..79ed2e7 100644
--- a/kmicromail/accountview.h
+++ b/kmicromail/accountview.h
@@ -1,46 +1,46 @@
1#ifndef ACCOUNTVIEW_H 1#ifndef ACCOUNTVIEW_H
2#define ACCOUNTVIEW_H 2#define ACCOUNTVIEW_H
3 3
4#include <qlistview.h> 4#include <qlistview.h>
5#include <qlist.h> 5#include <qlist.h>
6#include <opie2/osmartpointer.h> 6#include <opie2/osmartpointer.h>
7#include <libmailwrapper/mailtypes.h> 7#include <libmailwrapper/mailtypes.h>
8 8
9class Selectstore; 9class Selectstore;
10class Folder; 10class Folder;
11class AbstractMail; 11class AbstractMail;
12class Account; 12class Account;
13class IMAPviewItem; 13class IMAPviewItem;
14class MHviewItem; 14class MHviewItem;
15 15
16class AccountView : public QListView 16class AccountView : public QListView
17{ 17{
18 Q_OBJECT 18 Q_OBJECT
19 19
20public: 20public:
21 AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); 21 AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 );
22 virtual ~AccountView(); 22 virtual ~AccountView();
23 virtual void populate( QList<Account> list ); 23 virtual void populate( QList<Account> list );
24 virtual RecBodyP fetchBody(const Opie::Core::OSmartPointer<RecMail>&aMail); 24 virtual RecBodyP fetchBody(const Opie::Core::OSmartPointer<RecMail>&aMail);
25 virtual void downloadMails(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper); 25 virtual void downloadMails(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper);
26 virtual void downloadMailsInbox(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper); 26 virtual void downloadMailsInbox(const Opie::Core::OSmartPointer<Folder>&fromFolder,AbstractMail*fromWrapper);
27 virtual bool currentisDraft(); 27 virtual bool currentisDraft();
28 28 QValueList<MHviewItem*> allAccounts() { return mhAccounts;}
29public slots: 29public slots:
30 virtual void refreshAll(); 30 virtual void refreshAll();
31 virtual void refresh(QListViewItem *item); 31 virtual void refresh(QListViewItem *item);
32 virtual void refreshCurrent(); 32 virtual void refreshCurrent();
33 virtual void slotHold(int, QListViewItem *,const QPoint&,int); 33 virtual void slotHold(int, QListViewItem *,const QPoint&,int);
34 virtual void slotContextMenu(int id); 34 virtual void slotContextMenu(int id);
35 void setupFolderselect(Selectstore*sels); 35 void setupFolderselect(Selectstore*sels);
36 36
37signals: 37signals:
38 void refreshMailview(const QValueList<RecMailP>& ); 38 void refreshMailview(const QValueList<RecMailP>& );
39 39
40protected: 40protected:
41 QListViewItem* m_currentItem; 41 QListViewItem* m_currentItem;
42 QValueList<IMAPviewItem*> imapAccounts; 42 QValueList<IMAPviewItem*> imapAccounts;
43 QValueList<MHviewItem*> mhAccounts; 43 QValueList<MHviewItem*> mhAccounts;
44}; 44};
45 45
46#endif 46#endif
diff --git a/kmicromail/libmailwrapper/mailtypes.cpp b/kmicromail/libmailwrapper/mailtypes.cpp
index 89150ad..96d55e6 100644
--- a/kmicromail/libmailwrapper/mailtypes.cpp
+++ b/kmicromail/libmailwrapper/mailtypes.cpp
@@ -1,416 +1,433 @@
1#include "mailtypes.h" 1#include "mailtypes.h"
2 2
3//#include <opie2/odebug.h> 3//#include <opie2/odebug.h>
4 4
5#include <stdlib.h> 5#include <stdlib.h>
6 6
7using namespace Opie::Core; 7using namespace Opie::Core;
8RecMail::RecMail() 8RecMail::RecMail()
9 :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7) 9 :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7)
10{ 10{
11 init(); 11 init();
12} 12}
13 13
14RecMail::RecMail(const RecMail&old) 14RecMail::RecMail(const RecMail&old)
15 :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7) 15 :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7)
16{ 16{
17 init(); 17 init();
18 copy_old(old); 18 copy_old(old);
19 // odebug << "Copy constructor RecMail" << oendl; 19 // odebug << "Copy constructor RecMail" << oendl;
20} 20}
21 21
22RecMail::~RecMail() 22RecMail::~RecMail()
23{ 23{
24 wrapper = 0; 24 wrapper = 0;
25} 25}
26static bool stringCompareRec( const QString& s1, const QString& s2 ) 26static bool stringCompareRec( const QString& s1, const QString& s2 )
27{ 27{
28 if ( s1.isEmpty() && s2.isEmpty() ) 28 if ( s1.isEmpty() && s2.isEmpty() )
29 return true; 29 return true;
30 return s1 == s2; 30 return s1 == s2;
31} 31}
32 32
33const QString RecMail::MsgsizeString() const
34{
35
36 double s = msg_size;
37 int w = 0;
38 s/=1024;
39 if (s>999.0) {
40 s/=1024.0;
41 ++w;
42 }
43 QString fsize = QString::number( s, 'f', 2 );
44 if ( w == 0 ) {
45 fsize += "kB" ;
46 } else
47 fsize += "MB" ;
48 return fsize;
49}
33bool RecMail::isEqual( RecMail* r1 ) 50bool RecMail::isEqual( RecMail* r1 )
34{ 51{
35 if ( !stringCompareRec( isodate, r1->isodate ) ) { 52 if ( !stringCompareRec( isodate, r1->isodate ) ) {
36 //qDebug("date *%s* *%s* ", isodate.latin1(), r1->isodate.latin1()); 53 //qDebug("date *%s* *%s* ", isodate.latin1(), r1->isodate.latin1());
37 return false; 54 return false;
38 } 55 }
39 if ( !stringCompareRec( subject.left(40), r1->subject.left(40) ) ) { 56 if ( !stringCompareRec( subject.left(40), r1->subject.left(40) ) ) {
40 //qDebug("sub *%s* *%s*", subject.latin1(), r1->subject.latin1()); 57 //qDebug("sub *%s* *%s*", subject.latin1(), r1->subject.latin1());
41 return false; 58 return false;
42 } 59 }
43 60
44 //qDebug("date *%s* *%s* ", isodate.latin1(), r1->isodate.latin1()); 61 //qDebug("date *%s* *%s* ", isodate.latin1(), r1->isodate.latin1());
45 if ( !stringCompareRec( from.left(40), r1->from.left(40)) ) { 62 if ( !stringCompareRec( from.left(40), r1->from.left(40)) ) {
46 if ( r1->from.find ( from ) < 0 ) { 63 if ( r1->from.find ( from ) < 0 ) {
47 if ( !stringCompareRec( from.simplifyWhiteSpace ().left(40), r1->from.simplifyWhiteSpace ().left(40)) ) { 64 if ( !stringCompareRec( from.simplifyWhiteSpace ().left(40), r1->from.simplifyWhiteSpace ().left(40)) ) {
48 //qDebug("from *%s* *%s* ", from.left(40).latin1(), r1->from.left(20).latin1()); 65 //qDebug("from *%s* *%s* ", from.left(40).latin1(), r1->from.left(20).latin1());
49 return false; 66 return false;
50 } 67 }
51 } 68 }
52 } 69 }
53 70
54 return true; 71 return true;
55} 72}
56void RecMail::copy_old(const RecMail&old) 73void RecMail::copy_old(const RecMail&old)
57{ 74{
58 subject = old.subject; 75 subject = old.subject;
59 date = old.date; 76 date = old.date;
60 mbox = old.mbox; 77 mbox = old.mbox;
61 msg_id = old.msg_id; 78 msg_id = old.msg_id;
62 msg_size = old.msg_size; 79 msg_size = old.msg_size;
63 msg_number = old.msg_number; 80 msg_number = old.msg_number;
64 from = old.from; 81 from = old.from;
65 msg_flags = old.msg_flags; 82 msg_flags = old.msg_flags;
66 to = old.to; 83 to = old.to;
67 cc = old.cc; 84 cc = old.cc;
68 bcc = old.bcc; 85 bcc = old.bcc;
69 wrapper = old.wrapper; 86 wrapper = old.wrapper;
70 in_reply_to = old.in_reply_to; 87 in_reply_to = old.in_reply_to;
71 references = old.references; 88 references = old.references;
72 replyto = old.replyto; 89 replyto = old.replyto;
73} 90}
74 91
75void RecMail::init() 92void RecMail::init()
76{ 93{
77 to.clear(); 94 to.clear();
78 cc.clear(); 95 cc.clear();
79 bcc.clear(); 96 bcc.clear();
80 in_reply_to.clear(); 97 in_reply_to.clear();
81 references.clear(); 98 references.clear();
82 wrapper = 0; 99 wrapper = 0;
83} 100}
84 101
85void RecMail::setWrapper(AbstractMail*awrapper) 102void RecMail::setWrapper(AbstractMail*awrapper)
86{ 103{
87 wrapper = awrapper; 104 wrapper = awrapper;
88} 105}
89 106
90AbstractMail* RecMail::Wrapper() 107AbstractMail* RecMail::Wrapper()
91{ 108{
92 return wrapper; 109 return wrapper;
93} 110}
94 111
95void RecMail::setTo(const QStringList&list) 112void RecMail::setTo(const QStringList&list)
96{ 113{
97 to = list; 114 to = list;
98} 115}
99 116
100const QStringList&RecMail::To()const 117const QStringList&RecMail::To()const
101{ 118{
102 return to; 119 return to;
103} 120}
104 121
105void RecMail::setCC(const QStringList&list) 122void RecMail::setCC(const QStringList&list)
106{ 123{
107 cc = list; 124 cc = list;
108} 125}
109 126
110const QStringList&RecMail::CC()const 127const QStringList&RecMail::CC()const
111{ 128{
112 return cc; 129 return cc;
113} 130}
114 131
115void RecMail::setBcc(const QStringList&list) 132void RecMail::setBcc(const QStringList&list)
116{ 133{
117 bcc = list; 134 bcc = list;
118} 135}
119 136
120const QStringList& RecMail::Bcc()const 137const QStringList& RecMail::Bcc()const
121{ 138{
122 return bcc; 139 return bcc;
123} 140}
124 141
125void RecMail::setInreply(const QStringList&list) 142void RecMail::setInreply(const QStringList&list)
126{ 143{
127 in_reply_to = list; 144 in_reply_to = list;
128} 145}
129 146
130const QStringList& RecMail::Inreply()const 147const QStringList& RecMail::Inreply()const
131{ 148{
132 return in_reply_to; 149 return in_reply_to;
133} 150}
134 151
135void RecMail::setReferences(const QStringList&list) 152void RecMail::setReferences(const QStringList&list)
136{ 153{
137 references = list; 154 references = list;
138} 155}
139 156
140const QStringList& RecMail::References()const 157const QStringList& RecMail::References()const
141{ 158{
142 return references; 159 return references;
143} 160}
144 161
145RecPart::RecPart() 162RecPart::RecPart()
146 : Opie::Core::ORefCount(), 163 : Opie::Core::ORefCount(),
147 m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0) 164 m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0)
148{ 165{
149 m_Parameters.clear(); 166 m_Parameters.clear();
150 m_poslist.clear(); 167 m_poslist.clear();
151} 168}
152 169
153RecPart::RecPart(const RecPart&old) 170RecPart::RecPart(const RecPart&old)
154 : Opie::Core::ORefCount(), 171 : Opie::Core::ORefCount(),
155 m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0) 172 m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0)
156{ 173{
157 m_type = old.m_type; 174 m_type = old.m_type;
158 m_subtype = old.m_subtype; 175 m_subtype = old.m_subtype;
159 m_identifier = old.m_identifier; 176 m_identifier = old.m_identifier;
160 m_encoding = old.m_encoding; 177 m_encoding = old.m_encoding;
161 m_description = old.m_description; 178 m_description = old.m_description;
162 m_lines = old.m_lines; 179 m_lines = old.m_lines;
163 m_size = old.m_size; 180 m_size = old.m_size;
164 m_Parameters = old.m_Parameters; 181 m_Parameters = old.m_Parameters;
165 m_poslist = old.m_poslist; 182 m_poslist = old.m_poslist;
166 // odebug << "RecPart copy constructor" << oendl; 183 // odebug << "RecPart copy constructor" << oendl;
167} 184}
168 185
169RecPart::~RecPart() 186RecPart::~RecPart()
170{ 187{
171} 188}
172 189
173void RecPart::setSize(unsigned int size) 190void RecPart::setSize(unsigned int size)
174{ 191{
175 m_size = size; 192 m_size = size;
176} 193}
177 194
178const unsigned int RecPart::Size()const 195const unsigned int RecPart::Size()const
179{ 196{
180 return m_size; 197 return m_size;
181} 198}
182 199
183void RecPart::setLines(unsigned int lines) 200void RecPart::setLines(unsigned int lines)
184{ 201{
185 m_lines = lines; 202 m_lines = lines;
186} 203}
187 204
188const unsigned int RecPart::Lines()const 205const unsigned int RecPart::Lines()const
189{ 206{
190 return m_lines; 207 return m_lines;
191} 208}
192 209
193const QString& RecPart::Type()const 210const QString& RecPart::Type()const
194{ 211{
195 return m_type; 212 return m_type;
196} 213}
197 214
198void RecPart::setType(const QString&type) 215void RecPart::setType(const QString&type)
199{ 216{
200 m_type = type; 217 m_type = type;
201} 218}
202 219
203const QString& RecPart::Subtype()const 220const QString& RecPart::Subtype()const
204{ 221{
205 return m_subtype; 222 return m_subtype;
206} 223}
207 224
208void RecPart::setSubtype(const QString&subtype) 225void RecPart::setSubtype(const QString&subtype)
209{ 226{
210 m_subtype = subtype; 227 m_subtype = subtype;
211} 228}
212 229
213const QString& RecPart::Identifier()const 230const QString& RecPart::Identifier()const
214{ 231{
215 return m_identifier; 232 return m_identifier;
216} 233}
217 234
218void RecPart::setIdentifier(const QString&identifier) 235void RecPart::setIdentifier(const QString&identifier)
219{ 236{
220 m_identifier = identifier; 237 m_identifier = identifier;
221} 238}
222 239
223const QString& RecPart::Encoding()const 240const QString& RecPart::Encoding()const
224{ 241{
225 return m_encoding; 242 return m_encoding;
226} 243}
227 244
228void RecPart::setEncoding(const QString&encoding) 245void RecPart::setEncoding(const QString&encoding)
229{ 246{
230 m_encoding = encoding; 247 m_encoding = encoding;
231} 248}
232 249
233const QString& RecPart::Description()const 250const QString& RecPart::Description()const
234{ 251{
235 return m_description; 252 return m_description;
236} 253}
237 254
238void RecPart::setDescription(const QString&desc) 255void RecPart::setDescription(const QString&desc)
239{ 256{
240 m_description = desc; 257 m_description = desc;
241} 258}
242 259
243void RecPart::setParameters(const part_plist_t&list) 260void RecPart::setParameters(const part_plist_t&list)
244{ 261{
245 m_Parameters = list; 262 m_Parameters = list;
246} 263}
247 264
248const part_plist_t& RecPart::Parameters()const 265const part_plist_t& RecPart::Parameters()const
249{ 266{
250 return m_Parameters; 267 return m_Parameters;
251} 268}
252 269
253void RecPart::addParameter(const QString&key,const QString&value) 270void RecPart::addParameter(const QString&key,const QString&value)
254{ 271{
255 m_Parameters[key]=value; 272 m_Parameters[key]=value;
256} 273}
257 274
258const QString RecPart::searchParamter(const QString&key)const 275const QString RecPart::searchParamter(const QString&key)const
259{ 276{
260 QString value(""); 277 QString value("");
261 part_plist_t::ConstIterator it = m_Parameters.find(key); 278 part_plist_t::ConstIterator it = m_Parameters.find(key);
262 if (it != m_Parameters.end()) { 279 if (it != m_Parameters.end()) {
263 value = it.data(); 280 value = it.data();
264 } 281 }
265 return value; 282 return value;
266} 283}
267 284
268void RecPart::setPositionlist(const QValueList<int>&poslist) 285void RecPart::setPositionlist(const QValueList<int>&poslist)
269{ 286{
270 m_poslist = poslist; 287 m_poslist = poslist;
271} 288}
272 289
273const QValueList<int>& RecPart::Positionlist()const 290const QValueList<int>& RecPart::Positionlist()const
274{ 291{
275 return m_poslist; 292 return m_poslist;
276} 293}
277 294
278RecBody::RecBody() 295RecBody::RecBody()
279 : Opie::Core::ORefCount(),m_BodyText(),m_description(new RecPart()) 296 : Opie::Core::ORefCount(),m_BodyText(),m_description(new RecPart())
280{ 297{
281 m_PartsList.clear(); 298 m_PartsList.clear();
282} 299}
283 300
284RecBody::RecBody(const RecBody&old) 301RecBody::RecBody(const RecBody&old)
285 :Opie::Core::ORefCount(),m_BodyText(),m_PartsList(),m_description(new RecPart()) 302 :Opie::Core::ORefCount(),m_BodyText(),m_PartsList(),m_description(new RecPart())
286{ 303{
287 m_BodyText = old.m_BodyText; 304 m_BodyText = old.m_BodyText;
288 m_PartsList = old.m_PartsList; 305 m_PartsList = old.m_PartsList;
289 m_description = old.m_description; 306 m_description = old.m_description;
290 mCharset = old.mCharset; 307 mCharset = old.mCharset;
291 // odebug << "Recbody copy constructor" << oendl; 308 // odebug << "Recbody copy constructor" << oendl;
292} 309}
293 310
294RecBody::~RecBody() 311RecBody::~RecBody()
295{ 312{
296} 313}
297 314
298void RecBody::setBodytext(const QString&bodyText) 315void RecBody::setBodytext(const QString&bodyText)
299{ 316{
300 m_BodyText = bodyText; 317 m_BodyText = bodyText;
301} 318}
302 319
303const QString& RecBody::Bodytext()const 320const QString& RecBody::Bodytext()const
304{ 321{
305 return m_BodyText; 322 return m_BodyText;
306} 323}
307 324
308void RecBody::setParts(const QValueList<RecPartP>&parts) 325void RecBody::setParts(const QValueList<RecPartP>&parts)
309{ 326{
310 m_PartsList.clear(); 327 m_PartsList.clear();
311 m_PartsList = parts; 328 m_PartsList = parts;
312} 329}
313 330
314const QValueList<RecPartP>& RecBody::Parts()const 331const QValueList<RecPartP>& RecBody::Parts()const
315{ 332{
316 return m_PartsList; 333 return m_PartsList;
317} 334}
318 335
319void RecBody::addPart(const RecPartP& part) 336void RecBody::addPart(const RecPartP& part)
320{ 337{
321 m_PartsList.append(part); 338 m_PartsList.append(part);
322} 339}
323 340
324void RecBody::setDescription(const RecPartP&des) 341void RecBody::setDescription(const RecPartP&des)
325{ 342{
326 m_description = des; 343 m_description = des;
327} 344}
328 345
329const RecPartP& RecBody::Description()const 346const RecPartP& RecBody::Description()const
330{ 347{
331 return m_description; 348 return m_description;
332} 349}
333 350
334void RecBody::setCharset(const QString& str) 351void RecBody::setCharset(const QString& str)
335{ 352{
336 mCharset = str; 353 mCharset = str;
337} 354}
338 355
339QString RecBody::getCharset()const 356QString RecBody::getCharset()const
340{ 357{
341 return mCharset; 358 return mCharset;
342} 359}
343 360
344/* handling encoded content */ 361/* handling encoded content */
345encodedString::encodedString() 362encodedString::encodedString()
346{ 363{
347 init(); 364 init();
348} 365}
349 366
350encodedString::encodedString(const char*nContent,unsigned int nSize) 367encodedString::encodedString(const char*nContent,unsigned int nSize)
351{ 368{
352 init(); 369 init();
353 setContent(nContent,nSize); 370 setContent(nContent,nSize);
354} 371}
355 372
356encodedString::encodedString(char*nContent,unsigned int nSize) 373encodedString::encodedString(char*nContent,unsigned int nSize)
357{ 374{
358 init(); 375 init();
359 setContent(nContent,nSize); 376 setContent(nContent,nSize);
360} 377}
361 378
362encodedString::encodedString(const encodedString&old) 379encodedString::encodedString(const encodedString&old)
363{ 380{
364 init(); 381 init();
365 copy_old(old); 382 copy_old(old);
366 // odebug << "encodedeString: copy constructor!" << oendl; 383 // odebug << "encodedeString: copy constructor!" << oendl;
367} 384}
368 385
369encodedString& encodedString::operator=(const encodedString&old) 386encodedString& encodedString::operator=(const encodedString&old)
370{ 387{
371 init(); 388 init();
372 copy_old(old); 389 copy_old(old);
373 // odebug << "encodedString: assign operator!" << oendl; 390 // odebug << "encodedString: assign operator!" << oendl;
374 return *this; 391 return *this;
375} 392}
376 393
377encodedString::~encodedString() 394encodedString::~encodedString()
378{ 395{
379 clean(); 396 clean();
380} 397}
381 398
382void encodedString::init() 399void encodedString::init()
383{ 400{
384 content = 0; 401 content = 0;
385 size = 0; 402 size = 0;
386} 403}
387 404
388void encodedString::clean() 405void encodedString::clean()
389{ 406{
390 if (content) { 407 if (content) {
391 free(content); 408 free(content);
392 } 409 }
393 content = 0; 410 content = 0;
394 size = 0; 411 size = 0;
395} 412}
396 413
397void encodedString::copy_old(const encodedString&old) 414void encodedString::copy_old(const encodedString&old)
398{ 415{
399 clean(); 416 clean();
400 if (old.size>0 && old.content) { 417 if (old.size>0 && old.content) {
401 content = (char*)malloc(old.size*sizeof(char)); 418 content = (char*)malloc(old.size*sizeof(char));
402 memcpy(content,old.content,size); 419 memcpy(content,old.content,size);
403 size = old.size; 420 size = old.size;
404 } 421 }
405} 422}
406 423
407const char*encodedString::Content()const 424const char*encodedString::Content()const
408{ 425{
409 return content; 426 return content;
410} 427}
411 428
412const int encodedString::Length()const 429const int encodedString::Length()const
413{ 430{
414 return size; 431 return size;
415} 432}
416 433
diff --git a/kmicromail/libmailwrapper/mailtypes.h b/kmicromail/libmailwrapper/mailtypes.h
index 32d92c0..39c0bac 100644
--- a/kmicromail/libmailwrapper/mailtypes.h
+++ b/kmicromail/libmailwrapper/mailtypes.h
@@ -1,214 +1,215 @@
1#ifndef __MAIL_TYPES_H 1#ifndef __MAIL_TYPES_H
2#define __MAIL_TYPES_H 2#define __MAIL_TYPES_H
3 3
4#define FLAG_ANSWERED 0 4#define FLAG_ANSWERED 0
5#define FLAG_FLAGGED 1 5#define FLAG_FLAGGED 1
6#define FLAG_DELETED 2 6#define FLAG_DELETED 2
7#define FLAG_SEEN 3 7#define FLAG_SEEN 3
8#define FLAG_DRAFT 4 8#define FLAG_DRAFT 4
9#define FLAG_RECENT 5 9#define FLAG_RECENT 5
10 10
11#include <opie2/osmartpointer.h> 11#include <opie2/osmartpointer.h>
12 12
13#include <qbitarray.h> 13#include <qbitarray.h>
14#include <qstring.h> 14#include <qstring.h>
15#include <qstringlist.h> 15#include <qstringlist.h>
16#include <qmap.h> 16#include <qmap.h>
17#include <qvaluelist.h> 17#include <qvaluelist.h>
18 18
19class AbstractMail; 19class AbstractMail;
20/* a class to describe mails in a mailbox */ 20/* a class to describe mails in a mailbox */
21/* Attention! 21/* Attention!
22 From programmers point of view it would make sense to 22 From programmers point of view it would make sense to
23 store the mail body into this class, too. 23 store the mail body into this class, too.
24 But: not from the point of view of the device. 24 But: not from the point of view of the device.
25 Mailbodies can be real large. So we request them when 25 Mailbodies can be real large. So we request them when
26 needed from the mail-wrapper class direct from the server itself 26 needed from the mail-wrapper class direct from the server itself
27 (imap) or from a file-based cache (pop3?) 27 (imap) or from a file-based cache (pop3?)
28 So there is no interface "const QString&body()" but you should 28 So there is no interface "const QString&body()" but you should
29 make a request to the mailwrapper with this class as parameter to 29 make a request to the mailwrapper with this class as parameter to
30 get the body. Same words for the attachments. 30 get the body. Same words for the attachments.
31*/ 31*/
32class RecMail:public Opie::Core::ORefCount 32class RecMail:public Opie::Core::ORefCount
33{ 33{
34public: 34public:
35 RecMail(); 35 RecMail();
36 RecMail(const RecMail&old); 36 RecMail(const RecMail&old);
37 virtual ~RecMail(); 37 virtual ~RecMail();
38 bool isEqual( RecMail* r1 ); 38 bool isEqual( RecMail* r1 );
39 39
40 const unsigned int getNumber()const{return msg_number;} 40 const unsigned int getNumber()const{return msg_number;}
41 void setNumber(unsigned int number){msg_number=number;} 41 void setNumber(unsigned int number){msg_number=number;}
42 const QString&getDate()const{ return date; } 42 const QString&getDate()const{ return date; }
43 void setDate( const QString&a ) { date = a; } 43 void setDate( const QString&a ) { date = a; }
44 const QString&getIsoDate()const{ return isodate; } 44 const QString&getIsoDate()const{ return isodate; }
45 void setIsoDate( const QString&a ) { isodate = a; } 45 void setIsoDate( const QString&a ) { isodate = a; }
46 const QString&getFrom()const{ return from; } 46 const QString&getFrom()const{ return from; }
47 void setFrom( const QString&a ) { from = a; } 47 void setFrom( const QString&a ) { from = a; }
48 const QString&getSubject()const { return subject; } 48 const QString&getSubject()const { return subject; }
49 void setSubject( const QString&s ) { subject = s; } 49 void setSubject( const QString&s ) { subject = s; }
50 const QString&getMbox()const{return mbox;} 50 const QString&getMbox()const{return mbox;}
51 void setMbox(const QString&box){mbox = box;} 51 void setMbox(const QString&box){mbox = box;}
52 void setMsgid(const QString&id){msg_id=id;} 52 void setMsgid(const QString&id){msg_id=id;}
53 const QString&Msgid()const{return msg_id;} 53 const QString&Msgid()const{return msg_id;}
54 void setReplyto(const QString&reply){replyto=reply;} 54 void setReplyto(const QString&reply){replyto=reply;}
55 const QString&Replyto()const{return replyto;} 55 const QString&Replyto()const{return replyto;}
56 void setMsgsize(unsigned int size){msg_size = size;} 56 void setMsgsize(unsigned int size){msg_size = size;}
57 const unsigned int Msgsize()const{return msg_size;} 57 const unsigned int Msgsize()const{return msg_size;}
58 const QString MsgsizeString()const;
58 59
59 60
60 void setTo(const QStringList&list); 61 void setTo(const QStringList&list);
61 const QStringList&To()const; 62 const QStringList&To()const;
62 void setCC(const QStringList&list); 63 void setCC(const QStringList&list);
63 const QStringList&CC()const; 64 const QStringList&CC()const;
64 void setBcc(const QStringList&list); 65 void setBcc(const QStringList&list);
65 const QStringList&Bcc()const; 66 const QStringList&Bcc()const;
66 void setInreply(const QStringList&list); 67 void setInreply(const QStringList&list);
67 const QStringList&Inreply()const; 68 const QStringList&Inreply()const;
68 void setReferences(const QStringList&list); 69 void setReferences(const QStringList&list);
69 const QStringList&References()const; 70 const QStringList&References()const;
70 71
71 const QBitArray&getFlags()const{return msg_flags;} 72 const QBitArray&getFlags()const{return msg_flags;}
72 void setFlags(const QBitArray&flags){msg_flags = flags;} 73 void setFlags(const QBitArray&flags){msg_flags = flags;}
73 74
74 void setWrapper(AbstractMail*wrapper); 75 void setWrapper(AbstractMail*wrapper);
75 AbstractMail* Wrapper(); 76 AbstractMail* Wrapper();
76 // public for debugging 77 // public for debugging
77 QString subject,date,isodate,from,mbox,msg_id,replyto; 78 QString subject,date,isodate,from,mbox,msg_id,replyto;
78 79
79protected: 80protected:
80 //QString subject,date,isodate,from,mbox,msg_id,replyto; 81 //QString subject,date,isodate,from,mbox,msg_id,replyto;
81 unsigned int msg_number,msg_size; 82 unsigned int msg_number,msg_size;
82 QBitArray msg_flags; 83 QBitArray msg_flags;
83 QStringList to,cc,bcc,in_reply_to,references; 84 QStringList to,cc,bcc,in_reply_to,references;
84 AbstractMail*wrapper; 85 AbstractMail*wrapper;
85 void init(); 86 void init();
86 void copy_old(const RecMail&old); 87 void copy_old(const RecMail&old);
87}; 88};
88 89
89typedef Opie::Core::OSmartPointer<RecMail> RecMailP; 90typedef Opie::Core::OSmartPointer<RecMail> RecMailP;
90typedef QMap<QString,QString> part_plist_t; 91typedef QMap<QString,QString> part_plist_t;
91 92
92class RecPart:public Opie::Core::ORefCount 93class RecPart:public Opie::Core::ORefCount
93{ 94{
94protected: 95protected:
95 QString m_type,m_subtype,m_identifier,m_encoding,m_description; 96 QString m_type,m_subtype,m_identifier,m_encoding,m_description;
96 unsigned int m_lines,m_size; 97 unsigned int m_lines,m_size;
97 part_plist_t m_Parameters; 98 part_plist_t m_Parameters;
98 /* describes the position in the mail */ 99 /* describes the position in the mail */
99 QValueList<int> m_poslist; 100 QValueList<int> m_poslist;
100 101
101public: 102public:
102 RecPart(); 103 RecPart();
103 RecPart(const RecPart&); 104 RecPart(const RecPart&);
104 virtual ~RecPart(); 105 virtual ~RecPart();
105 106
106 const QString&Type()const; 107 const QString&Type()const;
107 void setType(const QString&type); 108 void setType(const QString&type);
108 const QString&Subtype()const; 109 const QString&Subtype()const;
109 void setSubtype(const QString&subtype); 110 void setSubtype(const QString&subtype);
110 const QString&Identifier()const; 111 const QString&Identifier()const;
111 void setIdentifier(const QString&identifier); 112 void setIdentifier(const QString&identifier);
112 const QString&Encoding()const; 113 const QString&Encoding()const;
113 void setEncoding(const QString&encoding); 114 void setEncoding(const QString&encoding);
114 const QString&Description()const; 115 const QString&Description()const;
115 void setDescription(const QString&desc); 116 void setDescription(const QString&desc);
116 void setLines(unsigned int lines); 117 void setLines(unsigned int lines);
117 const unsigned int Lines()const; 118 const unsigned int Lines()const;
118 void setSize(unsigned int size); 119 void setSize(unsigned int size);
119 const unsigned int Size()const; 120 const unsigned int Size()const;
120 121
121 122
122 void setParameters(const part_plist_t&list); 123 void setParameters(const part_plist_t&list);
123 const part_plist_t&Parameters()const; 124 const part_plist_t&Parameters()const;
124 void addParameter(const QString&key,const QString&value); 125 void addParameter(const QString&key,const QString&value);
125 const QString searchParamter(const QString&key)const; 126 const QString searchParamter(const QString&key)const;
126 void setPositionlist(const QValueList<int>&poslist); 127 void setPositionlist(const QValueList<int>&poslist);
127 const QValueList<int>& Positionlist()const; 128 const QValueList<int>& Positionlist()const;
128}; 129};
129 130
130typedef Opie::Core::OSmartPointer<RecPart> RecPartP; 131typedef Opie::Core::OSmartPointer<RecPart> RecPartP;
131 132
132class RecBody:public Opie::Core::ORefCount 133class RecBody:public Opie::Core::ORefCount
133{ 134{
134protected: 135protected:
135 QString m_BodyText; 136 QString m_BodyText;
136 QString mCharset; 137 QString mCharset;
137 QValueList<RecPartP> m_PartsList; 138 QValueList<RecPartP> m_PartsList;
138 RecPartP m_description; 139 RecPartP m_description;
139 140
140public: 141public:
141 RecBody(); 142 RecBody();
142 RecBody(const RecBody&old); 143 RecBody(const RecBody&old);
143 virtual ~RecBody(); 144 virtual ~RecBody();
144 void setBodytext(const QString&); 145 void setBodytext(const QString&);
145 const QString& Bodytext()const; 146 const QString& Bodytext()const;
146 void setCharset(const QString&); 147 void setCharset(const QString&);
147 QString getCharset()const; 148 QString getCharset()const;
148 149
149 void setDescription(const RecPartP&des); 150 void setDescription(const RecPartP&des);
150 const RecPartP& Description()const; 151 const RecPartP& Description()const;
151 152
152 void setParts(const QValueList<RecPartP>&parts); 153 void setParts(const QValueList<RecPartP>&parts);
153 const QValueList<RecPartP>& Parts()const; 154 const QValueList<RecPartP>& Parts()const;
154 void addPart(const RecPartP&part); 155 void addPart(const RecPartP&part);
155}; 156};
156 157
157typedef Opie::Core::OSmartPointer<RecBody> RecBodyP; 158typedef Opie::Core::OSmartPointer<RecBody> RecBodyP;
158 159
159class encodedString 160class encodedString
160{ 161{
161public: 162public:
162 encodedString(); 163 encodedString();
163 /* 164 /*
164 creates an new content string. 165 creates an new content string.
165 it makes a deep copy of it! 166 it makes a deep copy of it!
166 */ 167 */
167 encodedString(const char*nContent,unsigned int length); 168 encodedString(const char*nContent,unsigned int length);
168 /* 169 /*
169 Take over the nContent. Means: it will just copy the pointer, not the content. 170 Take over the nContent. Means: it will just copy the pointer, not the content.
170 so make sure: No one else frees the string, the string has allocated with 171 so make sure: No one else frees the string, the string has allocated with
171 malloc for compatibility with c-based libs 172 malloc for compatibility with c-based libs
172 */ 173 */
173 encodedString(char*nContent,unsigned int nSize); 174 encodedString(char*nContent,unsigned int nSize);
174 /* copy construkor - makes ALWAYS a deep copy!!!! */ 175 /* copy construkor - makes ALWAYS a deep copy!!!! */
175 encodedString(const encodedString&old); 176 encodedString(const encodedString&old);
176 /* assign operator - makes ALWAYS a deep copy!!!! */ 177 /* assign operator - makes ALWAYS a deep copy!!!! */
177 encodedString& operator=(const encodedString&old); 178 encodedString& operator=(const encodedString&old);
178 /* destructor - cleans the content */ 179 /* destructor - cleans the content */
179 virtual ~encodedString(); 180 virtual ~encodedString();
180 181
181 /* returns a pointer to the content - do not delete yoursel! */ 182 /* returns a pointer to the content - do not delete yoursel! */
182 const char*Content()const; 183 const char*Content()const;
183 /* returns the lengths of the content 'cause it must not be a null-terminated string! */ 184 /* returns the lengths of the content 'cause it must not be a null-terminated string! */
184 const int Length()const; 185 const int Length()const;
185 186
186 /* 187 /*
187 makes a deep copy of nContent! 188 makes a deep copy of nContent!
188 */ 189 */
189 void setContent(const char*nContent,int nSize); 190 void setContent(const char*nContent,int nSize);
190 /* 191 /*
191 Take over the nContent. Means: it will just copy the pointer, not the content. 192 Take over the nContent. Means: it will just copy the pointer, not the content.
192 so make sure: No one else frees the string, the string has allocated with 193 so make sure: No one else frees the string, the string has allocated with
193 malloc for compatibility with c-based libs 194 malloc for compatibility with c-based libs
194 */ 195 */
195 void setContent(char*nContent,int nSize); 196 void setContent(char*nContent,int nSize);
196 197
197protected: 198protected:
198 char * content; 199 char * content;
199 unsigned int size; 200 unsigned int size;
200 201
201 void init(); 202 void init();
202 void copy_old(const encodedString&old); 203 void copy_old(const encodedString&old);
203 void clean(); 204 void clean();
204}; 205};
205 206
206struct folderStat 207struct folderStat
207{ 208{
208 unsigned int message_count; 209 unsigned int message_count;
209 unsigned int message_unseen; 210 unsigned int message_unseen;
210 unsigned int message_recent; 211 unsigned int message_recent;
211 folderStat&operator=(const folderStat&old); 212 folderStat&operator=(const folderStat&old);
212}; 213};
213 214
214#endif 215#endif
diff --git a/kmicromail/mailistviewitem.cpp b/kmicromail/mailistviewitem.cpp
index ffb835c..137c482 100644
--- a/kmicromail/mailistviewitem.cpp
+++ b/kmicromail/mailistviewitem.cpp
@@ -1,103 +1,95 @@
1// CHANGED 2004-08-06 Lutz Rogowski 1// CHANGED 2004-08-06 Lutz Rogowski
2#include "mailistviewitem.h" 2#include "mailistviewitem.h"
3#include <libmailwrapper/abstractmail.h> 3#include <libmailwrapper/abstractmail.h>
4#include <qtextstream.h> 4#include <qtextstream.h>
5#include <kiconloader.h> 5#include <kiconloader.h>
6#include "koprefs.h" 6#include "koprefs.h"
7//#include <qpe/resource.h> 7//#include <qpe/resource.h>
8 8
9MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) 9MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item )
10 :QListViewItem(parent,item),mail_data() 10 :QListViewItem(parent,item),mail_data()
11{ 11{
12} 12}
13 13
14void MailListViewItem::showEntry() 14void MailListViewItem::showEntry()
15{ 15{
16 if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) { 16 if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) {
17 setPixmap( 0, SmallIcon ( "kmmsgreplied") ); 17 setPixmap( 0, SmallIcon ( "kmmsgreplied") );
18 } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) { 18 } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) {
19 /* I think it looks nicer if there are not such a log of icons but only on mails 19 /* I think it looks nicer if there are not such a log of icons but only on mails
20 replied or new - Alwin*/ 20 replied or new - Alwin*/
21 //setPixmap( 0,SmallIcon ("kmmsgunseen") ); 21 //setPixmap( 0,SmallIcon ("kmmsgunseen") );
22 } else { 22 } else {
23 setPixmap( 0,SmallIcon ( "kmmsgnew") ); 23 setPixmap( 0,SmallIcon ( "kmmsgnew") );
24 } 24 }
25 double s = mail_data->Msgsize(); 25 QString fsize = mail_data->MsgsizeString();
26 int w = 0;
27 s/=1024;
28 if (s>999.0) {
29 s/=1024.0;
30 ++w;
31 }
32 QString fsort;
33 fsort.sprintf( "%.2f", s );
34 QString fsize = QString::number( s, 'f', 2 );
35 // 1.23 26 // 1.23
36 // 11.23 27 // 11.23
37 // 111.23 28 // 111.23
38 // 999.23 maxlen 29 // 999.23 maxlen
30 QString fsort;
39 switch(fsize.length() ) { 31 switch(fsize.length() ) {
40 case 4: 32 case 6:
41 fsort = "00" + fsize ; 33 fsort = "00" + fsize ;
42 break; 34 break;
43 case 5: 35 case 7:
44 fsort = "0" + fsize ; 36 fsort = "0" + fsize ;
45 break; 37 break;
46 default: 38 default:
47 fsort = fsize ; 39 fsort = fsize ;
48 break; 40 break;
49 41
50 } 42 }
51 if ( w == 0 ) { 43 setText(3, fsize );
52 setText(3, fsize + "kB" ); 44 //qDebug("fsize *%s* ",fsize.latin1() );
45 //qDebug("fsort *%s* ",fsort.latin1() );
46 if ( fsize.right(2) == "kB" ) {
53 mKeyMap.insert(3, "k" + fsort); 47 mKeyMap.insert(3, "k" + fsort);
54 //setText(3, "kB" + fsort ); // test only
55 } else { 48 } else {
56 //setText(3, fsize + "MB");
57 mKeyMap.insert(3, "M" +fsort ); 49 mKeyMap.insert(3, "M" +fsort );
58 } 50 }
59 setText(1,mail_data->getSubject()); 51 setText(1,mail_data->getSubject());
60 setText(2,mail_data->getFrom()); 52 setText(2,mail_data->getFrom());
61 mKeyMap.insert(4,mail_data->getIsoDate()); 53 mKeyMap.insert(4,mail_data->getIsoDate());
62 setText(4,mail_data->getDate()); 54 setText(4,mail_data->getDate());
63 if ( KOPrefs::instance()->mShowToField ) 55 if ( KOPrefs::instance()->mShowToField )
64 setText(5,mail_data->To()[0]); 56 setText(5,mail_data->To()[0]);
65} 57}
66 58
67void MailListViewItem::storeData(const RecMailP&data) 59void MailListViewItem::storeData(const RecMailP&data)
68{ 60{
69 mail_data = data; 61 mail_data = data;
70} 62}
71void MailListViewItem::setSortKey(int column,const QString &key) 63void MailListViewItem::setSortKey(int column,const QString &key)
72{ 64{
73 mKeyMap.insert(column,key); 65 mKeyMap.insert(column,key);
74} 66}
75QString MailListViewItem::key(int column, bool) const 67QString MailListViewItem::key(int column, bool) const
76{ 68{
77 // to make is fast, we use here special cases 69 // to make is fast, we use here special cases
78 if ( column == 3 || column == 4 ) { 70 if ( column == 3 || column == 4 ) {
79 return *mKeyMap.find(column); 71 return *mKeyMap.find(column);
80 } 72 }
81 if ( column == 1 ) { 73 if ( column == 1 ) {
82 if ( text(1).left(4).lower() == "re: " ) 74 if ( text(1).left(4).lower() == "re: " )
83 return text(1).mid(4); 75 return text(1).mid(4);
84 76
85 } 77 }
86 return text(column); 78 return text(column);
87 /* 79 /*
88 QMap<int,QString>::ConstIterator it = mKeyMap.find(column); 80 QMap<int,QString>::ConstIterator it = mKeyMap.find(column);
89 if (it == mKeyMap.end()) return text(column); 81 if (it == mKeyMap.end()) return text(column);
90 else return *it; 82 else return *it;
91 */ 83 */
92} 84}
93 85
94const RecMailP& MailListViewItem::data()const 86const RecMailP& MailListViewItem::data()const
95{ 87{
96 return mail_data; 88 return mail_data;
97} 89}
98 90
99MAILLIB::ATYPE MailListViewItem::wrapperType() 91MAILLIB::ATYPE MailListViewItem::wrapperType()
100{ 92{
101 if (!mail_data->Wrapper()) return MAILLIB::A_UNDEFINED; 93 if (!mail_data->Wrapper()) return MAILLIB::A_UNDEFINED;
102 return mail_data->Wrapper()->getType(); 94 return mail_data->Wrapper()->getType();
103} 95}
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp
index 6e54bf4..760e3b0 100644
--- a/kmicromail/opiemail.cpp
+++ b/kmicromail/opiemail.cpp
@@ -1,602 +1,638 @@
1// CHANGED 2004-09-31 Lutz Rogowski 1// CHANGED 2004-09-31 Lutz Rogowski
2// CHANGED 2004-08-06 Lutz Rogowski 2// CHANGED 2004-08-06 Lutz Rogowski
3 3
4 4
5#define protected public 5#define protected public
6#include <qwidget.h> 6#include <qwidget.h>
7#undef protected 7#undef protected
8#include "koprefsdialog.h" 8#include "koprefsdialog.h"
9#include <kapplication.h> 9#include <kapplication.h>
10#include <libkdepim/externalapphandler.h> 10#include <libkdepim/externalapphandler.h>
11#include <libkdepim/kpimglobalprefs.h> 11#include <libkdepim/kpimglobalprefs.h>
12#ifdef MINIKDE_KDIALOG_H 12#ifdef MINIKDE_KDIALOG_H
13#undef MINIKDE_KDIALOG_H 13#undef MINIKDE_KDIALOG_H
14#endif 14#endif
15#include "settingsdialog.h" 15#include "settingsdialog.h"
16#include "opiemail.h" 16#include "opiemail.h"
17#include "editaccounts.h" 17#include "editaccounts.h"
18#include "composemail.h" 18#include "composemail.h"
19#include "mailistviewitem.h" 19#include "mailistviewitem.h"
20#include "viewmail.h" 20#include "viewmail.h"
21#include "selectstore.h" 21#include "selectstore.h"
22#include "selectsmtp.h" 22#include "selectsmtp.h"
23#include "accountitem.h" 23#include "accountitem.h"
24#include "accountview.h"
24#include "klocale.h" 25#include "klocale.h"
25 26
26#include <qmessagebox.h> 27#include <qmessagebox.h>
27#include <qtimer.h> 28#include <qtimer.h>
28#include <qcursor.h> 29#include <qcursor.h>
29#include <qtextbrowser.h> 30#include <qtextbrowser.h>
30#include <qregexp.h> 31#include <qregexp.h>
31#include <qpe/global.h> 32#include <qpe/global.h>
32 33
33#ifdef DESKTOP_VERSION 34#ifdef DESKTOP_VERSION
34#include <qapplication.h> 35#include <qapplication.h>
35#else 36#else
36#include <qpe/qpeapplication.h> 37#include <qpe/qpeapplication.h>
37#endif 38#endif
38#include <libmailwrapper/smtpwrapper.h> 39#include <libmailwrapper/smtpwrapper.h>
39#include <libmailwrapper/mailtypes.h> 40#include <libmailwrapper/mailtypes.h>
40#include <libmailwrapper/abstractmail.h> 41#include <libmailwrapper/abstractmail.h>
41#include "koprefs.h" 42#include "koprefs.h"
42 43
43//using namespace Opie::Core; 44//using namespace Opie::Core;
44 45
45OpieMail::OpieMail( QWidget *parent, const char *name ) 46OpieMail::OpieMail( QWidget *parent, const char *name )
46 : MainWindow( parent, name) //, WStyle_ContextHelp ) 47 : MainWindow( parent, name) //, WStyle_ContextHelp )
47{ 48{
48 settings = new Settings(); 49 settings = new Settings();
49 tb = 0; 50 tb = 0;
50 setIcon(SmallIcon( "kmicromail" ) ); 51 setIcon(SmallIcon( "kmicromail" ) );
51 folderView->populate( settings->getAccounts() ); 52 folderView->populate( settings->getAccounts() );
52 53
53} 54}
54 55
55OpieMail::~OpieMail() 56OpieMail::~OpieMail()
56{ 57{
57 if (settings) delete settings; 58 if (settings) delete settings;
58 if ( tb ) 59 if ( tb )
59 delete tb; 60 delete tb;
60} 61}
61 62
62void OpieMail::appMessage(const QCString &msg, const QByteArray &data) 63void OpieMail::appMessage(const QCString &msg, const QByteArray &data)
63{ 64{
64 65
65} 66}
66#include <stdlib.h> 67#include <stdlib.h>
67void OpieMail::message(const QCString &msg, const QByteArray &data) 68void OpieMail::message(const QCString &msg, const QByteArray &data)
68{ 69{
69 // copied from old mail2 70 // copied from old mail2
70 static int ii = 0; 71 static int ii = 0;
71 //qDebug("QCOP CALL ############################# %d ", ii); 72 //qDebug("QCOP CALL ############################# %d ", ii);
72 //QString mess ( msg ); 73 //QString mess ( msg );
73 //qDebug("Message = %s ",mess.latin1()); 74 //qDebug("Message = %s ",mess.latin1());
74 ++ii; 75 ++ii;
75 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); 76 //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this);
76 77
77 mPendingEmail = QString::null; 78 mPendingEmail = QString::null;
78 mPendingName = QString::null; 79 mPendingName = QString::null;
79 if (msg == "writeMail(QString,QString)") 80 if (msg == "writeMail(QString,QString)")
80 { 81 {
81 //qDebug("writeMail(QString,QString) "); 82 //qDebug("writeMail(QString,QString) ");
82 QDataStream stream(data,IO_ReadOnly); 83 QDataStream stream(data,IO_ReadOnly);
83 stream >> mPendingName >> mPendingEmail; 84 stream >> mPendingName >> mPendingEmail;
84 // removing the whitespaces at beginning and end is needed! 85 // removing the whitespaces at beginning and end is needed!
85 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 86 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
86 } 87 }
87 else if (msg == "newMail()") 88 else if (msg == "newMail()")
88 { 89 {
89 //qDebug("slotComposeMail() "); 90 //qDebug("slotComposeMail() ");
90 // we cannot call slotComposeMail(); directly, because may be executing a QCOP call 91 // we cannot call slotComposeMail(); directly, because may be executing a QCOP call
91 // and a QCOP call does not like a processevents in his execution 92 // and a QCOP call does not like a processevents in his execution
92 // with the Qtimer we call slotComposeMail() after we reached the main event loop 93 // with the Qtimer we call slotComposeMail() after we reached the main event loop
93 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 94 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
94 // slotComposeMail(); 95 // slotComposeMail();
95 } 96 }
96 else if (msg == "newMail(QString)") 97 else if (msg == "newMail(QString)")
97 { 98 {
98 //qDebug(" newMail(QString)"); 99 //qDebug(" newMail(QString)");
99 QDataStream stream(data,IO_ReadOnly); 100 QDataStream stream(data,IO_ReadOnly);
100 stream >> mPendingName; 101 stream >> mPendingName;
101 // the format is 102 // the format is
102 // NAME <EMAIL>:SUBJECT 103 // NAME <EMAIL>:SUBJECT
103 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); 104 QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) );
104 } else { 105 } else {
105 mPendingData = data; 106 mPendingData = data;
106 mPendingMessage = msg; 107 mPendingMessage = msg;
107 QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) ); 108 QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) );
108 } 109 }
109 110
110 //qDebug("END OpieMail::message "); 111 //qDebug("END OpieMail::message ");
111} 112}
112void OpieMail::slotExtAppHandler() 113void OpieMail::slotExtAppHandler()
113{ 114{
114 ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData ); 115 ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData );
115} 116}
116void OpieMail::slotwriteMail2(const QString& namemail ) 117void OpieMail::slotwriteMail2(const QString& namemail )
117{ 118{
118 //qDebug("OpieMail::slotwriteMail2 "); 119 //qDebug("OpieMail::slotwriteMail2 ");
119 //qApp->processEvents(); 120 //qApp->processEvents();
120 ComposeMail compose( settings, this, 0, true ); 121 ComposeMail compose( settings, this, 0, true );
121 if ( !namemail.isEmpty() ) { 122 if ( !namemail.isEmpty() ) {
122 QString to = namemail; 123 QString to = namemail;
123 if ( namemail.find( " <") > 1 ) { 124 if ( namemail.find( " <") > 1 ) {
124 to = "\"" +to.replace( QRegExp( " <"), "\" <") ; 125 to = "\"" +to.replace( QRegExp( " <"), "\" <") ;
125 } else 126 } else
126 if ( namemail.find( "<") > 1 ) { 127 if ( namemail.find( "<") > 1 ) {
127 to = "\"" +to.replace( QRegExp( "<"), "\" <") ; 128 to = "\"" +to.replace( QRegExp( "<"), "\" <") ;
128 } 129 }
129 int sub = to.find( ">:"); 130 int sub = to.find( ">:");
130 if ( sub > 0 ) { 131 if ( sub > 0 ) {
131 compose.setTo( to.left(sub+1) ); 132 compose.setTo( to.left(sub+1) );
132 compose.setSubject( to.mid(sub+2) ); 133 compose.setSubject( to.mid(sub+2) );
133 } else 134 } else
134 compose.setTo( to ); 135 compose.setTo( to );
135 } 136 }
136 compose.slotAdjustColumns(); 137 compose.slotAdjustColumns();
137#ifndef DESKTOP_VERSION 138#ifndef DESKTOP_VERSION
138 compose.showMaximized(); 139 compose.showMaximized();
139#endif 140#endif
140 compose.exec(); 141 compose.exec();
141 raise(); 142 raise();
142 //qDebug("retttich "); 143 //qDebug("retttich ");
143} 144}
144void OpieMail::slotwriteMail(const QString&name,const QString&email) 145void OpieMail::slotwriteMail(const QString&name,const QString&email)
145{ 146{
146 // qDebug("OpieMail::slotwriteMail "); 147 // qDebug("OpieMail::slotwriteMail ");
147 ComposeMail compose( settings, this, 0, true ); 148 ComposeMail compose( settings, this, 0, true );
148 if (!email.isEmpty()) 149 if (!email.isEmpty())
149 { 150 {
150 if (!name.isEmpty()) 151 if (!name.isEmpty())
151 { 152 {
152 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); 153 compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">");
153 } 154 }
154 else 155 else
155 { 156 {
156 compose.setTo(email); 157 compose.setTo(email);
157 } 158 }
158 } 159 }
159 compose.slotAdjustColumns(); 160 compose.slotAdjustColumns();
160#ifndef DESKTOP_VERSION 161#ifndef DESKTOP_VERSION
161 compose.showMaximized(); 162 compose.showMaximized();
162#endif 163#endif
163 compose.exec(); 164 compose.exec();
164 raise(); 165 raise();
165} 166}
166 167
167void OpieMail::slotComposeMail() 168void OpieMail::slotComposeMail()
168{ 169{
169 if ( mPendingEmail == QString::null && mPendingName == QString::null) 170 if ( mPendingEmail == QString::null && mPendingName == QString::null)
170 slotwriteMail2( QString () ); 171 slotwriteMail2( QString () );
171 else { 172 else {
172 if ( mPendingEmail == QString::null ) 173 if ( mPendingEmail == QString::null )
173 slotwriteMail2( mPendingName ); 174 slotwriteMail2( mPendingName );
174 else 175 else
175 slotwriteMail( mPendingName, mPendingEmail ); 176 slotwriteMail( mPendingName, mPendingEmail );
176 } 177 }
177 //slotwriteMail(0l,0l); 178 //slotwriteMail(0l,0l);
178} 179}
179 180
180void OpieMail::slotSendQueued() 181void OpieMail::slotSendQueued()
181{ 182{
182 SMTPaccount *smtp = 0; 183 SMTPaccount *smtp = 0;
183 184
184 QList<Account> list = settings->getAccounts(); 185 QList<Account> list = settings->getAccounts();
185 QList<SMTPaccount> smtpList; 186 QList<SMTPaccount> smtpList;
186 smtpList.setAutoDelete(false); 187 smtpList.setAutoDelete(false);
187 Account *it; 188 Account *it;
188 for ( it = list.first(); it; it = list.next() ) 189 for ( it = list.first(); it; it = list.next() )
189 { 190 {
190 if ( it->getType() == MAILLIB::A_SMTP ) 191 if ( it->getType() == MAILLIB::A_SMTP )
191 { 192 {
192 smtp = static_cast<SMTPaccount *>(it); 193 smtp = static_cast<SMTPaccount *>(it);
193 smtpList.append(smtp); 194 smtpList.append(smtp);
194 } 195 }
195 } 196 }
196 if (smtpList.count()==0) 197 if (smtpList.count()==0)
197 { 198 {
198 QMessageBox::information(0,i18n("Info"),i18n("Define a smtp account first!\n")); 199 QMessageBox::information(0,i18n("Info"),i18n("Define a smtp account first!\n"));
199 return; 200 return;
200 } 201 }
201 if ( QMessageBox::warning(this, i18n("Sending all mails"), i18n("Do you really want to send\nall queued mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) 202 if ( QMessageBox::warning(this, i18n("Sending all mails"), i18n("Do you really want to send\nall queued mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No )
202 return; 203 return;
203 if (smtpList.count()==1) 204 if (smtpList.count()==1)
204 { 205 {
205 smtp = smtpList.at(0); 206 smtp = smtpList.at(0);
206 } 207 }
207 else 208 else
208 { 209 {
209 smtp = 0; 210 smtp = 0;
210 selectsmtp selsmtp; 211 selectsmtp selsmtp;
211 selsmtp.setSelectionlist(&smtpList); 212 selsmtp.setSelectionlist(&smtpList);
212#ifndef DESKTOP_VERSION 213#ifndef DESKTOP_VERSION
213 selsmtp.showMaximized(); 214 selsmtp.showMaximized();
214#endif 215#endif
215 if ( selsmtp.exec() == QDialog::Accepted ) 216 if ( selsmtp.exec() == QDialog::Accepted )
216 { 217 {
217 smtp = selsmtp.selected_smtp(); 218 smtp = selsmtp.selected_smtp();
218 } 219 }
219 } 220 }
220 if (smtp) 221 if (smtp)
221 { 222 {
222 223
223 Global::statusMessage("Sending mails...!"); 224 Global::statusMessage("Sending mails...!");
224 SMTPwrapper * wrap = new SMTPwrapper(smtp); 225 SMTPwrapper * wrap = new SMTPwrapper(smtp);
225 if ( wrap->flushOutbox() ) 226 if ( wrap->flushOutbox() )
226 { 227 {
227 Global::statusMessage("Mails sent!"); 228 Global::statusMessage("Mails sent!");
228 } 229 }
229 delete wrap; 230 delete wrap;
230 } 231 }
231 // pending refresh list view, if outgoing is displayed 232 // pending refresh list view, if outgoing is displayed
232} 233}
233 234
234void OpieMail::slotSearchMails() 235void OpieMail::slotSearchMails()
235{ 236{
236 qDebug("OpieMail::slotSearchMails():not implemented "); 237 qDebug("OpieMail::slotSearchMails():not implemented ");
237} 238}
238 239
239void OpieMail::slotEditSettings() 240void OpieMail::slotEditSettings()
240{ 241{
241 242
242 KOPrefsDialog settingsDialog( this, "koprefs", true ); 243 KOPrefsDialog settingsDialog( this, "koprefs", true );
243#ifndef DESKTOP_VERSION 244#ifndef DESKTOP_VERSION
244 settingsDialog.showMaximized(); 245 settingsDialog.showMaximized();
245#endif 246#endif
246 settingsDialog.exec(); 247 settingsDialog.exec();
247 248
248 slotSetCodec( KOPrefs::instance()->mCurrentCodec ); 249 slotSetCodec( KOPrefs::instance()->mCurrentCodec );
249 // KApplication::execDialog(settingsDialog); 250 // KApplication::execDialog(settingsDialog);
250} 251}
251 252
252void OpieMail::slotEditAccounts() 253void OpieMail::slotEditAccounts()
253{ 254{
254 EditAccounts eaDialog( settings, this, 0, true ); 255 EditAccounts eaDialog( settings, this, 0, true );
255 eaDialog.slotAdjustColumns(); 256 eaDialog.slotAdjustColumns();
256#ifndef DESKTOP_VERSION 257#ifndef DESKTOP_VERSION
257 eaDialog.showMaximized(); 258 eaDialog.showMaximized();
258#endif 259#endif
259 eaDialog.exec(); 260 eaDialog.exec();
260 if ( settings ) delete settings; 261 if ( settings ) delete settings;
261 settings = new Settings(); 262 settings = new Settings();
262 263
263 folderView->populate( settings->getAccounts() ); 264 folderView->populate( settings->getAccounts() );
264} 265}
265void OpieMail::replyMail() 266void OpieMail::replyMail()
266{ 267{
267 268
268 QListViewItem*item = mailView->currentItem(); 269 QListViewItem*item = mailView->currentItem();
269 if (!item) return; 270 if (!item) return;
270 RecMailP mail = ((MailListViewItem*)item)->data(); 271 RecMailP mail = ((MailListViewItem*)item)->data();
271 RecBodyP body = folderView->fetchBody(mail); 272 RecBodyP body = folderView->fetchBody(mail);
272 273
273 QString rtext; 274 QString rtext;
274 rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose 275 rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose
275 .arg( mail->getFrom()) 276 .arg( mail->getFrom())
276 .arg( mail->getDate()); 277 .arg( mail->getDate());
277 278
278 QString text = body->Bodytext(); 279 QString text = body->Bodytext();
279 QStringList lines = QStringList::split(QRegExp("\\n"), text); 280 QStringList lines = QStringList::split(QRegExp("\\n"), text);
280 QStringList::Iterator it; 281 QStringList::Iterator it;
281 for (it = lines.begin(); it != lines.end(); it++) 282 for (it = lines.begin(); it != lines.end(); it++)
282 { 283 {
283 rtext += "> " + *it + "\n"; 284 rtext += "> " + *it + "\n";
284 } 285 }
285 rtext += "\n"; 286 rtext += "\n";
286 287
287 QString prefix; 288 QString prefix;
288 if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = ""; 289 if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = "";
289 else prefix = "Re: "; // no i18n on purpose 290 else prefix = "Re: "; // no i18n on purpose
290 291
291 Settings *settings = new Settings(); 292 Settings *settings = new Settings();
292 ComposeMail composer( settings ,this, 0, true); 293 ComposeMail composer( settings ,this, 0, true);
293 if (mail->Replyto().isEmpty()) { 294 if (mail->Replyto().isEmpty()) {
294 composer.setTo( mail->getFrom()); 295 composer.setTo( mail->getFrom());
295 } else { 296 } else {
296 composer.setTo( mail->Replyto()); 297 composer.setTo( mail->Replyto());
297 } 298 }
298 composer.setSubject( prefix + mail->getSubject()); 299 composer.setSubject( prefix + mail->getSubject());
299 composer.setMessage( rtext ); 300 composer.setMessage( rtext );
300 composer.setInReplyTo( mail->Msgid()); 301 composer.setInReplyTo( mail->Msgid());
301 composer.setCharset( body->getCharset() ); 302 composer.setCharset( body->getCharset() );
302 if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) 303 if ( QDialog::Accepted == KApplication::execDialog( &composer ) )
303 { 304 {
304 mail->Wrapper()->answeredMail(mail); 305 mail->Wrapper()->answeredMail(mail);
305 } 306 }
306 delete settings; 307 delete settings;
307 308
308} 309}
309void OpieMail::closeViewMail(ViewMail * vm) 310void OpieMail::closeViewMail(ViewMail * vm)
310{ 311{
311 vm->hide(); 312 vm->hide();
312} 313}
313 314
314void OpieMail::slotDownloadMail( ) 315void OpieMail::slotDownloadMail( )
315{ 316{
316 qDebug("slotDownloadMail( ) "); 317 QListViewItem*item = mailView->currentItem();
318 if (!item ) {
319 Global::statusMessage("Error: No item slected!");
320 return;
321 }
322 RecMailP mail = ((MailListViewItem*)item)->data();
323 Account * acc = mail->Wrapper()->getAccount();
324 if ( !acc ) {
325 Global::statusMessage("Mail is already stored locally!");
326 return;
327 }
328 QString lfName = acc->getLocalFolder();
329 //qDebug("local folder " + lfName );
330 if ( lfName.isEmpty() )
331 lfName = acc->getAccountName();
332 AbstractMail* targetMail = folderView->allAccounts()[0]->getWrapper();
333 //qDebug("target %d %d ",targetMail,mail->Wrapper() );
334 if ( targetMail == mail->Wrapper() ) {
335 Global::statusMessage("Mail is already locally stored!");
336 return;
337 }
338 if ( !targetMail->createMbox(lfName)) {
339 Global::statusMessage("Error creating folder!");
340 return;
341 }
342 Global::statusMessage("Fetching mail...please wait!");
343 qApp->processEvents();
344 encodedString*st = 0;
345 st = mail->Wrapper()->fetchRawBody(mail);
346 if ( st ) {
347 targetMail->storeMessage(st->Content(),st->Length(),lfName);
348 Global::statusMessage("Mail stored in "+ lfName);
349 delete st;
350 } else {
351 Global::statusMessage("Error: Cannot fetch mail!");
352 }
317} 353}
318 354
319 355
320void OpieMail::deleteAndDisplayNextMail(ViewMail * vm) 356void OpieMail::deleteAndDisplayNextMail(ViewMail * vm)
321{ 357{
322 QListViewItem*item = mailView->currentItem(); 358 QListViewItem*item = mailView->currentItem();
323 if (!item ) { 359 if (!item ) {
324 closeViewMail(vm); 360 closeViewMail(vm);
325 return; 361 return;
326 } 362 }
327 RecMailP mail = ((MailListViewItem*)item)->data(); 363 RecMailP mail = ((MailListViewItem*)item)->data();
328 mail->Wrapper()->deleteMail( mail ); 364 mail->Wrapper()->deleteMail( mail );
329 item = item->itemBelow(); 365 item = item->itemBelow();
330 if (!item ) { 366 if (!item ) {
331 closeViewMail(vm); 367 closeViewMail(vm);
332 return; 368 return;
333 } 369 }
334 mailView->setCurrentItem(item); 370 mailView->setCurrentItem(item);
335 mail = ((MailListViewItem*)item)->data(); 371 mail = ((MailListViewItem*)item)->data();
336 RecBodyP body = folderView->fetchBody(mail); 372 RecBodyP body = folderView->fetchBody(mail);
337 vm->setBody( body ); 373 vm->setBody( body );
338 vm->setMail( mail ); 374 vm->setMail( mail );
339} 375}
340void OpieMail::displayNextMail(ViewMail * vm) 376void OpieMail::displayNextMail(ViewMail * vm)
341{ 377{
342 QListViewItem*item = mailView->currentItem(); 378 QListViewItem*item = mailView->currentItem();
343 if (!item) return; 379 if (!item) return;
344 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); 380 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() );
345 item = item->itemBelow(); 381 item = item->itemBelow();
346 if (!item) { 382 if (!item) {
347 vm->setCaption(i18n("End of List" )); 383 vm->setCaption(i18n("End of List" ));
348 return; 384 return;
349 } 385 }
350 mailView->setCurrentItem(item); 386 mailView->setCurrentItem(item);
351 RecMailP mail = ((MailListViewItem*)item)->data(); 387 RecMailP mail = ((MailListViewItem*)item)->data();
352 RecBodyP body = folderView->fetchBody(mail); 388 RecBodyP body = folderView->fetchBody(mail);
353 vm->setBody( body ); 389 vm->setBody( body );
354 vm->setMail( mail ); 390 vm->setMail( mail );
355} 391}
356void OpieMail::displayMail() 392void OpieMail::displayMail()
357{ 393{
358 QListViewItem*item = mailView->currentItem(); 394 QListViewItem*item = mailView->currentItem();
359 if (!item) return; 395 if (!item) return;
360 RecMailP mail = ((MailListViewItem*)item)->data(); 396 RecMailP mail = ((MailListViewItem*)item)->data();
361 RecBodyP body = folderView->fetchBody(mail); 397 RecBodyP body = folderView->fetchBody(mail);
362 ViewMail readMail( this,"", Qt::WType_Modal ); 398 ViewMail readMail( this,"", Qt::WType_Modal );
363 readMail.setBody( body ); 399 readMail.setBody( body );
364 readMail.setMail( mail ); 400 readMail.setMail( mail );
365#ifndef DESKTOP_VERSION 401#ifndef DESKTOP_VERSION
366 readMail.showMaximized(); 402 readMail.showMaximized();
367#else 403#else
368 readMail.resize( 640, 480); 404 readMail.resize( 640, 480);
369#endif 405#endif
370 connect( &readMail,SIGNAL( showNextMail(ViewMail *) ), this, SLOT( displayNextMail(ViewMail *) ) ); 406 connect( &readMail,SIGNAL( showNextMail(ViewMail *) ), this, SLOT( displayNextMail(ViewMail *) ) );
371 connect( &readMail,SIGNAL( deleteAndDisplayNextMail(ViewMail *) ), this, SLOT(deleteAndDisplayNextMail(ViewMail *) ) ); 407 connect( &readMail,SIGNAL( deleteAndDisplayNextMail(ViewMail *) ), this, SLOT(deleteAndDisplayNextMail(ViewMail *) ) );
372 connect( &readMail,SIGNAL( signalDownloadMail() ), this, SLOT( slotDownloadMail() ) ); 408 connect( &readMail,SIGNAL( signalDownloadMail() ), this, SLOT( slotDownloadMail() ) );
373 409
374 readMail.exec(); 410 readMail.exec();
375 411
376 if ( readMail.deleted ) 412 if ( readMail.deleted )
377 { 413 {
378 folderView->refreshCurrent(); 414 folderView->refreshCurrent();
379 } 415 }
380 else 416 else
381 { 417 {
382 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); 418 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() );
383 } 419 }
384} 420}
385void OpieMail::slotGetAllMail() 421void OpieMail::slotGetAllMail()
386{ 422{
387 QListViewItem * item = folderView->firstChild(); 423 QListViewItem * item = folderView->firstChild();
388 while ( item ){ 424 while ( item ){
389 ((AccountViewItem *)item)->contextMenuSelected( 101 ); 425 ((AccountViewItem *)item)->contextMenuSelected( 101 );
390 item = item->nextSibling (); 426 item = item->nextSibling ();
391 } 427 }
392} 428}
393void OpieMail::slotGetMail() 429void OpieMail::slotGetMail()
394{ 430{
395 QListViewItem * item = folderView->currentItem(); 431 QListViewItem * item = folderView->currentItem();
396 if ( ! item ) return; 432 if ( ! item ) return;
397 ((AccountViewItem *)item)->contextMenuSelected( 101 ); 433 ((AccountViewItem *)item)->contextMenuSelected( 101 );
398} 434}
399void OpieMail::slotDeleteMail() 435void OpieMail::slotDeleteMail()
400{ 436{
401 if (!mailView->currentItem()) return; 437 if (!mailView->currentItem()) return;
402 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); 438 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
403 if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 439 if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
404 { 440 {
405 mail->Wrapper()->deleteMail( mail ); 441 mail->Wrapper()->deleteMail( mail );
406 folderView->refreshCurrent(); 442 folderView->refreshCurrent();
407 } 443 }
408} 444}
409void OpieMail::slotDeleteAllMail() 445void OpieMail::slotDeleteAllMail()
410{ 446{
411 447
412 QValueList<RecMailP> t; 448 QValueList<RecMailP> t;
413 if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 449 if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
414 { 450 {
415 MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); 451 MailListViewItem* item = (MailListViewItem*)mailView->firstChild ();
416 while ( item ) { 452 while ( item ) {
417 if ( item->isSelected() ) { 453 if ( item->isSelected() ) {
418 t.append( item->data() ); 454 t.append( item->data() );
419 } 455 }
420 item = (MailListViewItem*)item->nextSibling(); 456 item = (MailListViewItem*)item->nextSibling();
421 } 457 }
422 } 458 }
423 else 459 else
424 return; 460 return;
425 if ( t.count() == 0 ) 461 if ( t.count() == 0 )
426 return; 462 return;
427 RecMailP mail = t.first(); 463 RecMailP mail = t.first();
428 mail->Wrapper()->deleteMailList(t); 464 mail->Wrapper()->deleteMailList(t);
429 folderView->refreshCurrent(); 465 folderView->refreshCurrent();
430 466
431 467
432} 468}
433void OpieMail::clearSelection() 469void OpieMail::clearSelection()
434{ 470{
435 mailView->clearSelection(); 471 mailView->clearSelection();
436 472
437} 473}
438 474
439void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) 475void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int )
440{ 476{
441 if (!mailView->currentItem()) return; 477 if (!mailView->currentItem()) return;
442 MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); 478 MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType();
443 /* just the RIGHT button - or hold on pda */ 479 /* just the RIGHT button - or hold on pda */
444 if (button!=2) {return;} 480 if (button!=2) {return;}
445 if (!item) return; 481 if (!item) return;
446 QPopupMenu *m = new QPopupMenu(0); 482 QPopupMenu *m = new QPopupMenu(0);
447 if (m) 483 if (m)
448 { 484 {
449 if (mailtype==MAILLIB::A_NNTP) { 485 if (mailtype==MAILLIB::A_NNTP) {
450 m->insertItem(i18n("Read this posting"),this,SLOT(displayMail())); 486 m->insertItem(i18n("Read this posting"),this,SLOT(displayMail()));
451 m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail())); 487 m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail()));
452 m->insertSeparator(); 488 m->insertSeparator();
453 m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail())); 489 m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail()));
454 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); 490 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection()));
455 } else { 491 } else {
456 if (folderView->currentisDraft()) { 492 if (folderView->currentisDraft()) {
457 m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail())); 493 m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail()));
458 } 494 }
459 m->insertItem(i18n("Reply to this mail"),this,SLOT(replyMail())); 495 m->insertItem(i18n("Reply to this mail"),this,SLOT(replyMail()));
460 m->insertSeparator(); 496 m->insertSeparator();
461 m->insertItem(i18n("Read this mail"),this,SLOT(displayMail())); 497 m->insertItem(i18n("Read this mail"),this,SLOT(displayMail()));
462 m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); 498 m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail()));
463 m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail())); 499 m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail()));
464 m->insertSeparator(); 500 m->insertSeparator();
465 m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); 501 m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail()));
466 m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); 502 m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail()));
467 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); 503 m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection()));
468 } 504 }
469 m->setFocus(); 505 m->setFocus();
470 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); 506 m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) );
471 delete m; 507 delete m;
472 } 508 }
473} 509}
474 510
475void OpieMail::slotShowFolders( bool show ) 511void OpieMail::slotShowFolders( bool show )
476{ 512{
477 if ( show && folderView->isHidden() ) 513 if ( show && folderView->isHidden() )
478 { 514 {
479 folderView->show(); 515 folderView->show();
480 } 516 }
481 else if ( !show && !folderView->isHidden() ) 517 else if ( !show && !folderView->isHidden() )
482 { 518 {
483 folderView->hide(); 519 folderView->hide();
484 } 520 }
485} 521}
486 522
487void OpieMail::refreshMailView(const QValueList<RecMailP>&list) 523void OpieMail::refreshMailView(const QValueList<RecMailP>&list)
488{ 524{
489 MailListViewItem*item = 0; 525 MailListViewItem*item = 0;
490 mailView->clear(); 526 mailView->clear();
491 527
492 QValueList<RecMailP>::ConstIterator it; 528 QValueList<RecMailP>::ConstIterator it;
493 for (it = list.begin(); it != list.end();++it) 529 for (it = list.begin(); it != list.end();++it)
494 { 530 {
495 item = new MailListViewItem(mailView,item); 531 item = new MailListViewItem(mailView,item);
496 item->storeData((*it)); 532 item->storeData((*it));
497 item->showEntry(); 533 item->showEntry();
498 } 534 }
499 mailView->setSorting ( 4, false ); 535 mailView->setSorting ( 4, false );
500} 536}
501 537
502void OpieMail::mailLeftClicked( QListViewItem *item ) 538void OpieMail::mailLeftClicked( QListViewItem *item )
503{ 539{
504 mailView->clearSelection(); 540 mailView->clearSelection();
505 /* just LEFT button - or tap with stylus on pda */ 541 /* just LEFT button - or tap with stylus on pda */
506 //if (button!=1) return; 542 //if (button!=1) return;
507 if (!item) return; 543 if (!item) return;
508 if (folderView->currentisDraft()) { 544 if (folderView->currentisDraft()) {
509 reEditMail(); 545 reEditMail();
510 } else { 546 } else {
511 displayMail(); 547 displayMail();
512 } 548 }
513} 549}
514 550
515void OpieMail::slotMoveCopyMail() 551void OpieMail::slotMoveCopyMail()
516{ 552{
517 if (!mailView->currentItem()) return; 553 if (!mailView->currentItem()) return;
518 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); 554 RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data();
519 AbstractMail*targetMail = 0; 555 AbstractMail*targetMail = 0;
520 QString targetFolder = ""; 556 QString targetFolder = "";
521 Selectstore sels; 557 Selectstore sels;
522 folderView->setupFolderselect(&sels); 558 folderView->setupFolderselect(&sels);
523 if (!sels.exec()) return; 559 if (!sels.exec()) return;
524 targetMail = sels.currentMail(); 560 targetMail = sels.currentMail();
525 targetFolder = sels.currentFolder(); 561 targetFolder = sels.currentFolder();
526 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || 562 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) ||
527 targetFolder.isEmpty()) 563 targetFolder.isEmpty())
528 { 564 {
529 return; 565 return;
530 } 566 }
531 if (sels.newFolder() && !targetMail->createMbox(targetFolder)) 567 if (sels.newFolder() && !targetMail->createMbox(targetFolder))
532 { 568 {
533 QMessageBox::critical(0,i18n("Error creating new Folder"), 569 QMessageBox::critical(0,i18n("Error creating new Folder"),
534 i18n("<center>Error while creating<br>new folder - breaking.</center>")); 570 i18n("<center>Error while creating<br>new folder - breaking.</center>"));
535 return; 571 return;
536 } 572 }
537 sels.hide(); 573 sels.hide();
538 qApp->processEvents(); 574 qApp->processEvents();
539 // qDebug("hiding sels "); 575 // qDebug("hiding sels ");
540 mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); 576 mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails());
541 folderView->refreshCurrent(); 577 folderView->refreshCurrent();
542} 578}
543 579
544void OpieMail::slotMoveCopyAllMail() 580void OpieMail::slotMoveCopyAllMail()
545{ 581{
546 582
547 if (!mailView->currentItem()) return; 583 if (!mailView->currentItem()) return;
548 QValueList<RecMailP> t; 584 QValueList<RecMailP> t;
549 // if ( QMessageBox::warning(this, i18n("Move/Copy all selected mails"), i18n("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 585 // if ( QMessageBox::warning(this, i18n("Move/Copy all selected mails"), i18n("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
550 { 586 {
551 MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); 587 MailListViewItem* item = (MailListViewItem*)mailView->firstChild ();
552 while ( item ) { 588 while ( item ) {
553 if ( item->isSelected() ) { 589 if ( item->isSelected() ) {
554 t.append( item->data() ); 590 t.append( item->data() );
555 } 591 }
556 item = (MailListViewItem*)item->nextSibling(); 592 item = (MailListViewItem*)item->nextSibling();
557 } 593 }
558 } 594 }
559 // else 595 // else
560 // return; 596 // return;
561 if ( t.count() == 0 ) 597 if ( t.count() == 0 )
562 return; 598 return;
563 RecMailP mail = t.first(); 599 RecMailP mail = t.first();
564 AbstractMail*targetMail = 0; 600 AbstractMail*targetMail = 0;
565 QString targetFolder = ""; 601 QString targetFolder = "";
566 Selectstore sels; 602 Selectstore sels;
567 folderView->setupFolderselect(&sels); 603 folderView->setupFolderselect(&sels);
568 if (!sels.exec()) return; 604 if (!sels.exec()) return;
569 targetMail = sels.currentMail(); 605 targetMail = sels.currentMail();
570 targetFolder = sels.currentFolder(); 606 targetFolder = sels.currentFolder();
571 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || 607 if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) ||
572 targetFolder.isEmpty()) 608 targetFolder.isEmpty())
573 { 609 {
574 return; 610 return;
575 } 611 }
576 if (sels.newFolder() && !targetMail->createMbox(targetFolder)) 612 if (sels.newFolder() && !targetMail->createMbox(targetFolder))
577 { 613 {
578 QMessageBox::critical(0,i18n("Error creating new Folder"), 614 QMessageBox::critical(0,i18n("Error creating new Folder"),
579 i18n("<center>Error while creating<br>new folder - breaking.</center>")); 615 i18n("<center>Error while creating<br>new folder - breaking.</center>"));
580 return; 616 return;
581 } 617 }
582 sels.hide(); 618 sels.hide();
583 qApp->processEvents(); 619 qApp->processEvents();
584 //qDebug("hiding sels "); 620 //qDebug("hiding sels ");
585 mail->Wrapper()->mvcpMailList(t,targetFolder,targetMail,sels.moveMails()); 621 mail->Wrapper()->mvcpMailList(t,targetFolder,targetMail,sels.moveMails());
586 folderView->refreshCurrent(); 622 folderView->refreshCurrent();
587} 623}
588 624
589void OpieMail::reEditMail() 625void OpieMail::reEditMail()
590{ 626{
591 if (!mailView->currentItem()) return; 627 if (!mailView->currentItem()) return;
592 628
593 ComposeMail compose( settings, this, 0, true ); 629 ComposeMail compose( settings, this, 0, true );
594 compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); 630 compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data());
595 compose.slotAdjustColumns(); 631 compose.slotAdjustColumns();
596#ifndef DESKTOP_VERSION 632#ifndef DESKTOP_VERSION
597 compose.showMaximized(); 633 compose.showMaximized();
598#else 634#else
599 compose.resize(640,480); 635 compose.resize(640,480);
600#endif 636#endif
601 compose.exec(); 637 compose.exec();
602} 638}
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp
index 767a369..726f540 100644
--- a/kmicromail/viewmail.cpp
+++ b/kmicromail/viewmail.cpp
@@ -1,557 +1,560 @@
1// CHANGED 2004-08-06 Lutz Rogowski 1// CHANGED 2004-08-06 Lutz Rogowski
2 2
3 3
4 4
5#include <kfiledialog.h> 5#include <kfiledialog.h>
6#include "koprefs.h" 6#include "koprefs.h"
7#include <klocale.h> 7#include <klocale.h>
8#include <kglobal.h> 8#include <kglobal.h>
9#include <kapplication.h> 9#include <kapplication.h>
10 10
11#ifdef MINIKDE_KDIALOG_H 11#ifdef MINIKDE_KDIALOG_H
12#undef MINIKDE_KDIALOG_H 12#undef MINIKDE_KDIALOG_H
13#endif 13#endif
14 14
15#include "composemail.h" 15#include "composemail.h"
16#include "viewmail.h" 16#include "viewmail.h"
17 17
18#include <libmailwrapper/settings.h> 18#include <libmailwrapper/settings.h>
19#include <libmailwrapper/abstractmail.h> 19#include <libmailwrapper/abstractmail.h>
20#include <libmailwrapper/mailtypes.h> 20#include <libmailwrapper/mailtypes.h>
21 21
22#include <qdialog.h> 22#include <qdialog.h>
23 23
24#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25 25
26/* QT */ 26/* QT */
27#include <qtextbrowser.h> 27#include <qtextbrowser.h>
28#include <qmessagebox.h> 28#include <qmessagebox.h>
29#include <qtextstream.h> 29#include <qtextstream.h>
30#include <qaction.h> 30#include <qaction.h>
31#include <qpopupmenu.h> 31#include <qpopupmenu.h>
32#include <qfile.h> 32#include <qfile.h>
33#include <qlayout.h> 33#include <qlayout.h>
34 34
35//using namespace Opie::Ui; 35//using namespace Opie::Ui;
36//using namespace Opie::Core; 36//using namespace Opie::Core;
37 37
38AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, 38AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
39 const QString&fsize,int num,const QValueList<int>&path) 39 const QString&fsize,int num,const QValueList<int>&path)
40 : QListViewItem(parent,after),_partNum(num) 40 : QListViewItem(parent,after),_partNum(num)
41{ 41{
42 _path=path; 42 _path=path;
43 setText(0, mime); 43 setText(0, mime);
44 setText(1, desc); 44 setText(1, desc);
45 setText(2, file); 45 setText(2, file);
46 setText(3, fsize); 46 setText(3, fsize);
47} 47}
48 48
49AttachItem::AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, 49AttachItem::AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
50 const QString&fsize,int num,const QValueList<int>&path) 50 const QString&fsize,int num,const QValueList<int>&path)
51 : QListViewItem(parent,after),_partNum(num) 51 : QListViewItem(parent,after),_partNum(num)
52{ 52{
53 _path=path; 53 _path=path;
54 setText(0, mime); 54 setText(0, mime);
55 setText(1, desc); 55 setText(1, desc);
56 setText(2, file); 56 setText(2, file);
57 setText(3, fsize); 57 setText(3, fsize);
58} 58}
59 59
60bool AttachItem::isParentof(const QValueList<int>&path) 60bool AttachItem::isParentof(const QValueList<int>&path)
61{ 61{
62 /* if not set, then no parent */ 62 /* if not set, then no parent */
63 if (path.count()==0||_path.count()==0) return false; 63 if (path.count()==0||_path.count()==0) return false;
64 /* the parent must have one digit less then a child */ 64 /* the parent must have one digit less then a child */
65 if (path.count()!=_path.count()+1) return false; 65 if (path.count()!=_path.count()+1) return false;
66 for (unsigned int i=0; i < _path.count();++i) 66 for (unsigned int i=0; i < _path.count();++i)
67 { 67 {
68 if (_path[i]!=path[i]) return false; 68 if (_path[i]!=path[i]) return false;
69 } 69 }
70 return true; 70 return true;
71} 71}
72 72
73AttachItem* ViewMail::searchParent(const QValueList<int>&path) 73AttachItem* ViewMail::searchParent(const QValueList<int>&path)
74{ 74{
75 QListViewItemIterator it( attachments ); 75 QListViewItemIterator it( attachments );
76 for ( ; it.current(); ++it ) 76 for ( ; it.current(); ++it )
77 { 77 {
78 AttachItem*ati = (AttachItem*)it.current(); 78 AttachItem*ati = (AttachItem*)it.current();
79 if (ati->isParentof(path)) return ati; 79 if (ati->isParentof(path)) return ati;
80 } 80 }
81 return 0; 81 return 0;
82} 82}
83 83
84AttachItem* ViewMail::lastChild(AttachItem*parent) 84AttachItem* ViewMail::lastChild(AttachItem*parent)
85{ 85{
86 if (!parent) return 0; 86 if (!parent) return 0;
87 AttachItem* item = (AttachItem*)parent->firstChild(); 87 AttachItem* item = (AttachItem*)parent->firstChild();
88 if (!item) return item; 88 if (!item) return item;
89 AttachItem*temp=0; 89 AttachItem*temp=0;
90 while( (temp=(AttachItem*)item->nextSibling())) 90 while( (temp=(AttachItem*)item->nextSibling()))
91 { 91 {
92 item = temp; 92 item = temp;
93 } 93 }
94 return item; 94 return item;
95} 95}
96 96
97void ViewMail::setBody(const RecBodyP&body ) 97void ViewMail::setBody(const RecBodyP&body )
98{ 98{
99 99
100 m_body = body; 100 m_body = body;
101 m_mail[2] = body->Bodytext(); 101 m_mail[2] = body->Bodytext();
102 // qDebug("********text %s ",m_mail[2].latin1() ); 102 // qDebug("********text %s ",m_mail[2].latin1() );
103 attachbutton->setEnabled(body->Parts().count()>0); 103 attachbutton->setEnabled(body->Parts().count()>0);
104 attachments->setEnabled(body->Parts().count()>0); 104 attachments->setEnabled(body->Parts().count()>0);
105 if (body->Parts().count()==0) 105 if (body->Parts().count()==0)
106 { 106 {
107 return; 107 return;
108 } 108 }
109 AttachItem * curItem=0; 109 AttachItem * curItem=0;
110 AttachItem * parentItem = 0; 110 AttachItem * parentItem = 0;
111 QString type=body->Description()->Type()+"/"+body->Description()->Subtype(); 111 QString type=body->Description()->Type()+"/"+body->Description()->Subtype();
112 QString desc,fsize; 112 QString desc,fsize;
113 double s = body->Description()->Size(); 113 double s = body->Description()->Size();
114 int w; 114 int w;
115 w=0; 115 w=0;
116 116
117 while (s>1024) 117 while (s>1024)
118 { 118 {
119 s/=1024; 119 s/=1024;
120 ++w; 120 ++w;
121 if (w>=2) break; 121 if (w>=2) break;
122 } 122 }
123 123
124 QString q=""; 124 QString q="";
125 switch(w) 125 switch(w)
126 { 126 {
127 case 1: 127 case 1:
128 q="k"; 128 q="k";
129 break; 129 break;
130 case 2: 130 case 2:
131 q="M"; 131 q="M";
132 break; 132 break;
133 default: 133 default:
134 break; 134 break;
135 } 135 }
136 136
137 { 137 {
138 /* I did not found a method to make a CONTENT reset on a QTextStream 138 /* I did not found a method to make a CONTENT reset on a QTextStream
139 so I use this construct that the stream will re-constructed in each 139 so I use this construct that the stream will re-constructed in each
140 loop. To let it work, the textstream is packed into a own area of 140 loop. To let it work, the textstream is packed into a own area of
141 code is it will be destructed after finishing its small job. 141 code is it will be destructed after finishing its small job.
142 */ 142 */
143 QTextOStream o(&fsize); 143 QTextOStream o(&fsize);
144 if (w>0) o.precision(2); else o.precision(0); 144 if (w>0) o.precision(2); else o.precision(0);
145 o.setf(QTextStream::fixed); 145 o.setf(QTextStream::fixed);
146 o << s << " " << q << "Byte"; 146 o << s << " " << q << "Byte";
147 } 147 }
148 148
149 curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist()); 149 curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist());
150 QString filename = ""; 150 QString filename = "";
151 151
152 for (unsigned int i = 0; i < body->Parts().count();++i) 152 for (unsigned int i = 0; i < body->Parts().count();++i)
153 { 153 {
154 filename = ""; 154 filename = "";
155 type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype(); 155 type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype();
156 part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin(); 156 part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin();
157 for (;it!=body->Parts()[i]->Parameters().end();++it) 157 for (;it!=body->Parts()[i]->Parameters().end();++it)
158 { 158 {
159 if (it.key().lower()=="name") 159 if (it.key().lower()=="name")
160 { 160 {
161 filename=it.data(); 161 filename=it.data();
162 } 162 }
163 } 163 }
164 s = body->Parts()[i]->Size(); 164 s = body->Parts()[i]->Size();
165 w = 0; 165 w = 0;
166 while (s>1024) 166 while (s>1024)
167 { 167 {
168 s/=1024; 168 s/=1024;
169 ++w; 169 ++w;
170 if (w>=2) break; 170 if (w>=2) break;
171 } 171 }
172 switch(w) 172 switch(w)
173 { 173 {
174 case 1: 174 case 1:
175 q="k"; 175 q="k";
176 break; 176 break;
177 case 2: 177 case 2:
178 q="M"; 178 q="M";
179 break; 179 break;
180 default: 180 default:
181 q=""; 181 q="";
182 break; 182 break;
183 } 183 }
184 QTextOStream o(&fsize); 184 QTextOStream o(&fsize);
185 if (w>0) o.precision(2); else o.precision(0); 185 if (w>0) o.precision(2); else o.precision(0);
186 o.setf(QTextStream::fixed); 186 o.setf(QTextStream::fixed);
187 o << s << " " << q << "Byte"; 187 o << s << " " << q << "Byte";
188 desc = body->Parts()[i]->Description(); 188 desc = body->Parts()[i]->Description();
189 parentItem = searchParent(body->Parts()[i]->Positionlist()); 189 parentItem = searchParent(body->Parts()[i]->Positionlist());
190 if (parentItem) 190 if (parentItem)
191 { 191 {
192 AttachItem*temp = lastChild(parentItem); 192 AttachItem*temp = lastChild(parentItem);
193 if (temp) curItem = temp; 193 if (temp) curItem = temp;
194 curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); 194 curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist());
195 attachments->setRootIsDecorated(true); 195 attachments->setRootIsDecorated(true);
196 curItem = parentItem; 196 curItem = parentItem;
197 } 197 }
198 else 198 else
199 { 199 {
200 curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); 200 curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist());
201 } 201 }
202 } 202 }
203} 203}
204 204
205 205
206void ViewMail::slotViewSource() 206void ViewMail::slotViewSource()
207{ 207{
208 208
209 if ( !sourceOn ) { 209 if ( !sourceOn ) {
210 sourceOn = true; 210 sourceOn = true;
211 viewSource->setText(i18n("View Body Text")); 211 viewSource->setText(i18n("View Body Text"));
212 encodedString*st = 0; 212 encodedString*st = 0;
213 st = m_recMail->Wrapper()->fetchRawBody(m_recMail); 213 st = m_recMail->Wrapper()->fetchRawBody(m_recMail);
214 if ( st ) { 214 if ( st ) {
215 QString source = QString::fromUtf8( st->Content(), st->Length()); 215 QString source = QString::fromUtf8( st->Content(), st->Length());
216 browser->setText( source ); 216 browser->setText( source );
217 delete st; 217 delete st;
218 } 218 }
219 } else 219 } else
220 setText(); 220 setText();
221 221
222 222
223} 223}
224void ViewMail::slotShowHtml( bool state ) 224void ViewMail::slotShowHtml( bool state )
225{ 225{
226 m_showHtml = state; 226 m_showHtml = state;
227 setText(); 227 setText();
228} 228}
229 229
230void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) 230void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int )
231{ 231{
232 if (!item ) 232 if (!item )
233 return; 233 return;
234 234
235 if ( ( ( AttachItem* )item )->Partnumber() == -1 ) 235 if ( ( ( AttachItem* )item )->Partnumber() == -1 )
236 { 236 {
237 setText(); 237 setText();
238 return; 238 return;
239 } 239 }
240 QPopupMenu *menu = new QPopupMenu(); 240 QPopupMenu *menu = new QPopupMenu();
241 int ret=0; 241 int ret=0;
242 242
243 if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" ) 243 if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" )
244 { 244 {
245 menu->insertItem( i18n( "Show Text" ), 1 ); 245 menu->insertItem( i18n( "Show Text" ), 1 );
246 } 246 }
247 if (item->text(0).left(6)=="image/") { 247 if (item->text(0).left(6)=="image/") {
248 menu->insertItem(i18n("Display image preview"),2); 248 menu->insertItem(i18n("Display image preview"),2);
249 } 249 }
250 menu->insertItem( i18n( "Save Attachment" ), 0 ); 250 menu->insertItem( i18n( "Save Attachment" ), 0 );
251 menu->insertSeparator(1); 251 menu->insertSeparator(1);
252 252
253 ret = menu->exec( point, 0 ); 253 ret = menu->exec( point, 0 );
254 254
255 switch(ret) 255 switch(ret)
256 { 256 {
257 case 0: 257 case 0:
258 { 258 {
259 //MimeTypes types; 259 //MimeTypes types;
260 //types.insert( "all", "*" ); 260 //types.insert( "all", "*" );
261 QString str = KFileDialog::getSaveFileName( "/", item->text( 2 ), this ); 261 QString str = KFileDialog::getSaveFileName( "/", item->text( 2 ), this );
262 262
263 if( !str.isEmpty() ) 263 if( !str.isEmpty() )
264 { 264 {
265 encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); 265 encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] );
266 if (content) 266 if (content)
267 { 267 {
268 QFile output(str); 268 QFile output(str);
269 output.open(IO_WriteOnly); 269 output.open(IO_WriteOnly);
270 output.writeBlock(content->Content(),content->Length()); 270 output.writeBlock(content->Content(),content->Length());
271 output.close(); 271 output.close();
272 delete content; 272 delete content;
273 } 273 }
274 } 274 }
275 } 275 }
276 break ; 276 break ;
277 277
278 case 2: 278 case 2:
279 { 279 {
280#ifdef DESKTOP_VERSION 280#ifdef DESKTOP_VERSION
281 QString tmpfile = locateLocal( "tmp", "opiemail-image"); 281 QString tmpfile = locateLocal( "tmp", "opiemail-image");
282#else 282#else
283 QString tmpfile = "/tmp/opiemail-image"; 283 QString tmpfile = "/tmp/opiemail-image";
284#endif 284#endif
285 encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); 285 encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] );
286 if (content) { 286 if (content) {
287 QFile output(tmpfile); 287 QFile output(tmpfile);
288 output.open(IO_WriteOnly); 288 output.open(IO_WriteOnly);
289 output.writeBlock(content->Content(),content->Length()); 289 output.writeBlock(content->Content(),content->Length());
290 output.close(); 290 output.close();
291 delete content; 291 delete content;
292 MailImageDlg iview(""); 292 MailImageDlg iview("");
293 iview.setName(tmpfile); 293 iview.setName(tmpfile);
294 KApplication::execDialog(&iview); 294 KApplication::execDialog(&iview);
295 output.remove(); 295 output.remove();
296 } 296 }
297 } 297 }
298 break; 298 break;
299 case 1: 299 case 1:
300 if ( ( ( AttachItem* )item )->Partnumber() == -1 ) 300 if ( ( ( AttachItem* )item )->Partnumber() == -1 )
301 { 301 {
302 setText(); 302 setText();
303 } 303 }
304 else 304 else
305 { 305 {
306 if ( m_recMail->Wrapper() != 0l ) 306 if ( m_recMail->Wrapper() != 0l )
307 { // make sure that there is a wrapper , even after delete or simular actions 307 { // make sure that there is a wrapper , even after delete or simular actions
308 browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); 308 browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) );
309 } 309 }
310 } 310 }
311 break; 311 break;
312 } 312 }
313 delete menu; 313 delete menu;
314} 314}
315 315
316 316
317void ViewMail::setMail(const RecMailP&mail ) 317void ViewMail::setMail(const RecMailP&mail )
318{ 318{
319 319
320 m_recMail = mail; 320 m_recMail = mail;
321 321
322 m_mail[0] = mail->getFrom(); 322 m_mail[0] = mail->getFrom();
323 m_mail[1] = mail->getSubject(); 323 m_mail[1] = mail->getSubject();
324 m_mail[3] = mail->getDate(); 324 m_mail[3] = mail->getDate();
325 m_mail[4] = mail->Msgid(); 325 m_mail[4] = mail->Msgid();
326 326
327 m_mail2[0] = mail->To(); 327 m_mail2[0] = mail->To();
328 m_mail2[1] = mail->CC(); 328 m_mail2[1] = mail->CC();
329 m_mail2[2] = mail->Bcc(); 329 m_mail2[2] = mail->Bcc();
330 330
331 setText(); 331 setText();
332} 332}
333 333
334 334
335 335
336ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) 336ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
337 : ViewMailBase(parent, name, fl), _inLoop(false) 337 : ViewMailBase(parent, name, fl), _inLoop(false)
338{ 338{
339 m_gotBody = false; 339 m_gotBody = false;
340 deleted = false; 340 deleted = false;
341 sourceOn = false; 341 sourceOn = false;
342 connect( reply, SIGNAL(activated()), SLOT(slotReply())); 342 connect( reply, SIGNAL(activated()), SLOT(slotReply()));
343 connect( forward, SIGNAL(activated()), SLOT(slotForward())); 343 connect( forward, SIGNAL(activated()), SLOT(slotForward()));
344 connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) ); 344 connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) );
345 connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) ); 345 connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) );
346 connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); 346 connect( closeMail, SIGNAL( activated() ), SLOT( close() ) );
347 connect( nextMail, SIGNAL( activated() ), SLOT( slotNextMail() ) ); 347 connect( nextMail, SIGNAL( activated() ), SLOT( slotNextMail() ) );
348 connect( viewSource, SIGNAL( activated() ), SLOT( slotViewSource() ) ); 348 connect( viewSource, SIGNAL( activated() ), SLOT( slotViewSource() ) );
349 connect( downloadMail, SIGNAL( activated() ), SIGNAL( signalDownloadMail() ) ); 349 connect( downloadMail, SIGNAL( activated() ), SIGNAL( signalDownloadMail() ) );
350 350
351 attachments->setEnabled(m_gotBody); 351 attachments->setEnabled(m_gotBody);
352 connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) ); 352 connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) );
353 353
354 readConfig(); 354 readConfig();
355 attachments->setSorting(-1); 355 attachments->setSorting(-1);
356} 356}
357 357
358void ViewMail::readConfig() 358void ViewMail::readConfig()
359{ 359{
360 360
361 setFont ( KOPrefs::instance()->mReadFont ); 361 setFont ( KOPrefs::instance()->mReadFont );
362 m_showHtml = KOPrefs::instance()->mViewAsHtml; 362 m_showHtml = KOPrefs::instance()->mViewAsHtml;
363 showHtml->setOn( m_showHtml ); 363 showHtml->setOn( m_showHtml );
364} 364}
365 365
366void ViewMail::setText() 366void ViewMail::setText()
367{ 367{
368 368
369 viewSource->setText(i18n("View Source")); 369 viewSource->setText(i18n("View Source"));
370 sourceOn = false; 370 sourceOn = false;
371 QString toString; 371 QString toString;
372 QString ccString; 372 QString ccString;
373 QString bccString; 373 QString bccString;
374 374
375 375
376 toString = m_mail2[0].join(","); 376 toString = m_mail2[0].join(",");
377 ccString = m_mail2[1].join(","); 377 ccString = m_mail2[1].join(",");
378 bccString = m_mail2[2].join(","); 378 bccString = m_mail2[2].join(",");
379 379
380 380#ifdef DESKTOP_VERSION
381 setCaption( i18n("E-Mail by %1").arg( m_mail[0] ) ); 381 setCaption( i18n("Size: ")+m_recMail->MsgsizeString()+" - "+i18n("E-Mail by %1").arg( m_mail[0] ) );
382#else
383 setCaption( m_recMail->MsgsizeString()+" - "+m_mail[0] );
384#endif
382 385
383 m_mailHtml = "<html><body>" 386 m_mailHtml = "<html><body>"
384 "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>" 387 "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>"
385 "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>" 388 "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>"
386 "</td></tr><tr bgcolor=\"#EEEEE6\"><td>" 389 "</td></tr><tr bgcolor=\"#EEEEE6\"><td>"
387 "<b>" + i18n( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>" 390 "<b>" + i18n( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>"
388 "<b>" + i18n( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" + 391 "<b>" + i18n( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" +
389 i18n( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>" 392 i18n( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>"
390 "<b>" + i18n( "Date" ) + ": </b> " + m_mail[3] + 393 "<b>" + i18n( "Date" ) + ": </b> " + m_mail[3] +
391 "</td></tr></table><font>"; 394 "</td></tr></table><font>";
392 395
393 if ( !m_showHtml ) 396 if ( !m_showHtml )
394 { 397 {
395 browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" ); 398 browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" );
396 } 399 }
397 else 400 else
398 { 401 {
399 browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" ); 402 browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" );
400 } 403 }
401 // remove later in favor of a real handling 404 // remove later in favor of a real handling
402 m_gotBody = true; 405 m_gotBody = true;
403} 406}
404 407
405 408
406ViewMail::~ViewMail() 409ViewMail::~ViewMail()
407{ 410{
408 m_recMail->Wrapper()->cleanMimeCache(); 411 m_recMail->Wrapper()->cleanMimeCache();
409 hide(); 412 hide();
410} 413}
411 414
412void ViewMail::hide() 415void ViewMail::hide()
413{ 416{
414 QWidget::hide(); 417 QWidget::hide();
415 418
416 if (_inLoop) 419 if (_inLoop)
417 { 420 {
418 _inLoop = false; 421 _inLoop = false;
419 qApp->exit_loop(); 422 qApp->exit_loop();
420 423
421 } 424 }
422 425
423} 426}
424 427
425void ViewMail::exec() 428void ViewMail::exec()
426{ 429{
427 show(); 430 show();
428 431
429 if (!_inLoop) 432 if (!_inLoop)
430 { 433 {
431 _inLoop = true; 434 _inLoop = true;
432 qApp->enter_loop(); 435 qApp->enter_loop();
433 } 436 }
434 437
435} 438}
436 439
437QString ViewMail::deHtml(const QString &string) 440QString ViewMail::deHtml(const QString &string)
438{ 441{
439 QString string_ = string; 442 QString string_ = string;
440 string_.replace(QRegExp("&"), "&amp;"); 443 string_.replace(QRegExp("&"), "&amp;");
441 string_.replace(QRegExp("<"), "&lt;"); 444 string_.replace(QRegExp("<"), "&lt;");
442 string_.replace(QRegExp(">"), "&gt;"); 445 string_.replace(QRegExp(">"), "&gt;");
443 string_.replace(QRegExp("\\n"), "<br>"); 446 string_.replace(QRegExp("\\n"), "<br>");
444 return string_; 447 return string_;
445} 448}
446 449
447void ViewMail::slotReply() 450void ViewMail::slotReply()
448{ 451{
449 if (!m_gotBody) 452 if (!m_gotBody)
450 { 453 {
451 QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot reply yet."), i18n("Ok")); 454 QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot reply yet."), i18n("Ok"));
452 return; 455 return;
453 } 456 }
454 457
455 QString rtext; 458 QString rtext;
456 rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose 459 rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose
457 .arg( m_mail[0] ) 460 .arg( m_mail[0] )
458 .arg( m_mail[3] ); 461 .arg( m_mail[3] );
459 462
460 QString text = m_mail[2]; 463 QString text = m_mail[2];
461 QStringList lines = QStringList::split(QRegExp("\\n"), text); 464 QStringList lines = QStringList::split(QRegExp("\\n"), text);
462 QStringList::Iterator it; 465 QStringList::Iterator it;
463 for (it = lines.begin(); it != lines.end(); it++) 466 for (it = lines.begin(); it != lines.end(); it++)
464 { 467 {
465 rtext += "> " + *it + "\n"; 468 rtext += "> " + *it + "\n";
466 } 469 }
467 rtext += "\n"; 470 rtext += "\n";
468 471
469 QString prefix; 472 QString prefix;
470 if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = ""; 473 if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = "";
471 else prefix = "Re: "; // no i18n on purpose 474 else prefix = "Re: "; // no i18n on purpose
472 475
473 Settings *settings = new Settings(); 476 Settings *settings = new Settings();
474 ComposeMail composer( settings ,this, 0, true); 477 ComposeMail composer( settings ,this, 0, true);
475 if (m_recMail->Replyto().isEmpty()) { 478 if (m_recMail->Replyto().isEmpty()) {
476 composer.setTo(m_recMail->getFrom()); 479 composer.setTo(m_recMail->getFrom());
477 } else { 480 } else {
478 composer.setTo(m_recMail->Replyto()); 481 composer.setTo(m_recMail->Replyto());
479 } 482 }
480 composer.setSubject( prefix + m_mail[1] ); 483 composer.setSubject( prefix + m_mail[1] );
481 composer.setMessage( rtext ); 484 composer.setMessage( rtext );
482 composer.setInReplyTo(m_recMail->Msgid()); 485 composer.setInReplyTo(m_recMail->Msgid());
483 composer.setCharset( m_body->getCharset() ); 486 composer.setCharset( m_body->getCharset() );
484 487
485 if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) 488 if ( QDialog::Accepted == KApplication::execDialog( &composer ) )
486 { 489 {
487 m_recMail->Wrapper()->answeredMail(m_recMail); 490 m_recMail->Wrapper()->answeredMail(m_recMail);
488 } 491 }
489 delete settings; 492 delete settings;
490} 493}
491 494
492void ViewMail::slotForward() 495void ViewMail::slotForward()
493{ 496{
494 if (!m_gotBody) 497 if (!m_gotBody)
495 { 498 {
496 QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot forward yet."), i18n("Ok")); 499 QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot forward yet."), i18n("Ok"));
497 return; 500 return;
498 } 501 }
499 502
500 QString ftext; 503 QString ftext;
501 ftext += QString("\n----- Forwarded message from %1 -----\n\n") 504 ftext += QString("\n----- Forwarded message from %1 -----\n\n")
502 .arg( m_mail[0] ); 505 .arg( m_mail[0] );
503 if (!m_mail[3].isNull()) 506 if (!m_mail[3].isNull())
504 ftext += QString("Date: %1\n") 507 ftext += QString("Date: %1\n")
505 .arg( m_mail[3] ); 508 .arg( m_mail[3] );
506 if (!m_mail[0].isNull()) 509 if (!m_mail[0].isNull())
507 ftext += QString("From: %1\n") 510 ftext += QString("From: %1\n")
508 .arg( m_mail[0] ); 511 .arg( m_mail[0] );
509 if (!m_mail[1].isNull()) 512 if (!m_mail[1].isNull())
510 ftext += QString("Subject: %1\n") 513 ftext += QString("Subject: %1\n")
511 .arg( m_mail[1] ); 514 .arg( m_mail[1] );
512 515
513 ftext += QString("\n%1\n") 516 ftext += QString("\n%1\n")
514 .arg( m_mail[2]); 517 .arg( m_mail[2]);
515 518
516 ftext += QString("----- End forwarded message -----\n"); 519 ftext += QString("----- End forwarded message -----\n");
517 520
518 Settings *settings = new Settings(); 521 Settings *settings = new Settings();
519 ComposeMail composer( settings ,this, 0, true); 522 ComposeMail composer( settings ,this, 0, true);
520 composer.setSubject( "Fwd: " + m_mail[1] ); 523 composer.setSubject( "Fwd: " + m_mail[1] );
521 composer.setMessage( ftext ); 524 composer.setMessage( ftext );
522 if ( QDialog::Accepted == KApplication::execDialog( &composer )) 525 if ( QDialog::Accepted == KApplication::execDialog( &composer ))
523 { 526 {
524 } 527 }
525} 528}
526 529
527void ViewMail::slotDeleteMail( ) 530void ViewMail::slotDeleteMail( )
528{ 531{
529 if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + m_mail[0] + " - " + m_mail[1] ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) 532 if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + m_mail[0] + " - " + m_mail[1] ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
530 { 533 {
531 emit deleteAndDisplayNextMail( this); 534 emit deleteAndDisplayNextMail( this);
532 //m_recMail->Wrapper()->deleteMail( m_recMail ); 535 //m_recMail->Wrapper()->deleteMail( m_recMail );
533 //hide(); 536 //hide();
534 deleted = true; 537 deleted = true;
535 } 538 }
536} 539}
537 540
538MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, WFlags f) 541MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, WFlags f)
539 : QDialog(parent,name,modal) 542 : QDialog(parent,name,modal)
540{ 543{
541 QVBoxLayout*dlglayout = new QVBoxLayout(this); 544 QVBoxLayout*dlglayout = new QVBoxLayout(this);
542 dlglayout->setSpacing(2); 545 dlglayout->setSpacing(2);
543 dlglayout->setMargin(1); 546 dlglayout->setMargin(1);
544 //m_imageview = new Opie::MM::OImageScrollView(this); 547 //m_imageview = new Opie::MM::OImageScrollView(this);
545 //dlglayout->addWidget(m_imageview); 548 //dlglayout->addWidget(m_imageview);
546} 549}
547 550
548MailImageDlg::~MailImageDlg() 551MailImageDlg::~MailImageDlg()
549{ 552{
550} 553}
551 554
552void MailImageDlg::setName(const QString&fname) 555void MailImageDlg::setName(const QString&fname)
553{ 556{
554 qDebug("viewmail.cpp: MailImageDlg::setName Pending"); 557 qDebug("viewmail.cpp: MailImageDlg::setName Pending");
555 // m_imageview->setImage(fname); 558 // m_imageview->setImage(fname);
556} 559}
557 560