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 | |
parent | 1b8fac62de40773977e9b3e800cf22cc42603ced (diff) | |
download | opie-6439d07d42e10b0804a3a31fdfd6645b36d2fad5.zip opie-6439d07d42e10b0804a3a31fdfd6645b36d2fad5.tar.gz opie-6439d07d42e10b0804a3a31fdfd6645b36d2fad5.tar.bz2 |
opiemail now displays images send with mail
-rw-r--r-- | noncore/net/mail/mail.pro | 4 | ||||
-rw-r--r-- | noncore/net/mail/opie-mail.control | 2 | ||||
-rw-r--r-- | noncore/net/mail/viewmail.cpp | 43 | ||||
-rw-r--r-- | noncore/net/mail/viewmail.h | 20 |
4 files changed, 62 insertions, 7 deletions
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 | |||
@@ -53,14 +53,14 @@ INTERFACES = editaccountsui.ui \ | |||
53 | 53 | ||
54 | 54 | ||
55 | INCLUDEPATH += $(OPIEDIR)/include /usr/local/include | 55 | INCLUDEPATH += $(OPIEDIR)/include /usr/local/include |
56 | 56 | ||
57 | CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX ) | 57 | CONFTEST = $$system( echo $CONFIG_TARGET_MACOSX ) |
58 | contains( CONFTEST, y ){ | 58 | contains( CONFTEST, y ){ |
59 | LIBS += -lqpe -lopieui2 -lopiecore2 -lopiepim2 -lmailwrapper -liconv | 59 | LIBS += -lqpe -lopieui2 -lopiecore2 -lopiepim2 -lmailwrapper -liconv -lopiemm2 |
60 | }else{ | 60 | }else{ |
61 | LIBS += -lqpe -lopieui2 -lopiecore2 -lopiepim2 -lmailwrapper | 61 | LIBS += -lqpe -lopieui2 -lopiecore2 -lopiepim2 -lmailwrapper -lopiemm2 |
62 | } | 62 | } |
63 | 63 | ||
64 | TARGET = opiemail | 64 | TARGET = opiemail |
65 | 65 | ||
66 | include ( $(OPIEDIR)/include.pro ) | 66 | include ( $(OPIEDIR)/include.pro ) |
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 | |||
@@ -2,9 +2,9 @@ Package: opie-mail | |||
2 | Files: plugins/application/libopiemail.so* bin/opiemail apps/1Pim/mail.desktop pics/mail/*.png | 2 | Files: plugins/application/libopiemail.so* bin/opiemail apps/1Pim/mail.desktop pics/mail/*.png |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/pim | 4 | Section: opie/pim |
5 | Maintainer: Rajko Albrecht <alwin@handhelds.org>, Juergen Graf <jgf@handhelds.org>, Maximilian Reiß <harlekin@handhelds.org> | 5 | Maintainer: Rajko Albrecht <alwin@handhelds.org>, Juergen Graf <jgf@handhelds.org>, Maximilian Reiß <harlekin@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: 0.6-$SUB_VERSION | 7 | Version: 0.6-$SUB_VERSION |
8 | Depends: task-opie-minimal, libopiecore2, libopieui2, libmailwrapper (>= 0.6) | 8 | Depends: task-opie-minimal, libopiecore2, libopieui2, libopiemm2, libmailwrapper (>= 0.6) |
9 | Description: Opie's mail and news client (POP3, IMAP and NNTP) | 9 | Description: Opie's mail and news client (POP3, IMAP and NNTP) |
10 | License: LGPL | 10 | 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,26 +1,28 @@ | |||
1 | #include "composemail.h" | 1 | #include "composemail.h" |
2 | #include "viewmail.h" | 2 | #include "viewmail.h" |
3 | 3 | ||
4 | /* OPIE */ | ||
5 | #include <libmailwrapper/settings.h> | 4 | #include <libmailwrapper/settings.h> |
6 | #include <libmailwrapper/abstractmail.h> | 5 | #include <libmailwrapper/abstractmail.h> |
7 | #include <libmailwrapper/mailtypes.h> | 6 | #include <libmailwrapper/mailtypes.h> |
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> |
12 | #include <qpe/qpeapplication.h> | 13 | #include <qpe/qpeapplication.h> |
13 | 14 | ||
14 | /* QT */ | 15 | /* QT */ |
15 | #include <qtextbrowser.h> | 16 | #include <qtextbrowser.h> |
16 | #include <qmessagebox.h> | 17 | #include <qmessagebox.h> |
17 | #include <qtextstream.h> | 18 | #include <qtextstream.h> |
18 | #include <qaction.h> | 19 | #include <qaction.h> |
19 | #include <qpopupmenu.h> | 20 | #include <qpopupmenu.h> |
20 | #include <qfile.h> | 21 | #include <qfile.h> |
22 | #include <qlayout.h> | ||
21 | 23 | ||
22 | using namespace Opie::Ui; | 24 | using namespace Opie::Ui; |
23 | using namespace Opie::Core; | 25 | using namespace Opie::Core; |
24 | 26 | ||
25 | AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, | 27 | AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, |
26 | const QString&fsize,int num,const QValueList<int>&path) | 28 | const QString&fsize,int num,const QValueList<int>&path) |
@@ -210,12 +212,15 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int | |||
210 | int ret=0; | 212 | int ret=0; |
211 | 213 | ||
212 | if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" ) | 214 | if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" ) |
213 | { | 215 | { |
214 | menu->insertItem( tr( "Show Text" ), 1 ); | 216 | menu->insertItem( tr( "Show Text" ), 1 ); |
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 ); |
217 | menu->insertSeparator(1); | 222 | menu->insertSeparator(1); |
218 | 223 | ||
219 | ret = menu->exec( point, 0 ); | 224 | ret = menu->exec( point, 0 ); |
220 | 225 | ||
221 | switch(ret) | 226 | switch(ret) |
@@ -239,12 +244,29 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int | |||
239 | delete content; | 244 | delete content; |
240 | } | 245 | } |
241 | } | 246 | } |
242 | } | 247 | } |
243 | break ; | 248 | break ; |
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: |
246 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) | 268 | if ( ( ( AttachItem* )item )->Partnumber() == -1 ) |
247 | { | 269 | { |
248 | setText(); | 270 | setText(); |
249 | } | 271 | } |
250 | else | 272 | else |
@@ -475,6 +497,25 @@ void ViewMail::slotDeleteMail( ) | |||
475 | { | 497 | { |
476 | m_recMail->Wrapper()->deleteMail( m_recMail ); | 498 | m_recMail->Wrapper()->deleteMail( m_recMail ); |
477 | hide(); | 499 | hide(); |
478 | deleted = true; | 500 | deleted = true; |
479 | } | 501 | } |
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 | } | ||
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,17 +1,20 @@ | |||
1 | #ifndef VIEWMAIL_H | 1 | #ifndef VIEWMAIL_H |
2 | #define VIEWMAIL_H | 2 | #define VIEWMAIL_H |
3 | 3 | ||
4 | #include "viewmailbase.h" | ||
5 | #include <libmailwrapper/mailtypes.h> | ||
6 | |||
7 | #include <opie2/odialog.h> | ||
8 | |||
4 | #include <qlistview.h> | 9 | #include <qlistview.h> |
5 | #include <qmap.h> | 10 | #include <qmap.h> |
6 | #include <qstringlist.h> | 11 | #include <qstringlist.h> |
7 | #include <qvaluelist.h> | 12 | #include <qvaluelist.h> |
8 | 13 | ||
9 | #include "viewmailbase.h" | 14 | namespace Opie { namespace MM { class OImageScrollView; } } |
10 | #include <libmailwrapper/mailtypes.h> | ||
11 | |||
12 | 15 | ||
13 | class AttachItem : public QListViewItem | 16 | class AttachItem : public QListViewItem |
14 | { | 17 | { |
15 | public: | 18 | public: |
16 | AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, | 19 | AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, |
17 | const QString&fsize,int num,const QValueList<int>&path); | 20 | const QString&fsize,int num,const QValueList<int>&path); |
@@ -66,7 +69,18 @@ private: | |||
66 | // 0 from 1 subject 2 bodytext 3 date | 69 | // 0 from 1 subject 2 bodytext 3 date |
67 | QMap <int,QString> m_mail; | 70 | QMap <int,QString> m_mail; |
68 | // 0 to 1 cc 2 bcc | 71 | // 0 to 1 cc 2 bcc |
69 | QMap <int,QStringList> m_mail2; | 72 | QMap <int,QStringList> m_mail2; |
70 | }; | 73 | }; |
71 | 74 | ||
75 | class MailImageDlg:public Opie::Ui::ODialog | ||
76 | { | ||
77 | Q_OBJECT | ||
78 | public: | ||
79 | MailImageDlg(const QString&,QWidget *parent = 0, const char *name = 0, bool modal = true, WFlags f = 0); | ||
80 | ~MailImageDlg(); | ||
81 | void setName(const QString&); | ||
82 | protected: | ||
83 | Opie::MM::OImageScrollView*m_imageview; | ||
84 | }; | ||
85 | |||
72 | #endif | 86 | #endif |