From 6439d07d42e10b0804a3a31fdfd6645b36d2fad5 Mon Sep 17 00:00:00 2001 From: alwin Date: Wed, 14 Apr 2004 22:36:20 +0000 Subject: opiemail now displays images send with mail --- diff --git a/noncore/net/mail/mail.pro b/noncore/net/mail/mail.pro index 6969644..7b00c58 100644 --- a/noncore/net/mail/mail.pro +++ b/noncore/net/mail/mail.pro @@ -56,9 +56,9 @@ INCLUDEPATH += $(OPIEDIR)/include /usr/local/include CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX ) contains( CONFTEST, y ){ - LIBS += -lqpe -lopieui2 -lopiecore2 -lopiepim2 -lmailwrapper -liconv + LIBS += -lqpe -lopieui2 -lopiecore2 -lopiepim2 -lmailwrapper -liconv -lopiemm2 }else{ - LIBS += -lqpe -lopieui2 -lopiecore2 -lopiepim2 -lmailwrapper + LIBS += -lqpe -lopieui2 -lopiecore2 -lopiepim2 -lmailwrapper -lopiemm2 } TARGET = opiemail diff --git a/noncore/net/mail/opie-mail.control b/noncore/net/mail/opie-mail.control index 98cb3a4..1bb588a 100644 --- a/noncore/net/mail/opie-mail.control +++ b/noncore/net/mail/opie-mail.control @@ -5,6 +5,6 @@ Section: opie/pim Maintainer: Rajko Albrecht , Juergen Graf , Maximilian Reiß Architecture: arm Version: 0.6-$SUB_VERSION -Depends: task-opie-minimal, libopiecore2, libopieui2, libmailwrapper (>= 0.6) +Depends: task-opie-minimal, libopiecore2, libopieui2, libopiemm2, libmailwrapper (>= 0.6) Description: Opie's mail and news client (POP3, IMAP and NNTP) License: LGPL 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 @@ -1,13 +1,14 @@ #include "composemail.h" #include "viewmail.h" -/* OPIE */ #include #include #include +/* OPIE */ #include #include +#include #include #include @@ -18,6 +19,7 @@ #include #include #include +#include using namespace Opie::Ui; using namespace Opie::Core; @@ -213,6 +215,9 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int { menu->insertItem( tr( "Show Text" ), 1 ); } + if (item->text(0).left(6)=="image/") { + menu->insertItem(tr("Display image preview"),2); + } menu->insertItem( tr( "Save Attachment" ), 0 ); menu->insertSeparator(1); @@ -242,6 +247,23 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int } break ; + case 2: + { + QString tmpfile = "/tmp/opiemail-image"; + encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); + if (content) { + QFile output(tmpfile); + output.open(IO_WriteOnly); + output.writeBlock(content->Content(),content->Length()); + output.close(); + delete content; + MailImageDlg iview(""); + iview.setName(tmpfile); + QPEApplication::execDialog(&iview); + output.remove(); + } + } + break; case 1: if ( ( ( AttachItem* )item )->Partnumber() == -1 ) { @@ -478,3 +500,22 @@ void ViewMail::slotDeleteMail( ) deleted = true; } } + +MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, WFlags f) + : Opie::Ui::ODialog(parent,name,modal,f) +{ + QVBoxLayout*dlglayout = new QVBoxLayout(this); + dlglayout->setSpacing(2); + dlglayout->setMargin(1); + m_imageview = new Opie::MM::OImageScrollView(this); + dlglayout->addWidget(m_imageview); +} + +MailImageDlg::~MailImageDlg() +{ +} + +void MailImageDlg::setName(const QString&fname) +{ + m_imageview->setImage(fname); +} diff --git a/noncore/net/mail/viewmail.h b/noncore/net/mail/viewmail.h index b60fb8e..297836b 100644 --- a/noncore/net/mail/viewmail.h +++ b/noncore/net/mail/viewmail.h @@ -1,14 +1,17 @@ #ifndef VIEWMAIL_H #define VIEWMAIL_H +#include "viewmailbase.h" +#include + +#include + #include #include #include #include -#include "viewmailbase.h" -#include - +namespace Opie { namespace MM { class OImageScrollView; } } class AttachItem : public QListViewItem { @@ -69,4 +72,15 @@ private: QMap m_mail2; }; +class MailImageDlg:public Opie::Ui::ODialog +{ + Q_OBJECT +public: + MailImageDlg(const QString&,QWidget *parent = 0, const char *name = 0, bool modal = true, WFlags f = 0); + ~MailImageDlg(); + void setName(const QString&); +protected: + Opie::MM::OImageScrollView*m_imageview; +}; + #endif -- cgit v0.9.0.2