summaryrefslogtreecommitdiff
path: root/noncore/net/mail/viewmail.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/mail/viewmail.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/mail/viewmail.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp
index d86454c..e11fe1f 100644
--- a/noncore/net/mail/viewmail.cpp
+++ b/noncore/net/mail/viewmail.cpp
@@ -3,12 +3,14 @@
#include <qtextstream.h>
#include <qaction.h>
#include <qpopupmenu.h>
#include <qfile.h>
#include <qapplication.h>
+#include <qpe/config.h>
+
#include <opie/ofiledialog.h>
#include "settings.h"
#include "composemail.h"
#include "viewmail.h"
#include "abstractmail.h"
@@ -106,12 +108,18 @@ for (unsigned int i = 0; i < body.Parts().count();++i) {
o << s << " " << q << "Byte";
desc = body.Parts()[i].Description();
curItem=new AttachItem(attachments,curItem,type,desc,filename,fsize,i);
}
}
+
+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();
@@ -186,19 +194,28 @@ ViewMail::ViewMail( QWidget *parent, const char *name, WFlags fl)
m_gotBody = false;
deleted = false;
connect(reply, SIGNAL(activated()), SLOT(slotReply()));
connect(forward, SIGNAL(activated()), SLOT(slotForward()));
connect( deleteMail, SIGNAL( activated() ), SLOT( slotDeleteMail( ) ) );
+ connect( showHtml, SIGNAL( toggled( bool ) ), SLOT( slotShowHtml( bool ) ) );
attachments->setEnabled(m_gotBody);
connect( attachments, SIGNAL( clicked ( QListViewItem *, const QPoint & , int ) ), SLOT( slotItemClicked( QListViewItem *, const QPoint & , int ) ) );
+ readConfig();
}
+void ViewMail::readConfig() {
+ Config cfg( "mail" );
+ cfg.setGroup( "Settings" );
+ m_showHtml = cfg.readBoolEntry( "showHtml", false );
+ showHtml->setOn( m_showHtml );
+}
+
void ViewMail::setText()
{
QString toString;
QString ccString;
QString bccString;
@@ -222,13 +239,17 @@ void ViewMail::setText()
"<b>" + tr( "From" ) + ": </b><font color=#6C86C0>" + deHtml( m_mail[0] ) + "</font><br>"
"<b>" + tr( "To" ) + ": </b><font color=#6C86C0>" + deHtml( toString ) + "</font><br><b>" +
tr( "Cc" ) + ": </b>" + deHtml( ccString ) + "<br>"
"<b>" + tr( "Date" ) + ": </b> " + m_mail[3] +
"</td></tr></table><font face=fixed>";
+ if ( !m_showHtml ) {
browser->setText( QString( m_mailHtml) + deHtml( m_mail[2] ) + "</font></html>" );
+ } else {
+ browser->setText( QString( m_mailHtml) + m_mail[2] + "</font></html>" );
+ }
// remove later in favor of a real handling
m_gotBody = true;
}
ViewMail::~ViewMail()