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
@@ -683,32 +683,35 @@ void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which)
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();
@@ -747,27 +750,27 @@ void IMAPwrapper::answeredMail(const RecMail&mail)
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
@@ -683,32 +683,35 @@ void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which)
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();
@@ -747,27 +750,27 @@ void IMAPwrapper::answeredMail(const RecMail&mail)
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
@@ -72,33 +72,33 @@ void RecMail::setCC(const QStringList&list)
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{
@@ -142,32 +142,42 @@ const QString& RecPart::Identifier()const
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
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
@@ -67,50 +67,52 @@ public:
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{
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
@@ -72,33 +72,33 @@ void RecMail::setCC(const QStringList&list)
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{
@@ -142,32 +142,42 @@ const QString& RecPart::Identifier()const
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
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
@@ -67,50 +67,52 @@ public:
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{
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
@@ -186,33 +186,35 @@ void MainWindow::slotDeleteMail()
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{
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,142 +1,150 @@
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;
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,30 +1,31 @@
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();
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
@@ -42,34 +42,35 @@ ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl)
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