-rw-r--r-- | kmicromail/opiemail.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index e296d9c..75a75b9 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp | |||
@@ -416,261 +416,265 @@ void OpieMail::displayMail() | |||
416 | readMail.setBody( body ); | 416 | readMail.setBody( body ); |
417 | readMail.setMail( mail ); | 417 | readMail.setMail( mail ); |
418 | #ifndef DESKTOP_VERSION | 418 | #ifndef DESKTOP_VERSION |
419 | readMail.showMaximized(); | 419 | readMail.showMaximized(); |
420 | #else | 420 | #else |
421 | readMail.resize( 640, 480); | 421 | readMail.resize( 640, 480); |
422 | #endif | 422 | #endif |
423 | connect( &readMail,SIGNAL( showNextMail(ViewMail *) ), this, SLOT( displayNextMail(ViewMail *) ) ); | 423 | connect( &readMail,SIGNAL( showNextMail(ViewMail *) ), this, SLOT( displayNextMail(ViewMail *) ) ); |
424 | connect( &readMail,SIGNAL( deleteAndDisplayNextMail(ViewMail *) ), this, SLOT(deleteAndDisplayNextMail(ViewMail *) ) ); | 424 | connect( &readMail,SIGNAL( deleteAndDisplayNextMail(ViewMail *) ), this, SLOT(deleteAndDisplayNextMail(ViewMail *) ) ); |
425 | connect( &readMail,SIGNAL( signalDownloadMail() ), this, SLOT( slotDownloadMail() ) ); | 425 | connect( &readMail,SIGNAL( signalDownloadMail() ), this, SLOT( slotDownloadMail() ) ); |
426 | 426 | ||
427 | readMail.exec(); | 427 | readMail.exec(); |
428 | 428 | ||
429 | if ( readMail.deleted ) | 429 | if ( readMail.deleted ) |
430 | { | 430 | { |
431 | folderView->refreshCurrent(); | 431 | folderView->refreshCurrent(); |
432 | } | 432 | } |
433 | else | 433 | else |
434 | { | 434 | { |
435 | QListViewItem*item = mailView->currentItem(); | 435 | QListViewItem*item = mailView->currentItem(); |
436 | if (item) | 436 | if (item) |
437 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); | 437 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); |
438 | } | 438 | } |
439 | } | 439 | } |
440 | void OpieMail::slotGetAllMail() | 440 | void OpieMail::slotGetAllMail() |
441 | { | 441 | { |
442 | QListViewItem * item = folderView->firstChild(); | 442 | QListViewItem * item = folderView->firstChild(); |
443 | while ( item ){ | 443 | while ( item ){ |
444 | ((AccountViewItem *)item)->contextMenuSelected( 101 ); | 444 | ((AccountViewItem *)item)->contextMenuSelected( 101 ); |
445 | item = item->nextSibling (); | 445 | item = item->nextSibling (); |
446 | } | 446 | } |
447 | } | 447 | } |
448 | void OpieMail::slotGetMail() | 448 | void OpieMail::slotGetMail() |
449 | { | 449 | { |
450 | QListViewItem * item = folderView->currentItem(); | 450 | QListViewItem * item = folderView->currentItem(); |
451 | if ( ! item ) return; | 451 | if ( ! item ) return; |
452 | ((AccountViewItem *)item)->contextMenuSelected( 101 ); | 452 | ((AccountViewItem *)item)->contextMenuSelected( 101 ); |
453 | } | 453 | } |
454 | void OpieMail::slotDeleteMail() | 454 | void OpieMail::slotDeleteMail() |
455 | { | 455 | { |
456 | if (!mailView->currentItem()) return; | 456 | if (!mailView->currentItem()) return; |
457 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 457 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
458 | 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 ) | 458 | 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 ) |
459 | { | 459 | { |
460 | mail->Wrapper()->deleteMail( mail ); | 460 | mail->Wrapper()->deleteMail( mail ); |
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() | 493 | void OpieMail::selectAll() |
494 | { | 494 | { |
495 | QListViewItem* item = mailView->firstChild (); | 495 | QListViewItem* item = mailView->firstChild (); |
496 | while ( item ) { | 496 | while ( item ) { |
497 | mailView->setSelected ( item, true ); | 497 | mailView->setSelected ( item, true ); |
498 | item = item->nextSibling(); | 498 | item = item->nextSibling(); |
499 | } | 499 | } |
500 | } | 500 | } |
501 | 501 | ||
502 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) | 502 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) |
503 | { | 503 | { |
504 | if (!mailView->currentItem()) return; | 504 | if (!mailView->currentItem()) return; |
505 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); | 505 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); |
506 | /* just the RIGHT button - or hold on pda */ | 506 | /* just the RIGHT button - or hold on pda */ |
507 | if (button!=2) {return;} | 507 | if (button!=2) {return;} |
508 | if (!item) return; | 508 | if (!item) return; |
509 | QPopupMenu *m = new QPopupMenu(0); | 509 | QPopupMenu *m = new QPopupMenu(0); |
510 | if (m) | 510 | if (m) |
511 | { | 511 | { |
512 | if (mailtype==MAILLIB::A_NNTP) { | 512 | if (mailtype==MAILLIB::A_NNTP) { |
513 | m->insertItem(i18n("Read this posting"),this,SLOT(displayMail())); | 513 | m->insertItem(i18n("Read this posting"),this,SLOT(displayMail())); |
514 | m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail())); | 514 | m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail())); |
515 | m->insertSeparator(); | 515 | m->insertSeparator(); |
516 | m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail())); | 516 | m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail())); |
517 | m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); | 517 | m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); |
518 | } else { | 518 | } else { |
519 | if (folderView->currentisDraft()) { | 519 | if (folderView->currentisDraft()) { |
520 | m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail())); | 520 | m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail())); |
521 | } | 521 | } |
522 | m->insertItem(i18n("Reply to this mail"),this,SLOT(replyMail())); | 522 | m->insertItem(i18n("Reply to this mail"),this,SLOT(replyMail())); |
523 | m->insertItem(i18n("Read this mail"),this,SLOT(displayMail())); | 523 | m->insertItem(i18n("Read this mail"),this,SLOT(displayMail())); |
524 | m->insertSeparator(); | 524 | m->insertSeparator(); |
525 | m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); | 525 | m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); |
526 | m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail())); | 526 | m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail())); |
527 | m->insertSeparator(); | 527 | m->insertSeparator(); |
528 | m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); | 528 | m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); |
529 | m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); | 529 | m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); |
530 | m->insertSeparator(); | 530 | m->insertSeparator(); |
531 | m->insertItem(i18n("Select all"),this,SLOT(selectAll())); | 531 | m->insertItem(i18n("Select all"),this,SLOT(selectAll())); |
532 | m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); | 532 | m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); |
533 | } | 533 | } |
534 | m->setFocus(); | 534 | m->setFocus(); |
535 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 535 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
536 | delete m; | 536 | delete m; |
537 | } | 537 | } |
538 | } | 538 | } |
539 | 539 | ||
540 | void OpieMail::slotShowFolders( bool show ) | 540 | void OpieMail::slotShowFolders( bool show ) |
541 | { | 541 | { |
542 | if ( show && folderView->isHidden() ) | 542 | if ( show && folderView->isHidden() ) |
543 | { | 543 | { |
544 | slotAdjustColumns(); | ||
544 | folderView->show(); | 545 | folderView->show(); |
546 | //slotAdjustColumns(); | ||
545 | } | 547 | } |
546 | else if ( !show && !folderView->isHidden() ) | 548 | else if ( !show && !folderView->isHidden() ) |
547 | { | 549 | { |
550 | slotAdjustColumnsWide(); | ||
548 | folderView->hide(); | 551 | folderView->hide(); |
552 | //slotAdjustColumnsWide(); | ||
549 | } | 553 | } |
550 | } | 554 | } |
551 | 555 | ||
552 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) | 556 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) |
553 | { | 557 | { |
554 | MailListViewItem*item = 0; | 558 | MailListViewItem*item = 0; |
555 | mailView->clear(); | 559 | mailView->clear(); |
556 | 560 | ||
557 | QValueList<RecMailP>::ConstIterator it; | 561 | QValueList<RecMailP>::ConstIterator it; |
558 | for (it = list.begin(); it != list.end();++it) | 562 | for (it = list.begin(); it != list.end();++it) |
559 | { | 563 | { |
560 | item = new MailListViewItem(mailView,item); | 564 | item = new MailListViewItem(mailView,item); |
561 | item->storeData((*it)); | 565 | item->storeData((*it)); |
562 | item->showEntry(); | 566 | item->showEntry(); |
563 | } | 567 | } |
564 | mailView->setSorting ( 4, false ); | 568 | mailView->setSorting ( 4, false ); |
565 | } | 569 | } |
566 | 570 | ||
567 | void OpieMail::mailLeftClicked( QListViewItem *item ) | 571 | void OpieMail::mailLeftClicked( QListViewItem *item ) |
568 | { | 572 | { |
569 | mailView->clearSelection(); | 573 | mailView->clearSelection(); |
570 | /* just LEFT button - or tap with stylus on pda */ | 574 | /* just LEFT button - or tap with stylus on pda */ |
571 | //if (button!=1) return; | 575 | //if (button!=1) return; |
572 | if (!item) return; | 576 | if (!item) return; |
573 | if (folderView->currentisDraft()) { | 577 | if (folderView->currentisDraft()) { |
574 | reEditMail(); | 578 | reEditMail(); |
575 | } else { | 579 | } else { |
576 | displayMail(); | 580 | displayMail(); |
577 | } | 581 | } |
578 | } | 582 | } |
579 | 583 | ||
580 | void OpieMail::slotMoveCopyMail() | 584 | void OpieMail::slotMoveCopyMail() |
581 | { | 585 | { |
582 | if (!mailView->currentItem()) return; | 586 | if (!mailView->currentItem()) return; |
583 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 587 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
584 | AbstractMail*targetMail = 0; | 588 | AbstractMail*targetMail = 0; |
585 | QString targetFolder = ""; | 589 | QString targetFolder = ""; |
586 | Selectstore sels; | 590 | Selectstore sels; |
587 | folderView->setupFolderselect(&sels); | 591 | folderView->setupFolderselect(&sels); |
588 | if (!sels.exec()) return; | 592 | if (!sels.exec()) return; |
589 | targetMail = sels.currentMail(); | 593 | targetMail = sels.currentMail(); |
590 | targetFolder = sels.currentFolder(); | 594 | targetFolder = sels.currentFolder(); |
591 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || | 595 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || |
592 | targetFolder.isEmpty()) | 596 | targetFolder.isEmpty()) |
593 | { | 597 | { |
594 | return; | 598 | return; |
595 | } | 599 | } |
596 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | 600 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
597 | { | 601 | { |
598 | QMessageBox::critical(0,i18n("Error creating new Folder"), | 602 | QMessageBox::critical(0,i18n("Error creating new Folder"), |
599 | i18n("<center>Error while creating<br>new folder - breaking.</center>")); | 603 | i18n("<center>Error while creating<br>new folder - breaking.</center>")); |
600 | return; | 604 | return; |
601 | } | 605 | } |
602 | sels.hide(); | 606 | sels.hide(); |
603 | qApp->processEvents(); | 607 | qApp->processEvents(); |
604 | // qDebug("hiding sels "); | 608 | // qDebug("hiding sels "); |
605 | mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); | 609 | mail->Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); |
606 | folderView->refreshCurrent(); | 610 | folderView->refreshCurrent(); |
607 | } | 611 | } |
608 | 612 | ||
609 | void OpieMail::slotMoveCopyAllMail() | 613 | void OpieMail::slotMoveCopyAllMail() |
610 | { | 614 | { |
611 | 615 | ||
612 | if (!mailView->currentItem()) return; | 616 | if (!mailView->currentItem()) return; |
613 | QValueList<RecMailP> t; | 617 | QValueList<RecMailP> t; |
614 | // 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 ) | 618 | // 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 ) |
615 | { | 619 | { |
616 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); | 620 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); |
617 | while ( item ) { | 621 | while ( item ) { |
618 | if ( item->isSelected() ) { | 622 | if ( item->isSelected() ) { |
619 | t.append( item->data() ); | 623 | t.append( item->data() ); |
620 | } | 624 | } |
621 | item = (MailListViewItem*)item->nextSibling(); | 625 | item = (MailListViewItem*)item->nextSibling(); |
622 | } | 626 | } |
623 | } | 627 | } |
624 | // else | 628 | // else |
625 | // return; | 629 | // return; |
626 | if ( t.count() == 0 ) | 630 | if ( t.count() == 0 ) |
627 | return; | 631 | return; |
628 | RecMailP mail = t.first(); | 632 | RecMailP mail = t.first(); |
629 | AbstractMail*targetMail = 0; | 633 | AbstractMail*targetMail = 0; |
630 | QString targetFolder = ""; | 634 | QString targetFolder = ""; |
631 | Selectstore sels; | 635 | Selectstore sels; |
632 | folderView->setupFolderselect(&sels); | 636 | folderView->setupFolderselect(&sels); |
633 | if (!sels.exec()) return; | 637 | if (!sels.exec()) return; |
634 | targetMail = sels.currentMail(); | 638 | targetMail = sels.currentMail(); |
635 | targetFolder = sels.currentFolder(); | 639 | targetFolder = sels.currentFolder(); |
636 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || | 640 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || |
637 | targetFolder.isEmpty()) | 641 | targetFolder.isEmpty()) |
638 | { | 642 | { |
639 | return; | 643 | return; |
640 | } | 644 | } |
641 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | 645 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
642 | { | 646 | { |
643 | QMessageBox::critical(0,i18n("Error creating new Folder"), | 647 | QMessageBox::critical(0,i18n("Error creating new Folder"), |
644 | i18n("<center>Error while creating<br>new folder - breaking.</center>")); | 648 | i18n("<center>Error while creating<br>new folder - breaking.</center>")); |
645 | return; | 649 | return; |
646 | } | 650 | } |
647 | sels.hide(); | 651 | sels.hide(); |
648 | qApp->processEvents(); | 652 | qApp->processEvents(); |
649 | //qDebug("hiding sels "); | 653 | //qDebug("hiding sels "); |
650 | mail->Wrapper()->mvcpMailList(t,targetFolder,targetMail,sels.moveMails()); | 654 | mail->Wrapper()->mvcpMailList(t,targetFolder,targetMail,sels.moveMails()); |
651 | folderView->refreshCurrent(); | 655 | folderView->refreshCurrent(); |
652 | } | 656 | } |
653 | 657 | ||
654 | void OpieMail::reEditMail() | 658 | void OpieMail::reEditMail() |
655 | { | 659 | { |
656 | if (!mailView->currentItem()) return; | 660 | if (!mailView->currentItem()) return; |
657 | 661 | ||
658 | ComposeMail compose( settings, this, 0, true ); | 662 | ComposeMail compose( settings, this, 0, true ); |
659 | compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); | 663 | compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); |
660 | compose.slotAdjustColumns(); | 664 | compose.slotAdjustColumns(); |
661 | #ifndef DESKTOP_VERSION | 665 | #ifndef DESKTOP_VERSION |
662 | compose.showMaximized(); | 666 | compose.showMaximized(); |
663 | #else | 667 | #else |
664 | compose.resize(640,480); | 668 | compose.resize(640,480); |
665 | #endif | 669 | #endif |
666 | mCurrentComposer = &compose; | 670 | mCurrentComposer = &compose; |
667 | compose.exec(); | 671 | compose.exec(); |
668 | folderView->refreshOutgoing(); | 672 | folderView->refreshOutgoing(); |
669 | mCurrentComposer = 0; | 673 | mCurrentComposer = 0; |
670 | } | 674 | } |
671 | 675 | ||
672 | void OpieMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) | 676 | void OpieMail::insertAttendees(const QString& uid,const QStringList& nameList,const QStringList& emailList,const QStringList& uidList) |
673 | { | 677 | { |
674 | 678 | ||
675 | if ( mCurrentComposer ) { | 679 | if ( mCurrentComposer ) { |
676 | mCurrentComposer->insertAttendees(uid,nameList,emailList,uidList); | 680 | mCurrentComposer->insertAttendees(uid,nameList,emailList,uidList); |