summaryrefslogtreecommitdiff
path: root/noncore/net/mail/viewmail.cpp
authoralwin <alwin>2004-04-14 22:36:20 (UTC)
committer alwin <alwin>2004-04-14 22:36:20 (UTC)
commit6439d07d42e10b0804a3a31fdfd6645b36d2fad5 (patch) (unidiff)
tree07ff558875de1ebe8235badaa3cab4205fa82089 /noncore/net/mail/viewmail.cpp
parent1b8fac62de40773977e9b3e800cf22cc42603ced (diff)
downloadopie-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.cpp43
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
@@ -1,13 +1,14 @@
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
@@ -18,6 +19,7 @@
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
22using namespace Opie::Ui; 24using namespace Opie::Ui;
23using namespace Opie::Core; 25using namespace Opie::Core;
@@ -213,6 +215,9 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
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
@@ -242,6 +247,23 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
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 {
@@ -478,3 +500,22 @@ void ViewMail::slotDeleteMail( )
478 deleted = true; 500 deleted = true;
479 } 501 }
480} 502}
503
504MailImageDlg::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
514MailImageDlg::~MailImageDlg()
515{
516}
517
518void MailImageDlg::setName(const QString&fname)
519{
520 m_imageview->setImage(fname);
521}