-rw-r--r-- | kmicromail/accountitem.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kmicromail/accountitem.cpp b/kmicromail/accountitem.cpp index fcb2052..985a762 100644 --- a/kmicromail/accountitem.cpp +++ b/kmicromail/accountitem.cpp | |||
@@ -530,515 +530,515 @@ QPopupMenu * IMAPviewItem::getContextMenu() | |||
530 | } | 530 | } |
531 | else | 531 | else |
532 | { | 532 | { |
533 | m->insertItem(i18n("Get new messages"),GET_NEW_MAILS); | 533 | m->insertItem(i18n("Get new messages"),GET_NEW_MAILS); |
534 | m->insertItem(i18n("Set online"),3); | 534 | m->insertItem(i18n("Set online"),3); |
535 | } | 535 | } |
536 | } | 536 | } |
537 | return m; | 537 | return m; |
538 | } | 538 | } |
539 | 539 | ||
540 | void IMAPviewItem::createNewFolder() | 540 | void IMAPviewItem::createNewFolder() |
541 | { | 541 | { |
542 | Newmdirdlg ndirdlg; | 542 | Newmdirdlg ndirdlg; |
543 | 543 | ||
544 | #ifndef DESKTOP_VERSION | 544 | #ifndef DESKTOP_VERSION |
545 | //ndirdlg.showMaximized(); | 545 | //ndirdlg.showMaximized(); |
546 | #endif | 546 | #endif |
547 | if ( ndirdlg.exec() ) | 547 | if ( ndirdlg.exec() ) |
548 | { | 548 | { |
549 | QString ndir = ndirdlg.Newdir(); | 549 | QString ndir = ndirdlg.Newdir(); |
550 | bool makesubs = ndirdlg.subpossible(); | 550 | bool makesubs = ndirdlg.subpossible(); |
551 | QString delemiter = "/"; | 551 | QString delemiter = "/"; |
552 | IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); | 552 | IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); |
553 | if (item) | 553 | if (item) |
554 | { | 554 | { |
555 | delemiter = item->Delemiter(); | 555 | delemiter = item->Delemiter(); |
556 | } | 556 | } |
557 | if (wrapper->createMbox(ndir,0,delemiter,makesubs)) | 557 | if (wrapper->createMbox(ndir,0,delemiter,makesubs)) |
558 | { | 558 | { |
559 | refreshFolders(true); | 559 | refreshFolders(true); |
560 | } | 560 | } |
561 | } | 561 | } |
562 | } | 562 | } |
563 | 563 | ||
564 | void IMAPviewItem::contextMenuSelected(int id) | 564 | void IMAPviewItem::contextMenuSelected(int id) |
565 | { | 565 | { |
566 | 566 | ||
567 | switch (id) | 567 | switch (id) |
568 | { | 568 | { |
569 | case 0: | 569 | case 0: |
570 | refreshFolders(true); | 570 | refreshFolders(true); |
571 | break; | 571 | break; |
572 | case 1: | 572 | case 1: |
573 | createNewFolder(); | 573 | createNewFolder(); |
574 | break; | 574 | break; |
575 | case 2: | 575 | case 2: |
576 | removeChilds(); | 576 | removeChilds(); |
577 | wrapper->logout(); | 577 | wrapper->logout(); |
578 | break; | 578 | break; |
579 | case 3: | 579 | case 3: |
580 | if (account->getOffline()==false) | 580 | if (account->getOffline()==false) |
581 | { | 581 | { |
582 | removeChilds(); | 582 | removeChilds(); |
583 | wrapper->logout(); | 583 | wrapper->logout(); |
584 | } | 584 | } |
585 | account->setOffline(!account->getOffline()); | 585 | account->setOffline(!account->getOffline()); |
586 | account->save(); | 586 | account->save(); |
587 | SETPIX(PIXMAP_IMAPFOLDER); | 587 | SETPIX(PIXMAP_IMAPFOLDER); |
588 | refreshFolders(false); | 588 | refreshFolders(false); |
589 | break; | 589 | break; |
590 | case GET_NEW_MAILS: // daunlood | 590 | case GET_NEW_MAILS: // daunlood |
591 | { | 591 | { |
592 | if (account->getOffline()) { | 592 | if (account->getOffline()) { |
593 | contextMenuSelected( 3 ); | 593 | contextMenuSelected( 3 ); |
594 | } | 594 | } |
595 | AccountView*bl = accountView(); | 595 | AccountView*bl = accountView(); |
596 | if (!bl) return; | 596 | if (!bl) return; |
597 | AccountViewItem* in = findSubItem( "inbox" , 0); | 597 | AccountViewItem* in = findSubItem( "inbox" , 0); |
598 | if ( ! in ) | 598 | if ( ! in ) |
599 | return; | 599 | return; |
600 | bl->downloadMailsInbox(in->getFolder(),getWrapper()); | 600 | bl->downloadMailsInbox(in->getFolder(),getWrapper()); |
601 | } | 601 | } |
602 | break; | 602 | break; |
603 | default: | 603 | default: |
604 | break; | 604 | break; |
605 | } | 605 | } |
606 | } | 606 | } |
607 | 607 | ||
608 | RECBODYP IMAPviewItem::fetchBody(const RecMailP&) | 608 | RECBODYP IMAPviewItem::fetchBody(const RecMailP&) |
609 | { | 609 | { |
610 | return new RecBody(); | 610 | return new RecBody(); |
611 | } | 611 | } |
612 | 612 | ||
613 | bool IMAPviewItem::offline() | 613 | bool IMAPviewItem::offline() |
614 | { | 614 | { |
615 | return account->getOffline(); | 615 | return account->getOffline(); |
616 | } | 616 | } |
617 | 617 | ||
618 | IMAPfolderItem::IMAPfolderItem( const FolderP& folderInit, IMAPviewItem *parent , QListViewItem*after ) | 618 | IMAPfolderItem::IMAPfolderItem( const FolderP& folderInit, IMAPviewItem *parent , QListViewItem*after ) |
619 | : AccountViewItem( folderInit, parent , after ) | 619 | : AccountViewItem( folderInit, parent , after ) |
620 | { | 620 | { |
621 | imap = parent; | 621 | imap = parent; |
622 | if (folder->getDisplayName().lower()!="inbox") | 622 | if (folder->getDisplayName().lower()!="inbox") |
623 | { | 623 | { |
624 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 624 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
625 | } | 625 | } |
626 | else | 626 | else |
627 | { | 627 | { |
628 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 628 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
629 | } | 629 | } |
630 | setText( 0, folder->getDisplayName() ); | 630 | setText( 0, folder->getDisplayName() ); |
631 | } | 631 | } |
632 | 632 | ||
633 | IMAPfolderItem::IMAPfolderItem(const FolderP &folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ) | 633 | IMAPfolderItem::IMAPfolderItem(const FolderP &folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ) |
634 | : AccountViewItem(folderInit, parent,after ) | 634 | : AccountViewItem(folderInit, parent,after ) |
635 | { | 635 | { |
636 | imap = master; | 636 | imap = master; |
637 | if (folder->getDisplayName().lower()!="inbox") | 637 | if (folder->getDisplayName().lower()!="inbox") |
638 | { | 638 | { |
639 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 639 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
640 | } | 640 | } |
641 | else | 641 | else |
642 | { | 642 | { |
643 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 643 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
644 | } | 644 | } |
645 | setText( 0, folder->getDisplayName() ); | 645 | setText( 0, folder->getDisplayName() ); |
646 | } | 646 | } |
647 | 647 | ||
648 | IMAPfolderItem::~IMAPfolderItem() | 648 | IMAPfolderItem::~IMAPfolderItem() |
649 | {} | 649 | {} |
650 | 650 | ||
651 | const QString& IMAPfolderItem::Delemiter()const | 651 | const QString& IMAPfolderItem::Delemiter()const |
652 | { | 652 | { |
653 | return folder->Separator(); | 653 | return folder->Separator(); |
654 | } | 654 | } |
655 | 655 | ||
656 | void IMAPfolderItem::refresh(QValueList<RecMailP>&target) | 656 | void IMAPfolderItem::refresh(QValueList<RecMailP>&target) |
657 | { | 657 | { |
658 | if (folder->may_select()) | 658 | if (folder->may_select()) |
659 | { | 659 | { |
660 | imap->getWrapper()->listMessages( folder->getName(),target ); | 660 | imap->getWrapper()->listMessages( folder->getName(),target ); |
661 | } | 661 | } |
662 | else | 662 | else |
663 | { | 663 | { |
664 | target.clear(); | 664 | target.clear(); |
665 | } | 665 | } |
666 | } | 666 | } |
667 | 667 | ||
668 | RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail) | 668 | RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail) |
669 | { | 669 | { |
670 | return imap->getWrapper()->fetchBody(aMail); | 670 | return imap->getWrapper()->fetchBody(aMail); |
671 | } | 671 | } |
672 | 672 | ||
673 | QPopupMenu * IMAPfolderItem::getContextMenu() | 673 | QPopupMenu * IMAPfolderItem::getContextMenu() |
674 | { | 674 | { |
675 | QPopupMenu *m = new QPopupMenu(0); | 675 | QPopupMenu *m = new QPopupMenu(0); |
676 | if (m) | 676 | if (m) |
677 | { | 677 | { |
678 | if (folder->may_select()) | 678 | if (folder->may_select()) |
679 | { | 679 | { |
680 | m->insertItem(i18n("Get new messages"),GET_NEW_MAILS); | 680 | m->insertItem(i18n("Get new messages"),GET_NEW_MAILS); |
681 | m->insertItem(i18n("Refresh header list"),0); | 681 | m->insertItem(i18n("Refresh header list"),0); |
682 | m->insertItem(i18n("Move/Copie all mails"),4); | 682 | m->insertItem(i18n("Move/Copie all mails"),4); |
683 | m->insertItem(i18n("Delete all mails"),1); | 683 | m->insertItem(i18n("Delete all mails"),1); |
684 | } | 684 | } |
685 | if (folder->no_inferior()==false) | 685 | if (folder->no_inferior()==false) |
686 | { | 686 | { |
687 | m->insertItem(i18n("Create new subfolder"),2); | 687 | m->insertItem(i18n("Create new subfolder"),2); |
688 | } | 688 | } |
689 | if (folder->getDisplayName().lower()!="inbox") | 689 | if (folder->getDisplayName().lower()!="inbox") |
690 | { | 690 | { |
691 | m->insertItem(i18n("Delete folder"),3); | 691 | m->insertItem(i18n("Delete folder"),3); |
692 | } | 692 | } |
693 | } | 693 | } |
694 | return m; | 694 | return m; |
695 | } | 695 | } |
696 | 696 | ||
697 | void IMAPfolderItem::createNewFolder() | 697 | void IMAPfolderItem::createNewFolder() |
698 | { | 698 | { |
699 | Newmdirdlg ndirdlg; | 699 | Newmdirdlg ndirdlg; |
700 | //ndirdlg.showMaximized(); | 700 | //ndirdlg.showMaximized(); |
701 | if ( ndirdlg.exec() ) | 701 | if ( ndirdlg.exec() ) |
702 | { | 702 | { |
703 | QString ndir = ndirdlg.Newdir(); | 703 | QString ndir = ndirdlg.Newdir(); |
704 | bool makesubs = ndirdlg.subpossible(); | 704 | bool makesubs = ndirdlg.subpossible(); |
705 | QString delemiter = Delemiter(); | 705 | QString delemiter = Delemiter(); |
706 | if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) | 706 | if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) |
707 | { | 707 | { |
708 | imap->refreshFolders(true); | 708 | imap->refreshFolders(true); |
709 | } | 709 | } |
710 | } | 710 | } |
711 | } | 711 | } |
712 | 712 | ||
713 | void IMAPfolderItem::deleteFolder() | 713 | void IMAPfolderItem::deleteFolder() |
714 | { | 714 | { |
715 | int yesno = QMessageBox::warning(0,i18n("Delete folder"), | 715 | int yesno = QMessageBox::warning(0,i18n("Delete folder"), |
716 | i18n("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>").arg(folder->getDisplayName()), | 716 | i18n("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>").arg(folder->getDisplayName()), |
717 | i18n("Yes"), | 717 | i18n("Yes"), |
718 | i18n("No"),QString::null,1,1); | 718 | i18n("No"),QString::null,1,1); |
719 | 719 | ||
720 | if (yesno == 0) | 720 | if (yesno == 0) |
721 | { | 721 | { |
722 | if (imap->getWrapper()->deleteMbox(folder)) | 722 | if (imap->getWrapper()->deleteMbox(folder)) |
723 | { | 723 | { |
724 | QListView*v=listView(); | 724 | QListView*v=listView(); |
725 | IMAPviewItem * box = imap; | 725 | IMAPviewItem * box = imap; |
726 | /* be carefull - after that this object is destroyd so don't use | 726 | /* be carefull - after that this object is destroyd so don't use |
727 | * any member of it after that call!!*/ | 727 | * any member of it after that call!!*/ |
728 | imap->refreshFolders(true); | 728 | imap->refreshFolders(true); |
729 | if (v) | 729 | if (v) |
730 | { | 730 | { |
731 | v->setSelected(box,true); | 731 | v->setSelected(box,true); |
732 | } | 732 | } |
733 | } | 733 | } |
734 | } | 734 | } |
735 | } | 735 | } |
736 | 736 | ||
737 | void IMAPfolderItem::downloadMails() | 737 | void IMAPfolderItem::downloadMails() |
738 | { | 738 | { |
739 | AccountView*bl = imap->accountView(); | 739 | AccountView*bl = imap->accountView(); |
740 | if (!bl) return; | 740 | if (!bl) return; |
741 | bl->downloadMails(folder,imap->getWrapper()); | 741 | bl->downloadMails(folder,imap->getWrapper()); |
742 | } | 742 | } |
743 | 743 | ||
744 | void IMAPfolderItem::contextMenuSelected(int id) | 744 | void IMAPfolderItem::contextMenuSelected(int id) |
745 | { | 745 | { |
746 | 746 | ||
747 | AccountView * view = (AccountView*)listView(); | 747 | AccountView * view = (AccountView*)listView(); |
748 | switch(id) | 748 | switch(id) |
749 | { | 749 | { |
750 | case 0: | 750 | case 0: |
751 | view->refreshCurrent(); | 751 | view->refreshCurrent(); |
752 | break; | 752 | break; |
753 | case 1: | 753 | case 1: |
754 | deleteAllMail(imap->getWrapper(),folder); | 754 | deleteAllMail(imap->getWrapper(),folder); |
755 | break; | 755 | break; |
756 | case 2: | 756 | case 2: |
757 | createNewFolder(); | 757 | createNewFolder(); |
758 | break; | 758 | break; |
759 | case 3: | 759 | case 3: |
760 | deleteFolder(); | 760 | deleteFolder(); |
761 | break; | 761 | break; |
762 | case 4: | 762 | case 4: |
763 | downloadMails(); | 763 | downloadMails(); |
764 | break; | 764 | break; |
765 | case GET_NEW_MAILS: // daunlood | 765 | case GET_NEW_MAILS: // daunlood |
766 | { | 766 | { |
767 | if (!view) return; | 767 | if (!view) return; |
768 | view->downloadMailsInbox(getFolder(),imap->getWrapper()); | 768 | view->downloadMailsInbox(getFolder(),imap->getWrapper()); |
769 | } | 769 | } |
770 | break; | 770 | break; |
771 | default: | 771 | default: |
772 | break; | 772 | break; |
773 | } | 773 | } |
774 | } | 774 | } |
775 | 775 | ||
776 | /** | 776 | /** |
777 | * MH Account stuff | 777 | * MH Account stuff |
778 | */ | 778 | */ |
779 | /* MH is a little bit different - the top folder can contains messages other than in IMAP and | 779 | /* MH is a little bit different - the top folder can contains messages other than in IMAP and |
780 | POP3 and MBOX */ | 780 | POP3 and MBOX */ |
781 | MHviewItem::MHviewItem( const QString&aPath, AccountView *parent ) | 781 | MHviewItem::MHviewItem( const QString&aPath, AccountView *parent ) |
782 | : AccountViewItem( parent ) | 782 | : AccountViewItem( parent ) |
783 | { | 783 | { |
784 | m_Path = aPath; | 784 | m_Path = aPath; |
785 | /* be carefull - the space within settext is wanted - thats why the string twice */ | 785 | /* be carefull - the space within settext is wanted - thats why the string twice */ |
786 | wrapper = AbstractMail::getWrapper( m_Path,"Local Folders"); | 786 | wrapper = AbstractMail::getWrapper( m_Path,"Local Mailfolders"); |
787 | setPixmap( 0, PIXMAP_LOCALFOLDER ); | 787 | setPixmap( 0, PIXMAP_LOCALFOLDER ); |
788 | setText( 0, " Local Folders" ); | 788 | setText( 0, i18n(" Local Mailfolders") ); |
789 | setOpen( true ); | 789 | setOpen( true ); |
790 | folder = 0; | 790 | folder = 0; |
791 | } | 791 | } |
792 | 792 | ||
793 | MHviewItem::~MHviewItem() | 793 | MHviewItem::~MHviewItem() |
794 | { | 794 | { |
795 | delete wrapper; | 795 | delete wrapper; |
796 | } | 796 | } |
797 | 797 | ||
798 | AbstractMail *MHviewItem::getWrapper() | 798 | AbstractMail *MHviewItem::getWrapper() |
799 | { | 799 | { |
800 | return wrapper; | 800 | return wrapper; |
801 | } | 801 | } |
802 | 802 | ||
803 | void MHviewItem::refresh( QValueList<RecMailP> & target) | 803 | void MHviewItem::refresh( QValueList<RecMailP> & target) |
804 | { | 804 | { |
805 | refresh(false); | 805 | refresh(false); |
806 | getWrapper()->listMessages( "",target ); | 806 | getWrapper()->listMessages( "",target ); |
807 | } | 807 | } |
808 | 808 | ||
809 | void MHviewItem::refresh(bool force) | 809 | void MHviewItem::refresh(bool force) |
810 | { | 810 | { |
811 | if (childCount()>0 && force==false) return; | 811 | if (childCount()>0 && force==false) return; |
812 | removeChilds(); | 812 | removeChilds(); |
813 | currentFolders.clear(); | 813 | currentFolders.clear(); |
814 | QValueList<FolderP> *folders = wrapper->listFolders(); | 814 | QValueList<FolderP> *folders = wrapper->listFolders(); |
815 | QValueList<FolderP>::ConstIterator it; | 815 | QValueList<FolderP>::ConstIterator it; |
816 | MHfolderItem*item = 0; | 816 | MHfolderItem*item = 0; |
817 | MHfolderItem*pmaster = 0; | 817 | MHfolderItem*pmaster = 0; |
818 | QString fname = ""; | 818 | QString fname = ""; |
819 | int pos; | 819 | int pos; |
820 | for ( it = folders->begin(); it!=folders->end(); ++it) | 820 | for ( it = folders->begin(); it!=folders->end(); ++it) |
821 | { | 821 | { |
822 | fname = (*it)->getDisplayName(); | 822 | fname = (*it)->getDisplayName(); |
823 | /* this folder itself */ | 823 | /* this folder itself */ |
824 | if (fname=="/") | 824 | if (fname=="/") |
825 | { | 825 | { |
826 | currentFolders.append(fname); | 826 | currentFolders.append(fname); |
827 | folder = (*it); | 827 | folder = (*it); |
828 | continue; | 828 | continue; |
829 | } | 829 | } |
830 | currentFolders.append(fname); | 830 | currentFolders.append(fname); |
831 | pos = fname.findRev("/"); | 831 | pos = fname.findRev("/"); |
832 | if (pos > 0) | 832 | if (pos > 0) |
833 | { | 833 | { |
834 | fname = fname.left(pos); | 834 | fname = fname.left(pos); |
835 | pmaster = (MHfolderItem*)findSubItem(fname); | 835 | pmaster = (MHfolderItem*)findSubItem(fname); |
836 | } | 836 | } |
837 | else | 837 | else |
838 | { | 838 | { |
839 | pmaster = 0; | 839 | pmaster = 0; |
840 | } | 840 | } |
841 | if (pmaster) | 841 | if (pmaster) |
842 | { | 842 | { |
843 | item = new MHfolderItem( (*it), pmaster, item, this ); | 843 | item = new MHfolderItem( (*it), pmaster, item, this ); |
844 | } | 844 | } |
845 | else | 845 | else |
846 | { | 846 | { |
847 | item = new MHfolderItem( (*it), this , item ); | 847 | item = new MHfolderItem( (*it), this , item ); |
848 | } | 848 | } |
849 | item->setSelectable((*it)->may_select()); | 849 | item->setSelectable((*it)->may_select()); |
850 | } | 850 | } |
851 | delete folders; | 851 | delete folders; |
852 | } | 852 | } |
853 | 853 | ||
854 | RECBODYP MHviewItem::fetchBody( const RecMailP &mail ) | 854 | RECBODYP MHviewItem::fetchBody( const RecMailP &mail ) |
855 | { | 855 | { |
856 | 856 | ||
857 | return wrapper->fetchBody( mail ); | 857 | return wrapper->fetchBody( mail ); |
858 | } | 858 | } |
859 | 859 | ||
860 | QPopupMenu * MHviewItem::getContextMenu() | 860 | QPopupMenu * MHviewItem::getContextMenu() |
861 | { | 861 | { |
862 | QPopupMenu *m = new QPopupMenu(0); | 862 | QPopupMenu *m = new QPopupMenu(0); |
863 | if (m) | 863 | if (m) |
864 | { | 864 | { |
865 | m->insertItem(i18n("Refresh folder list"),0); | 865 | m->insertItem(i18n("Refresh folder list"),0); |
866 | m->insertItem(i18n("Create new folder"),1); | 866 | m->insertItem(i18n("Create new folder"),1); |
867 | m->insertItem(i18n("Delete all mails"),2); | 867 | m->insertItem(i18n("Delete all mails"),2); |
868 | m->insertItem(i18n("Move/Copie all mails"),3); | 868 | m->insertItem(i18n("Move/Copie all mails"),3); |
869 | } | 869 | } |
870 | return m; | 870 | return m; |
871 | } | 871 | } |
872 | 872 | ||
873 | void MHviewItem::createFolder() | 873 | void MHviewItem::createFolder() |
874 | { | 874 | { |
875 | Newmdirdlg ndirdlg(0,0,true); | 875 | Newmdirdlg ndirdlg(0,0,true); |
876 | //ndirdlg.showMaximized(); | 876 | //ndirdlg.showMaximized(); |
877 | if ( ndirdlg.exec() ) | 877 | if ( ndirdlg.exec() ) |
878 | { | 878 | { |
879 | QString ndir = ndirdlg.Newdir(); | 879 | QString ndir = ndirdlg.Newdir(); |
880 | if (wrapper->createMbox(ndir)) | 880 | if (wrapper->createMbox(ndir)) |
881 | { | 881 | { |
882 | refresh(true); | 882 | refresh(true); |
883 | } | 883 | } |
884 | } | 884 | } |
885 | } | 885 | } |
886 | 886 | ||
887 | void MHviewItem::downloadMails() | 887 | void MHviewItem::downloadMails() |
888 | { | 888 | { |
889 | AccountView*bl = accountView(); | 889 | AccountView*bl = accountView(); |
890 | if (!bl) return; | 890 | if (!bl) return; |
891 | bl->downloadMails(folder,getWrapper()); | 891 | bl->downloadMails(folder,getWrapper()); |
892 | } | 892 | } |
893 | 893 | ||
894 | QStringList MHviewItem::subFolders() | 894 | QStringList MHviewItem::subFolders() |
895 | { | 895 | { |
896 | return currentFolders; | 896 | return currentFolders; |
897 | } | 897 | } |
898 | 898 | ||
899 | void MHviewItem::contextMenuSelected(int which) | 899 | void MHviewItem::contextMenuSelected(int which) |
900 | { | 900 | { |
901 | switch (which) | 901 | switch (which) |
902 | { | 902 | { |
903 | case 0: | 903 | case 0: |
904 | refresh(true); | 904 | refresh(true); |
905 | break; | 905 | break; |
906 | case 1: | 906 | case 1: |
907 | createFolder(); | 907 | createFolder(); |
908 | break; | 908 | break; |
909 | case 2: | 909 | case 2: |
910 | deleteAllMail(getWrapper(),folder); | 910 | deleteAllMail(getWrapper(),folder); |
911 | break; | 911 | break; |
912 | case 3: | 912 | case 3: |
913 | downloadMails(); | 913 | downloadMails(); |
914 | break; | 914 | break; |
915 | default: | 915 | default: |
916 | break; | 916 | break; |
917 | } | 917 | } |
918 | } | 918 | } |
919 | 919 | ||
920 | MHfolderItem::~MHfolderItem() | 920 | MHfolderItem::~MHfolderItem() |
921 | {} | 921 | {} |
922 | 922 | ||
923 | MHfolderItem::MHfolderItem( const FolderP &folderInit, MHviewItem *parent , QListViewItem*after ) | 923 | MHfolderItem::MHfolderItem( const FolderP &folderInit, MHviewItem *parent , QListViewItem*after ) |
924 | : AccountViewItem(folderInit, parent,after ) | 924 | : AccountViewItem(folderInit, parent,after ) |
925 | { | 925 | { |
926 | mbox = parent; | 926 | mbox = parent; |
927 | initName(); | 927 | initName(); |
928 | } | 928 | } |
929 | 929 | ||
930 | MHfolderItem::MHfolderItem(const FolderP& folderInit, MHfolderItem *parent, QListViewItem*after, MHviewItem*master) | 930 | MHfolderItem::MHfolderItem(const FolderP& folderInit, MHfolderItem *parent, QListViewItem*after, MHviewItem*master) |
931 | : AccountViewItem(folderInit, parent,after ) | 931 | : AccountViewItem(folderInit, parent,after ) |
932 | { | 932 | { |
933 | folder = folderInit; | 933 | folder = folderInit; |
934 | mbox = master; | 934 | mbox = master; |
935 | initName(); | 935 | initName(); |
936 | } | 936 | } |
937 | 937 | ||
938 | void MHfolderItem::initName() | 938 | void MHfolderItem::initName() |
939 | { | 939 | { |
940 | QString bName = folder->getDisplayName(); | 940 | QString bName = folder->getDisplayName(); |
941 | if (bName.startsWith("/")&&bName.length()>1) | 941 | if (bName.startsWith("/")&&bName.length()>1) |
942 | { | 942 | { |
943 | bName.replace(0,1,""); | 943 | bName.replace(0,1,""); |
944 | } | 944 | } |
945 | int pos = bName.findRev("/"); | 945 | int pos = bName.findRev("/"); |
946 | if (pos > 0) | 946 | if (pos > 0) |
947 | { | 947 | { |
948 | bName.replace(0,pos+1,""); | 948 | bName.replace(0,pos+1,""); |
949 | } | 949 | } |
950 | if (bName.lower() == "outgoing") | 950 | if (bName.lower() == "outgoing") |
951 | { | 951 | { |
952 | setPixmap( 0, PIXMAP_OUTBOXFOLDER ); | 952 | setPixmap( 0, PIXMAP_OUTBOXFOLDER ); |
953 | } | 953 | } |
954 | else if (bName.lower() == "inbox") | 954 | else if (bName.lower() == "inbox") |
955 | { | 955 | { |
956 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 956 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
957 | } else if (bName.lower() == "drafts") { | 957 | } else if (bName.lower() == "drafts") { |
958 | setPixmap(0, SmallIcon ("edit")); | 958 | setPixmap(0, SmallIcon ("edit")); |
959 | } else { | 959 | } else { |
960 | setPixmap( 0, PIXMAP_MBOXFOLDER ); | 960 | setPixmap( 0, PIXMAP_MBOXFOLDER ); |
961 | } | 961 | } |
962 | setText( 0, bName ); | 962 | setText( 0, bName ); |
963 | } | 963 | } |
964 | 964 | ||
965 | const FolderP&MHfolderItem::getFolder()const | 965 | const FolderP&MHfolderItem::getFolder()const |
966 | { | 966 | { |
967 | return folder; | 967 | return folder; |
968 | } | 968 | } |
969 | 969 | ||
970 | void MHfolderItem::refresh(QValueList<RecMailP>&target) | 970 | void MHfolderItem::refresh(QValueList<RecMailP>&target) |
971 | { | 971 | { |
972 | if (folder->may_select()) | 972 | if (folder->may_select()) |
973 | mbox->getWrapper()->listMessages( folder->getName(),target ); | 973 | mbox->getWrapper()->listMessages( folder->getName(),target ); |
974 | } | 974 | } |
975 | 975 | ||
976 | RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail) | 976 | RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail) |
977 | { | 977 | { |
978 | return mbox->getWrapper()->fetchBody(aMail); | 978 | return mbox->getWrapper()->fetchBody(aMail); |
979 | } | 979 | } |
980 | 980 | ||
981 | void MHfolderItem::deleteFolder() | 981 | void MHfolderItem::deleteFolder() |
982 | { | 982 | { |
983 | int yesno = QMessageBox::warning(0,i18n("Delete folder"), | 983 | int yesno = QMessageBox::warning(0,i18n("Delete folder"), |
984 | i18n("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>").arg(folder->getDisplayName()), | 984 | i18n("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>").arg(folder->getDisplayName()), |
985 | i18n("Yes"), | 985 | i18n("Yes"), |
986 | i18n("No"),QString::null,1,1); | 986 | i18n("No"),QString::null,1,1); |
987 | 987 | ||
988 | if (yesno == 0) | 988 | if (yesno == 0) |
989 | { | 989 | { |
990 | if (mbox->getWrapper()->deleteMbox(folder)) | 990 | if (mbox->getWrapper()->deleteMbox(folder)) |
991 | { | 991 | { |
992 | QListView*v=listView(); | 992 | QListView*v=listView(); |
993 | MHviewItem * box = mbox; | 993 | MHviewItem * box = mbox; |
994 | /* be carefull - after that this object is destroyd so don't use | 994 | /* be carefull - after that this object is destroyd so don't use |
995 | * any member of it after that call!!*/ | 995 | * any member of it after that call!!*/ |
996 | mbox->refresh(true); | 996 | mbox->refresh(true); |
997 | if (v) | 997 | if (v) |
998 | { | 998 | { |
999 | v->setSelected(box,true); | 999 | v->setSelected(box,true); |
1000 | } | 1000 | } |
1001 | } | 1001 | } |
1002 | } | 1002 | } |
1003 | } | 1003 | } |
1004 | 1004 | ||
1005 | QPopupMenu * MHfolderItem::getContextMenu() | 1005 | QPopupMenu * MHfolderItem::getContextMenu() |
1006 | { | 1006 | { |
1007 | QPopupMenu *m = new QPopupMenu(0); | 1007 | QPopupMenu *m = new QPopupMenu(0); |
1008 | if (m) | 1008 | if (m) |
1009 | { | 1009 | { |
1010 | m->insertItem(i18n("Move/Copie all mails"),2); | 1010 | m->insertItem(i18n("Move/Copie all mails"),2); |
1011 | m->insertItem(i18n("Delete all mails"),0); | 1011 | m->insertItem(i18n("Delete all mails"),0); |
1012 | m->insertItem(i18n("Create new subfolder"),3); | 1012 | m->insertItem(i18n("Create new subfolder"),3); |
1013 | m->insertItem(i18n("Delete folder"),1); | 1013 | m->insertItem(i18n("Delete folder"),1); |
1014 | } | 1014 | } |
1015 | return m; | 1015 | return m; |
1016 | } | 1016 | } |
1017 | 1017 | ||
1018 | void MHfolderItem::downloadMails() | 1018 | void MHfolderItem::downloadMails() |
1019 | { | 1019 | { |
1020 | AccountView*bl = mbox->accountView(); | 1020 | AccountView*bl = mbox->accountView(); |
1021 | if (!bl) return; | 1021 | if (!bl) return; |
1022 | bl->downloadMails(folder,mbox->getWrapper()); | 1022 | bl->downloadMails(folder,mbox->getWrapper()); |
1023 | } | 1023 | } |
1024 | 1024 | ||
1025 | void MHfolderItem::createFolder() | 1025 | void MHfolderItem::createFolder() |
1026 | { | 1026 | { |
1027 | Newmdirdlg ndirdlg(0,0,true); | 1027 | Newmdirdlg ndirdlg(0,0,true); |
1028 | //ndirdlg.showMaximized(); | 1028 | //ndirdlg.showMaximized(); |
1029 | if (ndirdlg.exec() ) | 1029 | if (ndirdlg.exec() ) |
1030 | { | 1030 | { |
1031 | QString ndir = ndirdlg.Newdir(); | 1031 | QString ndir = ndirdlg.Newdir(); |
1032 | if (mbox->getWrapper()->createMbox(ndir,folder)) | 1032 | if (mbox->getWrapper()->createMbox(ndir,folder)) |
1033 | { | 1033 | { |
1034 | QListView*v=listView(); | 1034 | QListView*v=listView(); |
1035 | MHviewItem * box = mbox; | 1035 | MHviewItem * box = mbox; |
1036 | /* be carefull - after that this object is destroyd so don't use | 1036 | /* be carefull - after that this object is destroyd so don't use |
1037 | * any member of it after that call!!*/ | 1037 | * any member of it after that call!!*/ |
1038 | mbox->refresh(true); | 1038 | mbox->refresh(true); |
1039 | if (v) | 1039 | if (v) |
1040 | { | 1040 | { |
1041 | v->setSelected(box,true); | 1041 | v->setSelected(box,true); |
1042 | } | 1042 | } |
1043 | } | 1043 | } |
1044 | } | 1044 | } |