-rw-r--r-- | kmicromail/opiemail.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index ec192ea..915b3e8 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp @@ -286,62 +286,89 @@ void OpieMail::replyMail() if (mail->Replyto().isEmpty()) { composer.setTo( mail->getFrom()); } else { composer.setTo( mail->Replyto()); } composer.setSubject( prefix + mail->getSubject()); composer.setMessage( rtext ); composer.setInReplyTo( mail->Msgid()); composer.setCharset( body->getCharset() ); if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) { mail->Wrapper()->answeredMail(mail); } delete settings; } +void OpieMail::closeViewMail(ViewMail * vm) +{ + vm->hide(); +} +void OpieMail::deleteAndDisplayNextMail(ViewMail * vm) +{ + QListViewItem*item = mailView->currentItem(); + if (!item ) { + closeViewMail(vm); + return; + } + RecMailP mail = ((MailListViewItem*)item)->data(); + mail->Wrapper()->deleteMail( mail ); + item = item->itemBelow(); + if (!item ) { + closeViewMail(vm); + return; + } + mailView->setCurrentItem(item); + mail = ((MailListViewItem*)item)->data(); + RecBodyP body = folderView->fetchBody(mail); + vm->setBody( body ); + vm->setMail( mail ); +} void OpieMail::displayNextMail(ViewMail * vm) { QListViewItem*item = mailView->currentItem(); if (!item) return; + ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); item = item->itemBelow(); if (!item) { vm->setCaption(i18n("End of List" )); return; } mailView->setCurrentItem(item); RecMailP mail = ((MailListViewItem*)item)->data(); RecBodyP body = folderView->fetchBody(mail); vm->setBody( body ); vm->setMail( mail ); } void OpieMail::displayMail() { QListViewItem*item = mailView->currentItem(); if (!item) return; RecMailP mail = ((MailListViewItem*)item)->data(); RecBodyP body = folderView->fetchBody(mail); ViewMail readMail( this,"", Qt::WType_Modal ); readMail.setBody( body ); readMail.setMail( mail ); #ifndef DESKTOP_VERSION readMail.showMaximized(); #else readMail.resize( 640, 480); #endif connect( &readMail,SIGNAL( showNextMail(ViewMail *) ), this, SLOT( displayNextMail(ViewMail *) ) ); + connect( &readMail,SIGNAL( deleteAndDisplayNextMail(ViewMail *) ), this, SLOT(deleteAndDisplayNextMail(ViewMail *) ) ); + readMail.exec(); if ( readMail.deleted ) { folderView->refreshCurrent(); } else { ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); } } void OpieMail::slotGetAllMail() { QListViewItem * item = folderView->firstChild(); while ( item ){ ((AccountViewItem *)item)->contextMenuSelected( 101 ); |