author | zautrix <zautrix> | 2004-11-07 10:11:25 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-11-07 10:11:25 (UTC) |
commit | b6ef669713ee1d52adcfc9754dd039a4ff6675da (patch) (unidiff) | |
tree | eac59d1b135cbf87e0b9aca21213115331995203 /kmicromail/viewmail.cpp | |
parent | dcb3a171bca38934185de67e378956e6fd044f17 (diff) | |
download | kdepimpi-b6ef669713ee1d52adcfc9754dd039a4ff6675da.zip kdepimpi-b6ef669713ee1d52adcfc9754dd039a4ff6675da.tar.gz kdepimpi-b6ef669713ee1d52adcfc9754dd039a4ff6675da.tar.bz2 |
encoding fixes
-rw-r--r-- | kmicromail/viewmail.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp index 4883231..3bd6f41 100644 --- a/kmicromail/viewmail.cpp +++ b/kmicromail/viewmail.cpp | |||
@@ -332,200 +332,201 @@ ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) | |||
332 | 332 | ||
333 | readConfig(); | 333 | readConfig(); |
334 | attachments->setSorting(-1); | 334 | attachments->setSorting(-1); |
335 | } | 335 | } |
336 | 336 | ||
337 | void ViewMail::readConfig() | 337 | void 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 | ||
345 | void ViewMail::setText() | 345 | void 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 = m_mail2[0].join(","); | 353 | toString = m_mail2[0].join(","); |
354 | ccString = m_mail2[1].join(","); | 354 | ccString = m_mail2[1].join(","); |
355 | bccString = m_mail2[2].join(","); | 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 | { |
372 | browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" ); | 372 | browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" ); |
373 | } | 373 | } |
374 | else | 374 | else |
375 | { | 375 | { |
376 | browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" ); | 376 | browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" ); |
377 | } | 377 | } |
378 | // remove later in favor of a real handling | 378 | // remove later in favor of a real handling |
379 | m_gotBody = true; | 379 | m_gotBody = true; |
380 | } | 380 | } |
381 | 381 | ||
382 | 382 | ||
383 | ViewMail::~ViewMail() | 383 | ViewMail::~ViewMail() |
384 | { | 384 | { |
385 | m_recMail->Wrapper()->cleanMimeCache(); | 385 | m_recMail->Wrapper()->cleanMimeCache(); |
386 | hide(); | 386 | hide(); |
387 | } | 387 | } |
388 | 388 | ||
389 | void ViewMail::hide() | 389 | void ViewMail::hide() |
390 | { | 390 | { |
391 | QWidget::hide(); | 391 | QWidget::hide(); |
392 | 392 | ||
393 | if (_inLoop) | 393 | if (_inLoop) |
394 | { | 394 | { |
395 | _inLoop = false; | 395 | _inLoop = false; |
396 | qApp->exit_loop(); | 396 | qApp->exit_loop(); |
397 | 397 | ||
398 | } | 398 | } |
399 | 399 | ||
400 | } | 400 | } |
401 | 401 | ||
402 | void ViewMail::exec() | 402 | void ViewMail::exec() |
403 | { | 403 | { |
404 | show(); | 404 | show(); |
405 | 405 | ||
406 | if (!_inLoop) | 406 | if (!_inLoop) |
407 | { | 407 | { |
408 | _inLoop = true; | 408 | _inLoop = true; |
409 | qApp->enter_loop(); | 409 | qApp->enter_loop(); |
410 | } | 410 | } |
411 | 411 | ||
412 | } | 412 | } |
413 | 413 | ||
414 | QString ViewMail::deHtml(const QString &string) | 414 | QString ViewMail::deHtml(const QString &string) |
415 | { | 415 | { |
416 | QString string_ = string; | 416 | QString string_ = string; |
417 | string_.replace(QRegExp("&"), "&"); | 417 | string_.replace(QRegExp("&"), "&"); |
418 | string_.replace(QRegExp("<"), "<"); | 418 | string_.replace(QRegExp("<"), "<"); |
419 | string_.replace(QRegExp(">"), ">"); | 419 | string_.replace(QRegExp(">"), ">"); |
420 | string_.replace(QRegExp("\\n"), "<br>"); | 420 | string_.replace(QRegExp("\\n"), "<br>"); |
421 | return string_; | 421 | return string_; |
422 | } | 422 | } |
423 | 423 | ||
424 | void ViewMail::slotReply() | 424 | void ViewMail::slotReply() |
425 | { | 425 | { |
426 | if (!m_gotBody) | 426 | if (!m_gotBody) |
427 | { | 427 | { |
428 | QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot reply yet."), i18n("Ok")); | 428 | QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot reply yet."), i18n("Ok")); |
429 | return; | 429 | return; |
430 | } | 430 | } |
431 | 431 | ||
432 | QString rtext; | 432 | QString rtext; |
433 | rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose | 433 | rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose |
434 | .arg( m_mail[0] ) | 434 | .arg( m_mail[0] ) |
435 | .arg( m_mail[3] ); | 435 | .arg( m_mail[3] ); |
436 | 436 | ||
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(m_recMail->getFrom()); | 453 | composer.setTo(m_recMail->getFrom()); |
454 | } else { | 454 | } else { |
455 | composer.setTo(m_recMail->Replyto()); | 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 | composer.setCharset( m_body->getCharset() ); | ||
460 | 461 | ||
461 | if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) | 462 | if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) |
462 | { | 463 | { |
463 | m_recMail->Wrapper()->answeredMail(m_recMail); | 464 | m_recMail->Wrapper()->answeredMail(m_recMail); |
464 | } | 465 | } |
465 | delete settings; | 466 | delete settings; |
466 | } | 467 | } |
467 | 468 | ||
468 | void ViewMail::slotForward() | 469 | void ViewMail::slotForward() |
469 | { | 470 | { |
470 | if (!m_gotBody) | 471 | if (!m_gotBody) |
471 | { | 472 | { |
472 | QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot forward yet."), i18n("Ok")); | 473 | QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot forward yet."), i18n("Ok")); |
473 | return; | 474 | return; |
474 | } | 475 | } |
475 | 476 | ||
476 | QString ftext; | 477 | QString ftext; |
477 | ftext += QString("\n----- Forwarded message from %1 -----\n\n") | 478 | ftext += QString("\n----- Forwarded message from %1 -----\n\n") |
478 | .arg( m_mail[0] ); | 479 | .arg( m_mail[0] ); |
479 | if (!m_mail[3].isNull()) | 480 | if (!m_mail[3].isNull()) |
480 | ftext += QString("Date: %1\n") | 481 | ftext += QString("Date: %1\n") |
481 | .arg( m_mail[3] ); | 482 | .arg( m_mail[3] ); |
482 | if (!m_mail[0].isNull()) | 483 | if (!m_mail[0].isNull()) |
483 | ftext += QString("From: %1\n") | 484 | ftext += QString("From: %1\n") |
484 | .arg( m_mail[0] ); | 485 | .arg( m_mail[0] ); |
485 | if (!m_mail[1].isNull()) | 486 | if (!m_mail[1].isNull()) |
486 | ftext += QString("Subject: %1\n") | 487 | ftext += QString("Subject: %1\n") |
487 | .arg( m_mail[1] ); | 488 | .arg( m_mail[1] ); |
488 | 489 | ||
489 | ftext += QString("\n%1\n") | 490 | ftext += QString("\n%1\n") |
490 | .arg( m_mail[2]); | 491 | .arg( m_mail[2]); |
491 | 492 | ||
492 | ftext += QString("----- End forwarded message -----\n"); | 493 | ftext += QString("----- End forwarded message -----\n"); |
493 | 494 | ||
494 | Settings *settings = new Settings(); | 495 | Settings *settings = new Settings(); |
495 | ComposeMail composer( settings ,this, 0, true); | 496 | ComposeMail composer( settings ,this, 0, true); |
496 | composer.setSubject( "Fwd: " + m_mail[1] ); | 497 | composer.setSubject( "Fwd: " + m_mail[1] ); |
497 | composer.setMessage( ftext ); | 498 | composer.setMessage( ftext ); |
498 | if ( QDialog::Accepted == KApplication::execDialog( &composer )) | 499 | if ( QDialog::Accepted == KApplication::execDialog( &composer )) |
499 | { | 500 | { |
500 | } | 501 | } |
501 | } | 502 | } |
502 | 503 | ||
503 | void ViewMail::slotDeleteMail( ) | 504 | void ViewMail::slotDeleteMail( ) |
504 | { | 505 | { |
505 | 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 ) | 506 | 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 ) |
506 | { | 507 | { |
507 | m_recMail->Wrapper()->deleteMail( m_recMail ); | 508 | m_recMail->Wrapper()->deleteMail( m_recMail ); |
508 | hide(); | 509 | hide(); |
509 | deleted = true; | 510 | deleted = true; |
510 | } | 511 | } |
511 | } | 512 | } |
512 | 513 | ||
513 | MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, WFlags f) | 514 | MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, WFlags f) |
514 | : QDialog(parent,name,modal) | 515 | : QDialog(parent,name,modal) |
515 | { | 516 | { |
516 | QVBoxLayout*dlglayout = new QVBoxLayout(this); | 517 | QVBoxLayout*dlglayout = new QVBoxLayout(this); |
517 | dlglayout->setSpacing(2); | 518 | dlglayout->setSpacing(2); |
518 | dlglayout->setMargin(1); | 519 | dlglayout->setMargin(1); |
519 | //m_imageview = new Opie::MM::OImageScrollView(this); | 520 | //m_imageview = new Opie::MM::OImageScrollView(this); |
520 | //dlglayout->addWidget(m_imageview); | 521 | //dlglayout->addWidget(m_imageview); |
521 | } | 522 | } |
522 | 523 | ||
523 | MailImageDlg::~MailImageDlg() | 524 | MailImageDlg::~MailImageDlg() |
524 | { | 525 | { |
525 | } | 526 | } |
526 | 527 | ||
527 | void MailImageDlg::setName(const QString&fname) | 528 | void MailImageDlg::setName(const QString&fname) |
528 | { | 529 | { |
529 | qDebug("viewmail.cpp: MailImageDlg::setName Pending"); | 530 | qDebug("viewmail.cpp: MailImageDlg::setName Pending"); |
530 | // m_imageview->setImage(fname); | 531 | // m_imageview->setImage(fname); |
531 | } | 532 | } |