summaryrefslogtreecommitdiffabout
path: root/kmicromail/viewmail.cpp
Unidiff
Diffstat (limited to 'kmicromail/viewmail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/viewmail.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp
index 60c764c..6d88cad 100644
--- a/kmicromail/viewmail.cpp
+++ b/kmicromail/viewmail.cpp
@@ -413,121 +413,122 @@ void ViewMail::exec()
413} 413}
414 414
415QString ViewMail::deHtml(const QString &string) 415QString ViewMail::deHtml(const QString &string)
416{ 416{
417 QString string_ = string; 417 QString string_ = string;
418 string_.replace(QRegExp("&"), "&"); 418 string_.replace(QRegExp("&"), "&");
419 string_.replace(QRegExp("<"), "&lt;"); 419 string_.replace(QRegExp("<"), "&lt;");
420 string_.replace(QRegExp(">"), "&gt;"); 420 string_.replace(QRegExp(">"), "&gt;");
421 string_.replace(QRegExp("\\n"), "<br>"); 421 string_.replace(QRegExp("\\n"), "<br>");
422 return string_; 422 return string_;
423} 423}
424 424
425void ViewMail::slotReply() 425void ViewMail::slotReply()
426{ 426{
427 if (!m_gotBody) 427 if (!m_gotBody)
428 { 428 {
429 QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot reply yet."), i18n("Ok")); 429 QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot reply yet."), i18n("Ok"));
430 return; 430 return;
431 } 431 }
432 432
433 QString rtext; 433 QString rtext;
434 rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose 434 rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose
435 .arg( m_mail[0] ) 435 .arg( m_mail[0] )
436 .arg( m_mail[3] ); 436 .arg( m_mail[3] );
437 437
438 QString text = m_mail[2]; 438 QString text = m_mail[2];
439 QStringList lines = QStringList::split(QRegExp("\\n"), text); 439 QStringList lines = QStringList::split(QRegExp("\\n"), text);
440 QStringList::Iterator it; 440 QStringList::Iterator it;
441 for (it = lines.begin(); it != lines.end(); it++) 441 for (it = lines.begin(); it != lines.end(); it++)
442 { 442 {
443 rtext += "> " + *it + "\n"; 443 rtext += "> " + *it + "\n";
444 } 444 }
445 rtext += "\n"; 445 rtext += "\n";
446 446
447 QString prefix; 447 QString prefix;
448 if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = ""; 448 if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = "";
449 else prefix = "Re: "; // no i18n on purpose 449 else prefix = "Re: "; // no i18n on purpose
450 450
451 Settings *settings = new Settings(); 451 Settings *settings = new Settings();
452 ComposeMail composer( settings ,this, 0, true); 452 ComposeMail composer( settings ,this, 0, true);
453 if (m_recMail->Replyto().isEmpty()) { 453 if (m_recMail->Replyto().isEmpty()) {
454 composer.setTo(m_recMail->getFrom()); 454 composer.setTo(m_recMail->getFrom());
455 } else { 455 } else {
456 composer.setTo(m_recMail->Replyto()); 456 composer.setTo(m_recMail->Replyto());
457 } 457 }
458 composer.setSubject( prefix + m_mail[1] ); 458 composer.setSubject( prefix + m_mail[1] );
459 composer.setMessage( rtext ); 459 composer.setMessage( rtext );
460 composer.setInReplyTo(m_recMail->Msgid()); 460 composer.setInReplyTo(m_recMail->Msgid());
461 composer.setCharset( m_body->getCharset() ); 461 composer.setCharset( m_body->getCharset() );
462 462
463 if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) 463 if ( QDialog::Accepted == KApplication::execDialog( &composer ) )
464 { 464 {
465 m_recMail->Wrapper()->answeredMail(m_recMail); 465 m_recMail->Wrapper()->answeredMail(m_recMail);
466 } 466 }
467 delete settings; 467 delete settings;
468} 468}
469 469
470void ViewMail::slotForward() 470void ViewMail::slotForward()
471{ 471{
472 if (!m_gotBody) 472 if (!m_gotBody)
473 { 473 {
474 QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot forward yet."), i18n("Ok")); 474 QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot forward yet."), i18n("Ok"));
475 return; 475 return;
476 } 476 }
477 477
478 QString ftext; 478 QString ftext;
479 ftext += QString("\n----- Forwarded message from %1 -----\n\n") 479 ftext += QString("\n----- Forwarded message from %1 -----\n\n")
480 .arg( m_mail[0] ); 480 .arg( m_mail[0] );
481 if (!m_mail[3].isNull()) 481 if (!m_mail[3].isNull())
482 ftext += QString("Date: %1\n") 482 ftext += QString("Date: %1\n")
483 .arg( m_mail[3] ); 483 .arg( m_mail[3] );
484 if (!m_mail[0].isNull()) 484 if (!m_mail[0].isNull())
485 ftext += QString("From: %1\n") 485 ftext += QString("From: %1\n")
486 .arg( m_mail[0] ); 486 .arg( m_mail[0] );
487 if (!m_mail[1].isNull()) 487 if (!m_mail[1].isNull())
488 ftext += QString("Subject: %1\n") 488 ftext += QString("Subject: %1\n")
489 .arg( m_mail[1] ); 489 .arg( m_mail[1] );
490 490
491 ftext += QString("\n%1\n") 491 ftext += QString("\n%1\n")
492 .arg( m_mail[2]); 492 .arg( m_mail[2]);
493 493
494 ftext += QString("----- End forwarded message -----\n"); 494 ftext += QString("----- End forwarded message -----\n");
495 495
496 Settings *settings = new Settings(); 496 Settings *settings = new Settings();
497 ComposeMail composer( settings ,this, 0, true); 497 ComposeMail composer( settings ,this, 0, true);
498 composer.setSubject( "Fwd: " + m_mail[1] ); 498 composer.setSubject( "Fwd: " + m_mail[1] );
499 composer.setMessage( ftext ); 499 composer.setMessage( ftext );
500 if ( QDialog::Accepted == KApplication::execDialog( &composer )) 500 if ( QDialog::Accepted == KApplication::execDialog( &composer ))
501 { 501 {
502 } 502 }
503} 503}
504 504
505void ViewMail::slotDeleteMail( ) 505void ViewMail::slotDeleteMail( )
506{ 506{
507 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 ) 507 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 )
508 { 508 {
509 m_recMail->Wrapper()->deleteMail( m_recMail ); 509 emit deleteAndDisplayNextMail( this);
510 hide(); 510 //m_recMail->Wrapper()->deleteMail( m_recMail );
511 //hide();
511 deleted = true; 512 deleted = true;
512 } 513 }
513} 514}
514 515
515MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, WFlags f) 516MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, WFlags f)
516 : QDialog(parent,name,modal) 517 : QDialog(parent,name,modal)
517{ 518{
518 QVBoxLayout*dlglayout = new QVBoxLayout(this); 519 QVBoxLayout*dlglayout = new QVBoxLayout(this);
519 dlglayout->setSpacing(2); 520 dlglayout->setSpacing(2);
520 dlglayout->setMargin(1); 521 dlglayout->setMargin(1);
521 //m_imageview = new Opie::MM::OImageScrollView(this); 522 //m_imageview = new Opie::MM::OImageScrollView(this);
522 //dlglayout->addWidget(m_imageview); 523 //dlglayout->addWidget(m_imageview);
523} 524}
524 525
525MailImageDlg::~MailImageDlg() 526MailImageDlg::~MailImageDlg()
526{ 527{
527} 528}
528 529
529void MailImageDlg::setName(const QString&fname) 530void MailImageDlg::setName(const QString&fname)
530{ 531{
531 qDebug("viewmail.cpp: MailImageDlg::setName Pending"); 532 qDebug("viewmail.cpp: MailImageDlg::setName Pending");
532 // m_imageview->setImage(fname); 533 // m_imageview->setImage(fname);
533} 534}