summaryrefslogtreecommitdiffabout
path: root/kmicromail/viewmail.cpp
Unidiff
Diffstat (limited to 'kmicromail/viewmail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/viewmail.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp
index b434318..703711d 100644
--- a/kmicromail/viewmail.cpp
+++ b/kmicromail/viewmail.cpp
@@ -252,129 +252,130 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
252 252
253 case 2: 253 case 2:
254 { 254 {
255 QString tmpfile = "/tmp/opiemail-image"; 255 QString tmpfile = "/tmp/opiemail-image";
256 encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); 256 encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] );
257 if (content) { 257 if (content) {
258 QFile output(tmpfile); 258 QFile output(tmpfile);
259 output.open(IO_WriteOnly); 259 output.open(IO_WriteOnly);
260 output.writeBlock(content->Content(),content->Length()); 260 output.writeBlock(content->Content(),content->Length());
261 output.close(); 261 output.close();
262 delete content; 262 delete content;
263 MailImageDlg iview(""); 263 MailImageDlg iview("");
264 iview.setName(tmpfile); 264 iview.setName(tmpfile);
265 KApplication::execDialog(&iview); 265 KApplication::execDialog(&iview);
266 output.remove(); 266 output.remove();
267 } 267 }
268 } 268 }
269 break; 269 break;
270 case 1: 270 case 1:
271 if ( ( ( AttachItem* )item )->Partnumber() == -1 ) 271 if ( ( ( AttachItem* )item )->Partnumber() == -1 )
272 { 272 {
273 setText(); 273 setText();
274 } 274 }
275 else 275 else
276 { 276 {
277 if ( m_recMail->Wrapper() != 0l ) 277 if ( m_recMail->Wrapper() != 0l )
278 { // make sure that there is a wrapper , even after delete or simular actions 278 { // make sure that there is a wrapper , even after delete or simular actions
279 browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); 279 browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) );
280 } 280 }
281 } 281 }
282 break; 282 break;
283 } 283 }
284 delete menu; 284 delete menu;
285} 285}
286 286
287 287
288void ViewMail::setMail(const RecMailP&mail ) 288void ViewMail::setMail(const RecMailP&mail )
289{ 289{
290 290
291 m_recMail = mail; 291 m_recMail = mail;
292 292
293 m_mail[0] = mail->getFrom(); 293 m_mail[0] = mail->getFrom();
294 m_mail[1] = mail->getSubject(); 294 m_mail[1] = mail->getSubject();
295 m_mail[3] = mail->getDate(); 295 m_mail[3] = mail->getDate();
296 m_mail[4] = mail->Msgid(); 296 m_mail[4] = mail->Msgid();
297 297
298 m_mail2[0] = mail->To(); 298 m_mail2[0] = mail->To();
299 m_mail2[1] = mail->CC(); 299 m_mail2[1] = mail->CC();
300 m_mail2[2] = mail->Bcc(); 300 m_mail2[2] = mail->Bcc();
301 301
302 setText(); 302 setText();
303} 303}
304 304
305 305
306 306
307ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) 307ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
308 : ViewMailBase(parent, name, fl), _inLoop(false) 308 : ViewMailBase(parent, name, fl), _inLoop(false)
309{ 309{
310 m_gotBody = false; 310 m_gotBody = false;
311 deleted = false; 311 deleted = false;
312 312
313 connect( reply, SIGNAL(activated()), SLOT(slotReply())); 313 connect( reply, SIGNAL(activated()), SLOT(slotReply()));
314 connect( forward, SIGNAL(activated()), SLOT(slotForward())); 314 connect( forward, SIGNAL(activated()), SLOT(slotForward()));
315 connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) ); 315 connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) );
316 connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) ); 316 connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) );
317 connect( closeMail, SIGNAL( activated() ), SLOT( close() ) );
317 318
318 attachments->setEnabled(m_gotBody); 319 attachments->setEnabled(m_gotBody);
319 connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) ); 320 connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) );
320 321
321 readConfig(); 322 readConfig();
322 attachments->setSorting(-1); 323 attachments->setSorting(-1);
323} 324}
324 325
325void ViewMail::readConfig() 326void ViewMail::readConfig()
326{ 327{
327 Config cfg( "mail" ); 328 Config cfg( "mail" );
328 cfg.setGroup( "Settings" ); 329 cfg.setGroup( "Settings" );
329 m_showHtml = cfg.readBoolEntry( "showHtml", false ); 330 m_showHtml = cfg.readBoolEntry( "showHtml", false );
330 showHtml->setOn( m_showHtml ); 331 showHtml->setOn( m_showHtml );
331} 332}
332 333
333void ViewMail::setText() 334void ViewMail::setText()
334{ 335{
335 336
336 QString toString; 337 QString toString;
337 QString ccString; 338 QString ccString;
338 QString bccString; 339 QString bccString;
339 340
340 for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) 341 for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it )
341 { 342 {
342 toString += (*it); 343 toString += (*it);
343 } 344 }
344 for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it ) 345 for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it )
345 { 346 {
346 ccString += (*it); 347 ccString += (*it);
347 } 348 }
348 for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) 349 for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it )
349 { 350 {
350 bccString += (*it); 351 bccString += (*it);
351 } 352 }
352 353
353 setCaption( tr("E-Mail by %1").arg( m_mail[0] ) ); 354 setCaption( tr("E-Mail by %1").arg( m_mail[0] ) );
354 355
355 m_mailHtml = "<html><body>" 356 m_mailHtml = "<html><body>"
356 "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>" 357 "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>"
357 "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>" 358 "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>"
358 "</td></tr><tr bgcolor=\"#EEEEE6\"><td>" 359 "</td></tr><tr bgcolor=\"#EEEEE6\"><td>"
359 "<b>" + tr( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>" 360 "<b>" + tr( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>"
360 "<b>" + tr( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" + 361 "<b>" + tr( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" +
361 tr( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>" 362 tr( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>"
362 "<b>" + tr( "Date" ) + ": </b> " + m_mail[3] + 363 "<b>" + tr( "Date" ) + ": </b> " + m_mail[3] +
363 "</td></tr></table><font face=fixed>"; 364 "</td></tr></table><font face=fixed>";
364 365
365 if ( !m_showHtml ) 366 if ( !m_showHtml )
366 { 367 {
367 browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" ); 368 browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" );
368 } 369 }
369 else 370 else
370 { 371 {
371 browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" ); 372 browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" );
372 } 373 }
373 // remove later in favor of a real handling 374 // remove later in favor of a real handling
374 m_gotBody = true; 375 m_gotBody = true;
375} 376}
376 377
377 378
378ViewMail::~ViewMail() 379ViewMail::~ViewMail()
379{ 380{
380 m_recMail->Wrapper()->cleanMimeCache(); 381 m_recMail->Wrapper()->cleanMimeCache();