-rw-r--r-- | noncore/net/mail/viewmail.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp index 0ad7359..d2e5e29 100644 --- a/noncore/net/mail/viewmail.cpp +++ b/noncore/net/mail/viewmail.cpp | |||
@@ -67,129 +67,129 @@ default: | |||
67 | loop. To let it work, the textstream is packed into a own area of | 67 | loop. To let it work, the textstream is packed into a own area of |
68 | code is it will be destructed after finishing its small job. | 68 | code is it will be destructed after finishing its small job. |
69 | */ | 69 | */ |
70 | QTextOStream o(&fsize); | 70 | QTextOStream o(&fsize); |
71 | if (w>0) o.precision(2); else o.precision(0); | 71 | if (w>0) o.precision(2); else o.precision(0); |
72 | o.setf(QTextStream::fixed); | 72 | o.setf(QTextStream::fixed); |
73 | o << s << " " << q << "Byte"; | 73 | o << s << " " << q << "Byte"; |
74 | } | 74 | } |
75 | 75 | ||
76 | curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1); | 76 | curItem=new AttachItem(attachments,curItem,type,"Mailbody","",fsize,-1); |
77 | QString filename = ""; | 77 | QString filename = ""; |
78 | for (unsigned int i = 0; i < body.Parts().count();++i) { | 78 | for (unsigned int i = 0; i < body.Parts().count();++i) { |
79 | type = body.Parts()[i].Type()+"/"+body.Parts()[i].Subtype(); | 79 | type = body.Parts()[i].Type()+"/"+body.Parts()[i].Subtype(); |
80 | part_plist_t::ConstIterator it = body.Parts()[i].Parameters().begin(); | 80 | part_plist_t::ConstIterator it = body.Parts()[i].Parameters().begin(); |
81 | for (;it!=body.Parts()[i].Parameters().end();++it) { | 81 | for (;it!=body.Parts()[i].Parameters().end();++it) { |
82 | qDebug(it.key()); | 82 | qDebug(it.key()); |
83 | if (it.key().lower()=="name") { | 83 | if (it.key().lower()=="name") { |
84 | filename=it.data(); | 84 | filename=it.data(); |
85 | } | 85 | } |
86 | } | 86 | } |
87 | s = body.Parts()[i].Size(); | 87 | s = body.Parts()[i].Size(); |
88 | w = 0; | 88 | w = 0; |
89 | while (s>1024) { | 89 | while (s>1024) { |
90 | s/=1024; | 90 | s/=1024; |
91 | ++w; | 91 | ++w; |
92 | if (w>=2) break; | 92 | if (w>=2) break; |
93 | } | 93 | } |
94 | switch(w) { | 94 | switch(w) { |
95 | case 1: | 95 | case 1: |
96 | q="k"; | 96 | q="k"; |
97 | break; | 97 | break; |
98 | case 2: | 98 | case 2: |
99 | q="M"; | 99 | q="M"; |
100 | break; | 100 | break; |
101 | default: | 101 | default: |
102 | q=""; | 102 | q=""; |
103 | break; | 103 | break; |
104 | } | 104 | } |
105 | QTextOStream o(&fsize); | 105 | QTextOStream o(&fsize); |
106 | if (w>0) o.precision(2); else o.precision(0); | 106 | if (w>0) o.precision(2); else o.precision(0); |
107 | o.setf(QTextStream::fixed); | 107 | o.setf(QTextStream::fixed); |
108 | o << s << " " << q << "Byte"; | 108 | o << s << " " << q << "Byte"; |
109 | desc = body.Parts()[i].Description(); | 109 | desc = body.Parts()[i].Description(); |
110 | curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i); | 110 | curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i); |
111 | } | 111 | } |
112 | } | 112 | } |
113 | 113 | ||
114 | 114 | ||
115 | void ViewMail::slotShowHtml( bool state ) { | 115 | void ViewMail::slotShowHtml( bool state ) { |
116 | m_showHtml = state; | 116 | m_showHtml = state; |
117 | setText(); | 117 | setText(); |
118 | } | 118 | } |
119 | 119 | ||
120 | void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) { | 120 | void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int ) { |
121 | if (!item ) | 121 | if (!item ) |
122 | return; | 122 | return; |
123 | 123 | ||
124 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) { | 124 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) { |
125 | setText(); | 125 | setText(); |
126 | return; | 126 | return; |
127 | } | 127 | } |
128 | QPopupMenu *menu = new QPopupMenu(); | 128 | QPopupMenu *menu = new QPopupMenu(); |
129 | int ret=0; | 129 | int ret=0; |
130 | 130 | ||
131 | if ( item->text( 0 ).left( 5 ) == "text/" ) { | 131 | if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" ) { |
132 | menu->insertItem( tr( "Show Text" ), 1 ); | 132 | menu->insertItem( tr( "Show Text" ), 1 ); |
133 | } | 133 | } |
134 | menu->insertItem( tr( "Save Attachment" ), 0 ); | 134 | menu->insertItem( tr( "Save Attachment" ), 0 ); |
135 | menu->insertSeparator(1); | 135 | menu->insertSeparator(1); |
136 | 136 | ||
137 | ret = menu->exec( point, 0 ); | 137 | ret = menu->exec( point, 0 ); |
138 | 138 | ||
139 | switch(ret) { | 139 | switch(ret) { |
140 | case 0: | 140 | case 0: |
141 | { MimeTypes types; | 141 | { MimeTypes types; |
142 | types.insert( "all", "*" ); | 142 | types.insert( "all", "*" ); |
143 | QString str = OFileDialog::getSaveFileName( 1, | 143 | QString str = OFileDialog::getSaveFileName( 1, |
144 | "/", item->text( 2 ) , types, 0 ); | 144 | "/", item->text( 2 ) , types, 0 ); |
145 | 145 | ||
146 | if( !str.isEmpty() ) { | 146 | if( !str.isEmpty() ) { |
147 | encodedString*content = m_recMail.Wrapper()->fetchDecodedPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); | 147 | encodedString*content = m_recMail.Wrapper()->fetchDecodedPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); |
148 | if (content) { | 148 | if (content) { |
149 | QFile output(str); | 149 | QFile output(str); |
150 | output.open(IO_WriteOnly); | 150 | output.open(IO_WriteOnly); |
151 | output.writeBlock(content->Content(),content->Length()); | 151 | output.writeBlock(content->Content(),content->Length()); |
152 | output.close(); | 152 | output.close(); |
153 | delete content; | 153 | delete content; |
154 | } | 154 | } |
155 | } | 155 | } |
156 | } | 156 | } |
157 | break ; | 157 | break ; |
158 | 158 | ||
159 | case 1: | 159 | case 1: |
160 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) { | 160 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) { |
161 | setText(); | 161 | setText(); |
162 | } else { | 162 | } else { |
163 | if ( m_recMail.Wrapper() != 0l ) { // make sure that there is a wrapper , even after delete or simular actions | 163 | if ( m_recMail.Wrapper() != 0l ) { // make sure that there is a wrapper , even after delete or simular actions |
164 | browser->setText( m_recMail.Wrapper()->fetchTextPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); | 164 | browser->setText( m_recMail.Wrapper()->fetchTextPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); |
165 | } | 165 | } |
166 | } | 166 | } |
167 | break; | 167 | break; |
168 | } | 168 | } |
169 | delete menu; | 169 | delete menu; |
170 | } | 170 | } |
171 | 171 | ||
172 | 172 | ||
173 | void ViewMail::setMail( RecMail mail ) { | 173 | void ViewMail::setMail( RecMail mail ) { |
174 | 174 | ||
175 | m_recMail = mail; | 175 | m_recMail = mail; |
176 | 176 | ||
177 | m_mail[0] = mail.getFrom(); | 177 | m_mail[0] = mail.getFrom(); |
178 | m_mail[1] = mail.getSubject(); | 178 | m_mail[1] = mail.getSubject(); |
179 | m_mail[3] = mail.getDate(); | 179 | m_mail[3] = mail.getDate(); |
180 | m_mail[4] = mail.Msgid(); | 180 | m_mail[4] = mail.Msgid(); |
181 | 181 | ||
182 | m_mail2[0] = mail.To(); | 182 | m_mail2[0] = mail.To(); |
183 | m_mail2[1] = mail.CC(); | 183 | m_mail2[1] = mail.CC(); |
184 | m_mail2[2] = mail.Bcc(); | 184 | m_mail2[2] = mail.Bcc(); |
185 | 185 | ||
186 | setText(); | 186 | setText(); |
187 | } | 187 | } |
188 | 188 | ||
189 | 189 | ||
190 | 190 | ||
191 | ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) | 191 | ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl) |
192 | : ViewMailBase(parent, name, fl), _inLoop(false) | 192 | : ViewMailBase(parent, name, fl), _inLoop(false) |
193 | { | 193 | { |
194 | m_gotBody = false; | 194 | m_gotBody = false; |
195 | deleted = false; | 195 | deleted = false; |