-rw-r--r-- | noncore/net/mail/accountitem.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/net/mail/accountitem.cpp b/noncore/net/mail/accountitem.cpp index 4869df8..10db2c6 100644 --- a/noncore/net/mail/accountitem.cpp +++ b/noncore/net/mail/accountitem.cpp | |||
@@ -790,257 +790,257 @@ void MHviewItem::refresh(bool force) | |||
790 | pmaster = (MHfolderItem*)findSubItem(fname); | 790 | pmaster = (MHfolderItem*)findSubItem(fname); |
791 | } | 791 | } |
792 | else | 792 | else |
793 | { | 793 | { |
794 | pmaster = 0; | 794 | pmaster = 0; |
795 | } | 795 | } |
796 | if (pmaster) | 796 | if (pmaster) |
797 | { | 797 | { |
798 | item = new MHfolderItem( (*it), pmaster, item, this ); | 798 | item = new MHfolderItem( (*it), pmaster, item, this ); |
799 | } | 799 | } |
800 | else | 800 | else |
801 | { | 801 | { |
802 | item = new MHfolderItem( (*it), this , item ); | 802 | item = new MHfolderItem( (*it), this , item ); |
803 | } | 803 | } |
804 | item->setSelectable((*it)->may_select()); | 804 | item->setSelectable((*it)->may_select()); |
805 | } | 805 | } |
806 | delete folders; | 806 | delete folders; |
807 | } | 807 | } |
808 | 808 | ||
809 | RECBODYP MHviewItem::fetchBody( const RecMailP &mail ) | 809 | RECBODYP MHviewItem::fetchBody( const RecMailP &mail ) |
810 | { | 810 | { |
811 | odebug << "MH fetchBody" << oendl; | 811 | odebug << "MH fetchBody" << oendl; |
812 | return wrapper->fetchBody( mail ); | 812 | return wrapper->fetchBody( mail ); |
813 | } | 813 | } |
814 | 814 | ||
815 | QPopupMenu * MHviewItem::getContextMenu() | 815 | QPopupMenu * MHviewItem::getContextMenu() |
816 | { | 816 | { |
817 | QPopupMenu *m = new QPopupMenu(0); | 817 | QPopupMenu *m = new QPopupMenu(0); |
818 | if (m) | 818 | if (m) |
819 | { | 819 | { |
820 | m->insertItem(QObject::tr("Refresh folder list",contextName),SERVER_MENU_REFRESH_FOLDER); | 820 | m->insertItem(QObject::tr("Refresh folder list",contextName),SERVER_MENU_REFRESH_FOLDER); |
821 | m->insertItem(QObject::tr("Create new folder",contextName),FOLDER_MENU_NEW_SUBFOLDER); | 821 | m->insertItem(QObject::tr("Create new folder",contextName),FOLDER_MENU_NEW_SUBFOLDER); |
822 | m->insertItem(QObject::tr("Delete all mails",contextName),FOLDER_MENU_DELETE_ALL_MAILS); | 822 | m->insertItem(QObject::tr("Delete all mails",contextName),FOLDER_MENU_DELETE_ALL_MAILS); |
823 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),FOLDER_MENU_MOVE_MAILS); | 823 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),FOLDER_MENU_MOVE_MAILS); |
824 | } | 824 | } |
825 | return m; | 825 | return m; |
826 | } | 826 | } |
827 | 827 | ||
828 | void MHviewItem::createFolder() | 828 | void MHviewItem::createFolder() |
829 | { | 829 | { |
830 | Newmdirdlg ndirdlg(0,0,true); | 830 | Newmdirdlg ndirdlg(0,0,true); |
831 | if ( QPEApplication::execDialog( &ndirdlg ) ) | 831 | if ( QPEApplication::execDialog( &ndirdlg ) ) |
832 | { | 832 | { |
833 | QString ndir = ndirdlg.Newdir(); | 833 | QString ndir = ndirdlg.Newdir(); |
834 | if (wrapper->createMbox(ndir)) | 834 | if (wrapper->createMbox(ndir)) |
835 | { | 835 | { |
836 | refresh(true); | 836 | refresh(true); |
837 | } | 837 | } |
838 | } | 838 | } |
839 | } | 839 | } |
840 | 840 | ||
841 | void MHviewItem::downloadMails() | 841 | void MHviewItem::downloadMails() |
842 | { | 842 | { |
843 | AccountView*bl = accountView(); | 843 | AccountView*bl = accountView(); |
844 | if (!bl) return; | 844 | if (!bl) return; |
845 | bl->downloadMails(folder,getWrapper()); | 845 | bl->downloadMails(folder,getWrapper()); |
846 | } | 846 | } |
847 | 847 | ||
848 | QStringList MHviewItem::subFolders() | 848 | QStringList MHviewItem::subFolders() |
849 | { | 849 | { |
850 | return currentFolders; | 850 | return currentFolders; |
851 | } | 851 | } |
852 | 852 | ||
853 | void MHviewItem::contextMenuSelected(int which) | 853 | void MHviewItem::contextMenuSelected(int which) |
854 | { | 854 | { |
855 | AccountView*view = 0; | 855 | AccountView*view = 0; |
856 | 856 | ||
857 | switch (which) | 857 | switch (which) |
858 | { | 858 | { |
859 | case SERVER_MENU_REFRESH_FOLDER: | 859 | case SERVER_MENU_REFRESH_FOLDER: |
860 | refresh(true); | 860 | refresh(true); |
861 | break; | 861 | break; |
862 | case FOLDER_MENU_NEW_SUBFOLDER: | 862 | case FOLDER_MENU_NEW_SUBFOLDER: |
863 | createFolder(); | 863 | createFolder(); |
864 | break; | 864 | break; |
865 | case FOLDER_MENU_DELETE_ALL_MAILS: | 865 | case FOLDER_MENU_DELETE_ALL_MAILS: |
866 | deleteAllMail(getWrapper(),folder); | 866 | deleteAllMail(getWrapper(),folder); |
867 | break; | 867 | break; |
868 | case FOLDER_MENU_MOVE_MAILS: | 868 | case FOLDER_MENU_MOVE_MAILS: |
869 | downloadMails(); | 869 | downloadMails(); |
870 | break; | 870 | break; |
871 | case FOLDER_MENU_REFRESH_HEADER: | 871 | case FOLDER_MENU_REFRESH_HEADER: |
872 | view = (AccountView*)listView(); | 872 | view = (AccountView*)listView(); |
873 | if (view) view->refreshCurrent(); | 873 | if (view) view->refreshCurrent(); |
874 | break; | 874 | break; |
875 | default: | 875 | default: |
876 | break; | 876 | break; |
877 | } | 877 | } |
878 | } | 878 | } |
879 | 879 | ||
880 | MHfolderItem::~MHfolderItem() | 880 | MHfolderItem::~MHfolderItem() |
881 | {} | 881 | {} |
882 | 882 | ||
883 | MHfolderItem::MHfolderItem( const FolderP &folderInit, MHviewItem *parent , QListViewItem*after ) | 883 | MHfolderItem::MHfolderItem( const FolderP &folderInit, MHviewItem *parent , QListViewItem*after ) |
884 | : AccountViewItem(folderInit, parent,after ) | 884 | : AccountViewItem(folderInit, parent,after ) |
885 | { | 885 | { |
886 | mbox = parent; | 886 | mbox = parent; |
887 | initName(); | 887 | initName(); |
888 | } | 888 | } |
889 | 889 | ||
890 | MHfolderItem::MHfolderItem(const FolderP& folderInit, MHfolderItem *parent, QListViewItem*after, MHviewItem*master) | 890 | MHfolderItem::MHfolderItem(const FolderP& folderInit, MHfolderItem *parent, QListViewItem*after, MHviewItem*master) |
891 | : AccountViewItem(folderInit, parent,after ) | 891 | : AccountViewItem(folderInit, parent,after ) |
892 | { | 892 | { |
893 | folder = folderInit; | 893 | folder = folderInit; |
894 | mbox = master; | 894 | mbox = master; |
895 | initName(); | 895 | initName(); |
896 | } | 896 | } |
897 | 897 | ||
898 | void MHfolderItem::initName() | 898 | void MHfolderItem::initName() |
899 | { | 899 | { |
900 | QString bName = folder->getDisplayName(); | 900 | QString bName = folder->getDisplayName(); |
901 | if (bName.startsWith("/")&&bName.length()>1) | 901 | if (bName.startsWith("/")&&bName.length()>1) |
902 | { | 902 | { |
903 | bName.replace(0,1,""); | 903 | bName.replace(0,1,""); |
904 | } | 904 | } |
905 | int pos = bName.findRev("/"); | 905 | int pos = bName.findRev("/"); |
906 | if (pos > 0) | 906 | if (pos > 0) |
907 | { | 907 | { |
908 | bName.replace(0,pos+1,""); | 908 | bName.replace(0,pos+1,""); |
909 | } | 909 | } |
910 | if (bName.lower() == "outgoing") | 910 | if (bName.lower() == "outgoing") |
911 | { | 911 | { |
912 | setPixmap( 0, PIXMAP_OUTBOXFOLDER ); | 912 | setPixmap( 0, PIXMAP_OUTBOXFOLDER ); |
913 | } | 913 | } |
914 | else if (bName.lower() == "inbox") | 914 | else if (bName.lower() == "inbox") |
915 | { | 915 | { |
916 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 916 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
917 | } else if (bName.lower() == "drafts") { | 917 | } else if (bName.lower() == "drafts") { |
918 | setPixmap(0, Resource::loadPixmap("inline/edit")); | 918 | setPixmap(0, Resource::loadPixmap("edit")); |
919 | } else { | 919 | } else { |
920 | setPixmap( 0, PIXMAP_MBOXFOLDER ); | 920 | setPixmap( 0, PIXMAP_MBOXFOLDER ); |
921 | } | 921 | } |
922 | setText( 0, bName ); | 922 | setText( 0, bName ); |
923 | } | 923 | } |
924 | 924 | ||
925 | const FolderP&MHfolderItem::getFolder()const | 925 | const FolderP&MHfolderItem::getFolder()const |
926 | { | 926 | { |
927 | return folder; | 927 | return folder; |
928 | } | 928 | } |
929 | 929 | ||
930 | void MHfolderItem::refresh(QValueList<RecMailP>&target) | 930 | void MHfolderItem::refresh(QValueList<RecMailP>&target) |
931 | { | 931 | { |
932 | if (folder->may_select()) | 932 | if (folder->may_select()) |
933 | mbox->getWrapper()->listMessages( folder->getName(),target ); | 933 | mbox->getWrapper()->listMessages( folder->getName(),target ); |
934 | } | 934 | } |
935 | 935 | ||
936 | RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail) | 936 | RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail) |
937 | { | 937 | { |
938 | return mbox->getWrapper()->fetchBody(aMail); | 938 | return mbox->getWrapper()->fetchBody(aMail); |
939 | } | 939 | } |
940 | 940 | ||
941 | void MHfolderItem::deleteFolder() | 941 | void MHfolderItem::deleteFolder() |
942 | { | 942 | { |
943 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), | 943 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), |
944 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), | 944 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), |
945 | QObject::tr("Yes",contextName), | 945 | QObject::tr("Yes",contextName), |
946 | QObject::tr("No",contextName),QString::null,1,1); | 946 | QObject::tr("No",contextName),QString::null,1,1); |
947 | odebug << "Auswahl: " << yesno << "" << oendl; | 947 | odebug << "Auswahl: " << yesno << "" << oendl; |
948 | if (yesno == 0) | 948 | if (yesno == 0) |
949 | { | 949 | { |
950 | if (mbox->getWrapper()->deleteMbox(folder)) | 950 | if (mbox->getWrapper()->deleteMbox(folder)) |
951 | { | 951 | { |
952 | QListView*v=listView(); | 952 | QListView*v=listView(); |
953 | MHviewItem * box = mbox; | 953 | MHviewItem * box = mbox; |
954 | /* be carefull - after that this object is destroyd so don't use | 954 | /* be carefull - after that this object is destroyd so don't use |
955 | * any member of it after that call!!*/ | 955 | * any member of it after that call!!*/ |
956 | mbox->refresh(true); | 956 | mbox->refresh(true); |
957 | if (v) | 957 | if (v) |
958 | { | 958 | { |
959 | v->setSelected(box,true); | 959 | v->setSelected(box,true); |
960 | } | 960 | } |
961 | } | 961 | } |
962 | } | 962 | } |
963 | } | 963 | } |
964 | 964 | ||
965 | QPopupMenu * MHfolderItem::getContextMenu() | 965 | QPopupMenu * MHfolderItem::getContextMenu() |
966 | { | 966 | { |
967 | QPopupMenu *m = new QPopupMenu(0); | 967 | QPopupMenu *m = new QPopupMenu(0); |
968 | if (m) | 968 | if (m) |
969 | { | 969 | { |
970 | m->insertItem(QObject::tr("Create new subfolder",contextName),FOLDER_MENU_NEW_SUBFOLDER); | 970 | m->insertItem(QObject::tr("Create new subfolder",contextName),FOLDER_MENU_NEW_SUBFOLDER); |
971 | m->insertItem(QObject::tr("Refresh header list",contextName),FOLDER_MENU_REFRESH_HEADER); | 971 | m->insertItem(QObject::tr("Refresh header list",contextName),FOLDER_MENU_REFRESH_HEADER); |
972 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),FOLDER_MENU_MOVE_MAILS); | 972 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),FOLDER_MENU_MOVE_MAILS); |
973 | m->insertItem(QObject::tr("Delete all mails",contextName),FOLDER_MENU_DELETE_ALL_MAILS); | 973 | m->insertItem(QObject::tr("Delete all mails",contextName),FOLDER_MENU_DELETE_ALL_MAILS); |
974 | m->insertItem(QObject::tr("Delete folder",contextName),FOLDER_MENU_DELETE_FOLDER); | 974 | m->insertItem(QObject::tr("Delete folder",contextName),FOLDER_MENU_DELETE_FOLDER); |
975 | } | 975 | } |
976 | return m; | 976 | return m; |
977 | } | 977 | } |
978 | 978 | ||
979 | void MHfolderItem::downloadMails() | 979 | void MHfolderItem::downloadMails() |
980 | { | 980 | { |
981 | AccountView*bl = mbox->accountView(); | 981 | AccountView*bl = mbox->accountView(); |
982 | if (!bl) return; | 982 | if (!bl) return; |
983 | bl->downloadMails(folder,mbox->getWrapper()); | 983 | bl->downloadMails(folder,mbox->getWrapper()); |
984 | } | 984 | } |
985 | 985 | ||
986 | void MHfolderItem::createFolder() | 986 | void MHfolderItem::createFolder() |
987 | { | 987 | { |
988 | Newmdirdlg ndirdlg(0,0,true); | 988 | Newmdirdlg ndirdlg(0,0,true); |
989 | if ( QPEApplication::execDialog( &ndirdlg ) ) | 989 | if ( QPEApplication::execDialog( &ndirdlg ) ) |
990 | { | 990 | { |
991 | QString ndir = ndirdlg.Newdir(); | 991 | QString ndir = ndirdlg.Newdir(); |
992 | if (mbox->getWrapper()->createMbox(ndir,folder)) | 992 | if (mbox->getWrapper()->createMbox(ndir,folder)) |
993 | { | 993 | { |
994 | QListView*v=listView(); | 994 | QListView*v=listView(); |
995 | MHviewItem * box = mbox; | 995 | MHviewItem * box = mbox; |
996 | /* be carefull - after that this object is destroyd so don't use | 996 | /* be carefull - after that this object is destroyd so don't use |
997 | * any member of it after that call!!*/ | 997 | * any member of it after that call!!*/ |
998 | mbox->refresh(true); | 998 | mbox->refresh(true); |
999 | if (v) | 999 | if (v) |
1000 | { | 1000 | { |
1001 | v->setSelected(box,true); | 1001 | v->setSelected(box,true); |
1002 | } | 1002 | } |
1003 | } | 1003 | } |
1004 | } | 1004 | } |
1005 | } | 1005 | } |
1006 | 1006 | ||
1007 | void MHfolderItem::contextMenuSelected(int which) | 1007 | void MHfolderItem::contextMenuSelected(int which) |
1008 | { | 1008 | { |
1009 | AccountView*view = 0; | 1009 | AccountView*view = 0; |
1010 | switch(which) | 1010 | switch(which) |
1011 | { | 1011 | { |
1012 | case FOLDER_MENU_DELETE_ALL_MAILS: | 1012 | case FOLDER_MENU_DELETE_ALL_MAILS: |
1013 | deleteAllMail(mbox->getWrapper(),folder); | 1013 | deleteAllMail(mbox->getWrapper(),folder); |
1014 | break; | 1014 | break; |
1015 | case FOLDER_MENU_DELETE_FOLDER: | 1015 | case FOLDER_MENU_DELETE_FOLDER: |
1016 | deleteFolder(); | 1016 | deleteFolder(); |
1017 | break; | 1017 | break; |
1018 | case FOLDER_MENU_MOVE_MAILS: | 1018 | case FOLDER_MENU_MOVE_MAILS: |
1019 | downloadMails(); | 1019 | downloadMails(); |
1020 | break; | 1020 | break; |
1021 | case FOLDER_MENU_NEW_SUBFOLDER: | 1021 | case FOLDER_MENU_NEW_SUBFOLDER: |
1022 | createFolder(); | 1022 | createFolder(); |
1023 | break; | 1023 | break; |
1024 | case FOLDER_MENU_REFRESH_HEADER: | 1024 | case FOLDER_MENU_REFRESH_HEADER: |
1025 | view = (AccountView*)listView(); | 1025 | view = (AccountView*)listView(); |
1026 | if (view) view->refreshCurrent(); | 1026 | if (view) view->refreshCurrent(); |
1027 | break; | 1027 | break; |
1028 | default: | 1028 | default: |
1029 | break; | 1029 | break; |
1030 | } | 1030 | } |
1031 | } | 1031 | } |
1032 | 1032 | ||
1033 | bool MHfolderItem::isDraftfolder() | 1033 | bool MHfolderItem::isDraftfolder() |
1034 | { | 1034 | { |
1035 | if (folder && folder->getName()==AbstractMail::defaultLocalfolder()+"/"+AbstractMail::draftFolder()) return true; | 1035 | if (folder && folder->getName()==AbstractMail::defaultLocalfolder()+"/"+AbstractMail::draftFolder()) return true; |
1036 | return false; | 1036 | return false; |
1037 | } | 1037 | } |
1038 | 1038 | ||
1039 | /** | 1039 | /** |
1040 | * Generic stuff | 1040 | * Generic stuff |
1041 | */ | 1041 | */ |
1042 | 1042 | ||
1043 | const QString AccountViewItem::contextName="AccountViewItem"; | 1043 | const QString AccountViewItem::contextName="AccountViewItem"; |
1044 | 1044 | ||
1045 | AccountViewItem::AccountViewItem( AccountView *parent ) | 1045 | AccountViewItem::AccountViewItem( AccountView *parent ) |
1046 | : QListViewItem( parent ) | 1046 | : QListViewItem( parent ) |