-rw-r--r-- | kmicromail/opiemail.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index 8ac3451..e296d9c 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp | |||
@@ -461,94 +461,103 @@ void OpieMail::slotDeleteMail() | |||
461 | folderView->refreshCurrent(); | 461 | folderView->refreshCurrent(); |
462 | } | 462 | } |
463 | } | 463 | } |
464 | void OpieMail::slotDeleteAllMail() | 464 | void OpieMail::slotDeleteAllMail() |
465 | { | 465 | { |
466 | 466 | ||
467 | QValueList<RecMailP> t; | 467 | QValueList<RecMailP> t; |
468 | if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 468 | if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
469 | { | 469 | { |
470 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); | 470 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); |
471 | while ( item ) { | 471 | while ( item ) { |
472 | if ( item->isSelected() ) { | 472 | if ( item->isSelected() ) { |
473 | t.append( item->data() ); | 473 | t.append( item->data() ); |
474 | } | 474 | } |
475 | item = (MailListViewItem*)item->nextSibling(); | 475 | item = (MailListViewItem*)item->nextSibling(); |
476 | } | 476 | } |
477 | } | 477 | } |
478 | else | 478 | else |
479 | return; | 479 | return; |
480 | if ( t.count() == 0 ) | 480 | if ( t.count() == 0 ) |
481 | return; | 481 | return; |
482 | RecMailP mail = t.first(); | 482 | RecMailP mail = t.first(); |
483 | mail->Wrapper()->deleteMailList(t); | 483 | mail->Wrapper()->deleteMailList(t); |
484 | folderView->refreshCurrent(); | 484 | folderView->refreshCurrent(); |
485 | 485 | ||
486 | 486 | ||
487 | } | 487 | } |
488 | void OpieMail::clearSelection() | 488 | void OpieMail::clearSelection() |
489 | { | 489 | { |
490 | mailView->clearSelection(); | 490 | mailView->clearSelection(); |
491 | 491 | ||
492 | } | 492 | } |
493 | void OpieMail::selectAll() | ||
494 | { | ||
495 | QListViewItem* item = mailView->firstChild (); | ||
496 | while ( item ) { | ||
497 | mailView->setSelected ( item, true ); | ||
498 | item = item->nextSibling(); | ||
499 | } | ||
500 | } | ||
493 | 501 | ||
494 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) | 502 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) |
495 | { | 503 | { |
496 | if (!mailView->currentItem()) return; | 504 | if (!mailView->currentItem()) return; |
497 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); | 505 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); |
498 | /* just the RIGHT button - or hold on pda */ | 506 | /* just the RIGHT button - or hold on pda */ |
499 | if (button!=2) {return;} | 507 | if (button!=2) {return;} |
500 | if (!item) return; | 508 | if (!item) return; |
501 | QPopupMenu *m = new QPopupMenu(0); | 509 | QPopupMenu *m = new QPopupMenu(0); |
502 | if (m) | 510 | if (m) |
503 | { | 511 | { |
504 | if (mailtype==MAILLIB::A_NNTP) { | 512 | if (mailtype==MAILLIB::A_NNTP) { |
505 | m->insertItem(i18n("Read this posting"),this,SLOT(displayMail())); | 513 | m->insertItem(i18n("Read this posting"),this,SLOT(displayMail())); |
506 | m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail())); | 514 | m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail())); |
507 | m->insertSeparator(); | 515 | m->insertSeparator(); |
508 | m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail())); | 516 | m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail())); |
509 | m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); | 517 | m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); |
510 | } else { | 518 | } else { |
511 | if (folderView->currentisDraft()) { | 519 | if (folderView->currentisDraft()) { |
512 | m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail())); | 520 | m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail())); |
513 | } | 521 | } |
514 | m->insertItem(i18n("Reply to this mail"),this,SLOT(replyMail())); | 522 | m->insertItem(i18n("Reply to this mail"),this,SLOT(replyMail())); |
515 | m->insertItem(i18n("Read this mail"),this,SLOT(displayMail())); | 523 | m->insertItem(i18n("Read this mail"),this,SLOT(displayMail())); |
516 | m->insertSeparator(); | 524 | m->insertSeparator(); |
517 | m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); | 525 | m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); |
518 | m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail())); | 526 | m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail())); |
519 | m->insertSeparator(); | 527 | m->insertSeparator(); |
520 | m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); | 528 | m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); |
521 | m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); | 529 | m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); |
522 | m->insertSeparator(); | 530 | m->insertSeparator(); |
531 | m->insertItem(i18n("Select all"),this,SLOT(selectAll())); | ||
523 | m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); | 532 | m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); |
524 | } | 533 | } |
525 | m->setFocus(); | 534 | m->setFocus(); |
526 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 535 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
527 | delete m; | 536 | delete m; |
528 | } | 537 | } |
529 | } | 538 | } |
530 | 539 | ||
531 | void OpieMail::slotShowFolders( bool show ) | 540 | void OpieMail::slotShowFolders( bool show ) |
532 | { | 541 | { |
533 | if ( show && folderView->isHidden() ) | 542 | if ( show && folderView->isHidden() ) |
534 | { | 543 | { |
535 | folderView->show(); | 544 | folderView->show(); |
536 | } | 545 | } |
537 | else if ( !show && !folderView->isHidden() ) | 546 | else if ( !show && !folderView->isHidden() ) |
538 | { | 547 | { |
539 | folderView->hide(); | 548 | folderView->hide(); |
540 | } | 549 | } |
541 | } | 550 | } |
542 | 551 | ||
543 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) | 552 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) |
544 | { | 553 | { |
545 | MailListViewItem*item = 0; | 554 | MailListViewItem*item = 0; |
546 | mailView->clear(); | 555 | mailView->clear(); |
547 | 556 | ||
548 | QValueList<RecMailP>::ConstIterator it; | 557 | QValueList<RecMailP>::ConstIterator it; |
549 | for (it = list.begin(); it != list.end();++it) | 558 | for (it = list.begin(); it != list.end();++it) |
550 | { | 559 | { |
551 | item = new MailListViewItem(mailView,item); | 560 | item = new MailListViewItem(mailView,item); |
552 | item->storeData((*it)); | 561 | item->storeData((*it)); |
553 | item->showEntry(); | 562 | item->showEntry(); |
554 | } | 563 | } |