author | alwin <alwin> | 2004-04-14 22:36:20 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-04-14 22:36:20 (UTC) |
commit | 6439d07d42e10b0804a3a31fdfd6645b36d2fad5 (patch) (unidiff) | |
tree | 07ff558875de1ebe8235badaa3cab4205fa82089 /noncore/net/mail/viewmail.cpp | |
parent | 1b8fac62de40773977e9b3e800cf22cc42603ced (diff) | |
download | opie-6439d07d42e10b0804a3a31fdfd6645b36d2fad5.zip opie-6439d07d42e10b0804a3a31fdfd6645b36d2fad5.tar.gz opie-6439d07d42e10b0804a3a31fdfd6645b36d2fad5.tar.bz2 |
opiemail now displays images send with mail
Diffstat (limited to 'noncore/net/mail/viewmail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/viewmail.cpp | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp index 7267bcb..ce694d5 100644 --- a/noncore/net/mail/viewmail.cpp +++ b/noncore/net/mail/viewmail.cpp | |||
@@ -3,3 +3,2 @@ | |||
3 | 3 | ||
4 | /* OPIE */ | ||
5 | #include <libmailwrapper/settings.h> | 4 | #include <libmailwrapper/settings.h> |
@@ -8,4 +7,6 @@ | |||
8 | 7 | ||
8 | /* OPIE */ | ||
9 | #include <opie2/odebug.h> | 9 | #include <opie2/odebug.h> |
10 | #include <opie2/ofiledialog.h> | 10 | #include <opie2/ofiledialog.h> |
11 | #include <opie2/oimagescrollview.h> | ||
11 | #include <qpe/config.h> | 12 | #include <qpe/config.h> |
@@ -20,2 +21,3 @@ | |||
20 | #include <qfile.h> | 21 | #include <qfile.h> |
22 | #include <qlayout.h> | ||
21 | 23 | ||
@@ -215,2 +217,5 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int | |||
215 | } | 217 | } |
218 | if (item->text(0).left(6)=="image/") { | ||
219 | menu->insertItem(tr("Display image preview"),2); | ||
220 | } | ||
216 | menu->insertItem( tr( "Save Attachment" ), 0 ); | 221 | menu->insertItem( tr( "Save Attachment" ), 0 ); |
@@ -244,2 +249,19 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int | |||
244 | 249 | ||
250 | case 2: | ||
251 | { | ||
252 | QString tmpfile = "/tmp/opiemail-image"; | ||
253 | encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); | ||
254 | if (content) { | ||
255 | QFile output(tmpfile); | ||
256 | output.open(IO_WriteOnly); | ||
257 | output.writeBlock(content->Content(),content->Length()); | ||
258 | output.close(); | ||
259 | delete content; | ||
260 | MailImageDlg iview(""); | ||
261 | iview.setName(tmpfile); | ||
262 | QPEApplication::execDialog(&iview); | ||
263 | output.remove(); | ||
264 | } | ||
265 | } | ||
266 | break; | ||
245 | case 1: | 267 | case 1: |
@@ -480 +502,20 @@ void ViewMail::slotDeleteMail( ) | |||
480 | } | 502 | } |
503 | |||
504 | MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, WFlags f) | ||
505 | : Opie::Ui::ODialog(parent,name,modal,f) | ||
506 | { | ||
507 | QVBoxLayout*dlglayout = new QVBoxLayout(this); | ||
508 | dlglayout->setSpacing(2); | ||
509 | dlglayout->setMargin(1); | ||
510 | m_imageview = new Opie::MM::OImageScrollView(this); | ||
511 | dlglayout->addWidget(m_imageview); | ||
512 | } | ||
513 | |||
514 | MailImageDlg::~MailImageDlg() | ||
515 | { | ||
516 | } | ||
517 | |||
518 | void MailImageDlg::setName(const QString&fname) | ||
519 | { | ||
520 | m_imageview->setImage(fname); | ||
521 | } | ||