summaryrefslogtreecommitdiff
path: root/noncore
Side-by-side diff
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/mail.pro4
-rw-r--r--noncore/net/mail/opie-mail.control2
-rw-r--r--noncore/net/mail/viewmail.cpp43
-rw-r--r--noncore/net/mail/viewmail.h20
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
@@ -35,32 +35,32 @@ SOURCES = main.cpp \
selectstore.cpp \
selectsmtp.cpp \
nntpgroups.cpp \
nntpgroupsdlg.cpp
INTERFACES = editaccountsui.ui \
selectmailtypeui.ui \
imapconfigui.ui \
pop3configui.ui \
nntpconfigui.ui \
smtpconfigui.ui \
addresspickerui.ui \
composemailui.ui \
settingsdialogui.ui \
statuswidgetui.ui \
newmaildirui.ui \
selectstoreui.ui \
nntpgroupsui.ui
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
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
@@ -1,10 +1,10 @@
Package: opie-mail
Files: plugins/application/libopiemail.so* bin/opiemail apps/1Pim/mail.desktop pics/mail/*.png
Priority: optional
Section: opie/pim
Maintainer: Rajko Albrecht <alwin@handhelds.org>, Juergen Graf <jgf@handhelds.org>, Maximilian Reiß <harlekin@handhelds.org>
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,44 +1,46 @@
#include "composemail.h"
#include "viewmail.h"
-/* OPIE */
#include <libmailwrapper/settings.h>
#include <libmailwrapper/abstractmail.h>
#include <libmailwrapper/mailtypes.h>
+/* OPIE */
#include <opie2/odebug.h>
#include <opie2/ofiledialog.h>
+#include <opie2/oimagescrollview.h>
#include <qpe/config.h>
#include <qpe/qpeapplication.h>
/* QT */
#include <qtextbrowser.h>
#include <qmessagebox.h>
#include <qtextstream.h>
#include <qaction.h>
#include <qpopupmenu.h>
#include <qfile.h>
+#include <qlayout.h>
using namespace Opie::Ui;
using namespace Opie::Core;
AttachItem::AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
const QString&fsize,int num,const QValueList<int>&path)
: QListViewItem(parent,after),_partNum(num)
{
_path=path;
setText(0, mime);
setText(1, desc);
setText(2, file);
setText(3, fsize);
}
AttachItem::AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
const QString&fsize,int num,const QValueList<int>&path)
: QListViewItem(parent,after),_partNum(num)
{
_path=path;
setText(0, mime);
setText(1, desc);
setText(2, file);
setText(3, fsize);
@@ -192,77 +194,97 @@ void ViewMail::setBody(const RecBodyP&body )
void ViewMail::slotShowHtml( bool state )
{
m_showHtml = state;
setText();
}
void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int )
{
if (!item )
return;
if ( ( ( AttachItem* )item )->Partnumber() == -1 )
{
setText();
return;
}
QPopupMenu *menu = new QPopupMenu();
int ret=0;
if ( item->text( 0 ).left( 5 ) == "text/" || item->text(0)=="message/rfc822" )
{
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);
ret = menu->exec( point, 0 );
switch(ret)
{
case 0:
{
MimeTypes types;
types.insert( "all", "*" );
QString str = OFileDialog::getSaveFileName( 1,
"/", item->text( 2 ) , types, 0 );
if( !str.isEmpty() )
{
encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] );
if (content)
{
QFile output(str);
output.open(IO_WriteOnly);
output.writeBlock(content->Content(),content->Length());
output.close();
delete content;
}
}
}
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 )
{
setText();
}
else
{
if ( m_recMail->Wrapper() != 0l )
{ // make sure that there is a wrapper , even after delete or simular actions
browser->setText( m_recMail->Wrapper()->fetchTextPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ) );
}
}
break;
}
delete menu;
}
void ViewMail::setMail(const RecMailP&mail )
{
m_recMail = mail;
m_mail[0] = mail->getFrom();
@@ -457,24 +479,43 @@ void ViewMail::slotForward()
ftext += QString("\n%1\n")
.arg( m_mail[2]);
ftext += QString("----- End forwarded message -----\n");
Settings *settings = new Settings();
ComposeMail composer( settings ,this, 0, true);
composer.setSubject( "Fwd: " + m_mail[1] );
composer.setMessage( ftext );
if ( QDialog::Accepted == QPEApplication::execDialog( &composer ))
{
}
}
void ViewMail::slotDeleteMail( )
{
if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + m_mail[0] + " - " + m_mail[1] ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes )
{
m_recMail->Wrapper()->deleteMail( m_recMail );
hide();
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,35 +1,38 @@
#ifndef VIEWMAIL_H
#define VIEWMAIL_H
+#include "viewmailbase.h"
+#include <libmailwrapper/mailtypes.h>
+
+#include <opie2/odialog.h>
+
#include <qlistview.h>
#include <qmap.h>
#include <qstringlist.h>
#include <qvaluelist.h>
-#include "viewmailbase.h"
-#include <libmailwrapper/mailtypes.h>
-
+namespace Opie { namespace MM { class OImageScrollView; } }
class AttachItem : public QListViewItem
{
public:
AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
const QString&fsize,int num,const QValueList<int>&path);
AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file,
const QString&fsize,int num,const QValueList<int>&path);
int Partnumber() { return _partNum; }
bool isParentof(const QValueList<int>&path);
private:
int _partNum;
/* needed for a better display of attachments */
QValueList<int> _path;
};
class ViewMail : public ViewMailBase
{
Q_OBJECT
public:
ViewMail( QWidget *parent = 0, const char *name = 0, WFlags fl = 0);
~ViewMail();
@@ -48,25 +51,36 @@ protected:
protected slots:
void slotReply();
void slotForward();
void setText();
void slotItemClicked( QListViewItem * item , const QPoint & point, int c );
void slotDeleteMail( );
void slotShowHtml( bool );
private:
void readConfig();
bool _inLoop;
QString m_mailHtml;
bool m_gotBody;
RecBodyP m_body;
RecMailP m_recMail;
bool m_showHtml;
// 0 from 1 subject 2 bodytext 3 date
QMap <int,QString> m_mail;
// 0 to 1 cc 2 bcc
QMap <int,QStringList> 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