-rw-r--r-- | bin/kdepim/WhatsNew.txt | 3 | ||||
-rw-r--r-- | kmicromail/viewmail.cpp | 23 | ||||
-rw-r--r-- | kmicromail/viewmail.h | 2 |
3 files changed, 25 insertions, 3 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 0596511..86ac9b5 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -1,203 +1,206 @@ | |||
1 | Info about the changes in new versions of KDE-Pim/Pi | 1 | Info about the changes in new versions of KDE-Pim/Pi |
2 | 2 | ||
3 | ********** VERSION 2.0.12 ************ | 3 | ********** VERSION 2.0.12 ************ |
4 | 4 | ||
5 | KO/Pi: | 5 | KO/Pi: |
6 | Fixed a bug in todo start/due date handling for non recurring todos with a start and due date. | 6 | Fixed a bug in todo start/due date handling for non recurring todos with a start and due date. |
7 | Fixed some layout problems in the KO/Pi agenda view when there were many conflicting itmes. | 7 | Fixed some layout problems in the KO/Pi agenda view when there were many conflicting itmes. |
8 | Fixed several problems of the keyboard focus in the desktop versions when opening the search dialog/event viewer. | 8 | Fixed several problems of the keyboard focus in the desktop versions when opening the search dialog/event viewer. |
9 | 9 | ||
10 | Fixed problem in pi-sync mode when wrong password was sent. | 10 | Fixed problem in pi-sync mode when wrong password was sent. |
11 | 11 | ||
12 | OM/Pi: | ||
13 | Fixed a crash when displaying mails with "Show mail as html" was checked in the config. | ||
14 | Added a check before displaying the mail if the mail is in html format, if "Show mail as html" is enabled. | ||
12 | 15 | ||
13 | ********** VERSION 2.0.11 ************ | 16 | ********** VERSION 2.0.11 ************ |
14 | 17 | ||
15 | Fixed some problems in pi-sync mode | 18 | Fixed some problems in pi-sync mode |
16 | (e.g. details of events were not synced properly) | 19 | (e.g. details of events were not synced properly) |
17 | 20 | ||
18 | ********** VERSION 2.0.10 ************ | 21 | ********** VERSION 2.0.10 ************ |
19 | 22 | ||
20 | KO/Pi: | 23 | KO/Pi: |
21 | In the desktop versions the context menu in the search dialog was broken after introducing the What'sThis info for the list view. | 24 | In the desktop versions the context menu in the search dialog was broken after introducing the What'sThis info for the list view. |
22 | This is fixed. | 25 | This is fixed. |
23 | Changed the search dialog a bit to make it more user friendly. | 26 | Changed the search dialog a bit to make it more user friendly. |
24 | (E.g.: Removed message box about "no items found" and set key focus to search line edit after search). | 27 | (E.g.: Removed message box about "no items found" and set key focus to search line edit after search). |
25 | 28 | ||
26 | Added config option to hide the week number in KO/Pi toolbar. | 29 | Added config option to hide the week number in KO/Pi toolbar. |
27 | 30 | ||
28 | ********** VERSION 2.0.9 ************ | 31 | ********** VERSION 2.0.9 ************ |
29 | 32 | ||
30 | Made month view icons for multiday events a bit nicer. | 33 | Made month view icons for multiday events a bit nicer. |
31 | Some minor fixes in KO/Pi | 34 | Some minor fixes in KO/Pi |
32 | (e.g. go to today did not work for new week view properly). | 35 | (e.g. go to today did not work for new week view properly). |
33 | 36 | ||
34 | 37 | ||
35 | ********** VERSION 2.0.8 ************ | 38 | ********** VERSION 2.0.8 ************ |
36 | 39 | ||
37 | Fixed a problem in dependency info in the ipk files for the Zaurus. | 40 | Fixed a problem in dependency info in the ipk files for the Zaurus. |
38 | 41 | ||
39 | Added icon for the stealth new week view and made navigation more user friendly in monthview by adding a prev/next week button to the navigator bar. | 42 | Added icon for the stealth new week view and made navigation more user friendly in monthview by adding a prev/next week button to the navigator bar. |
40 | 43 | ||
41 | Added a "go today" button to the datepicker. | 44 | Added a "go today" button to the datepicker. |
42 | 45 | ||
43 | Added "created" and "last modified" to event/todo viewer (and What'sThis viewer) | 46 | Added "created" and "last modified" to event/todo viewer (and What'sThis viewer) |
44 | and made it configureable to show these values. | 47 | and made it configureable to show these values. |
45 | 48 | ||
46 | Fixed a problem for events (from external iCal files) that do have a duration but no end date. | 49 | Fixed a problem for events (from external iCal files) that do have a duration but no end date. |
47 | 50 | ||
48 | 51 | ||
49 | ********** VERSION 2.0.7 ************ | 52 | ********** VERSION 2.0.7 ************ |
50 | 53 | ||
51 | Added global application font settings | 54 | Added global application font settings |
52 | (for all KDE-Pim/Pi apps) to the general settings. | 55 | (for all KDE-Pim/Pi apps) to the general settings. |
53 | 56 | ||
54 | Fixed a problem in OM/Pi when trying to login to some IMAP servers | 57 | Fixed a problem in OM/Pi when trying to login to some IMAP servers |
55 | (like the IMAP server of Apple: mail.mac.com ) | 58 | (like the IMAP server of Apple: mail.mac.com ) |
56 | 59 | ||
57 | Added recurring todos to KO/Pi. | 60 | Added recurring todos to KO/Pi. |
58 | 61 | ||
59 | 62 | ||
60 | ********** VERSION 2.0.6 ************ | 63 | ********** VERSION 2.0.6 ************ |
61 | 64 | ||
62 | Some bugfixes in the pi-sync mode. | 65 | Some bugfixes in the pi-sync mode. |
63 | Added German translation for pi-sync mode. | 66 | Added German translation for pi-sync mode. |
64 | 67 | ||
65 | KO/Pi: | 68 | KO/Pi: |
66 | Made the todolist using alternate background. | 69 | Made the todolist using alternate background. |
67 | 70 | ||
68 | Other minor fixes in KO/Pi. | 71 | Other minor fixes in KO/Pi. |
69 | 72 | ||
70 | 73 | ||
71 | ********** VERSION 2.0.5 ************ | 74 | ********** VERSION 2.0.5 ************ |
72 | 75 | ||
73 | Bugfixes in KO/Pi. | 76 | Bugfixes in KO/Pi. |
74 | 77 | ||
75 | ********** VERSION 2.0.4 ************ | 78 | ********** VERSION 2.0.4 ************ |
76 | 79 | ||
77 | KO/Pi: | 80 | KO/Pi: |
78 | Fixed problem loading translations for summary/location edit boxes in event/todo editor. | 81 | Fixed problem loading translations for summary/location edit boxes in event/todo editor. |
79 | 82 | ||
80 | Added a general "select week number" to the toolbar. | 83 | Added a general "select week number" to the toolbar. |
81 | 84 | ||
82 | Fixed some small problem of the new features introduced in version 2.0.3. | 85 | Fixed some small problem of the new features introduced in version 2.0.3. |
83 | 86 | ||
84 | Made it possible to specify one specific category as category color, | 87 | Made it possible to specify one specific category as category color, |
85 | if more than one categories are selected. | 88 | if more than one categories are selected. |
86 | 89 | ||
87 | Fixed a bug in saving colors for categories with non-ascii characters. | 90 | Fixed a bug in saving colors for categories with non-ascii characters. |
88 | (Like, e.g. German Umlauts). | 91 | (Like, e.g. German Umlauts). |
89 | Propably you have to set your colors again for those categories. | 92 | Propably you have to set your colors again for those categories. |
90 | 93 | ||
91 | 94 | ||
92 | ********** VERSION 2.0.3 ************ | 95 | ********** VERSION 2.0.3 ************ |
93 | 96 | ||
94 | KO/Pi: | 97 | KO/Pi: |
95 | Added feature for changing alarm settings for many items at once: | 98 | Added feature for changing alarm settings for many items at once: |
96 | Open list view (or search dialog), select the desired items and choose in | 99 | Open list view (or search dialog), select the desired items and choose in |
97 | the popup menu: Set alarm for selected... | 100 | the popup menu: Set alarm for selected... |
98 | 101 | ||
99 | Added to the event/todo viewer the option to send an email to | 102 | Added to the event/todo viewer the option to send an email to |
100 | all attendees or all selected (with RSVP) attendees. | 103 | all attendees or all selected (with RSVP) attendees. |
101 | 104 | ||
102 | Made the week-month mode changing in month view faster. | 105 | Made the week-month mode changing in month view faster. |
103 | 106 | ||
104 | Made month view better useable with keyboard. | 107 | Made month view better useable with keyboard. |
105 | Now TAB key jumps to next cell with an event/todo. | 108 | Now TAB key jumps to next cell with an event/todo. |
106 | Scroll in cell with coursor keys, scroll in time (next week) with | 109 | Scroll in cell with coursor keys, scroll in time (next week) with |
107 | Shift/Control + coursorkeys. | 110 | Shift/Control + coursorkeys. |
108 | 111 | ||
109 | Fixed bug that the todo view flat mode was reset after first view update. | 112 | Fixed bug that the todo view flat mode was reset after first view update. |
110 | 113 | ||
111 | If a todo is displayed closed in the todo view, | 114 | If a todo is displayed closed in the todo view, |
112 | it is now displayed in overdue/due today color depending on the subtodos overdue/due today properties. | 115 | it is now displayed in overdue/due today color depending on the subtodos overdue/due today properties. |
113 | 116 | ||
114 | Added info about the numbers of years to the caption (title) information about a birthday event. | 117 | Added info about the numbers of years to the caption (title) information about a birthday event. |
115 | 118 | ||
116 | Made completion date in todo editor editable. | 119 | Made completion date in todo editor editable. |
117 | 120 | ||
118 | Added possibility to save/load templates for journals. | 121 | Added possibility to save/load templates for journals. |
119 | (Which is just a simple "save text to file" or "insert text from file". | 122 | (Which is just a simple "save text to file" or "insert text from file". |
120 | 123 | ||
121 | ********** VERSION 2.0.2 ************ | 124 | ********** VERSION 2.0.2 ************ |
122 | 125 | ||
123 | KO/Pi: | 126 | KO/Pi: |
124 | Fixed the layout problem of the day label buttons | 127 | Fixed the layout problem of the day label buttons |
125 | of the agenda view introduced in version 2.0.1. | 128 | of the agenda view introduced in version 2.0.1. |
126 | 129 | ||
127 | Added WhatsThis support for the todo view and the list view. | 130 | Added WhatsThis support for the todo view and the list view. |
128 | 131 | ||
129 | Added a quite useful feature to the montview. | 132 | Added a quite useful feature to the montview. |
130 | Just click on the week numbers on the left. | 133 | Just click on the week numbers on the left. |
131 | And in the top right corner of month view/agenda view | 134 | And in the top right corner of month view/agenda view |
132 | there is now a "week number quick selector". | 135 | there is now a "week number quick selector". |
133 | (Click on the black triangle). | 136 | (Click on the black triangle). |
134 | 137 | ||
135 | Made the quite difficult timezone change in KO/Pi easy. | 138 | Made the quite difficult timezone change in KO/Pi easy. |
136 | 139 | ||
137 | OM/Pi: | 140 | OM/Pi: |
138 | Fixed too small icons on desktop. | 141 | Fixed too small icons on desktop. |
139 | Fixed non visible icons in mainwindow on Z with fastload enabled. | 142 | Fixed non visible icons in mainwindow on Z with fastload enabled. |
140 | Added signature file setting to smtp account config. | 143 | Added signature file setting to smtp account config. |
141 | And the signature can be edited and saved in the edit mail dialog. | 144 | And the signature can be edited and saved in the edit mail dialog. |
142 | That does mean: | 145 | That does mean: |
143 | Simply edit the signature for the selected smtp account in the | 146 | Simply edit the signature for the selected smtp account in the |
144 | edit new mail dialog and press the "save signature" button there. | 147 | edit new mail dialog and press the "save signature" button there. |
145 | Then the signature is saved to the file specified in the smtp account settings. | 148 | Then the signature is saved to the file specified in the smtp account settings. |
146 | If there is no file specified, it is saved automatically to the file | 149 | If there is no file specified, it is saved automatically to the file |
147 | kdepim/apps/kopiemail/<accountname>.sig. | 150 | kdepim/apps/kopiemail/<accountname>.sig. |
148 | 151 | ||
149 | 152 | ||
150 | 153 | ||
151 | ********** VERSION 2.0.1 ************ | 154 | ********** VERSION 2.0.1 ************ |
152 | 155 | ||
153 | Oooops ... I forgot to test on the Zaurus 5500 ... | 156 | Oooops ... I forgot to test on the Zaurus 5500 ... |
154 | 157 | ||
155 | Fixed many problems of new (english) strings (and german translations) | 158 | Fixed many problems of new (english) strings (and german translations) |
156 | introduced in the latest versions, where the text was not fitting on the | 159 | introduced in the latest versions, where the text was not fitting on the |
157 | 240x320 display of the Zaurus 5500. | 160 | 240x320 display of the Zaurus 5500. |
158 | 161 | ||
159 | KO/Pi: | 162 | KO/Pi: |
160 | Added a popup menu ( press pen and hold to get popup ) to the agenda view | 163 | Added a popup menu ( press pen and hold to get popup ) to the agenda view |
161 | with many useful items (add event/todo, show next week, two weeks, month, journal). | 164 | with many useful items (add event/todo, show next week, two weeks, month, journal). |
162 | 165 | ||
163 | Added items to the todolist popup menu for: | 166 | Added items to the todolist popup menu for: |
164 | Display all opened, all closed or all todos flat. | 167 | Display all opened, all closed or all todos flat. |
165 | The "flat" view makes is possible to sort all todos after ,e.g., prio or date. | 168 | The "flat" view makes is possible to sort all todos after ,e.g., prio or date. |
166 | Made the reparenting of todos on the desktop possible via Drag&Drop. | 169 | Made the reparenting of todos on the desktop possible via Drag&Drop. |
167 | Fixed several bugs in setting the completed datetime for todos. | 170 | Fixed several bugs in setting the completed datetime for todos. |
168 | Added info about completed datetime of todos to the todo viewer. | 171 | Added info about completed datetime of todos to the todo viewer. |
169 | Now displaying a completed todo (with completed datetime set) in the agenda view | 172 | Now displaying a completed todo (with completed datetime set) in the agenda view |
170 | at the time of the completion. Such that now it is possible to see in the agenda view | 173 | at the time of the completion. Such that now it is possible to see in the agenda view |
171 | when what todo was completed. | 174 | when what todo was completed. |
172 | Fixed behaviour of automatic setting completion of todos with sub-todos/parent todos. | 175 | Fixed behaviour of automatic setting completion of todos with sub-todos/parent todos. |
173 | Now the behaviour is: | 176 | Now the behaviour is: |
174 | Setting a parent to complete sets all (sub)childs to complete. | 177 | Setting a parent to complete sets all (sub)childs to complete. |
175 | Setting a parent to uncomplete does not change the childs. | 178 | Setting a parent to uncomplete does not change the childs. |
176 | Setting a child to uncomplete sets all parent to uncomplete. | 179 | Setting a child to uncomplete sets all parent to uncomplete. |
177 | Setting a child to complete does not change the parents. | 180 | Setting a child to complete does not change the parents. |
178 | 181 | ||
179 | Smart updating and double buffering of the daymatrix. | 182 | Smart updating and double buffering of the daymatrix. |
180 | Showing holidays in the day matrix. | 183 | Showing holidays in the day matrix. |
181 | Many other small performance updates. | 184 | Many other small performance updates. |
182 | 185 | ||
183 | Made day labels in agenda clickable. By clicking a label, the day is displayed in single day mode. | 186 | Made day labels in agenda clickable. By clicking a label, the day is displayed in single day mode. |
184 | 187 | ||
185 | Now the translation file usertranslation.txt is supposed to be in utf8 format. | 188 | Now the translation file usertranslation.txt is supposed to be in utf8 format. |
186 | If you want to translate a language from western europe, just change the germantranslation.txt file. Please read the updated Usertranslation HowTo in KO/Pi Help menu. | 189 | If you want to translate a language from western europe, just change the germantranslation.txt file. Please read the updated Usertranslation HowTo in KO/Pi Help menu. |
187 | 190 | ||
188 | 191 | ||
189 | ********** VERSION 2.0.0 ************ | 192 | ********** VERSION 2.0.0 ************ |
190 | 193 | ||
191 | Stable release 2.0.0! | 194 | Stable release 2.0.0! |
192 | 195 | ||
193 | KO/Pi: | 196 | KO/Pi: |
194 | Fixed problem in edit dialog recreation at startup. | 197 | Fixed problem in edit dialog recreation at startup. |
195 | Made "toggle view*" menu items enabled context sensitive. | 198 | Made "toggle view*" menu items enabled context sensitive. |
196 | Changed agenda size menu to items 1-10. | 199 | Changed agenda size menu to items 1-10. |
197 | Made it possible to change agenda size quickly by pressing mouse on timelabels in agenda view and move mouse up/down. | 200 | Made it possible to change agenda size quickly by pressing mouse on timelabels in agenda view and move mouse up/down. |
198 | Usebility enhancements in the KO/Pi menus. | 201 | Usebility enhancements in the KO/Pi menus. |
199 | Birthday import now adds year to summary. | 202 | Birthday import now adds year to summary. |
200 | What's Next view shows age in years for birthday. | 203 | What's Next view shows age in years for birthday. |
201 | 204 | ||
202 | OM/Pi: | 205 | OM/Pi: |
203 | Added three info lines to display subject, from and to of selected mails. | 206 | Added three info lines to display subject, from and to of selected mails. |
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp index 726f540..685b4e4 100644 --- a/kmicromail/viewmail.cpp +++ b/kmicromail/viewmail.cpp | |||
@@ -1,546 +1,565 @@ | |||
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 | ||
38 | AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, | 38 | AttachItem::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 | ||
49 | AttachItem::AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, | 49 | AttachItem::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 | ||
60 | bool AttachItem::isParentof(const QValueList<int>&path) | 60 | bool 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 | ||
73 | AttachItem* ViewMail::searchParent(const QValueList<int>&path) | 73 | AttachItem* 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 | ||
84 | AttachItem* ViewMail::lastChild(AttachItem*parent) | 84 | AttachItem* 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 | ||
97 | void ViewMail::setBody(const RecBodyP&body ) | 97 | void 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 | m_showHtml = KOPrefs::instance()->mViewAsHtml; | ||
103 | if ( m_showHtml ) { | ||
104 | if ( m_mail[2].find ("<html>",0,false ) > -1 ) { | ||
105 | qDebug("html mail "); | ||
106 | } else { | ||
107 | qDebug("no html mail "); | ||
108 | m_showHtml = false; | ||
109 | } | ||
110 | } | ||
111 | showHtml->blockSignals( true ); | ||
112 | showHtml->setOn( m_showHtml ); | ||
113 | showHtml->blockSignals( false ); | ||
102 | // qDebug("********text %s ",m_mail[2].latin1() ); | 114 | // qDebug("********text %s ",m_mail[2].latin1() ); |
103 | attachbutton->setEnabled(body->Parts().count()>0); | 115 | attachbutton->setEnabled(body->Parts().count()>0); |
104 | attachments->setEnabled(body->Parts().count()>0); | 116 | attachments->setEnabled(body->Parts().count()>0); |
105 | if (body->Parts().count()==0) | 117 | if (body->Parts().count()==0) |
106 | { | 118 | { |
107 | return; | 119 | return; |
108 | } | 120 | } |
109 | AttachItem * curItem=0; | 121 | AttachItem * curItem=0; |
110 | AttachItem * parentItem = 0; | 122 | AttachItem * parentItem = 0; |
111 | QString type=body->Description()->Type()+"/"+body->Description()->Subtype(); | 123 | QString type=body->Description()->Type()+"/"+body->Description()->Subtype(); |
112 | QString desc,fsize; | 124 | QString desc,fsize; |
113 | double s = body->Description()->Size(); | 125 | double s = body->Description()->Size(); |
114 | int w; | 126 | int w; |
115 | w=0; | 127 | w=0; |
116 | 128 | ||
117 | while (s>1024) | 129 | while (s>1024) |
118 | { | 130 | { |
119 | s/=1024; | 131 | s/=1024; |
120 | ++w; | 132 | ++w; |
121 | if (w>=2) break; | 133 | if (w>=2) break; |
122 | } | 134 | } |
123 | 135 | ||
124 | QString q=""; | 136 | QString q=""; |
125 | switch(w) | 137 | switch(w) |
126 | { | 138 | { |
127 | case 1: | 139 | case 1: |
128 | q="k"; | 140 | q="k"; |
129 | break; | 141 | break; |
130 | case 2: | 142 | case 2: |
131 | q="M"; | 143 | q="M"; |
132 | break; | 144 | break; |
133 | default: | 145 | default: |
134 | break; | 146 | break; |
135 | } | 147 | } |
136 | 148 | ||
137 | { | 149 | { |
138 | /* I did not found a method to make a CONTENT reset on a QTextStream | 150 | /* 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 | 151 | 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 | 152 | 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. | 153 | code is it will be destructed after finishing its small job. |
142 | */ | 154 | */ |
143 | QTextOStream o(&fsize); | 155 | QTextOStream o(&fsize); |
144 | if (w>0) o.precision(2); else o.precision(0); | 156 | if (w>0) o.precision(2); else o.precision(0); |
145 | o.setf(QTextStream::fixed); | 157 | o.setf(QTextStream::fixed); |
146 | o << s << " " << q << "Byte"; | 158 | o << s << " " << q << "Byte"; |
147 | } | 159 | } |
148 | 160 | ||
149 | curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist()); | 161 | curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist()); |
150 | QString filename = ""; | 162 | QString filename = ""; |
151 | 163 | ||
152 | for (unsigned int i = 0; i < body->Parts().count();++i) | 164 | for (unsigned int i = 0; i < body->Parts().count();++i) |
153 | { | 165 | { |
154 | filename = ""; | 166 | filename = ""; |
155 | type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype(); | 167 | type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype(); |
156 | part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin(); | 168 | part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin(); |
157 | for (;it!=body->Parts()[i]->Parameters().end();++it) | 169 | for (;it!=body->Parts()[i]->Parameters().end();++it) |
158 | { | 170 | { |
159 | if (it.key().lower()=="name") | 171 | if (it.key().lower()=="name") |
160 | { | 172 | { |
161 | filename=it.data(); | 173 | filename=it.data(); |
162 | } | 174 | } |
163 | } | 175 | } |
164 | s = body->Parts()[i]->Size(); | 176 | s = body->Parts()[i]->Size(); |
165 | w = 0; | 177 | w = 0; |
166 | while (s>1024) | 178 | while (s>1024) |
167 | { | 179 | { |
168 | s/=1024; | 180 | s/=1024; |
169 | ++w; | 181 | ++w; |
170 | if (w>=2) break; | 182 | if (w>=2) break; |
171 | } | 183 | } |
172 | switch(w) | 184 | switch(w) |
173 | { | 185 | { |
174 | case 1: | 186 | case 1: |
175 | q="k"; | 187 | q="k"; |
176 | break; | 188 | break; |
177 | case 2: | 189 | case 2: |
178 | q="M"; | 190 | q="M"; |
179 | break; | 191 | break; |
180 | default: | 192 | default: |
181 | q=""; | 193 | q=""; |
182 | break; | 194 | break; |
183 | } | 195 | } |
184 | QTextOStream o(&fsize); | 196 | QTextOStream o(&fsize); |
185 | if (w>0) o.precision(2); else o.precision(0); | 197 | if (w>0) o.precision(2); else o.precision(0); |
186 | o.setf(QTextStream::fixed); | 198 | o.setf(QTextStream::fixed); |
187 | o << s << " " << q << "Byte"; | 199 | o << s << " " << q << "Byte"; |
188 | desc = body->Parts()[i]->Description(); | 200 | desc = body->Parts()[i]->Description(); |
189 | parentItem = searchParent(body->Parts()[i]->Positionlist()); | 201 | parentItem = searchParent(body->Parts()[i]->Positionlist()); |
190 | if (parentItem) | 202 | if (parentItem) |
191 | { | 203 | { |
192 | AttachItem*temp = lastChild(parentItem); | 204 | AttachItem*temp = lastChild(parentItem); |
193 | if (temp) curItem = temp; | 205 | if (temp) curItem = temp; |
194 | curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); | 206 | curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); |
195 | attachments->setRootIsDecorated(true); | 207 | attachments->setRootIsDecorated(true); |
196 | curItem = parentItem; | 208 | curItem = parentItem; |
197 | } | 209 | } |
198 | else | 210 | else |
199 | { | 211 | { |
200 | curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); | 212 | curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); |
201 | } | 213 | } |
202 | } | 214 | } |
203 | } | 215 | } |
204 | 216 | ||
205 | 217 | ||
206 | void ViewMail::slotViewSource() | 218 | void ViewMail::slotViewSource() |
207 | { | 219 | { |
208 | 220 | ||
209 | if ( !sourceOn ) { | 221 | if ( !sourceOn ) { |
210 | sourceOn = true; | 222 | sourceOn = true; |
211 | viewSource->setText(i18n("View Body Text")); | 223 | viewSource->setText(i18n("View Body Text")); |
212 | encodedString*st = 0; | 224 | encodedString*st = 0; |
213 | st = m_recMail->Wrapper()->fetchRawBody(m_recMail); | 225 | st = m_recMail->Wrapper()->fetchRawBody(m_recMail); |
214 | if ( st ) { | 226 | if ( st ) { |
215 | QString source = QString::fromUtf8( st->Content(), st->Length()); | 227 | QString source = QString::fromUtf8( st->Content(), st->Length()); |
216 | browser->setText( source ); | 228 | browser->setText( source ); |
217 | delete st; | 229 | delete st; |
218 | } | 230 | } |
219 | } else | 231 | } else |
220 | setText(); | 232 | setText(); |
221 | 233 | ||
222 | 234 | ||
223 | } | 235 | } |
224 | void ViewMail::slotShowHtml( bool state ) | 236 | void ViewMail::slotShowHtml( bool state ) |
225 | { | 237 | { |
226 | m_showHtml = state; | 238 | m_showHtml = state; |
227 | setText(); | 239 | setText(); |
228 | } | 240 | } |
229 | 241 | ||
230 | void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) | 242 | void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) |
231 | { | 243 | { |
232 | if (!item ) | 244 | if (!item ) |
233 | return; | 245 | return; |
234 | 246 | ||
235 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) | 247 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) |
236 | { | 248 | { |
237 | setText(); | 249 | setText(); |
238 | return; | 250 | return; |
239 | } | 251 | } |
240 | QPopupMenu *menu = new QPopupMenu(); | 252 | QPopupMenu *menu = new QPopupMenu(); |
241 | int ret=0; | 253 | int ret=0; |
242 | 254 | ||
243 | if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" ) | 255 | if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" ) |
244 | { | 256 | { |
245 | menu->insertItem( i18n( "Show Text" ), 1 ); | 257 | menu->insertItem( i18n( "Show Text" ), 1 ); |
246 | } | 258 | } |
247 | if (item->text(0).left(6)=="image/") { | 259 | if (item->text(0).left(6)=="image/") { |
248 | menu->insertItem(i18n("Display image preview"),2); | 260 | menu->insertItem(i18n("Display image preview"),2); |
249 | } | 261 | } |
250 | menu->insertItem( i18n( "Save Attachment" ), 0 ); | 262 | menu->insertItem( i18n( "Save Attachment" ), 0 ); |
251 | menu->insertSeparator(1); | 263 | menu->insertSeparator(1); |
252 | 264 | ||
253 | ret = menu->exec( point, 0 ); | 265 | ret = menu->exec( point, 0 ); |
254 | 266 | ||
255 | switch(ret) | 267 | switch(ret) |
256 | { | 268 | { |
257 | case 0: | 269 | case 0: |
258 | { | 270 | { |
259 | //MimeTypes types; | 271 | //MimeTypes types; |
260 | //types.insert( "all", "*" ); | 272 | //types.insert( "all", "*" ); |
261 | QString str = KFileDialog::getSaveFileName( "/", item->text( 2 ), this ); | 273 | QString str = KFileDialog::getSaveFileName( "/", item->text( 2 ), this ); |
262 | 274 | ||
263 | if( !str.isEmpty() ) | 275 | if( !str.isEmpty() ) |
264 | { | 276 | { |
265 | encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); | 277 | encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); |
266 | if (content) | 278 | if (content) |
267 | { | 279 | { |
268 | QFile output(str); | 280 | QFile output(str); |
269 | output.open(IO_WriteOnly); | 281 | output.open(IO_WriteOnly); |
270 | output.writeBlock(content->Content(),content->Length()); | 282 | output.writeBlock(content->Content(),content->Length()); |
271 | output.close(); | 283 | output.close(); |
272 | delete content; | 284 | delete content; |
273 | } | 285 | } |
274 | } | 286 | } |
275 | } | 287 | } |
276 | break ; | 288 | break ; |
277 | 289 | ||
278 | case 2: | 290 | case 2: |
279 | { | 291 | { |
280 | #ifdef DESKTOP_VERSION | 292 | #ifdef DESKTOP_VERSION |
281 | QString tmpfile = locateLocal( "tmp", "opiemail-image"); | 293 | QString tmpfile = locateLocal( "tmp", "opiemail-image"); |
282 | #else | 294 | #else |
283 | QString tmpfile = "/tmp/opiemail-image"; | 295 | QString tmpfile = "/tmp/opiemail-image"; |
284 | #endif | 296 | #endif |
285 | encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); | 297 | encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); |
286 | if (content) { | 298 | if (content) { |
287 | QFile output(tmpfile); | 299 | QFile output(tmpfile); |
288 | output.open(IO_WriteOnly); | 300 | output.open(IO_WriteOnly); |
289 | output.writeBlock(content->Content(),content->Length()); | 301 | output.writeBlock(content->Content(),content->Length()); |
290 | output.close(); | 302 | output.close(); |
291 | delete content; | 303 | delete content; |
292 | MailImageDlg iview(""); | 304 | MailImageDlg iview(""); |
293 | iview.setName(tmpfile); | 305 | iview.setName(tmpfile); |
294 | KApplication::execDialog(&iview); | 306 | KApplication::execDialog(&iview); |
295 | output.remove(); | 307 | output.remove(); |
296 | } | 308 | } |
297 | } | 309 | } |
298 | break; | 310 | break; |
299 | case 1: | 311 | case 1: |
300 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) | 312 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) |
301 | { | 313 | { |
302 | setText(); | 314 | setText(); |
303 | } | 315 | } |
304 | else | 316 | else |
305 | { | 317 | { |
306 | if ( m_recMail->Wrapper() != 0l ) | 318 | if ( m_recMail->Wrapper() != 0l ) |
307 | { // make sure that there is a wrapper , even after delete or simular actions | 319 | { // 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() ] ) ); | 320 | browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); |
309 | } | 321 | } |
310 | } | 322 | } |
311 | break; | 323 | break; |
312 | } | 324 | } |
313 | delete menu; | 325 | delete menu; |
314 | } | 326 | } |
315 | 327 | ||
316 | 328 | ||
317 | void ViewMail::setMail(const RecMailP&mail ) | 329 | void ViewMail::setMail(const RecMailP&mail ) |
318 | { | 330 | { |
319 | 331 | ||
320 | m_recMail = mail; | 332 | m_recMail = mail; |
321 | 333 | ||
322 | m_mail[0] = mail->getFrom(); | 334 | m_mail[0] = mail->getFrom(); |
323 | m_mail[1] = mail->getSubject(); | 335 | m_mail[1] = mail->getSubject(); |
324 | m_mail[3] = mail->getDate(); | 336 | m_mail[3] = mail->getDate(); |
325 | m_mail[4] = mail->Msgid(); | 337 | m_mail[4] = mail->Msgid(); |
326 | 338 | ||
327 | m_mail2[0] = mail->To(); | 339 | m_mail2[0] = mail->To(); |
328 | m_mail2[1] = mail->CC(); | 340 | m_mail2[1] = mail->CC(); |
329 | m_mail2[2] = mail->Bcc(); | 341 | m_mail2[2] = mail->Bcc(); |
330 | 342 | ||
331 | setText(); | 343 | setText(); |
332 | } | 344 | } |
333 | 345 | ||
334 | 346 | void ViewMail::slotNextMail() | |
347 | { | ||
348 | nextMail->blockSignals( true ); | ||
349 | setCaption(i18n("Displaying next mail...please wait!")); | ||
350 | qApp->processEvents(); | ||
351 | emit showNextMail(this); | ||
352 | nextMail->blockSignals( false ); | ||
353 | } | ||
335 | 354 | ||
336 | ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) | 355 | ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) |
337 | : ViewMailBase(parent, name, fl), _inLoop(false) | 356 | : ViewMailBase(parent, name, fl), _inLoop(false) |
338 | { | 357 | { |
339 | m_gotBody = false; | 358 | m_gotBody = false; |
340 | deleted = false; | 359 | deleted = false; |
341 | sourceOn = false; | 360 | sourceOn = false; |
361 | readConfig(); | ||
342 | connect( reply, SIGNAL(activated()), SLOT(slotReply())); | 362 | connect( reply, SIGNAL(activated()), SLOT(slotReply())); |
343 | connect( forward, SIGNAL(activated()), SLOT(slotForward())); | 363 | connect( forward, SIGNAL(activated()), SLOT(slotForward())); |
344 | connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) ); | 364 | connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) ); |
345 | connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) ); | 365 | connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) ); |
346 | connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); | 366 | connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); |
347 | connect( nextMail, SIGNAL( activated() ), SLOT( slotNextMail() ) ); | 367 | connect( nextMail, SIGNAL( activated() ), SLOT( slotNextMail() ) ); |
348 | connect( viewSource, SIGNAL( activated() ), SLOT( slotViewSource() ) ); | 368 | connect( viewSource, SIGNAL( activated() ), SLOT( slotViewSource() ) ); |
349 | connect( downloadMail, SIGNAL( activated() ), SIGNAL( signalDownloadMail() ) ); | 369 | connect( downloadMail, SIGNAL( activated() ), SIGNAL( signalDownloadMail() ) ); |
350 | 370 | ||
351 | attachments->setEnabled(m_gotBody); | 371 | attachments->setEnabled(m_gotBody); |
352 | connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) ); | 372 | connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) ); |
353 | 373 | ||
354 | readConfig(); | ||
355 | attachments->setSorting(-1); | 374 | attachments->setSorting(-1); |
356 | } | 375 | } |
357 | 376 | ||
358 | void ViewMail::readConfig() | 377 | void ViewMail::readConfig() |
359 | { | 378 | { |
360 | 379 | ||
361 | setFont ( KOPrefs::instance()->mReadFont ); | 380 | setFont ( KOPrefs::instance()->mReadFont ); |
362 | m_showHtml = KOPrefs::instance()->mViewAsHtml; | 381 | m_showHtml = KOPrefs::instance()->mViewAsHtml; |
363 | showHtml->setOn( m_showHtml ); | 382 | showHtml->setOn( m_showHtml ); |
364 | } | 383 | } |
365 | 384 | ||
366 | void ViewMail::setText() | 385 | void ViewMail::setText() |
367 | { | 386 | { |
368 | 387 | ||
369 | viewSource->setText(i18n("View Source")); | 388 | viewSource->setText(i18n("View Source")); |
370 | sourceOn = false; | 389 | sourceOn = false; |
371 | QString toString; | 390 | QString toString; |
372 | QString ccString; | 391 | QString ccString; |
373 | QString bccString; | 392 | QString bccString; |
374 | 393 | ||
375 | 394 | ||
376 | toString = m_mail2[0].join(","); | 395 | toString = m_mail2[0].join(","); |
377 | ccString = m_mail2[1].join(","); | 396 | ccString = m_mail2[1].join(","); |
378 | bccString = m_mail2[2].join(","); | 397 | bccString = m_mail2[2].join(","); |
379 | 398 | ||
380 | #ifdef DESKTOP_VERSION | 399 | #ifdef DESKTOP_VERSION |
381 | setCaption( i18n("Size: ")+m_recMail->MsgsizeString()+" - "+i18n("E-Mail by %1").arg( m_mail[0] ) ); | 400 | setCaption( i18n("Size: ")+m_recMail->MsgsizeString()+" - "+i18n("E-Mail by %1").arg( m_mail[0] ) ); |
382 | #else | 401 | #else |
383 | setCaption( m_recMail->MsgsizeString()+" - "+m_mail[0] ); | 402 | setCaption( m_recMail->MsgsizeString()+" - "+m_mail[0] ); |
384 | #endif | 403 | #endif |
385 | 404 | ||
386 | m_mailHtml = "<html><body>" | 405 | m_mailHtml = "<html><body>" |
387 | "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>" | 406 | "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>" |
388 | "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>" | 407 | "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>" |
389 | "</td></tr><tr bgcolor=\"#EEEEE6\"><td>" | 408 | "</td></tr><tr bgcolor=\"#EEEEE6\"><td>" |
390 | "<b>" + i18n( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>" | 409 | "<b>" + i18n( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>" |
391 | "<b>" + i18n( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" + | 410 | "<b>" + i18n( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" + |
392 | i18n( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>" | 411 | i18n( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>" |
393 | "<b>" + i18n( "Date" ) + ": </b> " + m_mail[3] + | 412 | "<b>" + i18n( "Date" ) + ": </b> " + m_mail[3] + |
394 | "</td></tr></table><font>"; | 413 | "</td></tr></table><font>"; |
395 | 414 | ||
396 | if ( !m_showHtml ) | 415 | if ( !m_showHtml ) |
397 | { | 416 | { |
398 | browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" ); | 417 | browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" ); |
399 | } | 418 | } |
400 | else | 419 | else |
401 | { | 420 | { |
402 | browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" ); | 421 | browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" ); |
403 | } | 422 | } |
404 | // remove later in favor of a real handling | 423 | // remove later in favor of a real handling |
405 | m_gotBody = true; | 424 | m_gotBody = true; |
406 | } | 425 | } |
407 | 426 | ||
408 | 427 | ||
409 | ViewMail::~ViewMail() | 428 | ViewMail::~ViewMail() |
410 | { | 429 | { |
411 | m_recMail->Wrapper()->cleanMimeCache(); | 430 | m_recMail->Wrapper()->cleanMimeCache(); |
412 | hide(); | 431 | hide(); |
413 | } | 432 | } |
414 | 433 | ||
415 | void ViewMail::hide() | 434 | void ViewMail::hide() |
416 | { | 435 | { |
417 | QWidget::hide(); | 436 | QWidget::hide(); |
418 | 437 | ||
419 | if (_inLoop) | 438 | if (_inLoop) |
420 | { | 439 | { |
421 | _inLoop = false; | 440 | _inLoop = false; |
422 | qApp->exit_loop(); | 441 | qApp->exit_loop(); |
423 | 442 | ||
424 | } | 443 | } |
425 | 444 | ||
426 | } | 445 | } |
427 | 446 | ||
428 | void ViewMail::exec() | 447 | void ViewMail::exec() |
429 | { | 448 | { |
430 | show(); | 449 | show(); |
431 | 450 | ||
432 | if (!_inLoop) | 451 | if (!_inLoop) |
433 | { | 452 | { |
434 | _inLoop = true; | 453 | _inLoop = true; |
435 | qApp->enter_loop(); | 454 | qApp->enter_loop(); |
436 | } | 455 | } |
437 | 456 | ||
438 | } | 457 | } |
439 | 458 | ||
440 | QString ViewMail::deHtml(const QString &string) | 459 | QString ViewMail::deHtml(const QString &string) |
441 | { | 460 | { |
442 | QString string_ = string; | 461 | QString string_ = string; |
443 | string_.replace(QRegExp("&"), "&"); | 462 | string_.replace(QRegExp("&"), "&"); |
444 | string_.replace(QRegExp("<"), "<"); | 463 | string_.replace(QRegExp("<"), "<"); |
445 | string_.replace(QRegExp(">"), ">"); | 464 | string_.replace(QRegExp(">"), ">"); |
446 | string_.replace(QRegExp("\\n"), "<br>"); | 465 | string_.replace(QRegExp("\\n"), "<br>"); |
447 | return string_; | 466 | return string_; |
448 | } | 467 | } |
449 | 468 | ||
450 | void ViewMail::slotReply() | 469 | void ViewMail::slotReply() |
451 | { | 470 | { |
452 | if (!m_gotBody) | 471 | if (!m_gotBody) |
453 | { | 472 | { |
454 | QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot reply yet."), i18n("Ok")); | 473 | QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot reply yet."), i18n("Ok")); |
455 | return; | 474 | return; |
456 | } | 475 | } |
457 | 476 | ||
458 | QString rtext; | 477 | QString rtext; |
459 | rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose | 478 | rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose |
460 | .arg( m_mail[0] ) | 479 | .arg( m_mail[0] ) |
461 | .arg( m_mail[3] ); | 480 | .arg( m_mail[3] ); |
462 | 481 | ||
463 | QString text = m_mail[2]; | 482 | QString text = m_mail[2]; |
464 | QStringList lines = QStringList::split(QRegExp("\\n"), text); | 483 | QStringList lines = QStringList::split(QRegExp("\\n"), text); |
465 | QStringList::Iterator it; | 484 | QStringList::Iterator it; |
466 | for (it = lines.begin(); it != lines.end(); it++) | 485 | for (it = lines.begin(); it != lines.end(); it++) |
467 | { | 486 | { |
468 | rtext += "> " + *it + "\n"; | 487 | rtext += "> " + *it + "\n"; |
469 | } | 488 | } |
470 | rtext += "\n"; | 489 | rtext += "\n"; |
471 | 490 | ||
472 | QString prefix; | 491 | QString prefix; |
473 | if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = ""; | 492 | if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = ""; |
474 | else prefix = "Re: "; // no i18n on purpose | 493 | else prefix = "Re: "; // no i18n on purpose |
475 | 494 | ||
476 | Settings *settings = new Settings(); | 495 | Settings *settings = new Settings(); |
477 | ComposeMail composer( settings ,this, 0, true); | 496 | ComposeMail composer( settings ,this, 0, true); |
478 | if (m_recMail->Replyto().isEmpty()) { | 497 | if (m_recMail->Replyto().isEmpty()) { |
479 | composer.setTo(m_recMail->getFrom()); | 498 | composer.setTo(m_recMail->getFrom()); |
480 | } else { | 499 | } else { |
481 | composer.setTo(m_recMail->Replyto()); | 500 | composer.setTo(m_recMail->Replyto()); |
482 | } | 501 | } |
483 | composer.setSubject( prefix + m_mail[1] ); | 502 | composer.setSubject( prefix + m_mail[1] ); |
484 | composer.setMessage( rtext ); | 503 | composer.setMessage( rtext ); |
485 | composer.setInReplyTo(m_recMail->Msgid()); | 504 | composer.setInReplyTo(m_recMail->Msgid()); |
486 | composer.setCharset( m_body->getCharset() ); | 505 | composer.setCharset( m_body->getCharset() ); |
487 | 506 | ||
488 | if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) | 507 | if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) |
489 | { | 508 | { |
490 | m_recMail->Wrapper()->answeredMail(m_recMail); | 509 | m_recMail->Wrapper()->answeredMail(m_recMail); |
491 | } | 510 | } |
492 | delete settings; | 511 | delete settings; |
493 | } | 512 | } |
494 | 513 | ||
495 | void ViewMail::slotForward() | 514 | void ViewMail::slotForward() |
496 | { | 515 | { |
497 | if (!m_gotBody) | 516 | if (!m_gotBody) |
498 | { | 517 | { |
499 | QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot forward yet."), i18n("Ok")); | 518 | QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot forward yet."), i18n("Ok")); |
500 | return; | 519 | return; |
501 | } | 520 | } |
502 | 521 | ||
503 | QString ftext; | 522 | QString ftext; |
504 | ftext += QString("\n----- Forwarded message from %1 -----\n\n") | 523 | ftext += QString("\n----- Forwarded message from %1 -----\n\n") |
505 | .arg( m_mail[0] ); | 524 | .arg( m_mail[0] ); |
506 | if (!m_mail[3].isNull()) | 525 | if (!m_mail[3].isNull()) |
507 | ftext += QString("Date: %1\n") | 526 | ftext += QString("Date: %1\n") |
508 | .arg( m_mail[3] ); | 527 | .arg( m_mail[3] ); |
509 | if (!m_mail[0].isNull()) | 528 | if (!m_mail[0].isNull()) |
510 | ftext += QString("From: %1\n") | 529 | ftext += QString("From: %1\n") |
511 | .arg( m_mail[0] ); | 530 | .arg( m_mail[0] ); |
512 | if (!m_mail[1].isNull()) | 531 | if (!m_mail[1].isNull()) |
513 | ftext += QString("Subject: %1\n") | 532 | ftext += QString("Subject: %1\n") |
514 | .arg( m_mail[1] ); | 533 | .arg( m_mail[1] ); |
515 | 534 | ||
516 | ftext += QString("\n%1\n") | 535 | ftext += QString("\n%1\n") |
517 | .arg( m_mail[2]); | 536 | .arg( m_mail[2]); |
518 | 537 | ||
519 | ftext += QString("----- End forwarded message -----\n"); | 538 | ftext += QString("----- End forwarded message -----\n"); |
520 | 539 | ||
521 | Settings *settings = new Settings(); | 540 | Settings *settings = new Settings(); |
522 | ComposeMail composer( settings ,this, 0, true); | 541 | ComposeMail composer( settings ,this, 0, true); |
523 | composer.setSubject( "Fwd: " + m_mail[1] ); | 542 | composer.setSubject( "Fwd: " + m_mail[1] ); |
524 | composer.setMessage( ftext ); | 543 | composer.setMessage( ftext ); |
525 | if ( QDialog::Accepted == KApplication::execDialog( &composer )) | 544 | if ( QDialog::Accepted == KApplication::execDialog( &composer )) |
526 | { | 545 | { |
527 | } | 546 | } |
528 | } | 547 | } |
529 | 548 | ||
530 | void ViewMail::slotDeleteMail( ) | 549 | void ViewMail::slotDeleteMail( ) |
531 | { | 550 | { |
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 ) | 551 | 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 ) |
533 | { | 552 | { |
534 | emit deleteAndDisplayNextMail( this); | 553 | emit deleteAndDisplayNextMail( this); |
535 | //m_recMail->Wrapper()->deleteMail( m_recMail ); | 554 | //m_recMail->Wrapper()->deleteMail( m_recMail ); |
536 | //hide(); | 555 | //hide(); |
537 | deleted = true; | 556 | deleted = true; |
538 | } | 557 | } |
539 | } | 558 | } |
540 | 559 | ||
541 | MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, WFlags f) | 560 | MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, WFlags f) |
542 | : QDialog(parent,name,modal) | 561 | : QDialog(parent,name,modal) |
543 | { | 562 | { |
544 | QVBoxLayout*dlglayout = new QVBoxLayout(this); | 563 | QVBoxLayout*dlglayout = new QVBoxLayout(this); |
545 | dlglayout->setSpacing(2); | 564 | dlglayout->setSpacing(2); |
546 | dlglayout->setMargin(1); | 565 | dlglayout->setMargin(1); |
diff --git a/kmicromail/viewmail.h b/kmicromail/viewmail.h index fc5edcf..bb5b685 100644 --- a/kmicromail/viewmail.h +++ b/kmicromail/viewmail.h | |||
@@ -1,93 +1,93 @@ | |||
1 | #ifndef VIEWMAIL_H | 1 | #ifndef VIEWMAIL_H |
2 | #define VIEWMAIL_H | 2 | #define VIEWMAIL_H |
3 | 3 | ||
4 | #include "viewmailbase.h" | 4 | #include "viewmailbase.h" |
5 | #include <libmailwrapper/mailtypes.h> | 5 | #include <libmailwrapper/mailtypes.h> |
6 | 6 | ||
7 | #include <qdialog.h> | 7 | #include <qdialog.h> |
8 | #include <qapplication.h> | 8 | #include <qapplication.h> |
9 | 9 | ||
10 | #include <qlistview.h> | 10 | #include <qlistview.h> |
11 | #include <qmap.h> | 11 | #include <qmap.h> |
12 | #include <klocale.h> | 12 | #include <klocale.h> |
13 | #include <qstringlist.h> | 13 | #include <qstringlist.h> |
14 | #include <qvaluelist.h> | 14 | #include <qvaluelist.h> |
15 | 15 | ||
16 | //namespace Opie { namespace MM { class OImageScrollView; } } | 16 | //namespace Opie { namespace MM { class OImageScrollView; } } |
17 | 17 | ||
18 | class AttachItem : public QListViewItem | 18 | class AttachItem : public QListViewItem |
19 | { | 19 | { |
20 | public: | 20 | public: |
21 | AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, | 21 | AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, |
22 | const QString&fsize,int num,const QValueList<int>&path); | 22 | const QString&fsize,int num,const QValueList<int>&path); |
23 | AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, | 23 | AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, |
24 | const QString&fsize,int num,const QValueList<int>&path); | 24 | const QString&fsize,int num,const QValueList<int>&path); |
25 | int Partnumber() { return _partNum; } | 25 | int Partnumber() { return _partNum; } |
26 | bool isParentof(const QValueList<int>&path); | 26 | bool isParentof(const QValueList<int>&path); |
27 | 27 | ||
28 | private: | 28 | private: |
29 | int _partNum; | 29 | int _partNum; |
30 | /* needed for a better display of attachments */ | 30 | /* needed for a better display of attachments */ |
31 | QValueList<int> _path; | 31 | QValueList<int> _path; |
32 | }; | 32 | }; |
33 | 33 | ||
34 | class ViewMail : public ViewMailBase | 34 | class ViewMail : public ViewMailBase |
35 | { | 35 | { |
36 | Q_OBJECT | 36 | Q_OBJECT |
37 | 37 | ||
38 | public: | 38 | public: |
39 | ViewMail( QWidget *parent = 0, const char *name = 0, WFlags fl = 0); | 39 | ViewMail( QWidget *parent = 0, const char *name = 0, WFlags fl = 0); |
40 | ~ViewMail(); | 40 | ~ViewMail(); |
41 | 41 | ||
42 | void hide(); | 42 | void hide(); |
43 | void exec(); | 43 | void exec(); |
44 | void setMail(const RecMailP&mail ); | 44 | void setMail(const RecMailP&mail ); |
45 | void setBody(const RecBodyP&body); | 45 | void setBody(const RecBodyP&body); |
46 | bool deleted; | 46 | bool deleted; |
47 | signals: | 47 | signals: |
48 | void showNextMail(ViewMail*); | 48 | void showNextMail(ViewMail*); |
49 | void deleteAndDisplayNextMail(ViewMail *); | 49 | void deleteAndDisplayNextMail(ViewMail *); |
50 | void signalDownloadMail(); | 50 | void signalDownloadMail(); |
51 | protected: | 51 | protected: |
52 | QString deHtml(const QString &string); | 52 | QString deHtml(const QString &string); |
53 | AttachItem* searchParent(const QValueList<int>&path); | 53 | AttachItem* searchParent(const QValueList<int>&path); |
54 | AttachItem* lastChild(AttachItem*parent); | 54 | AttachItem* lastChild(AttachItem*parent); |
55 | 55 | ||
56 | protected slots: | 56 | protected slots: |
57 | void slotNextMail() { setCaption(i18n("Displaying next mail...please wait!")); qApp->processEvents();emit showNextMail(this); }; | 57 | void slotNextMail(); |
58 | void slotReply(); | 58 | void slotReply(); |
59 | void slotForward(); | 59 | void slotForward(); |
60 | void setText(); | 60 | void setText(); |
61 | void slotItemClicked( QListViewItem * item , const QPoint & point, int c ); | 61 | void slotItemClicked( QListViewItem * item , const QPoint & point, int c ); |
62 | void slotDeleteMail( ); | 62 | void slotDeleteMail( ); |
63 | void slotShowHtml( bool ); | 63 | void slotShowHtml( bool ); |
64 | void slotViewSource(); | 64 | void slotViewSource(); |
65 | 65 | ||
66 | private: | 66 | private: |
67 | void readConfig(); | 67 | void readConfig(); |
68 | bool sourceOn;; | 68 | bool sourceOn;; |
69 | bool _inLoop; | 69 | bool _inLoop; |
70 | QString m_mailHtml; | 70 | QString m_mailHtml; |
71 | bool m_gotBody; | 71 | bool m_gotBody; |
72 | RecBodyP m_body; | 72 | RecBodyP m_body; |
73 | RecMailP m_recMail; | 73 | RecMailP m_recMail; |
74 | bool m_showHtml; | 74 | bool m_showHtml; |
75 | 75 | ||
76 | // 0 from 1 subject 2 bodytext 3 date | 76 | // 0 from 1 subject 2 bodytext 3 date |
77 | QMap <int,QString> m_mail; | 77 | QMap <int,QString> m_mail; |
78 | // 0 to 1 cc 2 bcc | 78 | // 0 to 1 cc 2 bcc |
79 | QMap <int,QStringList> m_mail2; | 79 | QMap <int,QStringList> m_mail2; |
80 | }; | 80 | }; |
81 | 81 | ||
82 | class MailImageDlg:public QDialog | 82 | class MailImageDlg:public QDialog |
83 | { | 83 | { |
84 | Q_OBJECT | 84 | Q_OBJECT |
85 | public: | 85 | public: |
86 | MailImageDlg(const QString&,QWidget *parent = 0, const char *name = 0, bool modal = true, WFlags f = 0); | 86 | MailImageDlg(const QString&,QWidget *parent = 0, const char *name = 0, bool modal = true, WFlags f = 0); |
87 | ~MailImageDlg(); | 87 | ~MailImageDlg(); |
88 | void setName(const QString&); | 88 | void setName(const QString&); |
89 | protected: | 89 | protected: |
90 | //Opie::MM::OImageScrollView*m_imageview; | 90 | //Opie::MM::OImageScrollView*m_imageview; |
91 | }; | 91 | }; |
92 | 92 | ||
93 | #endif | 93 | #endif |