-rw-r--r-- | kmicromail/opiemail.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index 68f0eb3..f56711d 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp | |||
@@ -402,199 +402,200 @@ void OpieMail::displayMail() | |||
402 | readMail.showMaximized(); | 402 | readMail.showMaximized(); |
403 | #else | 403 | #else |
404 | readMail.resize( 640, 480); | 404 | readMail.resize( 640, 480); |
405 | #endif | 405 | #endif |
406 | connect( &readMail,SIGNAL( showNextMail(ViewMail *) ), this, SLOT( displayNextMail(ViewMail *) ) ); | 406 | connect( &readMail,SIGNAL( showNextMail(ViewMail *) ), this, SLOT( displayNextMail(ViewMail *) ) ); |
407 | connect( &readMail,SIGNAL( deleteAndDisplayNextMail(ViewMail *) ), this, SLOT(deleteAndDisplayNextMail(ViewMail *) ) ); | 407 | connect( &readMail,SIGNAL( deleteAndDisplayNextMail(ViewMail *) ), this, SLOT(deleteAndDisplayNextMail(ViewMail *) ) ); |
408 | connect( &readMail,SIGNAL( signalDownloadMail() ), this, SLOT( slotDownloadMail() ) ); | 408 | connect( &readMail,SIGNAL( signalDownloadMail() ), this, SLOT( slotDownloadMail() ) ); |
409 | 409 | ||
410 | readMail.exec(); | 410 | readMail.exec(); |
411 | 411 | ||
412 | if ( readMail.deleted ) | 412 | if ( readMail.deleted ) |
413 | { | 413 | { |
414 | folderView->refreshCurrent(); | 414 | folderView->refreshCurrent(); |
415 | } | 415 | } |
416 | else | 416 | else |
417 | { | 417 | { |
418 | QListViewItem*item = mailView->currentItem(); | 418 | QListViewItem*item = mailView->currentItem(); |
419 | if (item) | 419 | if (item) |
420 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); | 420 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); |
421 | } | 421 | } |
422 | } | 422 | } |
423 | void OpieMail::slotGetAllMail() | 423 | void OpieMail::slotGetAllMail() |
424 | { | 424 | { |
425 | QListViewItem * item = folderView->firstChild(); | 425 | QListViewItem * item = folderView->firstChild(); |
426 | while ( item ){ | 426 | while ( item ){ |
427 | ((AccountViewItem *)item)->contextMenuSelected( 101 ); | 427 | ((AccountViewItem *)item)->contextMenuSelected( 101 ); |
428 | item = item->nextSibling (); | 428 | item = item->nextSibling (); |
429 | } | 429 | } |
430 | } | 430 | } |
431 | void OpieMail::slotGetMail() | 431 | void OpieMail::slotGetMail() |
432 | { | 432 | { |
433 | QListViewItem * item = folderView->currentItem(); | 433 | QListViewItem * item = folderView->currentItem(); |
434 | if ( ! item ) return; | 434 | if ( ! item ) return; |
435 | ((AccountViewItem *)item)->contextMenuSelected( 101 ); | 435 | ((AccountViewItem *)item)->contextMenuSelected( 101 ); |
436 | } | 436 | } |
437 | void OpieMail::slotDeleteMail() | 437 | void OpieMail::slotDeleteMail() |
438 | { | 438 | { |
439 | if (!mailView->currentItem()) return; | 439 | if (!mailView->currentItem()) return; |
440 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 440 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
441 | if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 441 | if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
442 | { | 442 | { |
443 | mail->Wrapper()->deleteMail( mail ); | 443 | mail->Wrapper()->deleteMail( mail ); |
444 | folderView->refreshCurrent(); | 444 | folderView->refreshCurrent(); |
445 | } | 445 | } |
446 | } | 446 | } |
447 | void OpieMail::slotDeleteAllMail() | 447 | void OpieMail::slotDeleteAllMail() |
448 | { | 448 | { |
449 | 449 | ||
450 | QValueList<RecMailP> t; | 450 | QValueList<RecMailP> t; |
451 | if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 451 | if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
452 | { | 452 | { |
453 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); | 453 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); |
454 | while ( item ) { | 454 | while ( item ) { |
455 | if ( item->isSelected() ) { | 455 | if ( item->isSelected() ) { |
456 | t.append( item->data() ); | 456 | t.append( item->data() ); |
457 | } | 457 | } |
458 | item = (MailListViewItem*)item->nextSibling(); | 458 | item = (MailListViewItem*)item->nextSibling(); |
459 | } | 459 | } |
460 | } | 460 | } |
461 | else | 461 | else |
462 | return; | 462 | return; |
463 | if ( t.count() == 0 ) | 463 | if ( t.count() == 0 ) |
464 | return; | 464 | return; |
465 | RecMailP mail = t.first(); | 465 | RecMailP mail = t.first(); |
466 | mail->Wrapper()->deleteMailList(t); | 466 | mail->Wrapper()->deleteMailList(t); |
467 | folderView->refreshCurrent(); | 467 | folderView->refreshCurrent(); |
468 | 468 | ||
469 | 469 | ||
470 | } | 470 | } |
471 | void OpieMail::clearSelection() | 471 | void OpieMail::clearSelection() |
472 | { | 472 | { |
473 | mailView->clearSelection(); | 473 | mailView->clearSelection(); |
474 | 474 | ||
475 | } | 475 | } |
476 | 476 | ||
477 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) | 477 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) |
478 | { | 478 | { |
479 | if (!mailView->currentItem()) return; | 479 | if (!mailView->currentItem()) return; |
480 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); | 480 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); |
481 | /* just the RIGHT button - or hold on pda */ | 481 | /* just the RIGHT button - or hold on pda */ |
482 | if (button!=2) {return;} | 482 | if (button!=2) {return;} |
483 | if (!item) return; | 483 | if (!item) return; |
484 | QPopupMenu *m = new QPopupMenu(0); | 484 | QPopupMenu *m = new QPopupMenu(0); |
485 | if (m) | 485 | if (m) |
486 | { | 486 | { |
487 | if (mailtype==MAILLIB::A_NNTP) { | 487 | if (mailtype==MAILLIB::A_NNTP) { |
488 | m->insertItem(i18n("Read this posting"),this,SLOT(displayMail())); | 488 | m->insertItem(i18n("Read this posting"),this,SLOT(displayMail())); |
489 | m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail())); | 489 | m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail())); |
490 | m->insertSeparator(); | 490 | m->insertSeparator(); |
491 | m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail())); | 491 | m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail())); |
492 | m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); | 492 | m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); |
493 | } else { | 493 | } else { |
494 | if (folderView->currentisDraft()) { | 494 | if (folderView->currentisDraft()) { |
495 | m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail())); | 495 | m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail())); |
496 | } | 496 | } |
497 | m->insertItem(i18n("Reply to this mail"),this,SLOT(replyMail())); | 497 | m->insertItem(i18n("Reply to this mail"),this,SLOT(replyMail())); |
498 | m->insertSeparator(); | ||
499 | m->insertItem(i18n("Read this mail"),this,SLOT(displayMail())); | 498 | m->insertItem(i18n("Read this mail"),this,SLOT(displayMail())); |
499 | m->insertSeparator(); | ||
500 | m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); | 500 | m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); |
501 | m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail())); | 501 | m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail())); |
502 | m->insertSeparator(); | 502 | m->insertSeparator(); |
503 | m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); | 503 | m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); |
504 | m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); | 504 | m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); |
505 | m->insertSeparator(); | ||
505 | m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); | 506 | m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); |
506 | } | 507 | } |
507 | m->setFocus(); | 508 | m->setFocus(); |
508 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 509 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
509 | delete m; | 510 | delete m; |
510 | } | 511 | } |
511 | } | 512 | } |
512 | 513 | ||
513 | void OpieMail::slotShowFolders( bool show ) | 514 | void OpieMail::slotShowFolders( bool show ) |
514 | { | 515 | { |
515 | if ( show && folderView->isHidden() ) | 516 | if ( show && folderView->isHidden() ) |
516 | { | 517 | { |
517 | folderView->show(); | 518 | folderView->show(); |
518 | } | 519 | } |
519 | else if ( !show && !folderView->isHidden() ) | 520 | else if ( !show && !folderView->isHidden() ) |
520 | { | 521 | { |
521 | folderView->hide(); | 522 | folderView->hide(); |
522 | } | 523 | } |
523 | } | 524 | } |
524 | 525 | ||
525 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) | 526 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) |
526 | { | 527 | { |
527 | MailListViewItem*item = 0; | 528 | MailListViewItem*item = 0; |
528 | mailView->clear(); | 529 | mailView->clear(); |
529 | 530 | ||
530 | QValueList<RecMailP>::ConstIterator it; | 531 | QValueList<RecMailP>::ConstIterator it; |
531 | for (it = list.begin(); it != list.end();++it) | 532 | for (it = list.begin(); it != list.end();++it) |
532 | { | 533 | { |
533 | item = new MailListViewItem(mailView,item); | 534 | item = new MailListViewItem(mailView,item); |
534 | item->storeData((*it)); | 535 | item->storeData((*it)); |
535 | item->showEntry(); | 536 | item->showEntry(); |
536 | } | 537 | } |
537 | mailView->setSorting ( 4, false ); | 538 | mailView->setSorting ( 4, false ); |
538 | } | 539 | } |
539 | 540 | ||
540 | void OpieMail::mailLeftClicked( QListViewItem *item ) | 541 | void OpieMail::mailLeftClicked( QListViewItem *item ) |
541 | { | 542 | { |
542 | mailView->clearSelection(); | 543 | mailView->clearSelection(); |
543 | /* just LEFT button - or tap with stylus on pda */ | 544 | /* just LEFT button - or tap with stylus on pda */ |
544 | //if (button!=1) return; | 545 | //if (button!=1) return; |
545 | if (!item) return; | 546 | if (!item) return; |
546 | if (folderView->currentisDraft()) { | 547 | if (folderView->currentisDraft()) { |
547 | reEditMail(); | 548 | reEditMail(); |
548 | } else { | 549 | } else { |
549 | displayMail(); | 550 | displayMail(); |
550 | } | 551 | } |
551 | } | 552 | } |
552 | 553 | ||
553 | void OpieMail::slotMoveCopyMail() | 554 | void OpieMail::slotMoveCopyMail() |
554 | { | 555 | { |
555 | if (!mailView->currentItem()) return; | 556 | if (!mailView->currentItem()) return; |
556 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 557 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
557 | AbstractMail*targetMail = 0; | 558 | AbstractMail*targetMail = 0; |
558 | QString targetFolder = ""; | 559 | QString targetFolder = ""; |
559 | Selectstore sels; | 560 | Selectstore sels; |
560 | folderView->setupFolderselect(&sels); | 561 | folderView->setupFolderselect(&sels); |
561 | if (!sels.exec()) return; | 562 | if (!sels.exec()) return; |
562 | targetMail = sels.currentMail(); | 563 | targetMail = sels.currentMail(); |
563 | targetFolder = sels.currentFolder(); | 564 | targetFolder = sels.currentFolder(); |
564 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || | 565 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || |
565 | targetFolder.isEmpty()) | 566 | targetFolder.isEmpty()) |
566 | { | 567 | { |
567 | return; | 568 | return; |
568 | } | 569 | } |
569 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | 570 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
570 | { | 571 | { |
571 | QMessageBox::critical(0,i18n("Error creating new Folder"), | 572 | QMessageBox::critical(0,i18n("Error creating new Folder"), |
572 | i18n("<center>Error while creating<br>new folder - breaking.</center>")); | 573 | i18n("<center>Error while creating<br>new folder - breaking.</center>")); |
573 | return; | 574 | return; |
574 | } | 575 | } |
575 | sels.hide(); | 576 | sels.hide(); |
576 | qApp->processEvents(); | 577 | qApp->processEvents(); |
577 | // qDebug("hiding sels "); | 578 | // qDebug("hiding sels "); |
578 | mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); | 579 | mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); |
579 | folderView->refreshCurrent(); | 580 | folderView->refreshCurrent(); |
580 | } | 581 | } |
581 | 582 | ||
582 | void OpieMail::slotMoveCopyAllMail() | 583 | void OpieMail::slotMoveCopyAllMail() |
583 | { | 584 | { |
584 | 585 | ||
585 | if (!mailView->currentItem()) return; | 586 | if (!mailView->currentItem()) return; |
586 | QValueList<RecMailP> t; | 587 | QValueList<RecMailP> t; |
587 | // if ( QMessageBox::warning(this, i18n("Move/Copy all selected mails"), i18n("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 588 | // if ( QMessageBox::warning(this, i18n("Move/Copy all selected mails"), i18n("Do you really want to copy/move\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
588 | { | 589 | { |
589 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); | 590 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); |
590 | while ( item ) { | 591 | while ( item ) { |
591 | if ( item->isSelected() ) { | 592 | if ( item->isSelected() ) { |
592 | t.append( item->data() ); | 593 | t.append( item->data() ); |
593 | } | 594 | } |
594 | item = (MailListViewItem*)item->nextSibling(); | 595 | item = (MailListViewItem*)item->nextSibling(); |
595 | } | 596 | } |
596 | } | 597 | } |
597 | // else | 598 | // else |
598 | // return; | 599 | // return; |
599 | if ( t.count() == 0 ) | 600 | if ( t.count() == 0 ) |
600 | return; | 601 | return; |