summaryrefslogtreecommitdiffabout
path: root/kmicromail/viewmail.cpp
Unidiff
Diffstat (limited to 'kmicromail/viewmail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/viewmail.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp
index 2093678..4883231 100644
--- a/kmicromail/viewmail.cpp
+++ b/kmicromail/viewmail.cpp
@@ -85,33 +85,33 @@ 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
97void ViewMail::setBody(const RecBodyP&body ) 97void ViewMail::setBody(const RecBodyP&body )
98{ 98{
99 99
100 m_body = body; 100 m_body = body;
101 m_mail[2] = QString::fromUtf8( body->Bodytext().latin1() ); 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)
@@ -288,36 +288,36 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
288 if ( m_recMail->Wrapper() != 0l ) 288 if ( m_recMail->Wrapper() != 0l )
289 { // make sure that there is a wrapper , even after delete or simular actions 289 { // make sure that there is a wrapper , even after delete or simular actions
290 browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); 290 browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) );
291 } 291 }
292 } 292 }
293 break; 293 break;
294 } 294 }
295 delete menu; 295 delete menu;
296} 296}
297 297
298 298
299void ViewMail::setMail(const RecMailP&mail ) 299void ViewMail::setMail(const RecMailP&mail )
300{ 300{
301 301
302 m_recMail = mail; 302 m_recMail = mail;
303 303
304 m_mail[0] = QString::fromUtf8( mail->getFrom().latin1() ); 304 m_mail[0] = mail->getFrom();
305 m_mail[1] = QString::fromUtf8( mail->getSubject().latin1() ); 305 m_mail[1] = mail->getSubject();
306 m_mail[3] = QString::fromUtf8( mail->getDate().latin1() ); 306 m_mail[3] = mail->getDate();
307 m_mail[4] = QString::fromUtf8( mail->Msgid().latin1() ); 307 m_mail[4] = mail->Msgid();
308 308
309 m_mail2[0] = mail->To(); 309 m_mail2[0] = mail->To();
310 m_mail2[1] = mail->CC(); 310 m_mail2[1] = mail->CC();
311 m_mail2[2] = mail->Bcc(); 311 m_mail2[2] = mail->Bcc();
312 312
313 setText(); 313 setText();
314} 314}
315 315
316 316
317 317
318ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) 318ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
319 : ViewMailBase(parent, name, fl), _inLoop(false) 319 : ViewMailBase(parent, name, fl), _inLoop(false)
320{ 320{
321 m_gotBody = false; 321 m_gotBody = false;
322 deleted = false; 322 deleted = false;
323 323
@@ -337,35 +337,35 @@ ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
337void ViewMail::readConfig() 337void ViewMail::readConfig()
338{ 338{
339 339
340 setFont ( KOPrefs::instance()->mReadFont ); 340 setFont ( KOPrefs::instance()->mReadFont );
341 m_showHtml = KOPrefs::instance()->mViewAsHtml; 341 m_showHtml = KOPrefs::instance()->mViewAsHtml;
342 showHtml->setOn( m_showHtml ); 342 showHtml->setOn( m_showHtml );
343} 343}
344 344
345void ViewMail::setText() 345void ViewMail::setText()
346{ 346{
347 347
348 QString toString; 348 QString toString;
349 QString ccString; 349 QString ccString;
350 QString bccString; 350 QString bccString;
351 351
352 352
353 toString = QString::fromUtf8(m_mail2[0].join(",").latin1()); 353 toString = m_mail2[0].join(",");
354 ccString = QString::fromUtf8(m_mail2[1].join(",").latin1()); 354 ccString = m_mail2[1].join(",");
355 bccString = QString::fromUtf8(m_mail2[2].join(",").latin1()); 355 bccString = m_mail2[2].join(",");
356 356
357 357
358 setCaption( i18n("E-Mail by %1").arg( m_mail[0] ) ); 358 setCaption( i18n("E-Mail by %1").arg( m_mail[0] ) );
359 359
360 m_mailHtml = "<html><body>" 360 m_mailHtml = "<html><body>"
361 "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>" 361 "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>"
362 "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>" 362 "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>"
363 "</td></tr><tr bgcolor=\"#EEEEE6\"><td>" 363 "</td></tr><tr bgcolor=\"#EEEEE6\"><td>"
364 "<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>"
365 "<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>" +
366 i18n( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>" 366 i18n( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>"
367 "<b>" + i18n( "Date" ) + ": </b> " + m_mail[3] + 367 "<b>" + i18n( "Date" ) + ": </b> " + m_mail[3] +
368 "</td></tr></table><font>"; 368 "</td></tr></table><font>";
369 369
370 if ( !m_showHtml ) 370 if ( !m_showHtml )
371 { 371 {
@@ -437,35 +437,35 @@ void ViewMail::slotReply()
437 QString text = m_mail[2]; 437 QString text = m_mail[2];
438 QStringList lines = QStringList::split(QRegExp("\\n"), text); 438 QStringList lines = QStringList::split(QRegExp("\\n"), text);
439 QStringList::Iterator it; 439 QStringList::Iterator it;
440 for (it = lines.begin(); it != lines.end(); it++) 440 for (it = lines.begin(); it != lines.end(); it++)
441 { 441 {
442 rtext += "> " + *it + "\n"; 442 rtext += "> " + *it + "\n";
443 } 443 }
444 rtext += "\n"; 444 rtext += "\n";
445 445
446 QString prefix; 446 QString prefix;
447 if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = ""; 447 if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = "";
448 else prefix = "Re: "; // no i18n on purpose 448 else prefix = "Re: "; // no i18n on purpose
449 449
450 Settings *settings = new Settings(); 450 Settings *settings = new Settings();
451 ComposeMail composer( settings ,this, 0, true); 451 ComposeMail composer( settings ,this, 0, true);
452 if (m_recMail->Replyto().isEmpty()) { 452 if (m_recMail->Replyto().isEmpty()) {
453 composer.setTo( QString::fromUtf8( m_recMail->getFrom().latin1())); 453 composer.setTo(m_recMail->getFrom());
454 } else { 454 } else {
455 composer.setTo( QString::fromUtf8( m_recMail->Replyto().latin1())); 455 composer.setTo(m_recMail->Replyto());
456 } 456 }
457 composer.setSubject( prefix + m_mail[1] ); 457 composer.setSubject( prefix + m_mail[1] );
458 composer.setMessage( rtext ); 458 composer.setMessage( rtext );
459 composer.setInReplyTo(m_recMail->Msgid()); 459 composer.setInReplyTo(m_recMail->Msgid());
460 460
461 if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) 461 if ( QDialog::Accepted == KApplication::execDialog( &composer ) )
462 { 462 {
463 m_recMail->Wrapper()->answeredMail(m_recMail); 463 m_recMail->Wrapper()->answeredMail(m_recMail);
464 } 464 }
465 delete settings; 465 delete settings;
466} 466}
467 467
468void ViewMail::slotForward() 468void ViewMail::slotForward()
469{ 469{
470 if (!m_gotBody) 470 if (!m_gotBody)
471 { 471 {