-rw-r--r-- | kmicromail/viewmail.cpp | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp index 685b4e4..c9dedb0 100644 --- a/kmicromail/viewmail.cpp +++ b/kmicromail/viewmail.cpp | |||
@@ -1,107 +1,110 @@ | |||
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 <q3textbrowser.h> |
28 | #include <qmessagebox.h> | 28 | #include <qmessagebox.h> |
29 | #include <qtextstream.h> | 29 | #include <q3textstream.h> |
30 | #include <qaction.h> | 30 | #include <qaction.h> |
31 | #include <qpopupmenu.h> | 31 | #include <q3popupmenu.h> |
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | #include <qlayout.h> | 33 | #include <qlayout.h> |
34 | //Added by qt3to4: | ||
35 | #include <Q3ValueList> | ||
36 | #include <Q3VBoxLayout> | ||
34 | 37 | ||
35 | //using namespace Opie::Ui; | 38 | //using namespace Opie::Ui; |
36 | //using namespace Opie::Core; | 39 | //using namespace Opie::Core; |
37 | 40 | ||
38 | AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, | 41 | AttachItem::AttachItem(Q3ListView * parent,Q3ListViewItem *after, const QString&mime,const QString&desc,const QString&file, |
39 | const QString&fsize,int num,const QValueList<int>&path) | 42 | const QString&fsize,int num,const Q3ValueList<int>&path) |
40 | : QListViewItem(parent,after),_partNum(num) | 43 | : Q3ListViewItem(parent,after),_partNum(num) |
41 | { | 44 | { |
42 | _path=path; | 45 | _path=path; |
43 | setText(0, mime); | 46 | setText(0, mime); |
44 | setText(1, desc); | 47 | setText(1, desc); |
45 | setText(2, file); | 48 | setText(2, file); |
46 | setText(3, fsize); | 49 | setText(3, fsize); |
47 | } | 50 | } |
48 | 51 | ||
49 | AttachItem::AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, | 52 | AttachItem::AttachItem(Q3ListViewItem * parent,Q3ListViewItem *after, const QString&mime,const QString&desc,const QString&file, |
50 | const QString&fsize,int num,const QValueList<int>&path) | 53 | const QString&fsize,int num,const Q3ValueList<int>&path) |
51 | : QListViewItem(parent,after),_partNum(num) | 54 | : Q3ListViewItem(parent,after),_partNum(num) |
52 | { | 55 | { |
53 | _path=path; | 56 | _path=path; |
54 | setText(0, mime); | 57 | setText(0, mime); |
55 | setText(1, desc); | 58 | setText(1, desc); |
56 | setText(2, file); | 59 | setText(2, file); |
57 | setText(3, fsize); | 60 | setText(3, fsize); |
58 | } | 61 | } |
59 | 62 | ||
60 | bool AttachItem::isParentof(const QValueList<int>&path) | 63 | bool AttachItem::isParentof(const Q3ValueList<int>&path) |
61 | { | 64 | { |
62 | /* if not set, then no parent */ | 65 | /* if not set, then no parent */ |
63 | if (path.count()==0||_path.count()==0) return false; | 66 | if (path.count()==0||_path.count()==0) return false; |
64 | /* the parent must have one digit less then a child */ | 67 | /* the parent must have one digit less then a child */ |
65 | if (path.count()!=_path.count()+1) return false; | 68 | if (path.count()!=_path.count()+1) return false; |
66 | for (unsigned int i=0; i < _path.count();++i) | 69 | for (unsigned int i=0; i < _path.count();++i) |
67 | { | 70 | { |
68 | if (_path[i]!=path[i]) return false; | 71 | if (_path[i]!=path[i]) return false; |
69 | } | 72 | } |
70 | return true; | 73 | return true; |
71 | } | 74 | } |
72 | 75 | ||
73 | AttachItem* ViewMail::searchParent(const QValueList<int>&path) | 76 | AttachItem* ViewMail::searchParent(const Q3ValueList<int>&path) |
74 | { | 77 | { |
75 | QListViewItemIterator it( attachments ); | 78 | Q3ListViewItemIterator it( attachments ); |
76 | for ( ; it.current(); ++it ) | 79 | for ( ; it.current(); ++it ) |
77 | { | 80 | { |
78 | AttachItem*ati = (AttachItem*)it.current(); | 81 | AttachItem*ati = (AttachItem*)it.current(); |
79 | if (ati->isParentof(path)) return ati; | 82 | if (ati->isParentof(path)) return ati; |
80 | } | 83 | } |
81 | return 0; | 84 | return 0; |
82 | } | 85 | } |
83 | 86 | ||
84 | AttachItem* ViewMail::lastChild(AttachItem*parent) | 87 | AttachItem* ViewMail::lastChild(AttachItem*parent) |
85 | { | 88 | { |
86 | if (!parent) return 0; | 89 | if (!parent) return 0; |
87 | AttachItem* item = (AttachItem*)parent->firstChild(); | 90 | AttachItem* item = (AttachItem*)parent->firstChild(); |
88 | if (!item) return item; | 91 | if (!item) return item; |
89 | AttachItem*temp=0; | 92 | AttachItem*temp=0; |
90 | while( (temp=(AttachItem*)item->nextSibling())) | 93 | while( (temp=(AttachItem*)item->nextSibling())) |
91 | { | 94 | { |
92 | item = temp; | 95 | item = temp; |
93 | } | 96 | } |
94 | return item; | 97 | return item; |
95 | } | 98 | } |
96 | 99 | ||
97 | void ViewMail::setBody(const RecBodyP&body ) | 100 | void ViewMail::setBody(const RecBodyP&body ) |
98 | { | 101 | { |
99 | 102 | ||
100 | m_body = body; | 103 | m_body = body; |
101 | m_mail[2] = body->Bodytext(); | 104 | m_mail[2] = body->Bodytext(); |
102 | m_showHtml = KOPrefs::instance()->mViewAsHtml; | 105 | m_showHtml = KOPrefs::instance()->mViewAsHtml; |
103 | if ( m_showHtml ) { | 106 | if ( m_showHtml ) { |
104 | if ( m_mail[2].find ("<html>",0,false ) > -1 ) { | 107 | if ( m_mail[2].find ("<html>",0,false ) > -1 ) { |
105 | qDebug("html mail "); | 108 | qDebug("html mail "); |
106 | } else { | 109 | } else { |
107 | qDebug("no html mail "); | 110 | qDebug("no html mail "); |
@@ -125,280 +128,280 @@ void ViewMail::setBody(const RecBodyP&body ) | |||
125 | double s = body->Description()->Size(); | 128 | double s = body->Description()->Size(); |
126 | int w; | 129 | int w; |
127 | w=0; | 130 | w=0; |
128 | 131 | ||
129 | while (s>1024) | 132 | while (s>1024) |
130 | { | 133 | { |
131 | s/=1024; | 134 | s/=1024; |
132 | ++w; | 135 | ++w; |
133 | if (w>=2) break; | 136 | if (w>=2) break; |
134 | } | 137 | } |
135 | 138 | ||
136 | QString q=""; | 139 | QString q=""; |
137 | switch(w) | 140 | switch(w) |
138 | { | 141 | { |
139 | case 1: | 142 | case 1: |
140 | q="k"; | 143 | q="k"; |
141 | break; | 144 | break; |
142 | case 2: | 145 | case 2: |
143 | q="M"; | 146 | q="M"; |
144 | break; | 147 | break; |
145 | default: | 148 | default: |
146 | break; | 149 | break; |
147 | } | 150 | } |
148 | 151 | ||
149 | { | 152 | { |
150 | /* I did not found a method to make a CONTENT reset on a QTextStream | 153 | /* I did not found a method to make a CONTENT reset on a QTextStream |
151 | so I use this construct that the stream will re-constructed in each | 154 | so I use this construct that the stream will re-constructed in each |
152 | loop. To let it work, the textstream is packed into a own area of | 155 | loop. To let it work, the textstream is packed into a own area of |
153 | code is it will be destructed after finishing its small job. | 156 | code is it will be destructed after finishing its small job. |
154 | */ | 157 | */ |
155 | QTextOStream o(&fsize); | 158 | QTextOStream o(&fsize); |
156 | if (w>0) o.precision(2); else o.precision(0); | 159 | if (w>0) o.precision(2); else o.precision(0); |
157 | o.setf(QTextStream::fixed); | 160 | o.setf(Q3TextStream::fixed); |
158 | o << s << " " << q << "Byte"; | 161 | o << s << " " << q << "Byte"; |
159 | } | 162 | } |
160 | 163 | ||
161 | curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist()); | 164 | curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1,body->Description()->Positionlist()); |
162 | QString filename = ""; | 165 | QString filename = ""; |
163 | 166 | ||
164 | for (unsigned int i = 0; i < body->Parts().count();++i) | 167 | for (unsigned int i = 0; i < body->Parts().count();++i) |
165 | { | 168 | { |
166 | filename = ""; | 169 | filename = ""; |
167 | type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype(); | 170 | type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype(); |
168 | part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin(); | 171 | part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin(); |
169 | for (;it!=body->Parts()[i]->Parameters().end();++it) | 172 | for (;it!=body->Parts()[i]->Parameters().end();++it) |
170 | { | 173 | { |
171 | if (it.key().lower()=="name") | 174 | if (it.key().lower()=="name") |
172 | { | 175 | { |
173 | filename=it.data(); | 176 | filename=it.data(); |
174 | } | 177 | } |
175 | } | 178 | } |
176 | s = body->Parts()[i]->Size(); | 179 | s = body->Parts()[i]->Size(); |
177 | w = 0; | 180 | w = 0; |
178 | while (s>1024) | 181 | while (s>1024) |
179 | { | 182 | { |
180 | s/=1024; | 183 | s/=1024; |
181 | ++w; | 184 | ++w; |
182 | if (w>=2) break; | 185 | if (w>=2) break; |
183 | } | 186 | } |
184 | switch(w) | 187 | switch(w) |
185 | { | 188 | { |
186 | case 1: | 189 | case 1: |
187 | q="k"; | 190 | q="k"; |
188 | break; | 191 | break; |
189 | case 2: | 192 | case 2: |
190 | q="M"; | 193 | q="M"; |
191 | break; | 194 | break; |
192 | default: | 195 | default: |
193 | q=""; | 196 | q=""; |
194 | break; | 197 | break; |
195 | } | 198 | } |
196 | QTextOStream o(&fsize); | 199 | QTextOStream o(&fsize); |
197 | if (w>0) o.precision(2); else o.precision(0); | 200 | if (w>0) o.precision(2); else o.precision(0); |
198 | o.setf(QTextStream::fixed); | 201 | o.setf(Q3TextStream::fixed); |
199 | o << s << " " << q << "Byte"; | 202 | o << s << " " << q << "Byte"; |
200 | desc = body->Parts()[i]->Description(); | 203 | desc = body->Parts()[i]->Description(); |
201 | parentItem = searchParent(body->Parts()[i]->Positionlist()); | 204 | parentItem = searchParent(body->Parts()[i]->Positionlist()); |
202 | if (parentItem) | 205 | if (parentItem) |
203 | { | 206 | { |
204 | AttachItem*temp = lastChild(parentItem); | 207 | AttachItem*temp = lastChild(parentItem); |
205 | if (temp) curItem = temp; | 208 | if (temp) curItem = temp; |
206 | curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); | 209 | curItem=new AttachItem(parentItem,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); |
207 | attachments->setRootIsDecorated(true); | 210 | attachments->setRootIsDecorated(true); |
208 | curItem = parentItem; | 211 | curItem = parentItem; |
209 | } | 212 | } |
210 | else | 213 | else |
211 | { | 214 | { |
212 | curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); | 215 | curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i,body->Parts()[i]->Positionlist()); |
213 | } | 216 | } |
214 | } | 217 | } |
215 | } | 218 | } |
216 | 219 | ||
217 | 220 | ||
218 | void ViewMail::slotViewSource() | 221 | void ViewMail::slotViewSource() |
219 | { | 222 | { |
220 | 223 | ||
221 | if ( !sourceOn ) { | 224 | if ( !sourceOn ) { |
222 | sourceOn = true; | 225 | sourceOn = true; |
223 | viewSource->setText(i18n("View Body Text")); | 226 | viewSource->setText(i18n("View Body Text")); |
224 | encodedString*st = 0; | 227 | encodedString*st = 0; |
225 | st = m_recMail->Wrapper()->fetchRawBody(m_recMail); | 228 | st = m_recMail->Wrapper()->fetchRawBody(m_recMail); |
226 | if ( st ) { | 229 | if ( st ) { |
227 | QString source = QString::fromUtf8( st->Content(), st->Length()); | 230 | QString source = QString::fromUtf8( st->Content(), st->Length()); |
228 | browser->setText( source ); | 231 | browser->setText( source ); |
229 | delete st; | 232 | delete st; |
230 | } | 233 | } |
231 | } else | 234 | } else |
232 | setText(); | 235 | setText(); |
233 | 236 | ||
234 | 237 | ||
235 | } | 238 | } |
236 | void ViewMail::slotShowHtml( bool state ) | 239 | void ViewMail::slotShowHtml( bool state ) |
237 | { | 240 | { |
238 | m_showHtml = state; | 241 | m_showHtml = state; |
239 | setText(); | 242 | setText(); |
240 | } | 243 | } |
241 | 244 | ||
242 | void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) | 245 | void ViewMail::slotItemClicked( Q3ListViewItem * item , const QPoint & point, int ) |
243 | { | 246 | { |
244 | if (!item ) | 247 | if (!item ) |
245 | return; | 248 | return; |
246 | 249 | ||
247 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) | 250 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) |
248 | { | 251 | { |
249 | setText(); | 252 | setText(); |
250 | return; | 253 | return; |
251 | } | 254 | } |
252 | QPopupMenu *menu = new QPopupMenu(); | 255 | Q3PopupMenu *menu = new Q3PopupMenu(); |
253 | int ret=0; | 256 | int ret=0; |
254 | 257 | ||
255 | if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" ) | 258 | if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" ) |
256 | { | 259 | { |
257 | menu->insertItem( i18n( "Show Text" ), 1 ); | 260 | menu->insertItem( i18n( "Show Text" ), 1 ); |
258 | } | 261 | } |
259 | if (item->text(0).left(6)=="image/") { | 262 | if (item->text(0).left(6)=="image/") { |
260 | menu->insertItem(i18n("Display image preview"),2); | 263 | menu->insertItem(i18n("Display image preview"),2); |
261 | } | 264 | } |
262 | menu->insertItem( i18n( "Save Attachment" ), 0 ); | 265 | menu->insertItem( i18n( "Save Attachment" ), 0 ); |
263 | menu->insertSeparator(1); | 266 | menu->insertSeparator(1); |
264 | 267 | ||
265 | ret = menu->exec( point, 0 ); | 268 | ret = menu->exec( point, 0 ); |
266 | 269 | ||
267 | switch(ret) | 270 | switch(ret) |
268 | { | 271 | { |
269 | case 0: | 272 | case 0: |
270 | { | 273 | { |
271 | //MimeTypes types; | 274 | //MimeTypes types; |
272 | //types.insert( "all", "*" ); | 275 | //types.insert( "all", "*" ); |
273 | QString str = KFileDialog::getSaveFileName( "/", item->text( 2 ), this ); | 276 | QString str = KFileDialog::getSaveFileName( "/", item->text( 2 ), this ); |
274 | 277 | ||
275 | if( !str.isEmpty() ) | 278 | if( !str.isEmpty() ) |
276 | { | 279 | { |
277 | encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); | 280 | encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); |
278 | if (content) | 281 | if (content) |
279 | { | 282 | { |
280 | QFile output(str); | 283 | QFile output(str); |
281 | output.open(IO_WriteOnly); | 284 | output.open(QIODevice::WriteOnly); |
282 | output.writeBlock(content->Content(),content->Length()); | 285 | output.writeBlock(content->Content(),content->Length()); |
283 | output.close(); | 286 | output.close(); |
284 | delete content; | 287 | delete content; |
285 | } | 288 | } |
286 | } | 289 | } |
287 | } | 290 | } |
288 | break ; | 291 | break ; |
289 | 292 | ||
290 | case 2: | 293 | case 2: |
291 | { | 294 | { |
292 | #ifdef DESKTOP_VERSION | 295 | #ifdef DESKTOP_VERSION |
293 | QString tmpfile = locateLocal( "tmp", "opiemail-image"); | 296 | QString tmpfile = locateLocal( "tmp", "opiemail-image"); |
294 | #else | 297 | #else |
295 | QString tmpfile = "/tmp/opiemail-image"; | 298 | QString tmpfile = "/tmp/opiemail-image"; |
296 | #endif | 299 | #endif |
297 | encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); | 300 | encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); |
298 | if (content) { | 301 | if (content) { |
299 | QFile output(tmpfile); | 302 | QFile output(tmpfile); |
300 | output.open(IO_WriteOnly); | 303 | output.open(QIODevice::WriteOnly); |
301 | output.writeBlock(content->Content(),content->Length()); | 304 | output.writeBlock(content->Content(),content->Length()); |
302 | output.close(); | 305 | output.close(); |
303 | delete content; | 306 | delete content; |
304 | MailImageDlg iview(""); | 307 | MailImageDlg iview(""); |
305 | iview.setName(tmpfile); | 308 | iview.setName(tmpfile); |
306 | KApplication::execDialog(&iview); | 309 | KApplication::execDialog(&iview); |
307 | output.remove(); | 310 | output.remove(); |
308 | } | 311 | } |
309 | } | 312 | } |
310 | break; | 313 | break; |
311 | case 1: | 314 | case 1: |
312 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) | 315 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) |
313 | { | 316 | { |
314 | setText(); | 317 | setText(); |
315 | } | 318 | } |
316 | else | 319 | else |
317 | { | 320 | { |
318 | if ( m_recMail->Wrapper() != 0l ) | 321 | if ( m_recMail->Wrapper() != 0l ) |
319 | { // make sure that there is a wrapper , even after delete or simular actions | 322 | { // make sure that there is a wrapper , even after delete or simular actions |
320 | browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); | 323 | browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); |
321 | } | 324 | } |
322 | } | 325 | } |
323 | break; | 326 | break; |
324 | } | 327 | } |
325 | delete menu; | 328 | delete menu; |
326 | } | 329 | } |
327 | 330 | ||
328 | 331 | ||
329 | void ViewMail::setMail(const RecMailP&mail ) | 332 | void ViewMail::setMail(const RecMailP&mail ) |
330 | { | 333 | { |
331 | 334 | ||
332 | m_recMail = mail; | 335 | m_recMail = mail; |
333 | 336 | ||
334 | m_mail[0] = mail->getFrom(); | 337 | m_mail[0] = mail->getFrom(); |
335 | m_mail[1] = mail->getSubject(); | 338 | m_mail[1] = mail->getSubject(); |
336 | m_mail[3] = mail->getDate(); | 339 | m_mail[3] = mail->getDate(); |
337 | m_mail[4] = mail->Msgid(); | 340 | m_mail[4] = mail->Msgid(); |
338 | 341 | ||
339 | m_mail2[0] = mail->To(); | 342 | m_mail2[0] = mail->To(); |
340 | m_mail2[1] = mail->CC(); | 343 | m_mail2[1] = mail->CC(); |
341 | m_mail2[2] = mail->Bcc(); | 344 | m_mail2[2] = mail->Bcc(); |
342 | 345 | ||
343 | setText(); | 346 | setText(); |
344 | } | 347 | } |
345 | 348 | ||
346 | void ViewMail::slotNextMail() | 349 | void ViewMail::slotNextMail() |
347 | { | 350 | { |
348 | nextMail->blockSignals( true ); | 351 | nextMail->blockSignals( true ); |
349 | setCaption(i18n("Displaying next mail...please wait!")); | 352 | setCaption(i18n("Displaying next mail...please wait!")); |
350 | qApp->processEvents(); | 353 | qApp->processEvents(); |
351 | emit showNextMail(this); | 354 | emit showNextMail(this); |
352 | nextMail->blockSignals( false ); | 355 | nextMail->blockSignals( false ); |
353 | } | 356 | } |
354 | 357 | ||
355 | ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) | 358 | ViewMail::ViewMail( QWidget *parent, const char *name, Qt::WFlags fl) |
356 | : ViewMailBase(parent, name, fl), _inLoop(false) | 359 | : ViewMailBase(parent, name, fl), _inLoop(false) |
357 | { | 360 | { |
358 | m_gotBody = false; | 361 | m_gotBody = false; |
359 | deleted = false; | 362 | deleted = false; |
360 | sourceOn = false; | 363 | sourceOn = false; |
361 | readConfig(); | 364 | readConfig(); |
362 | connect( reply, SIGNAL(activated()), SLOT(slotReply())); | 365 | connect( reply, SIGNAL(activated()), SLOT(slotReply())); |
363 | connect( forward, SIGNAL(activated()), SLOT(slotForward())); | 366 | connect( forward, SIGNAL(activated()), SLOT(slotForward())); |
364 | connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) ); | 367 | connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) ); |
365 | connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) ); | 368 | connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) ); |
366 | connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); | 369 | connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); |
367 | connect( nextMail, SIGNAL( activated() ), SLOT( slotNextMail() ) ); | 370 | connect( nextMail, SIGNAL( activated() ), SLOT( slotNextMail() ) ); |
368 | connect( viewSource, SIGNAL( activated() ), SLOT( slotViewSource() ) ); | 371 | connect( viewSource, SIGNAL( activated() ), SLOT( slotViewSource() ) ); |
369 | connect( downloadMail, SIGNAL( activated() ), SIGNAL( signalDownloadMail() ) ); | 372 | connect( downloadMail, SIGNAL( activated() ), SIGNAL( signalDownloadMail() ) ); |
370 | 373 | ||
371 | attachments->setEnabled(m_gotBody); | 374 | attachments->setEnabled(m_gotBody); |
372 | connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) ); | 375 | connect( attachments, SIGNAL( clicked(Q3ListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(Q3ListViewItem*,const QPoint&, int) ) ); |
373 | 376 | ||
374 | attachments->setSorting(-1); | 377 | attachments->setSorting(-1); |
375 | } | 378 | } |
376 | 379 | ||
377 | void ViewMail::readConfig() | 380 | void ViewMail::readConfig() |
378 | { | 381 | { |
379 | 382 | ||
380 | setFont ( KOPrefs::instance()->mReadFont ); | 383 | setFont ( KOPrefs::instance()->mReadFont ); |
381 | m_showHtml = KOPrefs::instance()->mViewAsHtml; | 384 | m_showHtml = KOPrefs::instance()->mViewAsHtml; |
382 | showHtml->setOn( m_showHtml ); | 385 | showHtml->setOn( m_showHtml ); |
383 | } | 386 | } |
384 | 387 | ||
385 | void ViewMail::setText() | 388 | void ViewMail::setText() |
386 | { | 389 | { |
387 | 390 | ||
388 | viewSource->setText(i18n("View Source")); | 391 | viewSource->setText(i18n("View Source")); |
389 | sourceOn = false; | 392 | sourceOn = false; |
390 | QString toString; | 393 | QString toString; |
391 | QString ccString; | 394 | QString ccString; |
392 | QString bccString; | 395 | QString bccString; |
393 | 396 | ||
394 | 397 | ||
395 | toString = m_mail2[0].join(","); | 398 | toString = m_mail2[0].join(","); |
396 | ccString = m_mail2[1].join(","); | 399 | ccString = m_mail2[1].join(","); |
397 | bccString = m_mail2[2].join(","); | 400 | bccString = m_mail2[2].join(","); |
398 | 401 | ||
399 | #ifdef DESKTOP_VERSION | 402 | #ifdef DESKTOP_VERSION |
400 | setCaption( i18n("Size: ")+m_recMail->MsgsizeString()+" - "+i18n("E-Mail by %1").arg( m_mail[0] ) ); | 403 | setCaption( i18n("Size: ")+m_recMail->MsgsizeString()+" - "+i18n("E-Mail by %1").arg( m_mail[0] ) ); |
401 | #else | 404 | #else |
402 | setCaption( m_recMail->MsgsizeString()+" - "+m_mail[0] ); | 405 | setCaption( m_recMail->MsgsizeString()+" - "+m_mail[0] ); |
403 | #endif | 406 | #endif |
404 | 407 | ||
@@ -528,52 +531,52 @@ void ViewMail::slotForward() | |||
528 | if (!m_mail[0].isNull()) | 531 | if (!m_mail[0].isNull()) |
529 | ftext += QString("From: %1\n") | 532 | ftext += QString("From: %1\n") |
530 | .arg( m_mail[0] ); | 533 | .arg( m_mail[0] ); |
531 | if (!m_mail[1].isNull()) | 534 | if (!m_mail[1].isNull()) |
532 | ftext += QString("Subject: %1\n") | 535 | ftext += QString("Subject: %1\n") |
533 | .arg( m_mail[1] ); | 536 | .arg( m_mail[1] ); |
534 | 537 | ||
535 | ftext += QString("\n%1\n") | 538 | ftext += QString("\n%1\n") |
536 | .arg( m_mail[2]); | 539 | .arg( m_mail[2]); |
537 | 540 | ||
538 | ftext += QString("----- End forwarded message -----\n"); | 541 | ftext += QString("----- End forwarded message -----\n"); |
539 | 542 | ||
540 | Settings *settings = new Settings(); | 543 | Settings *settings = new Settings(); |
541 | ComposeMail composer( settings ,this, 0, true); | 544 | ComposeMail composer( settings ,this, 0, true); |
542 | composer.setSubject( "Fwd: " + m_mail[1] ); | 545 | composer.setSubject( "Fwd: " + m_mail[1] ); |
543 | composer.setMessage( ftext ); | 546 | composer.setMessage( ftext ); |
544 | if ( QDialog::Accepted == KApplication::execDialog( &composer )) | 547 | if ( QDialog::Accepted == KApplication::execDialog( &composer )) |
545 | { | 548 | { |
546 | } | 549 | } |
547 | } | 550 | } |
548 | 551 | ||
549 | void ViewMail::slotDeleteMail( ) | 552 | void ViewMail::slotDeleteMail( ) |
550 | { | 553 | { |
551 | if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + m_mail[0] + " - " + m_mail[1] ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 554 | 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 ) |
552 | { | 555 | { |
553 | emit deleteAndDisplayNextMail( this); | 556 | emit deleteAndDisplayNextMail( this); |
554 | //m_recMail->Wrapper()->deleteMail( m_recMail ); | 557 | //m_recMail->Wrapper()->deleteMail( m_recMail ); |
555 | //hide(); | 558 | //hide(); |
556 | deleted = true; | 559 | deleted = true; |
557 | } | 560 | } |
558 | } | 561 | } |
559 | 562 | ||
560 | MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, WFlags f) | 563 | MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, Qt::WFlags f) |
561 | : QDialog(parent,name,modal) | 564 | : QDialog(parent,name,modal) |
562 | { | 565 | { |
563 | QVBoxLayout*dlglayout = new QVBoxLayout(this); | 566 | Q3VBoxLayout*dlglayout = new Q3VBoxLayout(this); |
564 | dlglayout->setSpacing(2); | 567 | dlglayout->setSpacing(2); |
565 | dlglayout->setMargin(1); | 568 | dlglayout->setMargin(1); |
566 | //m_imageview = new Opie::MM::OImageScrollView(this); | 569 | //m_imageview = new Opie::MM::OImageScrollView(this); |
567 | //dlglayout->addWidget(m_imageview); | 570 | //dlglayout->addWidget(m_imageview); |
568 | } | 571 | } |
569 | 572 | ||
570 | MailImageDlg::~MailImageDlg() | 573 | MailImageDlg::~MailImageDlg() |
571 | { | 574 | { |
572 | } | 575 | } |
573 | 576 | ||
574 | void MailImageDlg::setName(const QString&fname) | 577 | void MailImageDlg::setName(const QString&fname) |
575 | { | 578 | { |
576 | qDebug("viewmail.cpp: MailImageDlg::setName Pending"); | 579 | qDebug("viewmail.cpp: MailImageDlg::setName Pending"); |
577 | // m_imageview->setImage(fname); | 580 | // m_imageview->setImage(fname); |
578 | } | 581 | } |
579 | 582 | ||