author | zautrix <zautrix> | 2005-01-24 18:05:48 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-24 18:05:48 (UTC) |
commit | 77f93c632b66b5c8d92e4c63330362272ca1fc40 (patch) (unidiff) | |
tree | 31f28656062c899b5368f13ab594ff6fa5c657fa /kmicromail | |
parent | 6c89efd80c1e94a0c070025d07c7a4c656f2a81e (diff) | |
download | kdepimpi-77f93c632b66b5c8d92e4c63330362272ca1fc40.zip kdepimpi-77f93c632b66b5c8d92e4c63330362272ca1fc40.tar.gz kdepimpi-77f93c632b66b5c8d92e4c63330362272ca1fc40.tar.bz2 |
mail fixes
-rw-r--r-- | kmicromail/accountview.h | 2 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mailtypes.cpp | 17 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mailtypes.h | 1 | ||||
-rw-r--r-- | kmicromail/mailistviewitem.cpp | 24 | ||||
-rw-r--r-- | kmicromail/opiemail.cpp | 38 | ||||
-rw-r--r-- | kmicromail/viewmail.cpp | 7 |
6 files changed, 69 insertions, 20 deletions
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 | ||
9 | class Selectstore; | 9 | class Selectstore; |
10 | class Folder; | 10 | class Folder; |
11 | class AbstractMail; | 11 | class AbstractMail; |
12 | class Account; | 12 | class Account; |
13 | class IMAPviewItem; | 13 | class IMAPviewItem; |
14 | class MHviewItem; | 14 | class MHviewItem; |
15 | 15 | ||
16 | class AccountView : public QListView | 16 | class AccountView : public QListView |
17 | { | 17 | { |
18 | Q_OBJECT | 18 | Q_OBJECT |
19 | 19 | ||
20 | public: | 20 | public: |
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;} | |
29 | public slots: | 29 | public 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 | ||
37 | signals: | 37 | signals: |
38 | void refreshMailview(const QValueList<RecMailP>& ); | 38 | void refreshMailview(const QValueList<RecMailP>& ); |
39 | 39 | ||
40 | protected: | 40 | protected: |
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,439 +1,456 @@ | |||
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 | ||
7 | using namespace Opie::Core; | 7 | using namespace Opie::Core; |
8 | RecMail::RecMail() | 8 | RecMail::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 | ||
14 | RecMail::RecMail(const RecMail&old) | 14 | RecMail::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 | ||
22 | RecMail::~RecMail() | 22 | RecMail::~RecMail() |
23 | { | 23 | { |
24 | wrapper = 0; | 24 | wrapper = 0; |
25 | } | 25 | } |
26 | static bool stringCompareRec( const QString& s1, const QString& s2 ) | 26 | static 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 | ||
33 | const 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 | } | ||
33 | bool RecMail::isEqual( RecMail* r1 ) | 50 | bool 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 | } |
56 | void RecMail::copy_old(const RecMail&old) | 73 | void 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 | ||
75 | void RecMail::init() | 92 | void 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 | ||
85 | void RecMail::setWrapper(AbstractMail*awrapper) | 102 | void RecMail::setWrapper(AbstractMail*awrapper) |
86 | { | 103 | { |
87 | wrapper = awrapper; | 104 | wrapper = awrapper; |
88 | } | 105 | } |
89 | 106 | ||
90 | AbstractMail* RecMail::Wrapper() | 107 | AbstractMail* RecMail::Wrapper() |
91 | { | 108 | { |
92 | return wrapper; | 109 | return wrapper; |
93 | } | 110 | } |
94 | 111 | ||
95 | void RecMail::setTo(const QStringList&list) | 112 | void RecMail::setTo(const QStringList&list) |
96 | { | 113 | { |
97 | to = list; | 114 | to = list; |
98 | } | 115 | } |
99 | 116 | ||
100 | const QStringList&RecMail::To()const | 117 | const QStringList&RecMail::To()const |
101 | { | 118 | { |
102 | return to; | 119 | return to; |
103 | } | 120 | } |
104 | 121 | ||
105 | void RecMail::setCC(const QStringList&list) | 122 | void RecMail::setCC(const QStringList&list) |
106 | { | 123 | { |
107 | cc = list; | 124 | cc = list; |
108 | } | 125 | } |
109 | 126 | ||
110 | const QStringList&RecMail::CC()const | 127 | const QStringList&RecMail::CC()const |
111 | { | 128 | { |
112 | return cc; | 129 | return cc; |
113 | } | 130 | } |
114 | 131 | ||
115 | void RecMail::setBcc(const QStringList&list) | 132 | void RecMail::setBcc(const QStringList&list) |
116 | { | 133 | { |
117 | bcc = list; | 134 | bcc = list; |
118 | } | 135 | } |
119 | 136 | ||
120 | const QStringList& RecMail::Bcc()const | 137 | const QStringList& RecMail::Bcc()const |
121 | { | 138 | { |
122 | return bcc; | 139 | return bcc; |
123 | } | 140 | } |
124 | 141 | ||
125 | void RecMail::setInreply(const QStringList&list) | 142 | void RecMail::setInreply(const QStringList&list) |
126 | { | 143 | { |
127 | in_reply_to = list; | 144 | in_reply_to = list; |
128 | } | 145 | } |
129 | 146 | ||
130 | const QStringList& RecMail::Inreply()const | 147 | const QStringList& RecMail::Inreply()const |
131 | { | 148 | { |
132 | return in_reply_to; | 149 | return in_reply_to; |
133 | } | 150 | } |
134 | 151 | ||
135 | void RecMail::setReferences(const QStringList&list) | 152 | void RecMail::setReferences(const QStringList&list) |
136 | { | 153 | { |
137 | references = list; | 154 | references = list; |
138 | } | 155 | } |
139 | 156 | ||
140 | const QStringList& RecMail::References()const | 157 | const QStringList& RecMail::References()const |
141 | { | 158 | { |
142 | return references; | 159 | return references; |
143 | } | 160 | } |
144 | 161 | ||
145 | RecPart::RecPart() | 162 | RecPart::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 | ||
153 | RecPart::RecPart(const RecPart&old) | 170 | RecPart::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 | ||
169 | RecPart::~RecPart() | 186 | RecPart::~RecPart() |
170 | { | 187 | { |
171 | } | 188 | } |
172 | 189 | ||
173 | void RecPart::setSize(unsigned int size) | 190 | void RecPart::setSize(unsigned int size) |
174 | { | 191 | { |
175 | m_size = size; | 192 | m_size = size; |
176 | } | 193 | } |
177 | 194 | ||
178 | const unsigned int RecPart::Size()const | 195 | const unsigned int RecPart::Size()const |
179 | { | 196 | { |
180 | return m_size; | 197 | return m_size; |
181 | } | 198 | } |
182 | 199 | ||
183 | void RecPart::setLines(unsigned int lines) | 200 | void RecPart::setLines(unsigned int lines) |
184 | { | 201 | { |
185 | m_lines = lines; | 202 | m_lines = lines; |
186 | } | 203 | } |
187 | 204 | ||
188 | const unsigned int RecPart::Lines()const | 205 | const unsigned int RecPart::Lines()const |
189 | { | 206 | { |
190 | return m_lines; | 207 | return m_lines; |
191 | } | 208 | } |
192 | 209 | ||
193 | const QString& RecPart::Type()const | 210 | const QString& RecPart::Type()const |
194 | { | 211 | { |
195 | return m_type; | 212 | return m_type; |
196 | } | 213 | } |
197 | 214 | ||
198 | void RecPart::setType(const QString&type) | 215 | void RecPart::setType(const QString&type) |
199 | { | 216 | { |
200 | m_type = type; | 217 | m_type = type; |
201 | } | 218 | } |
202 | 219 | ||
203 | const QString& RecPart::Subtype()const | 220 | const QString& RecPart::Subtype()const |
204 | { | 221 | { |
205 | return m_subtype; | 222 | return m_subtype; |
206 | } | 223 | } |
207 | 224 | ||
208 | void RecPart::setSubtype(const QString&subtype) | 225 | void RecPart::setSubtype(const QString&subtype) |
209 | { | 226 | { |
210 | m_subtype = subtype; | 227 | m_subtype = subtype; |
211 | } | 228 | } |
212 | 229 | ||
213 | const QString& RecPart::Identifier()const | 230 | const QString& RecPart::Identifier()const |
214 | { | 231 | { |
215 | return m_identifier; | 232 | return m_identifier; |
216 | } | 233 | } |
217 | 234 | ||
218 | void RecPart::setIdentifier(const QString&identifier) | 235 | void RecPart::setIdentifier(const QString&identifier) |
219 | { | 236 | { |
220 | m_identifier = identifier; | 237 | m_identifier = identifier; |
221 | } | 238 | } |
222 | 239 | ||
223 | const QString& RecPart::Encoding()const | 240 | const QString& RecPart::Encoding()const |
224 | { | 241 | { |
225 | return m_encoding; | 242 | return m_encoding; |
226 | } | 243 | } |
227 | 244 | ||
228 | void RecPart::setEncoding(const QString&encoding) | 245 | void RecPart::setEncoding(const QString&encoding) |
229 | { | 246 | { |
230 | m_encoding = encoding; | 247 | m_encoding = encoding; |
231 | } | 248 | } |
232 | 249 | ||
233 | const QString& RecPart::Description()const | 250 | const QString& RecPart::Description()const |
234 | { | 251 | { |
235 | return m_description; | 252 | return m_description; |
236 | } | 253 | } |
237 | 254 | ||
238 | void RecPart::setDescription(const QString&desc) | 255 | void RecPart::setDescription(const QString&desc) |
239 | { | 256 | { |
240 | m_description = desc; | 257 | m_description = desc; |
241 | } | 258 | } |
242 | 259 | ||
243 | void RecPart::setParameters(const part_plist_t&list) | 260 | void RecPart::setParameters(const part_plist_t&list) |
244 | { | 261 | { |
245 | m_Parameters = list; | 262 | m_Parameters = list; |
246 | } | 263 | } |
247 | 264 | ||
248 | const part_plist_t& RecPart::Parameters()const | 265 | const part_plist_t& RecPart::Parameters()const |
249 | { | 266 | { |
250 | return m_Parameters; | 267 | return m_Parameters; |
251 | } | 268 | } |
252 | 269 | ||
253 | void RecPart::addParameter(const QString&key,const QString&value) | 270 | void RecPart::addParameter(const QString&key,const QString&value) |
254 | { | 271 | { |
255 | m_Parameters[key]=value; | 272 | m_Parameters[key]=value; |
256 | } | 273 | } |
257 | 274 | ||
258 | const QString RecPart::searchParamter(const QString&key)const | 275 | const QString RecPart::searchParamter(const QString&key)const |
259 | { | 276 | { |
260 | QString value(""); | 277 | QString value(""); |
261 | part_plist_t::ConstIterator it = m_Parameters.find(key); | 278 | part_plist_t::ConstIterator it = m_Parameters.find(key); |
262 | if (it != m_Parameters.end()) { | 279 | if (it != m_Parameters.end()) { |
263 | value = it.data(); | 280 | value = it.data(); |
264 | } | 281 | } |
265 | return value; | 282 | return value; |
266 | } | 283 | } |
267 | 284 | ||
268 | void RecPart::setPositionlist(const QValueList<int>&poslist) | 285 | void RecPart::setPositionlist(const QValueList<int>&poslist) |
269 | { | 286 | { |
270 | m_poslist = poslist; | 287 | m_poslist = poslist; |
271 | } | 288 | } |
272 | 289 | ||
273 | const QValueList<int>& RecPart::Positionlist()const | 290 | const QValueList<int>& RecPart::Positionlist()const |
274 | { | 291 | { |
275 | return m_poslist; | 292 | return m_poslist; |
276 | } | 293 | } |
277 | 294 | ||
278 | RecBody::RecBody() | 295 | RecBody::RecBody() |
279 | : Opie::Core::ORefCount(),m_BodyText(),m_description(new RecPart()) | 296 | : Opie::Core::ORefCount(),m_BodyText(),m_description(new RecPart()) |
280 | { | 297 | { |
281 | m_PartsList.clear(); | 298 | m_PartsList.clear(); |
282 | } | 299 | } |
283 | 300 | ||
284 | RecBody::RecBody(const RecBody&old) | 301 | RecBody::RecBody(const RecBody&old) |
285 | :Opie::Core::ORefCount(),m_BodyText(),m_PartsList(),m_description(new RecPart()) | 302 | :Opie::Core::ORefCount(),m_BodyText(),m_PartsList(),m_description(new RecPart()) |
286 | { | 303 | { |
287 | m_BodyText = old.m_BodyText; | 304 | m_BodyText = old.m_BodyText; |
288 | m_PartsList = old.m_PartsList; | 305 | m_PartsList = old.m_PartsList; |
289 | m_description = old.m_description; | 306 | m_description = old.m_description; |
290 | mCharset = old.mCharset; | 307 | mCharset = old.mCharset; |
291 | // odebug << "Recbody copy constructor" << oendl; | 308 | // odebug << "Recbody copy constructor" << oendl; |
292 | } | 309 | } |
293 | 310 | ||
294 | RecBody::~RecBody() | 311 | RecBody::~RecBody() |
295 | { | 312 | { |
296 | } | 313 | } |
297 | 314 | ||
298 | void RecBody::setBodytext(const QString&bodyText) | 315 | void RecBody::setBodytext(const QString&bodyText) |
299 | { | 316 | { |
300 | m_BodyText = bodyText; | 317 | m_BodyText = bodyText; |
301 | } | 318 | } |
302 | 319 | ||
303 | const QString& RecBody::Bodytext()const | 320 | const QString& RecBody::Bodytext()const |
304 | { | 321 | { |
305 | return m_BodyText; | 322 | return m_BodyText; |
306 | } | 323 | } |
307 | 324 | ||
308 | void RecBody::setParts(const QValueList<RecPartP>&parts) | 325 | void RecBody::setParts(const QValueList<RecPartP>&parts) |
309 | { | 326 | { |
310 | m_PartsList.clear(); | 327 | m_PartsList.clear(); |
311 | m_PartsList = parts; | 328 | m_PartsList = parts; |
312 | } | 329 | } |
313 | 330 | ||
314 | const QValueList<RecPartP>& RecBody::Parts()const | 331 | const QValueList<RecPartP>& RecBody::Parts()const |
315 | { | 332 | { |
316 | return m_PartsList; | 333 | return m_PartsList; |
317 | } | 334 | } |
318 | 335 | ||
319 | void RecBody::addPart(const RecPartP& part) | 336 | void RecBody::addPart(const RecPartP& part) |
320 | { | 337 | { |
321 | m_PartsList.append(part); | 338 | m_PartsList.append(part); |
322 | } | 339 | } |
323 | 340 | ||
324 | void RecBody::setDescription(const RecPartP&des) | 341 | void RecBody::setDescription(const RecPartP&des) |
325 | { | 342 | { |
326 | m_description = des; | 343 | m_description = des; |
327 | } | 344 | } |
328 | 345 | ||
329 | const RecPartP& RecBody::Description()const | 346 | const RecPartP& RecBody::Description()const |
330 | { | 347 | { |
331 | return m_description; | 348 | return m_description; |
332 | } | 349 | } |
333 | 350 | ||
334 | void RecBody::setCharset(const QString& str) | 351 | void RecBody::setCharset(const QString& str) |
335 | { | 352 | { |
336 | mCharset = str; | 353 | mCharset = str; |
337 | } | 354 | } |
338 | 355 | ||
339 | QString RecBody::getCharset()const | 356 | QString RecBody::getCharset()const |
340 | { | 357 | { |
341 | return mCharset; | 358 | return mCharset; |
342 | } | 359 | } |
343 | 360 | ||
344 | /* handling encoded content */ | 361 | /* handling encoded content */ |
345 | encodedString::encodedString() | 362 | encodedString::encodedString() |
346 | { | 363 | { |
347 | init(); | 364 | init(); |
348 | } | 365 | } |
349 | 366 | ||
350 | encodedString::encodedString(const char*nContent,unsigned int nSize) | 367 | encodedString::encodedString(const char*nContent,unsigned int nSize) |
351 | { | 368 | { |
352 | init(); | 369 | init(); |
353 | setContent(nContent,nSize); | 370 | setContent(nContent,nSize); |
354 | } | 371 | } |
355 | 372 | ||
356 | encodedString::encodedString(char*nContent,unsigned int nSize) | 373 | encodedString::encodedString(char*nContent,unsigned int nSize) |
357 | { | 374 | { |
358 | init(); | 375 | init(); |
359 | setContent(nContent,nSize); | 376 | setContent(nContent,nSize); |
360 | } | 377 | } |
361 | 378 | ||
362 | encodedString::encodedString(const encodedString&old) | 379 | encodedString::encodedString(const encodedString&old) |
363 | { | 380 | { |
364 | init(); | 381 | init(); |
365 | copy_old(old); | 382 | copy_old(old); |
366 | // odebug << "encodedeString: copy constructor!" << oendl; | 383 | // odebug << "encodedeString: copy constructor!" << oendl; |
367 | } | 384 | } |
368 | 385 | ||
369 | encodedString& encodedString::operator=(const encodedString&old) | 386 | encodedString& encodedString::operator=(const encodedString&old) |
370 | { | 387 | { |
371 | init(); | 388 | init(); |
372 | copy_old(old); | 389 | copy_old(old); |
373 | // odebug << "encodedString: assign operator!" << oendl; | 390 | // odebug << "encodedString: assign operator!" << oendl; |
374 | return *this; | 391 | return *this; |
375 | } | 392 | } |
376 | 393 | ||
377 | encodedString::~encodedString() | 394 | encodedString::~encodedString() |
378 | { | 395 | { |
379 | clean(); | 396 | clean(); |
380 | } | 397 | } |
381 | 398 | ||
382 | void encodedString::init() | 399 | void encodedString::init() |
383 | { | 400 | { |
384 | content = 0; | 401 | content = 0; |
385 | size = 0; | 402 | size = 0; |
386 | } | 403 | } |
387 | 404 | ||
388 | void encodedString::clean() | 405 | void encodedString::clean() |
389 | { | 406 | { |
390 | if (content) { | 407 | if (content) { |
391 | free(content); | 408 | free(content); |
392 | } | 409 | } |
393 | content = 0; | 410 | content = 0; |
394 | size = 0; | 411 | size = 0; |
395 | } | 412 | } |
396 | 413 | ||
397 | void encodedString::copy_old(const encodedString&old) | 414 | void encodedString::copy_old(const encodedString&old) |
398 | { | 415 | { |
399 | clean(); | 416 | clean(); |
400 | if (old.size>0 && old.content) { | 417 | if (old.size>0 && old.content) { |
401 | content = (char*)malloc(old.size*sizeof(char)); | 418 | content = (char*)malloc(old.size*sizeof(char)); |
402 | memcpy(content,old.content,size); | 419 | memcpy(content,old.content,size); |
403 | size = old.size; | 420 | size = old.size; |
404 | } | 421 | } |
405 | } | 422 | } |
406 | 423 | ||
407 | const char*encodedString::Content()const | 424 | const char*encodedString::Content()const |
408 | { | 425 | { |
409 | return content; | 426 | return content; |
410 | } | 427 | } |
411 | 428 | ||
412 | const int encodedString::Length()const | 429 | const int encodedString::Length()const |
413 | { | 430 | { |
414 | return size; | 431 | return size; |
415 | } | 432 | } |
416 | 433 | ||
417 | void encodedString::setContent(const char*nContent,int nSize) | 434 | void encodedString::setContent(const char*nContent,int nSize) |
418 | { | 435 | { |
419 | if (nSize>0 && nContent) { | 436 | if (nSize>0 && nContent) { |
420 | content = (char*)malloc(nSize*sizeof(char)); | 437 | content = (char*)malloc(nSize*sizeof(char)); |
421 | memcpy(content,nContent,nSize); | 438 | memcpy(content,nContent,nSize); |
422 | size = nSize; | 439 | size = nSize; |
423 | } | 440 | } |
424 | } | 441 | } |
425 | 442 | ||
426 | void encodedString::setContent(char*nContent,int nSize) | 443 | void encodedString::setContent(char*nContent,int nSize) |
427 | { | 444 | { |
428 | content = nContent; | 445 | content = nContent; |
429 | size = nSize; | 446 | size = nSize; |
430 | } | 447 | } |
431 | 448 | ||
432 | folderStat&folderStat::operator=(const folderStat&old) | 449 | folderStat&folderStat::operator=(const folderStat&old) |
433 | { | 450 | { |
434 | message_count = old.message_count; | 451 | message_count = old.message_count; |
435 | message_unseen = old.message_unseen; | 452 | message_unseen = old.message_unseen; |
436 | message_recent = old.message_recent; | 453 | message_recent = old.message_recent; |
437 | return *this; | 454 | return *this; |
438 | } | 455 | } |
439 | 456 | ||
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 | ||
19 | class AbstractMail; | 19 | class 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 | */ |
32 | class RecMail:public Opie::Core::ORefCount | 32 | class RecMail:public Opie::Core::ORefCount |
33 | { | 33 | { |
34 | public: | 34 | public: |
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 | ||
79 | protected: | 80 | protected: |
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 | ||
89 | typedef Opie::Core::OSmartPointer<RecMail> RecMailP; | 90 | typedef Opie::Core::OSmartPointer<RecMail> RecMailP; |
90 | typedef QMap<QString,QString> part_plist_t; | 91 | typedef QMap<QString,QString> part_plist_t; |
91 | 92 | ||
92 | class RecPart:public Opie::Core::ORefCount | 93 | class RecPart:public Opie::Core::ORefCount |
93 | { | 94 | { |
94 | protected: | 95 | protected: |
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 | ||
101 | public: | 102 | public: |
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 | ||
130 | typedef Opie::Core::OSmartPointer<RecPart> RecPartP; | 131 | typedef Opie::Core::OSmartPointer<RecPart> RecPartP; |
131 | 132 | ||
132 | class RecBody:public Opie::Core::ORefCount | 133 | class RecBody:public Opie::Core::ORefCount |
133 | { | 134 | { |
134 | protected: | 135 | protected: |
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 | ||
140 | public: | 141 | public: |
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 | ||
157 | typedef Opie::Core::OSmartPointer<RecBody> RecBodyP; | 158 | typedef Opie::Core::OSmartPointer<RecBody> RecBodyP; |
158 | 159 | ||
159 | class encodedString | 160 | class encodedString |
160 | { | 161 | { |
161 | public: | 162 | public: |
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 | ||
197 | protected: | 198 | protected: |
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 | ||
206 | struct folderStat | 207 | struct 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 | ||
9 | MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) | 9 | MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) |
10 | :QListViewItem(parent,item),mail_data() | 10 | :QListViewItem(parent,item),mail_data() |
11 | { | 11 | { |
12 | } | 12 | } |
13 | 13 | ||
14 | void MailListViewItem::showEntry() | 14 | void 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 | ||
67 | void MailListViewItem::storeData(const RecMailP&data) | 59 | void MailListViewItem::storeData(const RecMailP&data) |
68 | { | 60 | { |
69 | mail_data = data; | 61 | mail_data = data; |
70 | } | 62 | } |
71 | void MailListViewItem::setSortKey(int column,const QString &key) | 63 | void MailListViewItem::setSortKey(int column,const QString &key) |
72 | { | 64 | { |
73 | mKeyMap.insert(column,key); | 65 | mKeyMap.insert(column,key); |
74 | } | 66 | } |
75 | QString MailListViewItem::key(int column, bool) const | 67 | QString 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 | ||
94 | const RecMailP& MailListViewItem::data()const | 86 | const RecMailP& MailListViewItem::data()const |
95 | { | 87 | { |
96 | return mail_data; | 88 | return mail_data; |
97 | } | 89 | } |
98 | 90 | ||
99 | MAILLIB::ATYPE MailListViewItem::wrapperType() | 91 | MAILLIB::ATYPE MailListViewItem::wrapperType() |
100 | { | 92 | { |
101 | if (!mail_data->Wrapper()) return MAILLIB::A_UNDEFINED; | 93 | if (!mail_data->Wrapper()) return MAILLIB::A_UNDEFINED; |
102 | return mail_data->Wrapper()->getType(); | 94 | return mail_data->Wrapper()->getType(); |
103 | } | 95 | } |
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index 6e54bf4..760e3b0 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp | |||
@@ -1,602 +1,638 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | // CHANGED 2004-08-06 Lutz Rogowski | 2 | // CHANGED 2004-08-06 Lutz Rogowski |
3 | 3 | ||
4 | 4 | ||
5 | #define protected public | 5 | #define protected public |
6 | #include <qwidget.h> | 6 | #include <qwidget.h> |
7 | #undef protected | 7 | #undef protected |
8 | #include "koprefsdialog.h" | 8 | #include "koprefsdialog.h" |
9 | #include <kapplication.h> | 9 | #include <kapplication.h> |
10 | #include <libkdepim/externalapphandler.h> | 10 | #include <libkdepim/externalapphandler.h> |
11 | #include <libkdepim/kpimglobalprefs.h> | 11 | #include <libkdepim/kpimglobalprefs.h> |
12 | #ifdef MINIKDE_KDIALOG_H | 12 | #ifdef MINIKDE_KDIALOG_H |
13 | #undef MINIKDE_KDIALOG_H | 13 | #undef MINIKDE_KDIALOG_H |
14 | #endif | 14 | #endif |
15 | #include "settingsdialog.h" | 15 | #include "settingsdialog.h" |
16 | #include "opiemail.h" | 16 | #include "opiemail.h" |
17 | #include "editaccounts.h" | 17 | #include "editaccounts.h" |
18 | #include "composemail.h" | 18 | #include "composemail.h" |
19 | #include "mailistviewitem.h" | 19 | #include "mailistviewitem.h" |
20 | #include "viewmail.h" | 20 | #include "viewmail.h" |
21 | #include "selectstore.h" | 21 | #include "selectstore.h" |
22 | #include "selectsmtp.h" | 22 | #include "selectsmtp.h" |
23 | #include "accountitem.h" | 23 | #include "accountitem.h" |
24 | #include "accountview.h" | ||
24 | #include "klocale.h" | 25 | #include "klocale.h" |
25 | 26 | ||
26 | #include <qmessagebox.h> | 27 | #include <qmessagebox.h> |
27 | #include <qtimer.h> | 28 | #include <qtimer.h> |
28 | #include <qcursor.h> | 29 | #include <qcursor.h> |
29 | #include <qtextbrowser.h> | 30 | #include <qtextbrowser.h> |
30 | #include <qregexp.h> | 31 | #include <qregexp.h> |
31 | #include <qpe/global.h> | 32 | #include <qpe/global.h> |
32 | 33 | ||
33 | #ifdef DESKTOP_VERSION | 34 | #ifdef DESKTOP_VERSION |
34 | #include <qapplication.h> | 35 | #include <qapplication.h> |
35 | #else | 36 | #else |
36 | #include <qpe/qpeapplication.h> | 37 | #include <qpe/qpeapplication.h> |
37 | #endif | 38 | #endif |
38 | #include <libmailwrapper/smtpwrapper.h> | 39 | #include <libmailwrapper/smtpwrapper.h> |
39 | #include <libmailwrapper/mailtypes.h> | 40 | #include <libmailwrapper/mailtypes.h> |
40 | #include <libmailwrapper/abstractmail.h> | 41 | #include <libmailwrapper/abstractmail.h> |
41 | #include "koprefs.h" | 42 | #include "koprefs.h" |
42 | 43 | ||
43 | //using namespace Opie::Core; | 44 | //using namespace Opie::Core; |
44 | 45 | ||
45 | OpieMail::OpieMail( QWidget *parent, const char *name ) | 46 | OpieMail::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 | ||
55 | OpieMail::~OpieMail() | 56 | OpieMail::~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 | ||
62 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) | 63 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) |
63 | { | 64 | { |
64 | 65 | ||
65 | } | 66 | } |
66 | #include <stdlib.h> | 67 | #include <stdlib.h> |
67 | void OpieMail::message(const QCString &msg, const QByteArray &data) | 68 | void 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 | } |
112 | void OpieMail::slotExtAppHandler() | 113 | void OpieMail::slotExtAppHandler() |
113 | { | 114 | { |
114 | ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData ); | 115 | ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData ); |
115 | } | 116 | } |
116 | void OpieMail::slotwriteMail2(const QString& namemail ) | 117 | void 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 | } |
144 | void OpieMail::slotwriteMail(const QString&name,const QString&email) | 145 | void 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 | ||
167 | void OpieMail::slotComposeMail() | 168 | void 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 | ||
180 | void OpieMail::slotSendQueued() | 181 | void 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 | ||
234 | void OpieMail::slotSearchMails() | 235 | void OpieMail::slotSearchMails() |
235 | { | 236 | { |
236 | qDebug("OpieMail::slotSearchMails():not implemented "); | 237 | qDebug("OpieMail::slotSearchMails():not implemented "); |
237 | } | 238 | } |
238 | 239 | ||
239 | void OpieMail::slotEditSettings() | 240 | void 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 | ||
252 | void OpieMail::slotEditAccounts() | 253 | void 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 | } |
265 | void OpieMail::replyMail() | 266 | void 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 | } |
309 | void OpieMail::closeViewMail(ViewMail * vm) | 310 | void OpieMail::closeViewMail(ViewMail * vm) |
310 | { | 311 | { |
311 | vm->hide(); | 312 | vm->hide(); |
312 | } | 313 | } |
313 | 314 | ||
314 | void OpieMail::slotDownloadMail( ) | 315 | void 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 | ||
320 | void OpieMail::deleteAndDisplayNextMail(ViewMail * vm) | 356 | void 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 | } |
340 | void OpieMail::displayNextMail(ViewMail * vm) | 376 | void 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 | } |
356 | void OpieMail::displayMail() | 392 | void 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 | } |
385 | void OpieMail::slotGetAllMail() | 421 | void 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 | } |
393 | void OpieMail::slotGetMail() | 429 | void 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 | } |
399 | void OpieMail::slotDeleteMail() | 435 | void 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 | } |
409 | void OpieMail::slotDeleteAllMail() | 445 | void 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 | } |
433 | void OpieMail::clearSelection() | 469 | void OpieMail::clearSelection() |
434 | { | 470 | { |
435 | mailView->clearSelection(); | 471 | mailView->clearSelection(); |
436 | 472 | ||
437 | } | 473 | } |
438 | 474 | ||
439 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) | 475 | void 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 | ||
475 | void OpieMail::slotShowFolders( bool show ) | 511 | void 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 | ||
487 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) | 523 | void 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 | ||
502 | void OpieMail::mailLeftClicked( QListViewItem *item ) | 538 | void OpieMail::mailLeftClicked( QListViewItem *item ) |
503 | { | 539 | { |
504 | mailView->clearSelection(); | 540 | mailView->clearSelection(); |
505 | /* just LEFT button - or tap with stylus on pda */ | 541 | /* just LEFT button - or tap with stylus on pda */ |
506 | //if (button!=1) return; | 542 | //if (button!=1) return; |
507 | if (!item) return; | 543 | if (!item) return; |
508 | if (folderView->currentisDraft()) { | 544 | if (folderView->currentisDraft()) { |
509 | reEditMail(); | 545 | reEditMail(); |
510 | } else { | 546 | } else { |
511 | displayMail(); | 547 | displayMail(); |
512 | } | 548 | } |
513 | } | 549 | } |
514 | 550 | ||
515 | void OpieMail::slotMoveCopyMail() | 551 | void OpieMail::slotMoveCopyMail() |
516 | { | 552 | { |
517 | if (!mailView->currentItem()) return; | 553 | if (!mailView->currentItem()) return; |
518 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 554 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
519 | AbstractMail*targetMail = 0; | 555 | AbstractMail*targetMail = 0; |
520 | QString targetFolder = ""; | 556 | QString targetFolder = ""; |
521 | Selectstore sels; | 557 | Selectstore sels; |
522 | folderView->setupFolderselect(&sels); | 558 | folderView->setupFolderselect(&sels); |
523 | if (!sels.exec()) return; | 559 | if (!sels.exec()) return; |
524 | targetMail = sels.currentMail(); | 560 | targetMail = sels.currentMail(); |
525 | targetFolder = sels.currentFolder(); | 561 | targetFolder = sels.currentFolder(); |
526 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || | 562 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || |
527 | targetFolder.isEmpty()) | 563 | targetFolder.isEmpty()) |
528 | { | 564 | { |
529 | return; | 565 | return; |
530 | } | 566 | } |
531 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | 567 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
532 | { | 568 | { |
533 | QMessageBox::critical(0,i18n("Error creating new Folder"), | 569 | QMessageBox::critical(0,i18n("Error creating new Folder"), |
534 | i18n("<center>Error while creating<br>new folder - breaking.</center>")); | 570 | i18n("<center>Error while creating<br>new folder - breaking.</center>")); |
535 | return; | 571 | return; |
536 | } | 572 | } |
537 | sels.hide(); | 573 | sels.hide(); |
538 | qApp->processEvents(); | 574 | qApp->processEvents(); |
539 | // qDebug("hiding sels "); | 575 | // qDebug("hiding sels "); |
540 | mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); | 576 | mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); |
541 | folderView->refreshCurrent(); | 577 | folderView->refreshCurrent(); |
542 | } | 578 | } |
543 | 579 | ||
544 | void OpieMail::slotMoveCopyAllMail() | 580 | void OpieMail::slotMoveCopyAllMail() |
545 | { | 581 | { |
546 | 582 | ||
547 | if (!mailView->currentItem()) return; | 583 | if (!mailView->currentItem()) return; |
548 | QValueList<RecMailP> t; | 584 | QValueList<RecMailP> t; |
549 | // if ( QMessageBox::warning(this, i18n("Move/Copy all selected mails"), i18n("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 585 | // if ( QMessageBox::warning(this, i18n("Move/Copy all selected mails"), i18n("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
550 | { | 586 | { |
551 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); | 587 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); |
552 | while ( item ) { | 588 | while ( item ) { |
553 | if ( item->isSelected() ) { | 589 | if ( item->isSelected() ) { |
554 | t.append( item->data() ); | 590 | t.append( item->data() ); |
555 | } | 591 | } |
556 | item = (MailListViewItem*)item->nextSibling(); | 592 | item = (MailListViewItem*)item->nextSibling(); |
557 | } | 593 | } |
558 | } | 594 | } |
559 | // else | 595 | // else |
560 | // return; | 596 | // return; |
561 | if ( t.count() == 0 ) | 597 | if ( t.count() == 0 ) |
562 | return; | 598 | return; |
563 | RecMailP mail = t.first(); | 599 | RecMailP mail = t.first(); |
564 | AbstractMail*targetMail = 0; | 600 | AbstractMail*targetMail = 0; |
565 | QString targetFolder = ""; | 601 | QString targetFolder = ""; |
566 | Selectstore sels; | 602 | Selectstore sels; |
567 | folderView->setupFolderselect(&sels); | 603 | folderView->setupFolderselect(&sels); |
568 | if (!sels.exec()) return; | 604 | if (!sels.exec()) return; |
569 | targetMail = sels.currentMail(); | 605 | targetMail = sels.currentMail(); |
570 | targetFolder = sels.currentFolder(); | 606 | targetFolder = sels.currentFolder(); |
571 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || | 607 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || |
572 | targetFolder.isEmpty()) | 608 | targetFolder.isEmpty()) |
573 | { | 609 | { |
574 | return; | 610 | return; |
575 | } | 611 | } |
576 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | 612 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
577 | { | 613 | { |
578 | QMessageBox::critical(0,i18n("Error creating new Folder"), | 614 | QMessageBox::critical(0,i18n("Error creating new Folder"), |
579 | i18n("<center>Error while creating<br>new folder - breaking.</center>")); | 615 | i18n("<center>Error while creating<br>new folder - breaking.</center>")); |
580 | return; | 616 | return; |
581 | } | 617 | } |
582 | sels.hide(); | 618 | sels.hide(); |
583 | qApp->processEvents(); | 619 | qApp->processEvents(); |
584 | //qDebug("hiding sels "); | 620 | //qDebug("hiding sels "); |
585 | mail->Wrapper()->mvcpMailList(t,targetFolder,targetMail,sels.moveMails()); | 621 | mail->Wrapper()->mvcpMailList(t,targetFolder,targetMail,sels.moveMails()); |
586 | folderView->refreshCurrent(); | 622 | folderView->refreshCurrent(); |
587 | } | 623 | } |
588 | 624 | ||
589 | void OpieMail::reEditMail() | 625 | void OpieMail::reEditMail() |
590 | { | 626 | { |
591 | if (!mailView->currentItem()) return; | 627 | if (!mailView->currentItem()) return; |
592 | 628 | ||
593 | ComposeMail compose( settings, this, 0, true ); | 629 | ComposeMail compose( settings, this, 0, true ); |
594 | compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); | 630 | compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); |
595 | compose.slotAdjustColumns(); | 631 | compose.slotAdjustColumns(); |
596 | #ifndef DESKTOP_VERSION | 632 | #ifndef DESKTOP_VERSION |
597 | compose.showMaximized(); | 633 | compose.showMaximized(); |
598 | #else | 634 | #else |
599 | compose.resize(640,480); | 635 | compose.resize(640,480); |
600 | #endif | 636 | #endif |
601 | compose.exec(); | 637 | compose.exec(); |
602 | } | 638 | } |
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp index 767a369..726f540 100644 --- a/kmicromail/viewmail.cpp +++ b/kmicromail/viewmail.cpp | |||
@@ -1,557 +1,560 @@ | |||
1 | // CHANGED 2004-08-06 Lutz Rogowski | 1 | // CHANGED 2004-08-06 Lutz Rogowski |
2 | 2 | ||
3 | 3 | ||
4 | 4 | ||
5 | #include <kfiledialog.h> | 5 | #include <kfiledialog.h> |
6 | #include "koprefs.h" | 6 | #include "koprefs.h" |
7 | #include <klocale.h> | 7 | #include <klocale.h> |
8 | #include <kglobal.h> | 8 | #include <kglobal.h> |
9 | #include <kapplication.h> | 9 | #include <kapplication.h> |
10 | 10 | ||
11 | #ifdef MINIKDE_KDIALOG_H | 11 | #ifdef MINIKDE_KDIALOG_H |
12 | #undef MINIKDE_KDIALOG_H | 12 | #undef MINIKDE_KDIALOG_H |
13 | #endif | 13 | #endif |
14 | 14 | ||
15 | #include "composemail.h" | 15 | #include "composemail.h" |
16 | #include "viewmail.h" | 16 | #include "viewmail.h" |
17 | 17 | ||
18 | #include <libmailwrapper/settings.h> | 18 | #include <libmailwrapper/settings.h> |
19 | #include <libmailwrapper/abstractmail.h> | 19 | #include <libmailwrapper/abstractmail.h> |
20 | #include <libmailwrapper/mailtypes.h> | 20 | #include <libmailwrapper/mailtypes.h> |
21 | 21 | ||
22 | #include <qdialog.h> | 22 | #include <qdialog.h> |
23 | 23 | ||
24 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
25 | 25 | ||
26 | /* QT */ | 26 | /* QT */ |
27 | #include <qtextbrowser.h> | 27 | #include <qtextbrowser.h> |
28 | #include <qmessagebox.h> | 28 | #include <qmessagebox.h> |
29 | #include <qtextstream.h> | 29 | #include <qtextstream.h> |
30 | #include <qaction.h> | 30 | #include <qaction.h> |
31 | #include <qpopupmenu.h> | 31 | #include <qpopupmenu.h> |
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | #include <qlayout.h> | 33 | #include <qlayout.h> |
34 | 34 | ||
35 | //using namespace Opie::Ui; | 35 | //using namespace Opie::Ui; |
36 | //using namespace Opie::Core; | 36 | //using namespace Opie::Core; |
37 | 37 | ||
38 | AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, | 38 | AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, |
39 | const QString&fsize,int num,const QValueList<int>&path) | 39 | const QString&fsize,int num,const QValueList<int>&path) |
40 | : QListViewItem(parent,after),_partNum(num) | 40 | : QListViewItem(parent,after),_partNum(num) |
41 | { | 41 | { |
42 | _path=path; | 42 | _path=path; |
43 | setText(0, mime); | 43 | setText(0, mime); |
44 | setText(1, desc); | 44 | setText(1, desc); |
45 | setText(2, file); | 45 | setText(2, file); |
46 | setText(3, fsize); | 46 | setText(3, fsize); |
47 | } | 47 | } |
48 | 48 | ||
49 | AttachItem::AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, | 49 | AttachItem::AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, |
50 | const QString&fsize,int num,const QValueList<int>&path) | 50 | const QString&fsize,int num,const QValueList<int>&path) |
51 | : QListViewItem(parent,after),_partNum(num) | 51 | : QListViewItem(parent,after),_partNum(num) |
52 | { | 52 | { |
53 | _path=path; | 53 | _path=path; |
54 | setText(0, mime); | 54 | setText(0, mime); |
55 | setText(1, desc); | 55 | setText(1, desc); |
56 | setText(2, file); | 56 | setText(2, file); |
57 | setText(3, fsize); | 57 | setText(3, fsize); |
58 | } | 58 | } |
59 | 59 | ||
60 | bool AttachItem::isParentof(const QValueList<int>&path) | 60 | bool AttachItem::isParentof(const QValueList<int>&path) |
61 | { | 61 | { |
62 | /* if not set, then no parent */ | 62 | /* if not set, then no parent */ |
63 | if (path.count()==0||_path.count()==0) return false; | 63 | if (path.count()==0||_path.count()==0) return false; |
64 | /* the parent must have one digit less then a child */ | 64 | /* the parent must have one digit less then a child */ |
65 | if (path.count()!=_path.count()+1) return false; | 65 | if (path.count()!=_path.count()+1) return false; |
66 | for (unsigned int i=0; i < _path.count();++i) | 66 | for (unsigned int i=0; i < _path.count();++i) |
67 | { | 67 | { |
68 | if (_path[i]!=path[i]) return false; | 68 | if (_path[i]!=path[i]) return false; |
69 | } | 69 | } |
70 | return true; | 70 | return true; |
71 | } | 71 | } |
72 | 72 | ||
73 | AttachItem* ViewMail::searchParent(const QValueList<int>&path) | 73 | AttachItem* ViewMail::searchParent(const QValueList<int>&path) |
74 | { | 74 | { |
75 | QListViewItemIterator it( attachments ); | 75 | QListViewItemIterator it( attachments ); |
76 | for ( ; it.current(); ++it ) | 76 | for ( ; it.current(); ++it ) |
77 | { | 77 | { |
78 | AttachItem*ati = (AttachItem*)it.current(); | 78 | AttachItem*ati = (AttachItem*)it.current(); |
79 | if (ati->isParentof(path)) return ati; | 79 | if (ati->isParentof(path)) return ati; |
80 | } | 80 | } |
81 | return 0; | 81 | return 0; |
82 | } | 82 | } |
83 | 83 | ||
84 | AttachItem* ViewMail::lastChild(AttachItem*parent) | 84 | AttachItem* ViewMail::lastChild(AttachItem*parent) |
85 | { | 85 | { |
86 | if (!parent) return 0; | 86 | if (!parent) return 0; |
87 | AttachItem* item = (AttachItem*)parent->firstChild(); | 87 | AttachItem* item = (AttachItem*)parent->firstChild(); |
88 | if (!item) return item; | 88 | if (!item) return item; |
89 | AttachItem*temp=0; | 89 | AttachItem*temp=0; |
90 | while( (temp=(AttachItem*)item->nextSibling())) | 90 | while( (temp=(AttachItem*)item->nextSibling())) |
91 | { | 91 | { |
92 | item = temp; | 92 | item = temp; |
93 | } | 93 | } |
94 | return item; | 94 | return item; |
95 | } | 95 | } |
96 | 96 | ||
97 | void ViewMail::setBody(const RecBodyP&body ) | 97 | void ViewMail::setBody(const RecBodyP&body ) |
98 | { | 98 | { |
99 | 99 | ||
100 | m_body = body; | 100 | m_body = body; |
101 | m_mail[2] = body->Bodytext(); | 101 | m_mail[2] = body->Bodytext(); |
102 | // qDebug("********text %s ",m_mail[2].latin1() ); | 102 | // qDebug("********text %s ",m_mail[2].latin1() ); |
103 | attachbutton->setEnabled(body->Parts().count()>0); | 103 | attachbutton->setEnabled(body->Parts().count()>0); |
104 | attachments->setEnabled(body->Parts().count()>0); | 104 | attachments->setEnabled(body->Parts().count()>0); |
105 | if (body->Parts().count()==0) | 105 | if (body->Parts().count()==0) |
106 | { | 106 | { |
107 | return; | 107 | return; |
108 | } | 108 | } |
109 | AttachItem * curItem=0; | 109 | AttachItem * curItem=0; |
110 | AttachItem * parentItem = 0; | 110 | AttachItem * parentItem = 0; |
111 | QString type=body->Description()->Type()+"/"+body->Description()->Subtype(); | 111 | QString type=body->Description()->Type()+"/"+body->Description()->Subtype(); |
112 | QString desc,fsize; | 112 | QString desc,fsize; |
113 | double s = body->Description()->Size(); | 113 | double s = body->Description()->Size(); |
114 | int w; | 114 | int w; |
115 | w=0; | 115 | w=0; |
116 | 116 | ||
117 | while (s>1024) | 117 | while (s>1024) |
118 | { | 118 | { |
119 | s/=1024; | 119 | s/=1024; |
120 | ++w; | 120 | ++w; |
121 | if (w>=2) break; | 121 | if (w>=2) break; |
122 | } | 122 | } |
123 | 123 | ||
124 | QString q=""; | 124 | QString q=""; |
125 | switch(w) | 125 | switch(w) |
126 | { | 126 | { |
127 | case 1: | 127 | case 1: |
128 | q="k"; | 128 | q="k"; |
129 | break; | 129 | break; |
130 | case 2: | 130 | case 2: |
131 | q="M"; | 131 | q="M"; |
132 | break; | 132 | break; |
133 | default: | 133 | default: |
134 | break; | 134 | break; |
135 | } | 135 | } |
136 | 136 | ||
137 | { | 137 | { |
138 | /* I did not found a method to make a CONTENT reset on a QTextStream | 138 | /* I did not found a method to make a CONTENT reset on a QTextStream |
139 | so I use this construct that the stream will re-constructed in each | 139 | so I use this construct that the stream will re-constructed in each |
140 | loop. To let it work, the textstream is packed into a own area of | 140 | loop. To let it work, the textstream is packed into a own area of |
141 | code is it will be destructed after finishing its small job. | 141 | code is it will be destructed after finishing its small job. |
142 | */ | 142 | */ |
143 | QTextOStream o(&fsize); | 143 | QTextOStream o(&fsize); |
144 | if (w>0) o.precision(2); else o.precision(0); | 144 | if (w>0) o.precision(2); else o.precision(0); |
145 | o.setf(QTextStream::fixed); | 145 | o.setf(QTextStream::fixed); |
146 | o << s << " " << q << "Byte"; | 146 | o << s << " " << q << "Byte"; |
147 | } | 147 | } |
148 | 148 | ||
149 | curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist()); | 149 | curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist()); |
150 | QString filename = ""; | 150 | QString filename = ""; |
151 | 151 | ||
152 | for (unsigned int i = 0; i < body->Parts().count();++i) | 152 | for (unsigned int i = 0; i < body->Parts().count();++i) |
153 | { | 153 | { |
154 | filename = ""; | 154 | filename = ""; |
155 | type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype(); | 155 | type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype(); |
156 | part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin(); | 156 | part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin(); |
157 | for (;it!=body->Parts()[i]->Parameters().end();++it) | 157 | for (;it!=body->Parts()[i]->Parameters().end();++it) |
158 | { | 158 | { |
159 | if (it.key().lower()=="name") | 159 | if (it.key().lower()=="name") |
160 | { | 160 | { |
161 | filename=it.data(); | 161 | filename=it.data(); |
162 | } | 162 | } |
163 | } | 163 | } |
164 | s = body->Parts()[i]->Size(); | 164 | s = body->Parts()[i]->Size(); |
165 | w = 0; | 165 | w = 0; |
166 | while (s>1024) | 166 | while (s>1024) |
167 | { | 167 | { |
168 | s/=1024; | 168 | s/=1024; |
169 | ++w; | 169 | ++w; |
170 | if (w>=2) break; | 170 | if (w>=2) break; |
171 | } | 171 | } |
172 | switch(w) | 172 | switch(w) |
173 | { | 173 | { |
174 | case 1: | 174 | case 1: |
175 | q="k"; | 175 | q="k"; |
176 | break; | 176 | break; |
177 | case 2: | 177 | case 2: |
178 | q="M"; | 178 | q="M"; |
179 | break; | 179 | break; |
180 | default: | 180 | default: |
181 | q=""; | 181 | q=""; |
182 | break; | 182 | break; |
183 | } | 183 | } |
184 | QTextOStream o(&fsize); | 184 | QTextOStream o(&fsize); |
185 | if (w>0) o.precision(2); else o.precision(0); | 185 | if (w>0) o.precision(2); else o.precision(0); |
186 | o.setf(QTextStream::fixed); | 186 | o.setf(QTextStream::fixed); |
187 | o << s << " " << q << "Byte"; | 187 | o << s << " " << q << "Byte"; |
188 | desc = body->Parts()[i]->Description(); | 188 | desc = body->Parts()[i]->Description(); |
189 | parentItem = searchParent(body->Parts()[i]->Positionlist()); | 189 | parentItem = searchParent(body->Parts()[i]->Positionlist()); |
190 | if (parentItem) | 190 | if (parentItem) |
191 | { | 191 | { |
192 | AttachItem*temp = lastChild(parentItem); | 192 | AttachItem*temp = lastChild(parentItem); |
193 | if (temp) curItem = temp; | 193 | if (temp) curItem = temp; |
194 | curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); | 194 | curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); |
195 | attachments->setRootIsDecorated(true); | 195 | attachments->setRootIsDecorated(true); |
196 | curItem = parentItem; | 196 | curItem = parentItem; |
197 | } | 197 | } |
198 | else | 198 | else |
199 | { | 199 | { |
200 | curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); | 200 | curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); |
201 | } | 201 | } |
202 | } | 202 | } |
203 | } | 203 | } |
204 | 204 | ||
205 | 205 | ||
206 | void ViewMail::slotViewSource() | 206 | void 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 | } |
224 | void ViewMail::slotShowHtml( bool state ) | 224 | void ViewMail::slotShowHtml( bool state ) |
225 | { | 225 | { |
226 | m_showHtml = state; | 226 | m_showHtml = state; |
227 | setText(); | 227 | setText(); |
228 | } | 228 | } |
229 | 229 | ||
230 | void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) | 230 | void 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 | ||
317 | void ViewMail::setMail(const RecMailP&mail ) | 317 | void 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 | ||
336 | ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) | 336 | ViewMail::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 | ||
358 | void ViewMail::readConfig() | 358 | void 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 | ||
366 | void ViewMail::setText() | 366 | void 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 | ||
406 | ViewMail::~ViewMail() | 409 | ViewMail::~ViewMail() |
407 | { | 410 | { |
408 | m_recMail->Wrapper()->cleanMimeCache(); | 411 | m_recMail->Wrapper()->cleanMimeCache(); |
409 | hide(); | 412 | hide(); |
410 | } | 413 | } |
411 | 414 | ||
412 | void ViewMail::hide() | 415 | void 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 | ||
425 | void ViewMail::exec() | 428 | void 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 | ||
437 | QString ViewMail::deHtml(const QString &string) | 440 | QString ViewMail::deHtml(const QString &string) |
438 | { | 441 | { |
439 | QString string_ = string; | 442 | QString string_ = string; |
440 | string_.replace(QRegExp("&"), "&"); | 443 | string_.replace(QRegExp("&"), "&"); |
441 | string_.replace(QRegExp("<"), "<"); | 444 | string_.replace(QRegExp("<"), "<"); |
442 | string_.replace(QRegExp(">"), ">"); | 445 | string_.replace(QRegExp(">"), ">"); |
443 | string_.replace(QRegExp("\\n"), "<br>"); | 446 | string_.replace(QRegExp("\\n"), "<br>"); |
444 | return string_; | 447 | return string_; |
445 | } | 448 | } |
446 | 449 | ||
447 | void ViewMail::slotReply() | 450 | void 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 | ||
492 | void ViewMail::slotForward() | 495 | void 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 | ||
527 | void ViewMail::slotDeleteMail( ) | 530 | void 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 | ||
538 | MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, WFlags f) | 541 | MailImageDlg::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 | ||
548 | MailImageDlg::~MailImageDlg() | 551 | MailImageDlg::~MailImageDlg() |
549 | { | 552 | { |
550 | } | 553 | } |
551 | 554 | ||
552 | void MailImageDlg::setName(const QString&fname) | 555 | void 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 | ||