summaryrefslogtreecommitdiff
authoralwin <alwin>2003-12-14 22:30:26 (UTC)
committer alwin <alwin>2003-12-14 22:30:26 (UTC)
commitbdc60d27df0fa3a861e9117547fd2bed8a39661e (patch) (unidiff)
tree8dba1e590e60443ec0aff14398da665d351b0aa4
parent172c790df9004205eda2da25832cdc88fc6481ee (diff)
downloadopie-bdc60d27df0fa3a861e9117547fd2bed8a39661e.zip
opie-bdc60d27df0fa3a861e9117547fd2bed8a39661e.tar.gz
opie-bdc60d27df0fa3a861e9117547fd2bed8a39661e.tar.bz2
-answered mails get another pic (checked in in pics/opiemail)
-if a description for an attachment exists it will displayed -if mailbody is selected from list of attachments it will displayd without menu
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/imapwrapper.cpp5
-rw-r--r--noncore/net/mail/libmailwrapper/imapwrapper.cpp5
-rw-r--r--noncore/net/mail/libmailwrapper/mailtypes.cpp12
-rw-r--r--noncore/net/mail/libmailwrapper/mailtypes.h4
-rw-r--r--noncore/net/mail/mailtypes.cpp12
-rw-r--r--noncore/net/mail/mailtypes.h4
-rw-r--r--noncore/net/mail/mainwindow.cpp4
-rw-r--r--noncore/net/mail/viewmail.cpp32
-rw-r--r--noncore/net/mail/viewmail.h3
-rw-r--r--noncore/net/mail/viewmailbase.cpp5
10 files changed, 64 insertions, 22 deletions
diff --git a/noncore/net/mail/imapwrapper.cpp b/noncore/net/mail/imapwrapper.cpp
index 0ce2c6c..ad95384 100644
--- a/noncore/net/mail/imapwrapper.cpp
+++ b/noncore/net/mail/imapwrapper.cpp
@@ -667,107 +667,110 @@ void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which)
667 if (param) { 667 if (param) {
668 target_part.addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); 668 target_part.addParameter(QString(param->pa_name).lower(),QString(param->pa_value));
669 } 669 }
670 } 670 }
671 } 671 }
672 mailimap_body_fld_enc*enc = which->bd_encoding; 672 mailimap_body_fld_enc*enc = which->bd_encoding;
673 QString encoding(""); 673 QString encoding("");
674 switch (enc->enc_type) { 674 switch (enc->enc_type) {
675 case MAILIMAP_BODY_FLD_ENC_7BIT: 675 case MAILIMAP_BODY_FLD_ENC_7BIT:
676 encoding = "7bit"; 676 encoding = "7bit";
677 break; 677 break;
678 case MAILIMAP_BODY_FLD_ENC_8BIT: 678 case MAILIMAP_BODY_FLD_ENC_8BIT:
679 encoding = "8bit"; 679 encoding = "8bit";
680 break; 680 break;
681 case MAILIMAP_BODY_FLD_ENC_BINARY: 681 case MAILIMAP_BODY_FLD_ENC_BINARY:
682 encoding="binary"; 682 encoding="binary";
683 break; 683 break;
684 case MAILIMAP_BODY_FLD_ENC_BASE64: 684 case MAILIMAP_BODY_FLD_ENC_BASE64:
685 encoding="base64"; 685 encoding="base64";
686 break; 686 break;
687 case MAILIMAP_BODY_FLD_ENC_QUOTED_PRINTABLE: 687 case MAILIMAP_BODY_FLD_ENC_QUOTED_PRINTABLE:
688 encoding="quoted-printable"; 688 encoding="quoted-printable";
689 break; 689 break;
690 case MAILIMAP_BODY_FLD_ENC_OTHER: 690 case MAILIMAP_BODY_FLD_ENC_OTHER:
691 default: 691 default:
692 if (enc->enc_value) { 692 if (enc->enc_value) {
693 char*t=enc->enc_value; 693 char*t=enc->enc_value;
694 encoding=QString(enc->enc_value); 694 encoding=QString(enc->enc_value);
695 enc->enc_value=0L; 695 enc->enc_value=0L;
696 free(t); 696 free(t);
697 } 697 }
698 } 698 }
699 if (which->bd_description) {
700 target_part.setDescription(QString(which->bd_description));
701 }
699 target_part.setEncoding(encoding); 702 target_part.setEncoding(encoding);
700 target_part.setSize(which->bd_size); 703 target_part.setSize(which->bd_size);
701} 704}
702 705
703QString IMAPwrapper::fetchPart(const RecMail&mail,const RecPart&part) 706QString IMAPwrapper::fetchPart(const RecMail&mail,const RecPart&part)
704{ 707{
705 return fetchPart(mail,part.Positionlist(),false); 708 return fetchPart(mail,part.Positionlist(),false);
706} 709}
707 710
708void IMAPwrapper::deleteMail(const RecMail&mail) 711void IMAPwrapper::deleteMail(const RecMail&mail)
709{ 712{
710 mailimap_flag_list*flist; 713 mailimap_flag_list*flist;
711 mailimap_set *set; 714 mailimap_set *set;
712 mailimap_store_att_flags * store_flags; 715 mailimap_store_att_flags * store_flags;
713 int err; 716 int err;
714 login(); 717 login();
715 if (!m_imap) { 718 if (!m_imap) {
716 return; 719 return;
717 } 720 }
718 const char *mb = mail.getMbox().latin1(); 721 const char *mb = mail.getMbox().latin1();
719 err = mailimap_select( m_imap, (char*)mb); 722 err = mailimap_select( m_imap, (char*)mb);
720 if ( err != MAILIMAP_NO_ERROR ) { 723 if ( err != MAILIMAP_NO_ERROR ) {
721 qDebug("error selecting mailbox for delete: %s",m_imap->imap_response); 724 qDebug("error selecting mailbox for delete: %s",m_imap->imap_response);
722 return; 725 return;
723 } 726 }
724 flist = mailimap_flag_list_new_empty(); 727 flist = mailimap_flag_list_new_empty();
725 mailimap_flag_list_add(flist,mailimap_flag_new_deleted()); 728 mailimap_flag_list_add(flist,mailimap_flag_new_deleted());
726 store_flags = mailimap_store_att_flags_new_set_flags(flist); 729 store_flags = mailimap_store_att_flags_new_set_flags(flist);
727 set = mailimap_set_new_single(mail.getNumber()); 730 set = mailimap_set_new_single(mail.getNumber());
728 err = mailimap_store(m_imap,set,store_flags); 731 err = mailimap_store(m_imap,set,store_flags);
729 mailimap_set_free( set ); 732 mailimap_set_free( set );
730 mailimap_store_att_flags_free(store_flags); 733 mailimap_store_att_flags_free(store_flags);
731 734
732 if (err != MAILIMAP_NO_ERROR) { 735 if (err != MAILIMAP_NO_ERROR) {
733 qDebug("error deleting mail: %s",m_imap->imap_response); 736 qDebug("error deleting mail: %s",m_imap->imap_response);
734 return; 737 return;
735 } 738 }
736 qDebug("deleting mail: %s",m_imap->imap_response); 739 qDebug("deleting mail: %s",m_imap->imap_response);
737 /* should we realy do that at this moment? */ 740 /* should we realy do that at this moment? */
738 err = mailimap_expunge(m_imap); 741 err = mailimap_expunge(m_imap);
739 if (err != MAILIMAP_NO_ERROR) { 742 if (err != MAILIMAP_NO_ERROR) {
740 qDebug("error deleting mail: %s",m_imap->imap_response); 743 qDebug("error deleting mail: %s",m_imap->imap_response);
741 } 744 }
742 qDebug("Delete successfull %s",m_imap->imap_response); 745 qDebug("Delete successfull %s",m_imap->imap_response);
743} 746}
744 747
745void IMAPwrapper::answeredMail(const RecMail&mail) 748void IMAPwrapper::answeredMail(const RecMail&mail)
746{ 749{
747 mailimap_flag_list*flist; 750 mailimap_flag_list*flist;
748 mailimap_set *set; 751 mailimap_set *set;
749 mailimap_store_att_flags * store_flags; 752 mailimap_store_att_flags * store_flags;
750 int err; 753 int err;
751 login(); 754 login();
752 if (!m_imap) { 755 if (!m_imap) {
753 return; 756 return;
754 } 757 }
755 const char *mb = mail.getMbox().latin1(); 758 const char *mb = mail.getMbox().latin1();
756 err = mailimap_select( m_imap, (char*)mb); 759 err = mailimap_select( m_imap, (char*)mb);
757 if ( err != MAILIMAP_NO_ERROR ) { 760 if ( err != MAILIMAP_NO_ERROR ) {
758 qDebug("error selecting mailbox for mark: %s",m_imap->imap_response); 761 qDebug("error selecting mailbox for mark: %s",m_imap->imap_response);
759 return; 762 return;
760 } 763 }
761 flist = mailimap_flag_list_new_empty(); 764 flist = mailimap_flag_list_new_empty();
762 mailimap_flag_list_add(flist,mailimap_flag_new_answered()); 765 mailimap_flag_list_add(flist,mailimap_flag_new_answered());
763 store_flags = mailimap_store_att_flags_new_set_flags(flist); 766 store_flags = mailimap_store_att_flags_new_add_flags(flist);
764 set = mailimap_set_new_single(mail.getNumber()); 767 set = mailimap_set_new_single(mail.getNumber());
765 err = mailimap_store(m_imap,set,store_flags); 768 err = mailimap_store(m_imap,set,store_flags);
766 mailimap_set_free( set ); 769 mailimap_set_free( set );
767 mailimap_store_att_flags_free(store_flags); 770 mailimap_store_att_flags_free(store_flags);
768 771
769 if (err != MAILIMAP_NO_ERROR) { 772 if (err != MAILIMAP_NO_ERROR) {
770 qDebug("error marking mail: %s",m_imap->imap_response); 773 qDebug("error marking mail: %s",m_imap->imap_response);
771 return; 774 return;
772 } 775 }
773} 776}
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
index 0ce2c6c..ad95384 100644
--- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp
@@ -667,107 +667,110 @@ void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which)
667 if (param) { 667 if (param) {
668 target_part.addParameter(QString(param->pa_name).lower(),QString(param->pa_value)); 668 target_part.addParameter(QString(param->pa_name).lower(),QString(param->pa_value));
669 } 669 }
670 } 670 }
671 } 671 }
672 mailimap_body_fld_enc*enc = which->bd_encoding; 672 mailimap_body_fld_enc*enc = which->bd_encoding;
673 QString encoding(""); 673 QString encoding("");
674 switch (enc->enc_type) { 674 switch (enc->enc_type) {
675 case MAILIMAP_BODY_FLD_ENC_7BIT: 675 case MAILIMAP_BODY_FLD_ENC_7BIT:
676 encoding = "7bit"; 676 encoding = "7bit";
677 break; 677 break;
678 case MAILIMAP_BODY_FLD_ENC_8BIT: 678 case MAILIMAP_BODY_FLD_ENC_8BIT:
679 encoding = "8bit"; 679 encoding = "8bit";
680 break; 680 break;
681 case MAILIMAP_BODY_FLD_ENC_BINARY: 681 case MAILIMAP_BODY_FLD_ENC_BINARY:
682 encoding="binary"; 682 encoding="binary";
683 break; 683 break;
684 case MAILIMAP_BODY_FLD_ENC_BASE64: 684 case MAILIMAP_BODY_FLD_ENC_BASE64:
685 encoding="base64"; 685 encoding="base64";
686 break; 686 break;
687 case MAILIMAP_BODY_FLD_ENC_QUOTED_PRINTABLE: 687 case MAILIMAP_BODY_FLD_ENC_QUOTED_PRINTABLE:
688 encoding="quoted-printable"; 688 encoding="quoted-printable";
689 break; 689 break;
690 case MAILIMAP_BODY_FLD_ENC_OTHER: 690 case MAILIMAP_BODY_FLD_ENC_OTHER:
691 default: 691 default:
692 if (enc->enc_value) { 692 if (enc->enc_value) {
693 char*t=enc->enc_value; 693 char*t=enc->enc_value;
694 encoding=QString(enc->enc_value); 694 encoding=QString(enc->enc_value);
695 enc->enc_value=0L; 695 enc->enc_value=0L;
696 free(t); 696 free(t);
697 } 697 }
698 } 698 }
699 if (which->bd_description) {
700 target_part.setDescription(QString(which->bd_description));
701 }
699 target_part.setEncoding(encoding); 702 target_part.setEncoding(encoding);
700 target_part.setSize(which->bd_size); 703 target_part.setSize(which->bd_size);
701} 704}
702 705
703QString IMAPwrapper::fetchPart(const RecMail&mail,const RecPart&part) 706QString IMAPwrapper::fetchPart(const RecMail&mail,const RecPart&part)
704{ 707{
705 return fetchPart(mail,part.Positionlist(),false); 708 return fetchPart(mail,part.Positionlist(),false);
706} 709}
707 710
708void IMAPwrapper::deleteMail(const RecMail&mail) 711void IMAPwrapper::deleteMail(const RecMail&mail)
709{ 712{
710 mailimap_flag_list*flist; 713 mailimap_flag_list*flist;
711 mailimap_set *set; 714 mailimap_set *set;
712 mailimap_store_att_flags * store_flags; 715 mailimap_store_att_flags * store_flags;
713 int err; 716 int err;
714 login(); 717 login();
715 if (!m_imap) { 718 if (!m_imap) {
716 return; 719 return;
717 } 720 }
718 const char *mb = mail.getMbox().latin1(); 721 const char *mb = mail.getMbox().latin1();
719 err = mailimap_select( m_imap, (char*)mb); 722 err = mailimap_select( m_imap, (char*)mb);
720 if ( err != MAILIMAP_NO_ERROR ) { 723 if ( err != MAILIMAP_NO_ERROR ) {
721 qDebug("error selecting mailbox for delete: %s",m_imap->imap_response); 724 qDebug("error selecting mailbox for delete: %s",m_imap->imap_response);
722 return; 725 return;
723 } 726 }
724 flist = mailimap_flag_list_new_empty(); 727 flist = mailimap_flag_list_new_empty();
725 mailimap_flag_list_add(flist,mailimap_flag_new_deleted()); 728 mailimap_flag_list_add(flist,mailimap_flag_new_deleted());
726 store_flags = mailimap_store_att_flags_new_set_flags(flist); 729 store_flags = mailimap_store_att_flags_new_set_flags(flist);
727 set = mailimap_set_new_single(mail.getNumber()); 730 set = mailimap_set_new_single(mail.getNumber());
728 err = mailimap_store(m_imap,set,store_flags); 731 err = mailimap_store(m_imap,set,store_flags);
729 mailimap_set_free( set ); 732 mailimap_set_free( set );
730 mailimap_store_att_flags_free(store_flags); 733 mailimap_store_att_flags_free(store_flags);
731 734
732 if (err != MAILIMAP_NO_ERROR) { 735 if (err != MAILIMAP_NO_ERROR) {
733 qDebug("error deleting mail: %s",m_imap->imap_response); 736 qDebug("error deleting mail: %s",m_imap->imap_response);
734 return; 737 return;
735 } 738 }
736 qDebug("deleting mail: %s",m_imap->imap_response); 739 qDebug("deleting mail: %s",m_imap->imap_response);
737 /* should we realy do that at this moment? */ 740 /* should we realy do that at this moment? */
738 err = mailimap_expunge(m_imap); 741 err = mailimap_expunge(m_imap);
739 if (err != MAILIMAP_NO_ERROR) { 742 if (err != MAILIMAP_NO_ERROR) {
740 qDebug("error deleting mail: %s",m_imap->imap_response); 743 qDebug("error deleting mail: %s",m_imap->imap_response);
741 } 744 }
742 qDebug("Delete successfull %s",m_imap->imap_response); 745 qDebug("Delete successfull %s",m_imap->imap_response);
743} 746}
744 747
745void IMAPwrapper::answeredMail(const RecMail&mail) 748void IMAPwrapper::answeredMail(const RecMail&mail)
746{ 749{
747 mailimap_flag_list*flist; 750 mailimap_flag_list*flist;
748 mailimap_set *set; 751 mailimap_set *set;
749 mailimap_store_att_flags * store_flags; 752 mailimap_store_att_flags * store_flags;
750 int err; 753 int err;
751 login(); 754 login();
752 if (!m_imap) { 755 if (!m_imap) {
753 return; 756 return;
754 } 757 }
755 const char *mb = mail.getMbox().latin1(); 758 const char *mb = mail.getMbox().latin1();
756 err = mailimap_select( m_imap, (char*)mb); 759 err = mailimap_select( m_imap, (char*)mb);
757 if ( err != MAILIMAP_NO_ERROR ) { 760 if ( err != MAILIMAP_NO_ERROR ) {
758 qDebug("error selecting mailbox for mark: %s",m_imap->imap_response); 761 qDebug("error selecting mailbox for mark: %s",m_imap->imap_response);
759 return; 762 return;
760 } 763 }
761 flist = mailimap_flag_list_new_empty(); 764 flist = mailimap_flag_list_new_empty();
762 mailimap_flag_list_add(flist,mailimap_flag_new_answered()); 765 mailimap_flag_list_add(flist,mailimap_flag_new_answered());
763 store_flags = mailimap_store_att_flags_new_set_flags(flist); 766 store_flags = mailimap_store_att_flags_new_add_flags(flist);
764 set = mailimap_set_new_single(mail.getNumber()); 767 set = mailimap_set_new_single(mail.getNumber());
765 err = mailimap_store(m_imap,set,store_flags); 768 err = mailimap_store(m_imap,set,store_flags);
766 mailimap_set_free( set ); 769 mailimap_set_free( set );
767 mailimap_store_att_flags_free(store_flags); 770 mailimap_store_att_flags_free(store_flags);
768 771
769 if (err != MAILIMAP_NO_ERROR) { 772 if (err != MAILIMAP_NO_ERROR) {
770 qDebug("error marking mail: %s",m_imap->imap_response); 773 qDebug("error marking mail: %s",m_imap->imap_response);
771 return; 774 return;
772 } 775 }
773} 776}
diff --git a/noncore/net/mail/libmailwrapper/mailtypes.cpp b/noncore/net/mail/libmailwrapper/mailtypes.cpp
index 94f5d6f..8d9b247 100644
--- a/noncore/net/mail/libmailwrapper/mailtypes.cpp
+++ b/noncore/net/mail/libmailwrapper/mailtypes.cpp
@@ -56,65 +56,65 @@ AbstractMail* RecMail::Wrapper()
56 56
57void RecMail::setTo(const QStringList&list) 57void RecMail::setTo(const QStringList&list)
58{ 58{
59 to = list; 59 to = list;
60} 60}
61 61
62const QStringList&RecMail::To()const 62const QStringList&RecMail::To()const
63{ 63{
64 return to; 64 return to;
65} 65}
66 66
67void RecMail::setCC(const QStringList&list) 67void RecMail::setCC(const QStringList&list)
68{ 68{
69 cc = list; 69 cc = list;
70} 70}
71 71
72const QStringList&RecMail::CC()const 72const QStringList&RecMail::CC()const
73{ 73{
74 return cc; 74 return cc;
75} 75}
76 76
77void RecMail::setBcc(const QStringList&list) 77void RecMail::setBcc(const QStringList&list)
78{ 78{
79 bcc = list; 79 bcc = list;
80} 80}
81 81
82const QStringList& RecMail::Bcc()const 82const QStringList& RecMail::Bcc()const
83{ 83{
84 return bcc; 84 return bcc;
85} 85}
86 86
87RecPart::RecPart() 87RecPart::RecPart()
88 : m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_lines(0),m_size(0) 88 : m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0)
89{ 89{
90 m_Parameters.clear(); 90 m_Parameters.clear();
91 m_poslist.clear(); 91 m_poslist.clear();
92} 92}
93 93
94RecPart::~RecPart() 94RecPart::~RecPart()
95{ 95{
96} 96}
97 97
98void RecPart::setSize(unsigned int size) 98void RecPart::setSize(unsigned int size)
99{ 99{
100 m_size = size; 100 m_size = size;
101} 101}
102 102
103const unsigned int RecPart::Size()const 103const unsigned int RecPart::Size()const
104{ 104{
105 return m_size; 105 return m_size;
106} 106}
107 107
108void RecPart::setLines(unsigned int lines) 108void RecPart::setLines(unsigned int lines)
109{ 109{
110 m_lines = lines; 110 m_lines = lines;
111} 111}
112 112
113const unsigned int RecPart::Lines()const 113const unsigned int RecPart::Lines()const
114{ 114{
115 return m_lines; 115 return m_lines;
116} 116}
117 117
118const QString& RecPart::Type()const 118const QString& RecPart::Type()const
119{ 119{
120 return m_type; 120 return m_type;
@@ -126,64 +126,74 @@ void RecPart::setType(const QString&type)
126} 126}
127 127
128const QString& RecPart::Subtype()const 128const QString& RecPart::Subtype()const
129{ 129{
130 return m_subtype; 130 return m_subtype;
131} 131}
132 132
133void RecPart::setSubtype(const QString&subtype) 133void RecPart::setSubtype(const QString&subtype)
134{ 134{
135 m_subtype = subtype; 135 m_subtype = subtype;
136} 136}
137 137
138const QString& RecPart::Identifier()const 138const QString& RecPart::Identifier()const
139{ 139{
140 return m_identifier; 140 return m_identifier;
141} 141}
142 142
143void RecPart::setIdentifier(const QString&identifier) 143void RecPart::setIdentifier(const QString&identifier)
144{ 144{
145 m_identifier = identifier; 145 m_identifier = identifier;
146} 146}
147 147
148const QString& RecPart::Encoding()const 148const QString& RecPart::Encoding()const
149{ 149{
150 return m_encoding; 150 return m_encoding;
151} 151}
152 152
153void RecPart::setEncoding(const QString&encoding) 153void RecPart::setEncoding(const QString&encoding)
154{ 154{
155 m_encoding = encoding; 155 m_encoding = encoding;
156} 156}
157 157
158const QString& RecPart::Description()const
159{
160 return m_description;
161}
162
163void RecPart::setDescription(const QString&desc)
164{
165 m_description = desc;
166}
167
158void RecPart::setParameters(const part_plist_t&list) 168void RecPart::setParameters(const part_plist_t&list)
159{ 169{
160 m_Parameters = list; 170 m_Parameters = list;
161} 171}
162 172
163const part_plist_t& RecPart::Parameters()const 173const part_plist_t& RecPart::Parameters()const
164{ 174{
165 return m_Parameters; 175 return m_Parameters;
166} 176}
167 177
168void RecPart::addParameter(const QString&key,const QString&value) 178void RecPart::addParameter(const QString&key,const QString&value)
169{ 179{
170 m_Parameters[key]=value; 180 m_Parameters[key]=value;
171} 181}
172 182
173const QString RecPart::searchParamter(const QString&key)const 183const QString RecPart::searchParamter(const QString&key)const
174{ 184{
175 QString value(""); 185 QString value("");
176 part_plist_t::ConstIterator it = m_Parameters.find(key); 186 part_plist_t::ConstIterator it = m_Parameters.find(key);
177 if (it != m_Parameters.end()) { 187 if (it != m_Parameters.end()) {
178 value = it.data(); 188 value = it.data();
179 } 189 }
180 return value; 190 return value;
181} 191}
182 192
183void RecPart::setPositionlist(const QValueList<int>&poslist) 193void RecPart::setPositionlist(const QValueList<int>&poslist)
184{ 194{
185 m_poslist = poslist; 195 m_poslist = poslist;
186} 196}
187 197
188const QValueList<int>& RecPart::Positionlist()const 198const QValueList<int>& RecPart::Positionlist()const
189{ 199{
diff --git a/noncore/net/mail/libmailwrapper/mailtypes.h b/noncore/net/mail/libmailwrapper/mailtypes.h
index 9ef762d..7d7bebc 100644
--- a/noncore/net/mail/libmailwrapper/mailtypes.h
+++ b/noncore/net/mail/libmailwrapper/mailtypes.h
@@ -51,82 +51,84 @@ public:
51 const QString&Replyto()const{return replyto;} 51 const QString&Replyto()const{return replyto;}
52 void setMsgsize(int size){msg_size = size;} 52 void setMsgsize(int size){msg_size = size;}
53 const int Msgsize()const{return msg_size;} 53 const int Msgsize()const{return msg_size;}
54 54
55 55
56 void setTo(const QStringList&list); 56 void setTo(const QStringList&list);
57 const QStringList&To()const; 57 const QStringList&To()const;
58 void setCC(const QStringList&list); 58 void setCC(const QStringList&list);
59 const QStringList&CC()const; 59 const QStringList&CC()const;
60 void setBcc(const QStringList&list); 60 void setBcc(const QStringList&list);
61 const QStringList&Bcc()const; 61 const QStringList&Bcc()const;
62 const QBitArray&getFlags()const{return msg_flags;} 62 const QBitArray&getFlags()const{return msg_flags;}
63 void setFlags(const QBitArray&flags){msg_flags = flags;} 63 void setFlags(const QBitArray&flags){msg_flags = flags;}
64 64
65 void setWrapper(AbstractMail*wrapper); 65 void setWrapper(AbstractMail*wrapper);
66 AbstractMail* Wrapper(); 66 AbstractMail* Wrapper();
67 67
68protected: 68protected:
69 QString subject,date,from,mbox,msg_id,replyto; 69 QString subject,date,from,mbox,msg_id,replyto;
70 int msg_number,msg_size; 70 int msg_number,msg_size;
71 QBitArray msg_flags; 71 QBitArray msg_flags;
72 QStringList to,cc,bcc; 72 QStringList to,cc,bcc;
73 AbstractMail*wrapper; 73 AbstractMail*wrapper;
74 void init(); 74 void init();
75 void copy_old(const RecMail&old); 75 void copy_old(const RecMail&old);
76}; 76};
77 77
78typedef QMap<QString,QString> part_plist_t; 78typedef QMap<QString,QString> part_plist_t;
79 79
80class RecPart 80class RecPart
81{ 81{
82protected: 82protected:
83 QString m_type,m_subtype,m_identifier,m_encoding; 83 QString m_type,m_subtype,m_identifier,m_encoding,m_description;
84 unsigned int m_lines,m_size; 84 unsigned int m_lines,m_size;
85 part_plist_t m_Parameters; 85 part_plist_t m_Parameters;
86 /* describes the position in the mail */ 86 /* describes the position in the mail */
87 QValueList<int> m_poslist; 87 QValueList<int> m_poslist;
88 88
89public: 89public:
90 RecPart(); 90 RecPart();
91 virtual ~RecPart(); 91 virtual ~RecPart();
92 92
93 const QString&Type()const; 93 const QString&Type()const;
94 void setType(const QString&type); 94 void setType(const QString&type);
95 const QString&Subtype()const; 95 const QString&Subtype()const;
96 void setSubtype(const QString&subtype); 96 void setSubtype(const QString&subtype);
97 const QString&Identifier()const; 97 const QString&Identifier()const;
98 void setIdentifier(const QString&identifier); 98 void setIdentifier(const QString&identifier);
99 const QString&Encoding()const; 99 const QString&Encoding()const;
100 void setEncoding(const QString&encoding); 100 void setEncoding(const QString&encoding);
101 const QString&Description()const;
102 void setDescription(const QString&desc);
101 void setLines(unsigned int lines); 103 void setLines(unsigned int lines);
102 const unsigned int Lines()const; 104 const unsigned int Lines()const;
103 void setSize(unsigned int size); 105 void setSize(unsigned int size);
104 const unsigned int Size()const; 106 const unsigned int Size()const;
105 107
106 108
107 void setParameters(const part_plist_t&list); 109 void setParameters(const part_plist_t&list);
108 const part_plist_t&Parameters()const; 110 const part_plist_t&Parameters()const;
109 void addParameter(const QString&key,const QString&value); 111 void addParameter(const QString&key,const QString&value);
110 const QString searchParamter(const QString&key)const; 112 const QString searchParamter(const QString&key)const;
111 void setPositionlist(const QValueList<int>&poslist); 113 void setPositionlist(const QValueList<int>&poslist);
112 const QValueList<int>& Positionlist()const; 114 const QValueList<int>& Positionlist()const;
113}; 115};
114 116
115class RecBody 117class RecBody
116{ 118{
117protected: 119protected:
118 QString m_BodyText; 120 QString m_BodyText;
119 QValueList<RecPart> m_PartsList; 121 QValueList<RecPart> m_PartsList;
120 RecPart m_description; 122 RecPart m_description;
121 123
122public: 124public:
123 RecBody(); 125 RecBody();
124 virtual ~RecBody(); 126 virtual ~RecBody();
125 void setBodytext(const QString&); 127 void setBodytext(const QString&);
126 const QString& Bodytext()const; 128 const QString& Bodytext()const;
127 129
128 void setDescription(const RecPart&des); 130 void setDescription(const RecPart&des);
129 const RecPart& Description()const; 131 const RecPart& Description()const;
130 132
131 void setParts(const QValueList<RecPart>&parts); 133 void setParts(const QValueList<RecPart>&parts);
132 const QValueList<RecPart>& Parts()const; 134 const QValueList<RecPart>& Parts()const;
diff --git a/noncore/net/mail/mailtypes.cpp b/noncore/net/mail/mailtypes.cpp
index 94f5d6f..8d9b247 100644
--- a/noncore/net/mail/mailtypes.cpp
+++ b/noncore/net/mail/mailtypes.cpp
@@ -56,65 +56,65 @@ AbstractMail* RecMail::Wrapper()
56 56
57void RecMail::setTo(const QStringList&list) 57void RecMail::setTo(const QStringList&list)
58{ 58{
59 to = list; 59 to = list;
60} 60}
61 61
62const QStringList&RecMail::To()const 62const QStringList&RecMail::To()const
63{ 63{
64 return to; 64 return to;
65} 65}
66 66
67void RecMail::setCC(const QStringList&list) 67void RecMail::setCC(const QStringList&list)
68{ 68{
69 cc = list; 69 cc = list;
70} 70}
71 71
72const QStringList&RecMail::CC()const 72const QStringList&RecMail::CC()const
73{ 73{
74 return cc; 74 return cc;
75} 75}
76 76
77void RecMail::setBcc(const QStringList&list) 77void RecMail::setBcc(const QStringList&list)
78{ 78{
79 bcc = list; 79 bcc = list;
80} 80}
81 81
82const QStringList& RecMail::Bcc()const 82const QStringList& RecMail::Bcc()const
83{ 83{
84 return bcc; 84 return bcc;
85} 85}
86 86
87RecPart::RecPart() 87RecPart::RecPart()
88 : m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_lines(0),m_size(0) 88 : m_type(""),m_subtype(""),m_identifier(""),m_encoding(""),m_description(""),m_lines(0),m_size(0)
89{ 89{
90 m_Parameters.clear(); 90 m_Parameters.clear();
91 m_poslist.clear(); 91 m_poslist.clear();
92} 92}
93 93
94RecPart::~RecPart() 94RecPart::~RecPart()
95{ 95{
96} 96}
97 97
98void RecPart::setSize(unsigned int size) 98void RecPart::setSize(unsigned int size)
99{ 99{
100 m_size = size; 100 m_size = size;
101} 101}
102 102
103const unsigned int RecPart::Size()const 103const unsigned int RecPart::Size()const
104{ 104{
105 return m_size; 105 return m_size;
106} 106}
107 107
108void RecPart::setLines(unsigned int lines) 108void RecPart::setLines(unsigned int lines)
109{ 109{
110 m_lines = lines; 110 m_lines = lines;
111} 111}
112 112
113const unsigned int RecPart::Lines()const 113const unsigned int RecPart::Lines()const
114{ 114{
115 return m_lines; 115 return m_lines;
116} 116}
117 117
118const QString& RecPart::Type()const 118const QString& RecPart::Type()const
119{ 119{
120 return m_type; 120 return m_type;
@@ -126,64 +126,74 @@ void RecPart::setType(const QString&type)
126} 126}
127 127
128const QString& RecPart::Subtype()const 128const QString& RecPart::Subtype()const
129{ 129{
130 return m_subtype; 130 return m_subtype;
131} 131}
132 132
133void RecPart::setSubtype(const QString&subtype) 133void RecPart::setSubtype(const QString&subtype)
134{ 134{
135 m_subtype = subtype; 135 m_subtype = subtype;
136} 136}
137 137
138const QString& RecPart::Identifier()const 138const QString& RecPart::Identifier()const
139{ 139{
140 return m_identifier; 140 return m_identifier;
141} 141}
142 142
143void RecPart::setIdentifier(const QString&identifier) 143void RecPart::setIdentifier(const QString&identifier)
144{ 144{
145 m_identifier = identifier; 145 m_identifier = identifier;
146} 146}
147 147
148const QString& RecPart::Encoding()const 148const QString& RecPart::Encoding()const
149{ 149{
150 return m_encoding; 150 return m_encoding;
151} 151}
152 152
153void RecPart::setEncoding(const QString&encoding) 153void RecPart::setEncoding(const QString&encoding)
154{ 154{
155 m_encoding = encoding; 155 m_encoding = encoding;
156} 156}
157 157
158const QString& RecPart::Description()const
159{
160 return m_description;
161}
162
163void RecPart::setDescription(const QString&desc)
164{
165 m_description = desc;
166}
167
158void RecPart::setParameters(const part_plist_t&list) 168void RecPart::setParameters(const part_plist_t&list)
159{ 169{
160 m_Parameters = list; 170 m_Parameters = list;
161} 171}
162 172
163const part_plist_t& RecPart::Parameters()const 173const part_plist_t& RecPart::Parameters()const
164{ 174{
165 return m_Parameters; 175 return m_Parameters;
166} 176}
167 177
168void RecPart::addParameter(const QString&key,const QString&value) 178void RecPart::addParameter(const QString&key,const QString&value)
169{ 179{
170 m_Parameters[key]=value; 180 m_Parameters[key]=value;
171} 181}
172 182
173const QString RecPart::searchParamter(const QString&key)const 183const QString RecPart::searchParamter(const QString&key)const
174{ 184{
175 QString value(""); 185 QString value("");
176 part_plist_t::ConstIterator it = m_Parameters.find(key); 186 part_plist_t::ConstIterator it = m_Parameters.find(key);
177 if (it != m_Parameters.end()) { 187 if (it != m_Parameters.end()) {
178 value = it.data(); 188 value = it.data();
179 } 189 }
180 return value; 190 return value;
181} 191}
182 192
183void RecPart::setPositionlist(const QValueList<int>&poslist) 193void RecPart::setPositionlist(const QValueList<int>&poslist)
184{ 194{
185 m_poslist = poslist; 195 m_poslist = poslist;
186} 196}
187 197
188const QValueList<int>& RecPart::Positionlist()const 198const QValueList<int>& RecPart::Positionlist()const
189{ 199{
diff --git a/noncore/net/mail/mailtypes.h b/noncore/net/mail/mailtypes.h
index 9ef762d..7d7bebc 100644
--- a/noncore/net/mail/mailtypes.h
+++ b/noncore/net/mail/mailtypes.h
@@ -51,82 +51,84 @@ public:
51 const QString&Replyto()const{return replyto;} 51 const QString&Replyto()const{return replyto;}
52 void setMsgsize(int size){msg_size = size;} 52 void setMsgsize(int size){msg_size = size;}
53 const int Msgsize()const{return msg_size;} 53 const int Msgsize()const{return msg_size;}
54 54
55 55
56 void setTo(const QStringList&list); 56 void setTo(const QStringList&list);
57 const QStringList&To()const; 57 const QStringList&To()const;
58 void setCC(const QStringList&list); 58 void setCC(const QStringList&list);
59 const QStringList&CC()const; 59 const QStringList&CC()const;
60 void setBcc(const QStringList&list); 60 void setBcc(const QStringList&list);
61 const QStringList&Bcc()const; 61 const QStringList&Bcc()const;
62 const QBitArray&getFlags()const{return msg_flags;} 62 const QBitArray&getFlags()const{return msg_flags;}
63 void setFlags(const QBitArray&flags){msg_flags = flags;} 63 void setFlags(const QBitArray&flags){msg_flags = flags;}
64 64
65 void setWrapper(AbstractMail*wrapper); 65 void setWrapper(AbstractMail*wrapper);
66 AbstractMail* Wrapper(); 66 AbstractMail* Wrapper();
67 67
68protected: 68protected:
69 QString subject,date,from,mbox,msg_id,replyto; 69 QString subject,date,from,mbox,msg_id,replyto;
70 int msg_number,msg_size; 70 int msg_number,msg_size;
71 QBitArray msg_flags; 71 QBitArray msg_flags;
72 QStringList to,cc,bcc; 72 QStringList to,cc,bcc;
73 AbstractMail*wrapper; 73 AbstractMail*wrapper;
74 void init(); 74 void init();
75 void copy_old(const RecMail&old); 75 void copy_old(const RecMail&old);
76}; 76};
77 77
78typedef QMap<QString,QString> part_plist_t; 78typedef QMap<QString,QString> part_plist_t;
79 79
80class RecPart 80class RecPart
81{ 81{
82protected: 82protected:
83 QString m_type,m_subtype,m_identifier,m_encoding; 83 QString m_type,m_subtype,m_identifier,m_encoding,m_description;
84 unsigned int m_lines,m_size; 84 unsigned int m_lines,m_size;
85 part_plist_t m_Parameters; 85 part_plist_t m_Parameters;
86 /* describes the position in the mail */ 86 /* describes the position in the mail */
87 QValueList<int> m_poslist; 87 QValueList<int> m_poslist;
88 88
89public: 89public:
90 RecPart(); 90 RecPart();
91 virtual ~RecPart(); 91 virtual ~RecPart();
92 92
93 const QString&Type()const; 93 const QString&Type()const;
94 void setType(const QString&type); 94 void setType(const QString&type);
95 const QString&Subtype()const; 95 const QString&Subtype()const;
96 void setSubtype(const QString&subtype); 96 void setSubtype(const QString&subtype);
97 const QString&Identifier()const; 97 const QString&Identifier()const;
98 void setIdentifier(const QString&identifier); 98 void setIdentifier(const QString&identifier);
99 const QString&Encoding()const; 99 const QString&Encoding()const;
100 void setEncoding(const QString&encoding); 100 void setEncoding(const QString&encoding);
101 const QString&Description()const;
102 void setDescription(const QString&desc);
101 void setLines(unsigned int lines); 103 void setLines(unsigned int lines);
102 const unsigned int Lines()const; 104 const unsigned int Lines()const;
103 void setSize(unsigned int size); 105 void setSize(unsigned int size);
104 const unsigned int Size()const; 106 const unsigned int Size()const;
105 107
106 108
107 void setParameters(const part_plist_t&list); 109 void setParameters(const part_plist_t&list);
108 const part_plist_t&Parameters()const; 110 const part_plist_t&Parameters()const;
109 void addParameter(const QString&key,const QString&value); 111 void addParameter(const QString&key,const QString&value);
110 const QString searchParamter(const QString&key)const; 112 const QString searchParamter(const QString&key)const;
111 void setPositionlist(const QValueList<int>&poslist); 113 void setPositionlist(const QValueList<int>&poslist);
112 const QValueList<int>& Positionlist()const; 114 const QValueList<int>& Positionlist()const;
113}; 115};
114 116
115class RecBody 117class RecBody
116{ 118{
117protected: 119protected:
118 QString m_BodyText; 120 QString m_BodyText;
119 QValueList<RecPart> m_PartsList; 121 QValueList<RecPart> m_PartsList;
120 RecPart m_description; 122 RecPart m_description;
121 123
122public: 124public:
123 RecBody(); 125 RecBody();
124 virtual ~RecBody(); 126 virtual ~RecBody();
125 void setBodytext(const QString&); 127 void setBodytext(const QString&);
126 const QString& Bodytext()const; 128 const QString& Bodytext()const;
127 129
128 void setDescription(const RecPart&des); 130 void setDescription(const RecPart&des);
129 const RecPart& Description()const; 131 const RecPart& Description()const;
130 132
131 void setParts(const QValueList<RecPart>&parts); 133 void setParts(const QValueList<RecPart>&parts);
132 const QValueList<RecPart>& Parts()const; 134 const QValueList<RecPart>& Parts()const;
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp
index fae3e97..8e2132e 100644
--- a/noncore/net/mail/mainwindow.cpp
+++ b/noncore/net/mail/mainwindow.cpp
@@ -170,53 +170,55 @@ void MainWindow::displayMail(QListViewItem*item)
170 ViewMail readMail( this ); 170 ViewMail readMail( this );
171 readMail.setBody( body ); 171 readMail.setBody( body );
172 readMail.setMail( mail ); 172 readMail.setMail( mail );
173 readMail.showMaximized(); 173 readMail.showMaximized();
174 readMail.exec(); 174 readMail.exec();
175 175
176 if ( readMail.deleted ) { 176 if ( readMail.deleted ) {
177 folderView->refreshCurrent(); 177 folderView->refreshCurrent();
178 } else { 178 } else {
179 ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgunseen") ); 179 ( (MailListViewItem*)item )->setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgunseen") );
180 } 180 }
181} 181}
182 182
183void MainWindow::slotDeleteMail() 183void MainWindow::slotDeleteMail()
184{ 184{
185 if (!mailView->currentItem()) return; 185 if (!mailView->currentItem()) return;
186 RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data(); 186 RecMail mail = ((MailListViewItem*)mailView->currentItem() )->data();
187 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 ) { 187 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 ) {
188 mail.Wrapper()->deleteMail( mail ); 188 mail.Wrapper()->deleteMail( mail );
189 folderView->refreshCurrent(); 189 folderView->refreshCurrent();
190 } 190 }
191} 191}
192 192
193 193
194 194
195MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) 195MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item )
196 :QListViewItem(parent,item),mail_data() 196 :QListViewItem(parent,item),mail_data()
197{ 197{
198} 198}
199 199
200void MailListViewItem::showEntry() 200void MailListViewItem::showEntry()
201{ 201{
202 if ( mail_data.getFlags().testBit( FLAG_SEEN ) == true ) { 202 if ( mail_data.getFlags().testBit( FLAG_ANSWERED ) == true) {
203 setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgreplied") );
204 } else if ( mail_data.getFlags().testBit( FLAG_SEEN ) == true ) {
203 setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgunseen") ); 205 setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgunseen") );
204 } else { 206 } else {
205 setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgnew") ); 207 setPixmap( 0, Resource::loadPixmap( "opiemail/kmmsgnew") );
206 } 208 }
207 setText(1,mail_data.getSubject()); 209 setText(1,mail_data.getSubject());
208 setText(2,mail_data.getFrom()); 210 setText(2,mail_data.getFrom());
209 setText(3,mail_data.getDate()); 211 setText(3,mail_data.getDate());
210} 212}
211 213
212void MailListViewItem::storeData(const RecMail&data) 214void MailListViewItem::storeData(const RecMail&data)
213{ 215{
214 mail_data = data; 216 mail_data = data;
215} 217}
216 218
217const RecMail& MailListViewItem::data()const 219const RecMail& MailListViewItem::data()const
218{ 220{
219 return mail_data; 221 return mail_data;
220} 222}
221 223
222 224
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp
index 68d3c51..48b71eb 100644
--- a/noncore/net/mail/viewmail.cpp
+++ b/noncore/net/mail/viewmail.cpp
@@ -1,158 +1,166 @@
1#include <qtextbrowser.h> 1#include <qtextbrowser.h>
2#include <qmessagebox.h> 2#include <qmessagebox.h>
3#include <qtextstream.h> 3#include <qtextstream.h>
4#include <qaction.h> 4#include <qaction.h>
5#include <qpopupmenu.h> 5#include <qpopupmenu.h>
6#include <qapplication.h> 6#include <qapplication.h>
7 7
8#include <opie/ofiledialog.h> 8#include <opie/ofiledialog.h>
9 9
10#include "settings.h" 10#include "settings.h"
11#include "composemail.h" 11#include "composemail.h"
12#include "viewmail.h" 12#include "viewmail.h"
13#include "abstractmail.h" 13#include "abstractmail.h"
14#include "accountview.h" 14#include "accountview.h"
15 15
16AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&file,const QString&desc,int num) 16AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
17 const QString&fsize,int num)
17 : QListViewItem(parent,after),_partNum(num) 18 : QListViewItem(parent,after),_partNum(num)
18{ 19{
19 setText(0, mime); 20 setText(0, mime);
20 setText(1, file); 21 setText(1, desc);
21 setText(2, desc); 22 setText(2, file);
23 setText(3, fsize);
22} 24}
23 25
24void ViewMail::setBody( RecBody body ) { 26void ViewMail::setBody( RecBody body ) {
25 27
26m_body = body; 28m_body = body;
27m_mail[2] = body.Bodytext(); 29m_mail[2] = body.Bodytext();
28attachbutton->setEnabled(body.Parts().count()>0); 30attachbutton->setEnabled(body.Parts().count()>0);
29attachments->setEnabled(body.Parts().count()>0); 31attachments->setEnabled(body.Parts().count()>0);
30if (body.Parts().count()==0) { 32if (body.Parts().count()==0) {
31 return; 33 return;
32} 34}
33AttachItem * curItem=0; 35AttachItem * curItem=0;
34QString type=body.Description().Type()+"/"+body.Description().Subtype(); 36QString type=body.Description().Type()+"/"+body.Description().Subtype();
35QString desc; 37QString desc,fsize;
36double s = body.Description().Size(); 38double s = body.Description().Size();
37int w; 39int w;
38w=0; 40w=0;
39 41
40while (s>1024) { 42while (s>1024) {
41 s/=1024; 43 s/=1024;
42 ++w; 44 ++w;
43 if (w>=2) break; 45 if (w>=2) break;
44} 46}
45 47
46QString q=""; 48QString q="";
47switch(w) { 49switch(w) {
48case 1: 50case 1:
49 q="k"; 51 q="k";
50 break; 52 break;
51case 2: 53case 2:
52 q="M"; 54 q="M";
53 break; 55 break;
54default: 56default:
55 break; 57 break;
56} 58}
57 59
58{ 60{
59 /* I did not found a method to make a CONTENT reset on a QTextStream 61 /* I did not found a method to make a CONTENT reset on a QTextStream
60 so I use this construct that the stream will re-constructed in each 62 so I use this construct that the stream will re-constructed in each
61 loop. To let it work, the textstream is packed into a own area of 63 loop. To let it work, the textstream is packed into a own area of
62 code is it will be destructed after finishing its small job. 64 code is it will be destructed after finishing its small job.
63 */ 65 */
64 QTextOStream o(&desc); 66 QTextOStream o(&fsize);
65 if (w>0) o.precision(2); else o.precision(0); 67 if (w>0) o.precision(2); else o.precision(0);
66 o.setf(QTextStream::fixed); 68 o.setf(QTextStream::fixed);
67 o << s << " " << q << "Byte"; 69 o << s << " " << q << "Byte";
68} 70}
69 71
70curItem=new AttachItem(attachments,curItem,type,"Mailbody",desc,-1); 72curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1);
71QString filename = ""; 73QString filename = "";
72for (unsigned int i = 0; i < body.Parts().count();++i) { 74for (unsigned int i = 0; i < body.Parts().count();++i) {
73 type = body.Parts()[i].Type()+"/"+body.Parts()[i].Subtype(); 75 type = body.Parts()[i].Type()+"/"+body.Parts()[i].Subtype();
74 part_plist_t::ConstIterator it = body.Parts()[i].Parameters().begin(); 76 part_plist_t::ConstIterator it = body.Parts()[i].Parameters().begin();
75 for (;it!=body.Parts()[i].Parameters().end();++it) { 77 for (;it!=body.Parts()[i].Parameters().end();++it) {
78 qDebug(it.key());
76 if (it.key().lower()=="name") { 79 if (it.key().lower()=="name") {
77 filename=it.data(); 80 filename=it.data();
78 } 81 }
79 } 82 }
80 s = body.Parts()[i].Size(); 83 s = body.Parts()[i].Size();
81 w = 0; 84 w = 0;
82 while (s>1024) { 85 while (s>1024) {
83 s/=1024; 86 s/=1024;
84 ++w; 87 ++w;
85 if (w>=2) break; 88 if (w>=2) break;
86 } 89 }
87 switch(w) { 90 switch(w) {
88 case 1: 91 case 1:
89 q="k"; 92 q="k";
90 break; 93 break;
91 case 2: 94 case 2:
92 q="M"; 95 q="M";
93 break; 96 break;
94 default: 97 default:
95 q=""; 98 q="";
96 break; 99 break;
97 } 100 }
98 QTextOStream o(&desc); 101 QTextOStream o(&fsize);
99 if (w>0) o.precision(2); else o.precision(0); 102 if (w>0) o.precision(2); else o.precision(0);
100 o.setf(QTextStream::fixed); 103 o.setf(QTextStream::fixed);
101 o << s << " " << q << "Byte"; 104 o << s << " " << q << "Byte";
102 curItem=new AttachItem(attachments,curItem,type,filename,desc,i); 105 desc = body.Parts()[i].Description();
106 curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i);
103} 107}
104} 108}
105 109
106void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int c ) { 110void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) {
107 if (!item ) 111 if (!item )
108 return; 112 return;
109 113
110 QPopupMenu *menu = new QPopupMenu(); 114 if ( ( ( AttachItem* )item )->Partnumber() == -1 ) {
115 setText();
116 return;
117 }
118 QPopupMenu *menu = new QPopupMenu();
111 int ret=0; 119 int ret=0;
112 120
113 if ( item->text( 0 ).left( 4 ) == "text" ) { 121 if ( item->text( 0 ).left( 5 ) == "text/" ) {
114 menu->insertItem( tr( "Show Text" ), 1 ); 122 menu->insertItem( tr( "Show Text" ), 1 );
115 } 123 }
116 menu->insertItem( tr( "Save Attachment" ), 0 ); 124 menu->insertItem( tr( "Save Attachment" ), 0 );
117 menu->insertSeparator(1); 125 menu->insertSeparator(1);
118 126
119 ret = menu->exec( point, 0 ); 127 ret = menu->exec( point, 0 );
120 128
121 switch(ret) { 129 switch(ret) {
122 case 0: 130 case 0:
123 { MimeTypes types; 131 { MimeTypes types;
124 types.insert( "all", "*" ); 132 types.insert( "all", "*" );
125 QString str = OFileDialog::getSaveFileName( 1, 133 QString str = OFileDialog::getSaveFileName( 1,
126 "/", item->text( 1 ) , types, 0 ); 134 "/", item->text( 2 ) , types, 0 );
127 135
128 if( !str.isEmpty() ) { 136 if( !str.isEmpty() ) {
129 qDebug( "first we will need a MIME wrapper" ); 137 qDebug( "first we will need a MIME wrapper" );
130 } 138 }
131 } 139 }
132 break ; 140 break ;
133 141
134 case 1: 142 case 1:
135 if ( ( ( AttachItem* )item )->Partnumber() == -1 ) { 143 if ( ( ( AttachItem* )item )->Partnumber() == -1 ) {
136 setText(); 144 setText();
137 } else { 145 } else {
138 if ( m_recMail.Wrapper() != 0l ) { // make sure that there is a wrapper , even after delete or simular actions 146 if ( m_recMail.Wrapper() != 0l ) { // make sure that there is a wrapper , even after delete or simular actions
139 browser->setText( m_recMail.Wrapper()->fetchPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); 147 browser->setText( m_recMail.Wrapper()->fetchPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) );
140 } 148 }
141 } 149 }
142 break; 150 break;
143 } 151 }
144 delete menu; 152 delete menu;
145} 153}
146 154
147 155
148void ViewMail::setMail( RecMail mail ) { 156void ViewMail::setMail( RecMail mail ) {
149 157
150m_recMail = mail; 158m_recMail = mail;
151 159
152m_mail[0] = mail.getFrom(); 160m_mail[0] = mail.getFrom();
153m_mail[1] = mail.getSubject(); 161m_mail[1] = mail.getSubject();
154m_mail[3] = mail.getDate(); 162m_mail[3] = mail.getDate();
155m_mail[4] = mail.Msgid(); 163m_mail[4] = mail.Msgid();
156 164
157m_mail2[0] = mail.To(); 165m_mail2[0] = mail.To();
158m_mail2[1] = mail.CC(); 166m_mail2[1] = mail.CC();
diff --git a/noncore/net/mail/viewmail.h b/noncore/net/mail/viewmail.h
index 765464c..dd7f854 100644
--- a/noncore/net/mail/viewmail.h
+++ b/noncore/net/mail/viewmail.h
@@ -1,46 +1,47 @@
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
11class AttachItem : public QListViewItem 11class AttachItem : public QListViewItem
12{ 12{
13public: 13public:
14 AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&file,const QString&desc,int num); 14 AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
15 const QString&fsize,int num);
15 int Partnumber() { return _partNum; } 16 int Partnumber() { return _partNum; }
16 17
17private: 18private:
18 int _partNum; 19 int _partNum;
19}; 20};
20 21
21class ViewMail : public ViewMailBase 22class ViewMail : public ViewMailBase
22{ 23{
23 Q_OBJECT 24 Q_OBJECT
24 25
25public: 26public:
26 ViewMail( QWidget *parent = 0, const char *name = 0, WFlags fl = Qt::WType_Modal); 27 ViewMail( QWidget *parent = 0, const char *name = 0, WFlags fl = Qt::WType_Modal);
27 ~ViewMail(); 28 ~ViewMail();
28 29
29 void hide(); 30 void hide();
30 void exec(); 31 void exec();
31 void setMail( RecMail mail ); 32 void setMail( RecMail mail );
32 void setBody( RecBody body ); 33 void setBody( RecBody body );
33 bool deleted; 34 bool deleted;
34 35
35protected: 36protected:
36 QString deHtml(const QString &string); 37 QString deHtml(const QString &string);
37 38
38protected slots: 39protected slots:
39 void slotReply(); 40 void slotReply();
40 void slotForward(); 41 void slotForward();
41 void setText(); 42 void setText();
42 void slotItemClicked( QListViewItem * item , const QPoint & point, int c ); 43 void slotItemClicked( QListViewItem * item , const QPoint & point, int c );
43 void slotDeleteMail( ); 44 void slotDeleteMail( );
44 45
45 46
46private: 47private:
diff --git a/noncore/net/mail/viewmailbase.cpp b/noncore/net/mail/viewmailbase.cpp
index 38f92b4..0c7f671 100644
--- a/noncore/net/mail/viewmailbase.cpp
+++ b/noncore/net/mail/viewmailbase.cpp
@@ -26,51 +26,52 @@ ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl)
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", 60); 57 attachments->addColumn("Mime Type", 60);
58 attachments->addColumn(tr("Filename"), 100); 58 attachments->addColumn(tr("Description"), 100);
59 attachments->addColumn(tr("Size"), 80); 59 attachments->addColumn(tr("Filename"), 80);
60 attachments->addColumn(tr("Size"), 80);
60 attachments->setSorting(-1); 61 attachments->setSorting(-1);
61 attachments->hide(); 62 attachments->hide();
62 63
63 browser = new QTextBrowser(view); 64 browser = new QTextBrowser(view);
64 65
65 //openDiag = new OpenDiag(view); 66 //openDiag = new OpenDiag(view);
66 //openDiag->hide(); 67 //openDiag->hide();
67 68
68} 69}
69 70
70void ViewMailBase::slotChangeAttachview(bool state) 71void ViewMailBase::slotChangeAttachview(bool state)
71{ 72{
72 if (state) attachments->show(); 73 if (state) attachments->show();
73 else attachments->hide(); 74 else attachments->hide();
74} 75}
75 76
76 77