summaryrefslogtreecommitdiffabout
path: root/kmicromail/opiemail.cpp
Unidiff
Diffstat (limited to 'kmicromail/opiemail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/opiemail.cpp27
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
@@ -278,78 +278,105 @@ void OpieMail::replyMail()
278 rtext += "\n"; 278 rtext += "\n";
279 279
280 QString prefix; 280 QString prefix;
281 if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = ""; 281 if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = "";
282 else prefix = "Re: "; // no i18n on purpose 282 else prefix = "Re: "; // no i18n on purpose
283 283
284 Settings *settings = new Settings(); 284 Settings *settings = new Settings();
285 ComposeMail composer( settings ,this, 0, true); 285 ComposeMail composer( settings ,this, 0, true);
286 if (mail->Replyto().isEmpty()) { 286 if (mail->Replyto().isEmpty()) {
287 composer.setTo( mail->getFrom()); 287 composer.setTo( mail->getFrom());
288 } else { 288 } else {
289 composer.setTo( mail->Replyto()); 289 composer.setTo( mail->Replyto());
290 } 290 }
291 composer.setSubject( prefix + mail->getSubject()); 291 composer.setSubject( prefix + mail->getSubject());
292 composer.setMessage( rtext ); 292 composer.setMessage( rtext );
293 composer.setInReplyTo( mail->Msgid()); 293 composer.setInReplyTo( mail->Msgid());
294 composer.setCharset( body->getCharset() ); 294 composer.setCharset( body->getCharset() );
295 if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) 295 if ( QDialog::Accepted == KApplication::execDialog( &composer ) )
296 { 296 {
297 mail->Wrapper()->answeredMail(mail); 297 mail->Wrapper()->answeredMail(mail);
298 } 298 }
299 delete settings; 299 delete settings;
300 300
301} 301}
302void OpieMail::closeViewMail(ViewMail * vm)
303{
304 vm->hide();
305}
306void OpieMail::deleteAndDisplayNextMail(ViewMail * vm)
307{
308 QListViewItem*item = mailView->currentItem();
309 if (!item ) {
310 closeViewMail(vm);
311 return;
312 }
313 RecMailP mail = ((MailListViewItem*)item)->data();
314 mail->Wrapper()->deleteMail( mail );
315 item = item->itemBelow();
316 if (!item ) {
317 closeViewMail(vm);
318 return;
319 }
320 mailView->setCurrentItem(item);
321 mail = ((MailListViewItem*)item)->data();
322 RecBodyP body = folderView->fetchBody(mail);
323 vm->setBody( body );
324 vm->setMail( mail );
325}
302void OpieMail::displayNextMail(ViewMail * vm) 326void OpieMail::displayNextMail(ViewMail * vm)
303{ 327{
304 QListViewItem*item = mailView->currentItem(); 328 QListViewItem*item = mailView->currentItem();
305 if (!item) return; 329 if (!item) return;
330 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() );
306 item = item->itemBelow(); 331 item = item->itemBelow();
307 if (!item) { 332 if (!item) {
308 vm->setCaption(i18n("End of List" )); 333 vm->setCaption(i18n("End of List" ));
309 return; 334 return;
310 } 335 }
311 mailView->setCurrentItem(item); 336 mailView->setCurrentItem(item);
312 RecMailP mail = ((MailListViewItem*)item)->data(); 337 RecMailP mail = ((MailListViewItem*)item)->data();
313 RecBodyP body = folderView->fetchBody(mail); 338 RecBodyP body = folderView->fetchBody(mail);
314 vm->setBody( body ); 339 vm->setBody( body );
315 vm->setMail( mail ); 340 vm->setMail( mail );
316} 341}
317void OpieMail::displayMail() 342void OpieMail::displayMail()
318{ 343{
319 QListViewItem*item = mailView->currentItem(); 344 QListViewItem*item = mailView->currentItem();
320 if (!item) return; 345 if (!item) return;
321 RecMailP mail = ((MailListViewItem*)item)->data(); 346 RecMailP mail = ((MailListViewItem*)item)->data();
322 RecBodyP body = folderView->fetchBody(mail); 347 RecBodyP body = folderView->fetchBody(mail);
323 ViewMail readMail( this,"", Qt::WType_Modal ); 348 ViewMail readMail( this,"", Qt::WType_Modal );
324 readMail.setBody( body ); 349 readMail.setBody( body );
325 readMail.setMail( mail ); 350 readMail.setMail( mail );
326#ifndef DESKTOP_VERSION 351#ifndef DESKTOP_VERSION
327 readMail.showMaximized(); 352 readMail.showMaximized();
328#else 353#else
329 readMail.resize( 640, 480); 354 readMail.resize( 640, 480);
330#endif 355#endif
331 connect( &readMail,SIGNAL( showNextMail(ViewMail *) ), this, SLOT( displayNextMail(ViewMail *) ) ); 356 connect( &readMail,SIGNAL( showNextMail(ViewMail *) ), this, SLOT( displayNextMail(ViewMail *) ) );
357 connect( &readMail,SIGNAL( deleteAndDisplayNextMail(ViewMail *) ), this, SLOT(deleteAndDisplayNextMail(ViewMail *) ) );
358
332 readMail.exec(); 359 readMail.exec();
333 360
334 if ( readMail.deleted ) 361 if ( readMail.deleted )
335 { 362 {
336 folderView->refreshCurrent(); 363 folderView->refreshCurrent();
337 } 364 }
338 else 365 else
339 { 366 {
340 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); 367 ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() );
341 } 368 }
342} 369}
343void OpieMail::slotGetAllMail() 370void OpieMail::slotGetAllMail()
344{ 371{
345 QListViewItem * item = folderView->firstChild(); 372 QListViewItem * item = folderView->firstChild();
346 while ( item ){ 373 while ( item ){
347 ((AccountViewItem *)item)->contextMenuSelected( 101 ); 374 ((AccountViewItem *)item)->contextMenuSelected( 101 );
348 item = item->nextSibling (); 375 item = item->nextSibling ();
349 } 376 }
350} 377}
351void OpieMail::slotGetMail() 378void OpieMail::slotGetMail()
352{ 379{
353 QListViewItem * item = folderView->currentItem(); 380 QListViewItem * item = folderView->currentItem();
354 if ( ! item ) return; 381 if ( ! item ) return;
355 ((AccountViewItem *)item)->contextMenuSelected( 101 ); 382 ((AccountViewItem *)item)->contextMenuSelected( 101 );