-rw-r--r-- | kmicromail/viewmail.cpp | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp index f1e0225..2093678 100644 --- a/kmicromail/viewmail.cpp +++ b/kmicromail/viewmail.cpp | |||
@@ -89,25 +89,26 @@ AttachItem* ViewMail::lastChild(AttachItem*parent) | |||
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] = QString::fromUtf8( body->Bodytext().latin1() ); |
102 | // qDebug("********text %s ",m_mail[2].latin1() ); | ||
102 | attachbutton->setEnabled(body->Parts().count()>0); | 103 | attachbutton->setEnabled(body->Parts().count()>0); |
103 | attachments->setEnabled(body->Parts().count()>0); | 104 | attachments->setEnabled(body->Parts().count()>0); |
104 | if (body->Parts().count()==0) | 105 | if (body->Parts().count()==0) |
105 | { | 106 | { |
106 | return; | 107 | return; |
107 | } | 108 | } |
108 | AttachItem * curItem=0; | 109 | AttachItem * curItem=0; |
109 | AttachItem * parentItem = 0; | 110 | AttachItem * parentItem = 0; |
110 | QString type=body->Description()->Type()+"/"+body->Description()->Subtype(); | 111 | QString type=body->Description()->Type()+"/"+body->Description()->Subtype(); |
111 | QString desc,fsize; | 112 | QString desc,fsize; |
112 | double s = body->Description()->Size(); | 113 | double s = body->Description()->Size(); |
113 | int w; | 114 | int w; |
@@ -291,28 +292,28 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int | |||
291 | } | 292 | } |
292 | break; | 293 | break; |
293 | } | 294 | } |
294 | delete menu; | 295 | delete menu; |
295 | } | 296 | } |
296 | 297 | ||
297 | 298 | ||
298 | void ViewMail::setMail(const RecMailP&mail ) | 299 | void ViewMail::setMail(const RecMailP&mail ) |
299 | { | 300 | { |
300 | 301 | ||
301 | m_recMail = mail; | 302 | m_recMail = mail; |
302 | 303 | ||
303 | m_mail[0] = mail->getFrom(); | 304 | m_mail[0] = QString::fromUtf8( mail->getFrom().latin1() ); |
304 | m_mail[1] = mail->getSubject(); | 305 | m_mail[1] = QString::fromUtf8( mail->getSubject().latin1() ); |
305 | m_mail[3] = mail->getDate(); | 306 | m_mail[3] = QString::fromUtf8( mail->getDate().latin1() ); |
306 | m_mail[4] = mail->Msgid(); | 307 | m_mail[4] = QString::fromUtf8( mail->Msgid().latin1() ); |
307 | 308 | ||
308 | m_mail2[0] = mail->To(); | 309 | m_mail2[0] = mail->To(); |
309 | m_mail2[1] = mail->CC(); | 310 | m_mail2[1] = mail->CC(); |
310 | m_mail2[2] = mail->Bcc(); | 311 | m_mail2[2] = mail->Bcc(); |
311 | 312 | ||
312 | setText(); | 313 | setText(); |
313 | } | 314 | } |
314 | 315 | ||
315 | 316 | ||
316 | 317 | ||
317 | ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) | 318 | ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) |
318 | : ViewMailBase(parent, name, fl), _inLoop(false) | 319 | : ViewMailBase(parent, name, fl), _inLoop(false) |
@@ -339,36 +340,29 @@ void ViewMail::readConfig() | |||
339 | setFont ( KOPrefs::instance()->mReadFont ); | 340 | setFont ( KOPrefs::instance()->mReadFont ); |
340 | m_showHtml = KOPrefs::instance()->mViewAsHtml; | 341 | m_showHtml = KOPrefs::instance()->mViewAsHtml; |
341 | showHtml->setOn( m_showHtml ); | 342 | showHtml->setOn( m_showHtml ); |
342 | } | 343 | } |
343 | 344 | ||
344 | void ViewMail::setText() | 345 | void ViewMail::setText() |
345 | { | 346 | { |
346 | 347 | ||
347 | QString toString; | 348 | QString toString; |
348 | QString ccString; | 349 | QString ccString; |
349 | QString bccString; | 350 | QString bccString; |
350 | 351 | ||
351 | for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) | 352 | |
352 | { | 353 | toString = QString::fromUtf8(m_mail2[0].join(",").latin1()); |
353 | toString += (*it); | 354 | ccString = QString::fromUtf8(m_mail2[1].join(",").latin1()); |
354 | } | 355 | bccString = QString::fromUtf8(m_mail2[2].join(",").latin1()); |
355 | for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it ) | 356 | |
356 | { | ||
357 | ccString += (*it); | ||
358 | } | ||
359 | for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) | ||
360 | { | ||
361 | bccString += (*it); | ||
362 | } | ||
363 | 357 | ||
364 | setCaption( i18n("E-Mail by %1").arg( m_mail[0] ) ); | 358 | setCaption( i18n("E-Mail by %1").arg( m_mail[0] ) ); |
365 | 359 | ||
366 | m_mailHtml = "<html><body>" | 360 | m_mailHtml = "<html><body>" |
367 | "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>" | 361 | "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>" |
368 | "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>" | 362 | "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>" |
369 | "</td></tr><tr bgcolor=\"#EEEEE6\"><td>" | 363 | "</td></tr><tr bgcolor=\"#EEEEE6\"><td>" |
370 | "<b>" + i18n( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>" | 364 | "<b>" + i18n( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>" |
371 | "<b>" + i18n( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" + | 365 | "<b>" + i18n( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" + |
372 | i18n( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>" | 366 | i18n( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>" |
373 | "<b>" + i18n( "Date" ) + ": </b> " + m_mail[3] + | 367 | "<b>" + i18n( "Date" ) + ": </b> " + m_mail[3] + |
374 | "</td></tr></table><font>"; | 368 | "</td></tr></table><font>"; |
@@ -447,36 +441,37 @@ void ViewMail::slotReply() | |||
447 | { | 441 | { |
448 | rtext += "> " + *it + "\n"; | 442 | rtext += "> " + *it + "\n"; |
449 | } | 443 | } |
450 | rtext += "\n"; | 444 | rtext += "\n"; |
451 | 445 | ||
452 | QString prefix; | 446 | QString prefix; |
453 | if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = ""; | 447 | if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = ""; |
454 | else prefix = "Re: "; // no i18n on purpose | 448 | else prefix = "Re: "; // no i18n on purpose |
455 | 449 | ||
456 | Settings *settings = new Settings(); | 450 | Settings *settings = new Settings(); |
457 | ComposeMail composer( settings ,this, 0, true); | 451 | ComposeMail composer( settings ,this, 0, true); |
458 | if (m_recMail->Replyto().isEmpty()) { | 452 | if (m_recMail->Replyto().isEmpty()) { |
459 | composer.setTo( m_recMail->getFrom()); | 453 | composer.setTo( QString::fromUtf8( m_recMail->getFrom().latin1())); |
460 | } else { | 454 | } else { |
461 | composer.setTo( m_recMail->Replyto()); | 455 | composer.setTo( QString::fromUtf8( m_recMail->Replyto().latin1())); |
462 | } | 456 | } |
463 | composer.setSubject( prefix + m_mail[1] ); | 457 | composer.setSubject( prefix + m_mail[1] ); |
464 | composer.setMessage( rtext ); | 458 | composer.setMessage( rtext ); |
465 | composer.setInReplyTo(m_recMail->Msgid()); | 459 | composer.setInReplyTo(m_recMail->Msgid()); |
466 | 460 | ||
467 | if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) | 461 | if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) |
468 | { | 462 | { |
469 | m_recMail->Wrapper()->answeredMail(m_recMail); | 463 | m_recMail->Wrapper()->answeredMail(m_recMail); |
470 | } | 464 | } |
465 | delete settings; | ||
471 | } | 466 | } |
472 | 467 | ||
473 | void ViewMail::slotForward() | 468 | void ViewMail::slotForward() |
474 | { | 469 | { |
475 | if (!m_gotBody) | 470 | if (!m_gotBody) |
476 | { | 471 | { |
477 | QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot forward yet."), i18n("Ok")); | 472 | QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot forward yet."), i18n("Ok")); |
478 | return; | 473 | return; |
479 | } | 474 | } |
480 | 475 | ||
481 | QString ftext; | 476 | QString ftext; |
482 | ftext += QString("\n----- Forwarded message from %1 -----\n\n") | 477 | ftext += QString("\n----- Forwarded message from %1 -----\n\n") |