-rw-r--r-- | kmicromail/composemail.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp index 2dcbc75..f44100b 100644 --- a/kmicromail/composemail.cpp +++ b/kmicromail/composemail.cpp | |||
@@ -358,146 +358,146 @@ void ComposeMail::slotAdjustColumns() | |||
358 | 358 | ||
359 | tabWidget->showPage( attachTab ); | 359 | tabWidget->showPage( attachTab ); |
360 | attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); | 360 | attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); |
361 | attList->setColumnWidth( 1, 80 ); | 361 | attList->setColumnWidth( 1, 80 ); |
362 | 362 | ||
363 | tabWidget->setCurrentPage( currPage ); | 363 | tabWidget->setCurrentPage( currPage ); |
364 | } | 364 | } |
365 | 365 | ||
366 | void ComposeMail::addAttachment() | 366 | void ComposeMail::addAttachment() |
367 | { | 367 | { |
368 | QString lnk = KFileDialog::getOpenFileName( "", "Add Attachment", this ); | 368 | QString lnk = KFileDialog::getOpenFileName( "", "Add Attachment", this ); |
369 | if ( !lnk.isEmpty() ) { | 369 | if ( !lnk.isEmpty() ) { |
370 | Attachment *att = new Attachment( lnk ); | 370 | Attachment *att = new Attachment( lnk ); |
371 | (void) new AttachViewItem( attList, att ); | 371 | (void) new AttachViewItem( attList, att ); |
372 | } | 372 | } |
373 | } | 373 | } |
374 | 374 | ||
375 | void ComposeMail::removeAttachment() | 375 | void ComposeMail::removeAttachment() |
376 | { | 376 | { |
377 | if ( !attList->currentItem() ) { | 377 | if ( !attList->currentItem() ) { |
378 | QMessageBox::information( this, i18n( "Error" ), | 378 | QMessageBox::information( this, i18n( "Error" ), |
379 | i18n( "<p>Please select a File.</p>" ), | 379 | i18n( "<p>Please select a File.</p>" ), |
380 | i18n( "Ok" ) ); | 380 | i18n( "Ok" ) ); |
381 | } else { | 381 | } else { |
382 | attList->takeItem( attList->currentItem() ); | 382 | attList->takeItem( attList->currentItem() ); |
383 | } | 383 | } |
384 | } | 384 | } |
385 | 385 | ||
386 | void ComposeMail::accept() | 386 | void ComposeMail::accept() |
387 | { | 387 | { |
388 | if ( smtpAccountBox->count() == 0 ) { | 388 | if ( smtpAccountBox->count() == 0 ) { |
389 | 389 | ||
390 | reject(); | 390 | reject(); |
391 | return; | 391 | return; |
392 | } | 392 | } |
393 | 393 | ||
394 | if (! checkBoxLater->isChecked() ) { | 394 | if (! checkBoxLater->isChecked() ) { |
395 | int yesno = QMessageBox::warning(0,i18n("Stop editing message"), | 395 | int yesno = QMessageBox::warning(0,i18n("Stop editing message"), |
396 | i18n("Send this message?"), | 396 | i18n("Send this message?"), |
397 | i18n("Yes"), | 397 | i18n("Yes"), |
398 | i18n("Cancel")); | 398 | i18n("Cancel")); |
399 | 399 | ||
400 | if (yesno == 1) { | 400 | if (yesno == 1) { |
401 | return; | 401 | return; |
402 | } | 402 | } |
403 | } | 403 | } |
404 | #if 0 | 404 | #if 0 |
405 | odebug << "Sending Mail with " | 405 | odebug << "Sending Mail with " |
406 | << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl; | 406 | << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl; |
407 | #endif | 407 | #endif |
408 | Opie::Core::OSmartPointer<Mail> mail=new Mail; | 408 | Opie::Core::OSmartPointer<Mail> mail=new Mail; |
409 | 409 | ||
410 | SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); | 410 | SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); |
411 | mail->setMail(fromBox->currentText().utf8 ()); | 411 | mail->setMail(fromBox->currentText().utf8 ()); |
412 | 412 | ||
413 | if ( !toLine->text().isEmpty() ) { | 413 | if ( !toLine->text().isEmpty() ) { |
414 | mail->setTo( toLine->text().utf8 () ); | 414 | mail->setTo( toLine->text().utf8 () ); |
415 | } else { | 415 | } else { |
416 | QMessageBox::warning(0,i18n("Sending mail"), | 416 | QMessageBox::warning(0,i18n("Sending mail"), |
417 | i18n("No Receiver spezified" ) ); | 417 | i18n("No Receiver spezified" ) ); |
418 | return; | 418 | return; |
419 | } | 419 | } |
420 | 420 | ||
421 | mail->setName(senderNameEdit->text().utf8 ()); | 421 | mail->setName(senderNameEdit->text().utf8 ()); |
422 | mail->setCC( ccLine->text().utf8 () ); | 422 | mail->setCC( ccLine->text().utf8 () ); |
423 | mail->setBCC( bccLine->text().utf8 () ); | 423 | mail->setBCC( bccLine->text().utf8 () ); |
424 | mail->setReply( replyLine->text().utf8 () ); | 424 | mail->setReply( replyLine->text().utf8 () ); |
425 | mail->setSubject( subjectLine->text().utf8 () ); | 425 | mail->setSubject( subjectLine->text().utf8 () ); |
426 | if (!m_replyid.isEmpty()) { | 426 | if (!m_replyid.isEmpty()) { |
427 | QStringList ids; | 427 | QStringList ids; |
428 | ids.append(m_replyid.utf8 ()); | 428 | ids.append(m_replyid.utf8 ()); |
429 | mail->setInreply(ids); | 429 | mail->setInreply(ids); |
430 | } | 430 | } |
431 | QString txt = message->text().utf8 (); | 431 | QString txt = message->text().utf8 (); |
432 | if ( !sigMultiLine->text().isEmpty() ) { | 432 | if ( !sigMultiLine->text().isEmpty() ) { |
433 | txt.append( "\n--\n" ); | 433 | txt.append( "\n--\n" ); |
434 | txt.append( sigMultiLine->text().utf8 () ); | 434 | txt.append( sigMultiLine->text().utf8 () ); |
435 | } | 435 | } |
436 | mail->setMessage( txt ); | 436 | mail->setMessage( txt ); |
437 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); | 437 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); |
438 | while ( it != 0 ) { | 438 | while ( it != 0 ) { |
439 | mail->addAttachment( it->getAttachment() ); | 439 | mail->addAttachment( it->getAttachment() ); |
440 | it = (AttachViewItem *) it->nextSibling(); | 440 | it = (AttachViewItem *) it->nextSibling(); |
441 | } | 441 | } |
442 | 442 | ||
443 | SMTPwrapper wrapper( smtp ); | 443 | SMTPwrapper wrapper( smtp ); |
444 | if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) ) | 444 | if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) ) |
445 | setStatus( tr ("Mail sent")); | 445 | setStatus( tr ("Mail sent")); |
446 | else { | 446 | else { |
447 | setStatus( tr ("Error: Something went wrong. Nothing sent")); | 447 | setStatus( tr ("Error: Something went wrong. Nothing sent")); |
448 | return; | 448 | return; |
449 | } | 449 | } |
450 | 450 | ||
451 | 451 | ||
452 | QDialog::accept(); | 452 | QDialog::accept(); |
453 | } | 453 | } |
454 | 454 | ||
455 | void ComposeMail::reject() | 455 | void ComposeMail::reject() |
456 | { | 456 | { |
457 | //qDebug("ComposeMail::reject() "); | 457 | //qDebug("ComposeMail::reject() "); |
458 | int yesno = QMessageBox::warning(0,i18n("Store message?"), | 458 | int yesno = QMessageBox::warning(0,i18n("Store message?"), |
459 | i18n("Store message into drafts?\n"), | 459 | i18n("Store message into drafts?\n"), |
460 | i18n("Yes"), | 460 | i18n("Yes"), |
461 | i18n("No")); | 461 | i18n("No")); |
462 | 462 | ||
463 | //qDebug("button %d ", yesno); | 463 | //qDebug("button %d ", yesno); |
464 | if (yesno == 0) { | 464 | if (yesno == 0) { |
465 | if ( toLine->text().isEmpty() ) { | 465 | if ( toLine->text().isEmpty() ) { |
466 | QMessageBox::warning(0,i18n("Sending mail"), | 466 | QMessageBox::warning(0,i18n("Sending mail"), |
467 | i18n("No Receiver spezified" ) ); | 467 | i18n("No Receiver spezified" ) ); |
468 | return; | 468 | return; |
469 | } | 469 | } |
470 | saveAsDraft(); | 470 | saveAsDraft(); |
471 | } | 471 | } |
472 | if (yesno == 2) { | 472 | if (yesno == 2) { |
473 | qDebug("return "); | 473 | qDebug("return "); |
474 | return; | 474 | return; |
475 | } | 475 | } |
476 | QDialog::reject(); | 476 | QDialog::reject(); |
477 | } | 477 | } |
478 | 478 | ||
479 | ComposeMail::~ComposeMail() | 479 | ComposeMail::~ComposeMail() |
480 | { | 480 | { |
481 | } | 481 | } |
482 | 482 | ||
483 | void ComposeMail::reEditMail(const RecMailP¤t) | 483 | void ComposeMail::reEditMail(const RecMailP¤t) |
484 | { | 484 | { |
485 | RecMailP data = current; | 485 | RecMailP data = current; |
486 | message->setText(QString::fromUtf8( data->Wrapper()->fetchBody(current)->Bodytext().latin1() )); | 486 | message->setText(data->Wrapper()->fetchBody(current)->Bodytext()); |
487 | subjectLine->setText( QString::fromUtf8( data->getSubject().latin1() )); | 487 | subjectLine->setText( data->getSubject()); |
488 | toLine->setText(QString::fromUtf8( data->To().join(",").latin1() )); | 488 | toLine->setText(data->To().join(",")); |
489 | ccLine->setText(QString::fromUtf8( data->CC().join(",").latin1() )); | 489 | ccLine->setText(data->CC().join(",")); |
490 | bccLine->setText(QString::fromUtf8( data->Bcc().join(",").latin1() )); | 490 | bccLine->setText(data->Bcc().join(",")); |
491 | replyLine->setText(QString::fromUtf8( data->Replyto().latin1() )); | 491 | replyLine->setText(data->Replyto()); |
492 | } | 492 | } |
493 | 493 | ||
494 | AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) | 494 | AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) |
495 | : QListViewItem( parent ) | 495 | : QListViewItem( parent ) |
496 | { | 496 | { |
497 | attachment = att; | 497 | attachment = att; |
498 | if ( !attachment->getPixmap().isNull() ) | 498 | if ( !attachment->getPixmap().isNull() ) |
499 | setPixmap( 0,attachment->getPixmap() ); | 499 | setPixmap( 0,attachment->getPixmap() ); |
500 | setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); | 500 | setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); |
501 | setText( 1, QString::number( att->getSize() ) ); | 501 | setText( 1, QString::number( att->getSize() ) ); |
502 | } | 502 | } |
503 | 503 | ||