summaryrefslogtreecommitdiffabout
Unidiff
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,218 +1,220 @@
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
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,224 +1,241 @@
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{
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,508 +1,544 @@
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()) {
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp
index 767a369..726f540 100644
--- a/kmicromail/viewmail.cpp
+++ b/kmicromail/viewmail.cpp
@@ -188,370 +188,373 @@ void ViewMail::setBody(const RecBodyP&body )
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