-rw-r--r-- | noncore/net/mail/viewmail.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp index 894a386..f00d2cb 100644 --- a/noncore/net/mail/viewmail.cpp +++ b/noncore/net/mail/viewmail.cpp | |||
@@ -1,44 +1,45 @@ | |||
1 | #include "composemail.h" | 1 | #include "composemail.h" |
2 | #include "viewmail.h" | 2 | #include "viewmail.h" |
3 | 3 | ||
4 | /* OPIE */ | 4 | /* OPIE */ |
5 | #include <libmailwrapper/settings.h> | 5 | #include <libmailwrapper/settings.h> |
6 | #include <libmailwrapper/abstractmail.h> | 6 | #include <libmailwrapper/abstractmail.h> |
7 | #include <libmailwrapper/mailtypes.h> | 7 | #include <libmailwrapper/mailtypes.h> |
8 | 8 | ||
9 | #include <opie2/ofiledialog.h> | 9 | #include <opie2/ofiledialog.h> |
10 | #include <qpe/config.h> | 10 | #include <qpe/config.h> |
11 | #include <qpe/qpeapplication.h> | 11 | #include <qpe/qpeapplication.h> |
12 | 12 | ||
13 | /* QT */ | 13 | /* QT */ |
14 | #include <qtextbrowser.h> | 14 | #include <qtextbrowser.h> |
15 | #include <qmessagebox.h> | 15 | #include <qmessagebox.h> |
16 | #include <qtextstream.h> | 16 | #include <qtextstream.h> |
17 | #include <qaction.h> | 17 | #include <qaction.h> |
18 | #include <qpopupmenu.h> | 18 | #include <qpopupmenu.h> |
19 | #include <qfile.h> | 19 | #include <qfile.h> |
20 | 20 | ||
21 | using namespace Opie::Ui; | ||
21 | AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, | 22 | AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, |
22 | const QString&fsize,int num,const QValueList<int>&path) | 23 | const QString&fsize,int num,const QValueList<int>&path) |
23 | : QListViewItem(parent,after),_partNum(num) | 24 | : QListViewItem(parent,after),_partNum(num) |
24 | { | 25 | { |
25 | _path=path; | 26 | _path=path; |
26 | setText(0, mime); | 27 | setText(0, mime); |
27 | setText(1, desc); | 28 | setText(1, desc); |
28 | setText(2, file); | 29 | setText(2, file); |
29 | setText(3, fsize); | 30 | setText(3, fsize); |
30 | } | 31 | } |
31 | 32 | ||
32 | AttachItem::AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, | 33 | AttachItem::AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, |
33 | const QString&fsize,int num,const QValueList<int>&path) | 34 | const QString&fsize,int num,const QValueList<int>&path) |
34 | : QListViewItem(parent,after),_partNum(num) | 35 | : QListViewItem(parent,after),_partNum(num) |
35 | { | 36 | { |
36 | _path=path; | 37 | _path=path; |
37 | setText(0, mime); | 38 | setText(0, mime); |
38 | setText(1, desc); | 39 | setText(1, desc); |
39 | setText(2, file); | 40 | setText(2, file); |
40 | setText(3, fsize); | 41 | setText(3, fsize); |
41 | } | 42 | } |
42 | 43 | ||
43 | bool AttachItem::isParentof(const QValueList<int>&path) | 44 | bool AttachItem::isParentof(const QValueList<int>&path) |
44 | { | 45 | { |
@@ -199,49 +200,49 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int | |||
199 | 200 | ||
200 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) | 201 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) |
201 | { | 202 | { |
202 | setText(); | 203 | setText(); |
203 | return; | 204 | return; |
204 | } | 205 | } |
205 | QPopupMenu *menu = new QPopupMenu(); | 206 | QPopupMenu *menu = new QPopupMenu(); |
206 | int ret=0; | 207 | int ret=0; |
207 | 208 | ||
208 | if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" ) | 209 | if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" ) |
209 | { | 210 | { |
210 | menu->insertItem( tr( "Show Text" ), 1 ); | 211 | menu->insertItem( tr( "Show Text" ), 1 ); |
211 | } | 212 | } |
212 | menu->insertItem( tr( "Save Attachment" ), 0 ); | 213 | menu->insertItem( tr( "Save Attachment" ), 0 ); |
213 | menu->insertSeparator(1); | 214 | menu->insertSeparator(1); |
214 | 215 | ||
215 | ret = menu->exec( point, 0 ); | 216 | ret = menu->exec( point, 0 ); |
216 | 217 | ||
217 | switch(ret) | 218 | switch(ret) |
218 | { | 219 | { |
219 | case 0: | 220 | case 0: |
220 | { | 221 | { |
221 | MimeTypes types; | 222 | MimeTypes types; |
222 | types.insert( "all", "*" ); | 223 | types.insert( "all", "*" ); |
223 | QString str = Opie::OFileDialog::getSaveFileName( 1, | 224 | QString str = OFileDialog::getSaveFileName( 1, |
224 | "/", item->text( 2 ) , types, 0 ); | 225 | "/", item->text( 2 ) , types, 0 ); |
225 | 226 | ||
226 | if( !str.isEmpty() ) | 227 | if( !str.isEmpty() ) |
227 | { | 228 | { |
228 | encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); | 229 | encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); |
229 | if (content) | 230 | if (content) |
230 | { | 231 | { |
231 | QFile output(str); | 232 | QFile output(str); |
232 | output.open(IO_WriteOnly); | 233 | output.open(IO_WriteOnly); |
233 | output.writeBlock(content->Content(),content->Length()); | 234 | output.writeBlock(content->Content(),content->Length()); |
234 | output.close(); | 235 | output.close(); |
235 | delete content; | 236 | delete content; |
236 | } | 237 | } |
237 | } | 238 | } |
238 | } | 239 | } |
239 | break ; | 240 | break ; |
240 | 241 | ||
241 | case 1: | 242 | case 1: |
242 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) | 243 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) |
243 | { | 244 | { |
244 | setText(); | 245 | setText(); |
245 | } | 246 | } |
246 | else | 247 | else |
247 | { | 248 | { |