author | zautrix <zautrix> | 2004-10-23 19:32:41 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-23 19:32:41 (UTC) |
commit | 94df6192e59b7d4c69e2fb43ef2c39db08bb1c39 (patch) (unidiff) | |
tree | 28956adbf73a61010d98deb27d83b324cb285471 /kmicromail/viewmail.cpp | |
parent | 52b6fc17c0dcd1f13f701f698e0305440f26fc3e (diff) | |
download | kdepimpi-94df6192e59b7d4c69e2fb43ef2c39db08bb1c39.zip kdepimpi-94df6192e59b7d4c69e2fb43ef2c39db08bb1c39.tar.gz kdepimpi-94df6192e59b7d4c69e2fb43ef2c39db08bb1c39.tar.bz2 |
compile fixes
-rw-r--r-- | kmicromail/viewmail.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp index 32a3b7c..7cf5c8e 100644 --- a/kmicromail/viewmail.cpp +++ b/kmicromail/viewmail.cpp | |||
@@ -13,32 +13,33 @@ | |||
13 | //#include <opie2/oimagescrollview.h> | 13 | //#include <opie2/oimagescrollview.h> |
14 | 14 | ||
15 | #include <kfiledialog.h> | 15 | #include <kfiledialog.h> |
16 | #include <kdialog.h> | 16 | #include <kdialog.h> |
17 | 17 | ||
18 | #include <qpe/qpeapplication.h> | 18 | #include <qpe/qpeapplication.h> |
19 | 19 | ||
20 | /* QT */ | 20 | /* QT */ |
21 | #include <qtextbrowser.h> | 21 | #include <qtextbrowser.h> |
22 | #include <qmessagebox.h> | 22 | #include <qmessagebox.h> |
23 | #include <qtextstream.h> | 23 | #include <qtextstream.h> |
24 | #include <qaction.h> | 24 | #include <qaction.h> |
25 | #include <qpopupmenu.h> | 25 | #include <qpopupmenu.h> |
26 | #include <qfile.h> | 26 | #include <qfile.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include "koprefs.h" | 28 | #include "koprefs.h" |
29 | #include <klocale.h> | ||
29 | 30 | ||
30 | //using namespace Opie::Ui; | 31 | //using namespace Opie::Ui; |
31 | //using namespace Opie::Core; | 32 | //using namespace Opie::Core; |
32 | 33 | ||
33 | AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, | 34 | AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, |
34 | const QString&fsize,int num,const QValueList<int>&path) | 35 | const QString&fsize,int num,const QValueList<int>&path) |
35 | : QListViewItem(parent,after),_partNum(num) | 36 | : QListViewItem(parent,after),_partNum(num) |
36 | { | 37 | { |
37 | _path=path; | 38 | _path=path; |
38 | setText(0, mime); | 39 | setText(0, mime); |
39 | setText(1, desc); | 40 | setText(1, desc); |
40 | setText(2, file); | 41 | setText(2, file); |
41 | setText(3, fsize); | 42 | setText(3, fsize); |
42 | } | 43 | } |
43 | 44 | ||
44 | AttachItem::AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, | 45 | AttachItem::AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, |
@@ -205,38 +206,38 @@ void ViewMail::slotShowHtml( bool state ) | |||
205 | 206 | ||
206 | void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) | 207 | void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) |
207 | { | 208 | { |
208 | if (!item ) | 209 | if (!item ) |
209 | return; | 210 | return; |
210 | 211 | ||
211 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) | 212 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) |
212 | { | 213 | { |
213 | setText(); | 214 | setText(); |
214 | return; | 215 | return; |
215 | } | 216 | } |
216 | QPopupMenu *menu = new QPopupMenu(); | 217 | QPopupMenu *menu = new QPopupMenu(); |
217 | int ret=0; | 218 | int ret=0; |
218 | 219 | ||
219 | if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" ) | 220 | if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" ) |
220 | { | 221 | { |
221 | menu->insertItem( tr( "Show Text" ), 1 ); | 222 | menu->insertItem( i18n( "Show Text" ), 1 ); |
222 | } | 223 | } |
223 | if (item->text(0).left(6)=="image/") { | 224 | if (item->text(0).left(6)=="image/") { |
224 | menu->insertItem(tr("Display image preview"),2); | 225 | menu->insertItem(i18n("Display image preview"),2); |
225 | } | 226 | } |
226 | menu->insertItem( tr( "Save Attachment" ), 0 ); | 227 | menu->insertItem( i18n( "Save Attachment" ), 0 ); |
227 | menu->insertSeparator(1); | 228 | menu->insertSeparator(1); |
228 | 229 | ||
229 | ret = menu->exec( point, 0 ); | 230 | ret = menu->exec( point, 0 ); |
230 | 231 | ||
231 | switch(ret) | 232 | switch(ret) |
232 | { | 233 | { |
233 | case 0: | 234 | case 0: |
234 | { | 235 | { |
235 | //MimeTypes types; | 236 | //MimeTypes types; |
236 | //types.insert( "all", "*" ); | 237 | //types.insert( "all", "*" ); |
237 | QString str = KFileDialog::getSaveFileName( "/", item->text( 2 ), this ); | 238 | QString str = KFileDialog::getSaveFileName( "/", item->text( 2 ), this ); |
238 | 239 | ||
239 | if( !str.isEmpty() ) | 240 | if( !str.isEmpty() ) |
240 | { | 241 | { |
241 | encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); | 242 | encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); |
242 | if (content) | 243 | if (content) |
@@ -343,42 +344,42 @@ void ViewMail::setText() | |||
343 | QString ccString; | 344 | QString ccString; |
344 | QString bccString; | 345 | QString bccString; |
345 | 346 | ||
346 | for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) | 347 | for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) |
347 | { | 348 | { |
348 | toString += (*it); | 349 | toString += (*it); |
349 | } | 350 | } |
350 | for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it ) | 351 | for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it ) |
351 | { | 352 | { |
352 | ccString += (*it); | 353 | ccString += (*it); |
353 | } | 354 | } |
354 | for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) | 355 | for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) |
355 | { | 356 | { |
356 | bccString += (*it); | 357 | bccString += (*it); |
357 | } | 358 | } |
358 | 359 | ||
359 | setCaption( tr("E-Mail by %1").arg( m_mail[0] ) ); | 360 | setCaption( i18n("E-Mail by %1").arg( m_mail[0] ) ); |
360 | 361 | ||
361 | m_mailHtml = "<html><body>" | 362 | m_mailHtml = "<html><body>" |
362 | "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>" | 363 | "<table width=\"100%\" border=\"0\"><tr bgcolor=\"#FFDD76\"><td>" |
363 | "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>" | 364 | "<div align=left><b>" + deHtml( m_mail[1] ) + "</b></div>" |
364 | "</td></tr><tr bgcolor=\"#EEEEE6\"><td>" | 365 | "</td></tr><tr bgcolor=\"#EEEEE6\"><td>" |
365 | "<b>" + tr( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>" | 366 | "<b>" + i18n( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>" |
366 | "<b>" + tr( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" + | 367 | "<b>" + i18n( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" + |
367 | tr( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>" | 368 | i18n( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>" |
368 | "<b>" + tr( "Date" ) + ": </b> " + m_mail[3] + | 369 | "<b>" + i18n( "Date" ) + ": </b> " + m_mail[3] + |
369 | "</td></tr></table><font>"; | 370 | "</td></tr></table><font>"; |
370 | 371 | ||
371 | if ( !m_showHtml ) | 372 | if ( !m_showHtml ) |
372 | { | 373 | { |
373 | browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" ); | 374 | browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" ); |
374 | } | 375 | } |
375 | else | 376 | else |
376 | { | 377 | { |
377 | browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" ); | 378 | browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" ); |
378 | } | 379 | } |
379 | // remove later in favor of a real handling | 380 | // remove later in favor of a real handling |
380 | m_gotBody = true; | 381 | m_gotBody = true; |
381 | } | 382 | } |
382 | 383 | ||
383 | 384 | ||
384 | ViewMail::~ViewMail() | 385 | ViewMail::~ViewMail() |
@@ -413,33 +414,33 @@ void ViewMail::exec() | |||
413 | } | 414 | } |
414 | 415 | ||
415 | QString ViewMail::deHtml(const QString &string) | 416 | QString ViewMail::deHtml(const QString &string) |
416 | { | 417 | { |
417 | QString string_ = string; | 418 | QString string_ = string; |
418 | string_.replace(QRegExp("&"), "&"); | 419 | string_.replace(QRegExp("&"), "&"); |
419 | string_.replace(QRegExp("<"), "<"); | 420 | string_.replace(QRegExp("<"), "<"); |
420 | string_.replace(QRegExp(">"), ">"); | 421 | string_.replace(QRegExp(">"), ">"); |
421 | string_.replace(QRegExp("\\n"), "<br>"); | 422 | string_.replace(QRegExp("\\n"), "<br>"); |
422 | return string_; | 423 | return string_; |
423 | } | 424 | } |
424 | 425 | ||
425 | void ViewMail::slotReply() | 426 | void ViewMail::slotReply() |
426 | { | 427 | { |
427 | if (!m_gotBody) | 428 | if (!m_gotBody) |
428 | { | 429 | { |
429 | QMessageBox::information(this, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot reply yet."), tr("Ok")); | 430 | QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot reply yet."), i18n("Ok")); |
430 | return; | 431 | return; |
431 | } | 432 | } |
432 | 433 | ||
433 | QString rtext; | 434 | QString rtext; |
434 | rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose | 435 | rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose |
435 | .arg( m_mail[0] ) | 436 | .arg( m_mail[0] ) |
436 | .arg( m_mail[3] ); | 437 | .arg( m_mail[3] ); |
437 | 438 | ||
438 | QString text = m_mail[2]; | 439 | QString text = m_mail[2]; |
439 | QStringList lines = QStringList::split(QRegExp("\\n"), text); | 440 | QStringList lines = QStringList::split(QRegExp("\\n"), text); |
440 | QStringList::Iterator it; | 441 | QStringList::Iterator it; |
441 | for (it = lines.begin(); it != lines.end(); it++) | 442 | for (it = lines.begin(); it != lines.end(); it++) |
442 | { | 443 | { |
443 | rtext += "> " + *it + "\n"; | 444 | rtext += "> " + *it + "\n"; |
444 | } | 445 | } |
445 | rtext += "\n"; | 446 | rtext += "\n"; |
@@ -456,66 +457,66 @@ void ViewMail::slotReply() | |||
456 | composer.setTo( m_recMail->Replyto()); | 457 | composer.setTo( m_recMail->Replyto()); |
457 | } | 458 | } |
458 | composer.setSubject( prefix + m_mail[1] ); | 459 | composer.setSubject( prefix + m_mail[1] ); |
459 | composer.setMessage( rtext ); | 460 | composer.setMessage( rtext ); |
460 | composer.setInReplyTo(m_recMail->Msgid()); | 461 | composer.setInReplyTo(m_recMail->Msgid()); |
461 | 462 | ||
462 | if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) | 463 | if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) |
463 | { | 464 | { |
464 | m_recMail->Wrapper()->answeredMail(m_recMail); | 465 | m_recMail->Wrapper()->answeredMail(m_recMail); |
465 | } | 466 | } |
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, tr("Error"), tr("<p>The mail body is not yet downloaded, so you cannot forward yet."), tr("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, tr("Delete Mail"), QString( tr("<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 | : KDialog(parent,name,modal) | 515 | : KDialog(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 | } |