summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/viewmail.cpp46
-rw-r--r--noncore/net/mail/viewmail.h9
-rw-r--r--noncore/net/mail/viewmailbase.cpp26
-rw-r--r--noncore/net/mail/viewmailbase.h2
4 files changed, 64 insertions, 19 deletions
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp
index d2f1584..a64a168 100644
--- a/noncore/net/mail/viewmail.cpp
+++ b/noncore/net/mail/viewmail.cpp
@@ -251,7 +251,7 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
case 2:
{
- QString tmpfile = "/tmp/opiemail-image";
+ QString tmpfile = QString("/tmp/opiemail-image-%1").arg(_icounter++);
encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] );
- if (content) {
+ if (content && content->Length()) {
QFile output(tmpfile);
output.open(IO_WriteOnly);
@@ -259,8 +259,21 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int
output.close();
delete content;
- MailImageDlg iview("");
- iview.setName(tmpfile);
- QPEApplication::execDialog(&iview);
+ if (!m_PicsInline) {
+ MailImageDlg iview("");
+ iview.setName(tmpfile);
+ QPEApplication::execDialog(&iview);
+ } else {
+ if (!m_lastdlg) {
+ m_lastdlg=new Opie::MM::OImageScrollView("",browser->parentWidget(),false);
+ m_lastdlg->setAutoScale(true);
+ }
+ //m_lastdlg->setImage("");
+ m_lastdlg->setImage(tmpfile);
+ browser->hide();
+ m_lastdlg->show();
+ }
output.remove();
+ } else {
+ QMessageBox::critical(this, tr("Reading attachment"), tr("Could not read content of attachment"));
}
}
@@ -314,7 +327,10 @@ ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail() ) );
connect( showHtml, SIGNAL( toggled(bool) ), SLOT( slotShowHtml(bool) ) );
+ connect( showPicsInline, SIGNAL( toggled(bool) ), SLOT( slotImageInline(bool) ) );
attachments->setEnabled(m_gotBody);
connect( attachments, SIGNAL( clicked(QListViewItem*,const QPoint&, int) ), SLOT( slotItemClicked(QListViewItem*,const QPoint&, int) ) );
+ m_lastdlg = 0;
+ _icounter = 0;
readConfig();
@@ -322,4 +338,18 @@ ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
}
+void ViewMail::slotImageInline(bool how)
+{
+ Config cfg( "mail" );
+ cfg.writeEntry( "showPicsInline", how);
+ m_PicsInline = how;
+ if (m_lastdlg&&!how) {
+ browser->show();
+ m_lastdlg->hide();
+ m_lastdlg->reparent(0,QPoint(0,0),false);
+ delete m_lastdlg;
+ m_lastdlg = 0;
+ }
+}
+
void ViewMail::readConfig()
{
@@ -327,4 +357,6 @@ void ViewMail::readConfig()
cfg.setGroup( "Settings" );
m_showHtml = cfg.readBoolEntry( "showHtml", false );
+ m_PicsInline = cfg.readBoolEntry( "showPicsInline", true );
+ showPicsInline->setOn(m_PicsInline);
showHtml->setOn( m_showHtml );
}
@@ -337,4 +369,8 @@ void ViewMail::setText()
QString mailHtml;
+ if (m_lastdlg) {
+ m_lastdlg->hide();
+ }
+ browser->show();
for ( QStringList::Iterator it = ( m_mail2[0] ).begin(); it != ( m_mail2[0] ).end(); ++it )
{
diff --git a/noncore/net/mail/viewmail.h b/noncore/net/mail/viewmail.h
index 297836b..f5033f0 100644
--- a/noncore/net/mail/viewmail.h
+++ b/noncore/net/mail/viewmail.h
@@ -12,4 +12,6 @@
#include <qvaluelist.h>
+class MailImageDlg;
+
namespace Opie { namespace MM { class OImageScrollView; } }
@@ -49,4 +51,6 @@ protected:
AttachItem* lastChild(AttachItem*parent);
+ Opie::MM::OImageScrollView*m_lastdlg;
+
protected slots:
void slotReply();
@@ -56,4 +60,5 @@ protected slots:
void slotDeleteMail( );
void slotShowHtml( bool );
+ void slotImageInline(bool);
private:
@@ -65,5 +70,7 @@ private:
RecBodyP m_body;
RecMailP m_recMail;
- bool m_showHtml;
+ bool m_showHtml:1;
+ bool m_PicsInline:1;
+ unsigned int _icounter;
// 0 from 1 subject 2 bodytext 3 date
diff --git a/noncore/net/mail/viewmailbase.cpp b/noncore/net/mail/viewmailbase.cpp
index 49a0e6a..65ad0d6 100644
--- a/noncore/net/mail/viewmailbase.cpp
+++ b/noncore/net/mail/viewmailbase.cpp
@@ -6,4 +6,5 @@
#include <qtoolbar.h>
+#include <qlayout.h>
#include <qmenubar.h>
#include <qpe/resource.h>
@@ -22,8 +23,6 @@ ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl)
mailmenu = new QPopupMenu( menubar );
menubar->insertItem( tr( "Mail" ), mailmenu );
-
toolbar->setHorizontalStretchable(true);
addToolBar(toolbar);
-
QLabel *spacer = new QLabel(toolbar);
spacer->setBackgroundMode(QWidget::PaletteButton);
@@ -44,7 +43,12 @@ ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl)
- showHtml = new QAction( tr( "Show Html" ), QIconSet( Resource::loadPixmap( "mail/html" ) ), 0, 0, this, 0, true );
- showHtml->addTo( toolbar );
- showHtml->addTo( mailmenu );
+ showHtml = new QAction( tr( "Show Html" ), QIconSet( Resource::loadPixmap( "mail/html" ) ), 0, 0, this, 0, true );
+ showHtml->addTo( toolbar );
+ showHtml->addTo( mailmenu );
+
+ showPicsInline= new QAction(tr("Show image preview inline"), QIconSet(Resource::loadPixmap("pixmap")), 0, 0, this);
+ showPicsInline->setToggleAction(true);
+ showPicsInline->addTo(toolbar);
+ showPicsInline->addTo(mailmenu);
deleteMail = new QAction(tr("Delete Mail"), QIconSet(Resource::loadPixmap("trash")), 0, 0, this);
@@ -52,5 +56,7 @@ ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl)
deleteMail->addTo(mailmenu);
- QVBox *view = new QVBox(this);
+ QVBox * view = new QVBox(this);
+ view->setSpacing(1);
+ view->setMargin(0);
setCentralWidget(view);
@@ -64,12 +70,8 @@ ViewMailBase::ViewMailBase(QWidget *parent, const char *name, WFlags fl)
attachments->addColumn(tr("Size"), 80);
attachments->setSorting(-1);
- attachments->hide();
- //header = new QTextBrowser(view);
browser = new QTextBrowser(view);
-
-// openDiag = new OpenDiag(view);
-// openDiag->hide();
-
+ adjustSize();
+ attachments->hide();
}
diff --git a/noncore/net/mail/viewmailbase.h b/noncore/net/mail/viewmailbase.h
index 583b1f6..59179a4 100644
--- a/noncore/net/mail/viewmailbase.h
+++ b/noncore/net/mail/viewmailbase.h
@@ -20,5 +20,5 @@ public:
protected:
- QAction *reply, *forward, *attachbutton, *deleteMail, *showHtml;
+ QAction *reply, *forward, *attachbutton, *deleteMail, *showHtml,*showPicsInline;
QListView *attachments;
QToolBar *toolbar;