author | alwin <alwin> | 2003-12-13 03:51:21 (UTC) |
---|---|---|
committer | alwin <alwin> | 2003-12-13 03:51:21 (UTC) |
commit | 7f0861e63db74263ff286e09fbc4faf16d367a5b (patch) (unidiff) | |
tree | d97bd868343b179039c141fee3725f7781a0fca1 | |
parent | a170120c655169de904ff282e23461ba4eef2b47 (diff) | |
download | opie-7f0861e63db74263ff286e09fbc4faf16d367a5b.zip opie-7f0861e63db74263ff286e09fbc4faf16d367a5b.tar.gz opie-7f0861e63db74263ff286e09fbc4faf16d367a5b.tar.bz2 |
displaying list of attachments of a mail works. (Of course only if
the mail HAS attachments ;)
-rw-r--r-- | noncore/net/mail/imapwrapper.cpp | 1 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 1 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailtypes.cpp | 12 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailtypes.h | 5 | ||||
-rw-r--r-- | noncore/net/mail/mailtypes.cpp | 12 | ||||
-rw-r--r-- | noncore/net/mail/mailtypes.h | 5 | ||||
-rw-r--r-- | noncore/net/mail/viewmail.cpp | 94 | ||||
-rw-r--r-- | noncore/net/mail/viewmail.h | 26 | ||||
-rw-r--r-- | noncore/net/mail/viewmailbase.cpp | 7 |
9 files changed, 120 insertions, 43 deletions
diff --git a/noncore/net/mail/imapwrapper.cpp b/noncore/net/mail/imapwrapper.cpp index 3941cec..11bf3b8 100644 --- a/noncore/net/mail/imapwrapper.cpp +++ b/noncore/net/mail/imapwrapper.cpp | |||
@@ -641,54 +641,55 @@ void IMAPwrapper::fillSingleBasicPart(RecPart&target_part,mailimap_body_type_bas | |||
641 | } | 641 | } |
642 | qDebug("Type = %s/%s",type.latin1(),sub.latin1()); | 642 | qDebug("Type = %s/%s",type.latin1(),sub.latin1()); |
643 | target_part.setType(type.lower()); | 643 | target_part.setType(type.lower()); |
644 | target_part.setSubtype(sub.lower()); | 644 | target_part.setSubtype(sub.lower()); |
645 | fillBodyFields(target_part,which->bd_fields); | 645 | fillBodyFields(target_part,which->bd_fields); |
646 | } | 646 | } |
647 | 647 | ||
648 | void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which) | 648 | void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which) |
649 | { | 649 | { |
650 | if (!which) return; | 650 | if (!which) return; |
651 | if (which->bd_parameter && which->bd_parameter->pa_list && which->bd_parameter->pa_list->count>0) { | 651 | if (which->bd_parameter && which->bd_parameter->pa_list && which->bd_parameter->pa_list->count>0) { |
652 | clistcell*cur; | 652 | clistcell*cur; |
653 | mailimap_single_body_fld_param*param=0; | 653 | mailimap_single_body_fld_param*param=0; |
654 | for (cur = clist_begin(which->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { | 654 | for (cur = clist_begin(which->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { |
655 | param = (mailimap_single_body_fld_param*)cur->data; | 655 | param = (mailimap_single_body_fld_param*)cur->data; |
656 | if (param) { | 656 | if (param) { |
657 | target_part.addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); | 657 | target_part.addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); |
658 | } | 658 | } |
659 | } | 659 | } |
660 | } | 660 | } |
661 | mailimap_body_fld_enc*enc = which->bd_encoding; | 661 | mailimap_body_fld_enc*enc = which->bd_encoding; |
662 | QString encoding(""); | 662 | QString encoding(""); |
663 | switch (enc->enc_type) { | 663 | switch (enc->enc_type) { |
664 | case MAILIMAP_BODY_FLD_ENC_7BIT: | 664 | case MAILIMAP_BODY_FLD_ENC_7BIT: |
665 | encoding = "7bit"; | 665 | encoding = "7bit"; |
666 | break; | 666 | break; |
667 | case MAILIMAP_BODY_FLD_ENC_8BIT: | 667 | case MAILIMAP_BODY_FLD_ENC_8BIT: |
668 | encoding = "8bit"; | 668 | encoding = "8bit"; |
669 | break; | 669 | break; |
670 | case MAILIMAP_BODY_FLD_ENC_BINARY: | 670 | case MAILIMAP_BODY_FLD_ENC_BINARY: |
671 | encoding="binary"; | 671 | encoding="binary"; |
672 | break; | 672 | break; |
673 | case MAILIMAP_BODY_FLD_ENC_BASE64: | 673 | case MAILIMAP_BODY_FLD_ENC_BASE64: |
674 | encoding="base64"; | 674 | encoding="base64"; |
675 | break; | 675 | break; |
676 | case MAILIMAP_BODY_FLD_ENC_QUOTED_PRINTABLE: | 676 | case MAILIMAP_BODY_FLD_ENC_QUOTED_PRINTABLE: |
677 | encoding="quoted-printable"; | 677 | encoding="quoted-printable"; |
678 | break; | 678 | break; |
679 | case MAILIMAP_BODY_FLD_ENC_OTHER: | 679 | case MAILIMAP_BODY_FLD_ENC_OTHER: |
680 | default: | 680 | default: |
681 | if (enc->enc_value) { | 681 | if (enc->enc_value) { |
682 | char*t=enc->enc_value; | 682 | char*t=enc->enc_value; |
683 | encoding=QString(enc->enc_value); | 683 | encoding=QString(enc->enc_value); |
684 | enc->enc_value=0L; | 684 | enc->enc_value=0L; |
685 | free(t); | 685 | free(t); |
686 | } | 686 | } |
687 | } | 687 | } |
688 | target_part.setEncoding(encoding); | 688 | target_part.setEncoding(encoding); |
689 | target_part.setSize(which->bd_size); | ||
689 | } | 690 | } |
690 | 691 | ||
691 | QString IMAPwrapper::fetchPart(const RecMail&mail,const RecPart&part) | 692 | QString IMAPwrapper::fetchPart(const RecMail&mail,const RecPart&part) |
692 | { | 693 | { |
693 | return fetchPart(mail,part.Positionlist(),false); | 694 | return fetchPart(mail,part.Positionlist(),false); |
694 | } | 695 | } |
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index 3941cec..11bf3b8 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp | |||
@@ -641,54 +641,55 @@ void IMAPwrapper::fillSingleBasicPart(RecPart&target_part,mailimap_body_type_bas | |||
641 | } | 641 | } |
642 | qDebug("Type = %s/%s",type.latin1(),sub.latin1()); | 642 | qDebug("Type = %s/%s",type.latin1(),sub.latin1()); |
643 | target_part.setType(type.lower()); | 643 | target_part.setType(type.lower()); |
644 | target_part.setSubtype(sub.lower()); | 644 | target_part.setSubtype(sub.lower()); |
645 | fillBodyFields(target_part,which->bd_fields); | 645 | fillBodyFields(target_part,which->bd_fields); |
646 | } | 646 | } |
647 | 647 | ||
648 | void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which) | 648 | void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which) |
649 | { | 649 | { |
650 | if (!which) return; | 650 | if (!which) return; |
651 | if (which->bd_parameter && which->bd_parameter->pa_list && which->bd_parameter->pa_list->count>0) { | 651 | if (which->bd_parameter && which->bd_parameter->pa_list && which->bd_parameter->pa_list->count>0) { |
652 | clistcell*cur; | 652 | clistcell*cur; |
653 | mailimap_single_body_fld_param*param=0; | 653 | mailimap_single_body_fld_param*param=0; |
654 | for (cur = clist_begin(which->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { | 654 | for (cur = clist_begin(which->bd_parameter->pa_list);cur!=NULL;cur=clist_next(cur)) { |
655 | param = (mailimap_single_body_fld_param*)cur->data; | 655 | param = (mailimap_single_body_fld_param*)cur->data; |
656 | if (param) { | 656 | if (param) { |
657 | target_part.addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); | 657 | target_part.addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); |
658 | } | 658 | } |
659 | } | 659 | } |
660 | } | 660 | } |
661 | mailimap_body_fld_enc*enc = which->bd_encoding; | 661 | mailimap_body_fld_enc*enc = which->bd_encoding; |
662 | QString encoding(""); | 662 | QString encoding(""); |
663 | switch (enc->enc_type) { | 663 | switch (enc->enc_type) { |
664 | case MAILIMAP_BODY_FLD_ENC_7BIT: | 664 | case MAILIMAP_BODY_FLD_ENC_7BIT: |
665 | encoding = "7bit"; | 665 | encoding = "7bit"; |
666 | break; | 666 | break; |
667 | case MAILIMAP_BODY_FLD_ENC_8BIT: | 667 | case MAILIMAP_BODY_FLD_ENC_8BIT: |
668 | encoding = "8bit"; | 668 | encoding = "8bit"; |
669 | break; | 669 | break; |
670 | case MAILIMAP_BODY_FLD_ENC_BINARY: | 670 | case MAILIMAP_BODY_FLD_ENC_BINARY: |
671 | encoding="binary"; | 671 | encoding="binary"; |
672 | break; | 672 | break; |
673 | case MAILIMAP_BODY_FLD_ENC_BASE64: | 673 | case MAILIMAP_BODY_FLD_ENC_BASE64: |
674 | encoding="base64"; | 674 | encoding="base64"; |
675 | break; | 675 | break; |
676 | case MAILIMAP_BODY_FLD_ENC_QUOTED_PRINTABLE: | 676 | case MAILIMAP_BODY_FLD_ENC_QUOTED_PRINTABLE: |
677 | encoding="quoted-printable"; | 677 | encoding="quoted-printable"; |
678 | break; | 678 | break; |
679 | case MAILIMAP_BODY_FLD_ENC_OTHER: | 679 | case MAILIMAP_BODY_FLD_ENC_OTHER: |
680 | default: | 680 | default: |
681 | if (enc->enc_value) { | 681 | if (enc->enc_value) { |
682 | char*t=enc->enc_value; | 682 | char*t=enc->enc_value; |
683 | encoding=QString(enc->enc_value); | 683 | encoding=QString(enc->enc_value); |
684 | enc->enc_value=0L; | 684 | enc->enc_value=0L; |
685 | free(t); | 685 | free(t); |
686 | } | 686 | } |
687 | } | 687 | } |
688 | target_part.setEncoding(encoding); | 688 | target_part.setEncoding(encoding); |
689 | target_part.setSize(which->bd_size); | ||
689 | } | 690 | } |
690 | 691 | ||
691 | QString IMAPwrapper::fetchPart(const RecMail&mail,const RecPart&part) | 692 | QString IMAPwrapper::fetchPart(const RecMail&mail,const RecPart&part) |
692 | { | 693 | { |
693 | return fetchPart(mail,part.Positionlist(),false); | 694 | return fetchPart(mail,part.Positionlist(),false); |
694 | } | 695 | } |
diff --git a/noncore/net/mail/libmailwrapper/mailtypes.cpp b/noncore/net/mail/libmailwrapper/mailtypes.cpp index 9c312e9..5cd45ed 100644 --- a/noncore/net/mail/libmailwrapper/mailtypes.cpp +++ b/noncore/net/mail/libmailwrapper/mailtypes.cpp | |||
@@ -23,106 +23,116 @@ void RecMail::copy_old(const RecMail&old) | |||
23 | msg_id = old.msg_id; | 23 | msg_id = old.msg_id; |
24 | msg_size = old.msg_size; | 24 | msg_size = old.msg_size; |
25 | msg_number = old.msg_number; | 25 | msg_number = old.msg_number; |
26 | from = old.from; | 26 | from = old.from; |
27 | msg_flags = old.msg_flags; | 27 | msg_flags = old.msg_flags; |
28 | to = old.to; | 28 | to = old.to; |
29 | cc = old.cc; | 29 | cc = old.cc; |
30 | bcc = old.bcc; | 30 | bcc = old.bcc; |
31 | } | 31 | } |
32 | 32 | ||
33 | void RecMail::init() | 33 | void RecMail::init() |
34 | { | 34 | { |
35 | to.clear(); | 35 | to.clear(); |
36 | cc.clear(); | 36 | cc.clear(); |
37 | bcc.clear(); | 37 | bcc.clear(); |
38 | } | 38 | } |
39 | 39 | ||
40 | void RecMail::setTo(const QStringList&list) | 40 | void RecMail::setTo(const QStringList&list) |
41 | { | 41 | { |
42 | to = list; | 42 | to = list; |
43 | } | 43 | } |
44 | 44 | ||
45 | const QStringList&RecMail::To()const | 45 | const QStringList&RecMail::To()const |
46 | { | 46 | { |
47 | return to; | 47 | return to; |
48 | } | 48 | } |
49 | 49 | ||
50 | void RecMail::setCC(const QStringList&list) | 50 | void RecMail::setCC(const QStringList&list) |
51 | { | 51 | { |
52 | cc = list; | 52 | cc = list; |
53 | } | 53 | } |
54 | 54 | ||
55 | const QStringList&RecMail::CC()const | 55 | const QStringList&RecMail::CC()const |
56 | { | 56 | { |
57 | return cc; | 57 | return cc; |
58 | } | 58 | } |
59 | 59 | ||
60 | void RecMail::setBcc(const QStringList&list) | 60 | void RecMail::setBcc(const QStringList&list) |
61 | { | 61 | { |
62 | bcc = list; | 62 | bcc = list; |
63 | } | 63 | } |
64 | 64 | ||
65 | const QStringList& RecMail::Bcc()const | 65 | const QStringList& RecMail::Bcc()const |
66 | { | 66 | { |
67 | return bcc; | 67 | return bcc; |
68 | } | 68 | } |
69 | 69 | ||
70 | RecPart::RecPart() | 70 | RecPart::RecPart() |
71 | : m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_lines(0) | 71 | : m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_lines(0),m_size(0) |
72 | { | 72 | { |
73 | m_Parameters.clear(); | 73 | m_Parameters.clear(); |
74 | m_poslist.clear(); | 74 | m_poslist.clear(); |
75 | } | 75 | } |
76 | 76 | ||
77 | RecPart::~RecPart() | 77 | RecPart::~RecPart() |
78 | { | 78 | { |
79 | } | 79 | } |
80 | 80 | ||
81 | void RecPart::setSize(unsigned int size) | ||
82 | { | ||
83 | m_size = size; | ||
84 | } | ||
85 | |||
86 | const unsigned int RecPart::Size()const | ||
87 | { | ||
88 | return m_size; | ||
89 | } | ||
90 | |||
81 | void RecPart::setLines(unsigned int lines) | 91 | void RecPart::setLines(unsigned int lines) |
82 | { | 92 | { |
83 | m_lines = lines; | 93 | m_lines = lines; |
84 | } | 94 | } |
85 | 95 | ||
86 | const unsigned int RecPart::Lines()const | 96 | const unsigned int RecPart::Lines()const |
87 | { | 97 | { |
88 | return m_lines; | 98 | return m_lines; |
89 | } | 99 | } |
90 | 100 | ||
91 | const QString& RecPart::Type()const | 101 | const QString& RecPart::Type()const |
92 | { | 102 | { |
93 | return m_type; | 103 | return m_type; |
94 | } | 104 | } |
95 | 105 | ||
96 | void RecPart::setType(const QString&type) | 106 | void RecPart::setType(const QString&type) |
97 | { | 107 | { |
98 | m_type = type; | 108 | m_type = type; |
99 | } | 109 | } |
100 | 110 | ||
101 | const QString& RecPart::Subtype()const | 111 | const QString& RecPart::Subtype()const |
102 | { | 112 | { |
103 | return m_subtype; | 113 | return m_subtype; |
104 | } | 114 | } |
105 | 115 | ||
106 | void RecPart::setSubtype(const QString&subtype) | 116 | void RecPart::setSubtype(const QString&subtype) |
107 | { | 117 | { |
108 | m_subtype = subtype; | 118 | m_subtype = subtype; |
109 | } | 119 | } |
110 | 120 | ||
111 | const QString& RecPart::Identifier()const | 121 | const QString& RecPart::Identifier()const |
112 | { | 122 | { |
113 | return m_identifier; | 123 | return m_identifier; |
114 | } | 124 | } |
115 | 125 | ||
116 | void RecPart::setIdentifier(const QString&identifier) | 126 | void RecPart::setIdentifier(const QString&identifier) |
117 | { | 127 | { |
118 | m_identifier = identifier; | 128 | m_identifier = identifier; |
119 | } | 129 | } |
120 | 130 | ||
121 | const QString& RecPart::Encoding()const | 131 | const QString& RecPart::Encoding()const |
122 | { | 132 | { |
123 | return m_encoding; | 133 | return m_encoding; |
124 | } | 134 | } |
125 | 135 | ||
126 | void RecPart::setEncoding(const QString&encoding) | 136 | void RecPart::setEncoding(const QString&encoding) |
127 | { | 137 | { |
128 | m_encoding = encoding; | 138 | m_encoding = encoding; |
diff --git a/noncore/net/mail/libmailwrapper/mailtypes.h b/noncore/net/mail/libmailwrapper/mailtypes.h index f308bc7..24518cf 100644 --- a/noncore/net/mail/libmailwrapper/mailtypes.h +++ b/noncore/net/mail/libmailwrapper/mailtypes.h | |||
@@ -31,98 +31,101 @@ class RecMail | |||
31 | { | 31 | { |
32 | public: | 32 | public: |
33 | RecMail(); | 33 | RecMail(); |
34 | RecMail(const RecMail&old); | 34 | RecMail(const RecMail&old); |
35 | virtual ~RecMail(){} | 35 | virtual ~RecMail(){} |
36 | 36 | ||
37 | const int getNumber()const{return msg_number;} | 37 | const int getNumber()const{return msg_number;} |
38 | void setNumber(int number){msg_number=number;} | 38 | void setNumber(int number){msg_number=number;} |
39 | const QString&getDate()const{ return date; } | 39 | const QString&getDate()const{ return date; } |
40 | void setDate( const QString&a ) { date = a; } | 40 | void setDate( const QString&a ) { date = a; } |
41 | const QString&getFrom()const{ return from; } | 41 | const QString&getFrom()const{ return from; } |
42 | void setFrom( const QString&a ) { from = a; } | 42 | void setFrom( const QString&a ) { from = a; } |
43 | const QString&getSubject()const { return subject; } | 43 | const QString&getSubject()const { return subject; } |
44 | void setSubject( const QString&s ) { subject = s; } | 44 | void setSubject( const QString&s ) { subject = s; } |
45 | const QString&getMbox()const{return mbox;} | 45 | const QString&getMbox()const{return mbox;} |
46 | void setMbox(const QString&box){mbox = box;} | 46 | void setMbox(const QString&box){mbox = box;} |
47 | void setMsgid(const QString&id){msg_id=id;} | 47 | void setMsgid(const QString&id){msg_id=id;} |
48 | const QString&Msgid()const{return msg_id;} | 48 | const QString&Msgid()const{return msg_id;} |
49 | void setReplyto(const QString&reply){replyto=reply;} | 49 | void setReplyto(const QString&reply){replyto=reply;} |
50 | const QString&Replyto()const{return replyto;} | 50 | const QString&Replyto()const{return replyto;} |
51 | void setMsgsize(int size){msg_size = size;} | 51 | void setMsgsize(int size){msg_size = size;} |
52 | const int Msgsize()const{return msg_size;} | 52 | const int Msgsize()const{return msg_size;} |
53 | 53 | ||
54 | 54 | ||
55 | void setTo(const QStringList&list); | 55 | void setTo(const QStringList&list); |
56 | const QStringList&To()const; | 56 | const QStringList&To()const; |
57 | void setCC(const QStringList&list); | 57 | void setCC(const QStringList&list); |
58 | const QStringList&CC()const; | 58 | const QStringList&CC()const; |
59 | void setBcc(const QStringList&list); | 59 | void setBcc(const QStringList&list); |
60 | const QStringList&Bcc()const; | 60 | const QStringList&Bcc()const; |
61 | const QBitArray&getFlags()const{return msg_flags;} | 61 | const QBitArray&getFlags()const{return msg_flags;} |
62 | void setFlags(const QBitArray&flags){msg_flags = flags;} | 62 | void setFlags(const QBitArray&flags){msg_flags = flags;} |
63 | 63 | ||
64 | protected: | 64 | protected: |
65 | QString subject,date,from,mbox,msg_id,replyto; | 65 | QString subject,date,from,mbox,msg_id,replyto; |
66 | int msg_number,msg_size; | 66 | int msg_number,msg_size; |
67 | QBitArray msg_flags; | 67 | QBitArray msg_flags; |
68 | QStringList to,cc,bcc; | 68 | QStringList to,cc,bcc; |
69 | void init(); | 69 | void init(); |
70 | void copy_old(const RecMail&old); | 70 | void copy_old(const RecMail&old); |
71 | }; | 71 | }; |
72 | 72 | ||
73 | typedef QMap<QString,QString> part_plist_t; | 73 | typedef QMap<QString,QString> part_plist_t; |
74 | 74 | ||
75 | class RecPart | 75 | class RecPart |
76 | { | 76 | { |
77 | protected: | 77 | protected: |
78 | QString m_type,m_subtype,m_identifier,m_encoding; | 78 | QString m_type,m_subtype,m_identifier,m_encoding; |
79 | unsigned int m_lines; | 79 | unsigned int m_lines,m_size; |
80 | part_plist_t m_Parameters; | 80 | part_plist_t m_Parameters; |
81 | /* describes the position in the mail */ | 81 | /* describes the position in the mail */ |
82 | QValueList<int> m_poslist; | 82 | QValueList<int> m_poslist; |
83 | 83 | ||
84 | public: | 84 | public: |
85 | RecPart(); | 85 | RecPart(); |
86 | virtual ~RecPart(); | 86 | virtual ~RecPart(); |
87 | 87 | ||
88 | const QString&Type()const; | 88 | const QString&Type()const; |
89 | void setType(const QString&type); | 89 | void setType(const QString&type); |
90 | const QString&Subtype()const; | 90 | const QString&Subtype()const; |
91 | void setSubtype(const QString&subtype); | 91 | void setSubtype(const QString&subtype); |
92 | const QString&Identifier()const; | 92 | const QString&Identifier()const; |
93 | void setIdentifier(const QString&identifier); | 93 | void setIdentifier(const QString&identifier); |
94 | const QString&Encoding()const; | 94 | const QString&Encoding()const; |
95 | void setEncoding(const QString&encoding); | 95 | void setEncoding(const QString&encoding); |
96 | void setLines(unsigned int lines); | 96 | void setLines(unsigned int lines); |
97 | const unsigned int Lines()const; | 97 | const unsigned int Lines()const; |
98 | void setSize(unsigned int size); | ||
99 | const unsigned int Size()const; | ||
100 | |||
98 | 101 | ||
99 | void setParameters(const part_plist_t&list); | 102 | void setParameters(const part_plist_t&list); |
100 | const part_plist_t&Parameters()const; | 103 | const part_plist_t&Parameters()const; |
101 | void addParameter(const QString&key,const QString&value); | 104 | void addParameter(const QString&key,const QString&value); |
102 | const QString searchParamter(const QString&key)const; | 105 | const QString searchParamter(const QString&key)const; |
103 | void setPositionlist(const QValueList<int>&poslist); | 106 | void setPositionlist(const QValueList<int>&poslist); |
104 | const QValueList<int>& Positionlist()const; | 107 | const QValueList<int>& Positionlist()const; |
105 | }; | 108 | }; |
106 | 109 | ||
107 | class RecBody | 110 | class RecBody |
108 | { | 111 | { |
109 | protected: | 112 | protected: |
110 | QString m_BodyText; | 113 | QString m_BodyText; |
111 | QValueList<RecPart> m_PartsList; | 114 | QValueList<RecPart> m_PartsList; |
112 | RecPart m_description; | 115 | RecPart m_description; |
113 | 116 | ||
114 | public: | 117 | public: |
115 | RecBody(); | 118 | RecBody(); |
116 | virtual ~RecBody(); | 119 | virtual ~RecBody(); |
117 | void setBodytext(const QString&); | 120 | void setBodytext(const QString&); |
118 | const QString& Bodytext()const; | 121 | const QString& Bodytext()const; |
119 | 122 | ||
120 | void setDescription(const RecPart&des); | 123 | void setDescription(const RecPart&des); |
121 | const RecPart& Description()const; | 124 | const RecPart& Description()const; |
122 | 125 | ||
123 | void setParts(const QValueList<RecPart>&parts); | 126 | void setParts(const QValueList<RecPart>&parts); |
124 | const QValueList<RecPart>& Parts()const; | 127 | const QValueList<RecPart>& Parts()const; |
125 | void addPart(const RecPart&part); | 128 | void addPart(const RecPart&part); |
126 | }; | 129 | }; |
127 | 130 | ||
128 | #endif | 131 | #endif |
diff --git a/noncore/net/mail/mailtypes.cpp b/noncore/net/mail/mailtypes.cpp index 9c312e9..5cd45ed 100644 --- a/noncore/net/mail/mailtypes.cpp +++ b/noncore/net/mail/mailtypes.cpp | |||
@@ -23,106 +23,116 @@ void RecMail::copy_old(const RecMail&old) | |||
23 | msg_id = old.msg_id; | 23 | msg_id = old.msg_id; |
24 | msg_size = old.msg_size; | 24 | msg_size = old.msg_size; |
25 | msg_number = old.msg_number; | 25 | msg_number = old.msg_number; |
26 | from = old.from; | 26 | from = old.from; |
27 | msg_flags = old.msg_flags; | 27 | msg_flags = old.msg_flags; |
28 | to = old.to; | 28 | to = old.to; |
29 | cc = old.cc; | 29 | cc = old.cc; |
30 | bcc = old.bcc; | 30 | bcc = old.bcc; |
31 | } | 31 | } |
32 | 32 | ||
33 | void RecMail::init() | 33 | void RecMail::init() |
34 | { | 34 | { |
35 | to.clear(); | 35 | to.clear(); |
36 | cc.clear(); | 36 | cc.clear(); |
37 | bcc.clear(); | 37 | bcc.clear(); |
38 | } | 38 | } |
39 | 39 | ||
40 | void RecMail::setTo(const QStringList&list) | 40 | void RecMail::setTo(const QStringList&list) |
41 | { | 41 | { |
42 | to = list; | 42 | to = list; |
43 | } | 43 | } |
44 | 44 | ||
45 | const QStringList&RecMail::To()const | 45 | const QStringList&RecMail::To()const |
46 | { | 46 | { |
47 | return to; | 47 | return to; |
48 | } | 48 | } |
49 | 49 | ||
50 | void RecMail::setCC(const QStringList&list) | 50 | void RecMail::setCC(const QStringList&list) |
51 | { | 51 | { |
52 | cc = list; | 52 | cc = list; |
53 | } | 53 | } |
54 | 54 | ||
55 | const QStringList&RecMail::CC()const | 55 | const QStringList&RecMail::CC()const |
56 | { | 56 | { |
57 | return cc; | 57 | return cc; |
58 | } | 58 | } |
59 | 59 | ||
60 | void RecMail::setBcc(const QStringList&list) | 60 | void RecMail::setBcc(const QStringList&list) |
61 | { | 61 | { |
62 | bcc = list; | 62 | bcc = list; |
63 | } | 63 | } |
64 | 64 | ||
65 | const QStringList& RecMail::Bcc()const | 65 | const QStringList& RecMail::Bcc()const |
66 | { | 66 | { |
67 | return bcc; | 67 | return bcc; |
68 | } | 68 | } |
69 | 69 | ||
70 | RecPart::RecPart() | 70 | RecPart::RecPart() |
71 | : m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_lines(0) | 71 | : m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_lines(0),m_size(0) |
72 | { | 72 | { |
73 | m_Parameters.clear(); | 73 | m_Parameters.clear(); |
74 | m_poslist.clear(); | 74 | m_poslist.clear(); |
75 | } | 75 | } |
76 | 76 | ||
77 | RecPart::~RecPart() | 77 | RecPart::~RecPart() |
78 | { | 78 | { |
79 | } | 79 | } |
80 | 80 | ||
81 | void RecPart::setSize(unsigned int size) | ||
82 | { | ||
83 | m_size = size; | ||
84 | } | ||
85 | |||
86 | const unsigned int RecPart::Size()const | ||
87 | { | ||
88 | return m_size; | ||
89 | } | ||
90 | |||
81 | void RecPart::setLines(unsigned int lines) | 91 | void RecPart::setLines(unsigned int lines) |
82 | { | 92 | { |
83 | m_lines = lines; | 93 | m_lines = lines; |
84 | } | 94 | } |
85 | 95 | ||
86 | const unsigned int RecPart::Lines()const | 96 | const unsigned int RecPart::Lines()const |
87 | { | 97 | { |
88 | return m_lines; | 98 | return m_lines; |
89 | } | 99 | } |
90 | 100 | ||
91 | const QString& RecPart::Type()const | 101 | const QString& RecPart::Type()const |
92 | { | 102 | { |
93 | return m_type; | 103 | return m_type; |
94 | } | 104 | } |
95 | 105 | ||
96 | void RecPart::setType(const QString&type) | 106 | void RecPart::setType(const QString&type) |
97 | { | 107 | { |
98 | m_type = type; | 108 | m_type = type; |
99 | } | 109 | } |
100 | 110 | ||
101 | const QString& RecPart::Subtype()const | 111 | const QString& RecPart::Subtype()const |
102 | { | 112 | { |
103 | return m_subtype; | 113 | return m_subtype; |
104 | } | 114 | } |
105 | 115 | ||
106 | void RecPart::setSubtype(const QString&subtype) | 116 | void RecPart::setSubtype(const QString&subtype) |
107 | { | 117 | { |
108 | m_subtype = subtype; | 118 | m_subtype = subtype; |
109 | } | 119 | } |
110 | 120 | ||
111 | const QString& RecPart::Identifier()const | 121 | const QString& RecPart::Identifier()const |
112 | { | 122 | { |
113 | return m_identifier; | 123 | return m_identifier; |
114 | } | 124 | } |
115 | 125 | ||
116 | void RecPart::setIdentifier(const QString&identifier) | 126 | void RecPart::setIdentifier(const QString&identifier) |
117 | { | 127 | { |
118 | m_identifier = identifier; | 128 | m_identifier = identifier; |
119 | } | 129 | } |
120 | 130 | ||
121 | const QString& RecPart::Encoding()const | 131 | const QString& RecPart::Encoding()const |
122 | { | 132 | { |
123 | return m_encoding; | 133 | return m_encoding; |
124 | } | 134 | } |
125 | 135 | ||
126 | void RecPart::setEncoding(const QString&encoding) | 136 | void RecPart::setEncoding(const QString&encoding) |
127 | { | 137 | { |
128 | m_encoding = encoding; | 138 | m_encoding = encoding; |
diff --git a/noncore/net/mail/mailtypes.h b/noncore/net/mail/mailtypes.h index f308bc7..24518cf 100644 --- a/noncore/net/mail/mailtypes.h +++ b/noncore/net/mail/mailtypes.h | |||
@@ -31,98 +31,101 @@ class RecMail | |||
31 | { | 31 | { |
32 | public: | 32 | public: |
33 | RecMail(); | 33 | RecMail(); |
34 | RecMail(const RecMail&old); | 34 | RecMail(const RecMail&old); |
35 | virtual ~RecMail(){} | 35 | virtual ~RecMail(){} |
36 | 36 | ||
37 | const int getNumber()const{return msg_number;} | 37 | const int getNumber()const{return msg_number;} |
38 | void setNumber(int number){msg_number=number;} | 38 | void setNumber(int number){msg_number=number;} |
39 | const QString&getDate()const{ return date; } | 39 | const QString&getDate()const{ return date; } |
40 | void setDate( const QString&a ) { date = a; } | 40 | void setDate( const QString&a ) { date = a; } |
41 | const QString&getFrom()const{ return from; } | 41 | const QString&getFrom()const{ return from; } |
42 | void setFrom( const QString&a ) { from = a; } | 42 | void setFrom( const QString&a ) { from = a; } |
43 | const QString&getSubject()const { return subject; } | 43 | const QString&getSubject()const { return subject; } |
44 | void setSubject( const QString&s ) { subject = s; } | 44 | void setSubject( const QString&s ) { subject = s; } |
45 | const QString&getMbox()const{return mbox;} | 45 | const QString&getMbox()const{return mbox;} |
46 | void setMbox(const QString&box){mbox = box;} | 46 | void setMbox(const QString&box){mbox = box;} |
47 | void setMsgid(const QString&id){msg_id=id;} | 47 | void setMsgid(const QString&id){msg_id=id;} |
48 | const QString&Msgid()const{return msg_id;} | 48 | const QString&Msgid()const{return msg_id;} |
49 | void setReplyto(const QString&reply){replyto=reply;} | 49 | void setReplyto(const QString&reply){replyto=reply;} |
50 | const QString&Replyto()const{return replyto;} | 50 | const QString&Replyto()const{return replyto;} |
51 | void setMsgsize(int size){msg_size = size;} | 51 | void setMsgsize(int size){msg_size = size;} |
52 | const int Msgsize()const{return msg_size;} | 52 | const int Msgsize()const{return msg_size;} |
53 | 53 | ||
54 | 54 | ||
55 | void setTo(const QStringList&list); | 55 | void setTo(const QStringList&list); |
56 | const QStringList&To()const; | 56 | const QStringList&To()const; |
57 | void setCC(const QStringList&list); | 57 | void setCC(const QStringList&list); |
58 | const QStringList&CC()const; | 58 | const QStringList&CC()const; |
59 | void setBcc(const QStringList&list); | 59 | void setBcc(const QStringList&list); |
60 | const QStringList&Bcc()const; | 60 | const QStringList&Bcc()const; |
61 | const QBitArray&getFlags()const{return msg_flags;} | 61 | const QBitArray&getFlags()const{return msg_flags;} |
62 | void setFlags(const QBitArray&flags){msg_flags = flags;} | 62 | void setFlags(const QBitArray&flags){msg_flags = flags;} |
63 | 63 | ||
64 | protected: | 64 | protected: |
65 | QString subject,date,from,mbox,msg_id,replyto; | 65 | QString subject,date,from,mbox,msg_id,replyto; |
66 | int msg_number,msg_size; | 66 | int msg_number,msg_size; |
67 | QBitArray msg_flags; | 67 | QBitArray msg_flags; |
68 | QStringList to,cc,bcc; | 68 | QStringList to,cc,bcc; |
69 | void init(); | 69 | void init(); |
70 | void copy_old(const RecMail&old); | 70 | void copy_old(const RecMail&old); |
71 | }; | 71 | }; |
72 | 72 | ||
73 | typedef QMap<QString,QString> part_plist_t; | 73 | typedef QMap<QString,QString> part_plist_t; |
74 | 74 | ||
75 | class RecPart | 75 | class RecPart |
76 | { | 76 | { |
77 | protected: | 77 | protected: |
78 | QString m_type,m_subtype,m_identifier,m_encoding; | 78 | QString m_type,m_subtype,m_identifier,m_encoding; |
79 | unsigned int m_lines; | 79 | unsigned int m_lines,m_size; |
80 | part_plist_t m_Parameters; | 80 | part_plist_t m_Parameters; |
81 | /* describes the position in the mail */ | 81 | /* describes the position in the mail */ |
82 | QValueList<int> m_poslist; | 82 | QValueList<int> m_poslist; |
83 | 83 | ||
84 | public: | 84 | public: |
85 | RecPart(); | 85 | RecPart(); |
86 | virtual ~RecPart(); | 86 | virtual ~RecPart(); |
87 | 87 | ||
88 | const QString&Type()const; | 88 | const QString&Type()const; |
89 | void setType(const QString&type); | 89 | void setType(const QString&type); |
90 | const QString&Subtype()const; | 90 | const QString&Subtype()const; |
91 | void setSubtype(const QString&subtype); | 91 | void setSubtype(const QString&subtype); |
92 | const QString&Identifier()const; | 92 | const QString&Identifier()const; |
93 | void setIdentifier(const QString&identifier); | 93 | void setIdentifier(const QString&identifier); |
94 | const QString&Encoding()const; | 94 | const QString&Encoding()const; |
95 | void setEncoding(const QString&encoding); | 95 | void setEncoding(const QString&encoding); |
96 | void setLines(unsigned int lines); | 96 | void setLines(unsigned int lines); |
97 | const unsigned int Lines()const; | 97 | const unsigned int Lines()const; |
98 | void setSize(unsigned int size); | ||
99 | const unsigned int Size()const; | ||
100 | |||
98 | 101 | ||
99 | void setParameters(const part_plist_t&list); | 102 | void setParameters(const part_plist_t&list); |
100 | const part_plist_t&Parameters()const; | 103 | const part_plist_t&Parameters()const; |
101 | void addParameter(const QString&key,const QString&value); | 104 | void addParameter(const QString&key,const QString&value); |
102 | const QString searchParamter(const QString&key)const; | 105 | const QString searchParamter(const QString&key)const; |
103 | void setPositionlist(const QValueList<int>&poslist); | 106 | void setPositionlist(const QValueList<int>&poslist); |
104 | const QValueList<int>& Positionlist()const; | 107 | const QValueList<int>& Positionlist()const; |
105 | }; | 108 | }; |
106 | 109 | ||
107 | class RecBody | 110 | class RecBody |
108 | { | 111 | { |
109 | protected: | 112 | protected: |
110 | QString m_BodyText; | 113 | QString m_BodyText; |
111 | QValueList<RecPart> m_PartsList; | 114 | QValueList<RecPart> m_PartsList; |
112 | RecPart m_description; | 115 | RecPart m_description; |
113 | 116 | ||
114 | public: | 117 | public: |
115 | RecBody(); | 118 | RecBody(); |
116 | virtual ~RecBody(); | 119 | virtual ~RecBody(); |
117 | void setBodytext(const QString&); | 120 | void setBodytext(const QString&); |
118 | const QString& Bodytext()const; | 121 | const QString& Bodytext()const; |
119 | 122 | ||
120 | void setDescription(const RecPart&des); | 123 | void setDescription(const RecPart&des); |
121 | const RecPart& Description()const; | 124 | const RecPart& Description()const; |
122 | 125 | ||
123 | void setParts(const QValueList<RecPart>&parts); | 126 | void setParts(const QValueList<RecPart>&parts); |
124 | const QValueList<RecPart>& Parts()const; | 127 | const QValueList<RecPart>& Parts()const; |
125 | void addPart(const RecPart&part); | 128 | void addPart(const RecPart&part); |
126 | }; | 129 | }; |
127 | 130 | ||
128 | #endif | 131 | #endif |
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp index 7b8494d..39c9820 100644 --- a/noncore/net/mail/viewmail.cpp +++ b/noncore/net/mail/viewmail.cpp | |||
@@ -1,78 +1,146 @@ | |||
1 | #include <qtextbrowser.h> | 1 | #include <qtextbrowser.h> |
2 | #include <qmessagebox.h> | 2 | #include <qmessagebox.h> |
3 | #include <qtextstream.h> | ||
3 | #include <qaction.h> | 4 | #include <qaction.h> |
4 | #include <qapplication.h> | 5 | #include <qapplication.h> |
5 | 6 | ||
6 | #include "settings.h" | 7 | #include "settings.h" |
7 | #include "composemail.h" | 8 | #include "composemail.h" |
8 | #include "viewmail.h" | 9 | #include "viewmail.h" |
9 | 10 | ||
10 | AttachItem::AttachItem(QListView *parent, AttachItemStore &attachItemStore) | 11 | AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&file,const QString&desc,int num) |
11 | : QListViewItem(parent), _attachItemStore(attachItemStore) | 12 | : QListViewItem(parent,after),_partNum(num) |
12 | { | 13 | { |
13 | setText(0, _attachItemStore.mimeType()); | 14 | setText(0, mime); |
14 | setText(1, _attachItemStore.fileName()); | 15 | setText(1, file); |
15 | setText(2, _attachItemStore.description()); | 16 | setText(2, desc); |
16 | } | ||
17 | |||
18 | AttachItem::AttachItem(QListViewItem *parent, AttachItemStore &attachItemStore) | ||
19 | : QListViewItem(parent), _attachItemStore(attachItemStore) | ||
20 | { | ||
21 | setText(0, _attachItemStore.mimeType()); | ||
22 | setText(1, _attachItemStore.fileName()); | ||
23 | setText(2, _attachItemStore.description()); | ||
24 | } | 17 | } |
25 | 18 | ||
26 | 19 | ||
27 | void ViewMail::setBody( RecBody body ) { | 20 | void ViewMail::setBody( RecBody body ) { |
28 | 21 | ||
29 | m_mail[2] = body.Bodytext(); | 22 | m_mail[2] = body.Bodytext(); |
23 | attachbutton->setEnabled(body.Parts().count()>0); | ||
24 | attachments->setEnabled(body.Parts().count()>0); | ||
25 | if (body.Parts().count()==0) { | ||
26 | return; | ||
27 | } | ||
28 | AttachItem * curItem=0; | ||
29 | QString type=body.Description().Type()+"/"+body.Description().Subtype(); | ||
30 | QString desc; | ||
31 | double s = body.Description().Size(); | ||
32 | int w; | ||
33 | w=0; | ||
34 | |||
35 | while (s>1024) { | ||
36 | s/=1024; | ||
37 | ++w; | ||
38 | if (w>=2) break; | ||
39 | } | ||
30 | 40 | ||
41 | QString q=""; | ||
42 | switch(w) { | ||
43 | case 1: | ||
44 | q="k"; | ||
45 | break; | ||
46 | case 2: | ||
47 | q="M"; | ||
48 | break; | ||
49 | default: | ||
50 | break; | ||
51 | } | ||
52 | |||
53 | { | ||
54 | /* I did not found a method to make a CONTENT reset on a QTextStream | ||
55 | so I use this construct that the stream will re-constructed in each | ||
56 | loop. To let it work, the textstream is packed into a own area of | ||
57 | code is it will be destructed after finishing its small job. | ||
58 | */ | ||
59 | QTextOStream o(&desc); | ||
60 | if (w>0) o.precision(2); else o.precision(0); | ||
61 | o.setf(QTextStream::fixed); | ||
62 | o << s << " " << q << "Byte"; | ||
63 | } | ||
64 | |||
65 | curItem=new AttachItem(attachments,curItem,type,"Mailbody",desc,-1); | ||
66 | QString filename = ""; | ||
67 | for (unsigned int i = 0; i < body.Parts().count();++i) { | ||
68 | type = body.Parts()[i].Type()+"/"+body.Parts()[i].Subtype(); | ||
69 | part_plist_t::ConstIterator it = body.Parts()[i].Parameters().begin(); | ||
70 | for (;it!=body.Parts()[i].Parameters().end();++it) { | ||
71 | if (it.key().lower()=="name") { | ||
72 | filename=it.data(); | ||
73 | } | ||
74 | } | ||
75 | s = body.Parts()[i].Size(); | ||
76 | w = 0; | ||
77 | while (s>1024) { | ||
78 | s/=1024; | ||
79 | ++w; | ||
80 | if (w>=2) break; | ||
81 | } | ||
82 | switch(w) { | ||
83 | case 1: | ||
84 | q="k"; | ||
85 | break; | ||
86 | case 2: | ||
87 | q="M"; | ||
88 | break; | ||
89 | default: | ||
90 | q=""; | ||
91 | break; | ||
92 | } | ||
93 | QTextOStream o(&desc); | ||
94 | if (w>0) o.precision(2); else o.precision(0); | ||
95 | o.setf(QTextStream::fixed); | ||
96 | o << s << " " << q << "Byte"; | ||
97 | curItem=new AttachItem(attachments,curItem,type,filename,desc,i); | ||
98 | } | ||
31 | } | 99 | } |
32 | 100 | ||
33 | void ViewMail::setMail( RecMail mail ) { | 101 | void ViewMail::setMail( RecMail mail ) { |
34 | 102 | ||
35 | m_mail[0] = mail.getFrom(); | 103 | m_mail[0] = mail.getFrom(); |
36 | m_mail[1] = mail.getSubject(); | 104 | m_mail[1] = mail.getSubject(); |
37 | m_mail[3] = mail.getDate(); | 105 | m_mail[3] = mail.getDate(); |
38 | m_mail[4] = mail.Msgid(); | 106 | m_mail[4] = mail.Msgid(); |
39 | 107 | ||
40 | m_mail2[0] = mail.To(); | 108 | m_mail2[0] = mail.To(); |
41 | m_mail2[1] = mail.CC(); | 109 | m_mail2[1] = mail.CC(); |
42 | m_mail2[2] = mail.Bcc(); | 110 | m_mail2[2] = mail.Bcc(); |
43 | 111 | ||
44 | setText(); | 112 | setText(); |
45 | } | 113 | } |
46 | 114 | ||
47 | 115 | ||
48 | 116 | ||
49 | ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) | 117 | ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) |
50 | : ViewMailBase(parent, name, fl), _inLoop(false) | 118 | : ViewMailBase(parent, name, fl), _inLoop(false) |
51 | { | 119 | { |
52 | m_gotBody = false; | 120 | m_gotBody = false; |
53 | 121 | ||
54 | connect(reply, SIGNAL(activated()), SLOT(slotReply())); | 122 | connect(reply, SIGNAL(activated()), SLOT(slotReply())); |
55 | connect(forward, SIGNAL(activated()), SLOT(slotForward())); | 123 | connect(forward, SIGNAL(activated()), SLOT(slotForward())); |
56 | 124 | ||
57 | attachments->setEnabled(m_gotBody); | 125 | attachments->setEnabled(m_gotBody); |
58 | } | 126 | } |
59 | 127 | ||
60 | void ViewMail::setText() | 128 | void ViewMail::setText() |
61 | { | 129 | { |
62 | 130 | ||
63 | QString toString; | 131 | QString toString; |
64 | QString ccString; | 132 | QString ccString; |
65 | QString bccString; | 133 | QString bccString; |
66 | 134 | ||
67 | for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) { | 135 | for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it ) { |
68 | toString += (*it); | 136 | toString += (*it); |
69 | } | 137 | } |
70 | for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it ) { | 138 | for ( QStringList::Iterator it = ( m_mail2[1] ).begin(); it != ( m_mail2[1] ).end(); ++it ) { |
71 | ccString += (*it); | 139 | ccString += (*it); |
72 | } | 140 | } |
73 | for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) { | 141 | for ( QStringList::Iterator it = ( m_mail2[2] ).begin(); it != ( m_mail2[2] ).end(); ++it ) { |
74 | bccString += (*it); | 142 | bccString += (*it); |
75 | } | 143 | } |
76 | 144 | ||
77 | setCaption( caption().arg( m_mail[0] ) ); | 145 | setCaption( caption().arg( m_mail[0] ) ); |
78 | 146 | ||
diff --git a/noncore/net/mail/viewmail.h b/noncore/net/mail/viewmail.h index 61baa1d..b497434 100644 --- a/noncore/net/mail/viewmail.h +++ b/noncore/net/mail/viewmail.h | |||
@@ -1,74 +1,54 @@ | |||
1 | #ifndef VIEWMAIL_H | 1 | #ifndef VIEWMAIL_H |
2 | #define VIEWMAIL_H | 2 | #define VIEWMAIL_H |
3 | 3 | ||
4 | #include <qlistview.h> | 4 | #include <qlistview.h> |
5 | #include <qmap.h> | 5 | #include <qmap.h> |
6 | #include <qstringlist.h> | 6 | #include <qstringlist.h> |
7 | 7 | ||
8 | #include "viewmailbase.h" | 8 | #include "viewmailbase.h" |
9 | #include "mailtypes.h" | 9 | #include "mailtypes.h" |
10 | 10 | ||
11 | class AttachItemStore | ||
12 | { | ||
13 | public: | ||
14 | void setMimeType(QString mimeType) { _mimeType = mimeType; } | ||
15 | QString mimeType() { return _mimeType; } | ||
16 | void setFileName(QString fileName) { _fileName = fileName; } | ||
17 | QString fileName() { return _fileName; } | ||
18 | void setDescription(QString description) { _description = description; } | ||
19 | QString description() { return _description; } | ||
20 | void setPartNum(QString partNum) { _partNum = partNum; } | ||
21 | QString partNum() { return _partNum; } | ||
22 | |||
23 | private: | ||
24 | QString _mimeType, _fileName, _description, _partNum; | ||
25 | |||
26 | }; | ||
27 | |||
28 | class AttachItem : public QListViewItem | 11 | class AttachItem : public QListViewItem |
29 | { | 12 | { |
30 | public: | 13 | public: |
31 | AttachItem(QListView *parent, AttachItemStore &attachment); | 14 | AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&file,const QString&desc,int num); |
32 | AttachItem(QListViewItem *parent, AttachItemStore &attachment); | 15 | int Partnumber() { return _partNum; } |
33 | |||
34 | AttachItemStore attachItemStore() { return _attachItemStore; } | ||
35 | 16 | ||
36 | private: | 17 | private: |
37 | AttachItemStore _attachItemStore; | 18 | int _partNum; |
38 | |||
39 | }; | 19 | }; |
40 | 20 | ||
41 | class ViewMail : public ViewMailBase | 21 | class ViewMail : public ViewMailBase |
42 | { | 22 | { |
43 | Q_OBJECT | 23 | Q_OBJECT |
44 | 24 | ||
45 | public: | 25 | public: |
46 | ViewMail( QWidget *parent = 0, const char *name = 0, WFlags fl = Qt::WType_Modal); | 26 | ViewMail( QWidget *parent = 0, const char *name = 0, WFlags fl = Qt::WType_Modal); |
47 | ~ViewMail(); | 27 | ~ViewMail(); |
48 | 28 | ||
49 | void hide(); | 29 | void hide(); |
50 | void exec(); | 30 | void exec(); |
51 | void setMail( RecMail mail ); | 31 | void setMail( RecMail mail ); |
52 | void setBody( RecBody body ); | 32 | void setBody( RecBody body ); |
53 | 33 | ||
54 | protected: | 34 | protected: |
55 | QString deHtml(const QString &string); | 35 | QString deHtml(const QString &string); |
56 | 36 | ||
57 | protected slots: | 37 | protected slots: |
58 | void slotReply(); | 38 | void slotReply(); |
59 | void slotForward(); | 39 | void slotForward(); |
60 | void setText(); | 40 | void setText(); |
61 | 41 | ||
62 | private: | 42 | private: |
63 | bool _inLoop; | 43 | bool _inLoop; |
64 | QString m_mailHtml; | 44 | QString m_mailHtml; |
65 | bool m_gotBody; | 45 | bool m_gotBody; |
66 | 46 | ||
67 | // 0 from 1 subject 2 bodytext 3 date | 47 | // 0 from 1 subject 2 bodytext 3 date |
68 | QMap <int,QString> m_mail; | 48 | QMap <int,QString> m_mail; |
69 | // 0 to 1 cc 2 bcc | 49 | // 0 to 1 cc 2 bcc |
70 | QMap <int,QStringList> m_mail2; | 50 | QMap <int,QStringList> m_mail2; |
71 | 51 | ||
72 | }; | 52 | }; |
73 | 53 | ||
74 | #endif | 54 | #endif |
diff --git a/noncore/net/mail/viewmailbase.cpp b/noncore/net/mail/viewmailbase.cpp index 197a665..38f92b4 100644 --- a/noncore/net/mail/viewmailbase.cpp +++ b/noncore/net/mail/viewmailbase.cpp | |||
@@ -9,67 +9,68 @@ | |||
9 | #include <qmenubar.h> | 9 | #include <qmenubar.h> |
10 | #include <qpe/resource.h> | 10 | #include <qpe/resource.h> |
11 | 11 | ||
12 | #include "viewmailbase.h" | 12 | #include "viewmailbase.h" |
13 | //#include "opendiag.h" | 13 | //#include "opendiag.h" |
14 | 14 | ||
15 | ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl) | 15 | ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl) |
16 | : QMainWindow(parent, name, fl) | 16 | : QMainWindow(parent, name, fl) |
17 | { | 17 | { |
18 | setCaption(tr("E-Mail by %1")); | 18 | setCaption(tr("E-Mail by %1")); |
19 | setToolBarsMovable(false); | 19 | setToolBarsMovable(false); |
20 | 20 | ||
21 | toolbar = new QToolBar(this); | 21 | toolbar = new QToolBar(this); |
22 | menubar = new QMenuBar( toolbar ); | 22 | menubar = new QMenuBar( toolbar ); |
23 | mailmenu = new QPopupMenu( menubar ); | 23 | mailmenu = new QPopupMenu( menubar ); |
24 | menubar->insertItem( tr( "Mail" ), mailmenu ); | 24 | menubar->insertItem( tr( "Mail" ), mailmenu ); |
25 | 25 | ||
26 | toolbar->setHorizontalStretchable(true); | 26 | toolbar->setHorizontalStretchable(true); |
27 | addToolBar(toolbar); | 27 | addToolBar(toolbar); |
28 | 28 | ||
29 | QLabel *spacer = new QLabel(toolbar); | 29 | QLabel *spacer = new QLabel(toolbar); |
30 | spacer->setBackgroundMode(QWidget::PaletteButton); | 30 | spacer->setBackgroundMode(QWidget::PaletteButton); |
31 | toolbar->setStretchableWidget(spacer); | 31 | toolbar->setStretchableWidget(spacer); |
32 | 32 | ||
33 | reply = new QAction(tr("Reply"), QIconSet(Resource::loadPixmap("mail/reply")), 0, 0, this); | 33 | reply = new QAction(tr("Reply"), QIconSet(Resource::loadPixmap("mail/reply")), 0, 0, this); |
34 | reply->addTo(toolbar); | 34 | reply->addTo(toolbar); |
35 | reply->addTo(mailmenu); | 35 | reply->addTo(mailmenu); |
36 | 36 | ||
37 | forward = new QAction(tr("Forward"), QIconSet(Resource::loadPixmap("mail/forward")), 0, 0, this); | 37 | forward = new QAction(tr("Forward"), QIconSet(Resource::loadPixmap("mail/forward")), 0, 0, this); |
38 | forward->addTo(toolbar); | 38 | forward->addTo(toolbar); |
39 | forward->addTo(mailmenu); | 39 | forward->addTo(mailmenu); |
40 | 40 | ||
41 | attachbutton = new QAction(tr("Attachments"), QIconSet(Resource::loadPixmap("mail/attach")), 0, 0, this, 0, true); | 41 | attachbutton = new QAction(tr("Attachments"), QIconSet(Resource::loadPixmap("mail/attach")), 0, 0, this, 0, true); |
42 | attachbutton->addTo(toolbar); | 42 | attachbutton->addTo(toolbar); |
43 | attachbutton->addTo(mailmenu); | 43 | attachbutton->addTo(mailmenu); |
44 | connect(attachbutton, SIGNAL(toggled(bool)), SLOT(slotChangeAttachview(bool))); | 44 | connect(attachbutton, SIGNAL(toggled(bool)), SLOT(slotChangeAttachview(bool))); |
45 | 45 | ||
46 | deleteMail = new QAction(tr("Delete Mail"), QIconSet(Resource::loadPixmap("mail/delete")), 0, 0, this); | 46 | deleteMail = new QAction(tr("Delete Mail"), QIconSet(Resource::loadPixmap("mail/delete")), 0, 0, this); |
47 | deleteMail->addTo(toolbar); | 47 | deleteMail->addTo(toolbar); |
48 | deleteMail->addTo(mailmenu); | 48 | deleteMail->addTo(mailmenu); |
49 | 49 | ||
50 | QVBox *view = new QVBox(this); | 50 | QVBox *view = new QVBox(this); |
51 | setCentralWidget(view); | 51 | setCentralWidget(view); |
52 | 52 | ||
53 | attachments = new QListView(view); | 53 | attachments = new QListView(view); |
54 | attachments->setMinimumHeight(90); | 54 | attachments->setMinimumHeight(90); |
55 | attachments->setMaximumHeight(90); | 55 | attachments->setMaximumHeight(90); |
56 | attachments->setAllColumnsShowFocus(true); | 56 | attachments->setAllColumnsShowFocus(true); |
57 | attachments->addColumn("Mime Type", 100); | 57 | attachments->addColumn("Mime Type", 60); |
58 | attachments->addColumn("Filename", 100); | 58 | attachments->addColumn(tr("Filename"), 100); |
59 | attachments->addColumn("Description", 100); | 59 | attachments->addColumn(tr("Size"), 80); |
60 | attachments->setSorting(-1); | ||
60 | attachments->hide(); | 61 | attachments->hide(); |
61 | 62 | ||
62 | browser = new QTextBrowser(view); | 63 | browser = new QTextBrowser(view); |
63 | 64 | ||
64 | //openDiag = new OpenDiag(view); | 65 | //openDiag = new OpenDiag(view); |
65 | //openDiag->hide(); | 66 | //openDiag->hide(); |
66 | 67 | ||
67 | } | 68 | } |
68 | 69 | ||
69 | void ViewMailBase::slotChangeAttachview(bool state) | 70 | void ViewMailBase::slotChangeAttachview(bool state) |
70 | { | 71 | { |
71 | if (state) attachments->show(); | 72 | if (state) attachments->show(); |
72 | else attachments->hide(); | 73 | else attachments->hide(); |
73 | } | 74 | } |
74 | 75 | ||
75 | 76 | ||