-rw-r--r-- | noncore/net/mail/viewmail.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp index 48b71eb..0947879 100644 --- a/noncore/net/mail/viewmail.cpp +++ b/noncore/net/mail/viewmail.cpp | |||
@@ -1,20 +1,22 @@ | |||
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 <qfile.h> | ||
6 | #include <qapplication.h> | 7 | #include <qapplication.h> |
7 | 8 | ||
8 | #include <opie/ofiledialog.h> | 9 | #include <opie/ofiledialog.h> |
9 | 10 | ||
10 | #include "settings.h" | 11 | #include "settings.h" |
11 | #include "composemail.h" | 12 | #include "composemail.h" |
12 | #include "viewmail.h" | 13 | #include "viewmail.h" |
13 | #include "abstractmail.h" | 14 | #include "abstractmail.h" |
14 | #include "accountview.h" | 15 | #include "accountview.h" |
16 | #include "mailtypes.h" | ||
15 | 17 | ||
16 | AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, | 18 | AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, |
17 | const QString&fsize,int num) | 19 | const QString&fsize,int num) |
18 | : QListViewItem(parent,after),_partNum(num) | 20 | : QListViewItem(parent,after),_partNum(num) |
19 | { | 21 | { |
20 | setText(0, mime); | 22 | setText(0, mime); |
@@ -131,23 +133,30 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int | |||
131 | { MimeTypes types; | 133 | { MimeTypes types; |
132 | types.insert( "all", "*" ); | 134 | types.insert( "all", "*" ); |
133 | QString str = OFileDialog::getSaveFileName( 1, | 135 | QString str = OFileDialog::getSaveFileName( 1, |
134 | "/", item->text( 2 ) , types, 0 ); | 136 | "/", item->text( 2 ) , types, 0 ); |
135 | 137 | ||
136 | if( !str.isEmpty() ) { | 138 | if( !str.isEmpty() ) { |
137 | qDebug( "first we will need a MIME wrapper" ); | 139 | encodedString*content = m_recMail.Wrapper()->fetchDecodedPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); |
140 | if (content) { | ||
141 | QFile output(str); | ||
142 | output.open(IO_WriteOnly); | ||
143 | output.writeBlock(content->Content(),content->Length()); | ||
144 | output.close(); | ||
145 | delete content; | ||
146 | } | ||
138 | } | 147 | } |
139 | } | 148 | } |
140 | break ; | 149 | break ; |
141 | 150 | ||
142 | case 1: | 151 | case 1: |
143 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) { | 152 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) { |
144 | setText(); | 153 | setText(); |
145 | } else { | 154 | } else { |
146 | if ( m_recMail.Wrapper() != 0l ) { // make sure that there is a wrapper , even after delete or simular actions | 155 | if ( m_recMail.Wrapper() != 0l ) { // make sure that there is a wrapper , even after delete or simular actions |
147 | browser->setText( m_recMail.Wrapper()->fetchPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); | 156 | browser->setText( m_recMail.Wrapper()->fetchTextPart( m_recMail, m_body.Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) ); |
148 | } | 157 | } |
149 | } | 158 | } |
150 | break; | 159 | break; |
151 | } | 160 | } |
152 | delete menu; | 161 | delete menu; |
153 | } | 162 | } |