author | alwin <alwin> | 2003-12-14 22:30:26 (UTC) |
---|---|---|
committer | alwin <alwin> | 2003-12-14 22:30:26 (UTC) |
commit | bdc60d27df0fa3a861e9117547fd2bed8a39661e (patch) (unidiff) | |
tree | 8dba1e590e60443ec0aff14398da665d351b0aa4 | |
parent | 172c790df9004205eda2da25832cdc88fc6481ee (diff) | |
download | opie-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
-rw-r--r-- | noncore/net/mail/imapwrapper.cpp | 5 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 5 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailtypes.cpp | 12 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailtypes.h | 4 | ||||
-rw-r--r-- | noncore/net/mail/mailtypes.cpp | 12 | ||||
-rw-r--r-- | noncore/net/mail/mailtypes.h | 4 | ||||
-rw-r--r-- | noncore/net/mail/mainwindow.cpp | 4 | ||||
-rw-r--r-- | noncore/net/mail/viewmail.cpp | 32 | ||||
-rw-r--r-- | noncore/net/mail/viewmail.h | 3 | ||||
-rw-r--r-- | noncore/net/mail/viewmailbase.cpp | 5 |
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 | |||
@@ -691,16 +691,19 @@ void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which) | |||
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 | ||
703 | QString IMAPwrapper::fetchPart(const RecMail&mail,const RecPart&part) | 706 | QString 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 | } |
@@ -755,17 +758,17 @@ void IMAPwrapper::answeredMail(const RecMail&mail) | |||
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; |
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 | |||
@@ -691,16 +691,19 @@ void IMAPwrapper::fillBodyFields(RecPart&target_part,mailimap_body_fields*which) | |||
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 | ||
703 | QString IMAPwrapper::fetchPart(const RecMail&mail,const RecPart&part) | 706 | QString 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 | } |
@@ -755,17 +758,17 @@ void IMAPwrapper::answeredMail(const RecMail&mail) | |||
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; |
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 | |||
@@ -80,17 +80,17 @@ void RecMail::setBcc(const QStringList&list) | |||
80 | } | 80 | } |
81 | 81 | ||
82 | const QStringList& RecMail::Bcc()const | 82 | const QStringList& RecMail::Bcc()const |
83 | { | 83 | { |
84 | return bcc; | 84 | return bcc; |
85 | } | 85 | } |
86 | 86 | ||
87 | RecPart::RecPart() | 87 | RecPart::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 | ||
94 | RecPart::~RecPart() | 94 | RecPart::~RecPart() |
95 | { | 95 | { |
96 | } | 96 | } |
@@ -150,16 +150,26 @@ const QString& RecPart::Encoding()const | |||
150 | return m_encoding; | 150 | return m_encoding; |
151 | } | 151 | } |
152 | 152 | ||
153 | void RecPart::setEncoding(const QString&encoding) | 153 | void RecPart::setEncoding(const QString&encoding) |
154 | { | 154 | { |
155 | m_encoding = encoding; | 155 | m_encoding = encoding; |
156 | } | 156 | } |
157 | 157 | ||
158 | const QString& RecPart::Description()const | ||
159 | { | ||
160 | return m_description; | ||
161 | } | ||
162 | |||
163 | void RecPart::setDescription(const QString&desc) | ||
164 | { | ||
165 | m_description = desc; | ||
166 | } | ||
167 | |||
158 | void RecPart::setParameters(const part_plist_t&list) | 168 | void RecPart::setParameters(const part_plist_t&list) |
159 | { | 169 | { |
160 | m_Parameters = list; | 170 | m_Parameters = list; |
161 | } | 171 | } |
162 | 172 | ||
163 | const part_plist_t& RecPart::Parameters()const | 173 | const part_plist_t& RecPart::Parameters()const |
164 | { | 174 | { |
165 | return m_Parameters; | 175 | return m_Parameters; |
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 | |||
@@ -75,17 +75,17 @@ protected: | |||
75 | void copy_old(const RecMail&old); | 75 | void copy_old(const RecMail&old); |
76 | }; | 76 | }; |
77 | 77 | ||
78 | typedef QMap<QString,QString> part_plist_t; | 78 | typedef QMap<QString,QString> part_plist_t; |
79 | 79 | ||
80 | class RecPart | 80 | class RecPart |
81 | { | 81 | { |
82 | protected: | 82 | protected: |
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 | ||
89 | public: | 89 | public: |
90 | RecPart(); | 90 | RecPart(); |
91 | virtual ~RecPart(); | 91 | virtual ~RecPart(); |
@@ -93,16 +93,18 @@ public: | |||
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; |
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 | |||
@@ -80,17 +80,17 @@ void RecMail::setBcc(const QStringList&list) | |||
80 | } | 80 | } |
81 | 81 | ||
82 | const QStringList& RecMail::Bcc()const | 82 | const QStringList& RecMail::Bcc()const |
83 | { | 83 | { |
84 | return bcc; | 84 | return bcc; |
85 | } | 85 | } |
86 | 86 | ||
87 | RecPart::RecPart() | 87 | RecPart::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 | ||
94 | RecPart::~RecPart() | 94 | RecPart::~RecPart() |
95 | { | 95 | { |
96 | } | 96 | } |
@@ -150,16 +150,26 @@ const QString& RecPart::Encoding()const | |||
150 | return m_encoding; | 150 | return m_encoding; |
151 | } | 151 | } |
152 | 152 | ||
153 | void RecPart::setEncoding(const QString&encoding) | 153 | void RecPart::setEncoding(const QString&encoding) |
154 | { | 154 | { |
155 | m_encoding = encoding; | 155 | m_encoding = encoding; |
156 | } | 156 | } |
157 | 157 | ||
158 | const QString& RecPart::Description()const | ||
159 | { | ||
160 | return m_description; | ||
161 | } | ||
162 | |||
163 | void RecPart::setDescription(const QString&desc) | ||
164 | { | ||
165 | m_description = desc; | ||
166 | } | ||
167 | |||
158 | void RecPart::setParameters(const part_plist_t&list) | 168 | void RecPart::setParameters(const part_plist_t&list) |
159 | { | 169 | { |
160 | m_Parameters = list; | 170 | m_Parameters = list; |
161 | } | 171 | } |
162 | 172 | ||
163 | const part_plist_t& RecPart::Parameters()const | 173 | const part_plist_t& RecPart::Parameters()const |
164 | { | 174 | { |
165 | return m_Parameters; | 175 | return m_Parameters; |
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 | |||
@@ -75,17 +75,17 @@ protected: | |||
75 | void copy_old(const RecMail&old); | 75 | void copy_old(const RecMail&old); |
76 | }; | 76 | }; |
77 | 77 | ||
78 | typedef QMap<QString,QString> part_plist_t; | 78 | typedef QMap<QString,QString> part_plist_t; |
79 | 79 | ||
80 | class RecPart | 80 | class RecPart |
81 | { | 81 | { |
82 | protected: | 82 | protected: |
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 | ||
89 | public: | 89 | public: |
90 | RecPart(); | 90 | RecPart(); |
91 | virtual ~RecPart(); | 91 | virtual ~RecPart(); |
@@ -93,16 +93,18 @@ public: | |||
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; |
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 | |||
@@ -194,17 +194,19 @@ void MainWindow::slotDeleteMail() | |||
194 | 194 | ||
195 | MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) | 195 | MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) |
196 | :QListViewItem(parent,item),mail_data() | 196 | :QListViewItem(parent,item),mail_data() |
197 | { | 197 | { |
198 | } | 198 | } |
199 | 199 | ||
200 | void MailListViewItem::showEntry() | 200 | void 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 | } |
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 | |||
@@ -8,36 +8,38 @@ | |||
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 | ||
16 | AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&file,const QString&desc,int num) | 16 | AttachItem::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 | ||
24 | void ViewMail::setBody( RecBody body ) { | 26 | void ViewMail::setBody( RecBody body ) { |
25 | 27 | ||
26 | m_body = body; | 28 | m_body = body; |
27 | m_mail[2] = body.Bodytext(); | 29 | m_mail[2] = body.Bodytext(); |
28 | attachbutton->setEnabled(body.Parts().count()>0); | 30 | attachbutton->setEnabled(body.Parts().count()>0); |
29 | attachments->setEnabled(body.Parts().count()>0); | 31 | attachments->setEnabled(body.Parts().count()>0); |
30 | if (body.Parts().count()==0) { | 32 | if (body.Parts().count()==0) { |
31 | return; | 33 | return; |
32 | } | 34 | } |
33 | AttachItem * curItem=0; | 35 | AttachItem * curItem=0; |
34 | QString type=body.Description().Type()+"/"+body.Description().Subtype(); | 36 | QString type=body.Description().Type()+"/"+body.Description().Subtype(); |
35 | QString desc; | 37 | QString desc,fsize; |
36 | double s = body.Description().Size(); | 38 | double s = body.Description().Size(); |
37 | int w; | 39 | int w; |
38 | w=0; | 40 | w=0; |
39 | 41 | ||
40 | while (s>1024) { | 42 | while (s>1024) { |
41 | s/=1024; | 43 | s/=1024; |
42 | ++w; | 44 | ++w; |
43 | if (w>=2) break; | 45 | if (w>=2) break; |
@@ -56,28 +58,29 @@ default: | |||
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 | ||
70 | curItem=new AttachItem(attachments,curItem,type,"Mailbody",desc,-1); | 72 | curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1); |
71 | QString filename = ""; | 73 | QString filename = ""; |
72 | for (unsigned int i = 0; i < body.Parts().count();++i) { | 74 | for (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; |
@@ -90,45 +93,50 @@ for (unsigned int i = 0; i < body.Parts().count();++i) { | |||
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 | ||
106 | void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int c ) { | 110 | void 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: |
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 | |||
@@ -6,17 +6,18 @@ | |||
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 AttachItem : public QListViewItem | 11 | class AttachItem : public QListViewItem |
12 | { | 12 | { |
13 | public: | 13 | public: |
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 | ||
17 | private: | 18 | private: |
18 | int _partNum; | 19 | int _partNum; |
19 | }; | 20 | }; |
20 | 21 | ||
21 | class ViewMail : public ViewMailBase | 22 | class ViewMail : public ViewMailBase |
22 | { | 23 | { |
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 | |||
@@ -50,18 +50,19 @@ ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl) | |||
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 | ||