-rw-r--r-- | kmicromail/accountitem.cpp | 4 | ||||
-rw-r--r-- | kmicromail/accountview.cpp | 15 | ||||
-rw-r--r-- | kmicromail/mainwindow.cpp | 24 | ||||
-rw-r--r-- | kmicromail/mainwindow.h | 1 | ||||
-rw-r--r-- | kmicromail/opiemail.cpp | 4 |
5 files changed, 39 insertions, 9 deletions
diff --git a/kmicromail/accountitem.cpp b/kmicromail/accountitem.cpp index fcb2052..985a762 100644 --- a/kmicromail/accountitem.cpp +++ b/kmicromail/accountitem.cpp | |||
@@ -594,387 +594,387 @@ void IMAPviewItem::contextMenuSelected(int id) | |||
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 | ||
diff --git a/kmicromail/accountview.cpp b/kmicromail/accountview.cpp index cef55ab..4879d57 100644 --- a/kmicromail/accountview.cpp +++ b/kmicromail/accountview.cpp | |||
@@ -1,252 +1,263 @@ | |||
1 | 1 | ||
2 | #include "accountview.h" | 2 | #include "accountview.h" |
3 | #include "accountitem.h" | 3 | #include "accountitem.h" |
4 | #include "selectstore.h" | 4 | #include "selectstore.h" |
5 | 5 | ||
6 | #include <libmailwrapper/settings.h> | 6 | #include <libmailwrapper/settings.h> |
7 | #include <libmailwrapper/mailwrapper.h> | 7 | #include <libmailwrapper/mailwrapper.h> |
8 | #include <libmailwrapper/mailtypes.h> | 8 | #include <libmailwrapper/mailtypes.h> |
9 | #include <libmailwrapper/abstractmail.h> | 9 | #include <libmailwrapper/abstractmail.h> |
10 | 10 | ||
11 | /* OPIE */ | 11 | /* OPIE */ |
12 | #include <qpe/qpeapplication.h> | 12 | #include <qpe/qpeapplication.h> |
13 | 13 | ||
14 | /* QT */ | 14 | /* QT */ |
15 | #include <qmessagebox.h> | 15 | #include <qmessagebox.h> |
16 | #include <qpopupmenu.h> | 16 | #include <qpopupmenu.h> |
17 | #include <qcheckbox.h> | 17 | #include <qcheckbox.h> |
18 | #include <qtimer.h> | 18 | #include <qtimer.h> |
19 | #include <qspinbox.h> | 19 | #include <qspinbox.h> |
20 | #include <klocale.h> | 20 | #include <klocale.h> |
21 | #include <kmessagebox.h> | 21 | #include <kmessagebox.h> |
22 | 22 | ||
23 | using namespace Opie::Core; | 23 | using namespace Opie::Core; |
24 | AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) | 24 | AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) |
25 | : QListView( parent, name, flags ) | 25 | : QListView( parent, name, flags ) |
26 | { | 26 | { |
27 | //connect( this, SIGNAL( selectionChanged(QListViewItem*) ), | 27 | //connect( this, SIGNAL( selectionChanged(QListViewItem*) ), |
28 | // SLOT( refresh(QListViewItem*) ) ); | 28 | // SLOT( refresh(QListViewItem*) ) ); |
29 | connect( this, SIGNAL( clicked(QListViewItem*) ), | 29 | connect( this, SIGNAL( clicked(QListViewItem*) ), |
30 | SLOT( refresh(QListViewItem*) ) ); | 30 | SLOT( refresh(QListViewItem*) ) ); |
31 | connect( this, SIGNAL( returnPressed(QListViewItem*) ), | 31 | connect( this, SIGNAL( returnPressed(QListViewItem*) ), |
32 | SLOT( refresh(QListViewItem*) ) ); | 32 | SLOT( refresh(QListViewItem*) ) ); |
33 | connect( this, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, | 33 | connect( this, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, |
34 | SLOT( slotHold(int,QListViewItem*,const QPoint&,int) ) ); | 34 | SLOT( slotHold(int,QListViewItem*,const QPoint&,int) ) ); |
35 | setSorting(0); | 35 | setSorting(0); |
36 | } | 36 | } |
37 | 37 | ||
38 | AccountView::~AccountView() | 38 | AccountView::~AccountView() |
39 | { | 39 | { |
40 | imapAccounts.clear(); | 40 | imapAccounts.clear(); |
41 | mhAccounts.clear(); | 41 | mhAccounts.clear(); |
42 | } | 42 | } |
43 | 43 | ||
44 | void AccountView::slotContextMenu(int id) | 44 | void AccountView::slotContextMenu(int id) |
45 | { | 45 | { |
46 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); | 46 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); |
47 | if (!view) return; | 47 | if (!view) return; |
48 | view->contextMenuSelected(id); | 48 | view->contextMenuSelected(id); |
49 | } | 49 | } |
50 | 50 | ||
51 | void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int) | 51 | void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int) |
52 | { | 52 | { |
53 | if (button==1) {return;} | 53 | if (button==1) {return;} |
54 | if (!item) return; | 54 | if (!item) return; |
55 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 55 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
56 | QPopupMenu*m = view->getContextMenu(); | 56 | QPopupMenu*m = view->getContextMenu(); |
57 | if (!m) return; | 57 | if (!m) return; |
58 | connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int))); | 58 | connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int))); |
59 | m->setFocus(); | 59 | m->setFocus(); |
60 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 60 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
61 | delete m; | 61 | delete m; |
62 | } | 62 | } |
63 | 63 | ||
64 | void AccountView::populate( QList<Account> list ) | 64 | void AccountView::populate( QList<Account> list ) |
65 | { | 65 | { |
66 | clear(); | 66 | clear(); |
67 | 67 | ||
68 | imapAccounts.clear(); | 68 | imapAccounts.clear(); |
69 | mhAccounts.clear(); | 69 | mhAccounts.clear(); |
70 | 70 | ||
71 | mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this)); | 71 | mhAccounts.append(new MHviewItem(AbstractMail::defaultLocalfolder(),this)); |
72 | 72 | ||
73 | Account *it; | 73 | Account *it; |
74 | for ( it = list.first(); it; it = list.next() ) | 74 | for ( it = list.first(); it; it = list.next() ) |
75 | { | 75 | { |
76 | if ( it->getType() == MAILLIB::A_IMAP ) | 76 | if ( it->getType() == MAILLIB::A_IMAP ) |
77 | { | 77 | { |
78 | IMAPaccount *imap = static_cast<IMAPaccount *>(it); | 78 | IMAPaccount *imap = static_cast<IMAPaccount *>(it); |
79 | imapAccounts.append(new IMAPviewItem( imap, this )); | 79 | imapAccounts.append(new IMAPviewItem( imap, this )); |
80 | } | 80 | } |
81 | else if ( it->getType() == MAILLIB::A_POP3 ) | 81 | else if ( it->getType() == MAILLIB::A_POP3 ) |
82 | { | 82 | { |
83 | POP3account *pop3 = static_cast<POP3account *>(it); | 83 | POP3account *pop3 = static_cast<POP3account *>(it); |
84 | /* must not be hold 'cause it isn't required */ | 84 | /* must not be hold 'cause it isn't required */ |
85 | (void) new POP3viewItem( pop3, this ); | 85 | (void) new POP3viewItem( pop3, this ); |
86 | } | 86 | } |
87 | else if ( it->getType() == MAILLIB::A_NNTP ) | 87 | else if ( it->getType() == MAILLIB::A_NNTP ) |
88 | { | 88 | { |
89 | NNTPaccount *nntp = static_cast<NNTPaccount *>(it); | 89 | NNTPaccount *nntp = static_cast<NNTPaccount *>(it); |
90 | /* must not be hold 'cause it isn't required */ | 90 | /* must not be hold 'cause it isn't required */ |
91 | (void) new NNTPviewItem( nntp, this ); | 91 | (void) new NNTPviewItem( nntp, this ); |
92 | } | 92 | } |
93 | } | 93 | } |
94 | } | 94 | } |
95 | 95 | ||
96 | void AccountView::refresh(QListViewItem *item) | 96 | void AccountView::refresh(QListViewItem *item) |
97 | { | 97 | { |
98 | if ( item ) | 98 | if ( item ) |
99 | { | 99 | { |
100 | int result = KMessageBox::warningContinueCancel(this, | 100 | bool ask = true; |
101 | qDebug("text -%s- ",item->text( 0 ).latin1() ); | ||
102 | if ( item->text( 0 ) == i18n (" Local Mailfolders") ) | ||
103 | ask = false; | ||
104 | else { | ||
105 | if ( item->parent() ) | ||
106 | if ( item->parent()->text( 0 ) == i18n (" Local Mailfolders") ) | ||
107 | ask = false; | ||
108 | } | ||
109 | if ( ask ) { | ||
110 | int result = KMessageBox::warningContinueCancel(this, | ||
101 | i18n("Refresh\n%1\n?").arg( item->text(0) ), | 111 | i18n("Refresh\n%1\n?").arg( item->text(0) ), |
102 | i18n("Refresh"),i18n("Refresh"),i18n("Cancel"), | 112 | i18n("Refresh"),i18n("Refresh"),i18n("Cancel"), |
103 | true); | 113 | true); |
104 | if (result != KMessageBox::Continue) return; | 114 | if (result != KMessageBox::Continue) return; |
115 | } | ||
105 | m_currentItem = item; | 116 | m_currentItem = item; |
106 | topLevelWidget()->setCaption( i18n ( "Refreshing %1 ... please wait" ). arg ( m_currentItem->text( 0 ) ) ) ; | 117 | topLevelWidget()->setCaption( i18n ( "Refreshing %1 ... please wait" ). arg ( m_currentItem->text( 0 ) ) ) ; |
107 | QTimer::singleShot( 500, this, SLOT ( refreshCurrentSelected() ) ); | 118 | QTimer::singleShot( 500, this, SLOT ( refreshCurrentSelected() ) ); |
108 | 119 | ||
109 | } | 120 | } |
110 | } | 121 | } |
111 | void AccountView::refreshOutgoing() | 122 | void AccountView::refreshOutgoing() |
112 | { | 123 | { |
113 | m_currentItem = currentItem(); | 124 | m_currentItem = currentItem(); |
114 | if ( !m_currentItem ) return; | 125 | if ( !m_currentItem ) return; |
115 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); | 126 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); |
116 | if ( !view->getFolder() ) | 127 | if ( !view->getFolder() ) |
117 | return; | 128 | return; |
118 | QString bName = view->getFolder()->getDisplayName(); | 129 | QString bName = view->getFolder()->getDisplayName(); |
119 | if (bName.startsWith("/")&&bName.length()>1) | 130 | if (bName.startsWith("/")&&bName.length()>1) |
120 | { | 131 | { |
121 | bName.replace(0,1,""); | 132 | bName.replace(0,1,""); |
122 | } | 133 | } |
123 | int pos = bName.findRev("/"); | 134 | int pos = bName.findRev("/"); |
124 | if (pos > 0) | 135 | if (pos > 0) |
125 | { | 136 | { |
126 | bName.replace(0,pos+1,""); | 137 | bName.replace(0,pos+1,""); |
127 | } | 138 | } |
128 | //qDebug("name *%s* ",bName.lower().latin1() ); | 139 | //qDebug("name *%s* ",bName.lower().latin1() ); |
129 | if ( bName.lower() == "outgoing" || bName.lower() == "sent" || bName.lower() == "sendfailed" ) { | 140 | if ( bName.lower() == "outgoing" || bName.lower() == "sent" || bName.lower() == "sendfailed" ) { |
130 | refreshCurrent(); | 141 | refreshCurrent(); |
131 | // qDebug("refresh "); | 142 | // qDebug("refresh "); |
132 | } | 143 | } |
133 | } | 144 | } |
134 | void AccountView::refreshCurrentSelected() | 145 | void AccountView::refreshCurrentSelected() |
135 | { | 146 | { |
136 | if ( !m_currentItem ) return; | 147 | if ( !m_currentItem ) return; |
137 | QValueList<RecMailP> headerlist; | 148 | QValueList<RecMailP> headerlist; |
138 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); | 149 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); |
139 | view->refresh(headerlist); | 150 | view->refresh(headerlist); |
140 | emit refreshMailview(headerlist); | 151 | emit refreshMailview(headerlist); |
141 | topLevelWidget()->setCaption( i18n ( "KOpieMail/Pi" ) ) ; | 152 | topLevelWidget()->setCaption( i18n ( "KOpieMail/Pi" ) ) ; |
142 | } | 153 | } |
143 | 154 | ||
144 | void AccountView::refreshCurrent() | 155 | void AccountView::refreshCurrent() |
145 | { | 156 | { |
146 | m_currentItem = currentItem(); | 157 | m_currentItem = currentItem(); |
147 | if ( !m_currentItem ) return; | 158 | if ( !m_currentItem ) return; |
148 | topLevelWidget()->setCaption( i18n ( "Refreshing %1 ... please wait" ). arg ( m_currentItem->text( 0 ) ) ) ; | 159 | topLevelWidget()->setCaption( i18n ( "Refreshing %1 ... please wait" ). arg ( m_currentItem->text( 0 ) ) ) ; |
149 | QTimer::singleShot( 500, this, SLOT ( refreshCurrentSelected() ) ); | 160 | QTimer::singleShot( 500, this, SLOT ( refreshCurrentSelected() ) ); |
150 | } | 161 | } |
151 | 162 | ||
152 | void AccountView::refreshAll() | 163 | void AccountView::refreshAll() |
153 | { | 164 | { |
154 | } | 165 | } |
155 | 166 | ||
156 | RecBodyP AccountView::fetchBody(const RecMailP&aMail) | 167 | RecBodyP AccountView::fetchBody(const RecMailP&aMail) |
157 | { | 168 | { |
158 | QListViewItem*item = selectedItem (); | 169 | QListViewItem*item = selectedItem (); |
159 | if (!item) return new RecBody(); | 170 | if (!item) return new RecBody(); |
160 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 171 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
161 | return view->fetchBody(aMail); | 172 | return view->fetchBody(aMail); |
162 | } | 173 | } |
163 | 174 | ||
164 | void AccountView::setupFolderselect(Selectstore*sels) | 175 | void AccountView::setupFolderselect(Selectstore*sels) |
165 | { | 176 | { |
166 | 177 | ||
167 | #ifndef DESKTOP_VERSION | 178 | #ifndef DESKTOP_VERSION |
168 | sels->showMaximized(); | 179 | sels->showMaximized(); |
169 | #else | 180 | #else |
170 | sels->show(); | 181 | sels->show(); |
171 | #endif | 182 | #endif |
172 | QStringList sFolders; | 183 | QStringList sFolders; |
173 | unsigned int i = 0; | 184 | unsigned int i = 0; |
174 | for (i=0; i < mhAccounts.count();++i) | 185 | for (i=0; i < mhAccounts.count();++i) |
175 | { | 186 | { |
176 | mhAccounts[i]->refresh(false); | 187 | mhAccounts[i]->refresh(false); |
177 | sFolders = mhAccounts[i]->subFolders(); | 188 | sFolders = mhAccounts[i]->subFolders(); |
178 | sels->addAccounts(mhAccounts[i]->getWrapper(),sFolders); | 189 | sels->addAccounts(mhAccounts[i]->getWrapper(),sFolders); |
179 | } | 190 | } |
180 | for (i=0; i < imapAccounts.count();++i) | 191 | for (i=0; i < imapAccounts.count();++i) |
181 | { | 192 | { |
182 | if (imapAccounts[i]->offline()) | 193 | if (imapAccounts[i]->offline()) |
183 | continue; | 194 | continue; |
184 | imapAccounts[i]->refreshFolders(false); | 195 | imapAccounts[i]->refreshFolders(false); |
185 | sels->addAccounts(imapAccounts[i]->getWrapper(),imapAccounts[i]->subFolders()); | 196 | sels->addAccounts(imapAccounts[i]->getWrapper(),imapAccounts[i]->subFolders()); |
186 | } | 197 | } |
187 | } | 198 | } |
188 | void AccountView::downloadMailsInbox(const FolderP&fromFolder,AbstractMail*fromWrapper) | 199 | void AccountView::downloadMailsInbox(const FolderP&fromFolder,AbstractMail*fromWrapper) |
189 | { | 200 | { |
190 | #if 0 | 201 | #if 0 |
191 | AbstractMail*targetMail = 0; | 202 | AbstractMail*targetMail = 0; |
192 | QString targetFolder = ""; | 203 | QString targetFolder = ""; |
193 | Selectstore sels; | 204 | Selectstore sels; |
194 | setupFolderselect(&sels); | 205 | setupFolderselect(&sels); |
195 | if (!sels.exec()) return; | 206 | if (!sels.exec()) return; |
196 | targetMail = sels.currentMail(); | 207 | targetMail = sels.currentMail(); |
197 | targetFolder = sels.currentFolder(); | 208 | targetFolder = sels.currentFolder(); |
198 | if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) || | 209 | if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) || |
199 | targetFolder.isEmpty()) | 210 | targetFolder.isEmpty()) |
200 | { | 211 | { |
201 | return; | 212 | return; |
202 | } | 213 | } |
203 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | 214 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
204 | { | 215 | { |
205 | QMessageBox::critical(0,i18n("Error creating new Folder"), | 216 | QMessageBox::critical(0,i18n("Error creating new Folder"), |
206 | i18n("<center>Error while creating<br>new folder - breaking.</center>")); | 217 | i18n("<center>Error while creating<br>new folder - breaking.</center>")); |
207 | return; | 218 | return; |
208 | } | 219 | } |
209 | int maxsize = 0; | 220 | int maxsize = 0; |
210 | if ( sels.useSize->isChecked()) | 221 | if ( sels.useSize->isChecked()) |
211 | maxsize = sels.sizeSpinBox->value(); | 222 | maxsize = sels.sizeSpinBox->value(); |
212 | fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails(), maxsize); | 223 | fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails(), maxsize); |
213 | #endif | 224 | #endif |
214 | fromWrapper->downloadNewMails( fromFolder, mhAccounts[0]->getWrapper()); | 225 | fromWrapper->downloadNewMails( fromFolder, mhAccounts[0]->getWrapper()); |
215 | refreshCurrent(); | 226 | refreshCurrent(); |
216 | 227 | ||
217 | } | 228 | } |
218 | 229 | ||
219 | void AccountView::downloadMails(const FolderP&fromFolder,AbstractMail*fromWrapper) | 230 | void AccountView::downloadMails(const FolderP&fromFolder,AbstractMail*fromWrapper) |
220 | { | 231 | { |
221 | AbstractMail*targetMail = 0; | 232 | AbstractMail*targetMail = 0; |
222 | QString targetFolder = ""; | 233 | QString targetFolder = ""; |
223 | Selectstore sels; | 234 | Selectstore sels; |
224 | setupFolderselect(&sels); | 235 | setupFolderselect(&sels); |
225 | if (!sels.exec()) return; | 236 | if (!sels.exec()) return; |
226 | targetMail = sels.currentMail(); | 237 | targetMail = sels.currentMail(); |
227 | targetFolder = sels.currentFolder(); | 238 | targetFolder = sels.currentFolder(); |
228 | if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) || | 239 | if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) || |
229 | targetFolder.isEmpty()) | 240 | targetFolder.isEmpty()) |
230 | { | 241 | { |
231 | return; | 242 | return; |
232 | } | 243 | } |
233 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | 244 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
234 | { | 245 | { |
235 | QMessageBox::critical(0,i18n("Error creating new Folder"), | 246 | QMessageBox::critical(0,i18n("Error creating new Folder"), |
236 | i18n("<center>Error while creating<br>new folder - breaking.</center>")); | 247 | i18n("<center>Error while creating<br>new folder - breaking.</center>")); |
237 | return; | 248 | return; |
238 | } | 249 | } |
239 | int maxsize = 0; | 250 | int maxsize = 0; |
240 | if ( sels.useSize->isChecked()) | 251 | if ( sels.useSize->isChecked()) |
241 | maxsize = sels.sizeSpinBox->value(); | 252 | maxsize = sels.sizeSpinBox->value(); |
242 | 253 | ||
243 | fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails(), maxsize); | 254 | fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails(), maxsize); |
244 | refreshCurrent(); | 255 | refreshCurrent(); |
245 | } | 256 | } |
246 | 257 | ||
247 | bool AccountView::currentisDraft() | 258 | bool AccountView::currentisDraft() |
248 | { | 259 | { |
249 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); | 260 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); |
250 | if (!view) return false; | 261 | if (!view) return false; |
251 | return view->isDraftfolder(); | 262 | return view->isDraftfolder(); |
252 | } | 263 | } |
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp index 82a915e..3dde3cd 100644 --- a/kmicromail/mainwindow.cpp +++ b/kmicromail/mainwindow.cpp | |||
@@ -176,258 +176,272 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | |||
176 | mailView->addColumn( i18n( "To" ),QListView::Manual); | 176 | mailView->addColumn( i18n( "To" ),QListView::Manual); |
177 | mailView->setAllColumnsShowFocus(true); | 177 | mailView->setAllColumnsShowFocus(true); |
178 | //mailView->setSorting(-1); | 178 | //mailView->setSorting(-1); |
179 | mailView->setRootIsDecorated( false ); | 179 | mailView->setRootIsDecorated( false ); |
180 | statusWidget = new StatusWidget( wrapperBox ); | 180 | statusWidget = new StatusWidget( wrapperBox ); |
181 | statusWidget->hide(); | 181 | statusWidget->hide(); |
182 | mailView->setSelectionMode( QListView::Multi ); | 182 | mailView->setSelectionMode( QListView::Multi ); |
183 | mailView->setMultiSelection( true); | 183 | mailView->setMultiSelection( true); |
184 | mailView->setAlternateBackground(KPimGlobalPrefs::instance()->mAlternateColor ); | 184 | mailView->setAlternateBackground(KPimGlobalPrefs::instance()->mAlternateColor ); |
185 | //layout->addWidget( mailView ); | 185 | //layout->addWidget( mailView ); |
186 | //layout->setStretchFactor( folderView, 1 ); | 186 | //layout->setStretchFactor( folderView, 1 ); |
187 | //layout->setStretchFactor( mailView, 2 ); | 187 | //layout->setStretchFactor( mailView, 2 ); |
188 | 188 | ||
189 | slotAdjustLayout(); | 189 | slotAdjustLayout(); |
190 | #ifndef DESKTOP_VERSION | 190 | #ifndef DESKTOP_VERSION |
191 | QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); | 191 | QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); |
192 | QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); | 192 | QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); |
193 | if ( subLE ) | 193 | if ( subLE ) |
194 | QPEApplication::setStylusOperation( subLE ,QPEApplication::RightOnHold); | 194 | QPEApplication::setStylusOperation( subLE ,QPEApplication::RightOnHold); |
195 | if ( fromLE ) | 195 | if ( fromLE ) |
196 | QPEApplication::setStylusOperation( fromLE ,QPEApplication::RightOnHold); | 196 | QPEApplication::setStylusOperation( fromLE ,QPEApplication::RightOnHold); |
197 | if ( toLE ) | 197 | if ( toLE ) |
198 | QPEApplication::setStylusOperation( toLE ,QPEApplication::RightOnHold); | 198 | QPEApplication::setStylusOperation( toLE ,QPEApplication::RightOnHold); |
199 | #endif | 199 | #endif |
200 | connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, | 200 | connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, |
201 | SLOT( mailLeftClicked(QListViewItem*) ) ); | 201 | SLOT( mailLeftClicked(QListViewItem*) ) ); |
202 | connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, | 202 | connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, |
203 | SLOT( mailLeftClicked(QListViewItem*) ) ); | 203 | SLOT( mailLeftClicked(QListViewItem*) ) ); |
204 | connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, | 204 | connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, |
205 | SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); | 205 | SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); |
206 | connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), | 206 | connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), |
207 | this,SLOT(refreshMailView(const QValueList<RecMailP>&))); | 207 | this,SLOT(refreshMailView(const QValueList<RecMailP>&))); |
208 | 208 | ||
209 | connect( mailView, SIGNAL( currentChanged (QListViewItem* )),this, | 209 | connect( mailView, SIGNAL( currentChanged (QListViewItem* )),this, |
210 | SLOT( setInfoFields(QListViewItem*) ) ); | 210 | SLOT( setInfoFields(QListViewItem*) ) ); |
211 | 211 | ||
212 | connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); | 212 | connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); |
213 | connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); | 213 | connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); |
214 | // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); | 214 | // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); |
215 | connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); | 215 | connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); |
216 | //mailView->setMultiSelection ( true ); | 216 | //mailView->setMultiSelection ( true ); |
217 | //mailView->setSelectionMode( QListView::Extended ); | 217 | //mailView->setSelectionMode( QListView::Extended ); |
218 | QValueList<int> list; | 218 | QValueList<int> list; |
219 | int fw = 100; | 219 | int fw = 100; |
220 | if ( QApplication::desktop()->width() > 320 ) | 220 | if ( QApplication::desktop()->width() > 320 ) |
221 | fw = 50; | 221 | fw = 50; |
222 | list.append( fw ); | 222 | list.append( fw ); |
223 | list.append( 100 ); | 223 | list.append( 100 ); |
224 | split->setSizes( list ); | 224 | split->setSizes( list ); |
225 | QTimer::singleShot( 100, this, SLOT( slotAdjustColumns() ) ); | 225 | QTimer::singleShot( 100, this, SLOT( slotAdjustColumns() ) ); |
226 | mailView->setShowSortIndicator ( true ); | 226 | mailView->setShowSortIndicator ( true ); |
227 | QLabel *spacer = new QLabel( toolBar ); | 227 | QLabel *spacer = new QLabel( toolBar ); |
228 | spacer->setBackgroundMode( QWidget::PaletteButton ); | 228 | spacer->setBackgroundMode( QWidget::PaletteButton ); |
229 | toolBar->setStretchableWidget( spacer ); | 229 | toolBar->setStretchableWidget( spacer ); |
230 | 230 | ||
231 | QAction* closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this); | 231 | QAction* closeMail = new QAction(i18n("Close"),SmallIcon("exit"), 0, 0, this); |
232 | connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); | 232 | connect( closeMail, SIGNAL( activated() ), SLOT( close() ) ); |
233 | if ( QApplication::desktop()->width() > 320 ) | 233 | if ( QApplication::desktop()->width() > 320 ) |
234 | closeMail->addTo(toolBar); | 234 | closeMail->addTo(toolBar); |
235 | closeMail->addTo(mailMenu); | 235 | closeMail->addTo(mailMenu); |
236 | 236 | ||
237 | 237 | ||
238 | QPopupMenu* helpMenu = new QPopupMenu( menuBar ); | 238 | QPopupMenu* helpMenu = new QPopupMenu( menuBar ); |
239 | menuBar->insertItem( i18n( "Help" ), helpMenu ); | 239 | menuBar->insertItem( i18n( "Help" ), helpMenu ); |
240 | QAction* li = new QAction(i18n("About"), QPixmap(), 0, 0, this); | 240 | QAction* li = new QAction(i18n("About"), QPixmap(), 0, 0, this); |
241 | connect( li, SIGNAL( activated() ), SLOT( showAbout()) ); | 241 | connect( li, SIGNAL( activated() ), SLOT( showAbout()) ); |
242 | li->addTo(helpMenu); | 242 | li->addTo(helpMenu); |
243 | li = new QAction(i18n("Licence"),QPixmap(), 0, 0, this); | 243 | li = new QAction(i18n("Licence"),QPixmap(), 0, 0, this); |
244 | connect( li, SIGNAL( activated() ), SLOT( showLicence()) ); | 244 | connect( li, SIGNAL( activated() ), SLOT( showLicence()) ); |
245 | li->addTo(helpMenu); | 245 | li->addTo(helpMenu); |
246 | li = new QAction(i18n("LibEtPan Licence"), QPixmap(), 0, 0, this); | 246 | li = new QAction(i18n("LibEtPan Licence"), QPixmap(), 0, 0, this); |
247 | connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) ); | 247 | connect( li, SIGNAL( activated() ), SLOT( showEtpanLicence()) ); |
248 | li->addTo(helpMenu); | 248 | li->addTo(helpMenu); |
249 | connect( codecMenu, SIGNAL( activated(int) ), this, SLOT( slotSetCodec( int )) ); | 249 | connect( codecMenu, SIGNAL( activated(int) ), this, SLOT( slotSetCodec( int )) ); |
250 | slotSetCodec( KOPrefs::instance()->mCurrentCodec ); | 250 | slotSetCodec( KOPrefs::instance()->mCurrentCodec ); |
251 | menuBar->setMaximumWidth( menuBar->sizeHint().width()); | 251 | menuBar->setMaximumWidth( menuBar->sizeHint().width()); |
252 | //menuBar->setMaximumSize( menuBar->sizeHint()); | 252 | //menuBar->setMaximumSize( menuBar->sizeHint()); |
253 | #ifdef DESKTOP_VERSION | 253 | #ifdef DESKTOP_VERSION |
254 | resize ( 640, 480 ); | 254 | resize ( 640, 480 ); |
255 | #endif | 255 | #endif |
256 | } | 256 | } |
257 | 257 | ||
258 | MainWindow::~MainWindow() | 258 | MainWindow::~MainWindow() |
259 | { | 259 | { |
260 | } | 260 | } |
261 | 261 | ||
262 | void MainWindow::setInfoFields(QListViewItem* item ) | 262 | void MainWindow::setInfoFields(QListViewItem* item ) |
263 | { | 263 | { |
264 | if ( item == 0) { | 264 | if ( item == 0) { |
265 | if ( subLE ) subLE->setText(""); | 265 | if ( subLE ) subLE->setText(""); |
266 | if ( fromLE ) fromLE->setText(""); | 266 | if ( fromLE ) fromLE->setText(""); |
267 | if ( toLE ) toLE->setText(""); | 267 | if ( toLE ) toLE->setText(""); |
268 | return; | 268 | return; |
269 | } | 269 | } |
270 | RecMailP mail = ((MailListViewItem*)item)->data(); | 270 | RecMailP mail = ((MailListViewItem*)item)->data(); |
271 | if ( subLE ) subLE->setText(mail->getSubject()); | 271 | if ( subLE ) subLE->setText(mail->getSubject()); |
272 | if ( fromLE ) fromLE->setText(mail->getFrom()); | 272 | if ( fromLE ) fromLE->setText(mail->getFrom()); |
273 | if ( toLE ) toLE->setText(mail->To().join(";" )); | 273 | if ( toLE ) toLE->setText(mail->To().join(";" )); |
274 | if ( subLE ) subLE->setCursorPosition(0); | 274 | if ( subLE ) subLE->setCursorPosition(0); |
275 | if ( fromLE ) fromLE->setCursorPosition(0); | 275 | if ( fromLE ) fromLE->setCursorPosition(0); |
276 | if ( toLE ) toLE->setCursorPosition(0); | 276 | if ( toLE ) toLE->setCursorPosition(0); |
277 | 277 | ||
278 | } | 278 | } |
279 | void MainWindow::slotSetCodec( int codec ) | 279 | void MainWindow::slotSetCodec( int codec ) |
280 | { | 280 | { |
281 | codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, false ); | 281 | codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, false ); |
282 | //qDebug("codec %d ", codec); | 282 | //qDebug("codec %d ", codec); |
283 | KOPrefs::instance()->mCurrentCodec = codec; | 283 | KOPrefs::instance()->mCurrentCodec = codec; |
284 | KOPrefs::instance()->isDirty = true; | 284 | KOPrefs::instance()->isDirty = true; |
285 | QString name; | 285 | QString name; |
286 | switch ( codec ) { | 286 | switch ( codec ) { |
287 | case 0: | 287 | case 0: |
288 | name = "iso-8859-1"; | 288 | name = "iso-8859-1"; |
289 | break; | 289 | break; |
290 | case 1: | 290 | case 1: |
291 | name = "iso-8859-5"; | 291 | name = "iso-8859-5"; |
292 | break; | 292 | break; |
293 | case 2: | 293 | case 2: |
294 | name = "iso-8859-15"; | 294 | name = "iso-8859-15"; |
295 | break; | 295 | break; |
296 | case 3: | 296 | case 3: |
297 | name = "big-5"; | 297 | name = "big-5"; |
298 | break; | 298 | break; |
299 | case 4: | 299 | case 4: |
300 | name = "utf-8"; | 300 | name = "utf-8"; |
301 | break; | 301 | break; |
302 | case 5: | 302 | case 5: |
303 | name = KOPrefs::instance()->mSendCodec.lower(); | 303 | name = KOPrefs::instance()->mSendCodec.lower(); |
304 | break; | 304 | break; |
305 | } | 305 | } |
306 | KOPrefs::instance()->mCurrentCodeName = name ; | 306 | KOPrefs::instance()->mCurrentCodeName = name ; |
307 | codecMenu->changeItem ( 5, "Userdefined ("+KOPrefs::instance()->mSendCodec+")"); | 307 | codecMenu->changeItem ( 5, "Userdefined ("+KOPrefs::instance()->mSendCodec+")"); |
308 | codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, true ); | 308 | codecMenu->setItemChecked(KOPrefs::instance()->mCurrentCodec, true ); |
309 | } | 309 | } |
310 | void MainWindow::showLicence() | 310 | void MainWindow::showLicence() |
311 | { | 311 | { |
312 | KApplication::showLicence(); | 312 | KApplication::showLicence(); |
313 | } | 313 | } |
314 | void MainWindow::showAbout() | 314 | void MainWindow::showAbout() |
315 | { | 315 | { |
316 | QString version; | 316 | QString version; |
317 | #include <../version> | 317 | #include <../version> |
318 | 318 | ||
319 | QString cap = "About KOpieMail/Pi"; | 319 | QString cap = "About KOpieMail/Pi"; |
320 | QString text =i18n("KOpieMail/Platform-independent\n") + | 320 | QString text =i18n("KOpieMail/Platform-independent\n") + |
321 | "(OM/Pi) " + version + " - " | 321 | "(OM/Pi) " + version + " - " |
322 | 322 | ||
323 | #ifdef DESKTOP_VERSION | 323 | #ifdef DESKTOP_VERSION |
324 | "Desktop Edition\n" | 324 | "Desktop Edition\n" |
325 | #else | 325 | #else |
326 | "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n" | 326 | "PDA-Edition\nfor: Zaurus 5x00 / 7x0 / 8x0\n" |
327 | #endif | 327 | #endif |
328 | "www.pi-sync.info\n\n" | 328 | "www.pi-sync.info\n\n" |
329 | 329 | ||
330 | 330 | ||
331 | 331 | ||
332 | "Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.info>\n" | 332 | "Copyright (c) 2004 Lutz Rogowski <lutz@pi-sync.info>\n" |
333 | "KOpieMail/Pi is based on Opie Mail\n" | 333 | "KOpieMail/Pi is based on Opie Mail\n" |
334 | "Copyright (c) Rajko Albrecht and the Opie team\n" | 334 | "Copyright (c) Rajko Albrecht and the Opie team\n" |
335 | "KOpieMail/Pi is licensed under the GPL\n" | 335 | "KOpieMail/Pi is licensed under the GPL\n" |
336 | "\n" | 336 | "\n" |
337 | "KOpieMail/Pi uses LibEtPan - a mail stuff library\n" | 337 | "KOpieMail/Pi uses LibEtPan - a mail stuff library\n" |
338 | "Copyright (C) 2001, 2002 - DINH Viet Hoa\n" | 338 | "Copyright (C) 2001, 2002 - DINH Viet Hoa\n" |
339 | "libEtPan has its own licence - see LibEtPan licence\n"; | 339 | "libEtPan has its own licence - see LibEtPan licence\n"; |
340 | 340 | ||
341 | KApplication::showText( cap, text ); | 341 | KApplication::showText( cap, text ); |
342 | } | 342 | } |
343 | void MainWindow::showEtpanLicence() | 343 | void MainWindow::showEtpanLicence() |
344 | { | 344 | { |
345 | KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" ); | 345 | KApplication::showFile( "LibEtPan licence", "kdepim/kopiemail/COPYRIGHTlibetpan" ); |
346 | 346 | ||
347 | } | 347 | } |
348 | void MainWindow::appMessage(const QCString &, const QByteArray &) | 348 | void MainWindow::appMessage(const QCString &, const QByteArray &) |
349 | { | 349 | { |
350 | qDebug("appMessage implemented by subclass"); | 350 | qDebug("appMessage implemented by subclass"); |
351 | } | 351 | } |
352 | 352 | ||
353 | void MainWindow::slotAdjustLayout() { | 353 | void MainWindow::slotAdjustLayout() { |
354 | 354 | ||
355 | /* | 355 | /* |
356 | QWidget *d = QApplication::desktop(); | 356 | QWidget *d = QApplication::desktop(); |
357 | 357 | ||
358 | if ( d->width() < d->height() ) { | 358 | if ( d->width() < d->height() ) { |
359 | layout->setDirection( QBoxLayout::TopToBottom ); | 359 | layout->setDirection( QBoxLayout::TopToBottom ); |
360 | } else { | 360 | } else { |
361 | layout->setDirection( QBoxLayout::LeftToRight ); | 361 | layout->setDirection( QBoxLayout::LeftToRight ); |
362 | } | 362 | } |
363 | */ | 363 | */ |
364 | } | 364 | } |
365 | 365 | ||
366 | void MainWindow::slotAdjustColumns() | 366 | void MainWindow::slotAdjustColumns() |
367 | { | 367 | { |
368 | bool hidden = folderView->isHidden(); | 368 | |
369 | if ( hidden ) folderView->show(); | 369 | if ( !folderView->isHidden() ) |
370 | folderView->setColumnWidth( 0, folderView->visibleWidth() ); | 370 | folderView->setColumnWidth( 0, folderView->visibleWidth() ); |
371 | if ( hidden ) folderView->hide(); | ||
372 | 371 | ||
373 | mailView->setColumnWidth( 0, 10 ); | 372 | mailView->setColumnWidth( 0, 10 ); |
374 | mailView->setColumnWidth( 1, 100 ); | 373 | mailView->setColumnWidth( 1, 100 ); |
375 | mailView->setColumnWidth( 2, 100 ); | 374 | mailView->setColumnWidth( 2, 100 ); |
376 | mailView->setColumnWidth( 3, 70 ); | 375 | mailView->setColumnWidth( 3, 70 ); |
377 | mailView->setColumnWidth( 4, 170 ); | 376 | mailView->setColumnWidth( 4, 180 ); |
377 | if ( KOPrefs::instance()->mShowToField ) | ||
378 | mailView->setColumnWidth( 5, 100 ); | ||
379 | mailView->setColumnAlignment( 3, AlignRight); | ||
380 | mailView->setColumnAlignment( 4, AlignRight); | ||
381 | } | ||
382 | void MainWindow::slotAdjustColumnsWide() | ||
383 | { | ||
384 | if ( !folderView->isHidden() ) | ||
385 | folderView->setColumnWidth( 0, folderView->visibleWidth() ); | ||
386 | |||
387 | mailView->setColumnWidth( 0, 10 ); | ||
388 | mailView->setColumnWidth( 1, 200 ); | ||
389 | mailView->setColumnWidth( 2, 200 ); | ||
390 | mailView->setColumnWidth( 3, 70 ); | ||
391 | mailView->setColumnWidth( 4, 180 ); | ||
378 | if ( KOPrefs::instance()->mShowToField ) | 392 | if ( KOPrefs::instance()->mShowToField ) |
379 | mailView->setColumnWidth( 5, 100 ); | 393 | mailView->setColumnWidth( 5, 100 ); |
380 | mailView->setColumnAlignment( 3, AlignRight); | 394 | mailView->setColumnAlignment( 3, AlignRight); |
381 | } | 395 | } |
382 | 396 | ||
383 | void MainWindow::slotEditSettings() | 397 | void MainWindow::slotEditSettings() |
384 | { | 398 | { |
385 | } | 399 | } |
386 | void MainWindow::slotEditGlobalSettings() | 400 | void MainWindow::slotEditGlobalSettings() |
387 | { | 401 | { |
388 | } | 402 | } |
389 | 403 | ||
390 | void MainWindow::slotShowFolders( bool ) | 404 | void MainWindow::slotShowFolders( bool ) |
391 | { | 405 | { |
392 | qDebug("not implemented: "); | 406 | qDebug("not implemented: "); |
393 | } | 407 | } |
394 | 408 | ||
395 | void MainWindow::refreshMailView(const QValueList<RecMailP>&) | 409 | void MainWindow::refreshMailView(const QValueList<RecMailP>&) |
396 | { | 410 | { |
397 | qDebug("not implemented: "); | 411 | qDebug("not implemented: "); |
398 | } | 412 | } |
399 | 413 | ||
400 | void MainWindow::mailLeftClicked(QListViewItem * ) | 414 | void MainWindow::mailLeftClicked(QListViewItem * ) |
401 | { | 415 | { |
402 | qDebug("not implemented: "); | 416 | qDebug("not implemented: "); |
403 | } | 417 | } |
404 | 418 | ||
405 | void MainWindow::displayMail() | 419 | void MainWindow::displayMail() |
406 | { | 420 | { |
407 | qDebug("not implemented: "); | 421 | qDebug("not implemented: "); |
408 | } | 422 | } |
409 | 423 | ||
410 | void MainWindow::slotDeleteMail() | 424 | void MainWindow::slotDeleteMail() |
411 | { | 425 | { |
412 | qDebug("not implemented: "); | 426 | qDebug("not implemented: "); |
413 | } | 427 | } |
414 | 428 | ||
415 | void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) | 429 | void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) |
416 | { | 430 | { |
417 | qDebug("not implemented: "); | 431 | qDebug("not implemented: "); |
418 | } | 432 | } |
419 | 433 | ||
420 | void MainWindow::slotSendQueued() | 434 | void MainWindow::slotSendQueued() |
421 | { | 435 | { |
422 | qDebug("not implemented: "); | 436 | qDebug("not implemented: "); |
423 | } | 437 | } |
424 | 438 | ||
425 | void MainWindow::slotEditAccounts() | 439 | void MainWindow::slotEditAccounts() |
426 | { | 440 | { |
427 | qDebug("not implemented: "); | 441 | qDebug("not implemented: "); |
428 | } | 442 | } |
429 | 443 | ||
430 | void MainWindow::slotComposeMail() | 444 | void MainWindow::slotComposeMail() |
431 | { | 445 | { |
432 | qDebug("not implemented: "); | 446 | qDebug("not implemented: "); |
433 | } | 447 | } |
diff --git a/kmicromail/mainwindow.h b/kmicromail/mainwindow.h index 178d2bb..f65f3b4 100644 --- a/kmicromail/mainwindow.h +++ b/kmicromail/mainwindow.h | |||
@@ -1,74 +1,75 @@ | |||
1 | 1 | ||
2 | // CHANGED 2004-08-06 Lutz Rogowski | 2 | // CHANGED 2004-08-06 Lutz Rogowski |
3 | #ifndef MAINWINDOW_H | 3 | #ifndef MAINWINDOW_H |
4 | #define MAINWINDOW_H | 4 | #define MAINWINDOW_H |
5 | 5 | ||
6 | #include <qmainwindow.h> | 6 | #include <qmainwindow.h> |
7 | #include <klistview.h> | 7 | #include <klistview.h> |
8 | #include <qaction.h> | 8 | #include <qaction.h> |
9 | #include <qlineedit.h> | 9 | #include <qlineedit.h> |
10 | 10 | ||
11 | #include <qtoolbar.h> | 11 | #include <qtoolbar.h> |
12 | #ifdef DESKTOP_VERSION | 12 | #ifdef DESKTOP_VERSION |
13 | #include <qmenubar.h> | 13 | #include <qmenubar.h> |
14 | #define QPEMenuBar QMenuBar | 14 | #define QPEMenuBar QMenuBar |
15 | #else | 15 | #else |
16 | #include <qpe/qpemenubar.h> | 16 | #include <qpe/qpemenubar.h> |
17 | #endif | 17 | #endif |
18 | 18 | ||
19 | #include "accountview.h" | 19 | #include "accountview.h" |
20 | #include "statuswidget.h" | 20 | #include "statuswidget.h" |
21 | 21 | ||
22 | #include <libmailwrapper/mailtypes.h> | 22 | #include <libmailwrapper/mailtypes.h> |
23 | #include <opie2/osmartpointer.h> | 23 | #include <opie2/osmartpointer.h> |
24 | 24 | ||
25 | class RecMail; | 25 | class RecMail; |
26 | 26 | ||
27 | class MainWindow : public QMainWindow | 27 | class MainWindow : public QMainWindow |
28 | { | 28 | { |
29 | Q_OBJECT | 29 | Q_OBJECT |
30 | 30 | ||
31 | public: | 31 | public: |
32 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); | 32 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); |
33 | virtual ~MainWindow(); | 33 | virtual ~MainWindow(); |
34 | 34 | ||
35 | public slots: | 35 | public slots: |
36 | virtual void slotAdjustColumns(); | 36 | virtual void slotAdjustColumns(); |
37 | virtual void slotAdjustColumnsWide(); | ||
37 | virtual void appMessage(const QCString &msg, const QByteArray &data); | 38 | virtual void appMessage(const QCString &msg, const QByteArray &data); |
38 | virtual void slotComposeMail(); | 39 | virtual void slotComposeMail(); |
39 | 40 | ||
40 | protected slots: | 41 | protected slots: |
41 | virtual void setInfoFields(QListViewItem* ); | 42 | virtual void setInfoFields(QListViewItem* ); |
42 | virtual void slotSendQueued(); | 43 | virtual void slotSendQueued(); |
43 | virtual void slotEditAccounts(); | 44 | virtual void slotEditAccounts(); |
44 | virtual void slotShowFolders( bool show ); | 45 | virtual void slotShowFolders( bool show ); |
45 | virtual void refreshMailView(const QValueList<RecMailP>&); | 46 | virtual void refreshMailView(const QValueList<RecMailP>&); |
46 | virtual void displayMail(); | 47 | virtual void displayMail(); |
47 | virtual void slotGetMail() = 0; | 48 | virtual void slotGetMail() = 0; |
48 | virtual void slotGetAllMail() = 0; | 49 | virtual void slotGetAllMail() = 0; |
49 | virtual void slotDeleteMail(); | 50 | virtual void slotDeleteMail(); |
50 | virtual void slotDeleteAllMail() = 0; | 51 | virtual void slotDeleteAllMail() = 0; |
51 | virtual void slotSetCodec(int); | 52 | virtual void slotSetCodec(int); |
52 | virtual void mailHold(int, QListViewItem *,const QPoint&,int); | 53 | virtual void mailHold(int, QListViewItem *,const QPoint&,int); |
53 | virtual void slotAdjustLayout(); | 54 | virtual void slotAdjustLayout(); |
54 | virtual void slotEditSettings(); | 55 | virtual void slotEditSettings(); |
55 | virtual void slotEditGlobalSettings(); | 56 | virtual void slotEditGlobalSettings(); |
56 | virtual void mailLeftClicked( QListViewItem * ); | 57 | virtual void mailLeftClicked( QListViewItem * ); |
57 | void showLicence(); | 58 | void showLicence(); |
58 | void showAbout(); | 59 | void showAbout(); |
59 | void showEtpanLicence(); | 60 | void showEtpanLicence(); |
60 | 61 | ||
61 | protected: | 62 | protected: |
62 | QToolBar *toolBar; | 63 | QToolBar *toolBar; |
63 | StatusWidget *statusWidget; | 64 | StatusWidget *statusWidget; |
64 | QPEMenuBar *menuBar; | 65 | QPEMenuBar *menuBar; |
65 | QPopupMenu *mailMenu, *settingsMenu, *codecMenu; | 66 | QPopupMenu *mailMenu, *settingsMenu, *codecMenu; |
66 | QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails, | 67 | QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails, |
67 | *editSettings, *editAccounts, *syncFolders; | 68 | *editSettings, *editAccounts, *syncFolders; |
68 | AccountView *folderView; | 69 | AccountView *folderView; |
69 | KListView *mailView; | 70 | KListView *mailView; |
70 | QLineEdit* toLE,*fromLE,*subLE; | 71 | QLineEdit* toLE,*fromLE,*subLE; |
71 | //QBoxLayout *layout; | 72 | //QBoxLayout *layout; |
72 | }; | 73 | }; |
73 | 74 | ||
74 | #endif | 75 | #endif |
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index e296d9c..75a75b9 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp | |||
@@ -352,339 +352,343 @@ void OpieMail::slotDownloadMail( ) | |||
352 | Global::statusMessage("Mail is already locally stored!"); | 352 | Global::statusMessage("Mail is already locally stored!"); |
353 | return; | 353 | return; |
354 | } | 354 | } |
355 | if ( !targetMail->createMbox(lfName)) { | 355 | if ( !targetMail->createMbox(lfName)) { |
356 | Global::statusMessage("Error creating folder!"); | 356 | Global::statusMessage("Error creating folder!"); |
357 | return; | 357 | return; |
358 | } | 358 | } |
359 | Global::statusMessage("Fetching mail...please wait!"); | 359 | Global::statusMessage("Fetching mail...please wait!"); |
360 | qApp->processEvents(); | 360 | qApp->processEvents(); |
361 | encodedString*st = 0; | 361 | encodedString*st = 0; |
362 | st = mail->Wrapper()->fetchRawBody(mail); | 362 | st = mail->Wrapper()->fetchRawBody(mail); |
363 | if ( st ) { | 363 | if ( st ) { |
364 | targetMail->storeMessage(st->Content(),st->Length(),lfName); | 364 | targetMail->storeMessage(st->Content(),st->Length(),lfName); |
365 | Global::statusMessage("Mail stored in "+ lfName); | 365 | Global::statusMessage("Mail stored in "+ lfName); |
366 | delete st; | 366 | delete st; |
367 | } else { | 367 | } else { |
368 | Global::statusMessage("Error: Cannot fetch mail!"); | 368 | Global::statusMessage("Error: Cannot fetch mail!"); |
369 | } | 369 | } |
370 | } | 370 | } |
371 | 371 | ||
372 | 372 | ||
373 | void OpieMail::deleteAndDisplayNextMail(ViewMail * vm) | 373 | void OpieMail::deleteAndDisplayNextMail(ViewMail * vm) |
374 | { | 374 | { |
375 | QListViewItem*item = mailView->currentItem(); | 375 | QListViewItem*item = mailView->currentItem(); |
376 | if (!item ) { | 376 | if (!item ) { |
377 | closeViewMail(vm); | 377 | closeViewMail(vm); |
378 | return; | 378 | return; |
379 | } | 379 | } |
380 | RecMailP mail = ((MailListViewItem*)item)->data(); | 380 | RecMailP mail = ((MailListViewItem*)item)->data(); |
381 | mail->Wrapper()->deleteMail( mail ); | 381 | mail->Wrapper()->deleteMail( mail ); |
382 | item = item->itemBelow(); | 382 | item = item->itemBelow(); |
383 | if (!item ) { | 383 | if (!item ) { |
384 | closeViewMail(vm); | 384 | closeViewMail(vm); |
385 | return; | 385 | return; |
386 | } | 386 | } |
387 | mailView->setCurrentItem(item); | 387 | mailView->setCurrentItem(item); |
388 | mail = ((MailListViewItem*)item)->data(); | 388 | mail = ((MailListViewItem*)item)->data(); |
389 | RecBodyP body = folderView->fetchBody(mail); | 389 | RecBodyP body = folderView->fetchBody(mail); |
390 | vm->setBody( body ); | 390 | vm->setBody( body ); |
391 | vm->setMail( mail ); | 391 | vm->setMail( mail ); |
392 | } | 392 | } |
393 | void OpieMail::displayNextMail(ViewMail * vm) | 393 | void OpieMail::displayNextMail(ViewMail * vm) |
394 | { | 394 | { |
395 | QListViewItem*item = mailView->currentItem(); | 395 | QListViewItem*item = mailView->currentItem(); |
396 | if (!item) return; | 396 | if (!item) return; |
397 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); | 397 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); |
398 | item = item->itemBelow(); | 398 | item = item->itemBelow(); |
399 | if (!item) { | 399 | if (!item) { |
400 | vm->setCaption(i18n("End of List" )); | 400 | vm->setCaption(i18n("End of List" )); |
401 | return; | 401 | return; |
402 | } | 402 | } |
403 | mailView->setCurrentItem(item); | 403 | mailView->setCurrentItem(item); |
404 | RecMailP mail = ((MailListViewItem*)item)->data(); | 404 | RecMailP mail = ((MailListViewItem*)item)->data(); |
405 | RecBodyP body = folderView->fetchBody(mail); | 405 | RecBodyP body = folderView->fetchBody(mail); |
406 | vm->setBody( body ); | 406 | vm->setBody( body ); |
407 | vm->setMail( mail ); | 407 | vm->setMail( mail ); |
408 | } | 408 | } |
409 | void OpieMail::displayMail() | 409 | void OpieMail::displayMail() |
410 | { | 410 | { |
411 | QListViewItem*item = mailView->currentItem(); | 411 | QListViewItem*item = mailView->currentItem(); |
412 | if (!item) return; | 412 | if (!item) return; |
413 | RecMailP mail = ((MailListViewItem*)item)->data(); | 413 | RecMailP mail = ((MailListViewItem*)item)->data(); |
414 | RecBodyP body = folderView->fetchBody(mail); | 414 | RecBodyP body = folderView->fetchBody(mail); |
415 | ViewMail readMail( this,"", Qt::WType_Modal ); | 415 | ViewMail readMail( this,"", Qt::WType_Modal ); |
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); |
677 | } else { | 681 | } else { |
678 | ComposeMail compose( settings, this, 0, true ); | 682 | ComposeMail compose( settings, this, 0, true ); |
679 | compose.slotAdjustColumns(); | 683 | compose.slotAdjustColumns(); |
680 | #ifndef DESKTOP_VERSION | 684 | #ifndef DESKTOP_VERSION |
681 | compose.showMaximized(); | 685 | compose.showMaximized(); |
682 | #endif | 686 | #endif |
683 | mCurrentComposer = &compose; | 687 | mCurrentComposer = &compose; |
684 | mCurrentComposer->insertAttendees(uid,nameList,emailList,uidList); | 688 | mCurrentComposer->insertAttendees(uid,nameList,emailList,uidList); |
685 | compose.exec(); | 689 | compose.exec(); |
686 | mCurrentComposer = 0; | 690 | mCurrentComposer = 0; |
687 | folderView->refreshOutgoing(); | 691 | folderView->refreshOutgoing(); |
688 | raise(); | 692 | raise(); |
689 | } | 693 | } |
690 | } | 694 | } |