-rw-r--r-- | noncore/net/mail/accountitem.cpp | 17 | ||||
-rw-r--r-- | noncore/net/mail/accountitem.h | 2 | ||||
-rw-r--r-- | noncore/net/mail/accountview.cpp | 7 | ||||
-rw-r--r-- | noncore/net/mail/accountview.h | 1 | ||||
-rw-r--r-- | noncore/net/mail/composemail.cpp | 90 | ||||
-rw-r--r-- | noncore/net/mail/composemail.h | 25 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/abstractmail.cpp | 23 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/abstractmail.h | 10 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/genericwrapper.cpp | 8 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/libmailwrapper.pro | 6 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailtypes.cpp | 1 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/storemail.cpp | 90 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/storemail.h | 29 | ||||
-rw-r--r-- | noncore/net/mail/mailistviewitem.cpp | 7 | ||||
-rw-r--r-- | noncore/net/mail/mailistviewitem.h | 6 | ||||
-rw-r--r-- | noncore/net/mail/nntpgroupsdlg.cpp | 2 | ||||
-rw-r--r-- | noncore/net/mail/opiemail.cpp | 23 | ||||
-rw-r--r-- | noncore/net/mail/opiemail.h | 1 |
18 files changed, 309 insertions, 39 deletions
diff --git a/noncore/net/mail/accountitem.cpp b/noncore/net/mail/accountitem.cpp index 0d636a4..396dcb7 100644 --- a/noncore/net/mail/accountitem.cpp +++ b/noncore/net/mail/accountitem.cpp | |||
@@ -868,99 +868,99 @@ void MHviewItem::contextMenuSelected(int which) | |||
868 | deleteAllMail(getWrapper(),folder); | 868 | deleteAllMail(getWrapper(),folder); |
869 | break; | 869 | break; |
870 | case 3: | 870 | case 3: |
871 | downloadMails(); | 871 | downloadMails(); |
872 | break; | 872 | break; |
873 | default: | 873 | default: |
874 | break; | 874 | break; |
875 | } | 875 | } |
876 | } | 876 | } |
877 | 877 | ||
878 | MHfolderItem::~MHfolderItem() | 878 | MHfolderItem::~MHfolderItem() |
879 | {} | 879 | {} |
880 | 880 | ||
881 | MHfolderItem::MHfolderItem( Folder *folderInit, MHviewItem *parent , QListViewItem*after ) | 881 | MHfolderItem::MHfolderItem( Folder *folderInit, MHviewItem *parent , QListViewItem*after ) |
882 | : AccountViewItem( parent,after ) | 882 | : AccountViewItem( parent,after ) |
883 | { | 883 | { |
884 | folder = folderInit; | 884 | folder = folderInit; |
885 | mbox = parent; | 885 | mbox = parent; |
886 | initName(); | 886 | initName(); |
887 | } | 887 | } |
888 | 888 | ||
889 | MHfolderItem::MHfolderItem( Folder *folderInit, MHfolderItem *parent, QListViewItem*after, MHviewItem*master) | 889 | MHfolderItem::MHfolderItem( Folder *folderInit, MHfolderItem *parent, QListViewItem*after, MHviewItem*master) |
890 | : AccountViewItem( parent,after ) | 890 | : AccountViewItem( parent,after ) |
891 | { | 891 | { |
892 | folder = folderInit; | 892 | folder = folderInit; |
893 | mbox = master; | 893 | mbox = master; |
894 | initName(); | 894 | initName(); |
895 | } | 895 | } |
896 | 896 | ||
897 | void MHfolderItem::initName() | 897 | void MHfolderItem::initName() |
898 | { | 898 | { |
899 | QString bName = folder->getDisplayName(); | 899 | QString bName = folder->getDisplayName(); |
900 | if (bName.startsWith("/")&&bName.length()>1) | 900 | if (bName.startsWith("/")&&bName.length()>1) |
901 | { | 901 | { |
902 | bName.replace(0,1,""); | 902 | bName.replace(0,1,""); |
903 | } | 903 | } |
904 | int pos = bName.findRev("/"); | 904 | int pos = bName.findRev("/"); |
905 | if (pos > 0) | 905 | if (pos > 0) |
906 | { | 906 | { |
907 | bName.replace(0,pos+1,""); | 907 | bName.replace(0,pos+1,""); |
908 | } | 908 | } |
909 | if (bName.lower() == "outgoing") | 909 | if (bName.lower() == "outgoing") |
910 | { | 910 | { |
911 | setPixmap( 0, PIXMAP_OUTBOXFOLDER ); | 911 | setPixmap( 0, PIXMAP_OUTBOXFOLDER ); |
912 | } | 912 | } |
913 | else if (bName.lower() == "inbox") | 913 | else if (bName.lower() == "inbox") |
914 | { | 914 | { |
915 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 915 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
916 | } | 916 | } else if (bName.lower() == "drafts") { |
917 | else | 917 | setPixmap(0, Resource::loadPixmap("inline/edit")); |
918 | { | 918 | } else { |
919 | setPixmap( 0, PIXMAP_MBOXFOLDER ); | 919 | setPixmap( 0, PIXMAP_MBOXFOLDER ); |
920 | } | 920 | } |
921 | setText( 0, bName ); | 921 | setText( 0, bName ); |
922 | } | 922 | } |
923 | 923 | ||
924 | Folder*MHfolderItem::getFolder() | 924 | Folder*MHfolderItem::getFolder() |
925 | { | 925 | { |
926 | return folder; | 926 | return folder; |
927 | } | 927 | } |
928 | 928 | ||
929 | void MHfolderItem::refresh(QList<RecMail>&target) | 929 | void MHfolderItem::refresh(QList<RecMail>&target) |
930 | { | 930 | { |
931 | if (folder->may_select()) | 931 | if (folder->may_select()) |
932 | mbox->getWrapper()->listMessages( folder->getName(),target ); | 932 | mbox->getWrapper()->listMessages( folder->getName(),target ); |
933 | } | 933 | } |
934 | 934 | ||
935 | RecBody MHfolderItem::fetchBody(const RecMail&aMail) | 935 | RecBody MHfolderItem::fetchBody(const RecMail&aMail) |
936 | { | 936 | { |
937 | return mbox->getWrapper()->fetchBody(aMail); | 937 | return mbox->getWrapper()->fetchBody(aMail); |
938 | } | 938 | } |
939 | 939 | ||
940 | void MHfolderItem::deleteFolder() | 940 | void MHfolderItem::deleteFolder() |
941 | { | 941 | { |
942 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), | 942 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), |
943 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), | 943 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), |
944 | QObject::tr("Yes",contextName), | 944 | QObject::tr("Yes",contextName), |
945 | QObject::tr("No",contextName),QString::null,1,1); | 945 | QObject::tr("No",contextName),QString::null,1,1); |
946 | qDebug("Auswahl: %i",yesno); | 946 | qDebug("Auswahl: %i",yesno); |
947 | if (yesno == 0) | 947 | if (yesno == 0) |
948 | { | 948 | { |
949 | if (mbox->getWrapper()->deleteMbox(folder)) | 949 | if (mbox->getWrapper()->deleteMbox(folder)) |
950 | { | 950 | { |
951 | QListView*v=listView(); | 951 | QListView*v=listView(); |
952 | MHviewItem * box = mbox; | 952 | MHviewItem * box = mbox; |
953 | /* be carefull - after that this object is destroyd so don't use | 953 | /* be carefull - after that this object is destroyd so don't use |
954 | * any member of it after that call!!*/ | 954 | * any member of it after that call!!*/ |
955 | mbox->refresh(true); | 955 | mbox->refresh(true); |
956 | if (v) | 956 | if (v) |
957 | { | 957 | { |
958 | v->setSelected(box,true); | 958 | v->setSelected(box,true); |
959 | } | 959 | } |
960 | } | 960 | } |
961 | } | 961 | } |
962 | } | 962 | } |
963 | 963 | ||
964 | QPopupMenu * MHfolderItem::getContextMenu() | 964 | QPopupMenu * MHfolderItem::getContextMenu() |
965 | { | 965 | { |
966 | QPopupMenu *m = new QPopupMenu(0); | 966 | QPopupMenu *m = new QPopupMenu(0); |
@@ -978,96 +978,102 @@ void MHfolderItem::downloadMails() | |||
978 | { | 978 | { |
979 | AccountView*bl = mbox->accountView(); | 979 | AccountView*bl = mbox->accountView(); |
980 | if (!bl) return; | 980 | if (!bl) return; |
981 | bl->downloadMails(folder,mbox->getWrapper()); | 981 | bl->downloadMails(folder,mbox->getWrapper()); |
982 | } | 982 | } |
983 | 983 | ||
984 | void MHfolderItem::createFolder() | 984 | void MHfolderItem::createFolder() |
985 | { | 985 | { |
986 | Newmdirdlg ndirdlg(0,0,true); | 986 | Newmdirdlg ndirdlg(0,0,true); |
987 | if ( QPEApplication::execDialog( &ndirdlg ) ) | 987 | if ( QPEApplication::execDialog( &ndirdlg ) ) |
988 | { | 988 | { |
989 | QString ndir = ndirdlg.Newdir(); | 989 | QString ndir = ndirdlg.Newdir(); |
990 | if (mbox->getWrapper()->createMbox(ndir,folder)) | 990 | if (mbox->getWrapper()->createMbox(ndir,folder)) |
991 | { | 991 | { |
992 | QListView*v=listView(); | 992 | QListView*v=listView(); |
993 | MHviewItem * box = mbox; | 993 | MHviewItem * box = mbox; |
994 | /* be carefull - after that this object is destroyd so don't use | 994 | /* be carefull - after that this object is destroyd so don't use |
995 | * any member of it after that call!!*/ | 995 | * any member of it after that call!!*/ |
996 | mbox->refresh(true); | 996 | mbox->refresh(true); |
997 | if (v) | 997 | if (v) |
998 | { | 998 | { |
999 | v->setSelected(box,true); | 999 | v->setSelected(box,true); |
1000 | } | 1000 | } |
1001 | } | 1001 | } |
1002 | } | 1002 | } |
1003 | } | 1003 | } |
1004 | 1004 | ||
1005 | void MHfolderItem::contextMenuSelected(int which) | 1005 | void MHfolderItem::contextMenuSelected(int which) |
1006 | { | 1006 | { |
1007 | switch(which) | 1007 | switch(which) |
1008 | { | 1008 | { |
1009 | case 0: | 1009 | case 0: |
1010 | deleteAllMail(mbox->getWrapper(),folder); | 1010 | deleteAllMail(mbox->getWrapper(),folder); |
1011 | break; | 1011 | break; |
1012 | case 1: | 1012 | case 1: |
1013 | deleteFolder(); | 1013 | deleteFolder(); |
1014 | break; | 1014 | break; |
1015 | case 2: | 1015 | case 2: |
1016 | downloadMails(); | 1016 | downloadMails(); |
1017 | break; | 1017 | break; |
1018 | case 3: | 1018 | case 3: |
1019 | createFolder(); | 1019 | createFolder(); |
1020 | break; | 1020 | break; |
1021 | default: | 1021 | default: |
1022 | break; | 1022 | break; |
1023 | } | 1023 | } |
1024 | } | 1024 | } |
1025 | 1025 | ||
1026 | bool MHfolderItem::isDraftfolder() | ||
1027 | { | ||
1028 | if (folder && folder->getName()==AbstractMail::defaultLocalfolder()+"/"+AbstractMail::draftFolder()) return true; | ||
1029 | return false; | ||
1030 | } | ||
1031 | |||
1026 | /** | 1032 | /** |
1027 | * Generic stuff | 1033 | * Generic stuff |
1028 | */ | 1034 | */ |
1029 | 1035 | ||
1030 | const QString AccountViewItem::contextName="AccountViewItem"; | 1036 | const QString AccountViewItem::contextName="AccountViewItem"; |
1031 | 1037 | ||
1032 | AccountViewItem::AccountViewItem( AccountView *parent ) | 1038 | AccountViewItem::AccountViewItem( AccountView *parent ) |
1033 | : QListViewItem( parent ) | 1039 | : QListViewItem( parent ) |
1034 | { | 1040 | { |
1035 | init(); | 1041 | init(); |
1036 | m_Backlink = parent; | 1042 | m_Backlink = parent; |
1037 | } | 1043 | } |
1038 | 1044 | ||
1039 | AccountViewItem::AccountViewItem( QListViewItem *parent) | 1045 | AccountViewItem::AccountViewItem( QListViewItem *parent) |
1040 | : QListViewItem( parent) | 1046 | : QListViewItem( parent) |
1041 | { | 1047 | { |
1042 | init(); | 1048 | init(); |
1043 | } | 1049 | } |
1044 | 1050 | ||
1045 | AccountViewItem::AccountViewItem( QListViewItem *parent , QListViewItem*after ) | 1051 | AccountViewItem::AccountViewItem( QListViewItem *parent , QListViewItem*after ) |
1046 | :QListViewItem( parent,after ) | 1052 | :QListViewItem( parent,after ) |
1047 | { | 1053 | { |
1048 | init(); | 1054 | init(); |
1049 | } | 1055 | } |
1050 | 1056 | ||
1051 | void AccountViewItem::init() | 1057 | void AccountViewItem::init() |
1052 | { | 1058 | { |
1053 | m_Backlink = 0; | 1059 | m_Backlink = 0; |
1054 | folder = 0; | 1060 | folder = 0; |
1055 | } | 1061 | } |
1056 | 1062 | ||
1057 | AccountViewItem::~AccountViewItem() | 1063 | AccountViewItem::~AccountViewItem() |
1058 | { | 1064 | { |
1059 | if (folder) delete folder; | 1065 | if (folder) delete folder; |
1060 | } | 1066 | } |
1061 | 1067 | ||
1062 | AccountView*AccountViewItem::accountView() | 1068 | AccountView*AccountViewItem::accountView() |
1063 | { | 1069 | { |
1064 | return m_Backlink; | 1070 | return m_Backlink; |
1065 | } | 1071 | } |
1066 | 1072 | ||
1067 | void AccountViewItem::deleteAllMail(AbstractMail*wrapper,Folder*folder) | 1073 | void AccountViewItem::deleteAllMail(AbstractMail*wrapper,Folder*folder) |
1068 | { | 1074 | { |
1069 | if (!wrapper) return; | 1075 | if (!wrapper) return; |
1070 | QString fname=""; | 1076 | QString fname=""; |
1071 | if (folder) fname = folder->getDisplayName(); | 1077 | if (folder) fname = folder->getDisplayName(); |
1072 | int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName), | 1078 | int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName), |
1073 | QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName). | 1079 | QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName). |
@@ -1082,48 +1088,53 @@ void AccountViewItem::deleteAllMail(AbstractMail*wrapper,Folder*folder) | |||
1082 | AccountView * view = (AccountView*)listView(); | 1088 | AccountView * view = (AccountView*)listView(); |
1083 | if (view) view->refreshCurrent(); | 1089 | if (view) view->refreshCurrent(); |
1084 | } | 1090 | } |
1085 | } | 1091 | } |
1086 | } | 1092 | } |
1087 | 1093 | ||
1088 | void AccountViewItem::removeChilds() | 1094 | void AccountViewItem::removeChilds() |
1089 | { | 1095 | { |
1090 | QListViewItem *child = firstChild(); | 1096 | QListViewItem *child = firstChild(); |
1091 | while ( child ) | 1097 | while ( child ) |
1092 | { | 1098 | { |
1093 | QListViewItem *tmp = child; | 1099 | QListViewItem *tmp = child; |
1094 | child = child->nextSibling(); | 1100 | child = child->nextSibling(); |
1095 | delete tmp; | 1101 | delete tmp; |
1096 | } | 1102 | } |
1097 | } | 1103 | } |
1098 | 1104 | ||
1099 | bool AccountViewItem::matchName(const QString&name)const | 1105 | bool AccountViewItem::matchName(const QString&name)const |
1100 | { | 1106 | { |
1101 | if (!folder) return false; | 1107 | if (!folder) return false; |
1102 | return folder->getDisplayName()==name; | 1108 | return folder->getDisplayName()==name; |
1103 | } | 1109 | } |
1104 | 1110 | ||
1105 | 1111 | ||
1106 | AccountViewItem*AccountViewItem::findSubItem(const QString&path,AccountViewItem*start) | 1112 | AccountViewItem*AccountViewItem::findSubItem(const QString&path,AccountViewItem*start) |
1107 | { | 1113 | { |
1108 | AccountViewItem*pitem,*sitem; | 1114 | AccountViewItem*pitem,*sitem; |
1109 | if (!start) pitem = (AccountViewItem*)firstChild(); | 1115 | if (!start) pitem = (AccountViewItem*)firstChild(); |
1110 | else pitem = (AccountViewItem*)start->firstChild(); | 1116 | else pitem = (AccountViewItem*)start->firstChild(); |
1111 | while (pitem) | 1117 | while (pitem) |
1112 | { | 1118 | { |
1113 | if (pitem->matchName(path)) | 1119 | if (pitem->matchName(path)) |
1114 | { | 1120 | { |
1115 | break; | 1121 | break; |
1116 | } | 1122 | } |
1117 | if (pitem->childCount()>0) | 1123 | if (pitem->childCount()>0) |
1118 | { | 1124 | { |
1119 | sitem = findSubItem(path,pitem); | 1125 | sitem = findSubItem(path,pitem); |
1120 | if (sitem) | 1126 | if (sitem) |
1121 | { | 1127 | { |
1122 | pitem = sitem; | 1128 | pitem = sitem; |
1123 | break; | 1129 | break; |
1124 | } | 1130 | } |
1125 | } | 1131 | } |
1126 | pitem=(AccountViewItem*)pitem->nextSibling(); | 1132 | pitem=(AccountViewItem*)pitem->nextSibling(); |
1127 | } | 1133 | } |
1128 | return pitem; | 1134 | return pitem; |
1129 | } | 1135 | } |
1136 | |||
1137 | bool AccountViewItem::isDraftfolder() | ||
1138 | { | ||
1139 | return false; | ||
1140 | } | ||
diff --git a/noncore/net/mail/accountitem.h b/noncore/net/mail/accountitem.h index f3c0f5d..eb3baa3 100644 --- a/noncore/net/mail/accountitem.h +++ b/noncore/net/mail/accountitem.h | |||
@@ -1,80 +1,81 @@ | |||
1 | #ifndef __ACCOUNT_ITEM | 1 | #ifndef __ACCOUNT_ITEM |
2 | #define __ACCOUNT_ITEM | 2 | #define __ACCOUNT_ITEM |
3 | 3 | ||
4 | #include <qlistview.h> | 4 | #include <qlistview.h> |
5 | #include <qlist.h> | 5 | #include <qlist.h> |
6 | 6 | ||
7 | class POP3wrapper; | 7 | class POP3wrapper; |
8 | class RecMail; | 8 | class RecMail; |
9 | class RecBody; | 9 | class RecBody; |
10 | class QPopupMenu; | 10 | class QPopupMenu; |
11 | class Selectstore; | 11 | class Selectstore; |
12 | class AccountView; | 12 | class AccountView; |
13 | class POP3account; | 13 | class POP3account; |
14 | class NNTPaccount; | 14 | class NNTPaccount; |
15 | class IMAPaccount; | 15 | class IMAPaccount; |
16 | class AbstractMail; | 16 | class AbstractMail; |
17 | class Folder; | 17 | class Folder; |
18 | 18 | ||
19 | class AccountViewItem : public QListViewItem | 19 | class AccountViewItem : public QListViewItem |
20 | { | 20 | { |
21 | 21 | ||
22 | public: | 22 | public: |
23 | AccountViewItem( AccountView *parent ); | 23 | AccountViewItem( AccountView *parent ); |
24 | AccountViewItem( QListViewItem *parent); | 24 | AccountViewItem( QListViewItem *parent); |
25 | AccountViewItem( QListViewItem *parent , QListViewItem*after ); | 25 | AccountViewItem( QListViewItem *parent , QListViewItem*after ); |
26 | virtual ~AccountViewItem(); | 26 | virtual ~AccountViewItem(); |
27 | virtual void refresh(QList<RecMail>&)=0; | 27 | virtual void refresh(QList<RecMail>&)=0; |
28 | virtual RecBody fetchBody(const RecMail&)=0; | 28 | virtual RecBody fetchBody(const RecMail&)=0; |
29 | virtual QPopupMenu * getContextMenu(){return 0;}; | 29 | virtual QPopupMenu * getContextMenu(){return 0;}; |
30 | virtual void contextMenuSelected(int){} | 30 | virtual void contextMenuSelected(int){} |
31 | virtual AccountView*accountView(); | 31 | virtual AccountView*accountView(); |
32 | virtual bool matchName(const QString&name)const; | 32 | virtual bool matchName(const QString&name)const; |
33 | virtual bool isDraftfolder(); | ||
33 | 34 | ||
34 | protected: | 35 | protected: |
35 | AccountViewItem*findSubItem(const QString&path,AccountViewItem*start=0); | 36 | AccountViewItem*findSubItem(const QString&path,AccountViewItem*start=0); |
36 | virtual void init(); | 37 | virtual void init(); |
37 | virtual void removeChilds(); | 38 | virtual void removeChilds(); |
38 | virtual void deleteAllMail(AbstractMail*wrapper,Folder*f); | 39 | virtual void deleteAllMail(AbstractMail*wrapper,Folder*f); |
39 | static const QString contextName; | 40 | static const QString contextName; |
40 | AccountView*m_Backlink; | 41 | AccountView*m_Backlink; |
41 | Folder *folder; | 42 | Folder *folder; |
42 | }; | 43 | }; |
43 | 44 | ||
44 | class POP3viewItem : public AccountViewItem | 45 | class POP3viewItem : public AccountViewItem |
45 | { | 46 | { |
46 | 47 | ||
47 | public: | 48 | public: |
48 | POP3viewItem( POP3account *a, AccountView *parent ); | 49 | POP3viewItem( POP3account *a, AccountView *parent ); |
49 | virtual ~POP3viewItem(); | 50 | virtual ~POP3viewItem(); |
50 | virtual void refresh( QList<RecMail> &target ); | 51 | virtual void refresh( QList<RecMail> &target ); |
51 | virtual RecBody fetchBody( const RecMail &mail ); | 52 | virtual RecBody fetchBody( const RecMail &mail ); |
52 | AbstractMail *getWrapper(); | 53 | AbstractMail *getWrapper(); |
53 | virtual QPopupMenu * getContextMenu(); | 54 | virtual QPopupMenu * getContextMenu(); |
54 | virtual void contextMenuSelected(int); | 55 | virtual void contextMenuSelected(int); |
55 | 56 | ||
56 | protected: | 57 | protected: |
57 | POP3account *account; | 58 | POP3account *account; |
58 | virtual void refresh(); | 59 | virtual void refresh(); |
59 | AbstractMail *wrapper; | 60 | AbstractMail *wrapper; |
60 | void disconnect(); | 61 | void disconnect(); |
61 | void setOnOffline(); | 62 | void setOnOffline(); |
62 | }; | 63 | }; |
63 | 64 | ||
64 | class POP3folderItem : public AccountViewItem | 65 | class POP3folderItem : public AccountViewItem |
65 | { | 66 | { |
66 | 67 | ||
67 | public: | 68 | public: |
68 | POP3folderItem( Folder *folder, POP3viewItem *parent , QListViewItem*after ); | 69 | POP3folderItem( Folder *folder, POP3viewItem *parent , QListViewItem*after ); |
69 | virtual ~POP3folderItem(); | 70 | virtual ~POP3folderItem(); |
70 | virtual void refresh(QList<RecMail>&); | 71 | virtual void refresh(QList<RecMail>&); |
71 | virtual RecBody fetchBody(const RecMail&); | 72 | virtual RecBody fetchBody(const RecMail&); |
72 | virtual QPopupMenu * getContextMenu(); | 73 | virtual QPopupMenu * getContextMenu(); |
73 | virtual void contextMenuSelected(int); | 74 | virtual void contextMenuSelected(int); |
74 | 75 | ||
75 | protected: | 76 | protected: |
76 | void downloadMails(); | 77 | void downloadMails(); |
77 | POP3viewItem *pop3; | 78 | POP3viewItem *pop3; |
78 | }; | 79 | }; |
79 | 80 | ||
80 | 81 | ||
@@ -148,58 +149,59 @@ public: | |||
148 | virtual ~IMAPfolderItem(); | 149 | virtual ~IMAPfolderItem(); |
149 | virtual void refresh(QList<RecMail>&); | 150 | virtual void refresh(QList<RecMail>&); |
150 | virtual RecBody fetchBody(const RecMail&); | 151 | virtual RecBody fetchBody(const RecMail&); |
151 | virtual QPopupMenu * getContextMenu(); | 152 | virtual QPopupMenu * getContextMenu(); |
152 | virtual void contextMenuSelected(int); | 153 | virtual void contextMenuSelected(int); |
153 | virtual const QString& Delemiter()const; | 154 | virtual const QString& Delemiter()const; |
154 | protected: | 155 | protected: |
155 | virtual void createNewFolder(); | 156 | virtual void createNewFolder(); |
156 | virtual void deleteFolder(); | 157 | virtual void deleteFolder(); |
157 | virtual void downloadMails(); | 158 | virtual void downloadMails(); |
158 | IMAPviewItem *imap; | 159 | IMAPviewItem *imap; |
159 | }; | 160 | }; |
160 | 161 | ||
161 | class MHviewItem : public AccountViewItem | 162 | class MHviewItem : public AccountViewItem |
162 | { | 163 | { |
163 | friend class MHfolderItem; | 164 | friend class MHfolderItem; |
164 | 165 | ||
165 | public: | 166 | public: |
166 | MHviewItem( const QString&aMboxPath, AccountView *parent ); | 167 | MHviewItem( const QString&aMboxPath, AccountView *parent ); |
167 | virtual ~MHviewItem(); | 168 | virtual ~MHviewItem(); |
168 | virtual void refresh( QList<RecMail> &target ); | 169 | virtual void refresh( QList<RecMail> &target ); |
169 | virtual RecBody fetchBody( const RecMail &mail ); | 170 | virtual RecBody fetchBody( const RecMail &mail ); |
170 | AbstractMail *getWrapper(); | 171 | AbstractMail *getWrapper(); |
171 | virtual QPopupMenu * getContextMenu(); | 172 | virtual QPopupMenu * getContextMenu(); |
172 | virtual void contextMenuSelected(int); | 173 | virtual void contextMenuSelected(int); |
173 | QStringList subFolders(); | 174 | QStringList subFolders(); |
174 | virtual void refresh(bool force=false); | 175 | virtual void refresh(bool force=false); |
175 | 176 | ||
176 | protected: | 177 | protected: |
177 | void downloadMails(); | 178 | void downloadMails(); |
178 | virtual void createFolder(); | 179 | virtual void createFolder(); |
179 | QString m_Path; | 180 | QString m_Path; |
180 | AbstractMail *wrapper; | 181 | AbstractMail *wrapper; |
181 | QStringList currentFolders; | 182 | QStringList currentFolders; |
182 | }; | 183 | }; |
183 | 184 | ||
184 | class MHfolderItem : public AccountViewItem | 185 | class MHfolderItem : public AccountViewItem |
185 | { | 186 | { |
186 | 187 | ||
187 | public: | 188 | public: |
188 | MHfolderItem( Folder *folder, MHviewItem *parent , QListViewItem*after ); | 189 | MHfolderItem( Folder *folder, MHviewItem *parent , QListViewItem*after ); |
189 | MHfolderItem( Folder *folder, MHfolderItem *parent, QListViewItem*after, MHviewItem*master); | 190 | MHfolderItem( Folder *folder, MHfolderItem *parent, QListViewItem*after, MHviewItem*master); |
190 | virtual ~MHfolderItem(); | 191 | virtual ~MHfolderItem(); |
191 | virtual void refresh(QList<RecMail>&); | 192 | virtual void refresh(QList<RecMail>&); |
192 | virtual RecBody fetchBody(const RecMail&); | 193 | virtual RecBody fetchBody(const RecMail&); |
193 | virtual QPopupMenu * getContextMenu(); | 194 | virtual QPopupMenu * getContextMenu(); |
194 | virtual void contextMenuSelected(int); | 195 | virtual void contextMenuSelected(int); |
195 | virtual Folder*getFolder(); | 196 | virtual Folder*getFolder(); |
197 | virtual bool isDraftfolder(); | ||
196 | 198 | ||
197 | protected: | 199 | protected: |
198 | void downloadMails(); | 200 | void downloadMails(); |
199 | virtual void createFolder(); | 201 | virtual void createFolder(); |
200 | virtual void deleteFolder(); | 202 | virtual void deleteFolder(); |
201 | void initName(); | 203 | void initName(); |
202 | MHviewItem *mbox; | 204 | MHviewItem *mbox; |
203 | }; | 205 | }; |
204 | 206 | ||
205 | #endif | 207 | #endif |
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index 4375044..7938d4f 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp | |||
@@ -123,48 +123,55 @@ RecBody AccountView::fetchBody(const RecMail&aMail) | |||
123 | return view->fetchBody(aMail); | 123 | return view->fetchBody(aMail); |
124 | } | 124 | } |
125 | 125 | ||
126 | void AccountView::setupFolderselect(Selectstore*sels) | 126 | void AccountView::setupFolderselect(Selectstore*sels) |
127 | { | 127 | { |
128 | QPEApplication::showDialog( sels ); | 128 | QPEApplication::showDialog( sels ); |
129 | QStringList sFolders; | 129 | QStringList sFolders; |
130 | unsigned int i = 0; | 130 | unsigned int i = 0; |
131 | for (i=0; i < mhAccounts.count();++i) | 131 | for (i=0; i < mhAccounts.count();++i) |
132 | { | 132 | { |
133 | mhAccounts[i]->refresh(false); | 133 | mhAccounts[i]->refresh(false); |
134 | sFolders = mhAccounts[i]->subFolders(); | 134 | sFolders = mhAccounts[i]->subFolders(); |
135 | sels->addAccounts(mhAccounts[i]->getWrapper(),sFolders); | 135 | sels->addAccounts(mhAccounts[i]->getWrapper(),sFolders); |
136 | } | 136 | } |
137 | for (i=0; i < imapAccounts.count();++i) | 137 | for (i=0; i < imapAccounts.count();++i) |
138 | { | 138 | { |
139 | if (imapAccounts[i]->offline()) | 139 | if (imapAccounts[i]->offline()) |
140 | continue; | 140 | continue; |
141 | imapAccounts[i]->refreshFolders(false); | 141 | imapAccounts[i]->refreshFolders(false); |
142 | sels->addAccounts(imapAccounts[i]->getWrapper(),imapAccounts[i]->subFolders()); | 142 | sels->addAccounts(imapAccounts[i]->getWrapper(),imapAccounts[i]->subFolders()); |
143 | } | 143 | } |
144 | } | 144 | } |
145 | 145 | ||
146 | void AccountView::downloadMails(Folder*fromFolder,AbstractMail*fromWrapper) | 146 | void AccountView::downloadMails(Folder*fromFolder,AbstractMail*fromWrapper) |
147 | { | 147 | { |
148 | AbstractMail*targetMail = 0; | 148 | AbstractMail*targetMail = 0; |
149 | QString targetFolder = ""; | 149 | QString targetFolder = ""; |
150 | Selectstore sels; | 150 | Selectstore sels; |
151 | setupFolderselect(&sels); | 151 | setupFolderselect(&sels); |
152 | if (!sels.exec()) return; | 152 | if (!sels.exec()) return; |
153 | targetMail = sels.currentMail(); | 153 | targetMail = sels.currentMail(); |
154 | targetFolder = sels.currentFolder(); | 154 | targetFolder = sels.currentFolder(); |
155 | if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) || | 155 | if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) || |
156 | targetFolder.isEmpty()) | 156 | targetFolder.isEmpty()) |
157 | { | 157 | { |
158 | return; | 158 | return; |
159 | } | 159 | } |
160 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | 160 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
161 | { | 161 | { |
162 | QMessageBox::critical(0,tr("Error creating new Folder"), | 162 | QMessageBox::critical(0,tr("Error creating new Folder"), |
163 | tr("<center>Error while creating<br>new folder - breaking.</center>")); | 163 | tr("<center>Error while creating<br>new folder - breaking.</center>")); |
164 | return; | 164 | return; |
165 | } | 165 | } |
166 | qDebug("Targetfolder: %s",targetFolder.latin1()); | 166 | qDebug("Targetfolder: %s",targetFolder.latin1()); |
167 | qDebug("Fromfolder: %s",fromFolder->getName().latin1()); | 167 | qDebug("Fromfolder: %s",fromFolder->getName().latin1()); |
168 | fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails()); | 168 | fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails()); |
169 | refreshCurrent(); | 169 | refreshCurrent(); |
170 | } | 170 | } |
171 | |||
172 | bool AccountView::currentisDraft() | ||
173 | { | ||
174 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); | ||
175 | if (!view) return false; | ||
176 | return view->isDraftfolder(); | ||
177 | } | ||
diff --git a/noncore/net/mail/accountview.h b/noncore/net/mail/accountview.h index 9f92090..5000202 100644 --- a/noncore/net/mail/accountview.h +++ b/noncore/net/mail/accountview.h | |||
@@ -1,44 +1,45 @@ | |||
1 | #ifndef ACCOUNTVIEW_H | 1 | #ifndef ACCOUNTVIEW_H |
2 | #define ACCOUNTVIEW_H | 2 | #define ACCOUNTVIEW_H |
3 | 3 | ||
4 | #include <qlistview.h> | 4 | #include <qlistview.h> |
5 | #include <qlist.h> | 5 | #include <qlist.h> |
6 | 6 | ||
7 | class Selectstore; | 7 | class Selectstore; |
8 | class RecMail; | 8 | class RecMail; |
9 | class RecBody; | 9 | class RecBody; |
10 | class Folder; | 10 | class Folder; |
11 | class AbstractMail; | 11 | class AbstractMail; |
12 | class Account; | 12 | class Account; |
13 | class IMAPviewItem; | 13 | class IMAPviewItem; |
14 | class MHviewItem; | 14 | class MHviewItem; |
15 | 15 | ||
16 | class AccountView : public QListView | 16 | class AccountView : public QListView |
17 | { | 17 | { |
18 | Q_OBJECT | 18 | Q_OBJECT |
19 | 19 | ||
20 | public: | 20 | public: |
21 | AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); | 21 | AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); |
22 | virtual ~AccountView(); | 22 | virtual ~AccountView(); |
23 | virtual void populate( QList<Account> list ); | 23 | virtual void populate( QList<Account> list ); |
24 | virtual RecBody fetchBody(const RecMail&aMail); | 24 | virtual RecBody fetchBody(const RecMail&aMail); |
25 | virtual void downloadMails(Folder*fromFolder,AbstractMail*fromWrapper); | 25 | virtual void downloadMails(Folder*fromFolder,AbstractMail*fromWrapper); |
26 | virtual bool currentisDraft(); | ||
26 | 27 | ||
27 | public slots: | 28 | public slots: |
28 | virtual void refreshAll(); | 29 | virtual void refreshAll(); |
29 | virtual void refresh(QListViewItem *item); | 30 | virtual void refresh(QListViewItem *item); |
30 | virtual void refreshCurrent(); | 31 | virtual void refreshCurrent(); |
31 | virtual void slotHold(int, QListViewItem *,const QPoint&,int); | 32 | virtual void slotHold(int, QListViewItem *,const QPoint&,int); |
32 | virtual void slotContextMenu(int id); | 33 | virtual void slotContextMenu(int id); |
33 | void setupFolderselect(Selectstore*sels); | 34 | void setupFolderselect(Selectstore*sels); |
34 | 35 | ||
35 | signals: | 36 | signals: |
36 | void refreshMailview(QList<RecMail>*); | 37 | void refreshMailview(QList<RecMail>*); |
37 | 38 | ||
38 | protected: | 39 | protected: |
39 | QListViewItem* m_currentItem; | 40 | QListViewItem* m_currentItem; |
40 | QValueList<IMAPviewItem*> imapAccounts; | 41 | QValueList<IMAPviewItem*> imapAccounts; |
41 | QValueList<MHviewItem*> mhAccounts; | 42 | QValueList<MHviewItem*> mhAccounts; |
42 | }; | 43 | }; |
43 | 44 | ||
44 | #endif | 45 | #endif |
diff --git a/noncore/net/mail/composemail.cpp b/noncore/net/mail/composemail.cpp index b5cd75b..b9c9cbc 100644 --- a/noncore/net/mail/composemail.cpp +++ b/noncore/net/mail/composemail.cpp | |||
@@ -1,59 +1,62 @@ | |||
1 | #include <qt.h> | 1 | #include <qt.h> |
2 | 2 | ||
3 | #include <opie2/ofiledialog.h> | 3 | #include <opie2/ofiledialog.h> |
4 | #include <qpe/resource.h> | 4 | #include <qpe/resource.h> |
5 | #include <qpe/config.h> | 5 | #include <qpe/config.h> |
6 | #include <qpe/global.h> | 6 | #include <qpe/global.h> |
7 | #include <qpe/contact.h> | 7 | #include <qpe/contact.h> |
8 | 8 | ||
9 | #include "composemail.h" | 9 | #include "composemail.h" |
10 | 10 | ||
11 | #include <libmailwrapper/smtpwrapper.h> | 11 | #include <libmailwrapper/smtpwrapper.h> |
12 | #include <libmailwrapper/storemail.h> | ||
13 | #include <libmailwrapper/abstractmail.h> | ||
14 | #include <libmailwrapper/mailtypes.h> | ||
12 | 15 | ||
13 | ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) | 16 | ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) |
14 | : ComposeMailUI( parent, name, modal, flags ) | 17 | : ComposeMailUI( parent, name, modal, flags ) |
15 | { | 18 | { |
16 | settings = s; | 19 | settings = s; |
17 | m_replyid = ""; | 20 | m_replyid = ""; |
18 | 21 | ||
19 | QString vfilename = Global::applicationFileName("addressbook", | 22 | QString vfilename = Global::applicationFileName("addressbook", |
20 | "businesscard.vcf"); | 23 | "businesscard.vcf"); |
21 | Contact c; | 24 | Contact c; |
22 | if (QFile::exists(vfilename)) { | 25 | if (QFile::exists(vfilename)) { |
23 | c = Contact::readVCard( vfilename )[0]; | 26 | c = Contact::readVCard( vfilename )[0]; |
24 | } | 27 | } |
25 | 28 | ||
26 | QStringList mails = c.emailList(); | 29 | QStringList mails = c.emailList(); |
27 | QString defmail = c.defaultEmail(); | 30 | QString defmail = c.defaultEmail(); |
28 | 31 | ||
29 | if (defmail.length()!=0) { | 32 | if (defmail.length()!=0) { |
30 | fromBox->insertItem(defmail); | 33 | fromBox->insertItem(defmail); |
31 | } | 34 | } |
32 | QStringList::ConstIterator sit = mails.begin(); | 35 | QStringList::ConstIterator sit = mails.begin(); |
33 | for (;sit!=mails.end();++sit) { | 36 | for (;sit!=mails.end();++sit) { |
34 | if ( (*sit)==defmail) | 37 | if ( (*sit)==defmail) |
35 | continue; | 38 | continue; |
36 | fromBox->insertItem((*sit)); | 39 | fromBox->insertItem((*sit)); |
37 | } | 40 | } |
38 | senderNameEdit->setText(c.firstName()+" "+c.lastName()); | 41 | senderNameEdit->setText(c.firstName()+" "+c.lastName()); |
39 | Config cfg( "mail" ); | 42 | Config cfg( "mail" ); |
40 | cfg.setGroup( "Compose" ); | 43 | cfg.setGroup( "Compose" ); |
41 | checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); | 44 | checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); |
42 | 45 | ||
43 | attList->addColumn( tr( "Name" ) ); | 46 | attList->addColumn( tr( "Name" ) ); |
44 | attList->addColumn( tr( "Size" ) ); | 47 | attList->addColumn( tr( "Size" ) ); |
45 | 48 | ||
46 | QList<Account> accounts = settings->getAccounts(); | 49 | QList<Account> accounts = settings->getAccounts(); |
47 | 50 | ||
48 | Account *it; | 51 | Account *it; |
49 | for ( it = accounts.first(); it; it = accounts.next() ) { | 52 | for ( it = accounts.first(); it; it = accounts.next() ) { |
50 | if ( it->getType()==MAILLIB::A_SMTP ) { | 53 | if ( it->getType()==MAILLIB::A_SMTP ) { |
51 | SMTPaccount *smtp = static_cast<SMTPaccount *>(it); | 54 | SMTPaccount *smtp = static_cast<SMTPaccount *>(it); |
52 | smtpAccountBox->insertItem( smtp->getAccountName() ); | 55 | smtpAccountBox->insertItem( smtp->getAccountName() ); |
53 | smtpAccounts.append( smtp ); | 56 | smtpAccounts.append( smtp ); |
54 | } | 57 | } |
55 | } | 58 | } |
56 | 59 | ||
57 | if ( smtpAccounts.count() > 0 ) { | 60 | if ( smtpAccounts.count() > 0 ) { |
58 | fillValues( smtpAccountBox->currentItem() ); | 61 | fillValues( smtpAccountBox->currentItem() ); |
59 | } else { | 62 | } else { |
@@ -79,161 +82,220 @@ void ComposeMail::pickAddress( QLineEdit *line ) | |||
79 | line->setText( names ); | 82 | line->setText( names ); |
80 | } else if ( !names.isEmpty() ) { | 83 | } else if ( !names.isEmpty() ) { |
81 | line->setText( line->text() + ", " + names ); | 84 | line->setText( line->text() + ", " + names ); |
82 | } | 85 | } |
83 | } | 86 | } |
84 | 87 | ||
85 | 88 | ||
86 | void ComposeMail::setTo( const QString & to ) | 89 | void ComposeMail::setTo( const QString & to ) |
87 | { | 90 | { |
88 | toLine->setText( to ); | 91 | toLine->setText( to ); |
89 | } | 92 | } |
90 | 93 | ||
91 | void ComposeMail::setSubject( const QString & subject ) | 94 | void ComposeMail::setSubject( const QString & subject ) |
92 | { | 95 | { |
93 | subjectLine->setText( subject ); | 96 | subjectLine->setText( subject ); |
94 | } | 97 | } |
95 | 98 | ||
96 | void ComposeMail::setInReplyTo( const QString & messageId ) | 99 | void ComposeMail::setInReplyTo( const QString & messageId ) |
97 | { | 100 | { |
98 | m_replyid = messageId; | 101 | m_replyid = messageId; |
99 | } | 102 | } |
100 | 103 | ||
101 | void ComposeMail::setMessage( const QString & text ) | 104 | void ComposeMail::setMessage( const QString & text ) |
102 | { | 105 | { |
103 | message->setText( text ); | 106 | message->setText( text ); |
104 | } | 107 | } |
105 | 108 | ||
106 | 109 | ||
107 | void ComposeMail::pickAddressTo() | 110 | void ComposeMail::pickAddressTo() |
108 | { | 111 | { |
109 | pickAddress( toLine ); | 112 | pickAddress( toLine ); |
110 | } | 113 | } |
111 | 114 | ||
112 | void ComposeMail::pickAddressCC() | 115 | void ComposeMail::pickAddressCC() |
113 | { | 116 | { |
114 | pickAddress( ccLine ); | 117 | pickAddress( ccLine ); |
115 | } | 118 | } |
116 | 119 | ||
117 | void ComposeMail::pickAddressBCC() | 120 | void ComposeMail::pickAddressBCC() |
118 | { | 121 | { |
119 | pickAddress( bccLine ); | 122 | pickAddress( bccLine ); |
120 | } | 123 | } |
121 | 124 | ||
122 | void ComposeMail::pickAddressReply() | 125 | void ComposeMail::pickAddressReply() |
123 | { | 126 | { |
124 | pickAddress( replyLine ); | 127 | pickAddress( replyLine ); |
125 | } | 128 | } |
126 | 129 | ||
127 | void ComposeMail::fillValues( int current ) | 130 | void ComposeMail::fillValues( int ) |
128 | { | 131 | { |
129 | #if 0 | 132 | #if 0 |
130 | SMTPaccount *smtp = smtpAccounts.at( current ); | 133 | SMTPaccount *smtp = smtpAccounts.at( current ); |
131 | ccLine->clear(); | 134 | ccLine->clear(); |
132 | if ( smtp->getUseCC() ) { | 135 | if ( smtp->getUseCC() ) { |
133 | ccLine->setText( smtp->getCC() ); | 136 | ccLine->setText( smtp->getCC() ); |
134 | } | 137 | } |
135 | bccLine->clear(); | 138 | bccLine->clear(); |
136 | if ( smtp->getUseBCC() ) { | 139 | if ( smtp->getUseBCC() ) { |
137 | bccLine->setText( smtp->getBCC() ); | 140 | bccLine->setText( smtp->getBCC() ); |
138 | } | 141 | } |
139 | replyLine->clear(); | 142 | replyLine->clear(); |
140 | if ( smtp->getUseReply() ) { | 143 | if ( smtp->getUseReply() ) { |
141 | replyLine->setText( smtp->getReply() ); | 144 | replyLine->setText( smtp->getReply() ); |
142 | } | 145 | } |
143 | sigMultiLine->setText( smtp->getSignature() ); | 146 | sigMultiLine->setText( smtp->getSignature() ); |
144 | #endif | 147 | #endif |
145 | } | 148 | } |
146 | 149 | ||
147 | void ComposeMail::slotAdjustColumns() | 150 | void ComposeMail::slotAdjustColumns() |
148 | { | 151 | { |
149 | int currPage = tabWidget->currentPageIndex(); | 152 | int currPage = tabWidget->currentPageIndex(); |
150 | 153 | ||
151 | tabWidget->showPage( attachTab ); | 154 | tabWidget->showPage( attachTab ); |
152 | attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); | 155 | attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); |
153 | attList->setColumnWidth( 1, 80 ); | 156 | attList->setColumnWidth( 1, 80 ); |
154 | 157 | ||
155 | tabWidget->setCurrentPage( currPage ); | 158 | tabWidget->setCurrentPage( currPage ); |
156 | } | 159 | } |
157 | 160 | ||
158 | void ComposeMail::addAttachment() | 161 | void ComposeMail::addAttachment() |
159 | { | 162 | { |
160 | DocLnk lnk = Opie::OFileDialog::getOpenFileName( 1, "/" ); | 163 | DocLnk lnk = Opie::OFileDialog::getOpenFileName( 1, "/" ); |
161 | if ( !lnk.name().isEmpty() ) { | 164 | if ( !lnk.name().isEmpty() ) { |
162 | Attachment *att = new Attachment( lnk ); | 165 | Attachment *att = new Attachment( lnk ); |
163 | (void) new AttachViewItem( attList, att ); | 166 | (void) new AttachViewItem( attList, att ); |
164 | } | 167 | } |
165 | } | 168 | } |
166 | 169 | ||
167 | void ComposeMail::removeAttachment() | 170 | void ComposeMail::removeAttachment() |
168 | { | 171 | { |
169 | if ( !attList->currentItem() ) { | 172 | if ( !attList->currentItem() ) { |
170 | QMessageBox::information( this, tr( "Error" ), | 173 | QMessageBox::information( this, tr( "Error" ), |
171 | tr( "<p>Please select a File.</p>" ), | 174 | tr( "<p>Please select a File.</p>" ), |
172 | tr( "Ok" ) ); | 175 | tr( "Ok" ) ); |
173 | } else { | 176 | } else { |
174 | attList->takeItem( attList->currentItem() ); | 177 | attList->takeItem( attList->currentItem() ); |
175 | } | 178 | } |
176 | } | 179 | } |
177 | 180 | ||
178 | void ComposeMail::accept() | 181 | void ComposeMail::accept() |
179 | { | 182 | { |
180 | if ( checkBoxLater->isChecked() ) { | 183 | if ( checkBoxLater->isChecked() ) { |
181 | qDebug( "Send later" ); | 184 | qDebug( "Send later" ); |
182 | } | 185 | } |
183 | 186 | ||
184 | #if 0 | 187 | #if 0 |
185 | qDebug( "Sending Mail with " + | 188 | qDebug( "Sending Mail with " + |
186 | smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() ); | 189 | smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() ); |
187 | #endif | 190 | #endif |
188 | Mail *mail = new Mail(); | 191 | Mail mail; |
189 | 192 | ||
190 | SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); | 193 | SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); |
191 | mail->setMail(fromBox->currentText()); | 194 | mail.setMail(fromBox->currentText()); |
192 | 195 | ||
193 | if ( !toLine->text().isEmpty() ) { | 196 | if ( !toLine->text().isEmpty() ) { |
194 | mail->setTo( toLine->text() ); | 197 | mail.setTo( toLine->text() ); |
195 | } else { | 198 | } else { |
196 | qDebug( "No Reciever spezified -> returning" ); | 199 | QMessageBox::warning(0,tr("Sending mail"), |
200 | tr("No Receiver spezified" ) ); | ||
197 | return; | 201 | return; |
198 | } | 202 | } |
199 | mail->setName(senderNameEdit->text()); | 203 | mail.setName(senderNameEdit->text()); |
200 | mail->setCC( ccLine->text() ); | 204 | mail.setCC( ccLine->text() ); |
201 | mail->setBCC( bccLine->text() ); | 205 | mail.setBCC( bccLine->text() ); |
202 | mail->setReply( replyLine->text() ); | 206 | mail.setReply( replyLine->text() ); |
203 | mail->setSubject( subjectLine->text() ); | 207 | mail.setSubject( subjectLine->text() ); |
204 | if (!m_replyid.isEmpty()) { | 208 | if (!m_replyid.isEmpty()) { |
205 | QStringList ids; | 209 | QStringList ids; |
206 | ids.append(m_replyid); | 210 | ids.append(m_replyid); |
207 | mail->setInreply(ids); | 211 | mail.setInreply(ids); |
208 | } | 212 | } |
209 | QString txt = message->text(); | 213 | QString txt = message->text(); |
210 | if ( !sigMultiLine->text().isEmpty() ) { | 214 | if ( !sigMultiLine->text().isEmpty() ) { |
211 | txt.append( "\n--\n" ); | 215 | txt.append( "\n--\n" ); |
212 | txt.append( sigMultiLine->text() ); | 216 | txt.append( sigMultiLine->text() ); |
213 | } | 217 | } |
214 | qDebug(txt); | 218 | qDebug(txt); |
215 | mail->setMessage( txt ); | 219 | mail.setMessage( txt ); |
216 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); | 220 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); |
217 | while ( it != NULL ) { | 221 | while ( it != NULL ) { |
218 | mail->addAttachment( it->getAttachment() ); | 222 | mail.addAttachment( it->getAttachment() ); |
219 | it = (AttachViewItem *) it->nextSibling(); | 223 | it = (AttachViewItem *) it->nextSibling(); |
220 | } | 224 | } |
221 | 225 | ||
222 | SMTPwrapper wrapper( smtp ); | 226 | SMTPwrapper wrapper( smtp ); |
223 | wrapper.sendMail( *mail,checkBoxLater->isChecked() ); | 227 | wrapper.sendMail( mail,checkBoxLater->isChecked() ); |
224 | 228 | ||
225 | QDialog::accept(); | 229 | QDialog::accept(); |
226 | } | 230 | } |
227 | 231 | ||
232 | void ComposeMail::reject() | ||
233 | { | ||
234 | int yesno = QMessageBox::warning(0,tr("Store message"), | ||
235 | tr("Store message into drafts?"), | ||
236 | tr("Yes"), | ||
237 | tr("No"),QString::null,0,1); | ||
238 | |||
239 | if (yesno == 0) { | ||
240 | Mail mail; | ||
241 | mail.setMail(fromBox->currentText()); | ||
242 | mail.setTo( toLine->text() ); | ||
243 | mail.setName(senderNameEdit->text()); | ||
244 | mail.setCC( ccLine->text() ); | ||
245 | mail.setBCC( bccLine->text() ); | ||
246 | mail.setReply( replyLine->text() ); | ||
247 | mail.setSubject( subjectLine->text() ); | ||
248 | if (!m_replyid.isEmpty()) { | ||
249 | QStringList ids; | ||
250 | ids.append(m_replyid); | ||
251 | mail.setInreply(ids); | ||
252 | } | ||
253 | QString txt = message->text(); | ||
254 | if ( !sigMultiLine->text().isEmpty() ) { | ||
255 | txt.append( "\n--\n" ); | ||
256 | txt.append( sigMultiLine->text() ); | ||
257 | } | ||
258 | qDebug(txt); | ||
259 | mail.setMessage( txt ); | ||
260 | |||
261 | /* only use the default drafts folder name! */ | ||
262 | Storemail wrapper(AbstractMail::draftFolder()); | ||
263 | wrapper.storeMail(mail); | ||
264 | |||
265 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); | ||
266 | /* attachments we will ignore! */ | ||
267 | if ( it != NULL ) { | ||
268 | QMessageBox::warning(0,tr("Store message"), | ||
269 | tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); | ||
270 | } | ||
271 | } | ||
272 | QDialog::reject(); | ||
273 | } | ||
274 | |||
275 | ComposeMail::~ComposeMail() | ||
276 | { | ||
277 | } | ||
278 | |||
279 | void ComposeMail::reEditMail(const RecMail¤t) | ||
280 | { | ||
281 | RecMail data = current; | ||
282 | message->setText(data.Wrapper()->fetchBody(current).Bodytext()); | ||
283 | subjectLine->setText( data.getSubject()); | ||
284 | toLine->setText(data.To().join(",")); | ||
285 | ccLine->setText(data.CC().join(",")); | ||
286 | bccLine->setText(data.Bcc().join(",")); | ||
287 | replyLine->setText(data.Replyto()); | ||
288 | } | ||
289 | |||
228 | AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) | 290 | AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) |
229 | : QListViewItem( parent ) | 291 | : QListViewItem( parent ) |
230 | { | 292 | { |
231 | attachment = att; | 293 | attachment = att; |
232 | qDebug( att->getMimeType() ); | 294 | qDebug( att->getMimeType() ); |
233 | setPixmap( 0, attachment->getDocLnk().pixmap().isNull() ? | 295 | setPixmap( 0, attachment->getDocLnk().pixmap().isNull() ? |
234 | Resource::loadPixmap( "UnknownDocument-14" ) : | 296 | Resource::loadPixmap( "UnknownDocument-14" ) : |
235 | attachment->getDocLnk().pixmap() ); | 297 | attachment->getDocLnk().pixmap() ); |
236 | setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); | 298 | setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); |
237 | setText( 1, QString::number( att->getSize() ) ); | 299 | setText( 1, QString::number( att->getSize() ) ); |
238 | } | 300 | } |
239 | 301 | ||
diff --git a/noncore/net/mail/composemail.h b/noncore/net/mail/composemail.h index 886fb1d..1b9fc79 100644 --- a/noncore/net/mail/composemail.h +++ b/noncore/net/mail/composemail.h | |||
@@ -1,74 +1,79 @@ | |||
1 | #ifndef COMPOSEMAIL_H | 1 | #ifndef COMPOSEMAIL_H |
2 | #define COMPOSEMAIL_H | 2 | #define COMPOSEMAIL_H |
3 | 3 | ||
4 | #include <qlineedit.h> | 4 | #include <qlineedit.h> |
5 | #include <qlistview.h> | 5 | #include <qlistview.h> |
6 | 6 | ||
7 | #include "composemailui.h" | 7 | #include "composemailui.h" |
8 | #include "addresspickerui.h" | 8 | #include "addresspickerui.h" |
9 | #include <libmailwrapper/settings.h> | 9 | #include <libmailwrapper/settings.h> |
10 | #include <libmailwrapper/mailwrapper.h> | 10 | #include <libmailwrapper/mailwrapper.h> |
11 | 11 | ||
12 | 12 | ||
13 | 13 | ||
14 | class AddressPicker : public AddressPickerUI | 14 | class AddressPicker : public AddressPickerUI |
15 | { | 15 | { |
16 | Q_OBJECT | 16 | Q_OBJECT |
17 | 17 | ||
18 | public: | 18 | public: |
19 | AddressPicker( QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 ); | 19 | AddressPicker( QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 ); |
20 | static QString getNames(); | 20 | static QString getNames(); |
21 | 21 | ||
22 | protected: | 22 | protected: |
23 | QString selectedNames; | 23 | QString selectedNames; |
24 | void accept(); | 24 | void accept(); |
25 | 25 | ||
26 | }; | 26 | }; |
27 | 27 | ||
28 | class RecMail; | ||
28 | 29 | ||
29 | class ComposeMail : public ComposeMailUI | 30 | class ComposeMail : public ComposeMailUI |
30 | { | 31 | { |
31 | Q_OBJECT | 32 | Q_OBJECT |
32 | 33 | ||
33 | public: | 34 | public: |
34 | ComposeMail( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 ); | 35 | ComposeMail( Settings *s, QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags flags = 0 ); |
36 | virtual ~ComposeMail(); | ||
37 | |||
38 | void reEditMail(const RecMail¤t); | ||
35 | 39 | ||
36 | public slots: | 40 | public slots: |
37 | void slotAdjustColumns(); | 41 | void slotAdjustColumns(); |
38 | 42 | ||
39 | void setTo( const QString & to ); | 43 | void setTo( const QString & to ); |
40 | void setSubject( const QString & subject ); | 44 | void setSubject( const QString & subject ); |
41 | void setInReplyTo( const QString & messageId ); | 45 | void setInReplyTo( const QString & messageId ); |
42 | void setMessage( const QString & text ); | 46 | void setMessage( const QString & text ); |
43 | 47 | ||
44 | protected slots: | 48 | protected slots: |
45 | void accept(); | 49 | void accept(); |
46 | 50 | void reject(); | |
51 | |||
47 | private slots: | 52 | private slots: |
48 | void fillValues( int current ); | 53 | void fillValues( int current ); |
49 | void pickAddress( QLineEdit *line ); | 54 | void pickAddress( QLineEdit *line ); |
50 | void pickAddressTo(); | 55 | void pickAddressTo(); |
51 | void pickAddressCC(); | 56 | void pickAddressCC(); |
52 | void pickAddressBCC(); | 57 | void pickAddressBCC(); |
53 | void pickAddressReply(); | 58 | void pickAddressReply(); |
54 | void addAttachment(); | 59 | void addAttachment(); |
55 | void removeAttachment(); | 60 | void removeAttachment(); |
56 | 61 | ||
57 | protected: | 62 | protected: |
58 | Settings *settings; | 63 | Settings *settings; |
59 | QList<SMTPaccount> smtpAccounts; | 64 | QList<SMTPaccount> smtpAccounts; |
60 | QString m_replyid; | 65 | QString m_replyid; |
61 | }; | 66 | }; |
62 | 67 | ||
63 | class AttachViewItem : public QListViewItem | 68 | class AttachViewItem : public QListViewItem |
64 | { | 69 | { |
65 | public: | 70 | public: |
66 | AttachViewItem( QListView *parent, Attachment *att ); | 71 | AttachViewItem( QListView *parent, Attachment *att ); |
67 | Attachment *getAttachment() { return attachment; } | 72 | Attachment *getAttachment() { return attachment; } |
68 | 73 | ||
69 | private: | 74 | private: |
70 | Attachment *attachment; | 75 | Attachment *attachment; |
71 | 76 | ||
72 | }; | 77 | }; |
73 | 78 | ||
74 | #endif | 79 | #endif |
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.cpp b/noncore/net/mail/libmailwrapper/abstractmail.cpp index 9960f88..d71d35c 100644 --- a/noncore/net/mail/libmailwrapper/abstractmail.cpp +++ b/noncore/net/mail/libmailwrapper/abstractmail.cpp | |||
@@ -1,143 +1,166 @@ | |||
1 | #include "abstractmail.h" | 1 | #include "abstractmail.h" |
2 | #include "imapwrapper.h" | 2 | #include "imapwrapper.h" |
3 | #include "pop3wrapper.h" | 3 | #include "pop3wrapper.h" |
4 | #include "nntpwrapper.h" | 4 | #include "nntpwrapper.h" |
5 | #include "mhwrapper.h" | 5 | #include "mhwrapper.h" |
6 | #include "mailtypes.h" | 6 | #include "mailtypes.h" |
7 | 7 | ||
8 | #include <qfile.h> | 8 | #include <qfile.h> |
9 | #include <qtextstream.h> | 9 | #include <qtextstream.h> |
10 | #include <stdlib.h> | 10 | #include <stdlib.h> |
11 | #include <libetpan/mailmime_content.h> | 11 | #include <libetpan/mailmime_content.h> |
12 | #include <libetpan/mailmime.h> | 12 | #include <libetpan/mailmime.h> |
13 | 13 | ||
14 | AbstractMail* AbstractMail::getWrapper(IMAPaccount *a) | 14 | AbstractMail* AbstractMail::getWrapper(IMAPaccount *a) |
15 | { | 15 | { |
16 | return new IMAPwrapper(a); | 16 | return new IMAPwrapper(a); |
17 | } | 17 | } |
18 | 18 | ||
19 | AbstractMail* AbstractMail::getWrapper(POP3account *a) | 19 | AbstractMail* AbstractMail::getWrapper(POP3account *a) |
20 | { | 20 | { |
21 | return new POP3wrapper(a); | 21 | return new POP3wrapper(a); |
22 | } | 22 | } |
23 | 23 | ||
24 | AbstractMail* AbstractMail::getWrapper(NNTPaccount *a) | 24 | AbstractMail* AbstractMail::getWrapper(NNTPaccount *a) |
25 | { | 25 | { |
26 | return new NNTPwrapper(a); | 26 | return new NNTPwrapper(a); |
27 | } | 27 | } |
28 | 28 | ||
29 | AbstractMail* AbstractMail::getWrapper(const QString&a,const QString&name) | 29 | AbstractMail* AbstractMail::getWrapper(const QString&a,const QString&name) |
30 | { | 30 | { |
31 | return new MHwrapper(a,name); | 31 | return new MHwrapper(a,name); |
32 | } | 32 | } |
33 | 33 | ||
34 | AbstractMail* AbstractMail::getWrapper(Account*a) | ||
35 | { | ||
36 | if (!a) return 0; | ||
37 | switch (a->getType()) { | ||
38 | case MAILLIB::A_IMAP: | ||
39 | return new IMAPwrapper((IMAPaccount*)a); | ||
40 | break; | ||
41 | case MAILLIB::A_POP3: | ||
42 | return new POP3wrapper((POP3account*)a); | ||
43 | break; | ||
44 | case MAILLIB::A_NNTP: | ||
45 | return new NNTPwrapper((NNTPaccount*)a); | ||
46 | break; | ||
47 | default: | ||
48 | return 0; | ||
49 | } | ||
50 | } | ||
51 | |||
34 | encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc) | 52 | encodedString* AbstractMail::decode_String(const encodedString*text,const QString&enc) |
35 | { | 53 | { |
36 | qDebug("Decode string start"); | 54 | qDebug("Decode string start"); |
37 | char*result_text; | 55 | char*result_text; |
38 | size_t index = 0; | 56 | size_t index = 0; |
39 | /* reset for recursive use! */ | 57 | /* reset for recursive use! */ |
40 | size_t target_length = 0; | 58 | size_t target_length = 0; |
41 | result_text = 0; | 59 | result_text = 0; |
42 | int mimetype = MAILMIME_MECHANISM_7BIT; | 60 | int mimetype = MAILMIME_MECHANISM_7BIT; |
43 | if (enc.lower()=="quoted-printable") { | 61 | if (enc.lower()=="quoted-printable") { |
44 | mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE; | 62 | mimetype = MAILMIME_MECHANISM_QUOTED_PRINTABLE; |
45 | } else if (enc.lower()=="base64") { | 63 | } else if (enc.lower()=="base64") { |
46 | mimetype = MAILMIME_MECHANISM_BASE64; | 64 | mimetype = MAILMIME_MECHANISM_BASE64; |
47 | } else if (enc.lower()=="8bit") { | 65 | } else if (enc.lower()=="8bit") { |
48 | mimetype = MAILMIME_MECHANISM_8BIT; | 66 | mimetype = MAILMIME_MECHANISM_8BIT; |
49 | } else if (enc.lower()=="binary") { | 67 | } else if (enc.lower()=="binary") { |
50 | mimetype = MAILMIME_MECHANISM_BINARY; | 68 | mimetype = MAILMIME_MECHANISM_BINARY; |
51 | } | 69 | } |
52 | 70 | ||
53 | int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype, | 71 | int err = mailmime_part_parse(text->Content(),text->Length(),&index,mimetype, |
54 | &result_text,&target_length); | 72 | &result_text,&target_length); |
55 | 73 | ||
56 | encodedString* result = new encodedString(); | 74 | encodedString* result = new encodedString(); |
57 | if (err == MAILIMF_NO_ERROR) { | 75 | if (err == MAILIMF_NO_ERROR) { |
58 | result->setContent(result_text,target_length); | 76 | result->setContent(result_text,target_length); |
59 | } | 77 | } |
60 | qDebug("Decode string finished"); | 78 | qDebug("Decode string finished"); |
61 | return result; | 79 | return result; |
62 | } | 80 | } |
63 | 81 | ||
64 | QString AbstractMail::convert_String(const char*text) | 82 | QString AbstractMail::convert_String(const char*text) |
65 | { | 83 | { |
66 | size_t index = 0; | 84 | size_t index = 0; |
67 | char*res = 0; | 85 | char*res = 0; |
68 | 86 | ||
69 | /* attention - doesn't work with arm systems! */ | 87 | /* attention - doesn't work with arm systems! */ |
70 | int err = mailmime_encoded_phrase_parse("iso-8859-1", | 88 | int err = mailmime_encoded_phrase_parse("iso-8859-1", |
71 | text, strlen(text),&index, "iso-8859-1",&res); | 89 | text, strlen(text),&index, "iso-8859-1",&res); |
72 | if (err != MAILIMF_NO_ERROR) { | 90 | if (err != MAILIMF_NO_ERROR) { |
73 | if (res) free(res); | 91 | if (res) free(res); |
74 | return QString(text); | 92 | return QString(text); |
75 | } | 93 | } |
76 | if (res) { | 94 | if (res) { |
77 | QString result(res); | 95 | QString result(res); |
78 | free(res); | 96 | free(res); |
79 | return result; | 97 | return result; |
80 | } | 98 | } |
81 | return QString(text); | 99 | return QString(text); |
82 | } | 100 | } |
83 | 101 | ||
84 | /* cp & paste from launcher */ | 102 | /* cp & paste from launcher */ |
85 | QString AbstractMail::gen_attachment_id() | 103 | QString AbstractMail::gen_attachment_id() |
86 | { | 104 | { |
87 | QFile file( "/proc/sys/kernel/random/uuid" ); | 105 | QFile file( "/proc/sys/kernel/random/uuid" ); |
88 | if (!file.open(IO_ReadOnly ) ) | 106 | if (!file.open(IO_ReadOnly ) ) |
89 | return QString::null; | 107 | return QString::null; |
90 | 108 | ||
91 | QTextStream stream(&file); | 109 | QTextStream stream(&file); |
92 | 110 | ||
93 | return "{" + stream.read().stripWhiteSpace() + "}"; | 111 | return "{" + stream.read().stripWhiteSpace() + "}"; |
94 | } | 112 | } |
95 | 113 | ||
96 | int AbstractMail::createMbox(const QString&,const Folder*,const QString& delemiter,bool) | 114 | int AbstractMail::createMbox(const QString&,const Folder*,const QString& delemiter,bool) |
97 | { | 115 | { |
98 | return 0; | 116 | return 0; |
99 | } | 117 | } |
100 | 118 | ||
101 | QString AbstractMail::defaultLocalfolder() | 119 | QString AbstractMail::defaultLocalfolder() |
102 | { | 120 | { |
103 | QString f = getenv( "HOME" ); | 121 | QString f = getenv( "HOME" ); |
104 | f += "/Applications/opiemail/localmail"; | 122 | f += "/Applications/opiemail/localmail"; |
105 | return f; | 123 | return f; |
106 | } | 124 | } |
107 | 125 | ||
126 | QString AbstractMail::draftFolder() | ||
127 | { | ||
128 | return QString("Drafts"); | ||
129 | } | ||
130 | |||
108 | /* temporary - will be removed when implemented in all classes */ | 131 | /* temporary - will be removed when implemented in all classes */ |
109 | void AbstractMail::deleteMails(const QString &,QList<RecMail> &) | 132 | void AbstractMail::deleteMails(const QString &,QList<RecMail> &) |
110 | { | 133 | { |
111 | } | 134 | } |
112 | 135 | ||
113 | void AbstractMail::mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) | 136 | void AbstractMail::mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) |
114 | { | 137 | { |
115 | QList<RecMail> t; | 138 | QList<RecMail> t; |
116 | listMessages(fromFolder->getName(),t); | 139 | listMessages(fromFolder->getName(),t); |
117 | encodedString*st = 0; | 140 | encodedString*st = 0; |
118 | while (t.count()>0) { | 141 | while (t.count()>0) { |
119 | RecMail*r = t.at(0); | 142 | RecMail*r = t.at(0); |
120 | st = fetchRawBody(*r); | 143 | st = fetchRawBody(*r); |
121 | if (st) { | 144 | if (st) { |
122 | targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder); | 145 | targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder); |
123 | delete st; | 146 | delete st; |
124 | } | 147 | } |
125 | t.removeFirst(); | 148 | t.removeFirst(); |
126 | } | 149 | } |
127 | if (moveit) { | 150 | if (moveit) { |
128 | deleteAllMail(fromFolder); | 151 | deleteAllMail(fromFolder); |
129 | } | 152 | } |
130 | } | 153 | } |
131 | 154 | ||
132 | void AbstractMail::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) | 155 | void AbstractMail::mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit) |
133 | { | 156 | { |
134 | encodedString*st = 0; | 157 | encodedString*st = 0; |
135 | st = fetchRawBody(mail); | 158 | st = fetchRawBody(mail); |
136 | if (st) { | 159 | if (st) { |
137 | targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder); | 160 | targetWrapper->storeMessage(st->Content(),st->Length(),targetFolder); |
138 | delete st; | 161 | delete st; |
139 | } | 162 | } |
140 | if (moveit) { | 163 | if (moveit) { |
141 | deleteMail(mail); | 164 | deleteMail(mail); |
142 | } | 165 | } |
143 | } | 166 | } |
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.h b/noncore/net/mail/libmailwrapper/abstractmail.h index 442ebfe..d377452 100644 --- a/noncore/net/mail/libmailwrapper/abstractmail.h +++ b/noncore/net/mail/libmailwrapper/abstractmail.h | |||
@@ -1,68 +1,70 @@ | |||
1 | #ifndef __abstract_mail_ | 1 | #ifndef __abstract_mail_ |
2 | #define __abstract_mail_ | 2 | #define __abstract_mail_ |
3 | 3 | ||
4 | #include "maildefines.h" | 4 | #include "maildefines.h" |
5 | 5 | ||
6 | #include <qobject.h> | 6 | #include <qobject.h> |
7 | #include "settings.h" | 7 | #include "settings.h" |
8 | 8 | ||
9 | class RecMail; | 9 | class RecMail; |
10 | class RecBody; | 10 | class RecBody; |
11 | class RecPart; | 11 | class RecPart; |
12 | class IMAPwrapper; | 12 | class IMAPwrapper; |
13 | class POP3wrapper; | 13 | class POP3wrapper; |
14 | class Folder; | 14 | class Folder; |
15 | class encodedString; | 15 | class encodedString; |
16 | struct folderStat; | 16 | struct folderStat; |
17 | 17 | ||
18 | class AbstractMail:public QObject | 18 | class AbstractMail:public QObject |
19 | { | 19 | { |
20 | Q_OBJECT | 20 | Q_OBJECT |
21 | public: | 21 | public: |
22 | AbstractMail(){}; | 22 | AbstractMail(){}; |
23 | virtual ~AbstractMail(){} | 23 | virtual ~AbstractMail(){} |
24 | virtual QList<Folder>* listFolders()=0; | 24 | virtual QList<Folder>* listFolders()=0; |
25 | virtual void listMessages(const QString & mailbox,QList<RecMail>&target )=0; | 25 | virtual void listMessages(const QString & mailbox,QList<RecMail>&target )=0; |
26 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX")=0; | 26 | virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX")=0; |
27 | virtual RecBody fetchBody(const RecMail&mail)=0; | 27 | virtual RecBody fetchBody(const RecMail&mail)=0; |
28 | virtual QString fetchTextPart(const RecMail&mail,const RecPart&part)=0; | 28 | virtual QString fetchTextPart(const RecMail&mail,const RecPart&part)=0; |
29 | virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part)=0; | 29 | virtual encodedString* fetchDecodedPart(const RecMail&mail,const RecPart&part)=0; |
30 | virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part)=0; | 30 | virtual encodedString* fetchRawPart(const RecMail&mail,const RecPart&part)=0; |
31 | virtual encodedString* fetchRawBody(const RecMail&mail)=0; | 31 | virtual encodedString* fetchRawBody(const RecMail&mail)=0; |
32 | 32 | ||
33 | virtual void deleteMail(const RecMail&mail)=0; | 33 | virtual void deleteMail(const RecMail&mail)=0; |
34 | virtual void answeredMail(const RecMail&mail)=0; | 34 | virtual void answeredMail(const RecMail&mail)=0; |
35 | virtual int deleteAllMail(const Folder*)=0; | 35 | virtual int deleteAllMail(const Folder*)=0; |
36 | virtual void deleteMails(const QString & FolderName,QList<RecMail> &target); | 36 | virtual void deleteMails(const QString & FolderName,QList<RecMail> &target); |
37 | virtual int deleteMbox(const Folder*)=0; | 37 | virtual int deleteMbox(const Folder*)=0; |
38 | virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0; | 38 | virtual void storeMessage(const char*msg,size_t length, const QString&folder)=0; |
39 | 39 | ||
40 | virtual void mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); | 40 | virtual void mvcpAllMails(Folder*fromFolder,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); |
41 | virtual void mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); | 41 | virtual void mvcpMail(const RecMail&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); |
42 | 42 | ||
43 | virtual void cleanMimeCache(){}; | 43 | virtual void cleanMimeCache(){}; |
44 | /* mail box methods */ | 44 | /* mail box methods */ |
45 | /* parameter is the box to create. | 45 | /* parameter is the box to create. |
46 | * if the implementing subclass has prefixes, | 46 | * if the implementing subclass has prefixes, |
47 | * them has to be appended automatic. | 47 | * them has to be appended automatic. |
48 | */ | 48 | */ |
49 | virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false); | 49 | virtual int createMbox(const QString&,const Folder*parentfolder=0,const QString& delemiter="/",bool getsubfolder=false); |
50 | virtual void logout()=0; | 50 | virtual void logout()=0; |
51 | 51 | ||
52 | static AbstractMail* getWrapper(IMAPaccount *a); | 52 | static AbstractMail* getWrapper(IMAPaccount *a); |
53 | static AbstractMail* getWrapper(POP3account *a); | 53 | static AbstractMail* getWrapper(POP3account *a); |
54 | static AbstractMail* getWrapper(NNTPaccount *a); | 54 | static AbstractMail* getWrapper(NNTPaccount *a); |
55 | /* mbox only! */ | 55 | /* mbox only! */ |
56 | static AbstractMail* getWrapper(const QString&a,const QString&name="Local Folders"); | 56 | static AbstractMail* getWrapper(const QString&a,const QString&name="Local Folders"); |
57 | static AbstractMail* getWrapper(Account*a); | ||
57 | 58 | ||
58 | static QString defaultLocalfolder(); | 59 | static QString defaultLocalfolder(); |
59 | 60 | static QString draftFolder(); | |
61 | |||
60 | virtual MAILLIB::ATYPE getType()const=0; | 62 | virtual MAILLIB::ATYPE getType()const=0; |
61 | virtual const QString&getName()const=0; | 63 | virtual const QString&getName()const=0; |
62 | 64 | ||
63 | protected: | 65 | protected: |
64 | static encodedString*decode_String(const encodedString*text,const QString&enc); | 66 | static encodedString*decode_String(const encodedString*text,const QString&enc); |
65 | static QString convert_String(const char*text); | 67 | static QString convert_String(const char*text); |
66 | static QString gen_attachment_id(); | 68 | static QString gen_attachment_id(); |
67 | }; | 69 | }; |
68 | #endif | 70 | #endif |
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.cpp b/noncore/net/mail/libmailwrapper/genericwrapper.cpp index 137a6ef..ffa049f 100644 --- a/noncore/net/mail/libmailwrapper/genericwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/genericwrapper.cpp | |||
@@ -405,63 +405,71 @@ void Genericwrapper::parseList(QList<RecMail> &target,mailsession*session,const | |||
405 | return; | 405 | return; |
406 | } | 406 | } |
407 | mailimf_references * refs = 0; | 407 | mailimf_references * refs = 0; |
408 | mailimf_in_reply_to * in_replies = 0; | 408 | mailimf_in_reply_to * in_replies = 0; |
409 | uint32_t i = 0; | 409 | uint32_t i = 0; |
410 | for(; i < carray_count(env_list->msg_tab) ; ++i) { | 410 | for(; i < carray_count(env_list->msg_tab) ; ++i) { |
411 | mailmessage * msg; | 411 | mailmessage * msg; |
412 | QBitArray mFlags(7); | 412 | QBitArray mFlags(7); |
413 | msg = (mailmessage*)carray_get(env_list->msg_tab, i); | 413 | msg = (mailmessage*)carray_get(env_list->msg_tab, i); |
414 | if (msg->msg_fields == NULL) { | 414 | if (msg->msg_fields == NULL) { |
415 | //qDebug("could not fetch envelope of message %i", i); | 415 | //qDebug("could not fetch envelope of message %i", i); |
416 | continue; | 416 | continue; |
417 | } | 417 | } |
418 | RecMail * mail = new RecMail(); | 418 | RecMail * mail = new RecMail(); |
419 | mail->setWrapper(this); | 419 | mail->setWrapper(this); |
420 | mail_flags * flag_result = 0; | 420 | mail_flags * flag_result = 0; |
421 | r = mailmessage_get_flags(msg,&flag_result); | 421 | r = mailmessage_get_flags(msg,&flag_result); |
422 | if (r == MAIL_ERROR_NOT_IMPLEMENTED) { | 422 | if (r == MAIL_ERROR_NOT_IMPLEMENTED) { |
423 | mFlags.setBit(FLAG_SEEN); | 423 | mFlags.setBit(FLAG_SEEN); |
424 | } | 424 | } |
425 | mailimf_single_fields single_fields; | 425 | mailimf_single_fields single_fields; |
426 | mailimf_single_fields_init(&single_fields, msg->msg_fields); | 426 | mailimf_single_fields_init(&single_fields, msg->msg_fields); |
427 | mail->setMsgsize(msg->msg_size); | 427 | mail->setMsgsize(msg->msg_size); |
428 | mail->setFlags(mFlags); | 428 | mail->setFlags(mFlags); |
429 | mail->setMbox(mailbox); | 429 | mail->setMbox(mailbox); |
430 | mail->setNumber(msg->msg_index); | 430 | mail->setNumber(msg->msg_index); |
431 | if (single_fields.fld_subject) | 431 | if (single_fields.fld_subject) |
432 | mail->setSubject( convert_String(single_fields.fld_subject->sbj_value)); | 432 | mail->setSubject( convert_String(single_fields.fld_subject->sbj_value)); |
433 | if (single_fields.fld_from) | 433 | if (single_fields.fld_from) |
434 | mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list)); | 434 | mail->setFrom(parseMailboxList(single_fields.fld_from->frm_mb_list)); |
435 | if (!mbox_as_to) { | 435 | if (!mbox_as_to) { |
436 | if (single_fields.fld_to) | 436 | if (single_fields.fld_to) |
437 | mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) ); | 437 | mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) ); |
438 | } else { | 438 | } else { |
439 | mail->setTo(mailbox); | 439 | mail->setTo(mailbox); |
440 | } | 440 | } |
441 | if (single_fields.fld_cc) | 441 | if (single_fields.fld_cc) |
442 | mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); | 442 | mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); |
443 | if (single_fields.fld_bcc) | 443 | if (single_fields.fld_bcc) |
444 | mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); | 444 | mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); |
445 | if (single_fields.fld_orig_date) | 445 | if (single_fields.fld_orig_date) |
446 | mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) ); | 446 | mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) ); |
447 | // crashes when accessing pop3 account? | 447 | // crashes when accessing pop3 account? |
448 | if (single_fields.fld_message_id->mid_value) { | 448 | if (single_fields.fld_message_id->mid_value) { |
449 | mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); | 449 | mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); |
450 | qDebug("Msgid == %s",mail->Msgid().latin1()); | 450 | qDebug("Msgid == %s",mail->Msgid().latin1()); |
451 | } | 451 | } |
452 | 452 | ||
453 | if (single_fields.fld_reply_to) { | ||
454 | QStringList t = parseAddressList(single_fields.fld_reply_to->rt_addr_list); | ||
455 | if (t.count()>0) { | ||
456 | mail->setReplyto(t[0]); | ||
457 | } | ||
458 | } | ||
459 | #if 0 | ||
453 | refs = single_fields.fld_references; | 460 | refs = single_fields.fld_references; |
454 | if (refs && refs->mid_list && clist_count(refs->mid_list)) { | 461 | if (refs && refs->mid_list && clist_count(refs->mid_list)) { |
455 | char * text = (char*)refs->mid_list->first->data; | 462 | char * text = (char*)refs->mid_list->first->data; |
456 | mail->setReplyto(QString(text)); | 463 | mail->setReplyto(QString(text)); |
457 | } | 464 | } |
465 | #endif | ||
458 | if (single_fields.fld_in_reply_to && single_fields.fld_in_reply_to->mid_list && | 466 | if (single_fields.fld_in_reply_to && single_fields.fld_in_reply_to->mid_list && |
459 | clist_count(single_fields.fld_in_reply_to->mid_list)) { | 467 | clist_count(single_fields.fld_in_reply_to->mid_list)) { |
460 | mail->setInreply(parseInreplies(single_fields.fld_in_reply_to)); | 468 | mail->setInreply(parseInreplies(single_fields.fld_in_reply_to)); |
461 | } | 469 | } |
462 | target.append(mail); | 470 | target.append(mail); |
463 | } | 471 | } |
464 | if (env_list) { | 472 | if (env_list) { |
465 | mailmessage_list_free(env_list); | 473 | mailmessage_list_free(env_list); |
466 | } | 474 | } |
467 | } | 475 | } |
diff --git a/noncore/net/mail/libmailwrapper/libmailwrapper.pro b/noncore/net/mail/libmailwrapper/libmailwrapper.pro index cb1e573..d28079e 100644 --- a/noncore/net/mail/libmailwrapper/libmailwrapper.pro +++ b/noncore/net/mail/libmailwrapper/libmailwrapper.pro | |||
@@ -1,52 +1,54 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt warn_on debug | 2 | CONFIG += qt warn_on debug |
3 | 3 | ||
4 | HEADERS = mailwrapper.h \ | 4 | HEADERS = mailwrapper.h \ |
5 | imapwrapper.h \ | 5 | imapwrapper.h \ |
6 | mailtypes.h \ | 6 | mailtypes.h \ |
7 | pop3wrapper.h \ | 7 | pop3wrapper.h \ |
8 | abstractmail.h \ | 8 | abstractmail.h \ |
9 | smtpwrapper.h \ | 9 | smtpwrapper.h \ |
10 | genericwrapper.h \ | 10 | genericwrapper.h \ |
11 | mboxwrapper.h \ | 11 | mboxwrapper.h \ |
12 | settings.h \ | 12 | settings.h \ |
13 | logindialog.h \ | 13 | logindialog.h \ |
14 | sendmailprogress.h \ | 14 | sendmailprogress.h \ |
15 | statusmail.h \ | 15 | statusmail.h \ |
16 | mhwrapper.h \ | 16 | mhwrapper.h \ |
17 | nntpwrapper.h \ | 17 | nntpwrapper.h \ |
18 | generatemail.h | 18 | generatemail.h \ |
19 | storemail.h | ||
19 | 20 | ||
20 | SOURCES = imapwrapper.cpp \ | 21 | SOURCES = imapwrapper.cpp \ |
21 | mailwrapper.cpp \ | 22 | mailwrapper.cpp \ |
22 | mailtypes.cpp \ | 23 | mailtypes.cpp \ |
23 | pop3wrapper.cpp \ | 24 | pop3wrapper.cpp \ |
24 | abstractmail.cpp \ | 25 | abstractmail.cpp \ |
25 | smtpwrapper.cpp \ | 26 | smtpwrapper.cpp \ |
26 | genericwrapper.cpp \ | 27 | genericwrapper.cpp \ |
27 | mboxwrapper.cpp \ | 28 | mboxwrapper.cpp \ |
28 | settings.cpp \ | 29 | settings.cpp \ |
29 | logindialog.cpp \ | 30 | logindialog.cpp \ |
30 | sendmailprogress.cpp \ | 31 | sendmailprogress.cpp \ |
31 | statusmail.cpp \ | 32 | statusmail.cpp \ |
32 | mhwrapper.cpp \ | 33 | mhwrapper.cpp \ |
33 | nntpwrapper.cpp \ | 34 | nntpwrapper.cpp \ |
34 | generatemail.cpp | 35 | generatemail.cpp \ |
36 | storemail.cpp | ||
35 | 37 | ||
36 | INTERFACES = logindialogui.ui \ | 38 | INTERFACES = logindialogui.ui \ |
37 | sendmailprogressui.ui | 39 | sendmailprogressui.ui |
38 | 40 | ||
39 | 41 | ||
40 | INCLUDEPATH += $(OPIEDIR)/include | 42 | INCLUDEPATH += $(OPIEDIR)/include |
41 | 43 | ||
42 | CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX ) | 44 | CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX ) |
43 | contains( CONFTEST, y ){ | 45 | contains( CONFTEST, y ){ |
44 | LIBS += -lqpe -letpan -lssl -lcrypto -liconv | 46 | LIBS += -lqpe -letpan -lssl -lcrypto -liconv |
45 | }else{ | 47 | }else{ |
46 | LIBS += -lqpe -letpan -lssl -lcrypto | 48 | LIBS += -lqpe -letpan -lssl -lcrypto |
47 | } | 49 | } |
48 | 50 | ||
49 | DESTDIR = $(OPIEDIR)/lib$(PROJMAK) | 51 | DESTDIR = $(OPIEDIR)/lib$(PROJMAK) |
50 | TARGET = mailwrapper | 52 | TARGET = mailwrapper |
51 | 53 | ||
52 | include ( $(OPIEDIR)/include.pro ) | 54 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/net/mail/libmailwrapper/mailtypes.cpp b/noncore/net/mail/libmailwrapper/mailtypes.cpp index e4646d9..49b3caa 100644 --- a/noncore/net/mail/libmailwrapper/mailtypes.cpp +++ b/noncore/net/mail/libmailwrapper/mailtypes.cpp | |||
@@ -1,86 +1,87 @@ | |||
1 | #include "mailtypes.h" | 1 | #include "mailtypes.h" |
2 | #include <stdlib.h> | 2 | #include <stdlib.h> |
3 | 3 | ||
4 | RecMail::RecMail() | 4 | RecMail::RecMail() |
5 | :subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7) | 5 | :subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7) |
6 | { | 6 | { |
7 | init(); | 7 | init(); |
8 | } | 8 | } |
9 | 9 | ||
10 | RecMail::RecMail(const RecMail&old) | 10 | RecMail::RecMail(const RecMail&old) |
11 | :subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7) | 11 | :subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7) |
12 | { | 12 | { |
13 | init(); | 13 | init(); |
14 | copy_old(old); | 14 | copy_old(old); |
15 | qDebug("Copy constructor RecMail"); | 15 | qDebug("Copy constructor RecMail"); |
16 | } | 16 | } |
17 | 17 | ||
18 | RecMail::~RecMail() | 18 | RecMail::~RecMail() |
19 | { | 19 | { |
20 | wrapper = 0; | 20 | wrapper = 0; |
21 | } | 21 | } |
22 | 22 | ||
23 | void RecMail::copy_old(const RecMail&old) | 23 | void RecMail::copy_old(const RecMail&old) |
24 | { | 24 | { |
25 | subject = old.subject; | 25 | subject = old.subject; |
26 | date = old.date; | 26 | date = old.date; |
27 | mbox = old.mbox; | 27 | mbox = old.mbox; |
28 | msg_id = old.msg_id; | 28 | msg_id = old.msg_id; |
29 | msg_size = old.msg_size; | 29 | msg_size = old.msg_size; |
30 | msg_number = old.msg_number; | 30 | msg_number = old.msg_number; |
31 | from = old.from; | 31 | from = old.from; |
32 | msg_flags = old.msg_flags; | 32 | msg_flags = old.msg_flags; |
33 | to = old.to; | 33 | to = old.to; |
34 | cc = old.cc; | 34 | cc = old.cc; |
35 | bcc = old.bcc; | 35 | bcc = old.bcc; |
36 | wrapper = old.wrapper; | 36 | wrapper = old.wrapper; |
37 | in_reply_to = old.in_reply_to; | 37 | in_reply_to = old.in_reply_to; |
38 | references = old.references; | 38 | references = old.references; |
39 | replyto = old.replyto; | ||
39 | } | 40 | } |
40 | 41 | ||
41 | void RecMail::init() | 42 | void RecMail::init() |
42 | { | 43 | { |
43 | to.clear(); | 44 | to.clear(); |
44 | cc.clear(); | 45 | cc.clear(); |
45 | bcc.clear(); | 46 | bcc.clear(); |
46 | in_reply_to.clear(); | 47 | in_reply_to.clear(); |
47 | references.clear(); | 48 | references.clear(); |
48 | wrapper = 0; | 49 | wrapper = 0; |
49 | } | 50 | } |
50 | 51 | ||
51 | void RecMail::setWrapper(AbstractMail*awrapper) | 52 | void RecMail::setWrapper(AbstractMail*awrapper) |
52 | { | 53 | { |
53 | wrapper = awrapper; | 54 | wrapper = awrapper; |
54 | } | 55 | } |
55 | 56 | ||
56 | AbstractMail* RecMail::Wrapper() | 57 | AbstractMail* RecMail::Wrapper() |
57 | { | 58 | { |
58 | return wrapper; | 59 | return wrapper; |
59 | } | 60 | } |
60 | 61 | ||
61 | void RecMail::setTo(const QStringList&list) | 62 | void RecMail::setTo(const QStringList&list) |
62 | { | 63 | { |
63 | to = list; | 64 | to = list; |
64 | } | 65 | } |
65 | 66 | ||
66 | const QStringList&RecMail::To()const | 67 | const QStringList&RecMail::To()const |
67 | { | 68 | { |
68 | return to; | 69 | return to; |
69 | } | 70 | } |
70 | 71 | ||
71 | void RecMail::setCC(const QStringList&list) | 72 | void RecMail::setCC(const QStringList&list) |
72 | { | 73 | { |
73 | cc = list; | 74 | cc = list; |
74 | } | 75 | } |
75 | 76 | ||
76 | const QStringList&RecMail::CC()const | 77 | const QStringList&RecMail::CC()const |
77 | { | 78 | { |
78 | return cc; | 79 | return cc; |
79 | } | 80 | } |
80 | 81 | ||
81 | void RecMail::setBcc(const QStringList&list) | 82 | void RecMail::setBcc(const QStringList&list) |
82 | { | 83 | { |
83 | bcc = list; | 84 | bcc = list; |
84 | } | 85 | } |
85 | 86 | ||
86 | const QStringList& RecMail::Bcc()const | 87 | const QStringList& RecMail::Bcc()const |
diff --git a/noncore/net/mail/libmailwrapper/storemail.cpp b/noncore/net/mail/libmailwrapper/storemail.cpp new file mode 100644 index 0000000..53101f8 --- a/dev/null +++ b/noncore/net/mail/libmailwrapper/storemail.cpp | |||
@@ -0,0 +1,90 @@ | |||
1 | #include "storemail.h" | ||
2 | #include "mailwrapper.h" | ||
3 | #include "settings.h" | ||
4 | #include "abstractmail.h" | ||
5 | |||
6 | #include <libetpan/libetpan.h> | ||
7 | |||
8 | #include <qstring.h> | ||
9 | |||
10 | #include <stdlib.h> | ||
11 | |||
12 | Storemail::Storemail(Account*aAccount,const QString&aFolder) | ||
13 | : Generatemail() | ||
14 | { | ||
15 | wrapper = 0; | ||
16 | m_Account = aAccount; | ||
17 | m_tfolder = aFolder; | ||
18 | wrapper = AbstractMail::getWrapper(m_Account); | ||
19 | if (wrapper) { | ||
20 | wrapper->createMbox(m_tfolder); | ||
21 | } | ||
22 | } | ||
23 | |||
24 | Storemail::Storemail(const QString&dir,const QString&aFolder) | ||
25 | : Generatemail() | ||
26 | { | ||
27 | wrapper = 0; | ||
28 | m_Account = 0; | ||
29 | m_tfolder = aFolder; | ||
30 | wrapper = AbstractMail::getWrapper(dir); | ||
31 | if (wrapper) { | ||
32 | wrapper->createMbox(m_tfolder); | ||
33 | } | ||
34 | } | ||
35 | |||
36 | Storemail::Storemail(const QString&aFolder) | ||
37 | : Generatemail() | ||
38 | { | ||
39 | wrapper = 0; | ||
40 | m_Account = 0; | ||
41 | m_tfolder = aFolder; | ||
42 | wrapper = AbstractMail::getWrapper(AbstractMail::defaultLocalfolder()); | ||
43 | if (wrapper) { | ||
44 | wrapper->createMbox(m_tfolder); | ||
45 | } | ||
46 | } | ||
47 | |||
48 | Storemail::~Storemail() | ||
49 | { | ||
50 | } | ||
51 | |||
52 | int Storemail::storeMail(const Mail&mail) | ||
53 | { | ||
54 | if (!wrapper) return 0; | ||
55 | int ret = 1; | ||
56 | |||
57 | mailmime * mimeMail = 0; | ||
58 | mimeMail = createMimeMail(mail ); | ||
59 | if ( mimeMail == NULL ) { | ||
60 | qDebug( "storeMail: error creating mime mail" ); | ||
61 | return 0; | ||
62 | } | ||
63 | char *data; | ||
64 | size_t size; | ||
65 | data = 0; | ||
66 | |||
67 | mailmessage * msg = 0; | ||
68 | msg = mime_message_init(mimeMail); | ||
69 | mime_message_set_tmpdir(msg,getenv( "HOME" )); | ||
70 | int r = mailmessage_fetch(msg,&data,&size); | ||
71 | mime_message_detach_mime(msg); | ||
72 | mailmessage_free(msg); | ||
73 | msg = 0; | ||
74 | if (r != MAIL_NO_ERROR || !data) { | ||
75 | qDebug("Error fetching mime..."); | ||
76 | ret = 0; | ||
77 | } | ||
78 | |||
79 | if (ret) { | ||
80 | wrapper->storeMessage(data,size,m_tfolder); | ||
81 | } | ||
82 | |||
83 | if (data) { | ||
84 | free(data); | ||
85 | } | ||
86 | if (mimeMail) { | ||
87 | mailmime_free( mimeMail ); | ||
88 | } | ||
89 | return ret; | ||
90 | } | ||
diff --git a/noncore/net/mail/libmailwrapper/storemail.h b/noncore/net/mail/libmailwrapper/storemail.h new file mode 100644 index 0000000..872c981 --- a/dev/null +++ b/noncore/net/mail/libmailwrapper/storemail.h | |||
@@ -0,0 +1,29 @@ | |||
1 | #ifndef __STORE_MAIL_H | ||
2 | #define __STORE_MAIL_H | ||
3 | |||
4 | #include <qpe/applnk.h> | ||
5 | |||
6 | #include "generatemail.h" | ||
7 | |||
8 | class Account; | ||
9 | class Mail; | ||
10 | class AbstractMail; | ||
11 | |||
12 | class Storemail : public Generatemail | ||
13 | { | ||
14 | Q_OBJECT | ||
15 | public: | ||
16 | Storemail(Account*aAccount,const QString&aFolder); | ||
17 | Storemail(const QString&dir,const QString&aFolder); | ||
18 | Storemail(const QString&aFolder); | ||
19 | virtual ~Storemail(); | ||
20 | |||
21 | int storeMail(const Mail&mail); | ||
22 | |||
23 | protected: | ||
24 | Account* m_Account; | ||
25 | QString m_tfolder; | ||
26 | AbstractMail*wrapper; | ||
27 | }; | ||
28 | |||
29 | #endif | ||
diff --git a/noncore/net/mail/mailistviewitem.cpp b/noncore/net/mail/mailistviewitem.cpp index f224dc3..75633ef 100644 --- a/noncore/net/mail/mailistviewitem.cpp +++ b/noncore/net/mail/mailistviewitem.cpp | |||
@@ -1,65 +1,72 @@ | |||
1 | #include "mailistviewitem.h" | 1 | #include "mailistviewitem.h" |
2 | #include <libmailwrapper/abstractmail.h> | ||
2 | #include <qtextstream.h> | 3 | #include <qtextstream.h> |
3 | #include <qpe/resource.h> | 4 | #include <qpe/resource.h> |
4 | 5 | ||
5 | MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) | 6 | MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) |
6 | :QListViewItem(parent,item),mail_data() | 7 | :QListViewItem(parent,item),mail_data() |
7 | { | 8 | { |
8 | } | 9 | } |
9 | 10 | ||
10 | void MailListViewItem::showEntry() | 11 | void MailListViewItem::showEntry() |
11 | { | 12 | { |
12 | if ( mail_data.getFlags().testBit( FLAG_ANSWERED ) == true) { | 13 | if ( mail_data.getFlags().testBit( FLAG_ANSWERED ) == true) { |
13 | setPixmap( 0, Resource::loadPixmap( "mail/kmmsgreplied") ); | 14 | setPixmap( 0, Resource::loadPixmap( "mail/kmmsgreplied") ); |
14 | } else if ( mail_data.getFlags().testBit( FLAG_SEEN ) == true ) { | 15 | } else if ( mail_data.getFlags().testBit( FLAG_SEEN ) == true ) { |
15 | /* I think it looks nicer if there are not such a log of icons but only on mails | 16 | /* I think it looks nicer if there are not such a log of icons but only on mails |
16 | replied or new - Alwin*/ | 17 | replied or new - Alwin*/ |
17 | //setPixmap( 0, Resource::loadPixmap( "mail/kmmsgunseen") ); | 18 | //setPixmap( 0, Resource::loadPixmap( "mail/kmmsgunseen") ); |
18 | } else { | 19 | } else { |
19 | setPixmap( 0, Resource::loadPixmap( "mail/kmmsgnew") ); | 20 | setPixmap( 0, Resource::loadPixmap( "mail/kmmsgnew") ); |
20 | } | 21 | } |
21 | double s = mail_data.Msgsize(); | 22 | double s = mail_data.Msgsize(); |
22 | int w; | 23 | int w; |
23 | w=0; | 24 | w=0; |
24 | 25 | ||
25 | while (s>1024) { | 26 | while (s>1024) { |
26 | s/=1024; | 27 | s/=1024; |
27 | ++w; | 28 | ++w; |
28 | if (w>=2) break; | 29 | if (w>=2) break; |
29 | } | 30 | } |
30 | 31 | ||
31 | QString q=""; | 32 | QString q=""; |
32 | QString fsize=""; | 33 | QString fsize=""; |
33 | switch(w) { | 34 | switch(w) { |
34 | case 1: | 35 | case 1: |
35 | q="k"; | 36 | q="k"; |
36 | break; | 37 | break; |
37 | case 2: | 38 | case 2: |
38 | q="M"; | 39 | q="M"; |
39 | break; | 40 | break; |
40 | default: | 41 | default: |
41 | break; | 42 | break; |
42 | } | 43 | } |
43 | 44 | ||
44 | { | 45 | { |
45 | QTextOStream o(&fsize); | 46 | QTextOStream o(&fsize); |
46 | if (w>0) o.precision(2); else o.precision(0); | 47 | if (w>0) o.precision(2); else o.precision(0); |
47 | o.setf(QTextStream::fixed); | 48 | o.setf(QTextStream::fixed); |
48 | o << s << " " << q << "Byte"; | 49 | o << s << " " << q << "Byte"; |
49 | } | 50 | } |
50 | 51 | ||
51 | setText(1,mail_data.getSubject()); | 52 | setText(1,mail_data.getSubject()); |
52 | setText(2,mail_data.getFrom()); | 53 | setText(2,mail_data.getFrom()); |
53 | setText(3,fsize); | 54 | setText(3,fsize); |
54 | setText(4,mail_data.getDate()); | 55 | setText(4,mail_data.getDate()); |
55 | } | 56 | } |
56 | 57 | ||
57 | void MailListViewItem::storeData(const RecMail&data) | 58 | void MailListViewItem::storeData(const RecMail&data) |
58 | { | 59 | { |
59 | mail_data = data; | 60 | mail_data = data; |
60 | } | 61 | } |
61 | 62 | ||
62 | const RecMail& MailListViewItem::data()const | 63 | const RecMail& MailListViewItem::data()const |
63 | { | 64 | { |
64 | return mail_data; | 65 | return mail_data; |
65 | } | 66 | } |
67 | |||
68 | MAILLIB::ATYPE MailListViewItem::wrapperType() | ||
69 | { | ||
70 | if (!mail_data.Wrapper()) return MAILLIB::A_UNDEFINED; | ||
71 | return mail_data.Wrapper()->getType(); | ||
72 | } | ||
diff --git a/noncore/net/mail/mailistviewitem.h b/noncore/net/mail/mailistviewitem.h index 3b352a2..f736de0 100644 --- a/noncore/net/mail/mailistviewitem.h +++ b/noncore/net/mail/mailistviewitem.h | |||
@@ -1,21 +1,23 @@ | |||
1 | #ifndef __MAILLISTVIEWITEM_H | 1 | #ifndef __MAILLISTVIEWITEM_H |
2 | #define __MAILLISTVIEWITEM_H | 2 | #define __MAILLISTVIEWITEM_H |
3 | 3 | ||
4 | #include <qlistview.h> | 4 | #include <qlistview.h> |
5 | #include <libmailwrapper/mailtypes.h> | 5 | #include <libmailwrapper/mailtypes.h> |
6 | #include <libmailwrapper/maildefines.h> | ||
6 | 7 | ||
7 | class MailListViewItem:public QListViewItem | 8 | class MailListViewItem:public QListViewItem |
8 | { | 9 | { |
9 | public: | 10 | public: |
10 | MailListViewItem(QListView * parent, MailListViewItem * after ); | 11 | MailListViewItem(QListView * parent, MailListViewItem * after ); |
11 | virtual ~MailListViewItem(){} | 12 | virtual ~MailListViewItem(){} |
12 | 13 | ||
13 | void storeData(const RecMail&data); | 14 | void storeData(const RecMail&data); |
14 | const RecMail&data()const; | 15 | const RecMail&data()const; |
15 | void showEntry(); | 16 | void showEntry(); |
16 | 17 | MAILLIB::ATYPE wrapperType(); | |
18 | |||
17 | protected: | 19 | protected: |
18 | RecMail mail_data; | 20 | RecMail mail_data; |
19 | }; | 21 | }; |
20 | 22 | ||
21 | #endif | 23 | #endif |
diff --git a/noncore/net/mail/nntpgroupsdlg.cpp b/noncore/net/mail/nntpgroupsdlg.cpp index 752ce3c..c94d9fa 100644 --- a/noncore/net/mail/nntpgroupsdlg.cpp +++ b/noncore/net/mail/nntpgroupsdlg.cpp | |||
@@ -1,29 +1,29 @@ | |||
1 | #include "nntpgroupsdlg.h" | 1 | #include "nntpgroupsdlg.h" |
2 | #include "nntpgroups.h" | 2 | #include "nntpgroups.h" |
3 | 3 | ||
4 | #include <libmailwrapper/settings.h> | 4 | #include <libmailwrapper/settings.h> |
5 | 5 | ||
6 | #include <qlayout.h> | 6 | #include <qlayout.h> |
7 | 7 | ||
8 | NNTPGroupsDlg::NNTPGroupsDlg(NNTPaccount *account,QWidget * parent, const char * name) | 8 | NNTPGroupsDlg::NNTPGroupsDlg(NNTPaccount *account,QWidget * parent, const char * name) |
9 | : QDialog(parent,name,true) | 9 | : QDialog(parent,name,true,WStyle_ContextHelp) |
10 | { | 10 | { |
11 | setCaption(tr("Subscribed newsgroups")); | 11 | setCaption(tr("Subscribed newsgroups")); |
12 | m_Account = account; | 12 | m_Account = account; |
13 | QVBoxLayout*dlglayout = new QVBoxLayout(this); | 13 | QVBoxLayout*dlglayout = new QVBoxLayout(this); |
14 | dlglayout->setSpacing(2); | 14 | dlglayout->setSpacing(2); |
15 | dlglayout->setMargin(1); | 15 | dlglayout->setMargin(1); |
16 | groupsWidget = new NNTPGroups(account,this); | 16 | groupsWidget = new NNTPGroups(account,this); |
17 | dlglayout->addWidget(groupsWidget); | 17 | dlglayout->addWidget(groupsWidget); |
18 | } | 18 | } |
19 | 19 | ||
20 | NNTPGroupsDlg::~NNTPGroupsDlg() | 20 | NNTPGroupsDlg::~NNTPGroupsDlg() |
21 | { | 21 | { |
22 | } | 22 | } |
23 | 23 | ||
24 | void NNTPGroupsDlg::accept() | 24 | void NNTPGroupsDlg::accept() |
25 | { | 25 | { |
26 | groupsWidget->storeValues(); | 26 | groupsWidget->storeValues(); |
27 | m_Account->save(); | 27 | m_Account->save(); |
28 | QDialog::accept(); | 28 | QDialog::accept(); |
29 | } | 29 | } |
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp index 61e7dc4..d95b3c9 100644 --- a/noncore/net/mail/opiemail.cpp +++ b/noncore/net/mail/opiemail.cpp | |||
@@ -132,130 +132,147 @@ void OpieMail::slotEditSettings() | |||
132 | void OpieMail::slotEditAccounts() | 132 | void OpieMail::slotEditAccounts() |
133 | { | 133 | { |
134 | qDebug( "Edit Accounts" ); | 134 | qDebug( "Edit Accounts" ); |
135 | EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); | 135 | EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); |
136 | eaDialog.slotAdjustColumns(); | 136 | eaDialog.slotAdjustColumns(); |
137 | QPEApplication::execDialog( &eaDialog ); | 137 | QPEApplication::execDialog( &eaDialog ); |
138 | if ( settings ) delete settings; | 138 | if ( settings ) delete settings; |
139 | settings = new Settings(); | 139 | settings = new Settings(); |
140 | 140 | ||
141 | folderView->populate( settings->getAccounts() ); | 141 | folderView->populate( settings->getAccounts() ); |
142 | } | 142 | } |
143 | 143 | ||
144 | void OpieMail::displayMail() | 144 | void OpieMail::displayMail() |
145 | { | 145 | { |
146 | QListViewItem*item = mailView->currentItem(); | 146 | QListViewItem*item = mailView->currentItem(); |
147 | if (!item) return; | 147 | if (!item) return; |
148 | RecMail mail = ((MailListViewItem*)item)->data(); | 148 | RecMail mail = ((MailListViewItem*)item)->data(); |
149 | RecBody body = folderView->fetchBody(mail); | 149 | RecBody body = folderView->fetchBody(mail); |
150 | ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp ); | 150 | ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp ); |
151 | readMail.setBody( body ); | 151 | readMail.setBody( body ); |
152 | readMail.setMail( mail ); | 152 | readMail.setMail( mail ); |
153 | readMail.showMaximized(); | 153 | readMail.showMaximized(); |
154 | readMail.exec(); | 154 | readMail.exec(); |
155 | 155 | ||
156 | if ( readMail.deleted ) | 156 | if ( readMail.deleted ) |
157 | { | 157 | { |
158 | folderView->refreshCurrent(); | 158 | folderView->refreshCurrent(); |
159 | } | 159 | } |
160 | else | 160 | else |
161 | { | 161 | { |
162 | ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "" ) ); | 162 | ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "" ) ); |
163 | } | 163 | } |
164 | } | 164 | } |
165 | 165 | ||
166 | void OpieMail::slotDeleteMail() | 166 | void OpieMail::slotDeleteMail() |
167 | { | 167 | { |
168 | if (!mailView->currentItem()) return; | 168 | if (!mailView->currentItem()) return; |
169 | RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 169 | RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
170 | if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail.getFrom() + " - " + mail.getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 170 | if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail.getFrom() + " - " + mail.getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
171 | { | 171 | { |
172 | mail.Wrapper()->deleteMail( mail ); | 172 | mail.Wrapper()->deleteMail( mail ); |
173 | folderView->refreshCurrent(); | 173 | folderView->refreshCurrent(); |
174 | } | 174 | } |
175 | } | 175 | } |
176 | 176 | ||
177 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) | 177 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) |
178 | { | 178 | { |
179 | if (!mailView->currentItem()) return; | 179 | if (!mailView->currentItem()) return; |
180 | RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 180 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); |
181 | /* just the RIGHT button - or hold on pda */ | 181 | /* just the RIGHT button - or hold on pda */ |
182 | if (button!=2) {return;} | 182 | if (button!=2) {return;} |
183 | qDebug("Event right/hold"); | 183 | qDebug("Event right/hold"); |
184 | if (!item) return; | 184 | if (!item) return; |
185 | QPopupMenu *m = new QPopupMenu(0); | 185 | QPopupMenu *m = new QPopupMenu(0); |
186 | if (m) | 186 | if (m) |
187 | { | 187 | { |
188 | if (mail.Wrapper()->getType()==MAILLIB::A_NNTP) { | 188 | if (mailtype==MAILLIB::A_NNTP) { |
189 | m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); | 189 | m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); |
190 | // m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); | 190 | // m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); |
191 | } else { | 191 | } else { |
192 | if (folderView->currentisDraft()) { | ||
193 | m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); | ||
194 | } | ||
192 | m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); | 195 | m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); |
193 | m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); | 196 | m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); |
194 | m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail())); | 197 | m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail())); |
195 | } | 198 | } |
196 | m->setFocus(); | 199 | m->setFocus(); |
197 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 200 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
198 | delete m; | 201 | delete m; |
199 | } | 202 | } |
200 | } | 203 | } |
201 | 204 | ||
202 | void OpieMail::slotShowFolders( bool show ) | 205 | void OpieMail::slotShowFolders( bool show ) |
203 | { | 206 | { |
204 | qDebug( "Show Folders" ); | 207 | qDebug( "Show Folders" ); |
205 | if ( show && folderView->isHidden() ) | 208 | if ( show && folderView->isHidden() ) |
206 | { | 209 | { |
207 | qDebug( "-> showing" ); | 210 | qDebug( "-> showing" ); |
208 | folderView->show(); | 211 | folderView->show(); |
209 | } | 212 | } |
210 | else if ( !show && !folderView->isHidden() ) | 213 | else if ( !show && !folderView->isHidden() ) |
211 | { | 214 | { |
212 | qDebug( "-> hiding" ); | 215 | qDebug( "-> hiding" ); |
213 | folderView->hide(); | 216 | folderView->hide(); |
214 | } | 217 | } |
215 | } | 218 | } |
216 | 219 | ||
217 | void OpieMail::refreshMailView(QList<RecMail>*list) | 220 | void OpieMail::refreshMailView(QList<RecMail>*list) |
218 | { | 221 | { |
219 | MailListViewItem*item = 0; | 222 | MailListViewItem*item = 0; |
220 | mailView->clear(); | 223 | mailView->clear(); |
221 | for (unsigned int i = 0; i < list->count();++i) | 224 | for (unsigned int i = 0; i < list->count();++i) |
222 | { | 225 | { |
223 | item = new MailListViewItem(mailView,item); | 226 | item = new MailListViewItem(mailView,item); |
224 | item->storeData(*(list->at(i))); | 227 | item->storeData(*(list->at(i))); |
225 | item->showEntry(); | 228 | item->showEntry(); |
226 | } | 229 | } |
227 | } | 230 | } |
228 | 231 | ||
229 | void OpieMail::mailLeftClicked(int button, QListViewItem *item,const QPoint&,int ) | 232 | void OpieMail::mailLeftClicked(int button, QListViewItem *item,const QPoint&,int ) |
230 | { | 233 | { |
231 | /* just LEFT button - or tap with stylus on pda */ | 234 | /* just LEFT button - or tap with stylus on pda */ |
232 | if (button!=1) return; | 235 | if (button!=1) return; |
233 | if (!item) return; | 236 | if (!item) return; |
234 | displayMail(); | 237 | if (folderView->currentisDraft()) { |
238 | reEditMail(); | ||
239 | } else { | ||
240 | displayMail(); | ||
241 | } | ||
235 | } | 242 | } |
236 | 243 | ||
237 | void OpieMail::slotMoveCopyMail() | 244 | void OpieMail::slotMoveCopyMail() |
238 | { | 245 | { |
239 | if (!mailView->currentItem()) return; | 246 | if (!mailView->currentItem()) return; |
240 | RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 247 | RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
241 | AbstractMail*targetMail = 0; | 248 | AbstractMail*targetMail = 0; |
242 | QString targetFolder = ""; | 249 | QString targetFolder = ""; |
243 | Selectstore sels; | 250 | Selectstore sels; |
244 | folderView->setupFolderselect(&sels); | 251 | folderView->setupFolderselect(&sels); |
245 | if (!sels.exec()) return; | 252 | if (!sels.exec()) return; |
246 | targetMail = sels.currentMail(); | 253 | targetMail = sels.currentMail(); |
247 | targetFolder = sels.currentFolder(); | 254 | targetFolder = sels.currentFolder(); |
248 | if ( (mail.Wrapper()==targetMail && mail.getMbox()==targetFolder) || | 255 | if ( (mail.Wrapper()==targetMail && mail.getMbox()==targetFolder) || |
249 | targetFolder.isEmpty()) | 256 | targetFolder.isEmpty()) |
250 | { | 257 | { |
251 | return; | 258 | return; |
252 | } | 259 | } |
253 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | 260 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
254 | { | 261 | { |
255 | QMessageBox::critical(0,tr("Error creating new Folder"), | 262 | QMessageBox::critical(0,tr("Error creating new Folder"), |
256 | tr("<center>Error while creating<br>new folder - breaking.</center>")); | 263 | tr("<center>Error while creating<br>new folder - breaking.</center>")); |
257 | return; | 264 | return; |
258 | } | 265 | } |
259 | mail.Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); | 266 | mail.Wrapper()->mvcpMail(mail,targetFolder,targetMail,sels.moveMails()); |
260 | folderView->refreshCurrent(); | 267 | folderView->refreshCurrent(); |
261 | } | 268 | } |
269 | |||
270 | void OpieMail::reEditMail() | ||
271 | { | ||
272 | if (!mailView->currentItem()) return; | ||
273 | |||
274 | ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); | ||
275 | compose.reEditMail(((MailListViewItem*)mailView->currentItem() )->data()); | ||
276 | compose.slotAdjustColumns(); | ||
277 | QPEApplication::execDialog( &compose ); | ||
278 | } | ||
diff --git a/noncore/net/mail/opiemail.h b/noncore/net/mail/opiemail.h index 5821856..88c7ea1 100644 --- a/noncore/net/mail/opiemail.h +++ b/noncore/net/mail/opiemail.h | |||
@@ -1,39 +1,40 @@ | |||
1 | #ifndef OPIEMAIL_H | 1 | #ifndef OPIEMAIL_H |
2 | #define OPIEMAIL_H | 2 | #define OPIEMAIL_H |
3 | 3 | ||
4 | #include "mainwindow.h" | 4 | #include "mainwindow.h" |
5 | #include <libmailwrapper/settings.h> | 5 | #include <libmailwrapper/settings.h> |
6 | 6 | ||
7 | 7 | ||
8 | class OpieMail : public MainWindow | 8 | class OpieMail : public MainWindow |
9 | { | 9 | { |
10 | Q_OBJECT | 10 | Q_OBJECT |
11 | 11 | ||
12 | public: | 12 | public: |
13 | OpieMail( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); | 13 | OpieMail( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); |
14 | virtual ~OpieMail(); | 14 | virtual ~OpieMail(); |
15 | static QString appName() { return QString::fromLatin1("opiemail"); } | 15 | static QString appName() { return QString::fromLatin1("opiemail"); } |
16 | 16 | ||
17 | public slots: | 17 | public slots: |
18 | virtual void slotwriteMail(const QString&name,const QString&email); | 18 | virtual void slotwriteMail(const QString&name,const QString&email); |
19 | virtual void slotComposeMail(); | 19 | virtual void slotComposeMail(); |
20 | virtual void appMessage(const QCString &msg, const QByteArray &data); | 20 | virtual void appMessage(const QCString &msg, const QByteArray &data); |
21 | protected slots: | 21 | protected slots: |
22 | virtual void slotSendQueued(); | 22 | virtual void slotSendQueued(); |
23 | virtual void slotSearchMails(); | 23 | virtual void slotSearchMails(); |
24 | virtual void slotEditSettings(); | 24 | virtual void slotEditSettings(); |
25 | virtual void slotEditAccounts(); | 25 | virtual void slotEditAccounts(); |
26 | virtual void displayMail(); | 26 | virtual void displayMail(); |
27 | virtual void slotDeleteMail(); | 27 | virtual void slotDeleteMail(); |
28 | virtual void mailHold(int, QListViewItem *,const QPoint&,int); | 28 | virtual void mailHold(int, QListViewItem *,const QPoint&,int); |
29 | virtual void slotShowFolders( bool show ); | 29 | virtual void slotShowFolders( bool show ); |
30 | virtual void refreshMailView(QList<RecMail>*); | 30 | virtual void refreshMailView(QList<RecMail>*); |
31 | virtual void mailLeftClicked( int, QListViewItem *,const QPoint&,int ); | 31 | virtual void mailLeftClicked( int, QListViewItem *,const QPoint&,int ); |
32 | virtual void slotMoveCopyMail(); | 32 | virtual void slotMoveCopyMail(); |
33 | virtual void reEditMail(); | ||
33 | 34 | ||
34 | private: | 35 | private: |
35 | Settings *settings; | 36 | Settings *settings; |
36 | 37 | ||
37 | }; | 38 | }; |
38 | 39 | ||
39 | #endif | 40 | #endif |